@aotter/mantle 0.0.11-alpha.62 → 0.0.11-alpha.64
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.
- package/README.md +96 -11
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +52 -0
- package/dist/cli.js.map +1 -0
- package/dist/generate.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +181 -0
- package/dist/generate.js.map +1 -0
- package/dist/harness-cli.d.ts +3 -0
- package/dist/harness-cli.d.ts.map +1 -0
- package/dist/harness-cli.js +209 -0
- package/dist/harness-cli.js.map +1 -0
- package/dist/runtime-testing.d.ts +2 -0
- package/dist/runtime-testing.d.ts.map +1 -0
- package/dist/runtime-testing.js +2 -0
- package/dist/runtime-testing.js.map +1 -0
- package/dist/skills.d.ts +2 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +80 -0
- package/dist/skills.js.map +1 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +387 -0
- package/dist/update.js.map +1 -0
- package/docs/adapter-guide.md +8 -0
- package/docs/adr/0001-four-atom-manifest-model.md +6 -7
- package/docs/adr/0007-ai-as-primary-author.md +100 -138
- package/docs/adr/0008-structured-diagnostic-shape.md +79 -99
- package/docs/adr/0009-consumer-supplied-manifests.md +101 -228
- package/docs/adr/0012-views-as-public-rest.md +43 -15
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +43 -17
- package/docs/adr/0018-core-starters-repository-boundary.md +155 -0
- package/docs/adr/README.md +8 -6
- package/docs/cloudflare-low-level-composition.md +94 -0
- package/docs/design-atoms.md +59 -57
- package/docs/design-references/editorial-blog-2026-05-05.md +7 -7
- package/docs/labels.md +1 -1
- package/docs/media-uploads.md +1 -1
- package/docs/performance-harness.md +104 -0
- package/docs/release-process.md +156 -523
- package/docs/schema-indexes.md +14 -1
- package/package.json +16 -6
- package/skills/README.md +20 -16
- package/skills/develop/SKILL.md +42 -4
- package/skills/install/SKILL.md +16 -2
- package/skills/plugin/SKILL.md +1 -1
- package/skills/provision/SKILL.md +1 -1
- package/skills/theme/SKILL.md +12 -10
- package/skills/update/SKILL.md +31 -19
- package/skills/customize-design/SKILL.md +0 -215
- package/skills/extend/SKILL.md +0 -257
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-testing.d.ts","sourceRoot":"","sources":["../src/runtime-testing.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-testing.js","sourceRoot":"","sources":["../src/runtime-testing.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
package/dist/skills.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAQA,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD3E"}
|
package/dist/skills.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { cwd, stderr, stdout } from "node:process";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
6
|
+
const PROJECT_SKILLS = ["develop", "plugin", "theme", "update"];
|
|
7
|
+
export async function runSkills(rawArgs) {
|
|
8
|
+
let check;
|
|
9
|
+
try {
|
|
10
|
+
const { values } = parseArgs({
|
|
11
|
+
args: [...rawArgs],
|
|
12
|
+
options: {
|
|
13
|
+
check: { type: "boolean" },
|
|
14
|
+
help: { type: "boolean", short: "h" },
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
if (values.help) {
|
|
18
|
+
printHelp();
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
check = values.check === true;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
stderr.write(`${message(error)}\n`);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const sourceRoot = await skillSourceRoot();
|
|
29
|
+
let stale = false;
|
|
30
|
+
for (const skill of PROJECT_SKILLS) {
|
|
31
|
+
const expected = await readFile(join(sourceRoot, skill, "SKILL.md"), "utf8");
|
|
32
|
+
for (const tool of [".agent", ".claude"]) {
|
|
33
|
+
const target = resolve(cwd(), tool, "skills", `mantle-${skill}`, "SKILL.md");
|
|
34
|
+
const current = await readFile(target, "utf8").catch(() => null);
|
|
35
|
+
if (current === expected)
|
|
36
|
+
continue;
|
|
37
|
+
stale = true;
|
|
38
|
+
if (check) {
|
|
39
|
+
stderr.write(`Mantle skill is stale: ${relative(cwd(), target)}\n`);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
await mkdir(dirname(target), { recursive: true });
|
|
43
|
+
await writeFile(target, expected, "utf8");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (stale && check) {
|
|
47
|
+
stderr.write("Mantle skills are stale; run `mantle skills`.\n");
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
if (!check)
|
|
51
|
+
stdout.write("Mantle skills projected.\n");
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
stderr.write(`mantle skills: ${message(error)}\n`);
|
|
56
|
+
return 2;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function printHelp() {
|
|
60
|
+
stdout.write(`mantle skills — project version-matched Core skills
|
|
61
|
+
|
|
62
|
+
Usage: mantle skills [--check]
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
--check Fail without writing when projected skills are stale
|
|
66
|
+
-h, --help This help
|
|
67
|
+
`);
|
|
68
|
+
}
|
|
69
|
+
async function skillSourceRoot() {
|
|
70
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
71
|
+
for (const candidate of [join(packageRoot, "skills"), resolve(packageRoot, "../../skills")]) {
|
|
72
|
+
if ((await stat(candidate).catch(() => null))?.isDirectory())
|
|
73
|
+
return candidate;
|
|
74
|
+
}
|
|
75
|
+
throw new Error("Core skills are missing from the installed package");
|
|
76
|
+
}
|
|
77
|
+
function message(error) {
|
|
78
|
+
return error instanceof Error ? error.message : String(error);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC3B,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;YAClB,OAAO,EAAE;gBACP,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAA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ChE,CAAC"}
|
package/dist/update.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAwBA,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkF3E"}
|
package/dist/update.js
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, readFileSync, readdirSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { join, posix } from "node:path";
|
|
4
|
+
import { cwd, stderr, stdout } from "node:process";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
6
|
+
const REPORT_PATH = ".mantle/update-report.json";
|
|
7
|
+
const IGNORE_DIRS = new Set([".git", "node_modules", ".wrangler", ".wrangler-test", "dist"]);
|
|
8
|
+
const IGNORE_FILES = new Set([".mantle/features.json", ".mantle/launch-state.json", REPORT_PATH]);
|
|
9
|
+
export async function runUpdate(rawArgs) {
|
|
10
|
+
let values;
|
|
11
|
+
try {
|
|
12
|
+
({ values } = parseArgs({
|
|
13
|
+
args: [...rawArgs],
|
|
14
|
+
options: {
|
|
15
|
+
ref: { type: "string" },
|
|
16
|
+
"bundle-base-url": { type: "string" },
|
|
17
|
+
help: { type: "boolean", short: "h" },
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
stderr.write(`${message(error)}\n`);
|
|
23
|
+
return 2;
|
|
24
|
+
}
|
|
25
|
+
if (values.help) {
|
|
26
|
+
printHelp();
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
const root = cwd();
|
|
30
|
+
try {
|
|
31
|
+
const launchState = readJson(join(root, ".mantle", "launch-state.json"));
|
|
32
|
+
const features = readJson(join(root, ".mantle", "features.json"));
|
|
33
|
+
const registry = recordField(features, "registry");
|
|
34
|
+
const sourceRef = stringField(launchState, "starter_ref");
|
|
35
|
+
const targetRef = values.ref ?? stringField(registry, "version");
|
|
36
|
+
const bundleBaseUrl = values["bundle-base-url"] ?? stringField(registry, "bundleBaseUrl");
|
|
37
|
+
if (!sourceRef)
|
|
38
|
+
throw new UsageError(".mantle/launch-state.json is missing starter_ref");
|
|
39
|
+
if (!targetRef)
|
|
40
|
+
throw new UsageError("pass --ref or configure registry.version");
|
|
41
|
+
if (!bundleBaseUrl) {
|
|
42
|
+
throw new UsageError("pass --bundle-base-url or configure registry.bundleBaseUrl");
|
|
43
|
+
}
|
|
44
|
+
if (!bundleBaseUrl.includes("{ref}")) {
|
|
45
|
+
throw new UsageError("bundle base URL must contain {ref}");
|
|
46
|
+
}
|
|
47
|
+
const archetype = launchArchetype(launchState, features);
|
|
48
|
+
const sourceBundle = await fetchBundle(bundleBaseUrl, sourceRef, archetype);
|
|
49
|
+
const targetBundle = sourceRef === targetRef
|
|
50
|
+
? sourceBundle
|
|
51
|
+
: await fetchBundle(bundleBaseUrl, targetRef, archetype);
|
|
52
|
+
const timestamp = new Date().toISOString();
|
|
53
|
+
const turnstileSiteKey = optionalStringField(launchState, "turnstile_site_key")
|
|
54
|
+
?? readWranglerStringVar(root, "TURNSTILE_SITE_KEY")
|
|
55
|
+
?? "";
|
|
56
|
+
const source = materializeBundle(sourceBundle, placeholders(launchState, archetype, sourceRef, timestamp, turnstileSiteKey));
|
|
57
|
+
const target = materializeBundle(targetBundle, placeholders(launchState, archetype, targetRef, timestamp, turnstileSiteKey));
|
|
58
|
+
const upstream = compareSnapshots(source, target);
|
|
59
|
+
const local = compareProject(root, source);
|
|
60
|
+
const report = {
|
|
61
|
+
schema_version: 3,
|
|
62
|
+
generated_at: timestamp,
|
|
63
|
+
source_ref: sourceRef,
|
|
64
|
+
target_ref: targetRef,
|
|
65
|
+
bundle_base_url: bundleBaseUrl,
|
|
66
|
+
bundle_version: targetBundle.version ?? null,
|
|
67
|
+
upstream,
|
|
68
|
+
local,
|
|
69
|
+
metadata_migration: metadataMigration(sourceRef, targetRef, bundleBaseUrl, registry),
|
|
70
|
+
next_step: "Port reviewed upstream changes only, then apply the reported metadata migration while preserving all other instance state.",
|
|
71
|
+
};
|
|
72
|
+
writeReport(root, `${JSON.stringify(report, null, 2)}\n`);
|
|
73
|
+
stdout.write(`mantle update report: ${REPORT_PATH}\n`);
|
|
74
|
+
stdout.write(`${sourceRef} → ${targetRef}: ${upstream.counts.differing} changed, `
|
|
75
|
+
+ `${upstream.counts.missing_current} added, ${upstream.counts.removed_upstream} removed; `
|
|
76
|
+
+ `local: ${local.counts.differing} modified, ${local.counts.missing_current} missing, `
|
|
77
|
+
+ `${local.counts.removed_upstream} project-only\n`);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
stderr.write(`mantle update: ${message(error)}\n`);
|
|
82
|
+
return error instanceof UsageError ? 2 : 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function printHelp() {
|
|
86
|
+
stdout.write(`mantle update — compare this site with another provision bundle
|
|
87
|
+
|
|
88
|
+
Usage: mantle update [options]
|
|
89
|
+
|
|
90
|
+
Options:
|
|
91
|
+
--ref <ref> Target immutable starter ref; defaults to registry.version
|
|
92
|
+
--bundle-base-url <url> Bundle root containing {ref}; defaults to registry.bundleBaseUrl
|
|
93
|
+
-h, --help This help
|
|
94
|
+
`);
|
|
95
|
+
}
|
|
96
|
+
async function fetchBundle(baseTemplate, ref, archetype) {
|
|
97
|
+
let lastUrl = "";
|
|
98
|
+
let lastStatus = 404;
|
|
99
|
+
for (const candidate of bundleRefCandidates(ref)) {
|
|
100
|
+
const base = baseTemplate.replaceAll("{ref}", encodeURIComponent(candidate)).replace(/\/+$/, "");
|
|
101
|
+
const url = new URL(`${base}/${encodeURIComponent(archetype)}.json`);
|
|
102
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
103
|
+
throw new Error("bundle base URL must use http or https");
|
|
104
|
+
}
|
|
105
|
+
lastUrl = url.toString();
|
|
106
|
+
const response = await fetch(url, { headers: { accept: "application/json" } });
|
|
107
|
+
lastStatus = response.status;
|
|
108
|
+
if (!response.ok && response.status === 404)
|
|
109
|
+
continue;
|
|
110
|
+
if (!response.ok)
|
|
111
|
+
throw new Error(`failed to fetch ${url}: HTTP ${response.status}`);
|
|
112
|
+
const value = await response.json();
|
|
113
|
+
if (!isRecord(value) || !isStringRecord(value.files)) {
|
|
114
|
+
throw new Error(`invalid provision bundle at ${url}`);
|
|
115
|
+
}
|
|
116
|
+
if (typeof value.archetype === "string" && value.archetype !== archetype) {
|
|
117
|
+
throw new Error(`provision bundle at ${url} is ${value.archetype}, expected ${archetype}`);
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
version: typeof value.version === "string" ? value.version : undefined,
|
|
121
|
+
files: value.files,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
throw new Error(`failed to fetch ${lastUrl}: HTTP ${lastStatus}`);
|
|
125
|
+
}
|
|
126
|
+
function bundleRefCandidates(ref) {
|
|
127
|
+
return /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(ref) ? [ref, `v${ref}`] : [ref];
|
|
128
|
+
}
|
|
129
|
+
function materializeBundle(bundle, values) {
|
|
130
|
+
const files = new Map();
|
|
131
|
+
for (const [sourcePath, source] of Object.entries(bundle.files).sort(([a], [b]) => a.localeCompare(b))) {
|
|
132
|
+
const path = safeBundlePath(sourcePath);
|
|
133
|
+
if (files.has(path))
|
|
134
|
+
throw new Error(`duplicate provision bundle path: ${path}`);
|
|
135
|
+
let text = substitute(source, values);
|
|
136
|
+
if (path === "wrangler.toml")
|
|
137
|
+
text = materializeLegacyWranglerToml(text, values);
|
|
138
|
+
files.set(path, text);
|
|
139
|
+
}
|
|
140
|
+
return files;
|
|
141
|
+
}
|
|
142
|
+
function safeBundlePath(source) {
|
|
143
|
+
const slashPath = source.replaceAll("\\", "/");
|
|
144
|
+
if (/^(?:\/|[A-Za-z]:\/)/.test(slashPath) || slashPath.split("/").includes("..")) {
|
|
145
|
+
throw new Error(`bundle path escapes project root: ${source}`);
|
|
146
|
+
}
|
|
147
|
+
const path = posix.normalize(slashPath.replace(/\.template$/, ""));
|
|
148
|
+
if (path === "." || path.startsWith("../")) {
|
|
149
|
+
throw new Error(`bundle path escapes project root: ${source}`);
|
|
150
|
+
}
|
|
151
|
+
return path;
|
|
152
|
+
}
|
|
153
|
+
function substitute(source, values) {
|
|
154
|
+
return source.replace(/\{\{([A-Z_][A-Z0-9_]*)\}\}/g, (token, key) => {
|
|
155
|
+
const value = values[key];
|
|
156
|
+
if (value === undefined)
|
|
157
|
+
throw new Error(`unknown provision placeholder ${token}`);
|
|
158
|
+
return value;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function materializeLegacyWranglerToml(text, values) {
|
|
162
|
+
const envStart = text.search(/\n\[env\./);
|
|
163
|
+
const tail = envStart === -1 ? "" : text.slice(envStart);
|
|
164
|
+
let head = envStart === -1 ? text : text.slice(0, envStart);
|
|
165
|
+
head = head.replace(/^name = ".*"$/m, `name = ${JSON.stringify(values.PROJECT_NAME)}`);
|
|
166
|
+
head = head.replace(/^database_name = ".*"$/m, `database_name = ${JSON.stringify(`${values.PROJECT_NAME}-db`)}`);
|
|
167
|
+
head = upsertWranglerStringVar(head, "PUBLIC_ORIGIN", values.SITE_URL ?? "");
|
|
168
|
+
if (values.TURNSTILE_SITE_KEY?.trim()) {
|
|
169
|
+
head = upsertWranglerStringVar(head, "TURNSTILE_SITE_KEY", values.TURNSTILE_SITE_KEY.trim());
|
|
170
|
+
}
|
|
171
|
+
return `${head}${tail}`;
|
|
172
|
+
}
|
|
173
|
+
function upsertWranglerStringVar(text, name, value) {
|
|
174
|
+
const line = `${name} = ${JSON.stringify(value)}`;
|
|
175
|
+
const existing = new RegExp(`^\\s*#?\\s*${escapeRegExp(name)}\\s*=.*$`, "m");
|
|
176
|
+
if (existing.test(text))
|
|
177
|
+
return text.replace(existing, line);
|
|
178
|
+
const vars = text.match(/^\[vars\]\s*$/m);
|
|
179
|
+
if (!vars || vars.index === undefined)
|
|
180
|
+
return `${text.trimEnd()}\n\n[vars]\n${line}\n`;
|
|
181
|
+
const index = vars.index + vars[0].length;
|
|
182
|
+
return `${text.slice(0, index)}\n${line}${text.slice(index)}`;
|
|
183
|
+
}
|
|
184
|
+
function readWranglerStringVar(root, name) {
|
|
185
|
+
const path = join(root, "wrangler.toml");
|
|
186
|
+
if (!existsSync(path) || !lstatSync(path).isFile())
|
|
187
|
+
return null;
|
|
188
|
+
const source = readFileSync(path, "utf8");
|
|
189
|
+
const match = source.match(new RegExp(`^\\s*${escapeRegExp(name)}\\s*=\\s*("(?:[^"\\\\]|\\\\.)*")\\s*$`, "m"));
|
|
190
|
+
if (!match?.[1])
|
|
191
|
+
return null;
|
|
192
|
+
try {
|
|
193
|
+
const value = JSON.parse(match[1]);
|
|
194
|
+
return typeof value === "string" ? value.trim() : null;
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function escapeRegExp(value) {
|
|
201
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
202
|
+
}
|
|
203
|
+
function placeholders(launchState, archetype, targetRef, timestamp, turnstileSiteKey) {
|
|
204
|
+
const github = recordField(launchState, "github");
|
|
205
|
+
const repo = recordField(launchState, "repo");
|
|
206
|
+
const siteOwner = recordField(launchState, "site_owner");
|
|
207
|
+
const locales = arrayField(launchState, "locales");
|
|
208
|
+
const owner = optionalStringField(repo, "owner")
|
|
209
|
+
?? optionalStringField(github, "owner")
|
|
210
|
+
?? "unknown-owner";
|
|
211
|
+
const projectName = stringField(launchState, "project_name")
|
|
212
|
+
?? stringField(repo, "name")
|
|
213
|
+
?? "mantle-site";
|
|
214
|
+
const siteUrl = stringField(launchState, "site_url") ?? "https://example.com";
|
|
215
|
+
const locale = stringField(launchState, "canonical_locale") ?? locales[0] ?? "en";
|
|
216
|
+
const description = stringField(launchState, "description")
|
|
217
|
+
?? stringField(launchState, "purpose")
|
|
218
|
+
?? `${projectName} site.`;
|
|
219
|
+
return {
|
|
220
|
+
PROJECT_NAME: projectName,
|
|
221
|
+
ARCHETYPE: archetype,
|
|
222
|
+
BRAND: stringField(launchState, "brand") ?? projectName,
|
|
223
|
+
DESCRIPTION: description,
|
|
224
|
+
INSTALL_SUMMARY: stringField(launchState, "summary") ?? description,
|
|
225
|
+
LOCALES: JSON.stringify(locales.length ? locales : ["en"]),
|
|
226
|
+
CANONICAL_LOCALE: locale,
|
|
227
|
+
STARTER_REF: targetRef,
|
|
228
|
+
GITHUB_OWNER: owner,
|
|
229
|
+
ADMIN_GITHUB_LOGIN: optionalStringField(github, "admin_login")
|
|
230
|
+
?? optionalStringField(siteOwner, "github_login")
|
|
231
|
+
?? owner,
|
|
232
|
+
SITE_OWNER_EMAIL: optionalStringField(siteOwner, "email") ?? "",
|
|
233
|
+
AUTH_MODE: stringField(launchState, "authMode") ?? "self-managed",
|
|
234
|
+
SITE_URL: siteUrl,
|
|
235
|
+
TURNSTILE_SITE_KEY: turnstileSiteKey,
|
|
236
|
+
AFTER_LAUNCH_SKILL_URL: stringField(launchState, "after_launch_skill_url") ?? "",
|
|
237
|
+
INSTALL_TIMESTAMP: timestamp,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function compareSnapshots(current, upstream) {
|
|
241
|
+
const differing = [];
|
|
242
|
+
const missingCurrent = [];
|
|
243
|
+
for (const [path, source] of [...upstream].sort(([a], [b]) => a.localeCompare(b))) {
|
|
244
|
+
if (IGNORE_FILES.has(path))
|
|
245
|
+
continue;
|
|
246
|
+
const existing = current.get(path);
|
|
247
|
+
if (existing === undefined)
|
|
248
|
+
missingCurrent.push({ path, upstream_sha256: sha256(source) });
|
|
249
|
+
else if (existing !== source) {
|
|
250
|
+
differing.push({ path, current_sha256: sha256(existing), upstream_sha256: sha256(source) });
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const removedUpstream = [...current]
|
|
254
|
+
.filter(([path]) => !IGNORE_FILES.has(path) && !upstream.has(path))
|
|
255
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
256
|
+
.map(([path, source]) => ({ path, current_sha256: sha256(source) }));
|
|
257
|
+
return diffReport(differing, missingCurrent, removedUpstream);
|
|
258
|
+
}
|
|
259
|
+
function compareProject(root, upstream) {
|
|
260
|
+
const differing = [];
|
|
261
|
+
const missingCurrent = [];
|
|
262
|
+
for (const [path, source] of [...upstream].sort(([a], [b]) => a.localeCompare(b))) {
|
|
263
|
+
if (IGNORE_FILES.has(path))
|
|
264
|
+
continue;
|
|
265
|
+
const currentPath = join(root, path);
|
|
266
|
+
if (!existsSync(currentPath) || !lstatSync(currentPath).isFile()) {
|
|
267
|
+
missingCurrent.push({ path, upstream_sha256: sha256(source) });
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
const current = readFileSync(currentPath);
|
|
271
|
+
if (sha256(current) !== sha256(source)) {
|
|
272
|
+
differing.push({ path, current_sha256: sha256(current), upstream_sha256: sha256(source) });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const removedUpstream = listProjectFiles(root)
|
|
276
|
+
.filter((path) => !upstream.has(path))
|
|
277
|
+
.map((path) => ({ path, current_sha256: sha256(readFileSync(join(root, path))) }));
|
|
278
|
+
return diffReport(differing, missingCurrent, removedUpstream);
|
|
279
|
+
}
|
|
280
|
+
function listProjectFiles(root, prefix = "") {
|
|
281
|
+
const files = [];
|
|
282
|
+
for (const entry of readdirSync(join(root, prefix), { withFileTypes: true })) {
|
|
283
|
+
if (IGNORE_DIRS.has(entry.name))
|
|
284
|
+
continue;
|
|
285
|
+
const path = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
286
|
+
if (entry.isDirectory())
|
|
287
|
+
files.push(...listProjectFiles(root, path));
|
|
288
|
+
else if (entry.isFile() && !IGNORE_FILES.has(path))
|
|
289
|
+
files.push(path);
|
|
290
|
+
}
|
|
291
|
+
return files.sort();
|
|
292
|
+
}
|
|
293
|
+
function diffReport(differing, missingCurrent, removedUpstream) {
|
|
294
|
+
return {
|
|
295
|
+
counts: {
|
|
296
|
+
differing: differing.length,
|
|
297
|
+
missing_current: missingCurrent.length,
|
|
298
|
+
removed_upstream: removedUpstream.length,
|
|
299
|
+
},
|
|
300
|
+
differing,
|
|
301
|
+
missing_current: missingCurrent,
|
|
302
|
+
removed_upstream: removedUpstream,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function metadataMigration(sourceRef, targetRef, bundleBaseUrl, registry) {
|
|
306
|
+
return {
|
|
307
|
+
required: sourceRef !== targetRef
|
|
308
|
+
|| stringField(registry, "version") !== targetRef
|
|
309
|
+
|| stringField(registry, "bundleBaseUrl") !== bundleBaseUrl,
|
|
310
|
+
apply_after_reviewed_port: true,
|
|
311
|
+
files: [
|
|
312
|
+
{
|
|
313
|
+
path: ".mantle/launch-state.json",
|
|
314
|
+
set: { starter_ref: targetRef },
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
path: ".mantle/features.json",
|
|
318
|
+
set: {
|
|
319
|
+
"registry.version": targetRef,
|
|
320
|
+
"registry.bundleBaseUrl": bundleBaseUrl,
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function writeReport(root, source) {
|
|
327
|
+
const directory = join(root, ".mantle");
|
|
328
|
+
if (!existsSync(directory) || !lstatSync(directory).isDirectory()) {
|
|
329
|
+
throw new Error(".mantle must be a real directory");
|
|
330
|
+
}
|
|
331
|
+
const path = join(root, REPORT_PATH);
|
|
332
|
+
if (existsSync(path) && !lstatSync(path).isFile()) {
|
|
333
|
+
throw new Error(`${REPORT_PATH} must be a regular file`);
|
|
334
|
+
}
|
|
335
|
+
writeFileSync(path, source, "utf8");
|
|
336
|
+
}
|
|
337
|
+
function sha256(value) {
|
|
338
|
+
return createHash("sha256").update(value).digest("hex");
|
|
339
|
+
}
|
|
340
|
+
function readJson(path) {
|
|
341
|
+
if (!existsSync(path))
|
|
342
|
+
return {};
|
|
343
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
344
|
+
return isRecord(value) ? value : {};
|
|
345
|
+
}
|
|
346
|
+
function launchArchetype(launchState, features) {
|
|
347
|
+
const archetype = stringField(launchState, "archetype")
|
|
348
|
+
?? stringField(recordField(features, "archetype"), "name")
|
|
349
|
+
?? "blank";
|
|
350
|
+
if (!/^[a-z0-9-]+$/.test(archetype))
|
|
351
|
+
throw new Error(`invalid archetype: ${archetype}`);
|
|
352
|
+
return archetype;
|
|
353
|
+
}
|
|
354
|
+
function recordField(value, key) {
|
|
355
|
+
if (!isRecord(value))
|
|
356
|
+
return {};
|
|
357
|
+
return isRecord(value[key]) ? value[key] : {};
|
|
358
|
+
}
|
|
359
|
+
function stringField(value, key) {
|
|
360
|
+
if (!isRecord(value))
|
|
361
|
+
return null;
|
|
362
|
+
const field = value[key];
|
|
363
|
+
return typeof field === "string" && field.trim() ? field.trim() : null;
|
|
364
|
+
}
|
|
365
|
+
function optionalStringField(value, key) {
|
|
366
|
+
if (!isRecord(value))
|
|
367
|
+
return null;
|
|
368
|
+
const field = value[key];
|
|
369
|
+
return typeof field === "string" ? field.trim() : null;
|
|
370
|
+
}
|
|
371
|
+
function arrayField(value, key) {
|
|
372
|
+
if (!isRecord(value) || !Array.isArray(value[key]))
|
|
373
|
+
return [];
|
|
374
|
+
return value[key].filter((item) => typeof item === "string");
|
|
375
|
+
}
|
|
376
|
+
function isRecord(value) {
|
|
377
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
378
|
+
}
|
|
379
|
+
function isStringRecord(value) {
|
|
380
|
+
return isRecord(value) && Object.values(value).every((item) => typeof item === "string");
|
|
381
|
+
}
|
|
382
|
+
function message(error) {
|
|
383
|
+
return error instanceof Error ? error.message : String(error);
|
|
384
|
+
}
|
|
385
|
+
class UsageError extends Error {
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAW,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACjD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7F,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,uBAAuB,EAAE,2BAA2B,EAAE,WAAW,CAAC,CAAC,CAAC;AAUlG,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA0B;IACxD,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YACtB,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;YAClB,OAAO,EAAE;gBACP,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACvB,iBAAiB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACrC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;aACtC;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,C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OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAW,SAAQ,KAAK;CAAG"}
|
package/docs/adapter-guide.md
CHANGED
|
@@ -61,6 +61,14 @@ await runtime.bootInit();
|
|
|
61
61
|
|
|
62
62
|
`bootInit()` runs canonical migrations, seeds `siteDefaults`, and validates the manifest set. Call it once before serving CMS traffic. The Cloudflare adapter's reference pattern is `packages/adapters/cloudflare/src/mount/bootRuntimeOnce.ts`.
|
|
63
63
|
|
|
64
|
+
Use purpose-shaped runtime surfaces for canonical data: `runtime.entryReader`
|
|
65
|
+
applies Schema index declarations, locale semantics, and the public `Entry`
|
|
66
|
+
projection; `runtime.siteConfig` owns site settings. `runtime.db` remains only
|
|
67
|
+
for source compatibility and is deprecated. An adapter that owns additional
|
|
68
|
+
tables should retain the `DatabaseDriver` it injected instead of reaching back
|
|
69
|
+
through the assembled runtime. Authoring continues through the pre-wired
|
|
70
|
+
content use cases.
|
|
71
|
+
|
|
64
72
|
## HTTP and MCP surfaces
|
|
65
73
|
|
|
66
74
|
The runtime is a library, not an HTTP server. A new adapter must mount equivalent framework routes:
|
|
@@ -209,12 +209,11 @@ See § Authoring shape below for the full retirement rationale.
|
|
|
209
209
|
|
|
210
210
|
## Implementation status
|
|
211
211
|
|
|
212
|
-
Names + PG-1:1 framing are documented in this ADR and the
|
|
213
|
-
|
|
214
|
-
`
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
v0.1.0 ship list in [aotter/mantle](https://github.com/aotter/mantle).
|
|
212
|
+
Names + PG-1:1 framing are documented in this ADR and the manifest grammar
|
|
213
|
+
reference. Manifest TS types live in `packages/mantle-spec/`. The external
|
|
214
|
+
[`aotter/mantle-starters`](https://github.com/aotter/mantle-starters)
|
|
215
|
+
repository declares consumer instances of each atom. Runtime dispatcher, View
|
|
216
|
+
executor, and Procedure dispatcher live in this repository.
|
|
218
217
|
|
|
219
218
|
---
|
|
220
219
|
|
|
@@ -500,7 +499,7 @@ YAML's standard `---` separator allows multiple documents in
|
|
|
500
499
|
one file. A "feature file" carries all atoms for that feature:
|
|
501
500
|
|
|
502
501
|
```yaml
|
|
503
|
-
#
|
|
502
|
+
# manifests/contact.yaml
|
|
504
503
|
apiVersion: cms.mantle.aotter.net/v1
|
|
505
504
|
kind: Schema
|
|
506
505
|
metadata: { name: contact-messages }
|