maestro-flow 0.3.43 → 0.3.45
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/.claude/commands/learn-decompose.md +10 -15
- package/.claude/commands/learn-follow.md +11 -16
- package/.claude/commands/learn-investigate.md +18 -22
- package/.claude/commands/learn-retro.md +23 -26
- package/.claude/commands/learn-second-opinion.md +11 -16
- package/.claude/commands/maestro-analyze.md +8 -0
- package/.claude/commands/maestro-brainstorm.md +8 -0
- package/.claude/commands/maestro-execute.md +11 -3
- package/.claude/commands/maestro-learn.md +4 -4
- package/.claude/commands/maestro-milestone-complete.md +6 -6
- package/.claude/commands/maestro-plan.md +8 -0
- package/.claude/commands/maestro-ralph-execute.md +1 -2
- package/.claude/commands/maestro-tools-execute.md +117 -0
- package/.claude/commands/maestro-tools-register.md +136 -0
- package/.claude/commands/maestro-ui-codify.md +67 -0
- package/.claude/commands/manage-harvest.md +1 -1
- package/.claude/commands/manage-learn.md +5 -7
- package/.claude/commands/manage-wiki.md +1 -1
- package/.claude/commands/quality-auto-test.md +1 -1
- package/.claude/commands/quality-debug.md +8 -0
- package/.claude/commands/quality-retrospective.md +4 -5
- package/.claude/commands/quality-review.md +8 -0
- package/.claude/commands/spec-add.md +18 -2
- package/.claude/commands/spec-load.md +25 -6
- package/.claude/commands/spec-setup.md +2 -2
- package/.claude/commands/wiki-connect.md +1 -1
- package/.claude/commands/wiki-digest.md +5 -6
- package/.claude/skills/codify-to-knowhow/SKILL.md +167 -0
- package/.claude/skills/codify-to-knowhow/phases/01-load-manifest.md +101 -0
- package/.claude/skills/codify-to-knowhow/phases/02-generate-knowhow.md +97 -0
- package/.claude/skills/codify-to-knowhow/phases/03-generate-specs.md +92 -0
- package/.claude/skills/codify-to-knowhow/phases/04-index-verify.md +119 -0
- package/.codex/skills/codify-to-knowhow/SKILL.md +427 -0
- package/.codex/skills/learn-decompose/SKILL.md +8 -8
- package/.codex/skills/learn-follow/SKILL.md +6 -6
- package/.codex/skills/learn-investigate/SKILL.md +4 -4
- package/.codex/skills/learn-retro/SKILL.md +7 -7
- package/.codex/skills/learn-second-opinion/SKILL.md +6 -6
- package/.codex/skills/maestro-analyze/SKILL.md +491 -491
- package/.codex/skills/maestro-collab/SKILL.md +1 -1
- package/.codex/skills/maestro-learn/SKILL.md +1 -1
- package/.codex/skills/maestro-milestone-complete/SKILL.md +122 -122
- package/.codex/skills/maestro-plan/SKILL.md +485 -485
- package/.codex/skills/maestro-tools-execute/SKILL.md +105 -0
- package/.codex/skills/maestro-tools-register/SKILL.md +149 -0
- package/.codex/skills/maestro-ui-codify/SKILL.md +398 -0
- package/.codex/skills/maestro-verify/SKILL.md +486 -486
- package/.codex/skills/manage-harvest/SKILL.md +3 -3
- package/.codex/skills/manage-issue-discover/SKILL.md +431 -431
- package/.codex/skills/manage-learn/SKILL.md +13 -13
- package/.codex/skills/manage-wiki/SKILL.md +1 -1
- package/.codex/skills/quality-auto-test/SKILL.md +553 -553
- package/.codex/skills/quality-refactor/SKILL.md +151 -151
- package/.codex/skills/quality-retrospective/SKILL.md +6 -6
- package/.codex/skills/spec-add/SKILL.md +104 -101
- package/.codex/skills/spec-load/SKILL.md +73 -77
- package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
- package/.codex/skills/wiki-connect/SKILL.md +5 -5
- package/.codex/skills/wiki-digest/SKILL.md +8 -8
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +0 -1
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js +2 -2
- package/dashboard/dist-server/dashboard/src/server/state/fs-watcher.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js +1 -1
- package/dashboard/dist-server/dashboard/src/server/supervisor/self-learning-service.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +2 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +6 -3
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +29 -14
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +0 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +1 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +2 -52
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +68 -33
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +1 -11
- package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +5 -4
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +26 -12
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +5 -5
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +4 -2
- package/dashboard/dist-server/src/tools/spec-entry-parser.js +19 -7
- package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -1
- package/dashboard/dist-server/src/tools/spec-loader.d.ts +4 -4
- package/dashboard/dist-server/src/tools/spec-loader.js +166 -23
- package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +5 -5
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/commands/knowhow.d.ts.map +1 -1
- package/dist/src/commands/knowhow.js +25 -6
- package/dist/src/commands/knowhow.js.map +1 -1
- package/dist/src/commands/spec.d.ts +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +70 -3
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/commands/wiki.d.ts.map +1 -1
- package/dist/src/commands/wiki.js +45 -6
- package/dist/src/commands/wiki.js.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.js +1 -1
- package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
- package/dist/src/hooks/plugins/spec-injection-plugin.js +2 -2
- package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
- package/dist/src/hooks/spec-injector.d.ts +0 -6
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +36 -43
- package/dist/src/hooks/spec-injector.js.map +1 -1
- package/dist/src/hooks/wiki-role-loader.d.ts +18 -0
- package/dist/src/hooks/wiki-role-loader.d.ts.map +1 -0
- package/dist/src/hooks/wiki-role-loader.js +43 -0
- package/dist/src/hooks/wiki-role-loader.js.map +1 -0
- package/dist/src/tools/spec-entry-parser.d.ts +4 -2
- package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
- package/dist/src/tools/spec-entry-parser.js +19 -7
- package/dist/src/tools/spec-entry-parser.js.map +1 -1
- package/dist/src/tools/spec-init.js +54 -54
- package/dist/src/tools/spec-loader.d.ts +4 -4
- package/dist/src/tools/spec-loader.d.ts.map +1 -1
- package/dist/src/tools/spec-loader.js +166 -23
- package/dist/src/tools/spec-loader.js.map +1 -1
- package/dist/src/tools/spec-writer.d.ts +5 -0
- package/dist/src/tools/spec-writer.d.ts.map +1 -1
- package/dist/src/tools/spec-writer.js +27 -0
- package/dist/src/tools/spec-writer.js.map +1 -1
- package/dist/src/tools/store-knowhow.d.ts.map +1 -1
- package/dist/src/tools/store-knowhow.js +56 -27
- package/dist/src/tools/store-knowhow.js.map +1 -1
- package/package.json +1 -1
- package/workflows/execute.md +1 -1
- package/workflows/harvest.md +13 -13
- package/workflows/knowhow.md +72 -11
- package/workflows/learn.md +70 -58
- package/workflows/milestone-complete.md +1 -1
- package/workflows/retrospective.md +50 -56
- package/workflows/specs-load.md +15 -14
- package/workflows/tools-spec.md +65 -0
- package/workflows/ui-codify-extract.md +373 -0
- package/workflows/ui-codify-knowhow.md +258 -0
- package/workflows/ui-codify-package.md +161 -0
- package/workflows/ui-codify.md +225 -0
- package/workflows/verify.md +1 -1
- package/workflows/wiki-connect.md +7 -7
- package/workflows/wiki-digest.md +13 -13
- package/workflows/wiki-manage.md +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codify-to-knowhow
|
|
3
|
+
description: Manifest-driven knowledge asset generator — converts any structured package into maestro knowhow + spec entries with ref linking. Triggers on "codify-to-knowhow", "style to knowhow", "知识固化".
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, TodoWrite
|
|
5
|
+
auto-continue: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Codify to Knowhow
|
|
9
|
+
|
|
10
|
+
通用 manifest 驱动的知识资产生成器。读取 `knowhow-manifest.json`,按声明创建 knowhow 文件和 spec 条目,通过 ref 建立索引-详文桥梁。
|
|
11
|
+
|
|
12
|
+
**适用场景**: 任何工作流产出需要固化为知识资产时使用。上游 skill(如 `maestro-ui-codify`)负责生成 manifest,本 skill 负责执行知识写入。
|
|
13
|
+
|
|
14
|
+
## Architecture Overview
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
18
|
+
│ Codify to Knowhow (SKILL.md) — Manifest-Driven │
|
|
19
|
+
│ → Read manifest → Create knowhow → Create specs → Verify │
|
|
20
|
+
└──────────────────────────┬──────────────────────────────────┘
|
|
21
|
+
│
|
|
22
|
+
┌──────────┬───────────┼───────────┬──────────┐
|
|
23
|
+
↓ ↓ ↓ ↓ │
|
|
24
|
+
┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │
|
|
25
|
+
│Phase 1 │ │Phase 2 │ │Phase 3 │ │Phase 4 │ │
|
|
26
|
+
│ Load │ │Generate│ │Generate│ │ Index │ │
|
|
27
|
+
│Manifest│ │Knowhow │ │ Specs │ │ Verify │ │
|
|
28
|
+
└───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘ │
|
|
29
|
+
│ │ │ │ │
|
|
30
|
+
manifest AST-/DCS- spec-entry verified │
|
|
31
|
+
parsed files + ref assets │
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Key Design Principles
|
|
35
|
+
|
|
36
|
+
1. **Manifest 驱动**: 所有行为由 `knowhow-manifest.json` 声明,不含硬编码领域知识
|
|
37
|
+
2. **幂等执行**: 每个写入前按 slug 检查已存在资产,存在则跳过
|
|
38
|
+
3. **ref 桥梁**: spec-entry 通过 `ref` 引用 knowhow 详文
|
|
39
|
+
4. **闭合标签**: 所有条目使用 `<spec-entry>`/`<knowhow-entry>` 闭合标签
|
|
40
|
+
5. **上游生成 manifest**: 本 skill 不做知识提取,只做知识写入
|
|
41
|
+
|
|
42
|
+
## Manifest Format
|
|
43
|
+
|
|
44
|
+
`knowhow-manifest.json` 由上游 skill 生成,放在 package 目录中:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"slug": "my-style-v1",
|
|
49
|
+
"domain": "ui-design",
|
|
50
|
+
"roles": ["implement", "review"],
|
|
51
|
+
"packagePath": ".workflow/reference_style/my-style-v1",
|
|
52
|
+
|
|
53
|
+
"knowhow": [
|
|
54
|
+
{
|
|
55
|
+
"prefix": "AST",
|
|
56
|
+
"fileSlug": "tokens",
|
|
57
|
+
"title": "Design Tokens",
|
|
58
|
+
"category": "asset",
|
|
59
|
+
"assetType": "design-tokens",
|
|
60
|
+
"codePaths": ["src/styles/"],
|
|
61
|
+
"tags": ["design-tokens", "colors"],
|
|
62
|
+
"entries": [
|
|
63
|
+
{
|
|
64
|
+
"category": "pattern",
|
|
65
|
+
"keywords": "colors,tokens",
|
|
66
|
+
"title": "Color System",
|
|
67
|
+
"body": "## Colors\n\n..."
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
|
|
73
|
+
"specs": [
|
|
74
|
+
{
|
|
75
|
+
"category": "coding",
|
|
76
|
+
"keywords": "colors,design-tokens",
|
|
77
|
+
"title": "颜色编码约定",
|
|
78
|
+
"ref": "knowhow/AST-my-style-v1-tokens.md",
|
|
79
|
+
"body": "主色使用 var(--color-primary)..."
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Execution Flow
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Input: <package-path> (must contain knowhow-manifest.json)
|
|
89
|
+
|
|
90
|
+
Phase 1: Load and Validate Manifest
|
|
91
|
+
└─ Ref: phases/01-load-manifest.md
|
|
92
|
+
├─ Validate package path and manifest existence
|
|
93
|
+
├─ Parse knowhow-manifest.json
|
|
94
|
+
└─ Output: manifest object
|
|
95
|
+
|
|
96
|
+
Phase 2: Generate Knowhow Assets
|
|
97
|
+
└─ Ref: phases/02-generate-knowhow.md
|
|
98
|
+
├─ Idempotency check per file
|
|
99
|
+
├─ Write knowhow files per manifest.knowhow[]
|
|
100
|
+
└─ Output: knowhowPaths[]
|
|
101
|
+
|
|
102
|
+
Phase 3: Generate Spec Entries
|
|
103
|
+
└─ Ref: phases/03-generate-specs.md
|
|
104
|
+
├─ Idempotency check per entry
|
|
105
|
+
├─ Write spec entries per manifest.specs[]
|
|
106
|
+
└─ Output: specEntryCount
|
|
107
|
+
|
|
108
|
+
Phase 4: Index and Verify
|
|
109
|
+
└─ Ref: phases/04-index-verify.md
|
|
110
|
+
└─ Output: verification report
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Phase Reference Documents**:
|
|
114
|
+
|
|
115
|
+
| Phase | Document | Purpose |
|
|
116
|
+
|-------|----------|---------|
|
|
117
|
+
| 1 | [phases/01-load-manifest.md](phases/01-load-manifest.md) | Load and validate manifest |
|
|
118
|
+
| 2 | [phases/02-generate-knowhow.md](phases/02-generate-knowhow.md) | Create knowhow files |
|
|
119
|
+
| 3 | [phases/03-generate-specs.md](phases/03-generate-specs.md) | Create spec entries with ref |
|
|
120
|
+
| 4 | [phases/04-index-verify.md](phases/04-index-verify.md) | Verify assets and index |
|
|
121
|
+
|
|
122
|
+
## Core Rules
|
|
123
|
+
|
|
124
|
+
1. **Manifest 必需**: 无 manifest 则报错退出
|
|
125
|
+
2. **幂等写入**: 同 slug 文件存在则跳过
|
|
126
|
+
3. **闭合标签**: 所有 entry 使用闭合标签格式
|
|
127
|
+
4. **Auto-Continue**: Phase 完成后自动执行下一 Phase
|
|
128
|
+
5. **不提取知识**: 本 skill 只写入,知识提取由上游完成
|
|
129
|
+
|
|
130
|
+
## Data Flow
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Input (packagePath)
|
|
134
|
+
↓
|
|
135
|
+
Phase 1 → manifest: { slug, knowhow[], specs[] }
|
|
136
|
+
↓
|
|
137
|
+
Phase 2 → knowhowPaths: string[], knowhowIds: string[]
|
|
138
|
+
↓
|
|
139
|
+
Phase 3 → specEntryCount: number
|
|
140
|
+
↓
|
|
141
|
+
Phase 4 → verificationResult
|
|
142
|
+
↓
|
|
143
|
+
Completion report
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## TodoWrite Pattern
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
[
|
|
150
|
+
{"content": "Phase 1: 加载 Manifest", "status": "in_progress"},
|
|
151
|
+
{"content": "Phase 2: 生成 Knowhow 资产", "status": "pending"},
|
|
152
|
+
{"content": "Phase 3: 生成 Spec 条目", "status": "pending"},
|
|
153
|
+
{"content": "Phase 4: 索引验证", "status": "pending"}
|
|
154
|
+
]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Error Handling
|
|
158
|
+
|
|
159
|
+
- **Manifest 不存在**: 报告错误,提示上游 skill 需先生成 manifest
|
|
160
|
+
- **Manifest 格式错误**: 报告缺失字段
|
|
161
|
+
- **幂等冲突**: 跳过已存在资产,报告跳过数量
|
|
162
|
+
- **CLI 失败**: 回退到 Write tool 直接写文件
|
|
163
|
+
|
|
164
|
+
## Related Commands
|
|
165
|
+
|
|
166
|
+
**上游**: `maestro-ui-codify`, `learn-decompose`, 或任何生成 manifest 的 skill
|
|
167
|
+
**后续**: `maestro wiki list --category coding`, `maestro spec load --keyword <slug>`
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Phase 1: Load and Validate Manifest
|
|
2
|
+
|
|
3
|
+
读取和验证 `knowhow-manifest.json`。
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- 验证 package path 存在
|
|
8
|
+
- 验证 `knowhow-manifest.json` 存在并可解析
|
|
9
|
+
- 提取 manifest 结构供后续 phase 使用
|
|
10
|
+
|
|
11
|
+
## Execution
|
|
12
|
+
|
|
13
|
+
### Step 1.1: Validate Package Path
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
package_path="${PACKAGE_PATH}"
|
|
17
|
+
|
|
18
|
+
# 验证目录存在
|
|
19
|
+
test -d "$package_path" || { echo "ERROR: Package path not found: $package_path"; exit 1; }
|
|
20
|
+
|
|
21
|
+
# 验证 manifest 存在
|
|
22
|
+
manifest_file="${package_path}/knowhow-manifest.json"
|
|
23
|
+
test -f "$manifest_file" || { echo "ERROR: knowhow-manifest.json not found in $package_path"; exit 1; }
|
|
24
|
+
|
|
25
|
+
echo "Package: $package_path"
|
|
26
|
+
echo "Manifest: $manifest_file"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 1.2: Read and Parse Manifest
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
Read("${package_path}/knowhow-manifest.json")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**必需字段验证**:
|
|
36
|
+
|
|
37
|
+
| 字段 | 必需 | 说明 |
|
|
38
|
+
|------|------|------|
|
|
39
|
+
| `slug` | 是 | 包名 slug,用于文件命名 |
|
|
40
|
+
| `roles` | 是 | 角色标注数组 |
|
|
41
|
+
| `knowhow` | 是 | knowhow 资产声明数组(可为空) |
|
|
42
|
+
| `specs` | 是 | spec 条目声明数组(可为空) |
|
|
43
|
+
| `domain` | 否 | 领域标识(如 ui-design, api, data) |
|
|
44
|
+
| `packagePath` | 否 | 原始包路径(元数据) |
|
|
45
|
+
|
|
46
|
+
**knowhow[] 每项必需字段**:
|
|
47
|
+
|
|
48
|
+
| 字段 | 说明 |
|
|
49
|
+
|------|------|
|
|
50
|
+
| `prefix` | 文件前缀: AST, DCS, BLP, TIP, RCP, REF 等 |
|
|
51
|
+
| `fileSlug` | 文件名后缀(如 "tokens" → AST-{slug}-tokens.md) |
|
|
52
|
+
| `title` | 文档标题 |
|
|
53
|
+
| `category` | knowhow 类别: asset, decision, blueprint, tip, recipe, reference |
|
|
54
|
+
| `tags` | 标签数组 |
|
|
55
|
+
| `body` | Markdown 正文内容 |
|
|
56
|
+
|
|
57
|
+
**可选字段**: `assetType`, `codePaths`, `entries[]`(`<knowhow-entry>` 子条目)
|
|
58
|
+
|
|
59
|
+
**specs[] 每项必需字段**:
|
|
60
|
+
|
|
61
|
+
| 字段 | 说明 |
|
|
62
|
+
|------|------|
|
|
63
|
+
| `category` | spec 类别: coding, arch, quality, debug, test, review, learning |
|
|
64
|
+
| `title` | 条目标题 |
|
|
65
|
+
| `keywords` | 关键词(逗号分隔字符串) |
|
|
66
|
+
| `body` | 条目正文 |
|
|
67
|
+
|
|
68
|
+
**可选字段**: `ref`(引用 knowhow 文件路径)
|
|
69
|
+
|
|
70
|
+
### Step 1.3: Validate and Summarize
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const manifest = JSON.parse(manifestContent);
|
|
74
|
+
|
|
75
|
+
// 必需字段检查
|
|
76
|
+
const required = ['slug', 'roles', 'knowhow', 'specs'];
|
|
77
|
+
const missing = required.filter(f => !manifest[f]);
|
|
78
|
+
if (missing.length > 0) {
|
|
79
|
+
REPORT("ERROR: Missing required fields: " + missing.join(', '));
|
|
80
|
+
EXIT(1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 摘要
|
|
84
|
+
REPORT(`Manifest loaded:
|
|
85
|
+
Slug: ${manifest.slug}
|
|
86
|
+
Domain: ${manifest.domain || 'generic'}
|
|
87
|
+
Roles: ${manifest.roles.join(', ')}
|
|
88
|
+
Knowhow assets: ${manifest.knowhow.length}
|
|
89
|
+
Spec entries: ${manifest.specs.length}
|
|
90
|
+
`);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Output
|
|
94
|
+
|
|
95
|
+
- **Variable**: `manifest` — 解析后的 manifest 对象
|
|
96
|
+
- **Variable**: `slug` — `manifest.slug`
|
|
97
|
+
- **TodoWrite**: Mark Phase 1 completed, Phase 2 in_progress
|
|
98
|
+
|
|
99
|
+
## Next Phase
|
|
100
|
+
|
|
101
|
+
Return to orchestrator, then auto-continue to [Phase 2: Generate Knowhow](02-generate-knowhow.md).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Phase 2: Generate Knowhow Assets
|
|
2
|
+
|
|
3
|
+
按 `manifest.knowhow[]` 声明创建 knowhow 文件。
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- 遍历 `manifest.knowhow[]` 数组
|
|
8
|
+
- 每个条目生成对应的 knowhow 文件
|
|
9
|
+
- 幂等:同名文件存在则跳过
|
|
10
|
+
|
|
11
|
+
## Execution
|
|
12
|
+
|
|
13
|
+
### Step 2.1: Ensure Directory
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mkdir -p .workflow/knowhow
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Step 2.2: Iterate and Write
|
|
20
|
+
|
|
21
|
+
对 `manifest.knowhow[]` 中的每一项执行:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
for (const asset of manifest.knowhow) {
|
|
25
|
+
const filename = `${asset.prefix}-${manifest.slug}-${asset.fileSlug}.md`;
|
|
26
|
+
const filepath = `.workflow/knowhow/${filename}`;
|
|
27
|
+
|
|
28
|
+
// 幂等检查
|
|
29
|
+
if (fileExists(filepath)) {
|
|
30
|
+
REPORT(`SKIP: ${filename} (already exists)`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 构建 frontmatter
|
|
35
|
+
let frontmatter = `---
|
|
36
|
+
title: ${asset.title}
|
|
37
|
+
type: ${asset.category}`;
|
|
38
|
+
|
|
39
|
+
if (asset.assetType) {
|
|
40
|
+
frontmatter += `\nassetType: ${asset.assetType}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
frontmatter += `\nroles: [${manifest.roles.join(', ')}]`;
|
|
44
|
+
|
|
45
|
+
if (asset.codePaths && asset.codePaths.length > 0) {
|
|
46
|
+
frontmatter += `\ncodePaths:`;
|
|
47
|
+
for (const cp of asset.codePaths) {
|
|
48
|
+
frontmatter += `\n - ${cp}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
frontmatter += `\ntags: [${asset.tags.join(', ')}]`;
|
|
53
|
+
frontmatter += `\n---`;
|
|
54
|
+
|
|
55
|
+
// 构建 body
|
|
56
|
+
let body = asset.body || '';
|
|
57
|
+
|
|
58
|
+
// 如果有 entries[],生成 <knowhow-entry> 闭合标签
|
|
59
|
+
if (asset.entries && asset.entries.length > 0) {
|
|
60
|
+
const today = new Date().toISOString().split('T')[0];
|
|
61
|
+
for (let i = 0; i < asset.entries.length; i++) {
|
|
62
|
+
const entry = asset.entries[i];
|
|
63
|
+
const entryId = `${asset.prefix}-${manifest.slug}-${String(i + 1).padStart(3, '0')}`;
|
|
64
|
+
body += `\n\n<knowhow-entry keywords="${entry.category},${entry.keywords}" date="${today}" id="${entryId}" roles="${manifest.roles.join(',')}" source="codify-to-knowhow">
|
|
65
|
+
|
|
66
|
+
### ${entry.title}
|
|
67
|
+
|
|
68
|
+
${entry.body}
|
|
69
|
+
|
|
70
|
+
</knowhow-entry>`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const content = `${frontmatter}\n\n${body}`;
|
|
75
|
+
Write(filepath, content);
|
|
76
|
+
REPORT(`CREATED: ${filename}`);
|
|
77
|
+
knowhowPaths.push(filepath);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 2.3: Collect Results
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
const knowhowPaths = []; // 已创建的文件路径
|
|
85
|
+
const skippedCount = manifest.knowhow.length - knowhowPaths.length;
|
|
86
|
+
|
|
87
|
+
REPORT(`Knowhow assets: ${knowhowPaths.length} created, ${skippedCount} skipped`);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output
|
|
91
|
+
|
|
92
|
+
- **Variable**: `knowhowPaths` — 已创建的文件路径列表
|
|
93
|
+
- **TodoWrite**: Mark Phase 2 completed, Phase 3 in_progress
|
|
94
|
+
|
|
95
|
+
## Next Phase
|
|
96
|
+
|
|
97
|
+
Return to orchestrator, then auto-continue to [Phase 3: Generate Specs](03-generate-specs.md).
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Phase 3: Generate Spec Entries
|
|
2
|
+
|
|
3
|
+
按 `manifest.specs[]` 声明写入 spec 条目。
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- 遍历 `manifest.specs[]` 数组
|
|
8
|
+
- 每个条目追加到对应的 spec 文件
|
|
9
|
+
- 幂等:同 title 的条目已存在则跳过
|
|
10
|
+
- 使用 `<spec-entry>` 闭合标签格式
|
|
11
|
+
|
|
12
|
+
## Execution
|
|
13
|
+
|
|
14
|
+
### Step 3.1: Idempotency Check
|
|
15
|
+
|
|
16
|
+
对每个 spec 条目,检查是否已存在同 title 的 entry:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 按 keyword 搜索
|
|
20
|
+
maestro spec load --keyword "${manifest.slug}" --json 2>/dev/null | head -5
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 3.2: Iterate and Write
|
|
24
|
+
|
|
25
|
+
对 `manifest.specs[]` 中的每一项执行:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const today = new Date().toISOString().split('T')[0];
|
|
29
|
+
let specEntryCount = 0;
|
|
30
|
+
|
|
31
|
+
for (const spec of manifest.specs) {
|
|
32
|
+
// spec.category 决定目标文件
|
|
33
|
+
const categoryFileMap = {
|
|
34
|
+
coding: 'coding-conventions.md',
|
|
35
|
+
arch: 'architecture-constraints.md',
|
|
36
|
+
quality: 'quality-rules.md',
|
|
37
|
+
debug: 'debug-notes.md',
|
|
38
|
+
test: 'test-conventions.md',
|
|
39
|
+
review: 'review-standards.md',
|
|
40
|
+
learning: 'learnings.md'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const targetFile = `.workflow/specs/${categoryFileMap[spec.category]}`;
|
|
44
|
+
|
|
45
|
+
// 幂等检查:grep title 是否已存在
|
|
46
|
+
const titleExists = Bash(`grep -q "${spec.title}" "${targetFile}" 2>/dev/null && echo "exists" || echo "new"`);
|
|
47
|
+
|
|
48
|
+
if (titleExists.trim() === 'exists') {
|
|
49
|
+
REPORT(`SKIP spec: "${spec.title}" (already exists in ${spec.category})`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 构建 spec-entry 闭合标签
|
|
54
|
+
let refAttr = '';
|
|
55
|
+
if (spec.ref) {
|
|
56
|
+
refAttr = `\n ref="${spec.ref}"`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const entryBlock = `
|
|
60
|
+
|
|
61
|
+
<spec-entry category="${spec.category}" keywords="${spec.keywords}" date="${today}"${refAttr}>
|
|
62
|
+
|
|
63
|
+
### ${spec.title}
|
|
64
|
+
|
|
65
|
+
${spec.body}
|
|
66
|
+
|
|
67
|
+
</spec-entry>`;
|
|
68
|
+
|
|
69
|
+
// 追加到目标文件
|
|
70
|
+
// 优先使用 maestro spec add CLI
|
|
71
|
+
const cliResult = Bash(`maestro spec add ${spec.category} "${spec.title}" "${spec.body}" --keywords "${spec.keywords}" 2>/dev/null`);
|
|
72
|
+
|
|
73
|
+
if (cliResult.exitCode !== 0) {
|
|
74
|
+
// 回退:直接追加到文件
|
|
75
|
+
Edit(targetFile, { append: entryBlock });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
specEntryCount++;
|
|
79
|
+
REPORT(`CREATED spec: "${spec.title}" → ${spec.category}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
REPORT(`Spec entries: ${specEntryCount} created`);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Output
|
|
86
|
+
|
|
87
|
+
- **Variable**: `specEntryCount` — 创建的 spec 条目数量
|
|
88
|
+
- **TodoWrite**: Mark Phase 3 completed, Phase 4 in_progress
|
|
89
|
+
|
|
90
|
+
## Next Phase
|
|
91
|
+
|
|
92
|
+
Return to orchestrator, then auto-continue to [Phase 4: Index and Verify](04-index-verify.md).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Phase 4: Index and Verify
|
|
2
|
+
|
|
3
|
+
刷新 wiki 索引,验证所有创建的资产已正确索引和链接。
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- 刷新 wiki-index.json 以包含新创建的资产
|
|
8
|
+
- 验证 knowhow 文件存在并已索引
|
|
9
|
+
- 验证 spec 条目已写入
|
|
10
|
+
- 验证 ref 链接从 spec 指向 knowhow
|
|
11
|
+
- 输出完成报告
|
|
12
|
+
|
|
13
|
+
## Execution
|
|
14
|
+
|
|
15
|
+
### Step 4.1: Refresh Wiki Index
|
|
16
|
+
|
|
17
|
+
触发 wiki 索引刷新以识别新增的 knowhow 文件:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 刷新 wiki 索引
|
|
21
|
+
maestro wiki health 2>/dev/null || echo "Wiki index refresh skipped (command not available)"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
索引刷新确保 `wiki-index.json` 包含新创建的 AST-/DCS- 文件的 WikiEntry。
|
|
25
|
+
|
|
26
|
+
### Step 4.2: Verify Knowhow Files
|
|
27
|
+
|
|
28
|
+
检查所有预期的 knowhow 文件是否存在:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
echo "=== Knowhow 资产验证 ==="
|
|
32
|
+
|
|
33
|
+
# 必需文件
|
|
34
|
+
for file in ${knowhowPaths}; do
|
|
35
|
+
if test -f "$file"; then
|
|
36
|
+
echo " OK: $file"
|
|
37
|
+
else
|
|
38
|
+
echo " MISSING: $file"
|
|
39
|
+
fi
|
|
40
|
+
done
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 4.3: Verify Spec Entries
|
|
44
|
+
|
|
45
|
+
检查 spec 文件中是否包含新增的条目:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
echo "=== Spec 条目验证 ==="
|
|
49
|
+
|
|
50
|
+
# 检查 coding-conventions.md 中是否含 slug 相关条目
|
|
51
|
+
grep -c "${slug}" .workflow/specs/coding-conventions.md 2>/dev/null && \
|
|
52
|
+
echo " OK: coding-conventions.md (${slug} entries found)" || \
|
|
53
|
+
echo " MISSING: No ${slug} entries in coding-conventions.md"
|
|
54
|
+
|
|
55
|
+
# 检查 architecture-constraints.md 中是否含 slug 相关条目
|
|
56
|
+
grep -c "${slug}" .workflow/specs/architecture-constraints.md 2>/dev/null && \
|
|
57
|
+
echo " OK: architecture-constraints.md (${slug} entries found)" || \
|
|
58
|
+
echo " MISSING: No ${slug} entries in architecture-constraints.md"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 4.4: Verify Ref Links
|
|
62
|
+
|
|
63
|
+
检查 spec 条目中的 ref 属性指向的 knowhow 文件是否存在:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
echo "=== Ref 链接验证 ==="
|
|
67
|
+
|
|
68
|
+
# 从 spec 文件中提取 ref 属性值
|
|
69
|
+
refs=$(grep -oP 'ref="knowhow/[^"]*"' .workflow/specs/coding-conventions.md .workflow/specs/architecture-constraints.md 2>/dev/null | grep "${slug}" || true)
|
|
70
|
+
|
|
71
|
+
if [ -n "$refs" ]; then
|
|
72
|
+
echo "$refs" | while IFS= read -r ref; do
|
|
73
|
+
# 提取文件路径
|
|
74
|
+
filepath=$(echo "$ref" | grep -oP 'knowhow/[^"]*')
|
|
75
|
+
if test -f ".workflow/$filepath"; then
|
|
76
|
+
echo " OK: $filepath"
|
|
77
|
+
else
|
|
78
|
+
echo " BROKEN: $filepath (file not found)"
|
|
79
|
+
fi
|
|
80
|
+
done
|
|
81
|
+
else
|
|
82
|
+
echo " WARNING: No ref links found for ${slug}"
|
|
83
|
+
fi
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 4.5: Generate Completion Report
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
=== Codify to Knowhow 完成 ===
|
|
90
|
+
|
|
91
|
+
包: {slug}
|
|
92
|
+
来源: {packagePath}
|
|
93
|
+
|
|
94
|
+
Knowhow 资产:
|
|
95
|
+
AST-{slug}-tokens.md — 设计 token 资产
|
|
96
|
+
AST-{slug}-components.md — 组件模式资产
|
|
97
|
+
DCS-{slug}-decisions.md — 设计决策 {仅当有冲突}
|
|
98
|
+
|
|
99
|
+
Spec 条目 ({specEntryCount} 条):
|
|
100
|
+
coding: 颜色约定, 排版约定, 间距约定
|
|
101
|
+
arch: 组件分类约束{, 设计决策约束 — 仅当有冲突}
|
|
102
|
+
|
|
103
|
+
Ref 链接: spec → knowhow 桥梁已建立
|
|
104
|
+
Wiki 索引: 已刷新
|
|
105
|
+
|
|
106
|
+
后续操作:
|
|
107
|
+
maestro wiki list --category coding # 按角色浏览
|
|
108
|
+
maestro spec load --keyword {slug} # 加载相关 spec
|
|
109
|
+
maestro wiki load <id> # 加载详文
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Output
|
|
113
|
+
|
|
114
|
+
- **Report**: 验证结果(所有资产/条目/链接状态)
|
|
115
|
+
- **TodoWrite**: Mark Phase 4 completed (all tasks done)
|
|
116
|
+
|
|
117
|
+
## Completion
|
|
118
|
+
|
|
119
|
+
Codify to Knowhow 已完成。设计包已固化为知识资产。
|