architecture-harness 0.25.0 → 0.26.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 (244) hide show
  1. package/package.json +3 -22
  2. package/src/cli/ask.mjs +42 -0
  3. package/src/cli/ask.test.mjs +40 -0
  4. package/src/cli/branch-sync.mjs +126 -0
  5. package/src/cli/branch-sync.test.mjs +428 -0
  6. package/src/cli/budget-guard.mjs +74 -5
  7. package/src/cli/budget-guard.test.mjs +185 -2
  8. package/src/cli/budget-report.mjs +85 -0
  9. package/src/cli/budget-report.test.mjs +173 -0
  10. package/src/cli/budget.mjs +8 -5
  11. package/src/cli/check-commands.mjs +123 -11
  12. package/src/cli/check-commands.test.mjs +360 -6
  13. package/src/cli/check-feature-switches.test.mjs +110 -0
  14. package/src/cli/check-full.test.mjs +152 -0
  15. package/src/cli/check-verdict.mjs +46 -0
  16. package/src/cli/check-verdict.test.mjs +32 -0
  17. package/src/cli/check.mjs +137 -4
  18. package/src/cli/check.test.mjs +45 -0
  19. package/src/cli/checkpoint.mjs +143 -0
  20. package/src/cli/checkpoint.test.mjs +146 -0
  21. package/src/cli/child-run.mjs +7 -2
  22. package/src/cli/child-run.test.mjs +17 -2
  23. package/src/cli/ci-failures.mjs +304 -0
  24. package/src/cli/ci-failures.test.mjs +615 -0
  25. package/src/cli/ci-preview.mjs +62 -0
  26. package/src/cli/ci-preview.test.mjs +85 -0
  27. package/src/cli/ci-state.mjs +25 -29
  28. package/src/cli/ci-state.test.mjs +174 -2
  29. package/src/cli/ci-template.test.mjs +86 -0
  30. package/src/cli/claude-core.test.mjs +37 -0
  31. package/src/cli/codex-implement.mjs +580 -47
  32. package/src/cli/codex-implement.test.mjs +1946 -29
  33. package/src/cli/codex-limit.mjs +85 -0
  34. package/src/cli/codex-limit.test.mjs +179 -0
  35. package/src/cli/codex-reset.mjs +78 -0
  36. package/src/cli/codex-reset.test.mjs +192 -0
  37. package/src/cli/codex-verify.mjs +230 -0
  38. package/src/cli/codex-verify.test.mjs +402 -0
  39. package/src/cli/comment-watch.mjs +391 -0
  40. package/src/cli/comment-watch.test.mjs +392 -0
  41. package/src/cli/commit-guard.mjs +219 -0
  42. package/src/cli/commit-guard.test.mjs +809 -0
  43. package/src/cli/context-budgets.mjs +47 -0
  44. package/src/cli/context-budgets.test.mjs +96 -0
  45. package/src/cli/context-watch.mjs +116 -0
  46. package/src/cli/context-watch.test.mjs +395 -0
  47. package/src/cli/contract-history.mjs +1 -1
  48. package/src/cli/controller-guard.mjs +38 -0
  49. package/src/cli/controller-guard.test.mjs +66 -2
  50. package/src/cli/cost-stop.mjs +5 -1
  51. package/src/cli/cost-stop.test.mjs +26 -0
  52. package/src/cli/diff-shape.mjs +162 -0
  53. package/src/cli/diff-shape.test.mjs +200 -0
  54. package/src/cli/direct-lane.mjs +32 -19
  55. package/src/cli/direct-lane.test.mjs +21 -3
  56. package/src/cli/dispatch-guard.mjs +11 -0
  57. package/src/cli/dispatch-guard.test.mjs +145 -10
  58. package/src/cli/dispatch-reminder.mjs +23 -10
  59. package/src/cli/dispatch-reminder.test.mjs +63 -11
  60. package/src/cli/dispatch-route.mjs +54 -0
  61. package/src/cli/dispatch-route.test.mjs +101 -0
  62. package/src/cli/dispatch-slot.mjs +2 -2
  63. package/src/cli/dispatch-slot.test.mjs +18 -19
  64. package/src/cli/dispatch.test.mjs +3 -3
  65. package/src/cli/e2e-affected.mjs +15 -0
  66. package/src/cli/e2e-affected.test.mjs +73 -0
  67. package/src/cli/fleet.mjs +180 -0
  68. package/src/cli/fleet.test.mjs +213 -0
  69. package/src/cli/gate-slot.mjs +2 -1
  70. package/src/cli/gh-merge-command.mjs +96 -31
  71. package/src/cli/gh-merge-command.test.mjs +74 -0
  72. package/src/cli/gh-run.mjs +64 -3
  73. package/src/cli/gh-run.test.mjs +66 -1
  74. package/src/cli/git-hooks.test.mjs +25 -3
  75. package/src/cli/git-read.mjs +2 -1
  76. package/src/cli/integrate-tree.mjs +47 -0
  77. package/src/cli/integrate.mjs +143 -40
  78. package/src/cli/integrate.test.mjs +347 -1
  79. package/src/cli/integration-lane.mjs +62 -0
  80. package/src/cli/integration-lane.test.mjs +213 -0
  81. package/src/cli/ledger.mjs +4 -2
  82. package/src/cli/ledger.test.mjs +12 -3
  83. package/src/cli/legs.mjs +53 -0
  84. package/src/cli/legs.test.mjs +70 -0
  85. package/src/cli/lint-changed.mjs +59 -10
  86. package/src/cli/lint-changed.test.mjs +112 -1
  87. package/src/cli/locked-tests.mjs +134 -0
  88. package/src/cli/locked-tests.test.mjs +188 -0
  89. package/src/cli/merge-guard.mjs +234 -62
  90. package/src/cli/merge-guard.test.mjs +768 -39
  91. package/src/cli/metrics.mjs +53 -0
  92. package/src/cli/metrics.test.mjs +73 -0
  93. package/src/cli/milestone.mjs +297 -0
  94. package/src/cli/milestone.test.mjs +294 -0
  95. package/src/cli/mutate.mjs +203 -0
  96. package/src/cli/mutate.test.mjs +134 -0
  97. package/src/cli/output-redaction.mjs +26 -0
  98. package/src/cli/output-redaction.test.mjs +117 -0
  99. package/src/cli/overview.mjs +131 -0
  100. package/src/cli/overview.test.mjs +137 -0
  101. package/src/cli/pause.mjs +93 -0
  102. package/src/cli/pause.test.mjs +109 -0
  103. package/src/cli/plan-check.mjs +84 -12
  104. package/src/cli/plan-check.test.mjs +152 -2
  105. package/src/cli/plan-stop.mjs +7 -4
  106. package/src/cli/plan-stop.test.mjs +87 -0
  107. package/src/cli/platform-risk.mjs +46 -0
  108. package/src/cli/platform-risk.test.mjs +38 -0
  109. package/src/cli/plugin-skills.test.mjs +25 -0
  110. package/src/cli/pr-guard.mjs +128 -0
  111. package/src/cli/pr-guard.test.mjs +154 -0
  112. package/src/cli/promotion-branch.mjs +2 -0
  113. package/src/cli/qc.mjs +160 -27
  114. package/src/cli/qc.test.mjs +93 -0
  115. package/src/cli/report-stop.mjs +5 -0
  116. package/src/cli/report-stop.test.mjs +23 -1
  117. package/src/cli/retry-failed.mjs +3 -1
  118. package/src/cli/review-gate.mjs +24 -6
  119. package/src/cli/review-gate.test.mjs +116 -0
  120. package/src/cli/review-promotion.mjs +107 -0
  121. package/src/cli/review-promotion.test.mjs +251 -0
  122. package/src/cli/role-budget.mjs +50 -0
  123. package/src/cli/role-budget.test.mjs +91 -0
  124. package/src/cli/run-log.mjs +73 -0
  125. package/src/cli/run-log.test.mjs +121 -0
  126. package/src/cli/secret-patterns.mjs +16 -0
  127. package/src/cli/secret-patterns.test.mjs +73 -0
  128. package/src/cli/setup-block.mjs +24 -0
  129. package/src/cli/setup-block.test.mjs +96 -0
  130. package/src/cli/setup-checks.mjs +65 -0
  131. package/src/cli/setup-checks.test.mjs +158 -0
  132. package/src/cli/setup-compaction.mjs +55 -0
  133. package/src/cli/setup-compaction.test.mjs +115 -0
  134. package/src/cli/setup-skills.mjs +65 -0
  135. package/src/cli/setup-skills.test.mjs +171 -0
  136. package/src/cli/setup.mjs +107 -0
  137. package/src/cli/setup.test.mjs +275 -0
  138. package/src/cli/skill-length.test.mjs +8 -0
  139. package/src/cli/spawn-command.mjs +47 -0
  140. package/src/cli/spawn-command.test.mjs +64 -0
  141. package/src/cli/task-gate-review.test.mjs +21 -2
  142. package/src/cli/task-gate.mjs +25 -12
  143. package/src/cli/task-gate.test.mjs +43 -5
  144. package/src/cli/tokens.mjs +46 -3
  145. package/src/cli/tokens.test.mjs +103 -3
  146. package/src/cli/tools.mjs +49 -0
  147. package/src/cli/tools.test.mjs +89 -0
  148. package/src/cli/transcript-usage.mjs +27 -0
  149. package/src/cli/transcript-usage.test.mjs +34 -0
  150. package/src/cli/user-config-package.mjs +1 -1
  151. package/src/cli/user-config-toml.mjs +63 -7
  152. package/src/cli/user-config.mjs +39 -7
  153. package/src/cli/user-config.test.mjs +238 -5
  154. package/src/cli/watch-arm.mjs +39 -0
  155. package/src/cli/watch-arm.test.mjs +87 -0
  156. package/src/cli/watch.mjs +80 -35
  157. package/src/cli/watch.test.mjs +233 -27
  158. package/src/cli/work-order-guard.mjs +2 -1
  159. package/src/cli/workflow-hooks.test.mjs +18 -4
  160. package/src/cli/workflow-settings.mjs +44 -8
  161. package/src/cli/workflow-settings.test.mjs +124 -1
  162. package/src/cli/worktree.mjs +14 -1
  163. package/src/cli/worktree.test.mjs +20 -1
  164. package/src/config.mjs +174 -7
  165. package/src/config.test.mjs +327 -5
  166. package/src/consumer-package.mjs +31 -0
  167. package/src/consumer-package.test.mjs +54 -0
  168. package/src/descriptions.mjs +2 -0
  169. package/src/eslint/index.mjs +12 -0
  170. package/src/eslint/jsx.mjs +20 -0
  171. package/src/eslint/preset.mjs +26 -2
  172. package/src/eslint/preset.test.mjs +104 -2
  173. package/src/eslint/rules/no-arbitrary-class-value.mjs +32 -0
  174. package/src/eslint/rules/no-literal-color.mjs +94 -0
  175. package/src/eslint/rules/no-static-inline-style.mjs +41 -0
  176. package/src/eslint/rules/one-component-per-file.mjs +70 -0
  177. package/src/eslint/rules/raw-element-in-primitive.mjs +31 -0
  178. package/src/eslint/rules/timeless-comment.mjs +92 -0
  179. package/src/eslint/rules.test.mjs +189 -0
  180. package/src/eslint/ui-regressions.test.mjs +39 -0
  181. package/src/gates/contract-operations.mjs +3 -3
  182. package/src/gates/contract-operations.test.mjs +28 -0
  183. package/src/gates/feature-switches.mjs +19 -0
  184. package/src/gates/feature-switches.test.mjs +55 -0
  185. package/src/gates/plain-language.mjs +396 -0
  186. package/src/gates/plain-language.test.mjs +210 -0
  187. package/src/gates/runtime-imports.test.mjs +114 -0
  188. package/src/gates/saga-key.test.mjs +1 -1
  189. package/src/global-skills.mjs +9 -0
  190. package/src/global-skills.test.mjs +53 -0
  191. package/src/plugin.test.mjs +3 -2
  192. package/src/ui/class-sites.mjs +38 -6
  193. package/src/ui/codemod.mjs +4 -1
  194. package/src/ui/codemod.test.mjs +52 -0
  195. package/src/ui/components.mjs +5 -3
  196. package/src/ui/components.test.mjs +8 -0
  197. package/src/ui/dupes.test.mjs +18 -0
  198. package/templates/docs/enforcement.md +12 -2
  199. package/templates/docs/ui.md +33 -0
  200. package/templates/githooks/pre-commit +1 -0
  201. package/templates/githooks/pre-push +11 -2
  202. package/templates/github/workflows/ci.yml +57 -3
  203. package/user-config/claude/CLAUDE.core.md +28 -0
  204. package/user-config/claude/settings.shared.json +41 -1
  205. package/src/cli/screens-discovery.mjs +0 -60
  206. package/src/cli/screens.mjs +0 -84
  207. package/src/cli/stack.mjs +0 -14
  208. package/src/cli/throwaway-db.mjs +0 -127
  209. package/src/cli/throwaway-db.test.mjs +0 -83
  210. package/src/screens/auth-context.test.mjs +0 -41
  211. package/src/screens/auth-run.test.mjs +0 -147
  212. package/src/screens/auth.mjs +0 -223
  213. package/src/screens/auth.test.mjs +0 -76
  214. package/src/screens/capture-idle.test.mjs +0 -27
  215. package/src/screens/capture.browser-test.mjs +0 -73
  216. package/src/screens/capture.mjs +0 -175
  217. package/src/screens/capture.test.mjs +0 -28
  218. package/src/screens/catalog.browser-test.mjs +0 -32
  219. package/src/screens/catalog.mjs +0 -72
  220. package/src/screens/catalog.test.mjs +0 -36
  221. package/src/screens/chrome.mjs +0 -21
  222. package/src/screens/compare.mjs +0 -40
  223. package/src/screens/compare.test.mjs +0 -30
  224. package/src/screens/discovery.browser-test.mjs +0 -29
  225. package/src/screens/discovery.mjs +0 -158
  226. package/src/screens/discovery.test.mjs +0 -27
  227. package/src/screens/inventory.mjs +0 -69
  228. package/src/screens/inventory.test.mjs +0 -10
  229. package/src/screens/map.mjs +0 -63
  230. package/src/screens/map.test.mjs +0 -35
  231. package/src/screens/open.browser-test.mjs +0 -50
  232. package/src/screens/regions.mjs +0 -137
  233. package/src/screens/regions.test.mjs +0 -38
  234. package/src/screens/session-files.mjs +0 -39
  235. package/src/screens/session-files.test.mjs +0 -39
  236. package/src/screens/setup.browser-test.mjs +0 -49
  237. package/src/screens/setup.mjs +0 -78
  238. package/src/screens/stack-auth.browser-test.mjs +0 -30
  239. package/src/screens/stack-auth.mjs +0 -106
  240. package/src/screens/stack-auth.test.mjs +0 -65
  241. package/src/screens/write-guard.mjs +0 -26
  242. package/src/stack/stack.mjs +0 -131
  243. package/src/stack/stack.test.mjs +0 -40
  244. package/src/stack/supervisor.mjs +0 -30
