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.
- package/package.json +3 -22
- package/src/cli/ask.mjs +42 -0
- package/src/cli/ask.test.mjs +40 -0
- package/src/cli/branch-sync.mjs +126 -0
- package/src/cli/branch-sync.test.mjs +428 -0
- package/src/cli/budget-guard.mjs +74 -5
- package/src/cli/budget-guard.test.mjs +185 -2
- package/src/cli/budget-report.mjs +85 -0
- package/src/cli/budget-report.test.mjs +173 -0
- package/src/cli/budget.mjs +8 -5
- package/src/cli/check-commands.mjs +123 -11
- package/src/cli/check-commands.test.mjs +360 -6
- package/src/cli/check-feature-switches.test.mjs +110 -0
- package/src/cli/check-full.test.mjs +152 -0
- package/src/cli/check-verdict.mjs +46 -0
- package/src/cli/check-verdict.test.mjs +32 -0
- package/src/cli/check.mjs +137 -4
- package/src/cli/check.test.mjs +45 -0
- package/src/cli/checkpoint.mjs +143 -0
- package/src/cli/checkpoint.test.mjs +146 -0
- package/src/cli/child-run.mjs +7 -2
- package/src/cli/child-run.test.mjs +17 -2
- package/src/cli/ci-failures.mjs +304 -0
- package/src/cli/ci-failures.test.mjs +615 -0
- package/src/cli/ci-preview.mjs +62 -0
- package/src/cli/ci-preview.test.mjs +85 -0
- package/src/cli/ci-state.mjs +25 -29
- package/src/cli/ci-state.test.mjs +174 -2
- package/src/cli/ci-template.test.mjs +86 -0
- package/src/cli/claude-core.test.mjs +37 -0
- package/src/cli/codex-implement.mjs +580 -47
- package/src/cli/codex-implement.test.mjs +1946 -29
- package/src/cli/codex-limit.mjs +85 -0
- package/src/cli/codex-limit.test.mjs +179 -0
- package/src/cli/codex-reset.mjs +78 -0
- package/src/cli/codex-reset.test.mjs +192 -0
- package/src/cli/codex-verify.mjs +230 -0
- package/src/cli/codex-verify.test.mjs +402 -0
- package/src/cli/comment-watch.mjs +391 -0
- package/src/cli/comment-watch.test.mjs +392 -0
- package/src/cli/commit-guard.mjs +219 -0
- package/src/cli/commit-guard.test.mjs +809 -0
- package/src/cli/context-budgets.mjs +47 -0
- package/src/cli/context-budgets.test.mjs +96 -0
- package/src/cli/context-watch.mjs +116 -0
- package/src/cli/context-watch.test.mjs +395 -0
- package/src/cli/contract-history.mjs +1 -1
- package/src/cli/controller-guard.mjs +38 -0
- package/src/cli/controller-guard.test.mjs +66 -2
- package/src/cli/cost-stop.mjs +5 -1
- package/src/cli/cost-stop.test.mjs +26 -0
- package/src/cli/diff-shape.mjs +162 -0
- package/src/cli/diff-shape.test.mjs +200 -0
- package/src/cli/direct-lane.mjs +32 -19
- package/src/cli/direct-lane.test.mjs +21 -3
- package/src/cli/dispatch-guard.mjs +11 -0
- package/src/cli/dispatch-guard.test.mjs +145 -10
- package/src/cli/dispatch-reminder.mjs +23 -10
- package/src/cli/dispatch-reminder.test.mjs +63 -11
- package/src/cli/dispatch-route.mjs +54 -0
- package/src/cli/dispatch-route.test.mjs +101 -0
- package/src/cli/dispatch-slot.mjs +2 -2
- package/src/cli/dispatch-slot.test.mjs +18 -19
- package/src/cli/dispatch.test.mjs +3 -3
- package/src/cli/e2e-affected.mjs +15 -0
- package/src/cli/e2e-affected.test.mjs +73 -0
- package/src/cli/fleet.mjs +180 -0
- package/src/cli/fleet.test.mjs +213 -0
- package/src/cli/gate-slot.mjs +2 -1
- package/src/cli/gh-merge-command.mjs +96 -31
- package/src/cli/gh-merge-command.test.mjs +74 -0
- package/src/cli/gh-run.mjs +64 -3
- package/src/cli/gh-run.test.mjs +66 -1
- package/src/cli/git-hooks.test.mjs +25 -3
- package/src/cli/git-read.mjs +2 -1
- package/src/cli/integrate-tree.mjs +47 -0
- package/src/cli/integrate.mjs +143 -40
- package/src/cli/integrate.test.mjs +347 -1
- package/src/cli/integration-lane.mjs +62 -0
- package/src/cli/integration-lane.test.mjs +213 -0
- package/src/cli/ledger.mjs +4 -2
- package/src/cli/ledger.test.mjs +12 -3
- package/src/cli/legs.mjs +53 -0
- package/src/cli/legs.test.mjs +70 -0
- package/src/cli/lint-changed.mjs +59 -10
- package/src/cli/lint-changed.test.mjs +112 -1
- package/src/cli/locked-tests.mjs +134 -0
- package/src/cli/locked-tests.test.mjs +188 -0
- package/src/cli/merge-guard.mjs +234 -62
- package/src/cli/merge-guard.test.mjs +768 -39
- package/src/cli/metrics.mjs +53 -0
- package/src/cli/metrics.test.mjs +73 -0
- package/src/cli/milestone.mjs +297 -0
- package/src/cli/milestone.test.mjs +294 -0
- package/src/cli/mutate.mjs +203 -0
- package/src/cli/mutate.test.mjs +134 -0
- package/src/cli/output-redaction.mjs +26 -0
- package/src/cli/output-redaction.test.mjs +117 -0
- package/src/cli/overview.mjs +131 -0
- package/src/cli/overview.test.mjs +137 -0
- package/src/cli/pause.mjs +93 -0
- package/src/cli/pause.test.mjs +109 -0
- package/src/cli/plan-check.mjs +84 -12
- package/src/cli/plan-check.test.mjs +152 -2
- package/src/cli/plan-stop.mjs +7 -4
- package/src/cli/plan-stop.test.mjs +87 -0
- package/src/cli/platform-risk.mjs +46 -0
- package/src/cli/platform-risk.test.mjs +38 -0
- package/src/cli/plugin-skills.test.mjs +25 -0
- package/src/cli/pr-guard.mjs +128 -0
- package/src/cli/pr-guard.test.mjs +154 -0
- package/src/cli/promotion-branch.mjs +2 -0
- package/src/cli/qc.mjs +160 -27
- package/src/cli/qc.test.mjs +93 -0
- package/src/cli/report-stop.mjs +5 -0
- package/src/cli/report-stop.test.mjs +23 -1
- package/src/cli/retry-failed.mjs +3 -1
- package/src/cli/review-gate.mjs +24 -6
- package/src/cli/review-gate.test.mjs +116 -0
- package/src/cli/review-promotion.mjs +107 -0
- package/src/cli/review-promotion.test.mjs +251 -0
- package/src/cli/role-budget.mjs +50 -0
- package/src/cli/role-budget.test.mjs +91 -0
- package/src/cli/run-log.mjs +73 -0
- package/src/cli/run-log.test.mjs +121 -0
- package/src/cli/secret-patterns.mjs +16 -0
- package/src/cli/secret-patterns.test.mjs +73 -0
- package/src/cli/setup-block.mjs +24 -0
- package/src/cli/setup-block.test.mjs +96 -0
- package/src/cli/setup-checks.mjs +65 -0
- package/src/cli/setup-checks.test.mjs +158 -0
- package/src/cli/setup-compaction.mjs +55 -0
- package/src/cli/setup-compaction.test.mjs +115 -0
- package/src/cli/setup-skills.mjs +65 -0
- package/src/cli/setup-skills.test.mjs +171 -0
- package/src/cli/setup.mjs +107 -0
- package/src/cli/setup.test.mjs +275 -0
- package/src/cli/skill-length.test.mjs +8 -0
- package/src/cli/spawn-command.mjs +47 -0
- package/src/cli/spawn-command.test.mjs +64 -0
- package/src/cli/task-gate-review.test.mjs +21 -2
- package/src/cli/task-gate.mjs +25 -12
- package/src/cli/task-gate.test.mjs +43 -5
- package/src/cli/tokens.mjs +46 -3
- package/src/cli/tokens.test.mjs +103 -3
- package/src/cli/tools.mjs +49 -0
- package/src/cli/tools.test.mjs +89 -0
- package/src/cli/transcript-usage.mjs +27 -0
- package/src/cli/transcript-usage.test.mjs +34 -0
- package/src/cli/user-config-package.mjs +1 -1
- package/src/cli/user-config-toml.mjs +63 -7
- package/src/cli/user-config.mjs +39 -7
- package/src/cli/user-config.test.mjs +238 -5
- package/src/cli/watch-arm.mjs +39 -0
- package/src/cli/watch-arm.test.mjs +87 -0
- package/src/cli/watch.mjs +80 -35
- package/src/cli/watch.test.mjs +233 -27
- package/src/cli/work-order-guard.mjs +2 -1
- package/src/cli/workflow-hooks.test.mjs +18 -4
- package/src/cli/workflow-settings.mjs +44 -8
- package/src/cli/workflow-settings.test.mjs +124 -1
- package/src/cli/worktree.mjs +14 -1
- package/src/cli/worktree.test.mjs +20 -1
- package/src/config.mjs +174 -7
- package/src/config.test.mjs +327 -5
- package/src/consumer-package.mjs +31 -0
- package/src/consumer-package.test.mjs +54 -0
- package/src/descriptions.mjs +2 -0
- package/src/eslint/index.mjs +12 -0
- package/src/eslint/jsx.mjs +20 -0
- package/src/eslint/preset.mjs +26 -2
- package/src/eslint/preset.test.mjs +104 -2
- package/src/eslint/rules/no-arbitrary-class-value.mjs +32 -0
- package/src/eslint/rules/no-literal-color.mjs +94 -0
- package/src/eslint/rules/no-static-inline-style.mjs +41 -0
- package/src/eslint/rules/one-component-per-file.mjs +70 -0
- package/src/eslint/rules/raw-element-in-primitive.mjs +31 -0
- package/src/eslint/rules/timeless-comment.mjs +92 -0
- package/src/eslint/rules.test.mjs +189 -0
- package/src/eslint/ui-regressions.test.mjs +39 -0
- package/src/gates/contract-operations.mjs +3 -3
- package/src/gates/contract-operations.test.mjs +28 -0
- package/src/gates/feature-switches.mjs +19 -0
- package/src/gates/feature-switches.test.mjs +55 -0
- package/src/gates/plain-language.mjs +396 -0
- package/src/gates/plain-language.test.mjs +210 -0
- package/src/gates/runtime-imports.test.mjs +114 -0
- package/src/gates/saga-key.test.mjs +1 -1
- package/src/global-skills.mjs +9 -0
- package/src/global-skills.test.mjs +53 -0
- package/src/plugin.test.mjs +3 -2
- package/src/ui/class-sites.mjs +38 -6
- package/src/ui/codemod.mjs +4 -1
- package/src/ui/codemod.test.mjs +52 -0
- package/src/ui/components.mjs +5 -3
- package/src/ui/components.test.mjs +8 -0
- package/src/ui/dupes.test.mjs +18 -0
- package/templates/docs/enforcement.md +12 -2
- package/templates/docs/ui.md +33 -0
- package/templates/githooks/pre-commit +1 -0
- package/templates/githooks/pre-push +11 -2
- package/templates/github/workflows/ci.yml +57 -3
- package/user-config/claude/CLAUDE.core.md +28 -0
- package/user-config/claude/settings.shared.json +41 -1
- package/src/cli/screens-discovery.mjs +0 -60
- package/src/cli/screens.mjs +0 -84
- package/src/cli/stack.mjs +0 -14
- package/src/cli/throwaway-db.mjs +0 -127
- package/src/cli/throwaway-db.test.mjs +0 -83
- package/src/screens/auth-context.test.mjs +0 -41
- package/src/screens/auth-run.test.mjs +0 -147
- package/src/screens/auth.mjs +0 -223
- package/src/screens/auth.test.mjs +0 -76
- package/src/screens/capture-idle.test.mjs +0 -27
- package/src/screens/capture.browser-test.mjs +0 -73
- package/src/screens/capture.mjs +0 -175
- package/src/screens/capture.test.mjs +0 -28
- package/src/screens/catalog.browser-test.mjs +0 -32
- package/src/screens/catalog.mjs +0 -72
- package/src/screens/catalog.test.mjs +0 -36
- package/src/screens/chrome.mjs +0 -21
- package/src/screens/compare.mjs +0 -40
- package/src/screens/compare.test.mjs +0 -30
- package/src/screens/discovery.browser-test.mjs +0 -29
- package/src/screens/discovery.mjs +0 -158
- package/src/screens/discovery.test.mjs +0 -27
- package/src/screens/inventory.mjs +0 -69
- package/src/screens/inventory.test.mjs +0 -10
- package/src/screens/map.mjs +0 -63
- package/src/screens/map.test.mjs +0 -35
- package/src/screens/open.browser-test.mjs +0 -50
- package/src/screens/regions.mjs +0 -137
- package/src/screens/regions.test.mjs +0 -38
- package/src/screens/session-files.mjs +0 -39
- package/src/screens/session-files.test.mjs +0 -39
- package/src/screens/setup.browser-test.mjs +0 -49
- package/src/screens/setup.mjs +0 -78
- package/src/screens/stack-auth.browser-test.mjs +0 -30
- package/src/screens/stack-auth.mjs +0 -106
- package/src/screens/stack-auth.test.mjs +0 -65
- package/src/screens/write-guard.mjs +0 -26
- package/src/stack/stack.mjs +0 -131
- package/src/stack/stack.test.mjs +0 -40
- package/src/stack/supervisor.mjs +0 -30
package/src/config.mjs
CHANGED
|
@@ -9,6 +9,14 @@ import path from "node:path";
|
|
|
9
9
|
export const CONFIG_FILE = "qc.config.json";
|
|
10
10
|
|
|
11
11
|
export const defaults = {
|
|
12
|
+
commentWatch: true,
|
|
13
|
+
github: { configDirs: { shawrylk: "~/.config/gh-personal" } },
|
|
14
|
+
ready: { platforms: ["linux"] },
|
|
15
|
+
checkpoint: { maxAgeMinutes: 30 },
|
|
16
|
+
post: { aiLabel: true },
|
|
17
|
+
ci: { requiredChecks: [] },
|
|
18
|
+
lessons: { file: "docs/ci-lessons.md", rerun: "node --test" },
|
|
19
|
+
guard: { protectedPaths: [".github/workflows/**", ".husky/**", ".githooks/**", "qc.config.json", ".claude/settings*.json"] },
|
|
12
20
|
// Where features live. Every structural gate walks these.
|
|
13
21
|
featureRoots: ["backend/src/features", "frontend/src/features"],
|
|
14
22
|
// The path segment that marks a feature, and the one file that crosses its boundary.
|
|
@@ -17,7 +25,34 @@ export const defaults = {
|
|
|
17
25
|
|
|
18
26
|
// `qc codex-implement`. `compactTokens` is the backstop that compacts a runaway session; one item
|
|
19
27
|
// runs in a fresh session and should finish under 200K.
|
|
20
|
-
codex: {
|
|
28
|
+
codex: {
|
|
29
|
+
model: null,
|
|
30
|
+
reviewModel: "gpt-6.1-sol",
|
|
31
|
+
reviewEffort: "high",
|
|
32
|
+
pathsTests: "warn",
|
|
33
|
+
compactTokens: 300000,
|
|
34
|
+
disablePlugins: ["superpowers@claude-plugins-official"],
|
|
35
|
+
envAllow: [],
|
|
36
|
+
preamble: "",
|
|
37
|
+
briefMaxLines: 40,
|
|
38
|
+
briefMaxSteps: 6,
|
|
39
|
+
maxRuns: 2,
|
|
40
|
+
requireApproval: false,
|
|
41
|
+
maxDiffLines: 400,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
throwawayDb: {
|
|
45
|
+
schemaCommand: null,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// Token limits keep each role within its context: compactAt compacts, remindAt warns, and handoffAt hands off.
|
|
49
|
+
// toolOutputTokens caps one Codex tool output; null compactAt preserves codex.compactTokens.
|
|
50
|
+
budgets: {
|
|
51
|
+
orchestrator: { compactAt: 200000 },
|
|
52
|
+
implementer: { remindAt: 110000, handoffAt: 150000 },
|
|
53
|
+
reviewer: { remindAt: 80000, handoffAt: 120000 },
|
|
54
|
+
codex: { compactAt: null, toolOutputTokens: 4000 },
|
|
55
|
+
},
|
|
21
56
|
|
|
22
57
|
docs: {
|
|
23
58
|
root: "docs",
|
|
@@ -227,6 +262,27 @@ export const defaults = {
|
|
|
227
262
|
legacyBudget: undefined,
|
|
228
263
|
},
|
|
229
264
|
|
|
265
|
+
// Prose a person reads is Simplified Technical English (ASD-STE100), in the Google developer
|
|
266
|
+
// documentation style. `replace` adds this repository's own vocabulary to the words the gate
|
|
267
|
+
// ships; a value of null drops one of those. `allow` names a path the rule does not reach.
|
|
268
|
+
plainLanguage: {
|
|
269
|
+
// An instruction is held shorter than a description: a reader acts on it while they read it.
|
|
270
|
+
maxInstructionWords: 20,
|
|
271
|
+
maxDescriptiveWords: 25,
|
|
272
|
+
maxParagraphSentences: 6,
|
|
273
|
+
passive: true,
|
|
274
|
+
headings: true,
|
|
275
|
+
links: true,
|
|
276
|
+
replace: {},
|
|
277
|
+
properNouns: [],
|
|
278
|
+
// Markdown is the document. A comment is prose that happens to sit inside code, and reaches a
|
|
279
|
+
// reader the same way, so it is read by the same rule.
|
|
280
|
+
extensions: ["md", "tsx?", "[cm]?js", "mjs"],
|
|
281
|
+
roots: ["docs"],
|
|
282
|
+
exclude: ["(^|/)node_modules(/|$)", "(^|/)dist(/|$)", "(^|/)\\.git(/|$)", "(^|/)coverage(/|$)"],
|
|
283
|
+
allow: [],
|
|
284
|
+
},
|
|
285
|
+
|
|
230
286
|
// A decision record carries its cost and its rejected alternatives, or it is advocacy.
|
|
231
287
|
adr: {
|
|
232
288
|
root: "docs/decisions",
|
|
@@ -254,13 +310,15 @@ export const defaults = {
|
|
|
254
310
|
dispatch: null,
|
|
255
311
|
// Read only while `dispatch` is on. `reviewDefaults` fills each key it omits.
|
|
256
312
|
review: null,
|
|
257
|
-
// Read only while `dispatch` is on, and on by default then. `false` turns it off; `directDefaults` fills each key it omits.
|
|
313
|
+
// Read only while `dispatch` is on, and on by default then. `false` turns it off; `directDefaults` fills each key it omits, except `reviewPaths`, which `direct-lane.mjs` defaults.
|
|
258
314
|
direct: null,
|
|
259
315
|
},
|
|
260
316
|
|
|
261
317
|
// Files a generator writes. The generated-file hook refuses a hand edit of one and names `command`, when set.
|
|
262
318
|
generated: { globs: ["**/*.generated.*"], command: null },
|
|
263
319
|
|
|
320
|
+
merge: { holdLabel: "hold" },
|
|
321
|
+
|
|
264
322
|
// `qc worktree`. `install` runs in each new worktree; null picks it from the lockfile. `base` is the default `--from`: the ref a
|
|
265
323
|
// branch starts at, and the ref `remove` checks a merge against.
|
|
266
324
|
// `dir` holds each worktree, inside the main checkout. `enforce: false` turns off the QC-015 hooks.
|
|
@@ -270,7 +328,9 @@ export const defaults = {
|
|
|
270
328
|
scopedSuffixes: ["Repository", "Saga", "UnitOfWork", "UnitOfWorkFactory"],
|
|
271
329
|
|
|
272
330
|
// A comment is one line of why; reasoning that wants a paragraph is a decision with an id.
|
|
273
|
-
|
|
331
|
+
// It is also timeless: `timeless` names the phrases that date one, and a list stated here
|
|
332
|
+
// replaces the rule's own rather than adding to it.
|
|
333
|
+
comments: { maxLines: 2, timeless: { promises: [], moments: [] } },
|
|
274
334
|
|
|
275
335
|
// Switching a shipped check off names the decision that says why, or "off-by-design".
|
|
276
336
|
floor: { exemptions: {} },
|
|
@@ -284,9 +344,18 @@ export const defaults = {
|
|
|
284
344
|
required: { "pre-commit": ["qc work-order-check"], "commit-msg": ["qc commit-msg"], "pre-push": ["qc check"] },
|
|
285
345
|
},
|
|
286
346
|
|
|
347
|
+
// Push settled output in merge batches so each push triggers CI.
|
|
348
|
+
milestones: { times: ["11:00", "16:00", "21:00"] },
|
|
349
|
+
integrate: { ciEvery: 3, push: true, branchPattern: "^[a-z]+/[0-9]+-integration$", review: true },
|
|
350
|
+
|
|
351
|
+
tests: { maxNewCases: 8, maxExtraCases: 4, command: ["node", "--test"] },
|
|
352
|
+
|
|
287
353
|
check: {
|
|
288
354
|
// The kit appends changed paths; for example, "pnpm exec vitest related --run". Null keeps this off.
|
|
289
355
|
related: null,
|
|
356
|
+
// --since-push appends paths changed after the push; null uses related.
|
|
357
|
+
sincePush: null,
|
|
358
|
+
e2e: null,
|
|
290
359
|
// Commands receive no extra arguments; for example, ["node script/check-comments.mjs --base origin/dev"].
|
|
291
360
|
commands: [],
|
|
292
361
|
// The merge base with this ref selects committed and staged changes.
|
|
@@ -339,6 +408,9 @@ export const defaults = {
|
|
|
339
408
|
productPackages: [],
|
|
340
409
|
},
|
|
341
410
|
|
|
411
|
+
// Keep unwired controls in JSX while their feature switch controls their visibility.
|
|
412
|
+
featureSwitches: { file: "feature-switches.ts", patterns: ["UNWIRED", "^SHOW_", "_WIRED$"] },
|
|
413
|
+
|
|
342
414
|
// Each set: `source` declares the keys, `key` and `writer` are patterns whose first group is a key,
|
|
343
415
|
// `roots` hold the writers, and `declaredAhead` maps a key with no writer yet to its reason.
|
|
344
416
|
closedSetWriters: { sets: [] },
|
|
@@ -406,11 +478,13 @@ export const defaults = {
|
|
|
406
478
|
"config-floor": false,
|
|
407
479
|
"english-source": false,
|
|
408
480
|
"adr-format": false,
|
|
481
|
+
"plain-language": false,
|
|
409
482
|
"feature-cli": false,
|
|
410
483
|
// Each reads inputs only a repository can name: its registry, its product roots, its closed
|
|
411
484
|
// sets, its claims. Shipped on, each would also red a consumer's enforcement map on upgrade.
|
|
412
485
|
parity: false,
|
|
413
486
|
"integration-imports": false,
|
|
487
|
+
"feature-switches": false,
|
|
414
488
|
"closed-set-writers": false,
|
|
415
489
|
"doc-claims": false,
|
|
416
490
|
"tenant-isolation-test": false,
|
|
@@ -448,11 +522,17 @@ export const defaults = {
|
|
|
448
522
|
"no-raw-fetch": true,
|
|
449
523
|
"no-sql-raw": true,
|
|
450
524
|
"ime-safe-key": false,
|
|
525
|
+
"one-component-per-file": false,
|
|
526
|
+
"raw-element-in-primitive": false,
|
|
527
|
+
"no-arbitrary-class-value": false,
|
|
528
|
+
"no-literal-color": false,
|
|
529
|
+
"no-static-inline-style": false,
|
|
451
530
|
// A policy rule: a repository turns it on once its controls carry the pending prop.
|
|
452
531
|
"mutation-control-pending": false,
|
|
453
532
|
"registry-literal": true,
|
|
454
533
|
"durable-idempotency-key": true,
|
|
455
534
|
"no-supersession-trail": true,
|
|
535
|
+
"timeless-comment": true,
|
|
456
536
|
},
|
|
457
537
|
|
|
458
538
|
// Layer names and their legal import direction. The kit ships the reference set;
|
|
@@ -525,7 +605,7 @@ export const dispatchDefaults = {
|
|
|
525
605
|
// A slot with no stop expires after this many minutes.
|
|
526
606
|
slotMinutes: 60,
|
|
527
607
|
// How many implementers run at once in a session. Each needs paths of its own, and a worktree.
|
|
528
|
-
implementerSlots:
|
|
608
|
+
implementerSlots: 3,
|
|
529
609
|
// The model families each type's named `model` may carry, over the runtime's own in `runtimeModels`.
|
|
530
610
|
models: {},
|
|
531
611
|
};
|
|
@@ -579,13 +659,21 @@ export const contextDefaults = {
|
|
|
579
659
|
handoffTypes: ["sdd-implementer", "architecture:sdd-implementer", "general-purpose"],
|
|
580
660
|
};
|
|
581
661
|
|
|
662
|
+
export const PROMOTION_SCOPE = "promotion";
|
|
663
|
+
export const promotionDefaults = { surfaces: ["infra/**", "**/migrations/**", ".github/workflows/**"] };
|
|
664
|
+
|
|
582
665
|
// What each key of `swarm.review` means when a repository omits it. The workflow checks run only while
|
|
583
666
|
// `swarm.dispatch` is on, so this section alone turns nothing on.
|
|
584
667
|
export const reviewDefaults = {
|
|
668
|
+
runtime: "claude",
|
|
669
|
+
// Require a promotion review only when the repository chooses its branch pair.
|
|
670
|
+
promotion: null,
|
|
585
671
|
// The review kind whose APPROVED verdict lets `gh pr merge` run: "branch" or "task".
|
|
586
672
|
merge: "branch",
|
|
587
673
|
// The largest tool-call estimate one plan task may carry.
|
|
588
674
|
maxTaskCalls: 35,
|
|
675
|
+
riskPaths: ["**/migrations/**", "schemas/**"],
|
|
676
|
+
cases: {},
|
|
589
677
|
// Globs, relative to a checkout of this repository, that the main session may edit.
|
|
590
678
|
controllerPaths: ["docs/**", "*.md", "qc.config.json", "**/.claude/**"],
|
|
591
679
|
// The agent types whose stop records a verdict of each kind.
|
|
@@ -619,8 +707,6 @@ export const directDefaults = {
|
|
|
619
707
|
maxFiles: 2,
|
|
620
708
|
// Globs a direct fix may not touch. A change to one of these runs the subagent workflow.
|
|
621
709
|
excludes: ["schemas/**", "**/migrations/**"],
|
|
622
|
-
// Globs a direct fix may touch only with one APPROVED review of its head, of either kind.
|
|
623
|
-
reviewPaths: [],
|
|
624
710
|
};
|
|
625
711
|
|
|
626
712
|
function isPlainObject(value) {
|
|
@@ -642,12 +728,93 @@ export function load(root = process.cwd()) {
|
|
|
642
728
|
const file = path.join(root, CONFIG_FILE);
|
|
643
729
|
const user = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
|
|
644
730
|
const config = merge(defaults, user);
|
|
731
|
+
if (!isPlainObject(config.lessons)) throw new TypeError("lessons must be an object");
|
|
732
|
+
for (const key of ["file", "rerun"]) {
|
|
733
|
+
if (typeof config.lessons[key] !== "string" || !config.lessons[key].trim()) throw new TypeError(`lessons.${key} must be a non-empty string`);
|
|
734
|
+
}
|
|
735
|
+
if (Object.hasOwn(user, "checkpoint") && !isPlainObject(user.checkpoint)) throw new TypeError("checkpoint must be an object");
|
|
736
|
+
if (!Number.isFinite(config.checkpoint.maxAgeMinutes) || config.checkpoint.maxAgeMinutes < 0) {
|
|
737
|
+
throw new TypeError("checkpoint.maxAgeMinutes must be a non-negative number");
|
|
738
|
+
}
|
|
739
|
+
if (!isPlainObject(config.merge)) throw new TypeError("merge must be an object");
|
|
740
|
+
if (typeof config.merge.holdLabel !== "string" || !config.merge.holdLabel.trim() || config.merge.holdLabel !== config.merge.holdLabel.trim()) {
|
|
741
|
+
throw new TypeError("merge.holdLabel must be a non-empty string without surrounding whitespace");
|
|
742
|
+
}
|
|
743
|
+
if (isPlainObject(config.codex)) {
|
|
744
|
+
for (const key of ["model", "reviewModel"]) {
|
|
745
|
+
const value = config.codex[key];
|
|
746
|
+
if (key === "model" && value === null) continue;
|
|
747
|
+
if (typeof value !== "string" || !value.trim()) throw new TypeError(`codex.${key} must be a non-empty string${key === "model" ? " or null" : ""}`);
|
|
748
|
+
}
|
|
749
|
+
if (!["low", "medium", "high"].includes(config.codex.reviewEffort)) throw new TypeError("codex.reviewEffort must be low, medium, or high");
|
|
750
|
+
if (!["warn", "add"].includes(config.codex.pathsTests)) throw new TypeError("codex.pathsTests must be warn or add");
|
|
751
|
+
}
|
|
752
|
+
if (isPlainObject(config.codex) && (!Array.isArray(config.codex.envAllow)
|
|
753
|
+
|| !config.codex.envAllow.every((name) => typeof name === "string" && name.length > 0 && name === name.trim()))) {
|
|
754
|
+
throw new TypeError("codex.envAllow must be an array of non-empty strings without surrounding whitespace");
|
|
755
|
+
}
|
|
756
|
+
if (Object.hasOwn(user, "post") && !isPlainObject(user.post)) throw new TypeError("post must be an object");
|
|
757
|
+
if (typeof config.post.aiLabel !== "boolean") throw new TypeError("post.aiLabel must be a boolean");
|
|
758
|
+
if (Object.hasOwn(user, "guard") && !isPlainObject(user.guard)) throw new TypeError("guard must be an object");
|
|
759
|
+
if (!Array.isArray(config.guard.protectedPaths) || !config.guard.protectedPaths.every((glob) => typeof glob === "string" && glob.trim())) {
|
|
760
|
+
throw new TypeError("guard.protectedPaths must be an array of non-empty strings");
|
|
761
|
+
}
|
|
762
|
+
if (!isPlainObject(config.ci)) throw new TypeError("ci must be an object");
|
|
763
|
+
if (!Array.isArray(config.ci.requiredChecks) || !config.ci.requiredChecks.every((name) => typeof name === "string" && name.trim())) {
|
|
764
|
+
throw new TypeError("ci.requiredChecks must be an array of non-empty strings");
|
|
765
|
+
}
|
|
766
|
+
if (!isPlainObject(config.featureSwitches)) throw new TypeError("featureSwitches must be an object");
|
|
767
|
+
const switches = config.featureSwitches;
|
|
768
|
+
if (typeof switches.file !== "string" || !switches.file.trim() || /[\\/]/.test(switches.file) || [".", ".."].includes(switches.file)) {
|
|
769
|
+
throw new TypeError("featureSwitches.file must be a non-empty filename at the feature root");
|
|
770
|
+
}
|
|
771
|
+
if (!Array.isArray(switches.patterns) || !switches.patterns.every((pattern) => typeof pattern === "string")) {
|
|
772
|
+
throw new TypeError("featureSwitches.patterns must be an array of strings");
|
|
773
|
+
}
|
|
774
|
+
for (const pattern of switches.patterns) {
|
|
775
|
+
try {
|
|
776
|
+
new RegExp(pattern);
|
|
777
|
+
} catch {
|
|
778
|
+
throw new TypeError(`featureSwitches.patterns contains an invalid regular expression: ${JSON.stringify(pattern)}`);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if (!isPlainObject(config.milestones)) throw new TypeError("milestones must be an object");
|
|
782
|
+
if (!Array.isArray(config.milestones.times) || !config.milestones.times.every((time) => typeof time === "string" && /^(?:[01]\d|2[0-3]):[0-5]\d$/.test(time))) {
|
|
783
|
+
throw new TypeError("milestones.times must be an array of local HH:MM times");
|
|
784
|
+
}
|
|
785
|
+
if (!isPlainObject(config.integrate)) throw new TypeError("integrate must be an object");
|
|
786
|
+
if (config.integrate.base !== undefined && (typeof config.integrate.base !== "string" || !config.integrate.base.trim())) {
|
|
787
|
+
throw new TypeError("integrate.base must be a non-empty string");
|
|
788
|
+
}
|
|
789
|
+
const { ciEvery, push, branchPattern, review } = config.integrate;
|
|
790
|
+
if (!Number.isInteger(ciEvery) || ciEvery < 1) throw new TypeError("integrate.ciEvery must be a positive integer");
|
|
791
|
+
if (typeof push !== "boolean") throw new TypeError("integrate.push must be a boolean");
|
|
792
|
+
if (typeof branchPattern !== "string") throw new TypeError("integrate.branchPattern must be a regular expression string");
|
|
793
|
+
try {
|
|
794
|
+
new RegExp(branchPattern);
|
|
795
|
+
} catch {
|
|
796
|
+
throw new TypeError("integrate.branchPattern must be a valid regular expression");
|
|
797
|
+
}
|
|
798
|
+
if (typeof review !== "boolean") throw new TypeError("integrate.review must be a boolean");
|
|
799
|
+
if (!isPlainObject(config.ready) || !Array.isArray(config.ready.platforms) || config.ready.platforms.length === 0 ||
|
|
800
|
+
config.ready.platforms.some((os) => !["linux", "windows"].includes(os)) || new Set(config.ready.platforms).size !== config.ready.platforms.length) {
|
|
801
|
+
throw new TypeError("ready.platforms must be a non-empty array of distinct linux and windows platforms");
|
|
802
|
+
}
|
|
645
803
|
if (!isPlainObject(config.check)) throw new TypeError("check must be an object");
|
|
646
|
-
const { related, commands, base } = config.check;
|
|
804
|
+
const { related, sincePush, e2e, commands, base } = config.check;
|
|
647
805
|
const command = (value) => typeof value === "string" && value.trim().length > 0;
|
|
648
806
|
if (related !== null && !command(related)) throw new TypeError("check.related must be a non-empty string or null");
|
|
807
|
+
if (sincePush !== null && !command(sincePush)) throw new TypeError("check.sincePush must be a non-empty string or null");
|
|
808
|
+
if (e2e !== null && !command(e2e)) throw new TypeError("check.e2e must be a non-empty string or null");
|
|
649
809
|
if (!Array.isArray(commands) || !commands.every(command)) throw new TypeError("check.commands must be an array of non-empty strings");
|
|
650
810
|
if (!command(base)) throw new TypeError("check.base must be a non-empty string");
|
|
811
|
+
if (!isPlainObject(config.tests)) throw new TypeError("tests must be an object");
|
|
812
|
+
for (const key of ["maxNewCases", "maxExtraCases"]) {
|
|
813
|
+
if (!Number.isInteger(config.tests[key]) || config.tests[key] < 0) throw new TypeError(`tests.${key} must be a nonnegative whole number`);
|
|
814
|
+
}
|
|
815
|
+
if (!Array.isArray(config.tests.command) || !config.tests.command.length || !config.tests.command.every(command)) {
|
|
816
|
+
throw new TypeError("tests.command must be a non-empty array of non-empty strings");
|
|
817
|
+
}
|
|
651
818
|
config.root = root;
|
|
652
819
|
return config;
|
|
653
820
|
}
|
package/src/config.test.mjs
CHANGED
|
@@ -5,32 +5,304 @@ import { readFile } from "node:fs/promises";
|
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { defaults, load, merge, requiredHooks } from "./config.mjs";
|
|
8
|
+
import { defaults, directDefaults, load, merge, requiredHooks } from "./config.mjs";
|
|
9
9
|
import { rules } from "./eslint/index.mjs";
|
|
10
|
+
import { directSettings } from "./cli/direct-lane.mjs";
|
|
11
|
+
|
|
12
|
+
test("the direct lane owns its review path default and accepts replacements", () => {
|
|
13
|
+
assert.equal(Object.hasOwn(directDefaults, "reviewPaths"), false);
|
|
14
|
+
assert.deepEqual(directSettings({}).reviewPaths, [".mcp.json", "**/.claude/**", ".github/workflows/**", "hooks/**"]);
|
|
15
|
+
assert.deepEqual(directSettings({ direct: { reviewPaths: [] } }).reviewPaths, []);
|
|
16
|
+
assert.deepEqual(directSettings({ direct: { reviewPaths: ["local/**"] } }).reviewPaths, ["local/**"]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("throwaway database schema command defaults to null", () => {
|
|
20
|
+
assert.equal(defaults.throwawayDb.schemaCommand, null);
|
|
21
|
+
});
|
|
10
22
|
|
|
11
23
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
12
24
|
|
|
25
|
+
test("lessons settings default and validate the file and rerun command", (t) => {
|
|
26
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-lessons-config-"));
|
|
27
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 10 }));
|
|
28
|
+
assert.deepEqual(load(root).lessons, { file: "docs/ci-lessons.md", rerun: "node --test" });
|
|
29
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ lessons: { file: "LESSONS.md", rerun: "pnpm test" } }));
|
|
30
|
+
assert.deepEqual(load(root).lessons, { file: "LESSONS.md", rerun: "pnpm test" });
|
|
31
|
+
for (const lessons of [null, [], { file: "" }, { rerun: " " }, { file: 1 }, { rerun: false }]) {
|
|
32
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ lessons }));
|
|
33
|
+
assert.throws(() => load(root), /lessons/);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("checkpoint defaults to 30 minutes and accepts zero or a positive age", (t) => {
|
|
38
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-checkpoint-config-"));
|
|
39
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
40
|
+
assert.deepEqual(load(root).checkpoint, { maxAgeMinutes: 30 });
|
|
41
|
+
for (const maxAgeMinutes of [0, 1, 12.5, 60]) {
|
|
42
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ checkpoint: { maxAgeMinutes } }));
|
|
43
|
+
assert.equal(load(root).checkpoint.maxAgeMinutes, maxAgeMinutes);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("checkpoint rejects malformed configuration", (t) => {
|
|
48
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-checkpoint-invalid-"));
|
|
49
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
50
|
+
for (const checkpoint of [null, false, [], "off", { maxAgeMinutes: null }, { maxAgeMinutes: -1 }, { maxAgeMinutes: "30" }]) {
|
|
51
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ checkpoint }));
|
|
52
|
+
assert.throws(() => load(root), /checkpoint/);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("post.aiLabel defaults on and accepts an explicit boolean", (t) => {
|
|
57
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-post-config-"));
|
|
58
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
59
|
+
assert.deepEqual(defaults.post, { aiLabel: true });
|
|
60
|
+
assert.equal(load(root).post.aiLabel, true);
|
|
61
|
+
for (const post of [{}, { aiLabel: false }, { aiLabel: true }]) {
|
|
62
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ post }));
|
|
63
|
+
assert.equal(load(root).post.aiLabel, post.aiLabel ?? true);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("post.aiLabel rejects malformed configuration", (t) => {
|
|
68
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-post-invalid-"));
|
|
69
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
70
|
+
for (const post of [null, [], false, "post", { aiLabel: null }, { aiLabel: "false" }, { aiLabel: 0 }, { aiLabel: [] }, { aiLabel: {} }]) {
|
|
71
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ post }));
|
|
72
|
+
assert.throws(() => load(root), /post/);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("merge.holdLabel defaults to hold and accepts a repository label", (t) => {
|
|
77
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-hold-config-"));
|
|
78
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
79
|
+
assert.equal(defaults.merge?.holdLabel, "hold");
|
|
80
|
+
assert.equal(load(root).merge.holdLabel, "hold");
|
|
81
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ merge: { holdLabel: "operator-hold" } }));
|
|
82
|
+
assert.equal(load(root).merge.holdLabel, "operator-hold");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("merge rejects a non-object configuration", (t) => {
|
|
86
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-merge-invalid-"));
|
|
87
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
88
|
+
for (const value of [null, [], false, 5, "merge"]) {
|
|
89
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ merge: value }));
|
|
90
|
+
assert.throws(() => load(root), { name: "TypeError", message: "merge must be an object" });
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("merge.holdLabel rejects invalid labels and surrounding whitespace", (t) => {
|
|
95
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-hold-invalid-"));
|
|
96
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
97
|
+
for (const holdLabel of [null, false, 5, [], {}, "", " ", " hold", "hold "]) {
|
|
98
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ merge: { holdLabel } }));
|
|
99
|
+
assert.throws(() => load(root), { name: "TypeError", message: "merge.holdLabel must be a non-empty string without surrounding whitespace" });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("guard defaults protect automation and configuration, and custom paths replace the defaults", (t) => {
|
|
104
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-guard-config-"));
|
|
105
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
106
|
+
assert.deepEqual(load(root).guard.protectedPaths, [".github/workflows/**", ".husky/**", ".githooks/**", "qc.config.json", ".claude/settings*.json"]);
|
|
107
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ guard: { protectedPaths: ["ci/**"] } }));
|
|
108
|
+
assert.deepEqual(load(root).guard.protectedPaths, ["ci/**"]);
|
|
109
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ guard: { protectedPaths: [] } }));
|
|
110
|
+
assert.deepEqual(load(root).guard.protectedPaths, []);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("guard.protectedPaths rejects malformed configuration", (t) => {
|
|
114
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-guard-invalid-"));
|
|
115
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
116
|
+
for (const guard of [null, [], false, "guard", { protectedPaths: null }, { protectedPaths: "ci/**" }, { protectedPaths: [""] }, { protectedPaths: [" "] }, { protectedPaths: [1] }]) {
|
|
117
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ guard }));
|
|
118
|
+
assert.throws(() => load(root), /guard/);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("ci.requiredChecks defaults to an empty list and accepts check names", (t) => {
|
|
123
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-ci-config-"));
|
|
124
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
125
|
+
assert.deepEqual(load(root).ci, { requiredChecks: [] });
|
|
126
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ ci: { requiredChecks: ["build", "test"] } }));
|
|
127
|
+
assert.deepEqual(load(root).ci.requiredChecks, ["build", "test"]);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("ci.requiredChecks rejects malformed configuration", (t) => {
|
|
131
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-ci-config-"));
|
|
132
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
133
|
+
for (const ci of [null, [], false, "CI", { requiredChecks: null }, { requiredChecks: "build" }, { requiredChecks: [""] }, { requiredChecks: [" "] }, { requiredChecks: [1] }]) {
|
|
134
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ ci }));
|
|
135
|
+
assert.throws(() => load(root), /ci/);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("featureSwitches validates its object, filename, patterns, and regular expressions", (t) => {
|
|
140
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-switch-config-"));
|
|
141
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
142
|
+
for (const value of [null, [], false, "switches"]) {
|
|
143
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ featureSwitches: value }));
|
|
144
|
+
assert.throws(() => load(root), /featureSwitches must be an object/);
|
|
145
|
+
}
|
|
146
|
+
for (const [key, values] of Object.entries({
|
|
147
|
+
file: [null, false, 3, [], {}, "", " ", ".", "..", "nested/switches.ts", "nested\\switches.ts"],
|
|
148
|
+
patterns: [null, false, "SHOW_", {}, [3], [null], ["["], ["("]],
|
|
149
|
+
})) {
|
|
150
|
+
for (const value of values) {
|
|
151
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ featureSwitches: { [key]: value } }));
|
|
152
|
+
assert.throws(() => load(root), new RegExp(`featureSwitches\\.${key}`));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ featureSwitches: { file: "switches.ts", patterns: ["^CUSTOM_"] } }));
|
|
156
|
+
assert.deepEqual(load(root).featureSwitches, { file: "switches.ts", patterns: ["^CUSTOM_"] });
|
|
157
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ featureSwitches: { patterns: [] } }));
|
|
158
|
+
assert.deepEqual(load(root).featureSwitches.patterns, []);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("featureSwitches validation throws plain TypeErrors with their stacks", (t) => {
|
|
162
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-switch-errors-"));
|
|
163
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
164
|
+
for (const featureSwitches of [null, { file: "" }, { patterns: "SHOW_" }, { patterns: ["["] }]) {
|
|
165
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ featureSwitches }));
|
|
166
|
+
assert.throws(() => load(root), (error) => {
|
|
167
|
+
assert.equal(error.constructor, TypeError);
|
|
168
|
+
assert.equal(error.name, "TypeError");
|
|
169
|
+
assert.match(error.message, /^featureSwitches/);
|
|
170
|
+
assert.match(error.stack, /at load \(/);
|
|
171
|
+
return true;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("codex defaults bound a short session and disable the skill plugin", () => {
|
|
177
|
+
assert.deepEqual(load(here).codex, {
|
|
178
|
+
model: null,
|
|
179
|
+
reviewModel: "gpt-6.1-sol",
|
|
180
|
+
reviewEffort: "high",
|
|
181
|
+
pathsTests: "warn",
|
|
182
|
+
compactTokens: 300000,
|
|
183
|
+
disablePlugins: ["superpowers@claude-plugins-official"],
|
|
184
|
+
envAllow: [],
|
|
185
|
+
preamble: "",
|
|
186
|
+
briefMaxLines: 40,
|
|
187
|
+
briefMaxSteps: 6,
|
|
188
|
+
maxRuns: 2,
|
|
189
|
+
requireApproval: false,
|
|
190
|
+
maxDiffLines: 400,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("codex.pathsTests accepts warn and add and rejects other values", (t) => {
|
|
195
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-paths-tests-config-"));
|
|
196
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
197
|
+
for (const pathsTests of ["warn", "add"]) {
|
|
198
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ codex: { pathsTests } }));
|
|
199
|
+
assert.equal(load(root).codex.pathsTests, pathsTests);
|
|
200
|
+
}
|
|
201
|
+
for (const pathsTests of [null, "off", "WARN", 1, false]) {
|
|
202
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ codex: { pathsTests } }));
|
|
203
|
+
assert.throws(() => load(root), { name: "TypeError", message: "codex.pathsTests must be warn or add" });
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("codex configuration raises limits and preserves omitted defaults", (t) => {
|
|
208
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-codex-config-"));
|
|
209
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
210
|
+
const codex = { briefMaxLines: 80, briefMaxSteps: 10, maxRuns: 4, disablePlugins: ["custom@plugins"], envAllow: ["GITHUB_TOKEN", "PROJECT_KEY"], preamble: "Use the local rules." };
|
|
211
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ codex }));
|
|
212
|
+
assert.deepEqual(load(root).codex, { ...defaults.codex, ...codex });
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test("codex.envAllow rejects invalid lists and names with surrounding whitespace", (t) => {
|
|
216
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-codex-env-config-"));
|
|
217
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
218
|
+
for (const envAllow of [null, "GH_TOKEN", {}, [1], [""], [" "], [" GH_TOKEN"], ["GH_TOKEN "], ["\tNPM_TOKEN"], ["NPM_TOKEN\n"]]) {
|
|
219
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ codex: { envAllow } }));
|
|
220
|
+
assert.throws(() => load(root), { name: "TypeError", message: /codex\.envAllow.*array of non-empty strings/ }, JSON.stringify(envAllow));
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("integrate defaults push every three merges", () => {
|
|
225
|
+
const config = load(here);
|
|
226
|
+
assert.equal(config.integrate.ciEvery, 3);
|
|
227
|
+
assert.equal(config.integrate.push, true);
|
|
228
|
+
assert.equal(config.integrate.branchPattern, "^[a-z]+/[0-9]+-integration$");
|
|
229
|
+
assert.equal(config.integrate.review, true);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test("integrate configuration preserves omitted defaults", (t) => {
|
|
233
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-integrate-config-"));
|
|
234
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
235
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate: { ciEvery: 2 } }));
|
|
236
|
+
assert.equal(load(root).integrate.ciEvery, 2);
|
|
237
|
+
assert.equal(load(root).integrate.push, true);
|
|
238
|
+
assert.equal(load(root).integrate.branchPattern, "^[a-z]+/[0-9]+-integration$");
|
|
239
|
+
assert.equal(load(root).integrate.review, true);
|
|
240
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate: { push: false } }));
|
|
241
|
+
assert.equal(load(root).integrate.ciEvery, 3);
|
|
242
|
+
assert.equal(load(root).integrate.push, false);
|
|
243
|
+
assert.equal(load(root).integrate.branchPattern, "^[a-z]+/[0-9]+-integration$");
|
|
244
|
+
assert.equal(load(root).integrate.review, true);
|
|
245
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate: { branchPattern: "^release/", review: false } }));
|
|
246
|
+
assert.equal(load(root).integrate.branchPattern, "^release/");
|
|
247
|
+
assert.equal(load(root).integrate.review, false);
|
|
248
|
+
assert.equal(load(root).integrate.ciEvery, 3);
|
|
249
|
+
assert.equal(load(root).integrate.push, true);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test("integrate configuration rejects invalid types and cadences", (t) => {
|
|
253
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-integrate-config-"));
|
|
254
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
255
|
+
for (const integrate of [null, [], false, "command"]) {
|
|
256
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate }));
|
|
257
|
+
assert.throws(() => load(root), { name: "TypeError", message: /integrate must be an object/ });
|
|
258
|
+
}
|
|
259
|
+
for (const [key, values] of Object.entries({
|
|
260
|
+
ciEvery: [0, 1.5, "3"],
|
|
261
|
+
push: ["yes"],
|
|
262
|
+
branchPattern: [null, false, 1, [], {}, "["],
|
|
263
|
+
review: [null, "true", 1, [], {}],
|
|
264
|
+
base: [null, false, 5, [], {}, "", " "],
|
|
265
|
+
})) {
|
|
266
|
+
for (const value of values) {
|
|
267
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate: { [key]: value } }));
|
|
268
|
+
assert.throws(() => load(root), { name: "TypeError", message: new RegExp(`integrate\\.${key}`) });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test("integrate.base accepts a non-empty branch string and stays unset by default", (t) => {
|
|
274
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-integrate-base-"));
|
|
275
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
276
|
+
assert.equal(load(root).integrate.base, undefined);
|
|
277
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ integrate: { base: "origin/release" } }));
|
|
278
|
+
assert.equal(load(root).integrate.base, "origin/release");
|
|
279
|
+
});
|
|
280
|
+
|
|
13
281
|
test("check defaults leave repository commands off", () => {
|
|
14
|
-
assert.
|
|
282
|
+
assert.equal(defaults.check.sincePush, null);
|
|
283
|
+
assert.equal(defaults.check.e2e, null);
|
|
284
|
+
assert.deepEqual(load(here).check, { related: null, sincePush: null, e2e: null, commands: [], base: "origin/main" });
|
|
15
285
|
});
|
|
16
286
|
|
|
17
287
|
test("check configuration accepts commands and preserves omitted defaults", (t) => {
|
|
18
288
|
const root = mkdtempSync(path.join(tmpdir(), "qc-check-config-"));
|
|
19
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
289
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
20
290
|
const check = { related: "pnpm exec vitest related --run", commands: ["node script/check-comments.mjs --base origin/dev"] };
|
|
21
291
|
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ check }));
|
|
22
|
-
assert.deepEqual(load(root).check, { ...check, base: "origin/main" });
|
|
292
|
+
assert.deepEqual(load(root).check, { ...check, sincePush: null, e2e: null, base: "origin/main" });
|
|
23
293
|
});
|
|
24
294
|
|
|
25
295
|
test("check configuration rejects invalid types and empty commands or refs", (t) => {
|
|
26
296
|
const root = mkdtempSync(path.join(tmpdir(), "qc-check-config-"));
|
|
27
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
297
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
28
298
|
for (const check of [null, [], false, "command"]) {
|
|
29
299
|
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ check }));
|
|
30
300
|
assert.throws(() => load(root), /check must be an object/);
|
|
31
301
|
}
|
|
32
302
|
for (const [key, values] of Object.entries({
|
|
33
303
|
related: [false, 1, [], {}, "", " "],
|
|
304
|
+
sincePush: [false, 1, [], {}, "", " "],
|
|
305
|
+
e2e: [false, 1, [], {}, "", " "],
|
|
34
306
|
commands: [null, false, "node", [1], [null], [""], [" "]],
|
|
35
307
|
base: [null, false, 1, [], "", " "],
|
|
36
308
|
})) {
|
|
@@ -124,3 +396,53 @@ test("extraExemptHelpers defaults to an empty list, and exemptHelpers keeps the
|
|
|
124
396
|
assert.deepEqual(config.tenantPredicate.extraExemptHelpers, []);
|
|
125
397
|
assert.equal(config.tenantPredicate.exemptHelpers.length, 2);
|
|
126
398
|
});
|
|
399
|
+
|
|
400
|
+
for (const [key, values] of Object.entries({ model: [1, "", " "], reviewModel: [null, 1, "", " "], reviewEffort: [null, "xhigh", "HIGH", 1] })) {
|
|
401
|
+
test(`codex.${key} rejects invalid settings`, (t) => {
|
|
402
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-codex-model-"));
|
|
403
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
404
|
+
for (const value of values) {
|
|
405
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ codex: { [key]: value } }));
|
|
406
|
+
assert.throws(() => load(root), new RegExp(`codex\\.${key}`));
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
test("locked tests settings default and validate nonnegative whole caps and command argv", (t) => {
|
|
412
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-tests-config-"));
|
|
413
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
414
|
+
assert.deepEqual(load(root).tests, { maxNewCases: 8, maxExtraCases: 4, command: ["node", "--test"] });
|
|
415
|
+
for (const tests of [{ maxNewCases: 0, maxExtraCases: 0, command: ["pnpm", "test"] }, { maxNewCases: 12 }]) {
|
|
416
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ tests }));
|
|
417
|
+
assert.deepEqual(load(root).tests, { ...defaults.tests, ...tests });
|
|
418
|
+
}
|
|
419
|
+
for (const tests of [null, [], ...["maxNewCases", "maxExtraCases"].flatMap((key) => [-1, 1.5, "8", null].map((v) => ({ [key]: v }))), ...[[], "node --test", [""], [1], ["node", null]].map((command) => ({ command }))]) {
|
|
420
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ tests }));
|
|
421
|
+
assert.throws(() => load(root), /tests/);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
test("ready platforms default to Linux and reject invalid or empty platforms", (t) => {
|
|
426
|
+
assert.deepEqual(defaults.ready.platforms, ["linux"]);
|
|
427
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-ready-config-"));
|
|
428
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
429
|
+
assert.deepEqual(load(root).ready.platforms, ["linux"]);
|
|
430
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ ready: { platforms: ["linux", "windows"] } }));
|
|
431
|
+
assert.deepEqual(load(root).ready.platforms, ["linux", "windows"]);
|
|
432
|
+
for (const ready of [null, [], { platforms: [] }, { platforms: ["mac"] }, { platforms: ["linux", "linux"] }, { platforms: "linux" }]) {
|
|
433
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ ready }));
|
|
434
|
+
assert.throws(() => load(root), /ready/);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
test("milestones default to three local times and validate HH:MM", (t) => {
|
|
439
|
+
const root = mkdtempSync(path.join(tmpdir(), "qc-milestones-config-"));
|
|
440
|
+
t.after(() => rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
|
|
441
|
+
assert.deepEqual(load(root).milestones.times, ["11:00", "16:00", "21:00"]);
|
|
442
|
+
for (const milestones of [null, [], false, { times: null }, { times: "11:00" }, { times: ["24:00"] }, { times: ["1:00"] }, { times: ["12:60"] }, { times: [1] }]) {
|
|
443
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ milestones }));
|
|
444
|
+
assert.throws(() => load(root), /milestones/);
|
|
445
|
+
}
|
|
446
|
+
writeFileSync(path.join(root, "qc.config.json"), JSON.stringify({ milestones: { times: ["00:00", "23:59"] } }));
|
|
447
|
+
assert.deepEqual(load(root).milestones.times, ["00:00", "23:59"]);
|
|
448
|
+
});
|