feat(agents): grants — the per-agent credential attach surface - #102
Merged
Conversation
Aligns the CLI with the server's attach model: per-agent access is now written as grants (attach a connection or secret to an agent, optionally with per-tool --allow/--ask lists) instead of secret modes, assignment lists, and project-scope policy rules. - new: 'agents grants list|attach-connection|detach-connection| attach-secret|detach-secret', 'apps connections grants', and 'agents list --with-grants' - internal/api: the grants client (doProject + PathEscape; custom grants always send both arrays; the secret attach is a no-body PUT; detaches are 204) - retirement pass: the legacy 'rules'/'org rules' families, 'org settings', 'agents secrets|set-secrets|set-secret-mode|granular-access| connections', and all project-scope 'policy' writes now say RETIRED in every help surface, each pointing at its replacement; the 410 action hint splits project (grants) from org (org policy) - help_test.go: two-direction drift test pinning help.go to the live Kong tree, plus RETIRED-marker parity across both help surfaces - README + skills/onecli/SKILL.md: grants workflow, grant invariants, and the gateway's multi-account 409 protocol Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Aligns the CLI with the server's attach model: per-agent access is now written as grants — attach an app connection or secret to an agent, optionally naming per-tool
--allow/--asklists — replacing secret modes, assignment lists, and project-scope policy rules.New surface
--allow/--askderive a custom grant (--jsontakes the raw wire body, XOR with the flags).null); the secret attach is a no-body PUT; detaches handle the bare204.agents credentials/apps connections agent-accessstay the effective views with organization guardrails applied.Retirement pass
Every retired family now says RETIRED in every help surface, each pointing at its replacement: the legacy
rules/org rulesfamilies,org settings,agents secrets|set-secrets|set-secret-mode|granular-access|connections, and all project-scopepolicywrites (project rules are compiled from grants on updated servers). The commands keep calling — pre-cutover self-hosted servers still serve them — and the 410 action hint now splits project (grants) from org (org policy).Tests
internal/api/grants_test.go: table-driven httptest coverage — canonical paths, exact wire bodies (incl. the non-empty-array pin), the no-body PUT, 204 handling, X-Project-Id, 422 message passthrough.cmd/onecli/grants_test.go: the flag→body derivation matrix.cmd/onecli/help_test.go(first-ever coverage of help.go): a two-direction drift test pinning the hand-maintainedonecli helplist to the live Kong tree, plus RETIRED-marker parity between the two help surfaces. It caught real drift on its first run.Server dependency
The grants API is live on OneCLI Cloud today (shipped via onecli/onecli-cloud#743 and the preceding attach-model PRs). OSS servers gain the surface with the next OSS sync — until then the new commands 404 against OSS builds, and the retired commands still work there.
Siblings: SDK onecli/node-sdk#56 · docs onecli/onecli-docs#11 (docs merges last).
Review
Full
/review-change: hunk-by-hunk self-review, a 36-skill walk (10 applied:agent-first-cli,golang-patterns,golang-pro,typescript-pro,typescript-advanced-types,cloud-development,sync-app-docs,seo-audit,ai-artifact-review,find-skills), a field-by-field cross-repo contract check against the live routes, and an adversarial sweep. CLI-side fixes from review: two help pointers corrected (org policy default set --action).Gates:
go build·go test ./...·-race·golangci-lint(0 issues) ·gofmt— all green.Follow-ups (not this PR)
do()todoProject(X-Project-Id for project keys everywhere).cmd/onecli/skill_gateway_fallback.md's 409 section lands in lockstep with the cloud-served/v1/skill/gatewaycopy.🤖 Generated with Claude Code