Repository navigation
Expand file tree
/
Copy pathguard.config.example.json
More file actions
127 lines (105 loc) · 14.4 KB
/
Copy pathguard.config.example.json
File metadata and controls
127 lines (105 loc) · 14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{
"//": "Copy to guard.config.json at your repo ROOT, then strip these //-comment keys (real JSON has no comments). Every path below is resolved relative to THIS repo (the consumer cwd), never the devkit package dir. Omit any field to keep its built-in default (see gate-engine/config.mjs DEFAULTS).",
"//boundaries": "Cross-trust-boundary path prefixes. The decisions smell gate flags a single change that straddles 2+ of these (a cross-boundary move = likely an architectural decision). Default: [] (no boundaries → smell never fires).",
"boundaries": ["src/main/", "socket-server/", "vercel-serverless/"],
"//scanRoots": "Where the ratchets + structure scans look for implementation files. Default: ['src'].",
"scanRoots": ["src", "socket-server/src", "vercel-serverless"],
"//sourceExtensions": "Source extensions the ratchets count. Default: ['ts','tsx']. A JS/MJS codebase sets ['mjs','js']. Tests (*.test.<ext> / *.spec.<ext>) are excluded from impl fan-out but included when maxTestLines is enabled.",
"sourceExtensions": ["ts", "tsx"],
"//generated": "Generated paths and the command that regenerates each. When `devkit ship` cannot three-way merge one of these, it names the command instead of asking you to hand-merge a file whose correct content is derived. devkit only PRINTS the command, never runs it. devkit's own .devkit/skills-manifest.json and .devkit/agents-manifest.json are built in; an entry with the same glob overrides one. Globs are repo-relative; the first matching entry wins. Default: [].",
"generated": [{ "glob": "src/generated/**", "command": "npm run codegen" }],
"//evidence": "Opt-in. After `devkit ship` opens or updates a PR whose diff adds or changes test files, it runs those files twice in disposable clones: red (the PR base plus only the PR's test and supportPaths files) and green (the PR head). It writes the outcome between <!-- devkit:evidence:begin --> and <!-- devkit:evidence:end --> in the PR body and says captured, never proved. `command` is an argv run without a shell; exactly one element must be \"{files}\" (the PR's test paths, which Vitest treats as filters) and \"{report}\" names the Vitest JSON report it must write. supportPaths are repository globs (*, **, ?) for fixtures the tests need on red. timeoutSeconds (default 120) bounds the runs; a timeout or failure never fails the ship, and the block then reads inconclusive. Ship uses this command, not testCommand. Default: absent = no block and no extra gh calls.",
"evidence": {
"command": [
"node_modules/.bin/vitest",
"run",
"--reporter=json",
"--outputFile.json={report}",
"{files}"
],
"supportPaths": ["**/__tests__/**"],
"timeoutSeconds": 120
},
"//extraGates": "Repo-specific deterministic gates, label → command. guard-deterministic runs each on every commit and devkit ship, beside the built-in gates and before the AI judges; any non-zero exit blocks (a `guard-structure …` command keeps its exit-2 opt-out). A label starts with a letter or digit, then uses only letters, digits, `.`, `_` and `-`; it may not be a built-in gate name or start with `guard-`. The command is split on whitespace and run without a shell, so put pipes, && or env assignments in a package script. A `{staged}` argument (whole, at most once) becomes the commit's added, copied, modified and renamed paths, relative to the directory the gate runs in, so a test runner selects the tests related to the commit: `node_modules/.bin/vitest related --run {staged}` or `node_modules/.bin/jest --findRelatedTests --passWithNoTests {staged}`. Deleted paths are not passed. With nothing staged the gate prints `no staged paths, not run` and passes; a staged set git cannot list, or one too large for a command line, blocks. The tests read the working tree, which matches the staged content under devkit ship. A staged package.json or vitest config makes vitest run its whole suite; narrow that with `forceRerunTriggers` in your vitest config. It runs with GIT_INDEX_FILE unset: under git commit -a or git commit -- <path>, devkit exports DEVKIT_COMMIT_INDEX_FILE, so a script that reads the staged set sets GIT_INDEX_FILE to it only when it is set (an empty GIT_INDEX_FILE reads as an empty index) plus GIT_OPTIONAL_LOCKS=0, and never writes the index. devkit ship reuses a passing run for an identical staged tree and config, so a gate whose result depends on anything else (environment, branch, network, time) can be skipped. A slow gate can be written `{ \"cmd\": \"<command>\", \"afterGreen\": true }`: it runs last and only when every other deterministic gate passed (devkit review runs it regardless), and a red run lists it as NOT run. Default: none.",
"extraGates": {
"knip": "npm run knip",
"related-tests": "node_modules/.bin/vitest related --run {staged}",
"typecheck": "npm run typecheck"
},
"//gateTimeoutMs": "How long guard-deterministic waits for any one gate, built-in or extra, in milliseconds. A gate with no exit by then is signalled and blocks as `<gate>(timed-out:Ns)`, which is not a code finding. It is a hang detector, so size it well above your slowest gate on a loaded machine. A positive whole number; anything else falls back to the default. GUARD_GATE_TIMEOUT_MS overrides it for one run. Default: 1800000 (30 minutes).",
"gateTimeoutMs": 1800000,
"//mergeVerdict": "Inputs to the deterministic merge verdict: auto-merge-eligible, human-review (<reason>) or policy (<reason>). devkit ship prints it at the top of the evidence block, so only where `evidence` is configured, and records every reason that fired in the block's data line. It is advisory: nothing merges on it. enabled false leaves the verdict out and keeps the rest of the block, for a repo where every PR gets a human review anyway. Like every other field here it is read from the PR base, so a PR cannot turn off its own verdict. Default: true. A GUARD_* bypass exported for the ship or a waived finding reads human-review (gate-bypassed), and a PR with a commit since its base that has no passing devkit ship gate run recorded on this machine reads human-review (bypass-unknown). consumerSurface lists repo-relative globs (*, ** and ?) for what your repo ships to its users: synced assets, templates, CLI command and flag definitions, config schema. A change there needs human review. Default: []. A test-only change is eligible at any size. A source change is eligible only with red/green evidence captured at the PR head and within its size limit: changed lines (added plus deleted) and files. limits picks the size limit by the PR subject's Conventional Commits type (fix:, feat(scope):, case-insensitive); a breaking type!: subject, an untyped subject or a type with no entry uses limits.default. An entry may set one field and inherit the other from limits.default, then from the built-in 50 lines / 4 files; maxSourceLines 0 leaves only test-only changes eligible. Built in, whatever this key says: changes to CI and gate configuration (.github/**, .husky/**, guard.config.json, .devkit/config.json, ratchet baselines, waiver stores) and to dependency manifests and lockfiles (package.json, the JS lockfiles, Cargo.*, go.mod, pyproject.toml and the other files GitHub's dependency graph reads) are policy; decision records and any GUARD_* bypass or waived finding are human-review.",
"mergeVerdict": {
"consumerSurface": ["templates/**", "src/cli/commands/**"],
"limits": {
"default": { "maxSourceLines": 50, "maxSourceFiles": 4 },
"fix": { "maxSourceLines": 200 }
}
},
"//maxLines": "Raw line cap for implementation files. Existing oversized files are grandfathered shrink-only in .devkit/baselines/size-lines.json. 0 = off.",
"maxLines": 500,
"//maxTestLines": "Looser raw line cap for test files. Existing oversized tests are grandfathered shrink-only into the same .devkit/baselines/size-lines.json baseline. 0 = off.",
"maxTestLines": 2000,
"//maxLinesExtensions": "Extra extensions the raw-line caps also govern, beyond sourceExtensions (e.g. ['sh'] for shell scripts under scanRoots). No other gate reads them. After adding one, run guard-size freeze so files already over the cap are grandfathered. Default: [].",
"maxLinesExtensions": [],
"//decisionsDir": "Append-only decision-log dir (guard-decisions CLI + smell gate target). Default: 'docs/decisions'.",
"decisionsDir": "docs/decisions",
"//fanoutCap": "Max non-test impl files per folder (any depth) before guard-fanout trips. Default: 12.",
"fanoutCap": 12,
"//fanoutExempt": "Flat-by-design folders exempt from the fanout cap (e.g. one-file-per-domain routers, vendored UI primitives). Default: [].",
"fanoutExempt": ["src/main/lib/trpc/routers", "src/renderer/components/ui"],
"//allowlistPath": "Co-occurrence intentional-dup approvals (guard-dup + guard-clone). Default: '.co-occurrence-allowlist.json'.",
"allowlistPath": ".co-occurrence-allowlist.json",
"//thresholds": "Matcher/clone tier + size knobs. Override any subset; unspecified knobs keep their default.",
"thresholds": {
"nearCode": 0.95,
"driftCode": 0.8,
"driftDesc": 0.88,
"minLoc": 15,
"minTokens": 50,
"similarity": 0.9
},
"//indexPath": "search-code embedding index for the semantic duplication matcher. null (or omit) => matcher opts out / fails open; guard-clone + ratchets still run. OMITTING is not the same as writing null: `devkit doctor` reports drift when the key is ABSENT while .search-code/index.db exists (or search-code was selected at init), because that combination is devkit's own wiring lost rather than a choice. An explicit null is the DECLARED opt-out and is always silent. Env: GUARD_INDEX_PATH (or SEARCH_CODE_DB, matcher-only).",
"indexPath": ".search-code/index.db",
"//searchTool": "Semantic-search tool NAME the search-steering hooks point agents at. Default: 'mcp__codebase__searchCode'. Env override: GUARD_SEARCH_TOOL.",
"searchTool": "mcp__codebase__searchCode",
"//graphTool": "Graph/dependency tool NAME the search-steering hooks point agents at. Default: 'graphify'. Env override: GUARD_GRAPH_TOOL.",
"graphTool": "graphify",
"//testCommand": "Test command the testing agents run (e.g. 'bun run test:run'). Default: null => agents fall back to the package.json test script. Env override: GUARD_TEST_COMMAND.",
"testCommand": null,
"//coverage": "The `coverage` guard (opt-in — add it to your devkit guards). Reads coverage/coverage-final.json (produced by `test:run:coverage`) and enforces the threshold KEYS you set here (statements/functions/lines/branches — any subset). FAIL-CLOSED: when the guard is selected and coverage data is ABSENT, the commit fails hard (run test:run:coverage first). Set `false` to bypass entirely. Default (omit): {} = enforce no % floor but still fail hard on absent data. Diff scope — { \"scope\": \"diff\", \"addedLines\": 70 } — judges only the executable lines a commit or ship ADDS, from a seconds-long `devkit coverage-run <test files>`; a source file with added lines that the run never measured blocks, and a change adding no production source lines passes without any run. Keep the repo-wide floor in CI when you choose diff scope.",
"coverage": { "statements": 60, "functions": 55 },
"//review": "paths.include/exclude defines the shared reviewable repository universe for every reviewer; backendRoots/frontendRoots then route eligible files to domain reviewers. An EMPTY frontendRoots array means frontend-security-reviewer and frontend-performance-reviewer are never selected; an EMPTY backendRoots array similarly disables backend domain reviewers. Omit paths to preserve legacy reviewer selection. trustBoundaries, shortcutTracking, and accessibility configure reviewer context. prNotes (default true) lists PASS reviewers' non-blocking advisories under Reviewer notes in a devkit-shipped PR body; false leaves them out.",
"//review-models": "Optional judge knobs (env > this file > defaults): model = cascade first-pass for unpinned reviewers (default gpt-5.6-terra@high); escalationModel = the model that re-investigates an unpinned reviewer's FAIL, confirm or overturn (default gpt-5.6-sol); correctnessModel = the correctness reviewer's single-pass pin (default gpt-5.6-sol); correctnessChunkLoc = correctness chunk cap in LOC, 0 = un-chunked kill switch (default 400). A gpt-* value may carry a reasoning-effort suffix (model@low|medium|high|xhigh). gpt-* models route judges through the codex CLI \u2014 it must be installed (or GUARD_CODEX_BIN set) on every machine that commits; devkit doctor DRIFTs when it is missing. Claude-only installs set the four claude-era values shown here. Each key has an env override: GUARD_REVIEW_MODEL, GUARD_REVIEW_ESCALATION_MODEL, GUARD_CORRECTNESS_MODEL and GUARD_CORRECTNESS_CHUNK (which takes 'off' where this file takes 0) — move the whole family, never a subset, because no large-diff bench has measured the claude correctness model chunked. The sentry judge has no key here: it resolves GUARD_SENTRY_MODEL, else FRINK_SENTRY_MODEL, else review.model.",
"//reviewPaths": "Optional shared repository scope for all reviewers. include/exclude are repo-relative POSIX globs; exclude wins. It is independent of sourceExtensions so tests, docs, scripts, and other authored text can reach reviewers that can reason about them; language-aware tools such as commit-guard still apply sourceExtensions afterward. Omit the whole block to preserve every reviewer's legacy selection behavior.",
"review": {
"model": "sonnet",
"escalationModel": "opus",
"correctnessModel": "claude-haiku-5-5",
"correctnessChunkLoc": 0,
"paths": {
"include": ["**"],
"exclude": [
".agents/**",
".claude/**",
".codex/**",
".cursor/**",
".devkit/**",
".env*",
"**/.env*",
"node_modules/**",
"**/node_modules/**",
"dist/**",
"**/dist/**",
"coverage/**",
"*.lock",
"**/*.lock"
]
},
"backendRoots": ["src/main", "socket-server", "vercel-serverless"],
"frontendRoots": ["src/renderer", "src/preload"],
"trustBoundaries": "src/main = privileged Node process that ships inside the user-extractable app binary, so it holds no credentials or API keys; treat IPC arguments and sender, MCP/agent payloads and filesystem/network input reaching it as untrusted; src/renderer + src/preload = untrusted web context; socket-server + vercel-serverless = trusted backend holding the secrets",
"shortcutTracking": false,
"accessibility": { "skipTouchTargets": true }
}
}