maestro-flow 0.3.42 → 0.3.44
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 +52 -80
- package/.claude/commands/maestro-ralph.md +2 -2
- package/.claude/commands/maestro-tools-execute.md +117 -0
- package/.claude/commands/maestro-tools-register.md +137 -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 +25 -4
- package/.claude/commands/spec-load.md +26 -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 +144 -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 +17 -4
- package/.codex/skills/spec-load/SKILL.md +24 -28
- package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
- package/.codex/skills/team-review/roles/reviewer/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +1 -1
- package/.codex/skills/team-testing/roles/executor/role.md +1 -1
- package/.codex/skills/team-testing/roles/generator/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/agents/claude-code-adapter.js +4 -2
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +2 -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 +7 -3
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +47 -15
- 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 +1 -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 +3 -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 +67 -21
- 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 +6 -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 +7 -4
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +27 -12
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
- package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +10 -2
- package/dashboard/dist-server/src/tools/spec-entry-parser.js +46 -12
- package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -1
- package/dashboard/dist-server/src/tools/spec-loader.d.ts +6 -2
- package/dashboard/dist-server/src/tools/spec-loader.js +119 -23
- package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
- package/dist/src/commands/knowhow.d.ts.map +1 -1
- package/dist/src/commands/knowhow.js +21 -2
- 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 +78 -4
- 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 +51 -3
- 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 +11 -11
- package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
- package/dist/src/hooks/spec-injector.d.ts +1 -0
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +55 -22
- 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 +10 -2
- package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
- package/dist/src/tools/spec-entry-parser.js +46 -12
- package/dist/src/tools/spec-entry-parser.js.map +1 -1
- package/dist/src/tools/spec-init.d.ts.map +1 -1
- package/dist/src/tools/spec-init.js +19 -0
- package/dist/src/tools/spec-init.js.map +1 -1
- package/dist/src/tools/spec-loader.d.ts +6 -2
- package/dist/src/tools/spec-loader.d.ts.map +1 -1
- package/dist/src/tools/spec-loader.js +119 -23
- package/dist/src/tools/spec-loader.js.map +1 -1
- package/dist/src/tools/spec-writer.d.ts +6 -1
- package/dist/src/tools/spec-writer.d.ts.map +1 -1
- package/dist/src/tools/spec-writer.js +29 -2
- 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/analyze.md +2 -2
- package/workflows/auto-test.md +2 -2
- package/workflows/brainstorm.md +1 -1
- package/workflows/codebase-rebuild.md +1 -1
- package/workflows/codebase-refresh.md +1 -1
- package/workflows/debug.md +1 -1
- package/workflows/execute.md +3 -3
- package/workflows/harvest.md +13 -13
- package/workflows/integration-test.md +2 -2
- package/workflows/issue-discover.md +1 -1
- package/workflows/knowhow.md +72 -11
- package/workflows/learn.md +70 -58
- package/workflows/map.md +1 -1
- package/workflows/milestone-complete.md +2 -2
- package/workflows/plan.md +1 -1
- package/workflows/quick.md +1 -1
- package/workflows/refactor.md +1 -1
- package/workflows/retrospective.md +51 -57
- package/workflows/review.md +1 -1
- package/workflows/roadmap-common.md +1 -1
- package/workflows/specs-add.md +11 -2
- package/workflows/specs-load.md +17 -15
- package/workflows/test-gen.md +1 -1
- package/workflows/tools-spec.md +98 -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: quality-retrospective
|
|
3
|
-
description: Phase retrospective with insight routing to specs and
|
|
3
|
+
description: Phase retrospective with insight routing to specs and knowhow
|
|
4
4
|
argument-hint: "[phase|N..M] [--lens technical|process|quality|decision] [--all] [--no-route] [--compare N] [-y]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -13,7 +13,7 @@ allowed-tools:
|
|
|
13
13
|
- AskUserQuestion
|
|
14
14
|
---
|
|
15
15
|
<purpose>
|
|
16
|
-
Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/
|
|
16
|
+
Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/knowhow/specs/learnings.md` as `<spec-entry>` blocks for cross-phase queryability.
|
|
17
17
|
</purpose>
|
|
18
18
|
|
|
19
19
|
<required_reading>
|
|
@@ -70,9 +70,8 @@ Follow `~/.maestro/workflows/retrospective.md` Stages 1–8 in order. Key invari
|
|
|
70
70
|
- [ ] Spec entries (if any) appended as `<spec-entry>` to matching `.workflow/specs/{category-file}.md`
|
|
71
71
|
- [ ] Issue rows (if any) match canonical issues.jsonl schema (status "open", full issue_history, all required fields)
|
|
72
72
|
- [ ] Note tips (if any) created via `Skill({ skill: "manage-learn", args: "tip ..." })`
|
|
73
|
-
- [ ] `
|
|
74
|
-
- [ ] `learning-index.json` updated and parseable
|
|
73
|
+
- [ ] `specs/learnings.md` appended with one `<spec-entry>` per insight regardless of routing target
|
|
75
74
|
- [ ] No existing phase artifacts modified (verification.json, review.json, plan.json untouched)
|
|
76
75
|
- [ ] Confirmation banner displays routing counts and next-step suggestions
|
|
77
|
-
- [ ] Next step: `/manage-status` to review state, or `/manage-issue list --source retrospective` to triage created issues, or `/manage-learn list` to browse the
|
|
76
|
+
- [ ] Next step: `/manage-status` to review state, or `/manage-issue list --source retrospective` to triage created issues, or `/manage-learn list` to browse the knowhow library
|
|
78
77
|
</success_criteria>
|
|
@@ -54,6 +54,14 @@ Extract conclusions from related artifacts that may affect this review. Pass as
|
|
|
54
54
|
2. **Wiki constraints**: Run `maestro wiki search "architecture constraint" --json 2>/dev/null`. If results found, pass as `wiki_context` to reviewer agents for evaluating code against documented decisions.
|
|
55
55
|
3. Both are optional — proceed without if unavailable.
|
|
56
56
|
|
|
57
|
+
### Role Knowledge
|
|
58
|
+
1. Browse accumulated knowledge for this role:
|
|
59
|
+
`maestro wiki list --role review`
|
|
60
|
+
2. Analyze the index, identify entries relevant to the current task
|
|
61
|
+
3. Load selected documents:
|
|
62
|
+
`maestro wiki load <id1> [id2] [id3...]`
|
|
63
|
+
4. Review loaded knowledge before proceeding
|
|
64
|
+
|
|
57
65
|
**Output**: `REVIEW_DIR = .workflow/scratch/{YYYYMMDD}-review-P{N}-{slug}/` (P{N} = phase number, enables directory-level identification as state.json fallback)
|
|
58
66
|
</context>
|
|
59
67
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-add
|
|
3
|
-
description: Add spec entry by category
|
|
4
|
-
argument-hint: "[--scope project|global|team|personal] <category> <content>"
|
|
3
|
+
description: Add spec entry by category with role tagging
|
|
4
|
+
argument-hint: "[--scope project|global|team|personal] [--roles <csv>] <category> <content>"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Write
|
|
@@ -13,6 +13,7 @@ allowed-tools:
|
|
|
13
13
|
Add a knowledge entry to the specs system using `<spec-entry>` closed-tag format.
|
|
14
14
|
Each category maps 1:1 to a single target file — no dual-write.
|
|
15
15
|
Supports 4 scopes: project (default), global, team, personal.
|
|
16
|
+
Entries use `roles` attribute to declare which agent roles should load them.
|
|
16
17
|
</purpose>
|
|
17
18
|
|
|
18
19
|
<required_reading>
|
|
@@ -20,9 +21,29 @@ Supports 4 scopes: project (default), global, team, personal.
|
|
|
20
21
|
</required_reading>
|
|
21
22
|
|
|
22
23
|
<context>
|
|
23
|
-
$ARGUMENTS -- expects `[--scope <scope>] [--uid <uid>] <category> <content>`
|
|
24
|
+
$ARGUMENTS -- expects `[--scope <scope>] [--uid <uid>] [--roles <csv>] <category> <content>`
|
|
25
|
+
|
|
26
|
+
**Options:**
|
|
27
|
+
- `--roles <csv>` — Comma-separated roles (implement, plan, test, review, analyze, explore). Determines which agents load this entry via `spec load --role`.
|
|
28
|
+
- `--ref <path>` — Create as index entry referencing a knowhow document. If the path exists, only creates the spec index entry. If path doesn't exist, also creates the knowhow file.
|
|
29
|
+
- `--knowhow-type <type>` — Knowhow document type when creating with --ref (asset, blueprint, document, template, recipe, reference, decision)
|
|
24
30
|
|
|
25
31
|
Scope-to-directory mapping, category-to-file mapping, and entry format defined in workflow specs-add.md.
|
|
32
|
+
|
|
33
|
+
**Examples:**
|
|
34
|
+
```bash
|
|
35
|
+
# Tool spec with roles (stored in tools.md)
|
|
36
|
+
/spec-add tools "Integration Test Flow" "## Steps\n1. Setup\n2. Run" --roles "implement,test" --keywords "testing,api"
|
|
37
|
+
|
|
38
|
+
# Tool spec with ref to detailed knowhow
|
|
39
|
+
/spec-add tools "OAuth PKCE Flow" "完整 PKCE 集成流程" --roles "implement" --ref knowhow/RCP-oauth-pkce.md
|
|
40
|
+
|
|
41
|
+
# Standard spec with role
|
|
42
|
+
/spec-add coding "Named exports" "Always use named exports" --roles "implement"
|
|
43
|
+
|
|
44
|
+
# Legacy style (no --roles, backward compat)
|
|
45
|
+
/spec-add arch "OAuth PKCE 集成" "完整流程设计" --ref knowhow/AST-oauth-flow.md
|
|
46
|
+
```
|
|
26
47
|
</context>
|
|
27
48
|
|
|
28
49
|
<execution>
|
|
@@ -34,7 +55,7 @@ Follow '~/.maestro/workflows/specs-add.md' completely.
|
|
|
34
55
|
|------|----------|-------------|-------|
|
|
35
56
|
| E001 | fatal | Category and content are both required | parse_input |
|
|
36
57
|
| E002 | fatal | Specs directory not initialized -- run `maestro spec init --scope <scope>` | validate_entry |
|
|
37
|
-
| E003 | fatal | Invalid category -- must be one of: coding, arch, quality, debug, test, review, learning | parse_input |
|
|
58
|
+
| E003 | fatal | Invalid category -- must be one of: coding, arch, quality, debug, test, review, learning, tools | parse_input |
|
|
38
59
|
| E004 | fatal | Invalid scope -- must be one of: project, global, team, personal | parse_input |
|
|
39
60
|
| E005 | fatal | Personal scope requires uid -- use `--uid` or run `maestro collab join` first | parse_input |
|
|
40
61
|
</error_codes>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-load
|
|
3
3
|
description: Load specs and lessons for current context
|
|
4
|
-
argument-hint: "[--
|
|
4
|
+
argument-hint: "[--role <role>] [--keyword <word>]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Bash
|
|
@@ -9,8 +9,8 @@ allowed-tools:
|
|
|
9
9
|
- Grep
|
|
10
10
|
---
|
|
11
11
|
<purpose>
|
|
12
|
-
Load
|
|
13
|
-
|
|
12
|
+
Load relevant specs filtered by role (primary), category (file-level), and/or keyword (entry-level).
|
|
13
|
+
Role-based loading: loads the role's primary doc in full + matching entries from other files.
|
|
14
14
|
</purpose>
|
|
15
15
|
|
|
16
16
|
<required_reading>
|
|
@@ -20,14 +20,34 @@ Supports filtering by category (file-level) and keyword (entry-level via `<spec-
|
|
|
20
20
|
<context>
|
|
21
21
|
$ARGUMENTS -- optional flags and keyword
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
**Flags:**
|
|
24
|
+
- `--role <role>` — Load by role: primary role doc (full) + cross-file entries with matching roles attr. Roles: implement, plan, test, review, analyze, explore, brainstorm, research.
|
|
25
|
+
- `--keyword <word>` — Filter by keyword within entries
|
|
26
|
+
|
|
27
|
+
**File → Primary Role mapping:**
|
|
28
|
+
| File | Role |
|
|
29
|
+
|------|------|
|
|
30
|
+
| coding-conventions.md | implement |
|
|
31
|
+
| architecture-constraints.md | plan |
|
|
32
|
+
| test-conventions.md | test |
|
|
33
|
+
| review-standards.md | review |
|
|
34
|
+
| debug-notes.md | analyze |
|
|
35
|
+
| quality-rules.md | review |
|
|
36
|
+
| learnings.md | implement |
|
|
37
|
+
| tools.md | _(per-entry roles)_ |
|
|
24
38
|
|
|
25
39
|
**Examples:**
|
|
26
40
|
```
|
|
41
|
+
/spec-load --role implement # coding全文 + 跨文件implement条目
|
|
42
|
+
/spec-load --role review # review-standards + quality-rules + 跨文件review条目
|
|
43
|
+
/spec-load --role implement --keyword auth
|
|
27
44
|
/spec-load --keyword auth
|
|
28
|
-
/spec-load --category coding --keyword naming
|
|
29
|
-
/spec-load --category arch
|
|
30
45
|
```
|
|
46
|
+
|
|
47
|
+
**Ref entries:**
|
|
48
|
+
When loading entries with `ref` attribute, only the summary is shown with a load command:
|
|
49
|
+
→ Detail: maestro wiki load <knowhow-id>
|
|
50
|
+
Use the load command to read the full referenced document.
|
|
31
51
|
</context>
|
|
32
52
|
|
|
33
53
|
<execution>
|
|
@@ -11,7 +11,7 @@ allowed-tools:
|
|
|
11
11
|
---
|
|
12
12
|
<purpose>
|
|
13
13
|
Initialize the project-level specs directory by scanning the codebase for conventions, patterns, and tech stack.
|
|
14
|
-
Core files (coding, arch,
|
|
14
|
+
Core files (coding, arch, knowhow) are always created. Optional files (quality, debug, test, review) are created only when relevant signals are detected.
|
|
15
15
|
All output lands in `.workflow/specs/`.
|
|
16
16
|
</purpose>
|
|
17
17
|
|
|
@@ -44,7 +44,7 @@ Follow '~/.maestro/workflows/specs-setup.md' completely.
|
|
|
44
44
|
|
|
45
45
|
<success_criteria>
|
|
46
46
|
- [ ] `.workflow/specs/` directory created
|
|
47
|
-
- [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `
|
|
47
|
+
- [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `knowhow.md`
|
|
48
48
|
- [ ] Optional files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `debug-notes.md` (on demand), `review-standards.md` (on demand)
|
|
49
49
|
- [ ] Report displayed with summary and next steps
|
|
50
50
|
</success_criteria>
|
|
@@ -56,7 +56,7 @@ Follow '~/.maestro/workflows/wiki-connect.md' completely (Stages 1-6).
|
|
|
56
56
|
- [ ] If --fix: entries updated with new `related` links
|
|
57
57
|
- [ ] If --fix: new health score computed and delta reported
|
|
58
58
|
- [ ] Report written to `wiki-connections-{date}.md`
|
|
59
|
-
- [ ] Graph insights appended to `
|
|
59
|
+
- [ ] Graph insights appended to `specs/learnings.md` as `<spec-entry>` blocks
|
|
60
60
|
- [ ] No unintended entry modifications (only `related` field changed)
|
|
61
61
|
- [ ] Summary displayed with next-step routing
|
|
62
62
|
</success_criteria>
|
|
@@ -48,7 +48,7 @@ Follow '~/.maestro/workflows/wiki-digest.md' completely (Stages 1-8).
|
|
|
48
48
|
| E001 | error | No wiki entries found (empty index) | Initialize wiki content first |
|
|
49
49
|
| E002 | error | Topic search returned 0 results | Broaden topic or check wiki content |
|
|
50
50
|
| W001 | warning | Too few entries (<5) for meaningful theme clustering | Digest produced but themes may be trivial |
|
|
51
|
-
| W002 | warning |
|
|
51
|
+
| W002 | warning | specs/learnings.md not found — skipping cross-reference | Proceed without knowhow context |
|
|
52
52
|
| W003 | warning | Some entry bodies failed to load — partial summaries | Note incomplete entries in digest |
|
|
53
53
|
</error_codes>
|
|
54
54
|
|
|
@@ -57,13 +57,12 @@ Follow '~/.maestro/workflows/wiki-digest.md' completely (Stages 1-8).
|
|
|
57
57
|
- [ ] Baseline health score recorded
|
|
58
58
|
- [ ] Entries clustered into 3-5 semantic themes
|
|
59
59
|
- [ ] Per-theme analysis: summary, key entries, gaps, health
|
|
60
|
-
- [ ] Cross-reference with
|
|
60
|
+
- [ ] Cross-reference with specs/learnings.md completed
|
|
61
61
|
- [ ] Coverage heatmap generated (type × theme matrix)
|
|
62
62
|
- [ ] Knowledge gaps identified with suggested actions
|
|
63
63
|
- [ ] If `--create-issues`: gap issues created in `issues.jsonl` (deduped)
|
|
64
|
-
- [ ] Digest written to `digest-{slug}-{date}.md`
|
|
65
|
-
- [ ] Meta-insights appended to `
|
|
66
|
-
- [ ]
|
|
67
|
-
- [ ] No files modified outside `.workflow/learning/` and `.workflow/issues/` (issues only when `--create-issues`)
|
|
64
|
+
- [ ] Digest written to `KNW-digest-{slug}-{date}.md`
|
|
65
|
+
- [ ] Meta-insights appended to `specs/learnings.md` as `<spec-entry>` blocks
|
|
66
|
+
- [ ] No files modified outside `.workflow/knowhow/` and `.workflow/issues/` (issues only when `--create-issues`)
|
|
68
67
|
- [ ] Summary displayed with key findings and next-step routing
|
|
69
68
|
</success_criteria>
|
|
@@ -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 --role implement`, `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).
|