@fabricorg/fabric-gen 0.6.3 → 0.7.1
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/CHANGELOG.md +21 -0
- package/dist/{chunk-4QFNFERM.js → chunk-LHZN67DB.js} +232 -24
- package/dist/chunk-LHZN67DB.js.map +1 -0
- package/dist/cli.cjs +229 -23
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +231 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -6
- package/dist/index.d.ts +24 -6
- package/dist/index.js +3 -1
- package/package.json +7 -6
- package/dist/chunk-4QFNFERM.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
FabricGenUsageError: () => FabricGenUsageError,
|
|
34
34
|
GENERATOR_TARGETS: () => GENERATOR_TARGETS,
|
|
35
35
|
checkApplication: () => checkApplication,
|
|
36
|
+
exportModuleManifestFile: () => exportModuleManifestFile,
|
|
36
37
|
fabricGenCliExitCode: () => fabricGenCliExitCode,
|
|
37
38
|
generateFromManifest: () => generateFromManifest,
|
|
38
39
|
initializeCapability: () => initializeCapability,
|
|
@@ -44,7 +45,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
44
45
|
var import_promises = require("fs/promises");
|
|
45
46
|
var import_node_crypto = require("crypto");
|
|
46
47
|
var import_node_path = __toESM(require("path"), 1);
|
|
48
|
+
var import_node_url = require("url");
|
|
47
49
|
var import_compiler = require("@fabricorg/compiler");
|
|
50
|
+
var import_manifest = require("@fabricorg/platform/manifest");
|
|
48
51
|
var import_gen_capability = require("@fabricorg/gen-capability");
|
|
49
52
|
var import_gen_docs = require("@fabricorg/gen-docs");
|
|
50
53
|
var import_gen_events = require("@fabricorg/gen-events");
|
|
@@ -70,6 +73,7 @@ var compareCanonicalStrings = (left, right) => left < right ? -1 : left > right
|
|
|
70
73
|
var usage = [
|
|
71
74
|
"Usage:",
|
|
72
75
|
" fabric-gen init capability <namespace> [--directory <path>]",
|
|
76
|
+
" fabric-gen export --module <file> [--export <name>] --out <manifest.json>",
|
|
73
77
|
" fabric-gen init experience <application> [--directory <path>]",
|
|
74
78
|
" fabric-gen check-application [--config <path>]",
|
|
75
79
|
" fabric-gen promote-experience --config <path> --key <pem> [--out <path>]",
|
|
@@ -89,6 +93,13 @@ function flagValue(args, flag) {
|
|
|
89
93
|
return value;
|
|
90
94
|
}
|
|
91
95
|
async function runFabricGenCommand(args) {
|
|
96
|
+
if (args[0] === "export") {
|
|
97
|
+
const moduleFile = flagValue(args, "--module");
|
|
98
|
+
const out = flagValue(args, "--out");
|
|
99
|
+
if (!moduleFile || !out) throw new FabricGenUsageError(usage);
|
|
100
|
+
const result2 = await exportModuleManifestFile({ moduleFile, out, exportName: flagValue(args, "--export") });
|
|
101
|
+
return `Exported "${result2.namespace}" from ${result2.exportName} to ${out}: ${result2.objectTypes} object types, ${result2.actions} actions, ${result2.eventTypes} event types.`;
|
|
102
|
+
}
|
|
92
103
|
if (args[0] === "init") {
|
|
93
104
|
if (!args[2] || args[2].startsWith("--")) {
|
|
94
105
|
throw new FabricGenUsageError(usage);
|
|
@@ -138,6 +149,40 @@ async function runFabricGenCommand(args) {
|
|
|
138
149
|
});
|
|
139
150
|
return `${args.includes("--check") ? "Checked" : "Generated"} ${result.files.length} files.`;
|
|
140
151
|
}
|
|
152
|
+
function experienceReadme(application) {
|
|
153
|
+
return [
|
|
154
|
+
`# ${application} experience integration`,
|
|
155
|
+
"",
|
|
156
|
+
"| File | What it is |",
|
|
157
|
+
"| --- | --- |",
|
|
158
|
+
"| `fabric.experience.ts` | The server runtime and gateway, wired to your host. |",
|
|
159
|
+
"| `fabric.component-pack.ts` | The components this application is allowed to render. |",
|
|
160
|
+
"| `fabric.application.json` | What the deployment gate reads. |",
|
|
161
|
+
"| `fabric.assembly.lock.json` | The resolved assembly. Empty until you add capabilities. |",
|
|
162
|
+
"| `fabric.runtime.json` | Capabilities the running host actually registers. |",
|
|
163
|
+
"",
|
|
164
|
+
"## Install",
|
|
165
|
+
"",
|
|
166
|
+
"The scaffolded files import three packages this generator does not install:",
|
|
167
|
+
"",
|
|
168
|
+
"```bash",
|
|
169
|
+
"pnpm add @fabricorg/experience-runtime @fabricorg/experience-gateway @fabricorg/component-pack",
|
|
170
|
+
"```",
|
|
171
|
+
"",
|
|
172
|
+
"## Check it",
|
|
173
|
+
"",
|
|
174
|
+
"```bash",
|
|
175
|
+
"fabric-gen check-application --config fabric.application.json",
|
|
176
|
+
"```",
|
|
177
|
+
"",
|
|
178
|
+
"It passes on the scaffold and keeps passing as you add capabilities, as long",
|
|
179
|
+
"as the lockfile, the runtime capabilities, and every promoted release agree.",
|
|
180
|
+
"Regenerate the lockfile from your composition root with `resolveAssembly`;",
|
|
181
|
+
"`fabric.runtime.json` must list what that same root registers with the host,",
|
|
182
|
+
"which is what stops a deployment from serving a plan its host cannot answer.",
|
|
183
|
+
""
|
|
184
|
+
].join("\n");
|
|
185
|
+
}
|
|
141
186
|
async function initializeExperience(options) {
|
|
142
187
|
if (!/^[a-z][a-z0-9-]*$/.test(options.application)) {
|
|
143
188
|
throw new Error("Application name must use lowercase letters, numbers, and hyphens.");
|
|
@@ -189,6 +234,35 @@ async function initializeExperience(options) {
|
|
|
189
234
|
releases: []
|
|
190
235
|
}, null, 2)}
|
|
191
236
|
`
|
|
237
|
+
],
|
|
238
|
+
// The application config names these two files, so the scaffold has to
|
|
239
|
+
// produce them. Without them `fabric-gen check-application`, the very
|
|
240
|
+
// next step, failed on a missing file rather than on anything the
|
|
241
|
+
// author had done. The lockfile is resolved here, not hand-written, so
|
|
242
|
+
// it carries a real assembly digest from the first commit.
|
|
243
|
+
[
|
|
244
|
+
import_node_path.default.join(options.directory, "fabric.assembly.lock.json"),
|
|
245
|
+
`${JSON.stringify((0, import_assembly.resolveAssembly)({
|
|
246
|
+
manifest: {
|
|
247
|
+
formatVersion: 2,
|
|
248
|
+
application: options.application,
|
|
249
|
+
capabilities: [],
|
|
250
|
+
componentPacks: [],
|
|
251
|
+
bindings: [],
|
|
252
|
+
contracts: []
|
|
253
|
+
},
|
|
254
|
+
capabilities: [],
|
|
255
|
+
componentPacks: []
|
|
256
|
+
}).lockfile, null, 2)}
|
|
257
|
+
`
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
import_node_path.default.join(options.directory, "fabric.runtime.json"),
|
|
261
|
+
"[]\n"
|
|
262
|
+
],
|
|
263
|
+
[
|
|
264
|
+
import_node_path.default.join(options.directory, "README.md"),
|
|
265
|
+
experienceReadme(options.application)
|
|
192
266
|
]
|
|
193
267
|
];
|
|
194
268
|
await (0, import_promises.mkdir)(options.directory, { recursive: true });
|
|
@@ -262,14 +336,70 @@ async function checkApplication(options) {
|
|
|
262
336
|
assemblyDigest: assembly.assemblyDigest
|
|
263
337
|
};
|
|
264
338
|
}
|
|
339
|
+
async function exportModuleManifestFile(options) {
|
|
340
|
+
const absolute = import_node_path.default.resolve(options.moduleFile);
|
|
341
|
+
const loaded = await importAuthoredModule(absolute, options.moduleFile);
|
|
342
|
+
const candidates = Object.entries(loaded).filter(([, value]) => isFabricModuleLike(value));
|
|
343
|
+
let entry;
|
|
344
|
+
if (options.exportName) {
|
|
345
|
+
const named = loaded[options.exportName];
|
|
346
|
+
if (named === void 0) throw new Error(`"${options.moduleFile}" has no export named "${options.exportName}". It exports: ${Object.keys(loaded).join(", ") || "nothing"}.`);
|
|
347
|
+
if (!isFabricModuleLike(named)) throw new Error(`Export "${options.exportName}" of "${options.moduleFile}" is not a FabricModule: it has no string "namespace".`);
|
|
348
|
+
entry = [options.exportName, named];
|
|
349
|
+
} else if (candidates.length === 1) {
|
|
350
|
+
entry = candidates[0];
|
|
351
|
+
} else if (candidates.length === 0) {
|
|
352
|
+
throw new Error(`"${options.moduleFile}" exports no FabricModule. Export one, with a string "namespace", or name it with --export.`);
|
|
353
|
+
} else {
|
|
354
|
+
throw new Error(`"${options.moduleFile}" exports ${candidates.length} modules (${candidates.map(([name]) => name).join(", ")}). Choose one with --export.`);
|
|
355
|
+
}
|
|
356
|
+
const manifest = (0, import_manifest.exportModuleManifest)(entry[1]);
|
|
357
|
+
(0, import_compiler.compileManifestBundle)({ manifestVersion: 2, modules: [manifest] });
|
|
358
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(import_node_path.default.resolve(options.out)), { recursive: true });
|
|
359
|
+
await (0, import_promises.writeFile)(import_node_path.default.resolve(options.out), `${JSON.stringify(manifest, null, 2)}
|
|
360
|
+
`, "utf8");
|
|
361
|
+
return {
|
|
362
|
+
namespace: manifest.namespace,
|
|
363
|
+
exportName: entry[0],
|
|
364
|
+
objectTypes: manifest.objectTypes.length,
|
|
365
|
+
actions: manifest.actions.length,
|
|
366
|
+
eventTypes: manifest.eventTypes.length
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
async function importAuthoredModule(absolute, display) {
|
|
370
|
+
try {
|
|
371
|
+
return await import((0, import_node_url.pathToFileURL)(absolute).href);
|
|
372
|
+
} catch (error) {
|
|
373
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
374
|
+
const readAsCommonJs = /Unexpected token '(export|import)'|Cannot use import statement outside a module/.test(reason);
|
|
375
|
+
if (readAsCommonJs && /\.[cm]?ts$/.test(absolute)) {
|
|
376
|
+
const sibling = import_node_path.default.join(import_node_path.default.dirname(absolute), `.fabric-gen-${process.pid}-${import_node_path.default.basename(absolute, import_node_path.default.extname(absolute))}.mts`);
|
|
377
|
+
try {
|
|
378
|
+
await (0, import_promises.writeFile)(sibling, await (0, import_promises.readFile)(absolute, "utf8"), "utf8");
|
|
379
|
+
return await import((0, import_node_url.pathToFileURL)(sibling).href);
|
|
380
|
+
} catch (retried) {
|
|
381
|
+
const retriedReason = retried instanceof Error ? retried.message : String(retried);
|
|
382
|
+
throw new Error(`Could not load module file "${display}": ${retriedReason}
|
|
383
|
+
A TypeScript file needs a runtime that strips types (Node 22.18 or newer); otherwise point --module at the built JavaScript.`);
|
|
384
|
+
} finally {
|
|
385
|
+
await (0, import_promises.rm)(sibling, { force: true });
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
throw new Error(`Could not load module file "${display}": ${reason}
|
|
389
|
+
A TypeScript file needs a runtime that strips types (Node 22.18 or newer); otherwise point --module at the built JavaScript.`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function isFabricModuleLike(value) {
|
|
393
|
+
return typeof value === "object" && value !== null && typeof value.namespace === "string";
|
|
394
|
+
}
|
|
265
395
|
async function initializeCapability(options) {
|
|
266
396
|
if (!/^[a-z][a-z0-9-]*$/.test(options.namespace)) {
|
|
267
397
|
throw new Error("Capability namespace must use lowercase letters, numbers, and hyphens.");
|
|
268
398
|
}
|
|
269
399
|
const displayName = options.namespace.split("-").map((part, index) => index === 0 ? `${part.charAt(0).toUpperCase()}${part.slice(1)}` : part).join(" ");
|
|
270
|
-
const
|
|
400
|
+
const modulePath = import_node_path.default.join(options.directory, "module.ts");
|
|
271
401
|
const readmePath = import_node_path.default.join(options.directory, "README.md");
|
|
272
|
-
for (const file of [readmePath,
|
|
402
|
+
for (const file of [readmePath, modulePath]) {
|
|
273
403
|
try {
|
|
274
404
|
await (0, import_promises.access)(file);
|
|
275
405
|
throw new Error(`Refusing to overwrite existing file "${file}".`);
|
|
@@ -278,33 +408,108 @@ async function initializeCapability(options) {
|
|
|
278
408
|
if (error.code !== "ENOENT") throw error;
|
|
279
409
|
}
|
|
280
410
|
}
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
411
|
+
const module2 = [
|
|
412
|
+
`import type { ActionDefinition } from "@fabricorg/platform/actions";`,
|
|
413
|
+
`import type { FabricModule } from "@fabricorg/platform/modules";`,
|
|
414
|
+
"",
|
|
415
|
+
`/** One governed action. Every field below is checked when the manifest is exported. */`,
|
|
416
|
+
`const recordExample: ActionDefinition = {`,
|
|
417
|
+
` actionId: "${options.namespace}.record_example",`,
|
|
418
|
+
` namespace: "${options.namespace}",`,
|
|
419
|
+
" version: 1,",
|
|
420
|
+
' kind: "atomic",',
|
|
421
|
+
" idempotent: true,",
|
|
422
|
+
" mutatesDomain: true,",
|
|
423
|
+
' emitsEvents: ["ExampleRecorded"],',
|
|
424
|
+
" // The six execution dimensions. A strict certification profile requires all of them.",
|
|
425
|
+
" execution: {",
|
|
426
|
+
' connectivity: "online-required",',
|
|
427
|
+
' authorityMoment: "execution",',
|
|
428
|
+
' idempotency: "required",',
|
|
429
|
+
' completion: "immediate",',
|
|
430
|
+
' consistency: "authoritative-now",',
|
|
431
|
+
' sensitivity: "internal",',
|
|
432
|
+
" },",
|
|
433
|
+
" schema: {",
|
|
434
|
+
" parse(value: unknown): { exampleId: string } {",
|
|
435
|
+
" const input = value as { exampleId?: unknown };",
|
|
436
|
+
' if (typeof input?.exampleId !== "string") throw new Error("exampleId is required");',
|
|
437
|
+
" return { exampleId: input.exampleId };",
|
|
438
|
+
" },",
|
|
439
|
+
" safeParse(value: unknown) {",
|
|
440
|
+
" try {",
|
|
441
|
+
" return { success: true as const, data: this.parse(value) };",
|
|
442
|
+
" } catch (error) {",
|
|
443
|
+
' return { success: false as const, error: { issues: [{ path: ["exampleId"], message: error instanceof Error ? error.message : String(error) }] } };',
|
|
444
|
+
" }",
|
|
445
|
+
" },",
|
|
446
|
+
" },",
|
|
447
|
+
" handler: async (_context, parameters) => ({",
|
|
448
|
+
" success: true,",
|
|
449
|
+
" data: {",
|
|
450
|
+
" ...(parameters as { exampleId: string }),",
|
|
451
|
+
" _events: [{",
|
|
452
|
+
' eventType: "ExampleRecorded",',
|
|
453
|
+
' entityType: "Example",',
|
|
454
|
+
" entityId: (parameters as { exampleId: string }).exampleId,",
|
|
455
|
+
" payload: parameters,",
|
|
456
|
+
" }],",
|
|
457
|
+
" },",
|
|
458
|
+
" }),",
|
|
459
|
+
"};",
|
|
460
|
+
"",
|
|
461
|
+
`export const ${camelCase(options.namespace)}Module: FabricModule = {`,
|
|
462
|
+
` namespace: "${options.namespace}",`,
|
|
463
|
+
' version: "0.1.0",',
|
|
464
|
+
" capability: {",
|
|
465
|
+
` displayName: "${displayName}",`,
|
|
466
|
+
` description: "Governed ${displayName.toLowerCase()} capability.",`,
|
|
467
|
+
' stability: "experimental",',
|
|
468
|
+
" },",
|
|
469
|
+
" objectTypes: [{",
|
|
470
|
+
' type: "Example",',
|
|
471
|
+
" schema: {",
|
|
472
|
+
' type: "object",',
|
|
473
|
+
' properties: { exampleId: { type: "string" } },',
|
|
474
|
+
' required: ["exampleId"],',
|
|
475
|
+
" },",
|
|
476
|
+
" }],",
|
|
477
|
+
` idPrefixes: [{ prefix: "exm", name: "Example", module: "${options.namespace}" }],`,
|
|
478
|
+
' eventTypes: [{ eventType: "ExampleRecorded", schemaVersion: 1 }],',
|
|
479
|
+
" actions: [recordExample],",
|
|
480
|
+
"};",
|
|
481
|
+
""
|
|
482
|
+
].join("\n");
|
|
299
483
|
const readme = [
|
|
300
484
|
`# ${displayName}`,
|
|
301
485
|
"",
|
|
302
|
-
"
|
|
486
|
+
"`module.ts` is the source of truth. It is TypeScript, so the shape of every",
|
|
487
|
+
"action, object type, and event is checked as you write it.",
|
|
488
|
+
"",
|
|
489
|
+
"## The loop",
|
|
303
490
|
"",
|
|
304
491
|
"```bash",
|
|
492
|
+
"# 1. Export the authored module to the normalized manifest the generators read.",
|
|
493
|
+
"fabric-gen export --module module.ts --out fabric.manifest.json",
|
|
494
|
+
"",
|
|
495
|
+
"# 2. Generate types, event contracts, the usage contract, and docs.",
|
|
305
496
|
"fabric-gen --input fabric.manifest.json --out generated",
|
|
497
|
+
"",
|
|
498
|
+
"# 3. In CI, prove the generated files match the manifest.",
|
|
306
499
|
"fabric-gen --input fabric.manifest.json --out generated --check",
|
|
307
500
|
"```",
|
|
501
|
+
"",
|
|
502
|
+
"Commit both `fabric.manifest.json` and `generated/`. The manifest is the",
|
|
503
|
+
"contract other capabilities and applications compile against; regenerating",
|
|
504
|
+
"is how a consumer learns what changed.",
|
|
505
|
+
"",
|
|
506
|
+
"## What to edit",
|
|
507
|
+
"",
|
|
508
|
+
"- **Object types** carry a portable JSON Schema. They become generated TypeScript types.",
|
|
509
|
+
"- **Actions** declare six execution dimensions. A host refuses an action whose",
|
|
510
|
+
" declaration does not match how it is invoked, so declare them honestly.",
|
|
511
|
+
"- **Events** are the capability's public vocabulary. Adding a field is compatible;",
|
|
512
|
+
" removing or retyping one is not.",
|
|
308
513
|
""
|
|
309
514
|
].join("\n");
|
|
310
515
|
await (0, import_promises.mkdir)(options.directory, { recursive: true });
|
|
@@ -312,8 +517,7 @@ async function initializeCapability(options) {
|
|
|
312
517
|
try {
|
|
313
518
|
for (const [file, content] of [
|
|
314
519
|
[readmePath, readme],
|
|
315
|
-
[
|
|
316
|
-
`]
|
|
520
|
+
[modulePath, module2]
|
|
317
521
|
]) {
|
|
318
522
|
await (0, import_promises.writeFile)(file, content, { encoding: "utf8", flag: "wx" });
|
|
319
523
|
created.push(file);
|
|
@@ -327,6 +531,9 @@ async function initializeCapability(options) {
|
|
|
327
531
|
}
|
|
328
532
|
return { created };
|
|
329
533
|
}
|
|
534
|
+
function camelCase(namespace) {
|
|
535
|
+
return namespace.split("-").map((part, index) => index === 0 ? part : `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("");
|
|
536
|
+
}
|
|
330
537
|
async function generateFromManifest(options) {
|
|
331
538
|
const input = JSON.parse(await (0, import_promises.readFile)(options.inputPath, "utf8"));
|
|
332
539
|
if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error("Manifest input must be a JSON object.");
|
|
@@ -440,6 +647,7 @@ async function promoteExperience(options) {
|
|
|
440
647
|
FabricGenUsageError,
|
|
441
648
|
GENERATOR_TARGETS,
|
|
442
649
|
checkApplication,
|
|
650
|
+
exportModuleManifestFile,
|
|
443
651
|
fabricGenCliExitCode,
|
|
444
652
|
generateFromManifest,
|
|
445
653
|
initializeCapability,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { access, mkdir, readFile, readdir, rm, writeFile } from \"node:fs/promises\";\nimport { createPrivateKey } from \"node:crypto\";\nimport path from \"node:path\";\nimport { compileManifestBundle, runGenerator, type GeneratedFile, type GeneratorTarget } from \"@fabricorg/compiler\";\nimport { capabilityGenerator } from \"@fabricorg/gen-capability\";\nimport { docsGenerator } from \"@fabricorg/gen-docs\";\nimport { eventsGenerator } from \"@fabricorg/gen-events\";\nimport { typesGenerator } from \"@fabricorg/gen-types\";\nimport { prismaGenerator } from \"@fabricorg/gen-prisma\";\nimport { graphqlGenerator } from \"@fabricorg/gen-graphql\";\nimport { sduiGenerator } from \"@fabricorg/gen-sdui\";\nimport type { UsageContractDocument } from \"@fabricorg/gen-capability\";\nimport { createEs256ReleaseSigner, promoteExperienceRelease } from \"@fabricorg/sdui-composer\";\nimport { conformanceGenerator } from \"@fabricorg/gen-conformance\";\nimport {\n\tassertAssemblyLockfile,\n\tassertAssemblyRuntimeCompatible,\n\ttype AssemblyLockfile,\n\ttype AvailableCapability,\n} from \"@fabricorg/assembly\";\nimport {\n\tassertSduiReleaseIntegrity,\n\ttype SduiRelease,\n} from \"@fabricorg/sdui-release\";\n\nexport const GENERATOR_TARGETS: Record<string, GeneratorTarget> = {\n\ttypes: typesGenerator,\n\tevents: eventsGenerator,\n\tcapability: capabilityGenerator,\n\tdocs: docsGenerator,\n\tprisma: prismaGenerator,\n\tgraphql: graphqlGenerator,\n\tsdui: sduiGenerator,\n\tconformance: conformanceGenerator,\n};\nconst compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface GenerateOptions { inputPath: string; outputDirectory: string; targets: string[]; check?: boolean; }\nexport interface GenerateResult { changed: string[]; stale: string[]; files: GeneratedFile[]; }\nexport interface InitializeCapabilityOptions { directory: string; namespace: string; }\nexport interface InitializeCapabilityResult { created: string[]; }\nexport interface InitializeExperienceOptions { directory: string; application: string; }\nexport interface InitializeExperienceResult { created: string[]; }\nexport interface CheckApplicationOptions { configPath: string; }\nexport interface PromoteExperienceOptions {\n\tconfigPath: string;\n\t/** PEM-encoded ES256 private key. Never read from the configuration file. */\n\tprivateKeyPath: string;\n\toutputPath?: string;\n}\nexport interface PromoteExperienceResult {\n\tapplication: string;\n\treleaseDigest: string;\n\tassemblyDigest: string;\n\troutes: { views: number; intents: number };\n\toutputPath: string;\n}\nexport interface CheckApplicationResult {\n\tapplication: string;\n\tcapabilities: number;\n\treleases: number;\n\tassemblyDigest: string;\n}\n\nconst usage = [\n\t\"Usage:\",\n\t\" fabric-gen init capability <namespace> [--directory <path>]\",\n\t\" fabric-gen init experience <application> [--directory <path>]\",\n\t\" fabric-gen check-application [--config <path>]\",\n\t\" fabric-gen promote-experience --config <path> --key <pem> [--out <path>]\",\n\t\" fabric-gen --input <manifest.json> --out <directory> [--targets <list>] [--check]\",\n].join(\"\\n\");\n\nexport class FabricGenUsageError extends Error {\n\toverride readonly name = \"FabricGenUsageError\";\n}\n\nexport function fabricGenCliExitCode(error: unknown): number {\n\treturn error instanceof FabricGenUsageError ? 2 : 1;\n}\n\nfunction flagValue(args: readonly string[], flag: string): string | undefined {\n\tconst index = args.indexOf(flag);\n\tif (index < 0) return undefined;\n\tconst value = args[index + 1];\n\tif (!value || value.startsWith(\"--\")) throw new FabricGenUsageError(usage);\n\treturn value;\n}\n\n/** Execute one CLI command and return its single human-readable result line. */\nexport async function runFabricGenCommand(args: readonly string[]): Promise<string> {\n\tif (args[0] === \"init\") {\n\t\tif (!args[2] || args[2].startsWith(\"--\")) {\n\t\t\tthrow new FabricGenUsageError(usage);\n\t\t}\n\t\tconst name = args[2];\n\t\tconst directory = flagValue(args, \"--directory\") ?? name;\n\t\tif (args[1] === \"capability\") {\n\t\t\tconst result = await initializeCapability({ directory, namespace: name });\n\t\t\treturn `Initialized capability \"${name}\" with ${result.created.length} files.`;\n\t\t}\n\t\tif (args[1] === \"experience\") {\n\t\t\tconst result = await initializeExperience({ directory, application: name });\n\t\t\treturn `Initialized experience integration \"${name}\" with ${result.created.length} files.`;\n\t\t}\n\t\tthrow new FabricGenUsageError(usage);\n\t}\n\tif (args[0] === \"promote-experience\") {\n\t\tconst configPath = flagValue(args, \"--config\");\n\t\tconst privateKeyPath = flagValue(args, \"--key\");\n\t\tif (!configPath) throw new FabricGenUsageError(\"promote-experience requires --config.\");\n\t\tif (!privateKeyPath) throw new FabricGenUsageError(\"promote-experience requires --key.\");\n\t\tconst outputPath = flagValue(args, \"--out\");\n\t\tconst result = await promoteExperience({\n\t\t\tconfigPath,\n\t\t\tprivateKeyPath,\n\t\t\t...(outputPath ? { outputPath } : {}),\n\t\t});\n\t\treturn [\n\t\t\t`Promoted ${result.application} release ${result.releaseDigest.slice(0, 12)} against assembly ${result.assemblyDigest.slice(0, 12)}.`,\n\t\t\t`Routes: ${result.routes.views} views, ${result.routes.intents} intents.`,\n\t\t\t`Wrote ${result.outputPath}`,\n\t\t].join(\"\\n\");\n\t}\n\n\tif (args[0] === \"check-application\") {\n\t\tconst configPath = flagValue(args, \"--config\") ?? \"fabric.application.json\";\n\t\tconst result = await checkApplication({ configPath });\n\t\treturn `Checked \"${result.application}\": ${result.capabilities} capabilities, ${result.releases} releases.`;\n\t}\n\tconst inputPath = flagValue(args, \"--input\");\n\tconst outputDirectory = flagValue(args, \"--out\");\n\tif (!inputPath || !outputDirectory) throw new FabricGenUsageError(usage);\n\tconst result = await generateFromManifest({\n\t\tinputPath,\n\t\toutputDirectory,\n\t\ttargets: (flagValue(args, \"--targets\") ?? \"types,events,capability,docs\")\n\t\t\t.split(\",\")\n\t\t\t.filter(Boolean),\n\t\tcheck: args.includes(\"--check\"),\n\t});\n\treturn `${args.includes(\"--check\") ? \"Checked\" : \"Generated\"} ${result.files.length} files.`;\n}\n\n/**\n * Add experience integration files to an existing application. It deliberately\n * does not create package.json, routes, authentication, billing, or navigation:\n * those remain owned by the Supastarter-derived application shell.\n */\nexport async function initializeExperience(\n\toptions: InitializeExperienceOptions,\n): Promise<InitializeExperienceResult> {\n\tif (!/^[a-z][a-z0-9-]*$/.test(options.application)) {\n\t\tthrow new Error(\"Application name must use lowercase letters, numbers, and hyphens.\");\n\t}\n\tconst functionName = options.application\n\t\t.split(\"-\")\n\t\t.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)\n\t\t.join(\"\");\n\tconst files = [\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.experience.ts\"),\n\t\t\t[\n\t\t\t\t'import { createExperienceServerRuntime } from \"@fabricorg/experience-runtime/server\";',\n\t\t\t\t'import { createExperienceGateway } from \"@fabricorg/experience-gateway\";',\n\t\t\t\t\"\",\n\t\t\t\t`export const create${functionName}ExperienceRuntime = (`,\n\t\t\t\t\"\\toptions: Parameters<typeof createExperienceServerRuntime>[0],\",\n\t\t\t\t\") => createExperienceServerRuntime(options);\",\n\t\t\t\t\"\",\n\t\t\t\t`export const create${functionName}ExperienceGateway = (`,\n\t\t\t\t\"\\toptions: Parameters<typeof createExperienceGateway>[0],\",\n\t\t\t\t\") => createExperienceGateway(options);\",\n\t\t\t\t\"\",\n\t\t\t].join(\"\\n\"),\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.component-pack.ts\"),\n\t\t\t[\n\t\t\t\t'import { defineComponentPack } from \"@fabricorg/component-pack\";',\n\t\t\t\t\"\",\n\t\t\t\t`export const define${functionName}ComponentPack = (artifactDigest: string) =>`,\n\t\t\t\t\"\\tdefineComponentPack({\",\n\t\t\t\t`\\t\\tname: \"${options.application}\",`,\n\t\t\t\t`\\t\\tnamespace: \"${options.application}\",`,\n\t\t\t\t'\\t\\tversion: \"0.1.0\",',\n\t\t\t\t\"\\t\\tartifactDigest,\",\n\t\t\t\t'\\t\\ttokenContract: { name: \"fabric-family\", version: \"1.0.0\" },',\n\t\t\t\t\"\\t\\tcomponents: {\",\n\t\t\t\t'\\t\\t\\tText: { module: \"./components/text.js\", roles: [\"content\"], slots: [] },',\n\t\t\t\t\"\\t\\t},\",\n\t\t\t\t\"\\t});\",\n\t\t\t\t\"\",\n\t\t\t].join(\"\\n\"),\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.application.json\"),\n\t\t\t`${JSON.stringify({\n\t\t\t\tformatVersion: 1,\n\t\t\t\tapplication: options.application,\n\t\t\t\tassembly: \"./fabric.assembly.lock.json\",\n\t\t\t\truntimeCapabilities: \"./fabric.runtime.json\",\n\t\t\t\treleases: [],\n\t\t\t}, null, 2)}\\n`,\n\t\t],\n\t] as const;\n\tawait mkdir(options.directory, { recursive: true });\n\tconst created: string[] = [];\n\ttry {\n\t\tfor (const [file, content] of files) {\n\t\t\tawait writeFile(file, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t\tcreated.push(file);\n\t\t}\n\t} catch (error) {\n\t\tawait Promise.all(created.map((file) => rm(file, { force: true })));\n\t\tif ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n\t\t\tthrow new Error(\"Refusing to overwrite an existing experience integration file.\");\n\t\t}\n\t\tthrow error;\n\t}\n\treturn { created };\n}\n\ninterface ApplicationCheckConfig {\n\tformatVersion: 1;\n\tassembly: string;\n\truntimeCapabilities: string;\n\treleases: string[];\n}\n\nasync function readJson(file: string): Promise<unknown> {\n\treturn JSON.parse(await readFile(file, \"utf8\"));\n}\n\nfunction assertApplicationCheckConfig(value: unknown): asserts value is ApplicationCheckConfig {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"Application check configuration must be a JSON object.\");\n\t}\n\tconst config = value as Record<string, unknown>;\n\tif (config.formatVersion !== 1) throw new Error(\"Application check configuration formatVersion must be 1.\");\n\tif (typeof config.assembly !== \"string\" || !config.assembly) {\n\t\tthrow new Error(\"Application check configuration assembly must be a file path.\");\n\t}\n\tif (typeof config.runtimeCapabilities !== \"string\" || !config.runtimeCapabilities) {\n\t\tthrow new Error(\"Application check configuration runtimeCapabilities must be a file path.\");\n\t}\n\tif (!Array.isArray(config.releases) || !config.releases.every((entry) => typeof entry === \"string\" && entry)) {\n\t\tthrow new Error(\"Application check configuration releases must be an array of file paths.\");\n\t}\n}\n\n/**\n * Verify an application's immutable composition inputs before deployment.\n * Every runtime capability must exactly match the approved lockfile, and every\n * promoted experience release must be intact and bound to that assembly.\n */\nexport async function checkApplication(\n\toptions: CheckApplicationOptions,\n): Promise<CheckApplicationResult> {\n\tconst configValue = await readJson(options.configPath);\n\tassertApplicationCheckConfig(configValue);\n\tconst base = path.dirname(options.configPath);\n\tconst resolve = (file: string): string => path.resolve(base, file);\n\tconst assembly = await readJson(resolve(configValue.assembly)) as AssemblyLockfile;\n\tassertAssemblyLockfile(assembly);\n\tconst runtimeCapabilities = await readJson(\n\t\tresolve(configValue.runtimeCapabilities),\n\t) as AvailableCapability[];\n\tif (!Array.isArray(runtimeCapabilities)) {\n\t\tthrow new Error(\"Runtime capabilities must be a JSON array.\");\n\t}\n\tassertAssemblyRuntimeCompatible(assembly, runtimeCapabilities);\n\tfor (const releasePath of configValue.releases) {\n\t\tconst release = await readJson(resolve(releasePath)) as SduiRelease;\n\t\ttry {\n\t\t\tassertSduiReleaseIntegrity(release);\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Experience release \"${releasePath}\" is invalid: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t}\n\t\tif (release.assemblyDigest !== assembly.assemblyDigest) {\n\t\t\tthrow new Error(\n\t\t\t\t`Experience release \"${release.document.name}@${release.document.version}\" belongs to assembly \"${release.assemblyDigest}\", not \"${assembly.assemblyDigest}\".`,\n\t\t\t);\n\t\t}\n\t}\n\treturn {\n\t\tapplication: assembly.application,\n\t\tcapabilities: assembly.capabilities.length,\n\t\treleases: configValue.releases.length,\n\t\tassemblyDigest: assembly.assemblyDigest,\n\t};\n}\n\n/**\n * Create the smallest useful capability source tree. The manifest is accepted\n * by the compiler immediately, while leaving domain vocabulary to the adopter.\n */\nexport async function initializeCapability(\n\toptions: InitializeCapabilityOptions,\n): Promise<InitializeCapabilityResult> {\n\tif (!/^[a-z][a-z0-9-]*$/.test(options.namespace)) {\n\t\tthrow new Error(\"Capability namespace must use lowercase letters, numbers, and hyphens.\");\n\t}\n\tconst displayName = options.namespace\n\t\t.split(\"-\")\n\t\t.map((part, index) => index === 0\n\t\t\t? `${part.charAt(0).toUpperCase()}${part.slice(1)}`\n\t\t\t: part)\n\t\t.join(\" \");\n\tconst manifestPath = path.join(options.directory, \"fabric.manifest.json\");\n\tconst readmePath = path.join(options.directory, \"README.md\");\n\tfor (const file of [readmePath, manifestPath]) {\n\t\ttry {\n\t\t\tawait access(file);\n\t\t\tthrow new Error(`Refusing to overwrite existing file \"${file}\".`);\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error && error.message.startsWith(\"Refusing to overwrite\")) throw error;\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n\t\t}\n\t}\n\tconst manifest = {\n\t\tmanifestVersion: 2,\n\t\tnamespace: options.namespace,\n\t\tobjectTypes: [],\n\t\tsubjectTypes: [],\n\t\tidPrefixes: [],\n\t\tdependencies: [],\n\t\tpolicies: [],\n\t\teventTypes: [],\n\t\tactions: [],\n\t\tviews: [],\n\t\tstateMachines: [],\n\t\tcapability: {\n\t\t\tdisplayName,\n\t\t\tdescription: `Governed ${displayName.toLowerCase()} capability.`,\n\t\t\tstability: \"experimental\",\n\t\t},\n\t};\n\tconst readme = [\n\t\t`# ${displayName}`,\n\t\t\"\",\n\t\t\"Define domain objects, governed actions, events, and projections in `fabric.manifest.json`.\",\n\t\t\"\",\n\t\t\"```bash\",\n\t\t\"fabric-gen --input fabric.manifest.json --out generated\",\n\t\t\"fabric-gen --input fabric.manifest.json --out generated --check\",\n\t\t\"```\",\n\t\t\"\",\n\t].join(\"\\n\");\n\tawait mkdir(options.directory, { recursive: true });\n\tconst created: string[] = [];\n\ttry {\n\t\tfor (const [file, content] of [\n\t\t\t[readmePath, readme],\n\t\t\t[manifestPath, `${JSON.stringify(manifest, null, 2)}\\n`],\n\t\t] as const) {\n\t\t\tawait writeFile(file, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t\tcreated.push(file);\n\t\t}\n\t} catch (error) {\n\t\tawait Promise.all(created.map((file) => rm(file, { force: true })));\n\t\tif ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n\t\t\tthrow new Error(\"Refusing to overwrite a file created during capability initialization.\");\n\t\t}\n\t\tthrow error;\n\t}\n\treturn { created };\n}\n\nexport async function generateFromManifest(options: GenerateOptions): Promise<GenerateResult> {\n\tconst input = JSON.parse(await readFile(options.inputPath, \"utf8\"));\n\tif (!input || typeof input !== \"object\" || Array.isArray(input)) throw new Error(\"Manifest input must be a JSON object.\");\n\tconst bundle = \"modules\" in input ? input : { manifestVersion: input.manifestVersion, modules: [input] };\n\tconst ir = compileManifestBundle(bundle);\n\tconst files = (await Promise.all(options.targets.map(async (name) => {\n\t\tconst target = GENERATOR_TARGETS[name];\n\t\tif (!target) throw new Error(`Unknown generator target \"${name}\".`);\n\t\treturn (await runGenerator(target, ir)).map((file) => ({ ...file, path: `${name}/${file.path}` }));\n\t}))).flat().sort((left, right) => compareCanonicalStrings(left.path, right.path));\n\tconst expected = new Set(files.map((file) => file.path));\n\tconst existing = await listFiles(options.outputDirectory);\n\tconst selectedPrefixes = options.targets.map((target) => `${target}/`);\n\tconst stale = existing.filter((file) => selectedPrefixes.some((prefix) => file.startsWith(prefix)) && !expected.has(file));\n\tif (!options.check) await Promise.all(stale.map((file) => rm(path.join(options.outputDirectory, file), { force: true })));\n\tconst changed: string[] = [];\n\tfor (const file of files) {\n\t\tconst target = path.join(options.outputDirectory, file.path);\n\t\tlet current: string | undefined;\n\t\ttry { current = await readFile(target, \"utf8\"); } catch { current = undefined; }\n\t\tif (current !== file.content) {\n\t\t\tchanged.push(file.path);\n\t\t\tif (!options.check) { await mkdir(path.dirname(target), { recursive: true }); await writeFile(target, file.content, \"utf8\"); }\n\t\t}\n\t}\n\tif (options.check && (changed.length || stale.length)) throw new Error(`Generated artifacts drifted: ${[...changed, ...stale.map((file) => `stale:${file}`)].join(\", \")}`);\n\treturn { changed, stale, files };\n}\n\nasync function listFiles(directory: string, prefix = \"\"): Promise<string[]> {\n\tlet entries;\n\ttry { entries = await readdir(directory, { withFileTypes: true }); } catch { return []; }\n\tconst nested = await Promise.all(entries.map((entry) => entry.isDirectory() ? listFiles(path.join(directory, entry.name), `${prefix}${entry.name}/`) : [`${prefix}${entry.name}`]));\n\treturn nested.flat().sort();\n}\n\ninterface ExperiencePromotionConfig {\n\tformatVersion: 1;\n\tapplication: string;\n\tissuer: string;\n\tkeyId: string;\n\tassembly: string;\n\trelease: string;\n\tcontracts: string[];\n}\n\nfunction assertExperiencePromotionConfig(value: unknown): asserts value is ExperiencePromotionConfig {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"Experience promotion configuration must be a JSON object.\");\n\t}\n\tconst config = value as Record<string, unknown>;\n\tif (config.formatVersion !== 1) throw new Error(\"Experience promotion configuration formatVersion must be 1.\");\n\tfor (const field of [\"application\", \"issuer\", \"keyId\", \"assembly\", \"release\"] as const) {\n\t\tif (typeof config[field] !== \"string\" || !config[field]) {\n\t\t\tthrow new Error(`Experience promotion configuration ${field} must be a non-empty string.`);\n\t\t}\n\t}\n\t// The application name is interpolated into the default output path and\n\t// signed into the release body, so \"../../x\" would escape the configuration\n\t// directory and \"/etc/x\" would ignore it entirely.\n\tif (!/^[a-z][a-z0-9-]*$/.test(config.application as string)) {\n\t\tthrow new Error(\"Experience promotion configuration application must be lowercase letters, numbers, and hyphens.\");\n\t}\n\tif (!Array.isArray(config.contracts) || !config.contracts.every((entry) => typeof entry === \"string\" && entry)) {\n\t\tthrow new Error(\"Experience promotion configuration contracts must be an array of file paths.\");\n\t}\n\t// A signing key in a checked-in configuration file is a key in version\n\t// control. Enumerating two spellings only catches two spellings, so reject\n\t// anything that reads like one, and reject unknown fields so a future\n\t// spelling cannot arrive unnoticed.\n\tconst known = new Set([\"formatVersion\", \"application\", \"issuer\", \"keyId\", \"assembly\", \"release\", \"contracts\"]);\n\tfor (const field of Object.keys(config)) {\n\t\tif (/key|secret|credential|token|pem|password/i.test(field) && field !== \"keyId\") {\n\t\t\tthrow new Error(`Experience promotion configuration must not carry \"${field}\"; pass the signing key with --key.`);\n\t\t}\n\t\tif (!known.has(field)) {\n\t\t\tthrow new Error(`Experience promotion configuration has an unknown field \"${field}\".`);\n\t\t}\n\t}\n}\n\n/**\n * Turn a validated release into a signed one.\n *\n * Promotion is where a granted `capability://` reference becomes a concrete\n * action id and version, so it is also where that mapping has to be bound to\n * the assembly that approved it. The signing key is a command-line argument\n * rather than a configuration field, because a configuration file is the kind\n * of thing that ends up committed.\n */\nexport async function promoteExperience(\n\toptions: PromoteExperienceOptions,\n): Promise<PromoteExperienceResult> {\n\tconst configValue = await readJson(options.configPath);\n\tassertExperiencePromotionConfig(configValue);\n\tconst base = path.dirname(options.configPath);\n\tconst resolve = (file: string): string => path.resolve(base, file);\n\n\tconst assembly = await readJson(resolve(configValue.assembly)) as AssemblyLockfile;\n\tassertAssemblyLockfile(assembly);\n\tconst release = await readJson(resolve(configValue.release)) as SduiRelease;\n\tassertSduiReleaseIntegrity(release);\n\tconst contracts = await Promise.all(\n\t\tconfigValue.contracts.map(async (file) => await readJson(resolve(file)) as UsageContractDocument),\n\t);\n\n\tconst privateKey = createPrivateKey(await readFile(options.privateKeyPath, \"utf8\"));\n\tconst promoted = await promoteExperienceRelease({\n\t\tapplication: configValue.application,\n\t\trelease,\n\t\tcontracts,\n\t\tassembly,\n\t\tissuer: configValue.issuer,\n\t\tsigner: createEs256ReleaseSigner({ keyId: configValue.keyId, privateKey }),\n\t});\n\n\tconst outputPath = options.outputPath\n\t\t? path.resolve(options.outputPath)\n\t\t: resolve(`${configValue.application}.experience-release.jws`);\n\tawait mkdir(path.dirname(outputPath), { recursive: true });\n\tawait writeFile(outputPath, `${promoted.compactJws}\\n`, \"utf8\");\n\n\treturn {\n\t\tapplication: configValue.application,\n\t\treleaseDigest: release.releaseDigest,\n\t\tassemblyDigest: assembly.assemblyDigest,\n\t\troutes: {\n\t\t\tviews: promoted.release.routes.views.length,\n\t\t\tintents: promoted.release.routes.intents.length,\n\t\t},\n\t\toutputPath,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAgE;AAChE,yBAAiC;AACjC,uBAAiB;AACjB,sBAA8F;AAC9F,4BAAoC;AACpC,sBAA8B;AAC9B,wBAAgC;AAChC,uBAA+B;AAC/B,wBAAgC;AAChC,yBAAiC;AACjC,sBAA8B;AAE9B,2BAAmE;AACnE,6BAAqC;AACrC,sBAKO;AACP,0BAGO;AAEA,IAAM,oBAAqD;AAAA,EACjE,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AACd;AACA,IAAM,0BAA0B,CAAC,MAAc,UAA0B,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AA6BhH,IAAM,QAAQ;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,EAAE,KAAK,IAAI;AAEJ,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC5B,OAAO;AAC1B;AAEO,SAAS,qBAAqB,OAAwB;AAC5D,SAAO,iBAAiB,sBAAsB,IAAI;AACnD;AAEA,SAAS,UAAU,MAAyB,MAAkC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3D,sDAA2B,OAAO;AAClC,QAAM,YAAY,MAAM,QAAQ;AAAA,IAC/B,YAAY,UAAU,IAAI,OAAO,SAAS,MAAM,SAAS,QAAQ,IAAI,CAAC,CAA0B;AAAA,EACjG;AAEA,QAAM,iBAAa,qCAAiB,UAAM,0BAAS,QAAQ,gBAAgB,MAAM,CAAC;AAClF,QAAM,WAAW,UAAM,+CAAyB;AAAA,IAC/C,aAAa,YAAY;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,YAAY;AAAA,IACpB,YAAQ,+CAAyB,EAAE,OAAO,YAAY,OAAO,WAAW,CAAC;AAAA,EAC1E,CAAC;AAED,QAAM,aAAa,QAAQ,aACxB,iBAAAA,QAAK,QAAQ,QAAQ,UAAU,IAC/B,QAAQ,GAAG,YAAY,WAAW,yBAAyB;AAC9D,YAAM,uBAAM,iBAAAA,QAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AACzD,YAAM,2BAAU,YAAY,GAAG,SAAS,UAAU;AAAA,GAAM,MAAM;AAE9D,SAAO;AAAA,IACN,aAAa,YAAY;AAAA,IACzB,eAAe,QAAQ;AAAA,IACvB,gBAAgB,SAAS;AAAA,IACzB,QAAQ;AAAA,MACP,OAAO,SAAS,QAAQ,OAAO,MAAM;AAAA,MACrC,SAAS,SAAS,QAAQ,OAAO,QAAQ;AAAA,IAC1C;AAAA,IACA;AAAA,EACD;AACD;","names":["result","path"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { access, mkdir, readFile, readdir, rm, writeFile } from \"node:fs/promises\";\nimport { createPrivateKey } from \"node:crypto\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { compileManifestBundle, runGenerator, type GeneratedFile, type GeneratorTarget } from \"@fabricorg/compiler\";\nimport { exportModuleManifest } from \"@fabricorg/platform/manifest\";\nimport { capabilityGenerator } from \"@fabricorg/gen-capability\";\nimport { docsGenerator } from \"@fabricorg/gen-docs\";\nimport { eventsGenerator } from \"@fabricorg/gen-events\";\nimport { typesGenerator } from \"@fabricorg/gen-types\";\nimport { prismaGenerator } from \"@fabricorg/gen-prisma\";\nimport { graphqlGenerator } from \"@fabricorg/gen-graphql\";\nimport { sduiGenerator } from \"@fabricorg/gen-sdui\";\nimport type { UsageContractDocument } from \"@fabricorg/gen-capability\";\nimport { createEs256ReleaseSigner, promoteExperienceRelease } from \"@fabricorg/sdui-composer\";\nimport { conformanceGenerator } from \"@fabricorg/gen-conformance\";\nimport {\n\tassertAssemblyLockfile,\n\tresolveAssembly,\n\tassertAssemblyRuntimeCompatible,\n\ttype AssemblyLockfile,\n\ttype AvailableCapability,\n} from \"@fabricorg/assembly\";\nimport {\n\tassertSduiReleaseIntegrity,\n\ttype SduiRelease,\n} from \"@fabricorg/sdui-release\";\n\nexport const GENERATOR_TARGETS: Record<string, GeneratorTarget> = {\n\ttypes: typesGenerator,\n\tevents: eventsGenerator,\n\tcapability: capabilityGenerator,\n\tdocs: docsGenerator,\n\tprisma: prismaGenerator,\n\tgraphql: graphqlGenerator,\n\tsdui: sduiGenerator,\n\tconformance: conformanceGenerator,\n};\nconst compareCanonicalStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nexport interface GenerateOptions { inputPath: string; outputDirectory: string; targets: string[]; check?: boolean; }\nexport interface GenerateResult { changed: string[]; stale: string[]; files: GeneratedFile[]; }\nexport interface InitializeCapabilityOptions { directory: string; namespace: string; }\nexport interface InitializeCapabilityResult { created: string[]; }\nexport interface InitializeExperienceOptions { directory: string; application: string; }\nexport interface InitializeExperienceResult { created: string[]; }\nexport interface CheckApplicationOptions { configPath: string; }\nexport interface PromoteExperienceOptions {\n\tconfigPath: string;\n\t/** PEM-encoded ES256 private key. Never read from the configuration file. */\n\tprivateKeyPath: string;\n\toutputPath?: string;\n}\nexport interface PromoteExperienceResult {\n\tapplication: string;\n\treleaseDigest: string;\n\tassemblyDigest: string;\n\troutes: { views: number; intents: number };\n\toutputPath: string;\n}\nexport interface CheckApplicationResult {\n\tapplication: string;\n\tcapabilities: number;\n\treleases: number;\n\tassemblyDigest: string;\n}\n\nconst usage = [\n\t\"Usage:\",\n\t\" fabric-gen init capability <namespace> [--directory <path>]\",\n\t\" fabric-gen export --module <file> [--export <name>] --out <manifest.json>\",\n\t\" fabric-gen init experience <application> [--directory <path>]\",\n\t\" fabric-gen check-application [--config <path>]\",\n\t\" fabric-gen promote-experience --config <path> --key <pem> [--out <path>]\",\n\t\" fabric-gen --input <manifest.json> --out <directory> [--targets <list>] [--check]\",\n].join(\"\\n\");\n\nexport class FabricGenUsageError extends Error {\n\toverride readonly name = \"FabricGenUsageError\";\n}\n\nexport function fabricGenCliExitCode(error: unknown): number {\n\treturn error instanceof FabricGenUsageError ? 2 : 1;\n}\n\nfunction flagValue(args: readonly string[], flag: string): string | undefined {\n\tconst index = args.indexOf(flag);\n\tif (index < 0) return undefined;\n\tconst value = args[index + 1];\n\tif (!value || value.startsWith(\"--\")) throw new FabricGenUsageError(usage);\n\treturn value;\n}\n\n/** Execute one CLI command and return its single human-readable result line. */\nexport async function runFabricGenCommand(args: readonly string[]): Promise<string> {\n\tif (args[0] === \"export\") {\n\t\tconst moduleFile = flagValue(args, \"--module\");\n\t\tconst out = flagValue(args, \"--out\");\n\t\tif (!moduleFile || !out) throw new FabricGenUsageError(usage);\n\t\tconst result = await exportModuleManifestFile({ moduleFile, out, exportName: flagValue(args, \"--export\") });\n\t\treturn `Exported \"${result.namespace}\" from ${result.exportName} to ${out}: ${result.objectTypes} object types, ${result.actions} actions, ${result.eventTypes} event types.`;\n\t}\n\tif (args[0] === \"init\") {\n\t\tif (!args[2] || args[2].startsWith(\"--\")) {\n\t\t\tthrow new FabricGenUsageError(usage);\n\t\t}\n\t\tconst name = args[2];\n\t\tconst directory = flagValue(args, \"--directory\") ?? name;\n\t\tif (args[1] === \"capability\") {\n\t\t\tconst result = await initializeCapability({ directory, namespace: name });\n\t\t\treturn `Initialized capability \"${name}\" with ${result.created.length} files.`;\n\t\t}\n\t\tif (args[1] === \"experience\") {\n\t\t\tconst result = await initializeExperience({ directory, application: name });\n\t\t\treturn `Initialized experience integration \"${name}\" with ${result.created.length} files.`;\n\t\t}\n\t\tthrow new FabricGenUsageError(usage);\n\t}\n\tif (args[0] === \"promote-experience\") {\n\t\tconst configPath = flagValue(args, \"--config\");\n\t\tconst privateKeyPath = flagValue(args, \"--key\");\n\t\tif (!configPath) throw new FabricGenUsageError(\"promote-experience requires --config.\");\n\t\tif (!privateKeyPath) throw new FabricGenUsageError(\"promote-experience requires --key.\");\n\t\tconst outputPath = flagValue(args, \"--out\");\n\t\tconst result = await promoteExperience({\n\t\t\tconfigPath,\n\t\t\tprivateKeyPath,\n\t\t\t...(outputPath ? { outputPath } : {}),\n\t\t});\n\t\treturn [\n\t\t\t`Promoted ${result.application} release ${result.releaseDigest.slice(0, 12)} against assembly ${result.assemblyDigest.slice(0, 12)}.`,\n\t\t\t`Routes: ${result.routes.views} views, ${result.routes.intents} intents.`,\n\t\t\t`Wrote ${result.outputPath}`,\n\t\t].join(\"\\n\");\n\t}\n\n\tif (args[0] === \"check-application\") {\n\t\tconst configPath = flagValue(args, \"--config\") ?? \"fabric.application.json\";\n\t\tconst result = await checkApplication({ configPath });\n\t\treturn `Checked \"${result.application}\": ${result.capabilities} capabilities, ${result.releases} releases.`;\n\t}\n\tconst inputPath = flagValue(args, \"--input\");\n\tconst outputDirectory = flagValue(args, \"--out\");\n\tif (!inputPath || !outputDirectory) throw new FabricGenUsageError(usage);\n\tconst result = await generateFromManifest({\n\t\tinputPath,\n\t\toutputDirectory,\n\t\ttargets: (flagValue(args, \"--targets\") ?? \"types,events,capability,docs\")\n\t\t\t.split(\",\")\n\t\t\t.filter(Boolean),\n\t\tcheck: args.includes(\"--check\"),\n\t});\n\treturn `${args.includes(\"--check\") ? \"Checked\" : \"Generated\"} ${result.files.length} files.`;\n}\n\n/**\n * Add experience integration files to an existing application. It deliberately\n * does not create package.json, routes, authentication, billing, or navigation:\n * those remain owned by the Supastarter-derived application shell.\n */\n/** What the scaffolded files are, and what has to be installed for them to compile. */\nfunction experienceReadme(application: string): string {\n\treturn [\n\t\t`# ${application} experience integration`,\n\t\t\"\",\n\t\t\"| File | What it is |\",\n\t\t\"| --- | --- |\",\n\t\t\"| `fabric.experience.ts` | The server runtime and gateway, wired to your host. |\",\n\t\t\"| `fabric.component-pack.ts` | The components this application is allowed to render. |\",\n\t\t\"| `fabric.application.json` | What the deployment gate reads. |\",\n\t\t\"| `fabric.assembly.lock.json` | The resolved assembly. Empty until you add capabilities. |\",\n\t\t\"| `fabric.runtime.json` | Capabilities the running host actually registers. |\",\n\t\t\"\",\n\t\t\"## Install\",\n\t\t\"\",\n\t\t\"The scaffolded files import three packages this generator does not install:\",\n\t\t\"\",\n\t\t\"```bash\",\n\t\t\"pnpm add @fabricorg/experience-runtime @fabricorg/experience-gateway @fabricorg/component-pack\",\n\t\t\"```\",\n\t\t\"\",\n\t\t\"## Check it\",\n\t\t\"\",\n\t\t\"```bash\",\n\t\t\"fabric-gen check-application --config fabric.application.json\",\n\t\t\"```\",\n\t\t\"\",\n\t\t\"It passes on the scaffold and keeps passing as you add capabilities, as long\",\n\t\t\"as the lockfile, the runtime capabilities, and every promoted release agree.\",\n\t\t\"Regenerate the lockfile from your composition root with `resolveAssembly`;\",\n\t\t\"`fabric.runtime.json` must list what that same root registers with the host,\",\n\t\t\"which is what stops a deployment from serving a plan its host cannot answer.\",\n\t\t\"\",\n\t].join(\"\\n\");\n}\n\nexport async function initializeExperience(\n\toptions: InitializeExperienceOptions,\n): Promise<InitializeExperienceResult> {\n\tif (!/^[a-z][a-z0-9-]*$/.test(options.application)) {\n\t\tthrow new Error(\"Application name must use lowercase letters, numbers, and hyphens.\");\n\t}\n\tconst functionName = options.application\n\t\t.split(\"-\")\n\t\t.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)\n\t\t.join(\"\");\n\tconst files = [\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.experience.ts\"),\n\t\t\t[\n\t\t\t\t'import { createExperienceServerRuntime } from \"@fabricorg/experience-runtime/server\";',\n\t\t\t\t'import { createExperienceGateway } from \"@fabricorg/experience-gateway\";',\n\t\t\t\t\"\",\n\t\t\t\t`export const create${functionName}ExperienceRuntime = (`,\n\t\t\t\t\"\\toptions: Parameters<typeof createExperienceServerRuntime>[0],\",\n\t\t\t\t\") => createExperienceServerRuntime(options);\",\n\t\t\t\t\"\",\n\t\t\t\t`export const create${functionName}ExperienceGateway = (`,\n\t\t\t\t\"\\toptions: Parameters<typeof createExperienceGateway>[0],\",\n\t\t\t\t\") => createExperienceGateway(options);\",\n\t\t\t\t\"\",\n\t\t\t].join(\"\\n\"),\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.component-pack.ts\"),\n\t\t\t[\n\t\t\t\t'import { defineComponentPack } from \"@fabricorg/component-pack\";',\n\t\t\t\t\"\",\n\t\t\t\t`export const define${functionName}ComponentPack = (artifactDigest: string) =>`,\n\t\t\t\t\"\\tdefineComponentPack({\",\n\t\t\t\t`\\t\\tname: \"${options.application}\",`,\n\t\t\t\t`\\t\\tnamespace: \"${options.application}\",`,\n\t\t\t\t'\\t\\tversion: \"0.1.0\",',\n\t\t\t\t\"\\t\\tartifactDigest,\",\n\t\t\t\t'\\t\\ttokenContract: { name: \"fabric-family\", version: \"1.0.0\" },',\n\t\t\t\t\"\\t\\tcomponents: {\",\n\t\t\t\t'\\t\\t\\tText: { module: \"./components/text.js\", roles: [\"content\"], slots: [] },',\n\t\t\t\t\"\\t\\t},\",\n\t\t\t\t\"\\t});\",\n\t\t\t\t\"\",\n\t\t\t].join(\"\\n\"),\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.application.json\"),\n\t\t\t`${JSON.stringify({\n\t\t\t\tformatVersion: 1,\n\t\t\t\tapplication: options.application,\n\t\t\t\tassembly: \"./fabric.assembly.lock.json\",\n\t\t\t\truntimeCapabilities: \"./fabric.runtime.json\",\n\t\t\t\treleases: [],\n\t\t\t}, null, 2)}\\n`,\n\t\t],\n\t\t// The application config names these two files, so the scaffold has to\n\t\t// produce them. Without them `fabric-gen check-application`, the very\n\t\t// next step, failed on a missing file rather than on anything the\n\t\t// author had done. The lockfile is resolved here, not hand-written, so\n\t\t// it carries a real assembly digest from the first commit.\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.assembly.lock.json\"),\n\t\t\t`${JSON.stringify(resolveAssembly({\n\t\t\t\tmanifest: {\n\t\t\t\t\tformatVersion: 2,\n\t\t\t\t\tapplication: options.application,\n\t\t\t\t\tcapabilities: [],\n\t\t\t\t\tcomponentPacks: [],\n\t\t\t\t\tbindings: [],\n\t\t\t\t\tcontracts: [],\n\t\t\t\t},\n\t\t\t\tcapabilities: [],\n\t\t\t\tcomponentPacks: [],\n\t\t\t}).lockfile, null, 2)}\\n`,\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"fabric.runtime.json\"),\n\t\t\t\"[]\\n\",\n\t\t],\n\t\t[\n\t\t\tpath.join(options.directory, \"README.md\"),\n\t\t\texperienceReadme(options.application),\n\t\t],\n\t] as const;\n\tawait mkdir(options.directory, { recursive: true });\n\tconst created: string[] = [];\n\ttry {\n\t\tfor (const [file, content] of files) {\n\t\t\tawait writeFile(file, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t\tcreated.push(file);\n\t\t}\n\t} catch (error) {\n\t\tawait Promise.all(created.map((file) => rm(file, { force: true })));\n\t\tif ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n\t\t\tthrow new Error(\"Refusing to overwrite an existing experience integration file.\");\n\t\t}\n\t\tthrow error;\n\t}\n\treturn { created };\n}\n\ninterface ApplicationCheckConfig {\n\tformatVersion: 1;\n\tassembly: string;\n\truntimeCapabilities: string;\n\treleases: string[];\n}\n\nasync function readJson(file: string): Promise<unknown> {\n\treturn JSON.parse(await readFile(file, \"utf8\"));\n}\n\nfunction assertApplicationCheckConfig(value: unknown): asserts value is ApplicationCheckConfig {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"Application check configuration must be a JSON object.\");\n\t}\n\tconst config = value as Record<string, unknown>;\n\tif (config.formatVersion !== 1) throw new Error(\"Application check configuration formatVersion must be 1.\");\n\tif (typeof config.assembly !== \"string\" || !config.assembly) {\n\t\tthrow new Error(\"Application check configuration assembly must be a file path.\");\n\t}\n\tif (typeof config.runtimeCapabilities !== \"string\" || !config.runtimeCapabilities) {\n\t\tthrow new Error(\"Application check configuration runtimeCapabilities must be a file path.\");\n\t}\n\tif (!Array.isArray(config.releases) || !config.releases.every((entry) => typeof entry === \"string\" && entry)) {\n\t\tthrow new Error(\"Application check configuration releases must be an array of file paths.\");\n\t}\n}\n\n/**\n * Verify an application's immutable composition inputs before deployment.\n * Every runtime capability must exactly match the approved lockfile, and every\n * promoted experience release must be intact and bound to that assembly.\n */\nexport async function checkApplication(\n\toptions: CheckApplicationOptions,\n): Promise<CheckApplicationResult> {\n\tconst configValue = await readJson(options.configPath);\n\tassertApplicationCheckConfig(configValue);\n\tconst base = path.dirname(options.configPath);\n\tconst resolve = (file: string): string => path.resolve(base, file);\n\tconst assembly = await readJson(resolve(configValue.assembly)) as AssemblyLockfile;\n\tassertAssemblyLockfile(assembly);\n\tconst runtimeCapabilities = await readJson(\n\t\tresolve(configValue.runtimeCapabilities),\n\t) as AvailableCapability[];\n\tif (!Array.isArray(runtimeCapabilities)) {\n\t\tthrow new Error(\"Runtime capabilities must be a JSON array.\");\n\t}\n\tassertAssemblyRuntimeCompatible(assembly, runtimeCapabilities);\n\tfor (const releasePath of configValue.releases) {\n\t\tconst release = await readJson(resolve(releasePath)) as SduiRelease;\n\t\ttry {\n\t\t\tassertSduiReleaseIntegrity(release);\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Experience release \"${releasePath}\" is invalid: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t}\n\t\tif (release.assemblyDigest !== assembly.assemblyDigest) {\n\t\t\tthrow new Error(\n\t\t\t\t`Experience release \"${release.document.name}@${release.document.version}\" belongs to assembly \"${release.assemblyDigest}\", not \"${assembly.assemblyDigest}\".`,\n\t\t\t);\n\t\t}\n\t}\n\treturn {\n\t\tapplication: assembly.application,\n\t\tcapabilities: assembly.capabilities.length,\n\t\treleases: configValue.releases.length,\n\t\tassemblyDigest: assembly.assemblyDigest,\n\t};\n}\n\n/**\n * Create the smallest useful capability source tree. The manifest is accepted\n * by the compiler immediately, while leaving domain vocabulary to the adopter.\n */\nexport interface ExportModuleManifestFileOptions {\n\tmoduleFile: string;\n\tout: string;\n\texportName?: string;\n}\n\nexport interface ExportModuleManifestFileResult {\n\tnamespace: string;\n\texportName: string;\n\tobjectTypes: number;\n\tactions: number;\n\teventTypes: number;\n}\n\n/**\n * Turn an authored FabricModule into the normalized manifest every generator reads.\n *\n * This is the seam between the two halves of the authoring loop. The module is\n * TypeScript, so the compiler checks it as you write; the manifest is the\n * normalized JSON the code generators and the assembly compiler consume. Until\n * this command existed, nothing shipped connected them: `init capability`\n * scaffolded an empty manifest, and an author who filled it in by hand was\n * guessing at the shape of `exportModuleManifest`'s output.\n */\nexport async function exportModuleManifestFile(\n\toptions: ExportModuleManifestFileOptions,\n): Promise<ExportModuleManifestFileResult> {\n\tconst absolute = path.resolve(options.moduleFile);\n\tconst loaded = await importAuthoredModule(absolute, options.moduleFile);\n\tconst candidates = Object.entries(loaded).filter(([, value]) => isFabricModuleLike(value));\n\tlet entry: [string, unknown] | undefined;\n\tif (options.exportName) {\n\t\tconst named = loaded[options.exportName];\n\t\tif (named === undefined) throw new Error(`\"${options.moduleFile}\" has no export named \"${options.exportName}\". It exports: ${Object.keys(loaded).join(\", \") || \"nothing\"}.`);\n\t\tif (!isFabricModuleLike(named)) throw new Error(`Export \"${options.exportName}\" of \"${options.moduleFile}\" is not a FabricModule: it has no string \"namespace\".`);\n\t\tentry = [options.exportName, named];\n\t} else if (candidates.length === 1) {\n\t\tentry = candidates[0];\n\t} else if (candidates.length === 0) {\n\t\tthrow new Error(`\"${options.moduleFile}\" exports no FabricModule. Export one, with a string \"namespace\", or name it with --export.`);\n\t} else {\n\t\tthrow new Error(`\"${options.moduleFile}\" exports ${candidates.length} modules (${candidates.map(([name]) => name).join(\", \")}). Choose one with --export.`);\n\t}\n\tconst manifest = exportModuleManifest(entry[1] as Parameters<typeof exportModuleManifest>[0]);\n\t// Compile it here so the author learns about a bad field from this command,\n\t// standing in their own module, rather than from a generator two steps later.\n\tcompileManifestBundle({ manifestVersion: 2, modules: [manifest] });\n\tawait mkdir(path.dirname(path.resolve(options.out)), { recursive: true });\n\tawait writeFile(path.resolve(options.out), `${JSON.stringify(manifest, null, 2)}\\n`, \"utf8\");\n\treturn {\n\t\tnamespace: manifest.namespace,\n\t\texportName: entry[0],\n\t\tobjectTypes: manifest.objectTypes.length,\n\t\tactions: manifest.actions.length,\n\t\teventTypes: manifest.eventTypes.length,\n\t};\n}\n\n/**\n * Import an authored module, whatever the surrounding project calls itself.\n *\n * Node decides how to read a `.ts` file from the nearest package.json: without\n * `\"type\": \"module\"` it reads it as CommonJS and rejects `export const` with\n * \"Unexpected token 'export'\". Most projects are CommonJS, so a scaffolded\n * module that imports fine in a bare directory fails inside a real one. When\n * that happens the file is copied to a sibling `.mts`, which is unambiguously\n * ESM, and imported from there. The copy sits in the same directory so\n * relative imports and package resolution behave exactly as they would.\n */\nasync function importAuthoredModule(absolute: string, display: string): Promise<Record<string, unknown>> {\n\ttry {\n\t\treturn (await import(pathToFileURL(absolute).href)) as Record<string, unknown>;\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tconst readAsCommonJs = /Unexpected token '(export|import)'|Cannot use import statement outside a module/.test(reason);\n\t\tif (readAsCommonJs && /\\.[cm]?ts$/.test(absolute)) {\n\t\t\tconst sibling = path.join(path.dirname(absolute), `.fabric-gen-${process.pid}-${path.basename(absolute, path.extname(absolute))}.mts`);\n\t\t\ttry {\n\t\t\t\tawait writeFile(sibling, await readFile(absolute, \"utf8\"), \"utf8\");\n\t\t\t\treturn (await import(pathToFileURL(sibling).href)) as Record<string, unknown>;\n\t\t\t} catch (retried) {\n\t\t\t\tconst retriedReason = retried instanceof Error ? retried.message : String(retried);\n\t\t\t\tthrow new Error(`Could not load module file \"${display}\": ${retriedReason}\\nA TypeScript file needs a runtime that strips types (Node 22.18 or newer); otherwise point --module at the built JavaScript.`);\n\t\t\t} finally {\n\t\t\t\tawait rm(sibling, { force: true });\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Could not load module file \"${display}\": ${reason}\\nA TypeScript file needs a runtime that strips types (Node 22.18 or newer); otherwise point --module at the built JavaScript.`);\n\t}\n}\n\nfunction isFabricModuleLike(value: unknown): boolean {\n\treturn typeof value === \"object\" && value !== null && typeof (value as { namespace?: unknown }).namespace === \"string\";\n}\n\nexport async function initializeCapability(\n\toptions: InitializeCapabilityOptions,\n): Promise<InitializeCapabilityResult> {\n\tif (!/^[a-z][a-z0-9-]*$/.test(options.namespace)) {\n\t\tthrow new Error(\"Capability namespace must use lowercase letters, numbers, and hyphens.\");\n\t}\n\tconst displayName = options.namespace\n\t\t.split(\"-\")\n\t\t.map((part, index) => index === 0\n\t\t\t? `${part.charAt(0).toUpperCase()}${part.slice(1)}`\n\t\t\t: part)\n\t\t.join(\" \");\n\tconst modulePath = path.join(options.directory, \"module.ts\");\n\tconst readmePath = path.join(options.directory, \"README.md\");\n\tfor (const file of [readmePath, modulePath]) {\n\t\ttry {\n\t\t\tawait access(file);\n\t\t\tthrow new Error(`Refusing to overwrite existing file \"${file}\".`);\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error && error.message.startsWith(\"Refusing to overwrite\")) throw error;\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n\t\t}\n\t}\n\t// The scaffold is a working module, not an empty shell. An empty manifest\n\t// teaches nothing about the shape it has to reach, and a manifest authored\n\t// by hand is a guess at the output of exportModuleManifest(). The module is\n\t// the source; `fabric-gen export` produces the manifest from it.\n\tconst module = [\n\t\t`import type { ActionDefinition } from \"@fabricorg/platform/actions\";`,\n\t\t`import type { FabricModule } from \"@fabricorg/platform/modules\";`,\n\t\t\"\",\n\t\t`/** One governed action. Every field below is checked when the manifest is exported. */`,\n\t\t`const recordExample: ActionDefinition = {`,\n\t\t`\\tactionId: \"${options.namespace}.record_example\",`,\n\t\t`\\tnamespace: \"${options.namespace}\",`,\n\t\t\"\\tversion: 1,\",\n\t\t'\\tkind: \"atomic\",',\n\t\t\"\\tidempotent: true,\",\n\t\t\"\\tmutatesDomain: true,\",\n\t\t'\\temitsEvents: [\"ExampleRecorded\"],',\n\t\t\"\\t// The six execution dimensions. A strict certification profile requires all of them.\",\n\t\t\"\\texecution: {\",\n\t\t'\\t\\tconnectivity: \"online-required\",',\n\t\t'\\t\\tauthorityMoment: \"execution\",',\n\t\t'\\t\\tidempotency: \"required\",',\n\t\t'\\t\\tcompletion: \"immediate\",',\n\t\t'\\t\\tconsistency: \"authoritative-now\",',\n\t\t'\\t\\tsensitivity: \"internal\",',\n\t\t\"\\t},\",\n\t\t\"\\tschema: {\",\n\t\t\"\\t\\tparse(value: unknown): { exampleId: string } {\",\n\t\t\"\\t\\t\\tconst input = value as { exampleId?: unknown };\",\n\t\t'\\t\\t\\tif (typeof input?.exampleId !== \"string\") throw new Error(\"exampleId is required\");',\n\t\t\"\\t\\t\\treturn { exampleId: input.exampleId };\",\n\t\t\"\\t\\t},\",\n\t\t\"\\t\\tsafeParse(value: unknown) {\",\n\t\t\"\\t\\t\\ttry {\",\n\t\t\"\\t\\t\\t\\treturn { success: true as const, data: this.parse(value) };\",\n\t\t\"\\t\\t\\t} catch (error) {\",\n\t\t'\\t\\t\\t\\treturn { success: false as const, error: { issues: [{ path: [\"exampleId\"], message: error instanceof Error ? error.message : String(error) }] } };',\n\t\t\"\\t\\t\\t}\",\n\t\t\"\\t\\t},\",\n\t\t\"\\t},\",\n\t\t\"\\thandler: async (_context, parameters) => ({\",\n\t\t\"\\t\\tsuccess: true,\",\n\t\t\"\\t\\tdata: {\",\n\t\t\"\\t\\t\\t...(parameters as { exampleId: string }),\",\n\t\t\"\\t\\t\\t_events: [{\",\n\t\t'\\t\\t\\t\\teventType: \"ExampleRecorded\",',\n\t\t\"\\t\\t\\t\\tentityType: \\\"Example\\\",\",\n\t\t\"\\t\\t\\t\\tentityId: (parameters as { exampleId: string }).exampleId,\",\n\t\t\"\\t\\t\\t\\tpayload: parameters,\",\n\t\t\"\\t\\t\\t}],\",\n\t\t\"\\t\\t},\",\n\t\t\"\\t}),\",\n\t\t\"};\",\n\t\t\"\",\n\t\t`export const ${camelCase(options.namespace)}Module: FabricModule = {`,\n\t\t`\\tnamespace: \"${options.namespace}\",`,\n\t\t'\\tversion: \"0.1.0\",',\n\t\t\"\\tcapability: {\",\n\t\t`\\t\\tdisplayName: \"${displayName}\",`,\n\t\t`\\t\\tdescription: \"Governed ${displayName.toLowerCase()} capability.\",`,\n\t\t'\\t\\tstability: \"experimental\",',\n\t\t\"\\t},\",\n\t\t\"\\tobjectTypes: [{\",\n\t\t'\\t\\ttype: \"Example\",',\n\t\t\"\\t\\tschema: {\",\n\t\t'\\t\\t\\ttype: \"object\",',\n\t\t'\\t\\t\\tproperties: { exampleId: { type: \"string\" } },',\n\t\t'\\t\\t\\trequired: [\"exampleId\"],',\n\t\t\"\\t\\t},\",\n\t\t\"\\t}],\",\n\t\t`\\tidPrefixes: [{ prefix: \"exm\", name: \"Example\", module: \"${options.namespace}\" }],`,\n\t\t'\\teventTypes: [{ eventType: \"ExampleRecorded\", schemaVersion: 1 }],',\n\t\t\"\\tactions: [recordExample],\",\n\t\t\"};\",\n\t\t\"\",\n\t].join(\"\\n\");\n\tconst readme = [\n\t\t`# ${displayName}`,\n\t\t\"\",\n\t\t\"`module.ts` is the source of truth. It is TypeScript, so the shape of every\",\n\t\t\"action, object type, and event is checked as you write it.\",\n\t\t\"\",\n\t\t\"## The loop\",\n\t\t\"\",\n\t\t\"```bash\",\n\t\t\"# 1. Export the authored module to the normalized manifest the generators read.\",\n\t\t\"fabric-gen export --module module.ts --out fabric.manifest.json\",\n\t\t\"\",\n\t\t\"# 2. Generate types, event contracts, the usage contract, and docs.\",\n\t\t\"fabric-gen --input fabric.manifest.json --out generated\",\n\t\t\"\",\n\t\t\"# 3. In CI, prove the generated files match the manifest.\",\n\t\t\"fabric-gen --input fabric.manifest.json --out generated --check\",\n\t\t\"```\",\n\t\t\"\",\n\t\t\"Commit both `fabric.manifest.json` and `generated/`. The manifest is the\",\n\t\t\"contract other capabilities and applications compile against; regenerating\",\n\t\t\"is how a consumer learns what changed.\",\n\t\t\"\",\n\t\t\"## What to edit\",\n\t\t\"\",\n\t\t\"- **Object types** carry a portable JSON Schema. They become generated TypeScript types.\",\n\t\t\"- **Actions** declare six execution dimensions. A host refuses an action whose\",\n\t\t\" declaration does not match how it is invoked, so declare them honestly.\",\n\t\t\"- **Events** are the capability's public vocabulary. Adding a field is compatible;\",\n\t\t\" removing or retyping one is not.\",\n\t\t\"\",\n\t].join(\"\\n\");\n\tawait mkdir(options.directory, { recursive: true });\n\tconst created: string[] = [];\n\ttry {\n\t\tfor (const [file, content] of [\n\t\t\t[readmePath, readme],\n\t\t\t[modulePath, module],\n\t\t] as const) {\n\t\t\tawait writeFile(file, content, { encoding: \"utf8\", flag: \"wx\" });\n\t\t\tcreated.push(file);\n\t\t}\n\t} catch (error) {\n\t\tawait Promise.all(created.map((file) => rm(file, { force: true })));\n\t\tif ((error as NodeJS.ErrnoException).code === \"EEXIST\") {\n\t\t\tthrow new Error(\"Refusing to overwrite a file created during capability initialization.\");\n\t\t}\n\t\tthrow error;\n\t}\n\treturn { created };\n}\n\nfunction camelCase(namespace: string): string {\n\treturn namespace.split(\"-\").map((part, index) => index === 0 ? part : `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join(\"\");\n}\n\nexport async function generateFromManifest(options: GenerateOptions): Promise<GenerateResult> {\n\tconst input = JSON.parse(await readFile(options.inputPath, \"utf8\"));\n\tif (!input || typeof input !== \"object\" || Array.isArray(input)) throw new Error(\"Manifest input must be a JSON object.\");\n\tconst bundle = \"modules\" in input ? input : { manifestVersion: input.manifestVersion, modules: [input] };\n\tconst ir = compileManifestBundle(bundle);\n\tconst files = (await Promise.all(options.targets.map(async (name) => {\n\t\tconst target = GENERATOR_TARGETS[name];\n\t\tif (!target) throw new Error(`Unknown generator target \"${name}\".`);\n\t\treturn (await runGenerator(target, ir)).map((file) => ({ ...file, path: `${name}/${file.path}` }));\n\t}))).flat().sort((left, right) => compareCanonicalStrings(left.path, right.path));\n\tconst expected = new Set(files.map((file) => file.path));\n\tconst existing = await listFiles(options.outputDirectory);\n\tconst selectedPrefixes = options.targets.map((target) => `${target}/`);\n\tconst stale = existing.filter((file) => selectedPrefixes.some((prefix) => file.startsWith(prefix)) && !expected.has(file));\n\tif (!options.check) await Promise.all(stale.map((file) => rm(path.join(options.outputDirectory, file), { force: true })));\n\tconst changed: string[] = [];\n\tfor (const file of files) {\n\t\tconst target = path.join(options.outputDirectory, file.path);\n\t\tlet current: string | undefined;\n\t\ttry { current = await readFile(target, \"utf8\"); } catch { current = undefined; }\n\t\tif (current !== file.content) {\n\t\t\tchanged.push(file.path);\n\t\t\tif (!options.check) { await mkdir(path.dirname(target), { recursive: true }); await writeFile(target, file.content, \"utf8\"); }\n\t\t}\n\t}\n\tif (options.check && (changed.length || stale.length)) throw new Error(`Generated artifacts drifted: ${[...changed, ...stale.map((file) => `stale:${file}`)].join(\", \")}`);\n\treturn { changed, stale, files };\n}\n\nasync function listFiles(directory: string, prefix = \"\"): Promise<string[]> {\n\tlet entries;\n\ttry { entries = await readdir(directory, { withFileTypes: true }); } catch { return []; }\n\tconst nested = await Promise.all(entries.map((entry) => entry.isDirectory() ? listFiles(path.join(directory, entry.name), `${prefix}${entry.name}/`) : [`${prefix}${entry.name}`]));\n\treturn nested.flat().sort();\n}\n\ninterface ExperiencePromotionConfig {\n\tformatVersion: 1;\n\tapplication: string;\n\tissuer: string;\n\tkeyId: string;\n\tassembly: string;\n\trelease: string;\n\tcontracts: string[];\n}\n\nfunction assertExperiencePromotionConfig(value: unknown): asserts value is ExperiencePromotionConfig {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"Experience promotion configuration must be a JSON object.\");\n\t}\n\tconst config = value as Record<string, unknown>;\n\tif (config.formatVersion !== 1) throw new Error(\"Experience promotion configuration formatVersion must be 1.\");\n\tfor (const field of [\"application\", \"issuer\", \"keyId\", \"assembly\", \"release\"] as const) {\n\t\tif (typeof config[field] !== \"string\" || !config[field]) {\n\t\t\tthrow new Error(`Experience promotion configuration ${field} must be a non-empty string.`);\n\t\t}\n\t}\n\t// The application name is interpolated into the default output path and\n\t// signed into the release body, so \"../../x\" would escape the configuration\n\t// directory and \"/etc/x\" would ignore it entirely.\n\tif (!/^[a-z][a-z0-9-]*$/.test(config.application as string)) {\n\t\tthrow new Error(\"Experience promotion configuration application must be lowercase letters, numbers, and hyphens.\");\n\t}\n\tif (!Array.isArray(config.contracts) || !config.contracts.every((entry) => typeof entry === \"string\" && entry)) {\n\t\tthrow new Error(\"Experience promotion configuration contracts must be an array of file paths.\");\n\t}\n\t// A signing key in a checked-in configuration file is a key in version\n\t// control. Enumerating two spellings only catches two spellings, so reject\n\t// anything that reads like one, and reject unknown fields so a future\n\t// spelling cannot arrive unnoticed.\n\tconst known = new Set([\"formatVersion\", \"application\", \"issuer\", \"keyId\", \"assembly\", \"release\", \"contracts\"]);\n\tfor (const field of Object.keys(config)) {\n\t\tif (/key|secret|credential|token|pem|password/i.test(field) && field !== \"keyId\") {\n\t\t\tthrow new Error(`Experience promotion configuration must not carry \"${field}\"; pass the signing key with --key.`);\n\t\t}\n\t\tif (!known.has(field)) {\n\t\t\tthrow new Error(`Experience promotion configuration has an unknown field \"${field}\".`);\n\t\t}\n\t}\n}\n\n/**\n * Turn a validated release into a signed one.\n *\n * Promotion is where a granted `capability://` reference becomes a concrete\n * action id and version, so it is also where that mapping has to be bound to\n * the assembly that approved it. The signing key is a command-line argument\n * rather than a configuration field, because a configuration file is the kind\n * of thing that ends up committed.\n */\nexport async function promoteExperience(\n\toptions: PromoteExperienceOptions,\n): Promise<PromoteExperienceResult> {\n\tconst configValue = await readJson(options.configPath);\n\tassertExperiencePromotionConfig(configValue);\n\tconst base = path.dirname(options.configPath);\n\tconst resolve = (file: string): string => path.resolve(base, file);\n\n\tconst assembly = await readJson(resolve(configValue.assembly)) as AssemblyLockfile;\n\tassertAssemblyLockfile(assembly);\n\tconst release = await readJson(resolve(configValue.release)) as SduiRelease;\n\tassertSduiReleaseIntegrity(release);\n\tconst contracts = await Promise.all(\n\t\tconfigValue.contracts.map(async (file) => await readJson(resolve(file)) as UsageContractDocument),\n\t);\n\n\tconst privateKey = createPrivateKey(await readFile(options.privateKeyPath, \"utf8\"));\n\tconst promoted = await promoteExperienceRelease({\n\t\tapplication: configValue.application,\n\t\trelease,\n\t\tcontracts,\n\t\tassembly,\n\t\tissuer: configValue.issuer,\n\t\tsigner: createEs256ReleaseSigner({ keyId: configValue.keyId, privateKey }),\n\t});\n\n\tconst outputPath = options.outputPath\n\t\t? path.resolve(options.outputPath)\n\t\t: resolve(`${configValue.application}.experience-release.jws`);\n\tawait mkdir(path.dirname(outputPath), { recursive: true });\n\tawait writeFile(outputPath, `${promoted.compactJws}\\n`, \"utf8\");\n\n\treturn {\n\t\tapplication: configValue.application,\n\t\treleaseDigest: release.releaseDigest,\n\t\tassemblyDigest: assembly.assemblyDigest,\n\t\troutes: {\n\t\t\tviews: promoted.release.routes.views.length,\n\t\t\tintents: promoted.release.routes.intents.length,\n\t\t},\n\t\toutputPath,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAgE;AAChE,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ACzD,YAAM,2BAAU,YAAY,GAAG,SAAS,UAAU;AAAA,GAAM,MAAM;AAE9D,SAAO;AAAA,IACN,aAAa,YAAY;AAAA,IACzB,eAAe,QAAQ;AAAA,IACvB,gBAAgB,SAAS;AAAA,IACzB,QAAQ;AAAA,MACP,OAAO,SAAS,QAAQ,OAAO,MAAM;AAAA,MACrC,SAAS,SAAS,QAAQ,OAAO,QAAQ;AAAA,IAC1C;AAAA,IACA;AAAA,EACD;AACD;","names":["result","path","module"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -57,11 +57,6 @@ declare class FabricGenUsageError extends Error {
|
|
|
57
57
|
declare function fabricGenCliExitCode(error: unknown): number;
|
|
58
58
|
/** Execute one CLI command and return its single human-readable result line. */
|
|
59
59
|
declare function runFabricGenCommand(args: readonly string[]): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Add experience integration files to an existing application. It deliberately
|
|
62
|
-
* does not create package.json, routes, authentication, billing, or navigation:
|
|
63
|
-
* those remain owned by the Supastarter-derived application shell.
|
|
64
|
-
*/
|
|
65
60
|
declare function initializeExperience(options: InitializeExperienceOptions): Promise<InitializeExperienceResult>;
|
|
66
61
|
/**
|
|
67
62
|
* Verify an application's immutable composition inputs before deployment.
|
|
@@ -73,6 +68,29 @@ declare function checkApplication(options: CheckApplicationOptions): Promise<Che
|
|
|
73
68
|
* Create the smallest useful capability source tree. The manifest is accepted
|
|
74
69
|
* by the compiler immediately, while leaving domain vocabulary to the adopter.
|
|
75
70
|
*/
|
|
71
|
+
interface ExportModuleManifestFileOptions {
|
|
72
|
+
moduleFile: string;
|
|
73
|
+
out: string;
|
|
74
|
+
exportName?: string;
|
|
75
|
+
}
|
|
76
|
+
interface ExportModuleManifestFileResult {
|
|
77
|
+
namespace: string;
|
|
78
|
+
exportName: string;
|
|
79
|
+
objectTypes: number;
|
|
80
|
+
actions: number;
|
|
81
|
+
eventTypes: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Turn an authored FabricModule into the normalized manifest every generator reads.
|
|
85
|
+
*
|
|
86
|
+
* This is the seam between the two halves of the authoring loop. The module is
|
|
87
|
+
* TypeScript, so the compiler checks it as you write; the manifest is the
|
|
88
|
+
* normalized JSON the code generators and the assembly compiler consume. Until
|
|
89
|
+
* this command existed, nothing shipped connected them: `init capability`
|
|
90
|
+
* scaffolded an empty manifest, and an author who filled it in by hand was
|
|
91
|
+
* guessing at the shape of `exportModuleManifest`'s output.
|
|
92
|
+
*/
|
|
93
|
+
declare function exportModuleManifestFile(options: ExportModuleManifestFileOptions): Promise<ExportModuleManifestFileResult>;
|
|
76
94
|
declare function initializeCapability(options: InitializeCapabilityOptions): Promise<InitializeCapabilityResult>;
|
|
77
95
|
declare function generateFromManifest(options: GenerateOptions): Promise<GenerateResult>;
|
|
78
96
|
/**
|
|
@@ -86,4 +104,4 @@ declare function generateFromManifest(options: GenerateOptions): Promise<Generat
|
|
|
86
104
|
*/
|
|
87
105
|
declare function promoteExperience(options: PromoteExperienceOptions): Promise<PromoteExperienceResult>;
|
|
88
106
|
|
|
89
|
-
export { type CheckApplicationOptions, type CheckApplicationResult, FabricGenUsageError, GENERATOR_TARGETS, type GenerateOptions, type GenerateResult, type InitializeCapabilityOptions, type InitializeCapabilityResult, type InitializeExperienceOptions, type InitializeExperienceResult, type PromoteExperienceOptions, type PromoteExperienceResult, checkApplication, fabricGenCliExitCode, generateFromManifest, initializeCapability, initializeExperience, promoteExperience, runFabricGenCommand };
|
|
107
|
+
export { type CheckApplicationOptions, type CheckApplicationResult, type ExportModuleManifestFileOptions, type ExportModuleManifestFileResult, FabricGenUsageError, GENERATOR_TARGETS, type GenerateOptions, type GenerateResult, type InitializeCapabilityOptions, type InitializeCapabilityResult, type InitializeExperienceOptions, type InitializeExperienceResult, type PromoteExperienceOptions, type PromoteExperienceResult, checkApplication, exportModuleManifestFile, fabricGenCliExitCode, generateFromManifest, initializeCapability, initializeExperience, promoteExperience, runFabricGenCommand };
|