maestro-flow 0.3.4 → 0.3.6

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 (105) hide show
  1. package/.claude/commands/maestro-brainstorm.md +10 -1
  2. package/.claude/commands/maestro-milestone-audit.md +1 -1
  3. package/.claude/commands/maestro-milestone-complete.md +2 -1
  4. package/.claude/commands/maestro-milestone-release.md +96 -0
  5. package/.claude/commands/maestro-phase-add.md +9 -1
  6. package/.claude/commands/maestro-phase-transition.md +9 -1
  7. package/.claude/commands/maestro.md +6 -0
  8. package/.claude/commands/manage-codebase-rebuild.md +76 -50
  9. package/.claude/commands/manage-codebase-refresh.md +9 -1
  10. package/.claude/commands/quality-refactor.md +1 -1
  11. package/.claude/commands/quality-sync.md +9 -1
  12. package/.claude/commands/spec-setup.md +1 -1
  13. package/.codex/skills/maestro-coordinate/SKILL.md +20 -6
  14. package/.codex/skills/maestro-init/SKILL.md +167 -167
  15. package/.codex/skills/maestro-phase-add/SKILL.md +154 -154
  16. package/.codex/skills/maestro-phase-transition/SKILL.md +173 -173
  17. package/.codex/skills/maestro-verify/SKILL.md +566 -566
  18. package/.codex/skills/manage-codebase-rebuild/SKILL.md +5 -5
  19. package/.codex/skills/manage-codebase-refresh/SKILL.md +5 -5
  20. package/.codex/skills/manage-issue/SKILL.md +7 -7
  21. package/.codex/skills/manage-issue-analyze/SKILL.md +8 -8
  22. package/.codex/skills/manage-issue-discover/SKILL.md +503 -503
  23. package/.codex/skills/manage-issue-execute/SKILL.md +9 -9
  24. package/.codex/skills/manage-issue-plan/SKILL.md +8 -8
  25. package/.codex/skills/manage-learn/SKILL.md +7 -7
  26. package/.codex/skills/manage-memory/SKILL.md +72 -72
  27. package/.codex/skills/manage-memory-capture/SKILL.md +86 -86
  28. package/.codex/skills/manage-status/SKILL.md +2 -2
  29. package/.codex/skills/quality-business-test/SKILL.md +8 -8
  30. package/.codex/skills/quality-debug/SKILL.md +5 -5
  31. package/.codex/skills/quality-integration-test/SKILL.md +544 -544
  32. package/.codex/skills/quality-refactor/SKILL.md +6 -6
  33. package/.codex/skills/quality-retrospective/SKILL.md +13 -13
  34. package/.codex/skills/quality-review/SKILL.md +408 -408
  35. package/.codex/skills/quality-sync/SKILL.md +6 -6
  36. package/.codex/skills/quality-test/SKILL.md +5 -5
  37. package/.codex/skills/quality-test-gen/SKILL.md +447 -447
  38. package/.codex/skills/spec-add/SKILL.md +5 -5
  39. package/.codex/skills/spec-load/SKILL.md +5 -5
  40. package/.codex/skills/spec-map/SKILL.md +5 -5
  41. package/.codex/skills/spec-setup/SKILL.md +2 -2
  42. package/.codex/skills/team-coordinate/SKILL.md +1 -1
  43. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +19 -10
  44. package/.codex/skills/team-coordinate/roles/coordinator/role.md +2 -2
  45. package/.codex/skills/team-executor/SKILL.md +1 -1
  46. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +20 -9
  47. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -2
  48. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +31 -12
  49. package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +1 -1
  50. package/.codex/skills/team-quality-assurance/SKILL.md +1 -1
  51. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +20 -9
  52. package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +1 -1
  53. package/.codex/skills/team-review/SKILL.md +1 -1
  54. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +20 -9
  55. package/.codex/skills/team-review/roles/coordinator/role.md +1 -1
  56. package/.codex/skills/team-tech-debt/SKILL.md +1 -1
  57. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +20 -9
  58. package/.codex/skills/team-tech-debt/roles/coordinator/role.md +1 -1
  59. package/.codex/skills/team-testing/SKILL.md +2 -2
  60. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +20 -9
  61. package/.codex/skills/team-testing/roles/coordinator/role.md +1 -1
  62. package/chains/singles/spec-map.json +2 -2
  63. package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.d.ts +4 -0
  64. package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js +47 -1
  65. package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js.map +1 -1
  66. package/dashboard/dist-server/src/commands/delegate.d.ts +23 -0
  67. package/dashboard/dist-server/src/commands/delegate.js +91 -55
  68. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  69. package/dist/src/brainstorm-visualize/frame.d.ts +8 -0
  70. package/dist/src/brainstorm-visualize/frame.d.ts.map +1 -0
  71. package/dist/src/brainstorm-visualize/frame.js +655 -0
  72. package/dist/src/brainstorm-visualize/frame.js.map +1 -0
  73. package/dist/src/brainstorm-visualize/server.d.ts +2 -0
  74. package/dist/src/brainstorm-visualize/server.d.ts.map +1 -0
  75. package/dist/src/brainstorm-visualize/server.js +180 -0
  76. package/dist/src/brainstorm-visualize/server.js.map +1 -0
  77. package/dist/src/cli.js +11 -1
  78. package/dist/src/cli.js.map +1 -1
  79. package/dist/src/commands/brainstorm-visualize.d.ts +3 -0
  80. package/dist/src/commands/brainstorm-visualize.d.ts.map +1 -0
  81. package/dist/src/commands/brainstorm-visualize.js +337 -0
  82. package/dist/src/commands/brainstorm-visualize.js.map +1 -0
  83. package/dist/src/commands/core-memory.d.ts +3 -0
  84. package/dist/src/commands/core-memory.d.ts.map +1 -0
  85. package/dist/src/commands/core-memory.js +101 -0
  86. package/dist/src/commands/core-memory.js.map +1 -0
  87. package/dist/src/commands/delegate.d.ts +23 -0
  88. package/dist/src/commands/delegate.d.ts.map +1 -1
  89. package/dist/src/commands/delegate.js +91 -55
  90. package/dist/src/commands/delegate.js.map +1 -1
  91. package/dist/src/commands/install-backend.d.ts.map +1 -1
  92. package/dist/src/commands/install-backend.js +5 -2
  93. package/dist/src/commands/install-backend.js.map +1 -1
  94. package/dist/src/mcp/delegate-channel-relay.d.ts.map +1 -1
  95. package/dist/src/mcp/delegate-channel-relay.js +6 -0
  96. package/dist/src/mcp/delegate-channel-relay.js.map +1 -1
  97. package/dist/src/mcp/server.d.ts.map +1 -1
  98. package/dist/src/mcp/server.js +28 -1
  99. package/dist/src/mcp/server.js.map +1 -1
  100. package/dist/src/tools/index.d.ts +1 -6
  101. package/dist/src/tools/index.d.ts.map +1 -1
  102. package/dist/src/tools/index.js +1 -460
  103. package/dist/src/tools/index.js.map +1 -1
  104. package/package.json +2 -1
  105. package/.claude/commands/spec-map.md +0 -82
