@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.cjs CHANGED
@@ -6439,8 +6439,8 @@ Usage:
6439
6439
  odla-ai runbook list [--app <id>] [--all] [--q <text>] [--json]
6440
6440
  odla-ai runbook comment <slug> --body "..." [--app <id>]
6441
6441
  odla-ai runbook get <slug> [--app <id>]
6442
- odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--app <id>]
6443
- odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--app <id>]
6442
+ odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--requires <specs>] [--app <id>]
6443
+ odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--requires <specs>] [--app <id>]
6444
6444
  odla-ai runbook import <dir> [--visibility operator|admin] [--dry-run] [--app <id>]
6445
6445
  odla-ai runbook publish <slug> [--app <id>]
6446
6446
  odla-ai runbook visibility <slug> <operator|admin> [--app <id>]
@@ -7913,17 +7913,19 @@ async function runbookGet(ctx, slug) {
7913
7913
  if (unmet.length) ctx.out.error(describeUnmet(slug, unmet));
7914
7914
  ctx.out.log(runbook.body);
7915
7915
  }
7916
- async function runbookNew(ctx, slug, title, body, summary) {
7916
+ async function runbookNew(ctx, slug, title, body, summary, requires) {
7917
7917
  const created = await call(ctx, "POST", "/runbook", {
7918
7918
  appId: ctx.appId,
7919
- input: { slug, title, body, ...summary ? { summary } : {} }
7919
+ input: { slug, title, body, ...summary ? { summary } : {}, ...requires ? { requires } : {} }
7920
7920
  });
7921
7921
  ctx.out.log(ctx.json ? JSON.stringify(created, null, 2) : `created ${slug} (${created.id})`);
7922
7922
  }
7923
- async function runbookEdit(ctx, slug, body, note) {
7923
+ async function runbookEdit(ctx, slug, body, note, requires) {
7924
7924
  const runbook = await bySlug(ctx, slug);
7925
7925
  const result = await call(ctx, "PATCH", `/runbook/${encodeURIComponent(runbook.id)}`, {
7926
- patch: { body, ...note ? { note } : {} }
7926
+ // An empty --requires clears the declaration; omitting the flag leaves
7927
+ // whatever is there, so an ordinary body edit never drops it.
7928
+ patch: { body, ...note ? { note } : {}, ...requires === void 0 ? {} : { requires: requires || null } }
7927
7929
  });
7928
7930
  if (ctx.json) return ctx.out.log(JSON.stringify(result, null, 2));
7929
7931
  ctx.out.log(`${slug} \u2192 v${result.record?.version ?? runbook.version + 1}`);
@@ -8686,7 +8688,8 @@ var ALLOWED2 = [
8686
8688
  "visibility",
8687
8689
  "dry-run",
8688
8690
  "limit",
8689
- "base"
8691
+ "base",
8692
+ "requires"
8690
8693
  ];
8691
8694
  function requireSlug(slug, action) {
8692
8695
  if (!slug) throw new Error(`"runbook ${action}" needs a slug, e.g. "odla-ai runbook ${action} release"`);
@@ -8708,11 +8711,13 @@ async function loadOrDefaultConfig(configPath, action, appId) {
8708
8711
  }
8709
8712
  return loadProjectConfig(configPath);
8710
8713
  }
8714
+ var PURE_STDOUT = /* @__PURE__ */ new Set(["get", "cat"]);
8711
8715
  async function buildContext2(parsed, deps, action) {
8712
8716
  const configPath = stringOpt(parsed.options.config) ?? "odla.config.mjs";
8713
8717
  const cfg = await loadOrDefaultConfig(configPath, action, stringOpt(parsed.options.app));
8714
8718
  const doFetch = deps.fetch ?? fetch;
8715
8719
  const out = deps.stdout ?? console;
8720
+ const authOut = PURE_STDOUT.has(action) ? { log: (line) => out.error(line), error: (line) => out.error(line) } : out;
8716
8721
  const appId = stringOpt(parsed.options.app) ?? PLATFORM_SCOPE;
8717
8722
  const dryRun = parsed.options["dry-run"] === true;
8718
8723
  if (action === "import" && dryRun) {
@@ -8732,7 +8737,7 @@ async function buildContext2(parsed, deps, action) {
8732
8737
  email: stringOpt(parsed.options.email),
8733
8738
  label: `odla CLI (runbook ${action})`,
8734
8739
  fetch: doFetch,
8735
- stdout: out,
8740
+ stdout: authOut,
8736
8741
  openApprovalUrl: deps.openUrl,
8737
8742
  // Anchor the grant cache to this project, not the shell's cwd.
8738
8743
  rootDir: cfg.rootDir
@@ -8749,7 +8754,7 @@ async function buildContext2(parsed, deps, action) {
8749
8754
  open: void 0
8750
8755
  },
8751
8756
  doFetch,
8752
- out
8757
+ authOut
8753
8758
  );
8754
8759
  return {
8755
8760
  platformUrl: cfg.platformUrl,
@@ -8807,7 +8812,8 @@ async function runbookCommand(parsed, deps = {}) {
8807
8812
  name,
8808
8813
  stringOpt(parsed.options.title) ?? name,
8809
8814
  readBody(stringOpt(parsed.options.file), stringOpt(parsed.options.body)),
8810
- stringOpt(parsed.options.summary)
8815
+ stringOpt(parsed.options.summary),
8816
+ stringOpt(parsed.options.requires)
8811
8817
  );
8812
8818
  }
8813
8819
  case "edit": {
@@ -8816,7 +8822,13 @@ async function runbookCommand(parsed, deps = {}) {
8816
8822
  const inline = stringOpt(parsed.options.body);
8817
8823
  const body = file === void 0 && inline === void 0 ? await editRunbook(ctx, name) : readBody(file, inline);
8818
8824
  if (body === null) return ctx.out.log(`${name} unchanged; nothing written`);
8819
- return runbookEdit(ctx, name, body, stringOpt(parsed.options.note));
8825
+ return runbookEdit(
8826
+ ctx,
8827
+ name,
8828
+ body,
8829
+ stringOpt(parsed.options.note),
8830
+ parsed.options.requires === void 0 ? void 0 : stringOpt(parsed.options.requires) ?? ""
8831
+ );
8820
8832
  }
8821
8833
  case "import": {
8822
8834
  const dir = parsed.positionals[2];