Skip to content

refactor(cli): rename oclif dispatch module - #2917

Merged
cv merged 27 commits into
mainfrom
refactor/oclif-arch-dispatch-module
May 5, 2026
Merged

refactor(cli): rename oclif dispatch module#2917
cv merged 27 commits into
mainfrom
refactor/oclif-arch-dispatch-module

Conversation

@cv

@cv cv commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Remove the stale legacy naming from the oclif dispatch helper now that sandbox and global commands route through explicit oclif adapters. This is a small naming cleanup in the architecture follow-up stack.

Stack Navigation

Changes

  • Renamed legacy-oclif-dispatch to oclif-dispatch.
  • Updated the CLI entrypoint and dispatch tests to import the renamed module.
  • Kept dispatch behavior unchanged.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Refactor
    • Removed legacy command dispatch paths and consolidated routing logic.
    • Updated routing for several commands to improve consistency.
    • Expanded the share command with structured subcommand support for mount, unmount, and status operations.
    • Updated help and usage messages for enhanced clarity.

cv added 26 commits May 2, 2026 13:36
@cv cv self-assigned this May 3, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 3, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 01451b19-4330-4757-8a54-beaeb1c5e9c1

📥 Commits

Reviewing files that changed from the base of the PR and between cd4cdb8 and 40b8948.

📒 Files selected for processing (3)
  • src/lib/oclif-dispatch.test.ts
  • src/lib/oclif-dispatch.ts
  • src/nemoclaw.ts

📝 Walkthrough

Walkthrough

The PR removes the legacy dispatch system by deleting the LegacyDispatch type, updating the DispatchResult union, and refactoring multiple sandbox command handlers to route directly to Oclif commands instead of legacy fallback paths. Import statements across test and main files are updated to reflect the new dispatch module.

Changes

Legacy Dispatch Removal & Oclif Migration

Layer / File(s) Summary
Type Definitions
src/lib/oclif-dispatch.ts
LegacyDispatch type is removed; DispatchResult union updated to exclude LegacyDispatch, leaving only OclifDispatch, HelpDispatch, UsageErrorDispatch, UnknownSubcommandDispatch, and UnknownActionDispatch. Helper hasMissingFlagValue is also removed.
Dispatch Handler Updates
src/lib/oclif-dispatch.ts
resolveSandboxOclifDispatch handlers for doctor, logs, policy-add, skill, snapshot, and share are updated to route to Oclif commands (sandbox:doctor, sandbox:policy-add, sandbox:skill, sandbox:snapshot:*, sandbox:share:*) instead of returning legacy results. destroy help usage adjusted. Legacy fallback for missing policy-add flags is removed.
Integration & Imports
src/nemoclaw.ts, src/lib/oclif-dispatch.test.ts
Imports are updated to source resolveSandboxOclifDispatch and DispatchResult from ./oclif-dispatch instead of ./legacy-oclif-dispatch. Test assertions remain functionally unchanged but exercise the new resolver.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A hop, a skip, the legacy fades,
Dispatch now flows through Oclif cascades,
No more fallbacks hiding in the shade,
Commands route clean—the new way's made! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/oclif-arch-dispatch-module

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

@cv cv added the v0.0.34 label May 4, 2026

@cjagwani cjagwani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved as part of stack from #2886 (auto-approve: CI green, no scope/behavior flags).

@cv cv added v0.0.35 refactor PR restructures code without intended behavior change and removed v0.0.34 labels May 5, 2026
cv added a commit that referenced this pull request May 5, 2026
## Summary
Start the post-UX architecture cleanup by extracting public argv
normalization out of `src/nemoclaw.ts`. The top-level entrypoint still
owns registry recovery and user-facing routing errors, but command
classification now lives in a focused helper with unit coverage.

## Stack Navigation
- Position: 23 of 60
- Previous PR: [#2915 — docs: sync oclif UX command
reference](#2915)
- Next PR: [#2917 — refactor(cli): rename oclif dispatch
module](#2917)

## Changes
- Added `src/lib/cli-argv-normalizer.ts` for root/global/sandbox argv
normalization and typo suggestions.
- Replaced duplicated command-shape parsing in `src/nemoclaw.ts` with
the normalizer.
- Added unit coverage for root help, global commands, explicit sandbox
actions, implicit connect, and suggestions.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

# Release Notes

* **New Features**
* Added `sandbox doctor` diagnostic command for comprehensive sandbox
health checks.
* Enhanced `sandbox logs` with `--tail`, `--since`, and `--follow`
options for flexible log streaming.
* Added `--probe-only` option to sandbox connection for testing without
full connection.

* **Documentation**
* Updated CLI commands reference with new flag options and short aliases
(`-y`, `-q`, `-o`, `-v`).
* Added CLI usage examples across multiple commands for improved
discoverability.

* **Bug Fixes**
* Made channel argument required for `channels` subcommands to prevent
invalid invocations.
* Improved validation for policy and channel mutations with clearer
error messages.

* **Refactoring**
* Restructured internal CLI dispatching and removed legacy dispatch
path.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv marked this pull request as ready for review May 5, 2026 17:22
@cv
cv changed the base branch from refactor/oclif-arch-normalize-argv to main May 5, 2026 17:22
@cv
cv enabled auto-merge (squash) May 5, 2026 17:22
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv merged commit 693de6c into main May 5, 2026
11 checks passed
cv added a commit that referenced this pull request May 5, 2026
## Summary
Start normalizing sandbox-scoped internal command IDs by moving policy
commands to topic-style IDs. Public CLI syntax stays unchanged
(`policy-add`, `policy-remove`, `policy-list`).

## Stack Navigation
- Position: 25 of 60
- Previous PR: [#2917 — refactor(cli): rename oclif dispatch
module](#2917)
- Next PR: [#2919 — test(cli): require oclif command
metadata](#2919)

## Changes
- Renamed internal policy command IDs to `sandbox:policy:add`,
`sandbox:policy:remove`, and `sandbox:policy:list`.
- Updated dispatch routing and oclif command registration for the new
IDs.
- Updated dispatch tests for the normalized IDs.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added `sandbox doctor` diagnostics command for health checks
* Added log stream options: `--tail`/`-n` for line count and `--since`
for time filtering

* **Documentation**
* Updated CLI command reference with new option aliases and examples
across multiple commands

* **Improvements**
* Added short flag variants: `-y` (yes), `-q` (quick), `-o` (output),
`-v` (verbose)
  * Made skill install path argument required
  * Refactored share command into discrete subcommands

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv deleted the refactor/oclif-arch-dispatch-module branch May 27, 2026 21:17
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output and removed NemoClaw CLI labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants