maestro-flow 0.3.9 → 0.3.10

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 (125) hide show
  1. package/.claude/commands/maestro-analyze.md +46 -3
  2. package/.claude/commands/maestro-execute.md +14 -0
  3. package/.claude/commands/maestro-plan.md +16 -0
  4. package/.claude/commands/manage-harvest.md +1 -1
  5. package/.claude/commands/manage-issue-discover.md +2 -2
  6. package/.claude/commands/manage-issue.md +3 -3
  7. package/.codex/skills/maestro/SKILL.md +463 -0
  8. package/.codex/skills/maestro-analyze/SKILL.md +28 -7
  9. package/.codex/skills/maestro-chain/SKILL.md +248 -0
  10. package/.codex/skills/maestro-coordinate/SKILL.md +279 -224
  11. package/.codex/skills/maestro-execute/SKILL.md +8 -0
  12. package/.codex/skills/maestro-plan/SKILL.md +9 -1
  13. package/README.md +7 -7
  14. package/README.zh-CN.md +7 -7
  15. package/chains/issue-lifecycle.json +13 -13
  16. package/chains/singles/issue-analyze.json +3 -3
  17. package/chains/singles/issue-execute.json +3 -3
  18. package/chains/singles/issue-plan.json +3 -3
  19. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  20. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  21. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  22. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  23. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  24. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  25. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  26. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  27. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  28. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  29. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  30. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  31. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  32. package/dashboard/dist-server/src/hooks/constants.d.ts +90 -12
  33. package/dashboard/dist-server/src/hooks/constants.js +149 -16
  34. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  35. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  36. package/dist/src/commands/collab.d.ts +1 -34
  37. package/dist/src/commands/collab.d.ts.map +1 -1
  38. package/dist/src/commands/collab.js +4 -72
  39. package/dist/src/commands/collab.js.map +1 -1
  40. package/dist/src/commands/hooks.d.ts +5 -1
  41. package/dist/src/commands/hooks.d.ts.map +1 -1
  42. package/dist/src/commands/hooks.js +50 -10
  43. package/dist/src/commands/hooks.js.map +1 -1
  44. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  45. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  46. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  47. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  48. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  49. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  50. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  51. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  52. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  53. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  54. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  55. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  56. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  57. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  58. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  59. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  60. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  61. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  62. package/dist/src/hooks/constants.d.ts +90 -12
  63. package/dist/src/hooks/constants.d.ts.map +1 -1
  64. package/dist/src/hooks/constants.js +149 -16
  65. package/dist/src/hooks/constants.js.map +1 -1
  66. package/dist/src/hooks/guards/index.d.ts +1 -0
  67. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  68. package/dist/src/hooks/guards/index.js +1 -0
  69. package/dist/src/hooks/guards/index.js.map +1 -1
  70. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  71. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  72. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  73. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  74. package/dist/src/hooks/index.d.ts +1 -0
  75. package/dist/src/hooks/index.d.ts.map +1 -1
  76. package/dist/src/hooks/index.js +1 -0
  77. package/dist/src/hooks/index.js.map +1 -1
  78. package/dist/src/hooks/preflight-core.d.ts +37 -0
  79. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  80. package/dist/src/hooks/preflight-core.js +86 -0
  81. package/dist/src/hooks/preflight-core.js.map +1 -0
  82. package/dist/src/hooks/statusline.d.ts +8 -17
  83. package/dist/src/hooks/statusline.d.ts.map +1 -1
  84. package/dist/src/hooks/statusline.js +269 -112
  85. package/dist/src/hooks/statusline.js.map +1 -1
  86. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  87. package/dist/src/i18n/locales/en.js +5 -0
  88. package/dist/src/i18n/locales/en.js.map +1 -1
  89. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  90. package/dist/src/i18n/locales/zh.js +5 -0
  91. package/dist/src/i18n/locales/zh.js.map +1 -1
  92. package/dist/src/i18n/types.d.ts +5 -0
  93. package/dist/src/i18n/types.d.ts.map +1 -1
  94. package/dist/src/tools/collab-adapter.d.ts +17 -0
  95. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  96. package/dist/src/tools/collab-adapter.js +138 -0
  97. package/dist/src/tools/collab-adapter.js.map +1 -1
  98. package/dist/src/tools/merge-validator.d.ts +24 -0
  99. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  100. package/dist/src/tools/merge-validator.js +220 -0
  101. package/dist/src/tools/merge-validator.js.map +1 -0
  102. package/dist/src/types/index.d.ts +5 -0
  103. package/dist/src/types/index.d.ts.map +1 -1
  104. package/package.json +1 -1
  105. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  106. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  107. package/templates/search-tools.md +1 -1
  108. package/workflows/cli-tools-usage.md +44 -27
  109. package/workflows/delegate-usage.md +3 -3
  110. package/workflows/issue-analyze.md +6 -2
  111. package/workflows/issue-discover.md +4 -4
  112. package/workflows/issue-execute.md +6 -3
  113. package/workflows/issue-plan.md +5 -2
  114. package/workflows/maestro-coordinate.codex.md +281 -470
  115. package/workflows/maestro-coordinate.md +14 -14
  116. package/workflows/maestro-link-coordinate.md +2 -2
  117. package/workflows/maestro.codex.md +710 -0
  118. package/workflows/maestro.md +10 -11
  119. package/workflows/retrospective.md +1 -1
  120. package/.claude/commands/manage-issue-analyze.md +0 -62
  121. package/.claude/commands/manage-issue-execute.md +0 -73
  122. package/.claude/commands/manage-issue-plan.md +0 -62
  123. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  124. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  125. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -531,9 +531,9 @@ const chainMap = {
531
531
  'memory_capture': [{ cmd: 'manage-memory-capture', args: '"{description}"' }],
532
532
  'issue': [{ cmd: 'manage-issue', args: '"{description}"' }],
533
533
  'issue_discover': [{ cmd: 'manage-issue-discover', args: '"{description}"' }],
534
- 'issue_analyze': [{ cmd: 'manage-issue-analyze', args: '"{description}"' }],
535
- 'issue_plan': [{ cmd: 'manage-issue-plan', args: '"{description}"' }],
536
- 'issue_execute': [{ cmd: 'manage-issue-execute', args: '"{description}"' }],
534
+ 'issue_analyze': [{ cmd: 'maestro-analyze', args: '--gaps "{description}"' }],
535
+ 'issue_plan': [{ cmd: 'maestro-plan', args: '--gaps' }],
536
+ 'issue_execute': [{ cmd: 'maestro-execute', args: '' }],
537
537
  'memory': [{ cmd: 'manage-memory', args: '"{description}"' }],
538
538
  'quick': [{ cmd: 'maestro-quick', args: '"{description}"' }],
539
539
  'fork': [{ cmd: 'maestro-fork', args: '-m {milestone_num}' }],
@@ -614,15 +614,15 @@ const chainMap = {
614
614
  ],
615
615
  // Issue lifecycle chains (with quality gates)
616
616
  'issue-full': [
617
- { cmd: 'manage-issue-analyze', args: '{issue_id}' },
618
- { cmd: 'manage-issue-plan', args: '{issue_id}' },
619
- { cmd: 'manage-issue-execute', args: '{issue_id}' },
617
+ { cmd: 'maestro-analyze', args: '--gaps {issue_id}' },
618
+ { cmd: 'maestro-plan', args: '--gaps' },
619
+ { cmd: 'maestro-execute', args: '' },
620
620
  { cmd: 'quality-review', args: '--scope {affected_files}' },
621
621
  { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
622
622
  ],
623
623
  'issue-quick': [
624
- { cmd: 'manage-issue-plan', args: '{issue_id}' },
625
- { cmd: 'manage-issue-execute', args: '{issue_id}' },
624
+ { cmd: 'maestro-plan', args: '--gaps' },
625
+ { cmd: 'maestro-execute', args: '' },
626
626
  { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
627
627
  ]
628
628
  };
@@ -669,7 +669,6 @@ function resolvePhase(intent_analysis, project_state) {
669
669
 
670
670
  // 5. Chain doesn't need phase (init, status, memory, issue, etc.)
671
671
  const noPhaseCommands = ['manage-status', 'manage-issue', 'manage-issue-discover',
672
- 'manage-issue-analyze', 'manage-issue-plan', 'manage-issue-execute',
673
672
  'maestro-init', 'maestro-spec-generate', 'maestro-fork', 'maestro-merge',
674
673
  'maestro-roadmap', 'spec-setup', 'manage-memory', 'manage-memory-capture', 'manage-learn',
675
674
  'manage-codebase-rebuild', 'manage-codebase-refresh', 'maestro-milestone-audit',
@@ -939,8 +938,8 @@ Shows how structured extraction routes common inputs — especially cases where
939
938
  | `"这个问题需要看看"` | `{analyze, bug}` | analyze | maestro-analyze |
940
939
  | `"创建一个 issue 跟踪"` | `{manage, issue}` | issue | manage-issue |
941
940
  | `"discover issues"` | `{explore, issue}` | issue_discover | manage-issue-discover |
942
- | `"analyze issue ISS-xxx"` | `{analyze, issue, ISS-xxx}` | issue_analyze | manage-issue-analyze |
943
- | `"plan issue ISS-xxx"` | `{plan, issue, ISS-xxx}` | issue_plan | manage-issue-plan |
941
+ | `"analyze issue ISS-xxx"` | `{analyze, issue, ISS-xxx}` | issue_analyze | maestro-analyze --gaps |
942
+ | `"plan issue ISS-xxx"` | `{plan, issue, ISS-xxx}` | issue_plan | maestro-plan --gaps |
944
943
  | `"brainstorm notification system"` | `{explore, feature}` | brainstorm | brainstorm-driven |
945
944
  | `"spec generate user auth"` | `{create, spec}` | spec_generate | spec-driven |
946
945
  | `"ui design landing page"` | `{create, ui}` | ui_design | ui-design-driven |
@@ -11,7 +11,7 @@ This is a **post-execution analysis** workflow. It reads only — until the rout
11
11
  - `.workflow/` initialized (`.workflow/state.json` exists)
12
12
  - At least one phase directory under `.workflow/phases/{NN}-{slug}/`
13
13
  - Target phase has been executed (has `.task/` and `.summaries/`)
14
- - `maestro cli` available (used for the four lens analyses via Agent calls)
14
+ - `maestro delegate` available (used for the four lens analyses via Agent calls)
15
15
 
16
16
  ---
17
17
 
@@ -1,62 +0,0 @@
1
- ---
2
- name: manage-issue-analyze
3
- description: Root cause analysis for a specific issue using CLI exploration
4
- argument-hint: "<ISS-ID> [--tool gemini|qwen] [--depth standard|deep]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Bash
9
- - Glob
10
- - Grep
11
- - Agent
12
- - AskUserQuestion
13
- ---
14
- <purpose>
15
- Root cause analysis for a specific issue. Uses CLI exploration to analyze codebase context, identify root cause, assess impact, and produce a structured analysis record attached to the issue in `.workflow/issues/issues.jsonl`.
16
-
17
- - **--tool**: CLI tool for analysis (default: gemini)
18
- - **--depth**: `standard` (keyword grep) or `deep` (semantic search via Agent)
19
-
20
- For issue CRUD, use `/manage-issue`. For solution planning, use `/manage-issue-plan`.
21
- </purpose>
22
-
23
- <required_reading>
24
- @~/.maestro/workflows/issue-analyze.md
25
- </required_reading>
26
-
27
- <deferred_reading>
28
- - [issue.json template](~/.maestro/templates/issue.json) -- read when building the analysis record structure
29
- </deferred_reading>
30
-
31
- <context>
32
- $ARGUMENTS -- ISS-ID (required) + optional flags.
33
-
34
- **Options:**
35
- - `<ISS-ID>` -- issue ID in ISS-XXXXXXXX-NNN format (required)
36
- - `--tool gemini|qwen` -- CLI tool for analysis (default: gemini)
37
- - `--depth standard|deep` -- analysis depth (default: standard)
38
-
39
- **State files:**
40
- - `.workflow/issues/issues.jsonl` -- issue records (read + write)
41
- </context>
42
-
43
- <execution>
44
- Follow '~/.maestro/workflows/issue-analyze.md' completely.
45
- </execution>
46
-
47
- <error_codes>
48
- | Code | Severity | Condition | Recovery |
49
- |------|----------|-----------|----------|
50
- | E_NO_ISSUE_ID | error | No ISS-ID provided in $ARGUMENTS | Display usage hint with example |
51
- | E_ISSUE_NOT_FOUND | error | ISS-ID not found in issues.jsonl | Suggest `/manage-issue list` to find valid IDs |
52
- | E_INVALID_STATUS | warning | Issue status is not 'open' or 'registered' | Warn but allow analysis to proceed |
53
- | E_ANALYSIS_FAILED | error | CLI analysis returned no usable results | Retry with different --tool or report partial context |
54
- </error_codes>
55
-
56
- <success_criteria>
57
- - [ ] Issue loaded and validated from issues.jsonl
58
- - [ ] Codebase context gathered (grep or semantic search)
59
- - [ ] CLI analysis executed and JSON result parsed
60
- - [ ] Analysis record attached to issue in issues.jsonl
61
- - [ ] Summary displayed with next-step routing to manage-issue-plan
62
- </success_criteria>
@@ -1,73 +0,0 @@
1
- ---
2
- name: manage-issue-execute
3
- description: Execute planned solution for an issue via dual-mode agent dispatch
4
- argument-hint: "<ISS-ID> [--executor claude-code|codex|gemini] [--dry-run]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Bash
9
- - Glob
10
- - Grep
11
- - Agent
12
- - AskUserQuestion
13
- ---
14
- <purpose>
15
- Execute a planned solution for a specific issue. Supports dual-mode dispatch:
16
-
17
- - **Server UP**: POST to `/api/execution/dispatch` for orchestrated execution
18
- - **Server DOWN**: Direct execution via `maestro delegate` with the solution prompt
19
-
20
- Options:
21
- - **--executor**: Agent to execute the solution (default: claude-code)
22
- - **--dry-run**: Display the constructed prompt and steps without executing
23
-
24
- For issue CRUD, use `/manage-issue`. For analysis, use `/manage-issue-analyze`. For planning, use `/manage-issue-plan`.
25
- </purpose>
26
-
27
- <required_reading>
28
- @~/.maestro/workflows/issue-execute.md
29
- </required_reading>
30
-
31
- <deferred_reading>
32
- - [issue.json template](~/.maestro/templates/issue.json) -- read when updating issue status after execution
33
- </deferred_reading>
34
-
35
- <context>
36
- $ARGUMENTS -- ISS-ID (required) + optional flags.
37
-
38
- **Options:**
39
- - `<ISS-ID>` -- issue ID in ISS-XXXXXXXX-NNN format (required)
40
- - `--executor claude-code|codex|gemini` -- execution agent (default: claude-code)
41
- - `--dry-run` -- preview prompt and steps without executing
42
-
43
- **State files:**
44
- - `.workflow/issues/issues.jsonl` -- issue records (read + write)
45
- </context>
46
-
47
- <execution>
48
- Follow '~/.maestro/workflows/issue-execute.md' completely.
49
-
50
- **Next-step routing on completion:**
51
- - Execution succeeded → `/manage-issue close <ISS-ID> --resolution fixed`
52
- - Execution failed → `/quality-debug <failure description>` then retry
53
- - Want verification → `/maestro-verify {phase}`
54
- </execution>
55
-
56
- <error_codes>
57
- | Code | Severity | Condition | Recovery |
58
- |------|----------|-----------|----------|
59
- | E_NO_ISSUE_ID | error | No ISS-ID provided in $ARGUMENTS | Display usage hint with example |
60
- | E_NO_SOLUTION | error | Issue has no solution record (issue.solution is null) | Suggest `/manage-issue-plan` first |
61
- | E_DISPATCH_FAILED | error | Server dispatch or CLI execution failed | Log error, revert status to open, display failure details |
62
- </error_codes>
63
-
64
- <success_criteria>
65
- - [ ] Issue loaded with valid solution record
66
- - [ ] Execution mode detected (server UP or DOWN)
67
- - [ ] Solution executed (or dry-run displayed)
68
- - [ ] Issue status updated in issues.jsonl (in_progress -> resolved or open on failure)
69
- - [ ] Result summary displayed with next-step routing:
70
- - Execution succeeded → `/manage-issue close <ISS-ID> --resolution fixed`
71
- - Execution failed → `/quality-debug <failure description>` then retry
72
- - Want verification → `/maestro-verify {phase}`
73
- </success_criteria>
@@ -1,62 +0,0 @@
1
- ---
2
- name: manage-issue-plan
3
- description: Solution planning for a specific issue with codebase-aware step generation
4
- argument-hint: "<ISS-ID> [--tool gemini|qwen] [--from-analysis]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Bash
9
- - Glob
10
- - Grep
11
- - Agent
12
- - AskUserQuestion
13
- ---
14
- <purpose>
15
- Solution planning for a specific issue. Generates a structured, codebase-aware solution with ordered steps, context, and a prompt template for execution. Attaches the solution record to the issue in `.workflow/issues/issues.jsonl`.
16
-
17
- - **--tool**: CLI tool for planning (default: gemini)
18
- - **--from-analysis**: Auto-detected; includes analysis context (root_cause, related_files) in the planning prompt if issue.analysis exists
19
-
20
- For issue CRUD, use `/manage-issue`. For execution, use `/manage-issue-execute`.
21
- </purpose>
22
-
23
- <required_reading>
24
- @~/.maestro/workflows/issue-plan.md
25
- </required_reading>
26
-
27
- <deferred_reading>
28
- - [issue.json template](~/.maestro/templates/issue.json) -- read when building the solution record structure
29
- </deferred_reading>
30
-
31
- <context>
32
- $ARGUMENTS -- ISS-ID (required) + optional flags.
33
-
34
- **Options:**
35
- - `<ISS-ID>` -- issue ID in ISS-XXXXXXXX-NNN format (required)
36
- - `--tool gemini|qwen` -- CLI tool for planning (default: gemini)
37
- - `--from-analysis` -- explicitly include analysis context (auto-detected if issue.analysis exists)
38
-
39
- **State files:**
40
- - `.workflow/issues/issues.jsonl` -- issue records (read + write)
41
- </context>
42
-
43
- <execution>
44
- Follow '~/.maestro/workflows/issue-plan.md' completely.
45
- </execution>
46
-
47
- <error_codes>
48
- | Code | Severity | Condition | Recovery |
49
- |------|----------|-----------|----------|
50
- | E_NO_ISSUE_ID | error | No ISS-ID provided in $ARGUMENTS | Display usage hint with example |
51
- | E_ISSUE_NOT_FOUND | error | ISS-ID not found in issues.jsonl | Suggest `/manage-issue list` to find valid IDs |
52
- | E_NO_ANALYSIS | warning | No analysis record on issue and --from-analysis specified | Proceed without analysis context, suggest `/manage-issue-analyze` first |
53
- | E_PLANNING_FAILED | error | CLI planning returned no usable results | Retry with different --tool or report partial output |
54
- </error_codes>
55
-
56
- <success_criteria>
57
- - [ ] Issue loaded and validated from issues.jsonl
58
- - [ ] Analysis context included in prompt (if available)
59
- - [ ] CLI planning executed and solution JSON parsed
60
- - [ ] Solution record attached to issue in issues.jsonl
61
- - [ ] Solution steps displayed with next-step routing to manage-issue-execute
62
- </success_criteria>
@@ -1,207 +0,0 @@
1
- ---
2
- name: manage-issue-analyze
3
- description: Root cause analysis for a specific issue via CLI exploration. Gathers codebase context (grep or semantic deep search), runs maestro delegate gemini analysis, and attaches a structured analysis record to the issue in issues.jsonl.
4
- argument-hint: "<ISS-ID> [--tool gemini|qwen] [--depth standard|deep]"
5
- allowed-tools: Read, Write, Bash, Glob, Grep
6
- ---
7
-
8
- # Issue Analyze
9
-
10
- ## Usage
11
-
12
- ```bash
13
- $manage-issue-analyze "ISS-20260401-001"
14
- $manage-issue-analyze "ISS-20260401-001 --depth deep"
15
- $manage-issue-analyze "ISS-20260401-001 --tool qwen --depth standard"
16
- ```
17
-
18
- **Flags**:
19
- - `<ISS-ID>` — Issue ID in `ISS-XXXXXXXX-NNN` format (required)
20
- - `--tool gemini|qwen` — CLI tool for analysis (default: gemini)
21
- - `--depth standard|deep` — `standard` uses keyword grep; `deep` spawns a semantic explore agent (default: standard)
22
-
23
- **State files**: `.workflow/issues/issues.jsonl` (read + write)
24
-
25
- ---
26
-
27
- ## Overview
28
-
29
- Sequential 4-step pipeline: load issue → gather codebase context → run CLI analysis → attach analysis record. The CLI analysis step invokes `maestro delegate --to gemini --mode analysis` to produce a structured root-cause record written back into issues.jsonl. This is the first step in the issue resolution workflow: **analyze → plan → execute**.
30
-
31
- ```
32
- Load Issue → Gather Context → CLI Analysis → Attach Record
33
- (validate) (grep / agent) (gemini/qwen) (apply_patch)
34
- ```
35
-
36
- ---
37
-
38
- ## Implementation
39
-
40
- ### Step 1: Load and Validate Issue
41
-
42
- ```javascript
43
- functions.update_plan({
44
- explanation: "Starting issue analysis",
45
- plan: [
46
- { step: "Load and validate issue", status: "in_progress" },
47
- { step: "Gather codebase context", status: "pending" },
48
- { step: "Run CLI analysis", status: "pending" },
49
- { step: "Attach analysis record", status: "pending" }
50
- ]
51
- })
52
- ```
53
-
54
- Read `.workflow/issues/issues.jsonl` line by line. Find the row where `id == <ISS-ID>`. Validate:
55
- - ISS-ID matches format `ISS-[0-9]{8}-[0-9]{3}`
56
- - Row found in file
57
- - Parse fields: `id`, `title`, `description`, `status`, `context`, `related_files`
58
-
59
- If `status` is not `open` or `registered`, emit W001 but continue.
60
-
61
- ### Step 2: Gather Codebase Context
62
-
63
- **Standard depth** (default):
64
- - Grep key terms from `issue.title` + `issue.description` across `src/**` (-C 3)
65
- - If `issue.related_files` is set, read those files directly
66
- - Collect file:line references into `contextSummary`
67
-
68
- **Deep depth**:
69
- ```javascript
70
- spawn_agent({
71
- task_name: "ctx-explore",
72
- fork_turns: "none",
73
- message: `## TASK ASSIGNMENT
74
-
75
- ### MANDATORY FIRST STEPS
76
- 1. Read: ~/.codex/agents/cli-explore-agent.md
77
-
78
- ---
79
-
80
- Goal: Gather codebase context for issue root-cause analysis.
81
- Issue: <issue.title>
82
- Description: <issue.description>
83
-
84
- TASK: Find all code paths, functions, and modules related to this issue.
85
- Identify: affected locations (file:line), caller/callee chains, data flow, existing error handling.
86
-
87
- EXPECTED: JSON with: affected_files [{file, line, snippet, relevance}], related_modules, error_handling_gaps, test_coverage_gaps.
88
- `
89
- })
90
- const ctxResult = wait_agent({ timeout_ms: 1800000 }) // initial spawn: 30 min
91
- close_agent({ target: "ctx-explore" })
92
- ```
93
-
94
- ```javascript
95
- functions.update_plan({
96
- explanation: "Context gathered",
97
- plan: [
98
- { step: "Load and validate issue", status: "completed" },
99
- { step: "Gather codebase context", status: "completed" },
100
- { step: "Run CLI analysis", status: "in_progress" },
101
- { step: "Attach analysis record", status: "pending" }
102
- ]
103
- })
104
- ```
105
-
106
- ### Step 3: Run CLI Analysis
107
-
108
- > **Prompt safety**: `issue.title` and `contextSummary` may contain quotes or shell-special characters. Write the full prompt to a temp file first and reference it via `$(cat ...)` to avoid shell injection.
109
-
110
- ```javascript
111
- // Build prompt, write to temp file to avoid shell injection
112
- const promptContent = `PURPOSE: Root cause analysis for issue; identify exact cause, impact scope, fix direction; success = actionable record with file:line evidence.
113
- Issue: ${issue.id} — ${issue.title}
114
- TASK: Trace failure path | Map affected components | Assess blast radius | Define fix direction
115
- MODE: analysis
116
- CONTEXT: @src/**/* | Memory: ${contextSummary}
117
- EXPECTED: JSON: root_cause (string), affected_files (string[]), impact_scope (low|medium|high|critical), fix_direction (string), confidence (low|medium|high)
118
- CONSTRAINTS: Evidence required — file:line for each claim`
119
-
120
- Write(`/tmp/iss-analyze-${issue.id}.txt`, promptContent)
121
- functions.exec_command({
122
- cmd: `maestro delegate "$(cat /tmp/iss-analyze-${issue.id}.txt)" --to ${tool} --mode analysis`,
123
- workdir: "."
124
- })
125
- ```
126
-
127
- Parse CLI output into `analysis` object:
128
- ```json
129
- {
130
- "root_cause": "...",
131
- "affected_files": ["src/foo.ts:42"],
132
- "impact_scope": "medium",
133
- "fix_direction": "...",
134
- "analyzed_at": "<ISO>",
135
- "tool": "<tool>",
136
- "depth": "<depth>",
137
- "confidence": "medium"
138
- }
139
- ```
140
-
141
- ### Step 4: Attach Analysis Record and Report
142
-
143
- ```javascript
144
- // Read issues.jsonl, update the matching line in-place
145
- const historyEntry = { action: "analyzed", at: new Date().toISOString(), by: "manage-issue-analyze", summary: `Root cause: ${analysis.root_cause}` }
146
- const raw = Read('.workflow/issues/issues.jsonl')
147
- const updated = raw.split('\n')
148
- .filter(l => l.trim())
149
- .map(l => {
150
- const row = JSON.parse(l)
151
- if (row.id !== issueId) return l
152
- row.analysis = analysis
153
- row.issue_history = [...(row.issue_history || []), historyEntry]
154
- return JSON.stringify(row)
155
- })
156
- .join('\n') + '\n'
157
- Write('.workflow/issues/issues.jsonl', updated)
158
- ```
159
-
160
- ```javascript
161
- functions.update_plan({
162
- explanation: "Analysis complete",
163
- plan: [
164
- { step: "Load and validate issue", status: "completed" },
165
- { step: "Gather codebase context", status: "completed" },
166
- { step: "Run CLI analysis", status: "completed" },
167
- { step: "Attach analysis record", status: "completed" }
168
- ]
169
- })
170
- ```
171
-
172
- Display:
173
- ```
174
- === ANALYSIS COMPLETE ===
175
- Issue: <ISS-ID>: <title>
176
- Root Cause: <root_cause>
177
- Impact: <impact_scope>
178
- Confidence: <confidence>
179
- Affected: <N> files
180
-
181
- Next: $manage-issue-plan "<ISS-ID>"
182
- ```
183
-
184
- ---
185
-
186
- ## Error Handling
187
-
188
- | Code | Severity | Condition | Recovery |
189
- |------|----------|-----------|----------|
190
- | E001 | error | No ISS-ID provided | Display usage hint with format example |
191
- | E002 | error | ISS-ID format invalid | Show correct format `ISS-XXXXXXXX-NNN` |
192
- | E003 | error | ISS-ID not found in issues.jsonl | Suggest `$manage-issue "list"` |
193
- | E004 | error | CLI analysis returned no parseable result | Retry with different `--tool`; report partial |
194
- | W001 | warning | Issue status is not open/registered | Warn, allow analysis to continue |
195
-
196
- ---
197
-
198
- ## Core Rules
199
-
200
- 1. **Start immediately**: First action is `update_plan` then issue load — no preamble
201
- 2. **Validate before analysis**: Never run CLI without a valid loaded issue
202
- 3. **Evidence required**: Analysis record must cite file:line — no speculative root causes
203
- 4. **Deep agent lifecycle**: If deep spawned an agent, always `close_agent` before Step 3
204
- 5. **Append-only history**: Append to `issue_history`, never overwrite existing entries
205
- - *Note*: `spawn_agent` / `wait_agent` / `close_agent` are Codex v4 built-in orchestration functions — they do not need to be listed in `allowed-tools`
206
- 6. **Preserve existing fields**: Patch only `analysis` + `issue_history` — all other fields unchanged
207
- 7. **Next-step routing**: Always display `$manage-issue-plan "<ISS-ID>"` at the end
@@ -1,200 +0,0 @@
1
- ---
2
- name: manage-issue-execute
3
- description: Execute a planned solution for an issue via dual-mode dispatch. Auto-detects server UP (POST to /api/execution/dispatch) or DOWN (direct maestro delegate). Updates issue status on completion with next-step routing to close, debug, or verify.
4
- argument-hint: "<ISS-ID> [--executor claude-code|codex|gemini] [--dry-run]"
5
- allowed-tools: Read, Write, Bash, Glob, Grep
6
- ---
7
-
8
- # Issue Execute
9
-
10
- ## Usage
11
-
12
- ```bash
13
- $manage-issue-execute "ISS-20260401-001"
14
- $manage-issue-execute "ISS-20260401-001 --dry-run"
15
- $manage-issue-execute "ISS-20260401-001 --executor codex"
16
- $manage-issue-execute "ISS-20260401-001 --executor gemini"
17
- ```
18
-
19
- **Flags**:
20
- - `<ISS-ID>` — Issue ID in `ISS-XXXXXXXX-NNN` format (required)
21
- - `--executor claude-code|codex|gemini` — Execution agent (default: claude-code)
22
- - `--dry-run` — Preview constructed prompt and steps without executing
23
-
24
- **State files**: `.workflow/issues/issues.jsonl` (read + write)
25
-
26
- ---
27
-
28
- ## Overview
29
-
30
- Sequential 4-step pipeline with conditional dispatch: load issue → dry-run check → detect mode → execute + update. Server-UP path posts to the orchestration API; Server-DOWN path invokes `maestro delegate` directly. This is the third step in the issue resolution workflow: **analyze → plan → execute**.
31
-
32
- ```
33
- Load Issue → [dry-run?] → Detect Mode → Dispatch → Update Status
34
- (+ solution (display server UP POST (apply_patch)
35
- required) + stop) / DOWN / cli
36
- ```
37
-
38
- ---
39
-
40
- ## Implementation
41
-
42
- ### Step 1: Load Issue and Validate Solution
43
-
44
- ```javascript
45
- functions.update_plan({
46
- explanation: "Starting issue execution",
47
- plan: [
48
- { step: "Load issue and validate solution", status: "in_progress" },
49
- { step: "Detect dispatch mode", status: "pending" },
50
- { step: "Execute solution", status: "pending" },
51
- { step: "Update issue status", status: "pending" }
52
- ]
53
- })
54
- ```
55
-
56
- Read `.workflow/issues/issues.jsonl`, find row where `id == <ISS-ID>`. Validate:
57
- - ISS-ID format `ISS-[0-9]{8}-[0-9]{3}`
58
- - Row exists in file
59
- - `issue.solution` is non-null (E002 if missing — run `manage-issue-plan` first)
60
-
61
- If `--dry-run`: display the full constructed prompt and each step from `issue.solution.steps`, then stop.
62
-
63
- ### Step 2: Detect Dispatch Mode
64
-
65
- ```javascript
66
- // Read port from config (falls back to MAESTRO_PORT env var, then 3000)
67
- const configPort = (() => {
68
- try { return JSON.parse(Read('.workflow/config.json'))?.server?.port } catch { return null }
69
- })()
70
- const port = configPort || functions.exec_command({ cmd: "echo ${MAESTRO_PORT:-3000}", workdir: "." }).stdout.trim()
71
-
72
- const healthCheck = functions.exec_command({
73
- cmd: `curl -s -o /dev/null -w '%{http_code}' http://localhost:${port}/health`,
74
- workdir: "."
75
- })
76
- const serverUp = healthCheck.stdout.trim() === "200"
77
- ```
78
-
79
- | Mode | Condition | Action |
80
- |------|-----------|--------|
81
- | Server UP | HTTP 200 from /health | POST to `/api/execution/dispatch` |
82
- | Server DOWN | Any other result | Direct `maestro delegate` execution |
83
-
84
- ```javascript
85
- functions.update_plan({
86
- explanation: `Dispatch mode: ${serverUp ? "server" : "cli"}`,
87
- plan: [
88
- { step: "Load issue and validate solution", status: "completed" },
89
- { step: "Detect dispatch mode", status: "completed" },
90
- { step: "Execute solution", status: "in_progress" },
91
- { step: "Update issue status", status: "pending" }
92
- ]
93
- })
94
- ```
95
-
96
- ### Step 3: Execute Solution
97
-
98
- Build the execution prompt from `issue.solution`:
99
- ```
100
- PURPOSE: Implement solution for '${issue.title}'.
101
- TASK: ${solution.steps.map(s => `${s.order}. ${s.description} in ${s.file}`).join(' | ')}
102
- MODE: write
103
- CONTEXT: @src/**/* | Memory: Approach: ${solution.approach}
104
- ${issue.analysis ? `Root cause: ${issue.analysis.root_cause}` : ''}
105
- EXPECTED: All steps implemented, all verification criteria met: ${solution.verification.join('; ')}
106
- CONSTRAINTS: Only modify files listed in steps | No scope creep
107
- ```
108
-
109
- **Server UP**:
110
- ```javascript
111
- // Write payload to temp file to avoid shell injection from prompt content
112
- const payload = JSON.stringify({ issue_id: issue.id, executor, prompt: execPrompt })
113
- Write(`/tmp/iss-exec-${issue.id}.json`, payload)
114
- functions.exec_command({
115
- cmd: `curl -X POST http://localhost:${port}/api/execution/dispatch \
116
- -H 'Content-Type: application/json' \
117
- -d @/tmp/iss-exec-${issue.id}.json`,
118
- workdir: "."
119
- })
120
- ```
121
-
122
- **Server DOWN**:
123
- ```javascript
124
- // Write prompt to temp file to avoid shell injection
125
- Write(`/tmp/iss-exec-${issue.id}.txt`, execPrompt)
126
- functions.exec_command({
127
- cmd: `maestro delegate "$(cat /tmp/iss-exec-${issue.id}.txt)" --to ${executor === 'codex' ? 'codex' : 'claude'} --mode write`,
128
- workdir: "."
129
- })
130
- ```
131
-
132
- Set issue status to `in_progress` before dispatching via apply_patch.
133
-
134
- ### Step 4: Update Issue Status and Report
135
-
136
- On success:
137
- ```javascript
138
- // Read issues.jsonl, update the matching line in-place
139
- const historyEntry = { action: "executed", at: new Date().toISOString(), by: "manage-issue-execute", executor, summary: `Solution executed via ${serverUp ? "server" : "cli"}` }
140
- const raw = Read('.workflow/issues/issues.jsonl')
141
- const updated = raw.split('\n')
142
- .filter(l => l.trim())
143
- .map(l => {
144
- const row = JSON.parse(l)
145
- if (row.id !== issueId) return l
146
- row.status = "resolved"
147
- row.issue_history = [...(row.issue_history || []), historyEntry]
148
- return JSON.stringify(row)
149
- })
150
- .join('\n') + '\n'
151
- Write('.workflow/issues/issues.jsonl', updated)
152
- ```
153
-
154
- ```javascript
155
- functions.update_plan({
156
- explanation: "Execution complete",
157
- plan: [
158
- { step: "Load issue and validate solution", status: "completed" },
159
- { step: "Detect dispatch mode", status: "completed" },
160
- { step: "Execute solution", status: "completed" },
161
- { step: "Update issue status", status: "completed" }
162
- ]
163
- })
164
- ```
165
-
166
- Display next-step routing:
167
- ```
168
- === EXECUTION COMPLETE ===
169
- Issue: <ISS-ID>: <title>
170
- Executor: <executor>
171
- Mode: <server|cli>
172
- Status: resolved
173
-
174
- Next steps:
175
- Close: $manage-issue "close <ISS-ID> --resolution fixed"
176
- Verify: $maestro-verify "<phase>"
177
- Debug: $quality-debug "<failure description>" (if issues found)
178
- ```
179
-
180
- ---
181
-
182
- ## Error Handling
183
-
184
- | Code | Severity | Condition | Recovery |
185
- |------|----------|-----------|----------|
186
- | E001 | error | No ISS-ID provided | Display usage hint |
187
- | E002 | error | No solution record on issue | Run `$manage-issue-plan "<ISS-ID>"` first |
188
- | E003 | error | ISS-ID not found in issues.jsonl | Suggest `$manage-issue "list"` |
189
- | E004 | error | Server dispatch or CLI execution failed | Log error, revert status to `open`, display failure details |
190
-
191
- ---
192
-
193
- ## Core Rules
194
-
195
- 1. **Solution required**: Never dispatch without a valid `issue.solution` record
196
- 2. **Dry-run first**: `--dry-run` always stops after displaying prompt — no execution
197
- 3. **Status before dispatch**: Set status to `in_progress` before dispatching, `resolved` on success, `open` on failure
198
- 4. **Revert on failure**: If dispatch fails, revert issue status to `open` via apply_patch
199
- 5. **Preserve history**: Append to `issue_history`, never overwrite existing entries
200
- 6. **Next-step routing**: Always display all three options (close / verify / debug) at the end