Commit c2d4c16b27ad2295edf74851737c561b8cae2954

Authored by zichun
1 parent 7244ba41

skeleton-gen: drop sql/migrations/.gitkeep; set tokens.css > prototype precedence for colors

- C.1: stop generating sql/migrations/.gitkeep (A4 db-init's Write V1 creates the dir); README A2 drops 'create empty migrations dir'
- precedence rule: on color conflict, tokens.css wins over prototype (prototype = structure/layout/interaction; tokens.css = color) — encoded in skeleton-gen note, coding.mjs frontend stage, code-reviewer § Design Tokens
README.md
... ... @@ -121,7 +121,7 @@ erp-workflow-plugin/
121 121 |---|---|---|---|
122 122 | A0 | `project-init` | • **依赖检查**:检测 git / mysql / node 是否在 PATH,缺失则按 OS 自动安装,装不上再停下提示用户<br>• 空目录初始化:用 Read/Write/Glob 工具拷模板创建 CLAUDE.md / docs/01/index.md / docs/08<br>• `git init` | `plan-start` |
123 123 | A1 | `scope-lock` | • 引导填项目概述 / 技术栈 / 需求索引<br>• 按 `docs/01-需求清单/<module>/{_module.md, REQ-*.md}` 子目录结构生成 REQ 卡片(CC 据 index.md 填 `{{req_id/title/goal/rules/constraints/acceptance}}` 6 个占位,模板其余内容含输入/输出示例字段表原样复制)<br>• **A1 终结校验**:REQ 6 个占位均填真实数据、无 `{{` 残留、`config-vars.yaml` **全部配置**(包名 / 端口 / 初始账号 + DB 凭据 / 密钥占位)已锁、各 stack 的 build/lint/unit/e2e 命令写入 docs/04 § 零;缺失则在此(Plan 期)用 `AskUserQuestion` 问清(敏感凭据由用户自填,不进会话)<br>• 据模板直接 `Write` 生成 `_module.md` / `REQ-*.md`<br>• 终结校验通过后**自动**调用 `Skill(skeleton-gen)` 进入 A2(不停下) | A0 |
124   -| A2 | `skeleton-gen` | • 生成架构文档:docs/04 § 一+ / docs/07 / docs/09<br>• 生成跨平台工具脚本:`scripts/*.mjs`(**无 chmod**;凭据 / 配置统一在 A1 产出的 config-vars.yaml)<br>• 创建 `sql/migrations/` 空目录(Flyway 准备)<br>• 用 `node ${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs` 合并 .gitignore(逐行判重) | `plan-start` |
  124 +| A2 | `skeleton-gen` | • 生成架构文档:docs/04 § 一+ / docs/07 / docs/09<br>• 生成跨平台工具脚本:`scripts/*.mjs`(**无 chmod**;凭据 / 配置统一在 A1 产出的 config-vars.yaml)<br>• 用 `node ${CLAUDE_PLUGIN_ROOT}/lib/merge-gitignore.mjs` 合并 .gitignore(逐行判重) | `plan-start` |
125 125 | A3 | `db-design-gen` | • A3 起始用 `AskUserQuestion` 确认 ERP 约定(主键策略 / 租户列 / 列前缀规则,默认值可覆盖),结果写 docs/04 + CLAUDE.md<br>• 从 docs/01 REQ 卡片正向设计 `docs/03-数据库设计文档.md`(schema SSoT)<br>• 回填 REQ 卡片依赖表(`TBD(A3 自动补)` → 实际表名)<br>• **停下**等人工审阅 docs/03,审阅完毕用 `/plan-start` 续进 A4 | A2 |
126 126 | A4 | `db-init` | • LLM 解析 docs/03 → `sql/migrations/V1__initial_schema.sql`(DDL only)<br>• `node ${CLAUDE_PLUGIN_ROOT}/lib/validate-ddl.mjs` 校验 DDL ↔ docs/03(5 维:表/列名/列类型/索引/FK),fail-closed<br>• `node ${CLAUDE_PLUGIN_ROOT}/lib/apply-ddl.mjs config-vars.yaml V1.sql`(解析 config-vars.yaml database: 段 + mysql2 apply,**无 shell-source**) | A3 |
127 127 | A5 | `downstream-gen` | • 一次性生成 docs/02 / docs/05 / docs/10<br>• 回填 REQ 卡片依赖接口(`TBD(A5 自动补)` → 实际 endpoint)<br>• 追加模块清单到 docs/08 § 二<br>• **docs/05 + docs/02 评审闸**:用 `AskUserQuestion` 让用户确认 API 端点/字段无误 + 构建顺序可接受,未确认不勾 A5<br>• **prototype/ 门禁 + 推导 FE 清单写 docs/08 § 三**(原 A6 已并入;无 prototype 则问「无前端」→ § 三 留空)<br>• 最终占位符 + 结构残留扫描 | A4 |
... ...
agents/code-reviewer.md
... ... @@ -35,6 +35,7 @@ For each dimension below, classify Critical / Important / Suggestion as above.
35 35 ### 2. Design Tokens (objective → can request-changes)
36 36 - All color values MUST use `var(--color-*)` per `src/styles/tokens.css` (the single token source). Hard-coded hex / rgb → `request-changes` with file:line.
37 37 - New tokens used in code without registration in `src/styles/tokens.css` → `request-changes`.
  38 +- Precedence — **tokens.css > prototype** for colors: if a prototype's literal color differs from the matching `tokens.css` token, using the token (not the prototype's raw color) is correct. Do NOT `request-changes` for a color that differs from the prototype as long as the right token is used. (Prototype governs structure/layout/interaction; tokens.css governs color.)