@@ -0,0 +1,114 @@
1
+ import assert from "node:assert/strict";
2
+ import { cpSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+ import { tmpdir } from "node:os";
5
+ import { join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { test } from "node:test";
8
+ import ts from "typescript";
9
+ import { defaults } from "../config.mjs";
10
+
11
+ function bareImports(source) {
12
+ const found = [];
13
+ const tree = ts.createSourceFile("source.mjs", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
14
+ function visit(node) {
15
+ const specifier = ts.isImportDeclaration(node) || ts.isExportDeclaration(node)
16
+ ? node.moduleSpecifier
17
+ : ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || node.expression.getText(tree) === "require")
18
+ ? node.arguments[0] : undefined;
19
+ if (specifier && ts.isStringLiteralLike(specifier) && !/^(?:node:|\.{1,2}\/)/.test(specifier.text)) found.push(specifier.text);
20
+ ts.forEachChild(node, visit);
21
+ }
22
+ visit(tree);
23
+ return found;
24
+ }
25
+
26
+ test("runtime import gate rejects packages in each import form", () => {
27
+ for (const source of ['import spawn from "cross-spawn"', 'import "package"', 'export { x } from "package"', 'import("package")', 'require("package")']) {
28
+ assert.equal(bareImports(source).length, 1, source);
29
+ }
30
+ assert.deepEqual(bareImports('import fs from "node:fs"; import "./local.mjs"; // import "ignored"\nconst example = `import "ignored"`;'), []);
31
+ });
32
+
33
+ test("the hook scan rejects an unresolved script variable", () => {
34
+ assert.throws(() => hookJavaScript('node -e "$MISSING_SCRIPT"'), /unresolved.*MISSING_SCRIPT/i);
35
+ });
36
+
37
+ function hookJavaScript(source) {
38
+ const bodies = [...source.matchAll(/\bnode\s+-e\s+'([^']*)'/g)].map((match) => match[1]);
39
+ const variables = new Map([...source.matchAll(/(?:^|\n)([A-Za-z_]\w*)='([^']*)'/g)].map((match) => [match[1], match[2]]));
40
+ for (const match of source.matchAll(/\bnode\s+-e\s+"\$([A-Za-z_]\w*)"/g)) {
41
+ assert.ok(variables.has(match[1]), `Unresolved hook script variable: ${match[1]}`);
42
+ bodies.push(variables.get(match[1]));
43
+ }
44
+ return bodies;
45
+ }
46
+
47
+ function runtimeImports(root) {
48
+ const violations = [];
49
+ let hookScripts = 0;
50
+ for (const directory of ["packages/qc-harness/src", "hooks"]) {
51
+ for (const entry of readdirSync(join(root, directory), { recursive: true }).map(String)) {
52
+ // Test modules execute in the development installation, outside the plugin runtime.
53
+ if (!/\.(?:mjs|cjs|js|sh)$/.test(entry) || /\.(?:test|browser-test)\.(?:mjs|cjs|js)$/.test(entry)) continue;
54
+ if (entry.endsWith(".sh") && directory !== "hooks") continue;
55
+ const file = directory + "/" + entry.replaceAll("\\", "/");
56
+ const source = readFileSync(join(root, file), "utf8");
57
+ const bodies = entry.endsWith(".sh") ? hookJavaScript(source) : [source];
58
+ if (entry.endsWith(".sh")) hookScripts += bodies.length;
59
+ for (const body of bodies) {
60
+ for (const name of bareImports(body)) violations.push(`${file}: ${name}`);
61
+ }
62
+ }
63
+ }
64
+ return { violations, hookScripts };
65
+ }
66
+
67
+
68
+ test("plugin runtime imports only built-ins and relative files", () => {
69
+ const { violations, hookScripts } = runtimeImports(fileURLToPath(new URL("../../../../", import.meta.url)));
70
+ assert.deepEqual(violations, []);
71
+ assert.ok(hookScripts > 0, "the real hooks contain JavaScript scripts to scan");
72
+ });
73
+
74
+ for (const [file, source] of [
75
+ ["hooks/probe.cjs", 'const peer = require("forbidden-peer");'],
76
+ ["packages/qc-harness/src/probe.cjs", 'require("forbidden-peer");'],
77
+ ["hooks/probe.sh", `#!/bin/sh
78
+ node -e '
79
+ const peer = require("forbidden-peer");
80
+ '`],
81
+ ["hooks/variable.sh", `#!/bin/sh
82
+ SCRIPT='const peer = require("forbidden-peer");'
83
+ node -e "$SCRIPT"`],
84
+ ]) {
85
+ test(`runtime import gate rejects a bare import in ${file}`, () => {
86
+ const root = mkdtempSync(join(tmpdir(), "qc-runtime-imports-"));
87
+ try {
88
+ mkdirSync(join(root, "hooks"), { recursive: true });
89
+ mkdirSync(join(root, "packages/qc-harness/src"), { recursive: true });
90
+ writeFileSync(join(root, file), source);
91
+ assert.deepEqual(runtimeImports(root).violations, [`${file}: forbidden-peer`]);
92
+ } finally {
93
+ rmSync(root, { recursive: true, force: true });
94
+ }
95
+ });
96
+ }
97
+
98
+ test("qc check runs from a plugin cache with no node_modules", () => {
99
+ const root = mkdtempSync(join(tmpdir(), "qc-cache-"));
100
+ try {
101
+ const source = fileURLToPath(new URL("../", import.meta.url));
102
+ cpSync(source, join(root, "src"), { recursive: true, filter: (file) => !/\.(?:test|browser-test)\.mjs$/.test(file) });
103
+ writeFileSync(join(root, "qc.config.json"), JSON.stringify({
104
+ featureRoots: [],
105
+ gates: Object.fromEntries(Object.keys(defaults.gates).map((name) => [name, false])),
106
+ check: { commands: [`"${process.execPath}" -e 'process.exit(0)'`] },
107
+ }));
108
+ const result = spawnSync(process.execPath, [join(root, "src", "cli", "qc.mjs"), "check"], { cwd: root, encoding: "utf8" });
109
+ assert.equal(result.status, 0, result.stdout + result.stderr);
110
+ assert.match(result.stdout, /RUN /);
111
+ } finally {
112
+ rmSync(root, { recursive: true, force: true });
113
+ }
114
+ });
@@ -222,7 +222,7 @@ test("a wrapping call of stored values passes", () => {
222
222
  assert.deepEqual(check("runPipeline({ mutationId: options.mutationId ?? state.clientMutationId });"), []);
223
223
  });
224
224
 
225
- test("the outbox key expression of quality-control-mono fails inside a runner call", () => {
225
+ test("the outbox key expression of example-app fails inside a runner call", () => {
226
226
  assert.equal(check("runPipeline({ mutationId: options.mutationId ?? crypto.randomUUID(), failureCode: null });").length, 1);
227
227
  });
228
228
 
@@ -0,0 +1,9 @@
1
+ // Index of global skills that apply without a qc.config.json requirement.
2
+ export const GLOBAL_SKILLS = Object.freeze([
3
+ "applying-engineering-standards",
4
+ "navigating-source-code",
5
+ "registering-work",
6
+ "reviewing-before-merge",
7
+ "writing-decision-final-specs",
8
+ "writing-plain-english",
9
+ ]);
@@ -0,0 +1,53 @@
1
+ import { strict as assert } from "node:assert";
2
+ import { readdirSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { test } from "node:test";
5
+ import { fileURLToPath } from "node:url";
6
+ import { GLOBAL_SKILLS } from "./global-skills.mjs";
7
+
8
+ const PLUGIN = fileURLToPath(new URL("../../../", import.meta.url));
9
+
10
+ test("each global skill has its folder name and a Use when description in its frontmatter", () => {
11
+ for (const skill of GLOBAL_SKILLS) {
12
+ const text = readFileSync(`${PLUGIN}skills/${skill}/SKILL.md`, "utf8");
13
+ const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(text)?.[1] ?? "";
14
+ assert.equal(/^name: (.+)$/m.exec(frontmatter)?.[1], skill, skill);
15
+ assert.match(frontmatter, /^description: "Use when/m, skill);
16
+ }
17
+ });
18
+
19
+ test("global skill files contain no paths tied to a user's machine", () => {
20
+ for (const skill of GLOBAL_SKILLS) {
21
+ const folder = `${PLUGIN}skills/${skill}`;
22
+ for (const entry of readdirSync(folder, { recursive: true, withFileTypes: true })) {
23
+ if (!entry.isFile()) continue;
24
+ const path = join(entry.parentPath, entry.name);
25
+ assert.doesNotMatch(readFileSync(path, "utf8"), /C:\\|\/Users\/|\/home\/|~\//, path);
26
+ }
27
+ }
28
+ });
29
+
30
+ test("shipped global skills use neutral text and optional source navigation tools", () => {
31
+ const registration = readFileSync(`${PLUGIN}skills/registering-work/SKILL.md`, "utf8");
32
+ assert.doesNotMatch(registration, /performance review|employer|roleflow\//i);
33
+ assert.match(registration, /merged pull request with no issue behind it leaves the work untracked/i);
34
+ const review = readFileSync(`${PLUGIN}skills/reviewing-before-merge/SKILL.md`, "utf8");
35
+ assert.doesNotMatch(review, /Keep this bar local|Do not add it to a shared rules file/);
36
+ assert.doesNotMatch(review, /suspend|early development|fast, cheap iteration/i);
37
+ assert.match(review, /Run `\/code-review` against the pull request before it merges/);
38
+ const navigation = readFileSync(`${PLUGIN}skills/navigating-source-code/SKILL.md`, "utf8");
39
+ assert.match(navigation, /gitnexus.*optional/i);
40
+ assert.match(navigation, /^description: .*falling back to the Claude Code `Grep` and `Glob` tools/m);
41
+ assert.match(navigation, /unavailable.*Claude Code `Grep` and `Glob` tools/i);
42
+ });
43
+
44
+ test("the plugin contains exactly the global skills and the kit skills", () => {
45
+ assert.deepEqual(readdirSync(`${PLUGIN}skills`).sort(), [
46
+ ...GLOBAL_SKILLS,
47
+ "architecture",
48
+ "codex",
49
+ "enforcement",
50
+ "security",
51
+ "swarm",
52
+ ].sort());
53
+ });
@@ -2,14 +2,15 @@ import { strict as assert } from "node:assert";
2
2
  import { readdirSync, readFileSync } from "node:fs";
3
3
  import { test } from "node:test";
4
4
  import { fileURLToPath } from "node:url";
5
+ import { GLOBAL_SKILLS } from "./global-skills.mjs";
5
6
 
6
7
  const PLUGIN = fileURLToPath(new URL("../../../", import.meta.url));
7
8
  const EDIT_TOOLS = ["Write", "Edit", "MultiEdit", "NotebookEdit"];
8
9
 
9
- test("every skill applies only where qc.config.json exists, in its description and in its body", () => {
10
+ test("every kit skill applies only where qc.config.json exists, in its description and in its body", () => {
10
11
  const skills = readdirSync(`${PLUGIN}skills`);
11
12
  assert.ok(skills.length > 0);
12
- for (const skill of skills) {
13
+ for (const skill of skills.filter((name) => !GLOBAL_SKILLS.includes(name))) {
13
14
  const text = readFileSync(`${PLUGIN}skills/${skill}/SKILL.md`, "utf8");
14
15
  const description = /^description: (.+)$/m.exec(text)?.[1] ?? "";
15
16
  assert.match(description, /only in a repository with a `qc\.config\.json`/, skill);
@@ -14,6 +14,9 @@ function calleeName(ts, expression) {
14
14
  /** The text spans of a string-like node, as source ranges inside its quotes or between its substitutions. */
15
15
  function spansOf(ts, file, node) {
16
16
  const start = node.getStart(file);
17
+ if (ts.isIdentifier(node)) {
18
+ return [{ start, end: node.getEnd(), leftOpen: false, rightOpen: false, identifierKey: true }];
19
+ }
17
20
  if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {
18
21
  return [{ start: start + 1, end: node.getEnd() - 1, leftOpen: false, rightOpen: false }];
19
22
  }
@@ -35,11 +38,12 @@ function spansOf(ts, file, node) {
35
38
 
36
39
  /**
37
40
  * Every span of class text in a file.
38
- * @returns {{start: number, end: number, leftOpen: boolean, rightOpen: boolean}[]} in source order, none twice
41
+ * @returns {{start: number, end: number, leftOpen: boolean, rightOpen: boolean, identifierKey?: boolean}[]} in source order, none twice
39
42
  */
40
43
  export function classSpans(ts, file, callees) {
41
44
  const callable = new Set(callees);
42
45
  const found = new Map();
46
+ let checker;
43
47
 
44
48
  function take(node) {
45
49
  for (const span of spansOf(ts, file, node)) found.set(span.start, span);
@@ -56,6 +60,25 @@ export function classSpans(ts, file, callees) {
56
60
  return object.properties.filter((p) => wanted.has(propertyName(p))).map((p) => p.initializer);
57
61
  }
58
62
 
63
+ /** Fragment: resolves a variant object through a same-file const binding. */
64
+ function variantObject(node) {
65
+ if (ts.isObjectLiteralExpression(node)) return node;
66
+ if (!ts.isIdentifier(node) && !ts.isShorthandPropertyAssignment(node)) return null;
67
+ if (!checker) {
68
+ const options = { noLib: true, noResolve: true };
69
+ const host = ts.createCompilerHost(options);
70
+ host.getSourceFile = (name) => name === file.fileName ? file : undefined;
71
+ checker = ts.createProgram([file.fileName], options, host).getTypeChecker();
72
+ }
73
+ const symbol = ts.isShorthandPropertyAssignment(node)
74
+ ? checker.getShorthandAssignmentValueSymbol(node)
75
+ : checker.getSymbolAtLocation(node);
76
+ const declaration = symbol?.valueDeclaration;
77
+ if (!declaration || !ts.isVariableDeclaration(declaration) || declaration.getSourceFile() !== file) return null;
78
+ if (!ts.isVariableDeclarationList(declaration.parent) || !(declaration.parent.flags & ts.NodeFlags.Const)) return null;
79
+ return declaration.initializer && ts.isObjectLiteralExpression(declaration.initializer) ? declaration.initializer : null;
80
+ }
81
+
59
82
  /**
60
83
  * A node whose value is class text: a string, or an expression that yields one. A condition, a comparison
61
84
  * operand and the argument of a call outside `classCallees` are not class text, so the walk stops there.
@@ -89,7 +112,7 @@ export function classSpans(ts, file, callees) {
89
112
  for (const element of node.elements) collectValue(element, objectKeys);
90
113
  } else if (ts.isObjectLiteralExpression(node) && objectKeys) {
91
114
  for (const property of node.properties) {
92
- if (ts.isPropertyAssignment(property) && ts.isStringLiteral(property.name)) take(property.name);
115
+ if (ts.isPropertyAssignment(property) && (ts.isStringLiteral(property.name) || ts.isIdentifier(property.name))) take(property.name);
93
116
  }
94
117
  }
95
118
  }
@@ -98,9 +121,13 @@ export function classSpans(ts, file, callees) {
98
121
  function collectVariants(call) {
99
122
  const [base, config] = call.arguments;
100
123
  if (base) collectValue(base, false);
101
- if (!config) return;
102
- for (const variants of propertyValue(config, new Set(["variants"]))) {
103
- if (!ts.isObjectLiteralExpression(variants)) continue;
124
+ if (!config || !ts.isObjectLiteralExpression(config)) return;
125
+ for (const property of config.properties) {
126
+ if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) continue;
127
+ if (!ts.isIdentifier(property.name) && !ts.isStringLiteral(property.name)) continue;
128
+ if (property.name.text !== "variants") continue;
129
+ const variants = variantObject(ts.isShorthandPropertyAssignment(property) ? property : property.initializer);
130
+ if (!variants) continue;
104
131
  for (const group of variants.properties) {
105
132
  if (!ts.isPropertyAssignment(group) || !ts.isObjectLiteralExpression(group.initializer)) continue;
106
133
  for (const option of group.initializer.properties) {
@@ -140,7 +167,12 @@ export function tokensOfSpan(text, span) {
140
167
  const touchesLeft = span.leftOpen && found.index === 0;
141
168
  const touchesRight = span.rightOpen && found.index + found[0].length === raw.length;
142
169
  if (touchesLeft || touchesRight || found[0].includes("\\")) continue;
143
- out.push({ text: found[0], start: span.start + found.index, end: span.start + found.index + found[0].length });
170
+ out.push({
171
+ text: found[0],
172
+ start: span.start + found.index,
173
+ end: span.start + found.index + found[0].length,
174
+ ...(span.identifierKey ? { identifierKey: true } : {}),
175
+ });
144
176
  }
145
177
  return out;
146
178
  }
@@ -63,7 +63,10 @@ export function codemodSource(ts, name, text, map, callees) {
63
63
  const edits = [];
64
64
  for (const token of classTokensOf(ts, parseSource(ts, name, text), callees)) {
65
65
  const next = rewriteToken(token.text, map);
66
- if (next !== token.text) edits.push({ ...token, next });
66
+ if (next !== token.text) {
67
+ const quote = token.identifierKey && !ts.isIdentifierText(next, ts.ScriptTarget.Latest);
68
+ edits.push({ ...token, next: quote ? JSON.stringify(next) : next });
69
+ }
67
70
  }
68
71
  let out = text;
69
72
  for (const edit of edits.sort((a, b) => b.start - a.start)) out = out.slice(0, edit.start) + edit.next + out.slice(edit.end);
@@ -102,6 +102,58 @@ test("a compoundVariants class is rewritten and its selector is not", () => {
102
102
  assert.equal(out.text, `const v = cva("a", { compoundVariants: [{ size: "text-[11px]", className: "text-2xs" }] });`);
103
103
  });
104
104
 
105
+ test("a clsx identifier key is quoted when its replacement needs quotes", () => {
106
+ const out = run(`const a = clsx({ shadow: on, rounded: active, flex: ready });`, {
107
+ shadow: "shadow-sm",
108
+ rounded: "block",
109
+ });
110
+ assert.equal(out.text, `const a = clsx({ "shadow-sm": on, block: active, flex: ready });`);
111
+ assert.equal(out.count, 2);
112
+ assert.equal(ts.createSourceFile("a.tsx", out.text, ts.ScriptTarget.Latest).parseDiagnostics.length, 0);
113
+ });
114
+
115
+ test("a computed clsx key and a shorthand key stay untouched", () => {
116
+ const text = `const a = clsx({ [shadow]: on, ["shadow"]: active, shadow });`;
117
+ assert.deepEqual(run(text, { shadow: "shadow-sm" }), { text, count: 0 });
118
+ });
119
+
120
+ test("cva resolves a const object for shorthand and explicit variant properties", () => {
121
+ const text = [
122
+ `const variants = { size: { sm: "text-[11px]", md: "rounded-[4px]" } };`,
123
+ `const a = cva("a", { variants });`,
124
+ `const b = cva("b", { variants: variants });`,
125
+ ].join("\n");
126
+ const out = run(text);
127
+ assert.equal(out.text, text.replace("text-[11px]", "text-2xs").replace("rounded-[4px]", "rounded-sm"));
128
+ assert.equal(out.count, 2);
129
+ });
130
+
131
+ test("cva skips imported, mutable, nonliteral, and shadowed variants", () => {
132
+ for (const declaration of [
133
+ `import { variants } from "./variants";`,
134
+ `let variants = { size: { sm: "text-[11px]" } };`,
135
+ `var variants = { size: { sm: "text-[11px]" } };`,
136
+ `const variants = makeVariants("text-[11px]");`,
137
+ `const source = { size: { sm: "text-[11px]" } }; const variants = source;`,
138
+ ]) {
139
+ const text = `${declaration}\nconst a = cva("a", { variants });`;
140
+ assert.deepEqual(run(text), { text, count: 0 });
141
+ }
142
+ const text = `const variants = { size: { sm: "text-[11px]" } };\nfunction make(variants) { return cva("a", { variants }); }`;
143
+ assert.deepEqual(run(text), { text, count: 0 });
144
+ });
145
+
146
+ test("cva resolves the nearest const variants object in a function", () => {
147
+ const text = [
148
+ `const variants = { size: { sm: "text-[11px]" } };`,
149
+ `function make() {`,
150
+ ` const variants = { size: { sm: "rounded-[4px]" } };`,
151
+ ` return cva("a", { variants });`,
152
+ `}`,
153
+ ].join("\n");
154
+ assert.deepEqual(run(text), { text: text.replace("rounded-[4px]", "rounded-sm"), count: 1 });
155
+ });
156
+
105
157
  test("the static parts of a template literal are rewritten and a token cut by a substitution is not", () => {
106
158
  const out = run("const a = cn(`text-[11px] ${x} rounded-[4px] text-[11px]${y}`);");
107
159
  assert.equal(out.text, "const a = cn(`text-2xs ${x} rounded-sm text-[11px]${y}`);");
@@ -19,9 +19,11 @@ export function firstSentence(comment) {
19
19
  /** The layer of a file: the longest `layers` prefix that holds it, else `feature:<name>`, else `platform`. */
20
20
  export function layerOf(rel, options, featureDir = "features") {
21
21
  let best = null;
22
- for (const [layer, prefix] of Object.entries(options.layers ?? {})) {
23
- const folder = `${prefix.replace(/\/+$/, "")}/`;
24
- if (rel.startsWith(folder) && (best === null || folder.length > best.length)) best = { layer, length: folder.length };
22
+ for (const [layer, prefixes] of Object.entries(options.layers ?? {})) {
23
+ for (const prefix of [prefixes].flat()) {
24
+ const folder = `${prefix.replace(/\/+$/, "")}/`;
25
+ if (rel.startsWith(folder) && (best === null || folder.length > best.length)) best = { layer, length: folder.length };
26
+ }
25
27
  }
26
28
  if (best) return best.layer;
27
29
  const parts = rel.split("/");
@@ -6,6 +6,14 @@ import { loadTypeScript } from "./typescript.mjs";
6
6
  const ts = loadTypeScript();
7
7
  const extract = (text, rel = "frontend/src/platform/ui/primitives/button.tsx") => extractComponents(ts, rel, text);
8
8
 
9
+ test("a layer accepts multiple folders and keeps the longest folder match", () => {
10
+ const options = { layers: { primitive: ["src/ui", "src/shared/primitives"], pattern: "src/ui/patterns" } };
11
+ assert.equal(layerOf("src/ui/button.tsx", options), "primitive");
12
+ assert.equal(layerOf("src/shared/primitives/input.tsx", options), "primitive");
13
+ assert.equal(layerOf("src/ui/patterns/form.tsx", options), "pattern");
14
+ assert.equal(layerOf("src/ui-extra/button.tsx", options), "platform");
15
+ });
16
+
9
17
  test("a function component records its name, line, props and first JSDoc sentence", () => {
10
18
  const [button] = extract(`import React from "react";
11
19
  interface ButtonProps { label: string; onPress?: () => void }
@@ -13,6 +13,24 @@ const kinds = (found, kind) => found.filter((one) => one.kind === kind);
13
13
 
14
14
  const LONG = "flex items-center gap-2 rounded-md border px-3 py-2";
15
15
 
16
+ test("identifier keys in clsx objects count as duplicate class text", () => {
17
+ const files = ["a", "b", "c"].map((name) => ({
18
+ path: `ui/${name}.tsx`,
19
+ contents: `const a = clsx({ shadow: on, ["rounded"]: on });`,
20
+ }));
21
+ const found = kinds(find(files, { minClassLength: 1 }), "class-string");
22
+ assert.deepEqual(found.map((one) => one.key), ["shadow"]);
23
+ });
24
+
25
+ test("a const variants object used by cva counts as duplicate class text", () => {
26
+ const files = ["a", "b", "c"].map((name) => ({
27
+ path: `ui/${name}.tsx`,
28
+ contents: `const variants = { size: { sm: "${LONG}" } }; const a = cva("a", { variants });`,
29
+ }));
30
+ const found = kinds(find(files), "class-string");
31
+ assert.deepEqual(found.map((one) => one.key), [[...LONG.split(" ")].sort().join(" ")]);
32
+ });
33
+
16
34
  test("a long class string in three files is reported once, whatever the token order", () => {
17
35
  const reordered = "px-3 py-2 gap-2 flex items-center rounded-md border";
18
36
  const files = [
@@ -37,6 +37,7 @@ Read it as an index; the reasoning is under the headings that follow.
37
37
  | An exported async function takes a cancellation token last | `qc/signal-last-param` |
38
38
  | Storage imports belong in the resource block | `qc/storage-only-in-resource` |
39
39
  | Every business table carries the tenant column | `qc/tenant-scoped-table` |
40
+ | A comment states what is true, never when it became true or what is still owed | `qc/timeless-comment` |
40
41
  | Every cited id and doc path resolves, and nothing references another repository | `qc check` (citations) |
41
42
  | A comment under infra/ is one line of why, never a paragraph, a banner or code | `qc check` (comment-style) |
42
43
  | A repository's own gates each ship a case that must fail | `qc check` (gate-tests) |
@@ -123,8 +124,17 @@ Code carries the meaning. A comment exists only where it cannot.
123
124
  - Never write a number or quantity threshold (neither digits nor spelled-out words). Cite the
124
125
  registry or the doc that owns it. Citation ids are the exception.
125
126
 
126
- Comment prose quality is a review concern, deliberately not a rule: a second rule demanding a citation on
127
- every comment would fight the numeric one, and each false positive costs an agent round-trip.
127
+ `timeless-comment` prints advice as warnings and never fails a change.
128
+
129
+ Prose quality is a review concern by default. A second rule that demanded a citation on every
130
+ comment would fight the numeric one, and each false positive costs an agent a round trip.
131
+
132
+ A repository that wants the writing itself gated switches on `plain-language`. The gate reads
133
+ documents and comments against Simplified Technical English (ASD-STE100) and the Google developer
134
+ documentation style. It checks sentence length, paragraph length, the voice, an approved word
135
+ list, heading case and link text. The rest of the standard stays a review rule, because it needs a
136
+ part-of-speech tagger, and the approved dictionary carries a licence. State the vocabulary under
137
+ `plainLanguage.replace`, then switch the gate on.
128
138
 
129
139
  ## Prose in docs
130
140
 
@@ -30,3 +30,36 @@ WCAG 2.2 AA. Every drag has a non-drag equivalent. The focus ring is never remov
30
30
  Data-oriented discipline applies to any hot loop: per frame, or over a large item count, or
31
31
  allocating per iteration on the interaction thread. Assert it by measuring allocation, not by
32
32
  reading the code.
33
+
34
+ ## Adopt the UI lint rules
35
+
36
+ Enable these five rules under `rules` in `qc.config.json`:
37
+
38
+ - `one-component-per-file`
39
+ - `raw-element-in-primitive`
40
+ - `no-arbitrary-class-value`
41
+ - `no-literal-color`
42
+ - `no-static-inline-style`
43
+
44
+ The preset applies them to `clientFiles`. The primitive folders come from `ui.layers.primitive`, which accepts one folder or an array.
45
+ Local `memo` and `forwardRef` wrappers keep one component. Multiple components each receive a finding on their declaration.
46
+ Literal colors fail in presentation attributes, class strings, and JSX style properties. Text attributes and theme token objects pass.
47
+ Use classes and theme tokens for static presentation. Inline styles with runtime values, such as `style={{ width: size }}`, pass.
48
+ An object with only literal values, such as `style={{ width: 12 }}`, fails `qc/no-static-inline-style`.
49
+
50
+ For an existing frontend, use ESLint 9.24 or later; the kit uses ESLint 9.39.
51
+ `eslint --suppress-rule <rule>` writes `eslint-suppressions.json` as the baseline for existing findings, beside the filter for changed lines.
52
+ Create the initial baseline, then commit it:
53
+
54
+ ```sh
55
+ npx eslint frontend/src --suppress-rule qc/one-component-per-file --suppress-rule qc/raw-element-in-primitive --suppress-rule qc/no-arbitrary-class-value --suppress-rule qc/no-literal-color --suppress-rule qc/no-static-inline-style
56
+ ```
57
+
58
+ After adoption, run `npx qc lint`. It applies each baseline count per file and rule before checking changed lines.
59
+ Findings above a recorded count remain subject to the changed-line check.
60
+ With no named files, fewer findings than a recorded count fail as stale, including entries for untouched or deleted lintable files.
61
+ Named-file runs skip the stale check. The gate skips baseline entries for unsupported or ignored files.
62
+ With `--staged`, the gate reads source files and the baseline from the index.
63
+ Run `npx eslint frontend/src` without suppression-generation flags to check the whole frontend with the same baseline.
64
+ After you fix findings, run `npx eslint frontend/src --prune-suppressions` and commit the smaller file.
65
+ The baseline may only shrink: accept removals and lower counts.
@@ -5,6 +5,7 @@
5
5
  set -euo pipefail
6
6
  # Runs before the file filter below, so a commit of .tf, .yml, or .md files is checked too.
7
7
  npx qc work-order-check || exit 1
8
+ npx qc commit-guard || exit 4
8
9
  # The staged list is NUL-separated in a file, never in an argument: a large merge commit would
9
10
  # pass the command-line limit of npx.cmd on Windows (8191 characters).
10
11
  STAGED=$(mktemp)
@@ -10,10 +10,16 @@ cd "$(git rev-parse --show-toplevel)"
10
10
  # invocation this cannot reason about, which is a reason to run the gates, not to skip them.
11
11
  named=""
12
12
  carries_commits=""
13
- while read -r _local_ref local_oid _remote_ref _remote_oid; do
13
+ while read -r _local_ref local_oid _remote_ref remote_oid; do
14
14
  named=yes
15
15
  case "$local_oid" in
16
- *[!0]*) carries_commits=yes ;;
16
+ *[!0]*)
17
+ carries_commits=yes
18
+ npx qc commit-guard --push "$local_oid" "$remote_oid" </dev/null || exit 4
19
+ case "$_remote_ref" in
20
+ refs/heads/*) npx qc ci-failures --rerun --branch "${_remote_ref#refs/heads/}" </dev/null ;;
21
+ esac
22
+ ;;
17
23
  esac
18
24
  done
19
25
  if [ -n "$named" ] && [ -z "$carries_commits" ]; then
@@ -21,4 +27,7 @@ if [ -n "$named" ] && [ -z "$carries_commits" ]; then
21
27
  exit 0
22
28
  fi
23
29
 
30
+ if [ -z "$named" ]; then
31
+ npx qc ci-failures --rerun </dev/null
32
+ fi
24
33
  npx qc check
@@ -1,11 +1,40 @@
1
1
  name: ci
2
2
  on:
3
- push:
4
3
  pull_request:
4
+ types: [opened, synchronize, reopened, ready_for_review]
5
+ # Edit this list if the repository uses another trunk branch.
6
+ # A branch push with no pull request runs no CI.
7
+ push:
8
+ branches: [main, master]
9
+ schedule:
10
+ - cron: "0 2 * * *"
11
+ merge_group:
12
+ workflow_dispatch:
13
+ inputs:
14
+ os:
15
+ description: Platform legs
16
+ type: choice
17
+ required: true
18
+ default: both
19
+ options: [linux, windows, both]
20
+
21
+ concurrency:
22
+ group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
23
+ cancel-in-progress: ${{ github.event_name != 'merge_group' }}
24
+
25
+ permissions: { contents: read }
5
26
 
6
27
  jobs:
7
28
  gates:
8
- runs-on: ubuntu-latest
29
+ if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ os: ${{ fromJSON(github.event_name == 'workflow_dispatch' && inputs.os == 'linux' && '["ubuntu-latest"]' || github.event_name == 'workflow_dispatch' && inputs.os == 'windows' && '["windows-latest"]' || github.event_name == 'workflow_dispatch' && inputs.os == 'both' && '["ubuntu-latest","windows-latest"]' || '["ubuntu-latest","windows-latest"]') }}
34
+ runs-on: ${{ matrix.os }}
35
+ defaults:
36
+ run:
37
+ shell: bash
9
38
  steps:
10
39
  # Full history: `qc lint` judges the lines since the merge base.
11
40
  - uses: actions/checkout@v5
@@ -24,6 +53,9 @@ jobs:
24
53
 
25
54
  # The same three checks the hooks run. Each says when it has nothing to check.
26
55
  - run: npx qc check
56
+ if: github.event_name != 'pull_request'
57
+ - run: npx qc check --affected --base origin/main
58
+ if: github.event_name == 'pull_request'
27
59
  - run: npx qc typecheck
28
60
  # Only the lines this change adds: a problem older than the change never fails it.
29
61
  - run: npx qc lint --base "$BASE"
@@ -31,10 +63,32 @@ jobs:
31
63
  BASE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || 'HEAD^' }}
32
64
 
33
65
  # The repository's own tests, when it has a test script.
34
- - run: |
66
+ - if: github.event_name != 'pull_request'
67
+ run: |
35
68
  if node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then "$PM" run test
36
69
  else echo "::notice::tests skipped: no test script"
37
70
  fi
38
71
 
39
72
  # More checks are opt-in, one step each: `npx qc pr-check` (a pull request names an earlier
40
73
  # issue) and `npx qc prose` (Vale on the docs a change adds). docs/enforcement.md lists them.
74
+
75
+ report-failure:
76
+ needs: gates
77
+ concurrency: { group: "ci-red-${{ github.sha }}", cancel-in-progress: false }
78
+ if: ${{ always() && needs.gates.result == 'failure' && ((github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule') }}
79
+ runs-on: ubuntu-latest
80
+ permissions: { issues: write }
81
+ steps:
82
+ - uses: actions/github-script@v7
83
+ with:
84
+ script: |
85
+ for (const name of ['ci-red', 'priority']) {
86
+ try { await github.rest.issues.createLabel({ ...context.repo, name, color: 'd73a4a' }); }
87
+ catch (error) { if (error.status !== 422) throw error; }
88
+ }
89
+ const title = `CI red: ${context.sha}`;
90
+ const issues = await github.paginate(github.rest.issues.listForRepo, { ...context.repo, state: 'open', labels: 'ci-red,priority' });
91
+ if (!issues.some(issue => issue.title === title)) {
92
+ await github.rest.issues.create({ ...context.repo, title, labels: ['ci-red', 'priority'],
93
+ body: `CI failed for ${context.sha}. Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` });
94
+ }
@@ -0,0 +1,28 @@
1
+ ## Rules that live in skills
2
+
3
+ Each rule below is a skill the `architecture` plugin ships. Load it with the Skill tool at its trigger, and follow it exactly. The skill is the rule; this file only names it and says when. A subagent loads the same skills.
4
+
5
+ | Skill | Load it |
6
+ |---|---|
7
+ | `architecture:registering-work` | Before the first edit of any task in a repository that has an issue tracker |
8
+ | `architecture:reviewing-before-merge` | When the user runs `/code-review`, or before you decide that a pull request needs a review |
9
+ | `architecture:writing-plain-english` | Before you write documentation, an ADR, a commit message, a pull request or issue body, an issue comment, or a code comment |
10
+ | `architecture:applying-engineering-standards` | Before you design, write, refactor, or review code |
11
+ | `architecture:navigating-source-code` | Before you explore code you have not read, to find a concept, a symbol's callers, or a change's blast radius |
12
+ | `architecture:writing-decision-final-specs` | Before you write or change a specification, an ADR, a contract in `schemas/`, a requirements register, or a Docusaurus docs site |
13
+
14
+ ## Always on
15
+
16
+ - **Register the work.** Open a GitHub issue before the first edit of every task, in every repository that has an issue tracker. A small fix counts. `architecture:registering-work` has the details.
17
+ - **Review before merge.** Every pull request gets a review before it merges. `architecture:reviewing-before-merge` has the details.
18
+ - **Prose in every reply.** `architecture:writing-plain-english` is the full standard. Every reply follows this core:
19
+ - Lead with the answer or the result. Write no preamble, never restate the request, and do not close with a summary.
20
+ - A step is one instruction in 20 words at most. A descriptive sentence is 25 words at most. One topic per sentence.
21
+ - Use the active voice and the simple tenses. Keep the article.
22
+ - State what is true: no litotes, and one negative per sentence at most.
23
+ - Use the plainest word: "use", not "utilize"; "before", not "prior to"; "to", not "in order to". Delete `simply`, `just`, `easily`, `obviously`, `basically`, `actually`, `very`, `quite`, and `really`.
24
+ - Address the reader as "you", never "we". Never write "please" in an instruction, and never use a slash for "and" or "or".
25
+ - Use code font for code, paths, commands, and identifiers. Use the serial comma and sentence-case headings.
26
+ - Use a table for three or more parallel facts.
27
+ - Write timeless prose: no progress, no revision history, and no dates. An ADR, a changelog, a commit message, and a direct answer about what you did are the exceptions.
28
+ - Exempt: quoted text, Japanese UI strings, code identifiers, and thinking.