refactor(cli): reduce command adapter migration debt#3833
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR converts many sandbox CLI flows from legacy argv arrays to structured typed option/request objects, adds per-command publicDisplay metadata, migrates agentRuntime imports to ES modules, updates command-support helpers, refactors snapshot/skill actions, updates routing/dispatch/token logic, and adds a layer-import check for bin/lib shim imports. ChangesSandbox CLI Refactoring: Actions to Typed Options
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/actions/sandbox/policy-channel.ts (1)
41-44: 💤 Low valueConsider importing
ChannelMutationOptionsfromchannels-command-support.tsto avoid type drift.This type is defined identically in
src/lib/sandbox/channels-command-support.ts. Duplicating type definitions risks them diverging during future maintenance. Since the action layer already imports from the domain layer, importing from the command-support module (or extracting to a shared types file) would ensure consistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/actions/sandbox/policy-channel.ts` around lines 41 - 44, Replace the duplicated ChannelMutationOptions type in policy-channel.ts with an import from the existing definition in channels-command-support.ts: remove the local type alias and add an import for ChannelMutationOptions from the module that exports it (channels-command-support.ts or a shared types module), then update any references in policy-channel.ts to use the imported ChannelMutationOptions to prevent type drift between layers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/cli/command-registry.ts`:
- Around line 142-149: The JSDoc above directGlobalCommandIds is stale and
misleading (it references sandbox action tokens); update the comment to
accurately describe that directGlobalCommandIds() returns a Set<string> of leaf
global command IDs (derived from oclif command IDs and explicit public route
overrides) used for dispatch decisions, and remove or replace references to
"sandbox" and "action tokens" so the documentation matches the function purpose.
---
Nitpick comments:
In `@src/lib/actions/sandbox/policy-channel.ts`:
- Around line 41-44: Replace the duplicated ChannelMutationOptions type in
policy-channel.ts with an import from the existing definition in
channels-command-support.ts: remove the local type alias and add an import for
ChannelMutationOptions from the module that exports it
(channels-command-support.ts or a shared types module), then update any
references in policy-channel.ts to use the imported ChannelMutationOptions to
prevent type drift between layers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ba3ba010-5816-41a0-82f1-fca4f6bed7b4
📒 Files selected for processing (41)
scripts/checks/layer-import-boundaries.tssrc/commands/sandbox/channels/add.tssrc/commands/sandbox/channels/list.tssrc/commands/sandbox/channels/mutate.test.tssrc/commands/sandbox/channels/remove.tssrc/commands/sandbox/channels/start.tssrc/commands/sandbox/channels/stop.tssrc/commands/sandbox/policy/add.tssrc/commands/sandbox/policy/list.tssrc/commands/sandbox/policy/mutate.test.tssrc/commands/sandbox/policy/remove.tssrc/commands/sandbox/skill.test.tssrc/commands/sandbox/skill.tssrc/commands/sandbox/skill/install.tssrc/commands/sandbox/snapshot.test.tssrc/commands/sandbox/snapshot.tssrc/commands/sandbox/snapshot/create.tssrc/commands/sandbox/snapshot/list.tssrc/commands/sandbox/snapshot/restore.tssrc/lib/actions/sandbox/connect.tssrc/lib/actions/sandbox/doctor.tssrc/lib/actions/sandbox/policy-channel.tssrc/lib/actions/sandbox/process-recovery.tssrc/lib/actions/sandbox/rebuild.tssrc/lib/actions/sandbox/skill-install.tssrc/lib/actions/sandbox/snapshot.tssrc/lib/actions/sandbox/status.tssrc/lib/cli/command-display.tssrc/lib/cli/command-registry.tssrc/lib/cli/oclif-metadata.tssrc/lib/cli/public-argv-translation.tssrc/lib/cli/public-dispatch.tssrc/lib/cli/public-display-defaults.tssrc/lib/cli/public-route-metadata.tssrc/lib/domain/policy-channel.test.tssrc/lib/domain/policy-channel.tssrc/lib/sandbox/channels-command-support.tssrc/lib/sandbox/policy-command-support.tssrc/lib/sandbox/skill-command-support.tssrc/lib/sandbox/snapshot-command-support.tstest/channels-add-preset.test.ts
💤 Files with no reviewable changes (3)
- src/lib/cli/public-display-defaults.ts
- src/lib/sandbox/skill-command-support.ts
- src/lib/sandbox/snapshot-command-support.ts
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 26128228501
|
Selective E2E Results — ❌ Some jobs failedRun: 26129578640
|
Summary
Refactors CLI command adapters to keep the sandbox-first public grammar while reducing migration-era shim and argv translation debt. The changes move more command metadata and typed action inputs closer to oclif command definitions, and prevent source code from depending on packaged bin shims.
Changes
src/lib/agent/runtimeand add a layer check preventing non-JSONbin/lib/*shim imports fromsrc/**.public-display-defaults.tsonto the relevant oclif command classes.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
New Features
Refactor
Tests