@cosmicdrift/kumiko-dev-server 0.329.0 → 0.330.0

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.
Files changed (125) hide show
  1. package/README.md +17 -0
  2. package/bin/kumiko-build.ts +3 -2
  3. package/bin/kumiko-dev.ts +1 -1
  4. package/bin/kumiko-init-deploy.ts +1 -1
  5. package/bin/kumiko-schema-check.ts +4 -1
  6. package/dist/build-server-bundle.d.ts +31 -0
  7. package/dist/build-server-bundle.js +282 -0
  8. package/dist/build.d.ts +2 -0
  9. package/dist/build.js +5 -0
  10. package/dist/cli.d.ts +5 -0
  11. package/dist/cli.js +9 -0
  12. package/dist/codegen/index.d.ts +4 -0
  13. package/dist/codegen/index.js +4 -0
  14. package/dist/codegen/render.d.ts +55 -0
  15. package/dist/codegen/render.js +273 -0
  16. package/dist/codegen/run-codegen.d.ts +20 -0
  17. package/dist/codegen/run-codegen.js +219 -0
  18. package/dist/codegen/scan-events.d.ts +76 -0
  19. package/dist/codegen/scan-events.js +447 -0
  20. package/dist/codegen/watch.d.ts +33 -0
  21. package/dist/codegen/watch.js +112 -0
  22. package/dist/compose-stacks.d.ts +60 -0
  23. package/dist/compose-stacks.js +127 -0
  24. package/dist/crash-tracker.d.ts +17 -0
  25. package/dist/crash-tracker.js +37 -0
  26. package/dist/create-kumiko-server.d.ts +195 -0
  27. package/dist/create-kumiko-server.js +1040 -0
  28. package/dist/env-schema.d.ts +15 -0
  29. package/dist/env-schema.js +60 -0
  30. package/dist/few-shot-corpus.d.ts +72 -0
  31. package/dist/few-shot-corpus.js +262 -0
  32. package/dist/framework-version.d.ts +1 -0
  33. package/dist/framework-version.js +31 -0
  34. package/dist/index.d.ts +22 -0
  35. package/dist/index.js +33 -0
  36. package/dist/init-deploy-cli.d.ts +10 -0
  37. package/dist/init-deploy-cli.js +111 -0
  38. package/dist/kebab.d.ts +1 -0
  39. package/{src/kebab.ts → dist/kebab.js} +2 -3
  40. package/dist/run-dev-app.d.ts +174 -0
  41. package/dist/run-dev-app.js +403 -0
  42. package/dist/scaffold-app-feature.d.ts +16 -0
  43. package/dist/scaffold-app-feature.js +240 -0
  44. package/dist/scaffold-app.d.ts +45 -0
  45. package/dist/scaffold-app.js +852 -0
  46. package/dist/scaffold-demo-tasks.d.ts +8 -0
  47. package/{src/scaffold-demo-tasks.ts → dist/scaffold-demo-tasks.js} +69 -98
  48. package/dist/scaffold-deploy.d.ts +92 -0
  49. package/dist/scaffold-deploy.js +254 -0
  50. package/dist/scaffold-feature.d.ts +26 -0
  51. package/dist/scaffold-feature.js +163 -0
  52. package/dist/schema-apply.d.ts +11 -0
  53. package/dist/schema-apply.js +95 -0
  54. package/dist/schema-check-core.d.ts +2 -0
  55. package/{src/schema-check-core.ts → dist/schema-check-core.js} +8 -10
  56. package/dist/schema-tables-auth-mode.d.ts +2 -0
  57. package/{src/schema-tables-auth-mode.ts → dist/schema-tables-auth-mode.js} +2 -10
  58. package/dist/schema-tables-minimal.d.ts +2 -0
  59. package/{src/schema-tables-minimal.ts → dist/schema-tables-minimal.js} +2 -11
  60. package/dist/setup-test-stack-from-features.d.ts +11 -0
  61. package/dist/setup-test-stack-from-features.js +42 -0
  62. package/dist/welcome-banner.d.ts +15 -0
  63. package/dist/welcome-banner.js +27 -0
  64. package/package.json +71 -24
  65. package/src/changes.json +6 -0
  66. package/src/__tests__/build-prod-bundle.integration.test.ts +0 -282
  67. package/src/__tests__/build-server-bundle.test.ts +0 -228
  68. package/src/__tests__/classify-change.test.ts +0 -87
  69. package/src/__tests__/compose-stacks.test.ts +0 -273
  70. package/src/__tests__/config-resolver-default.integration.test.ts +0 -165
  71. package/src/__tests__/crash-tracker.test.ts +0 -89
  72. package/src/__tests__/create-kumiko-server-errors.test.ts +0 -54
  73. package/src/__tests__/create-kumiko-server-options.test.ts +0 -33
  74. package/src/__tests__/create-kumiko-server.integration.test.ts +0 -1007
  75. package/src/__tests__/discover-format.test.ts +0 -32
  76. package/src/__tests__/env-schema.integration.test.ts +0 -248
  77. package/src/__tests__/env-schema.test.ts +0 -132
  78. package/src/__tests__/few-shot-corpus.test.ts +0 -316
  79. package/src/__tests__/framework-version.test.ts +0 -45
  80. package/src/__tests__/init-deploy-cli.test.ts +0 -113
  81. package/src/__tests__/kumiko-schema-check.test.ts +0 -56
  82. package/src/__tests__/merge-extra-context.test.ts +0 -67
  83. package/src/__tests__/resolve-stylesheet.test.ts +0 -132
  84. package/src/__tests__/run-dev-app-boot-validation.test.ts +0 -38
  85. package/src/__tests__/run-dev-app.integration.test.ts +0 -290
  86. package/src/__tests__/runtime-classification.test.ts +0 -26
  87. package/src/__tests__/saas-identity-wire.integration.test.ts +0 -427
  88. package/src/__tests__/scaffold-app-feature.test.ts +0 -216
  89. package/src/__tests__/scaffold-app.test.ts +0 -630
  90. package/src/__tests__/scaffold-demo-tasks.test.ts +0 -47
  91. package/src/__tests__/scaffold-deploy.test.ts +0 -464
  92. package/src/__tests__/scaffold-dev-cycle.integration.test.ts +0 -109
  93. package/src/__tests__/scaffold-feature.test.ts +0 -143
  94. package/src/__tests__/schema-apply.integration.test.ts +0 -191
  95. package/src/__tests__/setup-test-stack-from-features.integration.test.ts +0 -30
  96. package/src/__tests__/setup-test-stack-job-run-logger.integration.test.ts +0 -72
  97. package/src/__tests__/walkthrough.integration.test.ts +0 -140
  98. package/src/__tests__/welcome-banner.test.ts +0 -42
  99. package/src/build-server-bundle.ts +0 -346
  100. package/src/build.ts +0 -28
  101. package/src/codegen/__tests__/render-codegen.test.ts +0 -100
  102. package/src/codegen/__tests__/run-codegen.test.ts +0 -665
  103. package/src/codegen/__tests__/strict-mode-diagnostics.test.ts +0 -347
  104. package/src/codegen/__tests__/watch.test.ts +0 -222
  105. package/src/codegen/index.ts +0 -19
  106. package/src/codegen/render.ts +0 -305
  107. package/src/codegen/run-codegen.ts +0 -278
  108. package/src/codegen/scan-events.ts +0 -565
  109. package/src/codegen/watch.ts +0 -140
  110. package/src/compose-stacks.ts +0 -193
  111. package/src/crash-tracker.ts +0 -56
  112. package/src/create-kumiko-server.ts +0 -1397
  113. package/src/env-schema.ts +0 -72
  114. package/src/few-shot-corpus.ts +0 -370
  115. package/src/framework-version.ts +0 -39
  116. package/src/index.ts +0 -105
  117. package/src/init-deploy-cli.ts +0 -148
  118. package/src/run-dev-app.ts +0 -694
  119. package/src/scaffold-app-feature.ts +0 -283
  120. package/src/scaffold-app.ts +0 -1033
  121. package/src/scaffold-deploy.ts +0 -393
  122. package/src/scaffold-feature.ts +0 -226
  123. package/src/schema-apply.ts +0 -123
  124. package/src/setup-test-stack-from-features.ts +0 -80
  125. package/src/welcome-banner.ts +0 -43
@@ -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
- }