create-relkit 0.7.1 → 0.7.4
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/dist/create-capabilities.d.ts +43 -0
- package/dist/create-capabilities.d.ts.map +1 -0
- package/dist/create-capabilities.js +94 -0
- package/dist/create-capabilities.js.map +1 -0
- package/dist/create-resolver.d.ts.map +1 -1
- package/dist/create-resolver.js +28 -6
- package/dist/create-resolver.js.map +1 -1
- package/dist/generate-output.d.ts +2 -1
- package/dist/generate-output.d.ts.map +1 -1
- package/dist/generate-output.js +19 -37
- package/dist/generate-output.js.map +1 -1
- package/dist/generate-output.schemas.d.ts +34 -0
- package/dist/generate-output.schemas.d.ts.map +1 -0
- package/dist/generate-output.schemas.js +33 -0
- package/dist/generate-output.schemas.js.map +1 -0
- package/dist/generate-output.types.d.ts +2 -0
- package/dist/generate-output.types.d.ts.map +1 -1
- package/dist/generate-preparation.d.ts +26 -0
- package/dist/generate-preparation.d.ts.map +1 -0
- package/dist/generate-preparation.js +83 -0
- package/dist/generate-preparation.js.map +1 -0
- package/dist/generate-result.d.ts +34 -0
- package/dist/generate-result.d.ts.map +1 -0
- package/dist/generate-result.js +41 -0
- package/dist/generate-result.js.map +1 -0
- package/dist/generate-stage.d.ts +21 -0
- package/dist/generate-stage.d.ts.map +1 -0
- package/dist/generate-stage.js +52 -0
- package/dist/generate-stage.js.map +1 -0
- package/dist/generate-stage.types.d.ts +11 -0
- package/dist/generate-stage.types.d.ts.map +1 -0
- package/dist/generate-stage.types.js +2 -0
- package/dist/generate-stage.types.js.map +1 -0
- package/dist/generate-workflow.d.ts +10 -7
- package/dist/generate-workflow.d.ts.map +1 -1
- package/dist/generate-workflow.js +22 -101
- package/dist/generate-workflow.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/templates/default/README.md +1 -1
- package/dist/templates/default/v1/agent/package.json +5 -4
- package/dist/templates/default/v1/agent/src/hello/agents/assistant.agent.ts +1 -1
- package/dist/templates/default/v1/api/package.json +4 -3
- package/dist/templates/default/v1/fullstack/README.md +7 -0
- package/dist/templates/default/v1/fullstack/package.json +7 -6
- package/dist/templates/default/v1/fullstack/src/hello/agents/assistant.agent.ts +1 -1
- package/dist/templates/default/v1/minimal/package.json +4 -3
- package/dist/templates/default/v1/tasks/package.json +4 -3
- package/package.json +3 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CreateOptions, type CreateTemplate } from "./options.js";
|
|
2
|
+
export interface CreateCapabilityTuple {
|
|
3
|
+
readonly template: CreateOptions["template"];
|
|
4
|
+
readonly cloud: CreateOptions["cloud"];
|
|
5
|
+
readonly deploy: CreateOptions["deploy"];
|
|
6
|
+
readonly jobs?: CreateOptions["jobs"];
|
|
7
|
+
readonly examples: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateCapabilityIdentity {
|
|
10
|
+
readonly release: string;
|
|
11
|
+
readonly bun: string;
|
|
12
|
+
readonly typescript: string;
|
|
13
|
+
readonly packageCatalogDigest: string;
|
|
14
|
+
readonly template: string;
|
|
15
|
+
readonly snapshotProtocol: number;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateCapabilityEvidence extends CreateCapabilityTuple {
|
|
18
|
+
readonly identity: CreateCapabilityIdentity;
|
|
19
|
+
readonly templateDigest: string;
|
|
20
|
+
readonly freshEvidence: string;
|
|
21
|
+
readonly restartEvidence: string;
|
|
22
|
+
}
|
|
23
|
+
type PartialCreateCapability = Readonly<{
|
|
24
|
+
template?: string;
|
|
25
|
+
cloud?: string;
|
|
26
|
+
deploy?: string;
|
|
27
|
+
jobs?: string | undefined;
|
|
28
|
+
examples?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const CREATE_CAPABILITY_TABLE: Readonly<{
|
|
31
|
+
version: 1;
|
|
32
|
+
entries: readonly CreateCapabilityEvidence[];
|
|
33
|
+
}>;
|
|
34
|
+
/** Returns the runtime identity that packaged evidence must match exactly. */
|
|
35
|
+
export declare function currentCreateCapabilityIdentity(): CreateCapabilityIdentity;
|
|
36
|
+
/** Rejects missing or stale runtime tuples before destination planning or installation. */
|
|
37
|
+
export declare function assertCreateCapability(options: Pick<CreateOptions, "template" | "cloud" | "deploy" | "jobs" | "examples">, identity?: CreateCapabilityIdentity): void;
|
|
38
|
+
/** Filters interactive template choices through the same evidence allow-list. */
|
|
39
|
+
export declare function supportedCreateTemplates(options: PartialCreateCapability, identity?: CreateCapabilityIdentity): readonly CreateTemplate[];
|
|
40
|
+
/** True only when a complete tuple and every evidence identity field match. */
|
|
41
|
+
export declare function supported(options: Pick<CreateOptions, "template" | "cloud" | "deploy" | "jobs" | "examples">, identity?: CreateCapabilityIdentity): boolean;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=create-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-capabilities.d.ts","sourceRoot":"","sources":["../src/create-capabilities.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ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|
|
|
1
|
+
/**
|
|
2
|
+
* Packaged creation support is an allow-list backed by reference-host evidence.
|
|
3
|
+
* Candidate literals remain parseable so explicit unsupported requests can return
|
|
4
|
+
* a precise pre-staging diagnostic instead of masquerading as syntax errors.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import manifest from "../package.json";
|
|
8
|
+
import { CreateOptionsError } from "./options.js";
|
|
9
|
+
const entries = Object.freeze([
|
|
10
|
+
Object.freeze({
|
|
11
|
+
template: "minimal",
|
|
12
|
+
cloud: "none",
|
|
13
|
+
deploy: "none",
|
|
14
|
+
examples: true,
|
|
15
|
+
identity: Object.freeze({
|
|
16
|
+
release: "0.7.4",
|
|
17
|
+
bun: "1.3.10",
|
|
18
|
+
typescript: "5.9.3",
|
|
19
|
+
packageCatalogDigest: "ac7c2f56e61fca5ab890775cf4c483722cb590e488ee7fc4741224cbb4f50ccd",
|
|
20
|
+
template: "default/v1/minimal",
|
|
21
|
+
snapshotProtocol: 1,
|
|
22
|
+
}),
|
|
23
|
+
templateDigest: "d5fdd807e4320b957c1343274c27b0208c26e8e51d858a20c61191601bfa8098",
|
|
24
|
+
freshEvidence: "docs/evidence/create-capabilities/0.7.4/fresh.json",
|
|
25
|
+
restartEvidence: "docs/evidence/create-capabilities/0.7.4/restart.json",
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
export const CREATE_CAPABILITY_TABLE = Object.freeze({
|
|
29
|
+
version: 1,
|
|
30
|
+
entries,
|
|
31
|
+
});
|
|
32
|
+
/** Returns the runtime identity that packaged evidence must match exactly. */
|
|
33
|
+
export function currentCreateCapabilityIdentity() {
|
|
34
|
+
const catalog = manifest.relkit.buildCatalog;
|
|
35
|
+
return {
|
|
36
|
+
release: manifest.version,
|
|
37
|
+
bun: Bun.version,
|
|
38
|
+
typescript: catalog.dependencies.typescript,
|
|
39
|
+
packageCatalogDigest: createHash("sha256").update(JSON.stringify(catalog)).digest("hex"),
|
|
40
|
+
template: "default/v1/minimal",
|
|
41
|
+
snapshotProtocol: 1,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Rejects missing or stale runtime tuples before destination planning or installation. */
|
|
45
|
+
export function assertCreateCapability(options, identity = currentCreateCapabilityIdentity()) {
|
|
46
|
+
if (supported(options, identity))
|
|
47
|
+
return;
|
|
48
|
+
throw new CreateOptionsError(`Creation combination is not certified: ${formatTuple(options)}. Supported: ${supportedTuples(identity).join(", ") || "none for this tool identity"}.`);
|
|
49
|
+
}
|
|
50
|
+
/** Filters interactive template choices through the same evidence allow-list. */
|
|
51
|
+
export function supportedCreateTemplates(options, identity = currentCreateCapabilityIdentity()) {
|
|
52
|
+
return CREATE_CAPABILITY_TABLE.entries
|
|
53
|
+
.filter((entry) => current(entry.identity, identity) && matchesPartial(entry, options))
|
|
54
|
+
.map((entry) => entry.template);
|
|
55
|
+
}
|
|
56
|
+
/** True only when a complete tuple and every evidence identity field match. */
|
|
57
|
+
export function supported(options, identity = currentCreateCapabilityIdentity()) {
|
|
58
|
+
return CREATE_CAPABILITY_TABLE.entries.some((entry) => current(entry.identity, identity) &&
|
|
59
|
+
entry.template === options.template &&
|
|
60
|
+
entry.cloud === options.cloud &&
|
|
61
|
+
entry.deploy === options.deploy &&
|
|
62
|
+
entry.jobs === options.jobs &&
|
|
63
|
+
entry.examples === options.examples);
|
|
64
|
+
}
|
|
65
|
+
function supportedTuples(identity) {
|
|
66
|
+
return CREATE_CAPABILITY_TABLE.entries
|
|
67
|
+
.filter((entry) => current(entry.identity, identity))
|
|
68
|
+
.map(formatTuple);
|
|
69
|
+
}
|
|
70
|
+
function current(left, right) {
|
|
71
|
+
return (left.release === right.release &&
|
|
72
|
+
left.bun === right.bun &&
|
|
73
|
+
left.typescript === right.typescript &&
|
|
74
|
+
left.packageCatalogDigest === right.packageCatalogDigest &&
|
|
75
|
+
left.template === right.template &&
|
|
76
|
+
left.snapshotProtocol === right.snapshotProtocol);
|
|
77
|
+
}
|
|
78
|
+
function matchesPartial(entry, options) {
|
|
79
|
+
return ((options.template === undefined || entry.template === options.template) &&
|
|
80
|
+
(options.cloud === undefined || entry.cloud === options.cloud) &&
|
|
81
|
+
(options.deploy === undefined || entry.deploy === options.deploy) &&
|
|
82
|
+
(options.jobs === undefined || entry.jobs === options.jobs) &&
|
|
83
|
+
(options.examples === undefined || entry.examples === options.examples));
|
|
84
|
+
}
|
|
85
|
+
function formatTuple(options) {
|
|
86
|
+
return [
|
|
87
|
+
`template=${options.template ?? "*"}`,
|
|
88
|
+
`jobs=${options.jobs ?? "none"}`,
|
|
89
|
+
`cloud=${options.cloud ?? "*"}`,
|
|
90
|
+
`deploy=${options.deploy ?? "*"}`,
|
|
91
|
+
`examples=${options.examples === undefined ? "*" : options.examples ? "on" : "off"}`,
|
|
92
|
+
].join("/");
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=create-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-capabilities.js","sourceRoot":"","sources":["../src/create-capabilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAA2C,MAAM,cAAc,CAAC;AAkC3F,MAAM,OAAO,GAAwC,MAAM,CAAC,MAAM,CAAC;IACjE,MAAM,CAAC,MAAM,CAAC;QACZ,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;YACtB,OAAO,EAAE,OAAO;YAChB,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE,OAAO;YACnB,oBAAoB,EAAE,kEAAkE;YACxF,QAAQ,EAAE,oBAAoB;YAC9B,gBAAgB,EAAE,CAAC;SACpB,CAAC;QACF,cAAc,EAAE,kEAAkE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,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC;QACvE,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC;QAC9D,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;QACjE,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC;QAC3D,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CACxE,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,OAAgC;IACnD,OAAO;QACL,YAAY,OAAO,CAAC,QAAQ,IAAI,GAAG,EAAE;QACrC,QAAQ,OAAO,CAAC,IAAI,IAAI,MAAM,EAAE;QAChC,SAAS,OAAO,CAAC,KAAK,IAAI,GAAG,EAAE;QAC/B,UAAU,OAAO,CAAC,MAAM,IAAI,GAAG,EAAE;QACjC,YAAY,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;KACrF,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-resolver.d.ts","sourceRoot":"","sources":["../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,
|
|
1
|
+
{"version":3,"file":"create-resolver.d.ts","sourceRoot":"","sources":["../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlG,OAAO,EAAE,eAAe,EAAwB,MAAM,uBAAuB,CAAC;AAI9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAO9F;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC;;;gIAwD7C,CAAC;AAqBF;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,CAExB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAWhC"}
|
package/dist/create-resolver.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { observeExecution } from "@relkit/contracts/operation";
|
|
3
|
-
import {
|
|
3
|
+
import { CREATE_OPTION_DEFAULTS, normalizeCreateOptions } from "./options.js";
|
|
4
|
+
import { assertCreateCapability, supportedCreateTemplates } from "./create-capabilities.js";
|
|
4
5
|
import { createClackPromptDriver } from "./prompt-driver.js";
|
|
5
6
|
import { GeneratorPrompt, generatorPromptLayer } from "./generator-prompt.js";
|
|
6
7
|
import { domainTry } from "./generator-errors.js";
|
|
@@ -32,9 +33,14 @@ export const resolveCreateOptionsDetailsEffect = Effect.fn("CreateResolution.res
|
|
|
32
33
|
prompted = true;
|
|
33
34
|
}
|
|
34
35
|
if (!has(output, "template")) {
|
|
36
|
+
const templates = supportedCreateTemplates(explicitCapabilityOptions(output));
|
|
37
|
+
if (templates.length === 0)
|
|
38
|
+
return yield* domainTry(() => {
|
|
39
|
+
throw new Error("No certified starter template matches the explicit creation flags.");
|
|
40
|
+
});
|
|
35
41
|
const template = yield* prompt.select({
|
|
36
42
|
message: "Starter template",
|
|
37
|
-
options:
|
|
43
|
+
options: templates.map((value) => ({ value, label: title(value) })),
|
|
38
44
|
initialValue: CREATE_OPTION_DEFAULTS.template,
|
|
39
45
|
});
|
|
40
46
|
output.push("--template", template);
|
|
@@ -43,10 +49,7 @@ export const resolveCreateOptionsDetailsEffect = Effect.fn("CreateResolution.res
|
|
|
43
49
|
if (!has(output, "jobs")) {
|
|
44
50
|
const jobs = yield* prompt.select({
|
|
45
51
|
message: "Jobs service",
|
|
46
|
-
options: [
|
|
47
|
-
{ value: "none", label: "None" },
|
|
48
|
-
...CREATE_JOBS.map((value) => ({ value, label: title(value) })),
|
|
49
|
-
],
|
|
52
|
+
options: [{ value: "none", label: "None" }],
|
|
50
53
|
initialValue: "none",
|
|
51
54
|
});
|
|
52
55
|
if (jobs !== "none")
|
|
@@ -64,8 +67,27 @@ export const resolveCreateOptionsDetailsEffect = Effect.fn("CreateResolution.res
|
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
const options = yield* domainTry(() => normalizeCreateOptions(output, context.json === undefined ? {} : { json: context.json }));
|
|
70
|
+
yield* domainTry(() => assertCreateCapability(options));
|
|
67
71
|
return { options, prompted };
|
|
68
72
|
}, (effect) => observeExecution("generator", "create.resolve", effect));
|
|
73
|
+
function explicitCapabilityOptions(args) {
|
|
74
|
+
return {
|
|
75
|
+
cloud: explicitValue(args, "cloud") ?? CREATE_OPTION_DEFAULTS.cloud,
|
|
76
|
+
deploy: explicitValue(args, "deploy") ?? CREATE_OPTION_DEFAULTS.deploy,
|
|
77
|
+
...(explicitValue(args, "jobs") === undefined
|
|
78
|
+
? {}
|
|
79
|
+
: { jobs: explicitValue(args, "jobs") }),
|
|
80
|
+
examples: !args.includes("--no-examples"),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function explicitValue(args, name) {
|
|
84
|
+
const flag = `--${name}`;
|
|
85
|
+
const inline = args.find((argument) => argument.startsWith(`${flag}=`));
|
|
86
|
+
if (inline !== undefined)
|
|
87
|
+
return inline.slice(flag.length + 1);
|
|
88
|
+
const index = args.indexOf(flag);
|
|
89
|
+
return index < 0 ? undefined : args[index + 1];
|
|
90
|
+
}
|
|
69
91
|
/**
|
|
70
92
|
* Preserves normalized creation's Promise compatibility API.
|
|
71
93
|
* @param args - Existing flags.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-resolver.js","sourceRoot":"","sources":["../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"create-resolver.js","sourceRoot":"","sources":["../src/create-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD;;GAEG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;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AC,CAAC;QACxF,CAAC;;YAAM,OAAO,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,SAAS,GAAG,CAAC,IAAuB,EAAE,IAAY;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,IAAI,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC;AACvF,CAAC;AAED;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,KAAK;SACT,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC;SACjC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC;SACjC,OAAO,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -9,10 +9,11 @@ import type { CreateOptions } from "./options.js";
|
|
|
9
9
|
export declare function createGenerateNextSteps(options: Pick<CreateOptions, "examples" | "install">, destination: string, cwd?: string): GenerateNextSteps;
|
|
10
10
|
/**
|
|
11
11
|
* Formats a recognizable generation result for terminal display.
|
|
12
|
+
* @typeParam T - Native presentation input narrowed by the generated-result schema.
|
|
12
13
|
* @param value - Generation result or an unrecognized output value.
|
|
13
14
|
* @returns Success details, commands, endpoints and warnings; other values use JSON serialization.
|
|
14
15
|
*/
|
|
15
|
-
export declare function formatGenerateResult(value:
|
|
16
|
+
export declare function formatGenerateResult<T>(value: T): string;
|
|
16
17
|
import type { GenerateNextSteps } from "./generate-output.types.js";
|
|
17
18
|
export type { GenerateNextSteps } from "./generate-output.types.js";
|
|
18
19
|
//# sourceMappingURL=generate-output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-output.d.ts","sourceRoot":"","sources":["../src/generate-output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-output.d.ts","sourceRoot":"","sources":["../src/generate-output.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,SAAS,CAAC,EACpD,WAAW,EAAE,MAAM,EACnB,GAAG,SAAgB,GAClB,iBAAiB,CAuBnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CA0BxD;AAYD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/generate-output.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders local onboarding from the generated project's actual installation state.
|
|
3
|
+
* Pure command construction exposes finite preparation after skipped installation;
|
|
4
|
+
* schema guards recognize presentation values without promoting arbitrary output
|
|
5
|
+
* into the generated-result contract. Formatting performs no runtime acquisition.
|
|
6
|
+
*/
|
|
1
7
|
import { basename, relative, resolve } from "node:path";
|
|
8
|
+
import { Schema } from "effect";
|
|
9
|
+
import { GeneratePresentation } from "./generate-output.schemas.js";
|
|
2
10
|
/**
|
|
3
11
|
* Builds local commands and endpoints for a generated project.
|
|
4
12
|
* @param options - Installation and examples flags.
|
|
@@ -10,7 +18,12 @@ export function createGenerateNextSteps(options, destination, cwd = process.cwd(
|
|
|
10
18
|
const directory = relative(resolve(cwd), resolve(destination)) || basename(destination);
|
|
11
19
|
const commands = Object.freeze({
|
|
12
20
|
cd: `cd ${shellWord(directory)}`,
|
|
13
|
-
...(options.install
|
|
21
|
+
...(options.install
|
|
22
|
+
? {}
|
|
23
|
+
: {
|
|
24
|
+
install: "bun install",
|
|
25
|
+
prepare: "bunx --no-install relkit dev --prepare",
|
|
26
|
+
}),
|
|
14
27
|
dev: "bun run dev",
|
|
15
28
|
test: "bun run test",
|
|
16
29
|
check: "bun run check",
|
|
@@ -27,17 +40,16 @@ export function createGenerateNextSteps(options, destination, cwd = process.cwd(
|
|
|
27
40
|
}
|
|
28
41
|
/**
|
|
29
42
|
* Formats a recognizable generation result for terminal display.
|
|
43
|
+
* @typeParam T - Native presentation input narrowed by the generated-result schema.
|
|
30
44
|
* @param value - Generation result or an unrecognized output value.
|
|
31
45
|
* @returns Success details, commands, endpoints and warnings; other values use JSON serialization.
|
|
32
46
|
*/
|
|
33
47
|
export function formatGenerateResult(value) {
|
|
34
|
-
if (!
|
|
48
|
+
if (!Schema.is(GeneratePresentation)(value))
|
|
35
49
|
return JSON.stringify(value);
|
|
36
50
|
const { commands, endpoints } = value.nextSteps;
|
|
37
|
-
const additions =
|
|
38
|
-
const warnings =
|
|
39
|
-
? value.warnings.flatMap((warning) => isRecord(warning) && typeof warning.message === "string" ? [warning.message] : [])
|
|
40
|
-
: [];
|
|
51
|
+
const additions = value.additions?.length ?? 0;
|
|
52
|
+
const warnings = value.warnings?.map((warning) => warning.message) ?? [];
|
|
41
53
|
return [
|
|
42
54
|
...(typeof value.name === "string" && typeof value.destination === "string"
|
|
43
55
|
? [`Success! Created ${value.name} at ${value.destination}.`, ""]
|
|
@@ -45,6 +57,7 @@ export function formatGenerateResult(value) {
|
|
|
45
57
|
...(additions ? [`additions: ${additions}`, ""] : []),
|
|
46
58
|
commands.cd,
|
|
47
59
|
...(commands.install ? [commands.install] : []),
|
|
60
|
+
...(commands.prepare ? [commands.prepare] : []),
|
|
48
61
|
commands.dev,
|
|
49
62
|
"",
|
|
50
63
|
`backend: ${endpoints.backend}`,
|
|
@@ -69,35 +82,4 @@ function shellWord(value) {
|
|
|
69
82
|
return value.startsWith("-") ? `./${value}` : value;
|
|
70
83
|
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
71
84
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Checks that an unknown result contains the supported commands and endpoints.
|
|
74
|
-
* @param value - Unknown nextSteps field.
|
|
75
|
-
* @returns Whether the value matches the generated next-steps contract.
|
|
76
|
-
*/
|
|
77
|
-
function isNextSteps(value) {
|
|
78
|
-
if (!isRecord(value) || !isRecord(value.commands) || !isRecord(value.endpoints))
|
|
79
|
-
return false;
|
|
80
|
-
const commands = value.commands;
|
|
81
|
-
const endpoints = value.endpoints;
|
|
82
|
-
return (typeof commands.cd === "string" &&
|
|
83
|
-
(commands.install === undefined || commands.install === "bun install") &&
|
|
84
|
-
commands.dev === "bun run dev" &&
|
|
85
|
-
commands.test === "bun run test" &&
|
|
86
|
-
commands.check === "bun run check" &&
|
|
87
|
-
commands.build === "bun run build" &&
|
|
88
|
-
endpoints.backend === "http://localhost:3000" &&
|
|
89
|
-
endpoints.inspector === "http://localhost:3210" &&
|
|
90
|
-
endpoints.openapi === "http://localhost:3000/_relkit/v1/openapi.json" &&
|
|
91
|
-
endpoints.apiReference === "http://localhost:3000/_relkit/v1/api-reference" &&
|
|
92
|
-
(endpoints.route === undefined ||
|
|
93
|
-
endpoints.route === "GET http://localhost:3000/hello?name=RelKit"));
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Narrows an unknown value to a non-null object excluding arrays.
|
|
97
|
-
* @param value - Unknown value at the object boundary.
|
|
98
|
-
* @returns Whether the value is a non-null, non-array object.
|
|
99
|
-
*/
|
|
100
|
-
function isRecord(value) {
|
|
101
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
102
|
-
}
|
|
103
85
|
//# sourceMappingURL=generate-output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-output.js","sourceRoot":"","sources":["../src/generate-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-output.js","sourceRoot":"","sources":["../src/generate-output.ts"],"names":[],"mapp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GAAG,CAAC,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3E,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,EAAE;QACF,QAAQ,CAAC,IAAI;QACb,QAAQ,CAAC,KAAK;QACd,QAAQ,CAAC,KAAK;KACf,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3F,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recognizes generated onboarding values at the terminal formatting boundary.
|
|
3
|
+
* Literal commands and endpoints stay aligned with the published result type;
|
|
4
|
+
* arbitrary results fall back to JSON presentation and gain no command authority.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
/** Checked presentation subset; unrelated metadata is not used by rendering. */
|
|
8
|
+
export declare const GeneratePresentation: Schema.Struct<{
|
|
9
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
10
|
+
readonly destination: Schema.optionalKey<Schema.String>;
|
|
11
|
+
readonly nextSteps: Schema.Struct<{
|
|
12
|
+
readonly commands: Schema.Struct<{
|
|
13
|
+
readonly cd: Schema.String;
|
|
14
|
+
readonly install: Schema.optionalKey<Schema.Literal<"bun install">>;
|
|
15
|
+
readonly prepare: Schema.optionalKey<Schema.Literal<"bunx --no-install relkit dev --prepare">>;
|
|
16
|
+
readonly dev: Schema.Literal<"bun run dev">;
|
|
17
|
+
readonly test: Schema.Literal<"bun run test">;
|
|
18
|
+
readonly check: Schema.Literal<"bun run check">;
|
|
19
|
+
readonly build: Schema.Literal<"bun run build">;
|
|
20
|
+
}>;
|
|
21
|
+
readonly endpoints: Schema.Struct<{
|
|
22
|
+
readonly backend: Schema.Literal<"http://localhost:3000">;
|
|
23
|
+
readonly inspector: Schema.Literal<"http://localhost:3210">;
|
|
24
|
+
readonly openapi: Schema.Literal<"http://localhost:3000/_relkit/v1/openapi.json">;
|
|
25
|
+
readonly apiReference: Schema.Literal<"http://localhost:3000/_relkit/v1/api-reference">;
|
|
26
|
+
readonly route: Schema.optionalKey<Schema.Literal<"GET http://localhost:3000/hello?name=RelKit">>;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
readonly additions: Schema.optionalKey<Schema.$Array<Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
30
|
+
readonly warnings: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
31
|
+
readonly message: Schema.String;
|
|
32
|
+
}>>>;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=generate-output.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-output.schemas.d.ts","sourceRoot":"","sources":["../src/generate-output.schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAsBhC,gFAAgF;AAChF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;EAM/B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recognizes generated onboarding values at the terminal formatting boundary.
|
|
3
|
+
* Literal commands and endpoints stay aligned with the published result type;
|
|
4
|
+
* arbitrary results fall back to JSON presentation and gain no command authority.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
/** Local commands reflect whether installation and preparation already ran. */
|
|
8
|
+
const Commands = Schema.Struct({
|
|
9
|
+
cd: Schema.String,
|
|
10
|
+
install: Schema.optionalKey(Schema.Literal("bun install")),
|
|
11
|
+
prepare: Schema.optionalKey(Schema.Literal("bunx --no-install relkit dev --prepare")),
|
|
12
|
+
dev: Schema.Literal("bun run dev"),
|
|
13
|
+
test: Schema.Literal("bun run test"),
|
|
14
|
+
check: Schema.Literal("bun run check"),
|
|
15
|
+
build: Schema.Literal("bun run build"),
|
|
16
|
+
});
|
|
17
|
+
/** Only an example-bearing project advertises the generated hello route. */
|
|
18
|
+
const Endpoints = Schema.Struct({
|
|
19
|
+
backend: Schema.Literal("http://localhost:3000"),
|
|
20
|
+
inspector: Schema.Literal("http://localhost:3210"),
|
|
21
|
+
openapi: Schema.Literal("http://localhost:3000/_relkit/v1/openapi.json"),
|
|
22
|
+
apiReference: Schema.Literal("http://localhost:3000/_relkit/v1/api-reference"),
|
|
23
|
+
route: Schema.optionalKey(Schema.Literal("GET http://localhost:3000/hello?name=RelKit")),
|
|
24
|
+
});
|
|
25
|
+
/** Checked presentation subset; unrelated metadata is not used by rendering. */
|
|
26
|
+
export const GeneratePresentation = Schema.Struct({
|
|
27
|
+
name: Schema.optionalKey(Schema.String),
|
|
28
|
+
destination: Schema.optionalKey(Schema.String),
|
|
29
|
+
nextSteps: Schema.Struct({ commands: Commands, endpoints: Endpoints }),
|
|
30
|
+
additions: Schema.optionalKey(Schema.Array(Schema.Json)),
|
|
31
|
+
warnings: Schema.optionalKey(Schema.Array(Schema.Struct({ message: Schema.String }))),
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=generate-output.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-output.sch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C;IAC9C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACtE,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CACtF,CAAC,CAAC"}
|
|
@@ -5,6 +5,8 @@ export interface GenerateNextSteps {
|
|
|
5
5
|
readonly commands: Readonly<{
|
|
6
6
|
readonly cd: string;
|
|
7
7
|
readonly install?: "bun install";
|
|
8
|
+
/** Finite validation/preparation required after a skipped dependency installation. */
|
|
9
|
+
readonly prepare?: "bunx --no-install relkit dev --prepare";
|
|
8
10
|
readonly dev: "bun run dev";
|
|
9
11
|
readonly test: "bun run test";
|
|
10
12
|
readonly check: "bun run check";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-output.types.d.ts","sourceRoot":"","sources":["../src/generate-output.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;QAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;QAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;QAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;KACjC,CAAC,CAAC;IACH,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;QAC1C,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;QAC5C,QAAQ,CAAC,OAAO,EAAE,+CAA+C,CAAC;QAClE,QAAQ,CAAC,YAAY,EAAE,gDAAgD,CAAC;QACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,6CAA6C,CAAC;KAChE,CAAC,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"generate-output.types.d.ts","sourceRoot":"","sources":["../src/generate-output.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QACjC,sFAAsF;QACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,wCAAwC,CAAC;QAC5D,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;QAC5B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;QAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;QAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;KACjC,CAAC,CAAC;IACH,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;QAC1C,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;QAC5C,QAAQ,CAAC,OAAO,EAAE,+CAA+C,CAAC;QAClE,QAAQ,CAAC,YAAY,EAAE,gDAAgD,CAAC;QACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,6CAA6C,CAAC;KAChE,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { CreateOptions } from "./options.js";
|
|
3
|
+
import type { GenerateProjectContext } from "./generate-types.js";
|
|
4
|
+
import { GeneratorProcess } from "./generator-process.js";
|
|
5
|
+
/** Copies and customizes the template before installation.
|
|
6
|
+
* @param stage - Scope-owned sibling directory.
|
|
7
|
+
* @param options - Normalized creation selection.
|
|
8
|
+
* @param context - Template and deterministic failure authority.
|
|
9
|
+
* @returns Lazy materialization; failures abort before publication.
|
|
10
|
+
*/
|
|
11
|
+
export declare const materializeGenerationStage: (stage: string, options: CreateOptions, context: GenerateProjectContext) => Effect.Effect<void, import("./generator-errors.js").GeneratorIoError | import("./generator-errors.js").GeneratorDomainError, import("./generator-filesystem.js").GeneratorFileSystem | import("./generator-paths.js").GeneratorPaths>;
|
|
12
|
+
/** Installs dependencies and optional Git metadata inside the private stage.
|
|
13
|
+
* @param stage - Scope-owned sibling directory.
|
|
14
|
+
* @param options - Install/Git creation choices.
|
|
15
|
+
* @param context - Native executable, progress and cancellation authority.
|
|
16
|
+
* @returns Whether Git was initialized; owned subprocesses settle before returning.
|
|
17
|
+
*/
|
|
18
|
+
export declare const installGenerationStage: (stage: string, options: CreateOptions, context: GenerateProjectContext) => Effect.Effect<boolean, import("./generator-errors.js").GeneratorProcessError | import("./generator-errors.js").GeneratorDomainError, GeneratorProcess>;
|
|
19
|
+
/** Checks prerequisites and prepares a snapshot from one source validation.
|
|
20
|
+
* @param stage - Installed private project root.
|
|
21
|
+
* @param options - Cloud/deployment options controlling existing doctor checks.
|
|
22
|
+
* @param context - Native executable, progress and cancellation authority.
|
|
23
|
+
* @returns Finite preparation completion; failure leaves the destination unpublished.
|
|
24
|
+
*/
|
|
25
|
+
export declare const verifyGenerationStage: (stage: string, options: CreateOptions, context: GenerateProjectContext) => Effect.Effect<void, import("./generator-errors.js").GeneratorProcessError | import("./generator-errors.js").GeneratorDomainError, import("./generator-filesystem.js").GeneratorFileSystem | GeneratorProcess>;
|
|
26
|
+
//# sourceMappingURL=generate-preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-preparation.d.ts","sourceRoot":"","sources":["../src/generate-preparation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAgB1D;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,mTAmBtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,oOAuBlC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,2RA+BjC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Materializes, installs and validates a private creation stage. Finite dev
|
|
3
|
+
* --prepare owns one full check and reuses it for bundling; creation publishes
|
|
4
|
+
* only after its complete snapshot is durable. No development listener or
|
|
5
|
+
* support process is started here.
|
|
6
|
+
*/
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { Effect } from "effect";
|
|
9
|
+
import { observeExecution } from "@relkit/contracts/operation";
|
|
10
|
+
import { GeneratorProcess } from "./generator-process.js";
|
|
11
|
+
import { resolveTemplateRootEffect } from "./template-root.js";
|
|
12
|
+
import { prepareProjectDependencyPatchEffect } from "./dependency-patches.js";
|
|
13
|
+
import { domainTry } from "./generator-errors.js";
|
|
14
|
+
import { copyTemplateEffect, customizeProjectEffect, requireFilesEffect, requireTemplateEffect, } from "./generate-files.js";
|
|
15
|
+
import { injectGenerateFailure, resolveRelkitExecutableEffect, runProjectStepEffect, } from "./generate-process.js";
|
|
16
|
+
/** Copies and customizes the template before installation.
|
|
17
|
+
* @param stage - Scope-owned sibling directory.
|
|
18
|
+
* @param options - Normalized creation selection.
|
|
19
|
+
* @param context - Template and deterministic failure authority.
|
|
20
|
+
* @returns Lazy materialization; failures abort before publication.
|
|
21
|
+
*/
|
|
22
|
+
export const materializeGenerationStage = Effect.fn("ProjectGeneration.materializeStage")(function* (stage, options, context) {
|
|
23
|
+
const templateRoot = yield* resolveTemplateRootEffect(context);
|
|
24
|
+
const template = join(templateRoot, options.jobs === undefined ? options.template : "tasks");
|
|
25
|
+
yield* requireTemplateEffect(template);
|
|
26
|
+
yield* domainTry(() => injectGenerateFailure(context, "copy"));
|
|
27
|
+
yield* copyTemplateEffect(template, stage);
|
|
28
|
+
yield* domainTry(() => injectGenerateFailure(context, "substitute"));
|
|
29
|
+
yield* customizeProjectEffect(stage, options);
|
|
30
|
+
yield* requireFilesEffect(stage, [
|
|
31
|
+
"package.json",
|
|
32
|
+
"relkit.config.ts",
|
|
33
|
+
"src/platform/env.ts",
|
|
34
|
+
".env.example",
|
|
35
|
+
".gitignore",
|
|
36
|
+
]);
|
|
37
|
+
yield* prepareProjectDependencyPatchEffect(stage);
|
|
38
|
+
}, (effect) => observeExecution("generator", "generation.materializeStage", effect));
|
|
39
|
+
/** Installs dependencies and optional Git metadata inside the private stage.
|
|
40
|
+
* @param stage - Scope-owned sibling directory.
|
|
41
|
+
* @param options - Install/Git creation choices.
|
|
42
|
+
* @param context - Native executable, progress and cancellation authority.
|
|
43
|
+
* @returns Whether Git was initialized; owned subprocesses settle before returning.
|
|
44
|
+
*/
|
|
45
|
+
export const installGenerationStage = Effect.fn("ProjectGeneration.installStage")(function* (stage, options, context) {
|
|
46
|
+
if (options.install) {
|
|
47
|
+
context.onProgress?.("Installing dependencies...");
|
|
48
|
+
yield* runProjectStepEffect(context, [context.bunExecutable ?? globalThis.process.execPath, "install"], stage, "install", "install");
|
|
49
|
+
}
|
|
50
|
+
const git = context.gitExecutable ??
|
|
51
|
+
(context.commandRunner ? "git" : yield* (yield* GeneratorProcess).which("git"));
|
|
52
|
+
const gitInitialized = options.git && git !== null;
|
|
53
|
+
if (gitInitialized) {
|
|
54
|
+
context.onProgress?.("Initializing Git repository...");
|
|
55
|
+
yield* runProjectStepEffect(context, [git, "init"], stage, "git", "git");
|
|
56
|
+
}
|
|
57
|
+
return gitInitialized;
|
|
58
|
+
}, (effect) => observeExecution("generator", "generation.installStage", effect));
|
|
59
|
+
/** Checks prerequisites and prepares a snapshot from one source validation.
|
|
60
|
+
* @param stage - Installed private project root.
|
|
61
|
+
* @param options - Cloud/deployment options controlling existing doctor checks.
|
|
62
|
+
* @param context - Native executable, progress and cancellation authority.
|
|
63
|
+
* @returns Finite preparation completion; failure leaves the destination unpublished.
|
|
64
|
+
*/
|
|
65
|
+
export const verifyGenerationStage = Effect.fn("ProjectGeneration.prepareStage")(function* (stage, options, context) {
|
|
66
|
+
if (!options.install)
|
|
67
|
+
return;
|
|
68
|
+
const relkit = yield* resolveRelkitExecutableEffect(context, stage);
|
|
69
|
+
context.onProgress?.("Checking prerequisites...");
|
|
70
|
+
yield* runProjectStepEffect(context, [
|
|
71
|
+
relkit,
|
|
72
|
+
"doctor",
|
|
73
|
+
"--project-root",
|
|
74
|
+
stage,
|
|
75
|
+
"--no-ports",
|
|
76
|
+
...(options.cloud === "none" || options.deploy === "none" ? ["--no-pulumi"] : []),
|
|
77
|
+
], stage, "doctor", "doctor");
|
|
78
|
+
context.onProgress?.("Checking and preparing development snapshot...");
|
|
79
|
+
// Keep the existing check failure-injection contract. The finite command
|
|
80
|
+
// checks once and supplies its accepted result to snapshot preparation.
|
|
81
|
+
yield* runProjectStepEffect(context, [relkit, "dev", "--prepare", "--project-root", stage], stage, "prepare", "check");
|
|
82
|
+
}, (effect) => observeExecution("generator", "generation.prepareStage", effect));
|
|
83
|
+
//# sourceMappingURL=generate-preparation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-preparation.js","sourceRoot":"","sources":["../src/generate-preparation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,gBAA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