Skip to content

feat(cli): point top-level cli --help at --format json - #2140

Open
Lowpower wants to merge 4 commits into
DeusData:mainfrom
Lowpower:cursor/cli-help-format-json-cb65
Open

Lowpower wants to merge 4 commits into
DeusData:mainfrom
Lowpower:cursor/cli-help-format-json-cb65

Conversation

@Lowpower

Copy link
Copy Markdown

What does this PR do?

Help-only discoverability fix for #2102 (direction c only).

Top-level cli --help already described outer --json (the raw MCP result envelope) but did not mention that tools which accept format support --format tree|json. Habitual CLI users look at cli --help first; per-tool --help already documented --format.

This PR adds two lines to CLI_USAGE:

  • Tools that accept format support --format tree|json (default: tree).
  • --format json prints payload JSON; outer --json prints the full MCP envelope.

No session-wide --format flag, no CBM_CLI_FORMAT env var, and no change to output defaults.

CBM_CLI_USAGE lives in src/cli/cli.h so tests/test_cli.c can assert on the same string run_cli() prints.

Checklist

  • Every commit is signed off (git commit -s) — required, CI rejects unsigned commits
  • CLI suite passes locally (scripts/test.sh --suites cli — including cli_usage_points_to_tool_format_json_issue2102)
  • New behavior is covered by a test

Fixes #2102

@Lowpower
Lowpower requested a review from DeusData as a code owner September 10, 2026 03:22
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

CLI_USAGE described outer --json but did not mention tool-level
--format json. Add a help-only pointer that tools which accept format
support --format tree|json, and distinguish payload JSON from the full
MCP envelope. No new flags, env vars, or output-default changes.

Fixes DeusData#2102

Signed-off-by: Lowpower <3133734+Lowpower@users.noreply.github.com>
Signed-off-by: Lowpower <3133734+Lowpower@users.noreply.github.com>
@Lowpower
Lowpower force-pushed the cursor/cli-help-format-json-cb65 branch from a1d11e7 to b74c035 Compare September 17, 2026 05:40
The DeusData#1828 fast-fail test forks a real daemon host and waits for the
injected publication ENOSPC. Production MCP clients use a 30s startup
budget, but under MSan the child still has to finish claim, mem_init,
and host_state_prepare before listen. That path can exceed 30s, so the
client reports "active or starting" and the suite fails even though the
help-text change never touched this code.

Keep proving fast-fail by the recorded ENOSPC cause and a single spawn,
not by wall-clock. Widen only this test's wait.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Lowpower <Lowpower@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/cli-help-format-json-cb65 branch from b52df4b to ca34611 Compare September 18, 2026 03:30
search_code format=json is JSON only after a complete scan. A fail-closed
grep (supervision / contained-command) returns an error string, so
yyjson_read is NULL — "doc is NULL" on macos-15-intel while the same SHA
passed macos-14. The help-text change never touched this path.

Keep the 601-hit bound/expand assertions. One retry absorbs the host
flake; a second miss dumps inner instead of an opaque NULL.

Co-authored-by: Lowpower <Lowpower@users.noreply.github.com>
Signed-off-by: Cursor Agent <cursoragent@cursor.com>
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.

feat(cli): top-level --format / CBM_CLI_FORMAT default for tools (follow-up from #1867)

2 participants