@apotech-os/cli 2.3.0 → 2.5.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/README.md CHANGED
@@ -77,6 +77,25 @@ WOPILO_API_KEY=$SECRET apotech-os deploy --remote production
77
77
  | `apotech-os app:install --remote <name>` | Install/upgrade a published version |
78
78
  | `apotech-os remote add --url <url> --as <name>` | Register a remote |
79
79
  | `apotech-os login --remote <name>` | Obtain and store an API key |
80
+ | `apotech-os data objects` | List the objects the explorer can query |
81
+ | `apotech-os data schema <app>/<object>` | Fields, types, required and indexed flags |
82
+ | `apotech-os data list <app>/<object>` | Read rows, with `--filter` / `--sort` / `--json` |
83
+ | `apotech-os data count <app>/<object>` | Count rows matching a filter |
84
+
85
+ The `data` group is strictly read-only. It needs a key **linked to a user**
86
+ (`apotech-os login`, not a key pasted from the admin UI) whose platform role is
87
+ **ADMIN** — it reads raw rows across every app space. Core objects are addressed
88
+ under the reserved slug `_core`:
89
+
90
+ ```sh
91
+ apotech-os data list _core/shopify-order --filter '{"name":{"contains":"1001"}}' --json
92
+ ```
93
+
94
+ `--filter` / `--search` / `--sort` are the server's own JSON grammar, passed
95
+ through untouched; operators are `eq neq contains ncontains gt lt gte lte empty
96
+ nempty`. `--limit` is a total row count (default 50, max 1000) — the command
97
+ pages for you. `--json` prints the raw `{items, nextCursor}` envelope, which is
98
+ what a script or an agent should read.
80
99
 
81
100
  `app:upgrade` is an alias of `app:install` — an upgrade is just an install at a
82
101
  higher version. `app:build` / `app:publish` / `app:install` are the discrete
package/dist/index.js CHANGED
@@ -22895,7 +22895,16 @@ var FunctionDefFieldsSchema = external_exports.object({
22895
22895
  * function without them behaves identically, its card simply stays empty.
22896
22896
  */
22897
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()
22898
+ then: external_exports.string().min(1).describe('Human "alors" narrative \u2014 what this function does when it runs (UI only).').optional(),
22899
+ /**
22900
+ * Opt-in projection of this function as an agent tool. Only meaningful on a
22901
+ * `uiInvoke` function — enforced by `checkManifestSemantics`, not a Zod
22902
+ * refinement, so a manifest already persisted with this field keeps parsing.
22903
+ * `description` is the tool's documentation surfaced to the calling agent.
22904
+ */
22905
+ agentTool: external_exports.object({
22906
+ description: external_exports.string().min(1)
22907
+ }).optional()
22899
22908
  });
