Skip to content

fix(cli): remove duplicate shebang causing Self-Scan Skills failure#4

Merged
MackDing merged 1 commit into
mainfrom
fix/cli-double-shebang
May 6, 2026
Merged

fix(cli): remove duplicate shebang causing Self-Scan Skills failure#4
MackDing merged 1 commit into
mainfrom
fix/cli-double-shebang

Conversation

@MackDing

@MackDing MackDing commented May 6, 2026

Copy link
Copy Markdown
Contributor

Root Cause

apps/cli/src/cli.ts had #!/usr/bin/env node on line 1, AND apps/cli/tsup.config.ts injects the shebang via banner for ESM output. Result: dist/cli.js started with two consecutive #!/usr/bin/env node lines. Node executes the first as the interpreter directive, then parses the second as JS — syntax error.

This broke the Self-Scan Skills CI job which runs node apps/cli/dist/cli.js scan ... after build.

Fix

Replaced the source shebang with a comment. tsup banner remains the single source of truth for the ESM shebang.

Verification

$ pnpm turbo build --filter @claws-shield/cli --force
$ head -3 apps/cli/dist/cli.js
#!/usr/bin/env node

// src/cli.ts
$ node apps/cli/dist/cli.js --version
1.0.0

CJS output (dist/cli.cjs) unaffected — banner is ESM-only, and source shebang was previously being bundled into CJS as garbage too (now also clean).

Note

Pre-existing lint warnings re: moduleResolution are unrelated to this PR.

tsup config injects shebang via banner for ESM output. Having
the shebang in source caused dist/cli.js to have two consecutive
shebang lines, where the second was parsed as a syntax error when
node executed the file (Self-Scan Skills CI failure).

Verified: head -3 dist/cli.js post-rebuild shows single shebang.
@MackDing
MackDing merged commit f2093f7 into main May 6, 2026
4 of 6 checks passed
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