claude-everything-workflow 0.1.9 → 0.2.3

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 (152) hide show
  1. package/AGENTS.md +20 -20
  2. package/CLAUDE.md +1 -5
  3. package/README.md +151 -113
  4. package/agents/e2e-runner.md +8 -141
  5. package/agents/harness-optimizer.md +3 -2
  6. package/commands/code-review.md +10 -15
  7. package/commands/learn.md +97 -0
  8. package/commands/pr.md +5 -6
  9. package/commands/to-spec.md +11 -0
  10. package/commands/verify.md +7 -11
  11. package/harness/manifest.json +346 -0
  12. package/hooks/check-code-size.js +33 -12
  13. package/hooks/check-console-log.js +72 -24
  14. package/package.json +10 -2
  15. package/rules/01-base.md +9 -49
  16. package/rules/02-code-size.md +5 -20
  17. package/rules/03-architecture.md +9 -61
  18. package/rules/04-error-handling.md +4 -26
  19. package/rules/05-git-workflow.md +12 -39
  20. package/rules/06-comments.md +3 -43
  21. package/rules/07-forbidden.md +8 -31
  22. package/rules/08-specialty-rules-index.md +18 -0
  23. package/rules/09-first-principles-adversarial-testing.md +6 -18
  24. package/rules/common/agent-orchestration.md +8 -47
  25. package/rules/common/context-hygiene.md +9 -72
  26. package/rules/common/harness-engineering.md +11 -38
  27. package/rules/common/hooks.md +13 -82
  28. package/rules/common/performance.md +8 -71
  29. package/rules/common/pr-automation.md +7 -68
  30. package/rules/common/skills-learning.md +12 -36
  31. package/rules/common/testing.md +16 -59
  32. package/scripts/cleanup-retired-skills.js +214 -0
  33. package/scripts/install-rules.js +100 -0
  34. package/scripts/install.ps1 +99 -87
  35. package/scripts/install.sh +77 -78
  36. package/scripts/learning/review-confidence.js +1 -4
  37. package/scripts/legacy-common-rule-hashes.json +78 -0
  38. package/scripts/merge-claude-settings.cjs +75 -0
  39. package/scripts/retired-skill-files.json +54 -0
  40. package/scripts/upstream-capability-baseline.json +27 -0
  41. package/scripts/upstream-capability-map.json +155 -0
  42. package/scripts/verify/core.js +91 -0
  43. package/scripts/verify/grilling-spec-gate-checks.js +266 -0
  44. package/scripts/verify/install-rules.test.js +156 -0
  45. package/scripts/verify/metadata-checks.js +747 -0
  46. package/scripts/verify/repository-checks.js +409 -0
  47. package/scripts/verify/runtime-checks.js +593 -0
  48. package/scripts/verify/skill-invocation.test.js +86 -0
  49. package/scripts/verify/skill-manifest-checks.js +197 -0
  50. package/scripts/verify/skill-manifest-checks.test.js +123 -0
  51. package/scripts/verify/workflow-checks.js +685 -0
  52. package/scripts/verify/workflow-ownership-fixtures.js +371 -0
  53. package/scripts/verify/workflow-ownership.js +780 -0
  54. package/scripts/verify-harness.js +18 -1075
  55. package/scripts/verify-upstream-capability-map.js +118 -0
  56. package/skills/README.md +28 -16
  57. package/skills/code-review/SKILL.md +63 -0
  58. package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
  59. package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
  60. package/skills/codebase-design/SKILL.md +63 -0
  61. package/skills/codebase-design/references/deepening.md +27 -0
  62. package/skills/codebase-design/references/design-it-twice.md +17 -0
  63. package/skills/continuous-learning-v2/SKILL.md +8 -8
  64. package/skills/continuous-learning-v2/config.json +0 -4
  65. package/skills/domain-modeling/SKILL.md +101 -0
  66. package/skills/e2e-testing/SKILL.md +20 -310
  67. package/skills/e2e-testing/references/playwright-patterns.md +324 -0
  68. package/skills/feature-acceptance/SKILL.md +89 -0
  69. package/skills/grilling/SKILL.md +83 -0
  70. package/skills/handoff/SKILL.md +55 -0
  71. package/skills/handoff/agents/openai.yaml +2 -0
  72. package/skills/implement/SKILL.md +48 -0
  73. package/skills/implement/references/ticket-delivery.md +43 -0
  74. package/skills/improve-codebase-architecture/SKILL.md +47 -0
  75. package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
  76. package/skills/iterative-retrieval/SKILL.md +10 -1
  77. package/skills/learn/README.md +2 -2
  78. package/skills/prototype/SKILL.md +50 -0
  79. package/skills/prototype/references/logic.md +28 -0
  80. package/skills/prototype/references/ui.md +30 -0
  81. package/skills/resolving-merge-conflicts/SKILL.md +27 -0
  82. package/skills/spec-gate/SKILL.md +149 -0
  83. package/skills/spec-gate/agents/openai.yaml +4 -0
  84. package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
  85. package/skills/subagent-driven-development/SKILL.md +95 -414
  86. package/skills/systematic-debugging/SKILL.md +11 -49
  87. package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
  88. package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
  89. package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
  90. package/skills/test-driven-development/SKILL.md +24 -4
  91. package/skills/to-tickets/SKILL.md +96 -0
  92. package/skills/triage/SKILL.md +53 -0
  93. package/skills/triage/agents/openai.yaml +2 -0
  94. package/skills/triage/references/agent-brief.md +32 -0
  95. package/skills/triage/references/out-of-scope.md +14 -0
  96. package/skills/using-git-worktrees/SKILL.md +8 -5
  97. package/skills/using-superpowers/SKILL.md +76 -43
  98. package/skills/using-superpowers/references/process-outcomes.md +41 -0
  99. package/skills/verification-before-completion/SKILL.md +5 -4
  100. package/skills/visual-companion/SKILL.md +62 -0
  101. package/skills/visual-companion/agents/openai.yaml +4 -0
  102. package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
  103. package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
  104. package/skills/visual-companion/scripts/pages.cjs +28 -0
  105. package/skills/visual-companion/scripts/server-utils.cjs +82 -0
  106. package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
  107. package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
  108. package/skills/visual-companion/scripts/websocket.cjs +86 -0
  109. package/agents/architect.md +0 -59
  110. package/agents/code-reviewer.md +0 -57
  111. package/agents/planner.md +0 -124
  112. package/agents/tdd-guide.md +0 -101
  113. package/commands/e2e.md +0 -28
  114. package/commands/evolve.md +0 -42
  115. package/commands/harness-audit.md +0 -27
  116. package/commands/instinct-status.md +0 -38
  117. package/commands/learn-eval.md +0 -91
  118. package/commands/projects.md +0 -27
  119. package/commands/promote.md +0 -29
  120. package/commands/prune.md +0 -46
  121. package/commands/tdd.md +0 -27
  122. package/homunculus/instincts/personal/always-test-first.md +0 -28
  123. package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
  124. package/rules/08-ecc-integration.md +0 -46
  125. package/rules/common/implementation.md +0 -25
  126. package/rules/common/security.md +0 -19
  127. package/skills/brainstorming/SKILL.md +0 -185
  128. package/skills/brainstorming/agents/openai.yaml +0 -3
  129. package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  130. package/skills/context-budget/SKILL.md +0 -59
  131. package/skills/discover-unknowns-zh/SKILL.md +0 -112
  132. package/skills/discover-unknowns-zh/agents/openai.yaml +0 -4
  133. package/skills/discover-unknowns-zh/references/prompt-patterns.md +0 -144
  134. package/skills/documentation-lookup/SKILL.md +0 -90
  135. package/skills/executing-plans/SKILL.md +0 -66
  136. package/skills/find-skills/SKILL.md +0 -142
  137. package/skills/skill-creator/LICENSE.txt +0 -202
  138. package/skills/skill-creator/SKILL.md +0 -356
  139. package/skills/skill-creator/references/output-patterns.md +0 -82
  140. package/skills/skill-creator/references/workflows.md +0 -28
  141. package/skills/skill-creator/scripts/init_skill.py +0 -303
  142. package/skills/skill-creator/scripts/package_skill.py +0 -110
  143. package/skills/skill-creator/scripts/quick_validate.py +0 -95
  144. package/skills/subagent-driven-development/implementer-prompt.md +0 -139
  145. package/skills/subagent-driven-development/scripts/review-package +0 -44
  146. package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
  147. package/skills/subagent-driven-development/scripts/task-brief +0 -40
  148. package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
  149. package/skills/writing-plans/SKILL.md +0 -206
  150. package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
  151. /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
  152. /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
