maestro-flow 0.4.23 → 0.4.25

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 (120) hide show
  1. package/.agents/skills/maestro-impeccable/SKILL.md +5 -1
  2. package/.agents/skills/maestro-next/SKILL.md +7 -1
  3. package/.agents/skills/maestro-player/SKILL.md +9 -2
  4. package/.agents/skills/maestro-tools-execute/SKILL.md +4 -4
  5. package/.agents/skills/manage-codebase-rebuild/SKILL.md +4 -6
  6. package/.agents/skills/spec-load/SKILL.md +11 -4
  7. package/.agy/skills/maestro-impeccable/SKILL.md +5 -1
  8. package/.agy/skills/maestro-next/SKILL.md +7 -1
  9. package/.agy/skills/maestro-player/SKILL.md +9 -2
  10. package/.agy/skills/maestro-tools-execute/SKILL.md +4 -4
  11. package/.agy/skills/manage-codebase-rebuild/SKILL.md +4 -6
  12. package/.agy/skills/spec-load/SKILL.md +11 -4
  13. package/.claude/commands/maestro-impeccable.md +5 -1
  14. package/.claude/commands/maestro-next.md +7 -1
  15. package/.claude/commands/maestro-player.md +9 -2
  16. package/.claude/commands/maestro-tools-execute.md +4 -4
  17. package/.claude/commands/manage-codebase-rebuild.md +4 -6
  18. package/.claude/commands/spec-load.md +11 -4
  19. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -2
  20. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +96 -25
  21. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  22. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +7 -7
  23. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  24. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +1 -1
  25. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  26. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +1 -0
  27. package/dashboard/dist-server/dashboard/src/shared/constants.js +1 -0
  28. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  29. package/dashboard/dist-server/src/graph/types.d.ts +98 -0
  30. package/dashboard/dist-server/src/graph/types.js +19 -1
  31. package/dashboard/dist-server/src/graph/types.js.map +1 -1
  32. package/dist/src/commands/kg.d.ts.map +1 -1
  33. package/dist/src/commands/kg.js +345 -2
  34. package/dist/src/commands/kg.js.map +1 -1
  35. package/dist/src/commands/spec.d.ts.map +1 -1
  36. package/dist/src/commands/spec.js +82 -38
  37. package/dist/src/commands/spec.js.map +1 -1
  38. package/dist/src/graph/db/connection.d.ts +22 -0
  39. package/dist/src/graph/db/connection.d.ts.map +1 -0
  40. package/dist/src/graph/db/connection.js +113 -0
  41. package/dist/src/graph/db/connection.js.map +1 -0
  42. package/dist/src/graph/db/index.d.ts +4 -0
  43. package/dist/src/graph/db/index.d.ts.map +1 -0
  44. package/dist/src/graph/db/index.js +4 -0
  45. package/dist/src/graph/db/index.js.map +1 -0
  46. package/dist/src/graph/db/migrations.d.ts +5 -0
  47. package/dist/src/graph/db/migrations.d.ts.map +1 -0
  48. package/dist/src/graph/db/migrations.js +18 -0
  49. package/dist/src/graph/db/migrations.js.map +1 -0
  50. package/dist/src/graph/db/queries.d.ts +50 -0
  51. package/dist/src/graph/db/queries.d.ts.map +1 -0
  52. package/dist/src/graph/db/queries.js +313 -0
  53. package/dist/src/graph/db/queries.js.map +1 -0
  54. package/dist/src/graph/db/schema.sql +131 -0
  55. package/dist/src/graph/facade.d.ts +53 -0
  56. package/dist/src/graph/facade.d.ts.map +1 -0
  57. package/dist/src/graph/facade.js +172 -0
  58. package/dist/src/graph/facade.js.map +1 -0
  59. package/dist/src/graph/graph-queries.d.ts +24 -0
  60. package/dist/src/graph/graph-queries.d.ts.map +1 -0
  61. package/dist/src/graph/graph-queries.js +173 -0
  62. package/dist/src/graph/graph-queries.js.map +1 -0
  63. package/dist/src/graph/index.d.ts +8 -0
  64. package/dist/src/graph/index.d.ts.map +1 -1
  65. package/dist/src/graph/index.js +9 -0
  66. package/dist/src/graph/index.js.map +1 -1
  67. package/dist/src/graph/loader.d.ts +8 -0
  68. package/dist/src/graph/loader.d.ts.map +1 -1
  69. package/dist/src/graph/loader.js +20 -0
  70. package/dist/src/graph/loader.js.map +1 -1
  71. package/dist/src/graph/migration.d.ts +8 -0
  72. package/dist/src/graph/migration.d.ts.map +1 -0
  73. package/dist/src/graph/migration.js +134 -0
  74. package/dist/src/graph/migration.js.map +1 -0
  75. package/dist/src/graph/search/index.d.ts +4 -0
  76. package/dist/src/graph/search/index.d.ts.map +1 -0
  77. package/dist/src/graph/search/index.js +3 -0
  78. package/dist/src/graph/search/index.js.map +1 -0
  79. package/dist/src/graph/search/query-parser.d.ts +11 -0
  80. package/dist/src/graph/search/query-parser.d.ts.map +1 -0
  81. package/dist/src/graph/search/query-parser.js +111 -0
  82. package/dist/src/graph/search/query-parser.js.map +1 -0
  83. package/dist/src/graph/search/query-utils.d.ts +12 -0
  84. package/dist/src/graph/search/query-utils.d.ts.map +1 -0
  85. package/dist/src/graph/search/query-utils.js +184 -0
  86. package/dist/src/graph/search/query-utils.js.map +1 -0
  87. package/dist/src/graph/sync/content-hash.d.ts +7 -0
  88. package/dist/src/graph/sync/content-hash.d.ts.map +1 -0
  89. package/dist/src/graph/sync/content-hash.js +33 -0
  90. package/dist/src/graph/sync/content-hash.js.map +1 -0
  91. package/dist/src/graph/sync/incremental-sync.d.ts +23 -0
  92. package/dist/src/graph/sync/incremental-sync.d.ts.map +1 -0
  93. package/dist/src/graph/sync/incremental-sync.js +338 -0
  94. package/dist/src/graph/sync/incremental-sync.js.map +1 -0
  95. package/dist/src/graph/sync/index.d.ts +7 -0
  96. package/dist/src/graph/sync/index.d.ts.map +1 -0
  97. package/dist/src/graph/sync/index.js +5 -0
  98. package/dist/src/graph/sync/index.js.map +1 -0
  99. package/dist/src/graph/sync/watch-policy.d.ts +2 -0
  100. package/dist/src/graph/sync/watch-policy.d.ts.map +1 -0
  101. package/dist/src/graph/sync/watch-policy.js +38 -0
  102. package/dist/src/graph/sync/watch-policy.js.map +1 -0
  103. package/dist/src/graph/sync/watcher.d.ts +44 -0
  104. package/dist/src/graph/sync/watcher.d.ts.map +1 -0
  105. package/dist/src/graph/sync/watcher.js +153 -0
  106. package/dist/src/graph/sync/watcher.js.map +1 -0
  107. package/dist/src/graph/traversal.d.ts +37 -0
  108. package/dist/src/graph/traversal.d.ts.map +1 -0
  109. package/dist/src/graph/traversal.js +335 -0
  110. package/dist/src/graph/traversal.js.map +1 -0
  111. package/dist/src/graph/types.d.ts +98 -0
  112. package/dist/src/graph/types.d.ts.map +1 -1
  113. package/dist/src/graph/types.js +19 -1
  114. package/dist/src/graph/types.js.map +1 -1
  115. package/dist/src/utils/update-notices.js +11 -0
  116. package/dist/src/utils/update-notices.js.map +1 -1
  117. package/package.json +4 -2
  118. package/workflows/analyze.md +19 -13
  119. package/workflows/codebase-rebuild.md +18 -107
  120. package/workflows/execute.md +6 -5
