maestro-flow 0.1.0 → 0.1.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/.codex/skills/manage-codebase-rebuild/SKILL.md +405 -405
- package/.codex/skills/manage-codebase-refresh/SKILL.md +82 -82
- package/.codex/skills/manage-issue/SKILL.md +65 -65
- package/.codex/skills/manage-status/SKILL.md +89 -89
- package/.codex/skills/quality-debug/SKILL.md +413 -413
- package/.codex/skills/quality-refactor/SKILL.md +191 -191
- package/.codex/skills/quality-sync/SKILL.md +89 -89
- package/.codex/skills/quality-test/SKILL.md +198 -198
- package/.codex/skills/spec-add/SKILL.md +79 -79
- package/.codex/skills/spec-load/SKILL.md +75 -75
- package/.codex/skills/spec-map/SKILL.md +182 -182
- package/.codex/skills/spec-setup/SKILL.md +76 -76
- package/.codex/skills/team-coordinate/SKILL.md +7 -7
- package/.codex/skills/team-coordinate/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -2
- package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +1 -1
- package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +1 -1
- package/.codex/skills/team-quality-assurance/SKILL.md +2 -2
- package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
- package/.codex/skills/team-quality-assurance/roles/scout/role.md +2 -2
- package/.codex/skills/team-review/SKILL.md +2 -2
- package/.codex/skills/team-review/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-review/roles/reviewer/role.md +2 -2
- package/.codex/skills/team-review/roles/scanner/role.md +1 -1
- package/.codex/skills/team-tech-debt/SKILL.md +2 -2
- package/.codex/skills/team-tech-debt/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/executor/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +2 -2
- package/.codex/skills/team-tech-debt/roles/validator/role.md +1 -1
- package/.codex/skills/team-testing/SKILL.md +2 -2
- package/.codex/skills/team-testing/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-testing/roles/executor/role.md +2 -2
- package/.codex/skills/team-testing/roles/generator/role.md +2 -2
- package/README.md +43 -4
- package/dist/agents/dashboard-bridge.d.ts +5 -0
- package/dist/agents/dashboard-bridge.d.ts.map +1 -1
- package/dist/agents/dashboard-bridge.js +13 -0
- package/dist/agents/dashboard-bridge.js.map +1 -1
- package/dist/agents/parallel-cli-runner.d.ts +42 -0
- package/dist/agents/parallel-cli-runner.d.ts.map +1 -0
- package/dist/agents/parallel-cli-runner.js +200 -0
- package/dist/agents/parallel-cli-runner.js.map +1 -0
- package/dist/agents/terminal-adapter.d.ts +94 -0
- package/dist/agents/terminal-adapter.d.ts.map +1 -0
- package/dist/agents/terminal-adapter.js +132 -0
- package/dist/agents/terminal-adapter.js.map +1 -0
- package/dist/agents/terminal-backend.d.ts +53 -0
- package/dist/agents/terminal-backend.d.ts.map +1 -0
- package/dist/agents/terminal-backend.js +286 -0
- package/dist/agents/terminal-backend.js.map +1 -0
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/coordinate.d.ts.map +1 -1
- package/dist/commands/coordinate.js +14 -5
- package/dist/commands/coordinate.js.map +1 -1
- package/dist/commands/delegate.d.ts +3 -0
- package/dist/commands/delegate.d.ts.map +1 -0
- package/dist/commands/delegate.js +142 -0
- package/dist/commands/delegate.js.map +1 -0
- package/dist/commands/msg.d.ts +3 -0
- package/dist/commands/msg.d.ts.map +1 -0
- package/dist/commands/msg.js +110 -0
- package/dist/commands/msg.js.map +1 -0
- package/dist/coordinator/graph-types.d.ts +17 -0
- package/dist/coordinator/graph-types.d.ts.map +1 -1
- package/dist/coordinator/graph-walker.d.ts +3 -1
- package/dist/coordinator/graph-walker.d.ts.map +1 -1
- package/dist/coordinator/graph-walker.js +147 -8
- package/dist/coordinator/graph-walker.js.map +1 -1
- package/dist/coordinator/index.d.ts +2 -0
- package/dist/coordinator/index.d.ts.map +1 -1
- package/dist/coordinator/index.js +1 -0
- package/dist/coordinator/index.js.map +1 -1
- package/dist/coordinator/parallel-executor.d.ts +24 -0
- package/dist/coordinator/parallel-executor.d.ts.map +1 -0
- package/dist/coordinator/parallel-executor.js +43 -0
- package/dist/coordinator/parallel-executor.js.map +1 -0
- package/package.json +3 -1
- package/templates/cli/prompts/rules-tech-rules-agent-prompt.txt +89 -89
- package/templates/cli/prompts/workflow-codex-feasibility-validation.txt +176 -176
- package/templates/cli/prompts/workflow-gemini-solution-design.txt +131 -131
- package/templates/cli/prompts/workflow-skill-index.txt +224 -224
- package/templates/cli/protocols/analysis-protocol.md +2 -2
- package/templates/cli/protocols/write-protocol.md +2 -2
- package/workflows/memory.md +2 -2
- package/.codex/skills/team-lifecycle-v4/MIGRATION-PLAN.md +0 -512
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maestro-refactor
|
|
3
|
-
description: Tech debt reduction with reflection-driven iteration. Analyze scope, plan refactoring, execute with test verification, reflect on strategy per round.
|
|
4
|
-
argument-hint: "<phase|--dir path> [--max-iterations N]"
|
|
5
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Refactor
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
$maestro-refactor "src/auth" # module path scope
|
|
14
|
-
$maestro-refactor "authentication" # feature area scope
|
|
15
|
-
$maestro-refactor "all" # full codebase scan
|
|
16
|
-
$maestro-refactor "src/api --max-iterations 5" # limit iteration rounds
|
|
17
|
-
$maestro-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume existing
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**Flags**:
|
|
21
|
-
- `<phase|scope>`: Module path, feature area, or "all"
|
|
22
|
-
- `--dir path`: Resume existing refactor scratch directory
|
|
23
|
-
- `--max-iterations N`: Max refactoring rounds (default: 3)
|
|
24
|
-
|
|
25
|
-
**Output**: `.workflow/scratch/refactor-{slug}-{date}/` with index.json, plan.json, reflection-log.md, .task/, .summaries/
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Overview
|
|
30
|
-
|
|
31
|
-
Iterative refactoring cycle: analyze scope for tech debt -> plan refactoring tasks -> execute each with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Implementation
|
|
36
|
-
|
|
37
|
-
### Step 1: Parse Scope
|
|
38
|
-
|
|
39
|
-
1. Parse `$ARGUMENTS` for scope and flags
|
|
40
|
-
2. If `--dir` provided: resume existing scratch directory (skip to Step 5)
|
|
41
|
-
3. Scope types:
|
|
42
|
-
- Module path (e.g., "src/auth") -> scan that directory
|
|
43
|
-
- Feature area (e.g., "authentication") -> search for related files
|
|
44
|
-
- "all" -> full codebase scan
|
|
45
|
-
4. If empty: prompt user via AskUserQuestion with options (Module path / Feature area / Full codebase)
|
|
46
|
-
5. Detect `--max-iterations N` (default: 3)
|
|
47
|
-
|
|
48
|
-
### Step 2: Create Scratch Directory
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
REFACTOR_DIR=".workflow/scratch/refactor-${slug}-${date}"
|
|
52
|
-
mkdir -p "$REFACTOR_DIR/.task"
|
|
53
|
-
mkdir -p "$REFACTOR_DIR/.summaries"
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Write `index.json` with type "refactor", scope, status "active", plan/execution/reflection counters.
|
|
57
|
-
|
|
58
|
-
### Step 3: Scope Analysis
|
|
59
|
-
|
|
60
|
-
Load project specs if available (`maestro spec load --category execution`).
|
|
61
|
-
|
|
62
|
-
Analyze scope for tech debt categories:
|
|
63
|
-
|
|
64
|
-
| Category | What to Look For |
|
|
65
|
-
|----------|-----------------|
|
|
66
|
-
| Duplication | Repeated code blocks, copy-paste patterns |
|
|
67
|
-
| Complexity | Long functions, deep nesting, high cyclomatic complexity |
|
|
68
|
-
| Naming | Inconsistent naming, unclear identifiers |
|
|
69
|
-
| Dependencies | Circular deps, tight coupling, god objects |
|
|
70
|
-
| Dead code | Unused functions, unreachable branches |
|
|
71
|
-
| Pattern violations | Inconsistent with project conventions |
|
|
72
|
-
|
|
73
|
-
Present analysis summary table with category, count, severity.
|
|
74
|
-
Confirm with user before proceeding.
|
|
75
|
-
|
|
76
|
-
### Step 4: Plan Refactoring
|
|
77
|
-
|
|
78
|
-
1. Write `plan.json` with scope, total_tasks, strategy ("incremental -- each task independently safe")
|
|
79
|
-
2. For each identified issue, create `.task/TASK-{NNN}.json`:
|
|
80
|
-
- id, title, status (pending), type (refactor), category
|
|
81
|
-
- description, read_first files, files with action/target/change
|
|
82
|
-
- convergence.criteria (grep-verifiable), verification command
|
|
83
|
-
- implementation steps, risk level
|
|
84
|
-
3. Order: high risk last, dependencies respected, quick wins first
|
|
85
|
-
4. Update `index.json` plan fields
|
|
86
|
-
5. Present plan to user via AskUserQuestion -- show affected files, risk areas, ask for approval
|
|
87
|
-
|
|
88
|
-
### Step 5: Execute with Reflection
|
|
89
|
-
|
|
90
|
-
Initialize `reflection-log.md` if not exists.
|
|
91
|
-
|
|
92
|
-
For each task in order:
|
|
93
|
-
|
|
94
|
-
**5a. Execute refactoring:**
|
|
95
|
-
|
|
96
|
-
Spawn Agent for complex refactoring tasks:
|
|
97
|
-
```
|
|
98
|
-
Agent({
|
|
99
|
-
subagent_type: "general-purpose",
|
|
100
|
-
description: "Execute refactoring: {task title}",
|
|
101
|
-
prompt: "Implement refactoring as described. Read files in read_first, apply changes to target files. Follow convergence criteria exactly.",
|
|
102
|
-
run_in_background: false
|
|
103
|
-
})
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**5b. Run test suite:**
|
|
107
|
-
```bash
|
|
108
|
-
npm test 2>&1 || pytest 2>&1 || go test ./... 2>&1
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
**5c. Record in reflection-log.md:**
|
|
112
|
-
```markdown
|
|
113
|
-
## Round {N}: {task title}
|
|
114
|
-
|
|
115
|
-
- **Strategy:** {approach taken}
|
|
116
|
-
- **Result:** {pass|fail}
|
|
117
|
-
- **Tests:** {all pass | N failures}
|
|
118
|
-
- **Adjustment:** {what to change next, or "none needed"}
|
|
119
|
-
- **Files changed:** {list}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**5d. Handle test failures:**
|
|
123
|
-
1. Revert the change
|
|
124
|
-
2. Record failure + strategy adjustment in reflection-log.md
|
|
125
|
-
3. Retry with adjusted strategy (max 2 retries per task)
|
|
126
|
-
4. If still failing: mark task "blocked", continue to next
|
|
127
|
-
|
|
128
|
-
**5e. Update state:**
|
|
129
|
-
- `.task/TASK-{NNN}.json` status -> "completed" or "blocked"
|
|
130
|
-
- `.summaries/TASK-{NNN}-summary.md` written
|
|
131
|
-
- `index.json` execution and reflection fields updated
|
|
132
|
-
|
|
133
|
-
### Step 6: Final Verification
|
|
134
|
-
|
|
135
|
-
Run full test suite. Record final state in reflection-log.md:
|
|
136
|
-
```markdown
|
|
137
|
-
## Final Verification
|
|
138
|
-
|
|
139
|
-
- **Tests:** {result}
|
|
140
|
-
- **Tasks completed:** {N}/{total}
|
|
141
|
-
- **Tasks blocked:** {N}
|
|
142
|
-
- **Key learnings:** {patterns discovered}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Step 7: Complete and Report
|
|
146
|
-
|
|
147
|
-
Update `index.json`: status -> "completed", final execution/reflection counts.
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
## Refactoring Complete: {scope}
|
|
151
|
-
|
|
152
|
-
| Metric | Value |
|
|
153
|
-
|--------|-------|
|
|
154
|
-
| Tasks completed | {N}/{total} |
|
|
155
|
-
| Tasks blocked | {N} |
|
|
156
|
-
| Reflection rounds | {N} |
|
|
157
|
-
| Strategy adjustments | {N} |
|
|
158
|
-
| Tests passing | {yes/no} |
|
|
159
|
-
|
|
160
|
-
Key learnings:
|
|
161
|
-
{from reflection-log.md}
|
|
162
|
-
|
|
163
|
-
Artifacts:
|
|
164
|
-
- Reflection log: {REFACTOR_DIR}/reflection-log.md
|
|
165
|
-
- Task results: {REFACTOR_DIR}/.summaries/
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
If regressions: suggest Skill({ skill: "quality-debug" }).
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Error Handling
|
|
173
|
-
|
|
174
|
-
| Code | Severity | Condition | Recovery |
|
|
175
|
-
|------|----------|-----------|----------|
|
|
176
|
-
| E001 | error | Scope/description required | Prompt user for module path, feature area, or "all" |
|
|
177
|
-
| E002 | error | Test suite not available | Suggest creating tests first, or proceed with manual verification |
|
|
178
|
-
| W001 | warning | Partial test coverage | Note uncovered areas, proceed with extra caution |
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## Core Rules
|
|
183
|
-
|
|
184
|
-
- **Test after every change** -- zero regressions tolerated
|
|
185
|
-
- **Revert on failure** -- never leave broken state
|
|
186
|
-
- **Max 2 retries per task** with strategy adjustment
|
|
187
|
-
- **Reflection-driven** -- every round records strategy, outcome, adjustment
|
|
188
|
-
- **User approval required** before execution (Step 4)
|
|
189
|
-
- **Quick wins first** -- order by risk (low first) and dependency
|
|
190
|
-
- **Agent calls use `run_in_background: false`** for synchronous execution
|
|
191
|
-
- **Incremental safety** -- each task is independently safe to apply or revert
|
|
1
|
+
---
|
|
2
|
+
name: maestro-refactor
|
|
3
|
+
description: Tech debt reduction with reflection-driven iteration. Analyze scope, plan refactoring, execute with test verification, reflect on strategy per round.
|
|
4
|
+
argument-hint: "<phase|--dir path> [--max-iterations N]"
|
|
5
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Refactor
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$maestro-refactor "src/auth" # module path scope
|
|
14
|
+
$maestro-refactor "authentication" # feature area scope
|
|
15
|
+
$maestro-refactor "all" # full codebase scan
|
|
16
|
+
$maestro-refactor "src/api --max-iterations 5" # limit iteration rounds
|
|
17
|
+
$maestro-refactor "--dir .workflow/scratch/refactor-auth-2026-03-18" # resume existing
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Flags**:
|
|
21
|
+
- `<phase|scope>`: Module path, feature area, or "all"
|
|
22
|
+
- `--dir path`: Resume existing refactor scratch directory
|
|
23
|
+
- `--max-iterations N`: Max refactoring rounds (default: 3)
|
|
24
|
+
|
|
25
|
+
**Output**: `.workflow/scratch/refactor-{slug}-{date}/` with index.json, plan.json, reflection-log.md, .task/, .summaries/
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
Iterative refactoring cycle: analyze scope for tech debt -> plan refactoring tasks -> execute each with test verification -> reflect on strategy per round -> repeat if needed. Every change is verified against existing tests. Failed changes are reverted and retried with adjusted strategy.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Implementation
|
|
36
|
+
|
|
37
|
+
### Step 1: Parse Scope
|
|
38
|
+
|
|
39
|
+
1. Parse `$ARGUMENTS` for scope and flags
|
|
40
|
+
2. If `--dir` provided: resume existing scratch directory (skip to Step 5)
|
|
41
|
+
3. Scope types:
|
|
42
|
+
- Module path (e.g., "src/auth") -> scan that directory
|
|
43
|
+
- Feature area (e.g., "authentication") -> search for related files
|
|
44
|
+
- "all" -> full codebase scan
|
|
45
|
+
4. If empty: prompt user via AskUserQuestion with options (Module path / Feature area / Full codebase)
|
|
46
|
+
5. Detect `--max-iterations N` (default: 3)
|
|
47
|
+
|
|
48
|
+
### Step 2: Create Scratch Directory
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
REFACTOR_DIR=".workflow/scratch/refactor-${slug}-${date}"
|
|
52
|
+
mkdir -p "$REFACTOR_DIR/.task"
|
|
53
|
+
mkdir -p "$REFACTOR_DIR/.summaries"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Write `index.json` with type "refactor", scope, status "active", plan/execution/reflection counters.
|
|
57
|
+
|
|
58
|
+
### Step 3: Scope Analysis
|
|
59
|
+
|
|
60
|
+
Load project specs if available (`maestro spec load --category execution`).
|
|
61
|
+
|
|
62
|
+
Analyze scope for tech debt categories:
|
|
63
|
+
|
|
64
|
+
| Category | What to Look For |
|
|
65
|
+
|----------|-----------------|
|
|
66
|
+
| Duplication | Repeated code blocks, copy-paste patterns |
|
|
67
|
+
| Complexity | Long functions, deep nesting, high cyclomatic complexity |
|
|
68
|
+
| Naming | Inconsistent naming, unclear identifiers |
|
|
69
|
+
| Dependencies | Circular deps, tight coupling, god objects |
|
|
70
|
+
| Dead code | Unused functions, unreachable branches |
|
|
71
|
+
| Pattern violations | Inconsistent with project conventions |
|
|
72
|
+
|
|
73
|
+
Present analysis summary table with category, count, severity.
|
|
74
|
+
Confirm with user before proceeding.
|
|
75
|
+
|
|
76
|
+
### Step 4: Plan Refactoring
|
|
77
|
+
|
|
78
|
+
1. Write `plan.json` with scope, total_tasks, strategy ("incremental -- each task independently safe")
|
|
79
|
+
2. For each identified issue, create `.task/TASK-{NNN}.json`:
|
|
80
|
+
- id, title, status (pending), type (refactor), category
|
|
81
|
+
- description, read_first files, files with action/target/change
|
|
82
|
+
- convergence.criteria (grep-verifiable), verification command
|
|
83
|
+
- implementation steps, risk level
|
|
84
|
+
3. Order: high risk last, dependencies respected, quick wins first
|
|
85
|
+
4. Update `index.json` plan fields
|
|
86
|
+
5. Present plan to user via AskUserQuestion -- show affected files, risk areas, ask for approval
|
|
87
|
+
|
|
88
|
+
### Step 5: Execute with Reflection
|
|
89
|
+
|
|
90
|
+
Initialize `reflection-log.md` if not exists.
|
|
91
|
+
|
|
92
|
+
For each task in order:
|
|
93
|
+
|
|
94
|
+
**5a. Execute refactoring:**
|
|
95
|
+
|
|
96
|
+
Spawn Agent for complex refactoring tasks:
|
|
97
|
+
```
|
|
98
|
+
Agent({
|
|
99
|
+
subagent_type: "general-purpose",
|
|
100
|
+
description: "Execute refactoring: {task title}",
|
|
101
|
+
prompt: "Implement refactoring as described. Read files in read_first, apply changes to target files. Follow convergence criteria exactly.",
|
|
102
|
+
run_in_background: false
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**5b. Run test suite:**
|
|
107
|
+
```bash
|
|
108
|
+
npm test 2>&1 || pytest 2>&1 || go test ./... 2>&1
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**5c. Record in reflection-log.md:**
|
|
112
|
+
```markdown
|
|
113
|
+
## Round {N}: {task title}
|
|
114
|
+
|
|
115
|
+
- **Strategy:** {approach taken}
|
|
116
|
+
- **Result:** {pass|fail}
|
|
117
|
+
- **Tests:** {all pass | N failures}
|
|
118
|
+
- **Adjustment:** {what to change next, or "none needed"}
|
|
119
|
+
- **Files changed:** {list}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**5d. Handle test failures:**
|
|
123
|
+
1. Revert the change
|
|
124
|
+
2. Record failure + strategy adjustment in reflection-log.md
|
|
125
|
+
3. Retry with adjusted strategy (max 2 retries per task)
|
|
126
|
+
4. If still failing: mark task "blocked", continue to next
|
|
127
|
+
|
|
128
|
+
**5e. Update state:**
|
|
129
|
+
- `.task/TASK-{NNN}.json` status -> "completed" or "blocked"
|
|
130
|
+
- `.summaries/TASK-{NNN}-summary.md` written
|
|
131
|
+
- `index.json` execution and reflection fields updated
|
|
132
|
+
|
|
133
|
+
### Step 6: Final Verification
|
|
134
|
+
|
|
135
|
+
Run full test suite. Record final state in reflection-log.md:
|
|
136
|
+
```markdown
|
|
137
|
+
## Final Verification
|
|
138
|
+
|
|
139
|
+
- **Tests:** {result}
|
|
140
|
+
- **Tasks completed:** {N}/{total}
|
|
141
|
+
- **Tasks blocked:** {N}
|
|
142
|
+
- **Key learnings:** {patterns discovered}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Step 7: Complete and Report
|
|
146
|
+
|
|
147
|
+
Update `index.json`: status -> "completed", final execution/reflection counts.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
## Refactoring Complete: {scope}
|
|
151
|
+
|
|
152
|
+
| Metric | Value |
|
|
153
|
+
|--------|-------|
|
|
154
|
+
| Tasks completed | {N}/{total} |
|
|
155
|
+
| Tasks blocked | {N} |
|
|
156
|
+
| Reflection rounds | {N} |
|
|
157
|
+
| Strategy adjustments | {N} |
|
|
158
|
+
| Tests passing | {yes/no} |
|
|
159
|
+
|
|
160
|
+
Key learnings:
|
|
161
|
+
{from reflection-log.md}
|
|
162
|
+
|
|
163
|
+
Artifacts:
|
|
164
|
+
- Reflection log: {REFACTOR_DIR}/reflection-log.md
|
|
165
|
+
- Task results: {REFACTOR_DIR}/.summaries/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
If regressions: suggest Skill({ skill: "quality-debug" }).
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Error Handling
|
|
173
|
+
|
|
174
|
+
| Code | Severity | Condition | Recovery |
|
|
175
|
+
|------|----------|-----------|----------|
|
|
176
|
+
| E001 | error | Scope/description required | Prompt user for module path, feature area, or "all" |
|
|
177
|
+
| E002 | error | Test suite not available | Suggest creating tests first, or proceed with manual verification |
|
|
178
|
+
| W001 | warning | Partial test coverage | Note uncovered areas, proceed with extra caution |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Core Rules
|
|
183
|
+
|
|
184
|
+
- **Test after every change** -- zero regressions tolerated
|
|
185
|
+
- **Revert on failure** -- never leave broken state
|
|
186
|
+
- **Max 2 retries per task** with strategy adjustment
|
|
187
|
+
- **Reflection-driven** -- every round records strategy, outcome, adjustment
|
|
188
|
+
- **User approval required** before execution (Step 4)
|
|
189
|
+
- **Quick wins first** -- order by risk (low first) and dependency
|
|
190
|
+
- **Agent calls use `run_in_background: false`** for synchronous execution
|
|
191
|
+
- **Incremental safety** -- each task is independently safe to apply or revert
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maestro-sync
|
|
3
|
-
description: Sync codebase docs after code changes -- traces git diff through component/feature/requirement layers
|
|
4
|
-
argument-hint: "[--full] [--since <commit|HEAD~N>] [--dry-run]"
|
|
5
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Sync
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
$maestro-sync
|
|
14
|
-
$maestro-sync "--since HEAD~5"
|
|
15
|
-
$maestro-sync "--full"
|
|
16
|
-
$maestro-sync "--dry-run"
|
|
17
|
-
$maestro-sync "--since abc123 --dry-run"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
**Flags**:
|
|
21
|
-
- `--full` -- Complete resync of all tracked files (ignores git diff)
|
|
22
|
-
- `--since <commit|HEAD~N>` -- Diff since specific commit (default: last sync timestamp)
|
|
23
|
-
- `--dry-run` -- Show what would be updated without writing
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Implementation
|
|
28
|
-
|
|
29
|
-
### Step 1: Validate
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
test -d .workflow || exit 1 # E001: not initialized
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Step 2: Detect Changes
|
|
36
|
-
|
|
37
|
-
If `--full`: skip diff, mark all tracked files as changed.
|
|
38
|
-
|
|
39
|
-
Otherwise:
|
|
40
|
-
1. Read last sync timestamp from `state.json` field `last_synced`
|
|
41
|
-
2. If `--since` provided, use that as baseline
|
|
42
|
-
3. Run `git diff --name-only {baseline} HEAD` to get changed files
|
|
43
|
-
|
|
44
|
-
If no changes and not `--full`, report clean state (W001) and exit.
|
|
45
|
-
|
|
46
|
-
### Step 3: Trace Impact Chain
|
|
47
|
-
|
|
48
|
-
For each changed file, trace through `doc-index.json` impact layers:
|
|
49
|
-
1. **File layer** -- Which doc entries reference this file directly
|
|
50
|
-
2. **Component layer** -- Which components contain this file
|
|
51
|
-
3. **Feature layer** -- Which features depend on affected components
|
|
52
|
-
4. **Requirement layer** -- Which requirements trace to affected features
|
|
53
|
-
|
|
54
|
-
Build the full set of affected documentation entries.
|
|
55
|
-
|
|
56
|
-
### Step 4: Update Documentation
|
|
57
|
-
|
|
58
|
-
If `--dry-run`: display affected entries and exit.
|
|
59
|
-
|
|
60
|
-
For each affected entry:
|
|
61
|
-
1. Re-read source files
|
|
62
|
-
2. Regenerate the documentation section in `.workflow/codebase/`
|
|
63
|
-
3. Update `doc-index.json` with new timestamp and content hash
|
|
64
|
-
|
|
65
|
-
### Step 5: Update State
|
|
66
|
-
|
|
67
|
-
Update `state.json`:
|
|
68
|
-
- `last_synced: "{ISO timestamp}"`
|
|
69
|
-
- `last_synced_commit: "{HEAD commit hash}"`
|
|
70
|
-
|
|
71
|
-
Update affected `index.json` files in phase directories if task files were modified.
|
|
72
|
-
|
|
73
|
-
Display summary:
|
|
74
|
-
```
|
|
75
|
-
=== SYNC COMPLETE ===
|
|
76
|
-
Files changed: {N}
|
|
77
|
-
Components affected: {C}
|
|
78
|
-
Features affected: {F}
|
|
79
|
-
Docs updated: {D}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Error Handling
|
|
85
|
-
|
|
86
|
-
| Code | Severity | Description |
|
|
87
|
-
|------|----------|-------------|
|
|
88
|
-
| E001 | error | `.workflow/` not initialized -- run `Skill({ skill: "maestro-init" })` first |
|
|
89
|
-
| W001 | warning | No changes detected since last sync |
|
|
1
|
+
---
|
|
2
|
+
name: maestro-sync
|
|
3
|
+
description: Sync codebase docs after code changes -- traces git diff through component/feature/requirement layers
|
|
4
|
+
argument-hint: "[--full] [--since <commit|HEAD~N>] [--dry-run]"
|
|
5
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Sync
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$maestro-sync
|
|
14
|
+
$maestro-sync "--since HEAD~5"
|
|
15
|
+
$maestro-sync "--full"
|
|
16
|
+
$maestro-sync "--dry-run"
|
|
17
|
+
$maestro-sync "--since abc123 --dry-run"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Flags**:
|
|
21
|
+
- `--full` -- Complete resync of all tracked files (ignores git diff)
|
|
22
|
+
- `--since <commit|HEAD~N>` -- Diff since specific commit (default: last sync timestamp)
|
|
23
|
+
- `--dry-run` -- Show what would be updated without writing
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Implementation
|
|
28
|
+
|
|
29
|
+
### Step 1: Validate
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
test -d .workflow || exit 1 # E001: not initialized
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 2: Detect Changes
|
|
36
|
+
|
|
37
|
+
If `--full`: skip diff, mark all tracked files as changed.
|
|
38
|
+
|
|
39
|
+
Otherwise:
|
|
40
|
+
1. Read last sync timestamp from `state.json` field `last_synced`
|
|
41
|
+
2. If `--since` provided, use that as baseline
|
|
42
|
+
3. Run `git diff --name-only {baseline} HEAD` to get changed files
|
|
43
|
+
|
|
44
|
+
If no changes and not `--full`, report clean state (W001) and exit.
|
|
45
|
+
|
|
46
|
+
### Step 3: Trace Impact Chain
|
|
47
|
+
|
|
48
|
+
For each changed file, trace through `doc-index.json` impact layers:
|
|
49
|
+
1. **File layer** -- Which doc entries reference this file directly
|
|
50
|
+
2. **Component layer** -- Which components contain this file
|
|
51
|
+
3. **Feature layer** -- Which features depend on affected components
|
|
52
|
+
4. **Requirement layer** -- Which requirements trace to affected features
|
|
53
|
+
|
|
54
|
+
Build the full set of affected documentation entries.
|
|
55
|
+
|
|
56
|
+
### Step 4: Update Documentation
|
|
57
|
+
|
|
58
|
+
If `--dry-run`: display affected entries and exit.
|
|
59
|
+
|
|
60
|
+
For each affected entry:
|
|
61
|
+
1. Re-read source files
|
|
62
|
+
2. Regenerate the documentation section in `.workflow/codebase/`
|
|
63
|
+
3. Update `doc-index.json` with new timestamp and content hash
|
|
64
|
+
|
|
65
|
+
### Step 5: Update State
|
|
66
|
+
|
|
67
|
+
Update `state.json`:
|
|
68
|
+
- `last_synced: "{ISO timestamp}"`
|
|
69
|
+
- `last_synced_commit: "{HEAD commit hash}"`
|
|
70
|
+
|
|
71
|
+
Update affected `index.json` files in phase directories if task files were modified.
|
|
72
|
+
|
|
73
|
+
Display summary:
|
|
74
|
+
```
|
|
75
|
+
=== SYNC COMPLETE ===
|
|
76
|
+
Files changed: {N}
|
|
77
|
+
Components affected: {C}
|
|
78
|
+
Features affected: {F}
|
|
79
|
+
Docs updated: {D}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Error Handling
|
|
85
|
+
|
|
86
|
+
| Code | Severity | Description |
|
|
87
|
+
|------|----------|-------------|
|
|
88
|
+
| E001 | error | `.workflow/` not initialized -- run `Skill({ skill: "maestro-init" })` first |
|
|
89
|
+
| W001 | warning | No changes detected since last sync |
|