Skip to content

fix: degrade gracefully when git init or upstream remote fails#14

Open
flipvh wants to merge 1 commit into
mainfrom
fix/graceful-git-degradation
Open

fix: degrade gracefully when git init or upstream remote fails#14
flipvh wants to merge 1 commit into
mainfrom
fix/graceful-git-degradation

Conversation

@flipvh

@flipvh flipvh commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Removes the undocumented CREATE_CELLA_SKIP_GIT / CREATE_CELLA_SKIP_REMOTE env vars (flagged with a TODO review: this has a smell) and replaces them with graceful degradation: if git init, the initial commit, or adding the upstream remote fails, the CLI warns and continues instead of failing an otherwise complete scaffold.

Why

The env vars existed solely so the release smoke test could skip git steps when running the packed binary as a subprocess. That was a hidden test-only backdoor in production code. Since the git layer is isomorphic-git (pure JS, offline, explicit commit author — no dependency on the runner's git binary or config), the test can simply run the real steps.

Changes

  • create.ts — git init + commit + upstream remote wrapped in one non-fatal try/catch; on failure it prints a warning with the manual recovery commands (git init / git remote add cella-upstream …). If init fails, the remote step is skipped too.
  • progress.ts — new warn() on the progress tracker: closes the current step with a yellow ⚠ and the reason.
  • add-remote.ts — removed the silent error-swallowing param; remote failures were previously invisible (which would silently break the sync CLI's upstream later), now they surface as a warning.
  • release-smoke.test.ts — runs the real git steps and asserts .git exists and its config contains the cellajs/cella upstream.

Trade-off

A git failure now yields a created project plus a warning rather than a hard failure. The sync CLI depends on the Cella-Base trailer in the root commit, so the warning points users at the manual steps — considered acceptable versus failing the whole scaffold over a git hiccup.

Testing

  • vitest run — 33 tests pass
  • pnpm run test:release — smoke test passes; output shows initializing git and adding upstream remote running for real in the packed binary

🤖 Generated with Claude Code

Replace the undocumented CREATE_CELLA_SKIP_GIT/CREATE_CELLA_SKIP_REMOTE
env vars with graceful degradation: the git init + upstream remote block
now warns (with manual recovery commands) and continues on failure
instead of tearing down an otherwise complete scaffold.

- add progress.warn() to close a step with a yellow warning
- remove the silent error-swallowing param from addRemote; remote
  failures were previously invisible, now they surface as a warning
- release smoke test runs the real git steps (isomorphic-git: offline,
  no user git config needed) and asserts .git and the upstream remote

Co-Authored-By: Claude Fable 5 <[email protected]>
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.

1 participant