feat(gi): bundled boilerplate fallback + -c/--custom template flag #179

Merged
rootiest merged 1 commits from feat/gi-boilerplate-fallback-and-custom into main 2026-09-24 04:54:42 +00:00
Owner

Stacked on #178 (uses its -s/-o/-f flag names).

Problem

gi -b/default boilerplate mode hard-errored when $GITIGNORE_BOILERPLATE was unset, so it only worked for users who'd already configured a personal template (typically via .user-dots). No way to point at an ad-hoc template without exporting the env var either.

Fix

Boilerplate source resolves in priority order:

  1. -c/--custom PATH — new flag, explicit override
  2. $GITIGNORE_BOILERPLATE — existing behavior, unchanged
  3. bundled standard template at data/gi/boilerplate.gitignore — new fallback, no error

-c implies boilerplate mode (like -b), so gi -c template.gitignore works standalone without also passing -b.

The bundled template is a generalized copy of a personal one: OS junk (.DS_Store, Thumbs.db, *~, .Trash-*, .nfs*), scratch/debug/temp directory patterns, and AI-tool session state (.claude*, .gemini*, .antigravity*, .agy*, .agents*, .remember*). It deliberately does not ignore CLAUDE.md/AGENTS.md/GEMINI.md/ANTIGRAVITY.md themselves — committing those is increasingly normal practice, and agents-init already owns their placement, so a boilerplate default shouldn't block it.

Also fixed

A latent bug in gi's trailing test $needs_git -eq 1; and gitignore-scrub line: it leaked its own boolean as the function's exit status whenever needs_git was 0 (i.e. any --stdout run), so e.g. gi -o python returned 1 on success. Same line this change already had to touch; fixed with an explicit if/return 0.

Deferred (separate future job, not in this PR)

Whole-config onboarding pulling a .user-dots template repo when the user has none yet — noted for later, not implemented here. This PR only covers gi's own fallback.

Testing

  • fish -n functions/gi.fish — syntax OK
  • fish tests/test-network-fish.fish — 73/73 passed (new tests: fallback-with-unset-env, -c precedence over env var, -c with missing file, -o success exit-status regression)
  • fish tests/run-tests.fish — 794/794 assertions, indent lint clean, exit 0
  • docs/fish-config.md updated by hand to match (CI regen owns it long-term)
Stacked on #178 (uses its `-s/-o/-f` flag names). ## Problem `gi -b`/default boilerplate mode hard-errored when `$GITIGNORE_BOILERPLATE` was unset, so it only worked for users who'd already configured a personal template (typically via `.user-dots`). No way to point at an ad-hoc template without exporting the env var either. ## Fix Boilerplate source resolves in priority order: 1. `-c`/`--custom PATH` — new flag, explicit override 2. `$GITIGNORE_BOILERPLATE` — existing behavior, unchanged 3. bundled standard template at `data/gi/boilerplate.gitignore` — new fallback, no error `-c` implies boilerplate mode (like `-b`), so `gi -c template.gitignore` works standalone without also passing `-b`. The bundled template is a generalized copy of a personal one: OS junk (`.DS_Store`, `Thumbs.db`, `*~`, `.Trash-*`, `.nfs*`), scratch/debug/temp directory patterns, and AI-tool session state (`.claude*`, `.gemini*`, `.antigravity*`, `.agy*`, `.agents*`, `.remember*`). It deliberately does **not** ignore `CLAUDE.md`/`AGENTS.md`/`GEMINI.md`/`ANTIGRAVITY.md` themselves — committing those is increasingly normal practice, and `agents-init` already owns their placement, so a boilerplate default shouldn't block it. ## Also fixed A latent bug in `gi`'s trailing `test $needs_git -eq 1; and gitignore-scrub` line: it leaked its own boolean as the function's exit status whenever `needs_git` was 0 (i.e. any `--stdout` run), so e.g. `gi -o python` returned 1 on success. Same line this change already had to touch; fixed with an explicit `if`/`return 0`. ## Deferred (separate future job, not in this PR) Whole-config onboarding pulling a `.user-dots` *template* repo when the user has none yet — noted for later, not implemented here. This PR only covers `gi`'s own fallback. ## Testing - `fish -n functions/gi.fish` — syntax OK - `fish tests/test-network-fish.fish` — 73/73 passed (new tests: fallback-with-unset-env, `-c` precedence over env var, `-c` with missing file, `-o` success exit-status regression) - `fish tests/run-tests.fish` — 794/794 assertions, indent lint clean, exit 0 - `docs/fish-config.md` updated by hand to match (CI regen owns it long-term)
rootiest added the Kind/FeatureArea/Functions labels 2026-09-24 04:42:02 +00:00
rootiest changed target branch from fix/gi-stdout-flag-rework to main 2026-09-24 04:54:13 +00:00
rootiest added 1 commit 2026-09-24 04:54:13 +00:00
Boilerplate mode used to hard-error when $GITIGNORE_BOILERPLATE was unset,
so gi -b/-c only worked for users with a personal template configured
(typically via .user-dots). Add a resolution chain:

  1. -c/--custom PATH, if given
  2. $GITIGNORE_BOILERPLATE, if set
  3. bundled standard template (data/gi/boilerplate.gitignore)

The bundled template covers common OS junk, scratch/debug/temp dirs, and
AI tool session state (.claude*, .gemini*, .antigravity*, .agy*, .agents*,
.remember*) -- but deliberately does NOT ignore CLAUDE.md/AGENTS.md/
GEMINI.md/ANTIGRAVITY.md themselves, since committing those is increasingly
normal and agents-init already owns their placement.

-c implies boilerplate mode (like -b) so `gi -c template` works standalone.

Also fixes a latent bug in gi's final line: `test $needs_git -eq 1; and
gitignore-scrub` leaked its own boolean as the function's exit status
whenever needs_git was 0, so e.g. `gi -o python` returned 1 on success.
Same seam this change already touches; fixed with an explicit `return 0`.
rootiest merged commit 86aea9d5ef into main 2026-09-24 04:54:42 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#179