@webpieces/rules-config 0.4.844 → 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 +5 -5
- package/src/WebpiecesRulesConfig.d.ts +3 -49
- package/src/WebpiecesRulesConfig.js +1 -44
- package/src/WebpiecesRulesConfig.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 +6 -21
- package/src/index.js +9 -99
- 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 +1 -1
- 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 +11 -1
- package/src/rule-pack-registry.js +58 -2
- package/src/rule-pack-registry.js.map +1 -1
- 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 -95
- 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 -145
- 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 -59
- package/src/api-doc-rules-config.js +0 -70
- 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/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 -265
- package/src/rule-configs.js +0 -580
- package/src/rule-configs.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"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SchemaShape, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { 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 rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
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 rules_sdk_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 rules_sdk_1.FieldDef('string', rule_configs_1.ON_OFF_MODES),
|
|
47
|
-
branchNamingConvention: rules_sdk_1.FieldDef.optional('string'),
|
|
48
|
-
hangTimeoutMinutes: rules_sdk_1.FieldDef.optional('number'),
|
|
49
|
-
maxCommitsBehind: new rules_sdk_1.FieldDef('number'),
|
|
50
|
-
...rules_sdk_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,oDAA+F;AAE/F,iDAAyD;AAE5C,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,sBAAuB,SAAQ,0BAAc;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,4BAAgB;KACtB,CAAC;;AAlBN,wDAmBC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from '@webpieces/rules-sdk';\n\nimport { 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, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { 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 rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
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 rules_sdk_1.BaseRuleConfig {
|
|
26
|
-
severity;
|
|
27
|
-
disableAllowed;
|
|
28
|
-
allowedRoles;
|
|
29
|
-
allowedPaths;
|
|
30
|
-
static SCHEMA = {
|
|
31
|
-
mode: new rules_sdk_1.FieldDef('string', rule_configs_1.MODIFIED_CODE_MODES),
|
|
32
|
-
severity: rules_sdk_1.FieldDef.optional('string', exports.CLIENT_CREATION_SEVERITIES),
|
|
33
|
-
disableAllowed: rules_sdk_1.FieldDef.optional('boolean'),
|
|
34
|
-
allowedRoles: rules_sdk_1.FieldDef.optional('string[]'),
|
|
35
|
-
allowedPaths: rules_sdk_1.FieldDef.optional('string[]'),
|
|
36
|
-
...rules_sdk_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,oDAA+F;AAE/F,iDAAuE;AAEvE,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,0BAAc;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,4BAAgB;KACtB,CAAC;;AAdN,kGAeC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from '@webpieces/rules-sdk';\n\nimport { 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, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { 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 rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
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 rules_sdk_1.BaseRuleConfig {
|
|
25
|
-
allowedPaths;
|
|
26
|
-
static SCHEMA = {
|
|
27
|
-
mode: new rules_sdk_1.FieldDef('string', rule_configs_1.STRUCTURAL_MODES),
|
|
28
|
-
allowedPaths: rules_sdk_1.FieldDef.optional('string[]'),
|
|
29
|
-
...rules_sdk_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,oDAA+F;AAE/F,iDAAkE;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,wBAAyB,SAAQ,0BAAc;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,4BAAgB;KACtB,CAAC;;AARN,4DASC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from '@webpieces/rules-sdk';\n\nimport { 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, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { 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 rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
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 rules_sdk_1.BaseRuleConfig {
|
|
39
|
-
disableAllowed;
|
|
40
|
-
templateDirs;
|
|
41
|
-
bannedPathPrefixes;
|
|
42
|
-
static SCHEMA = {
|
|
43
|
-
mode: new rules_sdk_1.FieldDef('string', rule_configs_1.MODIFIED_CODE_MODES),
|
|
44
|
-
disableAllowed: rules_sdk_1.FieldDef.optional('boolean'),
|
|
45
|
-
templateDirs: rules_sdk_1.FieldDef.optional('string[]'),
|
|
46
|
-
bannedPathPrefixes: rules_sdk_1.FieldDef.optional('string[]'),
|
|
47
|
-
...rules_sdk_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,oDAA+F;AAE/F,iDAAuE;AAEvE;;;;;;;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,0BAAc;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,4BAAgB;KACtB,CAAC;;AAZN,sEAaC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from '@webpieces/rules-sdk';\n\nimport { 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, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { 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
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoUtilityTypesInApiLibConfig = void 0;
|
|
4
|
-
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
/**
|
|
7
|
-
* `no-utility-types-in-api-lib` (#1026) — in every `.ts` file under `paths`, refuse the TypeScript
|
|
8
|
-
* utility types that turn a contract's field list (or its set of keys) into a type-level computation:
|
|
9
|
-
* `Omit`, `Pick`, `Partial`, `Required`, `Exclude` and `Extract`. Refused wherever a type is written
|
|
10
|
-
* — `interface X extends Omit<…>`, a field type, a type alias, a generic argument.
|
|
11
|
-
*
|
|
12
|
-
* Why the whole family and not `Omit` alone: every one of them makes a reader open a second file and
|
|
13
|
-
* compute the fields (or keys) in their head, none of them can become a DTO class (`class X extends
|
|
14
|
-
* Omit<…>` does not compile — a utility type has no runtime value), and banning `Omit` alone just
|
|
15
|
-
* moves the same computation into `Pick<T, Exclude<keyof T, K>>`. `Record`, `Readonly`, `Array` and
|
|
16
|
-
* friends stay allowed: they do not hide which fields a DTO carries.
|
|
17
|
-
*
|
|
18
|
-
* Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
|
|
19
|
-
* - `mode` — OFF | NEW_AND_MODIFIED_CODE (only changed lines, so existing code is fixed as it is
|
|
20
|
-
* touched) | NEW_AND_MODIFIED_FILES (every occurrence in a changed file) | MODIFIED_PROJECTS /
|
|
21
|
-
* RUN_EVERY_TIME (every occurrence in a touched project / in the repo — #1027).
|
|
22
|
-
* - `paths` — the globs of the API contract libraries this rule judges, e.g. `["libraries/apis/**"]`.
|
|
23
|
-
* An empty list judges nothing.
|
|
24
|
-
*
|
|
25
|
-
* `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is
|
|
26
|
-
* `// webpieces-disable no-utility-types-in-api-lib -- <reason>` on the line or the line above.
|
|
27
|
-
*/
|
|
28
|
-
class NoUtilityTypesInApiLibConfig extends rules_sdk_1.BaseRuleConfig {
|
|
29
|
-
paths;
|
|
30
|
-
allowedPaths;
|
|
31
|
-
static SCHEMA = {
|
|
32
|
-
mode: new rules_sdk_1.FieldDef('string', rule_configs_1.MODIFIED_CODE_MODES),
|
|
33
|
-
paths: new rules_sdk_1.FieldDef('string[]'),
|
|
34
|
-
allowedPaths: rules_sdk_1.FieldDef.optional('string[]'),
|
|
35
|
-
...rules_sdk_1.BASE_RULE_SCHEMA,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.NoUtilityTypesInApiLibConfig = NoUtilityTypesInApiLibConfig;
|
|
39
|
-
//# sourceMappingURL=no-utility-types-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-utility-types-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/no-utility-types-config.ts"],"names":[],"mappings":";;;AAAA,oDAA+F;AAE/F,iDAAuE;AAEvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,4BAA6B,SAAQ,0BAAc;IAE5D,KAAK,CAAY;IACjB,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAA8C;QAChE,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,kCAAmB,CAAC;QACjD,KAAK,EAAE,IAAI,oBAAQ,CAAC,UAAU,CAAC;QAC/B,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,4BAAgB;KACtB,CAAC;;AAVN,oEAWC","sourcesContent":["import { FieldDef, SchemaShape, BaseRuleConfig, BASE_RULE_SCHEMA } from '@webpieces/rules-sdk';\n\nimport { ModifiedCodeMode, MODIFIED_CODE_MODES } from './rule-configs';\n\n/**\n * `no-utility-types-in-api-lib` (#1026) — in every `.ts` file under `paths`, refuse the TypeScript\n * utility types that turn a contract's field list (or its set of keys) into a type-level computation:\n * `Omit`, `Pick`, `Partial`, `Required`, `Exclude` and `Extract`. Refused wherever a type is written\n * — `interface X extends Omit<…>`, a field type, a type alias, a generic argument.\n *\n * Why the whole family and not `Omit` alone: every one of them makes a reader open a second file and\n * compute the fields (or keys) in their head, none of them can become a DTO class (`class X extends\n * Omit<…>` does not compile — a utility type has no runtime value), and banning `Omit` alone just\n * moves the same computation into `Pick<T, Exclude<keyof T, K>>`. `Record`, `Readonly`, `Array` and\n * friends stay allowed: they do not hide which fields a DTO carries.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * - `mode` — OFF | NEW_AND_MODIFIED_CODE (only changed lines, so existing code is fixed as it is\n * touched) | NEW_AND_MODIFIED_FILES (every occurrence in a changed file) | MODIFIED_PROJECTS /\n * RUN_EVERY_TIME (every occurrence in a touched project / in the repo — #1027).\n * - `paths` — the globs of the API contract libraries this rule judges, e.g. `[\"libraries/apis/**\"]`.\n * An empty list judges nothing.\n *\n * `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is\n * `// webpieces-disable no-utility-types-in-api-lib -- <reason>` on the line or the line above.\n */\nexport class NoUtilityTypesInApiLibConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n paths!: string[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoUtilityTypesInApiLibConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n paths: new FieldDef('string[]'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { SchemaShape, BaseRuleConfig } from '@webpieces/rules-sdk';
|
|
2
|
-
import { ModifiedCodeMode } from './rule-configs';
|
|
3
|
-
/**
|
|
4
|
-
* One `required-type-suffix` entry: the path globs it covers and the suffixes a type exported from a
|
|
5
|
-
* file under them may end in. Data-only.
|
|
6
|
-
*/
|
|
7
|
-
export declare class RequiredTypeSuffixEntry {
|
|
8
|
-
/** Workspace-relative globs, e.g. `["libraries/apis/internal/**"]`. Non-empty. */
|
|
9
|
-
paths: string[];
|
|
10
|
-
/** Case-sensitive name suffixes, e.g. `["Request", "Response", "Event", "Dto", "Api"]`. Non-empty. */
|
|
11
|
-
suffixes: string[];
|
|
12
|
-
static readonly SCHEMA: SchemaShape<RequiredTypeSuffixEntry>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* `required-type-suffix` (#1037) — every EXPORTED `interface`, `class` (abstract too), `enum` and `type`
|
|
16
|
-
* alias in a non-test `.ts` file under an entry's `paths` must end in one of that entry's `suffixes`
|
|
17
|
-
* (plain, case-sensitive `endsWith`; the suffix alone is not a name). Why: the suffix tells a reader which
|
|
18
|
-
* LAYER a type belongs to — a `…Dto` is on the wire, a `…Fs` is a Firestore document — where an
|
|
19
|
-
* unsuffixed name reads the same as a server-internal or vendor type.
|
|
20
|
-
*
|
|
21
|
-
* Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
|
|
22
|
-
* - `mode` — OFF | NEW_AND_MODIFIED_CODE (only a type whose declaration line is new or changed — a new or
|
|
23
|
-
* renamed type — so legacy names are grandfathered) | NEW_AND_MODIFIED_FILES (every exported type in a
|
|
24
|
-
* changed file) | MODIFIED_PROJECTS / RUN_EVERY_TIME (every exported type in each touched project / the
|
|
25
|
-
* whole repo — #1027).
|
|
26
|
-
* - `entries` — non-empty; each entry has non-empty `paths` and `suffixes`. For example:
|
|
27
|
-
*
|
|
28
|
-
* "entries": [
|
|
29
|
-
* { "paths": ["libraries/apis/internal/**"], "suffixes": ["Request", "Response", "Event", "Dto", "Api"] },
|
|
30
|
-
* { "paths": ["libraries/browser-node/fs-*-model/**"], "suffixes": ["Fs"] }
|
|
31
|
-
* ]
|
|
32
|
-
*
|
|
33
|
-
* OVERLAP — the FIRST MATCH in `entries` order wins; suffixes are never unioned. A file is governed by
|
|
34
|
-
* exactly one entry: the entries are read top to bottom, and the first one with a glob matching the file
|
|
35
|
-
* decides its suffixes. ORDER MATTERS: a narrower entry must be listed BEFORE a broader one. With
|
|
36
|
-
* `libraries/apis/internal/**` listed above `libraries/apis/**`, the narrower entry governs
|
|
37
|
-
* `libraries/apis/internal/x/src/A.ts`; listed below it, the broader entry governs that file and the
|
|
38
|
-
* narrower one never applies there. A failure names the governing entry's glob, so a reader can see
|
|
39
|
-
* which entry won.
|
|
40
|
-
*
|
|
41
|
-
* `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is
|
|
42
|
-
* `// webpieces-disable required-type-suffix -- <reason>` on the declaration's line or the line above.
|
|
43
|
-
*/
|
|
44
|
-
export declare class RequiredTypeSuffixConfig extends BaseRuleConfig {
|
|
45
|
-
mode?: ModifiedCodeMode;
|
|
46
|
-
entries: RequiredTypeSuffixEntry[];
|
|
47
|
-
allowedPaths?: string[];
|
|
48
|
-
static readonly SCHEMA: SchemaShape<RequiredTypeSuffixConfig>;
|
|
49
|
-
}
|