universal-dev-standards 5.15.1 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +31 -0
  2. package/bundled/ai/standards/forward-derivation-standards.ai.yaml +23 -0
  3. package/bundled/ai/standards/knowledge-graph-memory.ai.yaml +1 -1
  4. package/bundled/core/acceptance-criteria-traceability.md +46 -0
  5. package/bundled/core/forward-derivation-standards.md +19 -0
  6. package/bundled/core/knowledge-graph-memory.md +2 -2
  7. package/bundled/locales/zh-CN/CHANGELOG.md +13 -3
  8. package/bundled/locales/zh-CN/README.md +1 -1
  9. package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +46 -0
  10. package/bundled/locales/zh-CN/core/forward-derivation-standards.md +19 -0
  11. package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +194 -0
  12. package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +135 -40
  13. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +217 -63
  14. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +599 -0
  15. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +92 -25
  16. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +78 -16
  17. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +85 -26
  18. package/bundled/locales/zh-CN/skills/deploy-assistant/SKILL.md +189 -0
  19. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +110 -0
  20. package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +255 -0
  21. package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +70 -11
  22. package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +209 -0
  23. package/bundled/locales/zh-CN/skills/knowledge-graph/SKILL.md +58 -0
  24. package/bundled/locales/zh-CN/skills/knowledge-graph/guide.md +74 -0
  25. package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +125 -8
  26. package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +188 -0
  27. package/bundled/locales/zh-CN/skills/orchestrate/SKILL.md +173 -0
  28. package/bundled/locales/zh-CN/skills/plan/SKILL.md +240 -0
  29. package/bundled/locales/zh-CN/skills/push/SKILL.md +242 -0
  30. package/bundled/locales/zh-CN/skills/retrospective-assistant/SKILL.md +104 -36
  31. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +88 -32
  32. package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +216 -0
  33. package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +149 -0
  34. package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +188 -0
  35. package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +86 -0
  36. package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +476 -0
  37. package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +155 -81
  38. package/bundled/locales/zh-CN/skills/sweep/SKILL.md +151 -0
  39. package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +207 -110
  40. package/bundled/locales/zh-TW/CHANGELOG.md +13 -3
  41. package/bundled/locales/zh-TW/README.md +1 -1
  42. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +46 -0
  43. package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +222 -5
  44. package/bundled/locales/zh-TW/core/contract-testing-standards.md +184 -5
  45. package/bundled/locales/zh-TW/core/cross-flow-regression.md +192 -5
  46. package/bundled/locales/zh-TW/core/forward-derivation-standards.md +19 -0
  47. package/bundled/locales/zh-TW/core/knowledge-graph-memory.md +2 -2
  48. package/bundled/locales/zh-TW/core/release-readiness-gate.md +186 -5
  49. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +21 -42
  50. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +212 -59
  51. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +266 -579
  52. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +91 -26
  53. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +77 -15
  54. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +75 -16
  55. package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +255 -0
  56. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +125 -64
  57. package/bundled/locales/zh-TW/skills/knowledge-graph/SKILL.md +5 -5
  58. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +74 -0
  59. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +128 -11
  60. package/bundled/locales/zh-TW/skills/observability-assistant/guide.md +188 -0
  61. package/bundled/locales/zh-TW/skills/orchestrate/SKILL.md +3 -2
  62. package/bundled/locales/zh-TW/skills/plan/SKILL.md +3 -2
  63. package/bundled/locales/zh-TW/skills/push/SKILL.md +3 -2
  64. package/bundled/locales/zh-TW/skills/retrospective-assistant/SKILL.md +94 -28
  65. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +84 -28
  66. package/bundled/locales/zh-TW/skills/runbook-assistant/guide.md +216 -0
  67. package/bundled/locales/zh-TW/skills/slo-assistant/guide.md +188 -0
  68. package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +476 -0
  69. package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +148 -77
  70. package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +141 -44
  71. package/bundled/skills/brainstorm-assistant/SKILL.md +142 -106
  72. package/bundled/skills/brainstorm-assistant/guide.md +256 -661
  73. package/bundled/skills/commands/brainstorm.md +51 -30
  74. package/bundled/skills/knowledge-graph/SKILL.md +5 -5
  75. package/bundled/skills/knowledge-graph/guide.md +4 -4
  76. package/package.json +2 -2
  77. package/src/commands/check.js +11 -2
  78. package/src/lint/i18n.js +109 -23
  79. package/standards-registry.json +4 -4
  80. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +0 -407