@@ -0,0 +1,346 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "description": "CEW Harness \u7684 Skill \u5143\u6570\u636e\u4e0e\u6d41\u7a0b\u804c\u8d23\u552f\u4e00\u767b\u8bb0\u8868\u3002",
4
+ "skills": [
5
+ {
6
+ "name": "code-review",
7
+ "path": "skills/code-review/SKILL.md",
8
+ "owner": "skills/code-review/SKILL.md",
9
+ "version": "0.1.1",
10
+ "compatibility": [
11
+ "claude-code",
12
+ "codex"
13
+ ],
14
+ "allowedTools": null,
15
+ "invocation": "implicit"
16
+ },
17
+ {
18
+ "name": "codebase-design",
19
+ "path": "skills/codebase-design/SKILL.md",
20
+ "owner": "skills/codebase-design/SKILL.md",
21
+ "version": "0.1.1",
22
+ "compatibility": [
23
+ "claude-code",
24
+ "codex"
25
+ ],
26
+ "allowedTools": null,
27
+ "invocation": "implicit"
28
+ },
29
+ {
30
+ "name": "continuous-learning-v2",
31
+ "path": "skills/continuous-learning-v2/SKILL.md",
32
+ "owner": "skills/continuous-learning-v2/SKILL.md",
33
+ "version": "2.1.0",
34
+ "compatibility": [
35
+ "claude-code",
36
+ "codex"
37
+ ],
38
+ "allowedTools": null,
39
+ "invocation": "implicit"
40
+ },
41
+ {
42
+ "name": "domain-modeling",
43
+ "path": "skills/domain-modeling/SKILL.md",
44
+ "owner": "skills/domain-modeling/SKILL.md",
45
+ "version": "0.1.1",
46
+ "compatibility": [
47
+ "claude-code",
48
+ "codex"
49
+ ],
50
+ "allowedTools": null,
51
+ "invocation": "implicit"
52
+ },
53
+ {
54
+ "name": "e2e-testing",
55
+ "path": "skills/e2e-testing/SKILL.md",
56
+ "owner": "skills/e2e-testing/SKILL.md",
57
+ "version": "0.1.1",
58
+ "compatibility": [
59
+ "claude-code",
60
+ "codex"
61
+ ],
62
+ "allowedTools": null,
63
+ "invocation": "implicit"
64
+ },
65
+ {
66
+ "name": "feature-acceptance",
67
+ "path": "skills/feature-acceptance/SKILL.md",
68
+ "owner": "skills/feature-acceptance/SKILL.md",
69
+ "version": "0.1.0",
70
+ "compatibility": [
71
+ "claude-code",
72
+ "codex"
73
+ ],
74
+ "allowedTools": null,
75
+ "invocation": "implicit"
76
+ },
77
+ {
78
+ "name": "grilling",
79
+ "path": "skills/grilling/SKILL.md",
80
+ "owner": "skills/grilling/SKILL.md",
81
+ "version": "0.1.0",
82
+ "compatibility": [
83
+ "claude-code",
84
+ "codex"
85
+ ],
86
+ "allowedTools": null,
87
+ "invocation": "implicit"
88
+ },
89
+ {
90
+ "name": "handoff",
91
+ "path": "skills/handoff/SKILL.md",
92
+ "owner": "skills/handoff/SKILL.md",
93
+ "version": "0.1.1",
94
+ "compatibility": [
95
+ "claude-code",
96
+ "codex"
97
+ ],
98
+ "allowedTools": null,
99
+ "invocation": "implicit"
100
+ },
101
+ {
102
+ "name": "implement",
103
+ "path": "skills/implement/SKILL.md",
104
+ "owner": "skills/implement/SKILL.md",
105
+ "version": "0.1.1",
106
+ "compatibility": [
107
+ "claude-code",
108
+ "codex"
109
+ ],
110
+ "allowedTools": null,
111
+ "invocation": "implicit"
112
+ },
113
+ {
114
+ "name": "improve-codebase-architecture",
115
+ "path": "skills/improve-codebase-architecture/SKILL.md",
116
+ "owner": "skills/improve-codebase-architecture/SKILL.md",
117
+ "version": "0.1.1",
118
+ "compatibility": [
119
+ "claude-code",
120
+ "codex"
121
+ ],
122
+ "allowedTools": null,
123
+ "invocation": "implicit"
124
+ },
125
+ {
126
+ "name": "iterative-retrieval",
127
+ "path": "skills/iterative-retrieval/SKILL.md",
128
+ "owner": "skills/iterative-retrieval/SKILL.md",
129
+ "version": "0.1.0",
130
+ "compatibility": [
131
+ "claude-code",
132
+ "codex"
133
+ ],
134
+ "allowedTools": null,
135
+ "invocation": "implicit"
136
+ },
137
+ {
138
+ "name": "prototype",
139
+ "path": "skills/prototype/SKILL.md",
140
+ "owner": "skills/prototype/SKILL.md",
141
+ "version": "0.1.1",
142
+ "compatibility": [
143
+ "claude-code",
144
+ "codex"
145
+ ],
146
+ "allowedTools": null,
147
+ "invocation": "implicit"
148
+ },
149
+ {
150
+ "name": "resolving-merge-conflicts",
151
+ "path": "skills/resolving-merge-conflicts/SKILL.md",
152
+ "owner": "skills/resolving-merge-conflicts/SKILL.md",
153
+ "version": "0.1.0",
154
+ "compatibility": [
155
+ "claude-code",
156
+ "codex"
157
+ ],
158
+ "allowedTools": null,
159
+ "invocation": "implicit"
160
+ },
161
+ {
162
+ "name": "spec-gate",
163
+ "path": "skills/spec-gate/SKILL.md",
164
+ "owner": "skills/spec-gate/SKILL.md",
165
+ "version": "0.1.0",
166
+ "compatibility": [
167
+ "claude-code",
168
+ "codex"
169
+ ],
170
+ "allowedTools": null,
171
+ "invocation": "implicit"
172
+ },
173
+ {
174
+ "name": "subagent-driven-development",
175
+ "path": "skills/subagent-driven-development/SKILL.md",
176
+ "owner": "skills/subagent-driven-development/SKILL.md",
177
+ "version": "0.1.1",
178
+ "compatibility": [
179
+ "claude-code",
180
+ "codex"
181
+ ],
182
+ "allowedTools": null,
183
+ "invocation": "implicit"
184
+ },
185
+ {
186
+ "name": "systematic-debugging",
187
+ "path": "skills/systematic-debugging/SKILL.md",
188
+ "owner": "skills/systematic-debugging/SKILL.md",
189
+ "version": "0.1.1",
190
+ "compatibility": [
191
+ "claude-code",
192
+ "codex"
193
+ ],
194
+ "allowedTools": null,
195
+ "invocation": "implicit"
196
+ },
197
+ {
198
+ "name": "test-driven-development",
199
+ "path": "skills/test-driven-development/SKILL.md",
200
+ "owner": "skills/test-driven-development/SKILL.md",
201
+ "version": "0.1.1",
202
+ "compatibility": [
203
+ "claude-code",
204
+ "codex"
205
+ ],
206
+ "allowedTools": null,
207
+ "invocation": "implicit"
208
+ },
209
+ {
210
+ "name": "to-tickets",
211
+ "path": "skills/to-tickets/SKILL.md",
212
+ "owner": "skills/to-tickets/SKILL.md",
213
+ "version": "0.1.0",
214
+ "compatibility": [
215
+ "claude-code",
216
+ "codex"
217
+ ],
218
+ "allowedTools": null,
219
+ "invocation": "implicit"
220
+ },
221
+ {
222
+ "name": "triage",
223
+ "path": "skills/triage/SKILL.md",
224
+ "owner": "skills/triage/SKILL.md",
225
+ "version": "0.1.1",
226
+ "compatibility": [
227
+ "claude-code",
228
+ "codex"
229
+ ],
230
+ "allowedTools": null,
231
+ "invocation": "implicit"
232
+ },
233
+ {
234
+ "name": "using-git-worktrees",
235
+ "path": "skills/using-git-worktrees/SKILL.md",
236
+ "owner": "skills/using-git-worktrees/SKILL.md",
237
+ "version": "0.1.1",
238
+ "compatibility": [
239
+ "claude-code",
240
+ "codex"
241
+ ],
242
+ "allowedTools": null,
243
+ "invocation": "implicit"
244
+ },
245
+ {
246
+ "name": "using-superpowers",
247
+ "path": "skills/using-superpowers/SKILL.md",
248
+ "owner": "skills/using-superpowers/SKILL.md",
249
+ "version": "0.1.1",
250
+ "compatibility": [
251
+ "claude-code",
252
+ "codex"
253
+ ],
254
+ "allowedTools": null,
255
+ "invocation": "implicit"
256
+ },
257
+ {
258
+ "name": "verification-before-completion",
259
+ "path": "skills/verification-before-completion/SKILL.md",
260
+ "owner": "skills/verification-before-completion/SKILL.md",
261
+ "version": "0.1.1",
262
+ "compatibility": [
263
+ "claude-code",
264
+ "codex"
265
+ ],
266
+ "allowedTools": null,
267
+ "invocation": "implicit"
268
+ },
269
+ {
270
+ "name": "visual-companion",
271
+ "path": "skills/visual-companion/SKILL.md",
272
+ "owner": "skills/visual-companion/SKILL.md",
273
+ "version": "0.1.1",
274
+ "compatibility": [
275
+ "claude-code",
276
+ "codex"
277
+ ],
278
+ "allowedTools": null,
279
+ "invocation": "implicit"
280
+ }
281
+ ],
282
+ "ownership": [
283
+ {
284
+ "id": "routing",
285
+ "owner": "skills/using-superpowers/SKILL.md",
286
+ "surfaces": [
287
+ "AGENTS.md",
288
+ "rules/08-specialty-rules-index.md",
289
+ "rules/common/skills-learning.md"
290
+ ],
291
+ "enforcement": "advisory"
292
+ },
293
+ {
294
+ "id": "verification",
295
+ "owner": "skills/verification-before-completion/SKILL.md",
296
+ "surfaces": [
297
+ "commands/verify.md",
298
+ "rules/common/testing.md"
299
+ ],
300
+ "enforcement": "blocking"
301
+ },
302
+ {
303
+ "id": "review",
304
+ "owner": "skills/code-review/SKILL.md",
305
+ "surfaces": [
306
+ "commands/code-review.md",
307
+ "rules/common/pr-automation.md"
308
+ ],
309
+ "enforcement": "blocking"
310
+ },
311
+ {
312
+ "id": "testing",
313
+ "owner": "skills/test-driven-development/SKILL.md",
314
+ "surfaces": [
315
+ "rules/common/testing.md"
316
+ ],
317
+ "enforcement": "advisory"
318
+ },
319
+ {
320
+ "id": "worktree-isolation",
321
+ "owner": "skills/using-git-worktrees/SKILL.md",
322
+ "surfaces": [
323
+ "rules/05-git-workflow.md"
324
+ ],
325
+ "enforcement": "blocking"
326
+ },
327
+ {
328
+ "id": "learning",
329
+ "owner": "skills/continuous-learning-v2/SKILL.md",
330
+ "surfaces": [
331
+ "commands/learn.md",
332
+ "rules/common/skills-learning.md"
333
+ ],
334
+ "enforcement": "advisory"
335
+ },
336
+ {
337
+ "id": "ticket-delivery",
338
+ "owner": "skills/to-tickets/SKILL.md",
339
+ "surfaces": [
340
+ "skills/implement/SKILL.md",
341
+ "skills/subagent-driven-development/SKILL.md"
342
+ ],
343
+ "enforcement": "blocking"
344
+ }
345
+ ]
346
+ }
@@ -2,15 +2,17 @@
2
2
  /**
3
3
  * Check Code Size Hook
4
4
  *
5
- * 编辑后只检查本次改动的代码文件,正常静默,避免增加上下文噪音。
5
+ * 编辑后只检查本次改动的代码文件:文件行数上限与单行长度。
6
+ * 正常静默,避免增加上下文噪音。对应 rules/02-code-size.md。
6
7
  */
