Skip to content

feat(cli): expose json aliases on action commands - #2368

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/query-action-completion-polish
Jun 24, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/query-action-completion-polish

Conversation

@Sinity

@Sinity Sinity commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Promotes --json from a parser-only convenience into a local Click option on the action and analysis commands that already own --format json, and updates shell-completion coverage plus the generated CLI reference.

Problem

polylogue read <session> --json was accepted after the previous dogfood fix, but completions and command help still advertised only --format for many verbs. That made the accepted grammar less discoverable and kept the completion surface behind parser behavior.

Solution

Added local --json aliases backed by the existing output_format parameter for query actions, candidate assertion review commands, provider usage diagnostics, and insight analysis commands. The parser tests now assert the alias is owned locally rather than rewritten before Click dispatch. Completion tests verify bash, zsh, and fish expose --json alongside --format for the covered action paths.

Verification

  • devtools test tests/unit/cli/test_cli_action_contracts.py -k 'post_verb_json_alias' -> 8 passed, 29 deselected.
  • devtools test tests/unit/cli/test_completion_matrix.py -k 'json_alias_completion or mutating_guard_completion' -> 24 passed, 148 deselected.
  • devtools verify --quick -> passed, run 20260624T130051Z-quick-2590871-05f3c605.
  • pre-push devtools verify --quick -> passed, run 20260624T130135Z-quick-2591533-8ce195c6.

Ref #1844
Ref #2006
Ref #2317

Problem:
The query-action parser accepted post-verb --json, but shell completion and
Click help still advertised only --format on several action and analysis
commands. That made the accepted grammar harder to discover and left the
completion surface behind the parser contract.

What changed:
Added local --json aliases backed by the existing output_format parameter for
query actions, candidate-review commands, provider usage diagnostics, and
insight analysis commands. Updated the generated CLI reference and added parser
and per-shell completion coverage so --json is owned by the same commands that
own --format json.

Verification:
devtools test tests/unit/cli/test_cli_action_contracts.py -k 'post_verb_json_alias'
devtools test tests/unit/cli/test_completion_matrix.py -k 'json_alias_completion or mutating_guard_completion'
devtools verify --quick

Ref #1844
Ref #2006
Ref #2317
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 36 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0919308f-7fae-4895-916b-65738dba960d

📥 Commits

Reviewing files that changed from the base of the PR and between 727ef40 and 0f7bf54.

📒 Files selected for processing (6)
  • docs/cli-reference.md
  • polylogue/cli/commands/diagnostics.py
  • polylogue/cli/commands/insights.py
  • polylogue/cli/query_verbs.py
  • tests/unit/cli/test_cli_action_contracts.py
  • tests/unit/cli/test_completion_matrix.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/query-action-completion-polish

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

github-actions Bot pushed a commit that referenced this pull request Jun 24, 2026
@Sinity
Sinity merged commit 3a56081 into master Jun 24, 2026
15 checks passed
@Sinity
Sinity deleted the feature/feat/query-action-completion-polish branch June 24, 2026 13:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f7bf54785

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +421 to +427
@click.option(
"--json",
"output_format",
flag_value="json",
default=None,
help="Shortcut for --format json.",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor --json in machine-error detection

When this new alias is used and the command fails before emitting its payload (for example, an invalid read --json --view ... value or analyze usage --json --limit nope), the top-level run_machine_entry path will still render Click’s plain-text error because wants_json() only pre-scans raw argv for --format json, --format=json, or -f json. The same invocations with --format json get machine-error envelopes, so the advertised shortcut is not equivalent on error paths; please make the pre-scan recognize --json as JSON intent too.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot mentioned this pull request Jul 5, 2026
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