@@ -286,7 +286,7 @@ Append initial Intent Coverage Check to discussion.md.
286
286
 
287
287
  **Step 4.6: Baseline Confidence Scoring**
288
288
 
289
- Dimensions = the 6 analysis dimensions. Factors (weights): findings_depth(.30), evidence_strength(.25), coverage_breadth(.20), user_validation(.15), consistency(.10). Score each factor per dimension from Round 1 results. Append baseline confidence table to discussion.md. Thresholds: <60% 继续深入 | 60-80% 可选 | 80-95% 接近收敛 | >95% 建议收敛.
289
+ Dimensions = the 6 analysis dimensions. Factors (weights): findings_depth(.30), evidence_strength(.25), coverage_breadth(.20), user_validation(.15), consistency(.10). Score each factor per dimension from Round 1 results. Append baseline confidence table to discussion.md. Thresholds: <60% 继续深入 | 60-80% 需用户确认收敛 | >80% 建议收敛.
290
290
 
291
291
  ### Step 5: Interactive Discussion Loop
292
292
 
@@ -297,21 +297,27 @@ Generate 1-2 sentence recap linking previous round conclusions to current starti
297
297
 
298
298
  **5.2: Present Findings** from latest exploration/analysis
299
299
 
300
- **5.3: Gather Feedback** (AskUserQuestion, single-select, header: "分析反馈"):
301
- - **继续深入**: Deepen analysis — auto or user-specified direction
302
- - **调整方向**: Different focus or specific questions
303
- - **补充信息**: User has additional context, constraints, or corrections
304
- - **分析完成**: Sufficient exit to Phase 4
300
+ **5.3: Gather Feedback**
301
+
302
+ AskUserQuestion (single-select, header: "分析反馈"):
303
+ - **继续深入** (Recommended) deepen lowest-confidence dimension
304
+ - **调整方向**different focus or specific questions
305
+ - **补充信息** — user has additional context, constraints, or corrections
306
+ - **分析完成** — sufficient, exit to scoring
307
+
308
+ Question text: `Round {N} | Confidence: {overall}% | 最弱: {weakest_dim} ({dim_score}%)`
305
309
 
