specdo 1.0.2

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 (161) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +308 -0
  3. package/README.zh-CN.md +306 -0
  4. package/bin/specdo.js +3 -0
  5. package/dist/cli/index.d.ts +15 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +297 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/commands/_shared.d.ts +45 -0
  10. package/dist/commands/_shared.d.ts.map +1 -0
  11. package/dist/commands/_shared.js +124 -0
  12. package/dist/commands/_shared.js.map +1 -0
  13. package/dist/commands/apply.d.ts +30 -0
  14. package/dist/commands/apply.d.ts.map +1 -0
  15. package/dist/commands/apply.js +393 -0
  16. package/dist/commands/apply.js.map +1 -0
  17. package/dist/commands/archive.d.ts +25 -0
  18. package/dist/commands/archive.d.ts.map +1 -0
  19. package/dist/commands/archive.js +362 -0
  20. package/dist/commands/archive.js.map +1 -0
  21. package/dist/commands/doctor.d.ts +21 -0
  22. package/dist/commands/doctor.d.ts.map +1 -0
  23. package/dist/commands/doctor.js +180 -0
  24. package/dist/commands/doctor.js.map +1 -0
  25. package/dist/commands/domains.d.ts +14 -0
  26. package/dist/commands/domains.d.ts.map +1 -0
  27. package/dist/commands/domains.js +107 -0
  28. package/dist/commands/domains.js.map +1 -0
  29. package/dist/commands/explore.d.ts +48 -0
  30. package/dist/commands/explore.d.ts.map +1 -0
  31. package/dist/commands/explore.js +378 -0
  32. package/dist/commands/explore.js.map +1 -0
  33. package/dist/commands/init.d.ts +45 -0
  34. package/dist/commands/init.d.ts.map +1 -0
  35. package/dist/commands/init.js +243 -0
  36. package/dist/commands/init.js.map +1 -0
  37. package/dist/commands/list.d.ts +23 -0
  38. package/dist/commands/list.d.ts.map +1 -0
  39. package/dist/commands/list.js +135 -0
  40. package/dist/commands/list.js.map +1 -0
  41. package/dist/commands/propose.d.ts +22 -0
  42. package/dist/commands/propose.d.ts.map +1 -0
  43. package/dist/commands/propose.js +316 -0
  44. package/dist/commands/propose.js.map +1 -0
  45. package/dist/commands/show.d.ts +15 -0
  46. package/dist/commands/show.d.ts.map +1 -0
  47. package/dist/commands/show.js +214 -0
  48. package/dist/commands/show.js.map +1 -0
  49. package/dist/commands/status.d.ts +17 -0
  50. package/dist/commands/status.d.ts.map +1 -0
  51. package/dist/commands/status.js +146 -0
  52. package/dist/commands/status.js.map +1 -0
  53. package/dist/commands/sync.d.ts +21 -0
  54. package/dist/commands/sync.d.ts.map +1 -0
  55. package/dist/commands/sync.js +113 -0
  56. package/dist/commands/sync.js.map +1 -0
  57. package/dist/commands/validate.d.ts +117 -0
  58. package/dist/commands/validate.d.ts.map +1 -0
  59. package/dist/commands/validate.js +446 -0
  60. package/dist/commands/validate.js.map +1 -0
  61. package/dist/core/apply-brief-renderer.d.ts +35 -0
  62. package/dist/core/apply-brief-renderer.d.ts.map +1 -0
  63. package/dist/core/apply-brief-renderer.js +242 -0
  64. package/dist/core/apply-brief-renderer.js.map +1 -0
  65. package/dist/core/config-store.d.ts +190 -0
  66. package/dist/core/config-store.d.ts.map +1 -0
  67. package/dist/core/config-store.js +280 -0
  68. package/dist/core/config-store.js.map +1 -0
  69. package/dist/core/context-store.d.ts +96 -0
  70. package/dist/core/context-store.d.ts.map +1 -0
  71. package/dist/core/context-store.js +426 -0
  72. package/dist/core/context-store.js.map +1 -0
  73. package/dist/core/json-schemas.d.ts +349 -0
  74. package/dist/core/json-schemas.d.ts.map +1 -0
  75. package/dist/core/json-schemas.js +125 -0
  76. package/dist/core/json-schemas.js.map +1 -0
  77. package/dist/core/skill-content/cross-domain.d.ts +12 -0
  78. package/dist/core/skill-content/cross-domain.d.ts.map +1 -0
  79. package/dist/core/skill-content/cross-domain.js +291 -0
  80. package/dist/core/skill-content/cross-domain.js.map +1 -0
  81. package/dist/core/skill-content/protocol-examples.d.ts +13 -0
  82. package/dist/core/skill-content/protocol-examples.d.ts.map +1 -0
  83. package/dist/core/skill-content/protocol-examples.js +190 -0
  84. package/dist/core/skill-content/protocol-examples.js.map +1 -0
  85. package/dist/core/skill-content/workflow-content.d.ts +25 -0
  86. package/dist/core/skill-content/workflow-content.d.ts.map +1 -0
  87. package/dist/core/skill-content/workflow-content.js +1572 -0
  88. package/dist/core/skill-content/workflow-content.js.map +1 -0
  89. package/dist/core/skill-exporter.d.ts +186 -0
  90. package/dist/core/skill-exporter.d.ts.map +1 -0
  91. package/dist/core/skill-exporter.js +922 -0
  92. package/dist/core/skill-exporter.js.map +1 -0
  93. package/dist/core/spec-sync.d.ts +65 -0
  94. package/dist/core/spec-sync.d.ts.map +1 -0
  95. package/dist/core/spec-sync.js +226 -0
  96. package/dist/core/spec-sync.js.map +1 -0
  97. package/dist/core/task-parser.d.ts +58 -0
  98. package/dist/core/task-parser.d.ts.map +1 -0
  99. package/dist/core/task-parser.js +244 -0
  100. package/dist/core/task-parser.js.map +1 -0
  101. package/dist/core/template-renderer.d.ts +51 -0
  102. package/dist/core/template-renderer.d.ts.map +1 -0
  103. package/dist/core/template-renderer.js +362 -0
  104. package/dist/core/template-renderer.js.map +1 -0
  105. package/dist/domains/architecture.d.ts +34 -0
  106. package/dist/domains/architecture.d.ts.map +1 -0
  107. package/dist/domains/architecture.js +341 -0
  108. package/dist/domains/architecture.js.map +1 -0
  109. package/dist/domains/backend.d.ts +35 -0
  110. package/dist/domains/backend.d.ts.map +1 -0
  111. package/dist/domains/backend.js +367 -0
  112. package/dist/domains/backend.js.map +1 -0
  113. package/dist/domains/frontend.d.ts +36 -0
  114. package/dist/domains/frontend.d.ts.map +1 -0
  115. package/dist/domains/frontend.js +373 -0
  116. package/dist/domains/frontend.js.map +1 -0
  117. package/dist/domains/index.d.ts +49 -0
  118. package/dist/domains/index.d.ts.map +1 -0
  119. package/dist/domains/index.js +255 -0
  120. package/dist/domains/index.js.map +1 -0
  121. package/dist/domains/operations.d.ts +37 -0
  122. package/dist/domains/operations.d.ts.map +1 -0
  123. package/dist/domains/operations.js +344 -0
  124. package/dist/domains/operations.js.map +1 -0
  125. package/dist/domains/pool-ranking.d.ts +43 -0
  126. package/dist/domains/pool-ranking.d.ts.map +1 -0
  127. package/dist/domains/pool-ranking.js +153 -0
  128. package/dist/domains/pool-ranking.js.map +1 -0
  129. package/dist/domains/quality.d.ts +45 -0
  130. package/dist/domains/quality.d.ts.map +1 -0
  131. package/dist/domains/quality.js +368 -0
  132. package/dist/domains/quality.js.map +1 -0
  133. package/dist/domains/security.d.ts +19 -0
  134. package/dist/domains/security.d.ts.map +1 -0
  135. package/dist/domains/security.js +364 -0
  136. package/dist/domains/security.js.map +1 -0
  137. package/dist/domains/signal-match.d.ts +25 -0
  138. package/dist/domains/signal-match.d.ts.map +1 -0
  139. package/dist/domains/signal-match.js +67 -0
  140. package/dist/domains/signal-match.js.map +1 -0
  141. package/dist/domains/types.d.ts +354 -0
  142. package/dist/domains/types.d.ts.map +1 -0
  143. package/dist/domains/types.js +12 -0
  144. package/dist/domains/types.js.map +1 -0
  145. package/dist/index.d.ts +9 -0
  146. package/dist/index.d.ts.map +1 -0
  147. package/dist/index.js +9 -0
  148. package/dist/index.js.map +1 -0
  149. package/dist/protocols/index.d.ts +36 -0
  150. package/dist/protocols/index.d.ts.map +1 -0
  151. package/dist/protocols/index.js +85 -0
  152. package/dist/protocols/index.js.map +1 -0
  153. package/dist/protocols/review-to-solid.d.ts +32 -0
  154. package/dist/protocols/review-to-solid.d.ts.map +1 -0
  155. package/dist/protocols/review-to-solid.js +309 -0
  156. package/dist/protocols/review-to-solid.js.map +1 -0
  157. package/dist/utils/prompt.d.ts +37 -0
  158. package/dist/utils/prompt.d.ts.map +1 -0
  159. package/dist/utils/prompt.js +81 -0
  160. package/dist/utils/prompt.js.map +1 -0
  161. package/package.json +80 -0
