Skip to content

feat: add JSON verifier output - #27

Merged
shreyanshjain7174 merged 1 commit into
mainfrom
feat/verifier-json-output
Aug 29, 2026
Merged

feat: add JSON verifier output#27
shreyanshjain7174 merged 1 commit into
mainfrom
feat/verifier-json-output

Conversation

@shreyanshjain7174

Copy link
Copy Markdown
Contributor

Closes #13.

What changed:

  • Adds --format text|json to agentgate-verify, retaining text as the default.
  • JSON output is exactly one safe result object with verification counts, result state, stable mismatch reason, full head hash on success, completeness, and export range when present.
  • Preserves exit codes: 0 pass, 1 mismatch, 2 input/config error.
  • Documents --format json beside the standalone verifier command.

Verification:

  • go test ./cmd/agentgate-verify -race -count=1
  • go test ./... -race -count=1
  • go vet ./...
  • gofmt -l cmd/agentgate-verify/main.go cmd/agentgate-verify/main_test.go
  • git diff --check

All passed locally.

Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
@shreyanshjain7174
shreyanshjain7174 requested a lite review from Copilot August 29, 2026 17:02
@shreyanshjain7174
shreyanshjain7174 merged commit 8022c9b into main Aug 29, 2026
2 checks passed
@shreyanshjain7174
shreyanshjain7174 deleted the feat/verifier-json-output branch August 29, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a machine-readable JSON output mode to agentgate-verify. This helps CI and auditor tooling consume verification results without parsing text.

Changes:

  • Adds --format text|json flag to cmd/agentgate-verify and emits a single JSON result object on stdout when json is selected.
  • Documents --format json in the README verifier section.
  • Adds tests for JSON output, default text equivalence, and invalid format handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Mentions --format json for script-friendly verifier output.
cmd/agentgate-verify/main.go Adds --format flag, JSON result struct, and JSON encoder output path.
cmd/agentgate-verify/main_test.go Adds coverage for JSON output success and mismatch cases, plus format validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +148 to +152
rangeKind := ""
if manifest != nil {
if manifest.ResolvedTo == manifest.HeadSeq {
rangeKind = "full"
} else {
TotalReceipts int `json:"total_receipts"`
VerifiedCount int `json:"verified_count"`
FailedAtSeq uint64 `json:"failed_at_seq,omitempty"`
Reason string `json:"reason,omitempty"`
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.

agentgate-verify: add a --format json output option

2 participants