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
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# UI Codify: Phase 2 — Parallel Agent Extraction
|
|
2
|
+
|
|
3
|
+
从源代码文件中提取设计系统 token,通过 3 个并行 Agent 分析。
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
- 3 个 Agent 并行运行:Style、Animation、Layout
|
|
8
|
+
- 每个 Agent 可读取所有文件类型(CSS/SCSS/JS/TS/HTML)进行交叉引用
|
|
9
|
+
- 直接生成完整性报告
|
|
10
|
+
- 优雅的失败处理
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
来自 Phase 1 的变量:
|
|
15
|
+
- `source_path` — 源代码目录绝对路径
|
|
16
|
+
- `temp_dir` — 临时工作区路径
|
|
17
|
+
|
|
18
|
+
## Step 2.1: File Discovery
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
echo "[Phase 2] File Discovery Started"
|
|
22
|
+
echo " Source: ${source_path}"
|
|
23
|
+
|
|
24
|
+
# Discover files using script
|
|
25
|
+
discovery_file="${temp_dir}/.intermediates/import-analysis/discovered-files.json"
|
|
26
|
+
ccw tool exec discover_design_files '{"sourceDir":"'"${source_path}"'","outputPath":"'"${discovery_file}"'"}'
|
|
27
|
+
|
|
28
|
+
echo " Output: ${discovery_file}"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**File Discovery Behavior**:
|
|
32
|
+
- **Automatic discovery**: 智能扫描源目录中所有样式相关文件
|
|
33
|
+
- **Supported file types**: CSS, SCSS, JavaScript, TypeScript, HTML
|
|
34
|
+
- **Smart filtering**: 查找主题相关 JS/TS 文件(tailwind.config.js, theme.js, styled-components 等)
|
|
35
|
+
- **Exclusions**: 自动排除 `node_modules/`, `dist/`, `.git/`, build 目录
|
|
36
|
+
- **Output**: `discovered-files.json` — `{ "css": [...], "js": [...], "html": [...], "counts": {...} }`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 2.2: Parallel Agent Analysis
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
echo "[Phase 2] Starting parallel agent analysis (3 agents)"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Style Agent Task (design-tokens.json)
|
|
47
|
+
|
|
48
|
+
**Agent Task**:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
Task(subagent_type="ui-design-agent",
|
|
52
|
+
run_in_background=false,
|
|
53
|
+
prompt="[STYLE_TOKENS_EXTRACTION]
|
|
54
|
+
Extract visual design tokens from code files using code import extraction pattern.
|
|
55
|
+
|
|
56
|
+
MODE: style-extraction | SOURCE: ${source_path} | BASE_PATH: ${temp_dir}
|
|
57
|
+
|
|
58
|
+
## Input Files
|
|
59
|
+
|
|
60
|
+
**Discovered Files**: ${temp_dir}/.intermediates/import-analysis/discovered-files.json
|
|
61
|
+
$(cat \"${temp_dir}/.intermediates/import-analysis/discovered-files.json\" 2>/dev/null | grep -E '(count|files)' | head -30)
|
|
62
|
+
|
|
63
|
+
## Code Import Extraction Strategy
|
|
64
|
+
|
|
65
|
+
**Step 0: Fast Conflict Detection** (Use Bash/Grep for quick global scan)
|
|
66
|
+
- Quick scan: \`rg --color=never -n "^\\s*--primary:|^\\s*--secondary:|^\\s*--accent:" --type css ${source_path}\` to find core color definitions with line numbers
|
|
67
|
+
- Semantic search: \`rg --color=never -B3 -A1 "^\\s*--primary:" --type css ${source_path}\` to capture surrounding context and comments
|
|
68
|
+
- Core token scan: Search for --primary, --secondary, --accent, --background patterns to detect all theme-critical definitions
|
|
69
|
+
- Pattern: rg → Extract values → Compare → If different → Read full context with comments → Record conflict
|
|
70
|
+
- Alternative (if many files): Execute CLI analysis for comprehensive report:
|
|
71
|
+
\`\`\`bash
|
|
72
|
+
ccw cli -p \"
|
|
73
|
+
PURPOSE: Detect color token conflicts across all CSS/SCSS/JS files
|
|
74
|
+
TASK: • Scan all files for color definitions • Identify conflicting values • Extract semantic comments
|
|
75
|
+
MODE: analysis
|
|
76
|
+
CONTEXT: @**/*.css @**/*.scss @**/*.js @**/*.ts
|
|
77
|
+
EXPECTED: JSON report listing conflicts with file:line, values, semantic context
|
|
78
|
+
RULES: Focus on core tokens | Report ALL variants | analysis=READ-ONLY
|
|
79
|
+
\" --tool gemini --mode analysis --cd ${source_path}
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
**Step 1: Load file list**
|
|
83
|
+
- Read(${temp_dir}/.intermediates/import-analysis/discovered-files.json)
|
|
84
|
+
- Extract: file_types.css.files, file_types.js.files, file_types.html.files
|
|
85
|
+
|
|
86
|
+
**Step 2: Cross-source token extraction**
|
|
87
|
+
- CSS/SCSS: Colors, typography, spacing, shadows, borders
|
|
88
|
+
- JavaScript/TypeScript: Theme configs (Tailwind, styled-components, CSS-in-JS)
|
|
89
|
+
- HTML: Inline styles, usage patterns
|
|
90
|
+
|
|
91
|
+
**Step 3: Validation and Conflict Detection**
|
|
92
|
+
- Report missing tokens WITHOUT inference (mark as \"missing\" in _metadata.completeness)
|
|
93
|
+
- Detect and report inconsistent values across files (list ALL variants with file:line sources)
|
|
94
|
+
- Report missing categories WITHOUT auto-filling (document gaps for manual review)
|
|
95
|
+
- CRITICAL: Verify core tokens (primary, secondary, accent) against semantic comments in source code
|
|
96
|
+
|
|
97
|
+
## Output Files
|
|
98
|
+
|
|
99
|
+
**Target Directory**: ${temp_dir}/style-extraction/style-1/
|
|
100
|
+
|
|
101
|
+
**Files to Generate**:
|
|
102
|
+
1. **design-tokens.json**
|
|
103
|
+
- Follow [DESIGN_SYSTEM_GENERATION_TASK] standard token structure
|
|
104
|
+
- Add \"_metadata.extraction_source\": \"code_import\"
|
|
105
|
+
- Add \"_metadata.files_analyzed\": {css, js, html file lists}
|
|
106
|
+
- Add \"_metadata.completeness\": {status, missing_categories, recommendations}
|
|
107
|
+
- Add \"_metadata.conflicts\": Array of conflicting definitions (MANDATORY if conflicts exist)
|
|
108
|
+
- Add \"_metadata.code_snippets\": Map of code snippets (see below)
|
|
109
|
+
- Add \"_metadata.usage_recommendations\": Usage patterns from code (see below)
|
|
110
|
+
- Include \"source\" field for each token (e.g., \"file.css:23\")
|
|
111
|
+
|
|
112
|
+
**Code Snippet Recording**:
|
|
113
|
+
- For each extracted token, record the actual code snippet in `_metadata.code_snippets`
|
|
114
|
+
- Structure:
|
|
115
|
+
```json
|
|
116
|
+
\"code_snippets\": {
|
|
117
|
+
\"file.css:23\": {
|
|
118
|
+
\"lines\": \"23-27\",
|
|
119
|
+
\"snippet\": \":root {\\n --color-primary: oklch(0.5555 0.15 270);\\n /* Primary brand color */\\n --color-primary-hover: oklch(0.6 0.15 270);\\n}\",
|
|
120
|
+
\"context\": \"css-variable\"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
- Context types: \"css-variable\" | \"css-class\" | \"js-object\" | \"js-theme-config\" | \"inline-style\"
|
|
125
|
+
- Record complete code blocks with all dependencies and relevant comments
|
|
126
|
+
- Typical ranges: Simple declarations (1-5 lines), Utility classes (5-15 lines), Complete configs (15-50 lines)
|
|
127
|
+
- Preserve original formatting and indentation
|
|
128
|
+
|
|
129
|
+
**Conflict Detection and Reporting**:
|
|
130
|
+
- When the same token is defined differently across multiple files, record in `_metadata.conflicts`
|
|
131
|
+
- Follow Agent schema for conflicts array structure (see ui-design-agent.md)
|
|
132
|
+
- Each conflict MUST include: token_name, category, all definitions with context, selected_value, selection_reason
|
|
133
|
+
- Selection priority:
|
|
134
|
+
1. Definitions with semantic comments explaining intent (/* Blue theme */, /* Primary brand color */)
|
|
135
|
+
2. Definitions that align with overall color scheme described in comments
|
|
136
|
+
3. When in doubt, report ALL variants and flag for manual review in completeness.recommendations
|
|
137
|
+
|
|
138
|
+
**Usage Recommendations Generation**:
|
|
139
|
+
- Analyze code usage patterns to extract `_metadata.usage_recommendations` (see ui-design-agent.md schema)
|
|
140
|
+
- **Typography recommendations**:
|
|
141
|
+
* `common_sizes`: Identify most frequent font size usage (e.g., \"body_text\": \"base (1rem)\")
|
|
142
|
+
* `common_combinations`: Extract heading+body pairings from actual usage (e.g., h1 with p tags)
|
|
143
|
+
- **Spacing recommendations**:
|
|
144
|
+
* `size_guide`: Categorize spacing values into tight/normal/loose based on frequency
|
|
145
|
+
* `common_patterns`: Extract frequent padding/margin combinations from components
|
|
146
|
+
- Analysis method: Scan code for class/style usage frequency, extract patterns from component implementations
|
|
147
|
+
- Optional: If insufficient usage data, mark fields as empty arrays/objects with note in completeness.recommendations
|
|
148
|
+
|
|
149
|
+
## Code Import Specific Requirements
|
|
150
|
+
- ✅ Read discovered-files.json FIRST to get file paths
|
|
151
|
+
- ✅ Track extraction source for each token (file:line)
|
|
152
|
+
- ✅ Record complete code snippets in _metadata.code_snippets (complete blocks with dependencies/comments)
|
|
153
|
+
- ✅ Include completeness assessment in _metadata
|
|
154
|
+
- ✅ Report inconsistent values with ALL source locations in _metadata.conflicts (DO NOT auto-normalize or choose)
|
|
155
|
+
- ✅ CRITICAL: Verify core theme tokens (primary, secondary, accent) match source code semantic intent
|
|
156
|
+
- ✅ When conflicts exist, prefer definitions with semantic comments explaining intent
|
|
157
|
+
- ❌ NO inference, NO smart filling, NO automatic conflict resolution
|
|
158
|
+
- ❌ NO external research or web searches (code-only extraction)
|
|
159
|
+
")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Animation Agent Task (animation-tokens.json)
|
|
163
|
+
|
|
164
|
+
**Agent Task**:
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
Task(subagent_type="ui-design-agent",
|
|
168
|
+
run_in_background=false,
|
|
169
|
+
prompt="[ANIMATION_TOKEN_GENERATION_TASK]
|
|
170
|
+
Extract animation tokens from code files using code import extraction pattern.
|
|
171
|
+
|
|
172
|
+
MODE: animation-extraction | SOURCE: ${source_path} | BASE_PATH: ${temp_dir}
|
|
173
|
+
|
|
174
|
+
## Input Files
|
|
175
|
+
|
|
176
|
+
**Discovered Files**: ${temp_dir}/.intermediates/import-analysis/discovered-files.json
|
|
177
|
+
$(cat \"${temp_dir}/.intermediates/import-analysis/discovered-files.json\" 2>/dev/null | grep -E '(count|files)' | head -30)
|
|
178
|
+
|
|
179
|
+
## Code Import Extraction Strategy
|
|
180
|
+
|
|
181
|
+
**Step 0: Fast Animation Discovery** (Use Bash/Grep for quick pattern detection)
|
|
182
|
+
- Quick scan: \`rg --color=never -n "@keyframes|animation:|transition:" --type css ${source_path}\` to find animation definitions with line numbers
|
|
183
|
+
- Framework detection: \`rg --color=never "framer-motion|gsap|@react-spring|react-spring" --type js --type ts ${source_path}\` to detect animation frameworks
|
|
184
|
+
- Pattern categorization: \`rg --color=never -B2 -A5 "@keyframes" --type css ${source_path}\` to extract keyframe animations with context
|
|
185
|
+
- Pattern: rg → Identify animation types → Map framework usage → Prioritize extraction targets
|
|
186
|
+
- Alternative (if complex framework mix): Execute CLI analysis for comprehensive report:
|
|
187
|
+
\`\`\`bash
|
|
188
|
+
ccw cli -p \"
|
|
189
|
+
PURPOSE: Detect animation frameworks and patterns
|
|
190
|
+
TASK: • Identify frameworks • Map animation patterns • Categorize by complexity
|
|
191
|
+
MODE: analysis
|
|
192
|
+
CONTEXT: @**/*.css @**/*.scss @**/*.js @**/*.ts
|
|
193
|
+
EXPECTED: JSON report listing frameworks, animation types, file locations
|
|
194
|
+
RULES: Focus on framework consistency | Map all animations | analysis=READ-ONLY
|
|
195
|
+
\" --tool gemini --mode analysis --cd ${source_path}
|
|
196
|
+
\`\`\`
|
|
197
|
+
|
|
198
|
+
**Step 1: Load file list**
|
|
199
|
+
- Read(${temp_dir}/.intermediates/import-analysis/discovered-files.json)
|
|
200
|
+
- Extract: file_types.css.files, file_types.js.files, file_types.html.files
|
|
201
|
+
|
|
202
|
+
**Step 2: Cross-source animation extraction**
|
|
203
|
+
- CSS/SCSS: @keyframes, transitions, animation properties
|
|
204
|
+
- JavaScript/TypeScript: Animation frameworks (Framer Motion, GSAP), CSS-in-JS
|
|
205
|
+
- HTML: Inline styles, data-animation attributes
|
|
206
|
+
|
|
207
|
+
**Step 3: Framework detection & normalization**
|
|
208
|
+
- Detect animation frameworks used (css-animations | framer-motion | gsap | none)
|
|
209
|
+
- Normalize into semantic token system
|
|
210
|
+
- Cross-reference CSS animations with JS configs
|
|
211
|
+
|
|
212
|
+
## Output Files
|
|
213
|
+
|
|
214
|
+
**Target Directory**: ${temp_dir}/animation-extraction/
|
|
215
|
+
|
|
216
|
+
**Files to Generate**:
|
|
217
|
+
1. **animation-tokens.json**
|
|
218
|
+
- Follow [ANIMATION_TOKEN_GENERATION_TASK] standard structure
|
|
219
|
+
- Add \"_metadata.framework_detected\"
|
|
220
|
+
- Add \"_metadata.files_analyzed\"
|
|
221
|
+
- Add \"_metadata.completeness\"
|
|
222
|
+
- Add \"_metadata.code_snippets\": Map of code snippets (same format as Style Agent)
|
|
223
|
+
- Include \"source\" field for each token
|
|
224
|
+
|
|
225
|
+
**Code Snippet Recording**:
|
|
226
|
+
- Record actual animation/transition code in `_metadata.code_snippets`
|
|
227
|
+
- Context types: \"css-keyframes\" | \"css-transition\" | \"js-animation\" | \"framer-motion\" | \"gsap\"
|
|
228
|
+
- Record complete blocks: @keyframes animations (10-30 lines), transition configs (5-15 lines), JS animation objects (15-50 lines)
|
|
229
|
+
- Include all animation steps, timing functions, and related comments
|
|
230
|
+
- Preserve original formatting and framework-specific syntax
|
|
231
|
+
|
|
232
|
+
## Code Import Specific Requirements
|
|
233
|
+
- ✅ Read discovered-files.json FIRST to get file paths
|
|
234
|
+
- ✅ Detect animation framework if present
|
|
235
|
+
- ✅ Track extraction source for each token (file:line)
|
|
236
|
+
- ✅ Record complete code snippets in _metadata.code_snippets (complete animation blocks with all steps/timing)
|
|
237
|
+
- ✅ Normalize framework-specific syntax into standard tokens
|
|
238
|
+
- ❌ NO external research or web searches (code-only extraction)
|
|
239
|
+
")
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Layout Agent Task (layout-templates.json)
|
|
243
|
+
|
|
244
|
+
**Agent Task**:
|
|
245
|
+
|
|
246
|
+
```javascript
|
|
247
|
+
Task(subagent_type="ui-design-agent",
|
|
248
|
+
run_in_background=false,
|
|
249
|
+
prompt="[LAYOUT_TEMPLATE_GENERATION_TASK]
|
|
250
|
+
Extract layout patterns from code files using code import extraction pattern.
|
|
251
|
+
|
|
252
|
+
MODE: layout-extraction | SOURCE: ${source_path} | BASE_PATH: ${temp_dir}
|
|
253
|
+
|
|
254
|
+
## Input Files
|
|
255
|
+
|
|
256
|
+
**Discovered Files**: ${temp_dir}/.intermediates/import-analysis/discovered-files.json
|
|
257
|
+
$(cat \"${temp_dir}/.intermediates/import-analysis/discovered-files.json\" 2>/dev/null | grep -E '(count|files)' | head -30)
|
|
258
|
+
|
|
259
|
+
## Code Import Extraction Strategy
|
|
260
|
+
|
|
261
|
+
**Step 0: Fast Component Discovery** (Use Bash/Grep for quick component scan)
|
|
262
|
+
- Layout pattern scan: \`rg --color=never -n "display:\\s*(grid|flex)|grid-template" --type css ${source_path}\` to find layout systems
|
|
263
|
+
- Component class scan: \`rg --color=never "class.*=.*\\"[^\"]*\\b(btn|button|card|input|modal|dialog|dropdown)" --type html --type js --type ts ${source_path}\` to identify UI components
|
|
264
|
+
- Universal component heuristic: Components appearing in 3+ files = universal, <3 files = specialized
|
|
265
|
+
- Pattern: rg → Count occurrences → Classify by frequency → Prioritize universal components
|
|
266
|
+
- Alternative (if large codebase): Execute CLI analysis for comprehensive categorization:
|
|
267
|
+
\`\`\`bash
|
|
268
|
+
ccw cli -p \"
|
|
269
|
+
PURPOSE: Classify components as universal vs specialized
|
|
270
|
+
TASK: • Identify UI components • Classify reusability • Map layout systems
|
|
271
|
+
MODE: analysis
|
|
272
|
+
CONTEXT: @**/*.css @**/*.scss @**/*.js @**/*.ts @**/*.html
|
|
273
|
+
EXPECTED: JSON report categorizing components, layout patterns, naming conventions
|
|
274
|
+
RULES: Focus on component reusability | Identify layout systems | analysis=READ-ONLY
|
|
275
|
+
\" --tool gemini --mode analysis --cd ${source_path}
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
**Step 1: Load file list**
|
|
279
|
+
- Read(${temp_dir}/.intermediates/import-analysis/discovered-files.json)
|
|
280
|
+
- Extract: file_types.css.files, file_types.js.files, file_types.html.files
|
|
281
|
+
|
|
282
|
+
**Step 2: Cross-source layout extraction**
|
|
283
|
+
- CSS/SCSS: Grid systems, flexbox utilities, layout classes, media queries
|
|
284
|
+
- JavaScript/TypeScript: Layout components (React/Vue), grid configs
|
|
285
|
+
- HTML: Semantic structure, component hierarchies
|
|
286
|
+
|
|
287
|
+
**Component Classification** (MUST annotate in extraction):
|
|
288
|
+
- **Universal Components**: Reusable multi-component templates (buttons, inputs, cards, modals, etc.)
|
|
289
|
+
- **Specialized Components**: Module-specific components from code (feature-specific layouts, custom widgets, domain components)
|
|
290
|
+
|
|
291
|
+
**Step 3: System identification**
|
|
292
|
+
- Detect naming convention (BEM | SMACSS | utility-first | css-modules)
|
|
293
|
+
- Identify layout system (12-column | flexbox | css-grid | custom)
|
|
294
|
+
- Extract responsive strategy and breakpoints
|
|
295
|
+
|
|
296
|
+
## Output Files
|
|
297
|
+
|
|
298
|
+
**Target Directory**: ${temp_dir}/layout-extraction/
|
|
299
|
+
|
|
300
|
+
**Files to Generate**:
|
|
301
|
+
|
|
302
|
+
1. **layout-templates.json**
|
|
303
|
+
- Follow [LAYOUT_TEMPLATE_GENERATION_TASK] standard structure
|
|
304
|
+
- Add \"extraction_metadata\" section:
|
|
305
|
+
* extraction_source: \"code_import\"
|
|
306
|
+
* naming_convention: detected convention
|
|
307
|
+
* layout_system: {type, confidence, source_files}
|
|
308
|
+
* responsive: {breakpoints, mobile_first, source}
|
|
309
|
+
* completeness: {status, missing_items, recommendations}
|
|
310
|
+
* code_snippets: Map of code snippets (same format as Style Agent)
|
|
311
|
+
- For each component in \"layout_templates\":
|
|
312
|
+
* Include \"source\" field (file:line)
|
|
313
|
+
* **Include \"component_type\" field: \"universal\" | \"specialized\"**
|
|
314
|
+
* dom_structure with semantic HTML5
|
|
315
|
+
* css_layout_rules using var() placeholders
|
|
316
|
+
* Add \"description\" field explaining component purpose and classification rationale
|
|
317
|
+
* **Add \"usage_guide\" field for universal components** (see ui-design-agent.md schema):
|
|
318
|
+
- common_sizes: Extract size variants (small/medium/large) from code
|
|
319
|
+
- variant_recommendations: Document when to use each variant (primary/secondary/etc)
|
|
320
|
+
- usage_context: List typical usage scenarios from actual implementation
|
|
321
|
+
- accessibility_tips: Extract ARIA patterns and a11y notes from code
|
|
322
|
+
|
|
323
|
+
**Code Snippet Recording**:
|
|
324
|
+
- Record actual layout/component code in `extraction_metadata.code_snippets`
|
|
325
|
+
- Context types: \"css-grid\" | \"css-flexbox\" | \"css-utility\" | \"html-structure\" | \"react-component\"
|
|
326
|
+
- Record complete blocks: Utility classes (5-15 lines), HTML structures (10-30 lines), React components (20-100 lines)
|
|
327
|
+
- For components: include HTML structure + associated CSS rules + component logic
|
|
328
|
+
- Preserve original formatting and framework-specific syntax
|
|
329
|
+
|
|
330
|
+
## Code Import Specific Requirements
|
|
331
|
+
- ✅ Read discovered-files.json FIRST to get file paths
|
|
332
|
+
- ✅ Detect and document naming conventions
|
|
333
|
+
- ✅ Identify layout system with confidence level
|
|
334
|
+
- ✅ Extract component variants and states from usage patterns
|
|
335
|
+
- ✅ **Classify each component as \"universal\" or \"specialized\"** based on:
|
|
336
|
+
* Universal: Reusable across multiple features (buttons, inputs, cards, modals)
|
|
337
|
+
* Specialized: Feature-specific or domain-specific (checkout form, dashboard widget)
|
|
338
|
+
- ✅ Record complete code snippets in extraction_metadata.code_snippets (complete components/structures)
|
|
339
|
+
- ✅ **Document classification rationale** in component description
|
|
340
|
+
- ✅ **Generate usage_guide for universal components** (REQUIRED):
|
|
341
|
+
* Analyze code to extract size variants (scan for size-related classes/props)
|
|
342
|
+
* Document variant usage from code comments and implementation patterns
|
|
343
|
+
* List usage contexts from component instances in codebase
|
|
344
|
+
* Extract accessibility patterns from ARIA attributes and a11y comments
|
|
345
|
+
* If insufficient data, populate with minimal valid structure and note in completeness
|
|
346
|
+
- ❌ NO external research or web searches (code-only extraction)
|
|
347
|
+
")
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Wait for All Agents
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Agents run in parallel and write separate output files
|
|
354
|
+
# Each agent generates its own JSON directly
|
|
355
|
+
echo "[Phase 2] Parallel agent analysis complete"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Output Files
|
|
359
|
+
|
|
360
|
+
**Directory Structure**:
|
|
361
|
+
```
|
|
362
|
+
${temp_dir}/
|
|
363
|
+
├── style-extraction/
|
|
364
|
+
│ └── style-1/
|
|
365
|
+
│ └── design-tokens.json # Design tokens with code snippets
|
|
366
|
+
├── animation-extraction/
|
|
367
|
+
│ └── animation-tokens.json # Animation tokens with code snippets
|
|
368
|
+
├── layout-extraction/
|
|
369
|
+
│ └── layout-templates.json # Layout patterns with code snippets
|
|
370
|
+
└── .intermediates/
|
|
371
|
+
└── import-analysis/
|
|
372
|
+
└── discovered-files.json # All discovered files
|
|
373
|
+
```
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# UI Codify: Phase 4 — Knowledge Asset Generation
|
|
2
|
+
|
|
3
|
+
读取提取的 JSON 文件,构建 knowhow-manifest.json,调用 codify-to-knowhow 固化为知识资产。
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
来自前序 Phase 的变量:
|
|
8
|
+
- `package_dir` — 包目录(包含所有 token 文件)
|
|
9
|
+
- `package_name` — 包名(用作 slug)
|
|
10
|
+
- `temp_dir` — 临时工作区(清理用)
|
|
11
|
+
|
|
12
|
+
## Step 4.1: Read Extracted Data
|
|
13
|
+
|
|
14
|
+
读取 package_dir 中的 JSON 文件,提取构建 manifest 所需的数据:
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
// 1. Read design-tokens.json
|
|
18
|
+
const designTokens = Read("${package_dir}/design-tokens.json");
|
|
19
|
+
const tokenMetadata = designTokens._metadata || {};
|
|
20
|
+
const codePaths_tokens = Object.keys(tokenMetadata.code_snippets || {}).map(k => k.split(':')[0]);
|
|
21
|
+
const conflicts = tokenMetadata.conflicts || [];
|
|
22
|
+
|
|
23
|
+
// 2. Read layout-templates.json
|
|
24
|
+
const layoutTemplates = Read("${package_dir}/layout-templates.json");
|
|
25
|
+
const extractionMeta = layoutTemplates.extraction_metadata || {};
|
|
26
|
+
const codePaths_layout = Object.keys(extractionMeta.code_snippets || {}).map(k => k.split(':')[0]);
|
|
27
|
+
|
|
28
|
+
// Classify components
|
|
29
|
+
const allComponents = layoutTemplates.layout_templates || [];
|
|
30
|
+
const universalComponents = allComponents.filter(c => c.component_type === 'universal');
|
|
31
|
+
const specializedComponents = allComponents.filter(c => c.component_type === 'specialized');
|
|
32
|
+
|
|
33
|
+
// 3. Read animation-tokens.json (optional)
|
|
34
|
+
let animationTokens = null;
|
|
35
|
+
let codePaths_animation = [];
|
|
36
|
+
try {
|
|
37
|
+
animationTokens = Read("${package_dir}/animation-tokens.json");
|
|
38
|
+
const animMeta = animationTokens._metadata || {};
|
|
39
|
+
codePaths_animation = Object.keys(animMeta.code_snippets || {}).map(k => k.split(':')[0]);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// animation-tokens.json is optional
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 4. Deduplicate code paths
|
|
45
|
+
const allCodePaths = [...new Set([...codePaths_tokens, ...codePaths_layout, ...codePaths_animation])];
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Step 4.2: Build Knowhow Manifest
|
|
51
|
+
|
|
52
|
+
构建 `knowhow-manifest.json`,声明要创建的知识资产和 spec 条目。
|
|
53
|
+
|
|
54
|
+
**Slug**: 使用 `package_name` 作为 slug(已经是 kebab-case)。
|
|
55
|
+
|
|
56
|
+
### Knowhow 资产声明
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"slug": "${package_name}",
|
|
61
|
+
"domain": "ui-design",
|
|
62
|
+
"roles": ["implement", "review"],
|
|
63
|
+
"packagePath": "${package_dir}",
|
|
64
|
+
|
|
65
|
+
"knowhow": [
|
|
66
|
+
{
|
|
67
|
+
"prefix": "AST",
|
|
68
|
+
"fileSlug": "tokens",
|
|
69
|
+
"title": "${package_name} Design Tokens",
|
|
70
|
+
"type": "asset",
|
|
71
|
+
"assetType": "design-tokens",
|
|
72
|
+
"codePaths": ["<from allCodePaths — token sources>"],
|
|
73
|
+
"tags": ["design-tokens", "colors", "typography", "spacing", "${package_name}"],
|
|
74
|
+
"body": "## Design Token Reference\n\nExtracted from: ${package_dir}/design-tokens.json\n\n### Colors\n<summarize color categories and count>\n\n### Typography\n<summarize font families, scale>\n\n### Spacing\n<summarize spacing scale>\n\n> Full token data: `${package_dir}/design-tokens.json`",
|
|
75
|
+
"entries": [
|
|
76
|
+
{
|
|
77
|
+
"roles": "implement",
|
|
78
|
+
"keywords": "pattern,colors,design-tokens,${package_name}",
|
|
79
|
+
"title": "Color System",
|
|
80
|
+
"body": "<summarize primary, secondary, accent, semantic colors with values>"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"roles": "implement",
|
|
84
|
+
"keywords": "pattern,typography,design-tokens,${package_name}",
|
|
85
|
+
"title": "Typography Scale",
|
|
86
|
+
"body": "<summarize font families, sizes, weights>"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"roles": "implement",
|
|
90
|
+
"keywords": "pattern,spacing,design-tokens,${package_name}",
|
|
91
|
+
"title": "Spacing System",
|
|
92
|
+
"body": "<summarize spacing scale values>"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"prefix": "AST",
|
|
98
|
+
"fileSlug": "components",
|
|
99
|
+
"title": "${package_name} Component Patterns",
|
|
100
|
+
"type": "asset",
|
|
101
|
+
"assetType": "component-patterns",
|
|
102
|
+
"codePaths": ["<from allCodePaths — layout sources>"],
|
|
103
|
+
"tags": ["components", "layout", "universal", "specialized", "${package_name}"],
|
|
104
|
+
"body": "## Component Pattern Reference\n\nExtracted from: ${package_dir}/layout-templates.json\n\n### Universal Components (${universalComponents.length})\n<list universal component names with descriptions>\n\n### Specialized Components (${specializedComponents.length})\n<list specialized component names with descriptions>\n\n> Full component data: `${package_dir}/layout-templates.json`",
|
|
105
|
+
"entries": [
|
|
106
|
+
{
|
|
107
|
+
"roles": "implement",
|
|
108
|
+
"keywords": "pattern,universal,components,${package_name}",
|
|
109
|
+
"title": "Universal Components",
|
|
110
|
+
"body": "<list each universal component: name, purpose, key variants>"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"roles": "implement",
|
|
114
|
+
"keywords": "pattern,specialized,components,${package_name}",
|
|
115
|
+
"title": "Specialized Components",
|
|
116
|
+
"body": "<list each specialized component: name, purpose, usage context>"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
|
|
122
|
+
"specs": [
|
|
123
|
+
{
|
|
124
|
+
"roles": "implement",
|
|
125
|
+
"keywords": "coding,colors,design-tokens,${package_name}",
|
|
126
|
+
"title": "${package_name} 颜色编码约定",
|
|
127
|
+
"ref": "knowhow/AST-${package_name}-tokens.md",
|
|
128
|
+
"body": "<summarize: 主色使用 var(--color-primary),语义色映射规则,色彩命名约定>"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"roles": "implement",
|
|
132
|
+
"keywords": "coding,typography,design-tokens,${package_name}",
|
|
133
|
+
"title": "${package_name} 排版编码约定",
|
|
134
|
+
"ref": "knowhow/AST-${package_name}-tokens.md",
|
|
135
|
+
"body": "<summarize: 字体家族使用规则,字号层级,font-weight 约定>"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"roles": "implement",
|
|
139
|
+
"keywords": "coding,spacing,design-tokens,${package_name}",
|
|
140
|
+
"title": "${package_name} 间距编码约定",
|
|
141
|
+
"ref": "knowhow/AST-${package_name}-tokens.md",
|
|
142
|
+
"body": "<summarize: 间距 token 使用规则,padding/margin 约定>"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"roles": "plan",
|
|
146
|
+
"keywords": "arch,components,classification,${package_name}",
|
|
147
|
+
"title": "${package_name} 组件分类约束",
|
|
148
|
+
"ref": "knowhow/AST-${package_name}-components.md",
|
|
149
|
+
"body": "<summarize: universal vs specialized 分类标准,复用规则>"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Conditional: DCS Decision Asset (仅当存在冲突时)
|
|
156
|
+
|
|
157
|
+
当 `conflicts.length > 0` 时,添加以下到 knowhow 数组:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"prefix": "DCS",
|
|
162
|
+
"fileSlug": "decisions",
|
|
163
|
+
"title": "${package_name} Design Decisions",
|
|
164
|
+
"type": "decision",
|
|
165
|
+
"tags": ["design-decisions", "conflicts", "${package_name}"],
|
|
166
|
+
"body": "## Design Conflict Decisions\n\n<for each conflict: describe token, list variants with sources, document selected value and reasoning>",
|
|
167
|
+
"entries": [
|
|
168
|
+
{
|
|
169
|
+
"roles": "plan",
|
|
170
|
+
"keywords": "decision,conflict,resolution,${package_name}",
|
|
171
|
+
"title": "Token Conflict Resolutions",
|
|
172
|
+
"body": "<summarize each conflict: token name, file sources, chosen value, rationale>"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
同时添加到 specs 数组:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"roles": "plan",
|
|
183
|
+
"keywords": "arch,design-decisions,conflicts,${package_name}",
|
|
184
|
+
"title": "${package_name} 设计决策约束",
|
|
185
|
+
"ref": "knowhow/DCS-${package_name}-decisions.md",
|
|
186
|
+
"body": "<summarize: 冲突解决策略,优先级规则>"
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Step 4.3: Write Manifest
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
Write("${package_dir}/knowhow-manifest.json", JSON.stringify(manifest, null, 2));
|
|
196
|
+
echo " knowhow-manifest.json written to ${package_dir}"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Step 4.4: Call codify-to-knowhow
|
|
202
|
+
|
|
203
|
+
通过 Skill tool 调用 codify-to-knowhow:
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
Skill("codify-to-knowhow", args="${package_dir}")
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
等待 codify-to-knowhow 完成。它将:
|
|
210
|
+
1. 读取 knowhow-manifest.json
|
|
211
|
+
2. 创建 knowhow 文件(.workflow/knowhow/AST-*.md, DCS-*.md)
|
|
212
|
+
3. 创建 spec 条目(.workflow/specs/coding-conventions.md, architecture-constraints.md)
|
|
213
|
+
4. 验证 ref 链接
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Step 4.5: Cleanup Temporary Workspace
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# 清理临时工作区
|
|
221
|
+
if [ -d "${temp_dir}" ]; then
|
|
222
|
+
rm -rf "${temp_dir}"
|
|
223
|
+
echo " Temp workspace cleaned: ${temp_dir}"
|
|
224
|
+
fi
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Step 4.6: Completion Report
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
UI Design System Codified!
|
|
233
|
+
|
|
234
|
+
Package: ${package_name}
|
|
235
|
+
Location: ${package_dir}
|
|
236
|
+
|
|
237
|
+
Files:
|
|
238
|
+
design-tokens.json Design tokens (colors, typography, spacing)
|
|
239
|
+
layout-templates.json Component patterns (${universalComponents.length} universal, ${specializedComponents.length} specialized)
|
|
240
|
+
animation-tokens.json ${animationTokens ? 'Animation tokens' : '(not found)'}
|
|
241
|
+
preview.html Interactive showcase
|
|
242
|
+
preview.css Showcase styling
|
|
243
|
+
knowhow-manifest.json Knowledge asset manifest
|
|
244
|
+
|
|
245
|
+
Knowledge Assets:
|
|
246
|
+
AST-${package_name}-tokens.md Design token knowhow
|
|
247
|
+
AST-${package_name}-components.md Component pattern knowhow
|
|
248
|
+
${conflicts.length > 0 ? 'DCS-' + package_name + '-decisions.md Design decisions' : ''}
|
|
249
|
+
|
|
250
|
+
Specs: ${specCount} entries (coding: colors/typography/spacing, arch: components${conflicts.length > 0 ? '/decisions' : ''})
|
|
251
|
+
|
|
252
|
+
Open preview:
|
|
253
|
+
file://${absolutePath}/preview.html
|
|
254
|
+
|
|
255
|
+
Next steps:
|
|
256
|
+
maestro wiki list --role implement
|
|
257
|
+
maestro spec load --keyword ${package_name}
|
|
258
|
+
```
|