/*
Lazy-loading kernel module for RFC-0359/0380 Notausgang emergency export commands: export and validate, producing self-contained site packages with nulled integrations.
- Do not re-export types or utilities — the barrel notausgang/index.ts remains the public API surface.
- Do not register leitstand or release commands here.
- RFC-1097: step 6 — compass.migrate codemod run
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.
- RFC-1097: sweep — werkstatt-engine clean
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.
- RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)
- RFC-1231: step 1 — rename supportsAllSites to acceptsAllFlag
Mechanical sweep: the field only ever gated --all argv acceptance; fan-out
follows the parsed selector. Guard renamed assertAllSitesAllowed ->
assertAllFlagAccepted, message updated. 417 declaration sites + type
surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.
- RFC-1248: VITE-CLIENT-DEP-02 lazy-import gate + SCAN-02 validator reads-root existence check (RFC-1248)
*/
import type { ModuleExport } from "@warpgogol/werkstatt-shared/kernel";
export async function createNotausgangModule(): Promise {
const { runNotausgangExport, runNotausgangValidate } = await import("./notausgang-commands.ts");
return {
name: "notausgang",
version: "0.1.0",
declarations: [],
commands: [
{
name: "notausgang.export",
modulePath: "packages/werkstatt-engine/src/notausgang/notausgang.module.ts",
generates: [],
description:
"Export a full site package with dist artifacts, history, and nulled integrations (RFC-0359, RFC-0380). Writes YAML manifests and uses @warpgogol/fingerprint for hashing. Flags: --system, --release, --output, [--keep-integration, --reason].",
scope: "workspace",
acceptsAllFlag: false,
mutatesState: true,
flags: {
system: { kind: "string", required: true, description: "Sternsystem id." },
release: { kind: "string", required: true, description: "Release id to export." },
output: { kind: "string", required: true, description: "Export output directory." },
"keep-integration": {
kind: "string[]",
description: "Integration names to keep rather than null.",
},
reason: {
kind: "string[]",
description: "Reasons paired with kept integrations.",
},
},
writes: ["{--output}/**"],
reads: [
"releases/{release}/**",
"../systems-cache/{system}/**",
"../systems-cache/{system}/system-config.yaml",
"../systems-cache/{system}/src/content/system.md",
"../systems-cache/{system}/src/content/business-profile/**",
],
cacheable: false,
execute: runNotausgangExport,
},
{
name: "notausgang.validate",
mutatesState: false,
contract: "notausgang",
rules: [
"NA-EVIDENCE-01",
"NA-EVIDENCE-02",
"NA-FEATURES-01",
"NA-VERIFIER-01",
"NA-MANIFEST-02",
],
modulePath: "packages/werkstatt-engine/src/notausgang/notausgang.module.ts",
description:
"Deep integrity verification of a Notausgang export package (RFC-0359, RFC-0380). Re-computes hashes, validates manifest schema, Bordbuch NDJSON, pin content, behavior snapshots, and scans for secrets. Flags: --path.",
scope: "workspace",
acceptsAllFlag: false,
flags: {
path: { kind: "string", required: true, description: "Export package path." },
},
reads: ["{--path}/**"],
execute: runNotausgangValidate,
},
],
pipelines: [],
};
}