Skip to content

improvement(cli): recovery guidance on every parse error and body-shape refusal - #9646

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/cli-recovery-guidance
Nov 4, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
improvement/cli-recovery-guidance

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Parse-error guidance now attaches to every command that parses its own arguments, not just generated leaves. Hand-attached commands (files upload, files ls, ...) used to answer a guessed flag with a bare unknown option. Guidance now wraps each command's own error, because .command() children share their parent's output-configuration object, so a formatter set on one command would answer for all of them
  • Unknown option: if a sibling command declares the flag, the error names that sibling with its description (tables rows list --filter → tables rows query — Query rows with a filter and sort). Commander's near-spelling suggestion never reaches across commands
  • Missing required option: the error prints the full command line. When exactly one extra positional was typed, it names that value against the flag (files rename <id> new.pdf → pass it as --name "new.pdf", knowledge search <kbId> → --kb)
  • Too many arguments: the error prints the command line and the flag list (knowledge search "<query>" --kb <id>)
  • Body-variant shape refusal (--rows / --data): the error says what shape it received, gives an example, and points at the right spelling. That covers the wrapper object {"rows":[...]}, a single row passed to --rows, and an array passed to --data. Nothing is reshaped
  • Agent runs hit these errors often. A run that got no pointer either spent a round on --help/reference or dropped the filter and pulled whole tables into jq. Missing-flag positionals recovered in one round about 85% of the time; --rows shape errors failed again on the next call about 44% of the time

Type of Change

  • Improvement

Testing

  • New embed-isolation.test.ts cases cover each failure mode through runEmbeddedCli. Both fail on the pre-fix code and pass after the fix
  • packages/sim-cli vitest (521 tests), tsc --noEmit, biome on the changed files

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 3, 2026 11:50pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

The PR adds command-specific recovery guidance for parse errors and rejected JSON body shapes.

  • CLI errors point callers to the command syntax they need.
  • Body-shape errors explain which JSON form each flag takes.

Reviews (2) · Last reviewed commit: "fix(cli): valid JSON recovery examples, ..." · Reviewed by Greptile

Comment thread packages/sim-cli/src/runtime/request.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/sim-cli/src/runtime/build.ts Resolved
Comment thread packages/sim-cli/src/runtime/build.ts Resolved
Comment thread packages/sim-cli/src/runtime/request.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — 02089c9a Deployed Nov 3, 2026 by vercel[bot]
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