Skip to content

feat(tok): add hawk tok command + production-readiness hardening#13

Merged
Patel230 merged 4 commits into
mainfrom
feat/hawk-tok-command
Jun 7, 2026
Merged

feat(tok): add hawk tok command + production-readiness hardening#13
Patel230 merged 4 commits into
mainfrom
feat/hawk-tok-command

Conversation

@Patel230

@Patel230 Patel230 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds hawk tok so token compression/estimation/secret-scanning works through the hawk CLI (no standalone tok binary), plus production-readiness hardening.

Changes

  • cmd/tok.go (new): hawk tok compress (prose/prompt or --budget pipeline), hawk tok estimate (tokens + cost), hawk tok scan (detect/--redact secrets). Input via --input/arg/stdin, --format text|json. Wraps the embedded tok library directly.
  • ci.yml: pin govulncheck, drop --disable=noctx, coverage 60%, add fuzz.
  • docker.yml: SHA-pin actions, QEMU + multi-arch, Trivy image scan. release.yml: pin goreleaser.
  • scorecard.yml: add OSSF Scorecard. .goreleaser.yml: add SBOM.
  • Dockerfile: alpine:3.21, replace go.mod mutation with go work init.
  • cmd/{inspect,sight}.go: os.Exit → return error. cmd/errors.go: document intentional os.Exit sites. go.mod: go 1.26.4.
  • external/*: pin submodules to current upstream main SHAs.

Verification

build ✓ · vet ✓ · golangci-lint 0 issues ✓ · go test ./cmd/... green ✓ · hawk tok smoke-tested against upstream tok.

🤖 Generated with Claude Code

Patel230 and others added 4 commits June 6, 2026 19:43
Expose the embedded tok library through the hawk CLI so token
compression, estimation, and secret scanning work via `hawk tok`
with no standalone tok binary — matching how every other ecosystem
tool is surfaced (hawk yaad, hawk models, hawk inspect/sight/trace).

- compress: prose/prompt compression (--intensity lite/full/ultra) or
  token-budget pipeline (--budget), with optional --stats
- estimate: token count + per-model cost (--model)
- scan: detect secrets (non-zero exit for CI gating) or --redact
- input via --input <file>, trailing arg, or stdin; --format text|json

Wraps existing tok.* functions directly (no bridge package needed —
hawk already imports tok in internal/engine/token). Makes the
"provided via Hawk" references in tok's docs accurate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CI/CD, container, and release hardening for the hawk repo:
- ci.yml: pin govulncheck, drop --disable=noctx, raise coverage to 60%,
  add fuzz job
- docker.yml: SHA-pin all docker actions, add QEMU + multi-arch build,
  Trivy image scan
- release.yml: pin goreleaser version
- scorecard.yml: add OSSF Scorecard workflow
- .goreleaser.yml: add SBOM (spdx) generation
- Dockerfile: alpine:3.21, replace go.mod mutation with `go work init`
- cmd/{inspect,sight}.go: os.Exit -> return error (RunE)
- cmd/errors.go: document intentional os.Exit sites
- go.mod: go 1.26.3 -> 1.26.4

Pin external/* submodules to their current origin/main SHAs (all
published, fast-forwarded from stale local checkouts).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The pinned SHAs for gosec / trivy-action / docker-* actions were
invalid (not reachable refs), breaking CI. Repin to the exact commits
behind their release tags (gosec v2.22.4, trivy v0.28.0,
metadata v5.7.0, buildx v3.10.0, qemu v3.6.0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
v0.28.0 pulled a yanked setup-trivy@v0.2.1, breaking the image scan.
v0.36.0 pins a valid setup-trivy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Patel230 Patel230 merged commit b2f3272 into main Jun 7, 2026
17 of 18 checks passed
@Patel230 Patel230 deleted the feat/hawk-tok-command branch June 7, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant