@apotech-os/cli 2.0.1 → 2.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.js CHANGED
@@ -6372,7 +6372,7 @@ var {
6372
6372
  } = import_index.default;
6373
6373
 
6374
6374
  // src/index.ts
6375
- var import_fs8 = require("fs");
6375
+ var import_fs9 = require("fs");
6376
6376
  var import_path6 = require("path");
6377
6377
 
6378
6378
  // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
@@ -22724,14 +22724,51 @@ var FunctionTriggerSchema = external_exports.discriminatedUnion("type", [
22724
22724
  type: external_exports.literal("httpRoute"),
22725
22725
  path: external_exports.string(),
22726
22726
  method: external_exports.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "ALL"]),
22727
+ /**
22728
+ * HISTORICAL form of `auth`, kept because it shipped in 2.1.0 and is what
22729
+ * already-published manifests declare. `false` means "webhook, gated by an
22730
+ * HMAC signature"; `true`/absent means "authenticated session".
22731
+ * Equivalent to `auth: 'hmac'` / `auth: 'session'`. Declaring BOTH is
22732
+ * rejected by the refinement on FunctionDefSchema — two ways to say the
22733
+ * same thing is two ways to disagree.
22734
+ */
22727
22735
  isAuthRequired: external_exports.boolean().optional(),
22736
+ /**
22737
+ * How the caller proves its right to this route. Absent, it is derived from
22738
+ * `isAuthRequired` — always read it through `resolveHttpRouteAuth`, never
22739
+ * off the raw field, so a route cannot be guarded one way and documented
22740
+ * another.
22741
+ * - 'session' — an authenticated session AND `minRole` on this app.
22742
+ * - 'hmac' — HMAC-SHA256 over the raw body (inbound provider webhooks).
22743
+ * - 'apiKey' — an `AppApiKey` (`wopilo_app_…`) scoped to THIS app, for a
22744
+ * third-party SaaS that cannot sign. The key carries the
22745
+ * app; the app carries its manifest role.
22746
+ */
22747
+ auth: external_exports.enum(["session", "hmac", "apiKey"]).optional(),
22748
+ /**
22749
+ * What the HTTP response carries.
22750
+ * - 'runId' — default. Dispatches an Inngest event and answers with the
22751
+ * run id; the handler's return value is discarded.
22752
+ * - 'result' — runs the handler IN-PROCESS and returns its value as the
22753
+ * response body. No durable Inngest function is registered
22754
+ * for such a route (see app-inngest-functions.ts).
22755
+ */
22756
+ response: external_exports.enum(["runId", "result"]).optional(),
22757
+ /**
22758
+ * Wall-clock budget in ms. Only meaningful with `response: 'result'` — the
22759
+ * durable path has no wall clock by design — and rejected without it by the
22760
+ * refinement on FunctionDefSchema. Same bounds and server-side clamp as
22761
+ * `uiInvoke`.
22762
+ */
22763
+ timeoutMs: external_exports.number().int().min(1e3).max(3e4).optional(),
22728
22764
  /**
22729
22765
  * Minimum role the calling session must hold on this app
22730
22766
  * (contextId = manifest.slug). Defaults to EDITOR — fail-closed, like
22731
22767
  * `uiInvoke` and for the same reason: the handler runs with the app's FULL
22732
22768
  * manifest role, not the caller's.
22733
- * Illegal with `isAuthRequired: false` (webhook mode: there is no session,
22734
- * the HMAC governs) — rejected by the refinement on FunctionDefSchema.
22769
+ * Only meaningful in `session` mode: with `hmac` or `apiKey` there is no
22770
+ * session to hold a role, and the signature/key governs — rejected by the
22771
+ * refinement on FunctionDefSchema.
22735
22772
  */
22736
22773
  minRole: external_exports.enum(["VIEWER", "EDITOR", "ADMIN"]).optional()
22737
22774
  }),
@@ -22850,7 +22887,15 @@ var FunctionDefFieldsSchema = external_exports.object({
22850
22887
  * the platform, not the app — declaring an input schema there is always a
22851
22888
  * mistake and is rejected by the refinement below.
22852
22889
  */
22853
- input: external_exports.array(FieldDefSchema).optional()
22890
+ input: external_exports.array(FieldDefSchema).optional(),
22891
+ /**
22892
+ * Purely descriptive narratives rendered in the automations catalogue
22893
+ * ("Déclencheur & effet"), mirroring `AutomationManifest.when` / `.then`
22894
+ * carried by the platform's own jobs. No runtime effect whatsoever: an app
22895
+ * function without them behaves identically, its card simply stays empty.
22896
+ */
22897
+ when: external_exports.string().min(1).describe('Human "quand" narrative \u2014 what makes this function run (UI only).').optional(),
22898
+ then: external_exports.string().min(1).describe('Human "alors" narrative \u2014 what this function does when it runs (UI only).').optional()
22854
22899
  });
22855
22900
  var FunctionDefSchema = FunctionDefFieldsSchema.superRefine((fn, ctx) => {
22856
22901
  if (fn.input && fn.trigger.type !== "uiInvoke" && fn.trigger.type !== "httpRoute") {
@@ -22867,6 +22912,30 @@ var FunctionDefSchema = FunctionDefFieldsSchema.superRefine((fn, ctx) => {
22867
22912
  message: '"minRole" is meaningless on an unauthenticated webhook route (isAuthRequired: false)'
22868
22913
  });
22869
22914
  }
22915
+ if (fn.trigger.type === "httpRoute") {
22916
+ const { auth, isAuthRequired, minRole, response, timeoutMs } = fn.trigger;
22917
+ if (auth !== void 0 && isAuthRequired !== void 0) {
22918
+ ctx.addIssue({
22919
+ code: "custom",
22920
+ path: ["trigger", "auth"],
22921
+ message: `"auth" and "isAuthRequired" cannot both be declared \u2014 they are two ways to say the same thing. Keep "auth: '${auth}'" and drop "isAuthRequired".`
22922
+ });
22923
+ }
22924
+ if (auth !== void 0 && auth !== "session" && minRole !== void 0) {
22925
+ ctx.addIssue({
22926
+ code: "custom",
22927
+ path: ["trigger", "minRole"],
22928
+ message: `"minRole" is meaningless with auth: '${auth}' \u2014 there is no session to hold a role`
22929
+ });
22930
+ }
22931
+ if (timeoutMs !== void 0 && (response ?? "runId") !== "result") {
22932
+ ctx.addIssue({
22933
+ code: "custom",
22934
+ path: ["trigger", "timeoutMs"],
22935
+ message: `"timeoutMs" is only meaningful with response: 'result' \u2014 the fire-and-forget path answers before the handler runs, so it has no wall clock to budget`
22936
+ });
22937
+ }
22938
+ }
22870
22939
  });
