@atlashub/smartstack-cli 2.8.0 → 3.0.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.
Files changed (74) hide show
  1. package/.documentation/business-analyse.html +81 -17
  2. package/dist/index.js +94 -21
  3. package/dist/index.js.map +1 -1
  4. package/dist/mcp-entry.mjs +1302 -223
  5. package/dist/mcp-entry.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/templates/agents/efcore/db-deploy.md +1 -1
  8. package/templates/agents/efcore/migration.md +26 -10
  9. package/templates/agents/efcore/rebase-snapshot.md +24 -7
  10. package/templates/agents/efcore/squash.md +73 -57
  11. package/templates/agents/gitflow/commit.md +138 -18
  12. package/templates/agents/gitflow/exec.md +1 -1
  13. package/templates/agents/gitflow/finish.md +79 -62
  14. package/templates/agents/gitflow/init-clone.md +186 -0
  15. package/templates/agents/gitflow/init-detect.md +137 -0
  16. package/templates/agents/gitflow/init-validate.md +210 -0
  17. package/templates/agents/gitflow/init.md +231 -74
  18. package/templates/agents/gitflow/merge.md +65 -33
  19. package/templates/agents/gitflow/pr.md +93 -49
  20. package/templates/agents/gitflow/start.md +76 -33
  21. package/templates/agents/gitflow/status.md +41 -71
  22. package/templates/hooks/appsettings-guard.sh +76 -0
  23. package/templates/hooks/ef-migration-check.md +1 -1
  24. package/templates/hooks/hooks.json +9 -0
  25. package/templates/project/test-frontend/msw/handlers.ts +58 -0
  26. package/templates/project/test-frontend/msw/server.ts +25 -0
  27. package/templates/project/test-frontend/setup.ts +16 -0
  28. package/templates/project/test-frontend/test-utils.tsx +59 -0
  29. package/templates/project/test-frontend/vitest.config.ts +31 -0
  30. package/templates/skills/_resources/config-safety.md +61 -0
  31. package/templates/skills/_resources/formatting-guide.md +2 -2
  32. package/templates/skills/_shared.md +21 -0
  33. package/templates/skills/application/SKILL.md +32 -3
  34. package/templates/skills/application/steps/step-04-backend.md +21 -0
  35. package/templates/skills/application/steps/step-05-frontend.md +20 -36
  36. package/templates/skills/application/steps/step-07-tests.md +259 -120
  37. package/templates/skills/business-analyse/SKILL.md +57 -28
  38. package/templates/skills/business-analyse/_shared.md +70 -39
  39. package/templates/skills/business-analyse/html/ba-interactive.html +2622 -0
  40. package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
  41. package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
  42. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
  43. package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
  44. package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
  45. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
  46. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
  47. package/templates/skills/business-analyse/questionnaire.md +55 -46
  48. package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
  49. package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
  50. package/templates/skills/business-analyse/steps/step-03-specify.md +1 -0
  51. package/templates/skills/business-analyse/steps/step-05-handoff.md +103 -1
  52. package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
  53. package/templates/skills/check-version/SKILL.md +1 -1
  54. package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
  55. package/templates/skills/efcore/steps/db/step-reset.md +27 -4
  56. package/templates/skills/efcore/steps/db/step-seed.md +46 -2
  57. package/templates/skills/efcore/steps/db/step-status.md +14 -0
  58. package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
  59. package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
  60. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
  61. package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
  62. package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
  63. package/templates/skills/gitflow/SKILL.md +91 -29
  64. package/templates/skills/gitflow/_shared.md +144 -2
  65. package/templates/skills/gitflow/phases/status.md +11 -1
  66. package/templates/skills/gitflow/steps/step-commit.md +1 -1
  67. package/templates/skills/gitflow/steps/step-init.md +202 -39
  68. package/templates/skills/gitflow/templates/config.json +10 -1
  69. package/templates/skills/ralph-loop/steps/step-03-commit.md +2 -2
  70. package/templates/skills/validate-feature/SKILL.md +83 -0
  71. package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
  72. package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
  73. package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
  74. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: gitflow-init-validate