@@ -108,6 +108,27 @@ standard:
108
108
  AC Coverage: <pct>% (<covered>/<implemented_total> implemented ACs)
109
109
  Status: BLOCKED by <not_impl_count> not_implemented AC(s)
110
110
 
111
+ user_doc_coverage:
112
+ description: "Second dimension: are user-facing AC also documented in the user guide? Extends the traceability spine past tests to the user guide (Forward Derivation Standards -> Terminal Projection: User Guide)"
113
+ user_facing_filter:
114
+ rule: "Apply only to user-facing AC — those an end user can directly observe or operate (UI flow, CLI command, user-facing API semantics)"
115
+ excluded: "Internal refactor/module contracts, performance thresholds, security/internal guardrails"
116
+ conservative_default: "When in doubt treat AC as user-facing; excluding requires explicit 'user_facing: false', never silent omission"
117
+ status:
118
+ - status: documented
119
+ symbol: "✅"
120
+ definition: "A user-guide step covers this AC, tagged with the AC's shared T-NNN"
121
+ - status: partial
122
+ symbol: "⚠️"
123
+ definition: "A user-guide step exists but is incomplete or ambiguously tagged"
124
+ - status: undocumented
125
+ symbol: "❌"
126
+ definition: "No user-guide step references this user-facing AC"
127
+ calculation: |
128
+ user_doc_coverage = (documented + partial × 0.5) / (user_facing_ac_count - not_implemented_count) × 100
129
+ non-user-facing AC counted in neither numerator nor denominator; partial = 0.5; not_implemented excluded from denominator
130
+ shared_ruler: "A user-guide step's T-NNN MUST equal a real journey/E2E test id (single spine: test + journey + user guide). A parallel id with no matching test is reported undocumented, never covered"
131
+
111
132
  quality_thresholds:
112
133
  defaults:
113
134
  - name: Minimum AC Coverage
@@ -222,6 +243,16 @@ standard:
222
243
  instruction: Validate generated AC against SMART criteria and testability
223
244
  priority: required
224
245
 
246
+ - id: user-doc-user-facing-only
247
+ trigger: computing the user-doc coverage dimension
248
+ instruction: "Apply user-doc coverage only to user-facing AC; when in doubt treat as user-facing, exclude only with an explicit 'user_facing: false' marking"
249
+ priority: recommended
250
+
251
+ - id: user-doc-shared-tnnn
252
+ trigger: linking a user-guide step to an AC
253
+ instruction: "A user-guide step's T-NNN must equal a real journey/E2E test id; a parallel id with no matching test is reported undocumented, never covered"
254
+ priority: required
255
+
225
256
  related_standards:
226
257
  - forward-derivation-standards.md
227
258
  - spec-driven-development.md
@@ -99,6 +99,20 @@ ac_level_summary:
99
99
  description: "Output AC Level Summary at end of /derive all"
100
100
  format: "| AC | Suggested Level | Rationale |"
101
101
 
102
+ # Terminal Projection: User Guide (extends the chain past tests)
103
+ terminal_projection:
104
+ description: "The user guide is the terminal projection of the derivation chain — the human-readable view of the same workflow E2E/journey tests verify by machine"
105
+ single_source_of_truth: "AC spine — BDD, TDD/IT/E2E, ATDD, contracts, and the user guide are all projections of the same AC"
106
+ user_facing_filter:
107
+ rule: "A user-guide step is required only for an AC an end user can directly observe or operate (UI flow, CLI command, user-facing API semantics)"
108
+ excluded: "Purely internal AC (refactor, internal module contracts, performance thresholds, security controls) carry no user-guide obligation"
109
+ default: "When in doubt, treat the AC as user-facing; explicit marking is required to exclude"
110
+ shared_numbering:
111
+ rule: "Each user-guide step is tagged T-NNN, and that T-NNN MUST be the id of a real journey/E2E test"
112
+ ambiguous: "Ambiguous or missing tags are reported as uncovered (prefer redundancy over omission)"
113
+ violation: "Minting a parallel T-NNN-style series detached from the AC spine"
114
+ single_spine_principle: "Test and documentation sources are layered projections of one AC spine (N×1), not independent sources cross-checking one another pairwise (N×N); TDD/IT/E2E are pyramid layers of the same spine, not rival sources"
115
+
102
116
  # Certainty Framework
103
117
  certainty_framework:
104
118
  tags:
@@ -171,6 +185,15 @@ rules:
171
185
  - id: ac-level-summary
