Skip to content

fix(share): honor --json on arc share list - #44

Merged
bfirestone merged 1 commit into
mainfrom
fix/share-list-json
May 1, 2026
Merged

fix(share): honor --json on arc share list#44
bfirestone merged 1 commit into
mainfrom
fix/share-list-json

Conversation

@bfirestone

Copy link
Copy Markdown
Contributor

Summary

arc share list --json was silently emitting the tab-separated text output, ignoring the global --json flag. The handler in cmd/arc/share.go called fmt.Printf directly instead of branching on the package-level outputJSON, the way arc plan, arc label, and friends already do.

$ arc share list --json
e79y2k99    local   http://localhost:7432   docs/review_howto.md     ← ignored --json
fgqfxxhp    shared  http://localhost:7436   docs/plans/2026-04-29-shared-review.md

After this fix:

$ arc share list --json
[
  {
    "id": "e79y2k99",
    "kind": "local",
    "url": "http://localhost:7432",
    "key_b64url": "...",
    "plan_file": "docs/review_howto.md",
    "created_at": "2026-05-01T07:25:07Z"
  },
  ...
]

Why this matters

The marketplace plugin's /arc:plan skill now relies on arc share list --json | jq to look up the local file path for a given share ID (since arc share show returns the decrypted plan content, not metadata). Until this fix, that lookup silently failed.

Surface choices

  • edit_token is omitted from JSON. It's a bearer secret gated behind the Author URL — it doesn't belong in machine-readable output that might get teed to logs or CI artifacts.
  • key_b64url is included. This preserves parity with the text output, where the same key already travels inside the printed Share URL fragment (#k=<key>). Excluding it from --json would create inconsistent surface area without improving security posture.
  • Empty keyring returns []. Not the human (no shares) string, so JSON consumers can [].length without parsing.

Test plan

  • TestRunShareListJSON — seeds two shares, asserts JSON parses to a 2-element array containing both IDs, asserts edit_tokens don't leak
  • TestRunShareListJSONEmpty — empty keyring returns valid []
  • make build-quick + ./bin/arc share list --json against my local keyring → matches expected schema
  • go test ./... — full suite green
  • make lint — clean

`arc share list --json` was silently emitting the tab-separated text
output, ignoring the global flag. The handler called `fmt.Printf` directly
instead of branching on `outputJSON`.

Output is now a JSON array of `{id, kind, url, key_b64url, plan_file,
created_at}` entries. Edit tokens are deliberately omitted — they're
bearer secrets and don't belong in machine-readable output. Decryption
keys (`key_b64url`) are included to preserve parity with the text
output, where the same key already travels inside the printed Share URL.

Tests: TestRunShareListJSON (multi-row, JSON shape, no edit_token leak)
+ TestRunShareListJSONEmpty (empty keyring → `[]`, not `(no shares)`).
@bfirestone
bfirestone merged commit ae8088e into main May 1, 2026
3 checks passed
@bfirestone
bfirestone deleted the fix/share-list-json branch May 1, 2026 07:38
bfirestone added a commit to SentioLabs/claude-marketplace that referenced this pull request May 1, 2026
Now that PR SentioLabs/arc#44 makes `--json` actually work, surface the
output schema in the two skills that use it:

- skills/plan: pull the jq lookup onto its own code block and document
  the per-entry fields ({id, kind, url, key_b64url, plan_file,
  created_at}, edit_token redacted).
- skills/arc: expand the `arc share list` row in the CLI table to call
  out --json and the schema, so agents can discover the file_path
  lookup without reading the plan skill first.
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