3
+ description: GitFlow init - post-init validation with auto-repair
4
+ color: green
5
+ model: haiku
6
+ tools: Bash, Read, Glob
7
+ ---
8
+
9
+ # GitFlow Init Validate Agent
10
+
11
+ You validate a GitFlow installation and attempt auto-repair for common failures.
12
+
13
+ ## INPUT PARAMETERS
14
+
15
+ You receive these from the orchestrator:
16
+ - `{PROJECT_BASE}` - Absolute path to project root (already platform-normalized)
17
+ - `{WORKTREE_MODE}` - "organized" or "simple"
18
+ - `{REPO_URL}` - Expected remote URL
19
+ - `{PLATFORM}` - Current platform (wsl/windows/macos/linux)
20
+
21
+ ## VALIDATION CHECKLIST
22
+
23
+ Run ALL checks and report results:
24
+
25
+ ### 1. Bare Repository Integrity
26
+
27
+ ```bash
28
+ PROJECT_BASE="{PROJECT_BASE}"
29
+ ERRORS=0
30
+ REPAIRED=0
31
+
32
+ # Check .bare directory
33
+ if [ -d "$PROJECT_BASE/.bare" ]; then
34
+ echo "PASS: .bare/ directory exists"
35
+ else
36
+ echo "FAIL: .bare/ directory missing (cannot auto-repair - re-run clone)"
37
+ ERRORS=$((ERRORS + 1))
38
+ fi
39
+
40
+ # Check HEAD
41
+ if [ -f "$PROJECT_BASE/.bare/HEAD" ]; then
42
+ HEAD_CONTENT=$(cat "$PROJECT_BASE/.bare/HEAD")
43
+ echo "PASS: .bare/HEAD exists ($HEAD_CONTENT)"
44
+ else
45
+ echo "FAIL: .bare/HEAD missing"
46
+ ERRORS=$((ERRORS + 1))
47
+ fi
48
+
49
+ # Check objects directory
50
+ if [ -d "$PROJECT_BASE/.bare/objects" ]; then
51
+ echo "PASS: .bare/objects/ exists"
52
+ else
53
+ echo "FAIL: .bare/objects/ missing"
54
+ ERRORS=$((ERRORS + 1))
55
+ fi
56
+
57
+ # Check .git pseudo-file
58
+ if [ -f "$PROJECT_BASE/.git" ]; then
59
+ GIT_CONTENT=$(cat "$PROJECT_BASE/.git")
60
+ if echo "$GIT_CONTENT" | grep -q "gitdir:.*\.bare"; then
61
+ echo "PASS: .git pseudo-file points to .bare"
62
+ else
63
+ echo "WARN: .git pseudo-file has unexpected content: $GIT_CONTENT"
64
+ # Auto-repair
65
+ echo "gitdir: ./.bare" > "$PROJECT_BASE/.git"
66
+ echo "REPAIRED: .git pseudo-file rewritten"
67
+ REPAIRED=$((REPAIRED + 1))
68
+ fi
69
+ else
70
+ # Auto-repair
71
+ echo "gitdir: ./.bare" > "$PROJECT_BASE/.git"
72
+ echo "REPAIRED: .git pseudo-file created"
73
+ REPAIRED=$((REPAIRED + 1))
74
+ fi
75
+ ```
76
+
77
+ ### 2. Worktree Integrity
78
+
79
+ ```bash
80
+ PROJECT_BASE="{PROJECT_BASE}"
81
+ MAIN_DIR=$([ "{WORKTREE_MODE}" = "organized" ] && echo "01-Main" || echo "main")
82
+ DEVELOP_DIR=$([ "{WORKTREE_MODE}" = "organized" ] && echo "02-Develop" || echo "develop")
83
+
84
+ # Check main worktree
85
+ if [ -d "$PROJECT_BASE/$MAIN_DIR" ]; then
86
+ MAIN_BRANCH=$(git -C "$PROJECT_BASE/$MAIN_DIR" branch --show-current 2>/dev/null)
87
+ if [ "$MAIN_BRANCH" = "main" ]; then
88
+ echo "PASS: $MAIN_DIR is on branch main"
89
+ else
90
+ echo "WARN: $MAIN_DIR is on branch '$MAIN_BRANCH', expected 'main'"
91
+ git -C "$PROJECT_BASE/$MAIN_DIR" checkout main 2>/dev/null && {
92
+ echo "REPAIRED: $MAIN_DIR switched to main"
93
+ REPAIRED=$((REPAIRED + 1))
94
+ }
95
+ fi
96
+ else
97
+ echo "FAIL: $MAIN_DIR directory missing"
98
+ # Attempt repair
99
+ GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/$MAIN_DIR" main 2>&1 && {
100
+ echo "REPAIRED: $MAIN_DIR worktree recreated"
101
+ REPAIRED=$((REPAIRED + 1))
102
+ }
103
+ fi
104
+
105
+ # Check develop worktree
106
+ if [ -d "$PROJECT_BASE/$DEVELOP_DIR" ]; then
107
+ DEVELOP_BRANCH=$(git -C "$PROJECT_BASE/$DEVELOP_DIR" branch --show-current 2>/dev/null)
108
+ if [ "$DEVELOP_BRANCH" = "develop" ]; then
109
+ echo "PASS: $DEVELOP_DIR is on branch develop"
110
+ else
111
+ echo "WARN: $DEVELOP_DIR is on branch '$DEVELOP_BRANCH', expected 'develop'"
112
+ git -C "$PROJECT_BASE/$DEVELOP_DIR" checkout develop 2>/dev/null && {
113
+ echo "REPAIRED: $DEVELOP_DIR switched to develop"
114
+ REPAIRED=$((REPAIRED + 1))
115
+ }
116
+ fi
117
+ else
118
+ echo "FAIL: $DEVELOP_DIR directory missing"
119
+ GIT_DIR="$PROJECT_BASE/.bare" git worktree add "$PROJECT_BASE/$DEVELOP_DIR" develop 2>&1 && {
120
+ echo "REPAIRED: $DEVELOP_DIR worktree recreated"
121
+ REPAIRED=$((REPAIRED + 1))
122
+ }
123
+ fi
124
+
125
+ # Check subdirectories
126
+ for subdir in features releases hotfixes; do
127
+ if [ -d "$PROJECT_BASE/$subdir" ]; then
128
+ echo "PASS: $subdir/ exists"
129
+ else
130
+ mkdir -p "$PROJECT_BASE/$subdir"
131
+ echo "REPAIRED: $subdir/ created"
132
+ REPAIRED=$((REPAIRED + 1))
133
+ fi
134
+ done
135
+ ```
136
+
137
+ ### 3. Config Integrity
138
+
139
+ ```bash
140
+ PROJECT_BASE="{PROJECT_BASE}"
141
+ DEVELOP_DIR=$([ "{WORKTREE_MODE}" = "organized" ] && echo "02-Develop" || echo "develop")
142
+ CONFIG_FILE="$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/config.json"
143
+
144
+ if [ -f "$CONFIG_FILE" ]; then
145
+ # Validate JSON syntax
146
+ if python3 -c "import json; json.load(open('$CONFIG_FILE'))" 2>/dev/null || \
147
+ node -e "JSON.parse(require('fs').readFileSync('$CONFIG_FILE','utf8'))" 2>/dev/null; then
148
+ echo "PASS: config.json is valid JSON"
149
+ else
150
+ echo "FAIL: config.json has invalid JSON syntax"
151
+ ERRORS=$((ERRORS + 1))
152
+ fi
153
+
154
+ # Check version
155
+ VERSION=$(grep -oP '"version":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
156
+ echo "INFO: Config version: $VERSION"
157
+
158
+ # Check rootFolder resolves
159
+ ROOT=$(grep -oP '"rootFolder":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
160
+ echo "INFO: rootFolder: $ROOT"
161
+ else
162
+ echo "WARN: config.json not found at $CONFIG_FILE"
163
+ # Create directory if missing
164
+ mkdir -p "$(dirname "$CONFIG_FILE")"
165
+ echo "INFO: Config directory ensured, config.json must be written by orchestrator"
166
+ fi
167
+
168
+ # Check config subdirectories
169
+ for subdir in plans logs cache backup; do
170
+ if [ ! -d "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/$subdir" ]; then
171
+ mkdir -p "$PROJECT_BASE/$DEVELOP_DIR/.claude/gitflow/$subdir"
172
+ echo "REPAIRED: .claude/gitflow/$subdir/ created"
173
+ REPAIRED=$((REPAIRED + 1))
174
+ fi
175
+ done
176
+ ```
177
+
178
+ ### 4. Remote Connectivity
179
+
180
+ ```bash
181
+ PROJECT_BASE="{PROJECT_BASE}"
182
+
183
+ # Test remote fetch (timeout after 10s)
184
+ if timeout 10 git -C "$PROJECT_BASE/.bare" fetch origin --quiet 2>&1; then
185
+ echo "PASS: Remote accessible"
186
+ else
187
+ echo "WARN: Remote unreachable (may be network issue, not repairable)"
188
+ fi
189
+ ```
190
+
191
+ ### 5. Summary
192
+
193
+ ```
194
+ VALIDATION REPORT
195
+ =================
196
+ Errors: {ERRORS}
197
+ Repaired: {REPAIRED}
198
+
199
+ {if ERRORS == 0 && REPAIRED == 0}
200
+ STATUS: ALL CHECKS PASSED
201
+ {elif ERRORS == 0 && REPAIRED > 0}
202
+ STATUS: ALL ISSUES AUTO-REPAIRED
203
+ {else}
204
+ STATUS: {ERRORS} UNRESOLVABLE ERROR(S) - manual intervention needed
205
+ {endif}
206
+ ```
207
+
208
+ ## Priority
209
+
210
+ Correctness > Speed. Validate everything, repair what you can.
@@ -1,21 +1,33 @@
1
1
  ---
