@codemation/cli 0.0.20 → 0.0.22
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 +29 -0
- package/dist/{CliBin-BYHuUedo.js → CliBin-PdQvm7od.js} +17 -20
- package/dist/bin.js +1 -1
- package/dist/index.d.ts +1042 -535
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/src/bootstrap/CodemationCliApplicationSession.ts +3 -3
- 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/DevNextHostEnvironmentBuilder.ts +1 -0
- package/src/user/CliDatabaseUrlDescriptor.ts +1 -1
- package/src/user/UserAdminCliBootstrap.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @codemation/cli
|
|
2
2
|
|
|
3
|
+
## 0.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
- [#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.
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
- [#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.
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
- 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)]:
|
|
18
|
+
- @codemation/host@0.1.0
|
|
19
|
+
- @codemation/next-host@0.1.0
|
|
20
|
+
|
|
21
|
+
## 0.0.21
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#33](https://github.com/MadeRelevant/codemation/pull/33) [`790e114`](https://github.com/MadeRelevant/codemation/commit/790e11456a19abe0db8ac4eca93b3357ea69e163) Thanks [@cblokland90](https://github.com/cblokland90)! - Publish a patch release to validate the full scaffolded auth startup release path from the packaged CLI through the packaged Next host.
|
|
26
|
+
|
|
27
|
+
Keep the release loop exercised after tightening `main` to PR-only merges and after adding scaffolded browser coverage for auth-session startup.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`790e114`](https://github.com/MadeRelevant/codemation/commit/790e11456a19abe0db8ac4eca93b3357ea69e163)]:
|
|
30
|
+
- @codemation/next-host@0.0.21
|
|
31
|
+
|
|
3
32
|
## 0.0.20
|
|
4
33
|
|
|
5
34
|
### 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";
|
|
@@ -1331,7 +1331,7 @@ var ConsumerOutputBuilderFactory = class {
|
|
|
1331
1331
|
//#endregion
|
|
1332
1332
|
//#region src/database/ConsumerDatabaseConnectionResolver.ts
|
|
1333
1333
|
/**
|
|
1334
|
-
* Resolves TCP PostgreSQL vs
|
|
1334
|
+
* Resolves TCP PostgreSQL vs SQLite vs none from env + {@link CodemationConfig} (same rules as the host runtime).
|
|
1335
1335
|
*/
|
|
1336
1336
|
var ConsumerDatabaseConnectionResolver = class {
|
|
1337
1337
|
resolve(processEnv, config$1, consumerRoot) {
|
|
@@ -1346,24 +1346,24 @@ var ConsumerDatabaseConnectionResolver = class {
|
|
|
1346
1346
|
};
|
|
1347
1347
|
}
|
|
1348
1348
|
return {
|
|
1349
|
-
kind: "
|
|
1350
|
-
|
|
1349
|
+
kind: "sqlite",
|
|
1350
|
+
databaseFilePath: this.resolveSqliteFilePath(database.sqliteFilePath, processEnv, consumerRoot)
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
1353
|
resolveDatabaseKind(configuredKind, databaseUrl, env) {
|
|
1354
1354
|
const kindFromEnv = env.CODEMATION_DATABASE_KIND?.trim();
|
|
1355
|
-
if (kindFromEnv === "postgresql" || kindFromEnv === "
|
|
1355
|
+
if (kindFromEnv === "postgresql" || kindFromEnv === "sqlite") return kindFromEnv;
|
|
1356
1356
|
if (configuredKind) return configuredKind;
|
|
1357
1357
|
const trimmedUrl = databaseUrl?.trim();
|
|
1358
1358
|
if (trimmedUrl && (trimmedUrl.startsWith("postgresql://") || trimmedUrl.startsWith("postgres://"))) return "postgresql";
|
|
1359
|
-
return "
|
|
1359
|
+
return "sqlite";
|
|
1360
1360
|
}
|
|
1361
|
-
|
|
1362
|
-
const envPath = env.
|
|
1361
|
+
resolveSqliteFilePath(configuredPath, env, consumerRoot) {
|
|
1362
|
+
const envPath = env.CODEMATION_SQLITE_FILE_PATH?.trim();
|
|
1363
1363
|
if (envPath && envPath.length > 0) return path.isAbsolute(envPath) ? envPath : path.resolve(consumerRoot, envPath);
|
|
1364
1364
|
const trimmedConfiguredPath = configuredPath?.trim();
|
|
1365
1365
|
if (trimmedConfiguredPath && trimmedConfiguredPath.length > 0) return path.isAbsolute(trimmedConfiguredPath) ? trimmedConfiguredPath : path.resolve(consumerRoot, trimmedConfiguredPath);
|
|
1366
|
-
return path.resolve(consumerRoot, ".codemation", "
|
|
1366
|
+
return path.resolve(consumerRoot, ".codemation", "codemation.sqlite");
|
|
1367
1367
|
}
|
|
1368
1368
|
};
|
|
1369
1369
|
|
|
@@ -1405,7 +1405,7 @@ var DatabaseMigrationsApplyService = class {
|
|
|
1405
1405
|
});
|
|
1406
1406
|
const persistence = this.databaseConnectionResolver.resolve(process.env, resolution.config, consumerRoot);
|
|
1407
1407
|
if (persistence.kind === "none") {
|
|
1408
|
-
if (requirePersistence) throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or
|
|
1408
|
+
if (requirePersistence) throw new Error("Database persistence is not configured. Set CodemationConfig.runtime.database (postgresql URL or SQLite file path).");
|
|
1409
1409
|
return;
|
|
1410
1410
|
}
|
|
1411
1411
|
process.env.CODEMATION_HOST_PACKAGE_ROOT = this.hostPackageRoot;
|
|
@@ -1427,12 +1427,12 @@ var HostPackageRootResolver = class {
|
|
|
1427
1427
|
const entry = fileURLToPath(import.meta.resolve("@codemation/host"));
|
|
1428
1428
|
let dir = path.dirname(entry);
|
|
1429
1429
|
for (let depth = 0; depth < 8; depth += 1) {
|
|
1430
|
-
if (existsSync(path.join(dir, "prisma", "schema.prisma"))) return dir;
|
|
1430
|
+
if (existsSync(path.join(dir, "prisma", "schema.postgresql.prisma"))) return dir;
|
|
1431
1431
|
const parent = path.dirname(dir);
|
|
1432
1432
|
if (parent === dir) break;
|
|
1433
1433
|
dir = parent;
|
|
1434
1434
|
}
|
|
1435
|
-
throw new Error(`Could not locate prisma/schema.prisma near @codemation/host entry: ${entry}`);
|
|
1435
|
+
throw new Error(`Could not locate prisma/schema.postgresql.prisma near @codemation/host entry: ${entry}`);
|
|
1436
1436
|
}
|
|
1437
1437
|
};
|
|
1438
1438
|
|
|
@@ -1722,10 +1722,6 @@ var CliDevProxyServer = class {
|
|
|
1722
1722
|
}));
|
|
1723
1723
|
return;
|
|
1724
1724
|
}
|
|
1725
|
-
if (uiProxyTarget && pathname.startsWith("/api/auth/")) {
|
|
1726
|
-
this.proxy.web(req, res, { target: uiProxyTarget.replace(/\/$/, "") });
|
|
1727
|
-
return;
|
|
1728
|
-
}
|
|
1729
1725
|
if (pathname.startsWith("/api/")) {
|
|
1730
1726
|
const runtimeTarget = this.activeRuntime;
|
|
1731
1727
|
if (pathname === "/api/dev/bootstrap-summary" && runtimeTarget) {
|
|
@@ -2539,6 +2535,7 @@ var DevNextHostEnvironmentBuilder = class {
|
|
|
2539
2535
|
HOSTNAME: "127.0.0.1",
|
|
2540
2536
|
AUTH_SECRET: args.authSecret,
|
|
2541
2537
|
AUTH_URL: args.publicBaseUrl,
|
|
2538
|
+
CODEMATION_PUBLIC_BASE_URL: args.publicBaseUrl,
|
|
2542
2539
|
CODEMATION_PUBLIC_WS_PORT: String(publicWebsocketPort),
|
|
2543
2540
|
NEXT_PUBLIC_CODEMATION_WS_PORT: String(publicWebsocketPort)
|
|
2544
2541
|
};
|
|
@@ -3186,7 +3183,7 @@ var CliDatabaseUrlDescriptor = class {
|
|
|
3186
3183
|
describePersistence(persistence) {
|
|
3187
3184
|
if (persistence.kind === "none") return "none";
|
|
3188
3185
|
if (persistence.kind === "postgresql") return this.describeForDisplay(persistence.databaseUrl);
|
|
3189
|
-
return `
|
|
3186
|
+
return `SQLite (${persistence.databaseFilePath})`;
|
|
3190
3187
|
}
|
|
3191
3188
|
describeForDisplay(databaseUrl) {
|
|
3192
3189
|
if (!databaseUrl || databaseUrl.trim().length === 0) return "unknown database target";
|
|
@@ -3223,8 +3220,8 @@ var CodemationCliApplicationSession = class CodemationCliApplicationSession {
|
|
|
3223
3220
|
}
|
|
3224
3221
|
getPrismaClient() {
|
|
3225
3222
|
const container = this.getContainer();
|
|
3226
|
-
if (!container.isRegistered(PrismaClient, true)) return;
|
|
3227
|
-
return container.resolve(PrismaClient);
|
|
3223
|
+
if (!container.isRegistered(ApplicationTokens.PrismaClient, true)) return;
|
|
3224
|
+
return container.resolve(ApplicationTokens.PrismaClient);
|
|
3228
3225
|
}
|
|
3229
3226
|
getCommandBus() {
|
|
3230
3227
|
return this.getContainer().resolve(ApplicationTokens.CommandBus);
|
|
@@ -3264,7 +3261,7 @@ var UserAdminCliBootstrap = class {
|
|
|
3264
3261
|
configPathOverride: options.configPath
|
|
3265
3262
|
});
|
|
3266
3263
|
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
|
|
3264
|
+
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
3265
|
const session = await CodemationCliApplicationSession.open({ appConfig: loadResult.appConfig });
|
|
3269
3266
|
try {
|
|
3270
3267
|
return await fn(session);
|
package/dist/bin.js
CHANGED