172
186
  instruction: Output AC Level Summary table at end of /derive all
173
187
  priority: recommended
188
+ - id: single-spine-no-parallel-numbering
189
+ instruction: Every test/doc artifact must trace back to the AC spine; never mint a parallel T-NNN-style series detached from it
190
+ priority: required
191
+ - id: user-guide-shared-tnnn
192
+ instruction: A user-guide step's T-NNN must equal a real journey/E2E test id; ambiguous or missing tags are reported as uncovered
193
+ priority: required
194
+ - id: user-facing-ac-conservative-default
195
+ instruction: User-guide obligation applies to user-facing AC only; when in doubt treat as user-facing, explicit marking to exclude
196
+ priority: recommended
174
197
 
175
198
  related_standards:
176
199
  - reverse-engineering-standards.md
@@ -62,7 +62,7 @@ standard:
62
62
  always_available: true
63
63
  service:
64
64
  description: "Graph engine indexed: a single multi-hop query (impact-analysis {nodeId, maxHops}) returns the full cross-domain chain"
65
- example_engine: "CodeSage (@asiaostrich/codesage)"
65
+ example_engine: "EngramGraph (engramgraph)"
66
66
 
67
67
  confidence:
68
68
  optional: true
@@ -140,6 +140,52 @@ The gate clears only when all `not_implemented` ACs are updated to `uncovered`,
140
140
 
141
141
  ---
142
142
 
143
+ ## User-Documentation Coverage | 使用者文件覆蓋
144
+
145
+ The AC↔test matrix above verifies that AC are *tested*. A second dimension verifies that **user-facing AC are also documented** for the end user. This extends the traceability spine past tests to the user guide — see Forward Derivation Standards → *Terminal Projection: User Guide*. The user guide and the journey/E2E suite are two projections of one workflow, so they share one ruler: `T-NNN`.
146
+
147
+ ### User-Facing AC Filter
148
+
149
+ Apply the user-doc dimension **only to user-facing AC** — those an end user can directly observe or operate. This prevents the dimension from degrading into a blanket documentation obligation on every internal AC.
150
+
151
+ | AC kind | User-facing? |
152
+ |---------|--------------|
153
+ | UI flow, screen, navigation | Yes |
154
+ | CLI command / flag a user runs | Yes |
155
+ | User-facing API semantics (public contract a user calls) | Yes |
156
+ | Internal refactor / module contract | No |
157
+ | Performance threshold, capacity | No |
158
+ | Security control, internal guardrail | No |
159
+
160
+ **Conservative default**: when in doubt, treat the AC as user-facing. Excluding an AC requires **explicit marking** (e.g. `user_facing: false`), never silent omission.
161
+
162
+ ### User-Doc Status
163
+
164
+ Reuse the same symbols, now answering "is this user-facing AC covered by a user-guide step?":
165
+
166
+ | Status | Symbol | Definition |
167
+ |--------|--------|------------|
168
+ | **Documented** | ✅ | A user-guide step covers this AC, tagged with the AC's shared `T-NNN` |
169
+ | **Partial** | ⚠️ | A user-guide step exists but is incomplete or ambiguously tagged |
170
+ | **Undocumented** | ❌ | No user-guide step references this user-facing AC |
171
+
172
+ `not_implemented` (🚫) AC are excluded from the user-doc denominator, exactly as in the test-coverage calculation.
173
+
174
+ ### User-Doc Coverage Calculation
175
+
176
+ ```
177
+ User-Doc Coverage % = (documented + partial × 0.5) / (user_facing_ac_count - not_implemented_count) × 100
178
+
179
+ Where:
180
+ user_facing_ac_count = count of AC classified user-facing (conservative default applies)
181
+ non-user-facing AC are counted in neither numerator nor denominator
182
+ partial counts as 0.5
183
+ ```
184
+
185
+ > **Single ruler**: a user-guide step's `T-NNN` MUST equal a real journey/E2E test id (Forward Derivation Standards). This binds three projections of one AC — test, journey, and user guide — to a single spine. A user-guide step that mints a parallel id with no matching test is reported as **undocumented**, never as covered.
186
+
187
+ ---
188
+
143
189
  ## Quality Thresholds
144
190
 
145
191
  ### Default Thresholds
@@ -515,6 +515,25 @@ spec-review → forward-derivation → discovery
515
515
 
516
516
  ---
517
517
 