2
2
  name: gitflow-init
3
- description: GitFlow initialization - setup config and directories
3
+ description: GitFlow initialization - orchestrates detection, cloning, config, and validation
4
4
  color: blue
5
5
  model: sonnet
6
6
  tools: Bash, Read, Write, Glob, AskUserQuestion
7
7
  ---
8
8
 
9
- # GitFlow Init Agent
9
+ # GitFlow Init Agent (Orchestrator)
10
10
 
11
- You initialize a GitFlow project.
11
+ You initialize a GitFlow project by orchestrating 3 specialized sub-agents.
12
+
13
+ ## ARCHITECTURE
14
+
15
+ ```
16
+ gitflow-init (you - orchestrator)
17
+ ├── Task(gitflow-init-detect) → Environment report
18
+ ├── AskUserQuestion → User confirms URL, path, name
19
+ ├── Task(gitflow-init-clone) → Create structure
20
+ ├── Write config.json → v2.1.0 with platform & workspace
21
+ └── Task(gitflow-init-validate) → Verify & repair
22
+ ```
23
+
24
+ ---
12
25
 
13
26
  ## MANDATORY FIRST CHECK: Existing GitFlow Configuration
14
27
 
15
- **BEFORE anything else, check if GitFlow is already initialized in the current directory:**
28
+ **BEFORE anything else, check if GitFlow is already initialized:**
16
29
 
