Skip to content

chore(report): add total/results aliases for json output, document deprecation#87

Open
coletebou wants to merge 1 commit into
openclaw:mainfrom
coletebou:pr/report-json-shape
Open

chore(report): add total/results aliases for json output, document deprecation#87
coletebou wants to merge 1 commit into
openclaw:mainfrom
coletebou:pr/report-json-shape

Conversation

@coletebou
Copy link
Copy Markdown

Summary

clawpatch report --json returns { findings: <count>, output, items: [...] }. The mixed naming (findings is a number, items is the array) breaks common pipelines like jq '.findings | length'.

This PR adds two additive aliases (no breaking changes):

{
  "findings": 3,        // existing — count, deprecated
  "total":    3,        // new — count, canonical
  "output":   "...",
  "items":    [...],    // existing — array
  "results":  [...]     // new — same array reference
}

results === items (referential equality, not a copy). README marks findings: <number> as deprecated and plans removal in 0.4.

Files

  • src/app.ts — 4 lines added to reportCommand's json branch
  • src/workflow.test.ts — 3 assertions: total === findings, total === items.length, results === items
  • README.md — deprecation note
  • CHANGELOG.md — entry

Validation

  • pnpm format:check — clean
  • pnpm typecheck — clean
  • pnpm lint — clean
  • pnpm build — clean
  • pnpm test — 541 passed, 1 skipped (+3 new)

Notes

Smallest PR in this stack — additive only, no behavior change for existing callers.

…precation

`clawpatch report --json` previously returned `{ findings: <count>, output, items: [...] }`,
which mixed a count called `findings` with an array under `items` and broke common
shell pipelines like `jq '.findings | length'`.

Add additive aliases so existing callers keep working:
- `total: <count>` mirrors `findings`.
- `results: <array>` is the same reference as `items` (parity with `{count, results}` consumers).

The legacy `findings: <number>` key is kept but documented as deprecated; v0.4
will drop `findings: <number>` and `results`, landing on `{ total, items, output }`.
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