architecture-harness 0.23.0 → 0.25.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +20 -5
  3. package/src/cli/bash-command-guard.mjs +44 -5
  4. package/src/cli/bash-command-guard.test.mjs +35 -1
  5. package/src/cli/budget-guard.mjs +1 -0
  6. package/src/cli/budget-guard.test.mjs +7 -1
  7. package/src/cli/budget.mjs +3 -4
  8. package/src/cli/budget.test.mjs +5 -5
  9. package/src/cli/check-commands.mjs +82 -0
  10. package/src/cli/check-commands.test.mjs +190 -0
  11. package/src/cli/check.mjs +34 -13
  12. package/src/cli/ci-template.test.mjs +17 -15
  13. package/src/cli/cli.test.mjs +33 -2
  14. package/src/cli/commit-msg.mjs +12 -12
  15. package/src/cli/commit-msg.test.mjs +22 -7
  16. package/src/cli/generated-file-guard.mjs +11 -2
  17. package/src/cli/generated-file-guard.test.mjs +14 -2
  18. package/src/cli/init.mjs +70 -25
  19. package/src/cli/lint-changed.mjs +157 -0
  20. package/src/cli/lint-changed.test.mjs +102 -0
  21. package/src/cli/plugin-agents.test.mjs +1 -1
  22. package/src/cli/post-edit-gate.test.mjs +12 -3
  23. package/src/cli/pr-check.mjs +15 -2
  24. package/src/cli/pr-check.test.mjs +19 -9
  25. package/src/cli/qc.mjs +38 -7
  26. package/src/cli/scaffold.mjs +23 -2
  27. package/src/cli/scaffold.test.mjs +51 -0
  28. package/src/cli/shell-command.mjs +3 -1
  29. package/src/cli/stop-gate.test.mjs +49 -128
  30. package/src/cli/typecheck.mjs +46 -0
  31. package/src/cli/typecheck.test.mjs +43 -0
  32. package/src/cli/user-config-package.mjs +16 -0
  33. package/src/cli/user-config-toml.mjs +144 -0
  34. package/src/cli/user-config.mjs +155 -0
  35. package/src/cli/user-config.test.mjs +274 -0
  36. package/src/cli/work-order-guard.mjs +2 -2
  37. package/src/cli/worktree-gate.mjs +11 -12
  38. package/src/cli/worktree-gate.test.mjs +28 -29
  39. package/src/cli/worktree-isolation.mjs +3 -3
  40. package/src/cli/worktree-isolation.test.mjs +1 -1
  41. package/src/cli/worktree.mjs +9 -1
  42. package/src/cli/worktree.test.mjs +16 -1
  43. package/src/config.mjs +28 -11
  44. package/src/config.test.mjs +33 -1
  45. package/src/eslint/preset.mjs +8 -3
  46. package/src/eslint/preset.test.mjs +15 -8
  47. package/src/eslint/rules/no-raw-fetch.mjs +42 -2
  48. package/src/eslint/rules.test.mjs +15 -0
  49. package/src/gates/audit-append-only.mjs +18 -4
  50. package/src/gates/audit-append-only.test.mjs +19 -0
  51. package/src/gates/tenant-predicate.mjs +147 -7
  52. package/src/gates/tenant-predicate.test.mjs +55 -0
  53. package/src/gates/tenant-tables.mjs +5 -2
  54. package/src/gates/tenant-tables.test.mjs +8 -0
  55. package/src/gates/threshold-ratchet.mjs +12 -9
  56. package/src/gates/threshold-ratchet.test.mjs +16 -0
  57. package/src/plugin.test.mjs +28 -0
  58. package/src/screens/auth-run.test.mjs +20 -17
  59. package/src/screens/capture-idle.test.mjs +2 -1
  60. package/src/screens/catalog.test.mjs +3 -3
  61. package/src/screens/chrome.mjs +21 -0
  62. package/src/vale-style.test.mjs +5 -5
  63. package/templates/CLAUDE.md +2 -2
  64. package/templates/githooks/pre-commit +7 -10
  65. package/templates/github/workflows/ci.yml +25 -84
  66. package/templates/github/workflows/pr-policy.yml +36 -0
  67. package/user-config/claude/settings.shared.json +74 -0
  68. package/user-config/claude/statusline.js +323 -0
  69. package/user-config/codex/config.shared.toml +19 -0
  70. package/src/cli/edit-batch-guard.mjs +0 -77
  71. package/src/cli/edit-batch-guard.test.mjs +0 -131
