@webpieces/rules-config 0.4.843 → 0.4.845
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 +9 -4
- package/src/WebpiecesRulesConfig.d.ts +3 -49
- package/src/WebpiecesRulesConfig.js +1 -44
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/abstract-rule.d.ts +1 -1
- package/src/abstract-rule.js.map +1 -1
- package/src/config-pruner.d.ts +3 -1
- package/src/config-pruner.js +13 -9
- package/src/config-pruner.js.map +1 -1
- package/src/constants.d.ts +0 -37
- package/src/constants.js +1 -38
- package/src/constants.js.map +1 -1
- package/src/index.d.ts +7 -24
- package/src/index.js +14 -105
- package/src/index.js.map +1 -1
- package/src/load-config.d.ts +6 -2
- package/src/load-config.js +17 -11
- package/src/load-config.js.map +1 -1
- package/src/match-rules-config.d.ts +2 -1
- package/src/match-rules-config.js +2 -2
- package/src/match-rules-config.js.map +1 -1
- package/src/no-custom-css-scope.d.ts +9 -25
- package/src/no-custom-css-scope.js +10 -24
- package/src/no-custom-css-scope.js.map +1 -1
- package/src/retired-config-keys.d.ts +3 -64
- package/src/retired-config-keys.js +14 -152
- package/src/retired-config-keys.js.map +1 -1
- package/src/rule-pack-registry.d.ts +41 -0
- package/src/rule-pack-registry.js +231 -0
- package/src/rule-pack-registry.js.map +1 -0
- package/src/rule-pack-selection.d.ts +6 -0
- package/src/rule-pack-selection.js +50 -0
- package/src/rule-pack-selection.js.map +1 -0
- package/src/rule-schemas.d.ts +4 -14
- package/src/rule-schemas.js +6 -92
- package/src/rule-schemas.js.map +1 -1
- package/src/sections.d.ts +5 -46
- package/src/sections.js +5 -56
- package/src/sections.js.map +1 -1
- package/src/seed-entry.d.ts +5 -16
- package/src/seed-entry.js +14 -141
- package/src/seed-entry.js.map +1 -1
- package/src/validate-config.d.ts +3 -2
- package/src/validate-config.js +62 -73
- package/src/validate-config.js.map +1 -1
- package/templates/webpieces.branch-state-matrix.md +1 -1
- package/src/api-doc-rules-config.d.ts +0 -60
- package/src/api-doc-rules-config.js +0 -71
- package/src/api-doc-rules-config.js.map +0 -1
- package/src/api-lib-spelling-configs.d.ts +0 -40
- package/src/api-lib-spelling-configs.js +0 -52
- package/src/api-lib-spelling-configs.js.map +0 -1
- package/src/default-rules.d.ts +0 -2
- package/src/default-rules.js +0 -119
- package/src/default-rules.js.map +0 -1
- package/src/field-def.d.ts +0 -24
- package/src/field-def.js +0 -59
- package/src/field-def.js.map +0 -1
- package/src/main-sync-guard-configs.d.ts +0 -38
- package/src/main-sync-guard-configs.js +0 -54
- package/src/main-sync-guard-configs.js.map +0 -1
- package/src/no-client-creation-config.d.ts +0 -12
- package/src/no-client-creation-config.js +0 -40
- package/src/no-client-creation-config.js.map +0 -1
- package/src/no-root-union-config.d.ts +0 -25
- package/src/no-root-union-config.js +0 -33
- package/src/no-root-union-config.js.map +0 -1
- package/src/no-state-paths-config.d.ts +0 -41
- package/src/no-state-paths-config.js +0 -51
- package/src/no-state-paths-config.js.map +0 -1
- package/src/no-utility-types-config.d.ts +0 -30
- package/src/no-utility-types-config.js +0 -39
- package/src/no-utility-types-config.js.map +0 -1
- package/src/required-type-suffix-config.d.ts +0 -49
- package/src/required-type-suffix-config.js +0 -62
- package/src/required-type-suffix-config.js.map +0 -1
- package/src/rule-configs.d.ts +0 -273
- package/src/rule-configs.js +0 -595
- package/src/rule-configs.js.map +0 -1
- package/src/spec-temp-dirs.d.ts +0 -37
- package/src/spec-temp-dirs.js +0 -113
- package/src/spec-temp-dirs.js.map +0 -1
- package/src/tag-truth-configs.d.ts +0 -137
- package/src/tag-truth-configs.js +0 -175
- package/src/tag-truth-configs.js.map +0 -1
package/src/default-rules.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultRulesDir = exports.defaultRules = void 0;
|
|
4
|
-
// Default holistic exclude list for the validate-ts-in-src
|
|
5
|
-
// rules. Bare names match a directory segment at any depth; globs match the
|
|
6
|
-
// workspace-relative path. `**/*.d.ts` (ambient declarations) and
|
|
7
|
-
// `**/jest.config.ts` legitimately live outside src/ and are exempt here.
|
|
8
|
-
const DEFAULT_EXCLUDE_PATHS = [
|
|
9
|
-
'node_modules',
|
|
10
|
-
'dist',
|
|
11
|
-
'.nx',
|
|
12
|
-
'.git',
|
|
13
|
-
'**/*.d.ts',
|
|
14
|
-
'**/jest.config.ts',
|
|
15
|
-
];
|
|
16
|
-
// A RULE HAS NO DEFAULT. Not `mode`, and not any other field a schema marks REQUIRED.
|
|
17
|
-
//
|
|
18
|
-
// This table is TUNING ONLY: the value an OPTIONAL field takes when a consumer omits it, and the value
|
|
19
|
-
// the installer seeds that field with. It may never carry `mode`, and it may never carry a
|
|
20
|
-
// schema-required field — `no-rule-defaults.spec.ts` fails the build if one appears, and
|
|
21
|
-
// `webpieces-config-defaults-reviewer` fails the PR.
|
|
22
|
-
//
|
|
23
|
-
// Why, in one paragraph. Every rule with a schema is one `webpieces.config.json` must carry an entry
|
|
24
|
-
// for: validateWebpiecesConfig pushes a copy-paste snippet for every RULE_SCHEMAS key the config does
|
|
25
|
-
// not name, and that error FAILS THE LOAD. A default sitting beneath that is therefore not "the value
|
|
26
|
-
// when nobody said" — it is the value when the loader is bypassed, and its real effect is to make the
|
|
27
|
-
// question look answered. The consumer ANSWERING it is the product: a repo that was never asked
|
|
28
|
-
// whether merged branches may be deleted unattended is a repo where nobody decided, and an agent
|
|
29
|
-
// authoring a rule is the wrong party to decide that on every downstream repo's behalf. The failing
|
|
30
|
-
// load is the delivery mechanism, exactly as a compile error is for a changed surface — the upgrade
|
|
31
|
-
// breaks, the agent reads "add this entry", finds out what it means, and the human chooses.
|
|
32
|
-
//
|
|
33
|
-
// The six entries #1017 measured are gone from here, and every consumer must now state each one in
|
|
34
|
-
// its own config: branch-creation-guard (mode + subBranchNaming + autoReapMergedBranches),
|
|
35
|
-
// pr-lifecycle-guard (mode), branch-state-guard (mode + maxCommitsBehind), no-root-union-api-type,
|
|
36
|
-
// api-rules-for-openapi and api-rules-for-mcp (mode). THIS repo states only the first three today —
|
|
37
|
-
// the other three are new keys the one-release-behind validator does not know yet
|
|
38
|
-
// (.claude/rules/published-vs-local-source.md), so they land with the pin bump, tracked in #1015.
|
|
39
|
-
// `autoReapMergedBranches` and `subBranchNaming` are schema-REQUIRED
|
|
40
|
-
// because they are BEHAVIOUR — one deletes branches unattended, the other decides which branch names
|
|
41
|
-
// are blocked — and behaviour is stated, never inherited. The numeric caps (maxLocalBranches,
|
|
42
|
-
// maxWorktrees) stay optional knobs on purpose: they tune a refusal that PRINTS the cap it hit, so the
|
|
43
|
-
// value is visible at the moment it bites rather than only in webpieces' source.
|
|
44
|
-
// webpieces-disable no-any-unknown -- rule options are opaque at framework level
|
|
45
|
-
exports.defaultRules = {
|
|
46
|
-
'no-any-unknown': {},
|
|
47
|
-
'no-implicit-any': {},
|
|
48
|
-
'max-file-lines': { limit: 900 },
|
|
49
|
-
'max-method-lines': { limit: 80 },
|
|
50
|
-
'require-return-type': {},
|
|
51
|
-
'no-inline-type-literals': {},
|
|
52
|
-
'no-destructure': { allowTopLevel: true },
|
|
53
|
-
'catch-error-pattern': {},
|
|
54
|
-
'no-unmanaged-exceptions': {},
|
|
55
|
-
'no-file-import-cycles': {},
|
|
56
|
-
'runtime-architecture': {},
|
|
57
|
-
'prisma-validate-dtos': {},
|
|
58
|
-
'prisma-converter': {},
|
|
59
|
-
'angular-no-direct-api-in-resolver': {},
|
|
60
|
-
'no-symbol-di-tokens': {},
|
|
61
|
-
'no-client-creation-outside-server-or-client': {},
|
|
62
|
-
'no-custom-css': { allowGlobs: [] },
|
|
63
|
-
'no-state-paths-in-templates': {},
|
|
64
|
-
'no-process-exit-outside-main': {},
|
|
65
|
-
'inject-annotation-not-needed-for-concrete-class': {},
|
|
66
|
-
'framework-tag': {
|
|
67
|
-
knownTypes: ['browser', 'react', 'angular', 'node', 'express', 'react-native'],
|
|
68
|
-
},
|
|
69
|
-
'role-tag': {
|
|
70
|
-
knownTypes: ['server', 'app', 'bundle', 'designed-lib', 'lib', 'client', 'api-lib', 'api-client'],
|
|
71
|
-
},
|
|
72
|
-
'ensure-we-are-secure': {},
|
|
73
|
-
'nx-wiring': {},
|
|
74
|
-
'di-graph': {},
|
|
75
|
-
'missing-design-annotation': {},
|
|
76
|
-
'validate-ts-in-src': {
|
|
77
|
-
allowedRootFiles: ['jest.setup.ts'],
|
|
78
|
-
excludePaths: [...DEFAULT_EXCLUDE_PATHS],
|
|
79
|
-
},
|
|
80
|
-
'no-js-files': {},
|
|
81
|
-
'validate-architecture-unchanged': {},
|
|
82
|
-
'validate-no-architecture-cycles': {},
|
|
83
|
-
'validate-packagejson': {},
|
|
84
|
-
'validate-versions-locked': {},
|
|
85
|
-
'validate-eslint-sync': {},
|
|
86
|
-
'no-root-union-api-type': {},
|
|
87
|
-
'api-rules-for-openapi': {},
|
|
88
|
-
'api-rules-for-mcp': {},
|
|
89
|
-
// #1023: both REQUIRE `mode` — no entry here may carry one. Like the three above they are new keys
|
|
90
|
-
// the one-release-behind validator does not know yet, so THIS repo's config states them with the
|
|
91
|
-
// pin bump to the release that ships them, tracked in #1024.
|
|
92
|
-
'no-inline-import-in-api-lib': {},
|
|
93
|
-
'one-enum-spelling-in-api-lib': {},
|
|
94
|
-
// #1026: REQUIRES `mode` and `paths` — no entry here may carry either. A new key the
|
|
95
|
-
// one-release-behind validator does not know yet, so THIS repo's config states it after publish.
|
|
96
|
-
'no-utility-types-in-api-lib': {},
|
|
97
|
-
// #1037: REQUIRES `mode` and `entries` — no entry here may carry either. A new key the
|
|
98
|
-
// one-release-behind validator does not know yet, so THIS repo's config states it after publish.
|
|
99
|
-
'required-type-suffix': {},
|
|
100
|
-
// #1064: every field of these five that decides behaviour is REQUIRED — no entry here may carry
|
|
101
|
-
// one. New keys the one-release-behind validator does not know yet, so THIS repo's config states
|
|
102
|
-
// them after publish (.claude/rules/published-vs-local-source.md).
|
|
103
|
-
'api-lib-dependencies': {},
|
|
104
|
-
'api-lib-path': {},
|
|
105
|
-
'framework-folder': {},
|
|
106
|
-
'framework-tsconfig': {},
|
|
107
|
-
'framework-packages': {},
|
|
108
|
-
'branch-creation-guard': {},
|
|
109
|
-
'pr-lifecycle-guard': {},
|
|
110
|
-
// NOTE: `whole-repo-build-guard` is deliberately ABSENT from this table, and from RULE_SCHEMAS and
|
|
111
|
-
// HOOK_GUARD_NAMES with it. It is EXPERIMENTAL and OFF by default; the ONLY thing that turns it on
|
|
112
|
-
// is `experimental.whole-repo-build-guard: true` in the optional machine-local
|
|
113
|
-
// ~/.webpieces/config.json. Adding it back here would make it a rule every consumer must CONFIGURE
|
|
114
|
-
// — which is fault Y, i.e. every Bash call blocked on upgrade, which is exactly what it did the
|
|
115
|
-
// first time. See RETIRED_CONFIG_KEYS.
|
|
116
|
-
'branch-state-guard': {},
|
|
117
|
-
};
|
|
118
|
-
exports.defaultRulesDir = [];
|
|
119
|
-
//# sourceMappingURL=default-rules.js.map
|
package/src/default-rules.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,4EAA4E;AAC5E,kEAAkE;AAClE,0EAA0E;AAC1E,MAAM,qBAAqB,GAAsB;IAC7C,cAAc;IACd,MAAM;IACN,KAAK;IACL,MAAM;IACN,WAAW;IACX,mBAAmB;CACtB,CAAC;AAEF,sFAAsF;AACtF,EAAE;AACF,uGAAuG;AACvG,2FAA2F;AAC3F,yFAAyF;AACzF,qDAAqD;AACrD,EAAE;AACF,qGAAqG;AACrG,sGAAsG;AACtG,sGAAsG;AACtG,sGAAsG;AACtG,gGAAgG;AAChG,iGAAiG;AACjG,oGAAoG;AACpG,oGAAoG;AACpG,4FAA4F;AAC5F,EAAE;AACF,mGAAmG;AACnG,2FAA2F;AAC3F,mGAAmG;AACnG,oGAAoG;AACpG,kFAAkF;AAClF,kGAAkG;AAClG,qEAAqE;AACrE,qGAAqG;AACrG,8FAA8F;AAC9F,uGAAuG;AACvG,iFAAiF;AACjF,iFAAiF;AACpE,QAAA,YAAY,GAA4C;IACjE,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;IAChC,kBAAkB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACjC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IACzC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,uBAAuB,EAAE,EAAE;IAC3B,sBAAsB,EAAE,EAAE;IAC1B,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,mCAAmC,EAAE,EAAE;IACvC,qBAAqB,EAAE,EAAE;IACzB,6CAA6C,EAAE,EAAE;IACjD,eAAe,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;IACnC,6BAA6B,EAAE,EAAE;IACjC,8BAA8B,EAAE,EAAE;IAClC,iDAAiD,EAAE,EAAE;IACrD,eAAe,EAAE;QACb,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC;KACjF;IACD,UAAU,EAAE;QACR,UAAU,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC;KACpG;IACD,sBAAsB,EAAE,EAAE;IAC1B,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,2BAA2B,EAAE,EAAE;IAC/B,oBAAoB,EAAE;QAClB,gBAAgB,EAAE,CAAC,eAAe,CAAC;QACnC,YAAY,EAAE,CAAC,GAAG,qBAAqB,CAAC;KAC3C;IACD,aAAa,EAAE,EAAE;IACjB,iCAAiC,EAAE,EAAE;IACrC,iCAAiC,EAAE,EAAE;IACrC,sBAAsB,EAAE,EAAE;IAC1B,0BAA0B,EAAE,EAAE;IAC9B,sBAAsB,EAAE,EAAE;IAC1B,wBAAwB,EAAE,EAAE;IAC5B,uBAAuB,EAAE,EAAE;IAC3B,mBAAmB,EAAE,EAAE;IACvB,mGAAmG;IACnG,iGAAiG;IACjG,6DAA6D;IAC7D,6BAA6B,EAAE,EAAE;IACjC,8BAA8B,EAAE,EAAE;IAClC,qFAAqF;IACrF,iGAAiG;IACjG,6BAA6B,EAAE,EAAE;IACjC,uFAAuF;IACvF,iGAAiG;IACjG,sBAAsB,EAAE,EAAE;IAC1B,gGAAgG;IAChG,iGAAiG;IACjG,mEAAmE;IACnE,sBAAsB,EAAE,EAAE;IAC1B,cAAc,EAAE,EAAE;IAClB,kBAAkB,EAAE,EAAE;IACtB,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,EAAE;IACxB,uBAAuB,EAAE,EAAE;IAC3B,oBAAoB,EAAE,EAAE;IACxB,mGAAmG;IACnG,mGAAmG;IACnG,+EAA+E;IAC/E,mGAAmG;IACnG,gGAAgG;IAChG,uCAAuC;IACvC,oBAAoB,EAAE,EAAE;CAC3B,CAAC;AAEW,QAAA,eAAe,GAAsB,EAAE,CAAC","sourcesContent":["// Default holistic exclude list for the validate-ts-in-src\n// rules. Bare names match a directory segment at any depth; globs match the\n// workspace-relative path. `**/*.d.ts` (ambient declarations) and\n// `**/jest.config.ts` legitimately live outside src/ and are exempt here.\nconst DEFAULT_EXCLUDE_PATHS: readonly string[] = [\n 'node_modules',\n 'dist',\n '.nx',\n '.git',\n '**/*.d.ts',\n '**/jest.config.ts',\n];\n\n// A RULE HAS NO DEFAULT. Not `mode`, and not any other field a schema marks REQUIRED.\n//\n// This table is TUNING ONLY: the value an OPTIONAL field takes when a consumer omits it, and the value\n// the installer seeds that field with. It may never carry `mode`, and it may never carry a\n// schema-required field — `no-rule-defaults.spec.ts` fails the build if one appears, and\n// `webpieces-config-defaults-reviewer` fails the PR.\n//\n// Why, in one paragraph. Every rule with a schema is one `webpieces.config.json` must carry an entry\n// for: validateWebpiecesConfig pushes a copy-paste snippet for every RULE_SCHEMAS key the config does\n// not name, and that error FAILS THE LOAD. A default sitting beneath that is therefore not \"the value\n// when nobody said\" — it is the value when the loader is bypassed, and its real effect is to make the\n// question look answered. The consumer ANSWERING it is the product: a repo that was never asked\n// whether merged branches may be deleted unattended is a repo where nobody decided, and an agent\n// authoring a rule is the wrong party to decide that on every downstream repo's behalf. The failing\n// load is the delivery mechanism, exactly as a compile error is for a changed surface — the upgrade\n// breaks, the agent reads \"add this entry\", finds out what it means, and the human chooses.\n//\n// The six entries #1017 measured are gone from here, and every consumer must now state each one in\n// its own config: branch-creation-guard (mode + subBranchNaming + autoReapMergedBranches),\n// pr-lifecycle-guard (mode), branch-state-guard (mode + maxCommitsBehind), no-root-union-api-type,\n// api-rules-for-openapi and api-rules-for-mcp (mode). THIS repo states only the first three today —\n// the other three are new keys the one-release-behind validator does not know yet\n// (.claude/rules/published-vs-local-source.md), so they land with the pin bump, tracked in #1015.\n// `autoReapMergedBranches` and `subBranchNaming` are schema-REQUIRED\n// because they are BEHAVIOUR — one deletes branches unattended, the other decides which branch names\n// are blocked — and behaviour is stated, never inherited. The numeric caps (maxLocalBranches,\n// maxWorktrees) stay optional knobs on purpose: they tune a refusal that PRINTS the cap it hit, so the\n// value is visible at the moment it bites rather than only in webpieces' source.\n// webpieces-disable no-any-unknown -- rule options are opaque at framework level\nexport const defaultRules: Record<string, Record<string, unknown>> = {\n 'no-any-unknown': {},\n 'no-implicit-any': {},\n 'max-file-lines': { limit: 900 },\n 'max-method-lines': { limit: 80 },\n 'require-return-type': {},\n 'no-inline-type-literals': {},\n 'no-destructure': { allowTopLevel: true },\n 'catch-error-pattern': {},\n 'no-unmanaged-exceptions': {},\n 'no-file-import-cycles': {},\n 'runtime-architecture': {},\n 'prisma-validate-dtos': {},\n 'prisma-converter': {},\n 'angular-no-direct-api-in-resolver': {},\n 'no-symbol-di-tokens': {},\n 'no-client-creation-outside-server-or-client': {},\n 'no-custom-css': { allowGlobs: [] },\n 'no-state-paths-in-templates': {},\n 'no-process-exit-outside-main': {},\n 'inject-annotation-not-needed-for-concrete-class': {},\n 'framework-tag': {\n knownTypes: ['browser', 'react', 'angular', 'node', 'express', 'react-native'],\n },\n 'role-tag': {\n knownTypes: ['server', 'app', 'bundle', 'designed-lib', 'lib', 'client', 'api-lib', 'api-client'],\n },\n 'ensure-we-are-secure': {},\n 'nx-wiring': {},\n 'di-graph': {},\n 'missing-design-annotation': {},\n 'validate-ts-in-src': {\n allowedRootFiles: ['jest.setup.ts'],\n excludePaths: [...DEFAULT_EXCLUDE_PATHS],\n },\n 'no-js-files': {},\n 'validate-architecture-unchanged': {},\n 'validate-no-architecture-cycles': {},\n 'validate-packagejson': {},\n 'validate-versions-locked': {},\n 'validate-eslint-sync': {},\n 'no-root-union-api-type': {},\n 'api-rules-for-openapi': {},\n 'api-rules-for-mcp': {},\n // #1023: both REQUIRE `mode` — no entry here may carry one. Like the three above they are new keys\n // the one-release-behind validator does not know yet, so THIS repo's config states them with the\n // pin bump to the release that ships them, tracked in #1024.\n 'no-inline-import-in-api-lib': {},\n 'one-enum-spelling-in-api-lib': {},\n // #1026: REQUIRES `mode` and `paths` — no entry here may carry either. A new key the\n // one-release-behind validator does not know yet, so THIS repo's config states it after publish.\n 'no-utility-types-in-api-lib': {},\n // #1037: REQUIRES `mode` and `entries` — no entry here may carry either. A new key the\n // one-release-behind validator does not know yet, so THIS repo's config states it after publish.\n 'required-type-suffix': {},\n // #1064: every field of these five that decides behaviour is REQUIRED — no entry here may carry\n // one. New keys the one-release-behind validator does not know yet, so THIS repo's config states\n // them after publish (.claude/rules/published-vs-local-source.md).\n 'api-lib-dependencies': {},\n 'api-lib-path': {},\n 'framework-folder': {},\n 'framework-tsconfig': {},\n 'framework-packages': {},\n 'branch-creation-guard': {},\n 'pr-lifecycle-guard': {},\n // NOTE: `whole-repo-build-guard` is deliberately ABSENT from this table, and from RULE_SCHEMAS and\n // HOOK_GUARD_NAMES with it. It is EXPERIMENTAL and OFF by default; the ONLY thing that turns it on\n // is `experimental.whole-repo-build-guard: true` in the optional machine-local\n // ~/.webpieces/config.json. Adding it back here would make it a rule every consumer must CONFIGURE\n // — which is fault Y, i.e. every Bash call blocked on upgrade, which is exactly what it did the\n // first time. See RETIRED_CONFIG_KEYS.\n 'branch-state-guard': {},\n};\n\nexport const defaultRulesDir: readonly string[] = [];\n"]}
|
package/src/field-def.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type FieldType = 'string' | 'number' | 'boolean' | 'string[]' | 'object[]';
|
|
2
|
-
export declare class FieldDef {
|
|
3
|
-
readonly type: FieldType;
|
|
4
|
-
readonly enumValues?: readonly string[] | undefined;
|
|
5
|
-
readonly optional: boolean;
|
|
6
|
-
readonly nullable: boolean;
|
|
7
|
-
readonly nonEmpty: boolean;
|
|
8
|
-
readonly elementSchema?: Readonly<Record<string, FieldDef>> | undefined;
|
|
9
|
-
constructor(type: FieldType, enumValues?: readonly string[] | undefined, optional?: boolean, nullable?: boolean, nonEmpty?: boolean, elementSchema?: Readonly<Record<string, FieldDef>> | undefined);
|
|
10
|
-
/** Marks a field as optional (omittable) in the config schema. */
|
|
11
|
-
static optional(type: FieldType, enumValues?: readonly string[]): FieldDef;
|
|
12
|
-
/** A REQUIRED string field that also accepts `null` (present-but-unset). */
|
|
13
|
-
static nullableString(): FieldDef;
|
|
14
|
-
/** A REQUIRED `string[]` that must hold at least one string. */
|
|
15
|
-
static nonEmptyStrings(): FieldDef;
|
|
16
|
-
/** A REQUIRED list of objects (possibly empty), each validated against `elementSchema`. */
|
|
17
|
-
static objects(elementSchema: Readonly<Record<string, FieldDef>>): FieldDef;
|
|
18
|
-
/** A REQUIRED, non-empty list of objects, each validated against `elementSchema`. */
|
|
19
|
-
static nonEmptyObjects(elementSchema: Readonly<Record<string, FieldDef>>): FieldDef;
|
|
20
|
-
}
|
|
21
|
-
export type SchemaShape<T> = {
|
|
22
|
-
[K in keyof Required<T>]: FieldDef;
|
|
23
|
-
};
|
|
24
|
-
export {};
|
package/src/field-def.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FieldDef = void 0;
|
|
4
|
-
class FieldDef {
|
|
5
|
-
type;
|
|
6
|
-
enumValues;
|
|
7
|
-
optional;
|
|
8
|
-
nullable;
|
|
9
|
-
nonEmpty;
|
|
10
|
-
elementSchema;
|
|
11
|
-
constructor(type, enumValues,
|
|
12
|
-
// When true, the field is omittable: the missing-rule snippet lists it
|
|
13
|
-
// as optional rather than as a required copy-paste field.
|
|
14
|
-
optional = false,
|
|
15
|
-
// When true, JSON `null` is an accepted value in addition to `type`. Used for a REQUIRED
|
|
16
|
-
// field whose "unset" state must still be visible in the config (e.g. turnOffRuleWhileOnBranch:
|
|
17
|
-
// null means "no branch / always on") — required so it is always present, nullable so it can be
|
|
18
|
-
// present-but-unset without inventing a sentinel string.
|
|
19
|
-
nullable = false,
|
|
20
|
-
// When true, an array field (`string[]` / `object[]`) must hold at least one element — for a list
|
|
21
|
-
// whose emptiness would mean "judge nothing" while reading as "configured".
|
|
22
|
-
nonEmpty = false,
|
|
23
|
-
// For `object[]` only: the schema EVERY element is validated against (unknown keys, missing
|
|
24
|
-
// required keys, types, non-emptiness), exactly like a rule entry's own fields.
|
|
25
|
-
elementSchema) {
|
|
26
|
-
this.type = type;
|
|
27
|
-
this.enumValues = enumValues;
|
|
28
|
-
this.optional = optional;
|
|
29
|
-
this.nullable = nullable;
|
|
30
|
-
this.nonEmpty = nonEmpty;
|
|
31
|
-
this.elementSchema = elementSchema;
|
|
32
|
-
}
|
|
33
|
-
/** Marks a field as optional (omittable) in the config schema. */
|
|
34
|
-
static optional(type, enumValues) {
|
|
35
|
-
return new FieldDef(type, enumValues, true);
|
|
36
|
-
}
|
|
37
|
-
/** A REQUIRED string field that also accepts `null` (present-but-unset). */
|
|
38
|
-
// webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional
|
|
39
|
-
static nullableString() {
|
|
40
|
-
return new FieldDef('string', undefined, false, true);
|
|
41
|
-
}
|
|
42
|
-
/** A REQUIRED `string[]` that must hold at least one string. */
|
|
43
|
-
// webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional
|
|
44
|
-
static nonEmptyStrings() {
|
|
45
|
-
return new FieldDef('string[]', undefined, false, false, true);
|
|
46
|
-
}
|
|
47
|
-
/** A REQUIRED list of objects (possibly empty), each validated against `elementSchema`. */
|
|
48
|
-
// webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional
|
|
49
|
-
static objects(elementSchema) {
|
|
50
|
-
return new FieldDef('object[]', undefined, false, false, false, elementSchema);
|
|
51
|
-
}
|
|
52
|
-
/** A REQUIRED, non-empty list of objects, each validated against `elementSchema`. */
|
|
53
|
-
// webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional
|
|
54
|
-
static nonEmptyObjects(elementSchema) {
|
|
55
|
-
return new FieldDef('object[]', undefined, false, false, true, elementSchema);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.FieldDef = FieldDef;
|
|
59
|
-
//# sourceMappingURL=field-def.js.map
|
package/src/field-def.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-def.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/field-def.ts"],"names":[],"mappings":";;;AAIA,MAAa,QAAQ;IAEJ;IACA;IAGA;IAKA;IAGA;IAGA;IAhBb,YACa,IAAe,EACf,UAA8B;IACvC,uEAAuE;IACvE,0DAA0D;IACjD,WAAoB,KAAK;IAClC,yFAAyF;IACzF,gGAAgG;IAChG,gGAAgG;IAChG,yDAAyD;IAChD,WAAoB,KAAK;IAClC,kGAAkG;IAClG,4EAA4E;IACnE,WAAoB,KAAK;IAClC,4FAA4F;IAC5F,gFAAgF;IACvE,aAAkD;QAflD,SAAI,GAAJ,IAAI,CAAW;QACf,eAAU,GAAV,UAAU,CAAoB;QAG9B,aAAQ,GAAR,QAAQ,CAAiB;QAKzB,aAAQ,GAAR,QAAQ,CAAiB;QAGzB,aAAQ,GAAR,QAAQ,CAAiB;QAGzB,kBAAa,GAAb,aAAa,CAAqC;IAC5D,CAAC;IAEJ,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,IAAe,EAAE,UAA8B;QAC3D,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,4EAA4E;IAC5E,mGAAmG;IACnG,MAAM,CAAC,cAAc;QACjB,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED,gEAAgE;IAChE,mGAAmG;IACnG,MAAM,CAAC,eAAe;QAClB,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IAED,2FAA2F;IAC3F,mGAAmG;IACnG,MAAM,CAAC,OAAO,CAAC,aAAiD;QAC5D,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IACnF,CAAC;IAED,qFAAqF;IACrF,mGAAmG;IACnG,MAAM,CAAC,eAAe,CAAC,aAAiD;QACpE,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAClF,CAAC;CACJ;AAhDD,4BAgDC","sourcesContent":["// `object[]` is a list of JSON objects, each validated against the field's `elementSchema` (e.g.\n// required-type-suffix's `entries`: `[{ \"paths\": [...], \"suffixes\": [...] }]`).\ntype FieldType = 'string' | 'number' | 'boolean' | 'string[]' | 'object[]';\n\nexport class FieldDef {\n constructor(\n readonly type: FieldType,\n readonly enumValues?: readonly string[],\n // When true, the field is omittable: the missing-rule snippet lists it\n // as optional rather than as a required copy-paste field.\n readonly optional: boolean = false,\n // When true, JSON `null` is an accepted value in addition to `type`. Used for a REQUIRED\n // field whose \"unset\" state must still be visible in the config (e.g. turnOffRuleWhileOnBranch:\n // null means \"no branch / always on\") — required so it is always present, nullable so it can be\n // present-but-unset without inventing a sentinel string.\n readonly nullable: boolean = false,\n // When true, an array field (`string[]` / `object[]`) must hold at least one element — for a list\n // whose emptiness would mean \"judge nothing\" while reading as \"configured\".\n readonly nonEmpty: boolean = false,\n // For `object[]` only: the schema EVERY element is validated against (unknown keys, missing\n // required keys, types, non-emptiness), exactly like a rule entry's own fields.\n readonly elementSchema?: Readonly<Record<string, FieldDef>>,\n ) {}\n\n /** Marks a field as optional (omittable) in the config schema. */\n static optional(type: FieldType, enumValues?: readonly string[]): FieldDef {\n return new FieldDef(type, enumValues, true);\n }\n\n /** A REQUIRED string field that also accepts `null` (present-but-unset). */\n // webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional\n static nullableString(): FieldDef {\n return new FieldDef('string', undefined, false, true);\n }\n\n /** A REQUIRED `string[]` that must hold at least one string. */\n // webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional\n static nonEmptyStrings(): FieldDef {\n return new FieldDef('string[]', undefined, false, false, true);\n }\n\n /** A REQUIRED list of objects (possibly empty), each validated against `elementSchema`. */\n // webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional\n static objects(elementSchema: Readonly<Record<string, FieldDef>>): FieldDef {\n return new FieldDef('object[]', undefined, false, false, false, elementSchema);\n }\n\n /** A REQUIRED, non-empty list of objects, each validated against `elementSchema`. */\n // webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional\n static nonEmptyObjects(elementSchema: Readonly<Record<string, FieldDef>>): FieldDef {\n return new FieldDef('object[]', undefined, false, false, true, elementSchema);\n }\n}\n\n// Enforces that a static SCHEMA has exactly the same keys as the config class.\n// Add a field to the class → TS errors until SCHEMA is updated.\n// Add to SCHEMA without adding to class → TS errors (extra property).\nexport type SchemaShape<T> = { [K in keyof Required<T>]: FieldDef };\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, OnOffMode } from './rule-configs';
|
|
3
|
-
export declare const DEFAULT_MAX_COMMITS_BEHIND = 5;
|
|
4
|
-
/**
|
|
5
|
-
* `branch-state-guard` — ONE key, ONE policy: *may I work here, and is what I read current?*
|
|
6
|
-
*
|
|
7
|
-
* Four CLASSES implement it, because the tool wiring genuinely differs (a Read names one file, a Bash
|
|
8
|
-
* command is opaque, and the two Bash halves are not De Morgan duals of each other — see
|
|
9
|
-
* guards/L2-branch-state.md, "Deliberate divergence"):
|
|
10
|
-
*
|
|
11
|
-
* | on stale `main` (state A) | on an already-merged branch (state B)
|
|
12
|
-
* Write/Edit | feature-branch-guard | feature-branch-guard
|
|
13
|
-
* Read | read-stale-guard | read-stale-guard
|
|
14
|
-
* Bash | stale-main-bash-guard | merged-branch-bash-guard
|
|
15
|
-
*
|
|
16
|
-
* Those four class NAMES are unchanged and still appear in every decision-log line as `rule=`, so
|
|
17
|
-
* `grep rule=stale-main-bash-guard` over `.webpieces/logs/L2-decisions` keeps working. What merged is
|
|
18
|
-
* the SWITCH: all four read this one config entry (`AbstractRule.configKey`).
|
|
19
|
-
*
|
|
20
|
-
* ## Why one key and not four
|
|
21
|
-
*
|
|
22
|
-
* Four keys made **half a policy representable**: `read-stale-guard: OFF` beside
|
|
23
|
-
* `merged-branch-bash-guard: ON` is "read the file, yes; `cat` the same file, no" — the same
|
|
24
|
-
* information, opposite verdicts. Nobody chose that; it was reachable because the config had a knob
|
|
25
|
-
* per class instead of a knob per decision. One key makes it unconstructible.
|
|
26
|
-
*
|
|
27
|
-
* And `hangTimeoutMinutes` was declared four times, read four times, and fed ONE shared refresher for
|
|
28
|
-
* ONE shared cache — with a per-process latch (main-sync-refresh.ts) plus config-blind callers ahead of
|
|
29
|
-
* the guards, so at most one of the four values could ever reach a spawn. Four knobs, one honoured; now
|
|
30
|
-
* one knob, honoured everywhere (runner + hook-core route through this entry too).
|
|
31
|
-
*/
|
|
32
|
-
export declare class BranchStateGuardConfig extends BaseRuleConfig {
|
|
33
|
-
mode?: OnOffMode;
|
|
34
|
-
branchNamingConvention?: string;
|
|
35
|
-
hangTimeoutMinutes?: number;
|
|
36
|
-
maxCommitsBehind: number;
|
|
37
|
-
static readonly SCHEMA: SchemaShape<BranchStateGuardConfig>;
|
|
38
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BranchStateGuardConfig = exports.DEFAULT_MAX_COMMITS_BEHIND = void 0;
|
|
4
|
-
const field_def_1 = require("./field-def");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
exports.DEFAULT_MAX_COMMITS_BEHIND = 5;
|
|
7
|
-
/**
|
|
8
|
-
* `branch-state-guard` — ONE key, ONE policy: *may I work here, and is what I read current?*
|
|
9
|
-
*
|
|
10
|
-
* Four CLASSES implement it, because the tool wiring genuinely differs (a Read names one file, a Bash
|
|
11
|
-
* command is opaque, and the two Bash halves are not De Morgan duals of each other — see
|
|
12
|
-
* guards/L2-branch-state.md, "Deliberate divergence"):
|
|
13
|
-
*
|
|
14
|
-
* | on stale `main` (state A) | on an already-merged branch (state B)
|
|
15
|
-
* Write/Edit | feature-branch-guard | feature-branch-guard
|
|
16
|
-
* Read | read-stale-guard | read-stale-guard
|
|
17
|
-
* Bash | stale-main-bash-guard | merged-branch-bash-guard
|
|
18
|
-
*
|
|
19
|
-
* Those four class NAMES are unchanged and still appear in every decision-log line as `rule=`, so
|
|
20
|
-
* `grep rule=stale-main-bash-guard` over `.webpieces/logs/L2-decisions` keeps working. What merged is
|
|
21
|
-
* the SWITCH: all four read this one config entry (`AbstractRule.configKey`).
|
|
22
|
-
*
|
|
23
|
-
* ## Why one key and not four
|
|
24
|
-
*
|
|
25
|
-
* Four keys made **half a policy representable**: `read-stale-guard: OFF` beside
|
|
26
|
-
* `merged-branch-bash-guard: ON` is "read the file, yes; `cat` the same file, no" — the same
|
|
27
|
-
* information, opposite verdicts. Nobody chose that; it was reachable because the config had a knob
|
|
28
|
-
* per class instead of a knob per decision. One key makes it unconstructible.
|
|
29
|
-
*
|
|
30
|
-
* And `hangTimeoutMinutes` was declared four times, read four times, and fed ONE shared refresher for
|
|
31
|
-
* ONE shared cache — with a per-process latch (main-sync-refresh.ts) plus config-blind callers ahead of
|
|
32
|
-
* the guards, so at most one of the four values could ever reach a spawn. Four knobs, one honoured; now
|
|
33
|
-
* one knob, honoured everywhere (runner + hook-core route through this entry too).
|
|
34
|
-
*/
|
|
35
|
-
class BranchStateGuardConfig extends rule_configs_1.BaseRuleConfig {
|
|
36
|
-
// Surfaced verbatim in the on-main block's message, so a project's own convention is what the agent
|
|
37
|
-
// is told to follow. Consumed by FeatureBranchGuardRule.onMainMessage.
|
|
38
|
-
branchNamingConvention;
|
|
39
|
-
// Tunes the DETACHED refresher's stale-lock reclaim window (main-sync.lock.json). One value for one
|
|
40
|
-
// refresher writing one cache — which is what it always physically was.
|
|
41
|
-
hangTimeoutMinutes;
|
|
42
|
-
// Maximum cached commit distance tolerated on local main. Required so every repo consciously
|
|
43
|
-
// carries the policy; 5 means 0..5 are allowed and stale-main blocks starting at 6.
|
|
44
|
-
maxCommitsBehind;
|
|
45
|
-
static SCHEMA = {
|
|
46
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.ON_OFF_MODES),
|
|
47
|
-
branchNamingConvention: field_def_1.FieldDef.optional('string'),
|
|
48
|
-
hangTimeoutMinutes: field_def_1.FieldDef.optional('number'),
|
|
49
|
-
maxCommitsBehind: new field_def_1.FieldDef('number'),
|
|
50
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.BranchStateGuardConfig = BranchStateGuardConfig;
|
|
54
|
-
//# sourceMappingURL=main-sync-guard-configs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main-sync-guard-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/main-sync-guard-configs.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAA2F;AAE9E,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,sBAAuB,SAAQ,6BAAc;IAEtD,oGAAoG;IACpG,uEAAuE;IACvE,sBAAsB,CAAU;IAChC,oGAAoG;IACpG,wEAAwE;IACxE,kBAAkB,CAAU;IAC5B,6FAA6F;IAC7F,oFAAoF;IACpF,gBAAgB,CAAU;IAE1B,MAAM,CAAU,MAAM,GAAwC;QAC1D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,2BAAY,CAAC;QAC1C,sBAAsB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACnD,kBAAkB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC/C,gBAAgB,EAAE,IAAI,oBAAQ,CAAC,QAAQ,CAAC;QACxC,GAAG,+BAAgB;KACtB,CAAC;;AAlBN,wDAmBC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, OnOffMode, ON_OFF_MODES } from './rule-configs';\n\nexport const DEFAULT_MAX_COMMITS_BEHIND = 5;\n\n/**\n * `branch-state-guard` — ONE key, ONE policy: *may I work here, and is what I read current?*\n *\n * Four CLASSES implement it, because the tool wiring genuinely differs (a Read names one file, a Bash\n * command is opaque, and the two Bash halves are not De Morgan duals of each other — see\n * guards/L2-branch-state.md, \"Deliberate divergence\"):\n *\n * | on stale `main` (state A) | on an already-merged branch (state B)\n * Write/Edit | feature-branch-guard | feature-branch-guard\n * Read | read-stale-guard | read-stale-guard\n * Bash | stale-main-bash-guard | merged-branch-bash-guard\n *\n * Those four class NAMES are unchanged and still appear in every decision-log line as `rule=`, so\n * `grep rule=stale-main-bash-guard` over `.webpieces/logs/L2-decisions` keeps working. What merged is\n * the SWITCH: all four read this one config entry (`AbstractRule.configKey`).\n *\n * ## Why one key and not four\n *\n * Four keys made **half a policy representable**: `read-stale-guard: OFF` beside\n * `merged-branch-bash-guard: ON` is \"read the file, yes; `cat` the same file, no\" — the same\n * information, opposite verdicts. Nobody chose that; it was reachable because the config had a knob\n * per class instead of a knob per decision. One key makes it unconstructible.\n *\n * And `hangTimeoutMinutes` was declared four times, read four times, and fed ONE shared refresher for\n * ONE shared cache — with a per-process latch (main-sync-refresh.ts) plus config-blind callers ahead of\n * the guards, so at most one of the four values could ever reach a spawn. Four knobs, one honoured; now\n * one knob, honoured everywhere (runner + hook-core route through this entry too).\n */\nexport class BranchStateGuardConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n // Surfaced verbatim in the on-main block's message, so a project's own convention is what the agent\n // is told to follow. Consumed by FeatureBranchGuardRule.onMainMessage.\n branchNamingConvention?: string;\n // Tunes the DETACHED refresher's stale-lock reclaim window (main-sync.lock.json). One value for one\n // refresher writing one cache — which is what it always physically was.\n hangTimeoutMinutes?: number;\n // Maximum cached commit distance tolerated on local main. Required so every repo consciously\n // carries the policy; 5 means 0..5 are allowed and stale-main blocks starting at 6.\n maxCommitsBehind!: number;\n\n static readonly SCHEMA: SchemaShape<BranchStateGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n branchNamingConvention: FieldDef.optional('string'),\n hangTimeoutMinutes: FieldDef.optional('number'),\n maxCommitsBehind: new FieldDef('number'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, ModifiedCodeMode } from './rule-configs';
|
|
3
|
-
export declare const CLIENT_CREATION_SEVERITIES: readonly ["warn", "error"];
|
|
4
|
-
export type ClientCreationSeverity = typeof CLIENT_CREATION_SEVERITIES[number];
|
|
5
|
-
export declare class NoClientCreationOutsideServerOrClientConfig extends BaseRuleConfig {
|
|
6
|
-
mode?: ModifiedCodeMode;
|
|
7
|
-
severity?: ClientCreationSeverity;
|
|
8
|
-
disableAllowed?: boolean;
|
|
9
|
-
allowedRoles?: string[];
|
|
10
|
-
allowedPaths?: string[];
|
|
11
|
-
static readonly SCHEMA: SchemaShape<NoClientCreationOutsideServerOrClientConfig>;
|
|
12
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoClientCreationOutsideServerOrClientConfig = exports.CLIENT_CREATION_SEVERITIES = void 0;
|
|
4
|
-
const field_def_1 = require("./field-def");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
// no-client-creation-outside-server-or-client severity. Landed as a hard failure this rule would
|
|
7
|
-
// break every existing Angular repo on upgrade (provideCoreClient-style helpers create the client
|
|
8
|
-
// inside a role:lib on purpose), so it ships WARN — reports + prints the migration but passes the
|
|
9
|
-
// build — and a repo flips it to `error` once it has migrated its libraries.
|
|
10
|
-
exports.CLIENT_CREATION_SEVERITIES = ['warn', 'error'];
|
|
11
|
-
// no-client-creation-outside-server-or-client — flags a project that CONSTRUCTS an rpc/pubsub client
|
|
12
|
-
// (`factory.createRpcClient(...)` / `factory.createPubSubClient(...)`) when the project's `role:` tag
|
|
13
|
-
// is not one of `allowedRoles`. Only a runnable entrypoint (server / client app / app) has a declared
|
|
14
|
-
// identity (`serviceName`) or target (`callsService`), so a client built there is attributable in the
|
|
15
|
-
// runtime graph; a client built inside a `role:lib` reaches the fan-out fallback (one `uses` edge to
|
|
16
|
-
// EVERY implementer of the api) and draws calls that cannot happen. A reusable library takes the api
|
|
17
|
-
// INJECTED — the server/app module binds it to a client. Importing the api type or its DI token is
|
|
18
|
-
// FINE and never flagged; only constructing the transport is.
|
|
19
|
-
//
|
|
20
|
-
// `severity` ships "warn" (report + migration, build passes) so an upgrade can't break an un-migrated
|
|
21
|
-
// Angular repo; flip to "error" once libraries are migrated. `allowedRoles` defaults to the runnable
|
|
22
|
-
// roles; `allowedPaths` exempts whole file trees (shared glob semantics). Standard rollout knobs via
|
|
23
|
-
// the base: mode (OFF | NEW_AND_MODIFIED_CODE | NEW_AND_MODIFIED_FILES), turnOffRuleUntilEpoch,
|
|
24
|
-
// branch, and disableAllowed for the inline `// webpieces-disable` escape.
|
|
25
|
-
class NoClientCreationOutsideServerOrClientConfig extends rule_configs_1.BaseRuleConfig {
|
|
26
|
-
severity;
|
|
27
|
-
disableAllowed;
|
|
28
|
-
allowedRoles;
|
|
29
|
-
allowedPaths;
|
|
30
|
-
static SCHEMA = {
|
|
31
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.MODIFIED_CODE_MODES),
|
|
32
|
-
severity: field_def_1.FieldDef.optional('string', exports.CLIENT_CREATION_SEVERITIES),
|
|
33
|
-
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
34
|
-
allowedRoles: field_def_1.FieldDef.optional('string[]'),
|
|
35
|
-
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
36
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
exports.NoClientCreationOutsideServerOrClientConfig = NoClientCreationOutsideServerOrClientConfig;
|
|
40
|
-
//# sourceMappingURL=no-client-creation-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-client-creation-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/no-client-creation-config.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAyG;AAEzG,iGAAiG;AACjG,kGAAkG;AAClG,kGAAkG;AAClG,6EAA6E;AAChE,QAAA,0BAA0B,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAGrE,qGAAqG;AACrG,sGAAsG;AACtG,sGAAsG;AACtG,sGAAsG;AACtG,qGAAqG;AACrG,qGAAqG;AACrG,mGAAmG;AACnG,8DAA8D;AAC9D,EAAE;AACF,sGAAsG;AACtG,qGAAqG;AACrG,qGAAqG;AACrG,gGAAgG;AAChG,2EAA2E;AAC3E,MAAa,2CAA4C,SAAQ,6BAAc;IAE3E,QAAQ,CAA0B;IAClC,cAAc,CAAW;IACzB,YAAY,CAAY;IACxB,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAA6D;QAC/E,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,kCAAmB,CAAC;QACjD,QAAQ,EAAE,oBAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,kCAA0B,CAAC;QACjE,cAAc,EAAE,oBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,+BAAgB;KACtB,CAAC;;AAdN,kGAeC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, ModifiedCodeMode, MODIFIED_CODE_MODES } from './rule-configs';\n\n// no-client-creation-outside-server-or-client severity. Landed as a hard failure this rule would\n// break every existing Angular repo on upgrade (provideCoreClient-style helpers create the client\n// inside a role:lib on purpose), so it ships WARN — reports + prints the migration but passes the\n// build — and a repo flips it to `error` once it has migrated its libraries.\nexport const CLIENT_CREATION_SEVERITIES = ['warn', 'error'] as const;\nexport type ClientCreationSeverity = typeof CLIENT_CREATION_SEVERITIES[number];\n\n// no-client-creation-outside-server-or-client — flags a project that CONSTRUCTS an rpc/pubsub client\n// (`factory.createRpcClient(...)` / `factory.createPubSubClient(...)`) when the project's `role:` tag\n// is not one of `allowedRoles`. Only a runnable entrypoint (server / client app / app) has a declared\n// identity (`serviceName`) or target (`callsService`), so a client built there is attributable in the\n// runtime graph; a client built inside a `role:lib` reaches the fan-out fallback (one `uses` edge to\n// EVERY implementer of the api) and draws calls that cannot happen. A reusable library takes the api\n// INJECTED — the server/app module binds it to a client. Importing the api type or its DI token is\n// FINE and never flagged; only constructing the transport is.\n//\n// `severity` ships \"warn\" (report + migration, build passes) so an upgrade can't break an un-migrated\n// Angular repo; flip to \"error\" once libraries are migrated. `allowedRoles` defaults to the runnable\n// roles; `allowedPaths` exempts whole file trees (shared glob semantics). Standard rollout knobs via\n// the base: mode (OFF | NEW_AND_MODIFIED_CODE | NEW_AND_MODIFIED_FILES), turnOffRuleUntilEpoch,\n// branch, and disableAllowed for the inline `// webpieces-disable` escape.\nexport class NoClientCreationOutsideServerOrClientConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n severity?: ClientCreationSeverity;\n disableAllowed?: boolean;\n allowedRoles?: string[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoClientCreationOutsideServerOrClientConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n severity: FieldDef.optional('string', CLIENT_CREATION_SEVERITIES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedRoles: FieldDef.optional('string[]'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, StructuralMode } from './rule-configs';
|
|
3
|
-
/**
|
|
4
|
-
* `no-root-union-api-type` — a request or response type that IS a union, on any `@ApiPath` contract.
|
|
5
|
-
*
|
|
6
|
-
* Both the OpenAI and the Anthropic function-calling APIs forbid `oneOf`/`anyOf`/`allOf` at the TOP
|
|
7
|
-
* level of a tool's parameter schema, and a server sends its WHOLE tool list on every request — so
|
|
8
|
-
* ONE offending tool makes every request 400 and the entire client session is unusable, not just
|
|
9
|
-
* that tool. Nested composition, inside a property, is fine; only the root is the problem.
|
|
10
|
-
*
|
|
11
|
-
* It is checked on EVERY `@ApiPath` contract, whether or not it declares `@ApiType`. `@ApiType` is a
|
|
12
|
-
* PUBLISHING decision added later, on purpose, so a shape rule that only ran on contracts which had
|
|
13
|
-
* already opted in would let a team discover six months afterwards that the type was never
|
|
14
|
-
* expressible — by which time it is in partners' generated clients and cannot be changed.
|
|
15
|
-
*
|
|
16
|
-
* `allowedPaths` exempts whole trees, with the same glob semantics every other rule's `allowedPaths`
|
|
17
|
-
* uses. The per-site escape hatch is `// webpieces-disable no-root-union-api-type -- <reason>`, and
|
|
18
|
-
* the REASON is mandatory: this defect's blast radius is every tool in a session, so a suppression
|
|
19
|
-
* has to carry an argument somebody wrote down.
|
|
20
|
-
*/
|
|
21
|
-
export declare class NoRootUnionApiTypeConfig extends BaseRuleConfig {
|
|
22
|
-
mode?: StructuralMode;
|
|
23
|
-
allowedPaths?: string[];
|
|
24
|
-
static readonly SCHEMA: SchemaShape<NoRootUnionApiTypeConfig>;
|
|
25
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoRootUnionApiTypeConfig = void 0;
|
|
4
|
-
const field_def_1 = require("./field-def");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
/**
|
|
7
|
-
* `no-root-union-api-type` — a request or response type that IS a union, on any `@ApiPath` contract.
|
|
8
|
-
*
|
|
9
|
-
* Both the OpenAI and the Anthropic function-calling APIs forbid `oneOf`/`anyOf`/`allOf` at the TOP
|
|
10
|
-
* level of a tool's parameter schema, and a server sends its WHOLE tool list on every request — so
|
|
11
|
-
* ONE offending tool makes every request 400 and the entire client session is unusable, not just
|
|
12
|
-
* that tool. Nested composition, inside a property, is fine; only the root is the problem.
|
|
13
|
-
*
|
|
14
|
-
* It is checked on EVERY `@ApiPath` contract, whether or not it declares `@ApiType`. `@ApiType` is a
|
|
15
|
-
* PUBLISHING decision added later, on purpose, so a shape rule that only ran on contracts which had
|
|
16
|
-
* already opted in would let a team discover six months afterwards that the type was never
|
|
17
|
-
* expressible — by which time it is in partners' generated clients and cannot be changed.
|
|
18
|
-
*
|
|
19
|
-
* `allowedPaths` exempts whole trees, with the same glob semantics every other rule's `allowedPaths`
|
|
20
|
-
* uses. The per-site escape hatch is `// webpieces-disable no-root-union-api-type -- <reason>`, and
|
|
21
|
-
* the REASON is mandatory: this defect's blast radius is every tool in a session, so a suppression
|
|
22
|
-
* has to carry an argument somebody wrote down.
|
|
23
|
-
*/
|
|
24
|
-
class NoRootUnionApiTypeConfig extends rule_configs_1.BaseRuleConfig {
|
|
25
|
-
allowedPaths;
|
|
26
|
-
static SCHEMA = {
|
|
27
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.STRUCTURAL_MODES),
|
|
28
|
-
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
29
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.NoRootUnionApiTypeConfig = NoRootUnionApiTypeConfig;
|
|
33
|
-
//# sourceMappingURL=no-root-union-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-root-union-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/no-root-union-config.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAoG;AAEpG;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,wBAAyB,SAAQ,6BAAc;IAExD,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAA0C;QAC5D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,+BAAgB,CAAC;QAC9C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,+BAAgB;KACtB,CAAC;;AARN,4DASC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, StructuralMode, STRUCTURAL_MODES } from './rule-configs';\n\n/**\n * `no-root-union-api-type` — a request or response type that IS a union, on any `@ApiPath` contract.\n *\n * Both the OpenAI and the Anthropic function-calling APIs forbid `oneOf`/`anyOf`/`allOf` at the TOP\n * level of a tool's parameter schema, and a server sends its WHOLE tool list on every request — so\n * ONE offending tool makes every request 400 and the entire client session is unusable, not just\n * that tool. Nested composition, inside a property, is fine; only the root is the problem.\n *\n * It is checked on EVERY `@ApiPath` contract, whether or not it declares `@ApiType`. `@ApiType` is a\n * PUBLISHING decision added later, on purpose, so a shape rule that only ran on contracts which had\n * already opted in would let a team discover six months afterwards that the type was never\n * expressible — by which time it is in partners' generated clients and cannot be changed.\n *\n * `allowedPaths` exempts whole trees, with the same glob semantics every other rule's `allowedPaths`\n * uses. The per-site escape hatch is `// webpieces-disable no-root-union-api-type -- <reason>`, and\n * the REASON is mandatory: this defect's blast radius is every tool in a session, so a suppression\n * has to carry an argument somebody wrote down.\n */\nexport class NoRootUnionApiTypeConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoRootUnionApiTypeConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, ModifiedCodeMode } from './rule-configs';
|
|
3
|
-
/**
|
|
4
|
-
* The template dirs `no-state-paths-in-templates` looks at when a repo has not said otherwise:
|
|
5
|
-
* webpieces' own instruct-ai templates, which are the generated docs the rule was written for.
|
|
6
|
-
*
|
|
7
|
-
* A consumer repo that generates AI-facing docs from its own templates points `templateDirs` at them;
|
|
8
|
-
* a repo that generates none matches no files and the rule is a no-op. Seeded rather than left empty
|
|
9
|
-
* so the rule arrives doing the job it exists for instead of waiting to be discovered.
|
|
10
|
-
*/
|
|
11
|
-
export declare const DEFAULT_TEMPLATE_DIRS: readonly string[];
|
|
12
|
-
/**
|
|
13
|
-
* The path prefixes that must never be RESTATED in a generated doc, only computed.
|
|
14
|
-
*
|
|
15
|
-
* `.webpieces/` is the whole webpieces state tree, and every path under it is per-tree: a linked
|
|
16
|
-
* worktree's state lives at `<primary>/.webpieces/worktrees/<name>/…`, so the relative spelling names
|
|
17
|
-
* a file that does not exist there.
|
|
18
|
-
*/
|
|
19
|
-
export declare const DEFAULT_BANNED_STATE_PATH_PREFIXES: readonly string[];
|
|
20
|
-
/**
|
|
21
|
-
* Bans a hard-coded state path inside a GENERATED-doc template.
|
|
22
|
-
*
|
|
23
|
-
* The incident: `webpieces.git-workflow.md` restated `.webpieces/logs/branch-mutations.log`. That log
|
|
24
|
-
* is per-worktree, so the doc — regenerated into every governed repo and handed to an agent by
|
|
25
|
-
* absolute path as instruction — named a file that does not exist in half the trees that read it.
|
|
26
|
-
* Every one of these paths already has a resolver; the template engine already substitutes. The rule
|
|
27
|
-
* makes "restate it" the thing that fails and "render `{{PLACEHOLDER}}` from the resolver" the thing
|
|
28
|
-
* that passes.
|
|
29
|
-
*
|
|
30
|
-
* Diff-scoped like every other code rule, so the docs whose SUBJECT is the layout (they explain both
|
|
31
|
-
* rows on purpose) are not retroactively flooded — the rule bites when a template is next edited.
|
|
32
|
-
* A doc that genuinely has to print the literal says so out loud:
|
|
33
|
-
* `<!-- webpieces-disable no-state-paths-in-templates -- this table IS the layout -->`.
|
|
34
|
-
*/
|
|
35
|
-
export declare class NoStatePathsInTemplatesConfig extends BaseRuleConfig {
|
|
36
|
-
mode?: ModifiedCodeMode;
|
|
37
|
-
disableAllowed?: boolean;
|
|
38
|
-
templateDirs?: string[];
|
|
39
|
-
bannedPathPrefixes?: string[];
|
|
40
|
-
static readonly SCHEMA: SchemaShape<NoStatePathsInTemplatesConfig>;
|
|
41
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoStatePathsInTemplatesConfig = exports.DEFAULT_BANNED_STATE_PATH_PREFIXES = exports.DEFAULT_TEMPLATE_DIRS = void 0;
|
|
4
|
-
const field_def_1 = require("./field-def");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
/**
|
|
7
|
-
* The template dirs `no-state-paths-in-templates` looks at when a repo has not said otherwise:
|
|
8
|
-
* webpieces' own instruct-ai templates, which are the generated docs the rule was written for.
|
|
9
|
-
*
|
|
10
|
-
* A consumer repo that generates AI-facing docs from its own templates points `templateDirs` at them;
|
|
11
|
-
* a repo that generates none matches no files and the rule is a no-op. Seeded rather than left empty
|
|
12
|
-
* so the rule arrives doing the job it exists for instead of waiting to be discovered.
|
|
13
|
-
*/
|
|
14
|
-
exports.DEFAULT_TEMPLATE_DIRS = ['packages/tooling/rules-config/templates'];
|
|
15
|
-
/**
|
|
16
|
-
* The path prefixes that must never be RESTATED in a generated doc, only computed.
|
|
17
|
-
*
|
|
18
|
-
* `.webpieces/` is the whole webpieces state tree, and every path under it is per-tree: a linked
|
|
19
|
-
* worktree's state lives at `<primary>/.webpieces/worktrees/<name>/…`, so the relative spelling names
|
|
20
|
-
* a file that does not exist there.
|
|
21
|
-
*/
|
|
22
|
-
exports.DEFAULT_BANNED_STATE_PATH_PREFIXES = ['.webpieces/'];
|
|
23
|
-
/**
|
|
24
|
-
* Bans a hard-coded state path inside a GENERATED-doc template.
|
|
25
|
-
*
|
|
26
|
-
* The incident: `webpieces.git-workflow.md` restated `.webpieces/logs/branch-mutations.log`. That log
|
|
27
|
-
* is per-worktree, so the doc — regenerated into every governed repo and handed to an agent by
|
|
28
|
-
* absolute path as instruction — named a file that does not exist in half the trees that read it.
|
|
29
|
-
* Every one of these paths already has a resolver; the template engine already substitutes. The rule
|
|
30
|
-
* makes "restate it" the thing that fails and "render `{{PLACEHOLDER}}` from the resolver" the thing
|
|
31
|
-
* that passes.
|
|
32
|
-
*
|
|
33
|
-
* Diff-scoped like every other code rule, so the docs whose SUBJECT is the layout (they explain both
|
|
34
|
-
* rows on purpose) are not retroactively flooded — the rule bites when a template is next edited.
|
|
35
|
-
* A doc that genuinely has to print the literal says so out loud:
|
|
36
|
-
* `<!-- webpieces-disable no-state-paths-in-templates -- this table IS the layout -->`.
|
|
37
|
-
*/
|
|
38
|
-
class NoStatePathsInTemplatesConfig extends rule_configs_1.BaseRuleConfig {
|
|
39
|
-
disableAllowed;
|
|
40
|
-
templateDirs;
|
|
41
|
-
bannedPathPrefixes;
|
|
42
|
-
static SCHEMA = {
|
|
43
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.MODIFIED_CODE_MODES),
|
|
44
|
-
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
45
|
-
templateDirs: field_def_1.FieldDef.optional('string[]'),
|
|
46
|
-
bannedPathPrefixes: field_def_1.FieldDef.optional('string[]'),
|
|
47
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
exports.NoStatePathsInTemplatesConfig = NoStatePathsInTemplatesConfig;
|
|
51
|
-
//# sourceMappingURL=no-state-paths-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-state-paths-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/no-state-paths-config.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAyG;AAEzG;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAsB,CAAC,yCAAyC,CAAC,CAAC;AAEpG;;;;;;GAMG;AACU,QAAA,kCAAkC,GAAsB,CAAC,aAAa,CAAC,CAAC;AAErF;;;;;;;;;;;;;;GAcG;AACH,MAAa,6BAA8B,SAAQ,6BAAc;IAE7D,cAAc,CAAW;IACzB,YAAY,CAAY;IACxB,kBAAkB,CAAY;IAE9B,MAAM,CAAU,MAAM,GAA+C;QACjE,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,kCAAmB,CAAC;QACjD,cAAc,EAAE,oBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,kBAAkB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QACjD,GAAG,+BAAgB;KACtB,CAAC;;AAZN,sEAaC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, ModifiedCodeMode, MODIFIED_CODE_MODES } from './rule-configs';\n\n/**\n * The template dirs `no-state-paths-in-templates` looks at when a repo has not said otherwise:\n * webpieces' own instruct-ai templates, which are the generated docs the rule was written for.\n *\n * A consumer repo that generates AI-facing docs from its own templates points `templateDirs` at them;\n * a repo that generates none matches no files and the rule is a no-op. Seeded rather than left empty\n * so the rule arrives doing the job it exists for instead of waiting to be discovered.\n */\nexport const DEFAULT_TEMPLATE_DIRS: readonly string[] = ['packages/tooling/rules-config/templates'];\n\n/**\n * The path prefixes that must never be RESTATED in a generated doc, only computed.\n *\n * `.webpieces/` is the whole webpieces state tree, and every path under it is per-tree: a linked\n * worktree's state lives at `<primary>/.webpieces/worktrees/<name>/…`, so the relative spelling names\n * a file that does not exist there.\n */\nexport const DEFAULT_BANNED_STATE_PATH_PREFIXES: readonly string[] = ['.webpieces/'];\n\n/**\n * Bans a hard-coded state path inside a GENERATED-doc template.\n *\n * The incident: `webpieces.git-workflow.md` restated `.webpieces/logs/branch-mutations.log`. That log\n * is per-worktree, so the doc — regenerated into every governed repo and handed to an agent by\n * absolute path as instruction — named a file that does not exist in half the trees that read it.\n * Every one of these paths already has a resolver; the template engine already substitutes. The rule\n * makes \"restate it\" the thing that fails and \"render `{{PLACEHOLDER}}` from the resolver\" the thing\n * that passes.\n *\n * Diff-scoped like every other code rule, so the docs whose SUBJECT is the layout (they explain both\n * rows on purpose) are not retroactively flooded — the rule bites when a template is next edited.\n * A doc that genuinely has to print the literal says so out loud:\n * `<!-- webpieces-disable no-state-paths-in-templates -- this table IS the layout -->`.\n */\nexport class NoStatePathsInTemplatesConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n templateDirs?: string[];\n bannedPathPrefixes?: string[];\n\n static readonly SCHEMA: SchemaShape<NoStatePathsInTemplatesConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n templateDirs: FieldDef.optional('string[]'),\n bannedPathPrefixes: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, ModifiedCodeMode } from './rule-configs';
|
|
3
|
-
/**
|
|
4
|
-
* `no-utility-types-in-api-lib` (#1026) — in every `.ts` file under `paths`, refuse the TypeScript
|
|
5
|
-
* utility types that turn a contract's field list (or its set of keys) into a type-level computation:
|
|
6
|
-
* `Omit`, `Pick`, `Partial`, `Required`, `Exclude` and `Extract`. Refused wherever a type is written
|
|
7
|
-
* — `interface X extends Omit<…>`, a field type, a type alias, a generic argument.
|
|
8
|
-
*
|
|
9
|
-
* Why the whole family and not `Omit` alone: every one of them makes a reader open a second file and
|
|
10
|
-
* compute the fields (or keys) in their head, none of them can become a DTO class (`class X extends
|
|
11
|
-
* Omit<…>` does not compile — a utility type has no runtime value), and banning `Omit` alone just
|
|
12
|
-
* moves the same computation into `Pick<T, Exclude<keyof T, K>>`. `Record`, `Readonly`, `Array` and
|
|
13
|
-
* friends stay allowed: they do not hide which fields a DTO carries.
|
|
14
|
-
*
|
|
15
|
-
* Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
|
|
16
|
-
* - `mode` — OFF | NEW_AND_MODIFIED_CODE (only changed lines, so existing code is fixed as it is
|
|
17
|
-
* touched) | NEW_AND_MODIFIED_FILES (every occurrence in a changed file) | MODIFIED_PROJECTS /
|
|
18
|
-
* RUN_EVERY_TIME (every occurrence in a touched project / in the repo — #1027).
|
|
19
|
-
* - `paths` — the globs of the API contract libraries this rule judges, e.g. `["libraries/apis/**"]`.
|
|
20
|
-
* An empty list judges nothing.
|
|
21
|
-
*
|
|
22
|
-
* `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is
|
|
23
|
-
* `// webpieces-disable no-utility-types-in-api-lib -- <reason>` on the line or the line above.
|
|
24
|
-
*/
|
|
25
|
-
export declare class NoUtilityTypesInApiLibConfig extends BaseRuleConfig {
|
|
26
|
-
mode?: ModifiedCodeMode;
|
|
27
|
-
paths: string[];
|
|
28
|
-
allowedPaths?: string[];
|
|
29
|
-
static readonly SCHEMA: SchemaShape<NoUtilityTypesInApiLibConfig>;
|
|
30
|
-
}
|