17
30
  ```bash
18
- # Check for existing GitFlow config
19
31
  if [ -f ".claude/gitflow/config.json" ]; then
20
32
  echo "EXISTING_GITFLOW=true"
21
33
  cat .claude/gitflow/config.json
@@ -24,7 +36,7 @@ else
24
36
  fi
25
37
  ```
26
38
 
27
- **If `EXISTING_GITFLOW=true`, you MUST ask the user BEFORE proceeding:**
39
+ **If `EXISTING_GITFLOW=true`, ask the user:**
28
40
 
29
41
  ```json
30
42
  {
@@ -42,142 +54,287 @@ fi
42
54
  }
43
55
  ```
44
56
 
45
- **Handle responses:**
46
- - **View configuration**: Display the config in a formatted table and EXIT
47
- - **Reconfigure**: Continue with the init workflow (will overwrite existing config)
48
- - **Repair**: Check directories, validate config, fix issues, then EXIT
57
+ - **View**: Display config in formatted table and EXIT
58
+ - **Reconfigure**: Continue with full init workflow
59
+ - **Repair**: Delegate directly to `Task(gitflow-init-validate)` then EXIT
49
60
  - **Cancel**: EXIT immediately
50
61
 
51
- **⛔ DO NOT continue to URL/clone steps if user selects "View" or "Cancel".**
52
-
53
62
  ---