306
310
  **5.4: Process Response** (always record user choice + impact to discussion.md):
307
311
 
308
312
  | Choice | Action |
309
313
  |--------|--------|
310
- | 继续深入 | Sub-question (max 4 options: 3 context-driven + 1 heuristic frame-breaker) → CLI/agent exploration → merge findings |
314
+ | 继续深入 | AskUserQuestion sub-direction (below) → CLI/agent exploration → merge findings |
311
315
  | 调整方向 | Capture new direction → new CLI exploration → Record Decision (old vs new, reason, impact) |
312
316
  | 补充信息 | Capture user input → integrate → answer questions via CLI if needed → Record corrections |
313
317
  | 分析完成 | Exit loop → Record why concluding |
314
318
 
319
+ **继续深入 sub-direction**: AskUserQuestion (single-select, header: "深入方向", max 4 options: 3 context-driven from unresolved questions/low-confidence findings/unexplored dimensions + 1 heuristic "换角度审视"). "Other" auto-provided for custom direction.
320
+
315
321
  **5.5: Update discussion.md** after each round:
316
322
  - **Append** Round N: user input, direction, Q&A, corrections, new insights
317
323
  - **Append Technical Solutions** — for every solution proposed, validated, or rejected this round, record immediately using Technical Solution Record Format in `#### Technical Solutions`
