refactor(cli): use oclif flag relationships - #2927
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 (2)
📝 WalkthroughWalkthroughFlags for onboard and policy CLI commands were made mutually exclusive where appropriate; policy command examples were added; tests were added/updated to verify flag validation and error messages, and a new test ensures onboard's resume/fresh combination rejects before action dispatch. ChangesCLI Flag Exclusivity, Metadata, and Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
## Summary Introduce a shared NemoClaw oclif command base so common parser conventions live in one place instead of every command class redefining them. ## Stack Navigation - Position: 33 of 60 - Previous PR: [#2925 — refactor(cli): render public oclif help](#2925) - Next PR: [#2927 — refactor(cli): use oclif flag relationships](#2927) ## Changes - Added `NemoClawCommand` with common `-h/--help` base flag handling. - Centralized JSON formatting used by oclif JSON-enabled commands. - Migrated low-risk list, status, and maintenance command adapters to the shared base. ## 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 - [ ] 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 * **Refactor** * Restructured CLI command architecture for backup, upgrade, garbage collection, list, and status operations. All commands continue to function with consistent help and JSON output support. <!-- 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 Stop rebuilding argv strings in lifecycle oclif adapters and pass typed option objects from the parsed oclif result into action facades. ## Stack Navigation - Position: 35 of 60 - Previous PR: [#2927 — refactor(cli): use oclif flag relationships](#2927) - Next PR: [#2929 — refactor(cli): parse durations with oclif flags](#2929) ## Changes - Added typed lifecycle option shapes and compatibility normalizers for destroy, rebuild, gc, and upgrade-sandboxes. - Updated lifecycle command classes to pass typed options instead of reconstructed legacy argv arrays. - Kept action-level compatibility with existing internal argv callers. - Replaced a gc source-shape assertion with behavior-level option normalization coverage. ## 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 * **Refactor** * Internal improvements to command option handling for enhanced type safety and consistency across sandbox management operations. * **Tests** * Added test coverage for option normalization utilities to ensure robust handling of configuration flags. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Move simple cross-flag validation into oclif metadata so NemoClaw does not maintain duplicate parser logic for relationships oclif already supports.
Stack Navigation
Changes
--resumeand--freshmutually exclusive through oclif flag metadata.--from-fileand--from-dirmutually exclusive through oclif flag metadata.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
Improvements
Documentation
Tests