54
63
 
55
- ## MANDATORY WORKFLOW FOR URL MODE
64
+ ## STEP 1: DETECT ENVIRONMENT
56
65
 
57
- When the user provides a URL (starts with `https://` or `git@`), you MUST execute these steps IN ORDER:
66
+ Delegate to `gitflow-init-detect` sub-agent:
58
67
 
59
- ### STEP 1: Extract repo name from URL
68
+ ```
69
+ Task(gitflow-init-detect):
70
+ prompt: "Detect the environment for GitFlow initialization. Report platform, git state, workspace siblings, and provider."
71
+ subagent_type: gitflow-init-detect
72
+ model: haiku
73
+ ```
74
+
75
+ Parse the report to extract:
76
+ - `PLATFORM` (wsl/windows/macos/linux)
77
+ - `SHELL_TYPE` (bash/gitbash/powershell/zsh)
78
+ - `DETECTED_URL`, `DETECTED_NAME`, `GIT_PROVIDER`
79
+ - `HAS_MAIN`, `HAS_DEVELOP`, `HAS_CONFIG`
80
+ - `SIBLING_COUNT`, `HAS_WORKSPACE`
81
+
82
+ ---
60
83
 
61
- Parse the URL to get the suggested project name:
62
- - `https://github.com/org/my-project.git` → `my-project`
63
- - `https://dev.azure.com/org/project/_git/repo` → `repo`
84
+ ## STEP 2: ASK USER (3 MANDATORY QUESTIONS)
64
85
 
65
- DO NOT create any folder yet.
86
+ ### 2a. Repository URL
66
87
 
67
- ### STEP 2: ASK WHERE TO CREATE
88
+ **If user provided a URL in the command (starts with `https://` or `git@`), use it directly.**
68
89
 
69
- Call the AskUserQuestion tool NOW with these EXACT parameters:
90
+ Otherwise ask:
70
91
 
71
92
  ```json
72
93
  {
73
94
  "questions": [{
74
- "question": "Where do you want to create this project?",
75
- "header": "Location",
95
+ "question": "Repository URL? (detected: {DETECTED_URL})",
96
+ "header": "Repository",
76
97
  "options": [
77
- {"label": "C:/Dev", "description": "Development folder (Recommended)"},
78
- {"label": "Current directory", "description": "Create here"},
79
- {"label": "Custom path", "description": "Enter a different path"}
98
+ {"label": "Use detected URL (Recommended)", "description": "{DETECTED_URL}"},
99
+ {"label": "Enter GitHub URL", "description": "https://github.com/org/repo.git"},
100
+ {"label": "Enter Azure DevOps URL", "description": "https://dev.azure.com/org/project/_git/repo"},
101
+ {"label": "Local only (no remote)", "description": "Initialize without remote"}
80
102
  ],
81
103
  "multiSelect": false
82
104
  }]
83
105
  }
84
106
  ```
85
107
 
86
- WAIT for user response. Store result as TARGET_FOLDER.
108
+ **If user selects a custom option, ask follow-up for the actual URL.**
87
109
 
88
- ### STEP 3: ASK PROJECT NAME
110
+ ### 2b. Root Folder
89
111
 
90
- Call the AskUserQuestion tool NOW with these EXACT parameters:
112
+ **CRITICAL for WSL: Normalize the path for the current platform.**
91
113
 
