@odla-ai/cli 0.19.0 → 0.20.1

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
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exitCodeFor,
4
4
  runCli
5
- } from "./chunk-QMA5OGKQ.js";
5
+ } from "./chunk-XBPDHNWO.js";
6
6
 
7
7
  // src/bin.ts
8
8
  runCli().catch((err) => {
@@ -5946,8 +5946,8 @@ Usage:
5946
5946
  odla-ai runbook list [--app <id>] [--all] [--q <text>] [--json]
5947
5947
  odla-ai runbook comment <slug> --body "..." [--app <id>]
5948
5948
  odla-ai runbook get <slug> [--app <id>]
5949
- odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--app <id>]
5950
- odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--app <id>]
5949
+ odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--requires <specs>] [--app <id>]
5950
+ odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--requires <specs>] [--app <id>]
5951
5951
  odla-ai runbook import <dir> [--visibility operator|admin] [--dry-run] [--app <id>]
5952
5952
  odla-ai runbook publish <slug> [--app <id>]
5953
5953
  odla-ai runbook visibility <slug> <operator|admin> [--app <id>]
@@ -8281,17 +8281,19 @@ async function runbookGet(ctx, slug) {
8281
8281
  if (unmet.length) ctx.out.error(describeUnmet(slug, unmet));
8282
8282
  ctx.out.log(runbook.body);
8283
8283
  }
8284
- async function runbookNew(ctx, slug, title, body, summary) {
8284
+ async function runbookNew(ctx, slug, title, body, summary, requires) {
8285
8285
  const created = await call(ctx, "POST", "/runbook", {
8286
8286
  appId: ctx.appId,
8287
- input: { slug, title, body, ...summary ? { summary } : {} }
8287
+ input: { slug, title, body, ...summary ? { summary } : {}, ...requires ? { requires } : {} }
8288
8288
  });
8289
8289
  ctx.out.log(ctx.json ? JSON.stringify(created, null, 2) : `created ${slug} (${created.id})`);
8290
8290
  }
8291
- async function runbookEdit(ctx, slug, body, note) {
8291
+ async function runbookEdit(ctx, slug, body, note, requires) {
8292
8292
  const runbook = await bySlug(ctx, slug);
8293
8293
  const result = await call(ctx, "PATCH", `/runbook/${encodeURIComponent(runbook.id)}`, {
8294
- patch: { body, ...note ? { note } : {} }
8294
+ // An empty --requires clears the declaration; omitting the flag leaves
8295
+ // whatever is there, so an ordinary body edit never drops it.
8296
+ patch: { body, ...note ? { note } : {}, ...requires === void 0 ? {} : { requires: requires || null } }
8295
8297
  });
8296
8298
  if (ctx.json) return ctx.out.log(JSON.stringify(result, null, 2));
8297
8299
  ctx.out.log(`${slug} \u2192 v${result.record?.version ?? runbook.version + 1}`);
@@ -8945,7 +8947,8 @@ var ALLOWED2 = [
8945
8947
  "visibility",
8946
8948
  "dry-run",
8947
8949
  "limit",
8948
- "base"
8950
+ "base",
8951
+ "requires"
8949
8952
  ];
8950
8953
  function requireSlug(slug, action) {
8951
8954
  if (!slug) throw new Error(`"runbook ${action}" needs a slug, e.g. "odla-ai runbook ${action} release"`);
@@ -8967,11 +8970,13 @@ async function loadOrDefaultConfig(configPath, action, appId) {
8967
8970
  }
8968
8971
  return loadProjectConfig(configPath);
8969
8972
  }
8973
+ var PURE_STDOUT = /* @__PURE__ */ new Set(["get", "cat"]);
8970
8974
  async function buildContext2(parsed, deps, action) {
8971
8975
  const configPath = stringOpt(parsed.options.config) ?? "odla.config.mjs";
8972
8976
  const cfg = await loadOrDefaultConfig(configPath, action, stringOpt(parsed.options.app));
8973
8977
  const doFetch = deps.fetch ?? fetch;
8974
8978
  const out = deps.stdout ?? console;
8979
+ const authOut = PURE_STDOUT.has(action) ? { log: (line) => out.error(line), error: (line) => out.error(line) } : out;
8975
8980
  const appId = stringOpt(parsed.options.app) ?? PLATFORM_SCOPE;
8976
8981
  const dryRun = parsed.options["dry-run"] === true;
8977
8982
  if (action === "import" && dryRun) {
@@ -8991,7 +8996,7 @@ async function buildContext2(parsed, deps, action) {
8991
8996
  email: stringOpt(parsed.options.email),
8992
8997
  label: `odla CLI (runbook ${action})`,
8993
8998
  fetch: doFetch,
8994
- stdout: out,
8999
+ stdout: authOut,
8995
9000
  openApprovalUrl: deps.openUrl,
8996
9001
  // Anchor the grant cache to this project, not the shell's cwd.
8997
9002
  rootDir: cfg.rootDir
@@ -9008,7 +9013,7 @@ async function buildContext2(parsed, deps, action) {
9008
9013
  open: void 0
9009
9014
  },
9010
9015
  doFetch,
9011
- out
9016
+ authOut
9012
9017
  );
9013
9018
  return {
9014
9019
  platformUrl: cfg.platformUrl,
@@ -9066,7 +9071,8 @@ async function runbookCommand(parsed, deps = {}) {
9066
9071
  name,
9067
9072
  stringOpt(parsed.options.title) ?? name,
9068
9073
  readBody(stringOpt(parsed.options.file), stringOpt(parsed.options.body)),
9069
- stringOpt(parsed.options.summary)
9074
+ stringOpt(parsed.options.summary),
9075
+ stringOpt(parsed.options.requires)
9070
9076
  );
9071
9077
  }
9072
9078
  case "edit": {
@@ -9075,7 +9081,13 @@ async function runbookCommand(parsed, deps = {}) {
9075
9081
  const inline = stringOpt(parsed.options.body);
9076
9082
  const body = file === void 0 && inline === void 0 ? await editRunbook(ctx, name) : readBody(file, inline);
9077
9083
  if (body === null) return ctx.out.log(`${name} unchanged; nothing written`);
9078
- return runbookEdit(ctx, name, body, stringOpt(parsed.options.note));
9084
+ return runbookEdit(
9085
+ ctx,
9086
+ name,
9087
+ body,
9088
+ stringOpt(parsed.options.note),
9089
+ parsed.options.requires === void 0 ? void 0 : stringOpt(parsed.options.requires) ?? ""
9090
+ );
9079
9091
  }
9080
9092
  case "import": {
9081
9093
  const dir = parsed.positionals[2];
@@ -9705,4 +9717,4 @@ export {
9705
9717
  exitCodeFor,
9706
9718
  runCli
9707
9719
  };
9708
- //# sourceMappingURL=chunk-QMA5OGKQ.js.map
9720
+ //# sourceMappingURL=chunk-XBPDHNWO.js.map