From 111887bd992259b05dda105535c4d6f076b3915e Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 18 Oct 2025 12:38:54 +0330 Subject: [PATCH 1/2] fix: use npx for portable completion scripts --- .changeset/crazy-beds-rhyme.md | 5 +++++ bin/cli.ts | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 .changeset/crazy-beds-rhyme.md diff --git a/.changeset/crazy-beds-rhyme.md b/.changeset/crazy-beds-rhyme.md new file mode 100644 index 0000000..87b3414 --- /dev/null +++ b/.changeset/crazy-beds-rhyme.md @@ -0,0 +1,5 @@ +--- +'@bomb.sh/tab': patch +--- + +fix: use npx for portable completion scripts instead of absolute paths diff --git a/bin/cli.ts b/bin/cli.ts index 27827a7..28e640b 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -71,18 +71,11 @@ async function main() { cli.parse(); } -// function generateCompletionScript(packageManager: string, shell: string) { -// const name = packageManager; -// const executable = process.env.npm_execpath -// ? `${packageManager} exec @bomb.sh/tab ${packageManager}` -// : `node ${process.argv[1]} ${packageManager}`; -// script(shell as any, name, executable); -// } - function generateCompletionScript(packageManager: string, shell: string) { const name = packageManager; - // this always points at the actual file on disk (TESTING) - const executable = `node ${process.argv[1]} ${packageManager}`; + const executable = process.env.npm_execpath + ? `npx --yes @bomb.sh/tab ${packageManager}` + : `node ${process.argv[1]} ${packageManager}`; script(shell as any, name, executable); } From 98d8dbb8b513991cbc2540c58ff96ddac426a5cb Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 18 Oct 2025 14:46:54 +0330 Subject: [PATCH 2/2] use npm user agent --- bin/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.ts b/bin/cli.ts index 28e640b..8c48fe1 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -73,7 +73,7 @@ async function main() { function generateCompletionScript(packageManager: string, shell: string) { const name = packageManager; - const executable = process.env.npm_execpath + const executable = process.env.npm_config_user_agent ? `npx --yes @bomb.sh/tab ${packageManager}` : `node ${process.argv[1]} ${packageManager}`; script(shell as any, name, executable);