refactor(cli): wrap debug script with TypeScript command#3088
Conversation
This reverts commit 4ebeae4.
|
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 (2)
📝 WalkthroughWalkthroughThe PR updates debug.sh to delegate diagnostic collection to a compiled TypeScript CLI (dist/nemoclaw.js) when available, with fallback to the existing CLI wrapper. Environment variable ChangesDebug Wrapper & Token Redaction
Sequence DiagramsequenceDiagram
participant User as User/Script
participant Wrapper as debug.sh Wrapper
participant FS as Filesystem
participant NodeRuntime as Node Runtime
participant CLI as CLI Executable
User->>Wrapper: Invoke debug.sh with args
Wrapper->>FS: Check for dist/nemoclaw.js
alt Compiled CLI exists
Wrapper->>Wrapper: Resolve Node via NEMOCLAW_NODE<br/>or system node
alt Node found
Wrapper->>NodeRuntime: Execute Node binary
NodeRuntime->>CLI: Run dist/nemoclaw.js debug
CLI->>CLI: Collect diagnostics
CLI-->>User: Return output
else Node not found
Wrapper-->>User: Error: Node unavailable
end
else Compiled CLI absent
Wrapper->>CLI: Fallback: invoke nemoclaw debug
CLI->>CLI: Collect diagnostics
CLI-->>User: Return output
end
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 |
|
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. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Automated PR review summaryReviewed PR #3088: refactor(cli): wrap debug script with TypeScript command Recommendation
Installation and setup findings
What was validated
Failing tests and unresolved impact
Passing tests and why they matteredPassing test 1: debug.sh honors NEMOCLAW_NODE instead of a poisoned PATH node
Passing test 2: debug.sh still works as a compatibility entrypoint via installed nemoclaw fallback
Passing test 3: Wrapper executes the real TypeScript debug collector against the installed sandbox
Bottom line
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Clean shell→TS migration. scripts/debug.sh reduced from 363 lines to 33 — now a Node bootstrap wrapper that resolves NEMOCLAW_CLI_JS + NEMOCLAW_NODE and execs node dist/nemoclaw.js debug "$@", falling back to nemoclaw debug from PATH.
Verified feature parity: nemoclaw debug already lives at src/lib/debug-cli-command.ts with the section collectors (GPU/Docker/Sandbox Internals/Network/Kernel/Kernel Messages) implemented in src/lib/debug.ts. Public flags (--quick, --sandbox, --output) pass through verbatim. The full bash redact() / collect() machinery is gone — no dead code left behind.
Test changes are right-sized: the "sed fallback includes essential prefixes" test is replaced with "wrapper locates node from env", which still runs debug.sh --quick end-to-end with PATH constrained to fake binaries (now passing NEMOCLAW_NODE: process.execPath so the wrapper can find node), and continues to assert redaction of all literal-prefix tokens (nvapi-, nvcf-, ghp-, sk-) plus messaging tokens (xoxb-, xapp-, Discord bot tokens). Net redaction coverage unchanged.
Nit (non-blocking, intentional): The old debug.sh had a sed-based redaction fallback so the script could run on systems without node — supporting the curl -fsSL ... | bash -s -- --quick usage that was previously documented. The new wrapper exits 127 if node is unavailable, and the curl-pipe example has been removed from the help text. So that 'run from anywhere without node' workflow is intentionally retired. Matches the direction of the stack.
CI: pr.yaml rollup checks pass (commit-lint, dco, layer-boundary, check-hash, CodeRabbit). Self-hosted: 1 prior success on pull-request/3088. build-sandbox-images / macos-e2e / wsl-e2e / current self-hosted run still in progress at approval time.
Summary
Turns
scripts/debug.shinto a thin compatibility wrapper around the TypeScriptnemoclaw debugcommand. This removes duplicated shell diagnostic/redaction logic while preserving the script entrypoint for local checkouts.Changes
scripts/debug.shwith a wrapper that invokesdist/nemoclaw.js debugwhen available, then falls back tonemoclaw debug.NEMOCLAW_NODE,NODE, or PATH for constrained test environments.nodeis absent from PATH.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
Bug Fixes & Improvements
Tests