518
+ ## Terminal Projection: User Guide | 終端投影:使用者指南
519
+
520
+ The derivation chain does not stop at tests. The **user guide is the terminal projection** of the same chain — the human-readable view of the very workflow that E2E/journey tests verify by machine. "What the user reads as steps" and "what E2E actually verifies as behavior" become one maintained invariant.
521
+
522
+ - **Single source of truth**: the SPEC's acceptance criteria (AC). Every downstream artifact — BDD scenarios, TDD/IT/E2E skeletons, ATDD tables, contracts, **and the user guide** — is a projection of the same AC spine. The user guide is not a separate source to be cross-checked; it is one more projection.
523
+ - **User-facing AC only**: a user-guide step is required only for an AC that an **end user can directly observe or operate** (UI flow, CLI command, user-facing API semantics). Purely internal AC (refactor, internal module contracts, performance thresholds, security controls) carry no user-guide obligation. **When in doubt, treat the AC as user-facing** — conservative default; explicit marking is required to exclude.
524
+ - **Shared numbering (`T-NNN`)**: each user-guide step is tagged `T-NNN`, and that `T-NNN` MUST be the id of a real journey/E2E test. The user guide and the E2E suite are two projections of one workflow sharing one ruler. Ambiguous or missing tags are reported as **uncovered** (prefer redundancy over omission).
525
+ - ✅ user-guide step `T-012 "Create a project"` ↔ E2E test `T-012` in the journey spec.
526
+ - ❌ user guide invents `UG-3` with no corresponding test → drift, reported as uncovered.
527
+ - **Drift example**: user guide says "2-click checkout" while E2E still verifies "3-step payment" — without shared numbering, no one notices. Shared `T-NNN` turns this drift into a reported coverage gap.
528
+
529
+ ### Single-Spine Principle (not parallel cross-check)
530
+
531
+ Test and documentation sources are **multiple layered projections of one AC spine**, not independent sources of truth that cross-check one another. TDD/IT/E2E are pyramid *layers* of the same spine (see Test Level Decision Tree), not rival sources. Cross-checking N sources pairwise (N×N) breeds drift; projecting each artifact back to the single AC spine (N×1) eliminates it.
532
+
533
+ > **Rule**: every test or documentation artifact MUST trace back to an AC. Minting a **parallel numbering scheme** — a second `T-NNN`-style series detached from the AC spine — is a VIOLATION. There is one ruler: the AC spine, with `T-NNN` shared between journey/E2E tests and the user guide.
534
+
535
+ ---
536
+
518
537
  ## Test Level Decision Tree
519
538
 
520
539
  根據 AC 的性質決定應生成哪種測試層級:
@@ -13,7 +13,7 @@
13
13
 
14
14
  This standard defines a **relationship schema** so that specifications, decisions, and code can be traversed as a graph — answering questions like *"if I change `execute()`, which specs and decisions are affected?"*. It complements vector/semantic memory (which finds *similar* artifacts) with **structural traversal** (which finds *connected* artifacts).
15
15
 
