Repository navigation
refactor(cli): harden oclif bridge - #2774
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
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 (4)
📝 WalkthroughWalkthroughThe oclif command runner is refactored to explicitly manage command execution by setting the bin value from CLI_NAME, finding and loading commands manually, and executing prerun and postrun hooks around command instances. A new test validates the Changes
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)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
## Summary Draft stacked PR on top of #2774. Migrates the global `status` and tunnel service commands onto oclif wrappers while keeping the public legacy command shapes intact. ## Changes - Add oclif command classes for `status`, `tunnel start`, `tunnel stop`, and deprecated `start`/`stop` aliases. - Move global status dependency wiring into `src/lib/status-command-deps.ts` so the oclif wrapper can reuse `showStatusCommand()` without the legacy dispatcher owning status internals. - Route legacy global dispatch for `status`, `tunnel`, `start`, and `stop` through `runOclif()`. - Add CLI help coverage for the migrated status and tunnel 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 - [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) ## AI Disclosure - [x] AI-assisted — tool: OpenAI Codex --- 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 a new status command to display sandbox/service/messaging health and recent gateway logs * Added tunnel:start and tunnel:stop commands to manage public-URL tunnels * **Deprecated** * Top-level start and stop remain as deprecated aliases for tunnel:start/tunnel:stop * **Tests** * Added help-mode and unit tests for status, tunnel commands, deprecated aliases, runner behavior, sharing, and status deps * **Refactor** * CLI now delegates to the oclif runner and preserves branded help/output; top-level CLI dispatch forwards to oclif commands <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- STACK-CONTEXT:START --> ## Stack position > [!NOTE] > This PR is part of a stacked refactor. Please review/merge in stack order. > The current PR is highlighted below. This is PR **#2775** in the stacked CLI oclif refactor series. - Merge after: **`main`** - Next PR: **#2776** - Stack position: **1 / 37** ## Full stack Merge from top to bottom. | Order | PR | Merge after | Title | |---:|---|---|---| | 1 | **#2775** | `main` | **refactor(cli): migrate status and tunnel commands to oclif** | | 2 | #2776 | #2775 | refactor(cli): migrate debug uninstall and gateway-token to oclif | | 3 | #2786 | #2776 | refactor(cli): migrate credentials commands to oclif | | 4 | #2787 | #2786 | refactor(cli): migrate sandbox inspection commands to oclif | | 5 | #2788 | #2787 | refactor(cli): migrate maintenance commands to oclif | | 6 | #2796 | #2788 | refactor(cli): migrate sandbox logs command to oclif | | 7 | #2797 | #2796 | refactor(cli): migrate skill install command to oclif | | 8 | #2798 | #2797 | refactor(cli): migrate snapshot list and create to oclif | | 9 | #2802 | #2798 | refactor(cli): migrate shields commands to oclif | | 10 | #2803 | #2802 | refactor(cli): migrate channels mutation commands to oclif | | 11 | #2804 | #2803 | refactor(cli): migrate policy mutation commands to oclif | | 12 | #2805 | #2804 | refactor(cli): migrate snapshot restore command to oclif | | 13 | #2806 | #2805 | refactor(cli): migrate destroy command to oclif | | 14 | #2807 | #2806 | refactor(cli): migrate rebuild command to oclif | | 15 | #2808 | #2807 | refactor(cli): migrate connect command to oclif | | 16 | #2809 | #2808 | refactor(cli): migrate deploy command to oclif | | 17 | #2810 | #2809 | refactor(cli): migrate onboard aliases to oclif | | 18 | #2811 | #2810 | refactor(cli): migrate help and version commands to oclif | | 19 | #2814 | #2811 | refactor(cli): centralize legacy oclif dispatch | | 20 | #2815 | #2814 | refactor(cli): drop trivial oclif wrapper helpers | | 21 | #2816 | #2815 | refactor(cli): centralize sandbox runtime bridge | | 22 | #2817 | #2816 | refactor(cli): centralize policy and channels runtime bridge | | 23 | #2818 | #2817 | refactor(cli): centralize global runtime bridge | | 24 | #2819 | #2818 | refactor(cli): collapse runtime bridge exports | | 25 | #2826 | #2819 | refactor(cli): introduce sandbox runtime action facade | | 26 | #2827 | #2826 | refactor(cli): introduce policy and channels action facade | | 27 | #2828 | #2827 | refactor(cli): introduce global command action facade | | 28 | #2830 | #2828 | refactor(cli): extract root help action | | 29 | #2831 | #2830 | refactor(cli): extract deploy action | | 30 | #2832 | #2831 | refactor(cli): extract onboard actions | | 31 | #2835 | #2832 | refactor(cli): extract openshell runtime helpers | | 32 | #2836 | #2835 | refactor(cli): extract sandbox logs action | | 33 | #2837 | #2836 | refactor(cli): extract maintenance actions | | 34 | #2838 | #2837 | refactor(cli): extract snapshot actions | | 35 | #2839 | #2838 | refactor(cli): extract policy and channels actions | | 36 | #2840 | #2839 | refactor(cli): extract credentials and list runtime bits | | 37 | #2841 | #2840 | refactor(cli): shrink runtime bridge | <!-- STACK-CONTEXT:END --> --------- Signed-off-by: Carlos Villela <cvillela@nvidia.com> Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
Summary
Hardens the oclif bridge introduced for
nemoclaw listso command help uses the active launcher branding, including thenemohermesalias. It also centralizes legacy dispatch through arunOclif()helper and relaxes uninstall helper test timeouts that were flaky under full-suite load.Changes
CLI_NAMEand invoke command classes with that config so alias help renders correctly.runOclif()delegation helper insrc/nemoclaw.tsand routelistthrough it.nemohermes list --helpbranding.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)AI Disclosure
Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Tests
Refactor