/*
Register the werkstatt.shared.validate command with the kernel registry and module loader (RFC-0868).
- Do not implement validation logic — delegate to plugin/shared-validate.ts.
- RFC-0868: initial werkstatt-shared module registering werkstatt.shared.validate.
- 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.
*/
import type {
KernelCommandInput,
KernelCommandResult,
KernelRuntimeContext,
} from "../src/kernel/types.ts";
import { runSharedValidate, type SharedValidateResult } from "../src/plugin/shared-validate.ts";
import type { ModuleExport } from "../src/runtime/desired-state.ts";
export const werkstattSharedValidateModule: ModuleExport = {
name: "werkstatt-shared-validate",
version: "0.1.0",
declarations: [],
commands: [
{
name: "werkstatt.shared.validate",
mutatesState: false,
contract: "werkstatt",
rules: [],
modulePath: "packages/werkstatt-engine/os/werkstatt-shared-validate.module.ts",
description:
"Check SHARED-01 (werkstatt-shared dep declared), SHARED-02 (no site exemptions in autonomy-validate), SHARED-03 (no site imports in engine src), SHARED-04 (no engine imports in shared src), SHARED-05 (no engine dep in shared package.json). Enforces RFC-0868 + RFC-1104.",
scope: "workspace",
acceptsAllFlag: false,
flags: {},
reads: [
"packages/werkstatt-engine/package.json",
"packages/werkstatt-engine/src/plugin/autonomy-validate.ts",
"packages/werkstatt-engine/src/**",
"packages/werkstatt-shared/package.json",
"packages/werkstatt-shared/src/**",
],
cacheable: false,
async execute(
_input: KernelCommandInput,
context: KernelRuntimeContext,
): Promise> {
const result = await runSharedValidate(context.workspaceRoot);
const failedChecks = result.checks.filter((c) => c.status === "fail");
return {
exitCode: result.status === "pass" ? 0 : 1,
data: result,
summary:
result.status === "pass"
? `Shared boundary guard passed — SHARED-01..05 all pass`
: `Shared boundary guard failed — ${failedChecks.map((c) => c.id).join(", ")}`,
};
},
},
],
pipelines: [],
};