92
114
  ```json
93
115
  {
94
116
  "questions": [{
95
- "question": "What name for the project folder? (Suggested: {extracted_name})",
96
- "header": "Name",
117
+ "question": "Root folder for this project? (worktrees will be created here)",
118
+ "header": "Location",
97
119
  "options": [
98
- {"label": "{extracted_name}", "description": "Use name from URL (Recommended)"},
99
- {"label": "Custom name", "description": "Enter a different name"}
120
+ {"label": "Use parent folder (Recommended)", "description": "{PARENT_DIR}/ - consistent with {SIBLING_COUNT} sibling project(s)"},
121
+ {"label": "Use current folder", "description": "{CURRENT_DIR}/ - will create subfolders here"},
122
+ {"label": "Custom path", "description": "Specify a different location"}
100
123
  ],
101
124
  "multiSelect": false
102
125
  }]
103
126
  }
104
127
  ```
105
128
 
106
- WAIT for user response. Store result as PROJECT_NAME.
107
-
108
- ### STEP 4: CONFIRM CREATION
129
+ **After getting the path, normalize it:**
130
+ ```bash
131
+ # On WSL: translate Windows paths to /mnt/ format
132
+ # On Windows: ensure forward slashes
133
+ # Store the platform-normalized path as PROJECT_BASE
134
+ ```
109
135
 
110
- Call the AskUserQuestion tool NOW with these EXACT parameters:
136
+ ### 2c. Project Name
111
137
 
112
138
  ```json
113
139
  {
114
140
  "questions": [{
115
- "question": "Create GitFlow project?\n\nProject: {PROJECT_NAME}\nLocation: {TARGET_FOLDER}/{PROJECT_NAME}/\nRepository: {URL}",
116
- "header": "Confirm",
141
+ "question": "Project name? (detected: {DETECTED_NAME})",
142
+ "header": "Project",
117
143
  "options": [
118
- {"label": "Yes, create", "description": "Proceed with creation (Recommended)"},
119
- {"label": "Modify", "description": "Go back and change settings"}
144
+ {"label": "Use detected name (Recommended)", "description": "{DETECTED_NAME}"},
145
+ {"label": "Custom name", "description": "Specify a different project name"}
120
146
  ],
121
147
  "multiSelect": false
122
148
  }]
123
149
  }
124
150
  ```
125
151
 
126
- WAIT for user response. If "Modify", go back to STEP 2.
152
+ Normalize name into variants (PascalCase.Dot, PascalCase, kebab-case, snake_case, Display Name).
127
153
 
128
- ### STEP 5: CREATE STRUCTURE (only after confirmation)
154
+ ---
129
155
 
130
- ONLY after user confirms "Yes, create":
156
+ ## STEP 3: CLONE AND CREATE STRUCTURE
131
157
 
132
- **IMPORTANT:** Use absolute paths for ALL operations. The `cd` command does not persist between Bash calls.
158
+ Delegate to `gitflow-init-clone` sub-agent:
133
159
 
