Skip to content

Add git push-to-deploy (git push bool main)#11

Open
zgalant wants to merge 2 commits into
claude/align-cli-standards-3VTByfrom
claude/git-push-deploy
Open

Add git push-to-deploy (git push bool main)#11
zgalant wants to merge 2 commits into
claude/align-cli-standards-3VTByfrom
claude/git-push-deploy

Conversation

@zgalant

@zgalant zgalant commented May 12, 2026

Copy link
Copy Markdown
Member

Stacked on top of #10.

Adds git push bool main as a way to deploy. After bool git init, the working repo has a bool remote pointing at bool::<slug>; any push to it deploys the pushed commit.

How it works

bin/git-remote-bool.js is a git remote helper. Git invokes it whenever it sees a URL of the form bool::<address>:

  1. Speaks the helper protocol on stdin/stdout — advertises push, returns an empty list for-push so every local ref is treated as new on the remote.
  2. For each push <src>:<dst>, resolves the source ref to a SHA, materializes it into a temporary detached git worktree, then runs bool deploy <slug> -m "git push <branch> (<sha7>)" from inside that worktree.
  3. Writes ok <ref> or error <ref> <reason> back so git prints the familiar * [new branch] main -> main summary.

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 bin entry in package.json, so npm install -g bool-cli puts git-remote-bool on PATH next to bool, which is where git looks for it.

New command

bool git init [--remote bool] [--slug <slug>]

Reads the slug from .bool/config (or --slug), then git remote add bool bool::<slug> (or updates if it already exists). Honors --dry-run and --json like the rest of the CLI.

Test plan

  • bool git --help / bool git init --help show inherited global flags
  • bool git init without slug exits 2 with hint
  • bool git init --slug foo adds the remote; calling again updates it
  • bool git init --dry-run doesn't mutate the repo
  • End-to-end git push bool main against a fake bool shim — git accepts the push, helper extracts the commit into a worktree, and the shim records the right deploy <slug> -m "git push main (<sha7>)" invocation from that worktree

Stacking note

Base is claude/align-cli-standards-3VTBy (#10). Merge that one first.

https://claude.ai/code/session_012nFFfAmPiCZBm8zJRoKrru


Generated by Claude Code


Open in Devin Review

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread bin/git-remote-bool.js Outdated

// 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], {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.

Suggested change
const deploy = spawnSync('bool', ['deploy', slug, '-m', message], {
const deploy = spawnSync('bool', ['deploy', slug, '.', '-m', message], {
Open in Devin Review

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.
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.

2 participants