test(cli): cover oclif metadata routing helpers - #2936
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. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughA new dispatch layer ( ChangesCommand Dispatch Layer
Sequence DiagramsequenceDiagram
participant CLI as CLI Input
participant Dispatch as Dispatch Layer
participant Result as DispatchResult
participant Oclif as oclif Executor
CLI->>Dispatch: command + args
alt Global Command Route
Dispatch->>Dispatch: Check GLOBAL_ROUTES
Dispatch->>Dispatch: Handle special cases<br/>(tunnel, credentials, --version)
else Sandbox Command Route
Dispatch->>Dispatch: Check FLAT_SANDBOX_ROUTES
alt Found in Flat Routes
Dispatch->>Result: Return OclifDispatch
else Try Nested Routes
Dispatch->>Dispatch: Parse nested subcommands
Dispatch->>Dispatch: Validate against route config
alt Valid Subcommand
Dispatch->>Result: Return OclifDispatch
else Invalid or Help Flag
Dispatch->>Result: Return Help/UsageError/<br/>UnknownSubcommand
end
end
end
Result-->>CLI: DispatchResult
alt OclifDispatch
Result->>Oclif: commandId + args
Oclif-->>CLI: command execution
else Help/Error/Unknown
Result-->>CLI: structured outcome
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
## Summary Replace the transitional hand-written public sandbox help renderer with an oclif `CommandHelp` projection that keeps NemoClaw's public syntax while letting oclif render command details. ## Stack Navigation - Position: 37 of 60 - Previous PR: [#2929 — refactor(cli): parse durations with oclif flags](#2929) - Next PR: [#2936 — test(cli): cover oclif metadata routing helpers](#2936) ## Changes - Extended oclif metadata lookup so public help can access args, flags, base flags, usage, and examples. - Reworked public sandbox help rendering to use `CommandHelp` with an overridden public usage line. - Preserved public `nemoclaw <name> action` syntax while rendering oclif-managed flags, arguments, descriptions, and examples. - Updated help tests to assert the projected oclif output does not leak internal command IDs. ## Notes Help output format changes from `Usage: nemoclaw ...` to `$ nemoclaw ...` (oclif default rendering). Public command syntax and flags are unchanged; only the leading prefix in help/example lines differs. ## 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 * **Improvements** * Help output now displays with enhanced structure, including clearly separated USAGE sections with command syntax examples, FLAGS sections listing available options, and fully-resolved command examples to guide users through commands. * Help text generation now uses standardized formatting, ensuring consistent and professional presentation across all CLI commands. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
## Summary Remove broad coverage ignores from low-risk global oclif adapters and cover their parser-to-action mapping directly. ## Stack Navigation - Position: 39 of 60 - Previous PR: [#2936 — test(cli): cover oclif metadata routing helpers](#2936) - Next PR: [#2938 — test(cli): cover sandbox oclif command adapters](#2938) ## Changes - Removed file-level V8 ignores from list, status, maintenance, and onboard oclif adapters. - Added direct source-level tests for list/status adapter helpers and maintenance typed option mapping. - Covered onboard/setup/setup-spark compatibility argv generation through mocked action facades. ## 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 * **Tests** * Added comprehensive test coverage for command adapter behavior verification. * **Chores** * Code cleanup and maintenance improvements to internal directives. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Remove broad coverage ignores from oclif command metadata and routing helpers now that they are directly unit-tested.
Stack Navigation
Changes
command-registry.tsandoclif-dispatch.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
New Features
Improvements