@webpieces/rules-config 0.4.916 → 0.4.918
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 +5 -5
- package/src/aged-tree-sweep.d.ts +2 -2
- package/src/aged-tree-sweep.js +2 -2
- package/src/aged-tree-sweep.js.map +1 -1
- package/src/build-log-doc.d.ts +1 -1
- package/src/build-log-doc.js +3 -3
- package/src/build-log-doc.js.map +1 -1
- package/src/builds-log.d.ts +2 -2
- package/src/builds-log.js +2 -2
- package/src/builds-log.js.map +1 -1
- package/src/checklist-override.d.ts +1 -1
- package/src/checklist-override.js +1 -1
- package/src/checklist-override.js.map +1 -1
- package/src/config-error-banner.js +1 -1
- package/src/config-error-banner.js.map +1 -1
- package/src/constants.js +3 -3
- package/src/constants.js.map +1 -1
- package/src/exclude-hook-paths.d.ts +5 -5
- package/src/exclude-hook-paths.js +5 -5
- package/src/exclude-hook-paths.js.map +1 -1
- package/src/exclude-paths.d.ts +1 -1
- package/src/exclude-paths.js +1 -1
- package/src/exclude-paths.js.map +1 -1
- package/src/hook-fault-codes.js.map +1 -1
- package/src/index.js +5 -5
- package/src/index.js.map +1 -1
- package/src/instruct-ai-docs.d.ts +3 -3
- package/src/instruct-ai-docs.js +3 -3
- package/src/instruct-ai-docs.js.map +1 -1
- package/src/legacy-config-upgrade.js +2 -2
- package/src/legacy-config-upgrade.js.map +1 -1
- package/src/load-template.d.ts +1 -1
- package/src/load-template.js +2 -2
- package/src/load-template.js.map +1 -1
- package/src/merge-process-doc.d.ts +1 -1
- package/src/merge-process-doc.js +2 -2
- package/src/merge-process-doc.js.map +1 -1
- package/src/migrate-dirs-cli.js +1 -1
- package/src/migrate-dirs-cli.js.map +1 -1
- package/src/orphan-dir-archive.d.ts +4 -4
- package/src/orphan-dir-archive.js +4 -4
- package/src/orphan-dir-archive.js.map +1 -1
- package/src/orphan-dir-scan.d.ts +1 -1
- package/src/orphan-dir-scan.js +1 -1
- package/src/orphan-dir-scan.js.map +1 -1
- package/src/orphan-dir-sweep.js +1 -1
- package/src/orphan-dir-sweep.js.map +1 -1
- package/src/policy-tracking.js +5 -8
- package/src/policy-tracking.js.map +1 -1
- package/src/pr-gate-config.d.ts +1 -1
- package/src/pr-gate-config.js +1 -1
- package/src/pr-gate-config.js.map +1 -1
- package/src/repo-root.d.ts +7 -7
- package/src/repo-root.js +8 -8
- package/src/repo-root.js.map +1 -1
- package/src/repo-scratch-dirs.d.ts +3 -3
- package/src/repo-scratch-dirs.js +5 -5
- package/src/repo-scratch-dirs.js.map +1 -1
- package/src/review-json-data.js +2 -2
- package/src/review-json-data.js.map +1 -1
- package/src/review-json.js +1 -1
- package/src/review-json.js.map +1 -1
- package/src/reviewer-instructions.d.ts +1 -1
- package/src/reviewer-instructions.js +1 -1
- package/src/reviewer-instructions.js.map +1 -1
- package/src/stale-bin-sweep.js +1 -1
- package/src/stale-bin-sweep.js.map +1 -1
- package/src/subagent-provenance.d.ts +6 -6
- package/src/subagent-provenance.js +6 -6
- package/src/subagent-provenance.js.map +1 -1
- package/src/sync-flow-guidance.js +1 -1
- package/src/sync-flow-guidance.js.map +1 -1
- package/templates/webpieces.branch-state-matrix.md +2 -2
- package/templates/webpieces.buildlog.md +3 -3
- package/templates/webpieces.ci-gate-setup.md +2 -2
- package/templates/webpieces.git-workflow.md +8 -9
- package/templates/webpieces.location-matrix.md +10 -10
- package/templates/webpieces.review-checklists.md +3 -3
|
@@ -5,20 +5,20 @@ export declare class ExcludePaths {
|
|
|
5
5
|
/**
|
|
6
6
|
* webpieces' OWN state directory is NEVER governed, whatever `excludePaths` says.
|
|
7
7
|
*
|
|
8
|
-
* `.webpieces
|
|
8
|
+
* `.webpieces/` is gitignored in every consumer, so nothing under it can reach a branch, be reviewed,
|
|
9
9
|
* be reverted, or be lost to a checkout — every justification the branch-state guard prints about
|
|
10
10
|
* protecting `main` is vacuous there. Leaving that to config made the exemption OPTIONAL, and the
|
|
11
11
|
* tooling writes into the directory itself: `wp-review-upsert-pr` asks a reviewer subagent to write its
|
|
12
|
-
* verdict to `<primary>/.webpieces
|
|
12
|
+
* verdict to `<primary>/.webpieces/worktrees/agent-<id>/pr-review/<branch>/`, feature-branch-guard
|
|
13
13
|
* resolved that write to the PRIMARY clone and judged the primary's live branch — a tree the subagent
|
|
14
14
|
* is not standing in — so the reviewer was blocked with "You should not be working on main" whenever an
|
|
15
15
|
* unrelated session happened to leave the primary there. Hard-coding the skip makes that whole class
|
|
16
16
|
* unreachable, and fixes existing consumer repos the moment they upgrade the pin.
|
|
17
17
|
*
|
|
18
|
-
* THIS IS THE ONLY SPELLING. There is deliberately no companion `.webpieces
|
|
18
|
+
* THIS IS THE ONLY SPELLING. There is deliberately no companion `.webpieces/**` glob seeded into
|
|
19
19
|
* `excludePaths` — a config entry that changed nothing would be a second spelling of a decision that
|
|
20
|
-
* already has one, and a strictly WEAKER one at that: the repo's glob matcher compiles `.webpieces
|
|
21
|
-
* to an anchored regex whose `/` is literal, so it misses the bare directory `.webpieces
|
|
20
|
+
* already has one, and a strictly WEAKER one at that: the repo's glob matcher compiles `.webpieces/**`
|
|
21
|
+
* to an anchored regex whose `/` is literal, so it misses the bare directory `.webpieces` that this
|
|
22
22
|
* predicate matches. A consumer reading such a glob would also conclude the exemption is config-driven
|
|
23
23
|
* and therefore removable, which is exactly the belief this predicate exists to destroy.
|
|
24
24
|
*
|
|
@@ -27,20 +27,20 @@ exports.ExcludePaths = ExcludePaths;
|
|
|
27
27
|
/**
|
|
28
28
|
* webpieces' OWN state directory is NEVER governed, whatever `excludePaths` says.
|
|
29
29
|
*
|
|
30
|
-
* `.webpieces
|
|
30
|
+
* `.webpieces/` is gitignored in every consumer, so nothing under it can reach a branch, be reviewed,
|
|
31
31
|
* be reverted, or be lost to a checkout — every justification the branch-state guard prints about
|
|
32
32
|
* protecting `main` is vacuous there. Leaving that to config made the exemption OPTIONAL, and the
|
|
33
33
|
* tooling writes into the directory itself: `wp-review-upsert-pr` asks a reviewer subagent to write its
|
|
34
|
-
* verdict to `<primary>/.webpieces
|
|
34
|
+
* verdict to `<primary>/.webpieces/worktrees/agent-<id>/pr-review/<branch>/`, feature-branch-guard
|
|
35
35
|
* resolved that write to the PRIMARY clone and judged the primary's live branch — a tree the subagent
|
|
36
36
|
* is not standing in — so the reviewer was blocked with "You should not be working on main" whenever an
|
|
37
37
|
* unrelated session happened to leave the primary there. Hard-coding the skip makes that whole class
|
|
38
38
|
* unreachable, and fixes existing consumer repos the moment they upgrade the pin.
|
|
39
39
|
*
|
|
40
|
-
* THIS IS THE ONLY SPELLING. There is deliberately no companion `.webpieces
|
|
40
|
+
* THIS IS THE ONLY SPELLING. There is deliberately no companion `.webpieces/**` glob seeded into
|
|
41
41
|
* `excludePaths` — a config entry that changed nothing would be a second spelling of a decision that
|
|
42
|
-
* already has one, and a strictly WEAKER one at that: the repo's glob matcher compiles `.webpieces
|
|
43
|
-
* to an anchored regex whose `/` is literal, so it misses the bare directory `.webpieces
|
|
42
|
+
* already has one, and a strictly WEAKER one at that: the repo's glob matcher compiles `.webpieces/**`
|
|
43
|
+
* to an anchored regex whose `/` is literal, so it misses the bare directory `.webpieces` that this
|
|
44
44
|
* predicate matches. A consumer reading such a glob would also conclude the exemption is config-driven
|
|
45
45
|
* and therefore removable, which is exactly the belief this predicate exists to destroy.
|
|
46
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-hook-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-hook-paths.ts"],"names":[],"mappings":";;;AA6CA,kDAEC;AA/CD,8DAA8D;AAE9D,gGAAgG;AAChG,sGAAsG;AACtG,4EAA4E;AAC5E,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,qGAAqG;AACrG,gGAAgG;AAChG,mEAAmE;AACnE,EAAE;AACF,wGAAwG;AACxG,wGAAwG;AACxG,wGAAwG;AACxG,+FAA+F;AAC/F,MAAa,YAAY;IACA;IAArB,YAAqB,KAAe;QAAf,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;CAC3C;AAFD,oCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oKAAoK;AACpK,SAAgB,mBAAmB,CAAC,YAAoB;IACpD,OAAO,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,kCAAiB,CAAC;AAChF,CAAC","sourcesContent":["import { WEBPIECES_TMP_DIR } from '@webpieces/tooling-common';\n\n// Top-level `excludePaths` block from webpieces.config.json: ONE glob list that suppresses hook\n// enforcement for matching files (matched against the workspace-relative path). A path listed here is\n// hands-off for everything — code-style rules AND file-scoped guards alike.\n//\n// It used to be TWO independently-varying lists, `rules` and `guards`. The split never earned its\n// keep: every consumer set both to the same value, and the one case that would need them to differ\n// (exclude a generated tree from style rules but keep the git guards on it) is already served better\n// one level down, by a rule's OWN `excludePaths` inside its config block. A path is governed by\n// webpieces or it is not, so the top-level block is a single list.\n//\n// The object form `{ \"rules\": [...], \"guards\": [...] }` is RETIRED, not accepted — validateExcludePaths\n// rejects it with the union instruction. It was tolerated once, which is precisely why consumer configs\n// (this repo's included) stayed on it: an accepted shape is never migrated. See retired-config-keys.ts.\n// Data-only (per CLAUDE.md, classes for data). Built once by loadAndValidate after validation.\nexport class ExcludePaths {\n constructor(readonly paths: string[]) {}\n}\n\n/**\n * webpieces' OWN state directory is NEVER governed, whatever `excludePaths` says.\n *\n * `.webpieces
|
|
1
|
+
{"version":3,"file":"exclude-hook-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-hook-paths.ts"],"names":[],"mappings":";;;AA6CA,kDAEC;AA/CD,8DAA8D;AAE9D,gGAAgG;AAChG,sGAAsG;AACtG,4EAA4E;AAC5E,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,qGAAqG;AACrG,gGAAgG;AAChG,mEAAmE;AACnE,EAAE;AACF,wGAAwG;AACxG,wGAAwG;AACxG,wGAAwG;AACxG,+FAA+F;AAC/F,MAAa,YAAY;IACA;IAArB,YAAqB,KAAe;QAAf,UAAK,GAAL,KAAK,CAAU;IAAG,CAAC;CAC3C;AAFD,oCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oKAAoK;AACpK,SAAgB,mBAAmB,CAAC,YAAoB;IACpD,OAAO,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,kCAAiB,CAAC;AAChF,CAAC","sourcesContent":["import { WEBPIECES_TMP_DIR } from '@webpieces/tooling-common';\n\n// Top-level `excludePaths` block from webpieces.config.json: ONE glob list that suppresses hook\n// enforcement for matching files (matched against the workspace-relative path). A path listed here is\n// hands-off for everything — code-style rules AND file-scoped guards alike.\n//\n// It used to be TWO independently-varying lists, `rules` and `guards`. The split never earned its\n// keep: every consumer set both to the same value, and the one case that would need them to differ\n// (exclude a generated tree from style rules but keep the git guards on it) is already served better\n// one level down, by a rule's OWN `excludePaths` inside its config block. A path is governed by\n// webpieces or it is not, so the top-level block is a single list.\n//\n// The object form `{ \"rules\": [...], \"guards\": [...] }` is RETIRED, not accepted — validateExcludePaths\n// rejects it with the union instruction. It was tolerated once, which is precisely why consumer configs\n// (this repo's included) stayed on it: an accepted shape is never migrated. See retired-config-keys.ts.\n// Data-only (per CLAUDE.md, classes for data). Built once by loadAndValidate after validation.\nexport class ExcludePaths {\n constructor(readonly paths: string[]) {}\n}\n\n/**\n * webpieces' OWN state directory is NEVER governed, whatever `excludePaths` says.\n *\n * `.webpieces/` is gitignored in every consumer, so nothing under it can reach a branch, be reviewed,\n * be reverted, or be lost to a checkout — every justification the branch-state guard prints about\n * protecting `main` is vacuous there. Leaving that to config made the exemption OPTIONAL, and the\n * tooling writes into the directory itself: `wp-review-upsert-pr` asks a reviewer subagent to write its\n * verdict to `<primary>/.webpieces/worktrees/agent-<id>/pr-review/<branch>/`, feature-branch-guard\n * resolved that write to the PRIMARY clone and judged the primary's live branch — a tree the subagent\n * is not standing in — so the reviewer was blocked with \"You should not be working on main\" whenever an\n * unrelated session happened to leave the primary there. Hard-coding the skip makes that whole class\n * unreachable, and fixes existing consumer repos the moment they upgrade the pin.\n *\n * THIS IS THE ONLY SPELLING. There is deliberately no companion `.webpieces/**` glob seeded into\n * `excludePaths` — a config entry that changed nothing would be a second spelling of a decision that\n * already has one, and a strictly WEAKER one at that: the repo's glob matcher compiles `.webpieces/**`\n * to an anchored regex whose `/` is literal, so it misses the bare directory `.webpieces` that this\n * predicate matches. A consumer reading such a glob would also conclude the exemption is config-driven\n * and therefore removable, which is exactly the belief this predicate exists to destroy.\n *\n * FIRST SEGMENT ONLY, deliberately: this is the tooling's own directory at the workspace root, not any\n * path that merely contains the name. A `relativePath` that escapes the workspace ('../x'), or that is\n * '' (the Bash path with no `cd`), has a first segment of '..'/'' and does not match.\n */\n// webpieces-disable no-function-outside-class -- leaf predicate over one path string, beside the constant it tests; a class here would be a namespace with no state\nexport function isWebpiecesStateDir(relativePath: string): boolean {\n return relativePath.replace(/\\\\/g, '/').split('/')[0] === WEBPIECES_TMP_DIR;\n}\n"]}
|
package/src/exclude-paths.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare function isPathExcluded(relPath: string, excludePaths: readonly s
|
|
|
32
32
|
* DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`
|
|
33
33
|
* from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match
|
|
34
34
|
* `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`
|
|
35
|
-
* and `.webpieces
|
|
35
|
+
* and `.webpieces/` are ordinary, frequently-changed directories here, and a pattern author writing
|
|
36
36
|
* `**` means all of it. Shell-style dot-hiding protects against globbing up `.` and `..`, which is not a
|
|
37
37
|
* hazard any caller here has.
|
|
38
38
|
*
|
package/src/exclude-paths.js
CHANGED
|
@@ -51,7 +51,7 @@ function isPathExcluded(relPath, excludePaths) {
|
|
|
51
51
|
* DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`
|
|
52
52
|
* from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match
|
|
53
53
|
* `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`
|
|
54
|
-
* and `.webpieces
|
|
54
|
+
* and `.webpieces/` are ordinary, frequently-changed directories here, and a pattern author writing
|
|
55
55
|
* `**` means all of it. Shell-style dot-hiding protects against globbing up `.` and `..`, which is not a
|
|
56
56
|
* hazard any caller here has.
|
|
57
57
|
*
|
package/src/exclude-paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-paths.ts"],"names":[],"mappings":";;AAsBA,wCASC;AA6BD,wCAOC;AAnED,iGAAiG;AACjG,iGAAiG;AACjG,2DAAgD;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe,EAAE,YAA+B;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,sGAAsG;AACtG,SAAgB,cAAc,CAAC,OAAe,EAAE,QAA2B;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACzD,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["// Interop-resolved (issue #747) — NEVER `import { minimatch } from 'minimatch'` here; that named\n// export does not exist on minimatch v3, which is what a hoisted-linker consumer can resolve to.\nimport { minimatch } from './minimatch-interop';\n\n/**\n * Holistic exclusion check shared by validate-ts-in-src (Layer 1 + Layer 2)\n * and the file-location AI-hook rule, so the two implementations can never\n * drift apart again.\n *\n * `relPath` is a workspace-relative path (e.g.\n * \"libraries/foo/codegen.ts\"). An entry in `excludePaths` matches when ANY\n * of the following hold:\n *\n * 1. Bare directory/segment name appearing anywhere in the path. This is\n * the historical behavior and keeps entries like \"node_modules\",\n * \"dist\", \"scripts\", \"architecture\" working at any depth.\n * 2. A glob matched against the full relative path, e.g. \"**\\/*.d.ts\" or\n * \"**\\/codegen.ts\".\n * 3. A directory-prefix glob, e.g. \"libraries/apis\" -> \"libraries/apis/**\".\n *\n * Paths are normalized to forward slashes so Windows backslashes match too.\n */\nexport function isPathExcluded(relPath: string, excludePaths: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n const segments = norm.split('/');\n for (const pattern of excludePaths) {\n if (segments.includes(pattern)) return true;\n if (minimatch(norm, pattern)) return true;\n if (minimatch(norm, `${pattern}/**`)) return true;\n }\n return false;\n}\n\n/**\n * Does `relPath` match any of `patterns`, as a glob or as a directory prefix?\n *\n * The strict sibling of {@link isPathExcluded}: it drops rule 1 (bare segment name matching anywhere\n * in the path), which is right for an opt-out exclusion list but wrong for anything that CLASSIFIES\n * a path — a pattern like \"external\" would otherwise claim every path containing that segment at any\n * depth. Used for config lists that positively identify a set of projects (e.g.\n * `runtime-architecture.externalApiPaths`).\n *\n * Paths are normalized to forward slashes so Windows backslashes match too. Empty `patterns` matches\n * nothing, so an unconfigured list is inert rather than universal.\n *\n * DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`\n * from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match\n * `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`\n * and `.webpieces
|
|
1
|
+
{"version":3,"file":"exclude-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-paths.ts"],"names":[],"mappings":";;AAsBA,wCASC;AA6BD,wCAOC;AAnED,iGAAiG;AACjG,iGAAiG;AACjG,2DAAgD;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe,EAAE,YAA+B;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,sGAAsG;AACtG,SAAgB,cAAc,CAAC,OAAe,EAAE,QAA2B;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACzD,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["// Interop-resolved (issue #747) — NEVER `import { minimatch } from 'minimatch'` here; that named\n// export does not exist on minimatch v3, which is what a hoisted-linker consumer can resolve to.\nimport { minimatch } from './minimatch-interop';\n\n/**\n * Holistic exclusion check shared by validate-ts-in-src (Layer 1 + Layer 2)\n * and the file-location AI-hook rule, so the two implementations can never\n * drift apart again.\n *\n * `relPath` is a workspace-relative path (e.g.\n * \"libraries/foo/codegen.ts\"). An entry in `excludePaths` matches when ANY\n * of the following hold:\n *\n * 1. Bare directory/segment name appearing anywhere in the path. This is\n * the historical behavior and keeps entries like \"node_modules\",\n * \"dist\", \"scripts\", \"architecture\" working at any depth.\n * 2. A glob matched against the full relative path, e.g. \"**\\/*.d.ts\" or\n * \"**\\/codegen.ts\".\n * 3. A directory-prefix glob, e.g. \"libraries/apis\" -> \"libraries/apis/**\".\n *\n * Paths are normalized to forward slashes so Windows backslashes match too.\n */\nexport function isPathExcluded(relPath: string, excludePaths: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n const segments = norm.split('/');\n for (const pattern of excludePaths) {\n if (segments.includes(pattern)) return true;\n if (minimatch(norm, pattern)) return true;\n if (minimatch(norm, `${pattern}/**`)) return true;\n }\n return false;\n}\n\n/**\n * Does `relPath` match any of `patterns`, as a glob or as a directory prefix?\n *\n * The strict sibling of {@link isPathExcluded}: it drops rule 1 (bare segment name matching anywhere\n * in the path), which is right for an opt-out exclusion list but wrong for anything that CLASSIFIES\n * a path — a pattern like \"external\" would otherwise claim every path containing that segment at any\n * depth. Used for config lists that positively identify a set of projects (e.g.\n * `runtime-architecture.externalApiPaths`).\n *\n * Paths are normalized to forward slashes so Windows backslashes match too. Empty `patterns` matches\n * nothing, so an unconfigured list is inert rather than universal.\n *\n * DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`\n * from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match\n * `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`\n * and `.webpieces/` are ordinary, frequently-changed directories here, and a pattern author writing\n * `**` means all of it. Shell-style dot-hiding protects against globbing up `.` and `..`, which is not a\n * hazard any caller here has.\n *\n * The three consumers are named here on purpose, because the widening is silent for them:\n * `build-artifact-gate` (stale generated artifacts), `api-scanner.externalApiPaths` (project\n * classification) and `no-custom-css-scope.allowGlobs` (an EXEMPTION list, so wider = more exempt).\n * None configures a dot-path today, and for all three \"the pattern author meant the whole subtree\" is\n * the reading they already assume — but a future dot-path entry now matches where it silently did not,\n * and that is a deliberate decision recorded here rather than an accident.\n */\n// webpieces-disable no-function-outside-class -- pure path predicate, sibling of isPathExcluded above\nexport function matchesAnyGlob(relPath: string, patterns: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n for (const pattern of patterns) {\n if (minimatch(norm, pattern, { dot: true })) return true;\n if (minimatch(norm, `${pattern}/**`, { dot: true })) return true;\n }\n return false;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-fault-codes.js","sourceRoot":"","sources":["../../../../../packages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,sBAAsB;IAC7C,CAAC,+BAAuB,CAAC,EAAE,gBAAgB;IAC3C,CAAC,mCAA2B,CAAC,EAAE,oBAAoB;CACtD,CAAC;AAEF;;;;GAIG;AACU,QAAA,QAAQ,GAAG,IAAI,CAAC;AAE7B;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAEtC,0GAA0G;AAC7F,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAEtC,oGAAoG;AACvF,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC;;;;;;;GAOG;AACH,0KAA0K;AAC1K,SAAgB,aAAa,CAAC,KAAkB,EAAE,MAAc;IAC5D,OAAO,IAAI,sBAAc,CAAC,KAAK,CAAC,YAAY,gBAAQ,UAAU,KAAK,QAAQ,sBAAc,KAAK,MAAM,GAAG,CAAC;AAC5G,CAAC;AAED;;;GAGG;AACH,wGAAwG;AACxG,SAAgB,gBAAgB,CAAC,KAAkB;IAC/C,OAAO,cAAc,sBAAc,WAAW,KAAK,0GAA0G,gBAAQ,QAAQ,sBAAc,UAAU,KAAK,sDAAsD,CAAC;AACrQ,CAAC","sourcesContent":["// ---------------------------------------------------------------------------\n// THE L0 FAULT CODEBOOK — one letter per fault, declared HERE and nowhere else.\n//\n// Both halves of L0 stamp `fault=<code>` onto their audit lines: the POSIX `sh` shim writes D/X/U/K\n// (shim-audit-log.ts), and the guard bin writes S/C/Y in JS (decision-log.ts, via runner.ts and\n// hook-core.ts). The whole value of that field is that ONE grep — `grep 'fault=S'` — spans the entire\n// trail, and that the faults actually observed can be diffed against `L0_FAULTS`. Both properties hold\n// only while every emitter spells the letters the SAME way, and a hand-retyped 'S' in one emitter is\n// exactly the drift this module exists to make impossible.\n//\n// It used to be retyped: the shim assigned `WP_FAULT=X` as a literal, SHIM_LOG_FAULTS listed the four\n// sh-side letters again, and L0_FAULTS listed all seven a third time. Three spellings of one\n// vocabulary, held together by a unit test that could only notice AFTER they diverged.\n//\n// This module is a LEAF — no imports at all — on purpose. `l0-matrix.ts` (core) builds `L0_FAULTS`\n// from these constants and `shim-audit-log.ts` / `shim.ts` (bin) render them into the shim; parking the\n// constants in either of those two would make the other one a core↔bin import cycle. It also keeps the\n// shim renderer dependency-light, which it must be: it has to work on a tree too broken to load the\n// rule engine.\n// ---------------------------------------------------------------------------\n\n/** `D` — version drift: the root package.json pin != the installed version. Decided in `sh`. */\nexport const L0_FAULT_DRIFT = 'D';\n\n/** `X` — the guard bin is missing (fresh clone, new worktree, package removed). Decided in `sh`. */\nexport const L0_FAULT_BIN_MISSING = 'X';\n\n/** `U` — the bin is missing AND nothing declares the package, so an install is a no-op. `sh`. */\nexport const L0_FAULT_UNDECLARED = 'U';\n\n/** `K` — the bin is present but CRASHED (corrupt node_modules). Decided in `sh`. */\nexport const L0_FAULT_BIN_BROKEN = 'K';\n\n/** `S` — the committed `.claude/webpieces/ai-hook.sh` != `renderShim()`. Decided in the bin, in JS. */\nexport const L0_FAULT_SHIM_STALE = 'S';\n\n/** `C` — `webpieces.config.json` is missing. Decided in the bin, in JS. */\nexport const L0_FAULT_CONFIG_MISSING = 'C';\n\n/** `Y` — a loaded rule has no `webpieces.config.json` key. Decided in the bin, in JS. */\nexport const L0_FAULT_CONFIG_OUT_OF_SYNC = 'Y';\n\n/**\n * No fault AT THIS LAYER — the value every audit line carries when nothing fired.\n *\n * Never a claim that nothing was wrong: a `fault=-` line from the `sh` shim only says the sh half found\n * nothing, and the bin it then exec'd may still have blocked on S/C/Y and stamped its own line.\n */\nexport const L0_FAULT_NONE = '-';\n\n/**\n * The faults decided in POSIX `sh`, BEFORE the bin runs — a stale, missing or broken validator cannot\n * be trusted to validate itself. In first-match-wins order.\n */\nexport const L0_SH_FAULT_CODES = [\n L0_FAULT_DRIFT, L0_FAULT_BIN_MISSING, L0_FAULT_UNDECLARED, L0_FAULT_BIN_BROKEN,\n] as const;\n\n/**\n * The faults decided INSIDE the guard bin, in JS. These reached the audit trail with no fault label at\n * all until the JS emitters started stamping them: an `S` storm that blocked an agent for ~20 tool\n * calls left two lines in the `rejections/` stream, both attributed to a downstream rule, and nothing\n * anywhere identifying L0.\n */\nexport const L0_JS_FAULT_CODES = [\n L0_FAULT_SHIM_STALE, L0_FAULT_CONFIG_MISSING, L0_FAULT_CONFIG_OUT_OF_SYNC,\n] as const;\n\n// ---------------------------------------------------------------------------\n// THE JOIN KEYS — the three artifacts that describe one L0 event, and the coordinates that line them up.\n//\n// There are three, and until now they could not be grepped together:\n// 1. THE DENY the agent reads in the moment (shim-deny-reason.ts for S; DENY_REASON_SH for D/X/U/K)\n// 2. THE AUDIT LINE (`.webpieces-logs/logs/**`), which carries `layer=` `row=` `fault=`\n// 3. THE MATRIX DOC (webpieces.guard-matrix.md, rendered from L0_FAULTS + L0_ALLOWLIST)\n//\n// The deny had NONE of them: no fault letter, no row, and — the highest-value omission — no guard NAME,\n// while every L1/L2 deny opens `[<rule-name>] (N violations)`. So a transcript could not be debugged\n// against the log after the fact, and a reader could not find the matrix row by eye.\n//\n// These constants are that vocabulary, declared HERE for the same reason the letters are: this module is\n// a LEAF with no imports, so `core/l0-matrix.ts` (the doc), `bin/shim*.ts` (the denies) and\n// `core/decision-log.ts` (the log) can all reach it without an import cycle. Retyping a name in any one\n// of them is the drift this file exists to make impossible.\n// ---------------------------------------------------------------------------\n\n/**\n * EVERY L0 fault code, as a type. The two arrays above are the halves; this is their union, and it is\n * what makes `L0_FAULT_NAMES` TOTAL — a `Record<string, …>` would have forced a `?? 'unknown'` fallback\n * at every read, which is shim shape #4 (a runtime default standing in for a type that could have\n * expressed the invariant). With the union, a new fault added without a name is a COMPILE error, and\n * neither reader needs a defensive branch.\n */\nexport type L0FaultCode = typeof L0_SH_FAULT_CODES[number] | typeof L0_JS_FAULT_CODES[number];\n\n/**\n * The stable, human-readable GUARD NAME per fault code — what goes in the deny's `[…]` header, in the\n * matrix doc's own `guard` column, and nowhere else in a second spelling.\n *\n * L1 prints `[stale-main-bash-guard] (1 violation)` and L0 printed nothing comparable; the names below\n * are deliberately in that same kebab shape so the two layers read as one system. They are IDENTITY, not\n * prose: renaming one silently breaks a grep that spans all three artifacts, exactly as renumbering an\n * L1 row would (see L1_ROWS' header).\n */\nexport const L0_FAULT_NAMES: Readonly<Record<L0FaultCode, string>> = {\n [L0_FAULT_DRIFT]: 'version-drift',\n [L0_FAULT_BIN_MISSING]: 'guard-bin-missing',\n [L0_FAULT_UNDECLARED]: 'guard-pkg-undeclared',\n [L0_FAULT_BIN_BROKEN]: 'guard-bin-crashed',\n [L0_FAULT_SHIM_STALE]: 'managed-hook-surface',\n [L0_FAULT_CONFIG_MISSING]: 'config-missing',\n [L0_FAULT_CONFIG_OUT_OF_SYNC]: 'config-out-of-sync',\n};\n\n/**\n * The LAYER token — the other half of every join key, spelled once. The deny header, the matrix\n * citation, the sh audit line and guards/L0-tooling.md all read it from here, so `grep layer=L0` cannot\n * miss an artifact that typed the token itself.\n */\nexport const L0_LAYER = 'L0';\n\n/**\n * The three rows of L0's decision matrix, by number — the numbers `renderGuardMatrixDoc` prints, the\n * numbers the audit line's `row=` carries, and the numbers a deny cites. L0's matrix has no genuine\n * second dimension: every branch reduces to `fault present?` x `on the allowlist?`.\n *\n * All three are named because all three are LOGGED: the sh half writes a line for the healthy hand-down\n * too (`PASS-BIN-ALLOW`), which is the line that tells \"the guard ran and found nothing\" apart from\n * \"the guard never ran\".\n */\nexport const L0_ROW_HANDED_DOWN = '1';\n\n/** Row 2: a fault is present but the call is on the L0 allowlist — a cure, a Read, or the config edit. */\nexport const L0_ROW_ALLOWLISTED = '2';\n\n/** Row 3: a fault is present and the call is NOT on the allowlist. The one row that ever BLOCKS. */\nexport const L0_ROW_BLOCKED = '3';\n\n/**\n * The `[guard-name] (layer=L0 fault=<code> row=<n>)` header every L0 deny opens with, after the ❌ line.\n *\n * ONE builder, called by the JS denies directly and interpolated into the POSIX-sh denies at render\n * time by renderShim() — so the sh half cannot spell the coordinates differently from the JS half even\n * though it cannot import anything at runtime. `detail` is the per-fault count that mirrors\n * formatReport's `(N violations)`.\n */\n// webpieces-disable no-function-outside-class -- pure string builder over this leaf module's own constants; it must stay importable by the dependency-free shim renderer.\nexport function l0GuardHeader(fault: L0FaultCode, detail: string): string {\n return `[${L0_FAULT_NAMES[fault]}] (layer=${L0_LAYER} fault=${fault} row=${L0_ROW_BLOCKED}, ${detail})`;\n}\n\n/**\n * The one-line citation of WHICH matrix row was taken and on what dimension values — L1's pattern\n * (its deny cites \"`w` / `n` / `n` - row 8\"), in L0's own two columns.\n */\n// webpieces-disable no-function-outside-class -- sibling of l0GuardHeader in this leaf codebook module.\nexport function l0MatrixCitation(fault: L0FaultCode): string {\n return `matrix row ${L0_ROW_BLOCKED}: fault=${fault} present / on the allowlist? no -> BLOCK. Those are the same coordinates the audit line carries (layer=${L0_LAYER} row=${L0_ROW_BLOCKED} fault=${fault}) and the same row webpieces.guard-matrix.md prints.`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hook-fault-codes.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/hook-fault-codes.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,EAAE;AACF,oGAAoG;AACpG,gGAAgG;AAChG,sGAAsG;AACtG,uGAAuG;AACvG,qGAAqG;AACrG,2DAA2D;AAC3D,EAAE;AACF,sGAAsG;AACtG,6FAA6F;AAC7F,uFAAuF;AACvF,EAAE;AACF,mGAAmG;AACnG,wGAAwG;AACxG,uGAAuG;AACvG,oGAAoG;AACpG,eAAe;AACf,8EAA8E;;;AAgI9E,sCAEC;AAOD,4CAEC;AAzID,gGAAgG;AACnF,QAAA,cAAc,GAAG,GAAG,CAAC;AAElC,oGAAoG;AACvF,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAExC,iGAAiG;AACpF,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC,oFAAoF;AACvE,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC,uGAAuG;AAC1F,QAAA,mBAAmB,GAAG,GAAG,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WAAW,KAAK,0GAA0G,gBAAQ,QAAQ,sBAAc,UAAU,KAAK,sDAAsD,CAAC;AACrQ,CAAC","sourcesContent":["// ---------------------------------------------------------------------------\n// THE L0 FAULT CODEBOOK — one letter per fault, declared HERE and nowhere else.\n//\n// Both halves of L0 stamp `fault=<code>` onto their audit lines: the POSIX `sh` shim writes D/X/U/K\n// (shim-audit-log.ts), and the guard bin writes S/C/Y in JS (decision-log.ts, via runner.ts and\n// hook-core.ts). The whole value of that field is that ONE grep — `grep 'fault=S'` — spans the entire\n// trail, and that the faults actually observed can be diffed against `L0_FAULTS`. Both properties hold\n// only while every emitter spells the letters the SAME way, and a hand-retyped 'S' in one emitter is\n// exactly the drift this module exists to make impossible.\n//\n// It used to be retyped: the shim assigned `WP_FAULT=X` as a literal, SHIM_LOG_FAULTS listed the four\n// sh-side letters again, and L0_FAULTS listed all seven a third time. Three spellings of one\n// vocabulary, held together by a unit test that could only notice AFTER they diverged.\n//\n// This module is a LEAF — no imports at all — on purpose. `l0-matrix.ts` (core) builds `L0_FAULTS`\n// from these constants and `shim-audit-log.ts` / `shim.ts` (bin) render them into the shim; parking the\n// constants in either of those two would make the other one a core↔bin import cycle. It also keeps the\n// shim renderer dependency-light, which it must be: it has to work on a tree too broken to load the\n// rule engine.\n// ---------------------------------------------------------------------------\n\n/** `D` — version drift: the root package.json pin != the installed version. Decided in `sh`. */\nexport const L0_FAULT_DRIFT = 'D';\n\n/** `X` — the guard bin is missing (fresh clone, new worktree, package removed). Decided in `sh`. */\nexport const L0_FAULT_BIN_MISSING = 'X';\n\n/** `U` — the bin is missing AND nothing declares the package, so an install is a no-op. `sh`. */\nexport const L0_FAULT_UNDECLARED = 'U';\n\n/** `K` — the bin is present but CRASHED (corrupt node_modules). Decided in `sh`. */\nexport const L0_FAULT_BIN_BROKEN = 'K';\n\n/** `S` — the committed `.claude/webpieces/ai-hook.sh` != `renderShim()`. Decided in the bin, in JS. */\nexport const L0_FAULT_SHIM_STALE = 'S';\n\n/** `C` — `webpieces.config.json` is missing. Decided in the bin, in JS. */\nexport const L0_FAULT_CONFIG_MISSING = 'C';\n\n/** `Y` — a loaded rule has no `webpieces.config.json` key. Decided in the bin, in JS. */\nexport const L0_FAULT_CONFIG_OUT_OF_SYNC = 'Y';\n\n/**\n * No fault AT THIS LAYER — the value every audit line carries when nothing fired.\n *\n * Never a claim that nothing was wrong: a `fault=-` line from the `sh` shim only says the sh half found\n * nothing, and the bin it then exec'd may still have blocked on S/C/Y and stamped its own line.\n */\nexport const L0_FAULT_NONE = '-';\n\n/**\n * The faults decided in POSIX `sh`, BEFORE the bin runs — a stale, missing or broken validator cannot\n * be trusted to validate itself. In first-match-wins order.\n */\nexport const L0_SH_FAULT_CODES = [\n L0_FAULT_DRIFT, L0_FAULT_BIN_MISSING, L0_FAULT_UNDECLARED, L0_FAULT_BIN_BROKEN,\n] as const;\n\n/**\n * The faults decided INSIDE the guard bin, in JS. These reached the audit trail with no fault label at\n * all until the JS emitters started stamping them: an `S` storm that blocked an agent for ~20 tool\n * calls left two lines in the `rejections/` stream, both attributed to a downstream rule, and nothing\n * anywhere identifying L0.\n */\nexport const L0_JS_FAULT_CODES = [\n L0_FAULT_SHIM_STALE, L0_FAULT_CONFIG_MISSING, L0_FAULT_CONFIG_OUT_OF_SYNC,\n] as const;\n\n// ---------------------------------------------------------------------------\n// THE JOIN KEYS — the three artifacts that describe one L0 event, and the coordinates that line them up.\n//\n// There are three, and until now they could not be grepped together:\n// 1. THE DENY the agent reads in the moment (shim-deny-reason.ts for S; DENY_REASON_SH for D/X/U/K)\n// 2. THE AUDIT LINE (`.webpieces/logs/**`), which carries `layer=` `row=` `fault=`\n// 3. THE MATRIX DOC (webpieces.guard-matrix.md, rendered from L0_FAULTS + L0_ALLOWLIST)\n//\n// The deny had NONE of them: no fault letter, no row, and — the highest-value omission — no guard NAME,\n// while every L1/L2 deny opens `[<rule-name>] (N violations)`. So a transcript could not be debugged\n// against the log after the fact, and a reader could not find the matrix row by eye.\n//\n// These constants are that vocabulary, declared HERE for the same reason the letters are: this module is\n// a LEAF with no imports, so `core/l0-matrix.ts` (the doc), `bin/shim*.ts` (the denies) and\n// `core/decision-log.ts` (the log) can all reach it without an import cycle. Retyping a name in any one\n// of them is the drift this file exists to make impossible.\n// ---------------------------------------------------------------------------\n\n/**\n * EVERY L0 fault code, as a type. The two arrays above are the halves; this is their union, and it is\n * what makes `L0_FAULT_NAMES` TOTAL — a `Record<string, …>` would have forced a `?? 'unknown'` fallback\n * at every read, which is shim shape #4 (a runtime default standing in for a type that could have\n * expressed the invariant). With the union, a new fault added without a name is a COMPILE error, and\n * neither reader needs a defensive branch.\n */\nexport type L0FaultCode = typeof L0_SH_FAULT_CODES[number] | typeof L0_JS_FAULT_CODES[number];\n\n/**\n * The stable, human-readable GUARD NAME per fault code — what goes in the deny's `[…]` header, in the\n * matrix doc's own `guard` column, and nowhere else in a second spelling.\n *\n * L1 prints `[stale-main-bash-guard] (1 violation)` and L0 printed nothing comparable; the names below\n * are deliberately in that same kebab shape so the two layers read as one system. They are IDENTITY, not\n * prose: renaming one silently breaks a grep that spans all three artifacts, exactly as renumbering an\n * L1 row would (see L1_ROWS' header).\n */\nexport const L0_FAULT_NAMES: Readonly<Record<L0FaultCode, string>> = {\n [L0_FAULT_DRIFT]: 'version-drift',\n [L0_FAULT_BIN_MISSING]: 'guard-bin-missing',\n [L0_FAULT_UNDECLARED]: 'guard-pkg-undeclared',\n [L0_FAULT_BIN_BROKEN]: 'guard-bin-crashed',\n [L0_FAULT_SHIM_STALE]: 'managed-hook-surface',\n [L0_FAULT_CONFIG_MISSING]: 'config-missing',\n [L0_FAULT_CONFIG_OUT_OF_SYNC]: 'config-out-of-sync',\n};\n\n/**\n * The LAYER token — the other half of every join key, spelled once. The deny header, the matrix\n * citation, the sh audit line and guards/L0-tooling.md all read it from here, so `grep layer=L0` cannot\n * miss an artifact that typed the token itself.\n */\nexport const L0_LAYER = 'L0';\n\n/**\n * The three rows of L0's decision matrix, by number — the numbers `renderGuardMatrixDoc` prints, the\n * numbers the audit line's `row=` carries, and the numbers a deny cites. L0's matrix has no genuine\n * second dimension: every branch reduces to `fault present?` x `on the allowlist?`.\n *\n * All three are named because all three are LOGGED: the sh half writes a line for the healthy hand-down\n * too (`PASS-BIN-ALLOW`), which is the line that tells \"the guard ran and found nothing\" apart from\n * \"the guard never ran\".\n */\nexport const L0_ROW_HANDED_DOWN = '1';\n\n/** Row 2: a fault is present but the call is on the L0 allowlist — a cure, a Read, or the config edit. */\nexport const L0_ROW_ALLOWLISTED = '2';\n\n/** Row 3: a fault is present and the call is NOT on the allowlist. The one row that ever BLOCKS. */\nexport const L0_ROW_BLOCKED = '3';\n\n/**\n * The `[guard-name] (layer=L0 fault=<code> row=<n>)` header every L0 deny opens with, after the ❌ line.\n *\n * ONE builder, called by the JS denies directly and interpolated into the POSIX-sh denies at render\n * time by renderShim() — so the sh half cannot spell the coordinates differently from the JS half even\n * though it cannot import anything at runtime. `detail` is the per-fault count that mirrors\n * formatReport's `(N violations)`.\n */\n// webpieces-disable no-function-outside-class -- pure string builder over this leaf module's own constants; it must stay importable by the dependency-free shim renderer.\nexport function l0GuardHeader(fault: L0FaultCode, detail: string): string {\n return `[${L0_FAULT_NAMES[fault]}] (layer=${L0_LAYER} fault=${fault} row=${L0_ROW_BLOCKED}, ${detail})`;\n}\n\n/**\n * The one-line citation of WHICH matrix row was taken and on what dimension values — L1's pattern\n * (its deny cites \"`w` / `n` / `n` - row 8\"), in L0's own two columns.\n */\n// webpieces-disable no-function-outside-class -- sibling of l0GuardHeader in this leaf codebook module.\nexport function l0MatrixCitation(fault: L0FaultCode): string {\n return `matrix row ${L0_ROW_BLOCKED}: fault=${fault} present / on the allowlist? no -> BLOCK. Those are the same coordinates the audit line carries (layer=${L0_LAYER} row=${L0_ROW_BLOCKED} fault=${fault}) and the same row webpieces.guard-matrix.md prints.`;\n}\n"]}
|
package/src/index.js
CHANGED
|
@@ -55,12 +55,12 @@ var repo_root_1 = require("./repo-root");
|
|
|
55
55
|
Object.defineProperty(exports, "RepoRootFinder", { enumerable: true, get: function () { return repo_root_1.RepoRootFinder; } });
|
|
56
56
|
Object.defineProperty(exports, "INSTRUCT_AI_DIR", { enumerable: true, get: function () { return repo_root_1.INSTRUCT_AI_DIR; } });
|
|
57
57
|
Object.defineProperty(exports, "INSTRUCT_AI_LEAF", { enumerable: true, get: function () { return repo_root_1.INSTRUCT_AI_LEAF; } });
|
|
58
|
-
// The scoped `.webpieces
|
|
58
|
+
// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two
|
|
59
59
|
// named methods so the call site declares whether the state is repo-wide or worktree-private.
|
|
60
60
|
// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the
|
|
61
61
|
// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the
|
|
62
|
-
// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces
|
|
63
|
-
// webpieces tool writes is `{repo}/.webpieces
|
|
62
|
+
// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a
|
|
63
|
+
// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See
|
|
64
64
|
// `decisions/0005-the-pr-description-is-the-merge-body.md`.
|
|
65
65
|
var aged_tree_sweep_1 = require("./aged-tree-sweep");
|
|
66
66
|
Object.defineProperty(exports, "AgedTreeSweeper", { enumerable: true, get: function () { return aged_tree_sweep_1.AgedTreeSweeper; } });
|
|
@@ -179,11 +179,11 @@ Object.defineProperty(exports, "HOME_KEY_DOC", { enumerable: true, get: function
|
|
|
179
179
|
Object.defineProperty(exports, "HOME_KEY_AI_DOC", { enumerable: true, get: function () { return home_config_1.HOME_KEY_AI_DOC; } });
|
|
180
180
|
Object.defineProperty(exports, "DOCUMENTATION_KEYS", { enumerable: true, get: function () { return home_config_1.DOCUMENTATION_KEYS; } });
|
|
181
181
|
// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from
|
|
182
|
-
// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces
|
|
182
|
+
// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the
|
|
183
183
|
// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that "how
|
|
184
184
|
// many builds are burning this box's CPU" is a fact about the MACHINE, is not a cache of anything a
|
|
185
185
|
// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own
|
|
186
|
-
// `.webpieces
|
|
186
|
+
// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.
|
|
187
187
|
var builds_log_1 = require("./builds-log");
|
|
188
188
|
Object.defineProperty(exports, "BuildsLog", { enumerable: true, get: function () { return builds_log_1.BuildsLog; } });
|
|
189
189
|
Object.defineProperty(exports, "BuildTicket", { enumerable: true, get: function () { return builds_log_1.BuildTicket; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAE3C,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAuG;AACvG,sFAAsF;AACtF,2CAAwD;AAA/C,oGAAA,MAAM,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACjC,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAAiF;AAAxE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AAC5D,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAEhB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AA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B,2HAAA,oBAAoB,OAAA;AACpB,qHAAA,cAAc,OAAA;AACd,wHAAA,iBAAiB,OAAA;AAErB,+DAKgC;AAJ5B,0HAAA,kBAAkB,OAAA;AAClB,+HAAA,uBAAuB,OAAA;AACvB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AAG5B,uDAA8F;AAArF,kHAAA,cAAc,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\n\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces-logs` resolver. EVERY reader/writer of `.webpieces-logs/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\n\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces-logs` path a\n// webpieces tool writes is `{repo}/.webpieces-logs`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\n// The machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.allowedPaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces-logs` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces-logs/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync, RulePackSyncOptions } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n RulePackArtifacts,\n RuleArtifactContents,\n RULE_LOCK_FILE,\n RULE_CATALOG_FILE,\n} from './rule-pack-artifacts';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAE3C,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAuG;AACvG,sFAAsF;AACtF,2CAAw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vB,yDAK6B;AAJzB,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,oHAAA,eAAe,OAAA;AAEnB,mDAAqE;AAA5D,8GAAA,YAAY,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAC1C,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,6DAK+B;AAJ3B,wHAAA,iBAAiB,OAAA;AACjB,2HAAA,oBAAoB,OAAA;AACpB,qHAAA,cAAc,OAAA;AACd,wHAAA,iBAAiB,OAAA;AAErB,+DAKgC;AAJ5B,0HAAA,kBAAkB,OAAA;AAClB,+HAAA,uBAAuB,OAAA;AACvB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AAG5B,uDAA8F;AAArF,kHAAA,cAAc,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\n\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\n\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a\n// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\n// The machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.allowedPaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync, RulePackSyncOptions } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n RulePackArtifacts,\n RuleArtifactContents,\n RULE_LOCK_FILE,\n RULE_CATALOG_FILE,\n} from './rule-pack-artifacts';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\n"]}
|
|
@@ -13,7 +13,7 @@ export declare class InstructAiDoc {
|
|
|
13
13
|
* written into.
|
|
14
14
|
*
|
|
15
15
|
* `root` is not decoration: every webpieces state path is per-tree (a linked worktree's state lives
|
|
16
|
-
* under `<primary>/.webpieces
|
|
16
|
+
* under `<primary>/.webpieces/worktrees/<name>/`), so a doc that names one must RESOLVE it for the
|
|
17
17
|
* tree the reader is standing in. A template that restated a relative path instead shipped a path
|
|
18
18
|
* that does not exist in a worktree — see `GitWorkflowDoc`.
|
|
19
19
|
*/
|
|
@@ -36,12 +36,12 @@ export declare class MergeProcessDoc extends InstructAiDoc {
|
|
|
36
36
|
render(templateText: string, root: string): string;
|
|
37
37
|
seedOnly(): boolean;
|
|
38
38
|
}
|
|
39
|
-
/** The rules-config template name, and the file name it lands under in `.webpieces
|
|
39
|
+
/** The rules-config template name, and the file name it lands under in `.webpieces/instruct-ai/`. */
|
|
40
40
|
export declare const GIT_WORKFLOW_DOC = "webpieces.git-workflow.md";
|
|
41
41
|
/**
|
|
42
42
|
* `webpieces.git-workflow.md` — the one doc that names the branch-mutation log by path.
|
|
43
43
|
*
|
|
44
|
-
* It used to restate `.webpieces
|
|
44
|
+
* It used to restate `.webpieces/logs/branch-mutations.log` as a literal. That log is deliberately
|
|
45
45
|
* PER-WORKTREE (one appender each), so in a linked worktree the literal names a file that does not
|
|
46
46
|
* exist: the reader greps nothing, and the silence reads as "no deletions were logged" — the exact
|
|
47
47
|
* opposite of the truth, from the one file whose job is to prove every deletion is recoverable.
|
package/src/instruct-ai-docs.js
CHANGED
|
@@ -48,7 +48,7 @@ class InstructAiDoc {
|
|
|
48
48
|
* written into.
|
|
49
49
|
*
|
|
50
50
|
* `root` is not decoration: every webpieces state path is per-tree (a linked worktree's state lives
|
|
51
|
-
* under `<primary>/.webpieces
|
|
51
|
+
* under `<primary>/.webpieces/worktrees/<name>/`), so a doc that names one must RESOLVE it for the
|
|
52
52
|
* tree the reader is standing in. A template that restated a relative path instead shipped a path
|
|
53
53
|
* that does not exist in a worktree — see `GitWorkflowDoc`.
|
|
54
54
|
*/
|
|
@@ -85,12 +85,12 @@ class MergeProcessDoc extends InstructAiDoc {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
exports.MergeProcessDoc = MergeProcessDoc;
|
|
88
|
-
/** The rules-config template name, and the file name it lands under in `.webpieces
|
|
88
|
+
/** The rules-config template name, and the file name it lands under in `.webpieces/instruct-ai/`. */
|
|
89
89
|
exports.GIT_WORKFLOW_DOC = 'webpieces.git-workflow.md';
|
|
90
90
|
/**
|
|
91
91
|
* `webpieces.git-workflow.md` — the one doc that names the branch-mutation log by path.
|
|
92
92
|
*
|
|
93
|
-
* It used to restate `.webpieces
|
|
93
|
+
* It used to restate `.webpieces/logs/branch-mutations.log` as a literal. That log is deliberately
|
|
94
94
|
* PER-WORKTREE (one appender each), so in a linked worktree the literal names a file that does not
|
|
95
95
|
* exist: the reader greps nothing, and the silence reads as "no deletions were logged" — the exact
|
|
96
96
|
* opposite of the truth, from the one file whose job is to prove every deletion is recoverable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruct-ai-docs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/instruct-ai-docs.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAE7B,sEAAkE;AAClE,2DAA6F;AAE7F,8EAA8E;AAC9E,+DAA+D;AAC/D,EAAE;AACF,uGAAuG;AACvG,kGAAkG;AAClG,0EAA0E;AAC1E,uGAAuG;AACvG,wBAAwB;AACxB,EAAE;AACF,uGAAuG;AACvG,sGAAsG;AACtG,qGAAqG;AACrG,iEAAiE;AACjE,EAAE;AACF,uCAAuC;AACvC,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,qGAAqG;AACrG,gEAAgE;AAChE,uGAAuG;AACvG,yFAAyF;AACzF,8EAA8E;AAE9E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAA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AAC;gBACpB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC;QACL,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAxED,4CAwEC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nimport { BranchMutationLog } from '@webpieces/repo-workflow-core';\nimport { MERGE_PROCESS_DOC, MergeProcessText, ReferenceMergeRun } from './merge-process-doc';\n\n// ---------------------------------------------------------------------------\n// THE INSTRUCT-AI DOCS ARE WRITTEN AS A SET, NEVER ONE BY ONE.\n//\n// The bug this fixes: `webpieces.git-workflow.md` links to `webpieces.mergeprocess.md`, and six of the\n// nine governed repos had the first file and not the second — the link pointed at nothing. Nobody\n// forgot on purpose. Each `wp-*` command named the ONE doc it cared about\n// (`writeTemplate(root, 'webpieces.git-workflow.md')`), and a doc that only some other code path wrote\n// simply never arrived.\n//\n// Adding `webpieces.mergeprocess.md` to those six call sites would fix that one link and nothing else:\n// the NEXT doc to gain a sibling link would go missing the same way. So the fix is structural — a doc\n// is never written alone. Writing one writes the TRANSITIVE CLOSURE of the instruct-ai docs it links\n// to, so a doc and everything it points at always land together.\n//\n// TWO CONSEQUENCES WORTH SPELLING OUT:\n//\n// • THE SET IS THE TEMPLATES DIRECTORY. Membership is `readdirSync(templates/)`, not a hand-kept\n// array — dropping `webpieces.<something>.md` into that directory enrols it, and there is no\n// second place to remember. That is the same reason L1/L2 render their tables from the array the\n// guard dispatches on rather than from a description of it.\n// • `instruct-ai-docs.spec.ts` FAILS THE BUILD if any template references a `webpieces.*.md` sibling\n// that is not a member. Without that test this is one instance fixed, not the class.\n// ---------------------------------------------------------------------------\n\nconst TEMPLATES_DIR = path.join(__dirname, '..', 'templates');\n\n/** Every `webpieces.*.md` name mentioned anywhere in a doc's body — links, prose, code fences alike. */\nconst DOC_REFERENCE = /webpieces\\.[A-Za-z0-9._-]*\\.md/g;\n\n/**\n * One deliverable instruct-ai doc.\n *\n * The default is a byte-for-byte copy of its template, rewritten whenever the bytes change. A doc that\n * needs rendering, or that must not clobber live run state, overrides one of the two methods below.\n */\nexport class InstructAiDoc {\n constructor(readonly name: string) {}\n\n /**\n * The bytes to deliver, given the template's own bytes and the ROOT of the tree they are being\n * written into.\n *\n * `root` is not decoration: every webpieces state path is per-tree (a linked worktree's state lives\n * under `<primary>/.webpieces-logs/worktrees/<name>/`), so a doc that names one must RESOLVE it for the\n * tree the reader is standing in. A template that restated a relative path instead shipped a path\n * that does not exist in a worktree — see `GitWorkflowDoc`.\n */\n render(templateText: string, root: string): string {\n void root;\n return templateText;\n }\n\n /**\n * True when an EXISTING copy must be left alone.\n *\n * Only docs a `wp-*` command stamps with live run state say yes: overwriting one mid-run would\n * replace the handback an agent is reading with a generic reference copy.\n */\n seedOnly(): boolean {\n return false;\n }\n}\n\n/**\n * `webpieces.mergeprocess.md` — delivered as the reference rendering, never over a live handback.\n *\n * See merge-process-doc.ts for why one template with two inputs is the whole point.\n */\nexport class MergeProcessDoc extends InstructAiDoc {\n constructor() {\n super(MERGE_PROCESS_DOC);\n }\n\n override render(templateText: string, root: string): string {\n void root;\n return new MergeProcessText(templateText).render(new ReferenceMergeRun());\n }\n\n override seedOnly(): boolean {\n return true;\n }\n}\n\n/** The rules-config template name, and the file name it lands under in `.webpieces-logs/instruct-ai/`. */\nexport const GIT_WORKFLOW_DOC = 'webpieces.git-workflow.md';\n\n/**\n * `webpieces.git-workflow.md` — the one doc that names the branch-mutation log by path.\n *\n * It used to restate `.webpieces-logs/logs/branch-mutations.log` as a literal. That log is deliberately\n * PER-WORKTREE (one appender each), so in a linked worktree the literal names a file that does not\n * exist: the reader greps nothing, and the silence reads as \"no deletions were logged\" — the exact\n * opposite of the truth, from the one file whose job is to prove every deletion is recoverable.\n *\n * So the template carries `{{BRANCH_MUTATION_LOG}}` and this class fills it from the SAME resolver the\n * writer uses, for the tree the doc is being written into. There is one answer to \"where is that log\",\n * and it is `BranchMutationLog.branchMutationLogPath`.\n */\nexport class GitWorkflowDoc extends InstructAiDoc {\n constructor(private readonly mutationLog: BranchMutationLog = new BranchMutationLog()) {\n super(GIT_WORKFLOW_DOC);\n }\n\n override render(templateText: string, root: string): string {\n return templateText.replace(/\\{\\{BRANCH_MUTATION_LOG\\}\\}/g, this.mutationLog.branchMutationLogPath(root));\n }\n}\n\n/**\n * The set of instruct-ai docs, and the link graph over them.\n *\n * Constructed from the templates directory, so the set cannot disagree with what ships.\n */\nexport class InstructAiDocSet {\n constructor(private readonly mutationLog: BranchMutationLog = new BranchMutationLog()) {}\n\n // Resolved on FIRST USE, never in the constructor. `TemplateWriter` is constructed at module load\n // (its migration delegators), and a spec that mocks `fs` for its own subject would otherwise blow up\n // on an unrelated package's import — which is exactly what happened to read-stale-guard.spec.ts.\n private byName: Map<string, InstructAiDoc> | null = null;\n\n /** Every `webpieces.*.md` template that ships with this package. */\n templateNames(): readonly string[] {\n return fs.readdirSync(TEMPLATES_DIR)\n .filter((name: string): boolean => name.startsWith('webpieces.') && name.endsWith('.md'))\n .sort();\n }\n\n /** Every member, in name order. */\n all(): readonly InstructAiDoc[] {\n return [...this.members().values()];\n }\n\n /** The member called `name`, or null when `name` is not an instruct-ai doc at all. */\n get(name: string): InstructAiDoc | null {\n return this.members().get(name) ?? null;\n }\n\n /** Every `webpieces.*.md` name `text` mentions, member or not, de-duplicated in first-seen order. */\n referencesIn(text: string): readonly string[] {\n return [...new Set(text.match(DOC_REFERENCE) ?? [])];\n }\n\n /** The references in `text` that are NOT members — what the link-integrity test refuses. */\n danglingIn(text: string): readonly string[] {\n const members = this.members();\n return this.referencesIn(text).filter((name: string): boolean => !members.has(name));\n }\n\n // The set, built once from the templates directory. The overrides are the docs that need rendering\n // or that must not clobber live run state; everything else is a plain copy of its template.\n private members(): Map<string, InstructAiDoc> {\n if (this.byName !== null) return this.byName;\n const overrides = new Map<string, InstructAiDoc>();\n overrides.set(MERGE_PROCESS_DOC, new MergeProcessDoc());\n overrides.set(GIT_WORKFLOW_DOC, new GitWorkflowDoc(this.mutationLog));\n const built = new Map<string, InstructAiDoc>();\n for (const name of this.templateNames()) {\n built.set(name, overrides.get(name) ?? new InstructAiDoc(name));\n }\n this.byName = built;\n return built;\n }\n\n /**\n * `name` plus every member reachable from it by links, breadth-first from `name`.\n *\n * A non-member is returned alone: a caller writing something that is not an instruct-ai doc (the\n * CI workflow yml) still gets exactly what it asked for.\n */\n closure(name: string, loadText: (docName: string) => string): readonly InstructAiDoc[] {\n const first = this.get(name);\n if (first === null) return [new InstructAiDoc(name)];\n const out: InstructAiDoc[] = [first];\n const seen = new Set<string>([name]);\n for (let i = 0; i < out.length; i++) {\n for (const reference of this.referencesIn(loadText(out[i].name))) {\n const doc = this.get(reference);\n if (doc === null || seen.has(reference)) continue;\n seen.add(reference);\n out.push(doc);\n }\n }\n return out;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"instruct-ai-docs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/instruct-ai-docs.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAE7B,sEAAkE;AAClE,2DAA6F;AAE7F,8EAA8E;AAC9E,+DAA+D;AAC/D,EAAE;AACF,uGAAuG;AACvG,kGAAkG;AAClG,0EAA0E;AAC1E,uGAAuG;AACvG,wBAAwB;AACxB,EAAE;AACF,uGAAuG;AACvG,sGAAsG;AACtG,qGAAqG;AACrG,iEAAiE;AACjE,EAAE;AACF,uCAAuC;AACvC,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,qGAAqG;AACrG,gEAAgE;AAChE,uGAAuG;AACvG,yFAAyF;AACzF,8EAA8E;AAE9E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAE9D,wGAAwG;AACxG,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD;;;;;GAKG;AACH,MAAa,aAAa;IACD;IAArB,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,C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';\n\nimport { BranchMutationLog } from '@webpieces/repo-workflow-core';\nimport { MERGE_PROCESS_DOC, MergeProcessText, ReferenceMergeRun } from './merge-process-doc';\n\n// ---------------------------------------------------------------------------\n// THE INSTRUCT-AI DOCS ARE WRITTEN AS A SET, NEVER ONE BY ONE.\n//\n// The bug this fixes: `webpieces.git-workflow.md` links to `webpieces.mergeprocess.md`, and six of the\n// nine governed repos had the first file and not the second — the link pointed at nothing. Nobody\n// forgot on purpose. Each `wp-*` command named the ONE doc it cared about\n// (`writeTemplate(root, 'webpieces.git-workflow.md')`), and a doc that only some other code path wrote\n// simply never arrived.\n//\n// Adding `webpieces.mergeprocess.md` to those six call sites would fix that one link and nothing else:\n// the NEXT doc to gain a sibling link would go missing the same way. So the fix is structural — a doc\n// is never written alone. Writing one writes the TRANSITIVE CLOSURE of the instruct-ai docs it links\n// to, so a doc and everything it points at always land together.\n//\n// TWO CONSEQUENCES WORTH SPELLING OUT:\n//\n// • THE SET IS THE TEMPLATES DIRECTORY. Membership is `readdirSync(templates/)`, not a hand-kept\n// array — dropping `webpieces.<something>.md` into that directory enrols it, and there is no\n// second place to remember. That is the same reason L1/L2 render their tables from the array the\n// guard dispatches on rather than from a description of it.\n// • `instruct-ai-docs.spec.ts` FAILS THE BUILD if any template references a `webpieces.*.md` sibling\n// that is not a member. Without that test this is one instance fixed, not the class.\n// ---------------------------------------------------------------------------\n\nconst TEMPLATES_DIR = path.join(__dirname, '..', 'templates');\n\n/** Every `webpieces.*.md` name mentioned anywhere in a doc's body — links, prose, code fences alike. */\nconst DOC_REFERENCE = /webpieces\\.[A-Za-z0-9._-]*\\.md/g;\n\n/**\n * One deliverable instruct-ai doc.\n *\n * The default is a byte-for-byte copy of its template, rewritten whenever the bytes change. A doc that\n * needs rendering, or that must not clobber live run state, overrides one of the two methods below.\n */\nexport class InstructAiDoc {\n constructor(readonly name: string) {}\n\n /**\n * The bytes to deliver, given the template's own bytes and the ROOT of the tree they are being\n * written into.\n *\n * `root` is not decoration: every webpieces state path is per-tree (a linked worktree's state lives\n * under `<primary>/.webpieces/worktrees/<name>/`), so a doc that names one must RESOLVE it for the\n * tree the reader is standing in. A template that restated a relative path instead shipped a path\n * that does not exist in a worktree — see `GitWorkflowDoc`.\n */\n render(templateText: string, root: string): string {\n void root;\n return templateText;\n }\n\n /**\n * True when an EXISTING copy must be left alone.\n *\n * Only docs a `wp-*` command stamps with live run state say yes: overwriting one mid-run would\n * replace the handback an agent is reading with a generic reference copy.\n */\n seedOnly(): boolean {\n return false;\n }\n}\n\n/**\n * `webpieces.mergeprocess.md` — delivered as the reference rendering, never over a live handback.\n *\n * See merge-process-doc.ts for why one template with two inputs is the whole point.\n */\nexport class MergeProcessDoc extends InstructAiDoc {\n constructor() {\n super(MERGE_PROCESS_DOC);\n }\n\n override render(templateText: string, root: string): string {\n void root;\n return new MergeProcessText(templateText).render(new ReferenceMergeRun());\n }\n\n override seedOnly(): boolean {\n return true;\n }\n}\n\n/** The rules-config template name, and the file name it lands under in `.webpieces/instruct-ai/`. */\nexport const GIT_WORKFLOW_DOC = 'webpieces.git-workflow.md';\n\n/**\n * `webpieces.git-workflow.md` — the one doc that names the branch-mutation log by path.\n *\n * It used to restate `.webpieces/logs/branch-mutations.log` as a literal. That log is deliberately\n * PER-WORKTREE (one appender each), so in a linked worktree the literal names a file that does not\n * exist: the reader greps nothing, and the silence reads as \"no deletions were logged\" — the exact\n * opposite of the truth, from the one file whose job is to prove every deletion is recoverable.\n *\n * So the template carries `{{BRANCH_MUTATION_LOG}}` and this class fills it from the SAME resolver the\n * writer uses, for the tree the doc is being written into. There is one answer to \"where is that log\",\n * and it is `BranchMutationLog.branchMutationLogPath`.\n */\nexport class GitWorkflowDoc extends InstructAiDoc {\n constructor(private readonly mutationLog: BranchMutationLog = new BranchMutationLog()) {\n super(GIT_WORKFLOW_DOC);\n }\n\n override render(templateText: string, root: string): string {\n return templateText.replace(/\\{\\{BRANCH_MUTATION_LOG\\}\\}/g, this.mutationLog.branchMutationLogPath(root));\n }\n}\n\n/**\n * The set of instruct-ai docs, and the link graph over them.\n *\n * Constructed from the templates directory, so the set cannot disagree with what ships.\n */\nexport class InstructAiDocSet {\n constructor(private readonly mutationLog: BranchMutationLog = new BranchMutationLog()) {}\n\n // Resolved on FIRST USE, never in the constructor. `TemplateWriter` is constructed at module load\n // (its migration delegators), and a spec that mocks `fs` for its own subject would otherwise blow up\n // on an unrelated package's import — which is exactly what happened to read-stale-guard.spec.ts.\n private byName: Map<string, InstructAiDoc> | null = null;\n\n /** Every `webpieces.*.md` template that ships with this package. */\n templateNames(): readonly string[] {\n return fs.readdirSync(TEMPLATES_DIR)\n .filter((name: string): boolean => name.startsWith('webpieces.') && name.endsWith('.md'))\n .sort();\n }\n\n /** Every member, in name order. */\n all(): readonly InstructAiDoc[] {\n return [...this.members().values()];\n }\n\n /** The member called `name`, or null when `name` is not an instruct-ai doc at all. */\n get(name: string): InstructAiDoc | null {\n return this.members().get(name) ?? null;\n }\n\n /** Every `webpieces.*.md` name `text` mentions, member or not, de-duplicated in first-seen order. */\n referencesIn(text: string): readonly string[] {\n return [...new Set(text.match(DOC_REFERENCE) ?? [])];\n }\n\n /** The references in `text` that are NOT members — what the link-integrity test refuses. */\n danglingIn(text: string): readonly string[] {\n const members = this.members();\n return this.referencesIn(text).filter((name: string): boolean => !members.has(name));\n }\n\n // The set, built once from the templates directory. The overrides are the docs that need rendering\n // or that must not clobber live run state; everything else is a plain copy of its template.\n private members(): Map<string, InstructAiDoc> {\n if (this.byName !== null) return this.byName;\n const overrides = new Map<string, InstructAiDoc>();\n overrides.set(MERGE_PROCESS_DOC, new MergeProcessDoc());\n overrides.set(GIT_WORKFLOW_DOC, new GitWorkflowDoc(this.mutationLog));\n const built = new Map<string, InstructAiDoc>();\n for (const name of this.templateNames()) {\n built.set(name, overrides.get(name) ?? new InstructAiDoc(name));\n }\n this.byName = built;\n return built;\n }\n\n /**\n * `name` plus every member reachable from it by links, breadth-first from `name`.\n *\n * A non-member is returned alone: a caller writing something that is not an instruct-ai doc (the\n * CI workflow yml) still gets exactly what it asked for.\n */\n closure(name: string, loadText: (docName: string) => string): readonly InstructAiDoc[] {\n const first = this.get(name);\n if (first === null) return [new InstructAiDoc(name)];\n const out: InstructAiDoc[] = [first];\n const seen = new Set<string>([name]);\n for (let i = 0; i < out.length; i++) {\n for (const reference of this.referencesIn(loadText(out[i].name))) {\n const doc = this.get(reference);\n if (doc === null || seen.has(reference)) continue;\n seen.add(reference);\n out.push(doc);\n }\n }\n return out;\n }\n}\n"]}
|
|
@@ -60,9 +60,9 @@ function seedRule(ruleName, registry) {
|
|
|
60
60
|
// Required excludePaths block: ONE glob list suppressing hook enforcement per file path. Seeded empty
|
|
61
61
|
// (enforce everywhere) — a client adds paths (e.g. "repositories/**") to exempt vendored trees.
|
|
62
62
|
//
|
|
63
|
-
// Deliberately NOT seeded with webpieces' own `.webpieces
|
|
63
|
+
// Deliberately NOT seeded with webpieces' own `.webpieces/` state dir. That exemption lives in CODE
|
|
64
64
|
// (`isWebpiecesStateDir`, consulted by `filterByExcludedPaths` ahead of this list and regardless of it),
|
|
65
|
-
// and a glob here would be a second, weaker spelling of it — weaker because `.webpieces
|
|
65
|
+
// and a glob here would be a second, weaker spelling of it — weaker because `.webpieces/**` compiles to
|
|
66
66
|
// an anchored regex that misses the bare directory the predicate matches, and because a config entry
|
|
67
67
|
// invites a consumer to delete it and believe the exemption went with it.
|
|
68
68
|
// Bring an existing `excludePaths` forward to the single-list shape. Already a list → untouched.
|