@kosha-ai/cli 0.1.0 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { run, USAGE, redactUrl, type RunResult } from './lib/cli.js';
2
2
  export { loadConfig, findConfigPath, CONFIG_FILENAMES, ConfigNotFoundError, } from './lib/load-config.js';
3
3
  export { loadEnv, ENV_FILENAMES } from './lib/load-env.js';
4
4
  export { start, type StartOptions } from './lib/commands/start.js';
5
- export { migrate, resolvePrismaBin, type MigrateOptions, type MigrateSubcommand, } from './lib/commands/migrate.js';
5
+ export { migrate, migrateWithConfig, resolvePrismaBin, type MigrateConfig, type MigrateOptions, type MigrateSubcommand, } from './lib/commands/migrate.js';
6
6
  export { addIntegrations, listIntegrations, applyConfigEdit, detectPackageManager, installedIntegrationKeys, packageNameFor, type AddIntegrationOptions, type AddIntegrationResult, type IntegrationListEntry, } from './lib/commands/integration.js';
7
7
  export { findInstalledIntegrations, type InstalledIntegration, } from './lib/commands/installed.js';
8
8
  export { resolveServerPackageDir, resolveSchemaPath, resolveMigrationsDir, } from './lib/paths.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACL,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EACL,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { run, USAGE, redactUrl } from './lib/cli.js';
2
2
  export { loadConfig, findConfigPath, CONFIG_FILENAMES, ConfigNotFoundError, } from './lib/load-config.js';
3
3
  export { loadEnv, ENV_FILENAMES } from './lib/load-env.js';
4
4
  export { start } from './lib/commands/start.js';
5
- export { migrate, resolvePrismaBin, } from './lib/commands/migrate.js';
5
+ export { migrate, migrateWithConfig, resolvePrismaBin, } from './lib/commands/migrate.js';
6
6
  export { addIntegrations, listIntegrations, applyConfigEdit, detectPackageManager, installedIntegrationKeys, packageNameFor, } from './lib/commands/integration.js';
7
7
  export { findInstalledIntegrations, } from './lib/commands/installed.js';
8
8
  export { resolveServerPackageDir, resolveSchemaPath, resolveMigrationsDir, } from './lib/paths.js';
