vibe-forge 0.4.0 → 0.8.1

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.
Files changed (129) hide show
  1. package/.claude/commands/clear-attention.md +63 -63
  2. package/.claude/commands/compact-context.md +52 -0
  3. package/.claude/commands/configure-vcs.md +102 -102
  4. package/.claude/commands/forge.md +218 -171
  5. package/.claude/commands/need-help.md +77 -77
  6. package/.claude/commands/update-status.md +64 -64
  7. package/.claude/commands/worker-loop.md +106 -106
  8. package/.claude/hooks/worker-loop.js +217 -187
  9. package/.claude/scripts/setup-worker-loop.sh +45 -45
  10. package/.claude/settings.json +89 -0
  11. package/LICENSE +21 -21
  12. package/README.md +253 -232
  13. package/agents/aegis/personality.md +303 -269
  14. package/agents/anvil/personality.md +278 -240
  15. package/agents/architect/personality.md +260 -234
  16. package/agents/crucible/personality.md +362 -309
  17. package/agents/crucible-x/personality.md +210 -0
  18. package/agents/ember/personality.md +293 -265
  19. package/agents/flux/personality.md +248 -0
  20. package/agents/furnace/personality.md +342 -291
  21. package/agents/herald/personality.md +249 -247
  22. package/agents/loki/personality.md +108 -0
  23. package/agents/oracle/personality.md +284 -0
  24. package/agents/pixel/personality.md +140 -0
  25. package/agents/planning-hub/personality.md +473 -251
  26. package/agents/scribe/personality.md +253 -251
  27. package/agents/slag/personality.md +268 -0
  28. package/agents/temper/personality.md +270 -0
  29. package/bin/cli.js +372 -325
  30. package/bin/dashboard/api/agents.js +333 -0
  31. package/bin/dashboard/api/dispatch.js +507 -0
  32. package/bin/dashboard/api/tasks.js +416 -0
  33. package/bin/dashboard/public/assets/index-BpHfsx1r.js +2 -0
  34. package/bin/dashboard/public/assets/index-QODv4Zn9.css +1 -0
  35. package/bin/dashboard/public/index.html +14 -0
  36. package/bin/dashboard/server.js +645 -0
  37. package/bin/forge-daemon.sh +477 -851
  38. package/bin/forge-setup.sh +661 -645
  39. package/bin/forge-spawn.sh +164 -164
  40. package/bin/forge.cmd +83 -83
  41. package/bin/forge.sh +566 -387
  42. package/bin/lib/agents.sh +177 -177
  43. package/bin/lib/check-aliases.js +50 -0
  44. package/bin/lib/colors.sh +44 -44
  45. package/bin/lib/config.sh +347 -313
  46. package/bin/lib/constants.sh +241 -206
  47. package/bin/lib/daemon/budgets.sh +107 -0
  48. package/bin/lib/daemon/dependencies.sh +146 -0
  49. package/bin/lib/daemon/display.sh +128 -0
  50. package/bin/lib/daemon/notifications.sh +273 -0
  51. package/bin/lib/daemon/routing.sh +93 -0
  52. package/bin/lib/daemon/state.sh +163 -0
  53. package/bin/lib/daemon/sync.sh +103 -0
  54. package/bin/lib/database.sh +357 -305
  55. package/bin/lib/frontmatter.js +106 -0
  56. package/bin/lib/heimdall-setup.js +113 -0
  57. package/bin/lib/heimdall.js +265 -0
  58. package/bin/lib/json.sh +264 -258
  59. package/bin/lib/terminal.js +452 -446
  60. package/bin/lib/util.sh +126 -126
  61. package/bin/lib/vcs.js +349 -349
  62. package/config/agent-manifest.yaml +237 -243
  63. package/config/agents.json +207 -132
  64. package/config/task-template.md +159 -87
  65. package/config/task-types.yaml +111 -106
  66. package/config/templates/handoff-template.md +40 -0
  67. package/context/agent-overrides/README.md +41 -0
  68. package/context/architecture.md +42 -0
  69. package/context/modern-conventions.md +129 -129
  70. package/context/project-context-template.md +122 -122
  71. package/docs/agents.md +473 -409
  72. package/docs/architecture.md +194 -162
  73. package/docs/commands.md +451 -388
  74. package/docs/security.md +195 -144
  75. package/package.json +77 -50
  76. package/.claude/settings.local.json +0 -33
  77. package/agents/forge-master/capabilities.md +0 -144
  78. package/agents/forge-master/context-template.md +0 -128
  79. package/agents/forge-master/personality.md +0 -138
  80. package/agents/sentinel/personality.md +0 -194
  81. package/context/forge-state.yaml +0 -19
  82. package/docs/TODO.md +0 -150
  83. package/docs/getting-started.md +0 -243
  84. package/docs/npm-publishing.md +0 -95
  85. package/docs/workflows/README.md +0 -32
  86. package/docs/workflows/azure-devops.md +0 -108
  87. package/docs/workflows/bitbucket.md +0 -104
  88. package/docs/workflows/git-only.md +0 -130
  89. package/docs/workflows/gitea.md +0 -168
  90. package/docs/workflows/github.md +0 -103
  91. package/docs/workflows/gitlab.md +0 -105
  92. package/docs/workflows.md +0 -454
  93. package/tasks/completed/ARCH-001-duplicate-agent-config.md +0 -121
  94. package/tasks/completed/ARCH-002-mixed-bash-node-implementation.md +0 -88
  95. package/tasks/completed/ARCH-003-worker-loop-hook-duplication.md +0 -77
  96. package/tasks/completed/ARCH-009-test-organization.md +0 -78
  97. package/tasks/completed/ARCH-011-jq-vs-nodejs-json.md +0 -94
  98. package/tasks/completed/ARCH-012-tmp-files-in-root.md +0 -71
  99. package/tasks/completed/ARCH-013-exit-code-constants.md +0 -65
  100. package/tasks/completed/ARCH-014-sed-incompatibility.md +0 -96
  101. package/tasks/completed/ARCH-015-docs-todo-tracking.md +0 -83
  102. package/tasks/completed/CLEAN-001.md +0 -38
  103. package/tasks/completed/CLEAN-003.md +0 -47
  104. package/tasks/completed/CLEAN-004.md +0 -56
  105. package/tasks/completed/CLEAN-005.md +0 -75
  106. package/tasks/completed/CLEAN-006.md +0 -47
  107. package/tasks/completed/CLEAN-007.md +0 -34
  108. package/tasks/completed/CLEAN-008.md +0 -49
  109. package/tasks/completed/CLEAN-012.md +0 -58
  110. package/tasks/completed/CLEAN-013.md +0 -45
  111. package/tasks/completed/SEC-001-sql-injection-fix.md +0 -58
  112. package/tasks/completed/SEC-002-notification-injection-fix.md +0 -45
  113. package/tasks/completed/SEC-003-eval-injection-fix.md +0 -54
  114. package/tasks/completed/SEC-004-pid-race-condition-fix.md +0 -49
  115. package/tasks/completed/SEC-005-worker-loop-path-fix.md +0 -51
  116. package/tasks/completed/SEC-006-eval-agent-names.md +0 -55
  117. package/tasks/completed/SEC-007-spawn-escaping.md +0 -67
  118. package/tasks/pending/ARCH-004-git-bash-detection-duplication.md +0 -72
  119. package/tasks/pending/ARCH-005-missing-src-directory.md +0 -95
  120. package/tasks/pending/ARCH-006-task-template-location.md +0 -64
  121. package/tasks/pending/ARCH-007-daemon-monolith.md +0 -91
  122. package/tasks/pending/ARCH-008-forge-master-vs-hub.md +0 -81
  123. package/tasks/pending/ARCH-010-missing-index-files.md +0 -84
  124. package/tasks/pending/CLEAN-002.md +0 -29
  125. package/tasks/pending/CLEAN-009.md +0 -31
  126. package/tasks/pending/CLEAN-010.md +0 -30
  127. package/tasks/pending/CLEAN-011.md +0 -30
  128. package/tasks/pending/CLEAN-014.md +0 -32
  129. package/tasks/review/task-001.md +0 -78