16
- The schema is engine-agnostic: it is expressed as plain Markdown front-matter that an AI assistant can read directly (degraded mode), and that an optional graph engine (e.g. [CodeSage](https://github.com/AsiaOstrich/CodeSage)) can index for multi-hop queries (service mode).
16
+ The schema is engine-agnostic: it is expressed as plain Markdown front-matter that an AI assistant can read directly (degraded mode), and that an optional graph engine (e.g. [EngramGraph](https://github.com/AsiaOstrich/EngramGraph)) can index for multi-hop queries (service mode).
17
17
 
18
18
  ---
19
19
 
@@ -60,7 +60,7 @@ related: [XSPEC-204]
60
60
  ```markdown
61
61
  ---
62
62
  id: DEC-069
63
- title: CodeSage Architecture
63
+ title: EngramGraph Architecture
64
64
  date: 2026-05-27
65
65
  supersedes: [DEC-057]
66
66
  impacts: [XSPEC-237]
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  source: ../../CHANGELOG.md
3
- source_version: 5.15.1
4
- translation_version: 5.15.1
5
- last_synced: 2026-05-31
3
+ source_version: 5.16.0
4
+ translation_version: 5.16.0
5
+ last_synced: 2026-06-08
6
6
  status: current
7
7
  ---
8
8
 
@@ -17,6 +17,16 @@ status: current
17
17
 
18
18
  ## [Unreleased]
19
19
 
20
+ ## [5.16.0] - 2026-06-08
21
+
22
+ ### 新增 — 测试推导链延伸至用户指南(XSPEC-260)
23
+
24
+ - **`core/forward-derivation-standards.md`**:新增 `## Terminal Projection: User Guide`(终端投影:用户指南)段 + `### Single-Spine Principle`(单一主干原则)。把推导管道从测试延伸到用户指南——用户指南是 journey/E2E 测试以机器验证的同一条 AC 主干的终端投影。定义共用 `T-NNN` 编号(用户指南步骤的 `T-NNN` 必须等于某个真实 journey/E2E 测试的 id)、user-facing AC 筛选与保守预设,以及单一主干原则:测试/文件来源是同一 AC 主干的 N×1 投影、非 N×N 平行对照;另立平行编号体系即为违规。
25
+ - **`ai/standards/forward-derivation-standards.ai.yaml`**:对应 `terminal_projection` 区块 + 3 条 rules(`single-spine-no-parallel-numbering`、`user-guide-shared-tnnn`、`user-facing-ac-conservative-default`)。
26
+ - **`core/acceptance-criteria-traceability.md`**:新增 `## User-Documentation Coverage`(用户文件覆盖)维度——追踪 user-facing AC 是否被用户指南记载。含 user-facing AC 筛选(保守预设:判不准归 user-facing)、沿用 ✅/⚠️/❌ 状态,及排除非 user-facing 与 `not_implemented` AC 的覆盖率公式。
27
+ - **`ai/standards/acceptance-criteria-traceability.ai.yaml`**:对应 `user_doc_coverage` 区块 + 2 条 rules(`user-doc-user-facing-only`、`user-doc-shared-tnnn`)。
28
+ - **zh-TW / zh-CN 语言版**:两标准的新段落均完整翻译。
29
+
20
30
  ## [5.15.0] - 2026-05-28
21
31
 
22
32
  ### 新增 — i18n 分层语言策略(XSPEC-239)
@@ -14,7 +14,7 @@ status: current
14
14
 
15
15
  > **语言**: [English](../../README.md) | [繁體中文](../zh-TW/README.md) | 简体中文
16
16
 
17
- **版本**: 5.15.1 | **发布日期**: 2026-05-28 | **授权**: [双重授权](../../LICENSE) (CC BY 4.0 + MIT)
17
+ **版本**: 5.16.0 | **发布日期**: 2026-05-28 | **授权**: [双重授权](../../LICENSE) (CC BY 4.0 + MIT)
18
18
 
19
19
  语言无关、框架无关的软件项目文档标准。通过 AI 原生工作流,确保不同技术栈之间的一致性、质量和可维护性。
20
20
 
@@ -116,6 +116,52 @@ Coverage = (5 + 2×0.5) / 8 = 6/8 = 75%
116
116
 
117
117
  ---
118
118
 
119
+ ## 用户文件覆盖
120
+
121
+ 上方的 AC↔测试矩阵验证 AC 是否被*测试*。第二个维度则验证 **user-facing AC 是否同时被用户指南记载**。这把可追溯主干从测试延伸到用户指南——见正向推演标准 →《终端投影:用户指南》。用户指南与 journey/E2E 套件是同一作业流程的两个投影,因此共用一把尺:`T-NNN`。
122
+
123
+ ### User-Facing AC 筛选
124
+
125
+ 此维度**只套用于 user-facing AC**——终端用户可直接观察或操作者。如此可避免此维度退化成对每个内部 AC 的全面文件义务。
126
+
127
+ | AC 类型 | user-facing? |
128
+ |---------|--------------|
129
+ | UI 流程、画面、导航 | 是 |
130
+ | 用户执行的 CLI 指令/标志 | 是 |
131
+ | 对外 API 的用户语义(用户调用的公开契约)| 是 |
132
+ | 内部重构/模块契约 | 否 |
133
+ | 性能门槛、容量 | 否 |
134
+ | 安全内控、内部护栏 | 否 |
135
+
136
+ **保守预设**:判不准时一律归 user-facing。排除某个 AC 必须**明确标记**(如 `user_facing: false`),绝不静默省略。
137
+
138
+ ### 用户文件状态
139
+
140
+ 沿用相同符号,改回答「此 user-facing AC 是否被某个用户指南步骤覆盖?」:
141
+
142
+ | 状态 | 符号 | 定义 |
143
+ |------|------|------|
144
+ | **已记载** | ✅ | 有用户指南步骤覆盖此 AC,并标上该 AC 共用的 `T-NNN` |
145
+ | **部分** | ⚠️ | 有用户指南步骤但不完整或标记模棱两可 |
146
+ | **未记载** | ❌ | 无任何用户指南步骤引用此 user-facing AC |
147
+
148
+ `not_implemented`(🚫)AC 排除于用户文件分母之外,与测试覆盖率计算一致。
149
+
150
+ ### 用户文件覆盖率计算
151
+
152
+ ```
153
+ 用户文件覆盖率 % = (已记载 + 部分 × 0.5) / (user_facing_ac_count - not_implemented_count) × 100
154
+
155
+ 其中:
156
+ user_facing_ac_count = 归类为 user-facing 的 AC 数(套用保守预设)
157
+ 非 user-facing AC 不计入分子也不计入分母
158
+ 部分计为 0.5
159
+ ```
160
+
161
+ > **同一把尺**:用户指南步骤的 `T-NNN` 必须等于某个真实 journey/E2E 测试的 id(正向推演标准)。这把同一 AC 的三个投影——测试、journey、用户指南——绑到单一主干。自造平行 id 却无对应测试的用户指南步骤,一律报为**未记载**,绝不算覆盖。
162
+
163
+ ---
164
+
119
165
  ## 品质门槛
120
166
 
121
167
  ### 默认门槛
@@ -333,6 +333,25 @@ spec-review → forward-derivation → discovery
333
333
 
334
334
  ---
335
335
 
336
+ ## 终端投影:用户指南
337
+
338
+ 推演链不止于测试。**用户指南是同一条链的终端投影**——E2E/旅程测试以机器验证的那条作业流程,其供人阅读的视图。「用户读到的操作步骤」与「E2E 实际验证的行为」因此成为一个被维持的不变量。
339
+
340
+ - **单一真实来源**:SPEC 的验收条件(AC)。所有下游产物——BDD 场景、TDD/IT/E2E 骨架、ATDD 表格、契约,**以及用户指南**——都是同一条 AC 主干的投影。用户指南不是另一个要互相对照的来源,而是又一个投影。
341
+ - **仅限 user-facing AC**:唯有**终端用户可直接观察或操作**的 AC(UI 流程、CLI 指令、对外 API 的用户语义)才需要用户指南步骤。纯内部 AC(重构、内部模块契约、性能门槛、安全内控)无用户指南义务。**判不准时一律归 user-facing**——保守预设;必须明确标记才能排除。
342
+ - **共用编号(`T-NNN`)**:每个用户指南步骤标 `T-NNN`,且该 `T-NNN` 必须是某个真实 journey/E2E 测试的 id。用户指南与 E2E 套件是同一作业流程的两个投影、共用一把尺。模棱两可或未标记一律报为**未覆盖**(宁可冗余不要遗漏)。
343
+ - ✅ 用户指南步骤 `T-012「创建项目」` ↔ journey spec 中的 E2E 测试 `T-012`。
344
+ - ❌ 用户指南自造 `UG-3` 却无对应测试 → drift,报为未覆盖。
345
+ - **Drift 反例**:用户指南写「2-click checkout」、E2E 却仍验「3-step payment」——没有共用编号就无人察觉。共用 `T-NNN` 把这种 drift 变成被报出的覆盖缺口。
346
+
347
+ ### 单一主干原则(非平行对照)
348
+
349
+ 测试与文件来源是**同一条 AC 主干的多层投影**,不是互相对照的独立真实来源。TDD/IT/E2E 是同一主干的金字塔**层级**(依 AC 性质分层),非彼此竞争的来源。两两对照 N 个来源(N×N)会滋生 drift;把每个产物投影回单一 AC 主干(N×1)则消除它。
350
+
351
+ > **规则**:每个测试或文件产物都必须回溯到某个 AC。另立**平行编号体系**——一条脱离 AC 主干的第二套 `T-NNN` 系列——即为违规。只有一把尺:AC 主干,且 `T-NNN` 由 journey/E2E 测试与用户指南共用。
352
+
353
+ ---
354
+
336
355
  ## 命令
337
356
 
338
357
  ### 命令参考
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: ac-coverage
3
+ source: ../../../../skills/ac-coverage/SKILL.md
4
+ source_version: 1.0.0
5
+ translation_version: 1.0.0
6
+ last_synced: 2026-06-02
7
+ source_hash: f8358fa818e4
8
+ scope: universal
9
+ status: current
10
+ description: "[UDS] 分析验收条件(AC)与测试之间的追踪关系并生成覆盖率报告"
11
+ allowed-tools: Read, Grep, Glob
12
+ argument-hint: "[规格文件路径]"
13
+ ---
14
+
15
+ # AC 覆盖率助手
16
+
17
+ > **语言**: [English](../../../../skills/ac-coverage/SKILL.md) | 简体中文
18
+
19
+ 分析验收条件(AC)与测试之间的追踪关系,并生成覆盖率报告。
20
+
21
+ ## 与 `/coverage` 的区别
22
+
23
+ | 方面 | `/coverage` | `/ac-coverage` |
24
+ |------|-------------|----------------|
25
+ | **范围** | 代码层级(行数/分支/函数) | 需求层级(AC 对应测试) |
26
+ | **输入** | 源代码 + 测试运行器 | SPEC 文件 + 测试标注 |
27
+ | **问题** | 「代码测试了多少?」 | 「哪些 AC 有测试?」 |
28
+ | **输出** | 覆盖率百分比 | 追踪矩阵 + 缺口报告 |
29
+
30
+ ## 工作流程
31
+
32
+ 1. **解析 SPEC** — 从规格文件中抽取 AC 定义(AC-1, AC-2, ...)
33
+ 2. **扫描测试** — 依标准链接约定搜索测试文件中的 `@AC` 与 `@SPEC` 标注
34
+ 3. **构建矩阵** — 将每个 AC 对应到其测试引用(文件、测试名称、行号)
35
+ 4. **分类状态** — 将每个 AC 标记为 ✅ 已覆盖、⚠️ 部分覆盖、或 ❌ 未覆盖
36
+ 5. **计算覆盖率** — 套用公式:`覆盖率 % = (已覆盖 + 部分覆盖 × 0.5) / 总数 × 100`
37
+ 6. **生成报告** — 输出标准化的 Markdown 报告
38
+
39
+ ## 链接标注约定
40
+
41
+ 测试**必须**使用标准标注引用其来源 AC:
42
+
43
+ ```typescript
44
+ // TypeScript/JavaScript
45
+ describe('AC-1: User login with valid credentials', () => {
46
+ // @AC AC-1
47
+ // @SPEC SPEC-001
48
+ it('should redirect to dashboard on successful login', () => { ... });
49
+ });
50
+ ```
51
+
52
+ ```python
53
+ # Python
54
+ class TestAC1_UserLogin:
55
+ """AC-1: User login with valid credentials
56
+ @AC AC-1
57
+ @SPEC SPEC-001
58
+ """
59
+ def test_redirect_to_dashboard(self): ...
60
+ ```
61
+
62
+ ```gherkin
63
+ # BDD Feature
64
+ @SPEC-001 @AC-1
65
+ Scenario: User login with valid credentials
66
+ ```
67
+
68
+ ## 覆盖率门槛
69
+
70
+ | 门槛 | 默认值 | 强制等级 |
71
+ |------|--------|----------|
72
+ | **签入(Check-in)** | 80% | feature branch 合并必要条件 |
73
+ | **发布(Release)** | 100% | 生产环境发布必要条件 |
74
+ | **警告(Warning)** | 60% | 触发覆盖率警告 |
75
+
76
+ 门槛可通过 `--threshold` 参数或项目配置文件调整。
77
+
78
+ ## 四层追溯(`--full` 模式)
79
+
80
+ 使用 `--full` 标记将追溯从 2 层(AC→Test)扩展为 4 层。
81
+
82
+ ### 追溯层次
83
+
84
+ ```
85
+ Layer 0:需求 / 用户故事 (REQ)
86
+ ↓ (定义)
87
+ Layer 1:验收条件 (AC)
88
+ ↓ (@AC 标注)
89
+ Layer 2:测试用例
90
+ ↓ (覆盖)
91
+ Layer 3:源代码 (@implements)
92
+ ```
93
+
94
+ ### 各层标注约定
95
+
96
+ ```typescript
97
+ // Layer 3→1:代码引用 AC
98
+ // @implements AC-1, AC-2
99
+ function authenticate(user: string, pass: string) { ... }
100
+ ```
101
+
102
+ ```markdown
103
+ <!-- Layer 0→1:SPEC 中的需求 -->
104
+ ## Requirements
105
+ ### REQ-1:用户验证
106
+ - AC-1: 给定有效凭证,当登录时,则验证通过
107
+ - AC-2: 给定无效凭证,当登录时,则被拒绝
108
+ ```
109
+
110
+ ### 完整追溯报告
111
+
112
+ ```markdown
113
+ ## 四层追溯矩阵
114
+
115
+ | 需求 | AC | 测试 | 代码 | 状态 |
116
+ |------|-----|------|------|------|
117
+ | REQ-1 | AC-1 | auth.test.ts:15 | auth.ts:42 | ✅ 完整 |
118
+ | REQ-1 | AC-2 | auth.test.ts:30 | auth.ts:58 | ✅ 完整 |
119
+ | REQ-2 | AC-3 | — | dashboard.ts:10 | ⚠️ 缺测试 |
120
+ | REQ-3 | AC-4 | export.test.ts:5 | — | ⚠️ 缺代码 |
121
+
122
+ ### 缺口摘要
123
+ - Layer 0→1: 2 个需求未对应 AC
124
+ - Layer 1→2: 1 个 AC 未对应测试
125
+ - Layer 2→3: 0 个测试未对应代码
126
+ - Layer 3→1: 3 个代码文件未对应 AC
127
+ ```
128
+
129
+ ### 反向追溯
130
+
131
+ 使用 `--trace-code <path>` 从代码反向追溯到需求。
132
+
133
+ ```bash
134
+ /ac-coverage --trace-code src/auth.ts
135
+ # 输出:
136
+ # src/auth.ts:42 → @implements AC-1 → REQ-1 (SPEC-AUTH-001)
137
+ # src/auth.ts:58 → @implements AC-2 → REQ-1 (SPEC-AUTH-001)
138
+ ```
139
+
140
+ ## 报告格式
141
+
142
+ 生成的报告遵循 `core/acceptance-criteria-traceability.md` 的标准格式:
143
+
144
+ ```markdown
145
+ # AC 覆盖率报告
146
+
147
+ **规格**: SPEC-001 — 功能名称
148
+ **生成时间**: 2026-03-18
149
+ **覆盖率**: 75% (6/8 AC)
150
+
151
+ ## 摘要
152
+
153
+ | 状态 | 数量 | 百分比 |
154
+ |------|------|--------|
155
+ | ✅ 已覆盖 | 5 | 62.5% |
156
+ | ⚠️ 部分覆盖 | 2 | 25.0% |
157
+ | ❌ 未覆盖 | 1 | 12.5% |
158
+
159
+ ## 追溯矩阵
160
+
161
+ | AC-ID | 描述 | 状态 | 测试引用 |
162
+ |-------|------|------|----------|
163
+ | AC-1 | 以有效凭证登录 | ✅ | auth.test.ts:15 |
164
+ | AC-2 | 拒绝无效凭证 | ✅ | auth.test.ts:32 |
165
+ | ... | ... | ... | ... |
166
+
167
+ ## 缺口
168
+ - **AC-8**: 社交登录 — 因 OAuth sandbox 未就绪受阻
169
+
170
+ ## 行动项目
171
+ 1. [ ] AC-8:搭建 OAuth sandbox(预计时间:待定)
172
+ ```
173
+
174
+ ## 下一步引导
175
+
176
+ `/ac-coverage` 完成后,AI 助手应建议:
177
+
178
+ > **AC 覆盖率分析完成。建议下一步:**
179
+ > - 覆盖率达标 → 执行 `/checkin` 质量关卡
180
+ > - 有未覆盖 AC → 执行 `/derive-tdd` 补齐测试 ⭐ **推荐**
181
+ > - 有部分覆盖 AC → 检查缺少的边界情况
182
+ > - 需要完整追溯 → 执行 `/ac-coverage --full`
183
+ > - 反向追溯 → 执行 `/ac-coverage --trace-code <path>`
184
+
185
+ ## 参考
186
+
187
+ - 核心标准:[acceptance-criteria-traceability.md](../../../../core/acceptance-criteria-traceability.md)
188
+ - SPEC:[SPEC-AC-COVERAGE.md](../../../../docs/specs/skills/SPEC-AC-COVERAGE.md)
189
+ - 相关:[test-coverage-assistant](../test-coverage-assistant/SKILL.md)(代码层级覆盖率)
190
+ - 相关:[checkin-assistant](../checkin-assistant/SKILL.md)(质量关卡)
191
+
192
+ ## AI 代理行为
193
+
194
+ > 完整的 AI 行为定义请参阅对应的命令文件:[`/ac-coverage`](../../../../skills/commands/ac-coverage.md#ai-agent-behavior--ai-代理行为)