@@ -0,0 +1,14 @@
1
+ export interface MigrationsProvider {
2
+ key: string;
3
+ migrationsPath?: string;
4
+ }
5
+ /**
6
+ * Copies Kosha's migrations and each provider's into one folder for Prisma,
7
+ * renaming provider ones to `<key>_<name>` so they cannot collide.
8
+ */
9
+ export declare function assembleMigrations(args: {
10
+ coreDir: string;
11
+ providers: readonly MigrationsProvider[];
12
+ into: string;
13
+ }): void;
14
+ //# sourceMappingURL=assemble-migrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble-migrations.d.ts","sourceRoot":"","sources":["../../src/lib/assemble-migrations.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,IAAI,CA0BP"}
@@ -0,0 +1,28 @@
1
+ import { cpSync, existsSync, readdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ /**
4
+ * Copies Kosha's migrations and each provider's into one folder for Prisma,
5
+ * renaming provider ones to `<key>_<name>` so they cannot collide.
6
+ */
7
+ export function assembleMigrations(args) {
8
+ cpSync(args.coreDir, args.into, { recursive: true });
9
+ for (const provider of args.providers) {
10
+ if (!provider.migrationsPath || !existsSync(provider.migrationsPath)) {
11
+ continue;
12
+ }
13
+ const prefix = provider.key.replaceAll('-', '_');
14
+ for (const entry of readdirSync(provider.migrationsPath, {
15
+ withFileTypes: true,
16
+ })) {
17
+ if (!entry.isDirectory())
18
+ continue;
19
+ const target = join(args.into, `${prefix}_${entry.name}`);
20
+ if (existsSync(target)) {
21
+ throw new Error(`Two migrations would both be named ${target}. Is "${provider.key}" configured twice?`);
22
+ }
23
+ cpSync(join(provider.migrationsPath, entry.name), target, {
24
+ recursive: true,
25
+ });
26
+ }
27
+ }
28
+ }
package/dist/lib/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const USAGE = "kosha \u2014 the Kosha integration platform CLI\n\nUsage\n kosha start Boot the server from kosha.config.ts\n kosha migrate [deploy|dev|status|reset]\n Run Prisma against the packaged schema\n kosha integration list Show installed vs configured integrations\n kosha integration add <key...> Install integrations and register them\n kosha info Print the resolved config summary\n\nOptions\n --config <path> Path to the config file (default: ./kosha.config.ts)\n --port <number> Override server.port for this run\n --name <name> Migration name, for `migrate dev`\n --skip-install `integration add` edits the config without installing\n -h, --help Show this help\n -v, --version Show the CLI version\n";
1
+ export declare const USAGE = "kosha \u2014 the Kosha integration platform CLI\n\nUsage\n kosha start Boot the server from kosha.config.ts\n kosha migrate [deploy|status|reset]\n Run Prisma against the packaged schema\n kosha integration list Show installed vs configured integrations\n kosha integration add <key...> Install integrations and register them\n kosha info Print the resolved config summary\n\nOptions\n --config <path> Path to the config file (default: ./kosha.config.ts)\n --port <number> Override server.port for this run\n --skip-install `integration add` edits the config without installing\n -h, --help Show this help\n -v, --version Show the CLI version\n";
2
2
  export interface RunResult {
3
3
  exitCode: number;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,8zBAiBjB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAqH5D;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAU9C"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,KAAK,mwBAgBjB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAmH5D;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAU9C"}
package/dist/lib/cli.js CHANGED
@@ -6,7 +6,7 @@ export const USAGE = `kosha — the Kosha integration platform CLI
6
6
 
7
7
  Usage
8
8
  kosha start Boot the server from kosha.config.ts
9
- kosha migrate [deploy|dev|status|reset]
9
+ kosha migrate [deploy|status|reset]
10
10
  Run Prisma against the packaged schema
11
11
  kosha integration list Show installed vs configured integrations
12
12
  kosha integration add <key...> Install integrations and register them
@@ -15,7 +15,6 @@ Usage
15
15
  Options
16
16
  --config <path> Path to the config file (default: ./kosha.config.ts)
17
17
  --port <number> Override server.port for this run
18
- --name <name> Migration name, for \`migrate dev\`
19
18
  --skip-install \`integration add\` edits the config without installing
20
19
  -h, --help Show this help
21
20
  -v, --version Show the CLI version
@@ -27,7 +26,6 @@ export async function run(argv) {
27
26
  options: {
28
27
  config: { type: 'string' },
29
28
  port: { type: 'string' },
30
- name: { type: 'string' },
31
29
  'skip-install': { type: 'boolean' },
32
30
  help: { type: 'boolean', short: 'h' },
33
31
  version: { type: 'boolean', short: 'v' },
@@ -55,7 +53,6 @@ export async function run(argv) {
55
53
  const exitCode = await migrate({
56
54
  ...common,
57
55
  subcommand: rest[0],
58
- name: values.name,
59
56
  });
60
57
  return { exitCode };
61
58
  }
@@ -1,22 +1,41 @@
1
+ import { type MigrationsProvider } from '../assemble-migrations.js';
1
2
  import { type RunCommandOptions } from '../spawn.js';
2
- export type MigrateSubcommand = 'deploy' | 'dev' | 'status' | 'reset';
3
+ export type MigrateSubcommand = 'deploy' | 'status' | 'reset';
3
4
  export interface MigrateOptions {
4
5
  cwd?: string;
5
6
  config?: string;
6
7
  subcommand?: string;
7
- name?: string;
8
8
  /** Injected in tests. */
9
9
  run?: (script: string, args: string[], options: RunCommandOptions) => Promise<number>;
10
10
  }
11
11
  /**
12
- * Runs Prisma against the schema shipped inside `@kosha-ai/server`.
12
+ * The parts of a Kosha config that migrating uses: the database to migrate,
13
+ * and the integrations whose migrations to include.
14
+ */
15
+ export interface MigrateConfig {
16
+ database?: {
17
+ url?: string;
18
+ };
19
+ integrations?: readonly MigrationsProvider[];
20
+ }
21
+ /**
22
+ * Runs Prisma against the schema shipped inside `@kosha-ai/server`, for the
23
+ * app's `kosha.config.ts`.
24
+ */
25
+ export declare function migrate(options?: MigrateOptions): Promise<number>;
26
+ /**
27
+ * Runs the migrations for a config object passed in directly, instead of
28
+ * reading it from `kosha.config.ts`. `migrate` reads the file and calls this.
13
29
  *
14
30
  * Prisma 7 takes the datasource URL from a config file rather than the schema,
15
31
  * so a throwaway config is written per invocation pointing at the packaged
16
32
  * schema and the app's own DATABASE_URL. This is why apps never carry a
17
33
  * `prisma.config.ts` of their own.
34
+ *
35
+ * Kosha's migrations and each integration's are copied into one temp folder
36
+ * for Prisma to run.
18
37
  */
19
- export declare function migrate(options?: MigrateOptions): Promise<number>;
38
+ export declare function migrateWithConfig(config: MigrateConfig, options?: Omit<MigrateOptions, 'config'>): Promise<number>;
20
39
  /**
21
40
  * Locates Prisma's CLI entry script.
22
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/migrate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAItE,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,GAAG,CAAC,EAAE,CACJ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,iBAAiB,KACvB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC3E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAuBzC"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/migrate.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAI9D,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,GAAG,CAAC,EAAE,CACJ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,iBAAiB,KACvB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAM,GAC3C,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAYD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAuBzC"}
@@ -1,42 +1,70 @@
1
- import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
1
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { createRequire } from 'node:module';
3
3
  import { tmpdir } from 'node:os';
4
4
  import { dirname, join } from 'node:path';
5
+ import { assembleMigrations, } from '../assemble-migrations.js';
5
6
  import { loadConfig } from '../load-config.js';
6
7
  import { resolveMigrationsDir, resolveSchemaPath } from '../paths.js';
7
8
  import { runNodeScript } from '../spawn.js';
8
- const SUBCOMMANDS = ['deploy', 'dev', 'status', 'reset'];
9
+ const SUBCOMMANDS = ['deploy', 'status', 'reset'];
9
10
  /**
10
- * Runs Prisma against the schema shipped inside `@kosha-ai/server`.
11
+ * Runs Prisma against the schema shipped inside `@kosha-ai/server`, for the
12
+ * app's `kosha.config.ts`.
13
+ */
14
+ export async function migrate(options = {}) {
15
+ const cwd = options.cwd ?? process.cwd();
16
+ const subcommand = subcommandOf(options.subcommand);
17
+ const { config } = await loadConfig({ cwd, config: options.config });
18
+ return migrateWithConfig(config, { ...options, cwd, subcommand });
19
+ }
20
+ /**
21
+ * Runs the migrations for a config object passed in directly, instead of
22
+ * reading it from `kosha.config.ts`. `migrate` reads the file and calls this.
11
23
  *
12
24
  * Prisma 7 takes the datasource URL from a config file rather than the schema,
13
25
  * so a throwaway config is written per invocation pointing at the packaged
14
26
  * schema and the app's own DATABASE_URL. This is why apps never carry a
15
27
  * `prisma.config.ts` of their own.
28
+ *
29
+ * Kosha's migrations and each integration's are copied into one temp folder
30
+ * for Prisma to run.
16
31
  */
17
- export async function migrate(options = {}) {
32
+ export async function migrateWithConfig(config, options = {}) {
18
33
  const cwd = options.cwd ?? process.cwd();
19
- const subcommand = (options.subcommand ?? 'deploy');
20
- if (!SUBCOMMANDS.includes(subcommand)) {
21
- throw new Error(`Unknown migrate subcommand "${subcommand}". Expected one of: ${SUBCOMMANDS.join(', ')}`);
22
- }
23
- const { config } = await loadConfig({ cwd, config: options.config });
24
- if (!config.database?.url) {
34
+ const subcommand = subcommandOf(options.subcommand);
35
+ const databaseUrl = config.database?.url;
36
+ if (!databaseUrl) {
25
37
  throw new Error('kosha.config.ts has no database.url, so there is nothing to migrate against.');
26
38
  }
27
- const configPath = writePrismaConfig({
28
- schema: resolveSchemaPath(cwd),
29
- migrations: resolveMigrationsDir(cwd),
30
- });
31
- const args = ['migrate', subcommand, '--config', configPath];
32
- if (subcommand === 'dev' && options.name) {
33
- args.push('--name', options.name);
39
+ const workDir = mkdtempSync(join(tmpdir(), 'kosha-prisma-'));
40
+ try {
41
+ const migrations = join(workDir, 'migrations');
42
+ assembleMigrations({
43
+ coreDir: resolveMigrationsDir(cwd),
44
+ providers: config.integrations ?? [],
45
+ into: migrations,
46
+ });
47
+ const configPath = writePrismaConfig(workDir, {
48
+ schema: resolveSchemaPath(cwd),
49
+ migrations,
50
+ });
51
+ const args = ['migrate', subcommand, '--config', configPath];
52
+ const run = options.run ?? runNodeScript;
53
+ return await run(resolvePrismaBin(), args, {
54
+ cwd,
55
+ env: { ...process.env, DATABASE_URL: databaseUrl },
56
+ });
57
+ }
58
+ finally {
59
+ rmSync(workDir, { recursive: true, force: true });
60
+ }
61
+ }
62
+ function subcommandOf(value) {
63
+ const subcommand = (value ?? 'deploy');
64
+ if (!SUBCOMMANDS.includes(subcommand)) {
65
+ throw new Error(`Unknown migrate subcommand "${subcommand}". Expected one of: ${SUBCOMMANDS.join(', ')}`);
34
66
  }
35
- const run = options.run ?? runNodeScript;
36
- return run(resolvePrismaBin(), args, {
37
- cwd,
38
- env: { ...process.env, DATABASE_URL: config.database.url },
39
- });
67
+ return subcommand;
40
68
  }
41
69
  /**
42
70
  * Locates Prisma's CLI entry script.
@@ -61,8 +89,7 @@ export function resolvePrismaBin() {
61
89
  }
62
90
  return join(dirname(manifestPath), bin);
63
91
  }
64
- function writePrismaConfig(paths) {
65
- const dir = mkdtempSync(join(tmpdir(), 'kosha-prisma-'));
92
+ function writePrismaConfig(dir, paths) {
66
93
  const path = join(dir, 'prisma.config.mjs');
67
94
  // A plain object rather than `defineConfig(...)`: the file lives outside the
68
95
  // app, where `prisma/config` is not resolvable. `defineConfig` is only a
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/start.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCrE"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/lib/commands/start.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCrE"}
@@ -28,6 +28,10 @@ export async function start(options = {}) {
28
28
  PORT: String(resolved.admin.port),
29
29
  HOSTNAME: '0.0.0.0',
30
30
  KOSHA_API_URL: process.env.KOSHA_API_URL ?? resolved.server.publicUrl,
31
+ // The admin builds every URL it calls from these two, including the
32
+ // redirect URI an operator pastes into a provider's console. The prefix
33
+ // is configurable here, so it cannot be assumed there.
34
+ KOSHA_API_PREFIX: process.env.KOSHA_API_PREFIX ?? resolved.server.globalPrefix,
31
35
  },
32
36
  });
33
37
  // Ctrl+C in a terminal already reaches this child (same process group);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosha-ai/cli",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Kosha CLI: migrate, start, and manage a Kosha app",
5
5
  "keywords": [
6
6
  "kosha",
@@ -42,7 +42,7 @@
42
42
  "jiti": "^2.7.0",
43
43
  "prisma": "^7.10.0",
44
44
  "tslib": "^2.3.0",
45
- "@kosha-ai/server": "0.1.0"
45
+ "@kosha-ai/server": "0.3.0"
46
46
  },
47
47
  "kosha": {
48
48
  "kind": "cli"