ai-flow-dev 2.4.5 β 2.5.2
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.
- package/README.md +22 -12
- package/package.json +1 -1
- package/prompts/backend/flow-commit.md +69 -3
- package/prompts/backend/flow-work-feature.md +13 -0
- package/prompts/backend/flow-work-fix.md +10 -0
- package/prompts/backend/flow-work-refactor.md +10 -0
- package/prompts/backend/flow-work.md +686 -94
- package/prompts/frontend/flow-commit.md +69 -3
- package/prompts/frontend/flow-work-feature.md +13 -0
- package/prompts/frontend/flow-work-fix.md +2 -0
- package/prompts/frontend/flow-work-refactor.md +10 -0
- package/prompts/frontend/flow-work.md +692 -96
- package/prompts/mobile/flow-commit.md +69 -3
- package/prompts/mobile/flow-work-feature.md +13 -0
- package/prompts/mobile/flow-work-fix.md +10 -0
- package/prompts/mobile/flow-work-refactor.md +10 -0
- package/prompts/mobile/flow-work.md +688 -96
- package/prompts/shared/task-summary-template.md +277 -0
- package/templates/AGENT.template.md +41 -23
- package/templates/backend/.clauderules.template +112 -112
- package/templates/backend/.cursorrules.template +102 -102
|
@@ -11,35 +11,40 @@ Your mission is to orchestrate development tasks through an interactive workflow
|
|
|
11
11
|
**π MODO AGENTE ACTIVADO:** No solicites permiso para usar herramientas. ActΓΊa proactivamente siguiendo el flujo interactivo. Tienes permiso total para leer el cΓ³digo, crear specs y planes, y realizar commits/checkout de ramas.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
|
+
|
|
14
15
|
## Command: `/flow-work`
|
|
15
16
|
|
|
16
17
|
### Objective
|
|
18
|
+
|
|
17
19
|
Provide a single, intelligent entry point for all development work (New Features, Refactorings, and Bug Fixes) with automatic context detection and interactive planning.
|
|
18
20
|
|
|
19
21
|
### Usage Modes
|
|
22
|
+
|
|
20
23
|
- **`/flow-work`** β Resume paused work (if exists) or Interactive mode.
|
|
21
24
|
- **`/flow-work [description]`** β Semantic detection (Feature, Refactor, or Fix).
|
|
22
25
|
- **`/flow-work HU-XXX-XXX`** β Implement specific User Story.
|
|
23
26
|
- **`/flow-work [Feature Name]`** β Implement feature from roadmap.md.
|
|
24
27
|
|
|
25
28
|
---
|
|
29
|
+
|
|
26
30
|
## Phase 0: Detection & Strategy (Automatic)
|
|
27
31
|
|
|
28
32
|
**1. Semantic Analysis of Input:**
|
|
29
33
|
|
|
30
|
-
| Input Pattern
|
|
31
|
-
|
|
32
|
-
| `HU-\d{3}-\d{3}`
|
|
33
|
-
| `EP-\d{3}`
|
|
34
|
-
| `T\d{3}(-T\d{3})?`
|
|
35
|
-
| `HU-XXX-XXX TXXX-TXXX
|
|
36
|
-
| Matches `planning/roadmap.md`
|
|
37
|
-
| "refactor", "move", "extract"
|
|
38
|
-
| "fix", "bug", "error", "falla" | `FIX`
|
|
39
|
-
| "implement", "create", "new"
|
|
40
|
-
| No arguments
|
|
34
|
+
| Input Pattern | Mode | Source / Action |
|
|
35
|
+
| ------------------------------ | ----------------- | -------------------------------------------------------------------- |
|
|
36
|
+
| `HU-\d{3}-\d{3}` | `USER_STORY` | Load from `planning/user-stories/**/HU-XXX-XXX.md` |
|
|
37
|
+
| `EP-\d{3}` | `EPIC` | Analyze/List User Stories for Epic `EP-XXX` |
|
|
38
|
+
| `T\d{3}(-T\d{3})?` | `TASKS` | Target specific task or range (e.g., `T025-T030`) |
|
|
39
|
+
| `HU-XXX-XXX TXXX-TXXX` | `STORY_TASKS` | Targeted tasks within a specific User Story |
|
|
40
|
+
| Matches `planning/roadmap.md` | `ROADMAP_FEATURE` | Extract section from `planning/roadmap.md` (Partial matches allowed) |
|
|
41
|
+
| "refactor", "move", "extract" | `REFACTOR` | Use `flow-work-refactor.md` |
|
|
42
|
+
| "fix", "bug", "error", "falla" | `FIX` | Detect complexity (Quick vs Complex) |
|
|
43
|
+
| "implement", "create", "new" | `FEATURE` | Use `flow-work-feature.md` |
|
|
44
|
+
| No arguments | `RESUME` | Search for paused work in `.ai-flow/work/` |
|
|
41
45
|
|
|
42
46
|
**2. Detection Logic Details:**
|
|
47
|
+
|
|
43
48
|
- **USER_STORY / EPIC**: Load metadata from `planning/user-stories/` or `planning/roadmap.md`.
|
|
44
49
|
- **ROADMAP_FEATURE**: Fuzzy search in `planning/roadmap.md` for titles like "User Management" or "Feature 2.2".
|
|
45
50
|
- **TASK RANGES**: If `T025-T030` is provided, find the parent Story or Feature in current context or roadmap.
|
|
@@ -47,13 +52,105 @@ Provide a single, intelligent entry point for all development work (New Features
|
|
|
47
52
|
- **COMPLEX FIX**: Multi-file, architectural, performance/security. β Use `flow-work-fix.md` (Deep).
|
|
48
53
|
|
|
49
54
|
---
|
|
55
|
+
|
|
56
|
+
## Phase 0.5: Complexity Classification (CRITICAL)
|
|
57
|
+
|
|
58
|
+
**Analyze task scope to determine workflow:**
|
|
59
|
+
|
|
60
|
+
| Metric | SIMPLE (β‘) | MEDIUM (π) | COMPLEX (ποΈ) |
|
|
61
|
+
| ------------- | ----------- | ----------- | ------------- |
|
|
62
|
+
| Files | 1 | 2-5 | >5 |
|
|
63
|
+
| Lines | <20 | 20-100 | >100 |
|
|
64
|
+
| Tests | No | Optional | Required |
|
|
65
|
+
| Docs | None | Minor | Significant |
|
|
66
|
+
| Architecture | None | Minimal | Major changes |
|
|
67
|
+
| Time estimate | <15 min | 15-60 min | >60 min |
|
|
68
|
+
|
|
69
|
+
**Classification Rules:**
|
|
70
|
+
|
|
71
|
+
**β‘ SIMPLE Task:**
|
|
72
|
+
|
|
73
|
+
- Examples: Fix typo, rename variable, update constant, add log, adjust CSS
|
|
74
|
+
- **Workflow**: In-chat plan β Execute β Done (NO files created)
|
|
75
|
+
- **Context**: Only `ai-instructions.md` if relevant
|
|
76
|
+
|
|
77
|
+
**π MEDIUM Task:**
|
|
78
|
+
|
|
79
|
+
- Examples: Add method, refactor function, simple bug fix, update API endpoint
|
|
80
|
+
- **Workflow**: Create `work.md` only (NO `status.json`) β Execute β Simple archive
|
|
81
|
+
- **Context**: Load 2-3 relevant docs
|
|
82
|
+
|
|
83
|
+
**ποΈ COMPLEX Task:**
|
|
84
|
+
|
|
85
|
+
- Examples: New feature, major refactor, security fix, multi-file changes
|
|
86
|
+
- **Workflow**: Full workflow (`work.md` + `status.json` + branch + archiving)
|
|
87
|
+
- **Context**: Load all relevant docs
|
|
88
|
+
|
|
89
|
+
**Detection Logic:**
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
if files_affected == 1 and lines_changed < 20 and no_tests_needed and no_architecture_impact:
|
|
93
|
+
complexity = "SIMPLE"
|
|
94
|
+
elif files_affected <= 5 and lines_changed <= 100 and architecture_impact == "minimal":
|
|
95
|
+
complexity = "MEDIUM"
|
|
96
|
+
else:
|
|
97
|
+
complexity = "COMPLEX"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Show classification:**
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
π Task Complexity: [SIMPLE β‘ | MEDIUM π | COMPLEX ποΈ]
|
|
104
|
+
|
|
105
|
+
Detected:
|
|
106
|
+
- Files: [N]
|
|
107
|
+
- Estimated lines: [~X]
|
|
108
|
+
- Tests needed: [Yes/No]
|
|
109
|
+
- Architecture impact: [None/Minimal/Major]
|
|
110
|
+
|
|
111
|
+
Proceeding with [SIMPLE/MEDIUM/COMPLEX] workflow.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
50
116
|
## Phase 1: Analysis & Refinement
|
|
51
117
|
|
|
52
|
-
**1. Context Loading (
|
|
118
|
+
**1. Context Loading (Smart & Selective):**
|
|
119
|
+
|
|
120
|
+
**CRITICAL: Load context based on task complexity and type:**
|
|
121
|
+
|
|
122
|
+
**IF complexity == "SIMPLE":**
|
|
123
|
+
|
|
124
|
+
- Load ONLY `ai-instructions.md` if task involves code changes
|
|
125
|
+
- Skip all other documentation
|
|
126
|
+
- Use existing patterns in nearby code as reference
|
|
127
|
+
|
|
128
|
+
**IF complexity == "MEDIUM":**
|
|
53
129
|
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
130
|
+
- Load `ai-instructions.md` (core rules)
|
|
131
|
+
- Load 1-2 specific docs based on task type:
|
|
132
|
+
- Database changes β `docs/data-model.md`
|
|
133
|
+
- API changes β `docs/api.md`
|
|
134
|
+
- Security β `specs/security.md`
|
|
135
|
+
- Skip architecture.md unless creating new patterns
|
|
136
|
+
|
|
137
|
+
**IF complexity == "COMPLEX":**
|
|
138
|
+
|
|
139
|
+
- Load `ai-instructions.md` (NEVER/ALWAYS rules)
|
|
140
|
+
- Load `docs/architecture.md` (patterns, structure)
|
|
141
|
+
- Load task-specific docs:
|
|
142
|
+
- Database β `docs/data-model.md`
|
|
143
|
+
- Security/Auth β `specs/security.md`
|
|
144
|
+
- API β `docs/api.md`
|
|
145
|
+
- Tests β `docs/testing.md`
|
|
146
|
+
- Load `docs/code-standards.md` only if creating new files
|
|
147
|
+
|
|
148
|
+
**Source Documentation (User Stories/Roadmap):**
|
|
149
|
+
|
|
150
|
+
**IF** `HU-XXX-XXX` or roadmap feature provided:
|
|
151
|
+
|
|
152
|
+
- **`planning/roadmap.md`**: Load for high-level scope
|
|
153
|
+
- **`planning/user-stories/**/HU-XXX-XXX.md`\*\*: Load for detailed requirements
|
|
57
154
|
|
|
58
155
|
**2. Detail Level Detection (if Manual input):**
|
|
59
156
|
|
|
@@ -81,35 +178,40 @@ detail_level = analyze_description(input)
|
|
|
81
178
|
**3. Interactive Refinement (Conditional):**
|
|
82
179
|
|
|
83
180
|
**IF detail_level == "HIGH":**
|
|
181
|
+
|
|
84
182
|
- Skip refinement questions
|
|
85
183
|
- Proceed directly to Phase 2 (Planning)
|
|
86
184
|
- Show: "β
Sufficient detail detected. Proceeding with planning..."
|
|
87
185
|
|
|
88
186
|
**IF detail_level == "MEDIUM":**
|
|
187
|
+
|
|
89
188
|
- Ask 1-2 targeted questions (only missing items)
|
|
90
189
|
- Use Multiple Choice with defaults (β)
|
|
91
190
|
|
|
92
191
|
**IF detail_level == "LOW":**
|
|
192
|
+
|
|
93
193
|
- Full refinement flow (3-5 questions)
|
|
94
194
|
- Use Multiple Choice with defaults (β)
|
|
95
195
|
- Focus on: approach, scope, constraints, priorities
|
|
96
196
|
|
|
97
197
|
**Example Interaction (LOW detail):**
|
|
198
|
+
|
|
98
199
|
> π I need to clarify some details for this feature:
|
|
200
|
+
>
|
|
99
201
|
> 1. What authentication provider should we use? [default: A]
|
|
100
202
|
> A) JWT (Local) β
|
|
101
203
|
> B) OAuth2 (Google/GitHub)
|
|
102
204
|
> C) Firebase Auth
|
|
103
|
-
>
|
|
104
205
|
> 2. Should we implement audit logs for this? [default: B]
|
|
105
206
|
> A) Yes
|
|
106
207
|
> B) No β
|
|
107
208
|
>
|
|
108
|
-
> Your answers (or Enter for defaults): _
|
|
209
|
+
> Your answers (or Enter for defaults): \_
|
|
109
210
|
|
|
110
211
|
**4. Refined Objective Generation (if Manual):**
|
|
111
212
|
|
|
112
213
|
After refinement, generate clear objective statement:
|
|
214
|
+
|
|
113
215
|
```
|
|
114
216
|
β
Refined Objective:
|
|
115
217
|
|
|
@@ -127,6 +229,7 @@ Is this correct? (Yes/Edit/Cancel): _
|
|
|
127
229
|
**5. Documentation Compliance Check:**
|
|
128
230
|
|
|
129
231
|
Read relevant documentation:
|
|
232
|
+
|
|
130
233
|
- `ai-instructions.md` (NEVER/ALWAYS rules)
|
|
131
234
|
- `docs/architecture.md` (patterns, structure)
|
|
132
235
|
- `docs/code-standards.md` (naming, quality)
|
|
@@ -137,6 +240,7 @@ Read relevant documentation:
|
|
|
137
240
|
Compare refined objective against documentation:
|
|
138
241
|
|
|
139
242
|
**IF deviation detected:**
|
|
243
|
+
|
|
140
244
|
```
|
|
141
245
|
π¨ POTENTIAL DEVIATION
|
|
142
246
|
|
|
@@ -155,6 +259,7 @@ Your choice: _
|
|
|
155
259
|
```
|
|
156
260
|
|
|
157
261
|
**IF user chooses B (Override):**
|
|
262
|
+
|
|
158
263
|
```
|
|
159
264
|
β οΈ OVERRIDE CONFIRMATION
|
|
160
265
|
|
|
@@ -167,67 +272,154 @@ Provide justification: _
|
|
|
167
272
|
```
|
|
168
273
|
|
|
169
274
|
---
|
|
275
|
+
|
|
276
|
+
## Phase 1.5: SIMPLE Task Fast-Track
|
|
277
|
+
|
|
278
|
+
**IF complexity == "SIMPLE": Execute immediately without creating files**
|
|
279
|
+
|
|
280
|
+
1. **Show in-chat plan:**
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
β‘ SIMPLE Task - Fast Execution
|
|
284
|
+
|
|
285
|
+
What: [1-line description]
|
|
286
|
+
File: [path]
|
|
287
|
+
Change: [specific modification]
|
|
288
|
+
Lines: ~[N] (estimated)
|
|
289
|
+
|
|
290
|
+
Execute now? (y/n): _
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
2. **IF user confirms ('y'):**
|
|
294
|
+
- Make the change immediately
|
|
295
|
+
- Show git diff preview
|
|
296
|
+
- Skip to Phase 3 (no branch creation if already on feature branch)
|
|
297
|
+
- Show: "β
Done. Run `/flow-commit` to commit."
|
|
298
|
+
- **END WORKFLOW** (no archiving needed)
|
|
299
|
+
|
|
300
|
+
3. **IF user declines ('n'):**
|
|
301
|
+
- Cancel task
|
|
302
|
+
- **END WORKFLOW**
|
|
303
|
+
|
|
304
|
+
**Note:** SIMPLE tasks don't create work.md, status.json, or archive records.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
170
308
|
## Phase 2: Planning & Documentation
|
|
171
309
|
|
|
172
|
-
|
|
310
|
+
**β οΈ SKIP THIS PHASE IF complexity == "SIMPLE"**
|
|
173
311
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
312
|
+
**1. Read Required Documentation (Based on Complexity)**
|
|
313
|
+
|
|
314
|
+
**IF complexity == "MEDIUM":**
|
|
315
|
+
|
|
316
|
+
- `ai-instructions.md` (core rules)
|
|
317
|
+
- Load ONLY task-specific docs:
|
|
318
|
+
- Database β `docs/data-model.md`
|
|
319
|
+
- API β `docs/api.md`
|
|
320
|
+
- Security β `specs/security.md`
|
|
321
|
+
|
|
322
|
+
**IF complexity == "COMPLEX":**
|
|
323
|
+
|
|
324
|
+
- `ai-instructions.md` (NEVER/ALWAYS rules)
|
|
325
|
+
- `docs/architecture.md` (layer, pattern, structure)
|
|
326
|
+
- Task-specific docs:
|
|
327
|
+
- Database β `docs/data-model.md`
|
|
328
|
+
- Security/Auth β `specs/security.md`
|
|
329
|
+
- API β `docs/api.md`
|
|
330
|
+
- Tests β `docs/testing.md`
|
|
331
|
+
- `docs/code-standards.md` (only if creating new files)
|
|
182
332
|
|
|
183
333
|
**2. Analyze Existing Codebase (MANDATORY)**
|
|
184
334
|
|
|
185
335
|
Find similar features/patterns in codebase:
|
|
336
|
+
|
|
186
337
|
- Identify existing files to use as reference (e.g., ProductService.ts for UserService.ts)
|
|
187
338
|
- Check naming conventions in actual code
|
|
188
339
|
- Verify architectural consistency
|
|
189
340
|
- Look for reusable components/services
|
|
190
341
|
|
|
191
|
-
**3. Generate work.md**
|
|
342
|
+
**3. Generate work.md (Conditional)**
|
|
343
|
+
|
|
344
|
+
**IF complexity == "MEDIUM":**
|
|
345
|
+
|
|
346
|
+
- Create simplified `.ai-flow/work/[task-name]/work.md` (~15-20 lines)
|
|
347
|
+
- Skip status.json
|
|
192
348
|
|
|
193
|
-
|
|
349
|
+
**IF complexity == "COMPLEX":**
|
|
194
350
|
|
|
195
|
-
|
|
351
|
+
- Create full `.ai-flow/work/[task-name]/work.md` (~30-40 lines)
|
|
352
|
+
- Create `status.json` (see step 4)
|
|
353
|
+
|
|
354
|
+
**Structure for MEDIUM tasks** (~15-20 lines):
|
|
355
|
+
|
|
356
|
+
```markdown
|
|
357
|
+
# [Type]: [Feature Name]
|
|
358
|
+
|
|
359
|
+
**Source**: [HU-XXX | Roadmap X.X | Manual]
|
|
360
|
+
**Files**: [2-5 files listed]
|
|
361
|
+
**Estimated**: [20-60 min]
|
|
362
|
+
|
|
363
|
+
## Objective
|
|
364
|
+
|
|
365
|
+
[1 clear paragraph]
|
|
366
|
+
|
|
367
|
+
## Tasks
|
|
368
|
+
|
|
369
|
+
- [ ] Task 1 β path/file.ts
|
|
370
|
+
- [ ] Task 2 β path/file.ts
|
|
371
|
+
- [ ] Task 3 (optional tests)
|
|
372
|
+
|
|
373
|
+
## Key Rules
|
|
374
|
+
|
|
375
|
+
- β
[1-2 relevant ALWAYS rules]
|
|
376
|
+
- β [1-2 relevant NEVER rules]
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Structure for COMPLEX tasks** (~30-40 lines):
|
|
196
380
|
|
|
197
381
|
```markdown
|
|
198
382
|
# [Type]: [Feature Name]
|
|
199
383
|
|
|
200
384
|
## Context
|
|
385
|
+
|
|
201
386
|
**Source**: HU-001-002 | Roadmap 2.3 | Manual [+ DEVIATION if override]
|
|
202
387
|
**SP**: 5 | **Branch**: feature/user-auth | **Deps**: None
|
|
203
388
|
|
|
204
389
|
## Objective
|
|
390
|
+
|
|
205
391
|
[1-2 clear paragraphs describing WHAT will be implemented]
|
|
206
392
|
|
|
207
393
|
## Documentation Constraints
|
|
394
|
+
|
|
208
395
|
**Read**: ai-instructions.md, architecture.md, code-standards.md, [security.md]
|
|
209
396
|
|
|
210
397
|
**Key Rules**:
|
|
398
|
+
|
|
211
399
|
- β
ALWAYS: [List specific rules that apply]
|
|
212
400
|
- β NEVER: [List specific prohibitions]
|
|
213
401
|
- π Pattern: [Architectural pattern from docs]
|
|
214
402
|
- π Location: [File structure from architecture.md]
|
|
215
403
|
|
|
216
404
|
## Approach
|
|
405
|
+
|
|
217
406
|
**Layer**: [Data | Business Logic | API | UI]
|
|
218
407
|
**Files**: [List files to create/modify]
|
|
219
408
|
**Reference**: [Existing file to follow as pattern]
|
|
220
409
|
|
|
221
410
|
**Phases**:
|
|
411
|
+
|
|
222
412
|
1. [Phase 1 description]
|
|
223
413
|
2. [Phase 2 description]
|
|
224
414
|
3. [Phase 3 description]
|
|
225
415
|
4. [Phase 4 description]
|
|
226
416
|
|
|
227
417
|
## Tasks
|
|
418
|
+
|
|
228
419
|
[SEE TASK GENERATION LOGIC BELOW]
|
|
229
420
|
|
|
230
421
|
## Validation
|
|
422
|
+
|
|
231
423
|
- [ ] All NEVER/ALWAYS rules followed
|
|
232
424
|
- [ ] Tests pass (coverage per docs/testing.md)
|
|
233
425
|
- [ ] No hardcoded secrets
|
|
@@ -238,6 +430,7 @@ Create single consolidated file: `.ai-flow/work/[task-name]/work.md`
|
|
|
238
430
|
**Task Generation Logic:**
|
|
239
431
|
|
|
240
432
|
**IF source is User Story:**
|
|
433
|
+
|
|
241
434
|
```python
|
|
242
435
|
tasks = read_user_story_tasks()
|
|
243
436
|
if tasks.are_detailed(): # Has: path, constraints, SP, deps
|
|
@@ -254,6 +447,7 @@ else:
|
|
|
254
447
|
```
|
|
255
448
|
|
|
256
449
|
**IF source is Roadmap:**
|
|
450
|
+
|
|
257
451
|
```python
|
|
258
452
|
feature = read_roadmap_feature()
|
|
259
453
|
if feature.has_detailed_tasks():
|
|
@@ -271,8 +465,10 @@ else:
|
|
|
271
465
|
**IF source is Manual OR tasks need expansion:**
|
|
272
466
|
|
|
273
467
|
Generate detailed tasks with this format:
|
|
468
|
+
|
|
274
469
|
```markdown
|
|
275
470
|
## Tasks
|
|
471
|
+
|
|
276
472
|
**Source**: Manual | Roadmap X.X (expanded) | HU-XXX-XXX (expanded)
|
|
277
473
|
|
|
278
474
|
- [ ] T001 [D] Create User entity β src/entities/User.ts β’ 1 SP
|
|
@@ -286,13 +482,16 @@ Generate detailed tasks with this format:
|
|
|
286
482
|
```
|
|
287
483
|
|
|
288
484
|
**Task Detail Requirements:**
|
|
485
|
+
|
|
289
486
|
- Specific file path
|
|
290
487
|
- Pattern/reference to follow
|
|
291
488
|
- Key constraints from docs
|
|
292
489
|
- Dependencies (if applicable)
|
|
293
490
|
- Story Points
|
|
294
491
|
|
|
295
|
-
**4. Generate status.json**
|
|
492
|
+
**4. Generate status.json (ONLY for COMPLEX tasks)**
|
|
493
|
+
|
|
494
|
+
**IF complexity == "COMPLEX":**
|
|
296
495
|
|
|
297
496
|
Create: `.ai-flow/work/[task-name]/status.json`
|
|
298
497
|
|
|
@@ -324,6 +523,7 @@ Create: `.ai-flow/work/[task-name]/status.json`
|
|
|
324
523
|
**5. User Approval**
|
|
325
524
|
|
|
326
525
|
Show work.md for review:
|
|
526
|
+
|
|
327
527
|
```
|
|
328
528
|
π Generated: .ai-flow/work/[task-name]/work.md
|
|
329
529
|
|
|
@@ -335,10 +535,105 @@ Review work.md? (Yes/Edit/No): _
|
|
|
335
535
|
- **No**: Cancel workflow
|
|
336
536
|
|
|
337
537
|
---
|
|
538
|
+
|
|
338
539
|
## Phase 3: Execution (Branch Creation)
|
|
339
540
|
|
|
340
541
|
**Upon confirmation to start implementation:**
|
|
341
542
|
|
|
543
|
+
**π‘οΈ CRITICAL: Protected Branch Check**
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
git branch --show-current
|
|
547
|
+
git status --porcelain
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**If current branch is protected** (`main`, `master`, `develop`, `development`):
|
|
551
|
+
|
|
552
|
+
**A) If there are uncommitted changes:**
|
|
553
|
+
|
|
554
|
+
1. **Analyze changes to generate branch name:**
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
git status --porcelain
|
|
558
|
+
git diff --stat
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**Detection rules:**
|
|
562
|
+
- **New files** (untracked) β `feature/`
|
|
563
|
+
- **Bug fixes** (keywords: fix, error, bug in commit message or file content) β `fix/`
|
|
564
|
+
- **Refactoring** (modifications without new features) β `refactor/`
|
|
565
|
+
- **Configuration/Dependencies** (package.json, tsconfig, .env, etc.) β `chore/`
|
|
566
|
+
- **Tests only** β `test/`
|
|
567
|
+
- **Documentation only** β `docs/`
|
|
568
|
+
|
|
569
|
+
**Naming strategy:**
|
|
570
|
+
- Extract most significant file/module name
|
|
571
|
+
- Remove extensions and path prefixes
|
|
572
|
+
- Convert to kebab-case
|
|
573
|
+
- Limit to 3-4 words max
|
|
574
|
+
|
|
575
|
+
**Examples:**
|
|
576
|
+
|
|
577
|
+
```
|
|
578
|
+
src/services/UserService.ts (new) β feature/user-service
|
|
579
|
+
src/controllers/AuthController.ts (fix) β fix/auth-controller
|
|
580
|
+
src/utils/validator.ts (modified) β refactor/validator-utils
|
|
581
|
+
package.json + package-lock.json β chore/update-dependencies
|
|
582
|
+
src/services/User* + tests/ β feature/user-management
|
|
583
|
+
Multiple modules (auth + profile) β feature/auth-profile-integration
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
2. **Warn user:**
|
|
587
|
+
|
|
588
|
+
```
|
|
589
|
+
β οΈ Working on protected branch '[branch-name]' with uncommitted changes.
|
|
590
|
+
|
|
591
|
+
Analyzed changes:
|
|
592
|
+
- [file1] (new)
|
|
593
|
+
- [file2] (modified)
|
|
594
|
+
- [file3] (modified)
|
|
595
|
+
... [N] more files
|
|
596
|
+
|
|
597
|
+
Detected type: [feature|fix|refactor|chore]
|
|
598
|
+
Suggested branch: [type]/[descriptive-slug]
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
3. **Offer options:**
|
|
602
|
+
- **A)** Create branch: `[type]/[suggested-name]` β
|
|
603
|
+
- **B)** Edit branch name (user provides custom slug)
|
|
604
|
+
- **C)** Stash changes and continue: `git stash`
|
|
605
|
+
- **D)** Cancel
|
|
606
|
+
|
|
607
|
+
4. If user chooses A:
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
git checkout -b [type]/[suggested-name]
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Then show:
|
|
614
|
+
|
|
615
|
+
```
|
|
616
|
+
β
Created and switched to '[type]/[suggested-name]'
|
|
617
|
+
|
|
618
|
+
Next steps:
|
|
619
|
+
1. Run /flow-commit to commit these changes
|
|
620
|
+
2. Return to protected branch: git checkout [protected-branch]
|
|
621
|
+
3. Continue with /flow-work for new task
|
|
622
|
+
|
|
623
|
+
Or continue working on this branch if it's your intended work.
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
5. If user chooses B:
|
|
627
|
+
```
|
|
628
|
+
Enter branch name (without type prefix): _
|
|
629
|
+
```
|
|
630
|
+
Then create: `[detected-type]/[user-input]`
|
|
631
|
+
|
|
632
|
+
**B) If NO uncommitted changes:**
|
|
633
|
+
|
|
634
|
+
- β
Proceed normally - creating work branches FROM protected branches is correct workflow
|
|
635
|
+
- Protected branches serve as base for new work
|
|
636
|
+
|
|
342
637
|
1. **Generate Branch Name**:
|
|
343
638
|
- `feature/[slug]`
|
|
344
639
|
- `refactor/[slug]`
|
|
@@ -351,72 +646,368 @@ Review work.md? (Yes/Edit/No): _
|
|
|
351
646
|
- Update `status.json` progress
|
|
352
647
|
|
|
353
648
|
---
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
649
|
+
|
|
650
|
+
## Phase 4: Finalization (User-Controlled)
|
|
651
|
+
|
|
652
|
+
**β οΈ SKIP THIS PHASE IF complexity == "SIMPLE"** (already handled in Phase 1.5)
|
|
653
|
+
|
|
654
|
+
**Trigger Options:**
|
|
655
|
+
|
|
656
|
+
- User types: `/flow-work complete`
|
|
657
|
+
- All checkboxes in work.md marked complete
|
|
658
|
+
- User explicitly requests finalization
|
|
659
|
+
|
|
660
|
+
**CRITICAL: This phase requires EXPLICIT user confirmations at each step.**
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
### Step 1: Validation Check
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
π Running validation...
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Execute:
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
npm test # or project-specific test command
|
|
674
|
+
npm run lint # or project-specific lint command
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Show results:
|
|
678
|
+
|
|
679
|
+
```
|
|
680
|
+
π Validation Results
|
|
681
|
+
|
|
682
|
+
Tests: [β
Passed | β Failed (N tests)]
|
|
683
|
+
Lint: [β
Clean | β οΈ N warnings | β N errors]
|
|
684
|
+
Coverage: [X%]
|
|
685
|
+
|
|
686
|
+
Proceed with finalization?
|
|
687
|
+
|
|
688
|
+
a) Yes, continue β
|
|
689
|
+
b) No, let me fix issues
|
|
690
|
+
c) Skip validation (not recommended)
|
|
691
|
+
|
|
692
|
+
Your choice: _
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
- **'b'**: Return to Phase 3 for fixes, END finalization
|
|
696
|
+
- **'c'**: Show warning, ask confirmation again, then continue
|
|
697
|
+
- **'a'**: Continue to Step 2
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
### Step 2: Source Documentation Update (Interactive)
|
|
702
|
+
|
|
703
|
+
**Detect source references:**
|
|
704
|
+
|
|
705
|
+
```python
|
|
706
|
+
source = extract_from_work_md_or_status_json()
|
|
707
|
+
# Returns: "HU-001-002" | "roadmap-2.3" | "manual" | None
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**IF source exists (HU or roadmap):**
|
|
711
|
+
|
|
712
|
+
```
|
|
713
|
+
π Update Source Documentation?
|
|
714
|
+
|
|
715
|
+
Found:
|
|
716
|
+
- planning/roadmap.md β Feature 2.3 "User Authentication"
|
|
717
|
+
- planning/user-stories/EP-001/HU-001-002.md
|
|
718
|
+
|
|
719
|
+
What to update?
|
|
720
|
+
|
|
721
|
+
a) Update both β
|
|
722
|
+
b) Update roadmap only
|
|
723
|
+
c) Update user story only
|
|
724
|
+
d) Skip (I'll update manually later)
|
|
725
|
+
|
|
726
|
+
Your choice: _
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
**Execute selected updates:**
|
|
730
|
+
|
|
731
|
+
- Read files
|
|
732
|
+
- Mark checkboxes as complete: `- [ ]` β `- [x]`
|
|
733
|
+
- Add timestamp comment: `<!-- Completed: YYYY-MM-DD HH:MM -->`
|
|
734
|
+
- Save files
|
|
735
|
+
|
|
736
|
+
**Show confirmation:**
|
|
737
|
+
|
|
738
|
+
```
|
|
739
|
+
β
Updated:
|
|
740
|
+
- planning/roadmap.md (Feature 2.3)
|
|
741
|
+
- planning/user-stories/EP-001/HU-001-002.md (5/5 DoD items)
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
**IF update fails:**
|
|
745
|
+
|
|
746
|
+
```
|
|
747
|
+
β Failed to update [file]: [reason]
|
|
748
|
+
|
|
749
|
+
Options:
|
|
750
|
+
1) Retry update
|
|
751
|
+
2) Skip this file
|
|
752
|
+
3) Cancel finalization
|
|
753
|
+
|
|
754
|
+
Your choice: _
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
**IF source is "manual" or None:**
|
|
758
|
+
|
|
759
|
+
```
|
|
760
|
+
βοΈ No source documentation to update (manual task)
|
|
761
|
+
```
|
|
418
762
|
|
|
419
763
|
---
|
|
764
|
+
|
|
765
|
+
### Step 3: Archiving Decision (Explicit Confirmation)
|
|
766
|
+
|
|
767
|
+
**Show current state:**
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
git diff --stat
|
|
771
|
+
git log --oneline origin/[base-branch]..HEAD
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
**Present archiving options:**
|
|
775
|
+
|
|
776
|
+
```
|
|
777
|
+
πΎ Task Completion Options
|
|
778
|
+
|
|
779
|
+
Current work:
|
|
780
|
+
- Branch: [branch-name]
|
|
781
|
+
- Files changed: [N]
|
|
782
|
+
- Commits: [N]
|
|
783
|
+
- Duration: [X min]
|
|
784
|
+
|
|
785
|
+
What do you want to do?
|
|
786
|
+
|
|
787
|
+
a) Complete & Archive β
|
|
788
|
+
β Record analytics, delete work files, clean state
|
|
789
|
+
|
|
790
|
+
b) Complete & Keep
|
|
791
|
+
β Record analytics, rename folder to [task]-completed
|
|
792
|
+
|
|
793
|
+
c) Mark as Paused
|
|
794
|
+
β Keep work files for later resume
|
|
795
|
+
|
|
796
|
+
d) Cancel
|
|
797
|
+
β Go back to editing
|
|
798
|
+
|
|
799
|
+
Your choice: _
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
**IF 'a' (Complete & Archive):**
|
|
803
|
+
|
|
804
|
+
```
|
|
805
|
+
β
Archiving task...
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
1. **Extract metadata:**
|
|
809
|
+
|
|
810
|
+
```javascript
|
|
811
|
+
// IF complexity == "COMPLEX" (has status.json):
|
|
812
|
+
analytics = {
|
|
813
|
+
task: '[task-name]',
|
|
814
|
+
type: '[feature|refactor|fix]',
|
|
815
|
+
src: '[HU-001-002|roadmap-2.3|manual]',
|
|
816
|
+
dur: Math.round((completed - created) / 60000), // minutes
|
|
817
|
+
start: timestamps.created,
|
|
818
|
+
end: new Date().toISOString(),
|
|
819
|
+
tasks: progress.totalTasks,
|
|
820
|
+
sp: extract_story_points_from_work_md(),
|
|
821
|
+
commits: git.commits.length,
|
|
822
|
+
valid: validation.tests.passed && validation.lint.passed,
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
// IF complexity == "MEDIUM" (only work.md):
|
|
826
|
+
analytics = {
|
|
827
|
+
task: '[task-name]',
|
|
828
|
+
type: '[detected-from-folder-name]',
|
|
829
|
+
src: 'manual',
|
|
830
|
+
dur: estimate_duration_from_git_log(),
|
|
831
|
+
start: get_first_commit_timestamp(),
|
|
832
|
+
end: new Date().toISOString(),
|
|
833
|
+
tasks: count_checkboxes_in_work_md(),
|
|
834
|
+
sp: extract_story_points_from_work_md() || null,
|
|
835
|
+
commits: count_commits_in_branch(),
|
|
836
|
+
valid: validation_passed,
|
|
837
|
+
};
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
2. **Append to analytics:**
|
|
841
|
+
|
|
842
|
+
```bash
|
|
843
|
+
echo '{json}' >> .ai-flow/archive/analytics.jsonl
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
3. **Delete work folder:**
|
|
847
|
+
|
|
848
|
+
```bash
|
|
849
|
+
rm -rf .ai-flow/work/[task-name]/
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
4. **Show confirmation:**
|
|
853
|
+
|
|
854
|
+
```
|
|
855
|
+
β
Task archived successfully
|
|
856
|
+
|
|
857
|
+
π Analytics recorded:
|
|
858
|
+
- Duration: [X] min
|
|
859
|
+
- Story Points: [N]
|
|
860
|
+
- Commits: [N]
|
|
861
|
+
- Validation: [β
Passed | β Failed]
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
**IF 'b' (Complete & Keep):**
|
|
865
|
+
|
|
866
|
+
1. Record analytics (same as 'a')
|
|
867
|
+
2. Rename folder:
|
|
868
|
+
```bash
|
|
869
|
+
mv .ai-flow/work/[task] .ai-flow/work/[task]-completed/
|
|
870
|
+
```
|
|
871
|
+
3. Show: `β
Task marked complete. Files kept in: .ai-flow/work/[task]-completed/`
|
|
872
|
+
|
|
873
|
+
**IF 'c' (Mark as Paused):**
|
|
874
|
+
|
|
875
|
+
1. Add marker file:
|
|
876
|
+
```bash
|
|
877
|
+
echo "Paused: $(date)" > .ai-flow/work/[task]/PAUSED
|
|
878
|
+
```
|
|
879
|
+
2. Show: `βΈοΈ Task paused. Resume with: /flow-work`
|
|
880
|
+
3. **END finalization**
|
|
881
|
+
|
|
882
|
+
**IF 'd' (Cancel):**
|
|
883
|
+
|
|
884
|
+
1. Show: `β Finalization cancelled. Task remains active.`
|
|
885
|
+
2. **END finalization**
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
### Step 4: Ticket Summary (Optional)
|
|
890
|
+
|
|
891
|
+
**Only ask if task was archived (option 'a' or 'b'):**
|
|
892
|
+
|
|
893
|
+
```
|
|
894
|
+
π Generate ticket summary?
|
|
895
|
+
|
|
896
|
+
(For ClickUp, Jira, Linear, Asana, Trello, GitHub Projects, etc.)
|
|
897
|
+
|
|
898
|
+
y/n: _
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
**IF 'y':**
|
|
902
|
+
|
|
903
|
+
1. Check if template exists:
|
|
904
|
+
|
|
905
|
+
```bash
|
|
906
|
+
[ -f .ai-flow/prompts/shared/task-summary-template.md ]
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
2. **IF template exists:**
|
|
910
|
+
- Read template
|
|
911
|
+
- Extract data from:
|
|
912
|
+
- Last line of `analytics.jsonl`
|
|
913
|
+
- Git stats: `git diff --stat`, `git log --oneline`
|
|
914
|
+
- Branch info
|
|
915
|
+
- Populate template with real data
|
|
916
|
+
- Show formatted summary
|
|
917
|
+
|
|
918
|
+
3. **IF template doesn't exist:**
|
|
919
|
+
- Generate basic summary:
|
|
920
|
+
|
|
921
|
+
```
|
|
922
|
+
π Task Summary
|
|
923
|
+
|
|
924
|
+
**Task**: [task-name]
|
|
925
|
+
**Type**: [feature|refactor|fix]
|
|
926
|
+
**Duration**: [X min]
|
|
927
|
+
**Story Points**: [N]
|
|
928
|
+
**Commits**: [N]
|
|
929
|
+
**Branch**: [branch-name]
|
|
930
|
+
**Status**: β
Complete
|
|
931
|
+
|
|
932
|
+
**Changes**:
|
|
933
|
+
[git diff --stat output]
|
|
934
|
+
|
|
935
|
+
**Commits**:
|
|
936
|
+
[git log --oneline output]
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
4. Show: `π Copy the summary above to your ticket system`
|
|
940
|
+
|
|
941
|
+
**IF 'n':**
|
|
942
|
+
|
|
943
|
+
```
|
|
944
|
+
βοΈ Skipping ticket summary
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
---
|
|
948
|
+
|
|
949
|
+
### Step 5: Git Push (Final Step)
|
|
950
|
+
|
|
951
|
+
```
|
|
952
|
+
π Push changes to remote?
|
|
953
|
+
|
|
954
|
+
git push origin [branch-name]
|
|
955
|
+
|
|
956
|
+
y/n: _
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
**IF 'y':**
|
|
960
|
+
|
|
961
|
+
```bash
|
|
962
|
+
git push origin [branch-name]
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
Show result:
|
|
966
|
+
|
|
967
|
+
```
|
|
968
|
+
β
Pushed to origin/[branch-name]
|
|
969
|
+
|
|
970
|
+
Next steps:
|
|
971
|
+
- Create Pull Request/Merge Request
|
|
972
|
+
- Request code review
|
|
973
|
+
- Update project board
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
**IF 'n':**
|
|
977
|
+
|
|
978
|
+
```
|
|
979
|
+
βοΈ Skipping push
|
|
980
|
+
|
|
981
|
+
β οΈ Remember to push later:
|
|
982
|
+
git push origin [branch-name]
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
---
|
|
986
|
+
|
|
987
|
+
### Finalization Complete
|
|
988
|
+
|
|
989
|
+
```
|
|
990
|
+
β
Task Finalization Complete
|
|
991
|
+
|
|
992
|
+
π Summary:
|
|
993
|
+
- [β
|β οΈ] Validation passed
|
|
994
|
+
- [β
|βοΈ] Documentation updated
|
|
995
|
+
- [β
|βοΈ] Task archived
|
|
996
|
+
- [β
|βοΈ] Ticket summary generated
|
|
997
|
+
- [β
|βοΈ] Pushed to remote
|
|
998
|
+
|
|
999
|
+
Task: [task-name]
|
|
1000
|
+
Branch: [branch-name]
|
|
1001
|
+
Duration: [X min]
|
|
1002
|
+
Commits: [N]
|
|
1003
|
+
|
|
1004
|
+
π Great work!
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
**END WORKFLOW**
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
420
1011
|
## Orchestration Rules
|
|
421
1012
|
|
|
422
1013
|
- **DRY Logic**: This file handles the high-level orchestration.
|
|
@@ -428,4 +1019,5 @@ Review work.md? (Yes/Edit/No): _
|
|
|
428
1019
|
- **State Persistence**: Always read/write to `.ai-flow/work/[name]/status.json` to maintain state across sessions.
|
|
429
1020
|
|
|
430
1021
|
---
|
|
1022
|
+
|
|
431
1023
|
**BEGIN EXECUTION when user runs `/flow-work [args]`**
|