@webpieces/rules-config 0.4.843 → 0.4.845
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -4
- package/src/WebpiecesRulesConfig.d.ts +3 -49
- package/src/WebpiecesRulesConfig.js +1 -44
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/abstract-rule.d.ts +1 -1
- package/src/abstract-rule.js.map +1 -1
- package/src/config-pruner.d.ts +3 -1
- package/src/config-pruner.js +13 -9
- package/src/config-pruner.js.map +1 -1
- package/src/constants.d.ts +0 -37
- package/src/constants.js +1 -38
- package/src/constants.js.map +1 -1
- package/src/index.d.ts +7 -24
- package/src/index.js +14 -105
- package/src/index.js.map +1 -1
- package/src/load-config.d.ts +6 -2
- package/src/load-config.js +17 -11
- package/src/load-config.js.map +1 -1
- package/src/match-rules-config.d.ts +2 -1
- package/src/match-rules-config.js +2 -2
- package/src/match-rules-config.js.map +1 -1
- package/src/no-custom-css-scope.d.ts +9 -25
- package/src/no-custom-css-scope.js +10 -24
- package/src/no-custom-css-scope.js.map +1 -1
- package/src/retired-config-keys.d.ts +3 -64
- package/src/retired-config-keys.js +14 -152
- package/src/retired-config-keys.js.map +1 -1
- package/src/rule-pack-registry.d.ts +41 -0
- package/src/rule-pack-registry.js +231 -0
- package/src/rule-pack-registry.js.map +1 -0
- package/src/rule-pack-selection.d.ts +6 -0
- package/src/rule-pack-selection.js +50 -0
- package/src/rule-pack-selection.js.map +1 -0
- package/src/rule-schemas.d.ts +4 -14
- package/src/rule-schemas.js +6 -92
- package/src/rule-schemas.js.map +1 -1
- package/src/sections.d.ts +5 -46
- package/src/sections.js +5 -56
- package/src/sections.js.map +1 -1
- package/src/seed-entry.d.ts +5 -16
- package/src/seed-entry.js +14 -141
- package/src/seed-entry.js.map +1 -1
- package/src/validate-config.d.ts +3 -2
- package/src/validate-config.js +62 -73
- package/src/validate-config.js.map +1 -1
- package/templates/webpieces.branch-state-matrix.md +1 -1
- package/src/api-doc-rules-config.d.ts +0 -60
- package/src/api-doc-rules-config.js +0 -71
- package/src/api-doc-rules-config.js.map +0 -1
- package/src/api-lib-spelling-configs.d.ts +0 -40
- package/src/api-lib-spelling-configs.js +0 -52
- package/src/api-lib-spelling-configs.js.map +0 -1
- package/src/default-rules.d.ts +0 -2
- package/src/default-rules.js +0 -119
- package/src/default-rules.js.map +0 -1
- package/src/field-def.d.ts +0 -24
- package/src/field-def.js +0 -59
- package/src/field-def.js.map +0 -1
- package/src/main-sync-guard-configs.d.ts +0 -38
- package/src/main-sync-guard-configs.js +0 -54
- package/src/main-sync-guard-configs.js.map +0 -1
- package/src/no-client-creation-config.d.ts +0 -12
- package/src/no-client-creation-config.js +0 -40
- package/src/no-client-creation-config.js.map +0 -1
- package/src/no-root-union-config.d.ts +0 -25
- package/src/no-root-union-config.js +0 -33
- package/src/no-root-union-config.js.map +0 -1
- package/src/no-state-paths-config.d.ts +0 -41
- package/src/no-state-paths-config.js +0 -51
- package/src/no-state-paths-config.js.map +0 -1
- package/src/no-utility-types-config.d.ts +0 -30
- package/src/no-utility-types-config.js +0 -39
- package/src/no-utility-types-config.js.map +0 -1
- package/src/required-type-suffix-config.d.ts +0 -49
- package/src/required-type-suffix-config.js +0 -62
- package/src/required-type-suffix-config.js.map +0 -1
- package/src/rule-configs.d.ts +0 -273
- package/src/rule-configs.js +0 -595
- package/src/rule-configs.js.map +0 -1
- package/src/spec-temp-dirs.d.ts +0 -37
- package/src/spec-temp-dirs.js +0 -113
- package/src/spec-temp-dirs.js.map +0 -1
- package/src/tag-truth-configs.d.ts +0 -137
- package/src/tag-truth-configs.js +0 -175
- package/src/tag-truth-configs.js.map +0 -1
package/src/rule-configs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-configs.ts"],"names":[],"mappings":";;;;AAAA,2CAAoD;AAEpD,kFAAkF;AAClF,yF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QAAQ,EAAE,wBAAgB,CAAC;QAC9C,GAAG,wBAAgB;KACtB,CAAC;;AANN,4DAOC;AAED,MAAa,qBAAsB,SAAQ,cAAc;IAErD,gBAAgB,CAAY;IAC5B,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAuC;QACzD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,yBAAiB,CAAC;QAC/C,gBAAgB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AAVN,sDAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\n\n// Mode const arrays — TypeScript union types derived from them, and FieldDef enum\n// values reference the same array. Impossible for the type and runtime check to diverge.\n\n// Single source of truth for rule \"mode\" values. Exported so code-rules (and any other\n// consumer) imports these instead of re-declaring the same unions — a rename here ripples\n// everywhere at compile time. The FieldDef SCHEMA below references the same arrays, so the\n// type and the runtime validation can never diverge.\nexport const METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type MethodLimitMode = typeof METHOD_LIMIT_MODES[number];\n\nexport const FILE_LIMIT_MODES = ['OFF', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type FileLimitMode = typeof FILE_LIMIT_MODES[number];\n\nexport const RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type ReturnTypeMode = typeof RETURN_TYPE_MODES[number];\n\nexport const INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type InlineTypeMode = typeof INLINE_TYPE_MODES[number];\n\n// The two WHOLE-SCOPE modes (#1027) reuse the existing vocabulary rather than inventing names:\n// MODIFIED_PROJECTS — every in-scope file of every project the diff touches (plus the changed files\n// themselves, so it is never narrower than NEW_AND_MODIFIED_FILES).\n// RUN_EVERY_TIME — every in-scope file in the repo, every run.\n// Both judge WHOLE files, exactly like NEW_AND_MODIFIED_FILES — only the file SET differs. They exist so\n// a rule adopted at NEW_AND_MODIFIED_CODE can be measured (\"what is left?\") or finished off without a\n// hack, and they are what `wp-validate-code --rule=<name> --mode=<mode> --projects=a,b` accepts.\n// Edit-time (ai-hooks) treats every non-OFF mode alike: it judges the content being written.\nexport const MODIFIED_CODE_MODES = ['OFF', 'NEW_AND_MODIFIED_CODE', 'NEW_AND_MODIFIED_FILES', 'MODIFIED_PROJECTS', 'RUN_EVERY_TIME'] as const;\nexport type ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];\n\n// PROJECT-level rules (e.g. framework-tag): the check is neither line- nor file-scoped — it runs\n// for a whole project when ANY file the project owns is touched. `MODIFIED_PROJECTS` names that\n// honestly (nx `affected` already narrows execution to the changed projects).\nexport const PROJECT_MODES = ['OFF', 'MODIFIED_PROJECTS'] as const;\nexport type ProjectMode = typeof PROJECT_MODES[number];\n\nexport const PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];\n\nexport const PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type PrismaConverterMode = typeof PRISMA_CONVERTER_MODES[number];\n\nexport const DIRECT_API_RESOLVER_MODES = ['OFF', 'NEW_AND_MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];\n\nexport const THROW_CAUSE_MODES = ['OFF', 'NEW_AND_MODIFIED_CODE'] as const;\nexport type ThrowCauseMode = typeof THROW_CAUSE_MODES[number];\n\nexport const ON_OFF_MODES = ['ON', 'OFF'] as const;\nexport type OnOffMode = typeof ON_OFF_MODES[number];\n\n// branch-creation-guard modes. ON_NO_SUBBRANCHES is the strict variant: it hard-blocks\n// creating a branch off any non-main branch (no sub-branch affordance), pointing the agent\n// back to `git checkout main && git pull && git checkout -b <branch>`. Temporarily overridable\n// via the universal turnOffRuleUntilEpoch escape hatch.\nexport const BRANCH_GUARD_MODES = ['ON', 'OFF', 'ON_NO_SUBBRANCHES'] as const;\nexport type BranchGuardMode = typeof BRANCH_GUARD_MODES[number];\n\nexport const VALIDATE_TS_MODES = ['OFF', 'NEW_AND_MODIFIED_FILES'] as const;\nexport type ValidateTsMode = typeof VALIDATE_TS_MODES[number];\n\n// Structural / whole-graph rules (import-cycle, runtime-architecture, nx-wiring). They can't be\n// scoped to changed lines/files — a cycle or wiring break can route through a project that wasn't\n// itself edited — so when active they run the FULL check every time (nx-affected already limits\n// them to affected projects externally). RUN_EVERY_TIME replaces the old, vaguer \"ON\".\nexport const STRUCTURAL_MODES = ['OFF', 'RUN_EVERY_TIME'] as const;\nexport type StructuralMode = typeof STRUCTURAL_MODES[number];\n\n// ---------------------------------------------------------------------------\n// Universal escape hatches — EVERY rule supports temporarily disabling itself\n// either while on a named git branch (turnOffRuleWhileOnBranch) or until an\n// epoch passes (turnOffRuleUntilEpoch). They live on a shared base class so the\n// fields (and their schema entries) are declared once instead of repeated per\n// rule. `mode` stays per-rule because its allowed values vary (ON/OFF vs\n// NEW_AND_MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).\n//\n// BOTH fields are REQUIRED on every rule so both hatches are ALWAYS VISIBLE in the config — an AI\n// editing webpieces.config.json sees them on every rule and cannot miss that a rule can be time-boxed\n// or branch-scoped off. Convention:\n// turnOffRuleUntilEpoch: 0 = rule active (epoch in the past); a future unix epoch IN SECONDS =\n// temporarily disabled until that moment.\n// turnOffRuleWhileOnBranch: null = always on; a branch name = disabled while that branch is checked out.\n// The name is matched EXACTLY (===). Globs/wildcards are NOT supported and\n// must not be added: a pattern would switch a rule off on branches nobody\n// enumerated. It is also ignored (loudly — shouldSkipRule throws) on a pull\n// request from a FORK, where the branch name is the contributor's to choose.\n// Required-but-nullable so its \"unset\" state is present-and-visible (null)\n// rather than omitted.\n// The earlier spellings of these two fields were RENAMED to the names above and are no longer accepted —\n// the validator rejects them with a \"renamed to X\" hint. RENAMED_FIELD_ALIASES in validate-config.ts is\n// the ONE place in src/ a dead spelling may still be written (see escape-hatch-key-spelling.spec.ts).\n// ---------------------------------------------------------------------------\nexport abstract class BaseRuleConfig {\n // `mode` is declared here (loosely typed) so the shared AbstractRule base can read it for\n // on/off. Each concrete *Config narrows it to its own union (e.g. `mode?: ModifiedCodeMode`),\n // which is an assignable (covariant) override.\n mode?: string;\n // TS-optional, but schema-REQUIRED (see BASE_RULE_SCHEMA) — same split as `mode`. Read directly by\n // AbstractRule.shouldRun, RuleGate, and the code-rules validators.\n turnOffRuleUntilEpoch?: number;\n turnOffRuleWhileOnBranch?: string | null;\n}\n\nexport const BASE_RULE_SCHEMA = {\n turnOffRuleUntilEpoch: new FieldDef('number'),\n turnOffRuleWhileOnBranch: FieldDef.nullableString(),\n};\n\nexport class MaxMethodLinesConfig extends BaseRuleConfig {\n declare mode?: MethodLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxMethodLinesConfig> = {\n mode: new FieldDef('string', METHOD_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// max-file-lines — caps a file's line count.\n//\n// `allowedPaths` exempts whole file trees, matched with the shared `isPathExcluded` glob/prefix/segment\n// semantics (the same field, same matcher and same meaning as no-function-outside-class / no-js-files /\n// no-destructure). It is for files the repo did NOT author and cannot shrink — never a standing amnesty\n// for hand-written code, which is what the inline disable and a refactor are for.\n//\n// The machine-generated trees in GENERATED_CODE_PATHS are exempt WITHOUT configuration, and\n// `allowedPaths` ADDS to that floor rather than replacing it — see generated-code-paths.ts for why a\n// 42,000-line graphql-codegen output must not be able to cost a repo the whole rule.\nexport class MaxFileLinesConfig extends BaseRuleConfig {\n declare mode?: FileLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<MaxFileLinesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RequireReturnTypeConfig extends BaseRuleConfig {\n declare mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig> = {\n mode: new FieldDef('string', RETURN_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoInlineTypeLiteralsConfig extends BaseRuleConfig {\n declare mode?: InlineTypeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig> = {\n mode: new FieldDef('string', INLINE_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoAnyUnknownConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoAnyUnknownConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoImplicitAnyConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoImplicitAnyConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaValidateDtosConfig extends BaseRuleConfig {\n declare mode?: PrismaValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig> = {\n mode: new FieldDef('string', PRISMA_DTOS_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n prismaSchemaPath: FieldDef.optional('string'),\n dtoSourcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaConverterConfig extends BaseRuleConfig {\n declare mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaConverterConfig> = {\n mode: new FieldDef('string', PRISMA_CONVERTER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n schemaPath: FieldDef.optional('string'),\n convertersPaths: FieldDef.optional('string[]'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// `allowedPaths` exempts whole file trees whose idioms are destructuring by construction (React /\n// React Native components and hooks — `const [x, setX] = useState()`, destructured props — framework\n// glue), matched with the shared glob/prefix/segment semantics of `isPathExcluded`. It is the ONLY\n// escape when `disableAllowed: false`, since that setting deliberately ignores inline disables.\nexport class NoDestructureConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n allowTopLevel?: boolean;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoDestructureConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n allowTopLevel: FieldDef.optional('boolean'),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoUnmanagedExceptionsConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoUnmanagedExceptionsConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class CatchErrorPatternConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ThrowCauseRequiredConfig extends BaseRuleConfig {\n declare mode?: ThrowCauseMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig> = {\n mode: new FieldDef('string', THROW_CAUSE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {\n declare mode?: DirectApiResolverMode;\n disableAllowed?: boolean;\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<AngularNoDirectApiInResolverConfig> = {\n mode: new FieldDef('string', DIRECT_API_RESOLVER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// Bans hand-written CSS in Angular sources (styles:/styleUrls:/styleUrl: in @Component, and inline\n// style=/[style.x]/[ngStyle] in templates) so teams style with Tailwind utility classes. `allowGlobs`\n// exempts paths WITHIN the Angular scope (e.g. a vendored Fuse kit copied verbatim with its own CSS).\nexport class NoCustomCssConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowGlobs?: string[];\n\n static readonly SCHEMA: SchemaShape<NoCustomCssConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowGlobs: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoSymbolDiTokensConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoSymbolDiTokensConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// Flags `process.exit(...)` outside a main()/runMain wrapper (and `import { main }`) so a deep exit\n// can't silently kill a reused server/command. Gradual-rollout knobs via the standard base: mode\n// (OFF | NEW_AND_MODIFIED_CODE | NEW_AND_MODIFIED_FILES), turnOffRuleUntilEpoch, branch, and\n// disableAllowed for the inline `// webpieces-disable` escape at genuine terminal boundaries.\nexport class NoProcessExitOutsideMainConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoProcessExitOutsideMainConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// Flags a function CREATED OUTSIDE A CLASS at module scope: a top-level `function foo()` declaration\n// or a top-level `const foo = () => {}` / `= function(){}`. The point is that webpieces DI +\n// @DocumentDesign only work when behavior lives in injectable classes — a module-scope function is a\n// dead-end the DI graph can't reach. Inline callbacks, nested functions inside methods, and non-function\n// top-level consts (objects, zod schemas, primitives) are NOT flagged. Standard rollout knobs via the\n// base: mode (OFF | NEW_AND_MODIFIED_CODE | NEW_AND_MODIFIED_FILES), turnOffRuleUntilEpoch, branch,\n// and disableAllowed for the inline `// webpieces-disable` escape. `allowedPaths` exempts whole file\n// trees that legitimately live outside the class-per-behavior model (e.g. React component/hook files,\n// framework glue), matched with the shared glob/prefix/segment semantics of `isPathExcluded`.\nexport class NoFunctionOutsideClassConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFunctionOutsideClassConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// inject-annotation-not-needed-for-concrete-class — flags a REDUNDANT `@inject(X)` whose token is\n// textually identical to the parameter's own declared type (`@inject(Foo) private readonly foo: Foo`).\n// In this inversify setup the decorator is pure noise there: reflect-metadata (emitDecoratorMetadata)\n// already resolves a constructor parameter by its class type, so `private readonly foo: Foo` binds on\n// its own (see CLAUDE.md, and the no-symbol-di-tokens rule that pushes the same way). Symbol/interface\n// tokens are NOT flagged because they never equal the type (`@inject(FOO_TOKEN) x: Provider<Foo>`).\n// AI keeps carpet-bombing `@inject`; this fails the build on the redundant form. Standard rollout knobs\n// via the base: mode (OFF | NEW_AND_MODIFIED_CODE | NEW_AND_MODIFIED_FILES), turnOffRuleUntilEpoch,\n// branch, and disableAllowed for the inline `// webpieces-disable` escape. `allowedPaths` exempts whole\n// file trees, matched with the shared glob/prefix/segment semantics.\nexport class InjectAnnotationNotNeededForConcreteClassConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<InjectAnnotationNotNeededForConcreteClassConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// framework-tag — every project that a changed source file belongs to must carry >=1\n// `framework:<browser|react|angular|node|express|react-native>` nx tag in its project.json. Those tags are the\n// project's \"libType\" — the SET of runtime environments it runs in — and the source of truth for\n// the dependencies.json `framework` field and the `library-types-match-client` rule. Multiple tags\n// are allowed (the env set) and values are validated against the known set (`framework:all` is a\n// hard error). `knownTypes` customizes that set (defaults to browser, react, angular, node, express,\n// react-native — the last a first-class runtime, not a browser, #1064).\nexport class FrameworkTagConfig extends BaseRuleConfig {\n declare mode?: ProjectMode;\n knownTypes?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkTagConfig> = {\n mode: new FieldDef('string', PROJECT_MODES),\n knownTypes: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// role-tag — every project that a changed source file belongs to must carry a\n// `role:<server|app|bundle|designed-lib|lib|client|api-lib|api-client>` nx tag in its project.json. That tag is the project's\n// ROLE (orthogonal to `framework` libType) — the source of truth for the dependencies.json `role`\n// field, the `role-dependency` edge rule (apps are never depended upon), and DI-design generation\n// (server→@Controller, designed-lib→@ApiImplementation, lib→none, client→angular design).\n// `knownTypes` customizes the list suggested to the author when a tag is missing.\nexport class RoleTagConfig extends BaseRuleConfig {\n declare mode?: ProjectMode;\n knownTypes?: string[];\n\n static readonly SCHEMA: SchemaShape<RoleTagConfig> = {\n mode: new FieldDef('string', PROJECT_MODES),\n knownTypes: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// Touching a project audits every production API contract it directly owns.\nexport class EnsureWeAreSecureConfig extends BaseRuleConfig {\n declare mode?: ProjectMode;\n static readonly SCHEMA: SchemaShape<EnsureWeAreSecureConfig> = {\n mode: new FieldDef('string', PROJECT_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class BranchCreationGuardConfig extends BaseRuleConfig {\n declare mode?: BranchGuardMode;\n // Naming pattern for stacked SUB-branches only (branches created off another feature branch,\n // which require human approval). Never applied to branches created off main.\n //\n // Schema-REQUIRED (#1017), like `mode` and `autoReapMergedBranches`, and for the same reason: it\n // is BEHAVIOUR, not a knob. This string decides which branch names the guard BLOCKS, and the\n // refusal quotes it back at the agent as the convention to follow — so a repo running webpieces'\n // shipped value is a repo whose branch-naming convention was chosen by a framework author who\n // never saw it. TS-optional but schema-required, the split `mode` uses: absent at RUNTIME means\n // the config never passed validation.\n subBranchNaming!: string;\n // Human-sentence instruction telling the AI how to name a NEW branch off main. Surfaced back\n // to the agent in the guard's fix hints. May mirror no-edit-on-main.branchNamingConvention.\n branchFormat?: string;\n // Hard cap on local feature branches (excluding main). Creating one past the cap is BLOCKED until\n // already-merged branches are reaped, which is what keeps the branch list from growing without\n // bound. Branch creation is the gate because it is the only moment cleanup is both cheap and\n // obviously worth it. See merged-branches.ts for how \"already merged\" is determined.\n maxLocalBranches?: number;\n // Hard cap on LINKED worktrees (the primary clone is never counted). A separate budget from\n // maxLocalBranches: every worktree holds a branch, so if worktree-held branches also spent the\n // branch budget, five worktrees would leave room for zero branches. Held branches count here;\n // parked branches count against maxLocalBranches. Enforced at `git worktree add`.\n maxWorktrees?: number;\n // Let the detached background refresher DELETE dead branches on its own, instead of only\n // reporting them. Every candidate is provably dead (a MERGED PR — its own, or the PR of the branch\n // it snapshots; nothing else qualifies) and\n // recoverable by the SHA logged to branch-mutations.log — but it is still UNATTENDED deletion,\n // so this is schema-REQUIRED like `mode` and `turnOffRuleUntilEpoch`. \"Every built-in rule\n // must be explicitly configured — no silent defaults\" (validate-config.ts) applies with extra\n // force here: branches disappearing on a preference nobody ever stated is precisely the kind of\n // default that must not exist. Validation makes each consumer answer the question once.\n //\n // TS-optional but schema-required — the same split `mode` uses. Absent at RUNTIME therefore means\n // the config never passed validation, and the only safe reading of \"nobody has answered\" is: do\n // not delete anything.\n autoReapMergedBranches?: boolean;\n\n static readonly SCHEMA: SchemaShape<BranchCreationGuardConfig> = {\n mode: new FieldDef('string', BRANCH_GUARD_MODES),\n subBranchNaming: new FieldDef('string'),\n branchFormat: FieldDef.optional('string'),\n maxLocalBranches: FieldDef.optional('number'),\n maxWorktrees: FieldDef.optional('number'),\n autoReapMergedBranches: new FieldDef('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/**\n * `pr-lifecycle-guard` — ONE key, ONE policy: *PRs and merges go through the gated flow.*\n *\n * Four CLASSES implement it, and their names are unchanged (they are the operator identity every\n * decision-log line and every deny report carries):\n *\n * pr-creation-or-push-guard a manual `git push` / `gh pr create|edit` / a raw pulls API call\n * merge-in-progress-guard a PR command while a 3-point merge is half-finished\n * pr-merge-guard a bare `gh pr merge`\n * redirect-how-to-merge-main \"how do I get main into my branch?\" → the documented flow\n *\n * ## Say this out loud: `\"mode\": \"OFF\"` releases the unvalidated-merge gate too\n *\n * Three of the four are pure COMMAND-SHAPE blocks and can never fire spuriously. The fourth,\n * merge-in-progress-guard, is STATE-conditional — it fires only while a 3-point merge is actually in\n * progress, and it is the one state L2 explicitly stands down for. So turning this key OFF to unblock\n * `gh pr merge` ALSO drops the \"you have an unfinished merge\" gate. That is the honest cost of one key\n * per policy, and it is stated here, in guards/L4-pr-lifecycle.md, and in the error path, rather than\n * being papered over with a granular sub-mode (which would be four knobs wearing one key's name).\n *\n * ## The command strings are NOT here\n *\n * `upsertPrCommand` and `mergeCompleteCommand` used to sit on the two guards, and — being read at the\n * point of use — they BEAT `commands.guardHints`, so `guardHintsWhy`'s claim that renaming a gated\n * command there makes \"every guard message follow\" was simply false. They are DELETED, not deprecated.\n * `commands.guardHints.prCreationOrPush` / `.mergeInProgress` is the one place those strings live, and\n * the loader hands the resolved values to the two rules directly. A consumer that still sets the old\n * per-guard field gets a RETIRED_FIELD_HINTS error naming the destination.\n */\nexport class PrLifecycleGuardConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrLifecycleGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// NOTE: there is deliberately no `WholeRepoBuildGuardConfig`. That guard has NO webpieces.config.json\n// entry — it is EXPERIMENTAL and OFF by default, and its only switch is the OPT-IN\n// `experimental.whole-repo-build-guard: true` in the optional machine-local ~/.webpieces/config.json\n// (see home-config.ts). The build command it prints\n// is handed to it directly from `commands.pr-gate.buildCommand` by ai-hook-rules' runner. Re-adding a\n// config class here puts the guard back in RULE_SCHEMAS and makes it a fault-Y rule again.\n\nexport class NoFileImportCyclesConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n ignoreTypeOnly?: boolean;\n excludePackages?: string[];\n // Raw regex escape hatch for a cycle inside the project being checked — generated code, a\n // vendored tree, or a deliberate bidirectional domain model — that `excludePackages` cannot reach\n // (it resolves npm package NAMES, so it only excludes a *sibling* package, never a directory\n // inside this one). Patterns are handed to madge verbatim and matched against ids RELATIVE TO THE\n // PROJECT (e.g. \"^src/generated/\", \"^src/modules/(item|category)/\") — NOT workspace-rooted or\n // absolute, which silently match nothing. The executor warns when a pattern matches zero\n // traversed files, so a mis-anchored pattern is visible rather than a silent no-op.\n excludeRegExp?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFileImportCyclesConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ignoreTypeOnly: FieldDef.optional('boolean'),\n excludePackages: FieldDef.optional('string[]'),\n excludeRegExp: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RuntimeArchitectureConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n // NOTE: `servicePaths` / `apiProjectPaths` were removed — they were never read. The runtime graph\n // is derived SOLELY from architecture/dependencies.json apiRelations + project roles (see\n // nx-webpieces-rules/src/lib/runtime-graph.ts), so any config still listing them (a hand-maintained\n // enumeration of api libs) now fails the unknown-field check in validateWebpiecesConfig. There is\n // nothing to enumerate — delete the keys.\n // NOTE: `allowedCycles` was removed — a runtime cycle is no longer allowable at all. CD deploys\n // services in dependency order and a cyclic architecture has no such order, so the runtime graph\n // now THROWS while it is being levelled rather than emitting a flat, unlevellable diagram (see\n // nx-webpieces-rules/src/lib/runtime-graph-levels.ts). A repo that genuinely cannot break a cycle\n // yet declares it PER EDGE with a `cutLegacyCycle:<targetService>` nx tag on the CALLING project,\n // which admits the debt in a place `grep -rn cutLegacyCycle` can enumerate. Delete the key.\n /**\n * Draw a dashed terminal node for every contract a service calls that NOTHING in-repo\n * implements (firestore, gmail, ...) — the vendor systems the runtime graph otherwise stops one\n * hop short of. Defaults to true; set false in a repo whose external surface is noisy. Purely a\n * RENDER switch: levels, cycle detection and runtime-dependencies.json are identical either way.\n */\n showExternalNodes?: boolean;\n /**\n * Project roots whose exported `*Api` types are contracts for systems OUTSIDE this repo\n * (firestore, gmail, gcp-storage, ...), e.g. `[\"libraries/apis/external/**\"]`. Globs, matched\n * against the nx project root.\n *\n * Needed because an external contract does NOT look like an in-repo one: it is a plain\n * `interface` bound to a Symbol token and injected, never an `abstract class` carrying @ApiPath\n * reached through `createRpcClient`. Without this list the scanner has no way to tell a vendor\n * seam from any other library, so every call leaving the repo is invisible to the runtime graph.\n *\n * Defaults to none, which is correct for a repo with no vendor wrapper libraries.\n */\n externalApiPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<RuntimeArchitectureConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n showExternalNodes: FieldDef.optional('boolean'),\n externalApiPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NxWiringConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<NxWiringConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class DiGraphConfig extends BaseRuleConfig {\n // Structural: the DI graph is regenerated whole-project on every build (generate +\n // unchanged gate), so it cannot be scoped to changed lines.\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<DiGraphConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MissingDesignAnnotationConfig extends BaseRuleConfig {\n // Structural: enforced per-project by the di-graph-generate executor, which\n // roots the whole DI design on @DocumentDesign classes — cannot be line-scoped.\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<MissingDesignAnnotationConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoJsFilesConfig extends BaseRuleConfig {\n // File-tier: NEW_AND_MODIFIED_FILES (active) intercepts a .js/.jsx Write — the file being\n // written is inherently a new/modified file, so it's already diff-scoped in practice.\n declare mode?: FileLimitMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoJsFilesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n// ---------------------------------------------------------------------------\n// The five Nx infrastructure validators (architecture-unchanged, no-architecture-cycles,\n// packagejson, versions-locked, eslint-sync). Each is whole-graph / whole-repo by nature (a cycle, a\n// drifted dependencies.json, an unlocked version can be introduced by a file nobody in this diff\n// touched), so the only honest mode set is STRUCTURAL_MODES: RUN_EVERY_TIME (the default) or OFF.\n//\n// All five now honor the universal escape hatches (turnOffRuleUntilEpoch / turnOffRuleWhileOnBranch)\n// via shouldSkipRule — the RuleGate is called with honorEpoch:true from\n// every executor. This lets a repo time-box or branch-scope a failing infrastructure check (e.g. hold\n// validate-packagejson off until an upgrade PR lands) with a one-value edit, instead of only the\n// blunt \"mode\": \"OFF\". Originally packagejson/versions-locked/eslint-sync were all-or-nothing on the\n// theory that \"no blessed baseline\" made grandfathering meaningless, but a time-box is a schedule, not\n// a baseline: \"do not enforce this until <epoch>/off <branch>\" is coherent for any rule.\n// ---------------------------------------------------------------------------\n\nexport class ValidateArchitectureUnchangedConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<ValidateArchitectureUnchangedConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateNoArchitectureCyclesConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<ValidateNoArchitectureCyclesConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidatePackageJsonConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<ValidatePackageJsonConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateVersionsLockedConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<ValidateVersionsLockedConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateEslintSyncConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n\n static readonly SCHEMA: SchemaShape<ValidateEslintSyncConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateTsInSrcConfig extends BaseRuleConfig {\n declare mode?: ValidateTsMode;\n allowedRootFiles?: string[];\n excludePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig> = {\n mode: new FieldDef('string', VALIDATE_TS_MODES),\n allowedRootFiles: FieldDef.optional('string[]'),\n excludePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
package/src/spec-temp-dirs.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates `$TMPDIR` scratch directories for specs and testkits, and reaps every one of them when the
|
|
3
|
-
* process exits.
|
|
4
|
-
*
|
|
5
|
-
* Use the shared `specTempDirs` instance — the reaper is registered per-instance, so a caller that
|
|
6
|
-
* constructs its own gets a second `exit` listener and no benefit.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SpecTempDirs {
|
|
9
|
-
private readonly created;
|
|
10
|
-
private reaperRegistered;
|
|
11
|
-
/**
|
|
12
|
-
* `fs.mkdtempSync` under `os.tmpdir()`, with the path remembered for cleanup.
|
|
13
|
-
*
|
|
14
|
-
* `prefix` keeps the existing `wp-<area>-` convention so a leaked tree still names its creator; the
|
|
15
|
-
* trailing dash matters because mkdtemp appends six random characters directly onto it.
|
|
16
|
-
*/
|
|
17
|
-
make(prefix: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* `make`, with symlinks resolved.
|
|
20
|
-
*
|
|
21
|
-
* macOS hands back `/var/folders/...` from `os.tmpdir()` while `/var` is a symlink to `/private/var`,
|
|
22
|
-
* so a fixture that compares a path it was given against one the code under test computed sees two
|
|
23
|
-
* different strings for the same directory. Specs that do that comparison call this instead.
|
|
24
|
-
*/
|
|
25
|
-
makeReal(prefix: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Removes every directory this instance created, then forgets them.
|
|
28
|
-
*
|
|
29
|
-
* Deliberately never throws: it runs from an `exit` handler where a throw would replace a passing
|
|
30
|
-
* test run's exit code with a crash, and a scratch directory that cannot be removed is a leak, not a
|
|
31
|
-
* failure. Callers may also invoke it directly — a long suite that wants its fixtures gone before the
|
|
32
|
-
* end of the run.
|
|
33
|
-
*/
|
|
34
|
-
reapAll(): void;
|
|
35
|
-
private registerReaper;
|
|
36
|
-
}
|
|
37
|
-
export declare const specTempDirs: SpecTempDirs;
|
package/src/spec-temp-dirs.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.specTempDirs = exports.SpecTempDirs = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
-
const os = tslib_1.__importStar(require("os"));
|
|
7
|
-
const path = tslib_1.__importStar(require("path"));
|
|
8
|
-
// The Vitest setup loads this leaf before per-spec fs mocks; keep filesystem services lazy.
|
|
9
|
-
const to_error_1 = require("@webpieces/tooling-common/to-error");
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// ONE OWNER FOR EVERY `$TMPDIR` SCRATCH TREE THE TOOLING CREATES.
|
|
12
|
-
//
|
|
13
|
-
// THE DEFECT. Every `packages/tooling/**` spec builds its fixture with
|
|
14
|
-
// `specTempDirs.make('wp-<something>-')` and NONE of them removed it afterwards.
|
|
15
|
-
// Measured on one developer machine: 270,200 abandoned `wp-*` directories out of 286,270 total entries
|
|
16
|
-
// in `$TMPDIR` — 64,828 of them from `vitest.setup.mts` alone, which mints one isolated `$HOME` per test
|
|
17
|
-
// FILE per run. The cost is not disk (every `wp-*` prefix together is under 1 GiB; the `$HOME` dirs are
|
|
18
|
-
// empty by design) — it is INODES and the fact that `$TMPDIR` stops being inspectable: `ls` takes ~30s
|
|
19
|
-
// and `du` takes minutes, which is how this went unnoticed for as long as it did.
|
|
20
|
-
//
|
|
21
|
-
// WHY `$TMPDIR` AND NOT `.webpieces/`, WHICH IS WHERE EVERYTHING ELSE GOES. Because for a TEST fixture
|
|
22
|
-
// the whole point is to be outside the repo, and two separate mechanisms depend on that:
|
|
23
|
-
// - `vitest.setup.mts` mints a throwaway `$HOME` so a spec cannot read the developer's real
|
|
24
|
-
// `~/.webpieces/config.json`. A fake HOME inside the repo defeats its own isolation.
|
|
25
|
-
// - The fixtures `git init` and `git worktree add` INSIDE themselves. A nested git repo under the real
|
|
26
|
-
// repo root is what breaks the nx graph — the same hazard that makes `.claude/worktrees/` a
|
|
27
|
-
// mandatory gitignore entry.
|
|
28
|
-
// So the location was never the bug. The missing cleanup was.
|
|
29
|
-
//
|
|
30
|
-
// WHO ACTUALLY CALLS `reapAll`, AND WHY IT IS NOT A LINE IN EACH SPEC. An `afterAll` written into each
|
|
31
|
-
// of the 212 call sites is a line somebody has to remember, forever, in every new spec — precisely the
|
|
32
|
-
// discipline already demonstrated not to hold here. Instead `vitest.setup.mts` calls `reapAll()` in ONE
|
|
33
|
-
// global `afterAll`, so a call site swaps `fs.mkdtempSync(...)` for `specTempDirs.make(...)` and there
|
|
34
|
-
// is no other half to forget.
|
|
35
|
-
//
|
|
36
|
-
// THE `exit` REAPER BELOW IS THE SECONDARY BELT, NOT THE PRIMARY ONE — and the first cut of this file
|
|
37
|
-
// had that backwards. It relied on `process.on('exit')` alone, and a 145-file tooling run then left
|
|
38
|
-
// exactly 145 `wp-vitest-home-` directories behind: a 100% miss. The cause is `pool: 'forks'` (see
|
|
39
|
-
// vitest.config.mts) — vitest KILLS its workers rather than letting them exit, and a killed process runs
|
|
40
|
-
// no exit handler. The handler stays because it costs one listener and does fire for the non-vitest
|
|
41
|
-
// callers (testkits driven from plain node scripts), but nothing here should depend on it.
|
|
42
|
-
//
|
|
43
|
-
// SO CLEANUP IS BEST-EFFORT BY CONSTRUCTION, at two levels: a worker killed mid-file skips the
|
|
44
|
-
// `afterAll` too. That residue is why `CleanTmp` sweeps aged `wp-*` out of `$TMPDIR` via
|
|
45
|
-
// `TmpScratchSweeper` — belt, braces, and a sweep for what both of them miss.
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
/**
|
|
48
|
-
* Creates `$TMPDIR` scratch directories for specs and testkits, and reaps every one of them when the
|
|
49
|
-
* process exits.
|
|
50
|
-
*
|
|
51
|
-
* Use the shared `specTempDirs` instance — the reaper is registered per-instance, so a caller that
|
|
52
|
-
* constructs its own gets a second `exit` listener and no benefit.
|
|
53
|
-
*/
|
|
54
|
-
class SpecTempDirs {
|
|
55
|
-
created = [];
|
|
56
|
-
reaperRegistered = false;
|
|
57
|
-
/**
|
|
58
|
-
* `fs.mkdtempSync` under `os.tmpdir()`, with the path remembered for cleanup.
|
|
59
|
-
*
|
|
60
|
-
* `prefix` keeps the existing `wp-<area>-` convention so a leaked tree still names its creator; the
|
|
61
|
-
* trailing dash matters because mkdtemp appends six random characters directly onto it.
|
|
62
|
-
*/
|
|
63
|
-
make(prefix) {
|
|
64
|
-
this.registerReaper();
|
|
65
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
66
|
-
this.created.push(dir);
|
|
67
|
-
return dir;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* `make`, with symlinks resolved.
|
|
71
|
-
*
|
|
72
|
-
* macOS hands back `/var/folders/...` from `os.tmpdir()` while `/var` is a symlink to `/private/var`,
|
|
73
|
-
* so a fixture that compares a path it was given against one the code under test computed sees two
|
|
74
|
-
* different strings for the same directory. Specs that do that comparison call this instead.
|
|
75
|
-
*/
|
|
76
|
-
makeReal(prefix) {
|
|
77
|
-
return fs.realpathSync(this.make(prefix));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Removes every directory this instance created, then forgets them.
|
|
81
|
-
*
|
|
82
|
-
* Deliberately never throws: it runs from an `exit` handler where a throw would replace a passing
|
|
83
|
-
* test run's exit code with a crash, and a scratch directory that cannot be removed is a leak, not a
|
|
84
|
-
* failure. Callers may also invoke it directly — a long suite that wants its fixtures gone before the
|
|
85
|
-
* end of the run.
|
|
86
|
-
*/
|
|
87
|
-
reapAll() {
|
|
88
|
-
const dirs = this.created.splice(0, this.created.length);
|
|
89
|
-
for (const dir of dirs) {
|
|
90
|
-
// webpieces-disable no-unmanaged-exceptions -- chokepoint: this runs from vitest's afterAll and
|
|
91
|
-
// from an exit handler, where a throw would turn a passing run into a crash over a scratch dir
|
|
92
|
-
// eslint-disable-next-line @webpieces/no-unmanaged-exceptions
|
|
93
|
-
try {
|
|
94
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
const error = (0, to_error_1.toError)(err);
|
|
98
|
-
process.stderr.write(`SpecTempDirs: could not remove ${dir}: ${error.message}\n`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// One listener per instance, added lazily so a process that never makes a fixture never registers.
|
|
103
|
-
registerReaper() {
|
|
104
|
-
if (this.reaperRegistered)
|
|
105
|
-
return;
|
|
106
|
-
this.reaperRegistered = true;
|
|
107
|
-
process.on('exit', () => this.reapAll());
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.SpecTempDirs = SpecTempDirs;
|
|
111
|
-
// The shared instance — the reaper and the created-list are per-instance, so every caller must use this.
|
|
112
|
-
exports.specTempDirs = new SpecTempDirs();
|
|
113
|
-
//# sourceMappingURL=spec-temp-dirs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec-temp-dirs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/spec-temp-dirs.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,+CAAyB;AACzB,mDAA6B;AAC7B,4FAA4F;AAC5F,iEAA6D;AAE7D,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,uEAAuE;AACvE,iFAAiF;AACjF,uGAAuG;AACvG,yGAAyG;AACzG,wGAAwG;AACxG,uGAAuG;AACvG,kFAAkF;AAClF,EAAE;AACF,uGAAuG;AACvG,yFAAyF;AACzF,8FAA8F;AAC9F,yFAAyF;AACzF,yGAAyG;AACzG,gGAAgG;AAChG,iCAAiC;AACjC,8DAA8D;AAC9D,EAAE;AACF,uGAAuG;AACvG,uGAAuG;AACvG,wGAAwG;AACxG,uGAAuG;AACvG,8BAA8B;AAC9B,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,mGAAmG;AACnG,yGAAyG;AACzG,oGAAoG;AACpG,2FAA2F;AAC3F,EAAE;AACF,+FAA+F;AAC/F,yFAAyF;AACzF,8EAA8E;AAC9E,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAa,YAAY;IACJ,OAAO,GAAa,EAAE,CAAC;IAChC,gBAAgB,GAAG,KAAK,CAAC;IAEjC;;;;;OAKG;IACH,IAAI,CAAC,MAAc;QACf,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,MAAc;QACnB,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACH,OAAO;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,gGAAgG;YAChG,+FAA+F;YAC/F,8DAA8D;YAC9D,IAAI,CAAC;gBACD,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;gBAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,GAAG,KAAK,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;IACL,CAAC;IAED,mGAAmG;IAC3F,cAAc;QAClB,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAO;QAClC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAS,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;CACJ;AAzDD,oCAyDC;AAED,yGAAyG;AAC5F,QAAA,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\n// The Vitest setup loads this leaf before per-spec fs mocks; keep filesystem services lazy.\nimport { toError } from '@webpieces/tooling-common/to-error';\n\n// ---------------------------------------------------------------------------\n// ONE OWNER FOR EVERY `$TMPDIR` SCRATCH TREE THE TOOLING CREATES.\n//\n// THE DEFECT. Every `packages/tooling/**` spec builds its fixture with\n// `specTempDirs.make('wp-<something>-')` and NONE of them removed it afterwards.\n// Measured on one developer machine: 270,200 abandoned `wp-*` directories out of 286,270 total entries\n// in `$TMPDIR` — 64,828 of them from `vitest.setup.mts` alone, which mints one isolated `$HOME` per test\n// FILE per run. The cost is not disk (every `wp-*` prefix together is under 1 GiB; the `$HOME` dirs are\n// empty by design) — it is INODES and the fact that `$TMPDIR` stops being inspectable: `ls` takes ~30s\n// and `du` takes minutes, which is how this went unnoticed for as long as it did.\n//\n// WHY `$TMPDIR` AND NOT `.webpieces/`, WHICH IS WHERE EVERYTHING ELSE GOES. Because for a TEST fixture\n// the whole point is to be outside the repo, and two separate mechanisms depend on that:\n// - `vitest.setup.mts` mints a throwaway `$HOME` so a spec cannot read the developer's real\n// `~/.webpieces/config.json`. A fake HOME inside the repo defeats its own isolation.\n// - The fixtures `git init` and `git worktree add` INSIDE themselves. A nested git repo under the real\n// repo root is what breaks the nx graph — the same hazard that makes `.claude/worktrees/` a\n// mandatory gitignore entry.\n// So the location was never the bug. The missing cleanup was.\n//\n// WHO ACTUALLY CALLS `reapAll`, AND WHY IT IS NOT A LINE IN EACH SPEC. An `afterAll` written into each\n// of the 212 call sites is a line somebody has to remember, forever, in every new spec — precisely the\n// discipline already demonstrated not to hold here. Instead `vitest.setup.mts` calls `reapAll()` in ONE\n// global `afterAll`, so a call site swaps `fs.mkdtempSync(...)` for `specTempDirs.make(...)` and there\n// is no other half to forget.\n//\n// THE `exit` REAPER BELOW IS THE SECONDARY BELT, NOT THE PRIMARY ONE — and the first cut of this file\n// had that backwards. It relied on `process.on('exit')` alone, and a 145-file tooling run then left\n// exactly 145 `wp-vitest-home-` directories behind: a 100% miss. The cause is `pool: 'forks'` (see\n// vitest.config.mts) — vitest KILLS its workers rather than letting them exit, and a killed process runs\n// no exit handler. The handler stays because it costs one listener and does fire for the non-vitest\n// callers (testkits driven from plain node scripts), but nothing here should depend on it.\n//\n// SO CLEANUP IS BEST-EFFORT BY CONSTRUCTION, at two levels: a worker killed mid-file skips the\n// `afterAll` too. That residue is why `CleanTmp` sweeps aged `wp-*` out of `$TMPDIR` via\n// `TmpScratchSweeper` — belt, braces, and a sweep for what both of them miss.\n// ---------------------------------------------------------------------------\n\n/**\n * Creates `$TMPDIR` scratch directories for specs and testkits, and reaps every one of them when the\n * process exits.\n *\n * Use the shared `specTempDirs` instance — the reaper is registered per-instance, so a caller that\n * constructs its own gets a second `exit` listener and no benefit.\n */\nexport class SpecTempDirs {\n private readonly created: string[] = [];\n private reaperRegistered = false;\n\n /**\n * `fs.mkdtempSync` under `os.tmpdir()`, with the path remembered for cleanup.\n *\n * `prefix` keeps the existing `wp-<area>-` convention so a leaked tree still names its creator; the\n * trailing dash matters because mkdtemp appends six random characters directly onto it.\n */\n make(prefix: string): string {\n this.registerReaper();\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));\n this.created.push(dir);\n return dir;\n }\n\n /**\n * `make`, with symlinks resolved.\n *\n * macOS hands back `/var/folders/...` from `os.tmpdir()` while `/var` is a symlink to `/private/var`,\n * so a fixture that compares a path it was given against one the code under test computed sees two\n * different strings for the same directory. Specs that do that comparison call this instead.\n */\n makeReal(prefix: string): string {\n return fs.realpathSync(this.make(prefix));\n }\n\n /**\n * Removes every directory this instance created, then forgets them.\n *\n * Deliberately never throws: it runs from an `exit` handler where a throw would replace a passing\n * test run's exit code with a crash, and a scratch directory that cannot be removed is a leak, not a\n * failure. Callers may also invoke it directly — a long suite that wants its fixtures gone before the\n * end of the run.\n */\n reapAll(): void {\n const dirs = this.created.splice(0, this.created.length);\n for (const dir of dirs) {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: this runs from vitest's afterAll and\n // from an exit handler, where a throw would turn a passing run into a crash over a scratch dir\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n fs.rmSync(dir, { recursive: true, force: true });\n } catch (err: unknown) {\n const error = toError(err);\n process.stderr.write(`SpecTempDirs: could not remove ${dir}: ${error.message}\\n`);\n }\n }\n }\n\n // One listener per instance, added lazily so a process that never makes a fixture never registers.\n private registerReaper(): void {\n if (this.reaperRegistered) return;\n this.reaperRegistered = true;\n process.on('exit', (): void => this.reapAll());\n }\n}\n\n// The shared instance — the reaper and the created-list are per-instance, so every caller must use this.\nexport const specTempDirs = new SpecTempDirs();\n"]}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { SchemaShape } from './field-def';
|
|
2
|
-
import { BaseRuleConfig, StructuralMode } from './rule-configs';
|
|
3
|
-
/**
|
|
4
|
-
* The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a
|
|
5
|
-
* promise only the dependency graph checked; the code inside a library, the folder it lives in and the
|
|
6
|
-
* packages it imports were never compared with it.
|
|
7
|
-
*
|
|
8
|
-
* Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
|
|
9
|
-
* and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,
|
|
10
|
-
* `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:
|
|
11
|
-
* `framework-tsconfig` and `framework-packages`.
|
|
12
|
-
*
|
|
13
|
-
* Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
|
|
14
|
-
* which packages an api library may import, which folders hold which runtimes, and which framework
|
|
15
|
-
* packages belong to which runtime are the CONSUMER's layout, never webpieces'. The recommended values
|
|
16
|
-
* are SEEDED into a fresh config (seed-entry.ts) and documented in `.claude/rules/framework-tags.md`.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* The modes of the two PROJECT rules: OFF, MODIFIED_PROJECTS (every project owning a changed file) or
|
|
20
|
-
* RUN_EVERY_TIME (every project in the repo — the migration sweep).
|
|
21
|
-
*/
|
|
22
|
-
export declare const PROJECT_SCAN_MODES: readonly ["OFF", "MODIFIED_PROJECTS", "RUN_EVERY_TIME"];
|
|
23
|
-
export type ProjectScanMode = typeof PROJECT_SCAN_MODES[number];
|
|
24
|
-
/** One `role:api-client` project and the outside packages it may import (its SDK, inversify, …). Data-only. */
|
|
25
|
-
export declare class ApiClientPackagesEntry {
|
|
26
|
-
/** The nx project name of the `role:api-client` library, e.g. `gmail-client`. */
|
|
27
|
-
project: string;
|
|
28
|
-
/** Package names (globs allowed, e.g. `@google-cloud/*`) it may import beyond `apiLibPackages`. */
|
|
29
|
-
packages: string[];
|
|
30
|
-
static readonly SCHEMA: SchemaShape<ApiClientPackagesEntry>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* `api-lib-dependencies` (D2) — a `role:api-lib` may depend only on other `role:api-lib` projects plus
|
|
34
|
-
* the outside packages in `apiLibPackages`; a `role:api-client` may ALSO import the packages its own
|
|
35
|
-
* `apiClients` entry names (its SDK, `inversify`, `@webpieces/core-context`, …).
|
|
36
|
-
*
|
|
37
|
-
* - `mode` — OFF | RUN_EVERY_TIME (a graph rule: it reads every project, every run).
|
|
38
|
-
* - `apiLibPackages` — required; may be empty (an api library then imports nothing from outside), e.g.
|
|
39
|
-
* `["@webpieces/core-util", "tslib"]`. A workspace project whose name or package name is listed here
|
|
40
|
-
* is allowed too, so a repo whose `core-util` is a workspace project states it the same way.
|
|
41
|
-
* - `apiClients` — required; one entry per `role:api-client` project. A `role:api-client` with no
|
|
42
|
-
* entry is itself a violation: what it may talk to is stated, never inferred.
|
|
43
|
-
*/
|
|
44
|
-
export declare class ApiLibDependenciesConfig extends BaseRuleConfig {
|
|
45
|
-
mode?: StructuralMode;
|
|
46
|
-
apiLibPackages: string[];
|
|
47
|
-
apiClients: ApiClientPackagesEntry[];
|
|
48
|
-
static readonly SCHEMA: SchemaShape<ApiLibDependenciesConfig>;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* `api-lib-path` (D10) — both directions: every `role:api-lib` / `role:api-client` project lives under
|
|
52
|
-
* one of `paths`, and every project under `paths` carries one of those two roles.
|
|
53
|
-
*
|
|
54
|
-
* - `mode` — OFF | RUN_EVERY_TIME.
|
|
55
|
-
* - `paths` — required, non-empty globs over project ROOTS, e.g. `["libraries/apis/**"]`.
|
|
56
|
-
*/
|
|
57
|
-
export declare class ApiLibPathConfig extends BaseRuleConfig {
|
|
58
|
-
mode?: StructuralMode;
|
|
59
|
-
paths: string[];
|
|
60
|
-
static readonly SCHEMA: SchemaShape<ApiLibPathConfig>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* One folder of the runtime layout: the project roots it covers, the framework SETS a project there may
|
|
64
|
-
* carry, and the roles it may have. Data-only.
|
|
65
|
-
*
|
|
66
|
-
* A framework set is written as its tags joined by `+`, in any order: `"browser+node+react-native"`.
|
|
67
|
-
* Listing two sets means EITHER — `["node", "express"]` is a node library or an express one.
|
|
68
|
-
*/
|
|
69
|
-
export declare class FrameworkFolderEntry {
|
|
70
|
-
/** Globs over project ROOTS, e.g. `["libraries/universal/**"]`. Non-empty. */
|
|
71
|
-
paths: string[];
|
|
72
|
-
/** The accepted framework sets, each `+`-joined, e.g. `["browser+node+react-native"]`. Non-empty. */
|
|
73
|
-
frameworkSets: string[];
|
|
74
|
-
/** The accepted roles, e.g. `["lib", "designed-lib"]`. Non-empty. */
|
|
75
|
-
roles: string[];
|
|
76
|
-
static readonly SCHEMA: SchemaShape<FrameworkFolderEntry>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* `framework-folder` (D9) — the folder a library lives in and the tags it carries say the same thing,
|
|
80
|
-
* both directions:
|
|
81
|
-
* - a project under an entry's `paths` (the FIRST entry whose glob matches, in `entries` order) must
|
|
82
|
-
* carry one of that entry's `frameworkSets`, exactly, and one of its `roles`;
|
|
83
|
-
* - a LIBRARY (any role but server/app/client/bundle) carrying a framework set and role that some entry
|
|
84
|
-
* lists must live under one of the entries that list them.
|
|
85
|
-
*
|
|
86
|
-
* - `mode` — OFF | RUN_EVERY_TIME.
|
|
87
|
-
* - `entries` — required, non-empty. The recommended layout is in `.claude/rules/framework-tags.md`.
|
|
88
|
-
*/
|
|
89
|
-
export declare class FrameworkFolderConfig extends BaseRuleConfig {
|
|
90
|
-
mode?: StructuralMode;
|
|
91
|
-
entries: FrameworkFolderEntry[];
|
|
92
|
-
static readonly SCHEMA: SchemaShape<FrameworkFolderConfig>;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* `framework-tsconfig` (D7) — the COMPILER enforces the runtime a library's framework tags promise. Its
|
|
96
|
-
* `tsconfig.lib.json` (with everything it `extends`) must resolve to:
|
|
97
|
-
* - every env a browser one (browser / angular / react): `lib` includes `dom`, `types` excludes `node`;
|
|
98
|
-
* - every env a node one (node / express): `lib` excludes `dom`, `types` includes `node`;
|
|
99
|
-
* - anything else (universal, browser + react-native, react-native): `lib` excludes `dom`, `types`
|
|
100
|
-
* excludes `node` — pure TypeScript.
|
|
101
|
-
* An unset `lib` resolves to TypeScript's default, which includes `dom`; an unset `types` includes every
|
|
102
|
-
* installed `@types/*`, so it counts as including `node`. Both must therefore be stated.
|
|
103
|
-
*
|
|
104
|
-
* - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.
|
|
105
|
-
* - `allowedPaths` — optional globs over project roots this rule skips.
|
|
106
|
-
*/
|
|
107
|
-
export declare class FrameworkTsconfigConfig extends BaseRuleConfig {
|
|
108
|
-
mode?: ProjectScanMode;
|
|
109
|
-
allowedPaths?: string[];
|
|
110
|
-
static readonly SCHEMA: SchemaShape<FrameworkTsconfigConfig>;
|
|
111
|
-
}
|
|
112
|
-
/** Framework packages and the runtimes that may import them. Data-only. */
|
|
113
|
-
export declare class FrameworkPackagesEntry {
|
|
114
|
-
/** Package-name globs, e.g. `["@angular/*"]` or `["react", "react-native", "expo*"]`. Non-empty. */
|
|
115
|
-
packages: string[];
|
|
116
|
-
/** The framework tags allowed to import them, e.g. `["angular"]`. Non-empty. */
|
|
117
|
-
frameworks: string[];
|
|
118
|
-
static readonly SCHEMA: SchemaShape<FrameworkPackagesEntry>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* `framework-packages` (D8) — a framework package is imported only by a project whose EVERY framework
|
|
122
|
-
* tag is one its entry allows. A `browser+node` library importing `firebase-admin` is refused (its
|
|
123
|
-
* browser env cannot run it); a `react` library importing `react` is not.
|
|
124
|
-
*
|
|
125
|
-
* Only production source is read (specs and test setup are not the runtime). A package no entry names
|
|
126
|
-
* is not judged.
|
|
127
|
-
*
|
|
128
|
-
* - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.
|
|
129
|
-
* - `entries` — required, non-empty. The recommended list is in `.claude/rules/framework-tags.md`.
|
|
130
|
-
* - `allowedPaths` — optional globs over project roots this rule skips.
|
|
131
|
-
*/
|
|
132
|
-
export declare class FrameworkPackagesConfig extends BaseRuleConfig {
|
|
133
|
-
mode?: ProjectScanMode;
|
|
134
|
-
entries: FrameworkPackagesEntry[];
|
|
135
|
-
allowedPaths?: string[];
|
|
136
|
-
static readonly SCHEMA: SchemaShape<FrameworkPackagesConfig>;
|
|
137
|
-
}
|
package/src/tag-truth-configs.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FrameworkPackagesConfig = exports.FrameworkPackagesEntry = exports.FrameworkTsconfigConfig = exports.FrameworkFolderConfig = exports.FrameworkFolderEntry = exports.ApiLibPathConfig = exports.ApiLibDependenciesConfig = exports.ApiClientPackagesEntry = exports.PROJECT_SCAN_MODES = void 0;
|
|
4
|
-
const field_def_1 = require("./field-def");
|
|
5
|
-
const rule_configs_1 = require("./rule-configs");
|
|
6
|
-
/**
|
|
7
|
-
* The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a
|
|
8
|
-
* promise only the dependency graph checked; the code inside a library, the folder it lives in and the
|
|
9
|
-
* packages it imports were never compared with it.
|
|
10
|
-
*
|
|
11
|
-
* Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`
|
|
12
|
-
* and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,
|
|
13
|
-
* `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:
|
|
14
|
-
* `framework-tsconfig` and `framework-packages`.
|
|
15
|
-
*
|
|
16
|
-
* Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):
|
|
17
|
-
* which packages an api library may import, which folders hold which runtimes, and which framework
|
|
18
|
-
* packages belong to which runtime are the CONSUMER's layout, never webpieces'. The recommended values
|
|
19
|
-
* are SEEDED into a fresh config (seed-entry.ts) and documented in `.claude/rules/framework-tags.md`.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* The modes of the two PROJECT rules: OFF, MODIFIED_PROJECTS (every project owning a changed file) or
|
|
23
|
-
* RUN_EVERY_TIME (every project in the repo — the migration sweep).
|
|
24
|
-
*/
|
|
25
|
-
exports.PROJECT_SCAN_MODES = ['OFF', 'MODIFIED_PROJECTS', 'RUN_EVERY_TIME'];
|
|
26
|
-
/** One `role:api-client` project and the outside packages it may import (its SDK, inversify, …). Data-only. */
|
|
27
|
-
class ApiClientPackagesEntry {
|
|
28
|
-
/** The nx project name of the `role:api-client` library, e.g. `gmail-client`. */
|
|
29
|
-
project;
|
|
30
|
-
/** Package names (globs allowed, e.g. `@google-cloud/*`) it may import beyond `apiLibPackages`. */
|
|
31
|
-
packages;
|
|
32
|
-
static SCHEMA = {
|
|
33
|
-
project: new field_def_1.FieldDef('string'),
|
|
34
|
-
packages: new field_def_1.FieldDef('string[]'),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
exports.ApiClientPackagesEntry = ApiClientPackagesEntry;
|
|
38
|
-
/**
|
|
39
|
-
* `api-lib-dependencies` (D2) — a `role:api-lib` may depend only on other `role:api-lib` projects plus
|
|
40
|
-
* the outside packages in `apiLibPackages`; a `role:api-client` may ALSO import the packages its own
|
|
41
|
-
* `apiClients` entry names (its SDK, `inversify`, `@webpieces/core-context`, …).
|
|
42
|
-
*
|
|
43
|
-
* - `mode` — OFF | RUN_EVERY_TIME (a graph rule: it reads every project, every run).
|
|
44
|
-
* - `apiLibPackages` — required; may be empty (an api library then imports nothing from outside), e.g.
|
|
45
|
-
* `["@webpieces/core-util", "tslib"]`. A workspace project whose name or package name is listed here
|
|
46
|
-
* is allowed too, so a repo whose `core-util` is a workspace project states it the same way.
|
|
47
|
-
* - `apiClients` — required; one entry per `role:api-client` project. A `role:api-client` with no
|
|
48
|
-
* entry is itself a violation: what it may talk to is stated, never inferred.
|
|
49
|
-
*/
|
|
50
|
-
class ApiLibDependenciesConfig extends rule_configs_1.BaseRuleConfig {
|
|
51
|
-
apiLibPackages;
|
|
52
|
-
apiClients;
|
|
53
|
-
static SCHEMA = {
|
|
54
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.STRUCTURAL_MODES),
|
|
55
|
-
apiLibPackages: new field_def_1.FieldDef('string[]'),
|
|
56
|
-
apiClients: field_def_1.FieldDef.objects(ApiClientPackagesEntry.SCHEMA),
|
|
57
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
exports.ApiLibDependenciesConfig = ApiLibDependenciesConfig;
|
|
61
|
-
/**
|
|
62
|
-
* `api-lib-path` (D10) — both directions: every `role:api-lib` / `role:api-client` project lives under
|
|
63
|
-
* one of `paths`, and every project under `paths` carries one of those two roles.
|
|
64
|
-
*
|
|
65
|
-
* - `mode` — OFF | RUN_EVERY_TIME.
|
|
66
|
-
* - `paths` — required, non-empty globs over project ROOTS, e.g. `["libraries/apis/**"]`.
|
|
67
|
-
*/
|
|
68
|
-
class ApiLibPathConfig extends rule_configs_1.BaseRuleConfig {
|
|
69
|
-
paths;
|
|
70
|
-
static SCHEMA = {
|
|
71
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.STRUCTURAL_MODES),
|
|
72
|
-
paths: field_def_1.FieldDef.nonEmptyStrings(),
|
|
73
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
exports.ApiLibPathConfig = ApiLibPathConfig;
|
|
77
|
-
/**
|
|
78
|
-
* One folder of the runtime layout: the project roots it covers, the framework SETS a project there may
|
|
79
|
-
* carry, and the roles it may have. Data-only.
|
|
80
|
-
*
|
|
81
|
-
* A framework set is written as its tags joined by `+`, in any order: `"browser+node+react-native"`.
|
|
82
|
-
* Listing two sets means EITHER — `["node", "express"]` is a node library or an express one.
|
|
83
|
-
*/
|
|
84
|
-
class FrameworkFolderEntry {
|
|
85
|
-
/** Globs over project ROOTS, e.g. `["libraries/universal/**"]`. Non-empty. */
|
|
86
|
-
paths;
|
|
87
|
-
/** The accepted framework sets, each `+`-joined, e.g. `["browser+node+react-native"]`. Non-empty. */
|
|
88
|
-
frameworkSets;
|
|
89
|
-
/** The accepted roles, e.g. `["lib", "designed-lib"]`. Non-empty. */
|
|
90
|
-
roles;
|
|
91
|
-
static SCHEMA = {
|
|
92
|
-
paths: field_def_1.FieldDef.nonEmptyStrings(),
|
|
93
|
-
frameworkSets: field_def_1.FieldDef.nonEmptyStrings(),
|
|
94
|
-
roles: field_def_1.FieldDef.nonEmptyStrings(),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
exports.FrameworkFolderEntry = FrameworkFolderEntry;
|
|
98
|
-
/**
|
|
99
|
-
* `framework-folder` (D9) — the folder a library lives in and the tags it carries say the same thing,
|
|
100
|
-
* both directions:
|
|
101
|
-
* - a project under an entry's `paths` (the FIRST entry whose glob matches, in `entries` order) must
|
|
102
|
-
* carry one of that entry's `frameworkSets`, exactly, and one of its `roles`;
|
|
103
|
-
* - a LIBRARY (any role but server/app/client/bundle) carrying a framework set and role that some entry
|
|
104
|
-
* lists must live under one of the entries that list them.
|
|
105
|
-
*
|
|
106
|
-
* - `mode` — OFF | RUN_EVERY_TIME.
|
|
107
|
-
* - `entries` — required, non-empty. The recommended layout is in `.claude/rules/framework-tags.md`.
|
|
108
|
-
*/
|
|
109
|
-
class FrameworkFolderConfig extends rule_configs_1.BaseRuleConfig {
|
|
110
|
-
entries;
|
|
111
|
-
static SCHEMA = {
|
|
112
|
-
mode: new field_def_1.FieldDef('string', rule_configs_1.STRUCTURAL_MODES),
|
|
113
|
-
entries: field_def_1.FieldDef.nonEmptyObjects(FrameworkFolderEntry.SCHEMA),
|
|
114
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
exports.FrameworkFolderConfig = FrameworkFolderConfig;
|
|
118
|
-
/**
|
|
119
|
-
* `framework-tsconfig` (D7) — the COMPILER enforces the runtime a library's framework tags promise. Its
|
|
120
|
-
* `tsconfig.lib.json` (with everything it `extends`) must resolve to:
|
|
121
|
-
* - every env a browser one (browser / angular / react): `lib` includes `dom`, `types` excludes `node`;
|
|
122
|
-
* - every env a node one (node / express): `lib` excludes `dom`, `types` includes `node`;
|
|
123
|
-
* - anything else (universal, browser + react-native, react-native): `lib` excludes `dom`, `types`
|
|
124
|
-
* excludes `node` — pure TypeScript.
|
|
125
|
-
* An unset `lib` resolves to TypeScript's default, which includes `dom`; an unset `types` includes every
|
|
126
|
-
* installed `@types/*`, so it counts as including `node`. Both must therefore be stated.
|
|
127
|
-
*
|
|
128
|
-
* - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.
|
|
129
|
-
* - `allowedPaths` — optional globs over project roots this rule skips.
|
|
130
|
-
*/
|
|
131
|
-
class FrameworkTsconfigConfig extends rule_configs_1.BaseRuleConfig {
|
|
132
|
-
allowedPaths;
|
|
133
|
-
static SCHEMA = {
|
|
134
|
-
mode: new field_def_1.FieldDef('string', exports.PROJECT_SCAN_MODES),
|
|
135
|
-
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
136
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
exports.FrameworkTsconfigConfig = FrameworkTsconfigConfig;
|
|
140
|
-
/** Framework packages and the runtimes that may import them. Data-only. */
|
|
141
|
-
class FrameworkPackagesEntry {
|
|
142
|
-
/** Package-name globs, e.g. `["@angular/*"]` or `["react", "react-native", "expo*"]`. Non-empty. */
|
|
143
|
-
packages;
|
|
144
|
-
/** The framework tags allowed to import them, e.g. `["angular"]`. Non-empty. */
|
|
145
|
-
frameworks;
|
|
146
|
-
static SCHEMA = {
|
|
147
|
-
packages: field_def_1.FieldDef.nonEmptyStrings(),
|
|
148
|
-
frameworks: field_def_1.FieldDef.nonEmptyStrings(),
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
exports.FrameworkPackagesEntry = FrameworkPackagesEntry;
|
|
152
|
-
/**
|
|
153
|
-
* `framework-packages` (D8) — a framework package is imported only by a project whose EVERY framework
|
|
154
|
-
* tag is one its entry allows. A `browser+node` library importing `firebase-admin` is refused (its
|
|
155
|
-
* browser env cannot run it); a `react` library importing `react` is not.
|
|
156
|
-
*
|
|
157
|
-
* Only production source is read (specs and test setup are not the runtime). A package no entry names
|
|
158
|
-
* is not judged.
|
|
159
|
-
*
|
|
160
|
-
* - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.
|
|
161
|
-
* - `entries` — required, non-empty. The recommended list is in `.claude/rules/framework-tags.md`.
|
|
162
|
-
* - `allowedPaths` — optional globs over project roots this rule skips.
|
|
163
|
-
*/
|
|
164
|
-
class FrameworkPackagesConfig extends rule_configs_1.BaseRuleConfig {
|
|
165
|
-
entries;
|
|
166
|
-
allowedPaths;
|
|
167
|
-
static SCHEMA = {
|
|
168
|
-
mode: new field_def_1.FieldDef('string', exports.PROJECT_SCAN_MODES),
|
|
169
|
-
entries: field_def_1.FieldDef.nonEmptyObjects(FrameworkPackagesEntry.SCHEMA),
|
|
170
|
-
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
171
|
-
...rule_configs_1.BASE_RULE_SCHEMA,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
exports.FrameworkPackagesConfig = FrameworkPackagesConfig;
|
|
175
|
-
//# sourceMappingURL=tag-truth-configs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag-truth-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/tag-truth-configs.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAoG;AAEpG;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACU,QAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,CAAU,CAAC;AAG1F,+GAA+G;AAC/G,MAAa,sBAAsB;IAC/B,iFAAiF;IACjF,OAAO,CAAU;IACjB,mGAAmG;IACnG,QAAQ,CAAY;IAEpB,MAAM,CAAU,MAAM,GAAwC;QAC1D,OAAO,EAAE,IAAI,oBAAQ,CAAC,QAAQ,CAAC;QAC/B,QAAQ,EAAE,IAAI,oBAAQ,CAAC,UAAU,CAAC;KACrC,CAAC;;AATN,wDAUC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,wBAAyB,SAAQ,6BAAc;IAExD,cAAc,CAAY;IAC1B,UAAU,CAA4B;IAEtC,MAAM,CAAU,MAAM,GAA0C;QAC5D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,+BAAgB,CAAC;QAC9C,cAAc,EAAE,IAAI,oBAAQ,CAAC,UAAU,CAAC;QACxC,UAAU,EAAE,oBAAQ,CAAC,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC;QAC3D,GAAG,+BAAgB;KACtB,CAAC;;AAVN,4DAWC;AAED;;;;;;GAMG;AACH,MAAa,gBAAiB,SAAQ,6BAAc;IAEhD,KAAK,CAAY;IAEjB,MAAM,CAAU,MAAM,GAAkC;QACpD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,+BAAgB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C;;AATN,wDAUC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,uBAAwB,SAAQ,6BAAc;IAEvD,OAAO,CAA4B;IACnC,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAAyC;QAC3D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,0BAAkB,CAAC;QAChD,OAAO,EAAE,oBAAQ,CAAC,eAAe,CAAC,sBAAsB,CAAC,MAAM,CAAC;QAChE,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,+BAAgB;KACtB,CAAC;;AAVN,0DAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, StructuralMode, STRUCTURAL_MODES } from './rule-configs';\n\n/**\n * The five rules that make an nx `framework:*` / `role:*` tag TRUE (#1064). Before them a tag was a\n * promise only the dependency graph checked; the code inside a library, the folder it lives in and the\n * packages it imports were never compared with it.\n *\n * Three are GRAPH rules (they read the whole nx project graph, so they run in `architecture:generate`\n * and `validate-architecture-unchanged` beside `library-types-match-client`): `api-lib-dependencies`,\n * `api-lib-path` and `framework-folder`. Two are PROJECT rules in `@webpieces/code-rules`:\n * `framework-tsconfig` and `framework-packages`.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * which packages an api library may import, which folders hold which runtimes, and which framework\n * packages belong to which runtime are the CONSUMER's layout, never webpieces'. The recommended values\n * are SEEDED into a fresh config (seed-entry.ts) and documented in `.claude/rules/framework-tags.md`.\n */\n\n/**\n * The modes of the two PROJECT rules: OFF, MODIFIED_PROJECTS (every project owning a changed file) or\n * RUN_EVERY_TIME (every project in the repo — the migration sweep).\n */\nexport const PROJECT_SCAN_MODES = ['OFF', 'MODIFIED_PROJECTS', 'RUN_EVERY_TIME'] as const;\nexport type ProjectScanMode = typeof PROJECT_SCAN_MODES[number];\n\n/** One `role:api-client` project and the outside packages it may import (its SDK, inversify, …). Data-only. */\nexport class ApiClientPackagesEntry {\n /** The nx project name of the `role:api-client` library, e.g. `gmail-client`. */\n project!: string;\n /** Package names (globs allowed, e.g. `@google-cloud/*`) it may import beyond `apiLibPackages`. */\n packages!: string[];\n\n static readonly SCHEMA: SchemaShape<ApiClientPackagesEntry> = {\n project: new FieldDef('string'),\n packages: new FieldDef('string[]'),\n };\n}\n\n/**\n * `api-lib-dependencies` (D2) — a `role:api-lib` may depend only on other `role:api-lib` projects plus\n * the outside packages in `apiLibPackages`; a `role:api-client` may ALSO import the packages its own\n * `apiClients` entry names (its SDK, `inversify`, `@webpieces/core-context`, …).\n *\n * - `mode` — OFF | RUN_EVERY_TIME (a graph rule: it reads every project, every run).\n * - `apiLibPackages` — required; may be empty (an api library then imports nothing from outside), e.g.\n * `[\"@webpieces/core-util\", \"tslib\"]`. A workspace project whose name or package name is listed here\n * is allowed too, so a repo whose `core-util` is a workspace project states it the same way.\n * - `apiClients` — required; one entry per `role:api-client` project. A `role:api-client` with no\n * entry is itself a violation: what it may talk to is stated, never inferred.\n */\nexport class ApiLibDependenciesConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n apiLibPackages!: string[];\n apiClients!: ApiClientPackagesEntry[];\n\n static readonly SCHEMA: SchemaShape<ApiLibDependenciesConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n apiLibPackages: new FieldDef('string[]'),\n apiClients: FieldDef.objects(ApiClientPackagesEntry.SCHEMA),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/**\n * `api-lib-path` (D10) — both directions: every `role:api-lib` / `role:api-client` project lives under\n * one of `paths`, and every project under `paths` carries one of those two roles.\n *\n * - `mode` — OFF | RUN_EVERY_TIME.\n * - `paths` — required, non-empty globs over project ROOTS, e.g. `[\"libraries/apis/**\"]`.\n */\nexport class ApiLibPathConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n paths!: string[];\n\n static readonly SCHEMA: SchemaShape<ApiLibPathConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n paths: FieldDef.nonEmptyStrings(),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/**\n * One folder of the runtime layout: the project roots it covers, the framework SETS a project there may\n * carry, and the roles it may have. Data-only.\n *\n * A framework set is written as its tags joined by `+`, in any order: `\"browser+node+react-native\"`.\n * Listing two sets means EITHER — `[\"node\", \"express\"]` is a node library or an express one.\n */\nexport class FrameworkFolderEntry {\n /** Globs over project ROOTS, e.g. `[\"libraries/universal/**\"]`. Non-empty. */\n paths!: string[];\n /** The accepted framework sets, each `+`-joined, e.g. `[\"browser+node+react-native\"]`. Non-empty. */\n frameworkSets!: string[];\n /** The accepted roles, e.g. `[\"lib\", \"designed-lib\"]`. Non-empty. */\n roles!: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkFolderEntry> = {\n paths: FieldDef.nonEmptyStrings(),\n frameworkSets: FieldDef.nonEmptyStrings(),\n roles: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `framework-folder` (D9) — the folder a library lives in and the tags it carries say the same thing,\n * both directions:\n * - a project under an entry's `paths` (the FIRST entry whose glob matches, in `entries` order) must\n * carry one of that entry's `frameworkSets`, exactly, and one of its `roles`;\n * - a LIBRARY (any role but server/app/client/bundle) carrying a framework set and role that some entry\n * lists must live under one of the entries that list them.\n *\n * - `mode` — OFF | RUN_EVERY_TIME.\n * - `entries` — required, non-empty. The recommended layout is in `.claude/rules/framework-tags.md`.\n */\nexport class FrameworkFolderConfig extends BaseRuleConfig {\n declare mode?: StructuralMode;\n entries!: FrameworkFolderEntry[];\n\n static readonly SCHEMA: SchemaShape<FrameworkFolderConfig> = {\n mode: new FieldDef('string', STRUCTURAL_MODES),\n entries: FieldDef.nonEmptyObjects(FrameworkFolderEntry.SCHEMA),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/**\n * `framework-tsconfig` (D7) — the COMPILER enforces the runtime a library's framework tags promise. Its\n * `tsconfig.lib.json` (with everything it `extends`) must resolve to:\n * - every env a browser one (browser / angular / react): `lib` includes `dom`, `types` excludes `node`;\n * - every env a node one (node / express): `lib` excludes `dom`, `types` includes `node`;\n * - anything else (universal, browser + react-native, react-native): `lib` excludes `dom`, `types`\n * excludes `node` — pure TypeScript.\n * An unset `lib` resolves to TypeScript's default, which includes `dom`; an unset `types` includes every\n * installed `@types/*`, so it counts as including `node`. Both must therefore be stated.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkTsconfigConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkTsconfigConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\n/** Framework packages and the runtimes that may import them. Data-only. */\nexport class FrameworkPackagesEntry {\n /** Package-name globs, e.g. `[\"@angular/*\"]` or `[\"react\", \"react-native\", \"expo*\"]`. Non-empty. */\n packages!: string[];\n /** The framework tags allowed to import them, e.g. `[\"angular\"]`. Non-empty. */\n frameworks!: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesEntry> = {\n packages: FieldDef.nonEmptyStrings(),\n frameworks: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `framework-packages` (D8) — a framework package is imported only by a project whose EVERY framework\n * tag is one its entry allows. A `browser+node` library importing `firebase-admin` is refused (its\n * browser env cannot run it); a `react` library importing `react` is not.\n *\n * Only production source is read (specs and test setup are not the runtime). A package no entry names\n * is not judged.\n *\n * - `mode` — OFF | MODIFIED_PROJECTS | RUN_EVERY_TIME.\n * - `entries` — required, non-empty. The recommended list is in `.claude/rules/framework-tags.md`.\n * - `allowedPaths` — optional globs over project roots this rule skips.\n */\nexport class FrameworkPackagesConfig extends BaseRuleConfig {\n declare mode?: ProjectScanMode;\n entries!: FrameworkPackagesEntry[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<FrameworkPackagesConfig> = {\n mode: new FieldDef('string', PROJECT_SCAN_MODES),\n entries: FieldDef.nonEmptyObjects(FrameworkPackagesEntry.SCHEMA),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|