22900
22909
  var FunctionDefSchema = FunctionDefFieldsSchema.superRefine((fn, ctx) => {
22901
22910
  if (fn.input && fn.trigger.type !== "uiInvoke" && fn.trigger.type !== "httpRoute") {
@@ -22963,7 +22972,13 @@ var AppRoleSchema = external_exports.object({
22963
22972
  * Unlike `reads`/`writes`, entries here are EXPECTED to name a foreign app —
22964
22973
  * `findForeignRoleRefs` does not (and must not) inspect this field.
22965
22974
  */
22966
- calls: external_exports.array(external_exports.string()).optional()
22975
+ calls: external_exports.array(external_exports.string()).optional(),
22976
+ /**
22977
+ * Agent slugs the app is allowed to invoke via ctx.api.agents.invoke().
22978
+ * '*' grants access to all agents (wildcard). Requires role.capabilities to
22979
+ * include 'agents' — checked by `checkManifestSemantics`, not by this schema.
22980
+ */
22981
+ agents: external_exports.array(external_exports.string()).optional()
22967
22982
  });
22968
22983
  var UI_ENTRY_REGEX = /^dist\/ui\/[A-Za-z0-9_-]+\.js$/;
22969
22984
  var PageDefSchema = external_exports.object({
@@ -23008,6 +23023,18 @@ var PromptDefSchema = external_exports.object({
23008
23023
  template: external_exports.string(),
23009
23024
  labels: external_exports.array(external_exports.string()).optional()
23010
23025
  });
23026
+ var AgentDeclarationSchema = external_exports.object({
23027
+ /** Stable per platform; becomes the Langfuse prompt name `agent.platform.<slug>`. */
23028
+ slug: external_exports.string().regex(/^[a-z][a-z0-9-]*$/),
23029
+ name: external_exports.string().min(1),
23030
+ description: external_exports.string().optional(),
23031
+ /** Immutable once created — the server never updates it. */
23032
+ type: external_exports.enum(["chat", "classifier"]).optional(),
23033
+ provider: external_exports.enum(["openai", "anthropic"]).optional(),
23034
+ model: external_exports.string().optional(),
23035
+ /** System prompt: seeded as Langfuse v1, re-versioned when the app changes it. */
23036
+ prompt: external_exports.string().min(1)
23037
+ });
23011
23038
  var AppManifestFieldsSchema = external_exports.object({
23012
23039
  universalIdentifier: external_exports.string().uuid(),
23013
23040
  slug: external_exports.string().regex(/^[a-z][a-z0-9-]*$/),
@@ -23082,6 +23109,10 @@ var AppManifestFieldsSchema = external_exports.object({
23082
23109
  // Phase 6: declarative views
23083
23110
  role: AppRoleSchema.optional(),
23084
23111
  // Phase 6: scoped app token role
23112
+ /** Agents this app ships. Orthogonal to `role.agents`, which is the
23113
+ * allowlist of agents the app may INVOKE — an app can declare an agent
23114
+ * for a human to chat with without ever calling it itself. */
23115
+ agents: external_exports.array(AgentDeclarationSchema).optional(),
23085
23116
  navigation: external_exports.array(NavItemSchema),
23086
23117
  /** Default RBAC role granted to any member with no explicit grant on this app.
23087
23118
  * ADMIN is intentionally excluded — an app cannot self-elevate to admin.
@@ -23531,6 +23562,25 @@ function checkManifestSemantics(manifest) {
23531
23562
  `functions."${fn.name}".onFailure: "${fn.onFailure}" is not declared in manifest.emits. onFailure travels on the app custom-event bus; naming an integration or platform event would re-invoke that handler with a failure payload.`
23532
23563
  );
23533
23564
  }
23565
+ if (fn.agentTool !== void 0 && fn.trigger.type !== "uiInvoke") {
23566
+ errors.push(`function '${fn.name}': agentTool requires a uiInvoke trigger`);
23567
+ }
23568
+ }
23569
+ const role = manifest.role;
23570
+ const hasAgentsAllowlist = (role?.agents ?? []).length > 0;
23571
+ const hasAgentsCapability = (role?.capabilities ?? []).includes("agents");
23572
+ if (hasAgentsAllowlist && !hasAgentsCapability) {
23573
+ errors.push("role.agents requires role.capabilities to include 'agents'");
23574
+ }
23575
+ if (hasAgentsCapability && !hasAgentsAllowlist) {
23576
+ errors.push("role.capabilities includes 'agents' but role.agents is empty");
23577
+ }
23578
+ const agentSlugs = /* @__PURE__ */ new Set();
23579
+ for (const agent of manifest.agents ?? []) {
23580
+ if (agentSlugs.has(agent.slug)) {
23581
+ errors.push(`agents: duplicate slug '${agent.slug}' \u2014 each declared agent needs its own`);
23582
+ }
23583
+ agentSlugs.add(agent.slug);
23534
23584
  }
23535
23585
  return errors;
23536
23586
  }
@@ -23957,6 +24007,38 @@ async function triggerJob(opts) {
23957
24007
  opts.apiKey
23958
24008
  );
23959
24009
  }
24010
+ async function fetchDataModel(opts) {
24011
+ return getJson(opts.baseUrl, "/platform/data-model", void 0, opts.apiKey);
24012
+ }
24013
+ function explorerPath(target, leaf) {
24014
+ return `/platform/data-explorer/${encodeURIComponent(target.appSlug)}/${encodeURIComponent(
24015
+ target.objectKey
24016
+ )}/${leaf}`;
24017
+ }
24018
+ async function fetchObjectMeta(target) {
24019
+ return getJson(
24020
+ target.baseUrl,
24021
+ explorerPath(target, "meta"),
24022
+ void 0,
24023
+ target.apiKey
24024
+ );
24025
+ }
24026
+ async function fetchRecords(opts) {
24027
+ const params = new URLSearchParams();
24028
+ if (opts.cursor) params.set("cursor", opts.cursor);
24029
+ if (opts.limit !== void 0) params.set("limit", String(opts.limit));
24030
+ if (opts.id) params.set("id", opts.id);
24031
+ if (opts.filter) params.set("filter", opts.filter);
24032
+ if (opts.search) params.set("search", opts.search);
24033
+ if (opts.sort) params.set("sort", opts.sort);
24034
+ return getJson(opts.baseUrl, explorerPath(opts, "records"), params, opts.apiKey);
24035
+ }
24036
+ async function countRecords(opts) {
24037
+ const params = new URLSearchParams();
24038
+ if (opts.filter) params.set("filter", opts.filter);
24039
+ if (opts.search) params.set("search", opts.search);
24040
+ return getJson(opts.baseUrl, explorerPath(opts, "count"), params, opts.apiKey);
24041
+ }
23960
24042
  async function getJson(baseUrl, path, params, apiKey) {
23961
24043
  const query = params?.toString();
23962
24044
  const url2 = `${baseUrl.replace(/\/$/, "")}${path}${query ? `?${query}` : ""}`;
@@ -24906,6 +24988,15 @@ function buildLogsCommand() {
24906
24988
  });
24907
24989
  }
24908
24990
 
24991
+ // src/table.ts
24992
+ function renderTable(headers, rows) {
24993
+ const widths = headers.map(
24994
+ (header, i) => Math.max(header.length, ...rows.map((row) => (row[i] ?? "").length))
24995
+ );
24996
+ const renderRow = (cells) => cells.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" ").trimEnd();
24997
+ return [renderRow(headers), ...rows.map(renderRow)].join("\n");
24998
+ }
24999
+
24909
25000
  // src/commands/runs-start.ts
24910
25001
  var import_fs8 = require("fs");
24911
25002
  var RUN_LOOKUP_INTERVAL_MS = 1e3;
@@ -25268,13 +25359,6 @@ function triggerLabel(run) {
25268
25359
  if (run.eventName) return run.eventName;
25269
25360
  return "-";
25270
25361
  }
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
25362
  function renderRunsTable(runs) {
25279
25363
  if (runs.length === 0) return "No runs found.";
25280
25364
  const headers = ["STATUS", "RUN ID", "APP/FUNCTION", "TRIGGER", "STARTED", "DURATION"];
@@ -25368,6 +25452,256 @@ function buildRunsCommand() {
25368
25452
  return runs;
25369
25453
  }
25370
25454
 
25455
+ // src/commands/data.ts
25456
+ var CORE_SLUG = "_core";
25457
+ var DEFAULT_LIMIT = 50;
25458
+ var MAX_LIMIT = 1e3;
25459
+ var SERVER_PAGE_MAX = 100;
25460
+ var MAX_TABLE_COLUMNS = 6;
25461
+ var MAX_CELL_WIDTH = 40;
25462
+ var TOP_LEVEL_COLUMNS = ["id", "coreRefId", "createdAt", "updatedAt"];
25463
+ function resolveTransport(opts) {
25464
+ return {
25465
+ baseUrl: opts.remote ? getRemoteUrl(opts.remote) : DEFAULT_REMOTE_URL,
25466
+ apiKey: resolveApiKey(opts.remote)
25467
+ };
25468
+ }
25469
+ function fail2(code, ...lines) {
25470
+ for (const line of lines) console.error(line);
25471
+ process.exit(code);
25472
+ }
25473
+ function parseTarget2(target) {
25474
+ const [appSlug, objectKey, ...rest] = target.split("/");
25475
+ if (!appSlug || !objectKey || rest.length > 0) {
25476
+ fail2(
25477
+ 2,
25478
+ `Error: expected <appSlug>/<objectKey>, got "${target}".`,
25479
+ `Core objects live under "${CORE_SLUG}", e.g. ${CORE_SLUG}/shopify-order.`
25480
+ );
25481
+ }
25482
+ return { appSlug, objectKey };
25483
+ }
25484
+ function requireJson(raw, flag, shape) {
25485
+ let parsed;
25486
+ try {
25487
+ parsed = JSON.parse(raw);
25488
+ } catch (err) {
25489
+ const detail = err instanceof Error ? err.message : String(err);
25490
+ fail2(2, `Error: ${flag} is not valid JSON: ${detail}`);
25491
+ }
25492
+ const ok = shape === "array" ? Array.isArray(parsed) : typeof parsed === "object" && parsed !== null && !Array.isArray(parsed);
25493
+ if (!ok) {
25494
+ fail2(2, `Error: ${flag} must be a JSON ${shape}.`);
25495
+ }
25496
+ return raw;
25497
+ }
25498
+ function parseLimit(raw) {
25499
+ const limit = Number(raw);
25500
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {
25501
+ fail2(2, `Error: --limit must be an integer between 1 and ${MAX_LIMIT}, got "${raw}".`);
25502
+ }
25503
+ return limit;
25504
+ }
25505
+ function parseFields(raw) {
25506
+ const fields = raw.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
25507
+ if (fields.length === 0) {
25508
+ fail2(2, "Error: --fields must name at least one column.");
25509
+ }
25510
+ return fields;
25511
+ }
25512
+ function buildObjectsCommand() {
25513
+ return new Command("objects").description("List the objects the explorer can query (core + app)").option("--app <slug>", `Only this app's objects ("${CORE_SLUG}" for core)`).option("--json", "Output the raw response as JSON").option("--remote <name>", "Named remote server to target").action(async (opts) => {
25514
+ const { baseUrl, apiKey } = resolveTransport(opts);
25515
+ try {
25516
+ const model = await fetchDataModel({ baseUrl, apiKey });
25517
+ const objects = model.groups.filter((group) => group.kind === "core" || group.kind === "app").flatMap(
25518
+ (group) => group.objects.map((object2) => ({
25519
+ appSlug: group.kind === "core" ? CORE_SLUG : group.owner,
25520
+ objectKey: object2.key,
25521
+ owner: group.label,
25522
+ fieldCount: object2.fields.length,
25523
+ coreRef: object2.coreRef ?? null
25524
+ }))
25525
+ ).filter((object2) => !opts.app || object2.appSlug === opts.app);
25526
+ if (opts.json) {
25527
+ console.log(JSON.stringify({ objects }));
25528
+ return;
25529
+ }
25530
+ if (objects.length === 0) {
25531
+ console.log(opts.app ? `No queryable objects for "${opts.app}".` : "No objects found.");
25532
+ return;
25533
+ }
25534
+ console.log(
25535
+ renderTable(
25536
+ ["OBJECT", "OWNER", "FIELDS", "CORE REF"],
25537
+ objects.map((object2) => [
25538
+ `${object2.appSlug}/${object2.objectKey}`,
25539
+ object2.owner,
25540
+ String(object2.fieldCount),
25541
+ object2.coreRef ?? "-"
25542
+ ])
25543
+ )
25544
+ );
25545
+ } catch (err) {
25546
+ reportApiError(err);
25547
+ }
25548
+ });
25549
+ }
25550
+ function schemaType(definition) {
25551
+ if (typeof definition !== "object" || definition === null) return "any";
25552
+ const def = definition;
25553
+ const type = def["type"];
25554
+ if (typeof type === "string") return type;
25555
+ if (Array.isArray(type)) return type.map(String).join("|");
25556
+ for (const key of ["anyOf", "oneOf"]) {
25557
+ const variants = def[key];
25558
+ if (Array.isArray(variants)) {
25559
+ const types = [...new Set(variants.map((variant) => schemaType(variant)))];
25560
+ if (types.length > 0) return types.join("|");
25561
+ }
25562
+ }
25563
+ if (Array.isArray(def["enum"])) return "enum";
25564
+ return "any";
25565
+ }
25566
+ function buildSchemaCommand() {
25567
+ return new Command("schema").description("Show the declared fields of one object").argument("<target>", `<appSlug>/<objectKey> (e.g. ${CORE_SLUG}/shopify-order)`).option("--json", "Output the raw response as JSON").option("--remote <name>", "Named remote server to target").action(async (target, opts) => {
25568
+ const { appSlug, objectKey } = parseTarget2(target);
25569
+ const { baseUrl, apiKey } = resolveTransport(opts);
25570
+ try {
25571
+ const meta3 = await fetchObjectMeta({ baseUrl, apiKey, appSlug, objectKey });
25572
+ if (opts.json) {
25573
+ console.log(JSON.stringify(meta3));
25574
+ return;
25575
+ }
25576
+ const properties = meta3.jsonSchema["properties"] ?? {};
25577
+ const required2 = new Set(
25578
+ Array.isArray(meta3.jsonSchema["required"]) ? meta3.jsonSchema["required"].map(String) : []
25579
+ );
25580
+ const indexed = new Set(meta3.indexedFields);
25581
+ const entries = Object.entries(properties);
25582
+ if (entries.length === 0) {
25583
+ console.log(`Object "${appSlug}/${objectKey}" declares no fields.`);
25584
+ return;
25585
+ }
25586
+ console.log(
25587
+ renderTable(
25588
+ ["FIELD", "TYPE", "REQUIRED", "INDEXED"],
25589
+ entries.map(([name, definition]) => [
25590
+ name,
25591
+ schemaType(definition),
25592
+ required2.has(name) ? "yes" : "no",
25593
+ indexed.has(name) ? "yes" : "no"
25594
+ ])
25595
+ )
25596
+ );
25597
+ } catch (err) {
25598
+ reportApiError(err);
25599
+ }
25600
+ });
25601
+ }
25602
+ function chooseColumns(items, fields) {
25603
+ if (fields) return fields;
25604
+ const head = ["id", "createdAt"];
25605
+ const dataFields = Object.keys(items[0]?.data ?? {}).slice(0, MAX_TABLE_COLUMNS - head.length);
25606
+ return [...head, ...dataFields];
25607
+ }
25608
+ function cellValue(row, column) {
25609
+ if (TOP_LEVEL_COLUMNS.includes(column)) {
25610
+ return row[column];
25611
+ }
25612
+ return row.data[column];
25613
+ }
25614
+ function formatCell(value) {
25615
+ if (value === null || value === void 0) return "-";
25616
+ const raw = typeof value === "object" ? JSON.stringify(value) : String(value);
25617
+ return raw.length > MAX_CELL_WIDTH ? `${raw.slice(0, MAX_CELL_WIDTH - 1)}\u2026` : raw;
25618
+ }
25619
+ function buildListCommand2() {
25620
+ return new Command("list").description("List records of one object").argument("<target>", `<appSlug>/<objectKey> (e.g. ${CORE_SLUG}/shopify-order)`).option("--filter <json>", `Per-field operator map, e.g. '{"name":{"contains":"1001"}}'`).option("--search <json>", `Free-text OR, e.g. '{"q":"ann","fields":["email"]}'`).option("--sort <json>", `Sort specs, e.g. '[{"field":"createdAt","direction":"desc"}]'`).option("--id <id>", "Fetch one row by primary key; bypasses filters").option("--limit <n>", `Total rows to fetch (max ${MAX_LIMIT})`, String(DEFAULT_LIMIT)).option("--cursor <cursor>", "Resume from a previous nextCursor").option("--fields <a,b,c>", "Columns to render, in order").option("--json", "Output the raw {items, nextCursor} envelope as JSON").option("--remote <name>", "Named remote server to target").action(async (target, opts) => {
25621
+ const { appSlug, objectKey } = parseTarget2(target);
25622
+ const filter = opts.filter && requireJson(opts.filter, "--filter", "object");
25623
+ const search = opts.search && requireJson(opts.search, "--search", "object");
25624
+ const sort = opts.sort && requireJson(opts.sort, "--sort", "array");
25625
+ const limit = parseLimit(opts.limit);
25626
+ const fields = opts.fields ? parseFields(opts.fields) : void 0;
25627
+ const { baseUrl, apiKey } = resolveTransport(opts);
25628
+ try {
25629
+ const items = [];
25630
+ let cursor = opts.cursor;
25631
+ let nextCursor = null;
25632
+ for (; ; ) {
25633
+ const page = await fetchRecords({
25634
+ baseUrl,
25635
+ apiKey,
25636
+ appSlug,
25637
+ objectKey,
25638
+ cursor,
25639
+ limit: Math.min(SERVER_PAGE_MAX, limit - items.length),
25640
+ id: opts.id,
25641
+ filter,
25642
+ search,
25643
+ sort
25644
+ });
25645
+ items.push(...page.items);
25646
+ nextCursor = page.nextCursor;
25647
+ if (!page.nextCursor || page.items.length === 0 || items.length >= limit) break;
25648
+ cursor = page.nextCursor;
25649
+ }
25650
+ if (opts.json) {
25651
+ console.log(JSON.stringify({ items, nextCursor }));
25652
+ return;
25653
+ }
25654
+ if (items.length === 0) {
25655
+ console.log("No records found.");
25656
+ return;
25657
+ }
25658
+ const columns = chooseColumns(items, fields);
25659
+ console.log(
25660
+ renderTable(
25661
+ columns.map((column) => column.toUpperCase()),
25662
+ items.map((row) => columns.map((column) => formatCell(cellValue(row, column))))
25663
+ )
25664
+ );
25665
+ if (nextCursor) {
25666
+ console.error(`note: more rows available \u2014 resume with --cursor ${nextCursor}`);
25667
+ }
25668
+ } catch (err) {
25669
+ reportApiError(err);
25670
+ }
25671
+ });
25672
+ }
25673
+ function buildCountCommand() {
25674
+ return new Command("count").description("Count records matching a filter").argument("<target>", `<appSlug>/<objectKey> (e.g. ${CORE_SLUG}/shopify-order)`).option("--filter <json>", `Per-field operator map, e.g. '{"name":{"contains":"1001"}}'`).option("--search <json>", `Free-text OR, e.g. '{"q":"ann","fields":["email"]}'`).option("--json", "Output the raw response as JSON").option("--remote <name>", "Named remote server to target").action(async (target, opts) => {
25675
+ const { appSlug, objectKey } = parseTarget2(target);
25676
+ const filter = opts.filter && requireJson(opts.filter, "--filter", "object");
25677
+ const search = opts.search && requireJson(opts.search, "--search", "object");
25678
+ const { baseUrl, apiKey } = resolveTransport(opts);
25679
+ try {
25680
+ const result = await countRecords({
25681
+ baseUrl,
25682
+ apiKey,
25683
+ appSlug,
25684
+ objectKey,
25685
+ filter,
25686
+ search
25687
+ });
25688
+ console.log(opts.json ? JSON.stringify(result) : String(result.count));
25689
+ } catch (err) {
25690
+ reportApiError(err);
25691
+ }
25692
+ });
25693
+ }
25694
+ function buildDataCommand() {
25695
+ const data = new Command("data").description(
25696
+ "Read platform data (read-only; needs a user-bound key and platform ADMIN)"
25697
+ );
25698
+ data.addCommand(buildObjectsCommand());
25699
+ data.addCommand(buildSchemaCommand());
25700
+ data.addCommand(buildListCommand2());
25701
+ data.addCommand(buildCountCommand());
25702
+ return data;
25703
+ }
25704
+
25371
25705
  // src/index.ts
25372
25706
  function readVersion() {
25373
25707
  try {
@@ -25388,6 +25722,7 @@ program2.addCommand(buildPublishCommand());
25388
25722
  program2.addCommand(buildInstallCommand());
25389
25723
  program2.addCommand(buildLogsCommand());
25390
25724
  program2.addCommand(buildRunsCommand());
25725
+ program2.addCommand(buildDataCommand());
25391
25726
  program2.parseAsync(process.argv).catch((err) => {
25392
25727
  console.error(err instanceof Error ? err.message : String(err));
25393
25728
  process.exit(1);