@@ -9,6 +9,9 @@ import { chromium } from "playwright";
9
9
  import { browserSession, seedSession } from "./auth.mjs";
10
10
  import { runScreens } from "../cli/screens.mjs";
11
11
  import { captureScreens } from "./capture.mjs";
12
+ import { chromeMissing } from "./chrome.mjs";
13
+
14
+ const noChrome = await chromeMissing(chromium);
12
15
 
13
16
  async function fixture(t) {
14
17
  const root = mkdtempSync(path.join(os.tmpdir(), "qc-auth-run-"));
@@ -32,33 +35,33 @@ async function fixture(t) {
32
35
  return { root, requests, target, state, save };
33
36
  }
34
37
 
35
- test("expired application state refreshes once through the login path and persists the renewed cookie", async t => {
38
+ test("expired application state refreshes once through the login path and persists the renewed cookie", { skip: noChrome }, async t => {
36
39
  const f = await fixture(t);
37
40
  f.save(["sso"]);
38
- const session = await browserSession(chromium, f.target, { targetName: "mono-local", timeout: 3000, allowInteractive: false });
41
+ const session = await browserSession(chromium, f.target, { targetName: "new-local", timeout: 3000, allowInteractive: false });
39
42
  await session.close();
40
43
  assert.equal(f.requests.filter(p => p.startsWith("/bff/login")).length, 1);
41
44
  assert.ok(JSON.parse(readFileSync(f.state)).cookies.some(c => c.name === "app"));
42
45
  });
43
46
 
44
- test("seed errors name the target and failing field without exposing browser diagnostics or credentials", async t => {
47
+ test("seed errors name the target and failing field without exposing browser diagnostics or credentials", { skip: noChrome }, async t => {
45
48
  const f = await fixture(t);
46
49
  const target = { ...f.target, auth: { ...f.target.auth, mode: "seed-login", path: "/login", userSelector: "#user", passwordSelector: "#missing", submitSelector: "#submit" } };
47
- await assert.rejects(seedSession(chromium, target, { targetName: "legacy-local", credentials: { user: "test", password: randomUUID() }, timeout: 3000 }), error => {
48
- assert.equal(error.message, "legacy-local: seed sign-in failed at the password field");
50
+ await assert.rejects(seedSession(chromium, target, { targetName: "old-local", credentials: { user: "test", password: randomUUID() }, timeout: 3000 }), error => {
51
+ assert.equal(error.message, "old-local: seed sign-in failed at the password field");
49
52
  return true;
50
53
  });
51
54
  });
52
55
 
53
- test("run stops with code four and one human instruction without capturing or retrying", async t => {
56
+ test("run stops with code four and one human instruction without capturing or retrying", { skip: noChrome }, async t => {
54
57
  const f = await fixture(t);
55
58
  f.save([]);
56
59
  const map = path.join(f.root, "map.json");
57
- writeFileSync(map, JSON.stringify({ widths: [200], targets: { "mono-local": f.target, other: f.target }, screens: [{ name: "projects", targets: { "mono-local": { path: "/projects" }, other: { path: "/projects" } } }] }));
60
+ writeFileSync(map, JSON.stringify({ widths: [200], targets: { "new-local": f.target, other: f.target }, screens: [{ name: "projects", targets: { "new-local": { path: "/projects" }, other: { path: "/projects" } } }] }));
58
61
  const lines = [];
59
- const code = await runScreens(["run", "projects", "--map", map, "--targets", "mono-local,other", "--out", path.join(f.root, "out"), "--timeout", "3000", "--sign-in-timeout", "100"], { say: line => lines.push(line) });
62
+ const code = await runScreens(["run", "projects", "--map", map, "--targets", "new-local,other", "--out", path.join(f.root, "out"), "--timeout", "3000", "--sign-in-timeout", "100"], { say: line => lines.push(line) });
60
63
  assert.equal(code, 4);
61
- assert.deepEqual(lines, ["mono-local: needs a person to sign in (run qc screens auth mono-local --headed)"]);
64
+ assert.deepEqual(lines, ["new-local: needs a person to sign in (run qc screens auth new-local --headed)"]);
62
65
  assert.equal(f.requests.filter(p => p.startsWith("/bff/login")).length, 1);
63
66
  });
64
67
 
@@ -78,22 +81,22 @@ test("capture checks each target once before navigating any screen and closes ea
78
81
 
79
82
 
80
83
  // A headed browser needs a display, which a Linux CI runner lacks.
81
- test("headed auth accepts the named target and saves a valid session", { skip: process.platform === "linux" && !process.env.DISPLAY }, async t => {
84
+ test("headed auth accepts the named target and saves a valid session", { skip: noChrome || (process.platform === "linux" && !process.env.DISPLAY) }, async t => {
82
85
  const f = await fixture(t);
83
86
  f.save(["app"]);
84
87
  const map = path.join(f.root, "map.json");
85
- writeFileSync(map, JSON.stringify({ widths: [200], targets: { "mono-local": f.target, other: f.target }, screens: [{ name: "projects", targets: { "mono-local": { path: "/projects" }, other: { path: "/projects" } } }] }));
88
+ writeFileSync(map, JSON.stringify({ widths: [200], targets: { "new-local": f.target, other: f.target }, screens: [{ name: "projects", targets: { "new-local": { path: "/projects" }, other: { path: "/projects" } } }] }));
86
89
  const lines = [];
87
- assert.equal(await runScreens(["auth", "mono-local", "--headed", "--map", map, "--timeout", "3000"], { say: line => lines.push(line) }), 0);
88
- assert.deepEqual(lines, ["mono-local: signed in"]);
90
+ assert.equal(await runScreens(["auth", "new-local", "--headed", "--map", map, "--timeout", "3000"], { say: line => lines.push(line) }), 0);
91
+ assert.deepEqual(lines, ["new-local: signed in"]);
89
92
  assert.ok(JSON.parse(readFileSync(f.state)).cookies.some(c => c.name === "app"));
90
93
  });
91
94
 
92
- test("parallel sessions preserve the shared saved state and write a complete refresh ledger", async t => {
95
+ test("parallel sessions preserve the shared saved state and write a complete refresh ledger", { skip: noChrome }, async t => {
93
96
  const f = await fixture(t);
94
97
  f.save(["sso"]);
95
98
  const { targetSession } = await import("./stack-auth.mjs");
96
- const sessions = await Promise.all(Array.from({ length: 3 }, () => targetSession(chromium, f.target, { targetName: "mono-local", timeout: 3000, allowInteractive: false })));
99
+ const sessions = await Promise.all(Array.from({ length: 3 }, () => targetSession(chromium, f.target, { targetName: "new-local", timeout: 3000, allowInteractive: false })));
97
100
  await Promise.all(sessions.map(s => s.close()));
98
101
  assert.equal(f.requests.filter(p => p.startsWith("/bff/login")).length, 1);
99
102
  assert.ok(JSON.parse(readFileSync(f.state)).cookies.some(c => c.name === "app"));
@@ -110,8 +113,8 @@ test("parallel sessions preserve the shared saved state and write a complete ref
110
113
  test("a browser launch failure names the target and method without asking for human sign-in", async t => {
111
114
  const f = await fixture(t);
112
115
  f.save([]);
113
- await assert.rejects(browserSession({ launch: async () => { throw new Error("private browser diagnostics"); } }, f.target, { targetName: "mono-local", allowInteractive: false }), error => {
114
- assert.equal(error.message, "mono-local: browser-session sign-in failed at the browser");
116
+ await assert.rejects(browserSession({ launch: async () => { throw new Error("private browser diagnostics"); } }, f.target, { targetName: "new-local", allowInteractive: false }), error => {
117
+ assert.equal(error.message, "new-local: browser-session sign-in failed at the browser");
115
118
  assert.equal(error.exitCode, undefined);
116
119
  return true;
117
120
  });
@@ -6,8 +6,9 @@ import os from "node:os";
6
6
  import path from "node:path";
7
7
  import { chromium } from "playwright";
8
8
  import { capturePage } from "./capture.mjs";
9
+ import { chromeMissing } from "./chrome.mjs";
9
10
 
10
- test("an entry with idle false captures a page that polls forever", async t => {
11
+ test("an entry with idle false captures a page that polls forever", { skip: await chromeMissing(chromium) }, async t => {
11
12
  const root = mkdtempSync(path.join(os.tmpdir(), "qc-capture-idle-"));
12
13
  const server = http.createServer((req, res) => {
13
14
  if (req.url === "/poll") return res.end("ok");
@@ -29,8 +29,8 @@ test("catalog entries carry the idle option for each app family", async () => {
29
29
  const root = mkdtempSync(path.join(os.tmpdir(), "qc-catalog-"));
30
30
  try {
31
31
  writeFileSync(path.join(root, "area.ts"), 'export const entry = {name:"drawings-pins",idle:{legacy:false},open:{legacy:async (page: any) => page.goto("/a"),mono:async (page: any) => page.goto("/b")}}');
32
- const map = await applyCatalog({ catalog: root, targets: { "legacy-local": { family: "legacy" }, "mono-local": { family: "mono" } }, screens: [] }, path.join(root, "map.json"));
33
- assert.equal(map.screens[0].targets["legacy-local"].idle, false);
34
- assert.equal(map.screens[0].targets["mono-local"].idle, undefined);
32
+ const map = await applyCatalog({ catalog: root, targets: { "old-local": { family: "legacy" }, "new-local": { family: "mono" } }, screens: [] }, path.join(root, "map.json"));
33
+ assert.equal(map.screens[0].targets["old-local"].idle, false);
34
+ assert.equal(map.screens[0].targets["new-local"].idle, undefined);
35
35
  } finally { rmSync(root, { recursive: true, force: true }); }
36
36
  });
@@ -0,0 +1,21 @@
1
+ // The screen commands launch Google Chrome as the `chrome` channel, and a machine may not have it.
2
+
3
+ const MISSING = /is not found at|Executable doesn't exist|not installed/i;
4
+
5
+ /**
6
+ * Why a test that launches Chrome cannot run here, or false when it can. `QC_REQUIRE_CHROME=1` makes a missing
7
+ * Chrome a failure, so CI never passes by skipping.
8
+ * @param {{launch: (options: object) => Promise<{close: () => Promise<void>}>}} chromium the Playwright browser type
9
+ * @returns {Promise<string | false>}
10
+ */
11
+ export async function chromeMissing(chromium) {
12
+ if (process.env.QC_REQUIRE_CHROME === "1") return false;
13
+ try {
14
+ const browser = await chromium.launch({ channel: "chrome" });
15
+ await browser.close();
16
+ return false;
17
+ } catch (error) {
18
+ if (!MISSING.test(error?.message ?? "")) return false;
19
+ return "Google Chrome is not installed. Set QC_REQUIRE_CHROME=1 to fail instead of skip.";
20
+ }
21
+ }
@@ -101,7 +101,7 @@ test("init copies the Vale config and every rule where qc prose looks for them",
101
101
  const log = console.log;
102
102
  console.log = () => {};
103
103
  try {
104
- await runInit(load(dir));
104
+ await runInit(load(dir), ["--full"]);
105
105
  assert.ok(existsSync(path.join(dir, ".vale/.vale.ini")));
106
106
  for (const rule of Object.keys(rules)) assert.ok(existsSync(path.join(dir, ".vale/styles/Qc", `${rule}.yml`)), rule);
107
107
  } finally {
@@ -112,7 +112,7 @@ test("init copies the Vale config and every rule where qc prose looks for them",
112
112
 
113
113
  const HASH = "fbc2eb47d0b8c50220ed1a2c5c611fbe0904ed567d638143d482016a18fd2db0";
114
114
  const TARBALL = "vale_3.9.1_Linux_64-bit.tar.gz";
115
- const templateWorkflow = readFileSync(path.join(vale, "../github/workflows/ci.yml"), "utf8");
115
+ const templateWorkflow = readFileSync(path.join(vale, "../github/workflows/pr-policy.yml"), "utf8");
116
116
  const kitWorkflow = readFileSync(path.resolve(vale, "../../../../.github/workflows/ci.yml"), "utf8");
117
117
 
118
118
  /** @returns the `run` script of the step that installs Vale in `text`. */
@@ -121,7 +121,7 @@ function installStep(text) {
121
121
  return steps.find((step) => /releases\/download/.test(step.run ?? ""))?.run ?? "";
122
122
  }
123
123
 
124
- test("the template workflow runs qc prose on a pull request, with a pinned Vale release", () => {
124
+ test("the PR policy template runs qc prose on a pull request, with a pinned Vale release", () => {
125
125
  assert.match(templateWorkflow, /releases\/download\/v\d+\.\d+\.\d+\/vale_/);
126
126
  assert.match(templateWorkflow, /npx qc prose --base "origin\/\$GITHUB_BASE_REF" --pr-body-event/);
127
127
  });
@@ -151,8 +151,8 @@ test("the kit's own CI installs Vale on the ubuntu leg, so the real-Vale test ru
151
151
  assert.ok(order < steps.findIndex((step) => step.run === "pnpm test"), "Vale is installed before the tests run");
152
152
  });
153
153
 
154
- test("the README and the enforcement page state that an alert lands on the line where a sentence starts", () => {
155
- const readme = readFileSync(path.resolve(vale, "../../../../README.md"), "utf8");
154
+ test("the reference and the enforcement page state that an alert lands on the line where a sentence starts", () => {
155
+ const readme = readFileSync(path.resolve(vale, "../../../../docs/reference.md"), "utf8");
156
156
  const enforcement = readFileSync(path.join(vale, "../docs/enforcement.md"), "utf8");
157
157
  for (const text of [readme, enforcement]) assert.match(text.replace(/\s+/g, " "), /alert lands on the line where the sentence or phrase starts, so an edit to a later line of it is not judged/);
158
158
  });
@@ -20,12 +20,12 @@ undefined id, a missing doc path, or a reference to another repository fails the
20
20
 
21
21
  ## Commands
22
22
 
23
- `qc init` added the first three. Add the rest as the repository grows them, and list
23
+ `qc init` added `spec:check`. Add the rest as the repository grows them, and list
24
24
  every one here — this table is what an agent reads instead of guessing.
25
25
 
26
26
  ```bash
27
27
  pnpm spec:check # every structural gate (qc check)
28
- pnpm gen:feature <name> # scaffold a feature. Full domain name, never a code
28
+ npx qc feature <name> # scaffold a feature. Full domain name, never a code
29
29
  npx qc check <file>... # the fast path a post-edit hook or a commit takes
30
30
  npx qc config # print the configuration in force
31
31
  ```
@@ -1,20 +1,17 @@
1
1
  #!/usr/bin/env bash
2
2
  # A human is bound by exactly what binds an agent.
3
- # Fast tier only: staged-file lint, types, and each touched feature's own structure. The
4
- # repository-wide gates (citations, tenant predicate, route agreement...) run once per push
5
- # instead of once per commit — see the pre-push hook.
3
+ # Fast tier only: the lint of the staged lines, the types, and each touched feature's own structure.
4
+ # The repository-wide gates run once per push instead of once per commit: see the pre-push hook.
6
5
  set -euo pipefail
7
- # Runs before the extension filter below: a work order's own branch is checked regardless of
8
- # what kind of file it touches, so a commit of .tf/.yml/.md files is covered too.
6
+ # Runs before the file filter below, so a commit of .tf, .yml, or .md files is checked too.
9
7
  npx qc work-order-check || exit 1
10
8
  # The staged list is NUL-separated in a file, never in an argument: a large merge commit would
11
9
  # pass the command-line limit of npx.cmd on Windows (8191 characters).
12
10
  STAGED=$(mktemp)
13
11
  trap 'rm -f "$STAGED"' EXIT
14
- git diff --cached --name-only -z --diff-filter=ACM | grep -zE '\.(ts|tsx|mjs)$' > "$STAGED" || true
12
+ git diff --cached --name-only -z --diff-filter=ACM | grep -zE '\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$' > "$STAGED" || true
15
13
  [ -s "$STAGED" ] || exit 0
16
- # `--no-warn-ignored`: a staged file the config ignores is a decision, not a finding, and
17
- # without it a generated file turns "I ignored that" into a warning that fails the gate.
18
- xargs -0 -n 20 npx eslint --max-warnings 0 --no-warn-ignored < "$STAGED"
19
- npx tsc -b --pretty false
14
+ # Only the staged lines: a problem on a line this commit leaves alone never blocks it.
15
+ npx qc lint --staged
16
+ npx qc typecheck
20
17
  npx qc check --files-from - < "$STAGED"
@@ -1,99 +1,40 @@
1
1
  name: ci
2
2
  on:
3
3
  push:
4
- # `edited` re-runs the prose check when a pull request body changes.
5
4
  pull_request:
6
- types: [opened, synchronize, reopened, edited]
7
5
 
8
6
  jobs:
9
7
  gates:
10
8
  runs-on: ubuntu-latest
11
9
  steps:
12
- # Full history: the threshold ratchet compares the registry with the merge base.
10
+ # Full history: `qc lint` judges the lines since the merge base.
13
11
  - uses: actions/checkout@v5
14
12
  with: { fetch-depth: 0 }
15
13
  - uses: actions/setup-node@v5
16
- with: { node-version-file: package.json }
17
- - run: corepack enable
18
- - run: pnpm install --frozen-lockfile
14
+ with: { node-version: lts/* }
19
15
 
20
- # The structural gates. This step needs no package script of its own.
21
- - run: npx qc check
22
-
23
- # A pull request names the issue it closes, and the issue predates it.
24
- - if: github.event_name == 'pull_request'
25
- run: npx qc pr-check
26
- env: { GH_TOKEN: "${{ github.token }}" }
27
-
28
- # The lines a pull request adds, and its body, meet the prose style. Vale is a pinned release,
29
- # and the download is checked against its published hash before it is unpacked.
30
- - if: github.event_name == 'pull_request'
31
- run: |
16
+ # Install with the package manager of the lockfile, and keep its name for the test step.
17
+ - run: |
32
18
  set -euo pipefail
33
- cd "$RUNNER_TEMP"
34
- curl -sSfL -O https://github.com/errata-ai/vale/releases/download/v3.9.1/vale_3.9.1_Linux_64-bit.tar.gz
35
- echo "fbc2eb47d0b8c50220ed1a2c5c611fbe0904ed567d638143d482016a18fd2db0 vale_3.9.1_Linux_64-bit.tar.gz" | sha256sum -c -
36
- tar -xzf vale_3.9.1_Linux_64-bit.tar.gz vale
37
- echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
38
- - if: github.event_name == 'pull_request'
39
- run: npx qc prose --base "origin/$GITHUB_BASE_REF" --pr-body-event
19
+ if [ -f pnpm-lock.yaml ]; then corepack enable; pnpm install --frozen-lockfile; echo "PM=pnpm" >> "$GITHUB_ENV"
20
+ elif [ -f yarn.lock ]; then corepack enable; yarn install --immutable; echo "PM=yarn" >> "$GITHUB_ENV"
21
+ elif [ -f package-lock.json ]; then npm ci; echo "PM=npm" >> "$GITHUB_ENV"
22
+ else npm install; echo "PM=npm" >> "$GITHUB_ENV"
23
+ fi
40
24
 
41
- # Uncomment each as the repository grows the thing it checks.
42
- # - run: pnpm typecheck
43
- # - run: pnpm lint
44
- # - run: pnpm dup:check
45
- # - run: pnpm test
46
-
47
- # Unit tests in eight hosted shards. A self-hosted runner that goes offline leaves a job queued;
48
- # `qc watch --pr` reports a check queued for over 15 minutes. A repository with no test:unit script skips it.
49
- unit:
50
- runs-on: ubuntu-latest
51
- strategy: { fail-fast: false, matrix: { shard: [1, 2, 3, 4, 5, 6, 7, 8] } }
52
- steps:
53
- - uses: actions/checkout@v5
54
- - id: script
55
- run: node -e "console.log('present=' + Boolean(require('./package.json').scripts?.['test:unit']))" >> "$GITHUB_OUTPUT"
56
- - if: steps.script.outputs.present == 'true'
57
- uses: actions/setup-node@v5
58
- with: { node-version-file: package.json }
59
- - if: steps.script.outputs.present == 'true'
60
- run: corepack enable && pnpm install --frozen-lockfile
61
- - if: steps.script.outputs.present == 'true'
62
- run: pnpm test:unit --shard=${{ matrix.shard }}/${{ strategy.job-total }}
63
-
64
- # Integration tests in two hosted shards. Add the services the tests need, such as a database.
65
- integration:
66
- runs-on: ubuntu-latest
67
- strategy: { fail-fast: false, matrix: { shard: [1, 2] } }
68
- steps:
69
- - uses: actions/checkout@v5
70
- - id: script
71
- run: node -e "console.log('present=' + Boolean(require('./package.json').scripts?.['test:integration']))" >> "$GITHUB_OUTPUT"
72
- - if: steps.script.outputs.present == 'true'
73
- uses: actions/setup-node@v5
74
- with: { node-version-file: package.json }
75
- - if: steps.script.outputs.present == 'true'
76
- run: corepack enable && pnpm install --frozen-lockfile
77
- - if: steps.script.outputs.present == 'true'
78
- run: pnpm test:integration --shard=${{ matrix.shard }}/${{ strategy.job-total }}
79
-
80
- # Browser tests: the specs a pull request affects, by the repository's own e2e:affected script,
81
- # and every spec on a push.
82
- e2e:
83
- runs-on: ubuntu-latest
84
- steps:
85
- - uses: actions/checkout@v5
86
- with: { fetch-depth: 0 }
87
- - id: script
88
- run: node -e "const s = require('./package.json').scripts ?? {}; console.log('present=' + Boolean(s.e2e && s['e2e:affected']))" >> "$GITHUB_OUTPUT"
89
- - if: steps.script.outputs.present == 'true'
90
- uses: actions/setup-node@v5
91
- with: { node-version-file: package.json }
92
- - if: steps.script.outputs.present == 'true'
93
- run: corepack enable && pnpm install --frozen-lockfile
94
- - if: steps.script.outputs.present == 'true'
95
- run: pnpm exec playwright install --with-deps
96
- - if: steps.script.outputs.present == 'true' && github.event_name == 'pull_request'
97
- run: pnpm e2e:affected "origin/$GITHUB_BASE_REF"
98
- - if: steps.script.outputs.present == 'true' && github.event_name != 'pull_request'
99
- run: pnpm e2e
25
+ # The same three checks the hooks run. Each says when it has nothing to check.
26
+ - run: npx qc check
27
+ - run: npx qc typecheck
28
+ # Only the lines this change adds: a problem older than the change never fails it.
29
+ - run: npx qc lint --base "$BASE"
30
+ env:
31
+ BASE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || 'HEAD^' }}
32
+
33
+ # The repository's own tests, when it has a test script.
34
+ - run: |
35
+ if node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then "$PM" run test
36
+ else echo "::notice::tests skipped: no test script"
37
+ fi
38
+
39
+ # More checks are opt-in, one step each: `npx qc pr-check` (a pull request names an earlier
40
+ # issue) and `npx qc prose` (Vale on the docs a change adds). docs/enforcement.md lists them.
@@ -0,0 +1,36 @@
1
+ name: pr-policy
2
+ on:
3
+ # `edited` runs the checks again when a pull request body changes.
4
+ pull_request:
5
+ types: [opened, synchronize, reopened, edited]
6
+
7
+ jobs:
8
+ policy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v5
12
+ with: { fetch-depth: 0 }
13
+ - uses: actions/setup-node@v5
14
+ with: { node-version: lts/* }
15
+ - run: |
16
+ set -euo pipefail
17
+ if [ -f pnpm-lock.yaml ]; then corepack enable; pnpm install --frozen-lockfile
18
+ elif [ -f yarn.lock ]; then corepack enable; yarn install --immutable
19
+ elif [ -f package-lock.json ]; then npm ci
20
+ else npm install
21
+ fi
22
+
23
+ # A pull request names the issue it closes, and the issue predates it.
24
+ - run: npx qc pr-check
25
+ env: { GH_TOKEN: "${{ github.token }}" }
26
+
27
+ # The lines a pull request adds, and its body, meet the prose style. Vale is a pinned release,
28
+ # and the download is checked against its published hash before it is unpacked.
29
+ - run: |
30
+ set -euo pipefail
31
+ cd "$RUNNER_TEMP"
32
+ curl -sSfL -O https://github.com/errata-ai/vale/releases/download/v3.9.1/vale_3.9.1_Linux_64-bit.tar.gz
33
+ echo "fbc2eb47d0b8c50220ed1a2c5c611fbe0904ed567d638143d482016a18fd2db0 vale_3.9.1_Linux_64-bit.tar.gz" | sha256sum -c -
34
+ tar -xzf vale_3.9.1_Linux_64-bit.tar.gz vale
35
+ echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
36
+ - run: npx qc prose --base "origin/$GITHUB_BASE_REF" --pr-body-event
@@ -0,0 +1,74 @@
1
+ {
2
+ "cleanupPeriodDays": 90,
3
+ "syncClaudeAiPlugins": false,
4
+ "env": {
5
+ "CLAUDE_CODE_DISABLE_MOUSE": "1",
6
+ "CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP": "1"
7
+ },
8
+ "permissions": {
9
+ "defaultMode": "auto"
10
+ },
11
+ "model": "opus",
12
+ "skillOverrides": {
13
+ "csharp-lsp": "off",
14
+ "gitnexus-debugging": "off",
15
+ "gitnexus-guide": "off",
16
+ "gitnexus-pdg-query": "off",
17
+ "gitnexus-pr-review": "off",
18
+ "gitnexus-refactoring": "off",
19
+ "gitnexus-taint-analysis": "off"
20
+ },
21
+ "statusLine": {
22
+ "type": "command",
23
+ "command": "node \"${CLAUDE_CONFIG_DIR:-$HOME/.claude}/statusline.js\""
24
+ },
25
+ "enabledPlugins": {
26
+ "cocoindex-code@cocoindex-code": true,
27
+ "context-mode@context-mode": true,
28
+ "superpowers@claude-plugins-official": true,
29
+ "frontend-design@claude-plugins-official": true,
30
+ "architecture@architecture-kit": true
31
+ },
32
+ "extraKnownMarketplaces": {
33
+ "cocoindex-code": {
34
+ "source": {
35
+ "source": "github",
36
+ "repo": "cocoindex-io/cocoindex-code"
37
+ }
38
+ },
39
+ "leky90": {
40
+ "source": {
41
+ "source": "github",
42
+ "repo": "leky90/product-delivery-harness"
43
+ }
44
+ },
45
+ "ldk-tools": {
46
+ "source": {
47
+ "source": "github",
48
+ "repo": "ArentInc/ldk-roleflow"
49
+ }
50
+ }
51
+ },
52
+ "effortLevel": "xhigh",
53
+ "modelSettings": {
54
+ "claude-sonnet-5": {
55
+ "effortLevel": "high"
56
+ },
57
+ "claude-sonnet-4-6": {
58
+ "effortLevel": "xhigh"
59
+ },
60
+ "claude-opus-5-5": {
61
+ "effortLevel": "high",
62
+ "autoCompactWindow": 233000
63
+ }
64
+ },
65
+ "awaySummaryEnabled": false,
66
+ "autoUpdatesChannel": "latest",
67
+ "tui": "fullscreen",
68
+ "skipWorkflowUsageWarning": true,
69
+ "theme": "dark",
70
+ "autoCompactEnabled": true,
71
+ "autoContinueAtUsageLimit": false,
72
+ "agentPushNotifEnabled": true,
73
+ "skipAutoPermissionPrompt": true
74
+ }