@pmate/cli 0.17.2 → 0.17.4

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.
Files changed (2) hide show
  1. package/dist/index.js +104 -61
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18923,11 +18923,12 @@ var AgentCommandHandler = class {
18923
18923
  return;
18924
18924
  }
18925
18925
  case "list": {
18926
+ const search = args.namespace ? `?namespace=${encodeURIComponent(args.namespace)}` : "";
18926
18927
  const response = await this.request(
18927
18928
  baseUrl,
18928
18929
  token,
18929
18930
  "GET",
18930
- `/agents?namespace=${encodeURIComponent(args.namespace)}`
18931
+ `/agents${search}`
18931
18932
  );
18932
18933
  this.renderList(response.items, args.json);
18933
18934
  return;
@@ -18940,11 +18941,7 @@ var AgentCommandHandler = class {
18940
18941
  "GET",
18941
18942
  `/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
18942
18943
  );
18943
- if (args.action === "view" && !args.json) {
18944
- this.renderView(record);
18945
- return;
18946
- }
18947
- this.renderJson(record, args.json ?? true);
18944
+ this.renderJson(record, true);
18948
18945
  return;
18949
18946
  }
18950
18947
  case "create": {
@@ -19086,13 +19083,6 @@ var AgentCommandHandler = class {
19086
19083
  });
19087
19084
  }
19088
19085
  }
19089
- renderView(item) {
19090
- ui.info(formatNamespacedDisplayId(item.namespace, item.name), {
19091
- status: item.status,
19092
- version: item.version,
19093
- updatedAt: item.updatedAt
19094
- });
19095
- }
19096
19086
  };
19097
19087
 
19098
19088
  // src/commands/NsCommandHandler.ts
@@ -19388,11 +19378,7 @@ var AppCommandHandler = class {
19388
19378
  "GET",
19389
19379
  pathname
19390
19380
  );
19391
- if (args.action === "view" && !args.json) {
19392
- this.renderView(record);
19393
- return;
19394
- }
19395
- this.renderJson(record, args.json ?? true);
19381
+ this.renderJson(record, true);
19396
19382
  return;
19397
19383
  }
19398
19384
  case "create": {
@@ -19511,14 +19497,6 @@ var AppCommandHandler = class {
19511
19497
  }
19512
19498
  ui.plain(JSON.stringify(value, null, 2));
19513
19499
  }
19514
- renderView(item) {
19515
- ui.info(formatNamespacedDisplayId(item.namespace, item.id), {
19516
- name: item.name,
19517
- status: item.status,
19518
- icon: item.icon,
19519
- updatedAt: item.updatedAt
19520
- });
19521
- }
19522
19500
  buildAppPath(appId) {
19523
19501
  const { namespace, objectId } = parseNamespacedRef(appId, {
19524
19502
  entityLabel: "app ref"
@@ -20082,11 +20060,7 @@ var ServiceCommandHandler = class {
20082
20060
  case "get":
20083
20061
  case "view": {
20084
20062
  const record = await registry.getService(args.namespace, args.name);
20085
- if (args.action === "view" && !args.json) {
20086
- this.renderView(record);
20087
- return;
20088
- }
20089
- this.renderJson(record, args.json ?? true);
20063
+ this.renderJson(record, true);
20090
20064
  return;
20091
20065
  }
20092
20066
  case "create": {
@@ -20222,14 +20196,6 @@ var ServiceCommandHandler = class {
20222
20196
  }
20223
20197
  ui.plain(JSON.stringify(value, null, 2));
20224
20198
  }
20225
- renderView(item) {
20226
- ui.info(formatNamespacedDisplayId(item.namespace, item.name), {
20227
- kind: item.kind,
20228
- runtimeType: item.runtimeType,
20229
- status: item.status,
20230
- updatedAt: item.updatedAt
20231
- });
20232
- }
20233
20199
  };
20234
20200
 
20235
20201
  // src/commands/VercelCommandHandler.ts
@@ -20610,7 +20576,7 @@ function parseAgentArgs(tokens) {
20610
20576
  return { type: "agent" /* Agent */, action, baseUrl, json };
20611
20577
  }
20612
20578
  if (action === "list") {
20613
- let namespace = DEFAULT_AGENT_NAMESPACE;
20579
+ let namespace;
20614
20580
  while (rest.length > 0) {
20615
20581
  const token = rest.shift();
20616
20582
  switch (token) {
@@ -20629,27 +20595,49 @@ function parseAgentArgs(tokens) {
20629
20595
  }
20630
20596
  return { type: "agent" /* Agent */, action, namespace, baseUrl, json };
20631
20597
  }
20632
- if (action === "get" || action === "view" || action === "delete") {
20598
+ if (action === "view") {
20633
20599
  const ref = rest.shift();
20634
20600
  if (!ref) {
20635
20601
  throw new Error(
20636
- `Usage: agent ${action} <ns:objectId> [--base-url <url>] [--json]`
20602
+ "Usage: agent view <ns:objectId> [--base-url <url>]"
20637
20603
  );
20638
20604
  }
20639
20605
  let namespaceFromOption;
20640
- if (action === "view") {
20641
- while (rest.length > 0) {
20642
- const token = rest[0];
20643
- if (token === "--ns" || token === "--namespace") {
20644
- rest.shift();
20606
+ while (rest.length > 0) {
20607
+ const token = rest.shift();
20608
+ switch (token) {
20609
+ case "--ns":
20610
+ case "--namespace":
20645
20611
  namespaceFromOption = requireValue(rest, token);
20646
- continue;
20647
- }
20648
- break;
20612
+ break;
20613
+ case "--base-url":
20614
+ baseUrl = requireValue(rest, token);
20615
+ break;
20616
+ default:
20617
+ throw new Error(`Unknown agent view option: ${token}`);
20649
20618
  }
20650
20619
  }
20651
20620
  const parsed = parseNamespacedRef(ref, {
20652
- defaultNamespace: action === "view" ? namespaceFromOption : void 0,
20621
+ defaultNamespace: namespaceFromOption,
20622
+ entityLabel: "agent ref"
20623
+ });
20624
+ return {
20625
+ type: "agent" /* Agent */,
20626
+ action,
20627
+ namespace: parsed.namespace,
20628
+ name: parsed.objectId,
20629
+ baseUrl,
20630
+ json
20631
+ };
20632
+ }
20633
+ if (action === "get" || action === "delete") {
20634
+ const ref = rest.shift();
20635
+ if (!ref) {
20636
+ throw new Error(
20637
+ `Usage: agent ${action} <ns:objectId> [--base-url <url>] [--json]`
20638
+ );
20639
+ }
20640
+ const parsed = parseNamespacedRef(ref, {
20653
20641
  entityLabel: "agent ref"
20654
20642
  });
20655
20643
  takeSharedOptions4();
@@ -21065,11 +21053,11 @@ function parseAppArgs(tokens) {
21065
21053
  }
21066
21054
  return { type: "app" /* App */, action, namespace, baseUrl, json };
21067
21055
  }
21068
- if (action === "get" || action === "view" || action === "delete") {
21056
+ if (action === "view") {
21069
21057
  const rawRef = rest.shift();
21070
21058
  if (!rawRef || rawRef.startsWith("-")) {
21071
21059
  throw new Error(
21072
- `Usage: app ${action} <ns:objectId> [--base-url <url>] [--json]`
21060
+ "Usage: app view <ns:objectId> [--base-url <url>]"
21073
21061
  );
21074
21062
  }
21075
21063
  let namespace;
@@ -21083,7 +21071,29 @@ function parseAppArgs(tokens) {
21083
21071
  break;
21084
21072
  }
21085
21073
  const id = parseNamespacedRef(rawRef, {
21086
- defaultNamespace: action === "view" ? namespace : void 0,
21074
+ defaultNamespace: namespace,
21075
+ entityLabel: "app ref"
21076
+ }).fullId;
21077
+ while (rest.length > 0) {
21078
+ const token = rest.shift();
21079
+ switch (token) {
21080
+ case "--base-url":
21081
+ baseUrl = requireValue4(rest, token);
21082
+ break;
21083
+ default:
21084
+ throw new Error(`Unknown app view option: ${token}`);
21085
+ }
21086
+ }
21087
+ return { type: "app" /* App */, action, id, baseUrl, json };
21088
+ }
21089
+ if (action === "get" || action === "delete") {
21090
+ const rawRef = rest.shift();
21091
+ if (!rawRef || rawRef.startsWith("-")) {
21092
+ throw new Error(
21093
+ `Usage: app ${action} <ns:objectId> [--base-url <url>] [--json]`
21094
+ );
21095
+ }
21096
+ const id = parseNamespacedRef(rawRef, {
21087
21097
  entityLabel: "app ref"
21088
21098
  }).fullId;
21089
21099
  takeSharedOptions4();
@@ -21189,7 +21199,40 @@ function parseServiceArgs(tokens) {
21189
21199
  }
21190
21200
  return { type: "service" /* Service */, action, namespace, repository, baseUrl, json };
21191
21201
  }
21192
- if (action === "get" || action === "view" || action === "delete" || action === "deploy" || action === "init" || action === "log") {
21202
+ if (action === "view") {
21203
+ const ref = rest.shift();
21204
+ if (!ref || ref.startsWith("-")) {
21205
+ throw new Error("Usage: service view <ns:objectId> [--base-url <url>]");
21206
+ }
21207
+ let namespaceFromOption;
21208
+ while (rest.length > 0) {
21209
+ const token = rest.shift();
21210
+ switch (token) {
21211
+ case "--base-url":
21212
+ baseUrl = requireValue5(rest, token);
21213
+ break;
21214
+ case "--ns":
21215
+ case "--namespace":
21216
+ namespaceFromOption = requireValue5(rest, token);
21217
+ break;
21218
+ default:
21219
+ throw new Error(`Unknown service view option: ${token}`);
21220
+ }
21221
+ }
21222
+ const parsedRef = parseNamespacedRef(ref, {
21223
+ defaultNamespace: namespaceFromOption,
21224
+ entityLabel: "service ref"
21225
+ });
21226
+ return {
21227
+ type: "service" /* Service */,
21228
+ action,
21229
+ namespace: parsedRef.namespace,
21230
+ name: parsedRef.objectId,
21231
+ baseUrl,
21232
+ json
21233
+ };
21234
+ }
21235
+ if (action === "get" || action === "delete" || action === "deploy" || action === "init" || action === "log") {
21193
21236
  const ref = rest.shift();
21194
21237
  if (!ref || ref.startsWith("-")) {
21195
21238
  throw new Error(`Usage: service ${action} <ns:objectId> [--base-url <url>] [--json]`);
@@ -21229,7 +21272,7 @@ function parseServiceArgs(tokens) {
21229
21272
  }
21230
21273
  }
21231
21274
  const parsedRef = parseNamespacedRef(ref, {
21232
- defaultNamespace: action === "view" || action === "deploy" || action === "init" || action === "log" ? namespaceFromOption : void 0,
21275
+ defaultNamespace: action === "deploy" || action === "init" || action === "log" ? namespaceFromOption : void 0,
21233
21276
  entityLabel: "service ref"
21234
21277
  });
21235
21278
  const namespace = parsedRef.namespace;
@@ -21613,9 +21656,9 @@ var HELP_TEXT = [
21613
21656
  ` ${import_chalk3.default.gray(" --thread <name> [--endpoint <url>] [--json]")}`,
21614
21657
  ` ${import_chalk3.default.cyan("agent")} Manage agent registry entries via agent-ui-api`,
21615
21658
  ` ${import_chalk3.default.gray(" namespaces [--base-url <url>] [--json]")}`,
21616
- ` ${import_chalk3.default.gray(" list [--namespace <ns>] [--repo <owner/name|https://github.com/owner/name>] [--base-url <url>] [--json]")}`,
21659
+ ` ${import_chalk3.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
21617
21660
  ` ${import_chalk3.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
21618
- ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>] [--json]")}`,
21661
+ ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
21619
21662
  ` ${import_chalk3.default.gray(" create [<namespace>] --file <path> [--base-url <url>] [--json]")}`,
21620
21663
  ` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
21621
21664
  ` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
@@ -21642,15 +21685,15 @@ var HELP_TEXT = [
21642
21685
  ` ${import_chalk3.default.cyan("app")} Manage app registry entries via apps-api`,
21643
21686
  ` ${import_chalk3.default.gray(" list [--ns <namespace>] [--base-url <url>] [--json]")}`,
21644
21687
  ` ${import_chalk3.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
21645
- ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>] [--json]")}`,
21688
+ ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
21646
21689
  ` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
21647
21690
  ` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
21648
21691
  ` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
21649
21692
  ` ${import_chalk3.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
21650
21693
  ` ${import_chalk3.default.cyan("service")} Manage service registry entries via apps-api`,
21651
- ` ${import_chalk3.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
21694
+ ` ${import_chalk3.default.gray(" list [--namespace <ns>] [--repo <owner/name|https://github.com/owner/name>] [--base-url <url>] [--json]")}`,
21652
21695
  ` ${import_chalk3.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
21653
- ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>] [--json]")}`,
21696
+ ` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
21654
21697
  ` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
21655
21698
  ` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
21656
21699
  ` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.17.2",
3
+ "version": "0.17.4",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {