@webpieces/nx-webpieces-rules 0.4.847 → 0.4.849
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/README.md +28 -15
- package/executors.json +1 -66
- package/package.json +9 -9
- package/src/executors/validate-architecture-unchanged/executor.d.ts +8 -0
- package/src/executors/validate-architecture-unchanged/executor.js +20 -18
- package/src/executors/validate-architecture-unchanged/executor.js.map +1 -1
- package/src/executors/validate-code/executor.d.ts +2 -7
- package/src/executors/validate-code/executor.js +31 -2
- package/src/executors/validate-code/executor.js.map +1 -1
- package/src/executors/validate-code/schema.json +6 -281
- package/src/executors/validate-runtime-architecture/schema.json +1 -1
- package/src/lib/api-usage/wire-closure.d.ts +3 -3
- package/src/lib/api-usage/wire-closure.js +5 -5
- package/src/lib/api-usage/wire-closure.js.map +1 -1
- package/src/lib/api-usage/wire-suffix-entry.d.ts +5 -0
- package/src/lib/api-usage/wire-suffix-entry.js +10 -0
- package/src/lib/api-usage/wire-suffix-entry.js.map +1 -0
- package/src/lib/rule-gate.d.ts +1 -2
- package/src/lib/rule-gate.js +3 -4
- package/src/lib/rule-gate.js.map +1 -1
- package/src/lib/runtime-visualizer.d.ts +4 -4
- package/src/lib/runtime-visualizer.js +2 -2
- package/src/lib/runtime-visualizer.js.map +1 -1
- package/src/native-actions.d.ts +23 -0
- package/src/native-actions.js +69 -0
- package/src/native-actions.js.map +1 -0
- package/src/nx-policy-registry.d.ts +8 -0
- package/src/nx-policy-registry.js +40 -0
- package/src/nx-policy-registry.js.map +1 -0
- package/src/pack-build-runner.d.ts +6 -0
- package/src/pack-build-runner.js +46 -0
- package/src/pack-build-runner.js.map +1 -0
- package/src/plugin.js +6 -40
- package/src/plugin.js.map +1 -1
- package/src/rule-help.d.ts +3 -0
- package/src/rule-help.js +24 -0
- package/src/rule-help.js.map +1 -0
- package/src/rule-pack.js +5 -28
- package/src/rule-pack.js.map +1 -1
- package/src/rule-runtime.d.ts +5 -0
- package/src/rule-runtime.js +94 -0
- package/src/rule-runtime.js.map +1 -0
- package/src/validation-targets.js +21 -5
- package/src/validation-targets.js.map +1 -1
- package/src/executors/validate-catch-error-pattern/executor.d.ts +0 -4
- package/src/executors/validate-catch-error-pattern/executor.js +0 -8
- package/src/executors/validate-catch-error-pattern/executor.js.map +0 -1
- package/src/executors/validate-catch-error-pattern/schema.json +0 -24
- package/src/executors/validate-dtos/executor.d.ts +0 -4
- package/src/executors/validate-dtos/executor.js +0 -8
- package/src/executors/validate-dtos/executor.js.map +0 -1
- package/src/executors/validate-dtos/schema.json +0 -33
- package/src/executors/validate-modified-files/executor.d.ts +0 -4
- package/src/executors/validate-modified-files/executor.js +0 -8
- package/src/executors/validate-modified-files/executor.js.map +0 -1
- package/src/executors/validate-modified-files/schema.json +0 -25
- package/src/executors/validate-modified-methods/executor.d.ts +0 -4
- package/src/executors/validate-modified-methods/executor.js +0 -8
- package/src/executors/validate-modified-methods/executor.js.map +0 -1
- package/src/executors/validate-modified-methods/schema.json +0 -25
- package/src/executors/validate-new-methods/executor.d.ts +0 -4
- package/src/executors/validate-new-methods/executor.js +0 -8
- package/src/executors/validate-new-methods/executor.js.map +0 -1
- package/src/executors/validate-new-methods/schema.json +0 -25
- package/src/executors/validate-no-any-unknown/executor.d.ts +0 -4
- package/src/executors/validate-no-any-unknown/executor.js +0 -8
- package/src/executors/validate-no-any-unknown/executor.js.map +0 -1
- package/src/executors/validate-no-any-unknown/schema.json +0 -24
- package/src/executors/validate-no-destructure/executor.d.ts +0 -4
- package/src/executors/validate-no-destructure/executor.js +0 -8
- package/src/executors/validate-no-destructure/executor.js.map +0 -1
- package/src/executors/validate-no-destructure/schema.json +0 -24
- package/src/executors/validate-no-direct-api-resolver/executor.d.ts +0 -4
- package/src/executors/validate-no-direct-api-resolver/executor.js +0 -8
- package/src/executors/validate-no-direct-api-resolver/executor.js.map +0 -1
- package/src/executors/validate-no-direct-api-resolver/schema.json +0 -29
- package/src/executors/validate-no-implicit-any/executor.d.ts +0 -4
- package/src/executors/validate-no-implicit-any/executor.js +0 -8
- package/src/executors/validate-no-implicit-any/executor.js.map +0 -1
- package/src/executors/validate-no-implicit-any/schema.json +0 -24
- package/src/executors/validate-no-inline-types/executor.d.ts +0 -4
- package/src/executors/validate-no-inline-types/executor.js +0 -8
- package/src/executors/validate-no-inline-types/executor.js.map +0 -1
- package/src/executors/validate-no-inline-types/schema.json +0 -24
- package/src/executors/validate-no-unmanaged-exceptions/executor.d.ts +0 -4
- package/src/executors/validate-no-unmanaged-exceptions/executor.js +0 -8
- package/src/executors/validate-no-unmanaged-exceptions/executor.js.map +0 -1
- package/src/executors/validate-no-unmanaged-exceptions/schema.json +0 -24
- package/src/executors/validate-prisma-converters/executor.d.ts +0 -4
- package/src/executors/validate-prisma-converters/executor.js +0 -8
- package/src/executors/validate-prisma-converters/executor.js.map +0 -1
- package/src/executors/validate-prisma-converters/schema.json +0 -38
- package/src/executors/validate-return-types/executor.d.ts +0 -4
- package/src/executors/validate-return-types/executor.js +0 -8
- package/src/executors/validate-return-types/executor.js.map +0 -1
- package/src/executors/validate-return-types/schema.json +0 -24
package/src/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAiNH,sDASC;AAsWD,wCAsBC;AAID,oDAWC;AAnmBD,+BAAqC;AACrC,2BAAgC;AAQhC,uDAG2B;AAC3B,qEAAkE;AAClE,6DAAyD;AACzD,yDAAiE;AACjE,yDAA2F;AAC3F,iDAA6C;AAoE7C,MAAM,eAAe,GAAwC;IACzD,YAAY,EAAE;QACV,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,gCAAgC;QAC5C,eAAe,EAAE,EAAE;KACtB;IACD,SAAS,EAAE;QACP,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,OAAO;QACrB,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AO,eAAe,CAAC,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE;QAC5C,gCAAgC;QAChC,MAAM,YAAY,GAAG,OAAO;aACvB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,sBAAsB;aAC7C,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC;QAE9D,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,kBAAe,EAAE,aAAa,EAAb,qBAAa,EAAE,CAAC","sourcesContent":["/**\n * Unified Nx Inference Plugin for @webpieces/nx-webpieces-rules\n *\n * This plugin automatically creates targets for:\n * 1. Workspace-level architecture validation (generate, visualize, validate-*)\n * 2. Per-project circular dependency checking\n * 3. Per-project API documents, opted into with a TAG: `generate:openapi` infers `openapi-generate`,\n * `generate:openapi-components` infers `openapi-components-generate` (a DTO library's\n * components.openapi.json), `generate:docs-site` infers `openapi-generate` + `docs-generate`\n * (see generate-targets.ts)\n *\n * Install with: nx add @webpieces/nx-webpieces-rules\n *\n * Usage:\n * Add to nx.json plugins array:\n * {\n * \"plugins\": [\"@webpieces/nx-webpieces-rules\"]\n * }\n *\n * Then all targets appear automatically without manual project.json configuration.\n */\n\nimport { dirname, join } from 'path';\nimport { existsSync } from 'fs';\nimport type {\n CreateNodesV2,\n CreateNodesContextV2,\n CreateNodesResultV2,\n CreateNodesResult,\n TargetConfiguration,\n} from '@nx/devkit';\nimport {\n createVisualizeRuntimeTarget,\n createValidateRuntimeArchitectureTarget,\n} from './runtime-targets';\nimport { BRANCH_IDENTITY_INPUTS } from './branch-identity-inputs';\nimport { ValidationTargets } from './validation-targets';\nimport { createDiGraphGenerateTarget } from './di-graph-targets';\nimport { GenerateTargets, RawProjectJson, RawProjectJsonReader } from './generate-targets';\nimport { RulesTarget } from './rules-target';\n\n/**\n * Circular dependency checking options\n */\nexport interface CircularDepsOptions {\n enabled?: boolean;\n targetName?: string;\n excludePatterns?: string[];\n}\n\n/**\n * Validation options for architecture checks\n */\nexport interface ValidationOptions {\n noCycles?: boolean;\n architectureUnchanged?: boolean;\n validatePackageJson?: boolean;\n validateNewMethods?: boolean;\n validateModifiedMethods?: boolean;\n validateModifiedFiles?: boolean;\n validateVersionsLocked?: boolean;\n validateTsInSrc?: boolean;\n validateNxWiring?: boolean;\n runtimeArchitecture?: boolean;\n validateApiRelations?: boolean;\n validateApiLibTag?: boolean;\n diGraph?: boolean;\n newMethodsMaxLines?: number;\n modifiedAndNewMethodsMaxLines?: number;\n modifiedFilesMaxLines?: number;\n /**\n * Validation mode for method/file size limits:\n * - STRICT: All limits enforced, disable comments ignored\n * - NORMAL: Limits enforced, disable comments with dates work\n * - OFF: Skip size validations entirely (for fast iteration)\n */\n validationMode?: 'STRICT' | 'NORMAL' | 'OFF';\n}\n\n/**\n * Feature flags for workspace targets\n */\nexport interface FeatureOptions {\n generate?: boolean;\n visualize?: boolean;\n visualizeRuntime?: boolean;\n}\n\n/**\n * Workspace-level configuration options\n */\nexport interface WorkspaceOptions {\n enabled?: boolean;\n targetPrefix?: string;\n graphPath?: string;\n validations?: ValidationOptions;\n features?: FeatureOptions;\n}\n\n/**\n * Configuration for @webpieces/nx-webpieces-rules Nx plugin\n */\nexport interface ArchitecturePluginOptions {\n circularDeps?: CircularDepsOptions;\n workspace?: WorkspaceOptions;\n}\n\nconst DEFAULT_OPTIONS: Required<ArchitecturePluginOptions> = {\n circularDeps: {\n enabled: true,\n targetName: 'validate-no-file-import-cycles',\n excludePatterns: [],\n },\n workspace: {\n enabled: true,\n targetPrefix: 'arch:',\n graphPath: 'architecture/dependencies.json',\n validations: {\n noCycles: true,\n architectureUnchanged: true,\n validatePackageJson: true,\n validateNewMethods: true,\n validateModifiedMethods: true,\n validateModifiedFiles: true,\n validateVersionsLocked: true,\n validateTsInSrc: true,\n validateNxWiring: true,\n runtimeArchitecture: true,\n validateApiRelations: true,\n validateApiLibTag: true,\n diGraph: true,\n newMethodsMaxLines: 30,\n modifiedAndNewMethodsMaxLines: 80,\n modifiedFilesMaxLines: 900,\n validationMode: 'NORMAL',\n },\n features: {\n generate: true,\n visualize: true,\n visualizeRuntime: true,\n },\n },\n};\n\nfunction normalizeOptions(\n options: ArchitecturePluginOptions | undefined,\n): Required<ArchitecturePluginOptions> {\n const circularDeps = {\n ...DEFAULT_OPTIONS.circularDeps,\n ...options?.circularDeps,\n };\n\n const workspace = {\n ...DEFAULT_OPTIONS.workspace,\n ...options?.workspace,\n validations: {\n ...DEFAULT_OPTIONS.workspace.validations,\n ...options?.workspace?.validations,\n },\n features: {\n ...DEFAULT_OPTIONS.workspace.features,\n ...options?.workspace?.features,\n },\n };\n\n return {\n circularDeps,\n workspace,\n } as Required<ArchitecturePluginOptions>;\n}\n\nasync function createNodesFunction(\n projectFiles: readonly string[],\n options: ArchitecturePluginOptions | undefined,\n context: CreateNodesContextV2,\n): Promise<CreateNodesResultV2> {\n const opts = normalizeOptions(options);\n const results: CreateNodesResultV2 = [];\n\n // Add workspace-level architecture targets\n addArchitectureProject(results, projectFiles, opts, context);\n\n // One root policy target. webpieces.config.json is not a shared input of every product project;\n // this virtual project is its sole Nx owner and the gate runs it before affected CI.\n // Add per-project targets (circular-deps, ci, di-graph)\n addPerProjectTargets(results, projectFiles, opts, context);\n\n // Append the virtual root project after concrete projects so callers that select the first result\n // for a project.json still receive that project's inferred targets.\n new RulesTarget().add(results, projectFiles);\n\n return results;\n}\n\nfunction addArchitectureProject(\n results: CreateNodesResultV2,\n projectFiles: readonly string[],\n opts: Required<ArchitecturePluginOptions>,\n context: CreateNodesContextV2,\n): void {\n if (!opts.workspace.enabled) return;\n\n const archDirPath = join(context.workspaceRoot, 'architecture');\n if (!existsSync(archDirPath)) return;\n\n const workspaceTargets = createWorkspaceTargetsWithoutPrefix(opts);\n if (Object.keys(workspaceTargets).length === 0) return;\n\n const result: CreateNodesResult = {\n projects: {\n architecture: {\n name: 'architecture',\n root: 'architecture',\n targets: workspaceTargets,\n },\n },\n };\n\n const firstProjectFile = projectFiles[0];\n if (firstProjectFile) {\n results.push([firstProjectFile, result] as const);\n }\n}\n\n\n// A project sits inside a NESTED git repo (e.g. a clone under repositories/) when any of its\n// ancestor dirs — up to but NOT including the workspace root — contains a `.git`. Such projects are\n// separate repos, not part of THIS workspace's graph, so they must not get inferred targets (that is\n// what drags foreign clones into `nx affected`). Same repo-boundary signal the AI guards use.\nexport function isInsideNestedGitRepo(workspaceRoot: string, projectRoot: string): boolean {\n let dir = projectRoot;\n while (dir && dir !== '.' && dir !== '/') {\n if (existsSync(join(workspaceRoot, dir, '.git'))) return true;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return false;\n}\n\nfunction addPerProjectTargets(\n results: CreateNodesResultV2,\n projectFiles: readonly string[],\n opts: Required<ArchitecturePluginOptions>,\n context: CreateNodesContextV2,\n): void {\n // Track processed project roots to avoid duplicates when both files exist\n const processedRoots = new Set<string>();\n\n for (const projectFile of projectFiles) {\n const isProjectJson = projectFile.endsWith('project.json');\n const isPackageJson = projectFile.endsWith('package.json');\n\n if (!isProjectJson && !isPackageJson) continue;\n\n const projectRoot = dirname(projectFile);\n\n // Skip root (workspace manifest, not a project)\n if (projectRoot === '.') continue;\n // The scoped root policy project declares check/ci itself. It has no product source to lint,\n // compile or test, so the ordinary per-project aggregate would recreate irrelevant fan-out.\n if (projectRoot === 'rules') continue;\n\n // Skip projects inside a nested git repo (vendored clones under repositories/): they are\n // separate repos and must not be swept into this workspace's `nx affected` graph.\n if (isInsideNestedGitRepo(context.workspaceRoot, projectRoot)) continue;\n\n // Skip if we've already processed this project root\n if (processedRoots.has(projectRoot)) continue;\n\n // For package.json, skip if project.json also exists in same directory\n // (prefer project.json - it will be processed separately)\n if (isPackageJson) {\n const projectJsonPath = join(context.workspaceRoot, projectRoot, 'project.json');\n if (existsSync(projectJsonPath)) continue;\n }\n\n processedRoots.add(projectRoot);\n\n const architectureEnabled =\n opts.workspace.enabled === true &&\n existsSync(join(context.workspaceRoot, 'architecture'));\n const targets = buildPerProjectTargets(\n isProjectJson,\n projectRoot,\n opts,\n architectureEnabled,\n isProjectJson ? new RawProjectJsonReader().read(context.workspaceRoot, projectFile, projectRoot) : undefined,\n );\n\n if (Object.keys(targets).length === 0) continue;\n\n const result: CreateNodesResult = {\n projects: {\n [projectRoot]: {\n targets,\n },\n },\n };\n\n results.push([projectFile, result] as const);\n }\n}\n\n/**\n * Build the target map for one project. Most targets are project.json-only\n * (package.json-only projects may not have TypeScript source); `ci` goes on all.\n */\n// webpieces-disable no-function-outside-class -- Nx requires its inference callback and target-map assembly at module scope; this existing functional plugin is invoked by Nx, not DI.\nfunction buildPerProjectTargets(\n isProjectJson: boolean,\n projectRoot: string,\n opts: Required<ArchitecturePluginOptions>,\n architectureEnabled: boolean,\n rawProject: RawProjectJson | undefined,\n): Record<string, TargetConfiguration> {\n const targets: Record<string, TargetConfiguration> = {};\n\n // Per-project validation gates that `ci` must depend on. Collected as they are added\n // so `ci` references only gates that actually exist on THIS project (a package.json-only\n // project has none).\n const validationTargets: string[] = [];\n\n // Add circular-deps target ONLY for project.json projects\n if (isProjectJson && opts.circularDeps.enabled) {\n if (!isExcluded(projectRoot, opts.circularDeps.excludePatterns!)) {\n const targetName = opts.circularDeps.targetName!;\n targets[targetName] = createCircularDepsTarget(projectRoot, targetName);\n validationTargets.push(targetName);\n }\n }\n\n // Per-project DI design DAG: regenerate design.json/design.md/design.html on every build.\n //\n // `di-graph-generate` is itself pushed onto validationTargets so `ci` still RUNS it — it used to ride\n // in only as the `dependsOn` of the deleted `validate-di-graph-unchanged` gate. There is no staleness\n // gate here any more: \"the regenerated design files are committed\" is now one repo-wide check in\n // `wp-review-upsert-pr` (see di-graph-targets.ts for why the per-project gate could not work).\n if (isProjectJson && opts.workspace.validations!.diGraph) {\n targets['di-graph-generate'] = createDiGraphGenerateTarget();\n validationTargets.push('di-graph-generate');\n }\n\n // API documents, opted into with a TAG (generate:openapi / generate:docs-site). An untagged project\n // costs this one in-memory tag check. They ride ci like every other build step — generation is\n // ordinary BUILD work, not a side channel (#1021).\n if (rawProject !== undefined) {\n const generated = new GenerateTargets(projectRoot, rawProject).infer();\n for (const [name, target] of Object.entries(generated)) {\n targets[name] = target;\n validationTargets.push(name);\n }\n }\n\n // Add ci target to ALL projects (both project.json and package.json). ci aggregates\n // lint + build + test + the validation gates that formerly rode on the compile\n // executor's targetDefaults, so a bare `build` stays a fast compile-only step.\n targets['ci'] = createCiTarget(validationTargets, architectureEnabled);\n targets['hotfix-ci'] = createHotfixCiTarget();\n\n return targets;\n}\n\n/**\n * Nx V2 Inference Plugin\n * Matches project.json and package.json files to create targets\n */\nexport const createNodesV2: CreateNodesV2<ArchitecturePluginOptions> = [\n // Pattern to match project.json and package.json files\n '**/{project,package}.json',\n\n // Inference function\n createNodesFunction,\n];\n\n/**\n * Build list of enabled validation target names for validate-complete dependency chain\n */\nfunction buildValidationTargetsList(\n validations: Required<ArchitecturePluginOptions>['workspace']['validations'],\n): string[] {\n const targets: string[] = [];\n if (validations!.noCycles) targets.push('validate-no-architecture-cycles');\n if (validations!.architectureUnchanged) targets.push('validate-architecture-unchanged');\n if (validations!.validatePackageJson) targets.push('validate-packagejson');\n // Use combined validate-code instead of 3 separate targets\n if (\n validations!.validateNewMethods ||\n validations!.validateModifiedMethods ||\n validations!.validateModifiedFiles\n ) {\n targets.push('validate-code');\n }\n if (validations!.validateVersionsLocked) targets.push('validate-versions-locked');\n if (validations!.validateTsInSrc) targets.push('validate-ts-in-src');\n if (validations!.validateNxWiring) targets.push('validate-nx-wiring');\n if (validations!.runtimeArchitecture) targets.push('validate-runtime-architecture');\n if (validations!.validateApiRelations) targets.push('validate-api-relations');\n if (validations!.validateApiLibTag) targets.push('validate-api-lib-tag');\n return targets;\n}\n\n/**\n * Create workspace-level architecture validation targets WITHOUT prefix\n * Used for virtual 'architecture' project\n */\nfunction createWorkspaceTargetsWithoutPrefix(\n opts: Required<ArchitecturePluginOptions>,\n): Record<string, TargetConfiguration> {\n const targets: Record<string, TargetConfiguration> = {};\n const graphPath = opts.workspace.graphPath!;\n const validations = opts.workspace.validations!;\n // One ValidationTargets instance, injected below to build each target config.\n const targetFactory = new ValidationTargets();\n\n // Add help target (always available)\n targets['help'] = createHelpTarget();\n\n if (opts.workspace.features!.generate) {\n targets['generate'] = createGenerateTarget(graphPath);\n }\n if (opts.workspace.features!.visualize) {\n targets['visualize'] = createVisualizeTargetWithoutPrefix(graphPath);\n }\n if (opts.workspace.features!.visualizeRuntime) {\n targets['visualize-runtime'] = createVisualizeRuntimeTarget();\n }\n if (validations.noCycles) {\n targets['validate-no-architecture-cycles'] = targetFactory.noCycles();\n }\n if (validations.architectureUnchanged) {\n targets['validate-architecture-unchanged'] = createValidateUnchangedTarget(graphPath);\n }\n if (validations.validatePackageJson) {\n targets['validate-packagejson'] = targetFactory.packageJson();\n }\n // Always available (cheap; success when a repo has no checklists). Kept out of the validate-complete /\n // ci aggregate so it does not change existing gate behavior — consumers point a required check at it.\n targets['validate-checklist-docs'] = targetFactory.checklistDocs();\n // Use combined validate-code instead of 3 separate targets\n // Options come from webpieces.config.json at the workspace root\n // (loaded via @webpieces/rules-config; same source of truth as @webpieces/ai-hook-rules)\n if (\n validations.validateNewMethods ||\n validations.validateModifiedMethods ||\n validations.validateModifiedFiles\n ) {\n targets['validate-code'] = targetFactory.code();\n }\n if (validations.validateVersionsLocked) {\n targets['validate-versions-locked'] = targetFactory.versionsLocked();\n }\n if (validations.validateTsInSrc) {\n targets['validate-ts-in-src'] = targetFactory.tsInSrc();\n }\n if (validations.validateNxWiring) {\n targets['validate-nx-wiring'] = targetFactory.nxWiring();\n }\n if (validations.runtimeArchitecture) {\n targets['validate-runtime-architecture'] = createValidateRuntimeArchitectureTarget();\n }\n if (validations.validateApiRelations) {\n targets['validate-api-relations'] = targetFactory.apiRelations();\n }\n if (validations.validateApiLibTag) {\n targets['validate-api-lib-tag'] = targetFactory.apiLibTag();\n }\n\n // Add validate-complete target that runs all enabled validations\n const validationTargets = buildValidationTargetsList(validations);\n if (validationTargets.length > 0) {\n targets['validate-complete'] = createValidateCompleteTarget(validationTargets);\n }\n\n return targets;\n}\n\nfunction createGenerateTarget(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:generate',\n cache: false,\n outputs: [\n '{workspaceRoot}/architecture/dependencies.json',\n '{workspaceRoot}/architecture/dependencies.html',\n '{workspaceRoot}/architecture/apis',\n '{workspaceRoot}/architecture/runtime-dependencies.json',\n ],\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description:\n 'Generate the architecture dependency graph (+ clickable dependencies.html) and the runtime microservice graph',\n },\n };\n}\n\nfunction createVisualizeTargetWithoutPrefix(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:visualize',\n cache: false,\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description: 'View saved architecture without refreshing; refresh: pnpm nx run architecture:generate',\n },\n };\n}\n\nfunction createValidateUnchangedTarget(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-architecture-unchanged',\n cache: false,\n inputs: ['default', '{workspaceRoot}/architecture/dependencies.json'],\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description: 'Validate the architecture matches the saved blessed graph',\n },\n };\n}\n\nfunction createValidateNewMethodsTarget(\n maxLines: number,\n mode: 'STRICT' | 'NORMAL' | 'OFF',\n): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-new-methods',\n cache: false, // Don't cache - depends on git state\n inputs: ['default'],\n options: { max: maxLines, mode },\n metadata: {\n technologies: ['nx'],\n description: `Validate new methods do not exceed ${maxLines} lines (only runs in affected mode)`,\n },\n };\n}\n\nfunction createValidateModifiedMethodsTarget(\n maxLines: number,\n mode: 'STRICT' | 'NORMAL' | 'OFF',\n): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-modified-methods',\n cache: false, // Don't cache - depends on git state\n inputs: ['default'],\n options: { max: maxLines, mode },\n metadata: {\n technologies: ['nx'],\n description: `Validate new and modified methods do not exceed ${maxLines} lines (encourages gradual cleanup)`,\n },\n };\n}\n\nfunction createValidateModifiedFilesTarget(\n maxLines: number,\n mode: 'STRICT' | 'NORMAL' | 'OFF',\n): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-modified-files',\n cache: false, // Don't cache - depends on git state\n inputs: ['default'],\n options: { max: maxLines, mode },\n metadata: {\n technologies: ['nx'],\n description: `Validate modified files do not exceed ${maxLines} lines (encourages keeping files small)`,\n },\n };\n}\n\nfunction createValidateCompleteTarget(validationTargets: string[]): TargetConfiguration {\n return {\n executor: 'nx:noop',\n cache: true,\n dependsOn: validationTargets,\n metadata: {\n technologies: ['nx'],\n description: 'Run all architecture validations (cycles, unchanged, package.json, code rules)',\n },\n };\n}\n\n/**\n * Create per-project ci target - Gradle-style composite target\n * Composite CI target: runs lint, build, test, and every validation gate.\n *\n * Validation (architecture graph completeness, per-project file-import cycles, DI-graph\n * unchanged) lives HERE, not on the build/compile target. That keeps `nx build` a fast\n * compile-only step for local iteration while `nx ci` is the full gate the PR check runs.\n *\n * The per-project gates are passed in because they exist only on project.json projects;\n * `architecture:validate-complete` is a cross-project dep added only when the workspace\n * `architecture` project exists.\n *\n * NOTE: Type checking is done by the build target (@nx/js:tsc) during compilation.\n */\n// webpieces-disable no-function-outside-class -- Nx inference plugin: createNodes invokes these as module-scope target factories; the entire plugin is intentionally functional (matching the surrounding 18 factories), a DI class is not how the Nx plugin API is called.\nexport function createCiTarget(\n perProjectValidation: string[],\n architectureEnabled: boolean,\n): TargetConfiguration {\n const dependsOn: string[] = ['lint', 'build', 'test', ...perProjectValidation];\n if (architectureEnabled) {\n dependsOn.push('architecture:validate-complete');\n }\n return {\n executor: 'nx:noop',\n cache: true,\n // The branch is part of what `ci` asserts, because the rules it aggregates can be switched off by\n // turnOffRuleWhileOnBranch. Its own cache entry is a noop, but a `ci` hash that ignores the branch\n // is a green claim about a branch that was never checked. See branch-identity-inputs.ts.\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n dependsOn,\n metadata: {\n technologies: ['nx'],\n description:\n 'Run all CI checks: lint, build, test, and validation (Gradle-style composite target)',\n },\n };\n}\n\n/** Emergency profile: retain compilation/typechecking and tests, schedule no lint or policy target. */\n// webpieces-disable no-function-outside-class -- Nx inference target factory, matching createCiTarget and invoked by the module-scope plugin callback.\nexport function createHotfixCiTarget(): TargetConfiguration {\n return {\n executor: 'nx:noop',\n cache: true,\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n dependsOn: ['build', 'test'],\n metadata: {\n technologies: ['nx'],\n description: 'Hotfix CI: compilation/typechecking and tests only; lint and Webpieces validators bypassed',\n },\n };\n}\n\nfunction createHelpTarget(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:help',\n cache: false, // Never cache - always show help output\n metadata: {\n technologies: ['nx'],\n description: 'Display help for @webpieces/nx-webpieces-rules commands and targets',\n },\n };\n}\n\n/**\n * Create per-project circular dependency checking target.\n *\n * Uses the `validate-no-file-import-cycles` executor (which bundles madge as a\n * dependency) rather than a runtime `npx madge` fetch. The executor reads\n * webpieces.config.json so the gate can be turned on/off (`mode`) and\n * time-boxed (`turnOffRuleUntilEpoch`) like every other webpieces rule.\n *\n * Note `projectRoot` is intentionally unused now — the executor derives the\n * project root from the Nx context — but the param is kept for call-site\n * symmetry with the rest of the per-project target factories.\n */\nfunction createCircularDepsTarget(_projectRoot: string, _targetName: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-no-file-import-cycles',\n cache: true,\n // BRANCH_IDENTITY_INPUTS: this gate honors turnOffRuleWhileOnBranch, and it is CACHED, so without\n // the branch in its hash a hatched green replays onto branches the hatch never covered.\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n outputs: [] as string[],\n metadata: {\n technologies: ['madge'],\n description: 'Check for circular file-import dependencies using madge',\n },\n };\n}\n\n/**\n * Check if a project should be excluded based on patterns\n */\nfunction isExcluded(projectRoot: string, excludePatterns: string[]): boolean {\n if (excludePatterns.length === 0) {\n return false;\n }\n\n // Simple glob matching (could be enhanced with minimatch if needed)\n return excludePatterns.some((pattern: string) => {\n // Convert glob pattern to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, '.*') // ** matches any path\n .replace(/\\*/g, '[^/]*'); // * matches any string except /\n\n const regex = new RegExp(`^${regexPattern}$`);\n return regex.test(projectRoot);\n });\n}\n\n/**\n * Export plugin as default for Nx\n */\nexport default { createNodesV2 };\n"]}
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAgNH,sDASC;AAyTD,wCAsBC;AAID,oDAYC;AAtjBD,+BAAqC;AACrC,2BAAgC;AAQhC,uDAG2B;AAC3B,qEAAkE;AAClE,6DAAyD;AACzD,yDAAiE;AACjE,yDAA2F;AAC3F,iDAA6C;AAoE7C,MAAM,eAAe,GAAwC;IACzD,YAAY,EAAE;QACV,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,gCAAgC;QAC5C,eAAe,EAAE,EAAE;KACtB;IACD,SAAS,EAAE;QACP,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,OAAO;QACrB,SAAS,EAAE,gCAAgC;QAC3C,WAAW,EAAE;YACT,QAAQ,EAAE,IAAI;YACd,qBAAqB,EAAE,IAAI;YAC3B,mBAAmB,EAAE,IAAI;YACzB,kBAAkB,EAAE,IAAI;YACxB,uBAAuB,EAAE,IAAI;YAC7B,qBAAqB,EAAE,IAAI;YAC3B,sBAAsB,EAAE,IAAI;YAC5B,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,IAAI;YACtB,mBA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B,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,sBAAsB;aAC7C,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC;QAE9D,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,kBAAe,EAAE,aAAa,EAAb,qBAAa,EAAE,CAAC","sourcesContent":["/**\n * Unified Nx Inference Plugin for @webpieces/nx-webpieces-rules\n *\n * This plugin automatically creates targets for:\n * 1. Workspace-level architecture validation (generate, visualize, validate-*)\n * 2. Per-project circular dependency checking\n * 3. Per-project API documents, opted into with a TAG: `generate:openapi` infers `openapi-generate`,\n * `generate:openapi-components` infers `openapi-components-generate` (a DTO library's\n * components.openapi.json), `generate:docs-site` infers `openapi-generate` + `docs-generate`\n * (see generate-targets.ts)\n *\n * Install with: nx add @webpieces/nx-webpieces-rules\n *\n * Usage:\n * Add to nx.json plugins array:\n * {\n * \"plugins\": [\"@webpieces/nx-webpieces-rules\"]\n * }\n *\n * Then all targets appear automatically without manual project.json configuration.\n */\n\nimport { dirname, join } from 'path';\nimport { existsSync } from 'fs';\nimport type {\n CreateNodesV2,\n CreateNodesContextV2,\n CreateNodesResultV2,\n CreateNodesResult,\n TargetConfiguration,\n} from '@nx/devkit';\nimport {\n createVisualizeRuntimeTarget,\n createValidateRuntimeArchitectureTarget,\n} from './runtime-targets';\nimport { BRANCH_IDENTITY_INPUTS } from './branch-identity-inputs';\nimport { ValidationTargets } from './validation-targets';\nimport { createDiGraphGenerateTarget } from './di-graph-targets';\nimport { GenerateTargets, RawProjectJson, RawProjectJsonReader } from './generate-targets';\nimport { RulesTarget } from './rules-target';\n\n/**\n * Circular dependency checking options\n */\nexport interface CircularDepsOptions {\n enabled?: boolean;\n targetName?: string;\n excludePatterns?: string[];\n}\n\n/**\n * Validation options for architecture checks\n */\nexport interface ValidationOptions {\n noCycles?: boolean;\n architectureUnchanged?: boolean;\n validatePackageJson?: boolean;\n validateNewMethods?: boolean;\n validateModifiedMethods?: boolean;\n validateModifiedFiles?: boolean;\n validateVersionsLocked?: boolean;\n validateTsInSrc?: boolean;\n validateNxWiring?: boolean;\n runtimeArchitecture?: boolean;\n validateApiRelations?: boolean;\n validateApiLibTag?: boolean;\n diGraph?: boolean;\n newMethodsMaxLines?: number;\n modifiedAndNewMethodsMaxLines?: number;\n modifiedFilesMaxLines?: number;\n /**\n * Validation mode for method/file size limits:\n * - STRICT: All limits enforced, disable comments ignored\n * - NORMAL: Limits enforced, disable comments with dates work\n * - OFF: Skip size validations entirely (for fast iteration)\n */\n validationMode?: 'STRICT' | 'NORMAL' | 'OFF';\n}\n\n/**\n * Feature flags for workspace targets\n */\nexport interface FeatureOptions {\n generate?: boolean;\n visualize?: boolean;\n visualizeRuntime?: boolean;\n}\n\n/**\n * Workspace-level configuration options\n */\nexport interface WorkspaceOptions {\n enabled?: boolean;\n targetPrefix?: string;\n graphPath?: string;\n validations?: ValidationOptions;\n features?: FeatureOptions;\n}\n\n/**\n * Configuration for @webpieces/nx-webpieces-rules Nx plugin\n */\nexport interface ArchitecturePluginOptions {\n circularDeps?: CircularDepsOptions;\n workspace?: WorkspaceOptions;\n}\n\nconst DEFAULT_OPTIONS: Required<ArchitecturePluginOptions> = {\n circularDeps: {\n enabled: true,\n targetName: 'validate-no-file-import-cycles',\n excludePatterns: [],\n },\n workspace: {\n enabled: true,\n targetPrefix: 'arch:',\n graphPath: 'architecture/dependencies.json',\n validations: {\n noCycles: true,\n architectureUnchanged: true,\n validatePackageJson: true,\n validateNewMethods: true,\n validateModifiedMethods: true,\n validateModifiedFiles: true,\n validateVersionsLocked: true,\n validateTsInSrc: true,\n validateNxWiring: true,\n runtimeArchitecture: true,\n validateApiRelations: true,\n validateApiLibTag: true,\n diGraph: true,\n newMethodsMaxLines: 30,\n modifiedAndNewMethodsMaxLines: 80,\n modifiedFilesMaxLines: 900,\n validationMode: 'NORMAL',\n },\n features: {\n generate: true,\n visualize: true,\n visualizeRuntime: true,\n },\n },\n};\n\nfunction normalizeOptions(\n options: ArchitecturePluginOptions | undefined,\n): Required<ArchitecturePluginOptions> {\n const circularDeps = {\n ...DEFAULT_OPTIONS.circularDeps,\n ...options?.circularDeps,\n };\n\n const workspace = {\n ...DEFAULT_OPTIONS.workspace,\n ...options?.workspace,\n validations: {\n ...DEFAULT_OPTIONS.workspace.validations,\n ...options?.workspace?.validations,\n },\n features: {\n ...DEFAULT_OPTIONS.workspace.features,\n ...options?.workspace?.features,\n },\n };\n\n return {\n circularDeps,\n workspace,\n } as Required<ArchitecturePluginOptions>;\n}\n\nasync function createNodesFunction(\n projectFiles: readonly string[],\n options: ArchitecturePluginOptions | undefined,\n context: CreateNodesContextV2,\n): Promise<CreateNodesResultV2> {\n const opts = normalizeOptions(options);\n const results: CreateNodesResultV2 = [];\n\n // Add workspace-level architecture targets\n addArchitectureProject(results, projectFiles, opts, context);\n\n // One root policy target. webpieces.config.json is not a shared input of every product project;\n // this virtual project is its sole Nx owner and the gate runs it before affected CI.\n // Add per-project targets (circular-deps, ci, di-graph)\n addPerProjectTargets(results, projectFiles, opts, context);\n\n // Append the virtual root project after concrete projects so callers that select the first result\n // for a project.json still receive that project's inferred targets.\n new RulesTarget().add(results, projectFiles);\n\n return results;\n}\n\nfunction addArchitectureProject(\n results: CreateNodesResultV2,\n projectFiles: readonly string[],\n opts: Required<ArchitecturePluginOptions>,\n context: CreateNodesContextV2,\n): void {\n if (!opts.workspace.enabled) return;\n\n const archDirPath = join(context.workspaceRoot, 'architecture');\n if (!existsSync(archDirPath)) return;\n\n const workspaceTargets = createWorkspaceTargetsWithoutPrefix(opts);\n if (Object.keys(workspaceTargets).length === 0) return;\n\n const result: CreateNodesResult = {\n projects: {\n architecture: {\n name: 'architecture',\n root: 'architecture',\n targets: workspaceTargets,\n },\n },\n };\n\n const firstProjectFile = projectFiles[0];\n if (firstProjectFile) {\n results.push([firstProjectFile, result] as const);\n }\n}\n\n// A project sits inside a NESTED git repo (e.g. a clone under repositories/) when any of its\n// ancestor dirs — up to but NOT including the workspace root — contains a `.git`. Such projects are\n// separate repos, not part of THIS workspace's graph, so they must not get inferred targets (that is\n// what drags foreign clones into `nx affected`). Same repo-boundary signal the AI guards use.\nexport function isInsideNestedGitRepo(workspaceRoot: string, projectRoot: string): boolean {\n let dir = projectRoot;\n while (dir && dir !== '.' && dir !== '/') {\n if (existsSync(join(workspaceRoot, dir, '.git'))) return true;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return false;\n}\n\nfunction addPerProjectTargets(\n results: CreateNodesResultV2,\n projectFiles: readonly string[],\n opts: Required<ArchitecturePluginOptions>,\n context: CreateNodesContextV2,\n): void {\n // Track processed project roots to avoid duplicates when both files exist\n const processedRoots = new Set<string>();\n\n for (const projectFile of projectFiles) {\n const isProjectJson = projectFile.endsWith('project.json');\n const isPackageJson = projectFile.endsWith('package.json');\n\n if (!isProjectJson && !isPackageJson) continue;\n\n const projectRoot = dirname(projectFile);\n\n // Skip root (workspace manifest, not a project)\n if (projectRoot === '.') continue;\n // The scoped root policy project declares check/ci itself. It has no product source to lint,\n // compile or test, so the ordinary per-project aggregate would recreate irrelevant fan-out.\n if (projectRoot === 'rules') continue;\n\n // Skip projects inside a nested git repo (vendored clones under repositories/): they are\n // separate repos and must not be swept into this workspace's `nx affected` graph.\n if (isInsideNestedGitRepo(context.workspaceRoot, projectRoot)) continue;\n\n // Skip if we've already processed this project root\n if (processedRoots.has(projectRoot)) continue;\n\n // For package.json, skip if project.json also exists in same directory\n // (prefer project.json - it will be processed separately)\n if (isPackageJson) {\n const projectJsonPath = join(context.workspaceRoot, projectRoot, 'project.json');\n if (existsSync(projectJsonPath)) continue;\n }\n\n processedRoots.add(projectRoot);\n\n const architectureEnabled =\n opts.workspace.enabled === true &&\n existsSync(join(context.workspaceRoot, 'architecture'));\n const targets = buildPerProjectTargets(\n isProjectJson,\n projectRoot,\n opts,\n architectureEnabled,\n isProjectJson\n ? new RawProjectJsonReader().read(context.workspaceRoot, projectFile, projectRoot)\n : undefined,\n );\n\n if (Object.keys(targets).length === 0) continue;\n\n const result: CreateNodesResult = {\n projects: {\n [projectRoot]: {\n targets,\n },\n },\n };\n\n results.push([projectFile, result] as const);\n }\n}\n\n/**\n * Build the target map for one project. Most targets are project.json-only\n * (package.json-only projects may not have TypeScript source); `ci` goes on all.\n */\n// webpieces-disable no-function-outside-class -- Nx requires its inference callback and target-map assembly at module scope; this existing functional plugin is invoked by Nx, not DI.\nfunction buildPerProjectTargets(\n isProjectJson: boolean,\n projectRoot: string,\n opts: Required<ArchitecturePluginOptions>,\n architectureEnabled: boolean,\n rawProject: RawProjectJson | undefined,\n): Record<string, TargetConfiguration> {\n const targets: Record<string, TargetConfiguration> = {};\n\n // Per-project validation gates that `ci` must depend on. Collected as they are added\n // so `ci` references only gates that actually exist on THIS project (a package.json-only\n // project has none).\n const validationTargets: string[] = [];\n\n // Add circular-deps target ONLY for project.json projects\n if (isProjectJson && opts.circularDeps.enabled) {\n if (!isExcluded(projectRoot, opts.circularDeps.excludePatterns!)) {\n const targetName = opts.circularDeps.targetName!;\n targets[targetName] = createCircularDepsTarget(projectRoot, targetName);\n validationTargets.push(targetName);\n }\n }\n\n // Per-project DI design DAG: regenerate design.json/design.md/design.html on every build.\n //\n // `di-graph-generate` is itself pushed onto validationTargets so `ci` still RUNS it — it used to ride\n // in only as the `dependsOn` of the deleted `validate-di-graph-unchanged` gate. There is no staleness\n // gate here any more: \"the regenerated design files are committed\" is now one repo-wide check in\n // `wp-review-upsert-pr` (see di-graph-targets.ts for why the per-project gate could not work).\n if (isProjectJson && opts.workspace.validations!.diGraph) {\n targets['di-graph-generate'] = createDiGraphGenerateTarget();\n validationTargets.push('di-graph-generate');\n }\n\n // API documents, opted into with a TAG (generate:openapi / generate:docs-site). An untagged project\n // costs this one in-memory tag check. They ride ci like every other build step — generation is\n // ordinary BUILD work, not a side channel (#1021).\n if (rawProject !== undefined) {\n const generated = new GenerateTargets(projectRoot, rawProject).infer();\n for (const [name, target] of Object.entries(generated)) {\n targets[name] = target;\n validationTargets.push(name);\n }\n }\n\n // Add ci target to ALL projects (both project.json and package.json). ci aggregates\n // lint + build + test + the validation gates that formerly rode on the compile\n // executor's targetDefaults, so a bare `build` stays a fast compile-only step.\n targets['ci'] = createCiTarget(validationTargets, architectureEnabled);\n targets['hotfix-ci'] = createHotfixCiTarget();\n\n return targets;\n}\n\n/**\n * Nx V2 Inference Plugin\n * Matches project.json and package.json files to create targets\n */\nexport const createNodesV2: CreateNodesV2<ArchitecturePluginOptions> = [\n // Pattern to match project.json and package.json files\n '**/{project,package}.json',\n\n // Inference function\n createNodesFunction,\n];\n\n/**\n * Build list of enabled validation target names for validate-complete dependency chain\n */\nfunction buildValidationTargetsList(\n validations: Required<ArchitecturePluginOptions>['workspace']['validations'],\n): string[] {\n const targets: string[] = [];\n if (validations!.noCycles) targets.push('validate-no-architecture-cycles');\n if (validations!.architectureUnchanged) targets.push('validate-architecture-unchanged');\n if (validations!.validatePackageJson) targets.push('validate-packagejson');\n // Use combined validate-code instead of 3 separate targets\n if (\n validations!.validateNewMethods ||\n validations!.validateModifiedMethods ||\n validations!.validateModifiedFiles\n ) {\n targets.push('validate-code');\n }\n if (validations!.validateVersionsLocked) targets.push('validate-versions-locked');\n if (validations!.validateTsInSrc) targets.push('validate-ts-in-src');\n if (validations!.validateNxWiring) targets.push('validate-nx-wiring');\n if (validations!.runtimeArchitecture) targets.push('validate-runtime-architecture');\n if (validations!.validateApiRelations) targets.push('validate-api-relations');\n if (validations!.validateApiLibTag) targets.push('validate-api-lib-tag');\n return targets;\n}\n\n/**\n * Create workspace-level architecture validation targets WITHOUT prefix\n * Used for virtual 'architecture' project\n */\nfunction createWorkspaceTargetsWithoutPrefix(\n opts: Required<ArchitecturePluginOptions>,\n): Record<string, TargetConfiguration> {\n const targets: Record<string, TargetConfiguration> = {};\n const graphPath = opts.workspace.graphPath!;\n const validations = opts.workspace.validations!;\n // One ValidationTargets instance, injected below to build each target config.\n const targetFactory = new ValidationTargets();\n\n // Add help target (always available)\n targets['help'] = createHelpTarget();\n\n if (opts.workspace.features!.generate) {\n targets['generate'] = createGenerateTarget(graphPath);\n }\n if (opts.workspace.features!.visualize) {\n targets['visualize'] = createVisualizeTargetWithoutPrefix(graphPath);\n }\n if (opts.workspace.features!.visualizeRuntime) {\n targets['visualize-runtime'] = createVisualizeRuntimeTarget();\n }\n if (validations.noCycles) {\n targets['validate-no-architecture-cycles'] = targetFactory.noCycles();\n }\n if (validations.architectureUnchanged) {\n targets['validate-architecture-unchanged'] = createValidateUnchangedTarget(graphPath);\n }\n if (validations.validatePackageJson) {\n targets['validate-packagejson'] = targetFactory.packageJson();\n }\n // Always available (cheap; success when a repo has no checklists). Kept out of the validate-complete /\n // ci aggregate so it does not change existing gate behavior — consumers point a required check at it.\n targets['validate-checklist-docs'] = targetFactory.checklistDocs();\n // Use combined validate-code instead of 3 separate targets\n // Options come from declared owner files' direct policy-ID maps, resolved by\n // @webpieces/rules-config from the root rulePacks declaration.\n if (\n validations.validateNewMethods ||\n validations.validateModifiedMethods ||\n validations.validateModifiedFiles\n ) {\n targets['validate-code'] = targetFactory.code();\n }\n if (validations.validateVersionsLocked) {\n targets['validate-versions-locked'] = targetFactory.versionsLocked();\n }\n if (validations.validateTsInSrc) {\n targets['validate-ts-in-src'] = targetFactory.tsInSrc();\n }\n if (validations.validateNxWiring) {\n targets['validate-nx-wiring'] = targetFactory.nxWiring();\n }\n if (validations.runtimeArchitecture) {\n targets['validate-runtime-architecture'] = createValidateRuntimeArchitectureTarget();\n }\n if (validations.validateApiRelations) {\n targets['validate-api-relations'] = targetFactory.apiRelations();\n }\n if (validations.validateApiLibTag) {\n targets['validate-api-lib-tag'] = targetFactory.apiLibTag();\n }\n\n // Add validate-complete target that runs all enabled validations\n const validationTargets = buildValidationTargetsList(validations);\n if (validationTargets.length > 0) {\n targets['validate-complete'] = createValidateCompleteTarget(validationTargets);\n }\n\n return targets;\n}\n\nfunction createGenerateTarget(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:generate',\n cache: false,\n outputs: [\n '{workspaceRoot}/architecture/dependencies.json',\n '{workspaceRoot}/architecture/dependencies.html',\n '{workspaceRoot}/architecture/apis',\n '{workspaceRoot}/architecture/runtime-dependencies.json',\n ],\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description:\n 'Generate the architecture dependency graph (+ clickable dependencies.html) and the runtime microservice graph',\n },\n };\n}\n\nfunction createVisualizeTargetWithoutPrefix(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:visualize',\n cache: false,\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description: 'View saved architecture without refreshing; refresh: pnpm nx run architecture:generate',\n },\n };\n}\n\nfunction createValidateUnchangedTarget(graphPath: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-architecture-unchanged',\n cache: false,\n inputs: ['default', '{workspaceRoot}/architecture/dependencies.json'],\n options: { graphPath },\n metadata: {\n technologies: ['nx'],\n description: 'Validate the architecture matches the saved blessed graph',\n },\n };\n}\n\nfunction createValidateCompleteTarget(validationTargets: string[]): TargetConfiguration {\n return {\n executor: 'nx:noop',\n cache: true,\n dependsOn: validationTargets,\n metadata: {\n technologies: ['nx'],\n description:\n 'Run all architecture validations (cycles, unchanged, package.json, code rules)',\n },\n };\n}\n\n/**\n * Create per-project ci target - Gradle-style composite target\n * Composite CI target: runs lint, build, test, and every validation gate.\n *\n * Validation (architecture graph completeness, per-project file-import cycles, DI-graph\n * unchanged) lives HERE, not on the build/compile target. That keeps `nx build` a fast\n * compile-only step for local iteration while `nx ci` is the full gate the PR check runs.\n *\n * The per-project gates are passed in because they exist only on project.json projects;\n * `architecture:validate-complete` is a cross-project dep added only when the workspace\n * `architecture` project exists.\n *\n * NOTE: Type checking is done by the build target (@nx/js:tsc) during compilation.\n */\n// webpieces-disable no-function-outside-class -- Nx inference plugin: createNodes invokes these as module-scope target factories; the entire plugin is intentionally functional (matching the surrounding 18 factories), a DI class is not how the Nx plugin API is called.\nexport function createCiTarget(\n perProjectValidation: string[],\n architectureEnabled: boolean,\n): TargetConfiguration {\n const dependsOn: string[] = ['lint', 'build', 'test', ...perProjectValidation];\n if (architectureEnabled) {\n dependsOn.push('architecture:validate-complete');\n }\n return {\n executor: 'nx:noop',\n cache: true,\n // The branch is part of what `ci` asserts, because the rules it aggregates can be switched off by\n // turnOffRuleWhileOnBranch. Its own cache entry is a noop, but a `ci` hash that ignores the branch\n // is a green claim about a branch that was never checked. See branch-identity-inputs.ts.\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n dependsOn,\n metadata: {\n technologies: ['nx'],\n description:\n 'Run all CI checks: lint, build, test, and validation (Gradle-style composite target)',\n },\n };\n}\n\n/** Emergency profile: retain compilation/typechecking and tests, schedule no lint or policy target. */\n// webpieces-disable no-function-outside-class -- Nx inference target factory, matching createCiTarget and invoked by the module-scope plugin callback.\nexport function createHotfixCiTarget(): TargetConfiguration {\n return {\n executor: 'nx:noop',\n cache: true,\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n dependsOn: ['build', 'test'],\n metadata: {\n technologies: ['nx'],\n description:\n 'Hotfix CI: compilation/typechecking and tests only; lint and Webpieces validators bypassed',\n },\n };\n}\n\nfunction createHelpTarget(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:help',\n cache: false, // Never cache - always show help output\n metadata: {\n technologies: ['nx'],\n description: 'Display help for @webpieces/nx-webpieces-rules commands and targets',\n },\n };\n}\n\n/**\n * Create per-project circular dependency checking target.\n *\n * Uses the `validate-no-file-import-cycles` executor (which bundles madge as a\n * dependency) rather than a runtime `npx madge` fetch. The executor reads\n * the declared Nx owner file's direct policy-ID map to turn the gate on/off (`mode`) and\n * time-boxed (`turnOffRuleUntilEpoch`) like every other webpieces rule.\n *\n * Note `projectRoot` is intentionally unused now — the executor derives the\n * project root from the Nx context — but the param is kept for call-site\n * symmetry with the rest of the per-project target factories.\n */\nfunction createCircularDepsTarget(_projectRoot: string, _targetName: string): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-no-file-import-cycles',\n cache: true,\n // BRANCH_IDENTITY_INPUTS: this gate honors turnOffRuleWhileOnBranch, and it is CACHED, so without\n // the branch in its hash a hatched green replays onto branches the hatch never covered.\n inputs: ['default', ...BRANCH_IDENTITY_INPUTS],\n outputs: [] as string[],\n metadata: {\n technologies: ['madge'],\n description: 'Check for circular file-import dependencies using madge',\n },\n };\n}\n\n/**\n * Check if a project should be excluded based on patterns\n */\nfunction isExcluded(projectRoot: string, excludePatterns: string[]): boolean {\n if (excludePatterns.length === 0) {\n return false;\n }\n\n // Simple glob matching (could be enhanced with minimatch if needed)\n return excludePatterns.some((pattern: string) => {\n // Convert glob pattern to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, '.*') // ** matches any path\n .replace(/\\*/g, '[^/]*'); // * matches any string except /\n\n const regex = new RegExp(`^${regexPattern}$`);\n return regex.test(projectRoot);\n });\n}\n\n/**\n * Export plugin as default for Nx\n */\nexport default { createNodesV2 };\n"]}
|
package/src/rule-help.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ruleHelp = void 0;
|
|
4
|
+
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
5
|
+
/** Owner-authored guidance consumed by the registry catalog. */
|
|
6
|
+
exports.ruleHelp = {
|
|
7
|
+
'no-file-import-cycles': new rules_sdk_1.RuleHelp('Keep each project free of circular file imports.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
8
|
+
'runtime-architecture': new rules_sdk_1.RuleHelp('Validate runtime service and API dependency declarations.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
9
|
+
'nx-wiring': new rules_sdk_1.RuleHelp('Wire the required validation targets into the Nx execution graph.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
10
|
+
'di-graph': new rules_sdk_1.RuleHelp('Generate and validate dependency-injection design graphs.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
11
|
+
'missing-design-annotation': new rules_sdk_1.RuleHelp('Declare the application design roots required for DI analysis.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
12
|
+
'validate-architecture-unchanged': new rules_sdk_1.RuleHelp('Keep the committed architecture graph aligned with current dependencies.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
13
|
+
'validate-no-architecture-cycles': new rules_sdk_1.RuleHelp('Keep the project dependency architecture free of cycles.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
14
|
+
'validate-packagejson': new rules_sdk_1.RuleHelp('Align package dependencies with declared project dependencies.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
15
|
+
'validate-versions-locked': new rules_sdk_1.RuleHelp('Pin dependency versions consistently across governed projects.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
16
|
+
'validate-eslint-sync': new rules_sdk_1.RuleHelp('Keep managed ESLint configuration synchronized with its installed templates.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
17
|
+
'no-root-union-api-type': new rules_sdk_1.RuleHelp('Use a stable named root API contract rather than a root union type.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
18
|
+
'api-rules-for-openapi': new rules_sdk_1.RuleHelp('Validate API contracts against their configured OpenAPI requirements.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
19
|
+
'api-rules-for-mcp': new rules_sdk_1.RuleHelp('Validate API contracts against their configured MCP requirements.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
20
|
+
'api-lib-dependencies': new rules_sdk_1.RuleHelp('Validate the configured API library dependency relationships.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
21
|
+
'api-lib-path': new rules_sdk_1.RuleHelp('Use the configured paths for API contract libraries.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
22
|
+
'framework-folder': new rules_sdk_1.RuleHelp('Align framework declarations with their project folder layout.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=rule-help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-help.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/rule-help.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,gEAAgE;AACnD,QAAA,QAAQ,GAAuC;IACxD,uBAAuB,EAAE,IAAI,oBAAQ,CACjC,kDAAkD,EAClD,sIAAsI,CACzI;IACD,sBAAsB,EAAE,IAAI,oBAAQ,CAChC,2DAA2D,EAC3D,sIAAsI,CACzI;IACD,WAAW,EAAE,IAAI,oBAAQ,CACrB,mEAAmE,EACnE,sIAAsI,CACzI;IACD,UAAU,EAAE,IAAI,oBAAQ,CACpB,2DAA2D,EAC3D,sIAAsI,CACzI;IACD,2BAA2B,EAAE,IAAI,oBAAQ,CACrC,gEAAgE,EAChE,sIAAsI,CACzI;IACD,iCAAiC,EAAE,IAAI,oBAAQ,CAC3C,0EAA0E,EAC1E,sIAAsI,CACzI;IACD,iCAAiC,EAAE,IAAI,oBAAQ,CAC3C,0DAA0D,EAC1D,sIAAsI,CACzI;IACD,sBAAsB,EAAE,IAAI,oBAAQ,CAChC,gEAAgE,EAChE,sIAAsI,CACzI;IACD,0BAA0B,EAAE,IAAI,oBAAQ,CACpC,gEAAgE,EAChE,sIAAsI,CACzI;IACD,sBAAsB,EAAE,IAAI,oBAAQ,CAChC,8EAA8E,EAC9E,sIAAsI,CACzI;IACD,wBAAwB,EAAE,IAAI,oBAAQ,CAClC,qEAAqE,EACrE,sIAAsI,CACzI;IACD,uBAAuB,EAAE,IAAI,oBAAQ,CACjC,uEAAuE,EACvE,sIAAsI,CACzI;IACD,mBAAmB,EAAE,IAAI,oBAAQ,CAC7B,mEAAmE,EACnE,sIAAsI,CACzI;IACD,sBAAsB,EAAE,IAAI,oBAAQ,CAChC,+DAA+D,EAC/D,sIAAsI,CACzI;IACD,cAAc,EAAE,IAAI,oBAAQ,CACxB,sDAAsD,EACtD,sIAAsI,CACzI;IACD,kBAAkB,EAAE,IAAI,oBAAQ,CAC5B,gEAAgE,EAChE,sIAAsI,CACzI;CACJ,CAAC","sourcesContent":["import { RuleHelp } from '@webpieces/rules-sdk';\n\n/** Owner-authored guidance consumed by the registry catalog. */\nexport const ruleHelp: Readonly<Record<string, RuleHelp>> = {\n 'no-file-import-cycles': new RuleHelp(\n 'Keep each project free of circular file imports.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'runtime-architecture': new RuleHelp(\n 'Validate runtime service and API dependency declarations.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'nx-wiring': new RuleHelp(\n 'Wire the required validation targets into the Nx execution graph.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'di-graph': new RuleHelp(\n 'Generate and validate dependency-injection design graphs.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'missing-design-annotation': new RuleHelp(\n 'Declare the application design roots required for DI analysis.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'validate-architecture-unchanged': new RuleHelp(\n 'Keep the committed architecture graph aligned with current dependencies.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'validate-no-architecture-cycles': new RuleHelp(\n 'Keep the project dependency architecture free of cycles.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'validate-packagejson': new RuleHelp(\n 'Align package dependencies with declared project dependencies.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'validate-versions-locked': new RuleHelp(\n 'Pin dependency versions consistently across governed projects.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'validate-eslint-sync': new RuleHelp(\n 'Keep managed ESLint configuration synchronized with its installed templates.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'no-root-union-api-type': new RuleHelp(\n 'Use a stable named root API contract rather than a root union type.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'api-rules-for-openapi': new RuleHelp(\n 'Validate API contracts against their configured OpenAPI requirements.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'api-rules-for-mcp': new RuleHelp(\n 'Validate API contracts against their configured MCP requirements.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'api-lib-dependencies': new RuleHelp(\n 'Validate the configured API library dependency relationships.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'api-lib-path': new RuleHelp(\n 'Use the configured paths for API contract libraries.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'framework-folder': new RuleHelp(\n 'Align framework declarations with their project folder layout.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n};\n"]}
|
package/src/rule-pack.js
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rulePackManifest = void 0;
|
|
4
|
-
const rule_migrations_1 = require("./rule-migrations");
|
|
5
|
-
const rule_settings_1 = require("./rule-settings");
|
|
6
4
|
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const api_doc_rules_config_1 = require("./configs/api-doc-rules-config");
|
|
10
|
-
const tag_truth_configs_1 = require("./configs/tag-truth-configs");
|
|
5
|
+
const rule_migrations_1 = require("./rule-migrations");
|
|
6
|
+
const nx_policy_registry_1 = require("./nx-policy-registry");
|
|
11
7
|
const package_json_1 = require("../package.json");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
new rules_sdk_1.
|
|
15
|
-
new rules_sdk_1.OwnedRuleDefinition('runtime-architecture', rule_configs_1.RuntimeArchitectureConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['runtime-architecture'], rule_settings_1.recommendedSeeds['runtime-architecture'], 'rules'),
|
|
16
|
-
new rules_sdk_1.OwnedRuleDefinition('nx-wiring', rule_configs_1.NxWiringConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['nx-wiring'], rule_settings_1.recommendedSeeds['nx-wiring'], 'rules'),
|
|
17
|
-
new rules_sdk_1.OwnedRuleDefinition('di-graph', rule_configs_1.DiGraphConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['di-graph'], rule_settings_1.recommendedSeeds['di-graph'], 'rules'),
|
|
18
|
-
new rules_sdk_1.OwnedRuleDefinition('missing-design-annotation', rule_configs_1.MissingDesignAnnotationConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['missing-design-annotation'], rule_settings_1.recommendedSeeds['missing-design-annotation'], 'rules'),
|
|
19
|
-
new rules_sdk_1.OwnedRuleDefinition('validate-architecture-unchanged', rule_configs_1.ValidateArchitectureUnchangedConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-architecture-unchanged'], rule_settings_1.recommendedSeeds['validate-architecture-unchanged'], 'rules'),
|
|
20
|
-
new rules_sdk_1.OwnedRuleDefinition('validate-no-architecture-cycles', rule_configs_1.ValidateNoArchitectureCyclesConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-no-architecture-cycles'], rule_settings_1.recommendedSeeds['validate-no-architecture-cycles'], 'rules'),
|
|
21
|
-
new rules_sdk_1.OwnedRuleDefinition('validate-packagejson', rule_configs_1.ValidatePackageJsonConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-packagejson'], rule_settings_1.recommendedSeeds['validate-packagejson'], 'rules'),
|
|
22
|
-
new rules_sdk_1.OwnedRuleDefinition('validate-versions-locked', rule_configs_1.ValidateVersionsLockedConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-versions-locked'], rule_settings_1.recommendedSeeds['validate-versions-locked'], 'rules'),
|
|
23
|
-
new rules_sdk_1.OwnedRuleDefinition('validate-eslint-sync', rule_configs_1.ValidateEslintSyncConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['validate-eslint-sync'], rule_settings_1.recommendedSeeds['validate-eslint-sync'], 'rules'),
|
|
24
|
-
new rules_sdk_1.OwnedRuleDefinition('no-root-union-api-type', no_root_union_config_1.NoRootUnionApiTypeConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['no-root-union-api-type'], rule_settings_1.recommendedSeeds['no-root-union-api-type'], 'rules'),
|
|
25
|
-
new rules_sdk_1.OwnedRuleDefinition('api-rules-for-openapi', api_doc_rules_config_1.ApiRulesForOpenApiConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-rules-for-openapi'], rule_settings_1.recommendedSeeds['api-rules-for-openapi'], 'rules'),
|
|
26
|
-
new rules_sdk_1.OwnedRuleDefinition('api-rules-for-mcp', api_doc_rules_config_1.ApiRulesForMcpConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-rules-for-mcp'], rule_settings_1.recommendedSeeds['api-rules-for-mcp'], 'rules'),
|
|
27
|
-
new rules_sdk_1.OwnedRuleDefinition('api-lib-dependencies', tag_truth_configs_1.ApiLibDependenciesConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-lib-dependencies'], rule_settings_1.recommendedSeeds['api-lib-dependencies'], 'rules'),
|
|
28
|
-
new rules_sdk_1.OwnedRuleDefinition('api-lib-path', tag_truth_configs_1.ApiLibPathConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['api-lib-path'], rule_settings_1.recommendedSeeds['api-lib-path'], 'rules'),
|
|
29
|
-
new rules_sdk_1.OwnedRuleDefinition('framework-folder', tag_truth_configs_1.FrameworkFolderConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning['framework-folder'], rule_settings_1.recommendedSeeds['framework-folder'], 'rules'),
|
|
30
|
-
];
|
|
31
|
-
exports.rulePackManifest = new rules_sdk_1.RulePackManifest('@webpieces/nx-webpieces-rules', package_json_1.version, rules_sdk_1.RULE_PACK_API_VERSION, ownedRules, [
|
|
32
|
-
...ownedRules.map(rule => new rules_sdk_1.RuleContribution(rule.id, '@webpieces/nx-webpieces-rules', 'build')),
|
|
33
|
-
new rules_sdk_1.RuleContribution('validate-ts-in-src', '@webpieces/ai-hook-rules', 'build'),
|
|
8
|
+
exports.rulePackManifest = new rules_sdk_1.RulePackManifest('@webpieces/nx-webpieces-rules', package_json_1.version, rules_sdk_1.RULE_PACK_API_VERSION, nx_policy_registry_1.NX_POLICIES.map((policy) => policy.definition), [
|
|
9
|
+
...nx_policy_registry_1.NX_POLICIES.map((policy) => new rules_sdk_1.RuleContribution(policy.definition.id, '@webpieces/nx-webpieces-rules', 'build', '@webpieces/nx-webpieces-rules/rule-runtime')),
|
|
10
|
+
new rules_sdk_1.RuleContribution('validate-ts-in-src', '@webpieces/ai-hook-rules', 'build', '@webpieces/nx-webpieces-rules/rule-runtime'),
|
|
34
11
|
], rule_migrations_1.ruleMigrations, []);
|
|
35
12
|
//# sourceMappingURL=rule-pack.js.map
|
package/src/rule-pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-pack.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/rule-pack.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"rule-pack.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/rule-pack.ts"],"names":[],"mappings":";;;AAAA,oDAAiG;AACjG,uDAAmD;AACnD,6DAA6D;AAC7D,kDAA0C;AAE7B,QAAA,gBAAgB,GAAG,IAAI,4BAAgB,CAChD,+BAA+B,EAC/B,sBAAO,EACP,iCAAqB,EACrB,gCAAW,CAAC,GAAG,CAAC,CAAC,MAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EACxD;IACI,GAAG,gCAAW,CAAC,GAAG,CACd,CAAC,MAAgB,EAAE,EAAE,CACjB,IAAI,4BAAgB,CAChB,MAAM,CAAC,UAAU,CAAC,EAAE,EACpB,+BAA+B,EAC/B,OAAO,EACP,4CAA4C,CAC/C,CACR;IACD,IAAI,4BAAgB,CAChB,oBAAoB,EACpB,0BAA0B,EAC1B,OAAO,EACP,4CAA4C,CAC/C;CACJ,EACD,gCAAc,EACd,EAAE,CACL,CAAC","sourcesContent":["import { RuleContribution, RulePackManifest, RULE_PACK_API_VERSION } from '@webpieces/rules-sdk';\nimport { ruleMigrations } from './rule-migrations';\nimport { NX_POLICIES, NxPolicy } from './nx-policy-registry';\nimport { version } from '../package.json';\n\nexport const rulePackManifest = new RulePackManifest(\n '@webpieces/nx-webpieces-rules',\n version,\n RULE_PACK_API_VERSION,\n NX_POLICIES.map((policy: NxPolicy) => policy.definition),\n [\n ...NX_POLICIES.map(\n (policy: NxPolicy) =>\n new RuleContribution(\n policy.definition.id,\n '@webpieces/nx-webpieces-rules',\n 'build',\n '@webpieces/nx-webpieces-rules/rule-runtime',\n ),\n ),\n new RuleContribution(\n 'validate-ts-in-src',\n '@webpieces/ai-hook-rules',\n 'build',\n '@webpieces/nx-webpieces-rules/rule-runtime',\n ),\n ],\n ruleMigrations,\n [],\n);\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BuildPolicy, BuildRuleRuntime, PolicyRuntimeRequest } from '@webpieces/rules-sdk';
|
|
2
|
+
export declare class NxRuleRuntime implements BuildRuleRuntime {
|
|
3
|
+
create(request: PolicyRuntimeRequest): Promise<readonly BuildPolicy[]>;
|
|
4
|
+
}
|
|
5
|
+
export declare const buildRuleRuntime: NxRuleRuntime;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRuleRuntime = exports.NxRuleRuntime = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
7
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
8
|
+
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
9
|
+
const rules_config_1 = require("@webpieces/rules-config");
|
|
10
|
+
const rules_config_2 = require("@webpieces/rules-config");
|
|
11
|
+
const nx_policy_registry_1 = require("./nx-policy-registry");
|
|
12
|
+
const native_actions_1 = require("./native-actions");
|
|
13
|
+
class NativeExecutorContext {
|
|
14
|
+
root;
|
|
15
|
+
projectGraph;
|
|
16
|
+
projectsConfigurations;
|
|
17
|
+
nxJsonConfiguration;
|
|
18
|
+
projectName;
|
|
19
|
+
cwd;
|
|
20
|
+
isVerbose = false;
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
22
|
+
constructor(root, projectGraph, projectsConfigurations, nxJsonConfiguration, projectName) {
|
|
23
|
+
this.root = root;
|
|
24
|
+
this.projectGraph = projectGraph;
|
|
25
|
+
this.projectsConfigurations = projectsConfigurations;
|
|
26
|
+
this.nxJsonConfiguration = nxJsonConfiguration;
|
|
27
|
+
this.projectName = projectName;
|
|
28
|
+
this.cwd = root;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Related policies share an existing native scan within this execution, including its failures. */
|
|
32
|
+
class NativeExecution {
|
|
33
|
+
root;
|
|
34
|
+
results = new Map();
|
|
35
|
+
graph;
|
|
36
|
+
constructor(root) {
|
|
37
|
+
this.root = root;
|
|
38
|
+
}
|
|
39
|
+
run(action) {
|
|
40
|
+
const existing = this.results.get(action.name);
|
|
41
|
+
if (existing)
|
|
42
|
+
return existing;
|
|
43
|
+
const result = this.execute(action);
|
|
44
|
+
this.results.set(action.name, result);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
async execute(action) {
|
|
48
|
+
const graph = await (this.graph ??= (0, devkit_1.createProjectGraphAsync)());
|
|
49
|
+
const projects = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(graph);
|
|
50
|
+
const nxFile = path.join(this.root, 'nx.json');
|
|
51
|
+
if (!fs.existsSync(nxFile))
|
|
52
|
+
throw new rules_config_2.RuleFailError('policy-configuration', `Native Nx policies require ${nxFile}. Declare an Nx workspace or remove this pack.`);
|
|
53
|
+
const nxJson = JSON.parse(fs.readFileSync(nxFile, 'utf8'));
|
|
54
|
+
const names = action.scope === 'workspace' ? [undefined] : Object.keys(projects.projects).sort();
|
|
55
|
+
let success = true;
|
|
56
|
+
for (const name of names) {
|
|
57
|
+
const result = await action.execute(new NativeExecutorContext(this.root, graph, projects, nxJson, name));
|
|
58
|
+
if (!result || result.success !== true)
|
|
59
|
+
success = false;
|
|
60
|
+
}
|
|
61
|
+
return new rules_sdk_1.BuildPolicyResult(success);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class NativeBuildPolicy extends rules_config_1.AbstractRule {
|
|
65
|
+
action;
|
|
66
|
+
execution;
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
68
|
+
constructor(config, id, action, execution) {
|
|
69
|
+
super(config, id, id);
|
|
70
|
+
this.action = action;
|
|
71
|
+
this.execution = execution;
|
|
72
|
+
}
|
|
73
|
+
run(_root) {
|
|
74
|
+
return this.execution.run(this.action);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class NxRuleRuntime {
|
|
78
|
+
async create(request) {
|
|
79
|
+
const execution = new NativeExecution(request.workspaceRoot);
|
|
80
|
+
return request.ruleIds.map((id) => {
|
|
81
|
+
const config = request.configs[id];
|
|
82
|
+
if (!config)
|
|
83
|
+
throw new rules_config_2.RuleFailError('policy-configuration', `Missing explicit config for ${id}. Repair its declared owner file.`);
|
|
84
|
+
const policy = nx_policy_registry_1.NX_POLICIES.find((entry) => entry.definition.id === id);
|
|
85
|
+
const action = id === 'validate-ts-in-src' ? new native_actions_1.NativeActions().tsInSrc : policy?.action;
|
|
86
|
+
if (!action)
|
|
87
|
+
throw new rules_config_2.RuleFailError('policy-configuration', `Native Nx runtime has no implementation of ${id}. Repair its contribution.`);
|
|
88
|
+
return new NativeBuildPolicy(config, id, action, execution);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.NxRuleRuntime = NxRuleRuntime;
|
|
93
|
+
exports.buildRuleRuntime = new NxRuleRuntime();
|
|
94
|
+
//# sourceMappingURL=rule-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-runtime.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/rule-runtime.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AACpB,oDAA8B;AAC9B,wDAAkC;AAClC,oDAM8B;AAC9B,0DAAuD;AACvD,0DAAwD;AACxD,6DAA6D;AAC7D,qDAA+D;AAE/D,MAAM,qBAAqB;IAMV;IACA;IACA;IACA;IACA;IATJ,GAAG,CAAS;IACZ,SAAS,GAAG,KAAK,CAAC;IAE3B,yDAAyD;IACzD,YACa,IAAY,EACZ,YAA0B,EAC1B,sBAA8C,EAC9C,mBAAwC,EACxC,WAA+B;QAJ/B,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAc;QAC1B,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,gBAAW,GAAX,WAAW,CAAoB;QAExC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;CACJ;AAED,oGAAoG;AACpG,MAAM,eAAe;IAIY;IAHZ,OAAO,GAAG,IAAI,GAAG,EAAsC,CAAC;IACjE,KAAK,CAAoC;IAEjD,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAE7C,GAAG,CAAC,MAAoB;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC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,CAAC;IACP,CAAC;CACJ;AArBD,sCAqBC;AAEY,QAAA,gBAAgB,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import {\n createProjectGraphAsync,\n readProjectsConfigurationFromProjectGraph,\n ExecutorContext,\n ProjectGraph,\n ProjectsConfigurations,\n NxJsonConfiguration,\n} from '@nx/devkit';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport {\n BaseRuleConfig,\n BuildPolicy,\n BuildPolicyResult,\n BuildRuleRuntime,\n PolicyRuntimeRequest,\n} from '@webpieces/rules-sdk';\nimport { AbstractRule } from '@webpieces/rules-config';\nimport { RuleFailError } from '@webpieces/rules-config';\nimport { NX_POLICIES, NxPolicy } from './nx-policy-registry';\nimport { NativeAction, NativeActions } from './native-actions';\n\nclass NativeExecutorContext implements ExecutorContext {\n readonly cwd: string;\n readonly isVerbose = false;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n readonly root: string,\n readonly projectGraph: ProjectGraph,\n readonly projectsConfigurations: ProjectsConfigurations,\n readonly nxJsonConfiguration: NxJsonConfiguration,\n readonly projectName: string | undefined,\n ) {\n this.cwd = root;\n }\n}\n\n/** Related policies share an existing native scan within this execution, including its failures. */\nclass NativeExecution {\n private readonly results = new Map<string, Promise<BuildPolicyResult>>();\n private graph: Promise<ProjectGraph> | undefined;\n\n constructor(private readonly root: string) {}\n\n run(action: NativeAction): Promise<BuildPolicyResult> {\n const existing = this.results.get(action.name);\n if (existing) return existing;\n const result = this.execute(action);\n this.results.set(action.name, result);\n return result;\n }\n\n private async execute(action: NativeAction): Promise<BuildPolicyResult> {\n const graph = await (this.graph ??= createProjectGraphAsync());\n const projects = readProjectsConfigurationFromProjectGraph(graph);\n const nxFile = path.join(this.root, 'nx.json');\n if (!fs.existsSync(nxFile))\n throw new RuleFailError(\n 'policy-configuration',\n `Native Nx policies require ${nxFile}. Declare an Nx workspace or remove this pack.`,\n );\n const nxJson = JSON.parse(fs.readFileSync(nxFile, 'utf8')) as NxJsonConfiguration;\n const names =\n action.scope === 'workspace' ? [undefined] : Object.keys(projects.projects).sort();\n let success = true;\n for (const name of names) {\n const result = await action.execute(\n new NativeExecutorContext(this.root, graph, projects, nxJson, name),\n );\n if (!result || result.success !== true) success = false;\n }\n return new BuildPolicyResult(success);\n }\n}\n\nclass NativeBuildPolicy extends AbstractRule<BaseRuleConfig> implements BuildPolicy {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n config: BaseRuleConfig,\n id: string,\n private readonly action: NativeAction,\n private readonly execution: NativeExecution,\n ) {\n super(config, id, id);\n }\n\n run(_root: string): Promise<BuildPolicyResult> {\n return this.execution.run(this.action);\n }\n}\n\nexport class NxRuleRuntime implements BuildRuleRuntime {\n async create(request: PolicyRuntimeRequest): Promise<readonly BuildPolicy[]> {\n const execution = new NativeExecution(request.workspaceRoot);\n return request.ruleIds.map((id: string) => {\n const config = request.configs[id];\n if (!config)\n throw new RuleFailError(\n 'policy-configuration',\n `Missing explicit config for ${id}. Repair its declared owner file.`,\n );\n const policy = NX_POLICIES.find((entry: NxPolicy) => entry.definition.id === id);\n const action =\n id === 'validate-ts-in-src' ? new NativeActions().tsInSrc : policy?.action;\n if (!action)\n throw new RuleFailError(\n 'policy-configuration',\n `Native Nx runtime has no implementation of ${id}. Repair its contribution.`,\n );\n return new NativeBuildPolicy(config as BaseRuleConfig, id, action, execution);\n });\n }\n}\n\nexport const buildRuleRuntime = new NxRuleRuntime();\n"]}
|
|
@@ -16,7 +16,11 @@ class ValidationTargets {
|
|
|
16
16
|
return {
|
|
17
17
|
executor: '@webpieces/nx-webpieces-rules:validate-no-architecture-cycles',
|
|
18
18
|
cache: true,
|
|
19
|
-
inputs: [
|
|
19
|
+
inputs: [
|
|
20
|
+
'{workspaceRoot}/**/project.json',
|
|
21
|
+
'{workspaceRoot}/architecture/dependencies.json',
|
|
22
|
+
...branch_identity_inputs_1.BRANCH_IDENTITY_INPUTS,
|
|
23
|
+
],
|
|
20
24
|
metadata: {
|
|
21
25
|
technologies: ['nx'],
|
|
22
26
|
description: 'Validate the architecture has no circular project dependencies',
|
|
@@ -27,7 +31,11 @@ class ValidationTargets {
|
|
|
27
31
|
return {
|
|
28
32
|
executor: '@webpieces/nx-webpieces-rules:validate-packagejson',
|
|
29
33
|
cache: true,
|
|
30
|
-
inputs: [
|
|
34
|
+
inputs: [
|
|
35
|
+
'{workspaceRoot}/**/project.json',
|
|
36
|
+
'{workspaceRoot}/**/package.json',
|
|
37
|
+
...branch_identity_inputs_1.BRANCH_IDENTITY_INPUTS,
|
|
38
|
+
],
|
|
31
39
|
metadata: {
|
|
32
40
|
technologies: ['nx'],
|
|
33
41
|
description: 'Validate package.json dependencies match project.json build dependencies',
|
|
@@ -57,10 +65,14 @@ class ValidationTargets {
|
|
|
57
65
|
return {
|
|
58
66
|
executor: '@webpieces/nx-webpieces-rules:validate-code',
|
|
59
67
|
cache: false, // Don't cache - depends on git state
|
|
60
|
-
inputs: [
|
|
68
|
+
inputs: [
|
|
69
|
+
'default',
|
|
70
|
+
'{workspaceRoot}/webpieces.config.json',
|
|
71
|
+
{ runtime: 'node -e "process.stdout.write(String(Math.random()))"' },
|
|
72
|
+
],
|
|
61
73
|
metadata: {
|
|
62
74
|
technologies: ['nx'],
|
|
63
|
-
description: '
|
|
75
|
+
description: 'Execute the client-declared build policy contributions',
|
|
64
76
|
},
|
|
65
77
|
};
|
|
66
78
|
}
|
|
@@ -79,7 +91,11 @@ class ValidationTargets {
|
|
|
79
91
|
return {
|
|
80
92
|
executor: '@webpieces/nx-webpieces-rules:validate-ts-in-src',
|
|
81
93
|
cache: false,
|
|
82
|
-
inputs: [
|
|
94
|
+
inputs: [
|
|
95
|
+
'default',
|
|
96
|
+
'{workspaceRoot}/webpieces.config.json',
|
|
97
|
+
{ runtime: 'node -e "process.stdout.write(String(Math.random()))"' },
|
|
98
|
+
],
|
|
83
99
|
metadata: {
|
|
84
100
|
technologies: ['nx'],
|
|
85
101
|
description: 'Validate all .ts files in projects are inside the src/ directory',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-targets.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/validation-targets.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAIH,qEAAkE;AAElE,MAAa,iBAAiB;IAC1B,QAAQ;QACJ,OAAO;YACH,QAAQ,EAAE,+DAA+D;YACzE,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"validation-targets.js","sourceRoot":"","sources":["../../../../../packages/tooling/nx-webpieces-rules/src/validation-targets.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAIH,qEAAkE;AAElE,MAAa,iBAAiB;IAC1B,QAAQ;QACJ,OAAO;YACH,QAAQ,EAAE,+DAA+D;YACzE,KAAK,EAAE,IAAI;YACX,MAAM,EAAE;gBACJ,iCAAiC;gBACjC,gDAAgD;gBAChD,GAAG,+CAAsB;aAC5B;YACD,QAAQ,EAAE;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,WAAW,EAAE,gEAAgE;aAChF;SACJ,CAAC;IACN,CAAC;IAED,WAAW;QACP,OAAO;YACH,QAAQ,EAAE,oDAAoD;YAC9D,KAAK,EAAE,IAAI;YACX,MAAM,EAAE;gBACJ,iCAAiC;gBACjC,iCAAiC;gBACjC,GAAG,+CAAsB;aAC5B;YACD,QAAQ,EAAE;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,WAAW,EACP,0EAA0E;aACjF;SACJ,CAAC;IACN,CAAC;IAED,qGAAqG;IACrG,4FAA4F;IAC5F,gGAAgG;IAChG,aAAa;QACT,OAAO;YACH,QAAQ,EAAE,uDAAuD;YACjE,KAAK,EAAE,KAAK,EAAE,+EAA+E;YAC7F,MAAM,EAAE,CAAC,uCAAuC,CAAC;YACjD,QAAQ,EAAE;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,WAAW,EACP,oFAAoF;aAC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AQ,EAAE;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,WAAW,EACP,wEAAwE;aAC/E;SACJ,CAAC;IACN,CAAC;IAED,sGAAsG;IACtG,SAAS;QACL,OAAO;YACH,QAAQ,EAAE,oDAAoD;YAC9D,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC,SAAS,EAAE,iCAAiC,CAAC;YACtD,QAAQ,EAAE;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC;gBACpB,WAAW,EAAE,kEAAkE;aAClF;SACJ,CAAC;IACN,CAAC;CACJ;AA/ID,8CA+IC","sourcesContent":["/**\n * Workspace validation target factories\n *\n * The no-argument `architecture:*` validation target configurations, extracted\n * from plugin.ts (which is at its file-size limit). Each instance method returns\n * the nx TargetConfiguration that runs one @webpieces/nx-webpieces-rules validator.\n * Instantiate once and inject the instance where the targets are assembled (no\n * static methods — a static method can't be injected).\n */\n\nimport { TargetConfiguration } from '@nx/devkit';\n\nimport { BRANCH_IDENTITY_INPUTS } from './branch-identity-inputs';\n\nexport class ValidationTargets {\n noCycles(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-no-architecture-cycles',\n cache: true,\n inputs: [\n '{workspaceRoot}/**/project.json',\n '{workspaceRoot}/architecture/dependencies.json',\n ...BRANCH_IDENTITY_INPUTS,\n ],\n metadata: {\n technologies: ['nx'],\n description: 'Validate the architecture has no circular project dependencies',\n },\n };\n }\n\n packageJson(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-packagejson',\n cache: true,\n inputs: [\n '{workspaceRoot}/**/project.json',\n '{workspaceRoot}/**/package.json',\n ...BRANCH_IDENTITY_INPUTS,\n ],\n metadata: {\n technologies: ['nx'],\n description:\n 'Validate package.json dependencies match project.json build dependencies',\n },\n };\n }\n\n // Validate the pr-gate checklists[] array in isolation (docs exist, reviewer agents exist, subagents\n // blockMessage on BLOCK) so a bad checklist config fails as ITS OWN check rather than as an\n // unrelated validator's banner. Depends only on webpieces.config.json + the docs it references.\n checklistDocs(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-checklist-docs',\n cache: false, // depends on files on disk (docs paths) that project.json inputs can't express\n inputs: ['{workspaceRoot}/webpieces.config.json'],\n metadata: {\n technologies: ['nx'],\n description:\n 'Validate the pr-gate checklists[] block (docs exist, patterns compile, ids unique)',\n },\n };\n }\n\n /**\n * Combined validate-code target. Options come from webpieces.config.json at the\n * workspace root (loaded by the executor via @webpieces/rules-config — the same\n * source of truth as @webpieces/ai-hook-rules).\n */\n code(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-code',\n cache: false, // Don't cache - depends on git state\n inputs: [\n 'default',\n '{workspaceRoot}/webpieces.config.json',\n { runtime: 'node -e \"process.stdout.write(String(Math.random()))\"' },\n ],\n metadata: {\n technologies: ['nx'],\n description: 'Execute the client-declared build policy contributions',\n },\n };\n }\n\n versionsLocked(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-versions-locked',\n cache: true,\n inputs: ['{workspaceRoot}/**/package.json', ...BRANCH_IDENTITY_INPUTS],\n metadata: {\n technologies: ['nx'],\n description:\n 'Validate package.json versions are locked (no semver ranges) and consistent across projects',\n },\n };\n }\n\n tsInSrc(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-ts-in-src',\n cache: false,\n inputs: [\n 'default',\n '{workspaceRoot}/webpieces.config.json',\n { runtime: 'node -e \"process.stdout.write(String(Math.random()))\"' },\n ],\n metadata: {\n technologies: ['nx'],\n description: 'Validate all .ts files in projects are inside the src/ directory',\n },\n };\n }\n\n nxWiring(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-nx-wiring',\n cache: false, // Cheap; depends on nx.json + project graph, not worth caching\n inputs: ['{workspaceRoot}/nx.json'],\n metadata: {\n technologies: ['nx'],\n description:\n 'Validate the webpieces validators are wired into the build via nx.json dependsOn',\n },\n };\n }\n\n /**\n * Validate every server/client api-lib dependency is implemented or used. Scans\n * source (addRoutes = implements, createRpcClient/createPubSubClient = uses), so\n * it depends on all source + project.json, not just the committed graph.\n */\n apiRelations(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-api-relations',\n cache: false,\n inputs: ['default', '{workspaceRoot}/**/project.json'],\n metadata: {\n technologies: ['nx'],\n description:\n 'Validate every server/client api-lib dependency is implemented or used',\n },\n };\n }\n\n /** Validate role:api-lib ⇔ the project exports an @ApiPath/@Rpc/@PubSub contract, both directions. */\n apiLibTag(): TargetConfiguration {\n return {\n executor: '@webpieces/nx-webpieces-rules:validate-api-lib-tag',\n cache: false,\n inputs: ['default', '{workspaceRoot}/**/project.json'],\n metadata: {\n technologies: ['nx'],\n description: 'Validate role:api-lib matches the code (exports an API contract)',\n },\n };\n }\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { ExecutorResult } from '../../executor-result';
|
|
3
|
-
import { CatchErrorPatternConfig } from "@webpieces/code-rules";
|
|
4
|
-
export default function runExecutor(options: CatchErrorPatternConfig, context: ExecutorContext): Promise<ExecutorResult>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = runExecutor;
|
|
4
|
-
const code_rules_1 = require("@webpieces/code-rules");
|
|
5
|
-
async function runExecutor(options, context) {
|
|
6
|
-
return new code_rules_1.CatchErrorPatternValidator(options, new code_rules_1.GateScanScope()).run(context.root);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/nx-webpieces-rules/src/executors/validate-catch-error-pattern/executor.ts"],"names":[],"mappings":";;AAKA,8BAKC;AARD,sDAAkF;AAGnE,KAAK,UAAU,WAAW,CACrC,OAAgC,EAChC,OAAwB;IAExB,OAAO,IAAI,uCAA0B,CAAC,OAAO,EAAE,IAAI,0BAAa,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import type { ExecutorContext } from '@nx/devkit';\nimport { ExecutorResult } from '../../executor-result';\nimport { CatchErrorPatternValidator, GateScanScope } from '@webpieces/code-rules';\nimport { CatchErrorPatternConfig } from \"@webpieces/code-rules\";\n\nexport default async function runExecutor(\n options: CatchErrorPatternConfig,\n context: ExecutorContext,\n): Promise<ExecutorResult> {\n return new CatchErrorPatternValidator(options, new GateScanScope()).run(context.root);\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"title": "Validate Catch Error Pattern Executor",
|
|
4
|
-
"description": "Validates that catch blocks follow the standardized pattern: catch (err: unknown) { const error = toError(err); }",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"mode": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"enum": ["OFF", "NEW_AND_MODIFIED_CODE", "NEW_AND_MODIFIED_FILES"],
|
|
10
|
-
"description": "OFF: skip validation. NEW_AND_MODIFIED_CODE: only catch blocks on changed lines in diff. NEW_AND_MODIFIED_FILES: all catch blocks in modified files.",
|
|
11
|
-
"default": "OFF"
|
|
12
|
-
},
|
|
13
|
-
"disableAllowed": {
|
|
14
|
-
"type": "boolean",
|
|
15
|
-
"description": "Whether disable comments work. When false, no escape hatch.",
|
|
16
|
-
"default": true
|
|
17
|
-
},
|
|
18
|
-
"turnOffRuleUntilEpoch": {
|
|
19
|
-
"type": "number",
|
|
20
|
-
"description": "Epoch seconds. Until this time, skip validation entirely. When expired, normal mode resumes. Omit when not needed."
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"required": []
|
|
24
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { ExecutorResult } from '../../executor-result';
|
|
3
|
-
import { PrismaValidateDtosConfig } from "@webpieces/code-rules";
|
|
4
|
-
export default function runExecutor(options: PrismaValidateDtosConfig, context: ExecutorContext): Promise<ExecutorResult>;
|