@@ -1,164 +1,164 @@
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
- # =============================================================================
20
- # Load Shared Libraries
21
- # =============================================================================
22
-
23
- # shellcheck source=lib/colors.sh
24
- source "$SCRIPT_DIR/lib/colors.sh"
25
- # shellcheck source=lib/constants.sh
26
- source "$SCRIPT_DIR/lib/constants.sh"
27
- # shellcheck source=lib/config.sh
28
- source "$SCRIPT_DIR/lib/config.sh"
29
- # shellcheck source=lib/agents.sh
30
- source "$SCRIPT_DIR/lib/agents.sh"
31
-
32
- # Load agent configuration from JSON if available
33
- if [[ -f "$FORGE_ROOT/$AGENTS_CONFIG" ]]; then
34
- if ! load_agents_from_json "$FORGE_ROOT/$AGENTS_CONFIG" 2>/dev/null; then
35
- log_warn "Failed to load agents.json, using fallback defaults"
36
- fi
37
- fi
38
-
39
- # =============================================================================
40
- # Spawn Functions
41
- # =============================================================================
42
-
43
- spawn_windows_terminal() {
44
- local agent="$1"
45
-
46
- log_info "Spawning $agent in Windows Terminal..."
47
-
48
- if command -v wt &> /dev/null || command -v wt.exe &> /dev/null; then
49
- # Get display info for tab
50
- local display_name icon tab_color
51
- display_name=$(get_agent_display_name "$agent")
52
- icon=$(get_agent_icon "$agent")
53
- tab_color=$(get_agent_tab_color "$agent")
54
-
55
- # Build tab title with icon
56
- local tab_title="$display_name"
57
- if [[ -n "$icon" ]]; then
58
- tab_title="$icon $display_name"
59
- fi
60
-
61
- # Convert FORGE_ROOT to Windows path for wt.exe
62
- # Git Bash paths like /c/foo become C:/foo
63
- local win_forge_root
64
- if [[ "$FORGE_ROOT" =~ ^/([a-zA-Z])/ ]]; then
65
- win_forge_root="${BASH_REMATCH[1]}:${FORGE_ROOT:2}"
66
- else
67
- win_forge_root="$FORGE_ROOT"
68
- fi
69
-
70
- # Build wt command with optional tab color
71
- local wt_args=(-w 0 new-tab --title "$tab_title")
72
- if [[ -n "$tab_color" ]]; then
73
- wt_args+=(--tabColor "$tab_color")
74
- fi
75
-
76
- # Windows Terminal: open new tab with forge command
77
- # SECURITY: $agent has already been validated through resolve_agent
78
- # SECURITY: Use printf %q to properly escape paths for nested shell invocation
79
- local escaped_path escaped_agent
80
- escaped_path=$(printf %q "$win_forge_root")
81
- escaped_agent=$(printf %q "$agent")
82
-
83
- if [[ -n "$GIT_BASH_PATH" ]]; then
84
- local bash_path="${GIT_BASH_PATH//\//\\}"
85
- wt.exe "${wt_args[@]}" "$bash_path" -c "cd $escaped_path && ./bin/forge.sh start $escaped_agent"
86
- else
87
- wt.exe "${wt_args[@]}" bash -c "cd $escaped_path && ./bin/forge.sh start $escaped_agent"
88
- fi
89
- log_success "$tab_title spawned in new Windows Terminal tab"
90
- else
91
- log_error "wt command not found."
92
- echo "Make sure Windows Terminal is installed."
93
- echo ""
94
- echo "Manual fallback:"
95
- print_manual_instructions "$agent"
96
- exit $EXIT_DEPENDENCY_MISSING
97
- fi
98
- }
99
-
100
- print_manual_instructions() {
101
- local agent="$1"
102
- local display_name
103
- display_name=$(get_agent_display_name "$agent")
104
-
105
- echo ""
106
- log_info "To start $display_name manually:"
107
- echo ""
108
- echo " 1. Open a new terminal window/tab"
109
- echo " 2. Navigate to: $FORGE_ROOT"
110
- echo " 3. Run: ./bin/forge.sh start $agent"
111
- echo ""
112
- echo "Or copy this command:"
113
- echo ""
114
- echo " cd '$FORGE_ROOT' && ./bin/forge.sh start '$agent'"
115
- echo ""
116
- }
117
-
118
- # =============================================================================
119
- # Main
120
- # =============================================================================
121
-
122
- main() {
123
- local agent="${1:-}"
124
-
125
- if [[ -z "$agent" ]]; then
126
- log_error "No agent specified."
127
- echo ""
128
- echo "Usage: forge-spawn.sh <agent-name>"
129
- echo ""
130
- show_available_agents
131
- exit $EXIT_INVALID_ARGUMENT
132
- fi
133
-
134
- # Resolve alias to canonical agent name (SECURITY: whitelist validation)
135
- local resolved
136
- resolved=$(resolve_agent "$agent") || {
137
- log_error "Unknown agent: $agent"
138
- echo ""
139
- show_available_agents
140
- exit $EXIT_INVALID_ARGUMENT
141
- }
142
-
143
- # Load config
144
- require_forge_config "$FORGE_ROOT"
145
-
146
- echo ""
147
- local icon
148
- icon=$(get_agent_icon "$resolved")
149
- log_header "${icon:-🔥} Forge Spawn: $(get_agent_display_name "$resolved")"
150
- if [[ "$agent" != "$resolved" ]]; then
151
- echo " (resolved from '$agent')"
152
- fi
153
-
154
- case "$TERMINAL_TYPE" in
155
- "windows-terminal")
156
- spawn_windows_terminal "$resolved"
157
- ;;
158
- *)
159
- print_manual_instructions "$resolved"
160
- ;;
161
- esac
162
- }
163
-
164
- main "$@"
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
+ # =============================================================================
20
+ # Load Shared Libraries
21
+ # =============================================================================
22
+
23
+ # shellcheck source=lib/colors.sh
24
+ source "$SCRIPT_DIR/lib/colors.sh"
25
+ # shellcheck source=lib/constants.sh
26
+ source "$SCRIPT_DIR/lib/constants.sh"
27
+ # shellcheck source=lib/config.sh
28
+ source "$SCRIPT_DIR/lib/config.sh"
29
+ # shellcheck source=lib/agents.sh
30
+ source "$SCRIPT_DIR/lib/agents.sh"
31
+
32
+ # Load agent configuration from JSON if available
33
+ if [[ -f "$FORGE_ROOT/$AGENTS_CONFIG" ]]; then
34
+ if ! load_agents_from_json "$FORGE_ROOT/$AGENTS_CONFIG" 2>/dev/null; then
35
+ log_warn "Failed to load agents.json, using fallback defaults"
36
+ fi
37
+ fi
38
+
39
+ # =============================================================================
40
+ # Spawn Functions
41
+ # =============================================================================
42
+
43
+ spawn_windows_terminal() {
44
+ local agent="$1"
45
+
46
+ log_info "Spawning $agent in Windows Terminal..."
47
+
48
+ if command -v wt &> /dev/null || command -v wt.exe &> /dev/null; then
49
+ # Get display info for tab
50
+ local display_name icon tab_color
51
+ display_name=$(get_agent_display_name "$agent")
52
+ icon=$(get_agent_icon "$agent")
53
+ tab_color=$(get_agent_tab_color "$agent")
54
+
55
+ # Build tab title with icon
56
+ local tab_title="$display_name"
57
+ if [[ -n "$icon" ]]; then
58
+ tab_title="$icon $display_name"
59
+ fi
60
+
61
+ # Convert FORGE_ROOT to Windows path for wt.exe
62
+ # Git Bash paths like /c/foo become C:/foo
63
+ local win_forge_root
64
+ if [[ "$FORGE_ROOT" =~ ^/([a-zA-Z])/ ]]; then
65
+ win_forge_root="${BASH_REMATCH[1]}:${FORGE_ROOT:2}"
66
+ else
67
+ win_forge_root="$FORGE_ROOT"
68
+ fi
69
+
70
+ # Build wt command with optional tab color
71
+ local wt_args=(-w 0 new-tab --title "$tab_title")
72
+ if [[ -n "$tab_color" ]]; then
73
+ wt_args+=(--tabColor "$tab_color")
74
+ fi
75
+
76
+ # Windows Terminal: open new tab with forge command
77
+ # SECURITY: $agent has already been validated through resolve_agent
78
+ # SECURITY: Use printf %q to properly escape paths for nested shell invocation
79
+ local escaped_path escaped_agent
80
+ escaped_path=$(printf %q "$win_forge_root")
81
+ escaped_agent=$(printf %q "$agent")
82
+
83
+ if [[ -n "$GIT_BASH_PATH" ]]; then
84
+ local bash_path="${GIT_BASH_PATH//\//\\}"
85
+ wt.exe "${wt_args[@]}" "$bash_path" -c "cd $escaped_path && ./bin/forge.sh start $escaped_agent"
86
+ else
87
+ wt.exe "${wt_args[@]}" bash -c "cd $escaped_path && ./bin/forge.sh start $escaped_agent"
88
+ fi
89
+ log_success "$tab_title spawned in new Windows Terminal tab"
90
+ else
91
+ log_error "wt command not found."
92
+ echo "Make sure Windows Terminal is installed."
93
+ echo ""
94
+ echo "Manual fallback:"
95
+ print_manual_instructions "$agent"
96
+ exit $EXIT_DEPENDENCY_MISSING
97
+ fi
98
+ }
99
+
100
+ print_manual_instructions() {
101
+ local agent="$1"
102
+ local display_name
103
+ display_name=$(get_agent_display_name "$agent")
104
+
105
+ echo ""
106
+ log_info "To start $display_name manually:"
107
+ echo ""
108
+ echo " 1. Open a new terminal window/tab"
109
+ echo " 2. Navigate to: $FORGE_ROOT"
110
+ echo " 3. Run: ./bin/forge.sh start $agent"
111
+ echo ""
112
+ echo "Or copy this command:"
113
+ echo ""
114
+ echo " cd '$FORGE_ROOT' && ./bin/forge.sh start '$agent'"
115
+ echo ""
116
+ }
117
+
118
+ # =============================================================================
119
+ # Main
120
+ # =============================================================================
121
+
122
+ main() {
123
+ local agent="${1:-}"
124
+
125
+ if [[ -z "$agent" ]]; then
126
+ log_error "No agent specified."
127
+ echo ""
128
+ echo "Usage: forge-spawn.sh <agent-name>"
129
+ echo ""
130
+ show_available_agents
131
+ exit $EXIT_INVALID_ARGUMENT
132
+ fi
133
+
134
+ # Resolve alias to canonical agent name (SECURITY: whitelist validation)
135
+ local resolved
136
+ resolved=$(resolve_agent "$agent") || {
137
+ log_error "Unknown agent: $agent"
138
+ echo ""
139
+ show_available_agents
140
+ exit $EXIT_INVALID_ARGUMENT
141
+ }
142
+
143
+ # Load config
144
+ require_forge_config "$FORGE_ROOT"
145
+
146
+ echo ""
147
+ local icon
148
+ icon=$(get_agent_icon "$resolved")
149
+ log_header "${icon:-🔥} Forge Spawn: $(get_agent_display_name "$resolved")"
150
+ if [[ "$agent" != "$resolved" ]]; then
151
+ echo " (resolved from '$agent')"
152
+ fi
153
+
154
+ case "$TERMINAL_TYPE" in
155
+ "windows-terminal")
156
+ spawn_windows_terminal "$resolved"
157
+ ;;
158
+ *)
159
+ print_manual_instructions "$resolved"
160
+ ;;
161
+ esac
162
+ }
163
+
164
+ main "$@"
package/bin/forge.cmd CHANGED
@@ -1,83 +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
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