Skip to content

feat(run): forward inspect flags to node targets#515

Merged
jdx merged 6 commits intomainfrom
feat/run-inspect-node-flags
May 5, 2026
Merged

feat(run): forward inspect flags to node targets#515
jdx merged 6 commits intomainfrom
feat/run-inspect-node-flags

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented May 5, 2026

Summary

  • Add aube run --inspect[=port] and --inspect-brk[=port].
  • Forward those flags as explicit Node argv for direct node ... scripts and local Node-backed .bin fallbacks.
  • Avoid using NODE_OPTIONS, so debugger flags do not leak into every nested Node process.
  • Add Bats coverage for direct Node scripts and local Node binary fallback.

Context

This addresses feedback from Discussion #345 asking for aube run --inspect test / --inspect-brk support. Yarn supports this shape for Node-backed binaries; npm and pnpm do not appear to forward these flags for run, so aube keeps the behavior narrowly scoped to commands it can identify as Node-backed.

Validation

  • cargo test -p aube commands::run::tests
  • cargo test -p aube commands::exec::tests
  • mise run test:bats test/run.bats
  • cargo fmt --check
  • cargo clippy -p aube --all-targets -- -D warnings

Note

Medium Risk
Changes how aube run constructs and executes commands (including .bin fallback resolution), which could affect script/binary invocation across platforms. Scope is constrained to detected Node-backed targets and covered by new unit/Bats tests.

Overview
aube run now accepts --inspect[=[[HOST:]PORT]] and --inspect-brk[=[[HOST:]PORT]] and forwards them as explicit Node argv when running direct node ... package.json scripts or when falling back to local Node-backed node_modules/.bin binaries.

This refactors execution helpers to thread node_args through script/bin execution, adds cross-platform logic in exec to resolve .bin shims/symlinks and detect Node interpreters before injecting args, and updates CLI docs plus Bats/unit test coverage for the new behavior.

Reviewed by Cursor Bugbot for commit 9498953. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 5, 2026

Greptile Summary

  • Introduces --inspect[=port] and --inspect-brk[=port] for aube run, threading node_args through all script and bin-execution paths without leaking via NODE_OPTIONS. The two previously flagged issues (overly-broad contains("node") shebang check, full-file read) are both addressed in this version.
  • Shim resolution (resolve_node_bin_target, is_node_backed_bin, inject_node_args) is carefully scoped: direct node … script commands are detected by word-boundary check, and bin shims are identified via shebang basename matching using file_stem().
  • parse_posix_node_path assumes a single relative path after $basedir/; colon-separated multi-entry NODE_PATH values would produce an invalid joined path and silently leave NODE_PATH unset.

Confidence Score: 5/5

Safe to merge — no P0 or P1 issues; the one finding is a minor silent no-op in an edge case.

All findings are P2. The shebang-check and file-read concerns from the previous review round are resolved. The core flag-forwarding logic, shim parsing, and injection guards are sound.

crates/aube/src/commands/exec.rs — parse_posix_node_path multi-entry NODE_PATH edge case.

Important Files Changed

Filename Overview
crates/aube/src/commands/exec.rs Adds node_bin_command, resolve_node_bin_target, is_node_backed_bin, and parse helpers for shim resolution. is_node_interpreter now correctly uses file_stem() (addressing the previous contains("node") concern), and is_node_backed_bin reads only 256 bytes. parse_posix_node_path has a fragile format assumption that could miss colon-separated NODE_PATH entries.
crates/aube/src/commands/run.rs Threads node_args through all run/script execution paths. inject_node_args correctly guards against node-gyp and similar prefixes. node_args_from_run_flags correctly handles optional port values.
test/run.bats Adds Bats tests covering both direct node script injection and local node binary fallback via shim resolution. Tests use process.execArgv to verify flag propagation.
aube.usage.kdl CLI schema updated with --inspect and --inspect-brk flags with optional [[HOST:]PORT] argument.
docs/cli/run.md Generated docs updated with new flag descriptions.
docs/cli/commands.json Generated commands.json updated with inspect/inspect-brk flag metadata.

Fix All in Claude Code

Reviews (5): Last reviewed commit: "fix(run): preserve bin shim env for insp..." | Re-trigger Greptile

Comment thread crates/aube/src/commands/exec.rs Outdated
Comment thread crates/aube/src/commands/exec.rs Outdated
Comment thread crates/aube/src/commands/run.rs Outdated
Comment thread crates/aube/src/commands/exec.rs Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4765106. Configure here.

Comment thread crates/aube/src/commands/exec.rs Outdated
@jdx jdx merged commit 0ad8bc3 into main May 5, 2026
18 checks passed
@jdx jdx deleted the feat/run-inspect-node-flags branch May 5, 2026 17:10
@greptile-apps greptile-apps Bot mentioned this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant