[READ-ONLY] Mirror of https://github.com/bombshell-dev/tools. Internal CLI to standardize tooling across all Bombshell projects
0

Configure Feed

Select the types of activity you want to include in your feed.

fix init (#40)

* fix(init): correct clone destination

* chore(changeset): update changeset

---------

Co-authored-by: paul valladares <85648028+dreyfus92@users.noreply.github.com>

authored by

Nate Moore
paul valladares
and committed by
GitHub
(Jun 20, 2026, 12:31 PM -0500) 22f87d0f a65a254e

+17 -4
+7
.changeset/fix-init-clone-dest.md
··· 1 + --- 2 + "@bomb.sh/tools": patch 3 + --- 4 + 5 + Fixes the `bsh init` command—it now points at the directory the template was actually cloned into. 6 + 7 + `init` / `init .` now scaffolds into the current directory in-place and uses the current directory's basename as the project name.
+10 -4
src/commands/init.ts
··· 1 1 import { readFile, writeFile } from 'node:fs/promises'; 2 + import { basename } from 'node:path'; 2 3 import { cwd } from 'node:process'; 3 4 import { pathToFileURL } from 'node:url'; 4 5 import { x } from 'tinyexec'; ··· 7 8 export async function init(ctx: CommandContext) { 8 9 const [_name = '.'] = ctx.args; 9 10 const cwdUrl = pathToFileURL(`${cwd()}/`); 10 - const name = 11 - _name === '.' ? new URL('../', cwdUrl).pathname.split('/').filter(Boolean).pop()! : _name; 12 - const dest = new URL('./.temp/', cwdUrl); 13 - for await (const line of x('pnpx', ['giget@latest', 'gh:bombshell-dev/template', name])) { 11 + // `.` scaffolds into the current directory; otherwise clone into a new `./<name>/`. 12 + const inPlace = _name === '.'; 13 + const name = inPlace ? basename(cwd()) : _name; 14 + const target = inPlace ? '.' : name; 15 + const dest = inPlace ? cwdUrl : new URL(`./${name}/`, cwdUrl); 16 + const gigetArgs = ['giget@latest', 'gh:bombshell-dev/template', target]; 17 + // `--force` lets the template extract into an existing (non-empty) directory. 18 + if (inPlace) gigetArgs.push('--force'); 19 + for await (const line of x('pnpx', gigetArgs)) { 14 20 console.log(line); 15 21 } 16 22