Simplify workspace authoring and isolate managed component styles

This commit is contained in:
Timothy J. Aveni
2026-09-14 20:42:37 -07:00
parent 14b0ef25c3
commit 4982cb7e9f
13 changed files with 263 additions and 79 deletions
+23
View File
@@ -0,0 +1,23 @@
import fs from "node:fs/promises";
import path from "node:path";
import {contentDigest} from "../capability-model/evolution.js";
import {validateMigrationCatalog, type MigrationCatalog} from "../capability-model/migrations.js";
import {applyStructure, planStructure} from "./structural-plan.js";
/** Explicitly acknowledge edited migration code. This does not change retained
* contracts or grant activation approval; the immutable checker verifies it. */
export async function sealMigrations(directory: string) {
const root = await fs.realpath(directory);
const file = "quixos.migrations.json";
const before = await fs.readFile(path.join(root, file), "utf8");
const catalog = JSON.parse(before) as MigrationCatalog;
for (const migration of catalog.migrations) {
const implementation = await fs.realpath(path.join(root, migration.implementation.file));
if (!implementation.startsWith(root + path.sep)) throw new Error("Migration implementation escapes package");
migration.implementation.digest = contentDigest(await fs.readFile(implementation, "utf8"));
}
validateMigrationCatalog(catalog);
return applyStructure(await planStructure(root, {kind: "package", validation: "syntax", files: [
{file, expected: before, replace: JSON.stringify(catalog, null, 2) + "\n"},
]}));
}