Repository navigation
feat: agent-first JSON output contract - #7
Merged
Merged
Conversation
jordanpartridge
force-pushed
the
cursor/agent-json-contract-6412
branch
from
September 10, 2026 05:54
195f4dc to
1590c5c
Compare
There was a problem hiding this comment.
Blocking: TunnelCreateCommand duplicates getConnector instead of extending InteractsWithCloudflare.
- The alias hack on line 9 of TunnelCreateCommand.php creates two implementations of connector lookup.
- Other commands still rely on the trait; this divergence will drift.
- Tests cover the happy path but not the new cancellation JSON case in tunnel:delete.
- Minor: several getConnector signatures now return ?CloudflareConnector but callers only check null after the call; consistent with the new flow.
There was a problem hiding this comment.
TunnelListCommand now duplicates getConnector instead of using InteractsWithCloudflare (or the new trait). The rest of the JSON envelope contract, null-guard pattern, and tests look consistent.
- One duplication to clean up before merging.
- No blocking correctness issues.
Contributor
Author
|
Addressed the blocking review on 74b2192:
|
Add OutputsJson concern with {"ok":true,"data":...} / {"ok":false,"error":"..."}
envelopes on stdout, apply across zones/dns/tunnel commands, document the
contract, add Pest coverage with Saloon mocks, and wire PHP 8.3 CI.
Co-authored-by: Jordan Partridge <jordan@partridge.rocks>
Human mode still prints create-time token and cloudflared run steps after rebasing onto tunnel:expose.
Drop the getConnector alias on tunnel:create. Trait now returns null instead of exit(1) so --json can emit the envelope. Cover cancelled tunnel:delete JSON.
Prove --json --no-interaction returns {ok:true,data:{deleted:false,cancelled:true}} as JSON, not substring matches.
jordanpartridge
added a commit
that referenced
this pull request
Sep 10, 2026
Research seat. Commands + Saloon PUT overwrite. Raw --json, not the #7 envelope. Keep tunnel:expose README. Do not merge.
--json stdout is {ok,data} / {ok,error} exit 0/1.
InteractsWithCloudflare + OutputsJson; no CloudflareCommand; no exit(1).
Missing token must be CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID must be set. Cancelled tunnel:delete --json --no-interaction stays ok:true exit 0. tunnel:expose --json wraps the existing object so token/url toContain stays green.
Drop duplicated getConnector on zones, dns, and tunnel:list. Wrap tunnel:expose --json in the agent envelope. getConnector stays nullable and never exits. Human tunnel:create still prints the create-time token.
jordanpartridge
force-pushed
the
cursor/agent-json-contract-6412
branch
from
September 10, 2026 13:40
74b2192 to
9124ed1
Compare
There was a problem hiding this comment.
Ship it.
- One minor inconsistency flagged inline (TunnelDeleteCommand declares
--jsonin signature; others do not). - No
exit()calls remain, missing-creds path now returnsFAILUREcleanly, envelope contract matches spec and tests. - All commands use both traits, raw
json_encodepaths removed, human output untouched. - Tests cover missing creds, success, API error, cancellation, and tunnel:expose wrapping.
Ready to merge.
jordanpartridge
marked this pull request as ready for review
September 12, 2026 13:32
There was a problem hiding this comment.
Ship it.
- All seven commands now use both InteractsWithCloudflare + OutputsJson traits, no duplicate getConnector methods remain, and no exit() calls exist under app/Commands.
- Missing creds (token or account id) produces the exact failure envelope on --json and human error otherwise; reportMissingCloudflareCredentials guards the single print path.
- jsonSuccess/jsonFail route everything through stdout with correct exit codes; human output paths unchanged.
- Tests cover the contract (missing creds, success, cancel, API error, expose wrapper) and keep existing TunnelExposeCommandTest green.
- docs/agent-output.md and README accurately document the envelope and per-command data shape.
2 tasks
jordanpartridge
added a commit
that referenced
this pull request
Sep 12, 2026
Research seat. Commands + Saloon PUT overwrite. Raw --json, not the #7 envelope. Keep tunnel:expose README. Do not merge.
jordanpartridge
added a commit
that referenced
this pull request
Sep 12, 2026
* feat: wire orphaned DNS/tunnel API into dns:delete, dns:update, tunnel:get Complete CRUD gaps by adding DnsDeleteCommand and TunnelGetCommand for existing DeleteDnsRecord/GetTunnel requests, plus UpdateDnsRecord (PUT) with DnsUpdateCommand. Includes Pest coverage with Saloon mocks and CI. Co-authored-by: Jordan Partridge <jordan@partridge.rocks> * test: prove dns/tunnel crud register, force-delete json, update table, get json Decode --json payloads for dns:delete --force and tunnel:get, and assert dns:update table fields. Keep expose coverage in the Pest run. * spec: lock dns:delete, dns:update, tunnel:get (PR #8) Research seat. Commands + Saloon PUT overwrite. Raw --json, not the #7 envelope. Keep tunnel:expose README. Do not merge. * fix: tunnel:get uses InteractsWithCloudflare like other tunnel verbs DNS delete/update keep the dns:create token-only connector and pint concat. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.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.
Summary
Consistent agent-friendly JSON output contract.
OutputsJsonconcern with{ok, data|error}shapedocs/agent-output.md+ README blurbTest plan