38 39  
39 40 ### 3. 无障碍 (Accessibility) — best-effort, flag-obvious-only
40 41 - Form controls have `<label>` or `aria-label`.
... ...
skills/plan/skeleton-gen/SKILL.md
... ... @@ -31,7 +31,7 @@ allowed-tools: Read Write Edit Skill Grep Glob AskUserQuestion Bash(node *)
31 31 | `docs/07-环境配置.md` | `${CLAUDE_SKILL_DIR}/templates/docs-07-env-template.md` |
32 32 | `docs/09-项目目录结构.md` | `${CLAUDE_SKILL_DIR}/templates/docs-09-structure-template.md` |
33 33  
34   -> 前端 UI/交互/布局不再单独出文档:项目根 `prototype/` 是完整前端 demo(页面 + 布局 + 交互的权威);Design Tokens 在 `src/styles/tokens.css`;前端编码规范在 docs/04 § 二。
  34 +> 前端 UI/交互/布局不再单独出文档:项目根 `prototype/` 是完整前端 demo(页面 + 布局 + 交互的权威);Design Tokens 在 `src/styles/tokens.css`;前端编码规范在 docs/04 § 二。**色值冲突时 `tokens.css` 优先于 prototype**(prototype 管结构/布局/交互,tokens.css 管色值)。
35 35  
36 36 ### B.2 追加 docs/04 § 一+(保留 § 零 不覆盖)
37 37  
... ... @@ -49,13 +49,14 @@ docs/04 已由 scope-lock 写入 § 零。本步骤追加 § 一 ~ 三。
49 49  
50 50 #### C.1 复制固定模板文件(用 Read + Write,跨平台无 shell)
51 51  
52   -对下表每个文件:用 `Read` 读模板内容,用 `Write` **原样**写到目标路径(`Write` 会自动创建缺失的父目录,无需 `mkdir`)。`.gitkeep` 用 `Write` 写空文件。
  52 +对下表每个文件:用 `Read` 读模板内容,用 `Write` **原样**写到目标路径(`Write` 会自动创建缺失的父目录,无需 `mkdir`)。
53 53  
54 54 | 模板 | 目标路径 |
55 55 |---|---|
56 56 | `${CLAUDE_SKILL_DIR}/templates/scripts-setup-test-db-template.mjs` | `scripts/setup-test-db.mjs` |
57 57 | `${CLAUDE_SKILL_DIR}/templates/styles-tokens-template.css` | `src/styles/tokens.css` |
58   -| (空文件) | `sql/migrations/.gitkeep` |
  58 +
  59 +> `sql/migrations/` 目录不在此预建:A4 `db-init` 写 `V1__initial_schema.sql` 时 `Write` 会自动创建。
59 60  
60 61 > 凭据 / 配置不在此生成:项目**全部配置**(含 DB 凭据 / 密钥)已由 A1 `scope-lock` 写入仓库根 `config-vars.yaml`;`scripts/setup-test-db.mjs` 运行时按 2 层 map 直接读它。
61 62  
... ...
workflows/coding.mjs
... ... @@ -206,7 +206,7 @@ function deriveSpecPrompt(id, phase) {
206 206 `- 关联 REQ 卡片:\`${ROOT}/docs/01-需求清单/<module>/<REQ>.md\`(提取业务校验规则、acceptance、UI 描述)。`,
207 207 `- 关联 prototype:Read \`${ROOT}/prototype/**/*.html\`(含 anchor 时聚焦相应区域),作为页面布局权威。`,
208 208 `- API 契约:\`${ROOT}/docs/05-API接口契约.md\`,按本 FE 关联的 REQ 过滤出消费的端点。`,
209   - `- Design Tokens:\`${ROOT}/src/styles/tokens.css\`(色值 / 状态色单一来源;只用 var(--color-*),禁硬编码 hex)。`,
  209 + `- Design Tokens:\`${ROOT}/src/styles/tokens.css\`(色值 / 状态色单一来源;只用 var(--color-*),禁硬编码 hex)。**与 prototype 的色值冲突时以 tokens.css 为准**(prototype 管结构/布局/交互)。`,
210 210 `- 前端组件库:\`${ROOT}/docs/04-技术规范.md § 零\` 的 \`frontend.ui_lib\`,决定组件选型。`,
211 211 ].join('\n')
212 212 : [
... ...