refactor(ts-migration): move onboard and cli to typescript#1673
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe pull request migrates CLI implementation from JavaScript to TypeScript. The entry point Changes
Sequence DiagramsequenceDiagram
participant CLI as CLI Dispatcher
participant OpenShell as OpenShell Binary
participant Gateway as Gateway (SSH)
participant Registry as Sandbox Registry
participant Reconcile as Reconciliation
CLI->>OpenShell: Resolve & invoke binary
OpenShell-->>CLI: Running
CLI->>Registry: Validate sandbox names
Registry-->>CLI: Sandbox list
CLI->>Gateway: Check each sandbox status via SSH
alt Gateway Responsive
Gateway-->>CLI: Sandbox present/missing
CLI->>Reconcile: Classify state (present/missing/error)
else Gateway Unresponsive
Gateway-->>CLI: Connection error
CLI->>CLI: Re-establish nemoclaw gateway
CLI->>Gateway: Retry sandbox reconciliation
end
alt Recovery Needed
CLI->>Gateway: Run recovery script (cleanup locks)
Gateway->>Gateway: Clean temp files, restart
CLI->>Gateway: Re-establish port forward
end
Reconcile-->>CLI: Reconciliation outcome
CLI-->>CLI: Execute command (connect/status/deploy)
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~75 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…rd-cli Signed-off-by: Aaron Erickson <aerickson@nvidia.com> # Conflicts: # scripts/migrate-js-to-ts.ts # test/skills-frontmatter.test.ts
- add the final mechanical migration phase manifest - mechanically move `bin/lib/onboard.js` to `src/lib/onboard.ts` - mechanically move `bin/nemoclaw.js` to `src/nemoclaw.ts` - leave compatibility wrappers in `bin/` - rename the remaining root CLI tests from `.js` to `.ts` - retarget source-inspection assertions to the new TS source where appropriate - npm run build:cli - npm run typecheck:cli - npm run lint - npx vitest run test/cli.test.ts test/install-preflight.test.ts test/onboard-readiness.test.ts test/onboard-selection.test.ts test/onboard.test.ts test/runner.test.ts test/credential-exposure.test.ts test/gateway-cleanup.test.ts test/shellquote-sandbox.test.ts - npm test <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * Implemented CLI command dispatcher with support for sandbox management (connect, status, destroy). * Added gateway health checks and automatic recovery mechanisms. * Enhanced sandbox validation and reconciliation against live gateway state. * Added credentials and policy management commands. * **Chores** * Migrated CLI implementation to TypeScript. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Aaron Erickson <aerickson@nvidia.com>
Main underwent a large-scale refactoring while this PR was open: - JS→TS migration: bin/lib/onboard.js → src/lib/onboard.ts, bin/nemoclaw.js → src/nemoclaw.ts (NVIDIA#1673) - Legacy shim removal: 18 bin/lib/*.js files deleted (NVIDIA#1713) - Command handler extraction: src/lib/onboard-command.ts (NVIDIA#1710) - Test renames: .js → .ts across all test files Conflict resolution: - bin/nemoclaw.js: accept main's 6-line launcher (logic in src/nemoclaw.ts) - src/lib/onboard.ts: take main's build context staging (fromDockerfile + agent + stageOptimized), keep Jetson gateway patch functions - docs/get-started/quickstart.md: use main's table format, add Jetson row - test/onboard.test.js: accept deletion (migrated to .ts) Re-ported Jetson features onto new TS structure: - Add setup-jetson to GLOBAL_COMMANDS, help text, and switch dispatch in src/nemoclaw.ts (not a deprecated alias — runs setup-jetson.sh) - Add Jetson to ci/platform-matrix.json (source of truth for docs table) - Add getGatewayImageTag and patchGatewayImageForJetson to exports in src/lib/onboard.ts - Port 4 Jetson tests to test/onboard.test.ts (dist/lib/onboard paths) Verified on Jetson Orin Nano Super (8GB, JetPack 6.x, Node 22.22.0): - Build: tsc passes - 4 Jetson tests: all pass - GPU: jetson=true, 7619 MB unified memory - Gateway: iptables v1.8.10 (legacy), io.nemoclaw.jetson-patched=true - Sandbox: Phase Ready - Inference: openclaw agent → "2 + 2 = 4." - Path: sandbox → host.openshell.internal:11434 → Ollama → nemotron-3-nano:4b Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Main underwent a large-scale refactoring while this PR was open: - JS→TS migration: bin/lib/onboard.js → src/lib/onboard.ts, bin/nemoclaw.js → src/nemoclaw.ts (NVIDIA#1673) - Legacy shim removal: 18 bin/lib/*.js files deleted (NVIDIA#1713) - Command handler extraction: src/lib/onboard-command.ts (NVIDIA#1710) - Test renames: .js → .ts across all test files Conflict resolution: - bin/nemoclaw.js: accept main's 6-line launcher (logic in src/nemoclaw.ts) - src/lib/onboard.ts: take main's build context staging (fromDockerfile + agent + stageOptimized), keep Jetson gateway patch functions - docs/get-started/quickstart.md: use main's table format, add Jetson row - test/onboard.test.js: accept deletion (migrated to .ts) Re-ported Jetson features onto new TS structure: - Add setup-jetson to GLOBAL_COMMANDS, help text, and switch dispatch in src/nemoclaw.ts (not a deprecated alias — runs setup-jetson.sh) - Add Jetson to ci/platform-matrix.json (source of truth for docs table) - Add getGatewayImageTag and patchGatewayImageForJetson to exports in src/lib/onboard.ts - Port 4 Jetson tests to test/onboard.test.ts (dist/lib/onboard paths) Verified on Jetson Orin Nano Super (8GB, JetPack 6.x, Node 22.22.0): - Build: tsc passes - 4 Jetson tests: all pass - GPU: jetson=true, 7619 MB unified memory - Gateway: iptables v1.8.10 (legacy), io.nemoclaw.jetson-patched=true - Sandbox: Phase Ready - Inference: openclaw agent → "2 + 2 = 4." - Path: sandbox → host.openshell.internal:11434 → Ollama → nemotron-3-nano:4b Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary - add the final mechanical migration phase manifest - mechanically move `bin/lib/onboard.js` to `src/lib/onboard.ts` - mechanically move `bin/nemoclaw.js` to `src/nemoclaw.ts` - leave compatibility wrappers in `bin/` - rename the remaining root CLI tests from `.js` to `.ts` - retarget source-inspection assertions to the new TS source where appropriate ## Testing - npm run build:cli - npm run typecheck:cli - npm run lint - npx vitest run test/cli.test.ts test/install-preflight.test.ts test/onboard-readiness.test.ts test/onboard-selection.test.ts test/onboard.test.ts test/runner.test.ts test/credential-exposure.test.ts test/gateway-cleanup.test.ts test/shellquote-sandbox.test.ts - npm test <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Implemented CLI command dispatcher with support for sandbox management (connect, status, destroy). * Added gateway health checks and automatic recovery mechanisms. * Enhanced sandbox validation and reconciliation against live gateway state. * Added credentials and policy management commands. * **Chores** * Migrated CLI implementation to TypeScript. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Aaron Erickson <aerickson@nvidia.com>
…detection (#1978) ## Summary Supersedes #1716. Using `localhost` can resolve to IPv6 (`::1`) on some systems, causing local inference health checks, probe commands, and model queries to fail silently. This replaces all host-side `localhost` references with explicit `127.0.0.1` for deterministic IPv4 behavior. Based on the original work in #1716 by @chandler-barlow — the JS→TS migration (#1673) made the original PR unrebaseable, so the change has been re-applied on the current codebase with attribution. ## Changes - `src/lib/local-inference.ts`: validation URLs, health endpoints, error messages, model queries, warmup/probe commands - `src/lib/nim.ts`: NIM health check curls - `src/lib/onboard.ts`: Ollama and vLLM detection curls - `src/lib/local-inference.test.ts`: updated expectations - `src/lib/nim.test.ts`: updated mock matchers - `test/cli.test.ts`: updated status output assertion - `test/onboard-selection.test.ts`: updated mock matchers - `test/e2e/test-gpu-e2e.sh`: host-side Ollama curls ## Test plan - [x] 50 unit tests passing (local-inference + nim) - [x] Zero `http://localhost:11434` or `http://localhost:8000` references remain in src/ test/ scripts/ - [x] Dashboard URLs intentionally unchanged (different scope) Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved reliability of local inference and onboarding checks by standardizing local service addresses to the loopback IP. * **Tests** * Updated unit, integration, and end-to-end test expectations and scripts to match the adjusted loopback addressing and health-check behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> Co-authored-by: Chandler Barlow <cbarlow@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
bin/lib/onboard.jstosrc/lib/onboard.tsbin/nemoclaw.jstosrc/nemoclaw.tsbin/.jsto.tsTesting
Summary by CodeRabbit
New Features
Chores