7
8
 
8
9
  'use strict'
9
10
 
10
11
  const fs = require('fs')
11
12
 
12
- const DEFAULT_MAX_LINES = 600
13
+ const CODE_TARGET_LINES = 800
13
14
  const TEST_MAX_LINES = 1000
15
+ const MAX_LINE_LENGTH = 120
14
16
  const CODE_EXTENSIONS = new Set([
15
17
  '.c',
16
18
  '.cc',
@@ -52,8 +54,8 @@ function isTestFile(filePath) {
52
54
  /\.(test|spec)\.[^.\\/]+$/.test(filePath)
53
55
  }
54
56
 
55
- function getMaxLines(filePath) {
56
- return isTestFile(filePath) ? TEST_MAX_LINES : DEFAULT_MAX_LINES
57
+ function getLineThreshold(filePath) {
58
+ return isTestFile(filePath) ? TEST_MAX_LINES : CODE_TARGET_LINES
57
59
  }
58
60
 
59
61
  function countLines(content) {
@@ -82,18 +84,37 @@ function run(raw) {
82
84
  return { exitCode: 0 }
83
85
  }
84
86
 
85
- const maxLines = getMaxLines(filePath)
87
+ const testFile = isTestFile(filePath)
88
+ const lineThreshold = getLineThreshold(filePath)
86
89
  const lineCount = countLines(content)
87
- if (lineCount <= maxLines) {
88
- return { exitCode: 0 }
90
+
91
+ const messages = []
92
+ if (lineCount > lineThreshold) {
93
+ messages.push(
94
+ testFile
95
+ ? `测试文件超过 ${lineThreshold} 行上限 (${lineCount} 行),请拆分测试场景。`
96
+ : `代码文件超过约 ${lineThreshold} 行的参考值 (${lineCount} 行),请评估是否按职责拆分。`
97
+ )
89
98
  }
90
99
 
91
- return {
92
- exitCode: 0,
93
- stderr:
94
- `[Hook] 代码文件超过 ${maxLines} 行: ` +
95
- `${filePath} (${lineCount} 行),请拆分后继续。\n`
100
+ // 最多提示前 3 处超长行
101
+ const longLineNumbers = []
102
+ content.split(/\r?\n/).forEach((line, index) => {
103
+ if (line.length > MAX_LINE_LENGTH && longLineNumbers.length < 3) {
104
+ longLineNumbers.push(index + 1)
105
+ }
106
+ })
107
+ if (longLineNumbers.length > 0) {
108
+ messages.push(
109
+ `存在超过 ${MAX_LINE_LENGTH} 字符的行(如第 ${longLineNumbers.join('、')} 行),请换行或提取。`
110
+ )
96
111
  }
112
+
113
+ if (messages.length === 0) {
114
+ return { exitCode: 0 }
115
+ }
116
+
117
+ return { exitCode: 0, stderr: `[Hook] ${filePath}: ${messages.join(' ')}\n` }
97
118
  }
98
119
 
99
120
  module.exports = { run }
@@ -1,37 +1,85 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Check Console Log Hook
4
- *
5
- * 在代码编辑后检测 console.log
6
- * 用于 PostToolUse hook
3
+ * Check Forbidden Patterns Hook
4
+ *
5
+ * 在代码编辑后检测静态禁止模式:console.log、debugger,
6
+ * 以及 TypeScript 文件中的 @ts-ignore、@ts-nocheck、`: any`、`as any`。
7
+ * 对应 rules/07-forbidden.md 的代码禁止项;文档文件不受检查。
8
+ * 用于 PostToolUse hook,警告不阻塞。
7
9
  */
8
10
 
11
+ 'use strict'
12
+
9
13
  const fs = require('fs')
10
14
 
11
- function main() {
12
- let data = ''
15
+ const TS_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts'])
13
16
 
14
- process.stdin.on('data', chunk => {
15
- data += chunk
16
- })
17
+ function getExtension(filePath) {
18
+ const match = filePath.match(/(\.[^.\\/]+)$/)
19
+ return match ? match[1].toLowerCase() : ''
20
+ }
17
21
 
18
- process.stdin.on('end', () => {
19
- try {
20
- const input = JSON.parse(data)
21
- const filePath = input.tool_input?.file_path
22
+ const FORBIDDEN_PATTERNS = [
23
+ { label: 'console.log 调试残留', pattern: /\bconsole\.log\s*\(/ },
24
+ { label: 'debugger 调试残留', pattern: /^\s*debugger\b/m },
25
+ { label: '@ts-ignore', pattern: /@ts-ignore/ },
26
+ { label: '@ts-nocheck', pattern: /@ts-nocheck/ },
27
+ { label: 'any 类型(: any)', pattern: /:\s*any\b/ },
28
+ { label: 'any 断言(as any)', pattern: /\bas\s+any\b/ }
29
+ ]
22
30
 
23
- if (filePath && fs.existsSync(filePath)) {
24
- const content = fs.readFileSync(filePath, 'utf8')
31
+ function run(raw) {
32
+ let input
33
+ try {
34
+ input = JSON.parse(raw)
35
+ } catch {
36
+ return { exitCode: 0 }
37
+ }
25
38
 
26
- if (/console\.log/.test(content)) {
27
- console.error('[Hook] 警告: 发现 console.log,请在提交前移除')
28
- }
29
- }
39
+ const filePath = input.tool_input?.file_path
40
+ if (!filePath || !fs.existsSync(filePath)) {
41
+ return { exitCode: 0 }
42
+ }
30
43
 
31
- } catch (error) {
32
- console.error(`[Hook] console.log 检查失败: ${error.message}`)
33
- }
34
- })
44
+ const ext = getExtension(filePath)
45
+ const isCode = Boolean(ext) && !/^\.(md|json|txt)$/.test(ext)
46
+ const isTs = TS_EXTENSIONS.has(ext)
47
+ if (!isCode) {
48
+ return { exitCode: 0 }
49
+ }
50
+
51
+ let content
52
+ try {
53
+ content = fs.readFileSync(filePath, 'utf8')
54
+ } catch {
55
+ return { exitCode: 0 }
56
+ }
57
+
58
+ const hits = []
59
+ for (const rule of FORBIDDEN_PATTERNS) {
60
+ if (rule.label.includes('any') && !isTs) continue
61
+ if (rule.pattern.test(content)) hits.push(rule.label)
62
+ }
63
+ if (hits.length === 0) {
64
+ return { exitCode: 0 }
65
+ }
66
+
67
+ return {
68
+ exitCode: 0,
69
+ stderr: `[Hook] 警告: ${filePath} 含禁止模式: ${hits.join('、')},请按 rules/07-forbidden.md 处理\n`
70
+ }
35
71
  }
36
72
 
37
- main()
73
+ module.exports = { run }
74
+
75
+ if (require.main === module) {
76
+ let data = ''
77
+ process.stdin.setEncoding('utf8')
78
+ process.stdin.on('data', chunk => { data += chunk })
79
+ process.stdin.on('end', () => {
80
+ const result = run(data)
81
+ if (result.stderr) process.stderr.write(result.stderr)
82
+ if (result.stdout) process.stdout.write(result.stdout)
83
+ process.exit(result.exitCode || 0)
84
+ })
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-everything-workflow",
3
- "version": "0.1.9",
3
+ "version": "0.2.3",
4
4
  "description": "Claude Code and Codex harness with rules, skills, agents, hooks, and verification gates.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -17,8 +17,16 @@
17
17
  },
18
18
  "scripts": {
19
19
  "verify": "node scripts/verify-harness.js",
20
+ "test:manifest": "node scripts/verify/skill-manifest-checks.test.js",
21
+ "test:invocation": "node scripts/verify/skill-invocation.test.js",
22
+ "test:install-rules": "node scripts/verify/install-rules.test.js",
23
+ "verify:upstream": "node scripts/verify-upstream-capability-map.js",
20
24
  "pack:dry-run": "npm pack --dry-run"
21
25
  },
26
+ "dependencies": {
27
+ "commonmark": "0.31.2",
28
+ "yaml": "2.9.0"
29
+ },
22
30
  "files": [
23
31
  "AGENTS.md",
24
32
  "CLAUDE.md",
@@ -29,9 +37,9 @@
29
37
  "bin/",
30
38
  "commands/",
31
39
  "hooks/",
32
- "homunculus/",
33
40
  "references/",
34
41
  "rules/",
42
+ "harness/",
35
43
  "scripts/",
36
44
  "skills/"
37
45
  ],
package/rules/01-base.md CHANGED
@@ -1,49 +1,9 @@
1
- # 基础设定
2
-
3
- ## 角色定位 (CRITICAL)
4
-
5
- 你是一名资深架构师,注重代码优雅性、可维护性、可扩展性。
6
-
7
- ## 行为准则
8
-
9
- - 主动探索:阅读文件无需确认,主动探索项目结构。
10
- - 先理解后修改:修改代码前先理解现有架构和设计意图。
11
- - 最小改动:只修改必要的代码,避免无关重构。
12
- - 保持一致:遵循项目现有的代码风格和约定。
13
- - 主动询问:遇到不确定的需求主动询问,避免假设。
14
- - 可验证目标:将任务转成可检查的完成标准。
15
-
16
- ## 风格约束
17
-
18
- - 不静默假设:需求有多种解释时,先说明差异;高风险假设必须询问。
19
- - 简单优先:使用能解决当前问题的最小方案,不添加未要求的抽象、配置或扩展性。
20
- - 外科手术式修改:每一行改动都应能追溯到用户需求、失败用例或验证目标。
21
- - 不顺手重构:发现无关问题时只记录或说明,除非用户明确要求,否则不修改。
22
- - 先定义成功标准:复杂任务开始前明确验证方式,例如测试、构建、复现用例或行为检查。
23
- - 最小验证闭环:完成前运行与改动范围匹配的最小验证;无法验证时说明原因和剩余风险。
24
- - 分层验证频率:中间步骤只跑最小必要验证;完成阶段统一跑一次完整的相关验证。遇到失败、跨模块影响、高风险改动或 PR 质量门时,再升级验证范围。
25
-
26
- ## 开发流程
27
-
28
- 简单任务走最小闭环:
29
-
30
- ```text
31
- 1. 理解需求 -> 阅读相关代码,理解现有架构
32
- 2. 增量实现 -> 只修改必要文件
33
- 3. 验证检查 -> 运行与改动范围匹配的最小验证
34
- 4. 总结结果 -> 明确已验证项、未验证项和剩余风险
35
- ```
36
-
37
- 复杂任务走 Superpowers 风格门禁闭环:
38
-
39
- ```text
40
- 1. Spec Gate -> brainstorming 澄清需求并写 design spec
41
- 2. User Review Gate -> 用户确认 spec 后才能继续
42
- 3. Plan Gate -> writing-plans 写实施计划
43
- 4. Red Test Gate -> 行为变化先写失败测试并确认失败原因
44
- 5. Task Review Gate -> 每个任务完成后做需求符合性审查和代码质量审查
45
- 6. Verify Gate -> /verify 或等价验证通过后才能进入 PR
46
- 7. PR Gate -> /pr 只处理本次任务相关文件并记录验证与风险
47
- ```
48
-
49
- 复杂任务包括新功能、架构调整、多文件行为变化、高风险实现,以及需求有多种合理解释的工作。
1
+ # 执行原则
2
+
3
+ - 先理解用户目标和真实调用链,可查事实自行读取。只询问会实质改变结果且无法查明的用户决策。
4
+ - 改动必须对应需求、失败用例或验收标准;保留已有用户改动,无关问题只记录。
5
+ - 优先复用项目现有入口、标准库和已安装依赖;最后才写最小新增代码,并修在共同根因位置。
6
+ - 最小实现不得省略安全、输入校验、错误处理、兼容性、无障碍和必要验证。
7
+ - 目标项目的架构、lint、类型、测试和风格配置优先于本套通用默认值;没有配置时才使用相关规则的回退建议。
8
+ - 流程路由与升级条件只由 `skills/using-superpowers/SKILL.md` 维护;验证范围见 `rules/common/testing.md`,
9
+ Git 与授权见 `rules/05-git-workflow.md`。不在 rules 重写 Skill 的状态机。
@@ -1,22 +1,7 @@
1
- # 代码规模约束 (CRITICAL)
1
+ # 代码规模
2
2
 
3
- ## 硬性限制
3
+ 优先执行目标项目已有的 lint 和规模约束。`hooks/check-code-size.js` 提供兼容性短警告,不代替项目标准;
4
+ Markdown 不受该检查。Hook 的配置与关闭方式见 `rules/common/hooks.md`。
4
5
 
5
- | 约束项 | 限制 | 违反后果 |
6
- | ----------- | -------------- | ---------------------- |
7
- | 单代码文件行数 | **≤ 600 行** | 必须拆分文件 |
8
- | 单测试文件行数 | **≤ 1000 行** | 必须拆分测试场景 |
9
- | 单函数/方法 | **≤ 80 行** | 必须提取子函数 |
10
- | 函数参数 | **≤ 5 个** | 必须封装为对象 |
11
- | 嵌套层级 | **≤ 4 层** | 必须提前返回或提取函数 |
12
- | 单行长度 | **≤ 120 字符** | 必须换行 |
13
-
14
- **超限处理**:代码文件过长→拆分 | 测试文件过长→拆分场景 | 函数过长→提取 | 参数过多→封装对象 | 嵌套过深→早返回
15
-
16
- ## 执行要求
17
-
18
- - 编辑代码后必须触发轻量代码规模检查,只检查本次编辑的代码文件。
19
- - `*.test.*`、`*.spec.*` 和 `__tests__/` 下的测试文件上限为 1000 行。
20
- - 文档、设计稿、规则说明等非代码文件不受 600 行限制。
21
- - 检查通过时保持静默;只有代码文件超过对应上限时输出短警告。
22
- - 收到超限警告后,先拆分职责、提取模块或拆分测试场景,再继续实现。
6
+ 没有项目约束时,用函数约 80 行、参数 5 个、嵌套 4 层作为职责审查提示。超限先判断职责和可读性,
7
+ 不为满足数值拆出透传层,也不机械压缩代码;文件和行长由 Hook 提示,不在规则中重复维护。