Skip to content

feat(lathe): add __lathe verify for generated CLI contract validation#86

Merged
samzong merged 1 commit into
mainfrom
feat/verify-cli-contract
Jul 1, 2026
Merged

feat(lathe): add __lathe verify for generated CLI contract validation#86
samzong merged 1 commit into
mainfrom
feat/verify-cli-contract

Conversation

@samzong

@samzong samzong commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What's changed?

  • Add hidden __lathe verify --json command that validates generated CLI contract locally without network calls
  • Check root help, catalog schema version, JSON marshalability, commands show parity, required flags/body inputs, and unauthenticated auth status behavior
  • Add silentExitError in runtime so verify can emit JSON to stdout and exit non-zero without duplicating error output on stderr
  • Document the verify step in README and CLI usage agent workflow

Why

  • Agents need a fast, offline gate after building a generated CLI to confirm catalog/help/auth contracts before live API calls
  • Verify failures should return structured JSON on stdout for machine inspection while keeping stderr clean

Verification

go test ./pkg/lathe/... ./pkg/runtime/... -count=1
go vet ./pkg/lathe/... ./pkg/runtime/...

Considered and deferred

  • pkg/lathe/verify.go:54 [BOT-NIT]: --json flag is documented for agents but verify always emits JSON; flag exists for contract discoverability only.
  • pkg/lathe/verify.go:171 [BOT-TASTE]: isJSONBody treats empty media type as JSON, matching OpenAPI default body semantics.

Add a hidden __lathe verify --json command that checks root help, catalog
schema, commands show parity, required flags, and auth status behavior
without network calls. Support silent exit codes for verify failures.

## Considered and deferred

- pkg/lathe/verify.go:54 [BOT-NIT]: --json flag is documented for agents but verify always emits JSON; flag exists for contract discoverability only.
- pkg/lathe/verify.go:171 [BOT-TASTE]: isJSONBody treats empty media type as JSON, matching OpenAPI default body semantics.

Signed-off-by: samzong <samzong.lu@gmail.com>
@samzong samzong merged commit 6717674 into main Jul 1, 2026
3 checks passed
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