vibe-forge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,458 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Vibe Forge - Setup Script
4
+ # Initializes Vibe Forge for the current project
5
+ #
6
+ # Usage: ./forge-setup.sh [--non-interactive]
7
+ #
8
+
9
+ set -e
10
+
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ FORGE_ROOT="$(dirname "$SCRIPT_DIR")"
13
+
14
+ # Colors for output
15
+ RED='\033[0;31m'
16
+ GREEN='\033[0;32m'
17
+ YELLOW='\033[1;33m'
18
+ BLUE='\033[0;34m'
19
+ NC='\033[0m' # No Color
20
+
21
+ # Parse arguments
22
+ NON_INTERACTIVE=false
23
+ if [[ "$1" == "--non-interactive" ]]; then
24
+ NON_INTERACTIVE=true
25
+ fi
26
+
27
+ echo ""
28
+ echo -e "${YELLOW}🔥 Vibe Forge Setup${NC}"
29
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
30
+ echo ""
31
+
32
+ # =============================================================================
33
+ # STEP 1: Detect Platform
34
+ # =============================================================================
35
+
36
+ detect_platform() {
37
+ case "$(uname -s)" in
38
+ MINGW*|MSYS*|CYGWIN*)
39
+ PLATFORM="windows"
40
+ ;;
41
+ Darwin)
42
+ PLATFORM="macos"
43
+ ;;
44
+ Linux)
45
+ PLATFORM="linux"
46
+ ;;
47
+ *)
48
+ PLATFORM="unknown"
49
+ ;;
50
+ esac
51
+
52
+ echo -e "Platform detected: ${BLUE}$PLATFORM${NC}"
53
+ }
54
+
55
+ # =============================================================================
56
+ # STEP 2: Find Git Bash (Windows only)
57
+ # =============================================================================
58
+
59
+ find_git_bash() {
60
+ if [[ "$PLATFORM" != "windows" ]]; then
61
+ GIT_BASH_PATH=""
62
+ return 0
63
+ fi
64
+
65
+ echo ""
66
+ echo "Searching for Git Bash..."
67
+
68
+ GIT_BASH_PATH=""
69
+
70
+ # Common installation paths
71
+ local paths=(
72
+ "C:/Program Files/Git/bin/bash.exe"
73
+ "C:/Program Files (x86)/Git/bin/bash.exe"
74
+ "D:/Program Files/Git/bin/bash.exe"
75
+ "D:/applications/git/bin/bash.exe"
76
+ "$LOCALAPPDATA/Programs/Git/bin/bash.exe"
77
+ "$USERPROFILE/AppData/Local/Programs/Git/bin/bash.exe"
78
+ )
79
+
80
+ # Check common paths
81
+ for path in "${paths[@]}"; do
82
+ if [[ -f "$path" ]]; then
83
+ GIT_BASH_PATH="$path"
84
+ break
85
+ fi
86
+ done
87
+
88
+ # Try deriving from `where git`
89
+ if [[ -z "$GIT_BASH_PATH" ]]; then
90
+ local git_path
91
+ git_path=$(where git 2>/dev/null | head -1)
92
+ if [[ -n "$git_path" ]]; then
93
+ # Git is typically at .../Git/cmd/git.exe or .../Git/bin/git.exe
94
+ local git_dir
95
+ git_dir=$(dirname "$(dirname "$git_path")")
96
+ if [[ -f "$git_dir/bin/bash.exe" ]]; then
97
+ GIT_BASH_PATH="$git_dir/bin/bash.exe"
98
+ fi
99
+ fi
100
+ fi
101
+
102
+ if [[ -n "$GIT_BASH_PATH" ]]; then
103
+ echo -e "${GREEN}✅ Found Git Bash:${NC} $GIT_BASH_PATH"
104
+ return 0
105
+ else
106
+ echo -e "${RED}❌ Git Bash not found.${NC}"
107
+ echo ""
108
+ echo "Git Bash is required for Claude Code on Windows."
109
+ echo ""
110
+ echo "Options:"
111
+ echo " 1. Install via winget: winget install Git.Git"
112
+ echo " 2. Download from: https://git-scm.com/downloads/win"
113
+ echo ""
114
+
115
+ if [[ "$NON_INTERACTIVE" == "false" ]]; then
116
+ read -p "Auto-install via winget? (y/n): " choice
117
+ if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
118
+ echo ""
119
+ echo "Installing Git..."
120
+ if winget install Git.Git; then
121
+ echo ""
122
+ echo -e "${GREEN}Git installed.${NC} Please restart your terminal and run 'forge init' again."
123
+ exit 0
124
+ else
125
+ echo -e "${RED}Installation failed.${NC} Please install Git manually."
126
+ exit 1
127
+ fi
128
+ fi
129
+ fi
130
+
131
+ echo "Please install Git and run 'forge init' again."
132
+ exit 1
133
+ fi
134
+ }
135
+
136
+ # =============================================================================
137
+ # STEP 3: Check Claude Code
138
+ # =============================================================================
139
+
140
+ check_claude() {
141
+ echo ""
142
+ echo "Checking Claude Code installation..."
143
+
144
+ if ! command -v claude &> /dev/null; then
145
+ echo -e "${RED}❌ Claude Code not found.${NC}"
146
+ echo ""
147
+ echo "Claude Code CLI is required. Install from:"
148
+ echo " https://claude.ai/download"
149
+ echo ""
150
+ exit 1
151
+ fi
152
+
153
+ echo -e "${GREEN}✅ Claude Code found${NC}"
154
+ }
155
+
156
+ # =============================================================================
157
+ # STEP 4: Create Config
158
+ # =============================================================================
159
+
160
+ create_config() {
161
+ echo ""
162
+ echo "Creating configuration..."
163
+
164
+ local config_dir="$FORGE_ROOT/.forge"
165
+ mkdir -p "$config_dir"
166
+
167
+ # Convert path for Windows compatibility
168
+ local git_bash_escaped="${GIT_BASH_PATH//\\/\\\\}"
169
+
170
+ cat > "$config_dir/config.json" << EOF
171
+ {
172
+ "platform": "$PLATFORM",
173
+ "git_bash_path": "$git_bash_escaped",
174
+ "forge_root": "$FORGE_ROOT",
175
+ "initialized": "$(date -Iseconds)",
176
+ "validated": false
177
+ }
178
+ EOF
179
+
180
+ echo -e "${GREEN}✅ Config created:${NC} $config_dir/config.json"
181
+ }
182
+
183
+ # =============================================================================
184
+ # STEP 5: Validate Setup
185
+ # =============================================================================
186
+
187
+ validate_setup() {
188
+ echo ""
189
+ echo "Validating setup..."
190
+
191
+ local test_cmd="claude --version"
192
+
193
+ if [[ "$PLATFORM" == "windows" && -n "$GIT_BASH_PATH" ]]; then
194
+ # On Windows, test with the git bash path set
195
+ export CLAUDE_CODE_GIT_BASH_PATH="$GIT_BASH_PATH"
196
+ fi
197
+
198
+ if $test_cmd &> /dev/null; then
199
+ echo -e "${GREEN}✅ Claude Code working${NC}"
200
+
201
+ # Update config to mark as validated
202
+ local config_file="$FORGE_ROOT/.forge/config.json"
203
+ if [[ -f "$config_file" ]]; then
204
+ # Simple sed replacement for validated field
205
+ sed -i 's/"validated": false/"validated": true/' "$config_file" 2>/dev/null || true
206
+ fi
207
+
208
+ return 0
209
+ else
210
+ echo -e "${RED}❌ Claude Code validation failed${NC}"
211
+ return 1
212
+ fi
213
+ }
214
+
215
+ # =============================================================================
216
+ # STEP 6: Configure Terminal
217
+ # =============================================================================
218
+
219
+ configure_terminal() {
220
+ echo ""
221
+ echo "Terminal Configuration"
222
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
223
+ echo ""
224
+ echo "Select your terminal for auto-spawning worker agents:"
225
+ echo ""
226
+ echo " 1. Windows Terminal (recommended - uses wt)"
227
+ echo " 2. Other / Manual (provides instructions)"
228
+ echo ""
229
+
230
+ local terminal_choice="manual"
231
+
232
+ if [[ "$NON_INTERACTIVE" == "false" ]]; then
233
+ read -p "Terminal [1/2]: " choice
234
+ case "$choice" in
235
+ 1) terminal_choice="windows-terminal" ;;
236
+ *) terminal_choice="manual" ;;
237
+ esac
238
+ else
239
+ terminal_choice="manual"
240
+ fi
241
+
242
+ # Save to config
243
+ TERMINAL_TYPE="$terminal_choice"
244
+
245
+ # Update config with terminal type
246
+ local config_file="$FORGE_ROOT/.forge/config.json"
247
+ if [[ -f "$config_file" ]]; then
248
+ # Add terminal_type to config (insert before closing brace)
249
+ sed -i 's/}$/,\n "terminal_type": "'"$terminal_choice"'"\n}/' "$config_file" 2>/dev/null || true
250
+ fi
251
+
252
+ echo ""
253
+ case "$terminal_choice" in
254
+ "windows-terminal")
255
+ echo -e "${GREEN}✅ Windows Terminal selected${NC}"
256
+ echo " Workers will auto-spawn in new tabs via wt"
257
+ ;;
258
+ *)
259
+ echo -e "${YELLOW}ℹ️ Manual mode selected${NC}"
260
+ echo " You'll receive instructions to start workers"
261
+ ;;
262
+ esac
263
+ }
264
+
265
+ # =============================================================================
266
+ # STEP 7: Configure Daemon
267
+ # =============================================================================
268
+
269
+ configure_daemon() {
270
+ echo ""
271
+ echo "Daemon Configuration"
272
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
273
+ echo ""
274
+ echo "The Forge daemon monitors task folders and routes work automatically."
275
+ echo "It runs in the background and keeps forge-state.yaml updated."
276
+ echo ""
277
+
278
+ local enable_daemon="y"
279
+
280
+ if [[ "$NON_INTERACTIVE" == "false" ]]; then
281
+ read -p "Enable daemon orchestration? (Y/n): " choice
282
+ if [[ "$choice" == "n" || "$choice" == "N" ]]; then
283
+ enable_daemon="n"
284
+ fi
285
+ fi
286
+
287
+ # Update config with daemon preference
288
+ local config_file="$FORGE_ROOT/.forge/config.json"
289
+ if [[ -f "$config_file" ]]; then
290
+ # Add daemon_enabled to config
291
+ sed -i 's/"validated": true/"validated": true,\n "daemon_enabled": '"$( [[ "$enable_daemon" == "y" ]] && echo "true" || echo "false" )"'/' "$config_file" 2>/dev/null || true
292
+ fi
293
+
294
+ if [[ "$enable_daemon" == "y" ]]; then
295
+ echo ""
296
+ echo -e "${GREEN}✅ Daemon enabled${NC}"
297
+ echo ""
298
+ echo "Starting daemon..."
299
+ "$SCRIPT_DIR/forge-daemon.sh" start
300
+ else
301
+ echo ""
302
+ echo -e "${YELLOW}ℹ️ Daemon disabled${NC}"
303
+ echo " You can start it later with: forge daemon start"
304
+ fi
305
+ }
306
+
307
+ # =============================================================================
308
+ # STEP 8: Create Project Context
309
+ # =============================================================================
310
+
311
+ detect_project_info() {
312
+ # Try to detect project name
313
+ PROJECT_NAME=$(basename "$PWD")
314
+
315
+ # Try to detect tech stack
316
+ TECH_STACK=""
317
+
318
+ if [[ -f "package.json" ]]; then
319
+ TECH_STACK="Node.js"
320
+ # Check for framework hints
321
+ if grep -q '"react"' package.json 2>/dev/null; then
322
+ TECH_STACK="React"
323
+ elif grep -q '"vue"' package.json 2>/dev/null; then
324
+ TECH_STACK="Vue"
325
+ elif grep -q '"next"' package.json 2>/dev/null; then
326
+ TECH_STACK="Next.js"
327
+ elif grep -q '"svelte"' package.json 2>/dev/null; then
328
+ TECH_STACK="Svelte"
329
+ fi
330
+ elif [[ -f "Cargo.toml" ]]; then
331
+ TECH_STACK="Rust"
332
+ elif [[ -f "go.mod" ]]; then
333
+ TECH_STACK="Go"
334
+ elif [[ -f "requirements.txt" ]] || [[ -f "pyproject.toml" ]]; then
335
+ TECH_STACK="Python"
336
+ elif [[ -f "pom.xml" ]] || [[ -f "build.gradle" ]]; then
337
+ TECH_STACK="Java"
338
+ elif [[ -f "*.csproj" ]] || [[ -f "*.sln" ]]; then
339
+ TECH_STACK="C#/.NET"
340
+ fi
341
+ }
342
+
343
+ create_project_context() {
344
+ echo ""
345
+ echo "Project Context Setup"
346
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
347
+
348
+ detect_project_info
349
+
350
+ local context_dir="$PWD/context"
351
+ local context_file="$context_dir/project-context.md"
352
+ local template_file="$FORGE_ROOT/context/project-context-template.md"
353
+
354
+ mkdir -p "$context_dir"
355
+
356
+ # Check if context already exists
357
+ if [[ -f "$context_file" ]]; then
358
+ echo -e "${YELLOW}ℹ️ Project context already exists${NC}"
359
+ echo " $context_file"
360
+ return 0
361
+ fi
362
+
363
+ echo ""
364
+ echo -e "Detected project: ${BLUE}$PROJECT_NAME${NC}"
365
+ if [[ -n "$TECH_STACK" ]]; then
366
+ echo -e "Detected stack: ${BLUE}$TECH_STACK${NC}"
367
+ fi
368
+ echo ""
369
+
370
+ if [[ "$NON_INTERACTIVE" == "false" ]]; then
371
+ # Ask for project description
372
+ read -p "Brief project description (or Enter to skip): " PROJECT_DESC
373
+ fi
374
+
375
+ # Create project context from template or generate minimal one
376
+ if [[ -f "$template_file" ]]; then
377
+ cp "$template_file" "$context_file"
378
+
379
+ # Replace placeholders
380
+ sed -i "s/\[Project Name\]/$PROJECT_NAME/g" "$context_file" 2>/dev/null || true
381
+ sed -i "s/\[Your Name\]/Developer/g" "$context_file" 2>/dev/null || true
382
+
383
+ if [[ -n "$TECH_STACK" ]]; then
384
+ sed -i "s/\[e.g., React, Node.js, PostgreSQL\]/$TECH_STACK/g" "$context_file" 2>/dev/null || true
385
+ fi
386
+
387
+ if [[ -n "$PROJECT_DESC" ]]; then
388
+ sed -i "s/\[Brief description of the project\]/$PROJECT_DESC/g" "$context_file" 2>/dev/null || true
389
+ fi
390
+ else
391
+ # Generate minimal context
392
+ cat > "$context_file" << EOF
393
+ # Project Context
394
+
395
+ ## Project: $PROJECT_NAME
396
+
397
+ ${PROJECT_DESC:-A software project managed with Vibe Forge.}
398
+
399
+ ## Tech Stack
400
+ ${TECH_STACK:-To be determined}
401
+
402
+ ## Key Patterns
403
+ - Follow existing code conventions
404
+ - Write tests for new features
405
+ - Document public APIs
406
+
407
+ ## Notes
408
+ Edit this file to add project-specific context for the AI agents.
409
+ EOF
410
+ fi
411
+
412
+ echo -e "${GREEN}✅ Project context created:${NC} $context_file"
413
+ echo " Edit this file to add more project details."
414
+ }
415
+
416
+ # =============================================================================
417
+ # STEP 9: Setup Complete
418
+ # =============================================================================
419
+
420
+ setup_complete() {
421
+ echo ""
422
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
423
+ echo -e "${GREEN}🔥 Vibe Forge initialized!${NC}"
424
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
425
+ echo ""
426
+ echo "Ready to start! Run:"
427
+ echo ""
428
+ echo -e " ${BLUE}forge${NC} Start the Planning Hub"
429
+ echo -e " ${BLUE}forge status${NC} Check forge status"
430
+ echo -e " ${BLUE}forge help${NC} See all commands"
431
+ echo ""
432
+ echo "Optional: Edit context/project-context.md to add more details."
433
+ echo ""
434
+ }
435
+
436
+ # =============================================================================
437
+ # Main
438
+ # =============================================================================
439
+
440
+ main() {
441
+ detect_platform
442
+ find_git_bash
443
+ check_claude
444
+ create_config
445
+
446
+ if validate_setup; then
447
+ configure_terminal
448
+ configure_daemon
449
+ create_project_context
450
+ setup_complete
451
+ else
452
+ echo ""
453
+ echo -e "${RED}Setup incomplete.${NC} Please check the errors above."
454
+ exit 1
455
+ fi
456
+ }
457
+
458
+ main "$@"
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Vibe Forge - Agent Spawner
4
+ # Spawns worker agents in new terminal windows/tabs based on configured terminal type
5
+ #
6
+ # Usage: forge-spawn.sh <agent-name>
7
+ #
8
+ # Supports:
9
+ # - Windows Terminal (wt new-tab)
10
+ # - Manual (prints instructions)
11
+ #
12
+
13
+ set -e
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ FORGE_ROOT="$(dirname "$SCRIPT_DIR")"
17
+ CONFIG_FILE="$FORGE_ROOT/.forge/config.json"
18
+
19
+ # Colors
20
+ RED='\033[0;31m'
21
+ GREEN='\033[0;32m'
22
+ YELLOW='\033[1;33m'
23
+ BLUE='\033[0;34m'
24
+ NC='\033[0m'
25
+
26
+ # =============================================================================
27
+ # Load Configuration
28
+ # =============================================================================
29
+
30
+ load_config() {
31
+ if [[ ! -f "$CONFIG_FILE" ]]; then
32
+ echo -e "${RED}Error: Vibe Forge not initialized.${NC}"
33
+ echo "Run 'forge init' first."
34
+ exit 1
35
+ fi
36
+
37
+ PLATFORM=$(grep -o '"platform": *"[^"]*"' "$CONFIG_FILE" | cut -d'"' -f4)
38
+ TERMINAL_TYPE=$(grep -o '"terminal_type": *"[^"]*"' "$CONFIG_FILE" | cut -d'"' -f4)
39
+ GIT_BASH_PATH=$(grep -o '"git_bash_path": *"[^"]*"' "$CONFIG_FILE" | cut -d'"' -f4)
40
+
41
+ # Default to manual if not set
42
+ if [[ -z "$TERMINAL_TYPE" ]]; then
43
+ TERMINAL_TYPE="manual"
44
+ fi
45
+ }
46
+
47
+ # =============================================================================
48
+ # Spawn Functions
49
+ # =============================================================================
50
+
51
+ spawn_windows_terminal() {
52
+ local agent="$1"
53
+
54
+ echo -e "${BLUE}Spawning $agent in Windows Terminal...${NC}"
55
+
56
+ if command -v wt &> /dev/null || command -v wt.exe &> /dev/null; then
57
+ # Windows Terminal: open new tab with forge command
58
+ # Use Git Bash if available, otherwise use bash
59
+ if [[ -n "$GIT_BASH_PATH" ]]; then
60
+ local bash_path="${GIT_BASH_PATH//\//\\}"
61
+ wt.exe new-tab --title "$agent" "$bash_path" -c "cd '$FORGE_ROOT' && ./bin/forge.sh start $agent"
62
+ else
63
+ wt.exe new-tab --title "$agent" bash -c "cd '$FORGE_ROOT' && ./bin/forge.sh start $agent"
64
+ fi
65
+ echo -e "${GREEN}✅ $agent spawned in new Windows Terminal tab${NC}"
66
+ else
67
+ echo -e "${RED}Error: wt command not found.${NC}"
68
+ echo "Make sure Windows Terminal is installed."
69
+ echo ""
70
+ echo "Manual fallback:"
71
+ print_manual_instructions "$agent"
72
+ exit 1
73
+ fi
74
+ }
75
+
76
+ print_manual_instructions() {
77
+ local agent="$1"
78
+
79
+ echo ""
80
+ echo -e "${YELLOW}To start $agent manually:${NC}"
81
+ echo ""
82
+ echo " 1. Open a new terminal window/tab"
83
+ echo " 2. Navigate to: $FORGE_ROOT"
84
+ echo " 3. Run: ./bin/forge.sh start $agent"
85
+ echo ""
86
+ echo "Or copy this command:"
87
+ echo ""
88
+ echo " cd '$FORGE_ROOT' && ./bin/forge.sh start $agent"
89
+ echo ""
90
+ }
91
+
92
+ # =============================================================================
93
+ # Main
94
+ # =============================================================================
95
+
96
+ main() {
97
+ local agent="${1:-}"
98
+
99
+ if [[ -z "$agent" ]]; then
100
+ echo -e "${RED}Error: No agent specified.${NC}"
101
+ echo ""
102
+ echo "Usage: forge-spawn.sh <agent-name>"
103
+ echo ""
104
+ echo "Available agents:"
105
+ echo " anvil - Frontend Developer"
106
+ echo " furnace - Backend Developer"
107
+ echo " crucible - Tester / QA"
108
+ echo " sentinel - Code Reviewer"
109
+ echo " scribe - Documentation"
110
+ echo " herald - Release Manager"
111
+ echo " ember - DevOps"
112
+ echo " aegis - Security"
113
+ exit 1
114
+ fi
115
+
116
+ load_config
117
+
118
+ echo ""
119
+ echo -e "${YELLOW}🔥 Forge Spawn: $agent${NC}"
120
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
121
+
122
+ case "$TERMINAL_TYPE" in
123
+ "windows-terminal")
124
+ spawn_windows_terminal "$agent"
125
+ ;;
126
+ *)
127
+ print_manual_instructions "$agent"
128
+ ;;
129
+ esac
130
+ }
131
+
132
+ main "$@"
package/bin/forge.cmd ADDED
@@ -0,0 +1,83 @@
1
+ @echo off
2
+ REM Vibe Forge - Windows Launcher
3
+ REM Wraps forge.sh for Windows compatibility
4
+
5
+ setlocal EnableDelayedExpansion
6
+
7
+ set "SCRIPT_DIR=%~dp0"
8
+ set "FORGE_ROOT=%SCRIPT_DIR%.."
9
+ set "CONFIG_FILE=%FORGE_ROOT%\.forge\config.json"
10
+
11
+ REM Check if this is init or help (doesn't require config)
12
+ set "CMD=%~1"
13
+ if "%CMD%"=="init" goto :find_bash
14
+ if "%CMD%"=="help" goto :find_bash
15
+ if "%CMD%"=="--help" goto :find_bash
16
+ if "%CMD%"=="-h" goto :find_bash
17
+
18
+ REM For other commands, check if initialized
19
+ if not exist "%CONFIG_FILE%" (
20
+ echo Error: Vibe Forge not initialized.
21
+ echo Run 'forge init' first.
22
+ exit /b 1
23
+ )
24
+
25
+ REM Extract git_bash_path from config using PowerShell for reliable JSON parsing
26
+ for /f "usebackq delims=" %%a in (`powershell -NoProfile -Command "(Get-Content '%CONFIG_FILE%' | ConvertFrom-Json).git_bash_path"`) do (
27
+ set "GIT_BASH_PATH=%%a"
28
+ )
29
+
30
+ REM Convert forward slashes to backslashes if needed
31
+ set "GIT_BASH_PATH=!GIT_BASH_PATH:/=\!"
32
+
33
+ REM Verify the path exists
34
+ if not exist "!GIT_BASH_PATH!" (
35
+ echo Error: Git Bash not found at: !GIT_BASH_PATH!
36
+ echo Please run 'forge init' again.
37
+ exit /b 1
38
+ )
39
+
40
+ goto :run_forge
41
+
42
+ :find_bash
43
+ REM Find Git Bash for init/help commands
44
+ set "GIT_BASH_PATH="
45
+
46
+ REM Check common paths
47
+ if exist "C:\Program Files\Git\bin\bash.exe" (
48
+ set "GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe"
49
+ goto :run_forge
50
+ )
51
+ if exist "C:\Program Files (x86)\Git\bin\bash.exe" (
52
+ set "GIT_BASH_PATH=C:\Program Files (x86)\Git\bin\bash.exe"
53
+ goto :run_forge
54
+ )
55
+ if exist "D:\Program Files\Git\bin\bash.exe" (
56
+ set "GIT_BASH_PATH=D:\Program Files\Git\bin\bash.exe"
57
+ goto :run_forge
58
+ )
59
+ if exist "D:\applications\git\bin\bash.exe" (
60
+ set "GIT_BASH_PATH=D:\applications\git\bin\bash.exe"
61
+ goto :run_forge
62
+ )
63
+
64
+ REM Try to find via where command
65
+ for /f "tokens=*" %%i in ('where git 2^>nul') do (
66
+ set "GIT_PATH=%%~dpi"
67
+ set "GIT_BASH_PATH=!GIT_PATH!..\bin\bash.exe"
68
+ if exist "!GIT_BASH_PATH!" goto :run_forge
69
+ )
70
+
71
+ REM Still not found
72
+ echo Error: Git Bash not found.
73
+ echo Please install Git from https://git-scm.com/downloads/win
74
+ exit /b 1
75
+
76
+ :run_forge
77
+ REM Set environment variable for Claude Code
78
+ set "CLAUDE_CODE_GIT_BASH_PATH=%GIT_BASH_PATH%"
79
+
80
+ REM Run the bash script with all arguments
81
+ "%GIT_BASH_PATH%" "%SCRIPT_DIR%forge.sh" %*
82
+
83
+ endlocal