@odla-ai/cli 0.25.19 → 0.25.20

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/bin.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  exitCodeFor,
4
4
  redactSecrets,
5
5
  runCli
6
- } from "./chunk-S3EJ66VG.js";
6
+ } from "./chunk-ONETPJFW.js";
7
7
 
8
8
  // src/bin.ts
9
9
  runCli().catch((err) => {
@@ -861,6 +861,7 @@ function isRecord3(value) {
861
861
  import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
862
862
  import { dirname as dirname3, isAbsolute as isAbsolute2, resolve as resolve2 } from "path";
863
863
  import { pathToFileURL } from "url";
864
+ import { appServiceDefinition, appServiceIds } from "@odla-ai/apps";
864
865
 
865
866
  // src/integration-validation.ts
866
867
  function validateIntegrations(cfg, path, defaultServices) {
@@ -948,6 +949,7 @@ async function loadProjectConfig(configPath = "odla.config.mjs") {
948
949
  const dbEndpoint = trimSlash(process.env.ODLA_DB_ENDPOINT || raw.dbEndpoint || platformUrl);
949
950
  const envs = unique2(raw.envs?.length ? raw.envs : DEFAULT_ENVS);
950
951
  const services = unique2(raw.services?.length ? raw.services : DEFAULT_SERVICES);
952
+ validateServices(services, resolved);
951
953
  validateCalendarConfig(raw, envs, services, resolved);
952
954
  const local = {
953
955
  tokenFile: resolve2(rootDir, raw.local?.tokenFile ?? ".odla/dev-token.json"),
@@ -1103,7 +1105,19 @@ function validateCalendarConfig(cfg, envs, services, path) {
1103
1105
  }
1104
1106
  }
1105
1107
  }
1106
- if (enabled && !services.includes("db")) throw new Error(`${path}: calendar service requires the db service`);
1108
+ }
1109
+ function validateServices(services, path) {
1110
+ for (const service of services) {
1111
+ const definition = appServiceDefinition(service);
1112
+ if (!definition) {
1113
+ throw new Error(`${path}: unknown service "${service}" (known: ${appServiceIds().join(", ")})`);
1114
+ }
1115
+ for (const dependency of definition.requires) {
1116
+ if (!services.includes(dependency)) {
1117
+ throw new Error(`${path}: ${service} service requires the ${dependency} service`);
1118
+ }
1119
+ }
1120
+ }
1107
1121
  }
1108
1122
  function assertOnly(value, allowed, label) {
1109
1123
  const extra = Object.keys(value).find((key) => !allowed.includes(key));
@@ -2070,6 +2084,7 @@ async function doctor(options) {
2070
2084
  // src/init.ts
2071
2085
  import { existsSync as existsSync6, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
2072
2086
  import { dirname as dirname4, resolve as resolve4 } from "path";
2087
+ import { appServiceDefinition as appServiceDefinition2, appServiceIds as appServiceIds2 } from "@odla-ai/apps";
2073
2088
  function initProject(options) {
2074
2089
  const out = options.stdout ?? console;
2075
2090
  const rootDir = resolve4(options.rootDir ?? process.cwd());
@@ -2082,7 +2097,13 @@ function initProject(options) {
2082
2097
  }
2083
2098
  const envs = options.envs?.length ? options.envs : ["dev"];
2084
2099
  const services = options.services?.length ? options.services : ["db", "ai"];
2085
- if (services.includes("calendar") && !services.includes("db")) throw new Error("--services calendar requires db");
2100
+ for (const service of services) {
2101
+ const definition = appServiceDefinition2(service);
2102
+ if (!definition) throw new Error(`--services contains unknown service "${service}" (known: ${appServiceIds2().join(", ")})`);
2103
+ for (const dependency of definition.requires) {
2104
+ if (!services.includes(dependency)) throw new Error(`--services ${service} requires ${dependency}`);
2105
+ }
2106
+ }
2086
2107
  const aiProvider = options.aiProvider ?? "anthropic";
2087
2108
  mkdirSync2(dirname4(configPath), { recursive: true });
2088
2109
  mkdirSync2(resolve4(rootDir, "src/odla"), { recursive: true });
@@ -6431,7 +6452,7 @@ function record4(value) {
6431
6452
  }
6432
6453
 
6433
6454
  // src/provision.ts
6434
- import { createAppsClient, tenantIdFor as tenantIdFor4 } from "@odla-ai/apps";
6455
+ import { createAppsClient, orderAppServices, tenantIdFor as tenantIdFor4 } from "@odla-ai/apps";
6435
6456
  import { putSecret as putSecret2 } from "@odla-ai/ai";
6436
6457
  import process8 from "process";
6437
6458
 
@@ -6585,11 +6606,6 @@ async function safeText4(res) {
6585
6606
  // src/provision-helpers.ts
6586
6607
  import { DEFAULT_SECRET_NAMES } from "@odla-ai/ai";
6587
6608
  import { tenantIdFor as tenantIdFor3 } from "@odla-ai/apps";
6588
- function serviceRank(service) {
6589
- if (service === "db") return 0;
6590
- if (service === "calendar") return 2;
6591
- return 1;
6592
- }
6593
6609
  function defaultSecretName(provider) {
6594
6610
  const names = DEFAULT_SECRET_NAMES;
6595
6611
  return names[provider] ?? `${provider}_api_key`;
@@ -6715,7 +6731,7 @@ async function provision(options) {
6715
6731
  for (const env of cfg.envs) {
6716
6732
  await assertTenantAdminAccess(doFetch, cfg, env, token);
6717
6733
  }
6718
- const serviceOrder = [...cfg.services].sort((a, b) => serviceRank(a) - serviceRank(b));
6734
+ const serviceOrder = orderAppServices(cfg.services);
6719
6735
  for (const env of cfg.envs) {
6720
6736
  for (const service of serviceOrder) {
6721
6737
  if (service === "ai") {
@@ -11358,4 +11374,4 @@ export {
11358
11374
  exitCodeFor,
11359
11375
  runCli
11360
11376
  };
11361
- //# sourceMappingURL=chunk-S3EJ66VG.js.map
11377
+ //# sourceMappingURL=chunk-ONETPJFW.js.map