Bun.which — scaffold tool probes (bun + git)
Accept. Smallest possible scope: two probes, no new flags, no
Review verdict (2026-05-27)
Accept. Smallest possible scope: two probes, no new flags, no new CLI surface. Fails fast on missing bun (the scaffolder needs it to run bun install), warns on missing git (skips the optional git init), uses Bun.which() which is one-line per probe. Saves the which npm dep and matches what users expect from polished scaffolders.
Scope pins:
- Two probes only.
bun(fail) +git(warn). Noclaude,docker,node, etc. - Probes run before template copy. If
bunis missing, the user's filesystem is untouched. - No auto-install. We never install tools on the user's behalf.
--no-gitstill wins. User opt-out continues to work as today.
Out of scope for this RFC:
patties doctorcommand. Richer probes (claude, docker, lockfile freshness, biome config) belong in a future doctor spec, not increate-patties.- Cross-platform
whichquirks. Bun's implementation handles.exeon Windows; this RFC trusts that. - Bun version-floor enforcement. Out of scope for this RFC.
Summary
Bun.which("git") returns the absolute path of the executable in PATH, or null. Use it in create-patties to (a) fail fast if bun is missing and (b) warn + skip git init if git is missing.
Motivation
create-patties today runs bun install and git init blind: if either binary is missing, the user gets a confusing mid-pipeline failure with half a project on disk. A pre-flight probe takes ~5 lines to write and makes the failure mode either fail-fast-with-message (bun missing) or scaffold-cleanly-with- warning (git missing).
Bun.which is the right primitive: built-in, cross-platform, handles .exe resolution on Windows, returns null on miss without throwing.
Proposal
Probe module
// packages/create-patties/src/probes.ts
export function probeTools(): void {
if (!Bun.which("bun")) {
console.error(
"create-patties: `bun` not found in PATH. " +
"Install Bun from https://bun.sh and re-run.",
)
process.exit(1)
}
}
export function hasGit(): boolean {
return Bun.which("git") !== null
}
Behavior changes
probeTools() runs after arg-parse + directory-validate, before template copy. The git-init step (was step 9 in the existing behavior list) consults hasGit() and prints a warn line if false.
Trade-offs
bunprobe is theoretically redundant underbunx— but defends against shipped-binary / clobbered-PATH cases. Cheap insurance.- Warn-only on
gitrather than fail keeps the scaffold useful for users on locked-down corporate machines without git.
Open questions
- Should we surface bun version too (
Bun.version>= some minimum)? Deferred — separate concern; if we ever bump a minimum Bun version, open a follow-up RFC. - Cross-platform
whichbehavior on Windows verified by Bun's implementation; not re-verified here.