@webpieces/nx-webpieces-rules 0.4.976 → 0.4.978

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.
@@ -1 +1 @@
1
- {"version":3,"file":"graph-impact.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-impact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;;;;AAEH,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,uCAAqD;AAIrD,0DAAyE;AACzE,iEAOgC;AAChC,uDAAmH;AAEnH,+CAA2C;AAC3C,wCAAqC;AAErC,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AAC/C,QAAA,kBAAkB,GAAG,GAAG,0BAAkB,IAAI,2BAAmB,EAAE,CAAC;AACjF,2GAA2G;AAC3G,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,8FAA8F;AAC9F,MAAM,WAAW,GAAG,MAAM,CAAC;AAEd,QAAA,yBAAyB,GAAG,oCAAoC,CAAC;AACjE,QAAA,kBAAkB,GAC3B,uFAAuF,CAAC;AAC/E,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D,mDAAmD;AACnD,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,2DAA2D;IAC3D,+BAAiB,CAAA;IACjB,2CAA2C;IAC3C,+BAAiB,CAAA;AACrB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,mEAAmE;AACtD,QAAA,sBAAsB,GAA0B,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AACpG,oGAAoG;AACvF,QAAA,qBAAqB,GAA0B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAEhF,uFAAuF;AACvF,MAAa,YAAY;IAED;IAEA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CAAC;IAC7F,CAAC;IAEO,IAAI,CAAC,MAAwC;QACjD,IAAI,MAAM,YAAY,iBAAiB,IAAI,CAAC,MAAM,CAAC,SAAS;YACxD,OAAO,gBAAgB,MAAM,CAAC,KAAK,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,cAAc,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QAChF,OAAO,cAAc,MAAM,CAAC,KAAK,KAAK,IAAI,YAAY,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,MAAM,CAAC,YAAY,kBAAkB,CAAC;IACzH,CAAC;CACJ;AAtFD,sCAsFC","sourcesContent":["/**\n * Impact mode's data: what one COMPARISON's build looks like, and WHY each project is in it.\n *\n * There are two comparisons, and only two (#1163). Both end at the WORKING TREE, so uncommitted and\n * untracked work counts in either:\n *\n * - BRANCH, \"Changed on this branch\": the fork point (`DiffScope.detectBase` in rules-config:\n * `git merge-base HEAD origin/main`, falling back to `main`) → working tree.\n * - COMMIT, \"Last commit\": `HEAD^` → working tree. To see what another commit changed, check it out\n * (`git checkout <hash>`) and run `pnpm arch:visualize`: nx computes `--affected` against the code\n * that is actually on disk, so nothing here ever jumps to another commit.\n *\n * Which of them exist is decided by `ImpactScopeResolver` from where HEAD is. On `main` (by BRANCH\n * NAME, so a local main with unpushed commits still counts as main) and on a detached HEAD only the\n * last commit exists — the fork point IS HEAD there, so the branch comparison would always be empty.\n * On a feature branch with commits past its fork point both exist, the branch one first. On a FRESH\n * feature branch (fork point = HEAD) only the branch one exists: falling through to \"last commit\"\n * would show main's last PR as if it were the branch's own work.\n *\n * Per comparison:\n * - BUILD INPUT is every transitive dependency of the affected set that is not itself affected:\n * `ci` dependsOn `^build`, so they must exist as build output though their inputs did not change.\n * nx restores them from cache when it has them and compiles them otherwise — which one happens is\n * not knowable here, so nothing claims it. A pure downward walk over the graph's own edges.\n * - AFFECTED is `nx show projects --affected --base=<the comparison's base> --json`, with NO\n * `--head`, so uncommitted and untracked work counts. nx already gets right everything a\n * hand-rolled diff gets wrong: lockfile and package.json changes resolved per project, root/global\n * inputs, namedInputs, implicitDependencies, nested roots and deleted files. It never reads\n * NX_BASE/NX_HEAD, whose value depends on whoever launched the process.\n * - WHY each affected project is in it (#1264) — changed, dependent (with the edge path), implicitly\n * touched (with the target, glob and file) or root-file touched — comes from nx's OWN affected\n * locators, run in-process against the workspace's own nx (graph-impact-reasons.ts). They are\n * loaded ONCE and shared by every comparison. The changed-file list is `DiffScope.getChangedFiles`,\n * the same base→working-tree diff (with untracked files) every code rule uses.\n *\n * The answer changes per checkout, so it never goes into the committed dependencies.html or\n * dependencies.json (both stay byte-stable). It goes into a SIDECAR,\n * `architecture/.impact/dependencies.impact.js`: a plain script setting one window global,\n * `window.__WP_IMPACT__ = { scans, defaultKind }`, loaded with `<script src>` — the one way a page\n * opened straight from disk (file://) can read a neighbouring file. The directory carries its own\n * `.gitignore` containing `*`, which ignores the directory and everything in it, so a consumer repo\n * needs no gitignore edit and the PR gate's \"build left nothing uncommitted\" check never sees it.\n *\n * `architecture:visualize` scans every comparison that exists. `architecture:generate` refreshes\n * ONLY the branch comparison (`GENERATE_IMPACT_KINDS`) and never scans the last commit; on main or a\n * detached HEAD that leaves nothing to write, so it removes the sidecar and the page says to run\n * `pnpm arch:visualize`.\n *\n * Impact is a convenience. When nx or git cannot answer any comparison, NO sidecar is written (a\n * stale one is removed) and the page disables Impact with a one-line reason. It never fails\n * generation.\n */\n\nimport { spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { createProjectGraphAsync } from '@nx/devkit';\nimport type { NxJsonConfiguration, ProjectGraph } from '@nx/devkit';\nimport type { FileChange } from 'nx/src/project-graph/file-utils';\nimport type { PackageJson } from 'nx/src/utils/package-json';\nimport { DiffScope, ChangedFilesOptions } from '@webpieces/rules-config';\nimport {\n AffectedClass,\n AffectedClassification,\n AffectedClassifier,\n AffectedInputs,\n AffectedReason,\n WorkspaceNx,\n} from './graph-impact-reasons';\nimport { EdgeChange, EdgeChangeKind, EdgeChangeScanner, EdgeDiffReport, LiveGraphSource } from './graph-edge-diff';\nimport type { EnhancedGraph } from './graph-sorter';\nimport { GraphNames } from './graph-names';\nimport { toError } from '../toError';\n\n/** Relative to the architecture/ directory the page lives in; the page's `<script src>`. */\nexport const IMPACT_SIDECAR_DIR = '.impact';\nexport const IMPACT_SIDECAR_FILE = 'dependencies.impact.js';\nexport const IMPACT_SIDECAR_SRC = `${IMPACT_SIDECAR_DIR}/${IMPACT_SIDECAR_FILE}`;\n/** Each nx call is capped; a slow or wedged nx disables that comparison instead of stalling generation. */\nconst NX_TIMEOUT_MS = 15000;\n/** The branch whose name means \"there is no branch comparison here, only the last commit\". */\nconst MAIN_BRANCH = 'main';\n\nexport const NOTHING_CHANGED_ON_BRANCH = 'Nothing changed on this branch yet';\nexport const ROOT_COMMIT_REASON =\n \"HEAD is the repository's first commit; there is no previous commit to compare against\";\nexport const UNCOMMITTED_SUFFIX = ' + uncommitted changes';\n\n/** Which of the two comparisons a scan answers. */\nexport enum ImpactKind {\n /** Fork point → working tree: \"Changed on this branch\". */\n BRANCH = 'branch',\n /** HEAD^ → working tree: \"Last commit\". */\n COMMIT = 'commit',\n}\n\n/** `architecture:visualize` scans every comparison that exists. */\nexport const VISUALIZE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH, ImpactKind.COMMIT];\n/** `architecture:generate` refreshes the branch comparison only and never scans the last commit. */\nexport const GENERATE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH];\n\n/** One scan as the sidecar carries it; the page reads `window.__WP_IMPACT__.scans`. */\nexport class ImpactReport {\n constructor(\n public readonly kind: ImpactKind,\n /** What the page says this scan compares, e.g. \"Changed on this branch (since abc1234)\". */\n public readonly label: string,\n /** The working tree had uncommitted or untracked changes (they count in the scan). */\n public readonly dirty: boolean,\n public readonly available: boolean,\n /** Why the scan is unavailable; for an available but EMPTY scan, the note the page shows. */\n public readonly reason: string,\n /** The base's short sha ('' when there is none). */\n public readonly base: string,\n /** Affected AND owning a changed file (node ids): \"changed\". */\n public readonly touched: string[],\n /** Affected through dependency edges from a changed or touched project (node ids). */\n public readonly dependents: string[],\n /** Affected because a `{workspaceRoot}` target input matched a changed file (node ids). */\n public readonly implicit: string[],\n /** Affected by a lockfile, package.json, tsconfig.base.json, nx.json or deleted-config change (node ids). */\n public readonly rootFile: string[],\n /** Affected, and nothing here could say why (node ids). Never shown as a dependent. */\n public readonly unexplained: string[],\n /**\n * Transitive dependencies of the affected set that are NOT affected (node ids). `ci` dependsOn\n * `^build`, so they must exist as build output although their inputs did not change: nx\n * restores them from cache when it has them and compiles them otherwise. Which of the two\n * happens is not knowable here, so the page claims neither.\n */\n public readonly buildInputs: string[],\n public readonly changedFiles: number,\n /**\n * Transitive dependencies of the TOUCHED set that are not touched themselves (node ids): the\n * Filter popover's \"Changed + dependencies\". (\"Changed + dependents\" is every affected project.)\n */\n public readonly dependencies: string[],\n /**\n * Changed files no project owns (repo-relative, sorted): workspace-global inputs such as\n * pnpm-lock.yaml. Empty when nx's locators were unavailable — then nothing is known.\n */\n public readonly globalFiles: string[],\n /** WHY each affected project is in the build (graph-impact-reasons.ts): one per affected node. */\n public readonly reasons: AffectedReason[],\n ) {}\n}\n\n/** The one-line count split, shared by the executor's console line (the page builds the same line). */\nexport class ImpactCounts {\n /** `8 changed · 3 dependents · 22 implicitly touched (runtime-wiring-check inputs) · 47 dependencies`. */\n line(report: ImpactReport): string {\n const parts = [`${report.touched.length} changed`, `${report.dependents.length} dependents`];\n if (report.implicit.length > 0) parts.push(`${report.implicit.length} implicitly touched${this.targets(report)}`);\n if (report.rootFile.length > 0) parts.push(`${report.rootFile.length} root-file touched`);\n if (report.unexplained.length > 0) parts.push(`${report.unexplained.length} unexplained`);\n parts.push(`${report.buildInputs.length} dependencies`);\n return parts.join(' · ');\n }\n\n private targets(report: ImpactReport): string {\n const targets = new Set<string>();\n for (const reason of report.reasons)\n if (reason.kind === AffectedClass.IMPLICIT && reason.target !== '') targets.add(reason.target);\n return targets.size === 0 ? '' : ` (${[...targets].sort().join(', ')} inputs)`;\n }\n}\n\n/** The sidecar's one global: every scan, and the one the page shows first. */\nexport class ImpactSidecarData {\n constructor(\n public readonly scans: ImpactReport[],\n public readonly defaultKind: ImpactKind,\n /**\n * The edges this branch gained or lost since its FORK POINT, the live graph against the fork\n * point's committed one (graph-edge-diff.ts, #1264). One per sidecar: it does not depend on\n * which scan is shown.\n */\n public readonly edges: EdgeDiffReport,\n ) {}\n}\n\n/** A scan (or a whole plan) that could not produce an answer. */\nexport class ImpactUnavailable {\n constructor(\n public readonly reason: string,\n public readonly label: string = 'Impact',\n ) {}\n}\n\n/** One comparison to scan. `base` is a full sha; null when it does not exist (`reason` says why). */\nexport class ImpactComparison {\n constructor(\n public readonly kind: ImpactKind,\n public readonly base: string | null,\n public readonly label: string,\n public readonly dirty: boolean,\n public readonly reason: string,\n ) {}\n}\n\n/** The comparisons that exist where HEAD is, and which one the page shows first. */\nexport class ImpactPlan {\n constructor(\n public readonly comparisons: ImpactComparison[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** The few git facts the resolver needs. Injected so specs never spawn git. */\nexport class ImpactGit {\n /** The checked-out branch's short name; null on a detached HEAD (or without git). */\n branch(root: string): string | null {\n return this.run(root, ['symbolic-ref', '--short', '-q', 'HEAD']);\n }\n\n /** The full sha `ref` names; null when it does not resolve (e.g. `HEAD^` on the first commit). */\n sha(root: string, ref: string): string | null {\n return this.run(root, ['rev-parse', '--verify', '-q', `${ref}^{commit}`]);\n }\n\n /** `git status --porcelain` is non-empty: uncommitted or untracked work. */\n dirty(root: string): boolean {\n return (this.run(root, ['status', '--porcelain']) ?? '') !== '';\n }\n\n /** HEAD's subject line ('' when unknown). */\n subject(root: string): string {\n return this.run(root, ['log', '-1', '--format=%s', 'HEAD']) ?? '';\n }\n\n /** Trimmed stdout, or null on any failure. */\n private run(root: string, args: string[]): string | null {\n const result = spawnSync('git', args, { cwd: root, encoding: 'utf8', stdio: 'pipe' });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout.trim();\n }\n}\n\n/**\n * Decides which comparisons exist from where HEAD is (#1163):\n *\n * | where | comparisons | default |\n * |---|---|---|\n * | `main` (by branch NAME) | last commit | last commit |\n * | detached HEAD | last commit | last commit |\n * | feature branch with commits past the fork point | branch, last commit | branch |\n * | fresh feature branch (fork point = HEAD) | branch | branch |\n *\n * HEAD with no parent leaves the last commit unavailable, with `ROOT_COMMIT_REASON`.\n */\nexport class ImpactScopeResolver {\n constructor(\n private readonly git: ImpactGit = new ImpactGit(),\n private readonly diffScope: DiffScope = new DiffScope(),\n ) {}\n\n resolve(root: string): ImpactPlan | ImpactUnavailable {\n const head = this.git.sha(root, 'HEAD');\n if (head === null) return new ImpactUnavailable('git cannot resolve HEAD (not a git checkout, or git is unavailable)');\n const branch = this.git.branch(root);\n const dirty = this.git.dirty(root);\n const commit = this.lastCommit(root, dirty);\n // On main the decision is the branch NAME, never merge-base: unpushed commits still mean \"last commit\".\n if (branch === null || branch === MAIN_BRANCH) return new ImpactPlan([commit], ImpactKind.COMMIT);\n const fork = this.diffScope.detectBase(root);\n if (fork === null) {\n const reason = 'no fork point: neither origin/main nor main resolves';\n return new ImpactPlan(\n [new ImpactComparison(ImpactKind.BRANCH, null, 'Changed on this branch', dirty, reason)],\n ImpactKind.BRANCH,\n );\n }\n const onBranch = new ImpactComparison(\n ImpactKind.BRANCH,\n fork,\n `Changed on this branch (since ${this.short(fork)})${dirty ? UNCOMMITTED_SUFFIX : ''}`,\n dirty,\n '',\n );\n // A fresh branch has no commit of its own: \"last commit\" would be main's last PR, not its work.\n if (this.sameCommit(fork, head)) return new ImpactPlan([onBranch], ImpactKind.BRANCH);\n return new ImpactPlan([onBranch, commit], ImpactKind.BRANCH);\n }\n\n private lastCommit(root: string, dirty: boolean): ImpactComparison {\n const parent = this.git.sha(root, 'HEAD^');\n if (parent === null) return new ImpactComparison(ImpactKind.COMMIT, null, 'Last commit', dirty, ROOT_COMMIT_REASON);\n const subject = this.git.subject(root);\n const label =\n `Changed since ${this.short(parent)}${subject === '' ? '' : ` — ${subject}`}` +\n (dirty ? UNCOMMITTED_SUFFIX : '');\n return new ImpactComparison(ImpactKind.COMMIT, parent, label, dirty, '');\n }\n\n /** detectBase may hand back a full or an abbreviated sha; compare on the shorter of the two. */\n private sameCommit(a: string, b: string): boolean {\n const length = Math.min(a.length, b.length);\n return length > 0 && a.slice(0, length) === b.slice(0, length);\n }\n\n private short(sha: string): string {\n return sha.slice(0, 7);\n }\n}\n\n/** Runs the workspace's own nx CLI. Injected so specs never spawn nx. */\nexport class NxCli {\n /** stdout, or null when nx cannot be found, exits non-zero or exceeds the timeout. */\n run(workspaceRoot: string, args: string[], timeoutMs: number): string | null {\n const bin = this.binary(workspaceRoot);\n if (bin === null) return null;\n const result = spawnSync(process.execPath, [bin, ...args], {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: timeoutMs,\n stdio: 'pipe',\n maxBuffer: 16 * 1024 * 1024,\n });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout;\n }\n\n /** Resolved the way node would from the workspace, so a linked worktree finds its main tree's nx. */\n private binary(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a workspace without nx resolves nothing; that is an answer, not an error\n try {\n return require.resolve('nx/bin/nx.js', { paths: [workspaceRoot] });\n } catch (err: unknown) {\n const error = toError(err);\n void error; // no nx installed here — Impact is simply unavailable\n return null;\n }\n }\n}\n\n/**\n * The workspace's nx facts every comparison classifies against: its project graph (with npm nodes\n * and every edge), nx.json, package.json, and nx's own affected locators. Subclassed by specs.\n */\nexport class AffectedContext {\n constructor(\n public readonly graph: ProjectGraph,\n public readonly nxJson: NxJsonConfiguration,\n public readonly packageJson: PackageJson,\n public readonly classifier: AffectedClassifier,\n private readonly nx: WorkspaceNx | null,\n ) {}\n\n /** nx's FileChange list for `files`, base → working tree. */\n fileChanges(files: string[], base: string): FileChange[] {\n if (this.nx === null) throw new Error('no workspace nx to read file changes with');\n return this.nx.fileChanges(files, base);\n }\n}\n\n/** Loads the workspace's nx facts. Injected so specs never load the real project graph. */\nexport class AffectedContextLoader {\n async load(workspaceRoot: string): Promise<AffectedContext> {\n const nx = new WorkspaceNx(workspaceRoot);\n return new AffectedContext(\n await createProjectGraphAsync(),\n nx.nxJson(),\n nx.packageJson(),\n new AffectedClassifier(nx.locators()),\n nx,\n );\n }\n}\n\n/**\n * The context, loaded at most ONCE however many comparisons ask for it. Failing is not fatal: every\n * affected project is then \"unexplained\", with this error as its reason — never a dependent.\n */\nexport class SharedContext {\n private pending: Promise<AffectedContext | Error> | null = null;\n\n constructor(\n private readonly loader: AffectedContextLoader,\n private readonly workspaceRoot: string,\n ) {}\n\n get(): Promise<AffectedContext | Error> {\n if (this.pending === null) this.pending = this.load();\n return this.pending;\n }\n\n private async load(): Promise<AffectedContext | Error> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the reasons are optional; the affected set still shows\n try {\n return await this.loader.load(this.workspaceRoot);\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Impact: nx's affected locators unavailable (${error.message}); reasons unknown`);\n return error;\n }\n }\n}\n\nexport class NxImpactScanner {\n private readonly names = new GraphNames();\n\n constructor(\n private readonly diffScope: DiffScope = new DiffScope(),\n private readonly nx: NxCli = new NxCli(),\n private readonly loader: AffectedContextLoader = new AffectedContextLoader(),\n ) {}\n\n /** Every comparison, in order, sharing one nx context. */\n async scanAll(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparisons: ImpactComparison[],\n ): Promise<(ImpactReport | ImpactUnavailable)[]> {\n const context = new SharedContext(this.loader, workspaceRoot);\n const results: (ImpactReport | ImpactUnavailable)[] = [];\n for (const comparison of comparisons) results.push(await this.scan(workspaceRoot, graph, comparison, context));\n return results;\n }\n\n /** One comparison: nx affected from ITS base, with NO `--head`, so uncommitted work counts. */\n async scan(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparison: ImpactComparison,\n context: SharedContext = new SharedContext(this.loader, workspaceRoot),\n ): Promise<ImpactReport | ImpactUnavailable> {\n const base = comparison.base;\n if (base === null) return this.empty(comparison, false, comparison.reason, '', 0);\n const json = this.nx.run(workspaceRoot, ['show', 'projects', '--affected', `--base=${base}`, '--json'], NX_TIMEOUT_MS);\n if (json === null)\n return new ImpactUnavailable(`nx show projects --affected failed or took over ${NX_TIMEOUT_MS / 1000}s`, comparison.label);\n const affectedSet = this.parse(json);\n if (affectedSet === null)\n return new ImpactUnavailable('nx show projects --affected printed something other than a JSON list', comparison.label);\n const options = new ChangedFilesOptions();\n options.tsOnly = false;\n options.includeDeletions = true;\n const files = this.diffScope.getChangedFiles(workspaceRoot, base, undefined, options);\n const short = base.slice(0, 7);\n const drawn = affectedSet.filter((project: string): boolean => graph[project] !== undefined);\n if (drawn.length === 0)\n return this.empty(comparison, true, this.emptyNote(comparison, files.length, short), short, files.length);\n const classification = await this.classify(await context.get(), files, base, affectedSet);\n return this.report(comparison, short, files.length, graph, classification);\n }\n\n /** nx's locators' answer; any failure makes every affected project \"unexplained\", with the reason. */\n async classify(\n context: AffectedContext | Error,\n files: string[],\n base: string,\n affected: string[],\n ): Promise<AffectedClassification> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the reasons are optional; a locator failure leaves them unknown\n try {\n if (context instanceof Error) throw context;\n const changes = context.fileChanges(files, base);\n return await context.classifier.classify(\n new AffectedInputs(context.graph, context.nxJson, context.packageJson, changes, affected),\n );\n } catch (err: unknown) {\n const error = toError(err);\n const why = `nx's affected locators could not run here (${error.message}), so why nx marked it is unknown`;\n return new AffectedClassification(\n [...affected].sort().map(\n (project: string): AffectedReason =>\n new AffectedReason(project, AffectedClass.UNEXPLAINED, [], [], '', '', why),\n ),\n [],\n );\n }\n }\n\n /**\n * An empty scan is still an ANSWER (available, zero sets): a fresh branch with a clean tree has\n * simply changed nothing yet, and the page says so instead of disabling Impact.\n */\n emptyNote(comparison: ImpactComparison, changedFiles: number, short: string): string {\n if (changedFiles === 0 && comparison.kind === ImpactKind.BRANCH) return NOTHING_CHANGED_ON_BRANCH;\n if (changedFiles === 0) return `Nothing changed since ${short}`;\n return `Nothing affected since ${short}`;\n }\n\n /**\n * Every transitive dependency of `roots` that is not itself one of them: a pure downward walk over\n * the graph's own dependsOn edges, no nx call. Of the affected set these are the build inputs; of\n * the touched set, \"Changed + dependencies\".\n */\n buildInputs(roots: string[], graph: EnhancedGraph): string[] {\n const inSet = new Set<string>(roots);\n const seen = new Set<string>(roots);\n const stack = [...roots];\n const inputs: string[] = [];\n while (stack.length > 0) {\n const project = stack.pop() as string;\n for (const dep of graph[project]?.dependsOn ?? []) {\n if (seen.has(dep)) continue;\n seen.add(dep);\n stack.push(dep);\n if (!inSet.has(dep) && graph[dep] !== undefined) inputs.push(dep);\n }\n }\n return inputs.sort();\n }\n\n /** The JSON list of project names, sorted; null when it is not a list of names. */\n parse(json: string): string[] | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- untrusted CLI output; anything unparseable is reported as a reason\n try {\n // webpieces-disable no-any-unknown -- CLI JSON is untrusted until narrowed below\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed)) return null;\n return parsed.filter((name: unknown): name is string => typeof name === 'string').sort();\n } catch (err: unknown) {\n const error = toError(err);\n void error; // not JSON — the caller reports it\n return null;\n }\n }\n\n /** The drawn projects only: a reason for a project the page does not draw has nowhere to show. */\n private report(\n comparison: ImpactComparison,\n short: string,\n changedFiles: number,\n graph: EnhancedGraph,\n classification: AffectedClassification,\n ): ImpactReport {\n const drawn = (projects: string[]): string[] =>\n projects.filter((project: string): boolean => graph[project] !== undefined);\n const touched = drawn(classification.of(AffectedClass.CHANGED));\n const affected = drawn(classification.reasons.map((reason: AffectedReason): string => reason.project));\n return new ImpactReport(\n comparison.kind,\n comparison.label,\n comparison.dirty,\n true,\n '',\n short,\n this.ids(touched),\n this.ids(drawn(classification.of(AffectedClass.DEPENDENT))),\n this.ids(drawn(classification.of(AffectedClass.IMPLICIT))),\n this.ids(drawn(classification.of(AffectedClass.ROOT_FILE))),\n this.ids(drawn(classification.of(AffectedClass.UNEXPLAINED))),\n this.ids(this.buildInputs(affected, graph)),\n changedFiles,\n this.ids(this.buildInputs(touched, graph)),\n classification.globalFiles,\n classification.reasons.filter((reason: AffectedReason): boolean => graph[reason.project] !== undefined),\n );\n }\n\n private empty(comparison: ImpactComparison, available: boolean, reason: string, base: string, changedFiles: number): ImpactReport {\n return new ImpactReport(comparison.kind, comparison.label, comparison.dirty, available, reason, base, [], [], [], [], [], [], changedFiles, [], [], []);\n }\n\n private ids(projects: string[]): string[] {\n return projects.map((project: string): string => this.names.getNodeId(project));\n }\n}\n\n/** Writes (or removes) the sidecar, self-ignored, beside architecture/dependencies.html. */\nexport class ImpactSidecar {\n /** Never throws: a sidecar that cannot be written just leaves Impact disabled on the page. */\n write(architectureDir: string, data: ImpactSidecarData): string | null {\n const dir = path.join(architectureDir, IMPACT_SIDECAR_DIR);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; a write failure must never fail generation\n try {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(\n path.join(dir, '.gitignore'),\n '# Written by architecture:generate and architecture:visualize. Per-checkout data: never commit it.\\n*\\n',\n 'utf-8',\n );\n const file = path.join(dir, IMPACT_SIDECAR_FILE);\n fs.writeFileSync(file, this.script(data), 'utf-8');\n return file;\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Could not write the impact sidecar: ${error.message}`);\n return null;\n }\n }\n\n /** A stale sidecar from an earlier checkout must never be shown as this one's impact. */\n remove(architectureDir: string): void {\n fs.rmSync(path.join(architectureDir, IMPACT_SIDECAR_DIR, IMPACT_SIDECAR_FILE), { force: true });\n }\n\n script(data: ImpactSidecarData): string {\n const json = JSON.stringify(data).replace(/</g, '\\\\u003c');\n return `// Generated by architecture:generate or architecture:visualize for one checkout. Gitignored; do not commit.\\nwindow.__WP_IMPACT__ = ${json};\\n`;\n }\n}\n\n/** The executors' one call: resolve, scan each comparison, write, and report one line per comparison. */\nexport class ImpactRefresh {\n constructor(\n private readonly scanner: NxImpactScanner = new NxImpactScanner(),\n private readonly sidecar: ImpactSidecar = new ImpactSidecar(),\n private readonly resolver: ImpactScopeResolver = new ImpactScopeResolver(),\n private readonly edges: EdgeChangeScanner = new EdgeChangeScanner(),\n ) {}\n\n /**\n * Scans the comparisons in `kinds` that exist here (`VISUALIZE_IMPACT_KINDS` /\n * `GENERATE_IMPACT_KINDS`), and the edge changes since the fork point against the LIVE graphs\n * `live` computes. Never throws — Impact is optional, generation is not.\n */\n async run(\n architectureDir: string,\n workspaceRoot: string,\n graph: EnhancedGraph,\n kinds: readonly ImpactKind[],\n live: LiveGraphSource,\n ): Promise<string> {\n const started = Date.now();\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; any failure becomes a reason, never a failed generation\n try {\n const plan = this.resolver.resolve(workspaceRoot);\n if (plan instanceof ImpactUnavailable) return this.none(architectureDir, plan.reason, started);\n const comparisons = plan.comparisons.filter(\n (comparison: ImpactComparison): boolean => kinds.includes(comparison.kind),\n );\n if (comparisons.length === 0)\n return this.none(\n architectureDir,\n 'no Changed-on-this-branch comparison on main or a detached HEAD; pnpm arch:visualize shows the last commit',\n started,\n );\n const results = await this.scanner.scanAll(workspaceRoot, graph, comparisons);\n const lines = results.map((result: ImpactReport | ImpactUnavailable): string => this.line(result));\n const scans = results.filter(\n (result: ImpactReport | ImpactUnavailable): result is ImpactReport => result instanceof ImpactReport,\n );\n const cost = `${Date.now() - started} ms`;\n if (scans.length === 0) {\n this.sidecar.remove(architectureDir);\n return [...lines, `ℹ️ Impact disabled, no sidecar written (${cost})`].join('\\n');\n }\n const fork = plan.comparisons.find((comparison: ImpactComparison): boolean => comparison.kind === ImpactKind.BRANCH);\n const edges = await this.edges.scan(workspaceRoot, fork?.base ?? null, live);\n lines.push(this.edgeLine(edges));\n const data = new ImpactSidecarData(scans, this.defaultKind(scans, plan.defaultKind), edges);\n const file = this.sidecar.write(architectureDir, data);\n return [...lines, file === null ? `⚠️ Impact sidecar not written (${Date.now() - started} ms)` : `→ ${file} (${Date.now() - started} ms)`].join('\\n');\n } catch (err: unknown) {\n const error = toError(err);\n this.sidecar.remove(architectureDir);\n return `⚠️ Impact skipped: ${error.message}`;\n }\n }\n\n /** `✅ Edges since abc1234: dependencies 1 gained · 1 lost; runtime 0 gained · 0 lost`, or why not. */\n private edgeLine(edges: EdgeDiffReport): string {\n const half = (name: string, reason: string, changes: EdgeChange[]): string => {\n if (reason !== '') return `${name}: ${reason}`;\n const gained = changes.filter((change: EdgeChange): boolean => change.change === EdgeChangeKind.GAINED).length;\n return `${name} ${gained} gained · ${changes.length - gained} lost`;\n };\n const head = edges.base === '' ? 'ℹ️ Edges' : `✅ Edges since ${edges.base}`;\n return `${head}: ${half('dependencies', edges.dependencyReason, edges.dependency)}; ${half('runtime', edges.runtimeReason, edges.runtime)}`;\n }\n\n /** The plan's default when that scan is available, else the first available one. */\n private defaultKind(scans: ImpactReport[], preferred: ImpactKind): ImpactKind {\n const usable = scans.filter((scan: ImpactReport): boolean => scan.available);\n if (usable.length === 0 || usable.some((scan: ImpactReport): boolean => scan.kind === preferred)) return preferred;\n return usable[0].kind;\n }\n\n private none(architectureDir: string, reason: string, started: number): string {\n this.sidecar.remove(architectureDir);\n return `ℹ️ Impact disabled, no sidecar written: ${reason} (${Date.now() - started} ms)`;\n }\n\n private line(result: ImpactReport | ImpactUnavailable): string {\n if (result instanceof ImpactUnavailable || !result.available)\n return `ℹ️ Impact · ${result.label}: unavailable — ${result.reason}`;\n if (result.reason !== '') return `✅ Impact · ${result.label}: ${result.reason}`;\n return `✅ Impact · ${result.label}: ${new ImpactCounts().line(result)}, from ${result.changedFiles} changed file(s)`;\n }\n}\n"]}
1
+ {"version":3,"file":"graph-impact.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-impact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;;;;AAEH,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,uCAAqD;AAIrD,0DAAyE;AACzE,iEAOgC;AAChC,uDAAmH;AAEnH,+CAA2C;AAC3C,wCAAqC;AAErC,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AAC/C,QAAA,kBAAkB,GAAG,GAAG,0BAAkB,IAAI,2BAAmB,EAAE,CAAC;AACjF,2GAA2G;AAC3G,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,8FAA8F;AAC9F,MAAM,WAAW,GAAG,MAAM,CAAC;AAEd,QAAA,yBAAyB,GAAG,oCAAoC,CAAC;AACjE,QAAA,kBAAkB,GAC3B,uFAAuF,CAAC;AAC/E,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D,mDAAmD;AACnD,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,2DAA2D;IAC3D,+BAAiB,CAAA;IACjB,2CAA2C;IAC3C,+BAAiB,CAAA;AACrB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,mEAAmE;AACtD,QAAA,sBAAsB,GAA0B,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AACpG,oGAAoG;AACvF,QAAA,qBAAqB,GAA0B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAEhF,uFAAuF;AACvF,MAAa,YAAY;IAED;IAEA;IAEA;IACA;IAEA;IAEA;IAEA;IAEA;IAEA;IAEA;IAEA;IAOA;IACA;IAKA;IAKA;IAEA;IAxCpB,YACoB,IAAgB;IAChC,4FAA4F;IAC5E,KAAa;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AAS;YACxD,OAAO,gBAAgB,MAAM,CAAC,KAAK,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,cAAc,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QAChF,OAAO,cAAc,MAAM,CAAC,KAAK,KAAK,IAAI,YAAY,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,MAAM,CAAC,YAAY,kBAAkB,CAAC;IACzH,CAAC;CACJ;AAtFD,sCAsFC","sourcesContent":["/**\n * Impact mode's data: what one COMPARISON's build looks like, and WHY each project is in it.\n *\n * There are two comparisons, and only two (#1163). Both end at the WORKING TREE, so uncommitted and\n * untracked work counts in either:\n *\n * - BRANCH, \"Changed on this branch\": the fork point (`DiffScope.detectBase` in rules-config:\n * `git merge-base HEAD origin/main`, falling back to `main`) → working tree.\n * - COMMIT, \"Last commit\": `HEAD^` → working tree. To see what another commit changed, check it out\n * (`git checkout <hash>`) and run `pnpm arch:visualize`: nx computes `--affected` against the code\n * that is actually on disk, so nothing here ever jumps to another commit.\n *\n * Which of them exist is decided by `ImpactScopeResolver` from where HEAD is. On `main` (by BRANCH\n * NAME, so a local main with unpushed commits still counts as main) and on a detached HEAD only the\n * last commit exists — the fork point IS HEAD there, so the branch comparison would always be empty.\n * On a feature branch with commits past its fork point both exist, the branch one first. On a FRESH\n * feature branch (fork point = HEAD) only the branch one exists: falling through to \"last commit\"\n * would show main's last PR as if it were the branch's own work.\n *\n * Per comparison:\n * - BUILD INPUT is every transitive dependency of the affected set that is not itself affected:\n * `ci` dependsOn `^build`, so they must exist as build output though their inputs did not change.\n * nx restores them from cache when it has them and compiles them otherwise — which one happens is\n * not knowable here, so nothing claims it. A pure downward walk over the graph's own edges.\n * - AFFECTED is `nx show projects --affected --base=<the comparison's base> --json`, with NO\n * `--head`, so uncommitted and untracked work counts. nx already gets right everything a\n * hand-rolled diff gets wrong: lockfile and package.json changes resolved per project, root/global\n * inputs, namedInputs, implicitDependencies, nested roots and deleted files. It never reads\n * NX_BASE/NX_HEAD, whose value depends on whoever launched the process.\n * - WHY each affected project is in it (#1264) — changed, dependent (with the edge path), implicitly\n * touched (with the target, glob and file) or root-file touched — comes from nx's OWN affected\n * locators, run in-process against the workspace's own nx (graph-impact-reasons.ts). They are\n * loaded ONCE and shared by every comparison. The changed-file list is `DiffScope.getChangedFiles`,\n * the same base→working-tree diff (with untracked files) every code rule uses.\n *\n * The answer changes per checkout, so it never goes into the committed dependencies.html or\n * dependencies.json (both stay byte-stable). It goes into a SIDECAR,\n * `architecture/.impact/dependencies.impact.js`: a plain script setting one window global,\n * `window.__WP_IMPACT__ = { scans, defaultKind }`, loaded with `<script src>` — the one way a page\n * opened straight from disk (file://) can read a neighbouring file. The directory carries its own\n * `.gitignore` containing `*`, which ignores the directory and everything in it, so a consumer repo\n * needs no gitignore edit and the PR gate's \"build left nothing uncommitted\" check never sees it.\n *\n * `architecture:visualize` scans every comparison that exists. `architecture:generate` refreshes\n * ONLY the branch comparison (`GENERATE_IMPACT_KINDS`) and never scans the last commit; on main or a\n * detached HEAD that leaves nothing to write, so it removes the sidecar and the page says to run\n * `pnpm arch:visualize`.\n *\n * Impact is a convenience. When nx or git cannot answer any comparison, NO sidecar is written (a\n * stale one is removed) and the page disables Impact with a one-line reason. It never fails\n * generation.\n */\n\nimport { spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { createProjectGraphAsync } from '@nx/devkit';\nimport type { NxJsonConfiguration, ProjectGraph } from '@nx/devkit';\nimport type { FileChange } from 'nx/src/project-graph/file-utils';\nimport type { PackageJson } from 'nx/src/utils/package-json';\nimport { DiffScope, ChangedFilesOptions } from '@webpieces/rules-config';\nimport {\n AffectedClass,\n AffectedClassification,\n AffectedClassifier,\n AffectedInputs,\n AffectedReason,\n WorkspaceNx,\n} from './graph-impact-reasons';\nimport { EdgeChange, EdgeChangeKind, EdgeChangeScanner, EdgeDiffReport, LiveGraphSource } from './graph-edge-diff';\nimport type { EnhancedGraph } from './graph-sorter';\nimport { GraphNames } from './graph-names';\nimport { toError } from '../toError';\n\n/** Relative to the architecture/ directory the page lives in; the page's `<script src>`. */\nexport const IMPACT_SIDECAR_DIR = '.impact';\nexport const IMPACT_SIDECAR_FILE = 'dependencies.impact.js';\nexport const IMPACT_SIDECAR_SRC = `${IMPACT_SIDECAR_DIR}/${IMPACT_SIDECAR_FILE}`;\n/** Each nx call is capped; a slow or wedged nx disables that comparison instead of stalling generation. */\nconst NX_TIMEOUT_MS = 15000;\n/** The branch whose name means \"there is no branch comparison here, only the last commit\". */\nconst MAIN_BRANCH = 'main';\n\nexport const NOTHING_CHANGED_ON_BRANCH = 'Nothing changed on this branch yet';\nexport const ROOT_COMMIT_REASON =\n \"HEAD is the repository's first commit; there is no previous commit to compare against\";\nexport const UNCOMMITTED_SUFFIX = ' + uncommitted changes';\n\n/** Which of the two comparisons a scan answers. */\nexport enum ImpactKind {\n /** Fork point → working tree: \"Changed on this branch\". */\n BRANCH = 'branch',\n /** HEAD^ → working tree: \"Last commit\". */\n COMMIT = 'commit',\n}\n\n/** `architecture:visualize` scans every comparison that exists. */\nexport const VISUALIZE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH, ImpactKind.COMMIT];\n/** `architecture:generate` refreshes the branch comparison only and never scans the last commit. */\nexport const GENERATE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH];\n\n/** One scan as the sidecar carries it; the page reads `window.__WP_IMPACT__.scans`. */\nexport class ImpactReport {\n constructor(\n public readonly kind: ImpactKind,\n /** What the page says this scan compares, e.g. \"Changed on this branch (since abc1234)\". */\n public readonly label: string,\n /** The working tree had uncommitted or untracked changes (they count in the scan). */\n public readonly dirty: boolean,\n public readonly available: boolean,\n /** Why the scan is unavailable; for an available but EMPTY scan, the note the page shows. */\n public readonly reason: string,\n /** The base's short sha ('' when there is none). */\n public readonly base: string,\n /** Affected AND owning a changed file (node ids): \"changed\". */\n public readonly touched: string[],\n /** Affected through dependency edges from a changed or touched project (node ids). */\n public readonly dependents: string[],\n /** Affected because a `{workspaceRoot}` target input matched a changed file (node ids). */\n public readonly implicit: string[],\n /** Affected by a lockfile, package.json, tsconfig.base.json, nx.json or deleted-config change (node ids). */\n public readonly rootFile: string[],\n /** Affected, and nothing here could say why (node ids). Never shown as a dependent. */\n public readonly unexplained: string[],\n /**\n * Transitive dependencies of the affected set that are NOT affected (node ids). `ci` dependsOn\n * `^build`, so they must exist as build output although their inputs did not change: nx\n * restores them from cache when it has them and compiles them otherwise. Which of the two\n * happens is not knowable here, so the page claims neither.\n */\n public readonly buildInputs: string[],\n public readonly changedFiles: number,\n /**\n * Transitive dependencies of the TOUCHED set that are not touched themselves (node ids): the\n * Filter popover's \"Changed + dependencies\". (\"Changed + dependents\" is every affected project.)\n */\n public readonly dependencies: string[],\n /**\n * Changed files no project owns (repo-relative, sorted): workspace-global inputs such as\n * pnpm-lock.yaml. Empty when nx's locators were unavailable — then nothing is known.\n */\n public readonly globalFiles: string[],\n /** WHY each affected project is in the build (graph-impact-reasons.ts): one per affected node. */\n public readonly reasons: AffectedReason[],\n ) {}\n}\n\n/** The one-line count split, shared by the executor's console line (the page builds the same line). */\nexport class ImpactCounts {\n /** `8 changed · 3 dependents · 22 implicitly touched (runtime-wiring-check inputs) · 47 dependencies`. */\n line(report: ImpactReport): string {\n const parts = [`${report.touched.length} changed`, `${report.dependents.length} dependents`];\n if (report.implicit.length > 0) parts.push(`${report.implicit.length} implicitly touched${this.targets(report)}`);\n if (report.rootFile.length > 0) parts.push(`${report.rootFile.length} root-file touched`);\n if (report.unexplained.length > 0) parts.push(`${report.unexplained.length} unexplained`);\n parts.push(`${report.buildInputs.length} dependencies`);\n return parts.join(' · ');\n }\n\n private targets(report: ImpactReport): string {\n const targets = new Set<string>();\n for (const reason of report.reasons)\n if (reason.kind === AffectedClass.IMPLICIT && reason.target !== '') targets.add(reason.target);\n return targets.size === 0 ? '' : ` (${[...targets].sort().join(', ')} inputs)`;\n }\n}\n\n/** The sidecar's one global: every scan, and the one the page shows first. */\nexport class ImpactSidecarData {\n constructor(\n public readonly scans: ImpactReport[],\n public readonly defaultKind: ImpactKind,\n /**\n * The edges this branch gained or lost since its FORK POINT, the live graph against the fork\n * point's committed one (graph-edge-diff.ts, #1264). One per sidecar: it does not depend on\n * which scan is shown.\n */\n public readonly edges: EdgeDiffReport,\n ) {}\n}\n\n/** A scan (or a whole plan) that could not produce an answer. */\nexport class ImpactUnavailable {\n constructor(\n public readonly reason: string,\n public readonly label: string = 'Impact',\n ) {}\n}\n\n/** One comparison to scan. `base` is a full sha; null when it does not exist (`reason` says why). */\nexport class ImpactComparison {\n constructor(\n public readonly kind: ImpactKind,\n public readonly base: string | null,\n public readonly label: string,\n public readonly dirty: boolean,\n public readonly reason: string,\n ) {}\n}\n\n/** The comparisons that exist where HEAD is, and which one the page shows first. */\nexport class ImpactPlan {\n constructor(\n public readonly comparisons: ImpactComparison[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** The few git facts the resolver needs. Injected so specs never spawn git. */\nexport class ImpactGit {\n /** The checked-out branch's short name; null on a detached HEAD (or without git). */\n branch(root: string): string | null {\n return this.run(root, ['symbolic-ref', '--short', '-q', 'HEAD']);\n }\n\n /** The full sha `ref` names; null when it does not resolve (e.g. `HEAD^` on the first commit). */\n sha(root: string, ref: string): string | null {\n return this.run(root, ['rev-parse', '--verify', '-q', `${ref}^{commit}`]);\n }\n\n /** `git status --porcelain` is non-empty: uncommitted or untracked work. */\n dirty(root: string): boolean {\n return (this.run(root, ['status', '--porcelain']) ?? '') !== '';\n }\n\n /** HEAD's subject line ('' when unknown). */\n subject(root: string): string {\n return this.run(root, ['log', '-1', '--format=%s', 'HEAD']) ?? '';\n }\n\n /** Trimmed stdout, or null on any failure. */\n private run(root: string, args: string[]): string | null {\n const result = spawnSync('git', args, { cwd: root, encoding: 'utf8', stdio: 'pipe' });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout.trim();\n }\n}\n\n/**\n * Decides which comparisons exist from where HEAD is (#1163):\n *\n * | where | comparisons | default |\n * |---|---|---|\n * | `main` (by branch NAME) | last commit | last commit |\n * | detached HEAD | last commit | last commit |\n * | feature branch with commits past the fork point | branch, last commit | branch |\n * | fresh feature branch (fork point = HEAD) | branch | branch |\n *\n * HEAD with no parent leaves the last commit unavailable, with `ROOT_COMMIT_REASON`.\n */\nexport class ImpactScopeResolver {\n constructor(\n private readonly git: ImpactGit = new ImpactGit(),\n private readonly diffScope: DiffScope = new DiffScope(),\n ) {}\n\n async resolve(root: string): Promise<ImpactPlan | ImpactUnavailable> {\n const head = this.git.sha(root, 'HEAD');\n if (head === null) return new ImpactUnavailable('git cannot resolve HEAD (not a git checkout, or git is unavailable)');\n const branch = this.git.branch(root);\n const dirty = this.git.dirty(root);\n const commit = this.lastCommit(root, dirty);\n // On main the decision is the branch NAME, never merge-base: unpushed commits still mean \"last commit\".\n if (branch === null || branch === MAIN_BRANCH) return new ImpactPlan([commit], ImpactKind.COMMIT);\n const fork = await this.diffScope.detectBase(root);\n if (fork === null) {\n const reason = 'no fork point: neither origin/main nor main resolves';\n return new ImpactPlan(\n [new ImpactComparison(ImpactKind.BRANCH, null, 'Changed on this branch', dirty, reason)],\n ImpactKind.BRANCH,\n );\n }\n const onBranch = new ImpactComparison(\n ImpactKind.BRANCH,\n fork,\n `Changed on this branch (since ${this.short(fork)})${dirty ? UNCOMMITTED_SUFFIX : ''}`,\n dirty,\n '',\n );\n // A fresh branch has no commit of its own: \"last commit\" would be main's last PR, not its work.\n if (this.sameCommit(fork, head)) return new ImpactPlan([onBranch], ImpactKind.BRANCH);\n return new ImpactPlan([onBranch, commit], ImpactKind.BRANCH);\n }\n\n private lastCommit(root: string, dirty: boolean): ImpactComparison {\n const parent = this.git.sha(root, 'HEAD^');\n if (parent === null) return new ImpactComparison(ImpactKind.COMMIT, null, 'Last commit', dirty, ROOT_COMMIT_REASON);\n const subject = this.git.subject(root);\n const label =\n `Changed since ${this.short(parent)}${subject === '' ? '' : ` — ${subject}`}` +\n (dirty ? UNCOMMITTED_SUFFIX : '');\n return new ImpactComparison(ImpactKind.COMMIT, parent, label, dirty, '');\n }\n\n /** detectBase may hand back a full or an abbreviated sha; compare on the shorter of the two. */\n private sameCommit(a: string, b: string): boolean {\n const length = Math.min(a.length, b.length);\n return length > 0 && a.slice(0, length) === b.slice(0, length);\n }\n\n private short(sha: string): string {\n return sha.slice(0, 7);\n }\n}\n\n/** Runs the workspace's own nx CLI. Injected so specs never spawn nx. */\nexport class NxCli {\n /** stdout, or null when nx cannot be found, exits non-zero or exceeds the timeout. */\n run(workspaceRoot: string, args: string[], timeoutMs: number): string | null {\n const bin = this.binary(workspaceRoot);\n if (bin === null) return null;\n const result = spawnSync(process.execPath, [bin, ...args], {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: timeoutMs,\n stdio: 'pipe',\n maxBuffer: 16 * 1024 * 1024,\n });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout;\n }\n\n /** Resolved the way node would from the workspace, so a linked worktree finds its main tree's nx. */\n private binary(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a workspace without nx resolves nothing; that is an answer, not an error\n try {\n return require.resolve('nx/bin/nx.js', { paths: [workspaceRoot] });\n } catch (err: unknown) {\n const error = toError(err);\n void error; // no nx installed here — Impact is simply unavailable\n return null;\n }\n }\n}\n\n/**\n * The workspace's nx facts every comparison classifies against: its project graph (with npm nodes\n * and every edge), nx.json, package.json, and nx's own affected locators. Subclassed by specs.\n */\nexport class AffectedContext {\n constructor(\n public readonly graph: ProjectGraph,\n public readonly nxJson: NxJsonConfiguration,\n public readonly packageJson: PackageJson,\n public readonly classifier: AffectedClassifier,\n private readonly nx: WorkspaceNx | null,\n ) {}\n\n /** nx's FileChange list for `files`, base → working tree. */\n fileChanges(files: string[], base: string): FileChange[] {\n if (this.nx === null) throw new Error('no workspace nx to read file changes with');\n return this.nx.fileChanges(files, base);\n }\n}\n\n/** Loads the workspace's nx facts. Injected so specs never load the real project graph. */\nexport class AffectedContextLoader {\n async load(workspaceRoot: string): Promise<AffectedContext> {\n const nx = new WorkspaceNx(workspaceRoot);\n return new AffectedContext(\n await createProjectGraphAsync(),\n nx.nxJson(),\n nx.packageJson(),\n new AffectedClassifier(nx.locators()),\n nx,\n );\n }\n}\n\n/**\n * The context, loaded at most ONCE however many comparisons ask for it. Failing is not fatal: every\n * affected project is then \"unexplained\", with this error as its reason — never a dependent.\n */\nexport class SharedContext {\n private pending: Promise<AffectedContext | Error> | null = null;\n\n constructor(\n private readonly loader: AffectedContextLoader,\n private readonly workspaceRoot: string,\n ) {}\n\n get(): Promise<AffectedContext | Error> {\n if (this.pending === null) this.pending = this.load();\n return this.pending;\n }\n\n private async load(): Promise<AffectedContext | Error> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the reasons are optional; the affected set still shows\n try {\n return await this.loader.load(this.workspaceRoot);\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Impact: nx's affected locators unavailable (${error.message}); reasons unknown`);\n return error;\n }\n }\n}\n\nexport class NxImpactScanner {\n private readonly names = new GraphNames();\n\n constructor(\n private readonly diffScope: DiffScope = new DiffScope(),\n private readonly nx: NxCli = new NxCli(),\n private readonly loader: AffectedContextLoader = new AffectedContextLoader(),\n ) {}\n\n /** Every comparison, in order, sharing one nx context. */\n async scanAll(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparisons: ImpactComparison[],\n ): Promise<(ImpactReport | ImpactUnavailable)[]> {\n const context = new SharedContext(this.loader, workspaceRoot);\n const results: (ImpactReport | ImpactUnavailable)[] = [];\n for (const comparison of comparisons) results.push(await this.scan(workspaceRoot, graph, comparison, context));\n return results;\n }\n\n /** One comparison: nx affected from ITS base, with NO `--head`, so uncommitted work counts. */\n async scan(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparison: ImpactComparison,\n context: SharedContext = new SharedContext(this.loader, workspaceRoot),\n ): Promise<ImpactReport | ImpactUnavailable> {\n const base = comparison.base;\n if (base === null) return this.empty(comparison, false, comparison.reason, '', 0);\n const json = this.nx.run(workspaceRoot, ['show', 'projects', '--affected', `--base=${base}`, '--json'], NX_TIMEOUT_MS);\n if (json === null)\n return new ImpactUnavailable(`nx show projects --affected failed or took over ${NX_TIMEOUT_MS / 1000}s`, comparison.label);\n const affectedSet = this.parse(json);\n if (affectedSet === null)\n return new ImpactUnavailable('nx show projects --affected printed something other than a JSON list', comparison.label);\n const options = new ChangedFilesOptions();\n options.tsOnly = false;\n options.includeDeletions = true;\n const files = await this.diffScope.getChangedFiles(workspaceRoot, base, undefined, options);\n const short = base.slice(0, 7);\n const drawn = affectedSet.filter((project: string): boolean => graph[project] !== undefined);\n if (drawn.length === 0)\n return this.empty(comparison, true, this.emptyNote(comparison, files.length, short), short, files.length);\n const classification = await this.classify(await context.get(), files, base, affectedSet);\n return this.report(comparison, short, files.length, graph, classification);\n }\n\n /** nx's locators' answer; any failure makes every affected project \"unexplained\", with the reason. */\n async classify(\n context: AffectedContext | Error,\n files: string[],\n base: string,\n affected: string[],\n ): Promise<AffectedClassification> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the reasons are optional; a locator failure leaves them unknown\n try {\n if (context instanceof Error) throw context;\n const changes = context.fileChanges(files, base);\n return await context.classifier.classify(\n new AffectedInputs(context.graph, context.nxJson, context.packageJson, changes, affected),\n );\n } catch (err: unknown) {\n const error = toError(err);\n const why = `nx's affected locators could not run here (${error.message}), so why nx marked it is unknown`;\n return new AffectedClassification(\n [...affected].sort().map(\n (project: string): AffectedReason =>\n new AffectedReason(project, AffectedClass.UNEXPLAINED, [], [], '', '', why),\n ),\n [],\n );\n }\n }\n\n /**\n * An empty scan is still an ANSWER (available, zero sets): a fresh branch with a clean tree has\n * simply changed nothing yet, and the page says so instead of disabling Impact.\n */\n emptyNote(comparison: ImpactComparison, changedFiles: number, short: string): string {\n if (changedFiles === 0 && comparison.kind === ImpactKind.BRANCH) return NOTHING_CHANGED_ON_BRANCH;\n if (changedFiles === 0) return `Nothing changed since ${short}`;\n return `Nothing affected since ${short}`;\n }\n\n /**\n * Every transitive dependency of `roots` that is not itself one of them: a pure downward walk over\n * the graph's own dependsOn edges, no nx call. Of the affected set these are the build inputs; of\n * the touched set, \"Changed + dependencies\".\n */\n buildInputs(roots: string[], graph: EnhancedGraph): string[] {\n const inSet = new Set<string>(roots);\n const seen = new Set<string>(roots);\n const stack = [...roots];\n const inputs: string[] = [];\n while (stack.length > 0) {\n const project = stack.pop() as string;\n for (const dep of graph[project]?.dependsOn ?? []) {\n if (seen.has(dep)) continue;\n seen.add(dep);\n stack.push(dep);\n if (!inSet.has(dep) && graph[dep] !== undefined) inputs.push(dep);\n }\n }\n return inputs.sort();\n }\n\n /** The JSON list of project names, sorted; null when it is not a list of names. */\n parse(json: string): string[] | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- untrusted CLI output; anything unparseable is reported as a reason\n try {\n // webpieces-disable no-any-unknown -- CLI JSON is untrusted until narrowed below\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed)) return null;\n return parsed.filter((name: unknown): name is string => typeof name === 'string').sort();\n } catch (err: unknown) {\n const error = toError(err);\n void error; // not JSON — the caller reports it\n return null;\n }\n }\n\n /** The drawn projects only: a reason for a project the page does not draw has nowhere to show. */\n private report(\n comparison: ImpactComparison,\n short: string,\n changedFiles: number,\n graph: EnhancedGraph,\n classification: AffectedClassification,\n ): ImpactReport {\n const drawn = (projects: string[]): string[] =>\n projects.filter((project: string): boolean => graph[project] !== undefined);\n const touched = drawn(classification.of(AffectedClass.CHANGED));\n const affected = drawn(classification.reasons.map((reason: AffectedReason): string => reason.project));\n return new ImpactReport(\n comparison.kind,\n comparison.label,\n comparison.dirty,\n true,\n '',\n short,\n this.ids(touched),\n this.ids(drawn(classification.of(AffectedClass.DEPENDENT))),\n this.ids(drawn(classification.of(AffectedClass.IMPLICIT))),\n this.ids(drawn(classification.of(AffectedClass.ROOT_FILE))),\n this.ids(drawn(classification.of(AffectedClass.UNEXPLAINED))),\n this.ids(this.buildInputs(affected, graph)),\n changedFiles,\n this.ids(this.buildInputs(touched, graph)),\n classification.globalFiles,\n classification.reasons.filter((reason: AffectedReason): boolean => graph[reason.project] !== undefined),\n );\n }\n\n private empty(comparison: ImpactComparison, available: boolean, reason: string, base: string, changedFiles: number): ImpactReport {\n return new ImpactReport(comparison.kind, comparison.label, comparison.dirty, available, reason, base, [], [], [], [], [], [], changedFiles, [], [], []);\n }\n\n private ids(projects: string[]): string[] {\n return projects.map((project: string): string => this.names.getNodeId(project));\n }\n}\n\n/** Writes (or removes) the sidecar, self-ignored, beside architecture/dependencies.html. */\nexport class ImpactSidecar {\n /** Never throws: a sidecar that cannot be written just leaves Impact disabled on the page. */\n write(architectureDir: string, data: ImpactSidecarData): string | null {\n const dir = path.join(architectureDir, IMPACT_SIDECAR_DIR);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; a write failure must never fail generation\n try {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(\n path.join(dir, '.gitignore'),\n '# Written by architecture:generate and architecture:visualize. Per-checkout data: never commit it.\\n*\\n',\n 'utf-8',\n );\n const file = path.join(dir, IMPACT_SIDECAR_FILE);\n fs.writeFileSync(file, this.script(data), 'utf-8');\n return file;\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Could not write the impact sidecar: ${error.message}`);\n return null;\n }\n }\n\n /** A stale sidecar from an earlier checkout must never be shown as this one's impact. */\n remove(architectureDir: string): void {\n fs.rmSync(path.join(architectureDir, IMPACT_SIDECAR_DIR, IMPACT_SIDECAR_FILE), { force: true });\n }\n\n script(data: ImpactSidecarData): string {\n const json = JSON.stringify(data).replace(/</g, '\\\\u003c');\n return `// Generated by architecture:generate or architecture:visualize for one checkout. Gitignored; do not commit.\\nwindow.__WP_IMPACT__ = ${json};\\n`;\n }\n}\n\n/** The executors' one call: resolve, scan each comparison, write, and report one line per comparison. */\nexport class ImpactRefresh {\n constructor(\n private readonly scanner: NxImpactScanner = new NxImpactScanner(),\n private readonly sidecar: ImpactSidecar = new ImpactSidecar(),\n private readonly resolver: ImpactScopeResolver = new ImpactScopeResolver(),\n private readonly edges: EdgeChangeScanner = new EdgeChangeScanner(),\n ) {}\n\n /**\n * Scans the comparisons in `kinds` that exist here (`VISUALIZE_IMPACT_KINDS` /\n * `GENERATE_IMPACT_KINDS`), and the edge changes since the fork point against the LIVE graphs\n * `live` computes. Never throws — Impact is optional, generation is not.\n */\n async run(\n architectureDir: string,\n workspaceRoot: string,\n graph: EnhancedGraph,\n kinds: readonly ImpactKind[],\n live: LiveGraphSource,\n ): Promise<string> {\n const started = Date.now();\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; any failure becomes a reason, never a failed generation\n try {\n const plan = await this.resolver.resolve(workspaceRoot);\n if (plan instanceof ImpactUnavailable) return this.none(architectureDir, plan.reason, started);\n const comparisons = plan.comparisons.filter(\n (comparison: ImpactComparison): boolean => kinds.includes(comparison.kind),\n );\n if (comparisons.length === 0)\n return this.none(\n architectureDir,\n 'no Changed-on-this-branch comparison on main or a detached HEAD; pnpm arch:visualize shows the last commit',\n started,\n );\n const results = await this.scanner.scanAll(workspaceRoot, graph, comparisons);\n const lines = results.map((result: ImpactReport | ImpactUnavailable): string => this.line(result));\n const scans = results.filter(\n (result: ImpactReport | ImpactUnavailable): result is ImpactReport => result instanceof ImpactReport,\n );\n const cost = `${Date.now() - started} ms`;\n if (scans.length === 0) {\n this.sidecar.remove(architectureDir);\n return [...lines, `ℹ️ Impact disabled, no sidecar written (${cost})`].join('\\n');\n }\n const fork = plan.comparisons.find((comparison: ImpactComparison): boolean => comparison.kind === ImpactKind.BRANCH);\n const edges = await this.edges.scan(workspaceRoot, fork?.base ?? null, live);\n lines.push(this.edgeLine(edges));\n const data = new ImpactSidecarData(scans, this.defaultKind(scans, plan.defaultKind), edges);\n const file = this.sidecar.write(architectureDir, data);\n return [...lines, file === null ? `⚠️ Impact sidecar not written (${Date.now() - started} ms)` : `→ ${file} (${Date.now() - started} ms)`].join('\\n');\n } catch (err: unknown) {\n const error = toError(err);\n this.sidecar.remove(architectureDir);\n return `⚠️ Impact skipped: ${error.message}`;\n }\n }\n\n /** `✅ Edges since abc1234: dependencies 1 gained · 1 lost; runtime 0 gained · 0 lost`, or why not. */\n private edgeLine(edges: EdgeDiffReport): string {\n const half = (name: string, reason: string, changes: EdgeChange[]): string => {\n if (reason !== '') return `${name}: ${reason}`;\n const gained = changes.filter((change: EdgeChange): boolean => change.change === EdgeChangeKind.GAINED).length;\n return `${name} ${gained} gained · ${changes.length - gained} lost`;\n };\n const head = edges.base === '' ? 'ℹ️ Edges' : `✅ Edges since ${edges.base}`;\n return `${head}: ${half('dependencies', edges.dependencyReason, edges.dependency)}; ${half('runtime', edges.runtimeReason, edges.runtime)}`;\n }\n\n /** The plan's default when that scan is available, else the first available one. */\n private defaultKind(scans: ImpactReport[], preferred: ImpactKind): ImpactKind {\n const usable = scans.filter((scan: ImpactReport): boolean => scan.available);\n if (usable.length === 0 || usable.some((scan: ImpactReport): boolean => scan.kind === preferred)) return preferred;\n return usable[0].kind;\n }\n\n private none(architectureDir: string, reason: string, started: number): string {\n this.sidecar.remove(architectureDir);\n return `ℹ️ Impact disabled, no sidecar written: ${reason} (${Date.now() - started} ms)`;\n }\n\n private line(result: ImpactReport | ImpactUnavailable): string {\n if (result instanceof ImpactUnavailable || !result.available)\n return `ℹ️ Impact · ${result.label}: unavailable — ${result.reason}`;\n if (result.reason !== '') return `✅ Impact · ${result.label}: ${result.reason}`;\n return `✅ Impact · ${result.label}: ${new ImpactCounts().line(result)}, from ${result.changedFiles} changed file(s)`;\n }\n}\n"]}