refactor(cli): improve sandbox diagnostic command metadata - #2906
Conversation
|
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 failedPull request was closed or merged during review 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 (7)
📝 WalkthroughWalkthroughThe PR removes legacy dispatch handling and migrates sandbox commands to oclif-based argument and flag parsing with constrained options. The ChangesCommand Parsing Modernization & Legacy Dispatch Removal
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 |
## Summary Move the sandbox logs command's `--tail`, `-n`, `--since`, and `--follow` option shape into the oclif adapter so invalid flag values fail before any OpenShell calls. This also carries the log filter options through the logs action and updates help/registry metadata for the new flags. ## Stack Navigation - Position: 13 of 60 - Previous PR: [#2902 — refactor(cli): add oclif examples for utility commands](#2902) - Next PR: [#2906 — refactor(cli): improve sandbox diagnostic command metadata](#2906) ## Changes - Added `SandboxLogsOptions` and wired `sandbox:logs` to pass structured log options instead of a bare follow boolean. - Modeled `--tail`/`-n` with `Flags.integer({ min: 1 })` and kept custom `--since` duration validation in the oclif command. - Updated log source argument construction so tail counts flow to both OpenClaw and OpenShell logs, while `--since` avoids an unfiltered gateway tail. - Expanded logs help metadata and root command registry flags. - Added CLI and command-adapter coverage for tail, since, follow, help, malformed values, and unknown flags. ## 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** * The `sandbox:logs` command now supports `--tail/-n` flag to display a specific number of log lines * Added `--since` flag to filter logs from a specified duration with validation and helpful error messages * Updated command documentation with usage examples <!-- 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>
prekshivyas
left a comment
There was a problem hiding this comment.
LGTM after rebase. 7 files / +61 / -9 — small, well-tested.
Two intentional validation tightenings (both declared in the PR description, both well-covered by tests):
SandboxDoctorCliCommand:strict = false→strict = truewith explicitArgs.stringfor sandboxName andFlags.booleanfor--json. Unknown flags like--bogusare now rejected at parse time instead of silently ignored. Test added.SandboxConfigGetCommand.--format: manual format check replaced with oclif'soptions: ["json", "yaml"]. Same non-zero exit, slightly different error message wording (still contains--format,json,yaml). Test added.
Plus examples added to connect/status/doctor/config get/policy-list/channels list and doctor --help now routes through legacy dispatch's help branch so user-facing help stays free of sandbox:doctor command-id leakage.
src/nemoclaw.ts untouched — cumulative ~16-orphan debt unchanged. CI: pr.yaml mostly green; pr-self-hosted builds and wsl-e2e/checks still in flight at review time. No failures.
## Summary Tighten oclif-owned validation and help metadata for policy and messaging channel mutation commands. This moves missing custom policy path and channel-name validation into strict command parsing before action dispatch. ## Stack Navigation - Position: 15 of 60 - Previous PR: [#2906 — refactor(cli): improve sandbox diagnostic command metadata](#2906) - Next PR: [#2908 — refactor(cli): improve snapshot command metadata](#2908) ## Changes - Added examples for `policy-add`, `policy-remove`, and channel add/remove/start/stop commands. - Removed the hidden raw `policy-add` adapter so missing `--from-file` and `--from-dir` values are handled by oclif. - Made channel mutation commands require a `<channel>` arg before dispatch. - Updated command registry metadata for channel mutation arguments. - Added unit and CLI coverage for missing parser-owned values. ## 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 usage examples to channel and policy mutation command help documentation. * **Bug Fixes** * Channel mutation commands now enforce the channel argument as required. * Policy add command validates that `--from-file` flag includes a path value. * **Chores** * Removed legacy command variant for policy operations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Improve the oclif metadata and parser-owned validation for read-only sandbox diagnostic commands. This keeps public sandbox-scoped help output stable while making
doctorandconfig getvalidation stricter in the command adapter.Stack Navigation
Changes
connect, sandbox-scopedstatus,doctor,config get,policy-list, andchannels listadapters.sandbox:doctora strict oclif command with a required sandbox arg and--jsonflag.config get --formatvalidation into oclif withjson|yamloptions and removed the adapter-level manual format check.doctor --helpoutput through legacy dispatch and expanded diagnostics validation coverage.config getflags.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
--jsonflag support.Improvements
--keyand--format json|yaml).--formatflag tojsonandyamlvalues with stricter validation.