pi-maestro-flow 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -72
- package/agents/cross-role-reviewer.md +1 -1
- package/agents/impeccable-agent.md +1 -1
- package/agents/ralph-executor.md +1 -1
- package/agents/team-worker.md +1 -1
- package/agents/workflow-analyzer.md +1 -1
- package/agents/workflow-codebase-mapper.md +1 -1
- package/agents/workflow-collab-planner.md +1 -1
- package/agents/workflow-debugger.md +1 -1
- package/agents/workflow-executor.md +1 -1
- package/agents/workflow-integration-checker.md +1 -1
- package/agents/workflow-nyquist-auditor.md +1 -1
- package/agents/workflow-phase-researcher.md +1 -1
- package/agents/workflow-planner.md +1 -1
- package/agents/workflow-project-researcher.md +1 -1
- package/agents/workflow-reviewer.md +1 -1
- package/agents/workflow-verifier.md +1 -1
- package/package.json +13 -4
- package/skills/codify-to-knowhow/SKILL.md +1 -1
- package/skills/delegation-check/SKILL.md +1 -1
- package/skills/domain-add/SKILL.md +5 -7
- package/skills/insight-challenge/SKILL.md +1 -1
- package/skills/learn-decompose/SKILL.md +4 -4
- package/skills/learn-follow/SKILL.md +5 -5
- package/skills/learn-investigate/SKILL.md +5 -5
- package/skills/learn-second-opinion/SKILL.md +5 -5
- package/skills/maestro/SKILL.md +9 -10
- package/skills/maestro-amend/SKILL.md +3 -3
- package/skills/maestro-analyze/SKILL.md +10 -13
- package/skills/maestro-blueprint/SKILL.md +8 -11
- package/skills/maestro-brainstorm/SKILL.md +11 -14
- package/skills/maestro-collab/SKILL.md +4 -4
- package/skills/maestro-companion/SKILL.md +3 -3
- package/skills/maestro-composer/SKILL.md +11 -12
- package/skills/maestro-execute/SKILL.md +9 -12
- package/skills/maestro-fork/SKILL.md +8 -11
- package/skills/maestro-grill/SKILL.md +13 -16
- package/skills/maestro-guard/SKILL.md +5 -5
- package/skills/maestro-help/SKILL.md +3 -3
- package/skills/maestro-impeccable/SKILL.md +7 -7
- package/skills/maestro-init/SKILL.md +9 -12
- package/skills/maestro-merge/SKILL.md +6 -8
- package/skills/maestro-milestone-audit/SKILL.md +3 -5
- package/skills/maestro-milestone-complete/SKILL.md +9 -12
- package/skills/maestro-milestone-release/SKILL.md +9 -11
- package/skills/maestro-next/SKILL.md +5 -5
- package/skills/maestro-overlay/SKILL.md +16 -16
- package/skills/maestro-plan/SKILL.md +9 -12
- package/skills/maestro-player/SKILL.md +5 -5
- package/skills/maestro-quick/SKILL.md +5 -7
- package/skills/maestro-ralph/SKILL.md +16 -17
- package/skills/maestro-ralph-cli/SKILL.md +6 -6
- package/skills/maestro-ralph-cli-execute/SKILL.md +2 -2
- package/skills/maestro-ralph-execute/SKILL.md +4 -4
- package/skills/maestro-ralph-v2/SKILL.md +18 -19
- package/skills/maestro-roadmap/SKILL.md +8 -9
- package/skills/maestro-swarm-workflow/SKILL.md +9 -9
- package/skills/maestro-tools-execute/SKILL.md +5 -7
- package/skills/maestro-tools-register/SKILL.md +7 -9
- package/skills/maestro-ui-codify/SKILL.md +9 -10
- package/skills/maestro-universal-workflow/SKILL.md +15 -15
- package/skills/maestro-update/SKILL.md +10 -10
- package/skills/manage-codebase-rebuild/SKILL.md +4 -6
- package/skills/manage-drift-realign/SKILL.md +8 -11
- package/skills/manage-harvest/SKILL.md +6 -9
- package/skills/manage-issue/SKILL.md +5 -8
- package/skills/manage-issue-discover/SKILL.md +8 -11
- package/skills/manage-kg-extractors/SKILL.md +3 -3
- package/skills/manage-knowhow/SKILL.md +3 -5
- package/skills/manage-knowhow-capture/SKILL.md +4 -6
- package/skills/manage-knowledge-audit/SKILL.md +6 -9
- package/skills/manage-status/SKILL.md +3 -5
- package/skills/manage-wiki/SKILL.md +5 -7
- package/skills/odyssey-debug/SKILL.md +13 -13
- package/skills/odyssey-improve/SKILL.md +15 -15
- package/skills/odyssey-planex/SKILL.md +16 -16
- package/skills/odyssey-review-test-fix/SKILL.md +11 -11
- package/skills/odyssey-ui/SKILL.md +10 -10
- package/skills/prompt-generator/SKILL.md +5 -5
- package/skills/quality-auto-test/SKILL.md +3 -5
- package/skills/quality-debug/SKILL.md +3 -5
- package/skills/quality-refactor/SKILL.md +3 -5
- package/skills/quality-retrospective/SKILL.md +10 -13
- package/skills/quality-review/SKILL.md +5 -8
- package/skills/quality-sync/SKILL.md +3 -5
- package/skills/quality-test/SKILL.md +4 -6
- package/skills/scholar-anti-ai-writing/SKILL.md +1 -1
- package/skills/scholar-citation-verify/SKILL.md +1 -1
- package/skills/scholar-experiment/SKILL.md +2 -2
- package/skills/scholar-ideation/SKILL.md +7 -7
- package/skills/scholar-latex-organizer/SKILL.md +1 -1
- package/skills/scholar-publish/SKILL.md +3 -3
- package/skills/scholar-rebuttal-pro/SKILL.md +3 -3
- package/skills/scholar-review/SKILL.md +1 -1
- package/skills/scholar-writing/SKILL.md +1 -1
- package/skills/security-audit/SKILL.md +2 -4
- package/skills/skill-generator/SKILL.md +3 -3
- package/skills/skill-iter-tune/SKILL.md +3 -3
- package/skills/skill-simplify/SKILL.md +1 -1
- package/skills/skill-tuning/SKILL.md +1 -1
- package/skills/spec-add/SKILL.md +5 -7
- package/skills/spec-load/SKILL.md +3 -5
- package/skills/spec-remove/SKILL.md +4 -6
- package/skills/spec-setup/SKILL.md +6 -8
- package/skills/team-adversarial-swarm/SKILL.md +5 -5
- package/skills/team-arch-opt/SKILL.md +2 -2
- package/skills/team-brainstorm/SKILL.md +3 -3
- package/skills/team-coordinate/SKILL.md +4 -4
- package/skills/team-designer/SKILL.md +1 -1
- package/skills/team-executor/SKILL.md +3 -3
- package/skills/team-frontend/SKILL.md +2 -2
- package/skills/team-frontend-debug/SKILL.md +3 -3
- package/skills/team-interactive-craft/SKILL.md +2 -2
- package/skills/team-issue/SKILL.md +3 -3
- package/skills/team-lifecycle-v4/SKILL.md +4 -4
- package/skills/team-motion-design/SKILL.md +2 -2
- package/skills/team-perf-opt/SKILL.md +3 -3
- package/skills/team-planex/SKILL.md +2 -2
- package/skills/team-quality-assurance/SKILL.md +3 -3
- package/skills/team-review/SKILL.md +3 -3
- package/skills/team-roadmap-dev/SKILL.md +3 -3
- package/skills/team-swarm/SKILL.md +4 -4
- package/skills/team-tech-debt/SKILL.md +2 -2
- package/skills/team-testing/SKILL.md +3 -3
- package/skills/team-ui-polish/SKILL.md +2 -2
- package/skills/team-uidesign/SKILL.md +2 -2
- package/skills/team-ultra-analyze/SKILL.md +4 -4
- package/skills/team-ux-improve/SKILL.md +3 -3
- package/skills/team-visual-a11y/SKILL.md +2 -2
- package/skills/workflow-skill-designer/SKILL.md +8 -8
- package/templates/business-test-report.json +68 -0
- package/templates/config.json +48 -0
- package/templates/context.md +16 -0
- package/templates/doc-index.json +11 -0
- package/templates/index.json +68 -0
- package/templates/issue.json +36 -0
- package/templates/plan.json +38 -0
- package/templates/project.md +60 -0
- package/templates/reflection-log.md +20 -0
- package/templates/roadmap.md +45 -0
- package/templates/scratch-index.json +19 -0
- package/templates/search-tool.json +1 -0
- package/templates/search-tools.md +47 -0
- package/templates/state.json +18 -0
- package/templates/task-summary.md +21 -0
- package/templates/task.json +89 -0
- package/templates/terminology-template.json +22 -0
- package/templates/uat.md +21 -0
- package/templates/validation.json +31 -0
- package/templates/verification.json +37 -0
- package/templates/workflow.md +14 -0
- package/templates/worktree-scope.json +9 -0
- package/templates/worktrees.json +26 -0
- package/workflows/agy-instructions.md +156 -0
- package/workflows/analyze.md +768 -0
- package/workflows/auto-test.md +705 -0
- package/workflows/blueprint.md +406 -0
- package/workflows/boundary-grill.md +50 -0
- package/workflows/brainstorm.md +508 -0
- package/workflows/business-test.md +574 -0
- package/workflows/chinese-response.md +25 -0
- package/workflows/claude-instructions.md +167 -0
- package/workflows/codebase-rebuild.md +267 -0
- package/workflows/codebase-refresh.md +168 -0
- package/workflows/codex-instructions.md +156 -0
- package/workflows/coding-philosophy.md +70 -0
- package/workflows/command-authoring.md +823 -0
- package/workflows/debug.md +409 -0
- package/workflows/delegate-usage.md +99 -0
- package/workflows/domain-add.md +121 -0
- package/workflows/drift-realign.md +396 -0
- package/workflows/execute.md +631 -0
- package/workflows/explore-usage.md +93 -0
- package/workflows/finish-work.md +124 -0
- package/workflows/fork.md +162 -0
- package/workflows/grill.md +494 -0
- package/workflows/harvest.md +478 -0
- package/workflows/impeccable.md +168 -0
- package/workflows/init.md +157 -0
- package/workflows/instruction-authoring-guide.md +97 -0
- package/workflows/integration-test.md +186 -0
- package/workflows/interview-mechanics.md +8 -0
- package/workflows/issue-analyze.md +20 -0
- package/workflows/issue-discover.md +238 -0
- package/workflows/issue-execute.md +110 -0
- package/workflows/issue-gaps-analyze.codex.md +256 -0
- package/workflows/issue-gaps-analyze.md +215 -0
- package/workflows/issue-plan.md +110 -0
- package/workflows/issue.md +338 -0
- package/workflows/knowhow.md +429 -0
- package/workflows/knowledge-audit.md +355 -0
- package/workflows/learn.md +271 -0
- package/workflows/maestro-chain-execute.md +20 -0
- package/workflows/maestro-link-coordinate.md +114 -0
- package/workflows/maestro-super.md +120 -0
- package/workflows/maestro.md +501 -0
- package/workflows/map.md +74 -0
- package/workflows/merge.md +122 -0
- package/workflows/milestone-audit.md +155 -0
- package/workflows/milestone-complete.md +167 -0
- package/workflows/milestone-release.md +82 -0
- package/workflows/odyssey-base-codex.md +305 -0
- package/workflows/odyssey-base.md +256 -0
- package/workflows/overlays.md +109 -0
- package/workflows/plan.md +520 -0
- package/workflows/quick.md +350 -0
- package/workflows/ralph-amend-goal.md +177 -0
- package/workflows/refactor.md +87 -0
- package/workflows/retrospective.md +471 -0
- package/workflows/review.md +448 -0
- package/workflows/roadmap-common.md +193 -0
- package/workflows/roadmap.md +106 -0
- package/workflows/shell-exec-protocol.md +30 -0
- package/workflows/skill-authoring.md +265 -0
- package/workflows/spec-generate.md +475 -0
- package/workflows/specs-add.md +123 -0
- package/workflows/specs-load.md +76 -0
- package/workflows/specs-remove.md +104 -0
- package/workflows/specs-setup.md +316 -0
- package/workflows/status.md +149 -0
- package/workflows/sync.md +116 -0
- package/workflows/tdd.md +255 -0
- package/workflows/test-gen.md +226 -0
- package/workflows/test.md +385 -0
- package/workflows/tools-spec.md +70 -0
- package/workflows/ui-codify-extract.md +372 -0
- package/workflows/ui-codify-knowhow.md +258 -0
- package/workflows/ui-codify-package.md +159 -0
- package/workflows/ui-codify.md +227 -0
- package/workflows/ui-design.md +393 -0
- package/workflows/ui-style.md +201 -0
- package/workflows/verify.md +557 -0
- package/workflows/wiki-connect.md +153 -0
- package/workflows/wiki-digest.md +180 -0
- package/workflows/wiki-manage.md +113 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Maestro
|
|
2
|
+
|
|
3
|
+
- **Coding Philosophy**: @~/.maestro/workflows/coding-philosophy.md
|
|
4
|
+
|
|
5
|
+
## Delegate & CLI
|
|
6
|
+
|
|
7
|
+
- **Delegate Usage**: @~/.maestro/workflows/delegate-usage.md
|
|
8
|
+
- **CLI Endpoints Config**: @~/.maestro/cli-tools.json
|
|
9
|
+
|
|
10
|
+
**Strictly follow the cli-tools.json configuration**
|
|
11
|
+
|
|
12
|
+
## Explore
|
|
13
|
+
|
|
14
|
+
`maestro explore` takes priority over Glob, Grep, and Read. When locating files or searching code patterns, call `maestro explore` first and stop to wait for results.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
maestro explore "FIND: <target + condition>\nSCOPE: <paths>" [more prompts...] [options]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Lightweight read-only codebase search. 1 prompt = 1 agent. Not for write-mode/long sessions — use `delegate`.
|
|
21
|
+
|
|
22
|
+
| Option | Description |
|
|
23
|
+
|--------|-------------|
|
|
24
|
+
| `-e, --endpoint <names>` | Endpoint name(s), comma-separated |
|
|
25
|
+
| `--all` | Fan out each prompt to all endpoints |
|
|
26
|
+
| `--max-turns <n>` | Max agent turns per job |
|
|
27
|
+
| `-f, --file <path>` | Load prompts from JSON or text file |
|
|
28
|
+
| `--cd <dir>` | Working directory |
|
|
29
|
+
| `--json` | Output results as JSON |
|
|
30
|
+
|
|
31
|
+
### Context Injection
|
|
32
|
+
|
|
33
|
+
Explore agent 无项目认知,调用前注入上下文:
|
|
34
|
+
|
|
35
|
+
| 注入项 | 写入字段 | 内容 |
|
|
36
|
+
|--------|----------|------|
|
|
37
|
+
| 结构 | SCOPE | 相关目录的具体路径(非通配泛扫) |
|
|
38
|
+
| 领域 | SCOPE | `maestro search` 已返回的关键文件路径 |
|
|
39
|
+
| 约束 | ATTENTION | 框架、语言、命名惯例 |
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
FIND: authentication middleware that validates JWT tokens
|
|
43
|
+
SCOPE: src/middleware/, src/auth/, src/api/routes/
|
|
44
|
+
ATTENTION: Express.js, middleware files named *.middleware.ts
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Prompt Structure
|
|
48
|
+
|
|
49
|
+
**FIND + SCOPE 为最低标准。** 每个字段一句陈述句,禁止嵌套条件。
|
|
50
|
+
|
|
51
|
+
| Field | Required | Rule |
|
|
52
|
+
|-------|----------|------|
|
|
53
|
+
| `FIND` | **Yes** | 可判定的具体目标(什么 + 判定条件) |
|
|
54
|
+
| `SCOPE` | **Yes** | 明确路径或 glob,禁止 `**/*` 泛扫 |
|
|
55
|
+
| `EXCLUDE` | No | 要跳过的文件类型或目录 |
|
|
56
|
+
| `ATTENTION` | No | 框架、命名惯例、已知陷阱 |
|
|
57
|
+
| `EXPECTED` | Recommended | 输出格式:`file:line` 列表 / 摘要 / JSON |
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
FIND: Functions that call db.query() with string concatenation instead of $1/$2
|
|
61
|
+
SCOPE: src/db/**/*.ts, src/api/**/*.ts
|
|
62
|
+
EXCLUDE: **/*.test.ts
|
|
63
|
+
EXPECTED: file:line list with the SQL string
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Cross-Search
|
|
67
|
+
|
|
68
|
+
对重要搜索,用 2-3 个不同角度的 prompt 并发,结果由 Claude 交叉验证。
|
|
69
|
+
|
|
70
|
+
**按角度拆分,不按关键词拆分:**
|
|
71
|
+
|
|
72
|
+
| 角度 | Prompt A | Prompt B |
|
|
73
|
+
|------|----------|----------|
|
|
74
|
+
| 定义 vs 调用 | 找函数定义 | 找调用点 |
|
|
75
|
+
| 正例 vs 反例 | 找正确用法 | 找遗漏用法 |
|
|
76
|
+
| 入口 vs 实现 | 找 export/路由 | 找内部逻辑 |
|
|
77
|
+
| 按文件类型 | .ts 中的用法 | .vue 中的用法 |
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
maestro explore \
|
|
81
|
+
"FIND: All functions exported from auth module\nSCOPE: src/auth/\nEXPECTED: function name + file:line" \
|
|
82
|
+
"FIND: All imports from auth module\nSCOPE: src/**/*.ts\nEXCLUDE: src/auth/\nEXPECTED: import path + file:line" \
|
|
83
|
+
--json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**结果置信度:**
|
|
87
|
+
- 双命中 → 高置信,直接使用
|
|
88
|
+
- 单命中 → 用 Grep/Read 二次确认
|
|
89
|
+
- 零命中 → 换角度重搜或目标不存在
|
|
90
|
+
|
|
91
|
+
### Execution
|
|
92
|
+
|
|
93
|
+
Multi-prompt — background;single lookup — foreground:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
Bash({ command: "maestro explore \"p1\" \"p2\" --json", run_in_background: true })
|
|
97
|
+
Bash({ command: "maestro explore \"FIND: ...\nSCOPE: ...\"" })
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Session: `maestro explore show` / `maestro explore output <id>`
|
|
101
|
+
|
|
102
|
+
## Knowledge System
|
|
103
|
+
|
|
104
|
+
**Gate rule**: run `maestro search` + `maestro load` BEFORE reading code or editing files.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
maestro search "<query>" [--type <type>] [--category <cat>] [--code] [--kg]
|
|
108
|
+
maestro load --type <type> [--list] [--category <cat>] [--keyword <word>] [--id <id>]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**--type**: `spec`, `knowhow`, `domain`, `issue`, `session`, `scratch`, `note`, `project`, `roadmap`
|
|
112
|
+
**--category** (spec only): `coding`, `arch`, `debug`, `test`, `review`, `learning`, `ui`
|
|
113
|
+
|
|
114
|
+
### Query Rules
|
|
115
|
+
|
|
116
|
+
1-3 core keywords per query — multiple short queries beat one long one.
|
|
117
|
+
Separate concepts from symbols. Add `--code` for symbols, `--kg` for full-source.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# ❌ keyword dump
|
|
121
|
+
maestro search "topology display frontend DetailedTopologySVG elk"
|
|
122
|
+
|
|
123
|
+
# ✅ targeted
|
|
124
|
+
maestro search "topology layout"
|
|
125
|
+
maestro search "DetailedTopologySVG" --code
|
|
126
|
+
maestro load --type spec --category coding
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Record
|
|
130
|
+
|
|
131
|
+
| What | Command |
|
|
132
|
+
|------|---------|
|
|
133
|
+
| Spec | `/spec-add <category> "title" "content" --keywords kw1,kw2 --description "summary"` |
|
|
134
|
+
| Knowhow | `/manage-knowhow-capture` (`--spec-category <cat>` for agent injection) |
|
|
135
|
+
|
|
136
|
+
Category routing: decisions→`arch`, patterns→`coding`, pitfalls→`debug`/`learning`, rules→`review`, tests→`test`.
|
|
137
|
+
|
|
138
|
+
### Supersession & Conflict (dual-track)
|
|
139
|
+
|
|
140
|
+
新知识与旧条目的关系分两种,语义不同、操作不同:
|
|
141
|
+
|
|
142
|
+
| 关系 | 场景 | 命令 | 效果 |
|
|
143
|
+
|------|------|------|------|
|
|
144
|
+
| **supersede** | 新规则替代旧规则(演化) | `maestro spec supersede <old-sid> --by <new-sid>` | 旧条目 `deprecated`(search/load 排除),演化链保留 |
|
|
145
|
+
| **conflict** | 两条规则均有道理(争议) | `maestro spec conflict mark <file> <line> --note "<reason>"` | 旧条目 `contested`(search ×0.5,`[CONTESTED]` 标注,仍注入),人裁决 |
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# supersede 流程: add → capture sid → supersede
|
|
149
|
+
maestro spec add coding "新规则" "内容" --keywords kw1,kw2 --json # → 获取 new-sid
|
|
150
|
+
maestro spec supersede <old-sid> --by <new-sid> # → 旧条目 deprecated
|
|
151
|
+
maestro spec history <sid> # → 查看演化链
|
|
152
|
+
|
|
153
|
+
# conflict 流程: 不确定谁对 → 标记争议 → 审计解决
|
|
154
|
+
maestro spec conflict mark <file> <line> --note "<reason>"
|
|
155
|
+
# Resolution: /manage-knowledge-audit
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**三正交轴**: `confidence`(人/审计裁定)⊥ `status`(active/deprecated 生命周期)⊥ time-decay(自动新鲜度)。不要混用。
|
|
159
|
+
|
|
160
|
+
### Health & Maintenance
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
maestro spec health # 生命周期统计 + 悬空/循环 supersedes 校验 + 新鲜度
|
|
164
|
+
maestro spec backfill-sid # 存量无 sid 条目回填(幂等),启用演化链
|
|
165
|
+
maestro spec history <sid> # 某条目的演化链(oldest → newest)
|
|
166
|
+
maestro search "<q>" --include-deprecated # 搜索含 deprecated 条目
|
|
167
|
+
```
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Workflow: codebase-rebuild
|
|
2
|
+
|
|
3
|
+
Full rebuild of the `.workflow/codebase/` documentation system.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
- Manual via `/workflow:codebase-rebuild [--force] [--skip-commit]`
|
|
8
|
+
- Auto-triggered by `/workflow:init` when existing code is detected
|
|
9
|
+
- Auto-triggered by `/workflow:map`
|
|
10
|
+
|
|
11
|
+
## Arguments
|
|
12
|
+
|
|
13
|
+
| Arg | Description | Default |
|
|
14
|
+
|-----|-------------|---------|
|
|
15
|
+
| `--force` | Clear existing codebase/ and rebuild from scratch | `false` |
|
|
16
|
+
| `--skip-commit` | Skip the final git commit of generated docs | `false` |
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- Project source code exists (src/ or equivalent)
|
|
21
|
+
- `.workflow/` directory exists
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Workflow Steps
|
|
26
|
+
|
|
27
|
+
### Step 1: Prepare Directory Structure
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Create (or clear if --force) .workflow/codebase/:
|
|
31
|
+
doc-index.json, tech-registry/_index.md, feature-maps/_index.md, action-logs/
|
|
32
|
+
|
|
33
|
+
If exists and not --force: confirm overwrite or exit.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Step 2: Scan Project Structure — Components
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Scan source directories (src/, lib/, app/, packages/) for components.
|
|
40
|
+
Use project.md Tech Stack for context if available.
|
|
41
|
+
|
|
42
|
+
Classify files by naming pattern:
|
|
43
|
+
Models (*model*, *entity*, *schema*), Services (*service*, *provider*),
|
|
44
|
+
Controllers (*controller*, *handler*, *route*), Utils (*util*, *helper*),
|
|
45
|
+
Types (*type*, *interface*, *.d.ts), Config (*config*, *constant*),
|
|
46
|
+
Middleware (*middleware*, *guard*, *interceptor*), Core (*core*, *registry*, *loader*)
|
|
47
|
+
|
|
48
|
+
For each component: read files, extract exported symbols, determine type.
|
|
49
|
+
Build component entry:
|
|
50
|
+
{
|
|
51
|
+
"id": "TC-{NNN}", // Sequential TC-001, TC-002, ...
|
|
52
|
+
"name": "{PascalCase name}",
|
|
53
|
+
"type": "{type}",
|
|
54
|
+
"code_locations": ["{relative paths}"],
|
|
55
|
+
"feature_ids": [], // Populated in Step 3
|
|
56
|
+
"symbols": ["{exported symbol names}"],
|
|
57
|
+
"last_updated": "{ISO timestamp}"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 2.5: Load Project Specs
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
# MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
|
|
65
|
+
specs_content = maestro spec load --category arch
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Used in Step 2-4 to produce architecture-aware documentation.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Step 3: Scan Project Structure — Features
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Group components into features by:
|
|
76
|
+
directory proximity, naming patterns, import relationships, blueprint/ mapping.
|
|
77
|
+
|
|
78
|
+
For each feature group: derive name, collect component IDs, map requirements and phase.
|
|
79
|
+
Build feature entry:
|
|
80
|
+
{
|
|
81
|
+
"id": "FT-{NNN}",
|
|
82
|
+
"name": "{Feature Name}",
|
|
83
|
+
"status": "active",
|
|
84
|
+
"requirement_ids": [], // From .spec mapping
|
|
85
|
+
"component_ids": ["TC-001", "TC-002"],
|
|
86
|
+
"phase": null // From roadmap mapping
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Back-fill component.feature_ids with assigned feature IDs.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 4: Map Requirements (if .spec exist)
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
If .workflow/blueprint/ exist: parse each SPEC-*/requirements/REQ-*.md,
|
|
96
|
+
match to features by keyword analysis. Build requirement entry:
|
|
97
|
+
{
|
|
98
|
+
"id": "REQ-{NNN}",
|
|
99
|
+
"title": "{requirement title}",
|
|
100
|
+
"priority": "must|should|could|wont",
|
|
101
|
+
"feature_id": "FT-{NNN}",
|
|
102
|
+
"status": "pending|in_progress|completed",
|
|
103
|
+
"acceptance_criteria": ["{criteria}"]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
If no blueprint: requirements = [] (populated later by maestro-blueprint).
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 5: Record Architecture Decisions (if ADRs exist)
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
If .workflow/blueprint/*/architecture/ADR-*.md exist: parse each ADR,
|
|
113
|
+
map to components by keyword analysis. Build ADR entry:
|
|
114
|
+
{
|
|
115
|
+
"id": "ADR-{NNN}",
|
|
116
|
+
"title": "{ADR title}",
|
|
117
|
+
"component_ids": ["TC-{NNN}"],
|
|
118
|
+
"decision": "{decision summary}",
|
|
119
|
+
"rationale": "{rationale summary}",
|
|
120
|
+
"evidence_source": "{evidence source — ADR file ref or code anchor}"
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
If no ADRs: architecture_decisions = [].
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Step 6: Write doc-index.json
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Assemble the complete doc-index.json:
|
|
130
|
+
|
|
131
|
+
{
|
|
132
|
+
"version": "1.0",
|
|
133
|
+
"schema_version": "1.0",
|
|
134
|
+
"project": "{project name from state.json or package.json}",
|
|
135
|
+
"last_updated": "{ISO timestamp}",
|
|
136
|
+
"features": [{feature entries}],
|
|
137
|
+
"components": [{component entries}],
|
|
138
|
+
"requirements": [{requirement entries}],
|
|
139
|
+
"architecture_decisions": [{ADR entries}],
|
|
140
|
+
"actions": []
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Write to: .workflow/codebase/doc-index.json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**GATE Step 6→7**: REQUIRED `doc-index.json` written and valid JSON before tech-registry generation; BLOCKED if `doc-index.json` missing or invalid.
|
|
147
|
+
|
|
148
|
+
### Step 7: Generate Tech Registry Docs
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
For each component (slug = lowercase-hyphenated name):
|
|
152
|
+
|
|
153
|
+
Write .workflow/codebase/tech-registry/{slug}.md:
|
|
154
|
+
Header table (ID, Type, Features) + sections: Code Locations, Exported Symbols, Dependencies.
|
|
155
|
+
Footer: *Auto-generated by codebase-rebuild at {timestamp}*
|
|
156
|
+
|
|
157
|
+
Write .workflow/codebase/tech-registry/_index.md:
|
|
158
|
+
Summary table (ID, Name, Type, Locations) + component count footer.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step 8: Generate Feature Map Docs
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
For each feature (slug = lowercase-hyphenated name):
|
|
165
|
+
|
|
166
|
+
Write .workflow/codebase/feature-maps/{slug}.md:
|
|
167
|
+
Header table (ID, Status, Phase) + sections: Requirements, Components table.
|
|
168
|
+
Footer: *Auto-generated by codebase-rebuild at {timestamp}*
|
|
169
|
+
|
|
170
|
+
Write .workflow/codebase/feature-maps/_index.md:
|
|
171
|
+
Summary table (ID, Name, Status, Components, Requirements) + feature count footer.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Step 8.5: Update State and Project Artifacts
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
a. Update state.json: set last_codebase_rebuild and last_updated timestamps.
|
|
178
|
+
|
|
179
|
+
b. Update project.md Tech Stack (if exists):
|
|
180
|
+
Compare "## Tech Stack" against detected stack from Step 2.
|
|
181
|
+
If changes detected: update section + footer timestamp.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**GATE Step 8.5→9**: Glob `.workflow/codebase/doc-index.json` AND `.workflow/codebase/knowledge-graph.json` MUST exist before Step 9 report; BLOCKED if missing.
|
|
185
|
+
|
|
186
|
+
### Step 9: Report and Commit
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Display summary: component/feature/requirement/ADR/file counts.
|
|
190
|
+
If KG pipeline ran: include KG node/edge/layer/tour counts.
|
|
191
|
+
If mapper agents failed: log W001.
|
|
192
|
+
If not --skip-commit: suggest committing generated docs.
|
|
193
|
+
Suggest next:
|
|
194
|
+
- manage-status (review)
|
|
195
|
+
- manage-codebase-refresh (incremental updates)
|
|
196
|
+
- maestro kg stats (verify KG)
|
|
197
|
+
- maestro wiki list --keyword kg (verify wiki integration)
|
|
198
|
+
- maestro kg diff-wiki (future change impact analysis)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Knowledge Graph Pipeline (Step 10)
|
|
204
|
+
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
### Step 10: Generate Knowledge Graph
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
# MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
|
|
211
|
+
maestro kg index --src "$PROJECT_ROOT/src"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- File system scan and code entity extraction (nodes, edges)
|
|
215
|
+
- Import/call graph analysis and test pairing (tested_by edges)
|
|
216
|
+
- Layer classification and topological tour generation
|
|
217
|
+
- Validation (referential integrity, layer coverage, tour structure)
|
|
218
|
+
- Write to `.workflow/codebase/knowledge-graph.json`
|
|
219
|
+
|
|
220
|
+
If validation fails: the graph is still written with `"valid": false` flag.
|
|
221
|
+
|
|
222
|
+
### Step 11: KG → Wiki Index Integration
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
When knowledge-graph.json is successfully written:
|
|
226
|
+
The WikiIndexer automatically indexes KG nodes as virtual wiki entries
|
|
227
|
+
on next wiki access (via adaptKnowledgeGraph virtual adapter).
|
|
228
|
+
|
|
229
|
+
Generated virtual entries:
|
|
230
|
+
- kg-{node-id} for each GraphNode (type: knowhow, virtualKind: kg-node)
|
|
231
|
+
- kg-layer-{id} for each Layer (virtualKind: kg-layer)
|
|
232
|
+
- kg-tour-{order} for each TourStep (virtualKind: kg-tour-step)
|
|
233
|
+
|
|
234
|
+
Cross-referencing:
|
|
235
|
+
- KG nodes are linked to existing codebase-comp-* entries via filePath matching
|
|
236
|
+
- Edge semantics preserved in ext.kgEdges for downstream semantic traversal
|
|
237
|
+
|
|
238
|
+
No manual action required — indexing is lazy and triggered on first wiki access.
|
|
239
|
+
To verify: run `maestro wiki list --keyword kg` after rebuild.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Error Handling
|
|
245
|
+
|
|
246
|
+
| Error | Action |
|
|
247
|
+
|-------|--------|
|
|
248
|
+
| No source directories found | Warn and create empty doc-index.json |
|
|
249
|
+
| .workflow/ missing | Fail: "Run /workflow:init first" |
|
|
250
|
+
| File read errors | Log warning, skip file, continue scan |
|
|
251
|
+
| Existing codebase/ without --force | Prompt user for confirmation |
|
|
252
|
+
| KG validation failed | Write knowledge-graph.json with `"valid": false`, log errors |
|
|
253
|
+
| Wiki index rebuild failed | Non-fatal — KG data still written, wiki indexing retries on next access |
|
|
254
|
+
|
|
255
|
+
## Output Files
|
|
256
|
+
|
|
257
|
+
| File | Description |
|
|
258
|
+
|------|-------------|
|
|
259
|
+
| `.workflow/codebase/doc-index.json` | Single source of truth for all components/features/requirements |
|
|
260
|
+
| `.workflow/codebase/tech-registry/_index.md` | Component index |
|
|
261
|
+
| `.workflow/codebase/tech-registry/{slug}.md` | Per-component documentation |
|
|
262
|
+
| `.workflow/codebase/feature-maps/_index.md` | Feature index |
|
|
263
|
+
| `.workflow/codebase/feature-maps/{slug}.md` | Per-feature documentation |
|
|
264
|
+
| `.workflow/codebase/knowledge-graph.json` | Knowledge Graph with nodes, edges, layers, and tour |
|
|
265
|
+
| `.workflow/wiki-index.json` | Updated on next wiki access: KG nodes indexed as virtual entries (automatic) |
|
|
266
|
+
| `.workflow/state.json` | Updated: last_codebase_rebuild timestamp |
|
|
267
|
+
| `.workflow/project.md` | Updated: Tech Stack section refreshed |
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Workflow: codebase-refresh
|
|
2
|
+
|
|
3
|
+
Incremental refresh of `.workflow/codebase/` documentation based on changes since the last rebuild or refresh.
|
|
4
|
+
|
|
5
|
+
Detects which files have changed (via git diff), identifies which codebase docs are affected, selectively re-scans only those areas, and updates timestamps. Much faster than a full rebuild for ongoing maintenance.
|
|
6
|
+
|
|
7
|
+
## Trigger
|
|
8
|
+
|
|
9
|
+
- Manual via `/workflow:codebase-refresh [--since <date>] [--deep]`
|
|
10
|
+
|
|
11
|
+
## Arguments
|
|
12
|
+
|
|
13
|
+
| Arg | Description | Required |
|
|
14
|
+
|-----|-------------|----------|
|
|
15
|
+
| `--since <date>` | Override change detection window (ISO date or relative like "3d") | No |
|
|
16
|
+
| `--deep` | Force deeper re-scan even for files with minor changes | No |
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- `.workflow/` directory exists and is initialized
|
|
21
|
+
- `.workflow/codebase/` must contain existing docs (from prior rebuild)
|
|
22
|
+
- `.workflow/codebase/doc-index.json` must exist (run `/workflow:codebase rebuild` first)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Workflow Steps
|
|
27
|
+
|
|
28
|
+
### Step 1: Parse Input and Validate
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Parse --since and --deep flags from $ARGUMENTS.
|
|
32
|
+
Verify .workflow/ initialized (E001 if not) and doc-index.json exists (E002 if not).
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 2: Detect Changes
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Change window: --since value, else codebase_last_rebuilt/codebase_last_refreshed from state.json.
|
|
39
|
+
Run git diff --name-only to get changed files.
|
|
40
|
+
If no changes: emit W001 and exit.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 3: Identify Affected Documentation
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Map changed files to doc-index.json entries via code_locations matching.
|
|
47
|
+
Build affected sets:
|
|
48
|
+
affected_components = components whose code_locations include changed files
|
|
49
|
+
affected_features = features whose component_ids include affected components
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 3.5: Load Project Specs
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
# MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
|
|
56
|
+
specs_content = maestro spec load --category arch
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Used in Step 4-5 to validate refreshed docs against architectural expectations.
|
|
60
|
+
|
|
61
|
+
### Step 3.6: KG Impact Analysis (if KG exists)
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
If .workflow/codebase/knowledge-graph.json exists:
|
|
65
|
+
# MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep (when KG exists)
|
|
66
|
+
Run: maestro kg diff-wiki --json
|
|
67
|
+
Parse output for affectedWiki entries.
|
|
68
|
+
|
|
69
|
+
If affectedWiki is non-empty:
|
|
70
|
+
Log WARNING for each affected wiki entry:
|
|
71
|
+
"KG impact: code changes affect [entry.id] — [entry.title] (via [reason])"
|
|
72
|
+
|
|
73
|
+
Add affected entry IDs to the refresh queue for human review.
|
|
74
|
+
|
|
75
|
+
Log summary: "KG analysis: {directNodes} direct, {impactedNodes} impacted KG nodes,
|
|
76
|
+
{affectedWiki.length} wiki entries flagged"
|
|
77
|
+
|
|
78
|
+
If .workflow/codebase/knowledge-graph.json does not exist:
|
|
79
|
+
Log W0xx "KG not generated — KG impact analysis skipped" and continue; flag KG analysis as [LOW CONFIDENCE] (KG unavailable).
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Step 4: Re-scan Affected Components
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
For each affected component:
|
|
88
|
+
- Verify code_locations still exist (remove missing, log warning)
|
|
89
|
+
- Re-extract exported symbols (ESM export + CJS module.exports patterns)
|
|
90
|
+
- Update symbols[] and last_updated timestamp
|
|
91
|
+
|
|
92
|
+
If --deep: follow reverse dependency chain to find additional affected components.
|
|
93
|
+
|
|
94
|
+
Report new files matching component naming patterns (do not auto-add).
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**GATE Step 4→5**: REQUIRED affected components re-scanned (symbols[] and last_updated refreshed) before relationship check; BLOCKED if affected components not re-scanned.
|
|
98
|
+
|
|
99
|
+
### Step 5: Check Relationship Changes
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
For each refreshed component:
|
|
103
|
+
Analyze imports to detect cross-feature dependencies (log if found).
|
|
104
|
+
|
|
105
|
+
For each refreshed feature:
|
|
106
|
+
Remove stale component_ids, check for new components by directory proximity.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 6: Update Doc Index
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
Write updated component/feature entries + timestamps to .workflow/codebase/doc-index.json.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step 7: Regenerate Affected Docs
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
For each refreshed component: regenerate tech-registry/{slug}.md
|
|
119
|
+
(header table + Code Locations + Exported Symbols + refresh timestamp).
|
|
120
|
+
|
|
121
|
+
For each refreshed feature: regenerate feature-maps/{slug}.md
|
|
122
|
+
(header table + Components table + Requirements + refresh timestamp).
|
|
123
|
+
|
|
124
|
+
If entries changed: regenerate tech-registry/_index.md and feature-maps/_index.md.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 8: Update Timestamps
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Update .workflow/state.json: set codebase_last_refreshed and last_updated timestamps.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**GATE Step 8→9**: Glob refreshed `tech-registry/{slug}.md` MUST exist before Step 9 report; BLOCKED if missing.
|
|
134
|
+
|
|
135
|
+
### Step 9: Report
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Display summary: changed files, components/features refreshed, symbols added/removed, warnings.
|
|
139
|
+
Suggest next: manage-status to review.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Error Handling
|
|
145
|
+
|
|
146
|
+
| Code | Meaning |
|
|
147
|
+
|------|---------|
|
|
148
|
+
| E001 | .workflow/ not initialized |
|
|
149
|
+
| E002 | No codebase/ docs exist, use codebase-rebuild instead |
|
|
150
|
+
| W001 | No changes detected since last refresh |
|
|
151
|
+
|
|
152
|
+
| Error | Action |
|
|
153
|
+
|-------|--------|
|
|
154
|
+
| doc-index.json missing | Fail with E002: "Run /workflow:codebase rebuild first" |
|
|
155
|
+
| .workflow/ missing | Fail with E001 |
|
|
156
|
+
| Code location file missing | Remove from code_locations, log warning |
|
|
157
|
+
| No changes detected | Emit W001, exit gracefully |
|
|
158
|
+
|
|
159
|
+
## Output Files
|
|
160
|
+
|
|
161
|
+
| File | Action |
|
|
162
|
+
|------|--------|
|
|
163
|
+
| `.workflow/codebase/doc-index.json` | Updated (affected entries + timestamps) |
|
|
164
|
+
| `.workflow/codebase/tech-registry/{slug}.md` | Regenerated for refreshed components |
|
|
165
|
+
| `.workflow/codebase/feature-maps/{slug}.md` | Regenerated for refreshed features |
|
|
166
|
+
| `.workflow/codebase/tech-registry/_index.md` | Updated if entries changed |
|
|
167
|
+
| `.workflow/codebase/feature-maps/_index.md` | Updated if entries changed |
|
|
168
|
+
| `.workflow/state.json` | Updated with codebase_last_refreshed timestamp |
|