@webpieces/rules-config 0.4.831 → 0.4.833
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 +1 -1
- package/src/WebpiecesRulesConfig.d.ts +6 -0
- package/src/WebpiecesRulesConfig.js +5 -0
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/cli-args.js +2 -2
- package/src/cli-args.js.map +1 -1
- package/src/constants.d.ts +5 -0
- package/src/constants.js +5 -0
- package/src/constants.js.map +1 -1
- package/src/default-rules.js +10 -2
- package/src/default-rules.js.map +1 -1
- package/src/field-def.d.ts +2 -0
- package/src/field-def.js +5 -0
- package/src/field-def.js.map +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +15 -5
- package/src/index.js.map +1 -1
- package/src/review-json.d.ts +2 -2
- package/src/review-json.js +3 -3
- package/src/review-json.js.map +1 -1
- package/src/rule-configs.js +4 -3
- package/src/rule-configs.js.map +1 -1
- package/src/rule-schemas.js +7 -0
- package/src/rule-schemas.js.map +1 -1
- package/src/seed-entry.js +28 -0
- package/src/seed-entry.js.map +1 -1
- package/src/tag-truth-configs.d.ts +137 -0
- package/src/tag-truth-configs.js +175 -0
- package/src/tag-truth-configs.js.map +1 -0
- package/templates/webpieces.review-checklists.md +3 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.833",
|
|
4
4
|
"description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -5,6 +5,7 @@ import { NoInlineImportInApiLibConfig, OneEnumSpellingInApiLibConfig } from './a
|
|
|
5
5
|
import { NoUtilityTypesInApiLibConfig } from './no-utility-types-config';
|
|
6
6
|
import { RequiredTypeSuffixConfig } from './required-type-suffix-config';
|
|
7
7
|
import { NoStatePathsInTemplatesConfig } from './no-state-paths-config';
|
|
8
|
+
import { ApiLibDependenciesConfig, ApiLibPathConfig, FrameworkFolderConfig, FrameworkPackagesConfig, FrameworkTsconfigConfig } from './tag-truth-configs';
|
|
8
9
|
export declare class WebpiecesRulesConfig {
|
|
9
10
|
'max-method-lines'?: MaxMethodLinesConfig;
|
|
10
11
|
'max-file-lines'?: MaxFileLinesConfig;
|
|
@@ -33,6 +34,11 @@ export declare class WebpiecesRulesConfig {
|
|
|
33
34
|
'one-enum-spelling-in-api-lib'?: OneEnumSpellingInApiLibConfig;
|
|
34
35
|
'no-utility-types-in-api-lib'?: NoUtilityTypesInApiLibConfig;
|
|
35
36
|
'required-type-suffix'?: RequiredTypeSuffixConfig;
|
|
37
|
+
'api-lib-dependencies'?: ApiLibDependenciesConfig;
|
|
38
|
+
'api-lib-path'?: ApiLibPathConfig;
|
|
39
|
+
'framework-folder'?: FrameworkFolderConfig;
|
|
40
|
+
'framework-tsconfig'?: FrameworkTsconfigConfig;
|
|
41
|
+
'framework-packages'?: FrameworkPackagesConfig;
|
|
36
42
|
'branch-state-guard'?: BranchStateGuardConfig;
|
|
37
43
|
'branch-creation-guard'?: BranchCreationGuardConfig;
|
|
38
44
|
'pr-lifecycle-guard'?: PrLifecycleGuardConfig;
|
|
@@ -29,6 +29,11 @@ class WebpiecesRulesConfig {
|
|
|
29
29
|
'one-enum-spelling-in-api-lib';
|
|
30
30
|
'no-utility-types-in-api-lib';
|
|
31
31
|
'required-type-suffix';
|
|
32
|
+
'api-lib-dependencies';
|
|
33
|
+
'api-lib-path';
|
|
34
|
+
'framework-folder';
|
|
35
|
+
'framework-tsconfig';
|
|
36
|
+
'framework-packages';
|
|
32
37
|
// The THREE hookGuards keys, complete. It used to list five of the nine class-named keys — both
|
|
33
38
|
// bash guards were simply missing — and nothing caught it, because this class is populated by
|
|
34
39
|
// dynamic key assignment in the loader. One key per POLICY makes completeness checkable by eye.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;AA6CA,MAAa,oBAAoB;IAC7B,kBAAkB,CAAwB;IAC1C,gBAAgB,CAAsB;IACtC,qBAAqB,CAA2B;IAChD,yBAAyB,CAA8B;IACvD,gBAAgB,CAAsB;IACtC,iBAAiB,CAAuB;IACxC,sBAAsB,CAA4B;IAClD,kBAAkB,CAAyB;IAC3C,gBAAgB,CAAuB;IACvC,yBAAyB,CAA+B;IACxD,qBAAqB,CAA2B;IAChD,sBAAsB,CAA4B;IAClD,mCAAmC,CAAsC;IACzE,qBAAqB,CAA0B;IAC/C,6CAA6C,CAA+C;IAC5F,eAAe,CAAqB;IACpC,6BAA6B,CAAiC;IAC9D,8BAA8B,CAAkC;IAChE,2BAA2B,CAAgC;IAC3D,iDAAiD,CAAmD;IACpG,eAAe,CAAsB;IACrC,UAAU,CAAiB;IAC3B,sBAAsB,CAA2B;IACjD,6BAA6B,CAAgC;IAC7D,8BAA8B,CAAiC;IAC/D,6BAA6B,CAAgC;IAC7D,sBAAsB,CAA4B;IAClD,sBAAsB,CAA4B;IAClD,cAAc,CAAoB;IAClC,kBAAkB,CAAyB;IAC3C,oBAAoB,CAA2B;IAC/C,oBAAoB,CAA2B;IAC/C,gGAAgG;IAChG,8FAA8F;IAC9F,gGAAgG;IAChG,oBAAoB,CAA0B;IAC9C,uBAAuB,CAA6B;IACpD,oBAAoB,CAA0B;IAC9C,uBAAuB,CAA4B;IACnD,sBAAsB,CAA6B;IACnD,UAAU,CAAiB;IAC3B,2BAA2B,CAAiC;IAC5D,aAAa,CAAmB;IAChC,oBAAoB,CAAyB;IAC7C,QAAQ,CAAY;CACvB;AA9CD,oDA8CC","sourcesContent":["import {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoCustomCssConfig,\n NoProcessExitOutsideMainConfig,\n NoFunctionOutsideClassConfig,\n InjectAnnotationNotNeededForConcreteClassConfig,\n FrameworkTagConfig,\n RoleTagConfig,\n EnsureWeAreSecureConfig,\n BranchCreationGuardConfig,\n PrLifecycleGuardConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n DiGraphConfig,\n MissingDesignAnnotationConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\nimport { BranchStateGuardConfig } from './main-sync-guard-configs';\nimport { NoClientCreationOutsideServerOrClientConfig } from './no-client-creation-config';\nimport { NoInlineImportInApiLibConfig, OneEnumSpellingInApiLibConfig } from './api-lib-spelling-configs';\nimport { NoUtilityTypesInApiLibConfig } from './no-utility-types-config';\nimport { RequiredTypeSuffixConfig } from './required-type-suffix-config';\nimport { NoStatePathsInTemplatesConfig } from './no-state-paths-config';\nimport {\n ApiLibDependenciesConfig,\n ApiLibPathConfig,\n FrameworkFolderConfig,\n FrameworkPackagesConfig,\n FrameworkTsconfigConfig,\n} from './tag-truth-configs';\n\nexport class WebpiecesRulesConfig {\n 'max-method-lines'?: MaxMethodLinesConfig;\n 'max-file-lines'?: MaxFileLinesConfig;\n 'require-return-type'?: RequireReturnTypeConfig;\n 'no-inline-type-literals'?: NoInlineTypeLiteralsConfig;\n 'no-any-unknown'?: NoAnyUnknownConfig;\n 'no-implicit-any'?: NoImplicitAnyConfig;\n 'prisma-validate-dtos'?: PrismaValidateDtosConfig;\n 'prisma-converter'?: PrismaConverterConfig;\n 'no-destructure'?: NoDestructureConfig;\n 'no-unmanaged-exceptions'?: NoUnmanagedExceptionsConfig;\n 'catch-error-pattern'?: CatchErrorPatternConfig;\n 'throw-cause-required'?: ThrowCauseRequiredConfig;\n 'angular-no-direct-api-in-resolver'?: AngularNoDirectApiInResolverConfig;\n 'no-symbol-di-tokens'?: NoSymbolDiTokensConfig;\n 'no-client-creation-outside-server-or-client'?: NoClientCreationOutsideServerOrClientConfig;\n 'no-custom-css'?: NoCustomCssConfig;\n 'no-state-paths-in-templates'?: NoStatePathsInTemplatesConfig;\n 'no-process-exit-outside-main'?: NoProcessExitOutsideMainConfig;\n 'no-function-outside-class'?: NoFunctionOutsideClassConfig;\n 'inject-annotation-not-needed-for-concrete-class'?: InjectAnnotationNotNeededForConcreteClassConfig;\n 'framework-tag'?: FrameworkTagConfig;\n 'role-tag'?: RoleTagConfig;\n 'ensure-we-are-secure'?: EnsureWeAreSecureConfig;\n 'no-inline-import-in-api-lib'?: NoInlineImportInApiLibConfig;\n 'one-enum-spelling-in-api-lib'?: OneEnumSpellingInApiLibConfig;\n 'no-utility-types-in-api-lib'?: NoUtilityTypesInApiLibConfig;\n 'required-type-suffix'?: RequiredTypeSuffixConfig;\n 'api-lib-dependencies'?: ApiLibDependenciesConfig;\n 'api-lib-path'?: ApiLibPathConfig;\n 'framework-folder'?: FrameworkFolderConfig;\n 'framework-tsconfig'?: FrameworkTsconfigConfig;\n 'framework-packages'?: FrameworkPackagesConfig;\n // The THREE hookGuards keys, complete. It used to list five of the nine class-named keys — both\n // bash guards were simply missing — and nothing caught it, because this class is populated by\n // dynamic key assignment in the loader. One key per POLICY makes completeness checkable by eye.\n 'branch-state-guard'?: BranchStateGuardConfig;\n 'branch-creation-guard'?: BranchCreationGuardConfig;\n 'pr-lifecycle-guard'?: PrLifecycleGuardConfig;\n 'no-file-import-cycles'?: NoFileImportCyclesConfig;\n 'runtime-architecture'?: RuntimeArchitectureConfig;\n 'di-graph'?: DiGraphConfig;\n 'missing-design-annotation'?: MissingDesignAnnotationConfig;\n 'no-js-files'?: NoJsFilesConfig;\n 'validate-ts-in-src'?: ValidateTsInSrcConfig;\n rulesDir?: string[];\n}\n"]}
|
package/src/cli-args.js
CHANGED
|
@@ -9,7 +9,7 @@ const cli_exit_error_1 = require("./cli-exit-error");
|
|
|
9
9
|
* written for the reader who has to DECIDE whether to pass it, not as a restatement of the name.
|
|
10
10
|
*/
|
|
11
11
|
class CliFlag {
|
|
12
|
-
name; // including the leading dashes, e.g. '--
|
|
12
|
+
name; // including the leading dashes, e.g. '--dry-run'
|
|
13
13
|
description;
|
|
14
14
|
/**
|
|
15
15
|
* The flag MAY carry a value: `--resolve dean/ONE-2275` or `--resolve=dean/ONE-2275`.
|
|
@@ -152,7 +152,7 @@ let CliArgs = class CliArgs {
|
|
|
152
152
|
}
|
|
153
153
|
scan.present.push(name);
|
|
154
154
|
if (!flag.takesValue) {
|
|
155
|
-
// `--
|
|
155
|
+
// `--dry-run=x` is a typo, not an accepted flag: the value would be silently dropped.
|
|
156
156
|
if (eq > 0)
|
|
157
157
|
scan.unknown.push(token);
|
|
158
158
|
continue;
|
package/src/cli-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/cli-args.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,qDAAgD;AAEhD;;;GAGG;AACH,MAAa,OAAO;IAChB,IAAI,CAAS,CAAQ,qDAAqD;IAC1E,WAAW,CAAS;IACpB;;;;;;;OAOG;IACH,UAAU,CAAU;IAEpB,YAAY,IAAY,EAAE,WAAmB,EAAE,UAAU,GAAG,KAAK;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,C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G,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,EAAE;YAAE,MAAM,IAAI,6BAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAe;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1D,IAAI,KAAK,CAAC,EAAE;YAAE,OAAO;QACrB,MAAM,IAAI,6BAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;CACJ,CAAA;AAtGY,0BAAO;kBAAP,OAAO;IADnB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,OAAO,CAsGnB","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport { CliExitError } from './cli-exit-error';\n\n/**\n * One optional `--flag` a command accepts. Data-only. The description is printed in `--help`, so it is\n * written for the reader who has to DECIDE whether to pass it, not as a restatement of the name.\n */\nexport class CliFlag {\n name: string; // including the leading dashes, e.g. '--no-optional'\n description: string;\n /**\n * The flag MAY carry a value: `--resolve dean/ONE-2275` or `--resolve=dean/ONE-2275`.\n *\n * \"May\", not \"must\". The one flag that needs this (`wp-push-dev --resolve`) is meaningful both bare\n * (queue every other copy) and with an argument (queue just that one), and a `valueRequired` variant\n * would be a second concept for a case nothing has. A following token is consumed as the value only\n * when it does not itself start with `-`, so `--resolve --force` still reads as two flags.\n */\n takesValue: boolean;\n\n constructor(name: string, description: string, takesValue = false) {\n this.name = name;\n this.description = description;\n this.takesValue = takesValue;\n }\n}\n\n/**\n * Usage descriptor for a `wp-*` bin. Data-only (classes-over-interfaces): a command name, its one-line\n * summary, and the flags it accepts. `CliArgs.classify` turns it into the `--help` / unknown-arg message.\n *\n * `flags` defaults to [] — the no-argument case stays a two-arg construction, which is what MOST `wp-*`\n * bins are. (Deliberately not a count: the last one written down went stale the next time a bin grew a\n * flag, which is exactly the drift the corollary in `.claude/rules/no-backwards-compat.md` is about.)\n *\n * A flag a command does not DECLARE here is still rejected with exit 2: that guard is\n * the reason this class exists (`wp-start-upsert-pr --help` once launched a squash-merge), and making it\n * flag-aware must not soften it.\n */\nexport class CliUsage {\n command: string;\n summary: string;\n flags: CliFlag[];\n\n constructor(command: string, summary: string, flags: CliFlag[] = []) {\n this.command = command;\n this.summary = summary;\n this.flags = flags;\n }\n}\n\n/**\n * Which declared flags argv actually carried. Data-only (a class, per CLAUDE.md), with a `has()` accessor\n * so every consumer asks the question the same way instead of open-coding `includes` against a raw array.\n */\nexport class CliArgSet {\n present: string[];\n // Values for the value-taking flags that carried one, keyed by flag name. A flag passed bare is in\n // `present` but absent here, which is exactly the distinction `--resolve` (bare) vs\n // `--resolve <branch>` needs.\n values: Map<string, string>;\n\n constructor(present: string[] = [], values: Map<string, string> = new Map<string, string>()) {\n this.present = present;\n this.values = values;\n }\n\n has(flag: string): boolean {\n return this.present.includes(flag);\n }\n\n /** The value passed with `flag`, or '' when the flag was absent or passed bare. */\n value(flag: string): string {\n return this.values.get(flag) ?? '';\n }\n}\n\n/**\n * Data-only outcome of checking argv against a no-argument command. `ok` true → run normally; else\n * `exitCode`/`message` are what the bin should exit with (help = 0, unknown arg = 2). Kept a pure\n * value so it can be asserted directly in tests without provoking a throw.\n */\nexport class CliArgsCheck {\n ok: boolean;\n exitCode: number;\n message: string;\n\n constructor(ok: boolean, exitCode: number, message: string) {\n this.ok = ok;\n this.exitCode = exitCode;\n this.message = message;\n }\n}\n\n/** One argv walk's result: which declared flags were seen, their values, and every unrecognized token. */\nclass CliScan {\n present: string[] = [];\n values: Map<string, string> = new Map<string, string>();\n unknown: string[] = [];\n}\n\n/** Argument guard for the no-argument `wp-*` bins. */\n@injectable(bindingScopeValues.Singleton)\nexport class CliArgs {\n // The help/usage block shown for `--help` and appended to an unknown-arg error. A command with no\n // declared flags says so outright, because \"takes no arguments\" is the whole usage for most of them.\n private usageText(usage: CliUsage): string {\n const head = `${usage.command} — ${usage.summary}\\n\\n`;\n if (usage.flags.length === 0) {\n return head + `Usage: pnpm ${usage.command}\\nThis command takes no arguments.`;\n }\n const label = (f: CliFlag): string => (f.takesValue ? `${f.name} [<value>]` : f.name);\n const width = Math.max(...usage.flags.map((f: CliFlag): number => label(f).length));\n const rows = usage.flags.map((f: CliFlag): string => ` ${label(f).padEnd(width)} ${f.description}`);\n return head + `Usage: pnpm ${usage.command} [flags]\\n\\nFlags:\\n${rows.join('\\n')}`;\n }\n\n /**\n * Pure argv classifier. No args → ok. `--help`/`-h` → not-ok, exit 0 with the usage block. Any token\n * the command did not DECLARE → not-ok, exit 2 naming the offending one(s). Split out from\n * `assertNoArgs`/`parse` so the decision is unit-testable without a thrown exception.\n *\n * An undeclared token is still fatal even for a command that accepts flags — a mistyped `--no-optionl`\n * must never be silently ignored and then run the flow WITH the reviews the caller meant to skip.\n */\n classify(args: string[], usage: CliUsage): CliArgsCheck {\n if (args.length === 0) return new CliArgsCheck(true, 0, '');\n if (args.includes('--help') || args.includes('-h')) {\n return new CliArgsCheck(false, 0, this.usageText(usage));\n }\n const scan = this.scan(args, usage);\n if (scan.unknown.length > 0) {\n return new CliArgsCheck(false, 2, `❌ Unknown argument(s): ${scan.unknown.join(' ')}\\n\\n` + this.usageText(usage));\n }\n return new CliArgsCheck(true, 0, '');\n }\n\n /**\n * Walk argv once, classifying every token as a declared flag, a value belonging to the\n * value-taking flag before it, or unknown. ONE walk backs both `classify` and `parse` so the set of\n * tokens the guard accepts and the set `parse` reports can never diverge — an accepted-but-unreported\n * flag would silently run the flow without the behaviour the caller asked for.\n */\n private scan(args: string[], usage: CliUsage): CliScan {\n const byName = new Map<string, CliFlag>();\n for (const flag of usage.flags) byName.set(flag.name, flag);\n const scan = new CliScan();\n for (let i = 0; i < args.length; i += 1) {\n const token = args[i];\n const eq = token.indexOf('=');\n // `--flag=value` — split before lookup so the name is what gets matched, not the whole token.\n const name = eq > 0 ? token.slice(0, eq) : token;\n const flag = byName.get(name);\n if (flag === undefined) {\n scan.unknown.push(token);\n continue;\n }\n scan.present.push(name);\n if (!flag.takesValue) {\n // `--no-optional=x` is a typo, not an accepted flag: the value would be silently dropped.\n if (eq > 0) scan.unknown.push(token);\n continue;\n }\n if (eq > 0) {\n scan.values.set(name, token.slice(eq + 1));\n continue;\n }\n // OPTIONAL value: only a following token that is not itself a flag. `--resolve --force`\n // therefore reads as two flags, not as a resolve of a branch literally named `--force`.\n const next = i + 1 < args.length ? args[i + 1] : '';\n if (next !== '' && !next.startsWith('-')) {\n scan.values.set(name, next);\n i += 1;\n }\n }\n return scan;\n }\n\n /**\n * The flag-accepting sibling of {@link assertNoArgs}: same guard, but it RETURNS which declared flags\n * were passed. Call it in exactly the same place — first thing inside `runMain`, before the app touches\n * git.\n */\n parse(usage: CliUsage): CliArgSet {\n const args = process.argv.slice(2);\n const check = this.classify(args, usage);\n if (!check.ok) throw new CliExitError(check.exitCode, check.message);\n const scan = this.scan(args, usage);\n return new CliArgSet(scan.present, scan.values);\n }\n\n /**\n * Call it as the FIRST thing inside `runMain`, BEFORE the app touches git — a bogus flag must\n * never start a mutation flow (the `wp-start-upsert-pr --help` incident: an ignored flag silently\n * launched the squash-merge and stranded the checkout on a `…PreMerge<n>` branch).\n *\n * Throws `CliExitError` (never `process.exit`) so `runMain` stays the single sanctioned exit site\n * (`no-process-exit-outside-main`): help exits 0, an unknown arg exits 2, and in both cases the\n * flow never begins.\n */\n assertNoArgs(usage: CliUsage): void {\n const check = this.classify(process.argv.slice(2), usage);\n if (check.ok) return;\n throw new CliExitError(check.exitCode, check.message);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/cli-args.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAC3D,qDAAgD;AAEhD;;;GAGG;AACH,MAAa,OAAO;IAChB,IAAI,CAAS,CAAQ,iDAAiD;IACtE,WAAW,CAAS;IACpB;;;;;;;OAOG;IACH,UAAU,CAAU;IAEpB,YAAY,IAAY,EAAE,WAAmB,EAAE,UAAU,GAAG,KAAK;QAC7D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CACJ;AAlBD,0BAkBC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,QAAQ;IACjB,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,KAAK,CAAY;IAEjB,YAAY,OAAe,EAAE,OAAe,EAAE,QAAmB,EAAE;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AAVD,4BAUC;AAED;;;GAGG;AACH,MAAa,SAAS;IAClB,OAAO,CAAW;IAClB,mGAAmG;IACnG,oFAAoF;IACpF,8BAA8B;IAC9B,MAAM,CAAsB;IAE5B,YAAY,UAAoB,EAAE,EAAE,SAA8B,IAAI,GAAG,EAAkB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,GAAG,CAAC,IAAY;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,mFAAmF;IACnF,KAAK,CA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SAAS,CAAC;GAC5B,OAAO,CAsGnB","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\nimport { CliExitError } from './cli-exit-error';\n\n/**\n * One optional `--flag` a command accepts. Data-only. The description is printed in `--help`, so it is\n * written for the reader who has to DECIDE whether to pass it, not as a restatement of the name.\n */\nexport class CliFlag {\n name: string; // including the leading dashes, e.g. '--dry-run'\n description: string;\n /**\n * The flag MAY carry a value: `--resolve dean/ONE-2275` or `--resolve=dean/ONE-2275`.\n *\n * \"May\", not \"must\". The one flag that needs this (`wp-push-dev --resolve`) is meaningful both bare\n * (queue every other copy) and with an argument (queue just that one), and a `valueRequired` variant\n * would be a second concept for a case nothing has. A following token is consumed as the value only\n * when it does not itself start with `-`, so `--resolve --force` still reads as two flags.\n */\n takesValue: boolean;\n\n constructor(name: string, description: string, takesValue = false) {\n this.name = name;\n this.description = description;\n this.takesValue = takesValue;\n }\n}\n\n/**\n * Usage descriptor for a `wp-*` bin. Data-only (classes-over-interfaces): a command name, its one-line\n * summary, and the flags it accepts. `CliArgs.classify` turns it into the `--help` / unknown-arg message.\n *\n * `flags` defaults to [] — the no-argument case stays a two-arg construction, which is what MOST `wp-*`\n * bins are. (Deliberately not a count: the last one written down went stale the next time a bin grew a\n * flag, which is exactly the drift the corollary in `.claude/rules/no-backwards-compat.md` is about.)\n *\n * A flag a command does not DECLARE here is still rejected with exit 2: that guard is\n * the reason this class exists (`wp-start-upsert-pr --help` once launched a squash-merge), and making it\n * flag-aware must not soften it.\n */\nexport class CliUsage {\n command: string;\n summary: string;\n flags: CliFlag[];\n\n constructor(command: string, summary: string, flags: CliFlag[] = []) {\n this.command = command;\n this.summary = summary;\n this.flags = flags;\n }\n}\n\n/**\n * Which declared flags argv actually carried. Data-only (a class, per CLAUDE.md), with a `has()` accessor\n * so every consumer asks the question the same way instead of open-coding `includes` against a raw array.\n */\nexport class CliArgSet {\n present: string[];\n // Values for the value-taking flags that carried one, keyed by flag name. A flag passed bare is in\n // `present` but absent here, which is exactly the distinction `--resolve` (bare) vs\n // `--resolve <branch>` needs.\n values: Map<string, string>;\n\n constructor(present: string[] = [], values: Map<string, string> = new Map<string, string>()) {\n this.present = present;\n this.values = values;\n }\n\n has(flag: string): boolean {\n return this.present.includes(flag);\n }\n\n /** The value passed with `flag`, or '' when the flag was absent or passed bare. */\n value(flag: string): string {\n return this.values.get(flag) ?? '';\n }\n}\n\n/**\n * Data-only outcome of checking argv against a no-argument command. `ok` true → run normally; else\n * `exitCode`/`message` are what the bin should exit with (help = 0, unknown arg = 2). Kept a pure\n * value so it can be asserted directly in tests without provoking a throw.\n */\nexport class CliArgsCheck {\n ok: boolean;\n exitCode: number;\n message: string;\n\n constructor(ok: boolean, exitCode: number, message: string) {\n this.ok = ok;\n this.exitCode = exitCode;\n this.message = message;\n }\n}\n\n/** One argv walk's result: which declared flags were seen, their values, and every unrecognized token. */\nclass CliScan {\n present: string[] = [];\n values: Map<string, string> = new Map<string, string>();\n unknown: string[] = [];\n}\n\n/** Argument guard for the no-argument `wp-*` bins. */\n@injectable(bindingScopeValues.Singleton)\nexport class CliArgs {\n // The help/usage block shown for `--help` and appended to an unknown-arg error. A command with no\n // declared flags says so outright, because \"takes no arguments\" is the whole usage for most of them.\n private usageText(usage: CliUsage): string {\n const head = `${usage.command} — ${usage.summary}\\n\\n`;\n if (usage.flags.length === 0) {\n return head + `Usage: pnpm ${usage.command}\\nThis command takes no arguments.`;\n }\n const label = (f: CliFlag): string => (f.takesValue ? `${f.name} [<value>]` : f.name);\n const width = Math.max(...usage.flags.map((f: CliFlag): number => label(f).length));\n const rows = usage.flags.map((f: CliFlag): string => ` ${label(f).padEnd(width)} ${f.description}`);\n return head + `Usage: pnpm ${usage.command} [flags]\\n\\nFlags:\\n${rows.join('\\n')}`;\n }\n\n /**\n * Pure argv classifier. No args → ok. `--help`/`-h` → not-ok, exit 0 with the usage block. Any token\n * the command did not DECLARE → not-ok, exit 2 naming the offending one(s). Split out from\n * `assertNoArgs`/`parse` so the decision is unit-testable without a thrown exception.\n *\n * An undeclared token is still fatal even for a command that accepts flags — a mistyped `--no-optionl`\n * must never be silently ignored and then run the flow WITH the reviews the caller meant to skip.\n */\n classify(args: string[], usage: CliUsage): CliArgsCheck {\n if (args.length === 0) return new CliArgsCheck(true, 0, '');\n if (args.includes('--help') || args.includes('-h')) {\n return new CliArgsCheck(false, 0, this.usageText(usage));\n }\n const scan = this.scan(args, usage);\n if (scan.unknown.length > 0) {\n return new CliArgsCheck(false, 2, `❌ Unknown argument(s): ${scan.unknown.join(' ')}\\n\\n` + this.usageText(usage));\n }\n return new CliArgsCheck(true, 0, '');\n }\n\n /**\n * Walk argv once, classifying every token as a declared flag, a value belonging to the\n * value-taking flag before it, or unknown. ONE walk backs both `classify` and `parse` so the set of\n * tokens the guard accepts and the set `parse` reports can never diverge — an accepted-but-unreported\n * flag would silently run the flow without the behaviour the caller asked for.\n */\n private scan(args: string[], usage: CliUsage): CliScan {\n const byName = new Map<string, CliFlag>();\n for (const flag of usage.flags) byName.set(flag.name, flag);\n const scan = new CliScan();\n for (let i = 0; i < args.length; i += 1) {\n const token = args[i];\n const eq = token.indexOf('=');\n // `--flag=value` — split before lookup so the name is what gets matched, not the whole token.\n const name = eq > 0 ? token.slice(0, eq) : token;\n const flag = byName.get(name);\n if (flag === undefined) {\n scan.unknown.push(token);\n continue;\n }\n scan.present.push(name);\n if (!flag.takesValue) {\n // `--dry-run=x` is a typo, not an accepted flag: the value would be silently dropped.\n if (eq > 0) scan.unknown.push(token);\n continue;\n }\n if (eq > 0) {\n scan.values.set(name, token.slice(eq + 1));\n continue;\n }\n // OPTIONAL value: only a following token that is not itself a flag. `--resolve --force`\n // therefore reads as two flags, not as a resolve of a branch literally named `--force`.\n const next = i + 1 < args.length ? args[i + 1] : '';\n if (next !== '' && !next.startsWith('-')) {\n scan.values.set(name, next);\n i += 1;\n }\n }\n return scan;\n }\n\n /**\n * The flag-accepting sibling of {@link assertNoArgs}: same guard, but it RETURNS which declared flags\n * were passed. Call it in exactly the same place — first thing inside `runMain`, before the app touches\n * git.\n */\n parse(usage: CliUsage): CliArgSet {\n const args = process.argv.slice(2);\n const check = this.classify(args, usage);\n if (!check.ok) throw new CliExitError(check.exitCode, check.message);\n const scan = this.scan(args, usage);\n return new CliArgSet(scan.present, scan.values);\n }\n\n /**\n * Call it as the FIRST thing inside `runMain`, BEFORE the app touches git — a bogus flag must\n * never start a mutation flow (the `wp-start-upsert-pr --help` incident: an ignored flag silently\n * launched the squash-merge and stranded the checkout on a `…PreMerge<n>` branch).\n *\n * Throws `CliExitError` (never `process.exit`) so `runMain` stays the single sanctioned exit site\n * (`no-process-exit-outside-main`): help exits 0, an unknown arg exits 2, and in both cases the\n * flow never begins.\n */\n assertNoArgs(usage: CliUsage): void {\n const check = this.classify(process.argv.slice(2), usage);\n if (check.ok) return;\n throw new CliExitError(check.exitCode, check.message);\n }\n}\n"]}
|
package/src/constants.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export declare const RULE_NAMES: {
|
|
|
30
30
|
readonly ONE_ENUM_SPELLING_IN_API_LIB: "one-enum-spelling-in-api-lib";
|
|
31
31
|
readonly NO_UTILITY_TYPES_IN_API_LIB: "no-utility-types-in-api-lib";
|
|
32
32
|
readonly REQUIRED_TYPE_SUFFIX: "required-type-suffix";
|
|
33
|
+
readonly API_LIB_DEPENDENCIES: "api-lib-dependencies";
|
|
34
|
+
readonly API_LIB_PATH: "api-lib-path";
|
|
35
|
+
readonly FRAMEWORK_FOLDER: "framework-folder";
|
|
36
|
+
readonly FRAMEWORK_TSCONFIG: "framework-tsconfig";
|
|
37
|
+
readonly FRAMEWORK_PACKAGES: "framework-packages";
|
|
33
38
|
};
|
|
34
39
|
export declare const WEBPIECES_TMP_DIR = ".webpieces";
|
|
35
40
|
export declare const MERGE_INFO_DIR = "merge-info";
|
package/src/constants.js
CHANGED
|
@@ -44,6 +44,11 @@ exports.RULE_NAMES = {
|
|
|
44
44
|
ONE_ENUM_SPELLING_IN_API_LIB: 'one-enum-spelling-in-api-lib',
|
|
45
45
|
NO_UTILITY_TYPES_IN_API_LIB: 'no-utility-types-in-api-lib',
|
|
46
46
|
REQUIRED_TYPE_SUFFIX: 'required-type-suffix',
|
|
47
|
+
API_LIB_DEPENDENCIES: 'api-lib-dependencies',
|
|
48
|
+
API_LIB_PATH: 'api-lib-path',
|
|
49
|
+
FRAMEWORK_FOLDER: 'framework-folder',
|
|
50
|
+
FRAMEWORK_TSCONFIG: 'framework-tsconfig',
|
|
51
|
+
FRAMEWORK_PACKAGES: 'framework-packages',
|
|
47
52
|
};
|
|
48
53
|
// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a
|
|
49
54
|
// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it
|
package/src/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/constants.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,yFAAyF;AACzF,qFAAqF;AACrF,kFAAkF;;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/constants.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,yFAAyF;AACzF,qFAAqF;AACrF,kFAAkF;;;AAoHlF,gCAEC;AApHY,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,kFAAkF;AAClF,uFAAuF;AACvF,uEAAuE;AACvE,sFAAsF;AACzE,QAAA,UAAU,GAAG;IACtB,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,uBAAuB,EAAE,yBAAyB;IAClD,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,2C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F,qGAAqG;AACrG,8FAA8F;AAC9F,2DAA2D;AAC3D,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,oGAAoG;AACpG,kGAAkG;AACrF,QAAA,mBAAmB,GAAG,2BAA2B,CAAC;AAE/D,2FAA2F;AAC3F,mFAAmF;AACnF,uFAAuF;AACvF,uGAAuG;AACvG,kGAAkG;AAClG,kGAAkG;AAClG,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;;;;;;;;GASG;AACU,QAAA,qBAAqB,GAAG,8BAA8B,CAAC;AAEpE;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,QAAgB;IACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAiB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// Single source of truth for the disable-comment token and rule-name identifiers\n// shared across rules-config, ai-hook-rules, code-rules, and pr-gate.\n//\n// There is exactly ONE disable form: `// webpieces-disable <rule>[, <rule2>] -- reason`.\n// The legacy `ai-hook-disable` alias and the `-file`/`-next`/`-all` variants and the\n// `*`/bare (no-rule) wildcard have been removed — every disable MUST name a rule.\n\nexport const WEBPIECES_DISABLE = 'webpieces-disable';\n\n// Rule-name tokens as they appear AFTER `webpieces-disable` in a disable comment.\n// Values must match existing comments exactly — changing a value silently breaks every\n// disable that names that rule. Note MAX_LINES_MODIFIED is a prefix of\n// MAX_LINES_MODIFIED_FILES (a historical substring-match quirk preserved on purpose).\nexport const RULE_NAMES = {\n NO_ANY_UNKNOWN: 'no-any-unknown',\n NO_IMPLICIT_ANY: 'no-implicit-any',\n NO_DESTRUCTURE: 'no-destructure',\n NO_UNMANAGED_EXCEPTIONS: 'no-unmanaged-exceptions',\n CATCH_ERROR_PATTERN: 'catch-error-pattern',\n THROW_CAUSE_REQUIRED: 'throw-cause-required',\n REQUIRE_RETURN_TYPE: 'require-return-type',\n NO_SYMBOL_DI_TOKENS: 'no-symbol-di-tokens',\n NO_CLIENT_CREATION_OUTSIDE_SERVER_OR_CLIENT: 'no-client-creation-outside-server-or-client',\n NO_PROCESS_EXIT_OUTSIDE_MAIN: 'no-process-exit-outside-main',\n NO_FUNCTION_OUTSIDE_CLASS: 'no-function-outside-class',\n INJECT_ANNOTATION_NOT_NEEDED_FOR_CONCRETE_CLASS:\n 'inject-annotation-not-needed-for-concrete-class',\n FRAMEWORK_TAG: 'framework-tag',\n ROLE_TAG: 'role-tag',\n ENSURE_WE_ARE_SECURE: 'ensure-we-are-secure',\n NO_INLINE_TYPES: 'no-inline-types',\n NO_DIRECT_API_RESOLVER: 'no-direct-api-resolver',\n NO_CUSTOM_CSS: 'no-custom-css',\n NO_STATE_PATHS_IN_TEMPLATES: 'no-state-paths-in-templates',\n PRISMA_CONVERTER: 'prisma-converter',\n MAX_LINES_NEW_METHODS: 'max-lines-new-methods',\n MAX_LINES_MODIFIED_FILES: 'max-lines-modified-files',\n MAX_LINES_MODIFIED: 'max-lines-modified',\n NO_ROOT_UNION_API_TYPE: 'no-root-union-api-type',\n API_RULES_FOR_OPENAPI: 'api-rules-for-openapi',\n API_RULES_FOR_MCP: 'api-rules-for-mcp',\n NO_INLINE_IMPORT_IN_API_LIB: 'no-inline-import-in-api-lib',\n ONE_ENUM_SPELLING_IN_API_LIB: 'one-enum-spelling-in-api-lib',\n NO_UTILITY_TYPES_IN_API_LIB: 'no-utility-types-in-api-lib',\n REQUIRED_TYPE_SUFFIX: 'required-type-suffix',\n API_LIB_DEPENDENCIES: 'api-lib-dependencies',\n API_LIB_PATH: 'api-lib-path',\n FRAMEWORK_FOLDER: 'framework-folder',\n FRAMEWORK_TSCONFIG: 'framework-tsconfig',\n FRAMEWORK_PACKAGES: 'framework-packages',\n} as const;\n\n// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a\n// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it\n// to block commit/push/PR until the merge is validated). Kept here so neither package\n// depends on the other — they only share this vocabulary.\n//\n// `.webpieces/` is the single working dir for all webpieces tooling: ai-hook-rules\n// bootstrap/cache, the instruct-ai docs, and the workflow state. To keep the top level\n// quiet, per-feature workflow dirs are nested one level down under `merge-info/<feature>`\n// and `pr-review/<feature>` rather than scattered as top-level `merge-<feature>`/`pr-<feature>`.\n// `.webpieces/` is gitignored; only the per-feature subdirs under those two homes are subject\n// to 30-day cleanup (the homes themselves, like hooks/ and instruct-ai/, are permanent).\n// The DIRECTORY NAME only. Never join it onto a root yourself — go through `DotWebpieces.shared()`\n// (repo-wide state), `DotWebpieces.local()` (this worktree's own tooling-written state) or\n// `DotWebpieces.aiWritable()` (this worktree's state that a CODING AGENT writes) so the call site\n// declares its scope. In a linked worktree the three resolve to different places, and getting that\n// silently wrong is the bug those methods exist to prevent.\nexport const WEBPIECES_TMP_DIR = '.webpieces';\nexport const MERGE_INFO_DIR = 'merge-info';\n// The PR working home. Renamed from the legacy `pr-info` to `pr-review` for clarity (it holds the\n// AI's PR review + rendered body). Old `pr-info/` dirs are gitignored local state and self-clear via\n// cleanTmp's legacy `pr-` sweep.\nexport const PR_REVIEW_DIR = 'pr-review';\nexport const MERGE_IN_PROGRESS_FILE = 'merge-in-progress.json';\n\n// The dev-deploy resolve state file, written by `wp-push-dev --resolve` and cleared by\n// `wp-finish-push-dev` (or `--abort`). Named here for the same reason MERGE_IN_PROGRESS_FILE is: the\n// pr-gate commands WRITE it and things outside pr-gate READ it to decide whether a resolve is\n// half-finished, and neither side may depend on the other.\n//\n// It lives directly under `.webpieces/` local state (NOT under merge-info/), because a dev-deploy\n// resolve is not a 3-point merge: it never touches the feature branch, never produces merge-info\n// context, and must NOT be picked up by merge-in-progress-guard's marker scan — that guard's remedy\n// is `pnpm wp-finish-upsert-pr`, which is the wrong command here and would strand the tmp branch.\nexport const PUSH_DEV_STATE_FILE = 'push-dev-in-progress.json';\n\n// Proof-of-work the AI must produce for every conflicted file it resolves during a 3-point\n// merge: a short explanation written NEXT TO that file's 3-point context (the same\n// `updatemain-<safe_path>/` dir that holds A-forkpoint.txt / B-A.diff / C-A.diff). The\n// wp-finish-upsert-pr gate requires a non-empty file of this name per conflicted file before passing —\n// it is the only check on the part of the process the AI actually owns (resolving files). Using a\n// sidecar file (rather than an in-source comment) works for any file type, including comment-less\n// ones like JSON and files resolved by deletion.\nexport const MERGE_EXPLANATION_FILE = 'merge-explanation.md';\n\n/**\n * The command that MECHANICALLY strips every unknown key from webpieces.config.json.\n *\n * An unknown key controls nothing, so deleting it is the cure — but \"delete it\" is a judgement call made\n * while the guard denies every Bash call, which is exactly when a reader is least able to make one. This\n * command turns that judgement into one keystroke, and every message that reports an unknown key names it.\n *\n * Lives in this leaf module (no imports) so both the banner and the validators can name it without\n * importing the pruner and re-creating an import cycle.\n */\nexport const PRUNE_UNKNOWN_COMMAND = 'pnpm wp-prune-unknown-config';\n\n/**\n * The command that rewrites every webpieces-owned file a repo commits — the L0 hook shim and the generic\n * reviewer agent (`.claude/agents/webpieces-reviewer.md`). Named here, in the leaf module, so the config\n * validator that finds that agent missing can print the cure without importing ai-hook-rules.\n */\nexport const UPGRADE_SHIM_COMMAND = 'pnpm wp-upgrade-shim';\n\n/**\n * Fast predicate: does this text carry a webpieces-disable for the given rule?\n * Line-agnostic — the caller decides which line(s) or block of text to feed it.\n * This is the cheap substring form used by code-rules detection and pr-gate's\n * dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)\n */\nexport function hasDisable(text: string, ruleName: string): boolean {\n return text.includes(WEBPIECES_DISABLE) && text.includes(ruleName);\n}\n"]}
|
package/src/default-rules.js
CHANGED
|
@@ -64,10 +64,10 @@ exports.defaultRules = {
|
|
|
64
64
|
'no-process-exit-outside-main': {},
|
|
65
65
|
'inject-annotation-not-needed-for-concrete-class': {},
|
|
66
66
|
'framework-tag': {
|
|
67
|
-
knownTypes: ['browser', 'react', 'angular', 'node', 'express'],
|
|
67
|
+
knownTypes: ['browser', 'react', 'angular', 'node', 'express', 'react-native'],
|
|
68
68
|
},
|
|
69
69
|
'role-tag': {
|
|
70
|
-
knownTypes: ['server', 'app', 'designed-lib', 'lib', 'client', 'api-lib'],
|
|
70
|
+
knownTypes: ['server', 'app', 'bundle', 'designed-lib', 'lib', 'client', 'api-lib', 'api-client'],
|
|
71
71
|
},
|
|
72
72
|
'ensure-we-are-secure': {},
|
|
73
73
|
'nx-wiring': {},
|
|
@@ -97,6 +97,14 @@ exports.defaultRules = {
|
|
|
97
97
|
// #1037: REQUIRES `mode` and `entries` — no entry here may carry either. A new key the
|
|
98
98
|
// one-release-behind validator does not know yet, so THIS repo's config states it after publish.
|
|
99
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': {},
|
|
100
108
|
'branch-creation-guard': {},
|
|
101
109
|
'pr-lifecycle-guard': {},
|
|
102
110
|
// NOTE: `whole-repo-build-guard` is deliberately ABSENT from this table, and from RULE_SCHEMAS and
|
package/src/default-rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CAAC;
|
|
1
|
+
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,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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
CHANGED
|
@@ -13,6 +13,8 @@ export declare class FieldDef {
|
|
|
13
13
|
static nullableString(): FieldDef;
|
|
14
14
|
/** A REQUIRED `string[]` that must hold at least one string. */
|
|
15
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;
|
|
16
18
|
/** A REQUIRED, non-empty list of objects, each validated against `elementSchema`. */
|
|
17
19
|
static nonEmptyObjects(elementSchema: Readonly<Record<string, FieldDef>>): FieldDef;
|
|
18
20
|
}
|
package/src/field-def.js
CHANGED
|
@@ -44,6 +44,11 @@ class FieldDef {
|
|
|
44
44
|
static nonEmptyStrings() {
|
|
45
45
|
return new FieldDef('string[]', undefined, false, false, true);
|
|
46
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
|
+
}
|
|
47
52
|
/** A REQUIRED, non-empty list of objects, each validated against `elementSchema`. */
|
|
48
53
|
// webpieces-disable no-function-outside-class -- static factory, matches sibling FieldDef.optional
|
|
49
54
|
static nonEmptyObjects(elementSchema) {
|
package/src/field-def.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CA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E,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"]}
|
package/src/index.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ export { NoRootUnionApiTypeConfig } from './no-root-union-config';
|
|
|
57
57
|
export { NoInlineImportInApiLibConfig, OneEnumSpellingInApiLibConfig } from './api-lib-spelling-configs';
|
|
58
58
|
export { NoUtilityTypesInApiLibConfig } from './no-utility-types-config';
|
|
59
59
|
export { RequiredTypeSuffixConfig, RequiredTypeSuffixEntry } from './required-type-suffix-config';
|
|
60
|
+
export { ApiClientPackagesEntry, ApiLibDependenciesConfig, ApiLibPathConfig, FrameworkFolderConfig, FrameworkFolderEntry, FrameworkPackagesConfig, FrameworkPackagesEntry, FrameworkTsconfigConfig, PROJECT_SCAN_MODES, } from './tag-truth-configs';
|
|
61
|
+
export type { ProjectScanMode } from './tag-truth-configs';
|
|
60
62
|
export { ApiRulesForMcpConfig, ApiRulesForOpenApiConfig, API_DOC_MODES } from './api-doc-rules-config';
|
|
61
63
|
export type { ApiDocMode } from './api-doc-rules-config';
|
|
62
64
|
export { METHOD_LIMIT_MODES, FILE_LIMIT_MODES, RETURN_TYPE_MODES, INLINE_TYPE_MODES, MODIFIED_CODE_MODES, PROJECT_MODES, PRISMA_DTOS_MODES, PRISMA_CONVERTER_MODES, DIRECT_API_RESOLVER_MODES, THROW_CAUSE_MODES, ON_OFF_MODES, STRUCTURAL_MODES, VALIDATE_TS_MODES, } from './rule-configs';
|
package/src/index.js
CHANGED
|
@@ -4,11 +4,11 @@ exports.RulesConfigDesign = exports.atRoot = exports.AtomicFile = exports.CLAUDE
|
|
|
4
4
|
exports.ConfigPruner = exports.retiredRuleFor = exports.retiredKeyErrorsIn = exports.retiredKeyError = exports.retiredEntry = exports.isRetiredKey = exports.RetiredConfigKey = exports.RETIRED_SCOPE_RULE = exports.RETIRED_SCOPE_KEY = exports.RETIRED_CONFIG_KEYS = exports.COMMENT_KEY_SUFFIX = exports.validateTopLevelKeys = exports.isCommentKey = exports.unknownKeyErrors = exports.validateCommandsSection = exports.seedEntryForRule = exports.recommendedSeedModeFor = exports.recommendedSeedMode = exports.allRuleNames = exports.validateMatchRulesSection = exports.validateExcludePaths = exports.validateSectionPlacement = exports.validateChecklistsSection = exports.validatePrGateSection = exports.validateWebpiecesConfig = exports.BUILD_LOG_DOC = exports.ReferenceMergeRun = exports.MergeRun = exports.MergeProcessText = exports.MERGE_PROCESS_DOC = exports.MergeProcessDoc = exports.InstructAiDocSet = exports.InstructAiDoc = exports.GitWorkflowDoc = exports.GIT_WORKFLOW_DOC = exports.TemplateWriter = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.NoCustomCssScope = exports.GENERATED_CODE_PATHS = exports.matchesAnyGlob = exports.isPathExcluded = exports.isWebpiecesStateDir = exports.ExcludePaths = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = void 0;
|
|
5
5
|
exports.schemaFieldNames = exports.DEFAULT_MATCH_RULES = exports.renderMatchRuleMessage = exports.compileMatchRulePatterns = exports.isMatchRuleAllowedPath = exports.findMatchRuleViolations = exports.MatchRuleViolation = exports.MatchRuleConfig = exports.OrphanSweepReport = exports.OrphanDirSweeper = exports.TRASH_RETENTION_DAYS = exports.TRASH_MANIFEST_FILE = exports.TRASH_STATE_DIR = exports.OrphanSweepManifest = exports.OrphanSweepResult = exports.FailedOrphan = exports.ArchivedOrphan = exports.OrphanDirArchiver = exports.OrphanCandidate = exports.OrphanDirScanner = exports.MAX_ROW_BYTES = exports.BUILDS_LOG_GENERATIONS = exports.MAX_BUILDS_LOG_BYTES = exports.BUILD_DONE_FAIL = exports.BUILD_DONE_SUCCESS = exports.BUILD_START = exports.BUILDS_LOCK_FILE = exports.BUILDS_LOG_FILE = exports.RunningBuild = exports.BuildTermination = exports.BuildTicket = exports.BuildsLog = exports.DOCUMENTATION_KEYS = exports.HOME_KEY_AI_DOC = exports.HOME_KEY_DOC = exports.DEFAULT_MAX_CONCURRENT_BUILDS = exports.HOME_KEY_TURN_OFF_ALL_REVIEWERS = exports.HOME_KEY_MAX_CONCURRENT_BUILDS = exports.HOME_KEY_WHOLE_REPO_BUILD_GUARD = exports.HOME_KEY_ORPHAN_DIR_SWEEP = exports.HOME_EXPERIMENTAL_SECTION = exports.HOME_CONFIG_FILE = exports.HOME_CONFIG_DIR = exports.RETIRED_HOME_CONFIG_KEYS = exports.RetiredHomeConfigKey = exports.HomeConfigService = exports.HomeConfig = exports.validateChecklistDocs = exports.PrunedKey = exports.PruneResult = void 0;
|
|
6
6
|
exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WP_FINISH_PUSH_DEV = exports.WP_PUSH_DEV = exports.WP_FINISH_UPSERT_PR = exports.WP_START_UPSERT_PR = exports.WP_FINISH_UPDATE = exports.WP_START_UPDATE = exports.SyncFlowGuidance = exports.WebpiecesRulesConfig = exports.UPGRADE_SHIM_COMMAND = exports.PRUNE_UNKNOWN_COMMAND = exports.PUSH_DEV_STATE_FILE = exports.MERGE_EXPLANATION_FILE = exports.MERGE_IN_PROGRESS_FILE = exports.PR_REVIEW_DIR = exports.MERGE_INFO_DIR = exports.WEBPIECES_TMP_DIR = exports.hasDisable = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = exports.AbstractRule = exports.ChangedFilesOptions = exports.DiffRange = exports.DiffScope = exports.isNewOrModified = exports.hasChangesInRange = exports.findNewMethodSignaturesInDiff = exports.getChangedLineNumbers = exports.getFileDiff = exports.getChangedFiles = exports.resolveBase = exports.detectBase = exports.SkipRuleResult = exports.HOTFIX_AUDIT_BANNER = exports.HOTFIX_BUILD_COMMAND = exports.HOTFIX_BRANCH_SEGMENT = exports.BranchIdentity = exports.shouldSkipRule = exports.FieldDef = exports.sectionForRule = exports.isHookGuard = exports.PR_LIFECYCLE_GUARD_KEY = exports.BRANCH_STATE_GUARD_KEY = exports.HOOK_GUARD_NAMES = exports.RULE_SCHEMAS = void 0;
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.TMP_SCRATCH_PREFIX = exports.TMP_SCRATCH_RETENTION_DAYS = exports.TmpScratchSweeper = exports.SCRATCH_DIR_NAME = exports.RepoScratchDirs = exports.specTempDirs = exports.SpecTempDirs = exports.staleBinSweeper = exports.StaleBinSweeper = exports.StaleBinRemoval = exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.HarnessAgentActivityReader = exports.AgentActivity = exports.AGENT_TRANSCRIPT_QUIET_MS = exports.AGENT_ACTIVITY_UNKNOWN = exports.AGENT_ACTIVITY_RETURNED = exports.AGENT_ACTIVITY_LIVE = exports.WorktreeLockVerdicts = exports.LockEvidence = exports.LockDecision = exports.LOCK_LIVENESS_UNVERIFIABLE = exports.HARNESS_NOT_CONSULTED = exports.AgentWorktreeLockReader = exports.AgentWorktreeLock = exports.WorktreeService = exports.WorktreeWorkInFlight = exports.Worktree = void 0;
|
|
7
|
+
exports.RETURN_TYPE_MODES = exports.FILE_LIMIT_MODES = exports.METHOD_LIMIT_MODES = exports.API_DOC_MODES = exports.ApiRulesForOpenApiConfig = exports.ApiRulesForMcpConfig = exports.PROJECT_SCAN_MODES = exports.FrameworkTsconfigConfig = exports.FrameworkPackagesEntry = exports.FrameworkPackagesConfig = exports.FrameworkFolderEntry = exports.FrameworkFolderConfig = exports.ApiLibPathConfig = exports.ApiLibDependenciesConfig = exports.ApiClientPackagesEntry = exports.RequiredTypeSuffixEntry = exports.RequiredTypeSuffixConfig = exports.NoUtilityTypesInApiLibConfig = exports.OneEnumSpellingInApiLibConfig = exports.NoInlineImportInApiLibConfig = exports.NoRootUnionApiTypeConfig = exports.BaseRuleConfig = exports.ValidateEslintSyncConfig = exports.ValidateVersionsLockedConfig = exports.ValidatePackageJsonConfig = exports.ValidateNoArchitectureCyclesConfig = exports.ValidateArchitectureUnchangedConfig = exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.DiGraphConfig = exports.NxWiringConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.PrLifecycleGuardConfig = exports.BranchCreationGuardConfig = exports.EnsureWeAreSecureConfig = exports.RoleTagConfig = exports.FrameworkTagConfig = exports.InjectAnnotationNotNeededForConcreteClassConfig = exports.NoFunctionOutsideClassConfig = exports.NoProcessExitOutsideMainConfig = exports.NoCustomCssConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = void 0;
|
|
8
|
+
exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ContextEntry = exports.BriefedFile = exports.ReviewerBriefing = exports.ReviewerInstructionsService = exports.ChecklistInstructionsService = exports.ChecklistValidator = exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.DEFAULT_REVIEWER_AGENT_NAME = exports.REVIEWER_AGENTS_PLACEHOLDER = exports.ReviewerAgentPolicy = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildDevDeployConfig = exports.buildLandPrConfig = exports.buildPrGateConfig = exports.defaultDevDeployConfig = exports.defaultLandPrConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.ReviewContextEntry = exports.DEFAULT_DEV_BRANCH = exports.DEFAULT_DEV_BRANCH_NAMESPACE = exports.DevDeployConfig = exports.LandPrConfig = exports.DEFAULT_BUILD_COMMAND = exports.PrGateConfig = exports.GateDefinition = exports.DEFAULT_MAX_COMMITS_BEHIND = exports.BranchStateGuardConfig = exports.DEFAULT_BANNED_STATE_PATH_PREFIXES = exports.DEFAULT_TEMPLATE_DIRS = exports.NoStatePathsInTemplatesConfig = exports.CLIENT_CREATION_SEVERITIES = exports.NoClientCreationOutsideServerOrClientConfig = exports.VALIDATE_TS_MODES = exports.STRUCTURAL_MODES = exports.ON_OFF_MODES = exports.THROW_CAUSE_MODES = exports.DIRECT_API_RESOLVER_MODES = exports.PRISMA_CONVERTER_MODES = exports.PRISMA_DTOS_MODES = exports.PROJECT_MODES = exports.MODIFIED_CODE_MODES = exports.INLINE_TYPE_MODES = void 0;
|
|
9
|
+
exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = exports.ChecklistVerdict = exports.ChecklistResult = exports.PrContext = exports.PrSummary = exports.DEFAULT_RETENTION_DAYS = exports.ProvenanceWriteRequest = exports.OfferedContext = exports.ReviewerPaths = exports.ReviewerTranscript = exports.ReviewProvenance = exports.ReviewProvenanceService = exports.REVIEW_STAMP_MAX_AGE_MS = exports.REVIEW_STAMP_DIR = exports.WRITE_REVIEW_CHECKLIST_FLAG = exports.WRITE_REVIEW_BIN = exports.reviewIdentityStamps = exports.ReviewIdentityStampService = exports.ReviewIdentityStamp = exports.claudeConfigDir = exports.ClaudeConfigDir = exports.CLAUDE_CONFIG_DIR_ENV = exports.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.TranscriptScan = exports.ExpectedReviewer = exports.ReviewerContext = exports.ReviewerEvidence = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = exports.GateTokenService = void 0;
|
|
10
|
+
exports.CLASSIFICATION_CURRENT = exports.CLASSIFICATION_LOCKED = exports.CLASSIFICATION_PRUNABLE = exports.CLASSIFICATION_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_LIVE = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.CACHE_STALE_AFTER_MS = exports.CacheFreshness = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = exports.squashRecoverySteps = exports.stampCleanMainSyncStatus = exports.computeMainSyncStatus = exports.finishedLock = exports.inProcessLock = exports.tryAcquireMainSyncLock = exports.isRefreshInProgress = exports.isLockStale = exports.writeMainSyncLock = exports.readMainSyncLock = exports.computeAllMainSyncStatuses = exports.writeMainSyncStatusFile = exports.writeMainSyncStatus = exports.readMainSyncStatusFile = exports.readMainSyncStatus = exports.mainSyncLockPath = exports.mainSyncStatusPath = exports.DEFAULT_HANG_TIMEOUT_MINUTES = exports.MainSyncStatusService = exports.MainSyncLock = exports.MAIN_SYNC_STATUS_VERSION = exports.PullRequestIndex = exports.MainSyncFileStore = exports.MainSyncStatusFile = exports.MainSyncStatus = exports.summaryJsonSchemaHint = exports.summaryJsonPath = exports.prDirFor = exports.ReviewJsonService = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.VERDICT_STATUSES = void 0;
|
|
11
|
+
exports.TMP_SCRATCH_PREFIX = exports.TMP_SCRATCH_RETENTION_DAYS = exports.TmpScratchSweeper = exports.SCRATCH_DIR_NAME = exports.RepoScratchDirs = exports.specTempDirs = exports.SpecTempDirs = exports.staleBinSweeper = exports.StaleBinSweeper = exports.StaleBinRemoval = exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.HarnessAgentActivityReader = exports.AgentActivity = exports.AGENT_TRANSCRIPT_QUIET_MS = exports.AGENT_ACTIVITY_UNKNOWN = exports.AGENT_ACTIVITY_RETURNED = exports.AGENT_ACTIVITY_LIVE = exports.WorktreeLockVerdicts = exports.LockEvidence = exports.LockDecision = exports.LOCK_LIVENESS_UNVERIFIABLE = exports.HARNESS_NOT_CONSULTED = exports.AgentWorktreeLockReader = exports.AgentWorktreeLock = exports.WorktreeService = exports.WorktreeWorkInFlight = exports.Worktree = exports.BRANCH_RETENTION_KEEP = exports.BRANCH_RETENTION_ARCHIVE_TAG = exports.BRANCH_RETENTION_DELETE = exports.BRANCH_RETENTIONS = exports.ARCHIVE_TAG_PREFIX = exports.ArchiveResult = exports.BranchArchiver = exports.ADJUDICATED_CLASSIFICATIONS = exports.CLASSIFICATION_DETACHED = void 0;
|
|
12
12
|
var types_1 = require("./types");
|
|
13
13
|
Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
|
|
14
14
|
Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
|
|
@@ -342,6 +342,16 @@ Object.defineProperty(exports, "NoUtilityTypesInApiLibConfig", { enumerable: tru
|
|
|
342
342
|
var required_type_suffix_config_1 = require("./required-type-suffix-config");
|
|
343
343
|
Object.defineProperty(exports, "RequiredTypeSuffixConfig", { enumerable: true, get: function () { return required_type_suffix_config_1.RequiredTypeSuffixConfig; } });
|
|
344
344
|
Object.defineProperty(exports, "RequiredTypeSuffixEntry", { enumerable: true, get: function () { return required_type_suffix_config_1.RequiredTypeSuffixEntry; } });
|
|
345
|
+
var tag_truth_configs_1 = require("./tag-truth-configs");
|
|
346
|
+
Object.defineProperty(exports, "ApiClientPackagesEntry", { enumerable: true, get: function () { return tag_truth_configs_1.ApiClientPackagesEntry; } });
|
|
347
|
+
Object.defineProperty(exports, "ApiLibDependenciesConfig", { enumerable: true, get: function () { return tag_truth_configs_1.ApiLibDependenciesConfig; } });
|
|
348
|
+
Object.defineProperty(exports, "ApiLibPathConfig", { enumerable: true, get: function () { return tag_truth_configs_1.ApiLibPathConfig; } });
|
|
349
|
+
Object.defineProperty(exports, "FrameworkFolderConfig", { enumerable: true, get: function () { return tag_truth_configs_1.FrameworkFolderConfig; } });
|
|
350
|
+
Object.defineProperty(exports, "FrameworkFolderEntry", { enumerable: true, get: function () { return tag_truth_configs_1.FrameworkFolderEntry; } });
|
|
351
|
+
Object.defineProperty(exports, "FrameworkPackagesConfig", { enumerable: true, get: function () { return tag_truth_configs_1.FrameworkPackagesConfig; } });
|
|
352
|
+
Object.defineProperty(exports, "FrameworkPackagesEntry", { enumerable: true, get: function () { return tag_truth_configs_1.FrameworkPackagesEntry; } });
|
|
353
|
+
Object.defineProperty(exports, "FrameworkTsconfigConfig", { enumerable: true, get: function () { return tag_truth_configs_1.FrameworkTsconfigConfig; } });
|
|
354
|
+
Object.defineProperty(exports, "PROJECT_SCAN_MODES", { enumerable: true, get: function () { return tag_truth_configs_1.PROJECT_SCAN_MODES; } });
|
|
345
355
|
var api_doc_rules_config_1 = require("./api-doc-rules-config");
|
|
346
356
|
Object.defineProperty(exports, "ApiRulesForMcpConfig", { enumerable: true, get: function () { return api_doc_rules_config_1.ApiRulesForMcpConfig; } });
|
|
347
357
|
Object.defineProperty(exports, "ApiRulesForOpenApiConfig", { enumerable: true, get: function () { return api_doc_rules_config_1.ApiRulesForOpenApiConfig; } });
|