Repository navigation
Preserve extension command contracts and recovery fidelity - #511
Conversation
Inherit canonical option metadata across flattened aliases, synthesize usable contracts for handler-only importer/exporter registrations, preserve nested failure recovery boundaries, and honor extension flag arity in suggested retries.\n\nAdd SDK, loader, activation-summary, and CLI regression coverage; verify 5,532 tests at 100/100/100/100 coverage plus fresh installed-package dogfood. Update managed pm-changelog to 2026.7.11.\n\nTracks pm-s9iu, pm-0mjz, pm-o71e, and pm-9qcr.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
@greptileai please review the current head. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
📝 WalkthroughWalkthroughThe PR updates extension import/export registration, canonical alias help resolution, CLI recovery suggestions, related tests, release documentation, managed-extension metadata, and PM tracking records. ChangesExtension command behavior
Project tracking metadata
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant RuntimeSnapshot
participant HelpDescriptors
participant ExtensionHandler
CLI->>RuntimeSnapshot: load extension command definitions
RuntimeSnapshot->>RuntimeSnapshot: build canonical alias mappings
RuntimeSnapshot->>HelpDescriptors: collect descriptors with aliases
HelpDescriptors-->>CLI: return canonical help metadata
ExtensionHandler-->>CLI: report missing option or nested failure
CLI->>CLI: infer flag arity and recovery retry
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
Greptile SummaryThis PR improves extension command contracts and recovery behavior. The main changes are:
Confidence Score: 5/5This PR appears safe to merge with low risk. The changed code is focused on extension command metadata and recovery construction, with tests covering the reported alias, importer/exporter, nested recovery, typed flag, required flag, and repeated-token cases. No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Ext as Extension activate(api)
participant Loader as Extension loader
participant Help as Command contract/help builder
participant CLI as CLI runtime recovery
Ext->>Loader: registerImporter/registerExporter(name, handler, options?)
Loader->>Loader: validate options and synthesize default description + [file] arg
Loader->>Help: expose command definitions, handlers, flags
Help->>Help: map verified flattened aliases to canonical descriptors
CLI->>Help: collect active runtime command descriptors
Ext-->>CLI: command error or nested typed failure
CLI->>CLI: preserve existing nested recovery when present
CLI->>Help: resolve missing extension flag arity from descriptor
CLI-->>Ext: structured recovery with executable suggested_retry
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Ext as Extension activate(api)
participant Loader as Extension loader
participant Help as Command contract/help builder
participant CLI as CLI runtime recovery
Ext->>Loader: registerImporter/registerExporter(name, handler, options?)
Loader->>Loader: validate options and synthesize default description + [file] arg
Loader->>Help: expose command definitions, handlers, flags
Help->>Help: map verified flattened aliases to canonical descriptors
CLI->>Help: collect active runtime command descriptors
Ext-->>CLI: command error or nested typed failure
CLI->>CLI: preserve existing nested recovery when present
CLI->>Help: resolve missing extension flag arity from descriptor
CLI-->>Ext: structured recovery with executable suggested_retry
Reviews (12): Last reviewed commit: "fix(extension): make retry arity path-ex..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Move verified extension alias mapping into the command-contract module after CI surfaced the main.ts file-length ratchet. Preserve focused behavior and exact 100/100/100/100 coverage.\n\nTracks pm-s9iu and PR #511 review feedback.
|
@greptileai please review the current head b03a135. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 30 minutes. |
There was a problem hiding this comment.
Code Review
This pull request implements extension contract fidelity and recovery improvements, ensuring that flattened extension-command aliases inherit canonical option contracts, bare importer/exporter registrations receive default contracts, and suggested retries respect extension flag arity. Feedback on these changes highlights two issues: first, a potential bug in src/cli/main.ts where indexOf returning -1 leads to an incorrect slice of invocationArgv; second, a matching issue in src/cli/extension-command-help.ts where single-word commands can result in a trailing space in the expected alias template, preventing successful matches.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Honor value_type/type arity, guard missing invocation command tokens, support single-token flattened aliases, and keep shared helpers inside the command-contract module.\n\nCovers all Greptile and Gemini findings on PR #511 with exact 100/100/100/100 coverage.\n\nTracks pm-s9iu and pm-9qcr.
|
@greptileai please review the current head 2e5956a after all inline findings were addressed. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
There was a problem hiding this comment.
Code Review
This pull request enhances extension command contract fidelity and error recovery. It provides default command contracts for bare importer/exporter registrations, resolves canonical extension aliases, and ensures suggested retries respect extension flag arity while preventing incorrect retries from nested failures. Feedback on the changes highlights two issues: first, the default options for importers/exporters are bypassed if an empty object is passed, which can be resolved by merging defaults with the provided options; second, using indexOf to locate the command name in the arguments list is fragile and can be corrupted if the command name matches a preceding flag value.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Merge importer/exporter defaults even when package authors pass empty metadata, and resolve the actual extension command occurrence when global option values repeat the command token. Add regression coverage for both bot findings, close the four linked PM issues with exact coverage evidence, and regenerate the package-owned changelog.
|
@greptileai please review current head 6afb546. All prior findings are addressed; please report any remaining actionable issues. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 21 minutes. |
|
@greptileai please review current head cdbf467 after main synchronization and changelog ancestry correction. Please report any remaining actionable issues. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 58 seconds. |
There was a problem hiding this comment.
Code Review
This pull request implements usable default contracts for handler-only importer/exporter registrations, resolves canonical nested commands behind auto-generated flattened extension aliases, preserves nested extension recovery payloads without inventing top-level retries, and respects extension flag arity in suggested retries. Feedback is provided regarding a potential bug in extensionFlagTakesValueForInvocation where using lastIndexOf(commandName) to locate the command token is fragile if the command name is repeated as an argument or option value later in the invocation, and a more robust iteration-based matching approach is suggested.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Select the longest extension command descriptor across every matching token occurrence, honor required untyped flags as value-taking, add regressions for leading and trailing command-token collisions, preserve the intentional README cleanup, and record final PM evidence.
|
@greptileai please review current head dce511d. The final required-arity and repeated-token findings are fixed with exact coverage; please report any remaining actionable issues. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
There was a problem hiding this comment.
Code Review
This pull request addresses several issues related to extension command contracts and error recovery. Specifically, it ensures that bare or empty-options importer/exporter registrations receive safe default command metadata (including descriptions and optional positional file arguments). It also implements flattened extension-command alias contract inheritance, allowing aliases to inherit descriptions, arguments, and options from their canonical nested commands. Additionally, error recovery suggestions (suggested_retry) now consult active extension command contracts to correctly format boolean flags (bare) versus value-taking flags, and nested extension failures are wrapped cleanly without synthesizing irrelevant top-level missing flags. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Final review accounting on dce511d: all Gemini and Greptile inline findings received direct replies and usefulness reactions, all review threads are resolved, Gemini reports no remaining comments, Greptile passes, CodeRabbit completed but was rate-limited, and the Codecov plus all required CI gates pass. Rate-limit/quota-only notifications were marked not useful; substantive summaries and coverage reports were marked useful. |
Summary
Verification
pnpm lintpnpm typechecknode scripts/run-tests.mjs coverage— 5,533/5,533, 100/100/100/100/tmp/pm-extension-contract-proofpm validate --check-resolution --check-history-drift --json(history drift clean; known legacy resolution warnings)pm health --check-only --summary --jsonpnpm audit --audit-level moderatepnpm changelog:pm:checkTracks pm-s9iu / GH-503, pm-0mjz / GH-504, pm-o71e / GH-505, and pm-9qcr / GH-507.
Summary by cubic
Preserves extension command contracts and recovery fidelity. Flattened aliases inherit canonical flags; importer/exporters get default contracts (even when options are omitted or
{}); nested errors keep their recovery; and suggested retries use extension flag arity with path‑exact command matching (longest descriptor) and treat required untyped flags as value‑taking. Also syncs with main, keeps fixes under Unreleased, bumpspm-changelogto 2026.7.11, and removes stale tracker references from the README.Bug Fixes
optionsyields an unusable CLI command (no arg/flag contracts, confusing "Too many arguments", no doctor diagnostic) #504 (pm-0mjz): Synthesizes default importer/exporter contracts, including optional[file]; visible in help/SDK; applies when options are omitted or{}.Refactors
Written for commit dce511d. Summary will update on new commits.