@@ -1,167 +1,167 @@
1
- ---
2
- name: maestro-init
3
- description: Initialize project with auto state detection — creates .workflow/ directory, project.md, state.json, config.json, and specs/
4
- argument-hint: "[--auto] [--from-brainstorm SESSION-ID]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--auto`: After config questions, run research without further interaction. Expects idea document via @ reference.
11
-
12
- # Maestro Init (Single Agent)
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $maestro-init ""
18
- $maestro-init "--auto"
19
- $maestro-init "--from-brainstorm brainstorm-auth-20260318"
20
- ```
21
-
22
- **Flags**:
23
- - `--auto`: Skip interactive questioning; extract from provided document
24
- - `--from-brainstorm SESSION-ID`: Import vision/goals/constraints from brainstorm guidance-specification.md
25
-
26
- **Output**: `.workflow/` directory with project.md, state.json, config.json, specs/
27
-
28
- ---
29
-
30
- ## Overview
31
-
32
- Sequential project setup skill. Detects project state (empty/code/existing), gathers project information through deep questioning or document extraction, then creates the `.workflow/` directory structure. No parallel agents — single sequential flow.
33
-
34
- ---
35
-
36
- ## Implementation
37
-
38
- ### Step 1: Parse Arguments
39
-
40
- Extract flags from arguments:
41
- - `--auto` flag presence
42
- - `--from-brainstorm SESSION-ID` value
43
- - Remaining text as project description
44
-
45
- ### Step 2: Detect Project State
46
-
47
- ```bash
48
- # Check existing state
49
- ls .workflow/state.json 2>/dev/null
50
- ls package.json pyproject.toml Cargo.toml go.mod 2>/dev/null
51
- ```
52
-
53
- Classify as:
54
- - **existing**: `.workflow/state.json` found — warn and exit (E002)
55
- - **code**: Source files present but no `.workflow/` — onboarding existing codebase
56
- - **empty**: Greenfield project
57
-
58
- ### Step 3: Gather Project Information
59
-
60
- **If `--from-brainstorm`**:
61
- - Read `.workflow/.brainstorm/{SESSION-ID}/guidance-specification.md`
62
- - Extract: vision, goals, constraints, terminology, tech decisions
63
- - Skip interactive questioning
64
-
65
- **If `--auto`**:
66
- - Extract project info from provided document/@ reference
67
- - Minimal interactive questions (confirm core value only)
68
-
69
- **Otherwise (interactive)**:
70
- - Deep questioning flow:
71
- 1. What is the core value proposition?
72
- 2. Who are the target users?
73
- 3. What are the key requirements? (follow threads, don't rush)
74
- 4. What are known constraints/limitations?
75
- 5. What tech stack preferences exist?
76
- - Follow each thread with clarifying questions until satisfied
77
-
78
- ### Step 4: Read Templates
79
-
80
- Read the following templates:
81
- - `~/.maestro/templates/project.md`
82
- - `~/.maestro/templates/state.json`
83
- - `~/.maestro/templates/config.json`
84
-
85
- ### Step 5: Create .workflow/ Structure
86
-
87
- ```bash
88
- mkdir -p .workflow/specs .workflow/phases .workflow/scratch .workflow/codebase
89
- ```
90
-
91
- ### Step 6: Write project.md
92
-
93
- Populate template with gathered information:
94
- - Project name, core value proposition
95
- - Requirements: Validated / Active / Out of Scope
96
- - Key decisions and constraints
97
- - Tech stack (detected or specified)
98
-
99
- Write to `.workflow/project.md`.
100
-
101
- ### Step 7: Write state.json
102
-
103
- Initialize state from template:
104
- - `current_phase`: null
105
- - `current_milestone`: null
106
- - `status`: "initialized"
107
-
108
- Write to `.workflow/state.json`.
109
-
110
- ### Step 8: Write config.json
111
-
112
- Configuration questions (or defaults for --auto):
113
- - Granularity: fine / medium / coarse
114
- - Workflow agents: enable/disable optional agents
115
- - Gate preferences: verification strictness
116
-
117
- Write to `.workflow/config.json`.
118
-
119
- ### Step 9: Initialize specs/
120
-
121
- Create convention files in `.workflow/specs/`:
122
- - `conventions.md` — detected or specified coding conventions
123
- - `learnings.md` — empty, populated during phase transitions
124
-
125
- ### Step 10: Completion Report
126
-
127
- ```
128
- === WORKFLOW INITIALIZED ===
129
- Project: {project_name}
130
- State: .workflow/state.json (active)
131
-
132
- Created:
133
- .workflow/project.md
134
- .workflow/state.json
135
- .workflow/config.json
136
- .workflow/specs/
137
-
138
- Next steps (choose one path to create roadmap):
139
- $maestro-spec-generate "<idea>" -- Full spec package + roadmap (heavy)
140
- $maestro-roadmap "<requirement>" -- Direct interactive roadmap (light)
141
-
142
- Other commands:
143
- $maestro-status -- View project dashboard
144
- $maestro-brainstorm "<topic>" -- Explore ideas first
145
- $maestro-quick "<task>" -- Quick ad-hoc task
146
- ```
147
-
148
- ---
149
-
150
- ## Error Handling
151
-
152
- | Code | Severity | Description | Recovery |
153
- |------|----------|-------------|----------|
154
- | E001 | error | No arguments when --auto requires document | Ask user for document reference |
155
- | E002 | error | .workflow/ already exists | Show status, suggest manage-status |
156
- | E003 | error | Brainstorm session not found | List available sessions |
157
- | W001 | warning | Could not detect tech stack | Continue with manual input |
158
-
159
- ---
160
-
161
- ## Core Rules
162
-
163
- 1. **Never create roadmap** — init only creates .workflow/ structure; roadmap is a separate step
164
- 2. **Deep questioning over speed** — follow threads, ask clarifying questions (unless --auto)
165
- 3. **Detect, don't assume** — scan for existing files, package managers, frameworks before asking
166
- 4. **Templates are source of truth** — always read templates before writing files
167
- 5. **Idempotent check** — if .workflow/ exists, refuse to overwrite (E002)
1
+ ---
2
+ name: maestro-init
3
+ description: Initialize project with auto state detection — creates .workflow/ directory, project.md, state.json, config.json, and specs/
4
+ argument-hint: "[--auto] [--from-brainstorm SESSION-ID]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--auto`: After config questions, run research without further interaction. Expects idea document via @ reference.
11
+
12
+ # Maestro Init (Single Agent)
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $maestro-init ""
18
+ $maestro-init "--auto"
19
+ $maestro-init "--from-brainstorm brainstorm-auth-20260318"
20
+ ```
21
+
22
+ **Flags**:
23
+ - `--auto`: Skip interactive questioning; extract from provided document
24
+ - `--from-brainstorm SESSION-ID`: Import vision/goals/constraints from brainstorm guidance-specification.md
25
+
26
+ **Output**: `.workflow/` directory with project.md, state.json, config.json, specs/
27
+
28
+ ---
29
+
30
+ ## Overview
31
+
32
+ Sequential project setup skill. Detects project state (empty/code/existing), gathers project information through deep questioning or document extraction, then creates the `.workflow/` directory structure. No parallel agents — single sequential flow.
33
+
34
+ ---
35
+
36
+ ## Implementation
37
+
38
+ ### Step 1: Parse Arguments
39
+
40
+ Extract flags from arguments:
41
+ - `--auto` flag presence
42
+ - `--from-brainstorm SESSION-ID` value
43
+ - Remaining text as project description
44
+
45
+ ### Step 2: Detect Project State
46
+
47
+ ```bash
48
+ # Check existing state
49
+ ls .workflow/state.json 2>/dev/null
50
+ ls package.json pyproject.toml Cargo.toml go.mod 2>/dev/null
51
+ ```
52
+
53
+ Classify as:
54
+ - **existing**: `.workflow/state.json` found — warn and exit (E002)
55
+ - **code**: Source files present but no `.workflow/` — onboarding existing codebase
56
+ - **empty**: Greenfield project
57
+
58
+ ### Step 3: Gather Project Information
59
+
60
+ **If `--from-brainstorm`**:
61
+ - Read `.workflow/.brainstorm/{SESSION-ID}/guidance-specification.md`
62
+ - Extract: vision, goals, constraints, terminology, tech decisions
63
+ - Skip interactive questioning
64
+
65
+ **If `--auto`**:
66
+ - Extract project info from provided document/@ reference
67
+ - Minimal interactive questions (confirm core value only)
68
+
69
+ **Otherwise (interactive)**:
70
+ - Deep questioning flow:
71
+ 1. What is the core value proposition?
72
+ 2. Who are the target users?
73
+ 3. What are the key requirements? (follow threads, don't rush)
74
+ 4. What are known constraints/limitations?
75
+ 5. What tech stack preferences exist?
76
+ - Follow each thread with clarifying questions until satisfied
77
+
78
+ ### Step 4: Read Templates
79
+
80
+ Read the following templates:
81
+ - `~/.maestro/templates/project.md`
82
+ - `~/.maestro/templates/state.json`
83
+ - `~/.maestro/templates/config.json`
84
+
85
+ ### Step 5: Create .workflow/ Structure
86
+
87
+ ```bash
88
+ mkdir -p .workflow/specs .workflow/phases .workflow/scratch .workflow/codebase
89
+ ```
90
+
91
+ ### Step 6: Write project.md
92
+
93
+ Populate template with gathered information:
94
+ - Project name, core value proposition
95
+ - Requirements: Validated / Active / Out of Scope
96
+ - Key decisions and constraints
97
+ - Tech stack (detected or specified)
98
+
99
+ Write to `.workflow/project.md`.
100
+
101
+ ### Step 7: Write state.json
102
+
103
+ Initialize state from template:
104
+ - `current_phase`: null
105
+ - `current_milestone`: null
106
+ - `status`: "initialized"
107
+
108
+ Write to `.workflow/state.json`.
109
+
110
+ ### Step 8: Write config.json
111
+
112
+ Configuration questions (or defaults for --auto):
113
+ - Granularity: fine / medium / coarse
114
+ - Workflow agents: enable/disable optional agents
115
+ - Gate preferences: verification strictness
116
+
117
+ Write to `.workflow/config.json`.
118
+
119
+ ### Step 9: Initialize specs/
120
+
121
+ Create convention files in `.workflow/specs/`:
122
+ - `conventions.md` — detected or specified coding conventions
123
+ - `learnings.md` — empty, populated during phase transitions
124
+
125
+ ### Step 10: Completion Report
126
+
127
+ ```
128
+ === WORKFLOW INITIALIZED ===
129
+ Project: {project_name}
130
+ State: .workflow/state.json (active)
131
+
132
+ Created:
133
+ .workflow/project.md
134
+ .workflow/state.json
135
+ .workflow/config.json
136
+ .workflow/specs/
137
+
138
+ Next steps (choose one path to create roadmap):
139
+ $maestro-spec-generate "<idea>" -- Full spec package + roadmap (heavy)
140
+ $maestro-roadmap "<requirement>" -- Direct interactive roadmap (light)
141
+
142
+ Other commands:
143
+ $manage-status -- View project dashboard
144
+ $maestro-brainstorm "<topic>" -- Explore ideas first
145
+ $maestro-quick "<task>" -- Quick ad-hoc task
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Error Handling
151
+
152
+ | Code | Severity | Description | Recovery |
153
+ |------|----------|-------------|----------|
154
+ | E001 | error | No arguments when --auto requires document | Ask user for document reference |
155
+ | E002 | error | .workflow/ already exists | Show status, suggest manage-status |
156
+ | E003 | error | Brainstorm session not found | List available sessions |
157
+ | W001 | warning | Could not detect tech stack | Continue with manual input |
158
+
159
+ ---
160
+
161
+ ## Core Rules
162
+
163
+ 1. **Never create roadmap** — init only creates .workflow/ structure; roadmap is a separate step
164
+ 2. **Deep questioning over speed** — follow threads, ask clarifying questions (unless --auto)
165
+ 3. **Detect, don't assume** — scan for existing files, package managers, frameworks before asking
166
+ 4. **Templates are source of truth** — always read templates before writing files
167
+ 5. **Idempotent check** — if .workflow/ exists, refuse to overwrite (E002)
@@ -1,154 +1,154 @@
1
- ---
2
- name: maestro-phase-add
3
- description: Add or insert a new phase into the project roadmap with automatic renumbering
4
- argument-hint: "\"phase name\" [--after N] [--before N]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- # Maestro Phase Add (Single Agent)
9
-
10
- ## Usage
11
-
12
- ```bash
13
- $maestro-phase-add "authentication"
14
- $maestro-phase-add "caching-layer" --after 2
15
- $maestro-phase-add "security-hardening" --before 5
16
- ```
17
-
18
- **Flags**:
19
- - `"phase name"`: Required. Used as both slug and title (slug = lowercase, hyphens)
20
- - `--after N`: Insert after phase N (renumbers subsequent phases)
21
- - `--before N`: Insert before phase N (renumbers from N onward)
22
- - If neither: append at end
23
-
24
- **Output**: New phase directory, updated roadmap.md, updated state.json
25
-
26
- ---
27
-
28
- ## Overview
29
-
30
- Single mutation operation on the project roadmap. Creates a new phase directory with initialized index.json, inserts the phase entry into roadmap.md at the correct position, and handles automatic renumbering of all affected phase directories and references.
31
-
32
- ---
33
-
34
- ## Implementation
35
-
36
- ### Step 1: Parse Arguments
37
-
38
- Extract:
39
- - Phase name/slug (required — E001 if missing)
40
- - `--after N` or `--before N` flag (mutually exclusive)
41
- - Generate slug: lowercase, replace spaces with hyphens, strip special chars
42
-
43
- ### Step 2: Load Roadmap State
44
-
45
- ```bash
46
- cat .workflow/roadmap.md
47
- cat .workflow/state.json
48
- ls -d .workflow/phases/*/
49
- ```
50
-
51
- - Parse existing phases from roadmap.md
52
- - List existing phase directories
53
- - Check for duplicate slug (E003 if exists)
54
- - Verify roadmap.md exists (E002 if not)
55
-
56
- ### Step 3: Calculate Position
57
-
58
- - If `--after N`: new phase number = N + 1
59
- - If `--before N`: new phase number = N
60
- - If neither: new phase number = max_existing + 1
61
-
62
- ### Step 4: Renumber Existing Phases (if inserting)
63
-
64
- **Only when `--after N` or `--before N` is used.**
65
-
66
- For each phase with number >= new phase number (process in reverse order to avoid collisions):
67
-
68
- 1. Rename directory: `.workflow/phases/{NN}-{slug}` → `.workflow/phases/{NN+1}-{slug}`
69
- 2. Update index.json inside renamed directory: `"phase": N+1`
70
-
71
- ```bash
72
- # Rename in reverse order to prevent collisions
73
- for dir in $(ls -rd .workflow/phases/*/); do
74
- # Extract number, if >= insertion point, rename to number+1
75
- done
76
- ```
77
-
78
- ### Step 5: Create Phase Directory
79
-
80
- ```bash
81
- mkdir -p .workflow/phases/{NN}-{slug}
82
- ```
83
-
84
- Format NN as zero-padded 2-digit number (e.g., 03).
85
-
86
- ### Step 6: Initialize Phase index.json
87
-
88
- Read template from `~/.maestro/templates/index.json` if available, otherwise create:
89
-
90
- ```json
91
- {
92
- "phase": <N>,
93
- "slug": "<slug>",
94
- "title": "<phase name>",
95
- "status": "pending",
96
- "created_at": "<ISO timestamp>",
97
- "tasks": []
98
- }
99
- ```
100
-
101
- Write to `.workflow/phases/{NN}-{slug}/index.json`.
102
-
103
- ### Step 7: Update roadmap.md
104
-
105
- Insert new phase entry at the correct position in roadmap.md:
106
- - Match the existing phase entry format
107
- - If inserting, update all subsequent phase numbers in the document
108
-
109
- ### Step 8: Update state.json
110
-
111
- If renumbering affected `current_phase` or `phases_completed`:
112
- - Adjust `current_phase` number if it was shifted
113
- - Adjust all entries in `phases_completed` that were shifted
114
-
115
- ### Step 9: Completion Report
116
-
117
- ```
118
- === PHASE ADDED ===
119
- Phase: {NN} - {phase name}
120
- Location: .workflow/phases/{NN}-{slug}/
121
-
122
- {if renumbered}
123
- Renumbered: Phases {start}-{end} shifted by +1
124
- {endif}
125
-
126
- Updated:
127
- .workflow/roadmap.md
128
- .workflow/phases/{NN}-{slug}/index.json
129
- {if renumbered}.workflow/state.json{endif}
130
-
131
- Next steps:
132
- $maestro-plan "" -- Plan tasks for the new phase
133
- $maestro-status -- View updated roadmap
134
- ```
135
-
136
- ---
137
-
138
- ## Error Handling
139
-
140
- | Code | Severity | Description | Recovery |
141
- |------|----------|-------------|----------|
142
- | E001 | error | Phase name/slug required | Provide phase name as argument |
143
- | E002 | error | roadmap.md not found | Run maestro-init first |
144
- | E003 | error | Duplicate phase name/slug exists | Choose a different name |
145
-
146
- ---
147
-
148
- ## Core Rules
149
-
150
- 1. **Reverse-order renumbering** — always rename directories from highest to lowest to prevent collisions
151
- 2. **State consistency** — state.json phase references must be adjusted after renumbering
152
- 3. **Match existing format** — new roadmap.md entries must match the style of existing entries
153
- 4. **Zero-padded numbers** — always use 2-digit format (01, 02, ... 99)
154
- 5. **Slug normalization** — lowercase, hyphens only, no special characters
1
+ ---
2
+ name: maestro-phase-add
3
+ description: Add or insert a new phase into the project roadmap with automatic renumbering
4
+ argument-hint: "\"phase name\" [--after N] [--before N]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ # Maestro Phase Add (Single Agent)
9
+
10
+ ## Usage
11
+
12
+ ```bash
13
+ $maestro-phase-add "authentication"
14
+ $maestro-phase-add "caching-layer" --after 2
15
+ $maestro-phase-add "security-hardening" --before 5
16
+ ```
17
+
18
+ **Flags**:
19
+ - `"phase name"`: Required. Used as both slug and title (slug = lowercase, hyphens)
20
+ - `--after N`: Insert after phase N (renumbers subsequent phases)
21
+ - `--before N`: Insert before phase N (renumbers from N onward)
22
+ - If neither: append at end
23
+
24
+ **Output**: New phase directory, updated roadmap.md, updated state.json
25
+
26
+ ---
27
+
28
+ ## Overview
29
+
30
+ Single mutation operation on the project roadmap. Creates a new phase directory with initialized index.json, inserts the phase entry into roadmap.md at the correct position, and handles automatic renumbering of all affected phase directories and references.
31
+
32
+ ---
33
+
34
+ ## Implementation
35
+
36
+ ### Step 1: Parse Arguments
37
+
38
+ Extract:
39
+ - Phase name/slug (required — E001 if missing)
40
+ - `--after N` or `--before N` flag (mutually exclusive)
41
+ - Generate slug: lowercase, replace spaces with hyphens, strip special chars
42
+
43
+ ### Step 2: Load Roadmap State
44
+
45
+ ```bash
46
+ cat .workflow/roadmap.md
47
+ cat .workflow/state.json
48
+ ls -d .workflow/phases/*/
49
+ ```
50
+
51
+ - Parse existing phases from roadmap.md
52
+ - List existing phase directories
53
+ - Check for duplicate slug (E003 if exists)
54
+ - Verify roadmap.md exists (E002 if not)
55
+
56
+ ### Step 3: Calculate Position
57
+
58
+ - If `--after N`: new phase number = N + 1
59
+ - If `--before N`: new phase number = N
60
+ - If neither: new phase number = max_existing + 1
61
+
62
+ ### Step 4: Renumber Existing Phases (if inserting)
63
+
64
+ **Only when `--after N` or `--before N` is used.**
65
+
66
+ For each phase with number >= new phase number (process in reverse order to avoid collisions):
67
+
68
+ 1. Rename directory: `.workflow/phases/{NN}-{slug}` → `.workflow/phases/{NN+1}-{slug}`
69
+ 2. Update index.json inside renamed directory: `"phase": N+1`
70
+
71
+ ```bash
72
+ # Rename in reverse order to prevent collisions
73
+ for dir in $(ls -rd .workflow/phases/*/); do
74
+ # Extract number, if >= insertion point, rename to number+1
75
+ done
76
+ ```
77
+
78
+ ### Step 5: Create Phase Directory
79
+
80
+ ```bash
81
+ mkdir -p .workflow/phases/{NN}-{slug}
82
+ ```
83
+
84
+ Format NN as zero-padded 2-digit number (e.g., 03).
85
+
86
+ ### Step 6: Initialize Phase index.json
87
+
88
+ Read template from `~/.maestro/templates/index.json` if available, otherwise create:
89
+
90
+ ```json
91
+ {
92
+ "phase": <N>,
93
+ "slug": "<slug>",
94
+ "title": "<phase name>",
95
+ "status": "pending",
96
+ "created_at": "<ISO timestamp>",
97
+ "tasks": []
98
+ }
99
+ ```
100
+
101
+ Write to `.workflow/phases/{NN}-{slug}/index.json`.
102
+
103
+ ### Step 7: Update roadmap.md
104
+
105
+ Insert new phase entry at the correct position in roadmap.md:
106
+ - Match the existing phase entry format
107
+ - If inserting, update all subsequent phase numbers in the document
108
+
109
+ ### Step 8: Update state.json
110
+
111
+ If renumbering affected `current_phase` or `phases_completed`:
112
+ - Adjust `current_phase` number if it was shifted
113
+ - Adjust all entries in `phases_completed` that were shifted
114
+
115
+ ### Step 9: Completion Report
116
+
117
+ ```
118
+ === PHASE ADDED ===
119
+ Phase: {NN} - {phase name}
120
+ Location: .workflow/phases/{NN}-{slug}/
121
+
122
+ {if renumbered}
123
+ Renumbered: Phases {start}-{end} shifted by +1
124
+ {endif}
125
+
126
+ Updated:
127
+ .workflow/roadmap.md
128
+ .workflow/phases/{NN}-{slug}/index.json
129
+ {if renumbered}.workflow/state.json{endif}
130
+
131
+ Next steps:
132
+ $maestro-plan "" -- Plan tasks for the new phase
133
+ $manage-status -- View updated roadmap
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Error Handling
139
+
140
+ | Code | Severity | Description | Recovery |
141
+ |------|----------|-------------|----------|
142
+ | E001 | error | Phase name/slug required | Provide phase name as argument |
143
+ | E002 | error | roadmap.md not found | Run maestro-init first |
144
+ | E003 | error | Duplicate phase name/slug exists | Choose a different name |
145
+
146
+ ---
147
+
148
+ ## Core Rules
149
+
150
+ 1. **Reverse-order renumbering** — always rename directories from highest to lowest to prevent collisions
151
+ 2. **State consistency** — state.json phase references must be adjusted after renumbering
152
+ 3. **Match existing format** — new roadmap.md entries must match the style of existing entries
153
+ 4. **Zero-padded numbers** — always use 2-digit format (01, 02, ... 99)
154
+ 5. **Slug normalization** — lowercase, hyphens only, no special characters