@codemation/cli 0.0.21 → 0.0.24
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 +34 -0
- package/dist/{CliBin-BYHuUedo.js → CliBin-CWXW_92Y.js} +116 -32
- package/dist/bin.js +1 -1
- package/dist/index.d.ts +8661 -1741
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/CliProgramFactory.ts +3 -0
- package/src/bootstrap/CodemationCliApplicationSession.ts +3 -3
- package/src/commands/DevCommand.ts +20 -20
- package/src/database/ConsumerDatabaseConnectionResolver.ts +10 -10
- package/src/database/DatabaseMigrationsApplyService.ts +1 -1
- package/src/database/HostPackageRootResolver.ts +2 -2
- package/src/database/PrismaMigrateDeployInvoker.ts +3 -2
- package/src/dev/CliDevProxyServer.ts +3 -6
- package/src/dev/DevCliBannerRenderer.ts +39 -0
- package/src/dev/DevNextChildProcessOutputFilter.ts +30 -0
- package/src/dev/DevNextHostEnvironmentBuilder.ts +1 -0
- package/src/dev/DevNextStartupBannerLineFilter.ts +25 -0
- package/src/user/CliDatabaseUrlDescriptor.ts +1 -1
- package/src/user/UserAdminCliBootstrap.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @codemation/cli
|
|
2
2
|
|
|
3
|
+
## 0.0.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`a72444e`](https://github.com/MadeRelevant/codemation/commit/a72444e25c4e744a9a90e231a59c93f8d90346e5), [`a72444e`](https://github.com/MadeRelevant/codemation/commit/a72444e25c4e744a9a90e231a59c93f8d90346e5)]:
|
|
8
|
+
- @codemation/host@0.1.2
|
|
9
|
+
- @codemation/next-host@0.1.2
|
|
10
|
+
|
|
11
|
+
## 0.0.23
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`cbfe843`](https://github.com/MadeRelevant/codemation/commit/cbfe843ef2363e400a219f4d0bcd05b091ab83b4)]:
|
|
16
|
+
- @codemation/host@0.1.1
|
|
17
|
+
- @codemation/next-host@0.1.1
|
|
18
|
+
|
|
19
|
+
## 0.0.22
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#35](https://github.com/MadeRelevant/codemation/pull/35) [`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff) Thanks [@cblokland90](https://github.com/cblokland90)! - Route `/api/auth/*` on the dev gateway to the disposable API runtime (same as other `/api/*` routes) so host-owned Better Auth is not bounced through the Next UI process. Avoids gateway↔Next proxy loops when `CODEMATION_RUNTIME_DEV_URL` points at the stable dev URL.
|
|
24
|
+
|
|
25
|
+
- [#35](https://github.com/MadeRelevant/codemation/pull/35) [`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff) Thanks [@cblokland90](https://github.com/cblokland90)! - Replace the local-development `pglite` path with SQLite across the host, CLI, scaffolding templates, and packaged dev flows while keeping PostgreSQL for production-aligned and shared integration scenarios.
|
|
26
|
+
|
|
27
|
+
Split Prisma into provider-specific PostgreSQL and SQLite schema and migration tracks so generated clients and startup migrations select the correct backend without the old `pglite` socket adapter.
|
|
28
|
+
|
|
29
|
+
- [#35](https://github.com/MadeRelevant/codemation/pull/35) [`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff) Thanks [@cblokland90](https://github.com/cblokland90)! - Move browser auth/session ownership into `@codemation/host` and make `@codemation/next-host` a thin UI client over the backend `/api/auth/*` surface.
|
|
30
|
+
|
|
31
|
+
Update packaged dev/scaffolded flows so the CLI provides the public base URL and auth secret wiring needed for the new backend-owned session flow, and refresh the templates/docs to match the clean cutover away from the legacy NextAuth runtime.
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff), [`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff), [`75b885b`](https://github.com/MadeRelevant/codemation/commit/75b885b111cc34ffe3a192ca9cc8cd3864fdf8ff)]:
|
|
34
|
+
- @codemation/host@0.1.0
|
|
35
|
+
- @codemation/next-host@0.1.0
|
|
36
|
+
|
|
3
37
|
## 0.0.21
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import process$1 from "node:process";
|
|
3
3
|
import { AppConfigLoader, CodemationConsumerConfigLoader, CodemationPluginDiscovery, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder } from "@codemation/host/server";
|
|
4
|
-
import { ApiPaths, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationPluginPackageMetadata, DatabaseMigrations, ListUserAccountsQuery,
|
|
4
|
+
import { ApiPaths, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationPluginPackageMetadata, DatabaseMigrations, ListUserAccountsQuery, UpsertLocalBootstrapUserCommand, WorkerRuntime } from "@codemation/host";
|
|
5
5
|
import { AppContainerFactory as AppContainerFactory$1, AppContainerLifecycle as AppContainerLifecycle$1, CodemationHonoApiApp, CodemationPluginListMerger, FrontendRuntime, ServerLoggerFactory, logLevelPolicyFactory } from "@codemation/host/next/server";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { access, copyFile, cp, mkdir, open, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -16,6 +16,7 @@ import { PrismaMigrationDeployer } from "@codemation/host/persistence";
|
|
|
16
16
|
import boxen from "boxen";
|
|
17
17
|
import chalk from "chalk";
|
|
18
18
|
import figlet from "figlet";
|
|
19
|
+
import { createInterface } from "node:readline";
|
|
19
20
|
import { createServer } from "node:http";
|
|
20
21
|
import httpProxy from "http-proxy";
|
|
21
22
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -128,7 +129,7 @@ var DbMigrateCommand = class {
|
|
|
128
129
|
//#region src/commands/DevCommand.ts
|
|
129
130
|
var DevCommand = class {
|
|
130
131
|
require = createRequire(import.meta.url);
|
|
131
|
-
constructor(pathResolver, tsRuntime, devLockFactory, devSourceWatcherFactory, cliLogger, session, databaseMigrationsApplyService, consumerOutputBuilderFactory, pluginDiscovery, consumerBuildArtifactsPublisher, devBootstrapSummaryFetcher, devCliBannerRenderer, consumerEnvDotenvFilePredicate, devTrackedProcessTreeKiller, nextHostConsumerServerCommandFactory, devApiRuntimeFactory, cliDevProxyServerFactory, devRebuildQueueFactory) {
|
|
132
|
+
constructor(pathResolver, tsRuntime, devLockFactory, devSourceWatcherFactory, cliLogger, session, databaseMigrationsApplyService, consumerOutputBuilderFactory, pluginDiscovery, consumerBuildArtifactsPublisher, devBootstrapSummaryFetcher, devCliBannerRenderer, consumerEnvDotenvFilePredicate, devTrackedProcessTreeKiller, nextHostConsumerServerCommandFactory, devApiRuntimeFactory, cliDevProxyServerFactory, devRebuildQueueFactory, devNextChildProcessOutputFilter) {
|
|
132
133
|
this.pathResolver = pathResolver;
|
|
133
134
|
this.tsRuntime = tsRuntime;
|
|
134
135
|
this.devLockFactory = devLockFactory;
|
|
@@ -147,6 +148,7 @@ var DevCommand = class {
|
|
|
147
148
|
this.devApiRuntimeFactory = devApiRuntimeFactory;
|
|
148
149
|
this.cliDevProxyServerFactory = cliDevProxyServerFactory;
|
|
149
150
|
this.devRebuildQueueFactory = devRebuildQueueFactory;
|
|
151
|
+
this.devNextChildProcessOutputFilter = devNextChildProcessOutputFilter;
|
|
150
152
|
}
|
|
151
153
|
async execute(args) {
|
|
152
154
|
const paths = await this.pathResolver.resolve(args.consumerRoot);
|
|
@@ -185,11 +187,11 @@ var DevCommand = class {
|
|
|
185
187
|
await this.startPackagedUiWhenNeeded(prepared, processState, uiProxyBase);
|
|
186
188
|
this.bindShutdownSignalsToChildProcesses(processState, proxyServer);
|
|
187
189
|
await this.spawnDevUiWhenNeeded(prepared, processState, gatewayBaseUrl);
|
|
190
|
+
this.devCliBannerRenderer.renderGatewayListeningHint(prepared.devMode === "watch-framework" ? prepared.nextPort : prepared.gatewayPort, commandName, prepared.devMode, prepared.devMode === "watch-framework" ? prepared.gatewayPort : void 0);
|
|
188
191
|
await this.startWatcherForSourceRestart(prepared, processState, watcher, devMode, gatewayBaseUrl, proxyServer, {
|
|
189
192
|
commandName,
|
|
190
193
|
configPathOverride: args.configPathOverride
|
|
191
194
|
});
|
|
192
|
-
this.logPackagedUiDevHintWhenNeeded(devMode, gatewayPort, commandName);
|
|
193
195
|
await stopPromise;
|
|
194
196
|
} finally {
|
|
195
197
|
if (previousDevelopmentServerToken === void 0) delete process$1.env.CODEMATION_DEV_SERVER_TOKEN;
|
|
@@ -265,9 +267,10 @@ var DevCommand = class {
|
|
|
265
267
|
});
|
|
266
268
|
state.currentPackagedUi = spawn(nextHostCommand.command, nextHostCommand.args, {
|
|
267
269
|
cwd: nextHostCommand.cwd,
|
|
268
|
-
...this.
|
|
270
|
+
...this.devDetachedChildSpawnPipeOptions(),
|
|
269
271
|
env: nextHostEnvironment
|
|
270
272
|
});
|
|
273
|
+
this.devNextChildProcessOutputFilter.attach(state.currentPackagedUi);
|
|
271
274
|
state.currentPackagedUi.on("error", (error) => {
|
|
272
275
|
if (state.stopRequested || state.isRestartingUi) return;
|
|
273
276
|
state.stopRequested = true;
|
|
@@ -296,13 +299,25 @@ var DevCommand = class {
|
|
|
296
299
|
});
|
|
297
300
|
proxyServer.setBuildStatus("idle");
|
|
298
301
|
}
|
|
299
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Next startup lines are filtered (see {@link DevNextChildProcessOutputFilter}) so the CLI can
|
|
304
|
+
* own the primary “open this URL” message without the internal loopback port dominating stdout.
|
|
305
|
+
*/
|
|
306
|
+
devDetachedChildSpawnPipeOptions() {
|
|
300
307
|
return process$1.platform === "win32" ? {
|
|
301
|
-
stdio:
|
|
308
|
+
stdio: [
|
|
309
|
+
"ignore",
|
|
310
|
+
"pipe",
|
|
311
|
+
"pipe"
|
|
312
|
+
],
|
|
302
313
|
detached: true,
|
|
303
314
|
windowsHide: true
|
|
304
315
|
} : {
|
|
305
|
-
stdio:
|
|
316
|
+
stdio: [
|
|
317
|
+
"ignore",
|
|
318
|
+
"pipe",
|
|
319
|
+
"pipe"
|
|
320
|
+
],
|
|
306
321
|
detached: true
|
|
307
322
|
};
|
|
308
323
|
}
|
|
@@ -349,9 +364,10 @@ var DevCommand = class {
|
|
|
349
364
|
"dev"
|
|
350
365
|
], {
|
|
351
366
|
cwd: nextHostRoot,
|
|
352
|
-
...this.
|
|
367
|
+
...this.devDetachedChildSpawnPipeOptions(),
|
|
353
368
|
env: nextHostEnvironment
|
|
354
369
|
});
|
|
370
|
+
this.devNextChildProcessOutputFilter.attach(state.currentDevUi);
|
|
355
371
|
state.currentDevUi.on("exit", (code) => {
|
|
356
372
|
const normalizedCode = code ?? 0;
|
|
357
373
|
if (state.stopRequested || state.isRestartingUi) return;
|
|
@@ -496,10 +512,6 @@ var DevCommand = class {
|
|
|
496
512
|
await this.consumerBuildArtifactsPublisher.publish(snapshot, discoveredPlugins);
|
|
497
513
|
this.cliLogger.debug(`Dev: consumer output published (${snapshot.buildVersion}).`);
|
|
498
514
|
}
|
|
499
|
-
logPackagedUiDevHintWhenNeeded(devMode, gatewayPort, commandName) {
|
|
500
|
-
if (devMode !== "packaged-ui") return;
|
|
501
|
-
this.cliLogger.info(`codemation ${commandName}: open http://127.0.0.1:${gatewayPort} — this uses the packaged @codemation/next-host UI. Use \`codemation ${commandName} --watch-framework\` only when working on the framework UI itself.`);
|
|
502
|
-
}
|
|
503
515
|
};
|
|
504
516
|
|
|
505
517
|
//#endregion
|
|
@@ -1331,7 +1343,7 @@ var ConsumerOutputBuilderFactory = class {
|
|
|
1331
1343
|
//#endregion
|
|
1332
1344
|
//#region src/database/ConsumerDatabaseConnectionResolver.ts
|
|
1333
1345
|
/**
|
|
1334
|
-
* Resolves TCP PostgreSQL vs
|
|
1346
|
+
* Resolves TCP PostgreSQL vs SQLite vs none from env + {@link CodemationConfig} (same rules as the host runtime).
|
|
1335
1347
|
*/
|
|
1336
1348
|
var ConsumerDatabaseConnectionResolver = class {
|
|
1337
1349
|
resolve(processEnv, config$1, consumerRoot) {
|
|
@@ -1346,24 +1358,24 @@ var ConsumerDatabaseConnectionResolver = class {
|
|
|
1346
1358
|
};
|
|
1347
1359
|
}
|
|
1348
1360
|
return {
|
|
1349
|
-
kind: "
|
|
1350
|
-
|
|
1361
|
+
kind: "sqlite",
|
|
1362
|
+
databaseFilePath: this.resolveSqliteFilePath(database.sqliteFilePath, processEnv, consumerRoot)
|
|
1351
1363
|
};
|
|
1352
1364
|
}
|
|
1353
1365
|
resolveDatabaseKind(configuredKind, databaseUrl, env) {
|
|
1354
1366
|
const kindFromEnv = env.CODEMATION_DATABASE_KIND?.trim();
|
|
1355
|
-
if (kindFromEnv === "postgresql" || kindFromEnv === "
|
|
1367
|
+
if (kindFromEnv === "postgresql" || kindFromEnv === "sqlite") return kindFromEnv;
|
|
1356
1368
|
if (configuredKind) return configuredKind;
|
|
1357
1369
|
const trimmedUrl = databaseUrl?.trim();
|
|
1358
1370
|
if (trimmedUrl && (trimmedUrl.startsWith("postgresql://") || trimmedUrl.startsWith("postgres://"))) return "postgresql";
|
|
1359
|
-
return "
|
|
1371
|
+
return "sqlite";
|
|
1360
1372
|
}
|
|
1361
|
-
|
|
1362
|
-
const envPath = env.
|
|
1373
|
+
resolveSqliteFilePath(configuredPath, env, consumerRoot) {
|
|
1374
|
+
const envPath = env.CODEMATION_SQLITE_FILE_PATH?.trim();
|
|
1363
1375
|
if (envPath && envPath.length > 0) return path.isAbsolute(envPath) ? envPath : path.resolve(consumerRoot, envPath);
|
|
1364
1376
|
const trimmedConfiguredPath = configuredPath?.trim();
|
|
1365
1377
|
if (trimmedConfiguredPath && trimmedConfiguredPath.length > 0) return path.isAbsolute(trimmedConfiguredPath) ? trimmedConfiguredPath : path.resolve(consumerRoot, trimmedConfiguredPath);
|
|
1366
|
-
return path.resolve(consumerRoot, ".codemation", "
|
|
1378
|
+
return path.resolve(consumerRoot, ".codemation", "codemation.sqlite");
|
|
1367
1379
|
}
|
|
1368
1380
|
};
|
|
1369
1381
|
|
|
@@ -1405,7 +1417,7 @@ var DatabaseMigrationsApplyService = class {
|
|
|
1405
1417
|
});
|
|
1406
1418
|
const persistence = this.databaseConnectionResolver.resolve(process.env, resolution.config, consumerRoot);
|
|
1407
1419
|
if (persistence.kind === "none") {
|
|
1408
|
-
if (requirePersistence) throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or
|
|
1420
|
+
if (requirePersistence) throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or SQLite file path).");
|
|
1409
1421
|
return;
|
|
1410
1422
|
}
|
|
1411
1423
|
process.env.CODEMATION_HOST_PACKAGE_ROOT = this.hostPackageRoot;
|
|
@@ -1427,12 +1439,12 @@ var HostPackageRootResolver = class {
|
|
|
1427
1439
|
const entry = fileURLToPath(import.meta.resolve("@codemation/host"));
|
|
1428
1440
|
let dir = path.dirname(entry);
|
|
1429
1441
|
for (let depth = 0; depth < 8; depth += 1) {
|
|
1430
|
-
if (existsSync(path.join(dir, "prisma", "schema.prisma"))) return dir;
|
|
1442
|
+
if (existsSync(path.join(dir, "prisma", "schema.postgresql.prisma"))) return dir;
|
|
1431
1443
|
const parent = path.dirname(dir);
|
|
1432
1444
|
if (parent === dir) break;
|
|
1433
1445
|
dir = parent;
|
|
1434
1446
|
}
|
|
1435
|
-
throw new Error(`Could not locate prisma/schema.prisma near @codemation/host entry: ${entry}`);
|
|
1447
|
+
throw new Error(`Could not locate prisma/schema.postgresql.prisma near @codemation/host entry: ${entry}`);
|
|
1436
1448
|
}
|
|
1437
1449
|
};
|
|
1438
1450
|
|
|
@@ -1505,6 +1517,37 @@ var DevCliBannerRenderer = class {
|
|
|
1505
1517
|
this.renderRuntimeSummary(summary);
|
|
1506
1518
|
}
|
|
1507
1519
|
/**
|
|
1520
|
+
* URL to open in the browser: packaged UI uses the CLI gateway port; watch-framework uses the
|
|
1521
|
+
* Next.js dev port (PORT). When they differ, {@link devGatewayPort} is shown in the footer.
|
|
1522
|
+
*/
|
|
1523
|
+
renderGatewayListeningHint(browserPort, commandName, devMode, devGatewayPort) {
|
|
1524
|
+
const url = `http://127.0.0.1:${browserPort}`;
|
|
1525
|
+
const footer = devMode === "watch-framework" ? chalk.dim(devGatewayPort !== void 0 && devGatewayPort !== browserPort ? `The dev gateway (API + runtime) is at http://127.0.0.1:${devGatewayPort}. Open the URL above for the Next.js UI (HMR).` : "Open the URL above for the Next.js UI.") : chalk.dim(`The UI is served through this URL (not the internal Next port). Framework UI work in the monorepo: \`codemation ${commandName} --watch-framework\`.`);
|
|
1526
|
+
const box = boxen([
|
|
1527
|
+
chalk.whiteBright.bold("Codemation is running"),
|
|
1528
|
+
"",
|
|
1529
|
+
`${chalk.hex("#9ca3af")("Open in your browser:")} ${chalk.greenBright.underline(url)}`,
|
|
1530
|
+
"",
|
|
1531
|
+
footer
|
|
1532
|
+
].join("\n"), {
|
|
1533
|
+
padding: {
|
|
1534
|
+
top: 0,
|
|
1535
|
+
bottom: 0,
|
|
1536
|
+
left: 1,
|
|
1537
|
+
right: 1
|
|
1538
|
+
},
|
|
1539
|
+
margin: {
|
|
1540
|
+
top: 1,
|
|
1541
|
+
bottom: 0
|
|
1542
|
+
},
|
|
1543
|
+
borderStyle: "double",
|
|
1544
|
+
borderColor: "green",
|
|
1545
|
+
title: chalk.bold("Codemation dev"),
|
|
1546
|
+
titleAlignment: "center"
|
|
1547
|
+
});
|
|
1548
|
+
process.stdout.write(`${box}\n`);
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1508
1551
|
* Shown after hot reload / watcher restarts (no figlet).
|
|
1509
1552
|
*/
|
|
1510
1553
|
renderCompact(summary) {
|
|
@@ -1586,6 +1629,50 @@ var DevCliBannerRenderer = class {
|
|
|
1586
1629
|
}
|
|
1587
1630
|
};
|
|
1588
1631
|
|
|
1632
|
+
//#endregion
|
|
1633
|
+
//#region src/dev/DevNextChildProcessOutputFilter.ts
|
|
1634
|
+
/**
|
|
1635
|
+
* Attaches to a spawned Next child process and forwards streams while dropping
|
|
1636
|
+
* {@link DevNextStartupBannerLineFilter} matches (startup banner only).
|
|
1637
|
+
*/
|
|
1638
|
+
var DevNextChildProcessOutputFilter = class {
|
|
1639
|
+
constructor(lineFilter) {
|
|
1640
|
+
this.lineFilter = lineFilter;
|
|
1641
|
+
}
|
|
1642
|
+
attach(child) {
|
|
1643
|
+
this.pipeFilteredStream(child.stdout, process.stdout);
|
|
1644
|
+
this.pipeFilteredStream(child.stderr, process.stderr);
|
|
1645
|
+
}
|
|
1646
|
+
pipeFilteredStream(source, sink) {
|
|
1647
|
+
if (!source) return;
|
|
1648
|
+
createInterface({
|
|
1649
|
+
input: source,
|
|
1650
|
+
crlfDelay: Infinity
|
|
1651
|
+
}).on("line", (line) => {
|
|
1652
|
+
if (this.lineFilter.shouldSuppress(line)) return;
|
|
1653
|
+
sink.write(`${line}\n`);
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
//#endregion
|
|
1659
|
+
//#region src/dev/DevNextStartupBannerLineFilter.ts
|
|
1660
|
+
/**
|
|
1661
|
+
* Filters noisy Next.js `next start` / `next dev` startup lines so the CLI can
|
|
1662
|
+
* surface the Codemation gateway URL as the primary “where to browse” signal.
|
|
1663
|
+
*/
|
|
1664
|
+
var DevNextStartupBannerLineFilter = class {
|
|
1665
|
+
shouldSuppress(line) {
|
|
1666
|
+
const t = line.replace(/\r$/, "").trimEnd();
|
|
1667
|
+
if (t.length === 0) return false;
|
|
1668
|
+
if (/^\s*▲\s+Next\.js/.test(t)) return true;
|
|
1669
|
+
if (/^\s*-\s+Local:\s+/.test(t)) return true;
|
|
1670
|
+
if (/^\s*-\s+Network:\s+/.test(t)) return true;
|
|
1671
|
+
if (/^\s*✓\s+Ready\b/.test(t)) return true;
|
|
1672
|
+
return false;
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1589
1676
|
//#endregion
|
|
1590
1677
|
//#region src/dev/CliDevProxyServer.ts
|
|
1591
1678
|
var CliDevProxyServer = class {
|
|
@@ -1722,10 +1809,6 @@ var CliDevProxyServer = class {
|
|
|
1722
1809
|
}));
|
|
1723
1810
|
return;
|
|
1724
1811
|
}
|
|
1725
|
-
if (uiProxyTarget && pathname.startsWith("/api/auth/")) {
|
|
1726
|
-
this.proxy.web(req, res, { target: uiProxyTarget.replace(/\/$/, "") });
|
|
1727
|
-
return;
|
|
1728
|
-
}
|
|
1729
1812
|
if (pathname.startsWith("/api/")) {
|
|
1730
1813
|
const runtimeTarget = this.activeRuntime;
|
|
1731
1814
|
if (pathname === "/api/dev/bootstrap-summary" && runtimeTarget) {
|
|
@@ -2539,6 +2622,7 @@ var DevNextHostEnvironmentBuilder = class {
|
|
|
2539
2622
|
HOSTNAME: "127.0.0.1",
|
|
2540
2623
|
AUTH_SECRET: args.authSecret,
|
|
2541
2624
|
AUTH_URL: args.publicBaseUrl,
|
|
2625
|
+
CODEMATION_PUBLIC_BASE_URL: args.publicBaseUrl,
|
|
2542
2626
|
CODEMATION_PUBLIC_WS_PORT: String(publicWebsocketPort),
|
|
2543
2627
|
NEXT_PUBLIC_CODEMATION_WS_PORT: String(publicWebsocketPort)
|
|
2544
2628
|
};
|
|
@@ -3186,7 +3270,7 @@ var CliDatabaseUrlDescriptor = class {
|
|
|
3186
3270
|
describePersistence(persistence) {
|
|
3187
3271
|
if (persistence.kind === "none") return "none";
|
|
3188
3272
|
if (persistence.kind === "postgresql") return this.describeForDisplay(persistence.databaseUrl);
|
|
3189
|
-
return `
|
|
3273
|
+
return `SQLite (${persistence.databaseFilePath})`;
|
|
3190
3274
|
}
|
|
3191
3275
|
describeForDisplay(databaseUrl) {
|
|
3192
3276
|
if (!databaseUrl || databaseUrl.trim().length === 0) return "unknown database target";
|
|
@@ -3223,8 +3307,8 @@ var CodemationCliApplicationSession = class CodemationCliApplicationSession {
|
|
|
3223
3307
|
}
|
|
3224
3308
|
getPrismaClient() {
|
|
3225
3309
|
const container = this.getContainer();
|
|
3226
|
-
if (!container.isRegistered(PrismaClient, true)) return;
|
|
3227
|
-
return container.resolve(PrismaClient);
|
|
3310
|
+
if (!container.isRegistered(ApplicationTokens.PrismaClient, true)) return;
|
|
3311
|
+
return container.resolve(ApplicationTokens.PrismaClient);
|
|
3228
3312
|
}
|
|
3229
3313
|
getCommandBus() {
|
|
3230
3314
|
return this.getContainer().resolve(ApplicationTokens.CommandBus);
|
|
@@ -3264,7 +3348,7 @@ var UserAdminCliBootstrap = class {
|
|
|
3264
3348
|
configPathOverride: options.configPath
|
|
3265
3349
|
});
|
|
3266
3350
|
if (loadResult.appConfig.auth?.kind !== "local") throw new Error("Codemation user commands require CodemationConfig.auth.kind to be \"local\".");
|
|
3267
|
-
if (loadResult.appConfig.persistence.kind === "none") throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or
|
|
3351
|
+
if (loadResult.appConfig.persistence.kind === "none") throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or SQLite file path).");
|
|
3268
3352
|
const session = await CodemationCliApplicationSession.open({ appConfig: loadResult.appConfig });
|
|
3269
3353
|
try {
|
|
3270
3354
|
return await fn(session);
|
|
@@ -3334,7 +3418,7 @@ var CliProgramFactory = class {
|
|
|
3334
3418
|
const buildOptionsParser = new ConsumerBuildOptionsParser();
|
|
3335
3419
|
const consumerOutputBuilderFactory = new ConsumerOutputBuilderFactory();
|
|
3336
3420
|
const consumerBuildArtifactsPublisher = new ConsumerBuildArtifactsPublisher();
|
|
3337
|
-
const devCommand = new DevCommand(pathResolver, tsRuntime, new DevLockFactory(), new DevSourceWatcherFactory(), cliLogger, devSessionServices, databaseMigrationsApplyService, consumerOutputBuilderFactory, pluginDiscovery, consumerBuildArtifactsPublisher, new DevBootstrapSummaryFetcher(), new DevCliBannerRenderer(), new ConsumerEnvDotenvFilePredicate(), new DevTrackedProcessTreeKiller(), nextHostConsumerServerCommandFactory, new DevApiRuntimeFactory(devSessionServices.loopbackPortAllocator, appConfigLoader, pluginDiscovery), new CliDevProxyServerFactory(), new DevRebuildQueueFactory());
|
|
3421
|
+
const devCommand = new DevCommand(pathResolver, tsRuntime, new DevLockFactory(), new DevSourceWatcherFactory(), cliLogger, devSessionServices, databaseMigrationsApplyService, consumerOutputBuilderFactory, pluginDiscovery, consumerBuildArtifactsPublisher, new DevBootstrapSummaryFetcher(), new DevCliBannerRenderer(), new ConsumerEnvDotenvFilePredicate(), new DevTrackedProcessTreeKiller(), nextHostConsumerServerCommandFactory, new DevApiRuntimeFactory(devSessionServices.loopbackPortAllocator, appConfigLoader, pluginDiscovery), new CliDevProxyServerFactory(), new DevRebuildQueueFactory(), new DevNextChildProcessOutputFilter(new DevNextStartupBannerLineFilter()));
|
|
3338
3422
|
return new CliProgram(buildOptionsParser, new BuildCommand(cliLogger, pathResolver, consumerOutputBuilderFactory, pluginDiscovery, consumerBuildArtifactsPublisher, tsRuntime), devCommand, new DevPluginCommand(new PluginDevConfigFactory(), devCommand), new ServeWebCommand(pathResolver, new CodemationConsumerConfigLoader(), tsRuntime, sourceMapNodeOptions, new ConsumerEnvLoader(), new ListenPortResolver(), nextHostConsumerServerCommandFactory), new ServeWorkerCommand(pathResolver, appConfigLoader, new AppContainerFactory()), new DbMigrateCommand(databaseMigrationsApplyService), new UserCreateCommand(new LocalUserCreator(userAdminBootstrap), userAdminCliOptionsParser), new UserListCommand(cliLogger, userAdminBootstrap, new CliDatabaseUrlDescriptor(), userAdminCliOptionsParser));
|
|
3339
3423
|
}
|
|
3340
3424
|
};
|
package/dist/bin.js
CHANGED