22871
22940
  var AppRoleSchema = external_exports.object({
22872
22941
  reads: external_exports.array(external_exports.string()),
@@ -23211,7 +23280,10 @@ var CoreShopifyOrderLineItemSchema = external_exports.object({
23211
23280
  taxLines: external_exports.array(ShopifyTaxLineSchema),
23212
23281
  requiresShipping: external_exports.boolean(),
23213
23282
  isGiftCard: external_exports.boolean(),
23214
- customAttributes: external_exports.array(ShopifyCustomAttributeSchema)
23283
+ customAttributes: external_exports.array(ShopifyCustomAttributeSchema),
23284
+ /** The PARENT ORDER's dates, denormalized — see the conventions above. */
23285
+ orderCreatedAt: external_exports.coerce.date().nullish(),
23286
+ orderUpdatedAt: external_exports.coerce.date().nullish()
23215
23287
  }).strict();
23216
23288
  var coreShopifyOrderLineItem = {
23217
23289
  key: "shopify-order-line-item",
@@ -23240,7 +23312,10 @@ var CoreShopifyRefundSchema = external_exports.object({
23240
23312
  note: external_exports.string().nullable(),
23241
23313
  totalRefundedCents: external_exports.number().int(),
23242
23314
  refundLineItems: external_exports.array(ShopifyRefundLineItemSchema),
23243
- orderAdjustments: external_exports.array(ShopifyOrderAdjustmentSchema)
23315
+ orderAdjustments: external_exports.array(ShopifyOrderAdjustmentSchema),
23316
+ /** The PARENT ORDER's dates, denormalized — see the conventions above. */
23317
+ orderCreatedAt: external_exports.coerce.date().nullish(),
23318
+ orderUpdatedAt: external_exports.coerce.date().nullish()
23244
23319
  }).strict();
23245
23320
  var coreShopifyRefund = {
23246
23321
  key: "shopify-refund",
@@ -23265,7 +23340,10 @@ var CoreShopifyReturnSchema = external_exports.object({
23265
23340
  totalQuantity: external_exports.number().int(),
23266
23341
  returnLineItems: external_exports.array(ShopifyReturnLineItemSchema),
23267
23342
  declineReason: external_exports.string().nullable(),
23268
- declineNote: external_exports.string().nullable()
23343
+ declineNote: external_exports.string().nullable(),
23344
+ /** The PARENT ORDER's dates, denormalized — see the conventions above. */
23345
+ orderCreatedAt: external_exports.coerce.date().nullish(),
23346
+ orderUpdatedAt: external_exports.coerce.date().nullish()
23269
23347
  }).strict();
23270
23348
  var coreShopifyReturn = {
23271
23349
  key: "shopify-return",
@@ -23297,7 +23375,10 @@ var CoreShopifyFulfillmentSchema = external_exports.object({
23297
23375
  estimatedDeliveryAt: external_exports.coerce.date().nullable(),
23298
23376
  trackingInfo: external_exports.array(ShopifyTrackingInfoSchema),
23299
23377
  locationName: external_exports.string().nullable(),
23300
- fulfillmentLineItems: external_exports.array(ShopifyFulfillmentLineItemSchema)
23378
+ fulfillmentLineItems: external_exports.array(ShopifyFulfillmentLineItemSchema),
23379
+ /** The PARENT ORDER's dates, denormalized — see the conventions above. */
23380
+ orderCreatedAt: external_exports.coerce.date().nullish(),
23381
+ orderUpdatedAt: external_exports.coerce.date().nullish()
23301
23382
  }).strict();
23302
23383
  var coreShopifyFulfillment = {
23303
23384
  key: "shopify-fulfillment",
@@ -23765,6 +23846,15 @@ var ApiError = class extends Error {
23765
23846
  status;
23766
23847
  body;
23767
23848
  };
23849
+ function reportApiError(err) {
23850
+ if (!(err instanceof ApiError)) throw err;
23851
+ if (err.status === 503 && extractCode(err.body) === "LOGS_NOT_CONFIGURED") {
23852
+ console.error("Error: the server has no log file configured (APP_LOGS_FILE).");
23853
+ } else {
23854
+ console.error(`Server error (${err.status}): ${err.message}`);
23855
+ }
23856
+ process.exit(1);
23857
+ }
23768
23858
  async function syncManifest(opts) {
23769
23859
  const url2 = `${opts.baseUrl.replace(/\/$/, "")}/platform/apps/sync`;
23770
23860
  const headers = {
@@ -23810,6 +23900,87 @@ async function installApp(opts) {
23810
23900
  }
23811
23901
  return body;
23812
23902
  }
23903
+ async function fetchLogs(opts) {
23904
+ const params = new URLSearchParams();
23905
+ if (opts.app) params.set("app", opts.app);
23906
+ if (opts.function) params.set("function", opts.function);
23907
+ if (opts.run) params.set("run", opts.run);
23908
+ if (opts.level) params.set("level", opts.level);
23909
+ if (opts.from) params.set("from", opts.from);
23910
+ if (opts.until) params.set("until", opts.until);
23911
+ if (opts.afterSeq !== void 0) params.set("afterSeq", String(opts.afterSeq));
23912
+ if (opts.limit !== void 0) params.set("limit", String(opts.limit));
23913
+ return getJson(opts.baseUrl, "/platform/logs", params, opts.apiKey);
23914
+ }
23915
+ var FUNCTION_RUN_STATUSES = [
23916
+ "RUNNING",
23917
+ "COMPLETED",
23918
+ "FAILED",
23919
+ "CANCELLED",
23920
+ "QUEUED",
23921
+ "SKIPPED"
23922
+ ];
23923
+ async function fetchRuns(opts) {
23924
+ const params = new URLSearchParams();
23925
+ if (opts.appSlug) params.set("appSlug", opts.appSlug);
23926
+ if (opts.functionName) params.set("functionName", opts.functionName);
23927
+ if (opts.slug) params.set("slug", opts.slug);
23928
+ if (opts.status) params.set("status", opts.status);
23929
+ if (opts.limit !== void 0) params.set("limit", String(opts.limit));
23930
+ if (opts.cursor) params.set("cursor", opts.cursor);
23931
+ if (opts.order) params.set("order", opts.order);
23932
+ if (opts.from) params.set("from", opts.from);
23933
+ if (opts.until) params.set("until", opts.until);
23934
+ if (opts.source) params.set("source", opts.source);
23935
+ return getJson(opts.baseUrl, "/runs", params, opts.apiKey);
23936
+ }
23937
+ async function fetchRunDetail(opts) {
23938
+ return getJson(
23939
+ opts.baseUrl,
23940
+ `/runs/${encodeURIComponent(opts.runId)}`,
23941
+ void 0,
23942
+ opts.apiKey
23943
+ );
23944
+ }
23945
+ async function fetchJobs(opts) {
23946
+ return getJson(opts.baseUrl, "/jobs", void 0, opts.apiKey);
23947
+ }
23948
+ async function lookupRun(opts) {
23949
+ const params = new URLSearchParams({ ref: opts.ref });
23950
+ return getJson(opts.baseUrl, "/runs/lookup", params, opts.apiKey);
23951
+ }
23952
+ async function triggerJob(opts) {
23953
+ return postJson(
23954
+ opts.baseUrl,
23955
+ `/jobs/${encodeURIComponent(opts.key)}/run`,
23956
+ { data: opts.data },
23957
+ opts.apiKey
23958
+ );
23959
+ }
23960
+ async function getJson(baseUrl, path, params, apiKey) {
23961
+ const query = params?.toString();
23962
+ const url2 = `${baseUrl.replace(/\/$/, "")}${path}${query ? `?${query}` : ""}`;
23963
+ const headers = {};
23964
+ if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
23965
+ return readJsonOrThrow(await fetch(url2, { headers }));
23966
+ }
23967
+ async function postJson(baseUrl, path, body, apiKey) {
23968
+ const url2 = `${baseUrl.replace(/\/$/, "")}${path}`;
23969
+ const headers = { "Content-Type": "application/json" };
23970
+ if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
23971
+ return readJsonOrThrow(
23972
+ await fetch(url2, { method: "POST", headers, body: JSON.stringify(body) })
23973
+ );
23974
+ }
23975
+ async function readJsonOrThrow(res) {
23976
+ const body = await res.json().catch(() => ({ message: res.statusText }));
23977
+ if (!res.ok) {
23978
+ const code = extractCode(body);
23979
+ const message = extractMessage(body) ?? `HTTP ${res.status}`;
23980
+ throw new ApiError(code ? `[${code}] ${message}` : message, res.status, body);
23981
+ }
23982
+ return body;
23983
+ }
23813
23984
  function extractMessage(body) {
23814
23985
  if (body && typeof body === "object" && "message" in body) {
23815
23986
  return String(body["message"]);
@@ -24453,7 +24624,7 @@ function openBrowser(url2) {
24453
24624
  function sleep(ms) {
24454
24625
  return new Promise((resolve4) => setTimeout(resolve4, ms));
24455
24626
  }
24456
- async function postJson(url2, body) {
24627
+ async function postJson2(url2, body) {
24457
24628
  const res = await fetch(url2, {
24458
24629
  method: "POST",
24459
24630
  headers: { "Content-Type": "application/json" },
@@ -24470,7 +24641,7 @@ async function promptForKey(remote) {
24470
24641
  console.log(`Credentials stored for remote "${remote}".`);
24471
24642
  }
24472
24643
  async function browserLogin(remote, baseUrl) {
24473
- const device = await postJson(`${baseUrl.replace(/\/$/, "")}/platform/cli-auth/device`, {
24644
+ const device = await postJson2(`${baseUrl.replace(/\/$/, "")}/platform/cli-auth/device`, {
24474
24645
  clientLabel: clientLabel()
24475
24646
  });
24476
24647
  if (device.status === 404) {
@@ -24498,7 +24669,7 @@ async function pollForKey(baseUrl, auth) {
24498
24669
  while (Date.now() < deadline) {
24499
24670
  await sleep(auth.interval * 1e3);
24500
24671
  if (Date.now() >= deadline) break;
24501
- const res = await postJson(tokenUrl, { deviceCode: auth.deviceCode });
24672
+ const res = await postJson2(tokenUrl, { deviceCode: auth.deviceCode });
24502
24673
  const result = res.body;
24503
24674
  if (result?.status === "approved") {
24504
24675
  console.log("\u2713");
@@ -24583,10 +24754,624 @@ function buildInstallCommand() {
24583
24754
  });
24584
24755
  }
24585
24756
 
24757
+ // src/duration.ts
24758
+ var RELATIVE_DURATION = /^(\d+)(s|m|h|d)$/;
24759
+ var UNIT_TO_MS = {
24760
+ s: 1e3,
24761
+ m: 6e4,
24762
+ h: 36e5,
24763
+ d: 864e5
24764
+ };
24765
+ function parseDurationMs(value) {
24766
+ const match = RELATIVE_DURATION.exec(value);
24767
+ if (!match) return void 0;
24768
+ const amount = Number(match[1]);
24769
+ const unit = match[2];
24770
+ return amount * UNIT_TO_MS[unit];
24771
+ }
24772
+ function parseSince(value) {
24773
+ const ms = parseDurationMs(value);
24774
+ if (ms === void 0) return value;
24775
+ return new Date(Date.now() - ms).toISOString();
24776
+ }
24777
+ function formatDurationMs(ms) {
24778
+ if (ms < 1e3) return `${ms}ms`;
24779
+ const totalSeconds = Math.floor(ms / 1e3);
24780
+ const minutes = Math.floor(totalSeconds / 60);
24781
+ const seconds = totalSeconds % 60;
24782
+ return minutes === 0 ? `${seconds}s` : `${minutes}m${seconds}s`;
24783
+ }
24784
+ function formatRunDuration(run) {
24785
+ if (!run.startedAt) return "-";
24786
+ const end = run.endedAt ?? (run.status === "RUNNING" ? (/* @__PURE__ */ new Date()).toISOString() : void 0);
24787
+ if (!end) return "-";
24788
+ return formatDurationMs(new Date(end).getTime() - new Date(run.startedAt).getTime());
24789
+ }
24790
+
24791
+ // src/follow-poll.ts
24792
+ var FOLLOW_MIN_INTERVAL_MS = 1e3;
24793
+ var FOLLOW_MAX_INTERVAL_MS = 5e3;
24794
+ var FOLLOW_BACKOFF_FACTOR = 1.5;
24795
+ function nextFollowInterval({ current, hadActivity, hadError }) {
24796
+ if (hadError) return FOLLOW_MAX_INTERVAL_MS;
24797
+ if (hadActivity) return FOLLOW_MIN_INTERVAL_MS;
24798
+ return Math.min(current * FOLLOW_BACKOFF_FACTOR, FOLLOW_MAX_INTERVAL_MS);
24799
+ }
24800
+
24801
+ // src/log-format.ts
24802
+ var SHORT_RUN_ID_LENGTH = 8;
24803
+ function formatLocalTimestamp(iso) {
24804
+ const d = new Date(iso);
24805
+ const pad = (n) => String(n).padStart(2, "0");
24806
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
24807
+ }
24808
+ function formatFieldValue(value) {
24809
+ return typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
24810
+ }
24811
+ function formatFields(fields) {
24812
+ if (!fields) return "";
24813
+ return Object.entries(fields).map(([key, value]) => `${key}=${formatFieldValue(value)}`).join(" ");
24814
+ }
24815
+ function formatLogLine(line) {
24816
+ const columns = [
24817
+ formatLocalTimestamp(line.at),
24818
+ `${line.appSlug}/${line.functionName}`,
24819
+ line.runId ? `#${line.runId.slice(0, SHORT_RUN_ID_LENGTH)}` : "",
24820
+ line.level.toUpperCase().padEnd(5),
24821
+ line.message,
24822
+ formatFields(line.fields)
24823
+ ];
24824
+ return columns.filter((c) => c !== "").join(" ");
24825
+ }
24826
+ function printLogLine(line, json2) {
24827
+ console.log(json2 ? JSON.stringify(line) : formatLogLine(line));
24828
+ }
24829
+
24830
+ // src/commands/logs.ts
24831
+ var LEVELS = ["debug", "info", "warn", "error"];
24832
+ function parseLevel(value) {
24833
+ if (!LEVELS.includes(value)) {
24834
+ throw new Error(`Invalid --level "${value}" \u2014 expected one of: ${LEVELS.join(", ")}.`);
24835
+ }
24836
+ return value;
24837
+ }
24838
+ function buildFetchOptions(appSlug, opts, baseUrl, apiKey) {
24839
+ return {
24840
+ baseUrl,
24841
+ apiKey,
24842
+ app: appSlug,
24843
+ function: opts.function,
24844
+ run: opts.run,
24845
+ level: parseLevel(opts.level),
24846
+ from: opts.since ? parseSince(opts.since) : void 0,
24847
+ limit: Number(opts.limit)
24848
+ };
24849
+ }
24850
+ function warnIfEvicted(since, oldestAvailableAt) {
24851
+ if (!since || !oldestAvailableAt) return;
24852
+ if (new Date(since) < new Date(oldestAvailableAt)) {
24853
+ console.error(`note: logs before ${oldestAvailableAt} have been evicted (size cap)`);
24854
+ }
24855
+ }
24856
+ function followLogs(fetchOptions, startSeq, json2) {
24857
+ let nextSeq = startSeq;
24858
+ let intervalMs = FOLLOW_MIN_INTERVAL_MS;
24859
+ process.on("SIGINT", () => {
24860
+ process.exit(0);
24861
+ });
24862
+ const poll = async () => {
24863
+ try {
24864
+ const page = await fetchLogs({ ...fetchOptions, afterSeq: nextSeq });
24865
+ for (const line of page.lines) printLogLine(line, json2);
24866
+ if (page.lines.length > 0) nextSeq = page.nextSeq;
24867
+ intervalMs = nextFollowInterval({
24868
+ current: intervalMs,
24869
+ hadActivity: page.lines.length > 0
24870
+ });
24871
+ } catch (err) {
24872
+ if (err instanceof ApiError && (err.status === 401 || err.status === 503)) {
24873
+ reportApiError(err);
24874
+ }
24875
+ const message = err instanceof Error ? err.message : String(err);
24876
+ console.error(`warning: poll failed (${message}) \u2014 retrying`);
24877
+ intervalMs = nextFollowInterval({ current: intervalMs, hadActivity: false, hadError: true });
24878
+ }
24879
+ setTimeout(() => void poll(), intervalMs);
24880
+ };
24881
+ setTimeout(() => void poll(), intervalMs);
24882
+ }
24883
+ function buildLogsCommand() {
24884
+ return new Command("logs").description("Tail or query application logs").argument("[appSlug]", "Only logs of this app").option("--run <runId>", "Only lines of this run").option("--function <name>", "Only this function").option("--level <level>", "Minimum level (debug|info|warn|error)", "debug").option("--since <value>", "Duration (15m, 2h, 3d) or ISO 8601 datetime").option("--limit <n>", "Max lines to fetch (max 1000)", "200").option("-f, --follow", "Keep polling for new lines").option("--json", "Raw NDJSON output (one JSON line per log)").option("--remote <name>", "Named remote server to target").action(async (appSlug, opts) => {
24885
+ const baseUrl = opts.remote ? getRemoteUrl(opts.remote) : DEFAULT_REMOTE_URL;
24886
+ const apiKey = resolveApiKey(opts.remote);
24887
+ const json2 = opts.json ?? false;
24888
+ let fetchOptions;
24889
+ try {
24890
+ fetchOptions = buildFetchOptions(appSlug, opts, baseUrl, apiKey);
24891
+ } catch (err) {
24892
+ console.error(err instanceof Error ? err.message : String(err));
24893
+ process.exit(1);
24894
+ }
24895
+ try {
24896
+ const initial = await fetchLogs(fetchOptions);
24897
+ for (const line of initial.lines) printLogLine(line, json2);
24898
+ if (opts.follow) {
24899
+ followLogs(fetchOptions, initial.nextSeq, json2);
24900
+ return;
24901
+ }
24902
+ warnIfEvicted(fetchOptions.from, initial.oldestAvailableAt);
24903
+ } catch (err) {
24904
+ reportApiError(err);
24905
+ }
24906
+ });
24907
+ }
24908
+
24909
+ // src/commands/runs-start.ts
24910
+ var import_fs8 = require("fs");
24911
+ var RUN_LOOKUP_INTERVAL_MS = 1e3;
24912
+ var RUN_LOOKUP_BUDGET_MS = 3e4;
24913
+ function fail(code, ...lines) {
24914
+ for (const line of lines) console.error(line);
24915
+ process.exit(code);
24916
+ }
24917
+ function sleep2(ms) {
24918
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
24919
+ }
24920
+ function parseTarget(target) {
24921
+ const [appSlug, functionName, ...rest] = target.split("/");
24922
+ if (!appSlug || !functionName || rest.length > 0) {
24923
+ fail(2, `Error: expected <appSlug>/<functionName>, got "${target}".`);
24924
+ }
24925
+ return { appSlug, functionName };
24926
+ }
24927
+ function readDataFile(path) {
24928
+ try {
24929
+ return path === "-" ? (0, import_fs8.readFileSync)(0, "utf8") : (0, import_fs8.readFileSync)(path, "utf8");
24930
+ } catch (err) {
24931
+ const detail = err instanceof Error ? err.message : String(err);
24932
+ fail(2, `Error: cannot read --data-file "${path}": ${detail}`);
24933
+ }
24934
+ }
24935
+ function parseJsonObject(raw, flag) {
24936
+ let parsed;
24937
+ try {
24938
+ parsed = JSON.parse(raw);
24939
+ } catch (err) {
24940
+ const detail = err instanceof Error ? err.message : String(err);
24941
+ fail(2, `Error: ${flag} is not valid JSON: ${detail}`);
24942
+ }
24943
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
24944
+ fail(2, `Error: ${flag} must be a JSON object.`);
24945
+ }
24946
+ return parsed;
24947
+ }
24948
+ function resolvePayload(opts) {
24949
+ if (opts.data !== void 0 && opts.dataFile !== void 0) {
24950
+ fail(2, "Error: --data and --data-file are mutually exclusive.");
24951
+ }
24952
+ if (opts.data !== void 0) return parseJsonObject(opts.data, "--data");
24953
+ if (opts.dataFile !== void 0)
24954
+ return parseJsonObject(readDataFile(opts.dataFile), "--data-file");
24955
+ return void 0;
24956
+ }
24957
+ function parseTimeoutMs(raw) {
24958
+ const ms = parseDurationMs(raw);
24959
+ if (ms === void 0) {
24960
+ fail(2, `Error: invalid --timeout "${raw}" \u2014 expected a duration like 90s, 10m, 2h.`);
24961
+ }
24962
+ return ms;
24963
+ }
24964
+ function ensureNonInteractiveConsent(yes) {
24965
+ if (!process.stdin.isTTY && !yes) {
24966
+ fail(2, "Error: refusing to trigger without --yes in non-interactive mode.");
24967
+ }
24968
+ }
24969
+ function classifyAndFail(err, appSlug, remote) {
24970
+ if (!(err instanceof ApiError)) {
24971
+ if (err instanceof TypeError && err.cause !== void 0) {
24972
+ const cause = err.cause instanceof Error ? err.cause.message : String(err.cause);
24973
+ fail(1, `Error: could not reach ${remote ? `remote "${remote}"` : "the server"}: ${cause}`);
24974
+ }
24975
+ throw err;
24976
+ }
24977
+ if (err.status === 401 || err.status === 403) {
24978
+ const remoteHint = remote ? ` --remote ${remote}` : "";
24979
+ fail(
24980
+ 4,
24981
+ `Server error (${err.status}): ${err.message}`,
24982
+ `Run "apotech-os login${remoteHint}" to (re)authenticate.`
24983
+ );
24984
+ }
24985
+ const code = extractCode(err.body);
24986
+ if (err.status === 409 && code === "APP_NOT_RUNNABLE") {
24987
+ fail(
24988
+ 9,
24989
+ `Error: app "${appSlug}" is not in a runnable state. Check "apotech-os plan" / reinstall the app.`
24990
+ );
24991
+ }
24992
+ if (err.status === 404 && code === "JOB_NOT_FOUND" || err.status === 400 && code === "JOB_NOT_MANUALLY_TRIGGERABLE") {
24993
+ fail(3, `Server error (${err.status}): ${err.message}`);
24994
+ }
24995
+ reportApiError(err);
24996
+ }
24997
+ function isTriggerable(job) {
24998
+ return job.appTrigger?.type === "cron" || job.appTrigger?.type === "event";
24999
+ }
25000
+ function formatTriggerableList(appSlug, candidates) {
25001
+ const triggerable = candidates.filter(isTriggerable);
25002
+ if (triggerable.length === 0) {
25003
+ return `Triggerable functions of "${appSlug}": none.`;
25004
+ }
25005
+ const list = triggerable.map((job) => `${job.title} (${job.appTrigger?.type})`).join(", ");
25006
+ return `Triggerable functions of "${appSlug}": ${list}`;
25007
+ }
25008
+ function failTriggerGate(appSlug, candidates, message) {
25009
+ fail(3, message, formatTriggerableList(appSlug, candidates));
25010
+ }
25011
+ function notTriggerableMessage(appSlug, functionName) {
25012
+ return `Error: no triggerable function "${functionName}" in app "${appSlug}" \u2014 it may not exist, or it may be a uiInvoke function (those run inline in the app UI; the CLI cannot start them in v1).`;
25013
+ }
25014
+ async function resolveFunction(baseUrl, apiKey, appSlug, functionName) {
25015
+ const { jobs } = await fetchJobs({ baseUrl, apiKey });
25016
+ const candidates = jobs.filter((job2) => job2.source === "app" && job2.appSlug === appSlug);
25017
+ if (candidates.length === 0) {
25018
+ fail(3, `Error: app "${appSlug}" has no functions in the catalogue \u2014 is it installed?`);
25019
+ }
25020
+ const job = candidates.find((candidate) => candidate.title === functionName);
25021
+ if (!job) {
25022
+ failTriggerGate(appSlug, candidates, notTriggerableMessage(appSlug, functionName));
25023
+ }
25024
+ const trigger = job.appTrigger;
25025
+ if (!trigger) {
25026
+ failTriggerGate(
25027
+ appSlug,
25028
+ candidates,
25029
+ 'Error: this server does not report function trigger kinds \u2014 upgrade the server to use "runs start".'
25030
+ );
25031
+ }
25032
+ if (isTriggerable(job)) {
25033
+ return job.id;
25034
+ }
25035
+ if (trigger.type === "dbEvent") {
25036
+ failTriggerGate(
25037
+ appSlug,
25038
+ candidates,
25039
+ `Error: function "${functionName}" runs when a "${trigger.objectRef}" record is ${trigger.operation} \u2014 trigger the data change instead.`
25040
+ );
25041
+ }
25042
+ if (trigger.type === "httpRoute") {
25043
+ failTriggerGate(
25044
+ appSlug,
25045
+ candidates,
25046
+ `Error: function "${functionName}" is an HTTP route \u2014 call ${trigger.method} /api/s/${appSlug}${trigger.path} directly.`
25047
+ );
25048
+ }
25049
+ failTriggerGate(appSlug, candidates, notTriggerableMessage(appSlug, functionName));
25050
+ }
25051
+ async function preflightCheck(baseUrl, apiKey, functionKey, ifIdle, json2) {
25052
+ const page = await fetchRuns({
25053
+ baseUrl,
25054
+ apiKey,
25055
+ slug: functionKey,
25056
+ status: "RUNNING,QUEUED",
25057
+ limit: 1
25058
+ });
25059
+ const inFlight = page.runs[0];
25060
+ if (!inFlight) return;
25061
+ if (ifIdle) {
25062
+ if (json2) {
25063
+ console.log(JSON.stringify({ error: "ALREADY_RUNNING", inFlightRunId: inFlight.id }));
25064
+ process.exit(8);
25065
+ }
25066
+ fail(
25067
+ 8,
25068
+ `Error: a run is already in flight (${inFlight.id}). Re-run without --if-idle to queue anyway.`
25069
+ );
25070
+ }
25071
+ console.error(
25072
+ `note: a run of this function is already ${inFlight.status} (${inFlight.id}); triggering another one anyway.`
25073
+ );
25074
+ }
25075
+ async function confirmTrigger(appSlug, functionName, remote) {
25076
+ const confirmMod = await Promise.resolve().then(() => (init_esm4(), esm_exports));
25077
+ const confirm = confirmMod.default;
25078
+ return confirm({
25079
+ message: `Trigger ${appSlug}/${functionName} on remote "${remote ?? "default"}"?`,
25080
+ default: false
25081
+ });
25082
+ }
25083
+ async function resolveRunId(baseUrl, apiKey, eventId, budgetMs) {
25084
+ const lookupDeadline = Date.now() + budgetMs;
25085
+ for (; ; ) {
25086
+ const { runId } = await lookupRun({ baseUrl, apiKey, ref: eventId });
25087
+ if (runId !== null) return runId;
25088
+ if (Date.now() >= lookupDeadline) return null;
25089
+ await sleep2(RUN_LOOKUP_INTERVAL_MS);
25090
+ }
25091
+ }
25092
+ var TERMINAL_EXIT_CODE = {
25093
+ COMPLETED: 0,
25094
+ FAILED: 5,
25095
+ CANCELLED: 6,
25096
+ SKIPPED: 6
25097
+ };
25098
+ function isTerminalRunStatus(status) {
25099
+ return status in TERMINAL_EXIT_CODE;
25100
+ }
25101
+ function reportTransientPollError(err) {
25102
+ if (err instanceof ApiError && err.status === 401) throw err;
25103
+ const message = err instanceof Error ? err.message : String(err);
25104
+ console.error(`warning: poll failed (${message}) \u2014 retrying`);
25105
+ }
25106
+ async function drainFinalLogs(baseUrl, apiKey, runId, afterSeq, json2) {
25107
+ try {
25108
+ const page = await fetchLogs({ baseUrl, apiKey, run: runId, afterSeq });
25109
+ for (const line of page.lines) printLogLine(line, json2);
25110
+ } catch {
25111
+ }
25112
+ }
25113
+ function readableRunError(error51) {
25114
+ try {
25115
+ const parsed = JSON.parse(error51);
25116
+ if (parsed && typeof parsed === "object" && "message" in parsed) {
25117
+ const message = parsed["message"];
25118
+ if (typeof message === "string" && message.length > 0) return message;
25119
+ }
25120
+ } catch {
25121
+ }
25122
+ return error51;
25123
+ }
25124
+ function exitForTerminalStatus(detail, json2) {
25125
+ const dur = formatRunDuration(detail);
25126
+ if (json2) {
25127
+ console.log(JSON.stringify(detail));
25128
+ } else if (detail.status === "COMPLETED") {
25129
+ console.log(`Run ${detail.id} COMPLETED in ${dur}.`);
25130
+ } else if (detail.status === "FAILED") {
25131
+ const errSuffix = detail.error ? `: ${readableRunError(detail.error)}` : ".";
25132
+ console.error(`Run ${detail.id} FAILED after ${dur}${errSuffix}`);
25133
+ } else {
25134
+ console.error(`Run ${detail.id} ${detail.status} after ${dur}.`);
25135
+ }
25136
+ process.exit(TERMINAL_EXIT_CODE[detail.status] ?? 6);
25137
+ }
25138
+ async function followRun(baseUrl, apiKey, runId, deadline, timeoutRaw, json2) {
25139
+ process.on("SIGINT", () => {
25140
+ fail(
25141
+ 130,
25142
+ `Interrupted; run ${runId} continues. Follow up with: apotech-os runs show ${runId} --logs`
25143
+ );
25144
+ });
25145
+ let afterSeq;
25146
+ let intervalMs = FOLLOW_MIN_INTERVAL_MS;
25147
+ let logsDisabled = false;
25148
+ let lastKnownStatus;
25149
+ for (; ; ) {
25150
+ let newLogLines = false;
25151
+ let hadError = false;
25152
+ if (!logsDisabled) {
25153
+ try {
25154
+ const page = await fetchLogs({ baseUrl, apiKey, run: runId, afterSeq });
25155
+ for (const line of page.lines) printLogLine(line, json2);
25156
+ if (page.lines.length > 0) {
25157
+ newLogLines = true;
25158
+ afterSeq = page.nextSeq;
25159
+ }
25160
+ } catch (err) {
25161
+ if (err instanceof ApiError && err.status === 503 && extractCode(err.body) === "LOGS_NOT_CONFIGURED") {
25162
+ logsDisabled = true;
25163
+ console.error(
25164
+ "note: server has no log file configured (APP_LOGS_FILE); following status only"
25165
+ );
25166
+ } else {
25167
+ reportTransientPollError(err);
25168
+ hadError = true;
25169
+ }
25170
+ }
25171
+ }
25172
+ let detail;
25173
+ try {
25174
+ detail = await fetchRunDetail({ baseUrl, apiKey, runId });
25175
+ lastKnownStatus = detail.status;
25176
+ } catch (err) {
25177
+ reportTransientPollError(err);
25178
+ hadError = true;
25179
+ }
25180
+ if (detail && isTerminalRunStatus(detail.status)) {
25181
+ if (!logsDisabled) await drainFinalLogs(baseUrl, apiKey, runId, afterSeq, json2);
25182
+ exitForTerminalStatus(detail, json2);
25183
+ }
25184
+ if (Date.now() >= deadline) {
25185
+ fail(
25186
+ 7,
25187
+ `Timed out after ${timeoutRaw}; run ${runId} is still ${lastKnownStatus ?? "unknown"} on the server. Follow up with: apotech-os runs show ${runId} --logs`
25188
+ );
25189
+ }
25190
+ intervalMs = nextFollowInterval({ current: intervalMs, hadActivity: newLogLines, hadError });
25191
+ await sleep2(intervalMs);
25192
+ }
25193
+ }
25194
+ function buildRunsStartCommand() {
25195
+ return new Command("start").description("Trigger an app function; with --follow, block until it reaches a terminal status").argument("<target>", "<appSlug>/<functionName>").option("--data <json>", "Inline JSON object \u2192 request body.data").option("--data-file <path>", "Read JSON from file; '-' reads stdin").option("--follow", "Stream logs and block until the run reaches a terminal status").option("--timeout <duration>", "Max wall time in follow mode (e.g. 90s, 10m, 2h)", "30m").option("--if-idle", "Refuse if a run of this function is already RUNNING or QUEUED").option("-y, --yes", "Skip the confirmation prompt").option("--json", "Machine-readable output").option("--remote <name>", "Named remote server to target").action(async (target, opts) => {
25196
+ ensureNonInteractiveConsent(opts.yes);
25197
+ const { appSlug, functionName } = parseTarget(target);
25198
+ const payload = resolvePayload(opts);
25199
+ const timeoutMs = parseTimeoutMs(opts.timeout);
25200
+ const baseUrl = opts.remote ? getRemoteUrl(opts.remote) : DEFAULT_REMOTE_URL;
25201
+ const apiKey = resolveApiKey(opts.remote);
25202
+ const json2 = opts.json ?? false;
25203
+ try {
25204
+ const functionKey = await resolveFunction(baseUrl, apiKey, appSlug, functionName);
25205
+ await preflightCheck(baseUrl, apiKey, functionKey, opts.ifIdle ?? false, json2);
25206
+ if (!opts.yes) {
25207
+ const confirmed = await confirmTrigger(appSlug, functionName, opts.remote);
25208
+ if (!confirmed) {
25209
+ fail(1, "Aborted.");
25210
+ }
25211
+ }
25212
+ const { runId: triggeredRunId, eventId } = await triggerJob({
25213
+ baseUrl,
25214
+ apiKey,
25215
+ key: functionKey,
25216
+ data: payload
25217
+ });
25218
+ const deadline = Date.now() + timeoutMs;
25219
+ let runId = triggeredRunId;
25220
+ if (runId === null) {
25221
+ if (eventId === null) {
25222
+ fail(1, "Error: the server accepted the trigger but returned no event id.");
25223
+ }
25224
+ const lookupBudgetMs = opts.follow ? Math.min(RUN_LOOKUP_BUDGET_MS, timeoutMs) : RUN_LOOKUP_BUDGET_MS;
25225
+ runId = await resolveRunId(baseUrl, apiKey, eventId, lookupBudgetMs);
25226
+ }
25227
+ if (json2 && !opts.follow) {
25228
+ console.log(JSON.stringify({ runId, eventId, status: "accepted" }));
25229
+ return;
25230
+ }
25231
+ if (!json2) {
25232
+ console.log(`Event ${eventId} accepted.`);
25233
+ if (runId) console.log(`Run ${runId} started.`);
25234
+ }
25235
+ if (!opts.follow) {
25236
+ if (!json2 && !runId) {
25237
+ console.log(`Run not linked yet; follow up with: apotech-os runs show ${eventId}`);
25238
+ }
25239
+ return;
25240
+ }
25241
+ if (!runId) {
25242
+ fail(
25243
+ 7,
25244
+ `Timed out after ${opts.timeout}; the run has not been linked yet. Follow up with: apotech-os runs show ${eventId}`
25245
+ );
25246
+ }
25247
+ await followRun(baseUrl, apiKey, runId, deadline, opts.timeout, json2);
25248
+ } catch (err) {
25249
+ classifyAndFail(err, appSlug, opts.remote);
25250
+ }
25251
+ });
25252
+ }
25253
+
25254
+ // src/commands/runs.ts
25255
+ var STATUS_ALIASES = Object.fromEntries(
25256
+ FUNCTION_RUN_STATUSES.map((status) => [status.toLowerCase(), status])
25257
+ );
25258
+ function mapStatusCsv(csv) {
25259
+ return csv.split(",").map((raw) => raw.trim()).filter((s) => s.length > 0).map((s) => STATUS_ALIASES[s.toLowerCase()] ?? s.toUpperCase()).join(",");
25260
+ }
25261
+ function appFunctionLabel(run) {
25262
+ if (run.source === "app") return `${run.appSlug ?? "?"}/${run.functionName ?? run.functionId}`;
25263
+ return run.functionSlug ?? run.functionId;
25264
+ }
25265
+ function triggerLabel(run) {
25266
+ if (run.triggerType) return run.triggerType;
25267
+ if (run.cronSchedule) return `cron(${run.cronSchedule})`;
25268
+ if (run.eventName) return run.eventName;
25269
+ return "-";
25270
+ }
25271
+ function renderTable(headers, rows) {
25272
+ const widths = headers.map(
25273
+ (header, i) => Math.max(header.length, ...rows.map((row) => (row[i] ?? "").length))
25274
+ );
25275
+ const renderRow = (cells) => cells.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" ").trimEnd();
25276
+ return [renderRow(headers), ...rows.map(renderRow)].join("\n");
25277
+ }
25278
+ function renderRunsTable(runs) {
25279
+ if (runs.length === 0) return "No runs found.";
25280
+ const headers = ["STATUS", "RUN ID", "APP/FUNCTION", "TRIGGER", "STARTED", "DURATION"];
25281
+ const rows = runs.map((run) => [
25282
+ run.status,
25283
+ run.id,
25284
+ appFunctionLabel(run),
25285
+ triggerLabel(run),
25286
+ formatLocalTimestamp(run.startedAt ?? run.queuedAt),
25287
+ formatRunDuration(run)
25288
+ ]);
25289
+ return renderTable(headers, rows);
25290
+ }
25291
+ function renderRunDetail(detail) {
25292
+ const lines = [
25293
+ `Status: ${detail.status}`,
25294
+ `Function: ${appFunctionLabel(detail)}`,
25295
+ `Trigger: ${triggerLabel(detail)}`,
25296
+ `Run ID: ${detail.id}`,
25297
+ `Queued: ${formatLocalTimestamp(detail.queuedAt)}`,
25298
+ `Started: ${detail.startedAt ? formatLocalTimestamp(detail.startedAt) : "-"}`,
25299
+ `Ended: ${detail.endedAt ? formatLocalTimestamp(detail.endedAt) : "-"}`,
25300
+ `Duration: ${formatRunDuration(detail)}`
25301
+ ];
25302
+ if (detail.error) {
25303
+ lines.push("", `Error: ${detail.error}`);
25304
+ }
25305
+ if (detail.steps.length > 0) {
25306
+ lines.push("", "Steps:");
25307
+ for (const step of detail.steps) {
25308
+ const duration3 = step.durationMs !== null && step.durationMs !== void 0 ? formatDurationMs(step.durationMs) : "-";
25309
+ lines.push(` - ${step.name} [${step.status}] ${duration3}`);
25310
+ }
25311
+ }
25312
+ return lines.join("\n");
25313
+ }
25314
+ function buildListCommand() {
25315
+ return new Command("list").description("List job/function runs").argument("[appSlug]", "Only runs of this app").option("--status <statuses>", "CSV of queued|running|completed|failed|cancelled|skipped").option("--function <name>", "Only this function").option("--since <value>", "Duration (15m, 2h, 3d) or ISO 8601 datetime", "24h").option("--limit <n>", "Max runs to fetch (max 100)", "50").option("--json", "Output the raw response as JSON").option("--remote <name>", "Named remote server to target").action(async (appSlug, opts) => {
25316
+ const baseUrl = opts.remote ? getRemoteUrl(opts.remote) : DEFAULT_REMOTE_URL;
25317
+ const apiKey = resolveApiKey(opts.remote);
25318
+ try {
25319
+ const page = await fetchRuns({
25320
+ baseUrl,
25321
+ apiKey,
25322
+ appSlug,
25323
+ functionName: opts.function,
25324
+ status: opts.status ? mapStatusCsv(opts.status) : void 0,
25325
+ from: parseSince(opts.since),
25326
+ limit: Number(opts.limit),
25327
+ source: appSlug ? "app" : "both"
25328
+ });
25329
+ if (opts.json) {
25330
+ console.log(JSON.stringify(page));
25331
+ } else {
25332
+ console.log(renderRunsTable(page.runs));
25333
+ }
25334
+ } catch (err) {
25335
+ reportApiError(err);
25336
+ }
25337
+ });
25338
+ }
25339
+ function buildShowCommand() {
25340
+ return new Command("show").description("Show detail for one run").argument("<runId>", "Run ID").option("--logs", "Also fetch and print the run's ctx.logger lines").option("--json", "Output the raw response as JSON").option("--remote <name>", "Named remote server to target").action(async (runId, opts) => {
25341
+ const baseUrl = opts.remote ? getRemoteUrl(opts.remote) : DEFAULT_REMOTE_URL;
25342
+ const apiKey = resolveApiKey(opts.remote);
25343
+ try {
25344
+ const [detail, logs] = await Promise.all([
25345
+ fetchRunDetail({ baseUrl, apiKey, runId }),
25346
+ opts.logs ? fetchLogs({ baseUrl, apiKey, run: runId }) : void 0
25347
+ ]);
25348
+ const logLines = logs?.lines;
25349
+ if (opts.json) {
25350
+ console.log(JSON.stringify(logLines ? { ...detail, logs: logLines } : detail));
25351
+ return;
25352
+ }
25353
+ console.log(renderRunDetail(detail));
25354
+ if (logLines) {
25355
+ console.log("\nLogs:");
25356
+ for (const line of logLines) console.log(formatLogLine(line));
25357
+ }
25358
+ } catch (err) {
25359
+ reportApiError(err);
25360
+ }
25361
+ });
25362
+ }
25363
+ function buildRunsCommand() {
25364
+ const runs = new Command("runs").description("Inspect and trigger job/function runs");
25365
+ runs.addCommand(buildListCommand());
25366
+ runs.addCommand(buildShowCommand());
25367
+ runs.addCommand(buildRunsStartCommand());
25368
+ return runs;
25369
+ }
25370
+
24586
25371
  // src/index.ts
24587
25372
  function readVersion() {
24588
25373
  try {
24589
- const pkg = (0, import_fs8.readFileSync)((0, import_path6.join)(__dirname, "..", "package.json"), "utf8");
25374
+ const pkg = (0, import_fs9.readFileSync)((0, import_path6.join)(__dirname, "..", "package.json"), "utf8");
24590
25375
  return JSON.parse(pkg).version ?? "0.0.0";
24591
25376
  } catch {
24592
25377
  return "0.0.0";
@@ -24601,6 +25386,8 @@ program2.addCommand(buildLoginCommand());
24601
25386
  program2.addCommand(buildBuildCommand());
24602
25387
  program2.addCommand(buildPublishCommand());
24603
25388
  program2.addCommand(buildInstallCommand());
25389
+ program2.addCommand(buildLogsCommand());
25390
+ program2.addCommand(buildRunsCommand());
24604
25391
  program2.parseAsync(process.argv).catch((err) => {
24605
25392
  console.error(err instanceof Error ? err.message : String(err));
24606
25393
  process.exit(1);