@cosmicdrift/kumiko-dev-server 0.329.0 → 0.330.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/bin/kumiko-build.ts +3 -2
- package/bin/kumiko-dev.ts +1 -1
- package/bin/kumiko-init-deploy.ts +1 -1
- package/bin/kumiko-schema-check.ts +4 -1
- package/dist/build-server-bundle.d.ts +31 -0
- package/dist/build-server-bundle.js +282 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.js +5 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +9 -0
- package/dist/codegen/index.d.ts +4 -0
- package/dist/codegen/index.js +4 -0
- package/dist/codegen/render.d.ts +55 -0
- package/dist/codegen/render.js +273 -0
- package/dist/codegen/run-codegen.d.ts +20 -0
- package/dist/codegen/run-codegen.js +219 -0
- package/dist/codegen/scan-events.d.ts +76 -0
- package/dist/codegen/scan-events.js +447 -0
- package/dist/codegen/watch.d.ts +33 -0
- package/dist/codegen/watch.js +112 -0
- package/dist/compose-stacks.d.ts +60 -0
- package/dist/compose-stacks.js +127 -0
- package/dist/crash-tracker.d.ts +17 -0
- package/dist/crash-tracker.js +37 -0
- package/dist/create-kumiko-server.d.ts +195 -0
- package/dist/create-kumiko-server.js +1040 -0
- package/dist/env-schema.d.ts +15 -0
- package/dist/env-schema.js +60 -0
- package/dist/few-shot-corpus.d.ts +72 -0
- package/dist/few-shot-corpus.js +262 -0
- package/dist/framework-version.d.ts +1 -0
- package/dist/framework-version.js +31 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +33 -0
- package/dist/init-deploy-cli.d.ts +10 -0
- package/dist/init-deploy-cli.js +111 -0
- package/dist/kebab.d.ts +1 -0
- package/{src/kebab.ts → dist/kebab.js} +2 -3
- package/dist/run-dev-app.d.ts +174 -0
- package/dist/run-dev-app.js +403 -0
- package/dist/scaffold-app-feature.d.ts +16 -0
- package/dist/scaffold-app-feature.js +240 -0
- package/dist/scaffold-app.d.ts +45 -0
- package/dist/scaffold-app.js +852 -0
- package/dist/scaffold-demo-tasks.d.ts +8 -0
- package/{src/scaffold-demo-tasks.ts → dist/scaffold-demo-tasks.js} +69 -98
- package/dist/scaffold-deploy.d.ts +92 -0
- package/dist/scaffold-deploy.js +254 -0
- package/dist/scaffold-feature.d.ts +26 -0
- package/dist/scaffold-feature.js +163 -0
- package/dist/schema-apply.d.ts +11 -0
- package/dist/schema-apply.js +95 -0
- package/dist/schema-check-core.d.ts +2 -0
- package/{src/schema-check-core.ts → dist/schema-check-core.js} +8 -10
- package/dist/schema-tables-auth-mode.d.ts +2 -0
- package/{src/schema-tables-auth-mode.ts → dist/schema-tables-auth-mode.js} +2 -10
- package/dist/schema-tables-minimal.d.ts +2 -0
- package/{src/schema-tables-minimal.ts → dist/schema-tables-minimal.js} +2 -11
- package/dist/setup-test-stack-from-features.d.ts +11 -0
- package/dist/setup-test-stack-from-features.js +42 -0
- package/dist/welcome-banner.d.ts +15 -0
- package/dist/welcome-banner.js +27 -0
- package/package.json +71 -24
- package/src/changes.json +6 -0
- package/src/__tests__/build-prod-bundle.integration.test.ts +0 -282
- package/src/__tests__/build-server-bundle.test.ts +0 -228
- package/src/__tests__/classify-change.test.ts +0 -87
- package/src/__tests__/compose-stacks.test.ts +0 -273
- package/src/__tests__/config-resolver-default.integration.test.ts +0 -165
- package/src/__tests__/crash-tracker.test.ts +0 -89
- package/src/__tests__/create-kumiko-server-errors.test.ts +0 -54
- package/src/__tests__/create-kumiko-server-options.test.ts +0 -33
- package/src/__tests__/create-kumiko-server.integration.test.ts +0 -1007
- package/src/__tests__/discover-format.test.ts +0 -32
- package/src/__tests__/env-schema.integration.test.ts +0 -248
- package/src/__tests__/env-schema.test.ts +0 -132
- package/src/__tests__/few-shot-corpus.test.ts +0 -316
- package/src/__tests__/framework-version.test.ts +0 -45
- package/src/__tests__/init-deploy-cli.test.ts +0 -113
- package/src/__tests__/kumiko-schema-check.test.ts +0 -56
- package/src/__tests__/merge-extra-context.test.ts +0 -67
- package/src/__tests__/resolve-stylesheet.test.ts +0 -132
- package/src/__tests__/run-dev-app-boot-validation.test.ts +0 -38
- package/src/__tests__/run-dev-app.integration.test.ts +0 -290
- package/src/__tests__/runtime-classification.test.ts +0 -26
- package/src/__tests__/saas-identity-wire.integration.test.ts +0 -427
- package/src/__tests__/scaffold-app-feature.test.ts +0 -216
- package/src/__tests__/scaffold-app.test.ts +0 -630
- package/src/__tests__/scaffold-demo-tasks.test.ts +0 -47
- package/src/__tests__/scaffold-deploy.test.ts +0 -464
- package/src/__tests__/scaffold-dev-cycle.integration.test.ts +0 -109
- package/src/__tests__/scaffold-feature.test.ts +0 -143
- package/src/__tests__/schema-apply.integration.test.ts +0 -191
- package/src/__tests__/setup-test-stack-from-features.integration.test.ts +0 -30
- package/src/__tests__/setup-test-stack-job-run-logger.integration.test.ts +0 -72
- package/src/__tests__/walkthrough.integration.test.ts +0 -140
- package/src/__tests__/welcome-banner.test.ts +0 -42
- package/src/build-server-bundle.ts +0 -346
- package/src/build.ts +0 -28
- package/src/codegen/__tests__/render-codegen.test.ts +0 -100
- package/src/codegen/__tests__/run-codegen.test.ts +0 -665
- package/src/codegen/__tests__/strict-mode-diagnostics.test.ts +0 -347
- package/src/codegen/__tests__/watch.test.ts +0 -222
- package/src/codegen/index.ts +0 -19
- package/src/codegen/render.ts +0 -305
- package/src/codegen/run-codegen.ts +0 -278
- package/src/codegen/scan-events.ts +0 -565
- package/src/codegen/watch.ts +0 -140
- package/src/compose-stacks.ts +0 -193
- package/src/crash-tracker.ts +0 -56
- package/src/create-kumiko-server.ts +0 -1397
- package/src/env-schema.ts +0 -72
- package/src/few-shot-corpus.ts +0 -370
- package/src/framework-version.ts +0 -39
- package/src/index.ts +0 -105
- package/src/init-deploy-cli.ts +0 -148
- package/src/run-dev-app.ts +0 -694
- package/src/scaffold-app-feature.ts +0 -283
- package/src/scaffold-app.ts +0 -1033
- package/src/scaffold-deploy.ts +0 -393
- package/src/scaffold-feature.ts +0 -226
- package/src/schema-apply.ts +0 -123
- package/src/setup-test-stack-from-features.ts +0 -80
- package/src/welcome-banner.ts +0 -43
package/src/init-deploy-cli.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// `kumiko-init-deploy` CLI — the shared implementation behind both the
|
|
2
|
-
// standalone `kumiko-init-deploy` bin (published, app-facing) and the
|
|
3
|
-
// monorepo's `bin/commands/init-deploy.ts` (delegates here, no duplicated
|
|
4
|
-
// logic).
|
|
5
|
-
|
|
6
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
-
import { join, relative } from "node:path";
|
|
8
|
-
import {
|
|
9
|
-
getFlag,
|
|
10
|
-
getNumberFlag,
|
|
11
|
-
getStringFlag,
|
|
12
|
-
parseArgs,
|
|
13
|
-
} from "@cosmicdrift/kumiko-framework/arg-parser";
|
|
14
|
-
import * as z from "zod";
|
|
15
|
-
import { checkDeployDrift, type ScaffoldedFile, scaffoldDeploy } from "./scaffold-deploy";
|
|
16
|
-
|
|
17
|
-
export type CliOutput = {
|
|
18
|
-
readonly log: (msg: string) => void;
|
|
19
|
-
readonly err: (msg: string) => void;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type RunInitDeployCliOptions = {
|
|
23
|
-
readonly argv: readonly string[];
|
|
24
|
-
readonly cwd: string;
|
|
25
|
-
readonly out: CliOutput;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const USAGE =
|
|
29
|
-
"Usage: kumiko-init-deploy --app <name> [--port <n>] [--github-org <org>] [--out <dir>] [--force | --check]";
|
|
30
|
-
|
|
31
|
-
const packageNameSchema = z.object({ name: z.string().optional() });
|
|
32
|
-
|
|
33
|
-
/** package.json `name` without its `@scope/` prefix, if present and valid. */
|
|
34
|
-
function defaultAppName(cwd: string): string | undefined {
|
|
35
|
-
const pkgPath = join(cwd, "package.json");
|
|
36
|
-
if (!existsSync(pkgPath)) return undefined;
|
|
37
|
-
try {
|
|
38
|
-
const pkg = packageNameSchema.parse(JSON.parse(readFileSync(pkgPath, "utf-8")));
|
|
39
|
-
if (!pkg.name) return undefined;
|
|
40
|
-
const slash = pkg.name.indexOf("/");
|
|
41
|
-
return pkg.name.startsWith("@") && slash !== -1 ? pkg.name.slice(slash + 1) : pkg.name;
|
|
42
|
-
} catch {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
type DeployTarget = {
|
|
48
|
-
readonly appName: string;
|
|
49
|
-
readonly port: number | undefined;
|
|
50
|
-
readonly githubOrg: string | undefined;
|
|
51
|
-
readonly destination: string;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
function targetOptions({ appName, port, githubOrg, destination }: DeployTarget) {
|
|
55
|
-
return {
|
|
56
|
-
appName,
|
|
57
|
-
...(port !== undefined && { port }),
|
|
58
|
-
...(githubOrg !== undefined && { githubOrg }),
|
|
59
|
-
destination,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function reportDrift(target: DeployTarget, out: CliOutput): number {
|
|
64
|
-
const result = checkDeployDrift(targetOptions(target));
|
|
65
|
-
if (result.drifted.length === 0) {
|
|
66
|
-
out.log(" ✓ deploy/ is in sync with the current templates.");
|
|
67
|
-
return 0;
|
|
68
|
-
}
|
|
69
|
-
out.err("");
|
|
70
|
-
out.err(` ✗ ${result.drifted.length} drifted file(s):`);
|
|
71
|
-
for (const d of result.drifted) {
|
|
72
|
-
out.err(` ${relative(target.destination, d.path)} — ${d.reason}`);
|
|
73
|
-
}
|
|
74
|
-
out.err("");
|
|
75
|
-
out.err(" run kumiko-init-deploy --force to regenerate.");
|
|
76
|
-
out.err("");
|
|
77
|
-
return 1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function fileMarker(file: ScaffoldedFile): string {
|
|
81
|
-
if (!file.written) return "SKIPPED ";
|
|
82
|
-
return file.reason === "force" ? "OVERWRITTEN" : "WRITTEN ";
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function reportScaffold(target: DeployTarget, force: boolean, out: CliOutput): number {
|
|
86
|
-
const result = scaffoldDeploy({ ...targetOptions(target), force });
|
|
87
|
-
out.log("");
|
|
88
|
-
out.log(` ✓ Deploy scaffolding generated — ${target.appName}`);
|
|
89
|
-
for (const f of result.files) {
|
|
90
|
-
out.log(` ${fileMarker(f)} ${relative(target.destination, f.path)}`);
|
|
91
|
-
}
|
|
92
|
-
if (result.files.some((f) => !f.written)) {
|
|
93
|
-
out.log("");
|
|
94
|
-
out.log(
|
|
95
|
-
" Some files were skipped because they already exist. Re-run with --force to overwrite.",
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
out.log("");
|
|
99
|
-
out.log(" Next steps:");
|
|
100
|
-
out.log(" 1. Review deploy/Dockerfile — adjust if your app needs extra COPY/ENV steps.");
|
|
101
|
-
out.log(" 2. Wire your image-build workflow to build deploy/Dockerfile and push it.");
|
|
102
|
-
out.log(" 3. Configure the runtime env-vars for your platform.");
|
|
103
|
-
out.log("");
|
|
104
|
-
return 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export async function runInitDeployCli({
|
|
108
|
-
argv,
|
|
109
|
-
cwd,
|
|
110
|
-
out,
|
|
111
|
-
}: RunInitDeployCliOptions): Promise<number> {
|
|
112
|
-
const args = parseArgs(argv);
|
|
113
|
-
const force = getFlag(args, "force");
|
|
114
|
-
const check = getFlag(args, "check");
|
|
115
|
-
if (force && check) {
|
|
116
|
-
out.err("");
|
|
117
|
-
out.err(" --check and --force are mutually exclusive.");
|
|
118
|
-
out.err(` ${USAGE}`);
|
|
119
|
-
out.err("");
|
|
120
|
-
return 2;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const appName = getStringFlag(args, "app") ?? defaultAppName(cwd);
|
|
124
|
-
if (!appName) {
|
|
125
|
-
out.err("");
|
|
126
|
-
out.err(' --app <name> is required (no package.json "name" found to default from).');
|
|
127
|
-
out.err(` ${USAGE}`);
|
|
128
|
-
out.err("");
|
|
129
|
-
return 1;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const target: DeployTarget = {
|
|
133
|
-
appName,
|
|
134
|
-
port: getNumberFlag(args, "port"),
|
|
135
|
-
githubOrg: getStringFlag(args, "github-org"),
|
|
136
|
-
destination: getStringFlag(args, "out") ?? cwd,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
return check ? reportDrift(target, out) : reportScaffold(target, force, out);
|
|
141
|
-
} catch (err) {
|
|
142
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
143
|
-
out.err("");
|
|
144
|
-
out.err(` ${msg}`);
|
|
145
|
-
out.err("");
|
|
146
|
-
return 1;
|
|
147
|
-
}
|
|
148
|
-
}
|