@elevasis/sdk 1.36.4 → 1.37.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/cli.cjs CHANGED
@@ -38577,17 +38577,48 @@ var SYSTEM_INTERFACE_PROFILES = [
38577
38577
  var SYSTEM_INTERFACE_READINESS_PROFILES = SYSTEM_INTERFACE_PROFILES.map(
38578
38578
  (profile) => profile.readinessProfile
38579
38579
  );
38580
- var SystemInterfaceReadinessProfileSchema = external_exports.enum(SYSTEM_INTERFACE_READINESS_PROFILES);
38580
+ var SystemInterfaceReadinessProfileSchema = external_exports.string().trim().min(1);
38581
38581
  var SystemInterfaceResourceScopeSchema = external_exports.array(ModelIdSchema).default([]);
38582
+ var SystemApiInterfaceReadinessContractSchema = external_exports.object({
38583
+ /** Ontology IDs of object types the interface depends on. */
38584
+ requiredObjects: external_exports.array(external_exports.string().trim().min(1)).default([]),
38585
+ /** Ontology IDs of catalog types the interface requires (must be non-empty). */
38586
+ requiredCatalogs: external_exports.array(external_exports.string().trim().min(1)).default([]),
38587
+ /** Optional ontology kind filters (reserved for future profile extensions). */
38588
+ requiredKinds: external_exports.array(external_exports.string().trim().min(1)).optional()
38589
+ }).strict();
38582
38590
  var SystemApiInterfaceSchema = external_exports.object({
38583
38591
  lifecycle: SystemInterfaceLifecycleSchema.default("active"),
38592
+ /**
38593
+ * Open-string profile id. Built-in platform presets are looked up through
38594
+ * the profile registry; custom ids are validated structurally via
38595
+ * `readinessContract`. Optional — `profileForInterface` provides a default.
38596
+ */
38584
38597
  readinessProfile: SystemInterfaceReadinessProfileSchema.optional(),
38585
38598
  /**
38586
38599
  * Resource ids that participate in this API interface. This scopes readiness
38587
38600
  * derivation without duplicating authored required/provided contract refs.
38588
38601
  */
38589
- resourceIds: SystemInterfaceResourceScopeSchema.optional()
38602
+ resourceIds: SystemInterfaceResourceScopeSchema.optional(),
38603
+ /**
38604
+ * Tenant-authorable readiness declaration. Required for custom
38605
+ * (non-built-in) profile ids so structural validation can proceed. Built-in
38606
+ * profiles ignore this field (requirements are derived from platform code).
38607
+ */
38608
+ readinessContract: SystemApiInterfaceReadinessContractSchema.optional()
38590
38609
  }).strict();
38610
+ var _profileRegistry = new Map(
38611
+ SYSTEM_INTERFACE_READINESS_PROFILES.map((profileId) => [
38612
+ profileId,
38613
+ { profileId, kind: "built-in" }
38614
+ ])
38615
+ );
38616
+ function profileForInterface(systemPath, interfaceKey, readinessProfile) {
38617
+ return readinessProfile ?? `${systemPath}.${interfaceKey}`;
38618
+ }
38619
+ function isBuiltInReadinessProfile(profileId) {
38620
+ return _profileRegistry.get(profileId)?.kind === "built-in";
38621
+ }
38591
38622
  var SystemInterfaceRefSchema = external_exports.object({
38592
38623
  systemPath: SystemPathSchema,
38593
38624
  interfaceKey: SystemInterfaceKeySchema
@@ -41491,14 +41522,11 @@ function addReadinessIssue(issues, family, code, message, details = {}) {
41491
41522
  function formatInterfaceIdentity(systemPath, interfaceKey) {
41492
41523
  return `${systemPath}/${interfaceKey}`;
41493
41524
  }
41494
- function profileForInterface(systemPath, interfaceKey, readinessProfile) {
41495
- return readinessProfile ?? `${systemPath}.${interfaceKey}`;
41496
- }
41497
41525
  function readinessMarkerPath(context) {
41498
41526
  return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : `systems.${context.systemPath}.derivedCrmHandoffReadiness`;
41499
41527
  }
41500
41528
  function formatSupportedReadinessProfiles() {
41501
- return SYSTEM_INTERFACE_READINESS_PROFILES.map((profile) => `"${profile}"`).join(", ");
41529
+ return SYSTEM_INTERFACE_PROFILES.map((p) => `"${p.readinessProfile}"`).join(", ");
41502
41530
  }
41503
41531
  function getActiveScopedResources(model, resourceIds, issues, context) {
41504
41532
  const resources = [];
@@ -41690,9 +41718,6 @@ function getLeadGenCrmHandoffResourceIds(model) {
41690
41718
  function getSystemInterfaceReadinessMarker(model, request) {
41691
41719
  const system = getSystem(model, request.systemPath);
41692
41720
  if (system === void 0) return void 0;
41693
- if (request.interfaceKey === LEAD_GEN_API_INTERFACE.interfaceKey) {
41694
- return system.apiInterface;
41695
- }
41696
41721
  if (request.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && request.interfaceKey === LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey) {
41697
41722
  return {
41698
41723
  lifecycle: "active",
@@ -41700,6 +41725,9 @@ function getSystemInterfaceReadinessMarker(model, request) {
41700
41725
  resourceIds: getLeadGenCrmHandoffResourceIds(model)
41701
41726
  };
41702
41727
  }
41728
+ if (request.interfaceKey === "api" && system.apiInterface !== void 0) {
41729
+ return system.apiInterface;
41730
+ }
41703
41731
  return void 0;
41704
41732
  }
41705
41733
  function mergeLeadGenDerivedCatalogs(model) {
@@ -41744,6 +41772,18 @@ function tryCompileBusinessOntology(model, readinessProfile, issues) {
41744
41772
  return void 0;
41745
41773
  }
41746
41774
  }
41775
+ function requireContractReadiness(issues, index, resources, contract, context) {
41776
+ const reads = resourceBindingIds(resources, "reads");
41777
+ const catalogs = resourceBindingIds(resources, "usesCatalogs");
41778
+ for (const objectId of contract.requiredObjects) {
41779
+ requireObjectReadiness(issues, index, objectId, context);
41780
+ requireScopedBinding(issues, reads, "reads", objectId, context);
41781
+ }
41782
+ for (const catalogId of contract.requiredCatalogs) {
41783
+ requireCatalogReadiness(issues, index, catalogId, context);
41784
+ requireScopedBinding(issues, catalogs, "usesCatalogs", catalogId, context);
41785
+ }
41786
+ }
41747
41787
  function computeInterfaceReadiness(model, request) {
41748
41788
  const issues = [];
41749
41789
  const system = getSystem(model, request.systemPath);
@@ -41791,20 +41831,22 @@ function computeInterfaceReadiness(model, request) {
41791
41831
  { path: `${readinessMarkerPath(request)}.lifecycle` }
41792
41832
  );
41793
41833
  }
41794
- const supportedProfile = readinessProfile !== void 0 && SYSTEM_INTERFACE_PROFILES.some((profile) => profile.readinessProfile === readinessProfile);
41795
- if (!supportedProfile) {
41834
+ const checkedReadinessProfile = readinessProfile ?? profileForInterface(request.systemPath, request.interfaceKey);
41835
+ const isBuiltIn = isBuiltInReadinessProfile(checkedReadinessProfile);
41836
+ const readinessContract = systemInterface.readinessContract;
41837
+ if (!isBuiltIn && readinessContract === void 0) {
41796
41838
  addReadinessIssue(
41797
41839
  issues,
41798
41840
  "SYSTEM_INTERFACE_INVALID",
41799
- "unknown-readiness-profile",
41800
- `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" references unknown readiness profile "${readinessProfile}". Supported profiles: ${formatSupportedReadinessProfiles()}. Custom Systems should not declare apiInterface; route custom behavior through workflows/operations plus ontology, resources, and topology.`,
41801
- { path: `${readinessMarkerPath(request)}.readinessProfile`, ref: readinessProfile }
41841
+ "missing-readiness-contract",
41842
+ `System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" uses custom readiness profile "${checkedReadinessProfile}" but declares no readinessContract. Built-in profiles: ${formatSupportedReadinessProfiles()}.`,
41843
+ { path: `${readinessMarkerPath(request)}.readinessContract`, ref: checkedReadinessProfile }
41802
41844
  );
41803
41845
  return {
41804
41846
  ready: false,
41805
41847
  systemPath: request.systemPath,
41806
41848
  interfaceKey: request.interfaceKey,
41807
- readinessProfile,
41849
+ readinessProfile: checkedReadinessProfile,
41808
41850
  scopedResourceIds,
41809
41851
  issues
41810
41852
  };
@@ -41818,10 +41860,6 @@ function computeInterfaceReadiness(model, request) {
41818
41860
  { path: `${readinessMarkerPath(request)}.resourceIds` }
41819
41861
  );
41820
41862
  }
41821
- const checkedReadinessProfile = readinessProfile;
41822
- if (checkedReadinessProfile === void 0) {
41823
- throw new Error("Supported readiness profile unexpectedly resolved to undefined");
41824
- }
41825
41863
  const resources = getActiveScopedResources(model, scopedResourceIds, issues, request);
41826
41864
  const index = tryCompileBusinessOntology(model, checkedReadinessProfile, issues);
41827
41865
  if (index !== void 0) {
@@ -41833,13 +41871,15 @@ function computeInterfaceReadiness(model, request) {
41833
41871
  requireLeadGenInterfaceReadiness(issues, index, resources, request);
41834
41872
  requireCrmInterfaceReadiness(issues, index, resources, { ...request, allowForeignOwner: true });
41835
41873
  requireHandoffBridgeReadiness(issues, model, request);
41874
+ } else if (readinessContract !== void 0) {
41875
+ requireContractReadiness(issues, index, resources, readinessContract, request);
41836
41876
  }
41837
41877
  }
41838
41878
  return {
41839
41879
  ready: issues.length === 0,
41840
41880
  systemPath: request.systemPath,
41841
41881
  interfaceKey: request.interfaceKey,
41842
- readinessProfile,
41882
+ readinessProfile: checkedReadinessProfile,
41843
41883
  scopedResourceIds,
41844
41884
  issues
41845
41885
  };
@@ -45808,7 +45848,7 @@ function wrapAction(commandName, fn) {
45808
45848
  // package.json
45809
45849
  var package_default = {
45810
45850
  name: "@elevasis/sdk",
45811
- version: "1.36.4",
45851
+ version: "1.37.0",
45812
45852
  description: "SDK for building Elevasis organization resources",
45813
45853
  type: "module",
45814
45854
  bin: {
@@ -47834,8 +47874,11 @@ Resolved client: ${client.name}`));
47834
47874
  }
47835
47875
 
47836
47876
  // src/cli/commands/project/projects.ts
47877
+ function printJson2(value) {
47878
+ console.log(JSON.stringify(value, null, 2));
47879
+ }
47837
47880
  function registerProjectList(program3) {
47838
- program3.command("project:list").description("List projects\n Example: elevasis-sdk project:list --search alpha").option("--kind <kind>", "Filter by kind: client_engagement | internal | research | other").option("--status <status>", "Filter by status: active | on_track | at_risk | blocked | completed | paused").option("--search <query>", "Search by project name or description").option("--client <id-or-name>", "Filter by client hub record (UUID or fuzzy name)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
47881
+ program3.command("project:list").description("List projects\n Example: elevasis-sdk project:list --search alpha").option("--kind <kind>", "Filter by kind: client_engagement | internal | research | other").option("--status <status>", "Filter by status: active | on_track | at_risk | blocked | completed | paused").option("--search <query>", "Search by project name or description").option("--client <id-or-name>", "Filter by client hub record (UUID or fuzzy name)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
47839
47882
  wrapAction(
47840
47883
  "project:list",
47841
47884
  async (options) => {
@@ -47853,6 +47896,10 @@ function registerProjectList(program3) {
47853
47896
  const qs = params.toString();
47854
47897
  const endpoint = `/api/external/projects${qs ? `?${qs}` : ""}`;
47855
47898
  const result = await apiGet(endpoint, apiUrl);
47899
+ if (options.json) {
47900
+ printJson2(result);
47901
+ return;
47902
+ }
47856
47903
  if (options.pretty) {
47857
47904
  const projects = result.projects;
47858
47905
  if (projects.length === 0) {
@@ -47878,9 +47925,13 @@ Projects (${projects.length}):
47878
47925
  function registerProjectResolve(program3) {
47879
47926
  program3.command("project:resolve <query>").description(
47880
47927
  'Resolve a project ID from a name, UUID, or search query\n Example: elevasis-sdk project:resolve "Alpha"'
47881
- ).option("--api-url <url>", "API base URL").option("--pretty", "Render project details instead of only the resolved ID").action(
47928
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render project details instead of only the resolved ID").option("--json", "Output as JSON").action(
47882
47929
  wrapAction("project:resolve", async (query, options) => {
47883
47930
  const project = await resolveProject(query, options.apiUrl);
47931
+ if (options.json) {
47932
+ printJson2(project);
47933
+ return;
47934
+ }
47884
47935
  if (options.pretty) {
47885
47936
  console.log(source_default.cyan(`
47886
47937
  Resolved project: ${project.name}`));
@@ -47918,10 +47969,14 @@ ${renderProjectWorkBrief(brief)}
47918
47969
  );
47919
47970
  }
47920
47971
  function registerProjectGet(program3) {
47921
- program3.command("project:get <id>").description("Get a project by ID\n Example: elevasis-sdk project:get <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
47972
+ program3.command("project:get <id>").description("Get a project by ID\n Example: elevasis-sdk project:get <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
47922
47973
  wrapAction("project:get", async (id, options) => {
47923
47974
  const apiUrl = resolveApiUrl(options.apiUrl);
47924
47975
  const result = await apiGet(`/api/external/projects/${id}`, apiUrl);
47976
+ if (options.json) {
47977
+ printJson2(result);
47978
+ return;
47979
+ }
47925
47980
  if (options.pretty) {
47926
47981
  const p = result.project;
47927
47982
  console.log(source_default.cyan(`
@@ -47938,7 +47993,7 @@ Project: ${p.name}`));
47938
47993
  );
47939
47994
  }
47940
47995
  function registerProjectCreate(program3) {
47941
- program3.command("project:create").description('Create a new project\n Example: elevasis-sdk project:create --name "My Project" --kind internal').requiredOption("--name <name>", "Project name").requiredOption("--kind <kind>", "Project kind: client_engagement | internal | research | other").option("--status <status>", "Project status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "Project description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
47996
+ program3.command("project:create").description('Create a new project\n Example: elevasis-sdk project:create --name "My Project" --kind internal').requiredOption("--name <name>", "Project name").requiredOption("--kind <kind>", "Project kind: client_engagement | internal | research | other").option("--status <status>", "Project status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "Project description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
47942
47997
  wrapAction(
47943
47998
  "project:create",
47944
47999
  async (options) => {
@@ -47962,6 +48017,10 @@ function registerProjectCreate(program3) {
47962
48017
  if (options.contractValue !== void 0) body.contract_value = options.contractValue;
47963
48018
  if (options.metadata) body.metadata = JSON.parse(options.metadata);
47964
48019
  const result = await apiPost("/api/external/projects", body, apiUrl);
48020
+ if (options.json) {
48021
+ printJson2(result);
48022
+ return;
48023
+ }
47965
48024
  if (options.pretty) {
47966
48025
  const p = result.project;
47967
48026
  console.log(source_default.green(`
@@ -47978,7 +48037,7 @@ Project created: ${p.name}`));
47978
48037
  );
47979
48038
  }
47980
48039
  function registerProjectUpdate(program3) {
47981
- program3.command("project:update <id>").description("Update a project\n Example: elevasis-sdk project:update <uuid> --status completed").option("--name <name>", "New project name").option("--status <status>", "New status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "New description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--clear-client", "Remove the client hub link (sets client_id to null)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--actual-end-date <date>", "Actual end date (ISO 8601)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48040
+ program3.command("project:update <id>").description("Update a project\n Example: elevasis-sdk project:update <uuid> --status completed").option("--name <name>", "New project name").option("--status <status>", "New status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "New description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--clear-client", "Remove the client hub link (sets client_id to null)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--actual-end-date <date>", "Actual end date (ISO 8601)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
47982
48041
  wrapAction(
47983
48042
  "project:update",
47984
48043
  async (id, options) => {
@@ -48021,6 +48080,10 @@ function registerProjectUpdate(program3) {
48021
48080
  }
48022
48081
  const apiUrl = resolveApiUrl(options.apiUrl);
48023
48082
  const result = await apiPatch(`/api/external/projects/${id}`, body, apiUrl);
48083
+ if (options.json) {
48084
+ printJson2(result);
48085
+ return;
48086
+ }
48024
48087
  if (options.pretty) {
48025
48088
  const p = result.project;
48026
48089
  console.log(source_default.green(`
@@ -48035,10 +48098,14 @@ Project updated: ${p.name}`));
48035
48098
  );
48036
48099
  }
48037
48100
  function registerProjectDelete(program3) {
48038
- program3.command("project:delete <id>").description("Delete a project\n Example: elevasis-sdk project:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48101
+ program3.command("project:delete <id>").description("Delete a project\n Example: elevasis-sdk project:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48039
48102
  wrapAction("project:delete", async (id, options) => {
48040
48103
  const apiUrl = resolveApiUrl(options.apiUrl);
48041
48104
  const result = await apiDelete(`/api/external/projects/${id}`, apiUrl);
48105
+ if (options.json) {
48106
+ printJson2(result);
48107
+ return;
48108
+ }
48042
48109
  if (options.pretty) {
48043
48110
  console.log(source_default.green(`
48044
48111
  Project ${id} deleted.`));
@@ -48054,6 +48121,9 @@ Project ${id} deleted.`));
48054
48121
  var import_node_fs3 = require("node:fs");
48055
48122
  init_source();
48056
48123
  init_config();
48124
+ function printJson3(value) {
48125
+ console.log(JSON.stringify(value, null, 2));
48126
+ }
48057
48127
  function parseChecklistOption(options) {
48058
48128
  if (options.checklist !== void 0 && options.checklistFile !== void 0) {
48059
48129
  process.stderr.write(
@@ -48074,10 +48144,14 @@ function parseChecklistOption(options) {
48074
48144
  }
48075
48145
  }
48076
48146
  function registerMilestoneList(program3) {
48077
- program3.command("project:milestone:list").description("List milestones for a project\n Example: elevasis-sdk project:milestone:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48147
+ program3.command("project:milestone:list").description("List milestones for a project\n Example: elevasis-sdk project:milestone:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48078
48148
  wrapAction("project:milestone:list", async (options) => {
48079
48149
  const apiUrl = resolveApiUrl(options.apiUrl);
48080
48150
  const result = await apiGet(`/api/external/projects/${options.project}/milestones`, apiUrl);
48151
+ if (options.json) {
48152
+ printJson3(result);
48153
+ return;
48154
+ }
48081
48155
  if (options.pretty) {
48082
48156
  const milestones = result.milestones;
48083
48157
  if (milestones.length === 0) {
@@ -48102,7 +48176,7 @@ Milestones (${milestones.length}):
48102
48176
  function registerMilestoneCreate(program3) {
48103
48177
  program3.command("project:milestone:create").description(
48104
48178
  'Create a milestone\n Example: elevasis-sdk project:milestone:create --project <uuid> --name "Phase 1"'
48105
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--name <name>", "Milestone name").option("--status <status>", "Status: upcoming | in_progress | completed | overdue | blocked").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "Milestone description").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48179
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--name <name>", "Milestone name").option("--status <status>", "Status: upcoming | in_progress | completed | overdue | blocked").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "Milestone description").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48106
48180
  wrapAction(
48107
48181
  "project:milestone:create",
48108
48182
  async (options) => {
@@ -48116,6 +48190,10 @@ function registerMilestoneCreate(program3) {
48116
48190
  body,
48117
48191
  apiUrl
48118
48192
  );
48193
+ if (options.json) {
48194
+ printJson3(result);
48195
+ return;
48196
+ }
48119
48197
  if (options.pretty) {
48120
48198
  const m = result.milestone;
48121
48199
  console.log(source_default.green(`
@@ -48135,7 +48213,7 @@ function registerMilestoneUpdate(program3) {
48135
48213
  program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
48136
48214
  "--checklist-file <path>",
48137
48215
  "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
48138
- ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48216
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48139
48217
  wrapAction(
48140
48218
  "project:milestone:update",
48141
48219
  async (id, options) => {
@@ -48157,6 +48235,10 @@ function registerMilestoneUpdate(program3) {
48157
48235
  }
48158
48236
  const apiUrl = resolveApiUrl(options.apiUrl);
48159
48237
  const result = await apiPatch(`/api/external/milestones/${id}`, body, apiUrl);
48238
+ if (options.json) {
48239
+ printJson3(result);
48240
+ return;
48241
+ }
48160
48242
  if (options.pretty) {
48161
48243
  const m = result.milestone;
48162
48244
  console.log(source_default.green(`
@@ -48171,10 +48253,14 @@ Milestone updated: ${m.name}`));
48171
48253
  );
48172
48254
  }
48173
48255
  function registerMilestoneDelete(program3) {
48174
- program3.command("project:milestone:delete <id>").description("Delete a milestone\n Example: elevasis-sdk project:milestone:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48256
+ program3.command("project:milestone:delete <id>").description("Delete a milestone\n Example: elevasis-sdk project:milestone:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48175
48257
  wrapAction("project:milestone:delete", async (id, options) => {
48176
48258
  const apiUrl = resolveApiUrl(options.apiUrl);
48177
48259
  const result = await apiDelete(`/api/external/milestones/${id}`, apiUrl);
48260
+ if (options.json) {
48261
+ printJson3(result);
48262
+ return;
48263
+ }
48178
48264
  if (options.pretty) {
48179
48265
  console.log(source_default.green(`
48180
48266
  Milestone ${id} deleted.`));
@@ -48190,6 +48276,9 @@ Milestone ${id} deleted.`));
48190
48276
  var import_node_fs4 = require("node:fs");
48191
48277
  init_source();
48192
48278
  init_config();
48279
+ function printJson4(value) {
48280
+ console.log(JSON.stringify(value, null, 2));
48281
+ }
48193
48282
  function parseChecklistOption2(options) {
48194
48283
  if (options.checklist !== void 0 && options.checklistFile !== void 0) {
48195
48284
  process.stderr.write(
@@ -48215,7 +48304,7 @@ function registerTaskList(program3) {
48215
48304
  ).requiredOption("--project <project-id>", "Project ID (UUID)").option(
48216
48305
  "--status <status>",
48217
48306
  "Filter by status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
48218
- ).option("--milestone <milestone-id>", "Filter by milestone ID (UUID)").option("--parent <parent-task-id>", "Filter by parent task ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48307
+ ).option("--milestone <milestone-id>", "Filter by milestone ID (UUID)").option("--parent <parent-task-id>", "Filter by parent task ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48219
48308
  wrapAction(
48220
48309
  "project:task:list",
48221
48310
  async (options) => {
@@ -48227,6 +48316,10 @@ function registerTaskList(program3) {
48227
48316
  const qs = params.toString();
48228
48317
  const endpoint = `/api/external/projects/${options.project}/tasks${qs ? `?${qs}` : ""}`;
48229
48318
  const result = await apiGet(endpoint, apiUrl);
48319
+ if (options.json) {
48320
+ printJson4(result);
48321
+ return;
48322
+ }
48230
48323
  if (options.pretty) {
48231
48324
  const tasks = result.tasks;
48232
48325
  if (tasks.length === 0) {
@@ -48250,10 +48343,14 @@ Tasks (${tasks.length}):
48250
48343
  );
48251
48344
  }
48252
48345
  function registerTaskGet(program3) {
48253
- program3.command("project:task:get <id>").description("Get a task by ID\n Example: elevasis-sdk project:task:get <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48346
+ program3.command("project:task:get <id>").description("Get a task by ID\n Example: elevasis-sdk project:task:get <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48254
48347
  wrapAction("project:task:get", async (id, options) => {
48255
48348
  const apiUrl = resolveApiUrl(options.apiUrl);
48256
48349
  const result = await apiGet(`/api/external/project-tasks/${id}`, apiUrl);
48350
+ if (options.json) {
48351
+ printJson4(result);
48352
+ return;
48353
+ }
48257
48354
  if (options.pretty) {
48258
48355
  const t = result.task;
48259
48356
  console.log(source_default.cyan(`
@@ -48279,7 +48376,7 @@ function registerTaskCreate(program3) {
48279
48376
  ).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
48280
48377
  "--checklist-file <path>",
48281
48378
  "Read checklist items from a JSON file. Relative paths resolve against the project root."
48282
- ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48379
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48283
48380
  wrapAction(
48284
48381
  "project:task:create",
48285
48382
  async (options) => {
@@ -48303,6 +48400,10 @@ function registerTaskCreate(program3) {
48303
48400
  )
48304
48401
  );
48305
48402
  }
48403
+ if (options.json) {
48404
+ printJson4(result);
48405
+ return;
48406
+ }
48306
48407
  if (options.pretty) {
48307
48408
  const t = result.task;
48308
48409
  console.log(source_default.green(`
@@ -48324,7 +48425,7 @@ function registerTaskUpdate(program3) {
48324
48425
  ).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--description <description>", "New description").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
48325
48426
  "--checklist-file <path>",
48326
48427
  "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
48327
- ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48428
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48328
48429
  wrapAction(
48329
48430
  "project:task:update",
48330
48431
  async (id, options) => {
@@ -48346,6 +48447,10 @@ function registerTaskUpdate(program3) {
48346
48447
  }
48347
48448
  const apiUrl = resolveApiUrl(options.apiUrl);
48348
48449
  const result = await apiPatch(`/api/external/project-tasks/${id}`, body, apiUrl);
48450
+ if (options.json) {
48451
+ printJson4(result);
48452
+ return;
48453
+ }
48349
48454
  if (options.pretty) {
48350
48455
  const t = result.task;
48351
48456
  console.log(source_default.green(`
@@ -48360,10 +48465,14 @@ Task updated: ${t.name}`));
48360
48465
  );
48361
48466
  }
48362
48467
  function registerTaskDelete(program3) {
48363
- program3.command("project:task:delete <id>").description("Delete a task\n Example: elevasis-sdk project:task:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48468
+ program3.command("project:task:delete <id>").description("Delete a task\n Example: elevasis-sdk project:task:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48364
48469
  wrapAction("project:task:delete", async (id, options) => {
48365
48470
  const apiUrl = resolveApiUrl(options.apiUrl);
48366
48471
  const result = await apiDelete(`/api/external/project-tasks/${id}`, apiUrl);
48472
+ if (options.json) {
48473
+ printJson4(result);
48474
+ return;
48475
+ }
48367
48476
  if (options.pretty) {
48368
48477
  console.log(source_default.green(`
48369
48478
  Task ${id} deleted.`));
@@ -48377,12 +48486,16 @@ Task ${id} deleted.`));
48377
48486
  function registerTaskResume(program3) {
48378
48487
  program3.command("project:task:resume <id>").description(
48379
48488
  "Fetch the resume_context JSONB for a task (used by /work resume)\n Example: elevasis-sdk project:task:resume <uuid>"
48380
- ).option("--api-url <url>", "API base URL").option("--pretty", "Render a human-readable resume briefing instead of raw JSON").action(
48489
+ ).option("--api-url <url>", "API base URL").option("--pretty", "Render a human-readable resume briefing instead of raw JSON").option("--json", "Output as JSON").action(
48381
48490
  wrapAction("project:task:resume", async (id, options) => {
48382
48491
  const apiUrl = resolveApiUrl(options.apiUrl);
48383
48492
  const result = await apiGet(`/api/external/project-tasks/${id}`, apiUrl);
48384
48493
  const task = result.task;
48385
48494
  const ctx = task.resume_context ?? {};
48495
+ if (options.json) {
48496
+ printJson4(ctx);
48497
+ return;
48498
+ }
48386
48499
  if (options.pretty) {
48387
48500
  console.log(source_default.cyan(`
48388
48501
  Resume briefing for task: ${task.name}`));
@@ -48426,7 +48539,7 @@ function registerTaskSave(program3) {
48426
48539
  program3.command("project:task:save <id>").description(
48427
48540
  `Merge fields into resume_context for a task (used by /work save)
48428
48541
  Example: elevasis-sdk project:task:save <uuid> --current-state "Implemented X" --files-modified '["src/foo.ts"]'`
48429
- ).requiredOption("--current-state <text>", "Current state description").option("--files-modified <json>", "JSON array of modified file paths").option("--next-steps <text>", "Next steps description").option("--key-docs <json>", "JSON array of key doc paths").option("--tools <json>", "JSON array of tool names used").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48542
+ ).requiredOption("--current-state <text>", "Current state description").option("--files-modified <json>", "JSON array of modified file paths").option("--next-steps <text>", "Next steps description").option("--key-docs <json>", "JSON array of key doc paths").option("--tools <json>", "JSON array of tool names used").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48430
48543
  wrapAction(
48431
48544
  "project:task:save",
48432
48545
  async (id, options) => {
@@ -48468,6 +48581,10 @@ function registerTaskSave(program3) {
48468
48581
  }
48469
48582
  const apiUrl = resolveApiUrl(options.apiUrl);
48470
48583
  const result = await apiPatch(`/api/external/project-tasks/${id}/resume-context`, body, apiUrl);
48584
+ if (options.json) {
48585
+ printJson4(result);
48586
+ return;
48587
+ }
48471
48588
  if (options.pretty) {
48472
48589
  console.log(source_default.green(`
48473
48590
  Resume context saved for task ${id}`));
@@ -48646,12 +48763,19 @@ var NoteIdParamsSchema = external_exports.object({ id: UuidSchema });
48646
48763
 
48647
48764
  // src/cli/commands/project/notes.ts
48648
48765
  init_config();
48766
+ function printJson5(value) {
48767
+ console.log(JSON.stringify(value, null, 2));
48768
+ }
48649
48769
  var NOTE_TYPE_HELP = NoteTypeSchema.options.join(" | ");
48650
48770
  function registerNoteList(program3) {
48651
- program3.command("project:note:list").description("List notes for a project\n Example: elevasis-sdk project:note:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48771
+ program3.command("project:note:list").description("List notes for a project\n Example: elevasis-sdk project:note:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48652
48772
  wrapAction("project:note:list", async (options) => {
48653
48773
  const apiUrl = resolveApiUrl(options.apiUrl);
48654
48774
  const result = await apiGet(`/api/external/projects/${options.project}/notes`, apiUrl);
48775
+ if (options.json) {
48776
+ printJson5(result);
48777
+ return;
48778
+ }
48655
48779
  if (options.pretty) {
48656
48780
  const notes = result.notes;
48657
48781
  if (notes.length === 0) {
@@ -48676,7 +48800,7 @@ Notes (${notes.length}):
48676
48800
  function registerNoteCreate(program3) {
48677
48801
  program3.command("project:note:create").description(
48678
48802
  'Create a note\n Example: elevasis-sdk project:note:create --project <uuid> --content "Status update"'
48679
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", `Note type: ${NOTE_TYPE_HELP}`).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48803
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", `Note type: ${NOTE_TYPE_HELP}`).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48680
48804
  wrapAction(
48681
48805
  "project:note:create",
48682
48806
  async (options) => {
@@ -48689,6 +48813,10 @@ function registerNoteCreate(program3) {
48689
48813
  if (options.type) body.type = options.type;
48690
48814
  const apiUrl = resolveApiUrl(options.apiUrl);
48691
48815
  const result = await apiPost("/api/external/project-notes", body, apiUrl);
48816
+ if (options.json) {
48817
+ printJson5(result);
48818
+ return;
48819
+ }
48692
48820
  if (options.pretty) {
48693
48821
  const n = result.note;
48694
48822
  console.log(source_default.green(`
@@ -48704,7 +48832,7 @@ Note created`));
48704
48832
  );
48705
48833
  }
48706
48834
  function registerNoteUpdate(program3) {
48707
- program3.command("project:note:update <id>").description('Update a note\n Example: elevasis-sdk project:note:update <uuid> --content "Updated content"').requiredOption("--content <content>", "New note content").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48835
+ program3.command("project:note:update <id>").description('Update a note\n Example: elevasis-sdk project:note:update <uuid> --content "Updated content"').requiredOption("--content <content>", "New note content").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48708
48836
  wrapAction("project:note:update", async (id, options) => {
48709
48837
  const apiUrl = resolveApiUrl(options.apiUrl);
48710
48838
  const result = await apiPatch(
@@ -48712,6 +48840,10 @@ function registerNoteUpdate(program3) {
48712
48840
  { content: options.content },
48713
48841
  apiUrl
48714
48842
  );
48843
+ if (options.json) {
48844
+ printJson5(result);
48845
+ return;
48846
+ }
48715
48847
  if (options.pretty) {
48716
48848
  console.log(source_default.green(`
48717
48849
  Note ${id} updated.`));
@@ -48723,10 +48855,14 @@ Note ${id} updated.`));
48723
48855
  );
48724
48856
  }
48725
48857
  function registerNoteDelete(program3) {
48726
- program3.command("project:note:delete <id>").description("Delete a note\n Example: elevasis-sdk project:note:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
48858
+ program3.command("project:note:delete <id>").description("Delete a note\n Example: elevasis-sdk project:note:delete <uuid>").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
48727
48859
  wrapAction("project:note:delete", async (id, options) => {
48728
48860
  const apiUrl = resolveApiUrl(options.apiUrl);
48729
48861
  const result = await apiDelete(`/api/external/project-notes/${id}`, apiUrl);
48862
+ if (options.json) {
48863
+ printJson5(result);
48864
+ return;
48865
+ }
48730
48866
  if (options.pretty) {
48731
48867
  console.log(source_default.green(`
48732
48868
  Note ${id} deleted.`));
@@ -51055,7 +51191,7 @@ function endpointWithQuery2(endpoint, params) {
51055
51191
  const query = params.toString();
51056
51192
  return query ? `${endpoint}?${query}` : endpoint;
51057
51193
  }
51058
- function printJson2(value) {
51194
+ function printJson6(value) {
51059
51195
  console.log(JSON.stringify(value, null, 2));
51060
51196
  }
51061
51197
  function dealEmail(deal) {
@@ -51086,7 +51222,7 @@ function registerAcquisitionDealList(program3) {
51086
51222
  appendQuery2(params, "offset", options.offset);
51087
51223
  const result = await apiGet(endpointWithQuery2("/api/external/deals", params), apiUrl);
51088
51224
  if (!options.pretty) {
51089
- printJson2(result);
51225
+ printJson6(result);
51090
51226
  return;
51091
51227
  }
51092
51228
  if (result.data.length === 0) {
@@ -51114,7 +51250,7 @@ function registerAcquisitionDealGet(program3) {
51114
51250
  const apiUrl = resolveApiUrl(options.apiUrl);
51115
51251
  const result = await apiGet("/api/external/deals/" + id, apiUrl);
51116
51252
  if (!options.pretty) {
51117
- printJson2(result);
51253
+ printJson6(result);
51118
51254
  return;
51119
51255
  }
51120
51256
  console.log(source_default.cyan(`
@@ -51136,7 +51272,7 @@ function registerAcquisitionDealStatus(program3) {
51136
51272
  const apiUrl = resolveApiUrl(options.apiUrl);
51137
51273
  const result = await apiGet("/api/external/deals/summary", apiUrl);
51138
51274
  if (!options.pretty) {
51139
- printJson2(result);
51275
+ printJson6(result);
51140
51276
  return;
51141
51277
  }
51142
51278
  console.log(source_default.cyan("\nAcquisition deal status"));
@@ -51166,7 +51302,7 @@ function endpointWithQuery3(endpoint, params) {
51166
51302
  const query = params.toString();
51167
51303
  return query ? `${endpoint}?${query}` : endpoint;
51168
51304
  }
51169
- function printJson3(value) {
51305
+ function printJson7(value) {
51170
51306
  console.log(JSON.stringify(value, null, 2));
51171
51307
  }
51172
51308
  function renderListSummary(list) {
@@ -51194,7 +51330,7 @@ function registerAcquisitionListList(program3) {
51194
51330
  apiUrl
51195
51331
  );
51196
51332
  if (!options.pretty) {
51197
- printJson3(result);
51333
+ printJson7(result);
51198
51334
  return;
51199
51335
  }
51200
51336
  if (result.length === 0) {
@@ -51225,7 +51361,7 @@ function registerAcquisitionListGet(program3) {
51225
51361
  apiUrl
51226
51362
  );
51227
51363
  if (!options.pretty) {
51228
- printJson3(result);
51364
+ printJson7(result);
51229
51365
  return;
51230
51366
  }
51231
51367
  console.log(source_default.cyan(`
@@ -51247,7 +51383,7 @@ function registerAcquisitionListStatus(program3) {
51247
51383
  const apiUrl = resolveApiUrl(options.apiUrl);
51248
51384
  const result = await apiGet("/api/external/acquisition/lists/status", apiUrl);
51249
51385
  if (!options.pretty) {
51250
- printJson3(result);
51386
+ printJson7(result);
51251
51387
  return;
51252
51388
  }
51253
51389
  console.log(source_default.cyan("\nAcquisition list status"));
@@ -51412,7 +51548,7 @@ function registerClientCommands(program3) {
51412
51548
  // src/cli/commands/queue/queue.ts
51413
51549
  init_source();
51414
51550
  init_config();
51415
- function printJson4(value) {
51551
+ function printJson8(value) {
51416
51552
  console.log(JSON.stringify(value, null, 2));
51417
51553
  }
51418
51554
  function appendQuery4(params, key, value) {
@@ -51453,7 +51589,7 @@ function registerQueueList(program3) {
51453
51589
  apiUrl
51454
51590
  );
51455
51591
  if (!options.pretty) {
51456
- printJson4(result);
51592
+ printJson8(result);
51457
51593
  return;
51458
51594
  }
51459
51595
  if (result.tasks.length === 0) {
@@ -51481,7 +51617,7 @@ function registerQueueGet(program3) {
51481
51617
  const apiUrl = resolveApiUrl(options.apiUrl);
51482
51618
  const result = await apiGet(`/api/external/command-queue/${id}`, apiUrl);
51483
51619
  if (!options.pretty) {
51484
- printJson4(result);
51620
+ printJson8(result);
51485
51621
  return;
51486
51622
  }
51487
51623
  const task = result.task;
@@ -51514,7 +51650,7 @@ function registerQueueSelect(program3) {
51514
51650
  apiUrl
51515
51651
  );
51516
51652
  if (!options.pretty) {
51517
- printJson4(result);
51653
+ printJson8(result);
51518
51654
  return;
51519
51655
  }
51520
51656
  console.log(source_default.green(`
@@ -51535,7 +51671,7 @@ function registerQueueExpire(program3) {
51535
51671
  apiUrl
51536
51672
  );
51537
51673
  if (!options.pretty) {
51538
- printJson4(result);
51674
+ printJson8(result);
51539
51675
  return;
51540
51676
  }
51541
51677
  console.log(source_default.green(`
@@ -51561,7 +51697,7 @@ function registerQueueStatus(program3) {
51561
51697
  apiUrl
51562
51698
  );
51563
51699
  if (!options.pretty) {
51564
- printJson4(result);
51700
+ printJson8(result);
51565
51701
  return;
51566
51702
  }
51567
51703
  console.log(source_default.cyan("\nQueue status"));
@@ -51599,7 +51735,7 @@ function registerQueueCommands(program3) {
51599
51735
  // src/cli/commands/schedule/schedule.ts
51600
51736
  init_source();
51601
51737
  init_config();
51602
- function printJson5(value) {
51738
+ function printJson9(value) {
51603
51739
  console.log(JSON.stringify(value, null, 2));
51604
51740
  }
51605
51741
  function appendQuery5(params, key, value) {
@@ -51641,7 +51777,7 @@ function registerScheduleList(program3) {
51641
51777
  apiUrl
51642
51778
  );
51643
51779
  if (!options.pretty) {
51644
- printJson5(result);
51780
+ printJson9(result);
51645
51781
  return;
51646
51782
  }
51647
51783
  if (result.schedules.length === 0) {
@@ -51668,7 +51804,7 @@ function registerScheduleGet(program3) {
51668
51804
  apiUrl
51669
51805
  );
51670
51806
  if (!options.pretty) {
51671
- printJson5(result);
51807
+ printJson9(result);
51672
51808
  return;
51673
51809
  }
51674
51810
  console.log(source_default.cyan(`
@@ -51718,7 +51854,7 @@ function registerScheduleCreate(program3) {
51718
51854
  apiUrl
51719
51855
  );
51720
51856
  if (!options.pretty) {
51721
- printJson5(result);
51857
+ printJson9(result);
51722
51858
  return;
51723
51859
  }
51724
51860
  console.log(source_default.green(`
@@ -51770,7 +51906,7 @@ function registerScheduleUpdate(program3) {
51770
51906
  apiUrl
51771
51907
  );
51772
51908
  if (!options.pretty) {
51773
- printJson5(result);
51909
+ printJson9(result);
51774
51910
  return;
51775
51911
  }
51776
51912
  console.log(source_default.green(`
@@ -51793,7 +51929,7 @@ function registerScheduleStatusMutation(program3, commandName, description) {
51793
51929
  apiUrl
51794
51930
  );
51795
51931
  if (!options.pretty) {
51796
- printJson5(result);
51932
+ printJson9(result);
51797
51933
  return;
51798
51934
  }
51799
51935
  const verb = commandName === "pause" ? "paused" : commandName === "resume" ? "resumed" : "cancelled";
@@ -51910,7 +52046,7 @@ init_config();
51910
52046
  function getResourceType2(resource) {
51911
52047
  return resource.type ?? resource.resourceType;
51912
52048
  }
51913
- function printJson6(value) {
52049
+ function printJson10(value) {
51914
52050
  console.log(JSON.stringify(value, null, 2));
51915
52051
  }
51916
52052
  function registerAgentList(program3) {
@@ -51920,7 +52056,7 @@ function registerAgentList(program3) {
51920
52056
  const result = await apiGet("/api/external/resources", apiUrl);
51921
52057
  const agents = result.resources.filter((resource) => getResourceType2(resource) === "agent");
51922
52058
  if (options.json) {
51923
- printJson6({ agents, total: agents.length });
52059
+ printJson10({ agents, total: agents.length });
51924
52060
  return;
51925
52061
  }
51926
52062
  if (agents.length === 0) {
@@ -51948,7 +52084,7 @@ function registerAgentGet(program3) {
51948
52084
  const apiUrl = resolveApiUrl(options.apiUrl);
51949
52085
  const definition = await apiGet(`/api/external/resources/${id}/definition`, apiUrl);
51950
52086
  if (options.json) {
51951
- printJson6(definition);
52087
+ printJson10(definition);
51952
52088
  return;
51953
52089
  }
51954
52090
  const config3 = definition.config ?? {};
@@ -51982,7 +52118,7 @@ function registerAgentCommands(program3) {
51982
52118
  var import_node_fs10 = require("node:fs");
51983
52119
  init_source();
51984
52120
  init_config();
51985
- function printJson7(value) {
52121
+ function printJson11(value) {
51986
52122
  console.log(JSON.stringify(value, null, 2));
51987
52123
  }
51988
52124
  function appendQuery6(params, key, value) {
@@ -52090,7 +52226,7 @@ function registerSessionCreate(program3) {
52090
52226
  if (options.metadata) body.metadata = parseJson(options.metadata, "--metadata");
52091
52227
  const session = await apiPost("/api/external/sessions", body, apiUrl);
52092
52228
  if (options.json) {
52093
- printJson7(session);
52229
+ printJson11(session);
52094
52230
  return;
52095
52231
  }
52096
52232
  console.log(source_default.green(`Created session ${session.sessionId}.`));
@@ -52110,7 +52246,7 @@ function registerSessionList(program3) {
52110
52246
  appendQuery6(params, "limit", options.limit);
52111
52247
  const result = await apiGet(endpointWithQuery6("/api/external/sessions", params), apiUrl);
52112
52248
  if (options.json) {
52113
- printJson7(result);
52249
+ printJson11(result);
52114
52250
  return;
52115
52251
  }
52116
52252
  if (result.sessions.length === 0) {
@@ -52136,7 +52272,7 @@ function registerSessionGet(program3) {
52136
52272
  const apiUrl = resolveApiUrl(options.apiUrl);
52137
52273
  const session = await apiGet(`/api/external/sessions/${id}`, apiUrl);
52138
52274
  if (options.json) {
52139
- printJson7(session);
52275
+ printJson11(session);
52140
52276
  return;
52141
52277
  }
52142
52278
  console.log(source_default.cyan(`Session: ${session.title ?? session.sessionId}`));
@@ -52158,7 +52294,7 @@ function registerSessionTurn(program3) {
52158
52294
  const input = resolveTurnInput(options);
52159
52295
  const result = await apiPost(`/api/external/sessions/${id}/turns`, { input }, apiUrl);
52160
52296
  if (options.json) {
52161
- printJson7(result);
52297
+ printJson11(result);
52162
52298
  return;
52163
52299
  }
52164
52300
  console.log(source_default.green(`Turn ${result.turnNumber} complete.`));
@@ -52190,7 +52326,7 @@ function registerSessionMessages(program3) {
52190
52326
  const apiUrl = resolveApiUrl(options.apiUrl);
52191
52327
  const result = await fetchSessionMessages(id, apiUrl, options);
52192
52328
  if (options.json) {
52193
- printJson7(result);
52329
+ printJson11(result);
52194
52330
  return;
52195
52331
  }
52196
52332
  const total = result.total === void 0 ? result.messages.length : result.total;
@@ -52216,7 +52352,7 @@ function registerSessionEnd(program3) {
52216
52352
  apiUrl
52217
52353
  );
52218
52354
  if (options.json) {
52219
- printJson7(result);
52355
+ printJson11(result);
52220
52356
  return;
52221
52357
  }
52222
52358
  console.log(source_default.green(`Ended session ${result.sessionId ?? id}.`));
@@ -52237,7 +52373,7 @@ function registerSessionCommands(program3) {
52237
52373
  // src/cli/commands/grant/grant.ts
52238
52374
  init_source();
52239
52375
  init_config();
52240
- function printJson8(value) {
52376
+ function printJson12(value) {
52241
52377
  console.log(JSON.stringify(value, null, 2));
52242
52378
  }
52243
52379
  function appendQuery7(params, key, value) {
@@ -52312,7 +52448,7 @@ function registerGrantList(program3) {
52312
52448
  apiUrl
52313
52449
  );
52314
52450
  if (options.json) {
52315
- printJson8(result);
52451
+ printJson12(result);
52316
52452
  return;
52317
52453
  }
52318
52454
  if (result.grants.length === 0) {
@@ -52360,7 +52496,7 @@ function registerGrantCreate(program3) {
52360
52496
  const apiUrl = resolveApiUrl(options.apiUrl);
52361
52497
  const result = await apiPost("/api/external/agent-access-grants", body, apiUrl);
52362
52498
  if (options.json) {
52363
- printJson8(result.grant);
52499
+ printJson12(result.grant);
52364
52500
  return;
52365
52501
  }
52366
52502
  console.log(source_default.green(`Created agent access grant ${result.grant.slug}.`));
@@ -52403,7 +52539,7 @@ function registerGrantUpdate(program3) {
52403
52539
  apiUrl
52404
52540
  );
52405
52541
  if (options.json) {
52406
- printJson8(result.grant);
52542
+ printJson12(result.grant);
52407
52543
  return;
52408
52544
  }
52409
52545
  console.log(source_default.green(`Updated agent access grant ${result.grant.slug}.`));
@@ -52422,7 +52558,7 @@ function registerGrantDisable(program3) {
52422
52558
  apiUrl
52423
52559
  );
52424
52560
  if (options.json) {
52425
- printJson8(result.grant);
52561
+ printJson12(result.grant);
52426
52562
  return;
52427
52563
  }
52428
52564
  console.log(source_default.green(`Disabled agent access grant ${result.grant.slug}.`));