@@ -347,7 +353,7 @@ Re-evaluate factors per dimension. Show delta: `Confidence: {prev}% → {current
347
353
  - **Stall Detection**: delta < 5% for 2 consecutive rounds → "分析可能停滞,建议切换方向或收敛"
348
354
 
349
355
  **5.10: Pre-Synthesis Readiness Gate** (on "分析完成"):
350
- Block if: ❌ items without deferral | any dimension < 40% | no pressure pass | unresolved contradictions. If blocked → AskUserQuestion: 补充后继续 or 忽略风险并继续 (record `residual_risks[]`).
356
+ Block if: ❌ items without deferral | any dimension < 40% | no pressure pass | unresolved contradictions | overall confidence < 80%. If blocked → AskUserQuestion: 补充后继续 or 忽略风险并继续 (record `residual_risks[]`, note accepted confidence level).
351
357
 
352
358
  **Auto mode (-y)**: auto-deepen ≤3 rounds, readiness gate auto-overrides with residual risk recording.
353
359
 
@@ -603,11 +609,11 @@ Display summary:
603
609
  - Key conclusions (if full mode)
604
610
  - Session stats
605
611
 
606
- **Next Step Selection** (AskUserQuestion, single-select, header: "Next Step"):
607
- - **快速执行**: Skill({ skill: "maestro-quick", args: "{task_description} --full" }) — build context from conclusions
608
- - **进入规划**: Phase mode → Skill({ skill: "maestro-plan", args: "{phase}" }); Scratch mode → Skill({ skill: "maestro-plan", args: "--dir {output_dir}" }) — plan directly against scratch directory
609
- - **产出Issue**: Convert recommendations to tracked issues
610
- - **完成**: No further action
612
+ AskUserQuestion (single-select, header: "Next Step"):
613
+ - **快速执行** — build context from conclusions, invoke maestro-quick
614
+ - **进入规划** phase planning (maestro-plan)
615
+ - **产出Issue** convert recommendations to tracked issues
616
+ - **完成** no further action
611
617
 
612
618
  Handle selection:
613
619
 
@@ -194,123 +194,36 @@ Suggest next:
194
194
 
195
195
  ---
196
196
 
197
- ## Knowledge Graph Pipeline (Steps 10–17)
197
+ ## Knowledge Graph Pipeline (Step 10)
198
198
 
199
- > **Optional.** Only runs when UA vendor is installed at
200
- > `~/.maestro/vendor/ua/understand-anything-plugin/packages/core/dist/index.js`.
201
- > If not found, skip Steps 10–17 with warning:
202
- > *"KG pipeline skipped: run `scripts/ua-vendor-setup.sh` first"*
199
+ Uses the native `maestro kg index` command (`src/graph/analyzers/fs-analyzer.ts`) to scan the codebase and generate the knowledge graph. No external dependencies required.
203
200
 
204
- All intermediate artifacts are written to `.workflow/codebase/.kg-tmp/`.
201
+ ### Step 10: Generate Knowledge Graph
205
202
 
206
- ### Step 10: KG Pipeline — Project Scan
207
-
208
- ```
209
- node ~/.maestro/vendor/ua/understand-anything-plugin/skills/understand/scan-project.mjs \
210
- "$PROJECT_ROOT" \
211
- "$PROJECT_ROOT/.workflow/codebase/.kg-tmp/scan-result.json"
212
- ```
213
-
214
- Output: `.workflow/codebase/.kg-tmp/scan-result.json`
215
-
216
- ### Step 11: KG Pipeline — Compute Batches
217
-
218
- ```
219
- node ~/.maestro/vendor/ua/understand-anything-plugin/skills/understand/compute-batches.mjs \
220
- "$PROJECT_ROOT"
221
- ```
222
-
223
- Output: `.workflow/codebase/.kg-tmp/batches.json`
224
-
225
- ### Step 12: KG Pipeline — File Analysis (Parallel Delegates)
226
-
227
- ```
228
- For each batch in batches.json, dispatch a delegate:
229
-
230
- maestro delegate "<prompt from kg-file-analyze template>" \
231
- --rule kg-file-analyze --mode analysis --cd "$PROJECT_ROOT"
232
-
233
- Run up to 5 delegates concurrently (run_in_background: true).
234
- Each produces batch-N.json in .kg-tmp/
235
- ```
236
-
237
- ### Step 13: KG Pipeline — Merge Batch Graphs
238
-
239
- ```
240
- node scripts/merge-batch-graphs.mjs "$PROJECT_ROOT" \
241
- --intermediate-dir "$PROJECT_ROOT/.workflow/codebase/.kg-tmp"
242
- ```
243
-
244
- Output: `.workflow/codebase/.kg-tmp/assembled-graph.json`
245
-
246
- ### Step 14: KG Pipeline — Architecture Analysis
247
-
248
- ```
249
- maestro delegate "<prompt>" --rule kg-architecture --mode analysis
250
- ```
251
-
252
- This **replaces** the original Architecture mapper (Mapper 2).
253
- Mapper 2 no longer runs independently — its output is produced here instead.
254
-
255
- Output: `.workflow/codebase/.kg-tmp/layers.json`
256
-
257
- ### Step 15: KG Pipeline — Tour Generation
258
-
259
- ```
260
- maestro delegate "<prompt>" --rule kg-tour-build --mode analysis
261
- ```
262
-
263
- Output: `.workflow/codebase/.kg-tmp/tour.json`
264
-
265
- ### Step 16: KG Pipeline — Validation
266
-
267
- ```
268
- Run inline validation (Node.js script from UA, adapted):
269
- - Check all nodes have required fields (id, type, name, filePath)
270
- - Check referential integrity (all edge source/target refs exist as node ids)
271
- - Check layer coverage (every file-type node appears in exactly 1 layer)
272
- - Check tour structure (all tour step refs resolve to valid nodes)
273
-
274
- If validation fails: log errors but still write the graph (with "valid": false flag).
275
203
  ```
276
-
277
- ### Step 17: KG Pipeline — Save Knowledge Graph
278
-
204
+ maestro kg index --src "$PROJECT_ROOT/src"
279
205
  ```