134
- ```bash
135
- # Set the project base path (use forward slashes even on Windows)
136
- PROJECT_BASE="{TARGET_FOLDER}/{PROJECT_NAME}"
160
+ ```
161
+ Task(gitflow-init-clone):
162
+ prompt: |
163
+ Create GitFlow structure:
164
+ - REPO_URL: {REPO_URL}
165
+ - PROJECT_BASE: {PROJECT_BASE} (already platform-normalized absolute path)
166
+ - PROJECT_NAME: {PROJECT_NAME}
167
+ - WORKTREE_MODE: organized
168
+ - PLATFORM: {PLATFORM}
169
+ subagent_type: gitflow-init-clone
170
+ model: sonnet
171
+ ```
172
+
173
+ Check the result. If FAIL, report to user and suggest manual intervention.
174
+
175
+ ---
176
+
177
+ ## STEP 4: WRITE CONFIG
178
+
179
+ Write `.claude/gitflow/config.json` in develop worktree using the Write tool.
180
+
181
+ **Path:** `{PROJECT_BASE}/02-Develop/.claude/gitflow/config.json`
182
+
183
+ **Content (v2.1.0):**
184
+ ```json
185
+ {
186
+ "version": "2.1.0",
187
+ "platform": {
188
+ "detected": "{PLATFORM}",
189
+ "shell": "{SHELL_TYPE}",
190
+ "detectedAt": "{ISO_DATE}"
191
+ },
192
+ "workspace": {
193
+ "path": "{normalize_path_for_storage(PARENT_DIR)}",
194
+ "name": ""
195
+ },
196
+ "repository": {
197
+ "name": "{PROJECT_NAME}",
198
+ "rootFolder": "{normalize_path_for_storage(PROJECT_BASE)}",
199
+ "nameVariants": {
200
+ "pascalCaseDot": "{PascalCase.Dot}",
201
+ "pascalCase": "{PascalCase}",
202
+ "kebabCase": "{kebab-case}",
203
+ "snakeCase": "{snake_case}",
204
+ "displayName": "{Display Name}"
205
+ },
206
+ "defaultBranch": "main",
207
+ "remoteUrl": "{REPO_URL}"
208
+ },
209
+ "git": {
210
+ "provider": "{GIT_PROVIDER}",
211
+ "branches": { "main": "main", "develop": "develop" },
212
+ "prefixes": { "feature": "feature/", "release": "release/", "hotfix": "hotfix/" }
213
+ },
214
+ "worktrees": {
215
+ "enabled": true,
216
+ "mode": "organized",
217
+ "structure": {
218
+ "main": "{normalize_path_for_storage(PROJECT_BASE)}/01-Main",
219
+ "develop": "{normalize_path_for_storage(PROJECT_BASE)}/02-Develop",
220
+ "features": "{normalize_path_for_storage(PROJECT_BASE)}/features",
221
+ "releases": "{normalize_path_for_storage(PROJECT_BASE)}/releases",
222
+ "hotfixes": "{normalize_path_for_storage(PROJECT_BASE)}/hotfixes"
223
+ }
224
+ },
225
+ "versioning": {
226
+ "strategy": "semver",
227
+ "current": "{VERSION}",
228
+ "tagPrefix": "v",
229
+ "sources": ["csproj", "package.json", "VERSION"]
230
+ },
231
+ "efcore": {
232
+ "enabled": true,
233
+ "validateOnCommit": true,
234
+ "blockDestructive": true,
235
+ "migrationNaming": "{context}_v{version}_{sequence}_{Description}"
236
+ },
237
+ "workflow": {
238
+ "push": { "afterCommit": "worktree" },
239
+ "pr": { "autoLabels": true, "requireReview": true }
240
+ },
241
+ "language": { "code": "en" }
242
+ }
243
+ ```
137
244
 
138
- # Create project directory and clone as bare repository
139
- mkdir -p "$PROJECT_BASE" && \
140
- git clone --bare "{URL}" "$PROJECT_BASE/.bare" && \
141
- echo "gitdir: ./.bare" > "$PROJECT_BASE/.git"
245
+ **IMPORTANT:** Always store paths in config using `normalize_path_for_storage()` format (Windows-style: `D:/path/to/folder`). The `read_gitflow_config()` in `_shared.md` translates them back to platform format at read time.
246
+
247
+ ---
142
248
 
143
- # Create worktree directories (use absolute paths)
144
- mkdir -p "$PROJECT_BASE/01-Main" "$PROJECT_BASE/02-Develop" "$PROJECT_BASE/features" "$PROJECT_BASE/releases" "$PROJECT_BASE/hotfixes"
249
+ ## STEP 5: VALIDATE
145
250
 
146
- # Setup worktrees (must cd first, chain with &&)
147
- cd "$PROJECT_BASE" && git worktree add 01-Main main
148
- cd "$PROJECT_BASE" && git worktree add 02-Develop develop
251
+ Delegate to `gitflow-init-validate` sub-agent:
149
252
 
150
- # Create config directory
151
- mkdir -p "$PROJECT_BASE/02-Develop/.claude/gitflow"
152
253
  ```