@@ -0,0 +1,344 @@
1
+ /**
2
+ * Operations Domain Module
3
+ *
4
+ * 来源:
5
+ * - content/skills/release-management/SKILL.md (49 行)
6
+ * 发布工作流、release notes、freeze gate、guardrails
7
+ * - content/skills/git-commit-and-pr/SKILL.md (46 行)
8
+ * 提交边界、commit message、PR body checklist
9
+ * - content/skills/documentation-writer/SKILL.md (47 行)
10
+ * README 默认结构、写作规则、guardrails
11
+ * - content/skills/dependency-upgrade/SKILL.md (45 行)
12
+ * 依赖升级分级 (patch/minor/major)、影响面、验证
13
+ * - content/skills/monorepo-management/SKILL.md (72 行)
14
+ * 工具矩阵 (turbo/nx/pnpm/lerna/bazel)、构建编排、发布
15
+ * - content/roles/06-developer-experience/devops-engineer.toml (43 行)
16
+ * CI/CD 管线、容器、IaC、监控、SRE 原则
17
+ * - content/roles/06-developer-experience/documentation-engineer.toml (42 行)
18
+ * 文档作为开发者生产力工程;与代码同步、可执行示例
19
+ *
20
+ * 压缩方法:
21
+ * 1. 7 个源文件的 "Use this skill when" 触发场景 → explore.signals
22
+ * 2. release freeze gate + PR checklist + README checklist → design.checklist
23
+ * 3. monorepo 工具矩阵 → design.patterns
24
+ * 4. devops-engineer principles + dependency-upgrade core workflow → implement.focusAreas
25
+ * 5. 7 个源文件的 guardrails → implement.antiPatterns
26
+ * 6. release notes checklist + monorepo health checks → verify.checklist
27
+ * 7. 原始示例代码 / dockerfile 模板 / 工具脚本 → 丢弃
28
+ *
29
+ * 与相邻领域的边界:
30
+ * - "rollback" / "release" / "deploy" / "ci" 归 operations
31
+ * - "database migration rollback" 归 backend;operations 只覆盖发布层 rollback
32
+ * - "monitoring" 通用监控归 operations;backend 关注 metrics 端点实现
33
+ * - "breaking change" 在 architecture 用于契约层;operations 用 "release breaking change" 多词
34
+ */
35
+ export const operationsDomain = {
36
+ name: 'operations',
37
+ description: 'Release engineering, CI/CD, deployment automation, dependency upgrades, monorepo workflows, and documentation engineering',
38
+ // ── Explore: 需求澄清 ─────────────────────────────────────
39
+ explore: {
40
+ signals: [
41
+ // 发布与版本
42
+ 'release', 'release notes', 'changelog', 'version bump', 'semver',
43
+ 'freeze', 'cut a release', 'tag a version', 'publish',
44
+ // Git / PR
45
+ 'commit', 'pull request', 'merge request', 'rebase', 'branch strategy',
46
+ 'conventional commits', 'pr description', 'pr template',
47
+ // 部署与基础设施
48
+ 'deploy', 'deployment', 'rollout', 'rollback', 'hotfix', 'canary',
49
+ 'pipeline', 'ci pipeline', 'cd pipeline', 'build pipeline',
50
+ 'dockerfile', 'kubernetes', 'k8s', 'helm chart', 'terraform',
51
+ 'pulumi', 'cloudformation', 'iac', 'infrastructure as code',
52
+ // 监控与运维
53
+ 'monitoring', 'observability', 'alerting', 'dashboard', 'runbook',
54
+ 'slo', 'sli', 'error budget',
55
+ // 依赖与 monorepo
56
+ 'dependency upgrade', 'dependency bump', 'lockfile', 'peer dependency',
57
+ 'monorepo', 'turborepo', 'nx workspace', 'pnpm workspace', 'lerna', 'bazel',
58
+ // 文档
59
+ 'readme', 'documentation', 'migration guide', 'onboarding doc',
60
+ 'release breaking change',
61
+ ],
62
+ questions: {
63
+ defaultCount: 8,
64
+ items: [
65
+ // ── Tier 1: 发布范围与目标 (priority 10) ──────────────
66
+ {
67
+ text: 'What is the blast radius of this change? Single service, monorepo, or every consumer of a public artefact (npm package, Docker image, API)?',
68
+ signals: ['deploy', 'release', 'blast radius', 'service', 'monorepo', 'package', 'docker', 'public', 'artifact'],
69
+ priority: 10,
70
+ },
71
+ {
72
+ text: 'What is the deployment target? (Kubernetes, serverless/lambda, VM, container registry, static hosting) — what are the existing pipeline stages?',
73
+ signals: ['deploy', 'kubernetes', 'k8s', 'serverless', 'lambda', 'vm', 'container', 'docker', 'pipeline', 'ci/cd'],
74
+ priority: 10,
75
+ },
76
+ // ── Tier 2: 回滚与安全发布 (priority 9) ──────────────
77
+ {
78
+ text: 'What is the rollback strategy if this fails in production? Has it been smoke-tested? How fast can we roll back (seconds vs minutes vs hours)?',
79
+ id: 'rollback-strategy',
80
+ signals: ['rollback', 'deploy', 'failure', 'production', 'smoke', 'revert', 'recovery', 'incident'],
81
+ priority: 9,
82
+ },
83
+ {
84
+ text: 'Is this a canary, blue-green, or rolling deployment? What is the rollback trigger (error rate spike, latency degradation, custom metric)?',
85
+ signals: ['canary', 'blue-green', 'rolling', 'deploy', 'strategy', 'rollback', 'trigger', 'metric', 'monitoring'],
86
+ priority: 8,
87
+ requiresAnswer: ['operations:rollback-strategy'],
88
+ },
89
+ // ── Tier 3: CI/CD 管道 (priority 8) ──────────────────
90
+ {
91
+ text: 'What CI checks gate the release? Which are blocking vs advisory, and how do we record skipped checks with rationale?',
92
+ signals: ['ci/cd', 'ci', 'pipeline', 'gate', 'check', 'block', 'advisory', 'skip', 'validation'],
93
+ priority: 8,
94
+ },
95
+ {
96
+ text: 'For monorepo work: which packages are affected? Is the affected-only test/build path correct in CI (no unnecessary rebuilds)?',
97
+ signals: ['monorepo', 'package', 'ci', 'build', 'test', 'affected', 'nx', 'turborepo', 'lerna'],
98
+ priority: 8,
99
+ },
100
+ {
101
+ text: 'What is the build artifact strategy? (immutable tags, checksum verification, SBOM generation, provenance attestation)',
102
+ signals: ['build', 'artifact', 'docker', 'image', 'checksum', 'sbom', 'provenance', 'immutable', 'tag'],
103
+ priority: 7,
104
+ },
105
+ // ── Tier 4: 依赖管理 (priority 7-8) ───────────────────
106
+ {
107
+ text: 'For dependency upgrades: is this patch, minor, or major? What is the contract risk classification? Is there a changelog review?',
108
+ signals: ['dependency', 'upgrade', 'patch', 'minor', 'major', 'semver', 'contract', 'risk', 'changelog'],
109
+ priority: 8,
110
+ },
111
+ {
112
+ text: 'Are all production dependencies pinned to exact versions? Is there a lockfile integrity check in CI?',
113
+ signals: ['dependency', 'pin', 'lockfile', 'version', 'integrity', 'ci', 'supply chain', 'npm', 'pip'],
114
+ priority: 7,
115
+ },
116
+ {
117
+ text: 'What is the vulnerability scanning strategy for dependencies? (npm audit, Snyk, Trivy) — does CI block on CRITICAL?',
118
+ signals: ['dependency', 'vulnerability', 'cve', 'npm audit', 'snyk', 'trivy', 'scan', 'ci', 'supply chain'],
119
+ priority: 7,
120
+ },
121
+ // ── Tier 5: 环境管理 (priority 7) ────────────────────
122
+ {
123
+ text: 'What environments does this change flow through? (dev → staging → canary → production) Are environments consistent (infra-as-code)?',
124
+ signals: ['environment', 'dev', 'staging', 'canary', 'production', 'infra', 'terraform', 'pulumi', 'iac'],
125
+ priority: 7,
126
+ },
127
+ {
128
+ text: 'How are environment variables and secrets managed per environment? (vault, KMS, CI secrets, .env files — are they encrypted at rest?)',
129
+ signals: ['environment', 'secret', 'env', 'variable', 'vault', 'kms', 'ci', 'configuration'],
130
+ priority: 7,
131
+ },
132
+ {
133
+ text: 'Is there a staging/production parity gap? What differs between staging and production (data, scale, configuration, third-party integration)?',
134
+ signals: ['staging', 'production', 'parity', 'environment', 'data', 'scale', 'configuration', 'integration'],
135
+ priority: 6,
136
+ },
137
+ // ── Tier 6: 可观测性 (priority 7-8) ──────────────────
138
+ {
139
+ text: 'What observability is in place for this change? (dashboards, alerts, SLOs, error budgets — are they defined before deploy?)',
140
+ id: 'observability',
141
+ signals: ['observability', 'monitoring', 'dashboard', 'alert', 'slo', 'error budget', 'grafana', 'datadog', 'prometheus'],
142
+ priority: 8,
143
+ },
144
+ {
145
+ text: 'How do we know the deploy was successful? What metric or health check confirms "this change is working as expected"?',
146
+ signals: ['deploy', 'verification', 'health check', 'metric', 'monitoring', 'success', 'smoke', 'validation'],
147
+ priority: 8,
148
+ requiresAnswer: ['operations:observability'],
149
+ },
150
+ {
151
+ text: 'What is the logging strategy in production? (structured JSON, log levels, retention period, PII redaction, log aggregation tool)',
152
+ signals: ['logging', 'log', 'production', 'structured', 'json', 'retention', 'pii', 'elk', 'loki', 'splunk'],
153
+ priority: 7,
154
+ },
155
+ // ── Tier 7: 事件响应 (priority 6-7) ──────────────────
156
+ {
157
+ text: 'What is the incident response playbook for this change? Who is on-call, what is the escalation path, where are runbooks?',
158
+ signals: ['incident', 'on-call', 'escalation', 'runbook', 'pagerduty', 'opsgenie', 'alert', 'response'],
159
+ priority: 7,
160
+ },
161
+ {
162
+ text: 'What manual steps remain in the release process today, and which can we eliminate this iteration? Is there a runbook for remaining manual steps?',
163
+ signals: ['release', 'manual', 'runbook', 'automation', 'process', 'checklist', 'operation'],
164
+ priority: 7,
165
+ },
166
+ // ── Tier 8: 下游通信 (priority 6-7) ──────────────────
167
+ {
168
+ text: 'Who are the downstream adopters that need a migration guide or upgrade notes? When do they get notified (before or at release)?',
169
+ signals: ['downstream', 'adopter', 'migration', 'upgrade', 'notification', 'changelog', 'consumer', 'breaking change'],
170
+ priority: 7,
171
+ },
172
+ {
173
+ text: 'What is the deprecation policy for removed or changed functionality? Is there a sunset period with warnings before removal?',
174
+ signals: ['deprecation', 'removal', 'sunset', 'warning', 'migration', 'backward compatibility', 'breaking change'],
175
+ priority: 6,
176
+ },
177
+ // ── Tier 9: 基础设施 (priority 6) ────────────────────
178
+ {
179
+ text: 'What infrastructure changes are needed? (new DB instance, queue, cache cluster, DNS, load balancer, firewall rule) — is it provisioned via IaC?',
180
+ signals: ['infra', 'infrastructure', 'terraform', 'pulumi', 'cloudformation', 'database', 'cache', 'dns', 'load balancer', 'firewall'],
181
+ priority: 7,
182
+ },
183
+ {
184
+ text: 'What is the resource sizing/capacity plan? (CPU, memory, disk, network — request vs limit; horizontal vs vertical scaling)',
185
+ signals: ['resource', 'capacity', 'cpu', 'memory', 'disk', 'network', 'scaling', 'sizing', 'request', 'limit'],
186
+ priority: 6,
187
+ },
188
+ {
189
+ text: 'How are database migrations run in production? (manual, automated in CI/CD, approval-gated — what is the rollback if migration fails?)',
190
+ signals: ['database', 'migration', 'production', 'ci/cd', 'rollback', 'ddl', 'schema', 'automation'],
191
+ priority: 6,
192
+ },
193
+ // ── Tier 10: 安全运维 (priority 6-7) ─────────────────
194
+ {
195
+ text: 'What is the security review process before production deploy? Is there a pre-flight security checklist (secrets rotation, dependency audit, CSP update)?',
196
+ signals: ['security', 'deploy', 'review', 'checklist', 'production', 'audit', 'csp'],
197
+ priority: 6,
198
+ },
199
+ {
200
+ text: 'What is the backup and disaster recovery plan for data affected by this change? Is backup tested regularly?',
201
+ signals: ['backup', 'disaster recovery', 'dr', 'data', 'restore', 'rpo', 'rto', 'snapshot'],
202
+ priority: 6,
203
+ },
204
+ {
205
+ text: 'Are there rate limits or abuse protections at the infrastructure level? (WAF rules, DDoS protection, API gateway throttling)',
206
+ signals: ['rate limit', 'waf', 'ddos', 'api gateway', 'throttle', 'abuse', 'infrastructure', 'protection'],
207
+ priority: 6,
208
+ },
209
+ // ── Tier 11: 成本与 FinOps (priority 5-6) ─────────────
210
+ {
211
+ text: 'What is the estimated cost impact of this change? (additional compute, storage, bandwidth, third-party API calls)',
212
+ signals: ['cost', 'finops', 'compute', 'storage', 'bandwidth', 'budget', 'cloud', 'aws', 'gcp', 'azure'],
213
+ priority: 5,
214
+ },
215
+ {
216
+ text: 'Are there any resource cleanup or decommissioning steps for deprecated services/endpoints after this deploy?',
217
+ signals: ['cleanup', 'decommission', 'deprecated', 'remove', 'delete', 'resource', 'cost'],
218
+ priority: 5,
219
+ },
220
+ ],
221
+ },
222
+ },
223
+ // ── Design: 设计阶段 ─────────────────────────────────────
224
+ design: {
225
+ checklist: [
226
+ // 发布门 (release freeze gate)
227
+ 'Release scope is explicit: what is in this release and what is intentionally not',
228
+ 'Code, docs, and examples are aligned on the public surface — no doc drift',
229
+ 'Required validations have actually run; skipped validations are listed explicitly with reason',
230
+ 'Release notes drafted with user-visible impact, not internal phrasing',
231
+ 'Upgrade and rollback path documented; no hidden manual steps required for adopters',
232
+ // PR / 提交质量
233
+ 'Commit boundaries reflect coherent changes, not file-count or chronology',
234
+ 'Mechanical churn is separated from behavioral change where practical',
235
+ 'PR description answers: what changed, why it changed, how it was verified, what risks remain, what was intentionally left out',
236
+ // 依赖升级
237
+ 'Dependency upgrade classified (patch / minor / major) with explicit contract-risk note',
238
+ 'Upstream release notes / migration guides reviewed before any code change',
239
+ 'Validation plan defined before the upgrade, not improvised after the build breaks',
240
+ // Monorepo / 构建编排
241
+ 'Workspace boundaries and naming are stable; new packages follow existing convention',
242
+ 'Build pipeline order respects the dependency graph; affected-only tasks are correct in CI',
243
+ 'Caching strategy declared (Turborepo / Nx / remote cache) with a target hit rate',
244
+ // 部署 / 基础设施
245
+ 'Pipeline stages are idempotent and re-triggerable safely',
246
+ 'Infrastructure changes are reproducible from code (no manual console edits)',
247
+ 'Resource limits and requests specified for every container; no implicit defaults',
248
+ 'Monitoring covers both infrastructure and application-level health, not just one layer',
249
+ // 文档
250
+ 'README / migration guide passes the "new visitor in 30 seconds" check; required vs optional setup is unambiguous',
251
+ ],
252
+ patterns: {
253
+ 'Modular Monorepo with Turborepo / Nx': 'Use a workspace tool with task graph + remote cache for JS/TS monorepos. Define one canonical build/test/lint task per package; CI runs only affected packages.',
254
+ 'pnpm Workspaces for Strict Dependencies': 'When dependency hygiene matters, pnpm workspaces enforce strict resolution and avoid phantom dependencies. Pair with workspace:* protocol for internal packages.',
255
+ 'Conventional Commits + Automated Versioning': 'Adopt Conventional Commits (feat/fix/chore/...) so changelog, semver bump, and release notes can be generated automatically. Commit hook enforces format at the boundary.',
256
+ 'Trunk-Based with Short-Lived Release Branches': 'Mainline development on trunk; cut a release branch only at freeze. Hotfixes target the release branch and are forward-merged to trunk.',
257
+ 'Multi-Stage Dockerfile + Reproducible Image': 'Build stage compiles and tests; runtime stage copies only required artefacts. Pin base image digest; declare resource limits in the orchestration manifest.',
258
+ 'IaC with Plan / Apply Discipline': 'All infra changes go through plan → review → apply (Terraform / Pulumi / CloudFormation). State is remote and locked; drift detection runs on schedule.',
259
+ },
260
+ antiPatterns: [
261
+ 'Releasing on the assumption that an unrun check would have passed — assume nothing you did not actually verify',
262
+ 'Hiding breaking changes inside minor wording in release notes — adopters lose the ability to plan migrations',
263
+ 'Bundling unrelated refactors into the same PR for "convenience" — review quality drops, blast radius widens',
264
+ 'Committing "fix stuff" / "update files" / similarly empty messages — the audit trail becomes useless within months',
265
+ 'Mass-upgrading multiple high-risk dependencies without a rollback strategy — every regression becomes ambiguous to attribute',
266
+ 'Manual console changes to production infrastructure — kills reproducibility and creates undetectable drift',
267
+ 'Treating "works on my machine" as a valid quick-start in the README — every new contributor pays the same setup tax',
268
+ 'Storing secrets in pipeline YAML, env files committed to git, or build logs — one commit becomes a credential leak',
269
+ ],
270
+ },
271
+ // ── Implement: 实施阶段 ──────────────────────────────────
272
+ implement: {
273
+ focusAreas: [
274
+ // 提交 / PR 规范
275
+ 'Commit message states the change, not just the area touched; subject is imperative and < 72 chars',
276
+ 'PR includes validation evidence (commands run, output, screenshots if UI) and explicit risk notes',
277
+ 'Mechanical churn (formatting, lint fixes, mass renames) lands in its own commit before behavioral change',
278
+ // 依赖升级
279
+ 'Upgrade scope mapped: APIs, config, build, runtime behavior, tests are listed before any version bump',
280
+ 'Lockfile churn reviewed deliberately — large unexpected diffs investigated, not waved through',
281
+ 'Plugin / peer dependency alignment verified after upgrade; no silent peer-dep mismatches',
282
+ // CI/CD 管线
283
+ 'Pipeline stages cache aggressively (node_modules, build outputs, docker layers) and use affected-only execution',
284
+ 'Pipeline failure modes produce actionable logs — no "exit code 1" without context',
285
+ 'Secrets resolved at runtime from a managed store (Vault, AWS Secrets Manager, GitHub OIDC) — never embedded in YAML or images',
286
+ // 容器 / 编排
287
+ 'Dockerfile uses multi-stage build; runtime image contains only required artefacts; image is pinned by digest',
288
+ 'Kubernetes manifests / Helm values declare resource requests, limits, liveness, readiness, and PodDisruptionBudget',
289
+ 'Health checks distinguish liveness (process alive) from readiness (ready to receive traffic)',
290
+ // 监控 / 运维
291
+ 'Alerts target SLO violations, not infrastructure CPU; every alert has a runbook entry',
292
+ 'Dashboards cover the four golden signals (latency, traffic, errors, saturation) per service',
293
+ // 文档
294
+ 'Docs are validated against current commands and file paths; copy-paste examples actually run on a clean checkout',
295
+ 'Migration guides include the failure mode users hit when they skip the steps, not just the steps themselves',
296
+ ],
297
+ patterns: {
298
+ 'Affected-Only CI': 'Compute the changed package set from `git diff` against the merge base; run lint/test/build only for affected packages and their dependents. Cuts CI time linearly with monorepo size.',
299
+ 'Idempotent Release Pipeline': 'Every pipeline stage can be re-run safely. Tag/version creation is conditional on artefact non-existence; publish step is at-most-once via idempotency key on the registry.',
300
+ 'Pinned Lockfile + Renovate Schedule': 'Lock dependencies exactly (no ^ or ~ for production); use Renovate / Dependabot to open scheduled PRs. Each upgrade PR gets its own validation cycle.',
301
+ 'Runbook-Linked Alert': 'Every alert payload contains a runbook URL with: detection criteria, immediate actions, escalation path. On-call never debugs an alert without docs.',
302
+ 'Documentation as Code': 'Docs live in the same repo as the code, follow the same review process, and are validated by CI (link check, example execution where feasible).',
303
+ },
304
+ antiPatterns: [
305
+ 'Claiming tests passed without actually running them — every later regression becomes a trust problem',
306
+ 'Committing secrets, local config, caches, or temporary artefacts — once on remote, treat as compromised',
307
+ 'Disabling a flaky test in CI without filing the follow-up issue — flakiness compounds silently',
308
+ 'Writing release notes as "various improvements" — adopters cannot decide whether to upgrade',
309
+ 'Mass-renames or mass-formatting in the same commit as logic changes — reviewers lose the ability to spot regressions',
310
+ 'Relying on type checks alone for runtime-heavy upgrades (DB driver, HTTP client, queue lib) — runtime smoke is required',
311
+ 'Pinning to "latest" tag for container base images or CI runners — builds become non-reproducible week to week',
312
+ ],
313
+ },
314
+ // ── Verify: 验证阶段 ─────────────────────────────────────
315
+ verify: {
316
+ checklist: [
317
+ // 发布 freeze gate
318
+ 'Release notes include: headline changes, breaking/behavioral changes, migration actions, compatibility caveats, known limits',
319
+ 'Code, docs, examples agree on the public surface; required validations actually ran',
320
+ 'Skipped validations are listed explicitly in the release record',
321
+ 'Upgrade and rollback path are present and have been smoke-tested at least once',
322
+ // CI / 管线
323
+ 'Pipeline runs are idempotent; re-triggering on the same commit produces the same artefact',
324
+ 'Build cache hit rate is observable and within expected band (≥ 80% for steady-state CI)',
325
+ 'CI runs only affected package tasks on PRs in the monorepo',
326
+ // Monorepo 健康
327
+ 'No circular dependencies between internal packages',
328
+ 'All internal dependencies use the workspace protocol (workspace:*) — no version drift',
329
+ 'Package boundaries enforced — no deep imports across packages',
330
+ 'Tooling versions (Node, pnpm, TypeScript, eslint) are consistent across the workspace',
331
+ // 部署 / 基础设施
332
+ 'Resource requests and limits specified for every container in production manifests',
333
+ 'Rollback path is documented and verified, not just hypothesised',
334
+ 'Secrets never appear in pipeline logs, build artefacts, or committed files',
335
+ // 监控
336
+ 'Alerts are linked to runbooks; on-call has run through the top-3 alerts at least once',
337
+ 'Monitoring covers both infrastructure layer and application-level health',
338
+ // 文档
339
+ 'A new contributor can complete the documented quick-start path on a clean machine',
340
+ 'Required vs optional setup is explicit; prerequisites appear before usage examples',
341
+ ],
342
+ },
343
+ };
344
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/domains/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,2HAA2H;IAE7H,yDAAyD;IAEzD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,QAAQ;YACR,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ;YACjE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS;YACrD,WAAW;YACX,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,iBAAiB;YACtE,sBAAsB,EAAE,gBAAgB,EAAE,aAAa;YACvD,UAAU;YACV,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ;YACjE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB;YAC1D,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW;YAC5D,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,wBAAwB;YAC3D,QAAQ;YACR,YAAY,EAAE,eAAe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,6BAA6B,EAC3B,6KAA6K;YAC/K,qCAAqC,EACnC,uJAAuJ;YACzJ,sBAAsB,EACpB,sJAAsJ;YACxJ,uBAAuB,EACrB,iJAAiJ;SACpJ;QAED,YAAY,EAAE;YACZ,sGAAsG;YACtG,yGAAyG;YACzG,gGAAgG;YAChG,6FAA6F;YAC7F,sHAAsH;YACtH,yHAAyH;YACzH,+GAA+G;SAChH;KACF;IAED,wDAAwD;IAExD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,iBAAiB;YACjB,8HAA8H;YAC9H,qFAAqF;YACrF,iEAAiE;YACjE,gFAAgF;YAChF,UAAU;YACV,2FAA2F;YAC3F,yFAAyF;YACzF,4DAA4D;YAC5D,cAAc;YACd,oDAAoD;YACpD,uFAAuF;YACvF,+DAA+D;YAC/D,uFAAuF;YACvF,YAAY;YACZ,oFAAoF;YACpF,iEAAiE;YACjE,4EAA4E;YAC5E,KAAK;YACL,uFAAuF;YACvF,0EAA0E;YAC1E,KAAK;YACL,mFAAmF;YACnF,oFAAoF;SACrF;KACF;CACF,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Question Pool Ranking Engine
3
+ *
4
+ * rankQuestions() 是领域问题池的核心排序函数。
5
+ * 根据用户输入 + 已收集回答,从池中选出最相关的 top-N 问题。
6
+ *
7
+ * 纯函数 — 无副作用,无 I/O,确定性输出。
8
+ */
9
+ import type { QuestionPool, RankedQuestion, RankQuestionsOptions } from './types.js';
10
+ /**
11
+ * 从 questions(string[] | QuestionPool)中提取纯问题文本数组。
12
+ * 用于向后兼容已有的数组遍历代码。
13
+ */
14
+ export declare function extractQuestions(questions: string[] | QuestionPool): string[];
15
+ /**
16
+ * 从 questions(string[] | QuestionPool)中获取问题数量。
17
+ */
18
+ export declare function getQuestionCount(questions: string[] | QuestionPool): number;
19
+ /**
20
+ * 带类型的类型守卫:判断 questions 是否为 QuestionPool。
21
+ */
22
+ export declare function isQuestionPool(questions: string[] | QuestionPool): questions is QuestionPool;
23
+ /**
24
+ * 自动将 legacy string[] 格式升级为 QuestionPool。
25
+ * 每个字符串转为合成 QuestionPoolItem(priority=5, signals=[])。
26
+ */
27
+ export declare function upgradeLegacyQuestions(questions: string[]): QuestionPool;
28
+ /**
29
+ * 纯函数:对问题池按相关性排序,返回 top-N。
30
+ *
31
+ * 算法步骤:
32
+ * 1. 对每个 pool item 计算分数
33
+ * 2. 过滤掉依赖未满足的项
34
+ * 3. 过滤掉条件未满足的项
35
+ * 4. 按 score desc → priority desc 排序
36
+ * 5. 取 top-N
37
+ *
38
+ * @param questions - 问题池 或 legacy string[]
39
+ * @param options - 排序选项(用户输入、已有回答、数量上限)
40
+ * @returns 排序后的问题列表
41
+ */
42
+ export declare function rankQuestions(questions: string[] | QuestionPool, options: RankQuestionsOptions): RankedQuestion[];
43
+ //# sourceMappingURL=pool-ranking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-ranking.d.ts","sourceRoot":"","sources":["../../src/domains/pool-ranking.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAGpB;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY,GAAG,MAAM,EAAE,CAG7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY,GAAG,MAAM,CAG3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY,GAAG,SAAS,IAAI,YAAY,CAE5F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY,CAQxE;AAqED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EAAE,GAAG,YAAY,EAClC,OAAO,EAAE,oBAAoB,GAC5B,cAAc,EAAE,CAgDlB"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Question Pool Ranking Engine
3
+ *
4
+ * rankQuestions() 是领域问题池的核心排序函数。
5
+ * 根据用户输入 + 已收集回答,从池中选出最相关的 top-N 问题。
6
+ *
7
+ * 纯函数 — 无副作用,无 I/O,确定性输出。
8
+ */
9
+ import { tokenize, signalMatchesToken } from './signal-match.js';
10
+ /**
11
+ * 从 questions(string[] | QuestionPool)中提取纯问题文本数组。
12
+ * 用于向后兼容已有的数组遍历代码。
13
+ */
14
+ export function extractQuestions(questions) {
15
+ if (Array.isArray(questions))
16
+ return questions;
17
+ return questions.items.map((item) => item.text);
18
+ }
19
+ /**
20
+ * 从 questions(string[] | QuestionPool)中获取问题数量。
21
+ */
22
+ export function getQuestionCount(questions) {
23
+ if (Array.isArray(questions))
24
+ return questions.length;
25
+ return questions.items.length;
26
+ }
27
+ /**
28
+ * 带类型的类型守卫:判断 questions 是否为 QuestionPool。
29
+ */
30
+ export function isQuestionPool(questions) {
31
+ return !Array.isArray(questions);
32
+ }
33
+ /**
34
+ * 自动将 legacy string[] 格式升级为 QuestionPool。
35
+ * 每个字符串转为合成 QuestionPoolItem(priority=5, signals=[])。
36
+ */
37
+ export function upgradeLegacyQuestions(questions) {
38
+ const items = questions.map((text) => ({
39
+ text,
40
+ signals: [],
41
+ priority: 5,
42
+ requiresAnswer: [],
43
+ }));
44
+ return { items, defaultCount: items.length };
45
+ }
46
+ /**
47
+ * 计算单个 QuestionPoolItem 对用户输入的相关性分数。
48
+ *
49
+ * 公式: (匹配信号数 / sqrt(总信号数)) * (priority / 10)
50
+ *
51
+ * 如果 signals 为空(legacy 升级项):
52
+ * 分数 = priority / 10(始终有资格,只要领域被匹配)
53
+ */
54
+ function scoreItem(item, lowerInput, tokens) {
55
+ if (item.signals.length === 0) {
56
+ return item.priority / 10;
57
+ }
58
+ const hits = item.signals.filter((signal) => signalMatchesToken(signal, lowerInput, tokens)).length;
59
+ return (hits / Math.sqrt(item.signals.length)) * (item.priority / 10);
60
+ }
61
+ /**
62
+ * 检查依赖链是否满足。
63
+ *
64
+ * requiresAnswer 中的每项格式为 "<domain>:<poolIndex>"。
65
+ * 全部满足返回 true;任何一项未满足返回 false。
66
+ */
67
+ function dependenciesSatisfied(item, existingAnswers) {
68
+ if (!item.requiresAnswer || item.requiresAnswer.length === 0) {
69
+ return true;
70
+ }
71
+ if (!existingAnswers) {
72
+ return false;
73
+ }
74
+ return item.requiresAnswer.every((key) => key in existingAnswers);
75
+ }
76
+ /**
77
+ * 检查条件激活是否满足。
78
+ *
79
+ * conditional 中的每项格式为 { "<domain>:<index>": "substring" }。
80
+ * 如果指定 key 的回答中包含子串(大小写不敏感),则该条件满足。
81
+ * 全部满足返回 true。
82
+ */
83
+ function conditionalsSatisfied(item, existingAnswers) {
84
+ if (!item.conditional || Object.keys(item.conditional).length === 0) {
85
+ return true;
86
+ }
87
+ if (!existingAnswers) {
88
+ return false;
89
+ }
90
+ return Object.entries(item.conditional).every(([key, substring]) => {
91
+ const answer = existingAnswers[key];
92
+ if (answer === undefined)
93
+ return false;
94
+ return answer.toLowerCase().includes(substring.toLowerCase());
95
+ });
96
+ }
97
+ /**
98
+ * 纯函数:对问题池按相关性排序,返回 top-N。
99
+ *
100
+ * 算法步骤:
101
+ * 1. 对每个 pool item 计算分数
102
+ * 2. 过滤掉依赖未满足的项
103
+ * 3. 过滤掉条件未满足的项
104
+ * 4. 按 score desc → priority desc 排序
105
+ * 5. 取 top-N
106
+ *
107
+ * @param questions - 问题池 或 legacy string[]
108
+ * @param options - 排序选项(用户输入、已有回答、数量上限)
109
+ * @returns 排序后的问题列表
110
+ */
111
+ export function rankQuestions(questions, options) {
112
+ // Step 0: 自动升级 legacy 格式
113
+ const pool = Array.isArray(questions)
114
+ ? upgradeLegacyQuestions(questions)
115
+ : questions;
116
+ const count = options.count ?? pool.defaultCount ?? 8;
117
+ const existingAnswers = options.existingAnswers ?? {};
118
+ const lowerInput = (options.input ?? '').toLowerCase();
119
+ const tokens = tokenize(options.input ?? '');
120
+ // Step 1: 计算每个 item 的分数
121
+ const scored = [];
122
+ for (let idx = 0; idx < pool.items.length; idx++) {
123
+ const item = pool.items[idx];
124
+ // 过滤依赖
125
+ if (!dependenciesSatisfied(item, existingAnswers))
126
+ continue;
127
+ // 过滤条件
128
+ if (!conditionalsSatisfied(item, existingAnswers))
129
+ continue;
130
+ const score = scoreItem(item, lowerInput, tokens);
131
+ scored.push({ item, idx, score });
132
+ }
133
+ // Step 2: 排序 (score desc → priority desc)
134
+ scored.sort((a, b) => {
135
+ const scoreDiff = b.score - a.score;
136
+ if (Math.abs(scoreDiff) > 0.0001)
137
+ return scoreDiff;
138
+ return b.item.priority - a.item.priority;
139
+ });
140
+ // Step 3: 取 top-N (保留 score+priority 排序,交互循环会按此顺序提问)
141
+ const top = scored.slice(0, count);
142
+ // Step 4: 确定 source 标签
143
+ const source = Array.isArray(questions) ? 'legacy' : 'pool';
144
+ return top.map((s) => ({
145
+ text: s.item.text,
146
+ score: Math.round(s.score * 1000) / 1000,
147
+ source,
148
+ index: s.idx,
149
+ id: s.item.id,
150
+ answerKey: s.item.id ?? String(s.idx),
151
+ }));
152
+ }
153
+ //# sourceMappingURL=pool-ranking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-ranking.js","sourceRoot":"","sources":["../../src/domains/pool-ranking.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAkC;IACjE,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/C,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM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AG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAEnC,uBAAuB;IACvB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAiB,CAAC,CAAC,CAAC,MAAe,CAAC;IAE9E,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI;QACxC,MAAM;QACN,KAAK,EAAE,CAAC,CAAC,GAAG;QACZ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;QACb,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;KACtC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Quality Domain Module
3
+ *
4
+ * 来源 (11 个,不含 review-to-solid):
5
+ * - content/skills/code-reviewer/SKILL.md (45 行) + references/review-checklist.md (26 行)
6
+ * 正确性 / 安全 / 可维护性 / 性能 / 测试 5 维评审顺序
7
+ * - content/skills/test-driven-development/SKILL.md (32 行)
8
+ * Red-Green-Refactor 循环 + 行为命名 + 集成边界优先
9
+ * - content/skills/systematic-debugging/SKILL.md (31 行)
10
+ * 5 步根因调查工作流(Reproduce/Localize/Trace/Fix/Verify)
11
+ * - content/skills/verification-before-completion/SKILL.md (49 行)
12
+ * 完成前必须有新鲜证据;不得依赖旧 output / 子代理报告
13
+ * - content/skills/performance-profiling/SKILL.md (65 行)
14
+ * 基线 → 热点 → 根因 → 优化 → 验证;前后端性能拆分
15
+ * - content/skills/webapp-testing/SKILL.md (39 行)
16
+ * Playwright 轻量 e2e + 降级链 (browser → jsdom → component → http)
17
+ * - content/roles/04-quality-security/code-reviewer.toml (42 行)
18
+ * evidence-driven review,1 normal + 1 failure path 验证
19
+ * - content/roles/04-quality-security/debugger.toml (42 行)
20
+ * fault-origin isolation,假设 vs 证据分离
21
+ * - content/roles/04-quality-security/qa-expert.toml (42 行)
22
+ * risk-based test scope;release gating
23
+ * - content/roles/04-quality-security/test-automator.toml (42 行)
24
+ * deterministic regression coverage;行为契约断言
25
+ * - content/roles/04-quality-security/performance-engineer.toml (42 行)
26
+ * bottleneck identification with measurement evidence
27
+ *
28
+ * 压缩方法:
29
+ * 1. code-reviewer 5 维评审顺序 → design.checklist 顶部 + implement.focusAreas
30
+ * 2. TDD Red-Green-Refactor → design.patterns + implement.patterns
31
+ * 3. systematic-debugging 5 步 → implement.focusAreas + implement.patterns
32
+ * 4. verification-before-completion 红旗短语 → implement.antiPatterns
33
+ * 5. performance-profiling 5 步工作流 → design.patterns + verify.checklist
34
+ * 6. webapp-testing 降级链 → implement.patterns
35
+ * 7. 5 个 role 的 quality checks → verify.checklist
36
+ *
37
+ * 与相邻领域的边界:
38
+ * - 单词 'n+1' / 'query plan' / 'slow query' 归 backend;quality 用通用 'profile' / 'bottleneck'
39
+ * - 'lighthouse' / 'core web vitals' / 'lcp' 归 frontend
40
+ * - review-to-solid 不在此处;它是独立 Protocol,由 apply 命令显式注入
41
+ * - 'review' 单词归 quality;operations 用多词 'pr description' / 'pr template'
42
+ */
43
+ import type { DomainModule } from './types.js';
44
+ export declare const qualityDomain: DomainModule;
45
+ //# sourceMappingURL=quality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality.d.ts","sourceRoot":"","sources":["../../src/domains/quality.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,aAAa,EAAE,YAwW3B,CAAC"}