280
- Assemble final KnowledgeGraph JSON:
281
206
 
282
- {
283
- "version": "1.0.0",
284
- "valid": true|false,
285
- "project": {
286
- "name": "<from state.json or package.json>",
287
- "languages": [<detected>],
288
- "frameworks": [<detected>],
289
- "description": "<from project.md>",
290
- "analyzedAt": "<ISO timestamp>",
291
- "gitCommitHash": "<current HEAD>"
292
- },
293
- "nodes": [<from assembled-graph.json>],
294
- "edges": [<from assembled-graph.json>],
295
- "layers": [<from Step 14 layers.json>],
296
- "tour": [<from Step 15 tour.json>]
297
- }
207
+ This single command performs:
208
+ - File system scan and code entity extraction (nodes, edges)
209
+ - Import/call graph analysis and test pairing (tested_by edges)
210
+ - Layer classification and topological tour generation
211
+ - Validation (referential integrity, layer coverage, tour structure)
212
+ - Write to `.workflow/codebase/knowledge-graph.json`
298
213
 
299
- Write to: .workflow/codebase/knowledge-graph.json
300
- Clean up: remove .workflow/codebase/.kg-tmp/ directory
301
- ```
214
+ If validation fails: the graph is still written with `"valid": false` flag.
302
215
 
303
- ### Step 18: KG → Wiki Index Integration
216
+ ### Step 11: KG → Wiki Index Integration
304
217
 
305
218
  ```
306
219
  When knowledge-graph.json is successfully written:
307
- The WikiIndexer will automatically index KG nodes as virtual wiki entries
308
- on next wiki access (via adaptUaKgGraph virtual adapter).
220
+ The WikiIndexer automatically indexes KG nodes as virtual wiki entries
221
+ on next wiki access (via adaptKnowledgeGraph virtual adapter).
309
222
 
310
223
  Generated virtual entries:
311
- - uakg-{node-id} for each GraphNode (type: knowhow, virtualKind: ua-kg-node)
312
- - uakg-layer-{id} for each Layer (virtualKind: ua-kg-layer)
313
- - uakg-tour-{order} for each TourStep (virtualKind: ua-kg-tour-step)
224
+ - kg-{node-id} for each GraphNode (type: knowhow, virtualKind: kg-node)
225
+ - kg-layer-{id} for each Layer (virtualKind: kg-layer)
226
+ - kg-tour-{order} for each TourStep (virtualKind: kg-tour-step)
314
227
 
315
228
  Cross-referencing:
316
229
  - KG nodes are linked to existing codebase-comp-* entries via filePath matching
@@ -330,8 +243,6 @@ When knowledge-graph.json is successfully written:
330
243
  | .workflow/ missing | Fail: "Run /workflow:init first" |
331
244
  | File read errors | Log warning, skip file, continue scan |
332
245
  | Existing codebase/ without --force | Prompt user for confirmation |
333
- | UA vendor not installed | Skip Steps 10–18 with warning, continue normally |
334
- | KG batch delegate failed | Log warning, continue with remaining batches |
335
246
  | KG validation failed | Write knowledge-graph.json with `"valid": false`, log errors |
336
247
  | Wiki index rebuild failed | Non-fatal — KG data still written, wiki indexing retries on next access |
337
248
 
@@ -344,7 +255,7 @@ When knowledge-graph.json is successfully written:
344
255
  | `.workflow/codebase/tech-registry/{slug}.md` | Per-component documentation |
345
256
  | `.workflow/codebase/feature-maps/_index.md` | Feature index |
346
257
  | `.workflow/codebase/feature-maps/{slug}.md` | Per-feature documentation |
347
- | `.workflow/codebase/knowledge-graph.json` | Knowledge Graph with nodes, edges, layers, and tour (if UA vendor installed) |
258
+ | `.workflow/codebase/knowledge-graph.json` | Knowledge Graph with nodes, edges, layers, and tour |
348
259
  | `.workflow/wiki-index.json` | Updated on next wiki access: KG nodes indexed as virtual entries (automatic) |
349
260
  | `.workflow/state.json` | Updated: last_codebase_rebuild timestamp |
350
261
  | `.workflow/project.md` | Updated: Tech Stack section refreshed |
@@ -295,16 +295,17 @@ For each wave in execution_queue (sequential):
295
295
  IF executor == "agent":
296
296
  Spawn workflow-executor agent (fresh 200k context) with:
297
297
  task definition, phase context, prior wave summaries, specs_content, context.md, analysis.md
298
- Agent: implement task verify convergence → auto-fix (max 3) → checkpoint if blocked
299
- On success: atomic commit (if auto-commit), write .summaries/${task_id}-summary.md
300
- Update .task/${task_id}.json: status = "completed" | "blocked"
298
+ Agent internally handles full lifecycle:
299
+ implement verify convergence auto-fix (max 3) → commit → write .summaries/${task_id}-summary.md → update .task/${task_id}.json status
300
+ (checkpoint if blocked)
301
+ Main flow: verify agent wrote summary + updated status, collect result
301
302
 
302
303
  ELSE (CLI path via maestro delegate):
303
304
  fixedId = "${PHASE_NUM || 'scratch'}-${PHASE_SLUG}-${task_id}"
304
305
  Store fixedId in index.json.execution.delegate_ids[task_id]
305
306
  Dispatch: maestro delegate "${prompt}" --to ${executor} --mode write --id ${fixedId}
306
- Post-dispatch: verify convergence criteria against file state
307
- Write summary, update task status, auto-commit if enabled
307
+ Main flow post-dispatch: verify convergence criteria against file state
308
+ Main flow writes: .summaries/${task_id}-summary.md, update .task/${task_id}.json status, auto-commit if enabled
308
309
 
309
310
  Collect result: { task_id, status, executor, summary_path, commit_hash, delegate_id }
310
311
  Clear state.json.current_task_id