Add git push-to-deploy (git push bool main)#11
Conversation
Run `bool git init` to register a `bool` remote, then `git push bool main` to deploy. Git invokes the new `git-remote-bool` helper when it sees the `bool::<slug>` URL scheme. The helper: - Speaks the git remote-helper protocol on stdin/stdout. - Accepts pushes (we don't track remote refs — empty `list for-push` means git treats every local ref as new). - For each `push <src>:<dst>`, resolves the source ref, materializes it into a temporary detached `git worktree`, and runs `bool deploy <slug>` there with a `git push <branch> (<sha7>)` commit message. - Writes `ok <ref>` / `error <ref> <reason>` back so git prints the familiar `* [new branch] main -> main` summary. `bin/git-remote-bool.js` is registered in package.json `bin` so a global install puts it on PATH alongside `bool`, where git can find it. The new `bool git init` command adds (or updates) the remote from the project's `.bool/config` slug.
|
|
||
| // Child stderr forwards to the user; child stdout is discarded so it | ||
| // doesn't pollute the helper protocol on our stdout. | ||
| const deploy = spawnSync('bool', ['deploy', slug, '-m', message], { |
There was a problem hiding this comment.
🔴 bool deploy called without explicit directory arg causes slug/directory ambiguity in git push-to-deploy
In bin/git-remote-bool.js:127, bool deploy is invoked as spawnSync('bool', ['deploy', slug, '-m', message], { cwd: worktree }) — passing only the slug and no directory argument. Inside the deploy command (src/commands/versions.js:11-22), resolveSlugAndDir(slugArg, undefined) checks whether the slug resolves to an existing directory relative to the CWD (the worktree). If the repository contains a top-level directory whose name matches the Bool slug (e.g., slug is "docs" and the repo has a docs/ folder, or slug is "app" with an app/ folder), the slug is silently reinterpreted as the directory to deploy from, and slug is set to undefined. Since the worktree has no .bool/config, the deploy will auto-create a brand-new Bool instead of deploying to the intended one — silently producing wrong behavior with no error.
| const deploy = spawnSync('bool', ['deploy', slug, '-m', message], { | |
| const deploy = spawnSync('bool', ['deploy', slug, '.', '-m', message], { |
Was this helpful? React with 👍 or 👎 to provide feedback.
bool deploy's first-positional-arg heuristic reinterprets the slug as a directory path when a top-level folder of the same name exists. In a git-push-to-deploy worktree this meant pushing to e.g. bool::docs would silently auto-create a new Bool named after the directory instead of deploying to the intended slug. Pass '.' explicitly to lock the slug in as a slug. Reported by Devin Review on PR #11.
Stacked on top of #10.
Adds
git push bool mainas a way to deploy. Afterbool git init, the working repo has aboolremote pointing atbool::<slug>; any push to it deploys the pushed commit.How it works
bin/git-remote-bool.jsis a git remote helper. Git invokes it whenever it sees a URL of the formbool::<address>:push, returns an emptylist for-pushso every local ref is treated as new on the remote.push <src>:<dst>, resolves the source ref to a SHA, materializes it into a temporary detachedgit worktree, then runsbool deploy <slug> -m "git push <branch> (<sha7>)"from inside that worktree.ok <ref>orerror <ref> <reason>back so git prints the familiar* [new branch] main -> mainsummary.This means the deploy reflects exactly what was committed — not whatever happens to be dirty in your working tree.
The helper is registered as a second
binentry inpackage.json, sonpm install -g bool-cliputsgit-remote-boolon PATH next tobool, which is where git looks for it.New command
Reads the slug from
.bool/config(or--slug), thengit remote add bool bool::<slug>(or updates if it already exists). Honors--dry-runand--jsonlike the rest of the CLI.Test plan
bool git --help/bool git init --helpshow inherited global flagsbool git initwithout slug exits 2 with hintbool git init --slug fooadds the remote; calling again updates itbool git init --dry-rundoesn't mutate the repogit push bool mainagainst a fakeboolshim — git accepts the push, helper extracts the commit into a worktree, and the shim records the rightdeploy <slug> -m "git push main (<sha7>)"invocation from that worktreeStacking note
Base is
claude/align-cli-standards-3VTBy(#10). Merge that one first.https://claude.ai/code/session_012nFFfAmPiCZBm8zJRoKrru
Generated by Claude Code