Skip to content

feat(cli): --json output + updated skills that use jq - #42

Merged
tato123 merged 1 commit into
mainfrom
feat/json-output
Apr 20, 2026
Merged

tato123 merged 1 commit into
mainfrom
feat/json-output

Conversation

@tato123

@tato123 tato123 commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a global `--json` flag so skills (and any jq-driven consumer) can extract fields directly instead of parsing ASCII. Also rewrites the two skills that consume output (`amos-focus`, `amos-next`) to use `jq` and craft natural-language summaries rather than piping raw CLI text back to the user.

JSON shapes

  • `amos milestones --json` → `{focus, milestones: [{title, open, ready, done, focused}]}`
  • `amos next|blocked|orphans --json` → `{focus, count, nodes: [{name, issue_number, description, blocked_by, blocks, related_to, milestone, facts, labels_local}]}`
  • `amos focus --json` → `{focus, action?}`
  • `amos validate --json` → `{ok, node_count, issues: [{kind, ...}]}`, non-zero exit on errors
  • `amos show --json` → full node with body, facts, every relationship field

Human-readable output paths are unchanged when the flag is absent — existing tooling keeps working.

Why

Skills had to scrape lines like `- @github:org/repo#347 — Research: DMA-BUF...` to find issue numbers and descriptions. Brittle and slow. Now:

```bash
amos next --json | jq -r '.nodes[] | "(.name)\t(.description)"'
```

Skill updates

  • `amos-focus` now reads/writes via `--json` + jq; prescribes natural-language confirmations instead of raw echo.
  • `amos-next` protocol rewritten to consume JSON at every step and compose English announcements, test results, and task completion reports. Rule Make amos runnable from the project root with no arguments #7 added: "Present data to the user in natural English, never raw JSON."

Test plan

  • 57 unit tests passing
  • `amos milestones --json` + `jq` against streamlib (9 milestones parse cleanly)
  • `amos next --json` + `jq` against streamlib focus (3 ready items parse cleanly)

🤖 Generated with Claude Code

…phans / validate / show

Adds a global `--json` flag that switches every scan-affecting command to
emit structured JSON on stdout. Skills and any jq-driven consumer can
extract fields directly instead of scraping ASCII tables / bullet lists.

- `amos milestones --json` → `{"focus": ..., "milestones": [{title, open, ready, done, focused}, ...]}`
- `amos next|blocked|orphans --json` → `{"focus": ..., "count": N, "nodes": [{name, issue_number, description, blocked_by, blocks, related_to, milestone, facts, labels_local}, ...]}`
- `amos focus --json` → `{"focus": "<title>" | null}`, optionally with `action: "set"|"cleared"`
- `amos validate --json` → `{"ok": bool, "node_count": N, "issues": [{kind, ...}, ...]}`, non-zero exit if issues
- `amos show <node> --json` → full node including body, facts, relationships

Human-readable output paths are unchanged when `--json` is absent. Status-
mutation commands (done/start/reset) still print their human-readable
confirmation.

Updates the `amos-focus` and `amos-next` skills to consume the JSON
output via jq, and instructs the agent to craft English summaries for the
user rather than echoing raw JSON. The protocol in amos-next still owns
branching, testing, PR creation — it just gets cleaner input now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tato123
tato123 merged commit 24e475e into main Apr 20, 2026
1 check passed
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