Skip to content

fix: default to cwd when --reach is used without explicit target#1121

Merged
mtorp merged 2 commits intov1.xfrom
fix/reach-target-validation-non-tty
Mar 19, 2026
Merged

fix: default to cwd when --reach is used without explicit target#1121
mtorp merged 2 commits intov1.xfrom
fix/reach-target-validation-non-tty

Conversation

@mtorp
Copy link
Contributor

@mtorp mtorp commented Mar 19, 2026

Summary

  • Fixed socket scan create --reach failing with input validation errors when no explicit target is passed in non-TTY environments (e.g. Jenkins CI). The interactive select() prompt silently returns undefined when stdin is not a TTY (due to wrapPrompt swallowing non-TypeError errors), causing suggestTarget() to return [] and all reach validations to fail.
  • Now defaults to . (cwd) when --reach is used without a target, consistent with --reach requiring exactly one directory target.
  • Also fixed latent bug where cli.input || [cwd] never fell back to [cwd] because empty arrays are truthy in JS.
  • Updated @coana-tech/cli to 14.12.200 and bumped CLI version to 1.1.74.

Fixes ENG-4810

Test plan

  • Run socket scan create --reach --org <org> --repo <repo> --branch <branch> without explicit target — should succeed using cwd
  • Run same command with explicit . target — should still work as before
  • Run in non-TTY environment (e.g. echo "" | socket scan create --reach ...) — should no longer fail with validation errors
  • Existing tests pass (24/25 — 1 pre-existing snapshot mismatch unrelated to this change)

🤖 Generated with Claude Code


Note

Low Risk
Low risk: small CLI input-handling change scoped to socket scan create --reach plus a routine dependency/version bump; main impact is defaulting the target to . in non-interactive runs.

Overview
Fixes socket scan create --reach when run without an explicit target by correctly detecting an empty cli.input array and defaulting the reachability target to . instead of falling back to an interactive prompt (which fails in non-TTY CI).

Bumps the CLI version to 1.1.74, updates @coana-tech/cli to 14.12.200, and records the change in CHANGELOG.md.

Written by Cursor Bugbot for commit 572fbcc. Configure here.

When `socket scan create --reach` is run without an explicit target path,
the CLI previously relied on an interactive prompt to ask the user to
confirm the current directory. In non-TTY environments (e.g. Jenkins CI),
the select() prompt silently fails because wrapPrompt swallows non-TypeError
errors, causing suggestTarget() to return [] and all reach validations to
fail with confusing "Input error: At least one TARGET (missing)" errors.

Now defaults to '.' (cwd) when --reach is used without a target, which is
consistent with --reach requiring exactly one directory target.

Also bumps @coana-tech/cli to 14.12.200 and CLI version to 1.1.74.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@socket-security
Copy link

socket-security bot commented Mar 19, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​coana-tech/​cli@​14.12.197 ⏵ 14.12.200961008098 +1100

View full report

@mtorp mtorp requested a review from BarrensZeppelin March 19, 2026 09:14
@socket-security-staging
Copy link

socket-security-staging bot commented Mar 19, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​coana-tech/​cli@​14.12.197 ⏵ 14.12.200971008098 +1100

View full report

When `socket scan create --reach` is run without an explicit target path,
the CLI previously relied on an interactive prompt to ask the user to
confirm the current directory. In non-TTY environments (e.g. Jenkins CI),
the select() prompt silently fails because wrapPrompt swallows non-TypeError
errors, causing suggestTarget() to return [] and all reach validations to
fail with confusing "Input error: At least one TARGET (missing)" errors.

Now falls back to '.' (cwd) when the prompt returns empty, preserving the
interactive prompt for TTY users while gracefully handling non-TTY
environments.

Also bumps @coana-tech/cli to 14.12.200 and CLI version to 1.1.74.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mtorp mtorp force-pushed the fix/reach-target-validation-non-tty branch from 220887d to 35a901c Compare March 19, 2026 09:30
@mtorp mtorp enabled auto-merge (squash) March 19, 2026 09:32
@mtorp mtorp merged commit 390598f into v1.x Mar 19, 2026
7 checks passed
@mtorp mtorp deleted the fix/reach-target-validation-non-tty branch March 19, 2026 09:33
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.

2 participants