Skip to content

spec: roll up to Agent CLI Guidelines v0.4.0 - #1

Merged
rnwolfe merged 2 commits into
mainfrom
spec-rollout/v0.4.0
Jun 25, 2026
Merged

spec: roll up to Agent CLI Guidelines v0.4.0#1
rnwolfe merged 2 commits into
mainfrom
spec-rollout/v0.4.0

Conversation

@rnwolfe

@rnwolfe rnwolfe commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Rolls knit up to Agent CLI Guidelines v0.4.0 and promotes conformance from Core → Full.

Per-rule checklist

  • §5 Machine-readable conformanceschema --json now includes a conformance block: {spec: "agent-cli-guidelines", version: version.Spec, level: "Full"}. An agent (or fleet-audit) can verify the contract version from the binary, not a README badge.
  • §5 / §11 version --check — pull-based, fail-silent latest-release check against GitHub Releases (3s timeout; KNIT_RELEASES_URL override for tests). Reports the upgrade command; never self-mutates. Dev/source builds never nag.
  • Full conformance promotion — README badge and conformance statement bumped from Core (v0.3.0) to Full (v0.4.0).
  • const Spec = "0.4.0" added to the version package.
  • Schema golden snapshot regenerated (testdata/schema.golden.json) to include the new conformance block and version --check flag.
  • CHANGELOG [Unreleased] updated.
  • No backpressure added — backend is an official/structured API.

Verification

  • go build ./... — clean.
  • go test ./...23 passed across 8 packages (golden snapshot updated, then green).
  • knit schema emits {"level":"Full","spec":"agent-cli-guidelines","version":"0.4.0"}.
  • knit version --check against an unreachable URL returns a graceful note (fail-silent, no error).

🤖 Generated with Claude Code

Add machine-readable conformance block to schema, add version --check
(fail-silent GitHub Releases poll), and bump conformance from Core to Full.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012UFrhC6bXVpoiiL3yhj2HH
Copilot AI review requested due to automatic review settings June 25, 2026 19:41
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
knit Ready Ready Preview, Comment Jun 25, 2026 8:03pm
knit-docs Ready Ready Preview, Comment Jun 25, 2026 8:03pm

Request Review

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

Rolls knit forward to Agent CLI Guidelines v0.4.0 and promotes declared conformance from Core → Full, including machine-readable conformance in schema output and a pull-based version --check upgrade check.

Changes:

  • Add a conformance block to knit schema JSON output (spec/version/level).
  • Add knit version --check to (fail-silently) check GitHub Releases for updates and report an upgrade command.
  • Update README badge/statement and CHANGELOG to reflect v0.4.0 (Full); regenerate schema golden snapshot.

Reviewed changes

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

Show a summary per file
File Description
README.md Updates conformance badge and declared guidelines level/version.
internal/version/version.go Introduces guidelines spec constant and implements latest-release lookup + upgrade hint helpers.
internal/cli/testdata/schema.golden.json Updates schema snapshot to include the new conformance block and version --check flag.
internal/cli/misc.go Adds schema.conformance and implements version --check output.
CHANGELOG.md Records the new schema conformance block and version --check behavior under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cli/misc.go Outdated
Comment thread internal/version/version.go Outdated
Comment on lines +62 to +65
// Latest returns the latest released version tag (from GitHub Releases by default).
// Network, short timeout, **fail-silent**: returns ("", err) on any problem so a
// `version --check` never errors or blocks an agent loop. The release source can be
// overridden with KNIT_RELEASES_URL (used in tests).
Comment thread internal/version/version.go Outdated
Comment on lines +54 to +60
// UpgradeHint returns the recommended upgrade command for this tool.
func UpgradeHint() string {
if slug := repoSlug(); slug != "" {
return "go install github.com/" + slug + "@latest"
}
return ""
}
Comment thread internal/cli/misc.go
Comment on lines +25 to +29
"tool": "knit",
"version": version.String(),
"conformance": map[string]any{
"spec": "agent-cli-guidelines", "version": version.Spec, "level": "Full",
},
Comment thread internal/cli/misc.go
Comment on lines 99 to +103
func (c *VersionCmd) Run(rt *Runtime) error {
return rt.Out.Emit(map[string]any{"version": version.String()})
cur := version.String()
if !c.Check {
return rt.Out.Emit(map[string]any{"version": cur})
}
- version --check: use rt.Ctx instead of context.Background() for
  cancellation/timeout propagation.
- internal/version: add User-Agent header to Latest() (GitHub REST rejects
  no-UA requests); fix UpgradeHint to .../cmd/knit@latest (bare module path
  has no root main and would fail); reword KNIT_RELEASES_URL comment.
- Add version --check tests (httptest + KNIT_RELEASES_URL): success +
  fail-silent.
- docs: document the version command (incl. --check) and the schema
  conformance block in reference/commands.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012UFrhC6bXVpoiiL3yhj2HH
@rnwolfe

rnwolfe commented Jun 25, 2026

Copy link
Copy Markdown
Owner Author

Addressed the Copilot review (a6a8467):

  • version --check context — now uses rt.Ctx instead of context.Background() so cancellation/timeouts propagate through the Runtime.
  • User-Agentinternal/version.Latest() now sets a User-Agent header (GitHub's REST API rejects UA-less requests).
  • UpgradeHint — fixed to go install github.com/<owner>/<repo>/cmd/knit@latest; the bare module path had no root main and would fail.
  • "used in tests" comment — reworded; the env var is now actually exercised by tests.
  • Tests — added TestVersionCheck (httptest + KNIT_RELEASES_URL) and TestVersionCheckFailSilent, locking in the JSON shape and fail-silent semantics. go test ./... → 25 passed.
  • Docs — documented the version command (incl. --check) and the schema.conformance block in reference/commands.md; site build green.

go build ./... clean, go test ./... green, docs site builds.

@rnwolfe
rnwolfe merged commit 107e64f into main Jun 25, 2026
4 checks passed
@rnwolfe
rnwolfe deleted the spec-rollout/v0.4.0 branch June 25, 2026 20:14
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.

2 participants