254
+ Task(gitflow-init-validate):
255
+ prompt: |
256
+ Validate GitFlow installation:
257
+ - PROJECT_BASE: {PROJECT_BASE}
258
+ - WORKTREE_MODE: organized
259
+ - REPO_URL: {REPO_URL}
260
+ - PLATFORM: {PLATFORM}
261
+ subagent_type: gitflow-init-validate
262
+ model: haiku
263
+ ```
264
+
265
+ Report validation results to user.
266
+
267
+ ---
153
268
 
154
- ### STEP 6: OUTPUT
269
+ ## STEP 6: UPDATE WORKSPACE (optional)
270
+
271
+ If `{HAS_WORKSPACE}=true`, update the existing `.smartstack-workspace.json` to include this project.
272
+
273
+ If `{HAS_WORKSPACE}=false` and `{SIBLING_COUNT} > 0`, suggest creating a workspace file.
274
+
275
+ ---
276
+
277
+ ## STEP 7: SUMMARY
155
278
 
156
279
  ```
157
280
  ================================================================================
158
- GITFLOW INITIALIZED (Clone Mode)
281
+ GITFLOW INITIALIZED
159
282
  ================================================================================
160
283
 
161
284
  PROJECT
162
- Name: {PROJECT_NAME}
163
- Location: {TARGET_FOLDER}/{PROJECT_NAME}/
164
- URL: {URL}
285
+ Name: {PROJECT_NAME}
286
+ Location: {PROJECT_BASE}/
287
+ URL: {REPO_URL}
288
+ Provider: {GIT_PROVIDER}
289
+ Platform: {PLATFORM} ({SHELL_TYPE})
165
290
 
166
291
  STRUCTURE
167
- 01-Main/ → main branch
168
- 02-Develop/ → develop branch (working directory)
169
- features/ → feature worktrees
170
- releases/ → release worktrees
171
- hotfixes/ → hotfix worktrees
292
+ 01-Main/ → main branch
293
+ 02-Develop/ → develop branch
294
+ features/ → feature worktrees
295
+ releases/ → release worktrees
296
+ hotfixes/ → hotfix worktrees
297
+
298
+ CONFIG
299
+ Version: 2.1.0
300
+ Path: 02-Develop/.claude/gitflow/config.json
301
+
302
+ VALIDATION
303
+ {validation_summary}
172
304
 
173
305
  NEXT STEPS
174
- cd "{TARGET_FOLDER}/{PROJECT_NAME}/02-Develop"
306
+ cd "{PROJECT_BASE}/02-Develop"
307
+ /gitflow -f <feature-name>
175
308
 
176
309
  ================================================================================
177
310
  ```
178
311
 
179
- ## OTHER MODES
312
+ ---
313
+
314
+ ## WORKSPACE MODE (`--workspace`)
315
+
316
+ When called with `--workspace` flag:
317
+
318
+ 1. Ask for workspace directory
319
+ 2. Ask for list of repo URLs (one per line) or detect from sibling folders
320
+ 3. Create `.smartstack-workspace.json` at workspace root
321
+ 4. Loop: for each repo, run Steps 1-6 with workspace defaults pre-populated
322
+ 5. Display global summary
323
+
324
+ ```json
325
+ {
326
+ "questions": [{
327
+ "question": "Enter repository URLs (one per line) or detect from existing folders?",
328
+ "header": "Repos",
329
+ "options": [
330
+ {"label": "Detect from folders", "description": "Scan {WORKSPACE_DIR} for git repositories"},
331
+ {"label": "Enter URLs", "description": "Provide a list of repository URLs"}
332
+ ],
333
+ "multiSelect": false
334
+ }]
335
+ }
336
+ ```
337
+
338
+ ## Priority
180
339
 
181
- If NO URL provided:
182
- - **Existing repo**: Configure GitFlow on current git repository
183
- - **New project**: Create new local project without remote
340
+ Correctness > Speed > UX. The init must succeed on every platform (WSL, Windows, macOS, Linux).