refactor(cli): validate logs flags with oclif - #2905
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. |
|
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)
📝 WalkthroughWalkthroughThe ChangesLog Filtering and Output Options
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
## Summary Add oclif examples to low-risk global and utility commands so generated help has concrete usage snippets. This starts the oclif UX pass without changing command behavior. ## Stack Navigation - Position: 12 of 60 - Previous PR: [#2901 — refactor(cli): expose explicit main entrypoint](#2901) - Next PR: [#2905 — refactor(cli): validate logs flags with oclif](#2905) ## Changes - Added examples for `list`, global `status`, `gateway-token`, `credentials`, `credentials list`, and `credentials reset`. - Added examples for `backup-all`, `upgrade-sandboxes`, and `gc`. - Added examples for `uninstall`, `tunnel start`, `tunnel stop`, and deprecated `start`/`stop` aliases. - Added a help flag declaration to the uninstall oclif adapter to align its metadata with other utility commands. ## 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 ## Release Notes * **New Features** * Added `sandbox doctor` command for comprehensive health diagnostics across sandbox infrastructure, gateway, and services * Introduced automated sandbox process recovery and health probing capabilities * Enhanced sandbox lifecycle management with improved destroy, rebuild, and skill installation workflows * **Documentation** * Expanded CLI usage examples across multiple commands for improved discoverability and guidance <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
LGTM after rebase. Tiny additive change — 1 file / +6 / -0, just static examples = [...] on SandboxLogsCommand for richer --help output.
Note: the PR description describes substantive flag-validation work (Flags.integer({min:1}), --since regex, SandboxLogsOptions wiring, etc.) but all of that is already present in sandbox-logs-cli-command.ts on main — it landed via earlier PRs in the stack and got absorbed by the rebase. The actual remaining delta here is the examples block.
Public surface unchanged (examples only render in --help). CI: pr.yaml fully green including CodeRabbit; pr-self-hosted build-sandbox-images/arm64 still in flight at review time.
Nit (non-blocking): consider updating the PR description before merging so the squash-merge commit message accurately reflects what's actually being added (examples), not the substantive work that already landed.
## 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 `doctor` and `config get` validation stricter in the command adapter. ## Stack Navigation - Position: 14 of 60 - Previous PR: [#2905 — refactor(cli): validate logs flags with oclif](#2905) - Next PR: [#2907 — refactor(cli): tighten policy and channel parser validation](#2907) ## Changes - Added examples for `connect`, sandbox-scoped `status`, `doctor`, `config get`, `policy-list`, and `channels list` adapters. - Made `sandbox:doctor` a strict oclif command with a required sandbox arg and `--json` flag. - Moved `config get --format` validation into oclif with `json|yaml` options and removed the adapter-level manual format check. - Preserved public `doctor --help` output through legacy dispatch and expanded diagnostics validation coverage. - Updated the hidden command registry metadata for `config get` 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 * **New Features** * Added command usage examples to help documentation for configuration, status, policy, and channels commands. * Enhanced doctor command with explicit `--json` flag support. * **Improvements** * Updated configuration command help text to clearly advertise available options (`--key` and `--format json|yaml`). * Restricted `--format` flag to `json` and `yaml` values with stricter validation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Move the sandbox logs command's
--tail,-n,--since, and--followoption 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
Changes
SandboxLogsOptionsand wiredsandbox:logsto pass structured log options instead of a bare follow boolean.--tail/-nwithFlags.integer({ min: 1 })and kept custom--sinceduration validation in the oclif command.--sinceavoids an unfiltered gateway tail.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
Release Notes
sandbox:logscommand now supports--tail/-nflag to display a specific number of log lines--sinceflag to filter logs from a specified duration with validation and helpful error messages