@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/index.cjs CHANGED
@@ -6498,8 +6498,8 @@ Usage:
6498
6498
  odla-ai runbook list [--app <id>] [--all] [--q <text>] [--json]
6499
6499
  odla-ai runbook comment <slug> --body "..." [--app <id>]
6500
6500
  odla-ai runbook get <slug> [--app <id>]
6501
- odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--app <id>]
6502
- odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--app <id>]
6501
+ odla-ai runbook new <slug> --title <t> --file <path|-> [--summary <s>] [--requires <specs>] [--app <id>]
6502
+ odla-ai runbook edit <slug> [--file <path|->|--body "..."] [--note <why>] [--requires <specs>] [--app <id>]
6503
6503
  odla-ai runbook import <dir> [--visibility operator|admin] [--dry-run] [--app <id>]
6504
6504
  odla-ai runbook publish <slug> [--app <id>]
6505
6505
  odla-ai runbook visibility <slug> <operator|admin> [--app <id>]
@@ -7972,17 +7972,19 @@ async function runbookGet(ctx, slug) {
7972
7972
  if (unmet.length) ctx.out.error(describeUnmet(slug, unmet));
7973
7973
  ctx.out.log(runbook.body);
7974
7974
  }
7975
- async function runbookNew(ctx, slug, title, body, summary) {
7975
+ async function runbookNew(ctx, slug, title, body, summary, requires) {
7976
7976
  const created = await call(ctx, "POST", "/runbook", {
7977
7977
  appId: ctx.appId,
7978
- input: { slug, title, body, ...summary ? { summary } : {} }
7978
+ input: { slug, title, body, ...summary ? { summary } : {}, ...requires ? { requires } : {} }
7979
7979
  });
7980
7980
  ctx.out.log(ctx.json ? JSON.stringify(created, null, 2) : `created ${slug} (${created.id})`);
7981
7981
  }
7982
- async function runbookEdit(ctx, slug, body, note) {
7982
+ async function runbookEdit(ctx, slug, body, note, requires) {
7983
7983
  const runbook = await bySlug(ctx, slug);
7984
7984
  const result = await call(ctx, "PATCH", `/runbook/${encodeURIComponent(runbook.id)}`, {
7985
- patch: { body, ...note ? { note } : {} }
7985
+ // An empty --requires clears the declaration; omitting the flag leaves
7986
+ // whatever is there, so an ordinary body edit never drops it.
7987
+ patch: { body, ...note ? { note } : {}, ...requires === void 0 ? {} : { requires: requires || null } }
7986
7988
  });
7987
7989
  if (ctx.json) return ctx.out.log(JSON.stringify(result, null, 2));
7988
7990
  ctx.out.log(`${slug} \u2192 v${result.record?.version ?? runbook.version + 1}`);
@@ -8754,7 +8756,8 @@ var ALLOWED2 = [
8754
8756
  "visibility",
8755
8757
  "dry-run",
8756
8758
  "limit",
8757
- "base"
8759
+ "base",
8760
+ "requires"
8758
8761
  ];
8759
8762
  function requireSlug(slug, action) {
8760
8763
  if (!slug) throw new Error(`"runbook ${action}" needs a slug, e.g. "odla-ai runbook ${action} release"`);
@@ -8776,11 +8779,13 @@ async function loadOrDefaultConfig(configPath, action, appId) {
8776
8779
  }
8777
8780
  return loadProjectConfig(configPath);
8778
8781
  }
8782
+ var PURE_STDOUT = /* @__PURE__ */ new Set(["get", "cat"]);
8779
8783
  async function buildContext2(parsed, deps, action) {
8780
8784
  const configPath = stringOpt(parsed.options.config) ?? "odla.config.mjs";
8781
8785
  const cfg = await loadOrDefaultConfig(configPath, action, stringOpt(parsed.options.app));
8782
8786
  const doFetch = deps.fetch ?? fetch;
8783
8787
  const out = deps.stdout ?? console;
8788
+ const authOut = PURE_STDOUT.has(action) ? { log: (line) => out.error(line), error: (line) => out.error(line) } : out;
8784
8789
  const appId = stringOpt(parsed.options.app) ?? PLATFORM_SCOPE;
8785
8790
  const dryRun = parsed.options["dry-run"] === true;
8786
8791
  if (action === "import" && dryRun) {
@@ -8800,7 +8805,7 @@ async function buildContext2(parsed, deps, action) {
8800
8805
  email: stringOpt(parsed.options.email),
8801
8806
  label: `odla CLI (runbook ${action})`,
8802
8807
  fetch: doFetch,
8803
- stdout: out,
8808
+ stdout: authOut,
8804
8809
  openApprovalUrl: deps.openUrl,
8805
8810
  // Anchor the grant cache to this project, not the shell's cwd.
8806
8811
  rootDir: cfg.rootDir
@@ -8817,7 +8822,7 @@ async function buildContext2(parsed, deps, action) {
8817
8822
  open: void 0
8818
8823
  },
8819
8824
  doFetch,
8820
- out
8825
+ authOut
8821
8826
  );
8822
8827
  return {
8823
8828
  platformUrl: cfg.platformUrl,
@@ -8875,7 +8880,8 @@ async function runbookCommand(parsed, deps = {}) {
8875
8880
  name,
8876
8881
  stringOpt(parsed.options.title) ?? name,
8877
8882
  readBody(stringOpt(parsed.options.file), stringOpt(parsed.options.body)),
8878
- stringOpt(parsed.options.summary)
8883
+ stringOpt(parsed.options.summary),
8884
+ stringOpt(parsed.options.requires)
8879
8885
  );
8880
8886
  }
8881
8887
  case "edit": {
@@ -8884,7 +8890,13 @@ async function runbookCommand(parsed, deps = {}) {
8884
8890
  const inline = stringOpt(parsed.options.body);
8885
8891
  const body = file === void 0 && inline === void 0 ? await editRunbook(ctx, name) : readBody(file, inline);
8886
8892
  if (body === null) return ctx.out.log(`${name} unchanged; nothing written`);
8887
- return runbookEdit(ctx, name, body, stringOpt(parsed.options.note));
8893
+ return runbookEdit(
8894
+ ctx,
8895
+ name,
8896
+ body,
8897
+ stringOpt(parsed.options.note),
8898
+ parsed.options.requires === void 0 ? void 0 : stringOpt(parsed.options.requires) ?? ""
8899
+ );
8888
8900
  }
8889
8901
  case "import": {
8890
8902
  const dir = parsed.positionals[2];