NemoClaw/scripts/debug.sh
Carlos Villela a71409dd1f
refactor(cli): wrap debug script with TypeScript command (#3088)
## Summary
Turns `scripts/debug.sh` into a thin compatibility wrapper around the
TypeScript `nemoclaw debug` command. This removes duplicated shell
diagnostic/redaction logic while preserving the script entrypoint for
local checkouts.

## Changes
- Replace the large shell diagnostic implementation in
`scripts/debug.sh` with a wrapper that invokes `dist/nemoclaw.js debug`
when available, then falls back to `nemoclaw debug`.
- Resolve Node through `NEMOCLAW_NODE`, `NODE`, or PATH for constrained
test environments.
- Update secret redaction tests to verify the wrapper uses the compiled
TypeScript redactor even when `node` is absent from PATH.

## 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

* **Bug Fixes & Improvements**
* Enhanced secret redaction to protect additional token types, including
API keys, GitHub credentials, and messaging service tokens.
* Improved diagnostic collection with better Node.js environment
handling.

* **Tests**
* Added comprehensive token redaction tests covering multiple secret
patterns.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
2026-05-06 19:51:33 +00:00

34 lines
990 B
Bash
Executable file

#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Compatibility wrapper for the TypeScript NemoClaw debug collector.
#
# Usage:
# ./scripts/debug.sh [--quick] [--sandbox NAME] [--output PATH]
# nemoclaw debug [--quick] [--sandbox NAME] [--output PATH]
set -euo pipefail
SCRIPT_PATH="${BASH_SOURCE[0]:-$0}"
case "$SCRIPT_PATH" in
*/*) SCRIPT_DIR="${SCRIPT_PATH%/*}" ;;
*) SCRIPT_DIR="." ;;
esac
SCRIPT_DIR="$(cd "$SCRIPT_DIR" && pwd -P)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
CLI_JS="${NEMOCLAW_CLI_JS:-$REPO_ROOT/dist/nemoclaw.js}"
if [ -f "$CLI_JS" ]; then
NODE_BIN="${NEMOCLAW_NODE:-${NODE:-}}"
if [ -z "$NODE_BIN" ]; then
NODE_BIN="$(command -v node || true)"
fi
if [ -z "$NODE_BIN" ]; then
echo "ERROR: node is required to run NemoClaw diagnostics." >&2
exit 127
fi
exec "$NODE_BIN" "$CLI_JS" debug "$@"
fi
exec nemoclaw debug "$@"