/** * DI Graph Generate Executor * * Per-project: statically analyzes the project's Inversify dependency DAG * (constructor injection from controllers — or library top-of-DAG classes — * down to leaves) and writes three checked-in files at the project root: * * design.json — machine-readable graph (deterministic, sorted) * design.md — Mermaid diagram rendered by GitHub/IDEs in PRs * design.html — clickable viz.js page (linked from architecture/dependencies.html) * * A project with NO design root writes NO files, and any stale ones are removed — see * writeDesignFiles for why an empty `{ "designs": [] }` is noise rather than information, and why * nothing downstream can tell "empty" from "absent". * * Runs on every build (cache:false; `ci` dependsOn this target directly). * Unrecognized DI patterns become "unresolved" nodes rather than failing the build. * * That the regenerated files are actually COMMITTED is no longer checked here (the deleted * validate-di-graph-unchanged target); it is one repo-wide "committed or staged" check in * `wp-review-upsert-pr` — @webpieces/pr-gate BuildArtifactGate. * * Config (webpieces.config.json, rule key `di-graph`): mode RUN_EVERY_TIME | OFF. That key still * governs THIS executor, so it stays in webpieces.config.json unchanged. * * Usage: nx run :di-graph-generate */ import type { ExecutorContext } from '@nx/devkit'; import { DiGraph } from '../../lib/di-graph/model'; export interface DiGraphGenerateOptions { } export interface ExecutorResult { success: boolean; } /** * Delete this project's design artifacts, returning the names actually removed. * * Reaping rather than leaving them is the point: a project that USED to have a `@DocumentDesign` root * and lost it would otherwise keep serving a stale committed design that describes code no longer * there, which is worse than having none. */ export declare function removeDesignFiles(projectRootAbs: string): string[]; /** * Write the design artifacts — or, when there is NO design, make sure none exist. * * WHY AN EMPTY GRAPH WRITES NOTHING: `{ "designs": [] }` carries no information, and every project * without an Inversify/Angular DI root produced one — legacy Express services, plain libs, api-libs, * bundles. That is most of a monorepo carrying three committed files apiece that say nothing, showing * up in diffs and PR file lists forever. * * This is safe because nothing downstream distinguishes "empty file" from "no file", and that is by * design rather than luck: `graph-metadata.ts:hasGeneratedDesign()` documents that a MISSING or * unparseable design.json reads as "no design", so a box's node menu gets a "View Design" item only * when `designs[]` is non-empty either way. `wp-design-visualize` likewise only fails when ZERO * design.json exist repo-wide. * * The ONE-TIME cost is a commit deleting the empty files a repo already carries — surfaced by the * usual "build left the tree committed" gate, exactly like any other regenerated artifact. */ export declare function writeDesignFiles(projectRootAbs: string, projectRoot: string, graph: DiGraph): void; export default function runExecutor(_options: DiGraphGenerateOptions, context: ExecutorContext): Promise;