refactor(cli): remove compatibility command index - #3103
Conversation
This reverts commit 4ebeae4.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughRemoved the compatibility fallback path for loading Oclif commands; command loading now calls pattern-discovery only. Import-boundary detection was tightened to ignore the prior compatibility index reference. Tests were adjusted/added to assert pattern discovery and absence of reliance on the compatibility index. ChangesCommand discovery -> pattern-only
Sequence Diagram(s)sequenceDiagram
participant Caller
participant OclifMetadata as OclifMetadataLoader
participant PatternDiscovery as PatternDiscovery
participant FileSystem as FileSystem
Caller->>OclifMetadata: request commands
OclifMetadata->>PatternDiscovery: loadPatternDiscoveredCommands()
PatternDiscovery->>FileSystem: scan src/commands pattern
FileSystem-->>PatternDiscovery: discovered command modules
PatternDiscovery-->>OclifMetadata: command list
OclifMetadata-->>Caller: return commands
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Automated PR review summaryReviewed PR #3103: refactor(cli): remove compatibility command index Recommendation
Installation and setup findings
What was validated
Failing tests and unresolved impact
Passing tests and why they matteredPassing test 1: Runtime command help survives without compatibility index
Passing test 2: Real sandbox remains operational through installed command path
Passing test 3: Adversarial check for hidden fallback dependency in built install
Bottom line
|
cjagwani
left a comment
There was a problem hiding this comment.
reference audit clean — no stale imports of src/lib/commands/index left in the codebase at this stack base. layer-boundaries exemption removed correctly (the file no longer exists).
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Clean cleanup PR — drops the temporary compatibility fallback now that the pattern-discovery and metadata-derived display stack is in place. src/lib/commands/index.ts (108-line hardcoded commandId → CommandClass map) deleted entirely. loadCompatibilityCommandIndex function and the ?? loadCompatibilityCommandIndex() fallback chain in oclif-metadata.ts removed; loadOclifCommands() now simply returns loadPatternDiscoveredCommands() directly. scripts/check-layer-import-boundaries.ts drops the src/lib/commands/index.ts exception since the file no longer exists.
Right shape of regression net: oclif-pattern-discovery.test.ts adds expect(fs.existsSync(...src/lib/commands/index.ts)).toBe(false) — if anyone re-creates the file, the test fails. oclif-metadata.test.ts existing case renamed for accuracy ("not in the compatibility command index" → "from pattern discovery"); same assertion validating that internal commands resolve via pattern discovery.
Observation (non-blocking): With the fallback gone, if loadPatternDiscoveredCommands() returns null (e.g., package.json#oclif.commands.target missing or dist/commands absent), metadata lookups return null with no safety net. In production this can't happen — the bundled package always has dist/ built. In dev/test, vitest depends on npm run build:cli running first (already true). Worth knowing the contract is now stricter.
CI: pr.yaml lightweight checks pass (commit-lint, dco, layer-boundary, check-hash, changes). checks / macos-e2e / wsl-e2e / build-sandbox-images / current self-hosted run still in progress at approval time.
Brings the 40 upstream commits accumulated on main into the US-507 remote-mode-on-oclif feature branch. Conflict resolutions (upstream-drives default for NemoClaw): - src/lib/commands/onboard.ts: adopt upstream's new ../actions/global path; keep our ../remote-onboard import alongside. - src/lib/commands/sandbox/connect.ts: same shape — upstream's ../../actions/sandbox/runtime + our ../../remote-connect. - src/lib/commands/index.ts: deleted (modify/delete). Upstream removed the compatibility command index in NVIDIA#3103 because oclif pattern discovery now drives command registration. Zero importers on this branch; nothing to migrate. - src/lib/cli/oclif-dispatch.ts: dropped the dead-code FLAT_SANDBOX_ROUTES + NESTED_SANDBOX_ROUTES blocks. They were a stale upstream snapshot (introduced in NVIDIA#2923) that upstream itself has refactored away — replaced by the sandboxCommands()/legacyRoutes() data flow. The blocks were unreferenced and the FlatSandboxRoute / NestedSandboxRoute types are undefined in the codebase. - src/nemoclaw.ts: rename one call site from resolveSandboxOclifDispatch to resolveLegacySandboxDispatch (upstream's new name; the old name is still exported as a compatibility alias). Production source typechecks clean. Remaining typecheck errors are all in upstream test/* files (dist/lib/* references that need npm run build, plus messagingChannelConfig vs messagingChannels drift from upstream fix NVIDIA#3133) — pre-existing on upstream/main, not regressions. Committed with --no-verify because the local prek environment fails on a Python/setuptools SSL cert chain issue unrelated to this merge.
Summary
Removes the legacy explicit
src/lib/commands/index.tscommand map now that oclif pattern discovery and metadata-derived command display are in place. Command metadata lookup now relies only on discoveredsrc/commands/**entrypoints.Changes
src/lib/commands/index.ts.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Refactor
Tests