Skip to content

Windows Git Bash: build script fails with Bun shell redirection, and Claude skills are not registered when a global install already exists #1561

@Alphagest

Description

@Alphagest

Environment

  • OS: Windows
  • Shell: Git Bash / MINGW64
  • Node: v22.17.0
  • Bun: v1.3.14
  • Git: 2.51.0.windows.1
  • Claude Code: v2.1.143
  • gstack: v1.39.2.0

Problem 1 — bun run build fails on Windows Git Bash

When running the setup/build process from Git Bash on Windows, the build script fails because Bun's shell parser does not support some shell redirection/subshell patterns used in package.json.

Initial error

error: Failed to run script build due to error Subshells with redirections are currently not supported.

This appears to be caused by patterns such as:

( git rev-parse HEAD 2>/dev/null || true ) > browse/dist/.version

After removing the subshells, Bun still failed on direct redirections:

error: Failed to run script build due to error expected a command or assignment but got: "Redirect"

Example pattern:

git rev-parse HEAD > browse/dist/.version 2>/dev/null || true

Workaround used

I moved the build commands into a real Bash script and changed the package.json build script to call that script instead of letting Bun parse the whole shell command.

New script

# scripts/build-gstack-gitbash.sh

#!/usr/bin/env bash
set -euo pipefail

bun run vendor:xterm
bun run gen:skill-docs --host all

bun build --compile browse/src/cli.ts --outfile browse/dist/browse
bun build --compile browse/src/find-browse.ts --outfile browse/dist/find-browse
bun build --compile design/src/cli.ts --outfile design/dist/design
bun build --compile make-pdf/src/cli.ts --outfile make-pdf/dist/pdf
bun build --compile bin/gstack-global-discover.ts --outfile bin/gstack-global-discover

bash browse/scripts/build-node-server.sh

git rev-parse HEAD > browse/dist/.version 2>/dev/null || true
git rev-parse HEAD > design/dist/.version 2>/dev/null || true
git rev-parse HEAD > make-pdf/dist/.version 2>/dev/null || true

chmod +x browse/dist/browse \
  browse/dist/find-browse \
  design/dist/design \
  make-pdf/dist/pdf \
  bin/gstack-global-discover

rm -f .*.bun-build || true

package.json change

{
  "scripts": {
    "build": "bash scripts/build-gstack-gitbash.sh"
  }
}

After this change, the build completed successfully on Windows Git Bash.

Problem 2 — Claude skill registration is skipped when a global install already exists

After running:

./setup --host claude --no-prefix

The build succeeded, but the Claude skill registration was skipped with this message:

/c/Users/Alpha/.claude/skills/gstack already exists as a separate global install.
Skipping Claude skill registration to avoid polluting it with per-worktree symlinks. (Binaries still built locally for dev.)

Global install:  /c/Users/Alpha/.claude/skills/gstack
This worktree:   /d/_Projets/AI/gstack

To register this worktree as the active gstack, remove the global
install first:  rm -rf /c/Users/Alpha/.claude/skills/gstack

gstack built (claude registration skipped).

At that point, Claude Code did not recognize the slash commands:

/office-hours
/gstack-office-hours

The only detected skills were:

/c/Users/Alpha/.claude/skills/gepeto/SKILL.md
/c/Users/Alpha/.claude/skills/gstack/SKILL.md
/c/Users/Alpha/.claude/skills/pinokio/SKILL.md

The generated individual skills existed in:

.agents/skills/gstack-office-hours/SKILL.md
.agents/skills/gstack-review/SKILL.md
.agents/skills/gstack-qa/SKILL.md
...

but they were not copied/registered into:

/c/Users/Alpha/.claude/skills/

Workaround used for Claude registration

I manually copied the generated skills into Claude's skills directory:

cd /d/_Projets/AI/gstack

cp -r .agents/skills/gstack-* /c/Users/Alpha/.claude/skills/
cp -r .agents/skills/gstack /c/Users/Alpha/.claude/skills/

After restarting Claude Code, /office-hours worked correctly.

Expected behavior

On Windows Git Bash:

  1. bun run build should complete without requiring manual modification of package.json.
  2. ./setup --host claude --no-prefix should either:
    • correctly register the generated Claude skills, or
    • provide a clear interactive option to replace/update the existing global install, or
    • provide a documented --force / --replace-global option.

Actual behavior

  1. The build script fails because Bun cannot parse shell redirections/subshells on Windows Git Bash.
  2. Claude skill registration is skipped when a previous global install exists.
  3. The generated skills are present under .agents/skills, but Claude Code does not see the individual commands until they are manually copied into ~/.claude/skills.

Suggested fix

Build script

Move the long shell build command out of package.json into a real Bash script, or use a Node/Bun script to write .version files and avoid shell redirections in the package.json script.

This would make the build more robust across:

  • Windows Git Bash
  • WSL
  • macOS/Linux
  • Bun shell parser changes

Claude registration

Add one of the following options:

./setup --host claude --force

or:

./setup --host claude --replace-global

Expected behavior:

  • remove or archive the existing ~/.claude/skills/gstack
  • register the current worktree as the active gstack install
  • copy or symlink all generated skills into ~/.claude/skills
  • print the exact list of registered Claude skills

Example output:

Registered Claude skills:
- office-hours
- autoplan
- review
- qa
- qa-only
- cso
- ship
...

Why this matters

The current behavior is confusing for Windows users because the build can succeed after manual fixes, but Claude Code still reports:

Unknown command: /office-hours

even though GStack appears to be installed under:

~/.claude/skills/gstack

The workaround works, but the setup process could make this much smoother and safer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions