@pmate/cli 0.17.3 → 0.17.5
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.d.ts +25 -1
- package/dist/index.js +297 -62
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -338,7 +338,7 @@ type CollectCommandArgs = {
|
|
|
338
338
|
type AgentCommandArgs = {
|
|
339
339
|
type: Command.Agent;
|
|
340
340
|
action: "list";
|
|
341
|
-
namespace
|
|
341
|
+
namespace?: string;
|
|
342
342
|
baseUrl?: string;
|
|
343
343
|
json: boolean;
|
|
344
344
|
} | {
|
|
@@ -375,6 +375,14 @@ type AgentCommandArgs = {
|
|
|
375
375
|
name: string;
|
|
376
376
|
baseUrl?: string;
|
|
377
377
|
json: boolean;
|
|
378
|
+
} | {
|
|
379
|
+
type: Command.Agent;
|
|
380
|
+
action: "rename";
|
|
381
|
+
namespace: string;
|
|
382
|
+
fromName: string;
|
|
383
|
+
toName: string;
|
|
384
|
+
baseUrl?: string;
|
|
385
|
+
json: boolean;
|
|
378
386
|
};
|
|
379
387
|
type NsCommandArgs = {
|
|
380
388
|
type: Command.Ns;
|
|
@@ -478,6 +486,14 @@ type AppCommandArgs = {
|
|
|
478
486
|
id: string;
|
|
479
487
|
baseUrl?: string;
|
|
480
488
|
json: boolean;
|
|
489
|
+
} | {
|
|
490
|
+
type: Command.App;
|
|
491
|
+
action: "rename";
|
|
492
|
+
namespace: string;
|
|
493
|
+
fromId: string;
|
|
494
|
+
toId: string;
|
|
495
|
+
baseUrl?: string;
|
|
496
|
+
json: boolean;
|
|
481
497
|
};
|
|
482
498
|
type ServiceCommandArgs = {
|
|
483
499
|
type: Command.Service;
|
|
@@ -507,6 +523,14 @@ type ServiceCommandArgs = {
|
|
|
507
523
|
filePath: string;
|
|
508
524
|
baseUrl?: string;
|
|
509
525
|
json: boolean;
|
|
526
|
+
} | {
|
|
527
|
+
type: Command.Service;
|
|
528
|
+
action: "rename";
|
|
529
|
+
namespace: string;
|
|
530
|
+
fromName: string;
|
|
531
|
+
toName: string;
|
|
532
|
+
baseUrl?: string;
|
|
533
|
+
json: boolean;
|
|
510
534
|
} | {
|
|
511
535
|
type: Command.Service;
|
|
512
536
|
action: "deploy";
|
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
|
|
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
|
-
|
|
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": {
|
|
@@ -18985,6 +18982,23 @@ var AgentCommandHandler = class {
|
|
|
18985
18982
|
this.renderJson(record, args.json);
|
|
18986
18983
|
return;
|
|
18987
18984
|
}
|
|
18985
|
+
case "rename": {
|
|
18986
|
+
const record = await this.request(
|
|
18987
|
+
baseUrl,
|
|
18988
|
+
token,
|
|
18989
|
+
"POST",
|
|
18990
|
+
`/agents/${encodeURIComponent(args.namespace)}/rename`,
|
|
18991
|
+
{
|
|
18992
|
+
from: args.fromName,
|
|
18993
|
+
to: args.toName
|
|
18994
|
+
}
|
|
18995
|
+
);
|
|
18996
|
+
ui.success(
|
|
18997
|
+
`Renamed agent ${formatNamespacedDisplayId(args.namespace, args.fromName)} -> ${record.id}`
|
|
18998
|
+
);
|
|
18999
|
+
this.renderJson(record, args.json);
|
|
19000
|
+
return;
|
|
19001
|
+
}
|
|
18988
19002
|
}
|
|
18989
19003
|
}
|
|
18990
19004
|
resolveBaseUrl(baseUrl) {
|
|
@@ -19086,13 +19100,6 @@ var AgentCommandHandler = class {
|
|
|
19086
19100
|
});
|
|
19087
19101
|
}
|
|
19088
19102
|
}
|
|
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
19103
|
};
|
|
19097
19104
|
|
|
19098
19105
|
// src/commands/NsCommandHandler.ts
|
|
@@ -19388,11 +19395,7 @@ var AppCommandHandler = class {
|
|
|
19388
19395
|
"GET",
|
|
19389
19396
|
pathname
|
|
19390
19397
|
);
|
|
19391
|
-
|
|
19392
|
-
this.renderView(record);
|
|
19393
|
-
return;
|
|
19394
|
-
}
|
|
19395
|
-
this.renderJson(record, args.json ?? true);
|
|
19398
|
+
this.renderJson(record, true);
|
|
19396
19399
|
return;
|
|
19397
19400
|
}
|
|
19398
19401
|
case "create": {
|
|
@@ -19435,6 +19438,23 @@ var AppCommandHandler = class {
|
|
|
19435
19438
|
this.renderJson(record, args.json);
|
|
19436
19439
|
return;
|
|
19437
19440
|
}
|
|
19441
|
+
case "rename": {
|
|
19442
|
+
const record = await this.request(
|
|
19443
|
+
baseUrl,
|
|
19444
|
+
token,
|
|
19445
|
+
"POST",
|
|
19446
|
+
`/apps/${encodeURIComponent(args.namespace)}/rename`,
|
|
19447
|
+
{
|
|
19448
|
+
fromId: args.fromId,
|
|
19449
|
+
toId: args.toId
|
|
19450
|
+
}
|
|
19451
|
+
);
|
|
19452
|
+
ui.success(
|
|
19453
|
+
`Renamed app ${formatNamespacedDisplayId(args.namespace, args.fromId)} -> ${formatNamespacedDisplayId(args.namespace, record.id)}`
|
|
19454
|
+
);
|
|
19455
|
+
this.renderJson(record, args.json);
|
|
19456
|
+
return;
|
|
19457
|
+
}
|
|
19438
19458
|
}
|
|
19439
19459
|
}
|
|
19440
19460
|
resolveBaseUrl(baseUrl) {
|
|
@@ -19511,14 +19531,6 @@ var AppCommandHandler = class {
|
|
|
19511
19531
|
}
|
|
19512
19532
|
ui.plain(JSON.stringify(value, null, 2));
|
|
19513
19533
|
}
|
|
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
19534
|
buildAppPath(appId) {
|
|
19523
19535
|
const { namespace, objectId } = parseNamespacedRef(appId, {
|
|
19524
19536
|
entityLabel: "app ref"
|
|
@@ -20082,11 +20094,7 @@ var ServiceCommandHandler = class {
|
|
|
20082
20094
|
case "get":
|
|
20083
20095
|
case "view": {
|
|
20084
20096
|
const record = await registry.getService(args.namespace, args.name);
|
|
20085
|
-
|
|
20086
|
-
this.renderView(record);
|
|
20087
|
-
return;
|
|
20088
|
-
}
|
|
20089
|
-
this.renderJson(record, args.json ?? true);
|
|
20097
|
+
this.renderJson(record, true);
|
|
20090
20098
|
return;
|
|
20091
20099
|
}
|
|
20092
20100
|
case "create": {
|
|
@@ -20124,6 +20132,22 @@ var ServiceCommandHandler = class {
|
|
|
20124
20132
|
this.renderJson(record, args.json);
|
|
20125
20133
|
return;
|
|
20126
20134
|
}
|
|
20135
|
+
case "rename": {
|
|
20136
|
+
const record = await this.request(
|
|
20137
|
+
baseUrl,
|
|
20138
|
+
"POST",
|
|
20139
|
+
`/services/${encodeURIComponent(args.namespace)}/rename`,
|
|
20140
|
+
{
|
|
20141
|
+
from: args.fromName,
|
|
20142
|
+
to: args.toName
|
|
20143
|
+
}
|
|
20144
|
+
);
|
|
20145
|
+
ui.success(
|
|
20146
|
+
`Renamed service ${formatNamespacedDisplayId(args.namespace, args.fromName)} -> ${record.id}`
|
|
20147
|
+
);
|
|
20148
|
+
this.renderJson(record, args.json);
|
|
20149
|
+
return;
|
|
20150
|
+
}
|
|
20127
20151
|
case "deploy": {
|
|
20128
20152
|
const record = await registry.getService(args.namespace, args.name);
|
|
20129
20153
|
await runtime.deploy(record, { cwd: args.cwd });
|
|
@@ -20222,14 +20246,6 @@ var ServiceCommandHandler = class {
|
|
|
20222
20246
|
}
|
|
20223
20247
|
ui.plain(JSON.stringify(value, null, 2));
|
|
20224
20248
|
}
|
|
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
20249
|
};
|
|
20234
20250
|
|
|
20235
20251
|
// src/commands/VercelCommandHandler.ts
|
|
@@ -20582,7 +20598,7 @@ function parseAgentArgs(tokens) {
|
|
|
20582
20598
|
const rawAction = rest.shift();
|
|
20583
20599
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
20584
20600
|
if (!action) {
|
|
20585
|
-
throw new Error("Missing agent action. Use: agent namespaces|list|get|view|create|update|delete");
|
|
20601
|
+
throw new Error("Missing agent action. Use: agent namespaces|list|get|view|create|update|rename|delete");
|
|
20586
20602
|
}
|
|
20587
20603
|
let baseUrl;
|
|
20588
20604
|
let json = false;
|
|
@@ -20610,7 +20626,7 @@ function parseAgentArgs(tokens) {
|
|
|
20610
20626
|
return { type: "agent" /* Agent */, action, baseUrl, json };
|
|
20611
20627
|
}
|
|
20612
20628
|
if (action === "list") {
|
|
20613
|
-
let namespace
|
|
20629
|
+
let namespace;
|
|
20614
20630
|
while (rest.length > 0) {
|
|
20615
20631
|
const token = rest.shift();
|
|
20616
20632
|
switch (token) {
|
|
@@ -20629,27 +20645,49 @@ function parseAgentArgs(tokens) {
|
|
|
20629
20645
|
}
|
|
20630
20646
|
return { type: "agent" /* Agent */, action, namespace, baseUrl, json };
|
|
20631
20647
|
}
|
|
20632
|
-
if (action === "
|
|
20648
|
+
if (action === "view") {
|
|
20633
20649
|
const ref = rest.shift();
|
|
20634
20650
|
if (!ref) {
|
|
20635
20651
|
throw new Error(
|
|
20636
|
-
|
|
20652
|
+
"Usage: agent view <ns:objectId> [--base-url <url>]"
|
|
20637
20653
|
);
|
|
20638
20654
|
}
|
|
20639
20655
|
let namespaceFromOption;
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20656
|
+
while (rest.length > 0) {
|
|
20657
|
+
const token = rest.shift();
|
|
20658
|
+
switch (token) {
|
|
20659
|
+
case "--ns":
|
|
20660
|
+
case "--namespace":
|
|
20645
20661
|
namespaceFromOption = requireValue(rest, token);
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20662
|
+
break;
|
|
20663
|
+
case "--base-url":
|
|
20664
|
+
baseUrl = requireValue(rest, token);
|
|
20665
|
+
break;
|
|
20666
|
+
default:
|
|
20667
|
+
throw new Error(`Unknown agent view option: ${token}`);
|
|
20649
20668
|
}
|
|
20650
20669
|
}
|
|
20651
20670
|
const parsed = parseNamespacedRef(ref, {
|
|
20652
|
-
defaultNamespace:
|
|
20671
|
+
defaultNamespace: namespaceFromOption,
|
|
20672
|
+
entityLabel: "agent ref"
|
|
20673
|
+
});
|
|
20674
|
+
return {
|
|
20675
|
+
type: "agent" /* Agent */,
|
|
20676
|
+
action,
|
|
20677
|
+
namespace: parsed.namespace,
|
|
20678
|
+
name: parsed.objectId,
|
|
20679
|
+
baseUrl,
|
|
20680
|
+
json
|
|
20681
|
+
};
|
|
20682
|
+
}
|
|
20683
|
+
if (action === "get" || action === "delete") {
|
|
20684
|
+
const ref = rest.shift();
|
|
20685
|
+
if (!ref) {
|
|
20686
|
+
throw new Error(
|
|
20687
|
+
`Usage: agent ${action} <ns:objectId> [--base-url <url>] [--json]`
|
|
20688
|
+
);
|
|
20689
|
+
}
|
|
20690
|
+
const parsed = parseNamespacedRef(ref, {
|
|
20653
20691
|
entityLabel: "agent ref"
|
|
20654
20692
|
});
|
|
20655
20693
|
takeSharedOptions4();
|
|
@@ -20730,6 +20768,48 @@ function parseAgentArgs(tokens) {
|
|
|
20730
20768
|
json
|
|
20731
20769
|
};
|
|
20732
20770
|
}
|
|
20771
|
+
if (action === "rename") {
|
|
20772
|
+
let namespace;
|
|
20773
|
+
let from;
|
|
20774
|
+
let to;
|
|
20775
|
+
while (rest.length > 0) {
|
|
20776
|
+
const token = rest.shift();
|
|
20777
|
+
switch (token) {
|
|
20778
|
+
case "--ns":
|
|
20779
|
+
case "--namespace":
|
|
20780
|
+
namespace = requireValue(rest, token);
|
|
20781
|
+
break;
|
|
20782
|
+
case "--from":
|
|
20783
|
+
from = parseBareRenameId(requireValue(rest, token), "agent");
|
|
20784
|
+
break;
|
|
20785
|
+
case "--to":
|
|
20786
|
+
to = parseBareRenameId(requireValue(rest, token), "agent");
|
|
20787
|
+
break;
|
|
20788
|
+
case "--base-url":
|
|
20789
|
+
baseUrl = requireValue(rest, token);
|
|
20790
|
+
break;
|
|
20791
|
+
case "--json":
|
|
20792
|
+
json = true;
|
|
20793
|
+
break;
|
|
20794
|
+
default:
|
|
20795
|
+
throw new Error(`Unknown agent rename option: ${token}`);
|
|
20796
|
+
}
|
|
20797
|
+
}
|
|
20798
|
+
if (!namespace || !from || !to) {
|
|
20799
|
+
throw new Error(
|
|
20800
|
+
"Usage: agent rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]"
|
|
20801
|
+
);
|
|
20802
|
+
}
|
|
20803
|
+
return {
|
|
20804
|
+
type: "agent" /* Agent */,
|
|
20805
|
+
action,
|
|
20806
|
+
namespace,
|
|
20807
|
+
fromName: from,
|
|
20808
|
+
toName: to,
|
|
20809
|
+
baseUrl,
|
|
20810
|
+
json
|
|
20811
|
+
};
|
|
20812
|
+
}
|
|
20733
20813
|
throw new Error(`Unknown agent action: ${action}`);
|
|
20734
20814
|
}
|
|
20735
20815
|
function requireValue(tokens, optionName) {
|
|
@@ -20739,6 +20819,13 @@ function requireValue(tokens, optionName) {
|
|
|
20739
20819
|
}
|
|
20740
20820
|
return value;
|
|
20741
20821
|
}
|
|
20822
|
+
function parseBareRenameId(value, entityName) {
|
|
20823
|
+
const normalized = value.trim();
|
|
20824
|
+
if (!normalized || normalized.includes(":")) {
|
|
20825
|
+
throw new Error(`Invalid ${entityName} rename id "${value}". Use bare id together with --ns.`);
|
|
20826
|
+
}
|
|
20827
|
+
return normalized;
|
|
20828
|
+
}
|
|
20742
20829
|
|
|
20743
20830
|
// src/nsCommandParser.ts
|
|
20744
20831
|
var DEFAULT_CHAIN = "pmate";
|
|
@@ -21024,7 +21111,7 @@ function parseAppArgs(tokens) {
|
|
|
21024
21111
|
const rawAction = rest.shift();
|
|
21025
21112
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
21026
21113
|
if (!action) {
|
|
21027
|
-
throw new Error("Missing app action. Use: app list|get|view|create|update|delete");
|
|
21114
|
+
throw new Error("Missing app action. Use: app list|get|view|create|update|rename|delete");
|
|
21028
21115
|
}
|
|
21029
21116
|
let baseUrl;
|
|
21030
21117
|
let json = false;
|
|
@@ -21065,11 +21152,11 @@ function parseAppArgs(tokens) {
|
|
|
21065
21152
|
}
|
|
21066
21153
|
return { type: "app" /* App */, action, namespace, baseUrl, json };
|
|
21067
21154
|
}
|
|
21068
|
-
if (action === "
|
|
21155
|
+
if (action === "view") {
|
|
21069
21156
|
const rawRef = rest.shift();
|
|
21070
21157
|
if (!rawRef || rawRef.startsWith("-")) {
|
|
21071
21158
|
throw new Error(
|
|
21072
|
-
|
|
21159
|
+
"Usage: app view <ns:objectId> [--base-url <url>]"
|
|
21073
21160
|
);
|
|
21074
21161
|
}
|
|
21075
21162
|
let namespace;
|
|
@@ -21083,7 +21170,29 @@ function parseAppArgs(tokens) {
|
|
|
21083
21170
|
break;
|
|
21084
21171
|
}
|
|
21085
21172
|
const id = parseNamespacedRef(rawRef, {
|
|
21086
|
-
defaultNamespace:
|
|
21173
|
+
defaultNamespace: namespace,
|
|
21174
|
+
entityLabel: "app ref"
|
|
21175
|
+
}).fullId;
|
|
21176
|
+
while (rest.length > 0) {
|
|
21177
|
+
const token = rest.shift();
|
|
21178
|
+
switch (token) {
|
|
21179
|
+
case "--base-url":
|
|
21180
|
+
baseUrl = requireValue4(rest, token);
|
|
21181
|
+
break;
|
|
21182
|
+
default:
|
|
21183
|
+
throw new Error(`Unknown app view option: ${token}`);
|
|
21184
|
+
}
|
|
21185
|
+
}
|
|
21186
|
+
return { type: "app" /* App */, action, id, baseUrl, json };
|
|
21187
|
+
}
|
|
21188
|
+
if (action === "get" || action === "delete") {
|
|
21189
|
+
const rawRef = rest.shift();
|
|
21190
|
+
if (!rawRef || rawRef.startsWith("-")) {
|
|
21191
|
+
throw new Error(
|
|
21192
|
+
`Usage: app ${action} <ns:objectId> [--base-url <url>] [--json]`
|
|
21193
|
+
);
|
|
21194
|
+
}
|
|
21195
|
+
const id = parseNamespacedRef(rawRef, {
|
|
21087
21196
|
entityLabel: "app ref"
|
|
21088
21197
|
}).fullId;
|
|
21089
21198
|
takeSharedOptions4();
|
|
@@ -21145,6 +21254,40 @@ function parseAppArgs(tokens) {
|
|
|
21145
21254
|
}
|
|
21146
21255
|
return { type: "app" /* App */, action, id, filePath, baseUrl, json };
|
|
21147
21256
|
}
|
|
21257
|
+
if (action === "rename") {
|
|
21258
|
+
let namespace;
|
|
21259
|
+
let fromId;
|
|
21260
|
+
let toId;
|
|
21261
|
+
while (rest.length > 0) {
|
|
21262
|
+
const token = rest.shift();
|
|
21263
|
+
switch (token) {
|
|
21264
|
+
case "--ns":
|
|
21265
|
+
case "--namespace":
|
|
21266
|
+
namespace = requireValue4(rest, token);
|
|
21267
|
+
break;
|
|
21268
|
+
case "--from":
|
|
21269
|
+
fromId = parseBareRenameId2(requireValue4(rest, token), "app");
|
|
21270
|
+
break;
|
|
21271
|
+
case "--to":
|
|
21272
|
+
toId = parseBareRenameId2(requireValue4(rest, token), "app");
|
|
21273
|
+
break;
|
|
21274
|
+
case "--base-url":
|
|
21275
|
+
baseUrl = requireValue4(rest, token);
|
|
21276
|
+
break;
|
|
21277
|
+
case "--json":
|
|
21278
|
+
json = true;
|
|
21279
|
+
break;
|
|
21280
|
+
default:
|
|
21281
|
+
throw new Error(`Unknown app rename option: ${token}`);
|
|
21282
|
+
}
|
|
21283
|
+
}
|
|
21284
|
+
if (!namespace || !fromId || !toId) {
|
|
21285
|
+
throw new Error(
|
|
21286
|
+
"Usage: app rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]"
|
|
21287
|
+
);
|
|
21288
|
+
}
|
|
21289
|
+
return { type: "app" /* App */, action, namespace, fromId, toId, baseUrl, json };
|
|
21290
|
+
}
|
|
21148
21291
|
throw new Error(`Unknown app action: ${action}`);
|
|
21149
21292
|
}
|
|
21150
21293
|
function requireValue4(tokens, optionName) {
|
|
@@ -21154,6 +21297,13 @@ function requireValue4(tokens, optionName) {
|
|
|
21154
21297
|
}
|
|
21155
21298
|
return value;
|
|
21156
21299
|
}
|
|
21300
|
+
function parseBareRenameId2(value, entityName) {
|
|
21301
|
+
const normalized = value.trim();
|
|
21302
|
+
if (!normalized || normalized.includes(":")) {
|
|
21303
|
+
throw new Error(`Invalid ${entityName} rename id "${value}". Use bare id together with --ns.`);
|
|
21304
|
+
}
|
|
21305
|
+
return normalized;
|
|
21306
|
+
}
|
|
21157
21307
|
|
|
21158
21308
|
// src/serviceCommandParser.ts
|
|
21159
21309
|
function parseServiceArgs(tokens) {
|
|
@@ -21161,7 +21311,7 @@ function parseServiceArgs(tokens) {
|
|
|
21161
21311
|
const rawAction = rest.shift();
|
|
21162
21312
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
21163
21313
|
if (!action) {
|
|
21164
|
-
throw new Error("Missing service action. Use: service list|get|view|create|update|delete");
|
|
21314
|
+
throw new Error("Missing service action. Use: service list|get|view|create|update|rename|delete");
|
|
21165
21315
|
}
|
|
21166
21316
|
let baseUrl;
|
|
21167
21317
|
let json = false;
|
|
@@ -21189,7 +21339,40 @@ function parseServiceArgs(tokens) {
|
|
|
21189
21339
|
}
|
|
21190
21340
|
return { type: "service" /* Service */, action, namespace, repository, baseUrl, json };
|
|
21191
21341
|
}
|
|
21192
|
-
if (action === "
|
|
21342
|
+
if (action === "view") {
|
|
21343
|
+
const ref = rest.shift();
|
|
21344
|
+
if (!ref || ref.startsWith("-")) {
|
|
21345
|
+
throw new Error("Usage: service view <ns:objectId> [--base-url <url>]");
|
|
21346
|
+
}
|
|
21347
|
+
let namespaceFromOption;
|
|
21348
|
+
while (rest.length > 0) {
|
|
21349
|
+
const token = rest.shift();
|
|
21350
|
+
switch (token) {
|
|
21351
|
+
case "--base-url":
|
|
21352
|
+
baseUrl = requireValue5(rest, token);
|
|
21353
|
+
break;
|
|
21354
|
+
case "--ns":
|
|
21355
|
+
case "--namespace":
|
|
21356
|
+
namespaceFromOption = requireValue5(rest, token);
|
|
21357
|
+
break;
|
|
21358
|
+
default:
|
|
21359
|
+
throw new Error(`Unknown service view option: ${token}`);
|
|
21360
|
+
}
|
|
21361
|
+
}
|
|
21362
|
+
const parsedRef = parseNamespacedRef(ref, {
|
|
21363
|
+
defaultNamespace: namespaceFromOption,
|
|
21364
|
+
entityLabel: "service ref"
|
|
21365
|
+
});
|
|
21366
|
+
return {
|
|
21367
|
+
type: "service" /* Service */,
|
|
21368
|
+
action,
|
|
21369
|
+
namespace: parsedRef.namespace,
|
|
21370
|
+
name: parsedRef.objectId,
|
|
21371
|
+
baseUrl,
|
|
21372
|
+
json
|
|
21373
|
+
};
|
|
21374
|
+
}
|
|
21375
|
+
if (action === "get" || action === "delete" || action === "deploy" || action === "init" || action === "log") {
|
|
21193
21376
|
const ref = rest.shift();
|
|
21194
21377
|
if (!ref || ref.startsWith("-")) {
|
|
21195
21378
|
throw new Error(`Usage: service ${action} <ns:objectId> [--base-url <url>] [--json]`);
|
|
@@ -21229,7 +21412,7 @@ function parseServiceArgs(tokens) {
|
|
|
21229
21412
|
}
|
|
21230
21413
|
}
|
|
21231
21414
|
const parsedRef = parseNamespacedRef(ref, {
|
|
21232
|
-
defaultNamespace: action === "
|
|
21415
|
+
defaultNamespace: action === "deploy" || action === "init" || action === "log" ? namespaceFromOption : void 0,
|
|
21233
21416
|
entityLabel: "service ref"
|
|
21234
21417
|
});
|
|
21235
21418
|
const namespace = parsedRef.namespace;
|
|
@@ -21297,6 +21480,48 @@ function parseServiceArgs(tokens) {
|
|
|
21297
21480
|
}
|
|
21298
21481
|
return { type: "service" /* Service */, action, namespace, name, filePath, baseUrl, json };
|
|
21299
21482
|
}
|
|
21483
|
+
if (action === "rename") {
|
|
21484
|
+
let namespace;
|
|
21485
|
+
let from;
|
|
21486
|
+
let to;
|
|
21487
|
+
while (rest.length > 0) {
|
|
21488
|
+
const token = rest.shift();
|
|
21489
|
+
switch (token) {
|
|
21490
|
+
case "--ns":
|
|
21491
|
+
case "--namespace":
|
|
21492
|
+
namespace = requireValue5(rest, token);
|
|
21493
|
+
break;
|
|
21494
|
+
case "--from":
|
|
21495
|
+
from = parseBareRenameId3(requireValue5(rest, token), "service");
|
|
21496
|
+
break;
|
|
21497
|
+
case "--to":
|
|
21498
|
+
to = parseBareRenameId3(requireValue5(rest, token), "service");
|
|
21499
|
+
break;
|
|
21500
|
+
case "--base-url":
|
|
21501
|
+
baseUrl = requireValue5(rest, token);
|
|
21502
|
+
break;
|
|
21503
|
+
case "--json":
|
|
21504
|
+
json = true;
|
|
21505
|
+
break;
|
|
21506
|
+
default:
|
|
21507
|
+
throw new Error(`Unknown service rename option: ${token}`);
|
|
21508
|
+
}
|
|
21509
|
+
}
|
|
21510
|
+
if (!namespace || !from || !to) {
|
|
21511
|
+
throw new Error(
|
|
21512
|
+
"Usage: service rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]"
|
|
21513
|
+
);
|
|
21514
|
+
}
|
|
21515
|
+
return {
|
|
21516
|
+
type: "service" /* Service */,
|
|
21517
|
+
action,
|
|
21518
|
+
namespace,
|
|
21519
|
+
fromName: from,
|
|
21520
|
+
toName: to,
|
|
21521
|
+
baseUrl,
|
|
21522
|
+
json
|
|
21523
|
+
};
|
|
21524
|
+
}
|
|
21300
21525
|
throw new Error(`Unknown service action: ${action}`);
|
|
21301
21526
|
}
|
|
21302
21527
|
function requireValue5(tokens, optionName) {
|
|
@@ -21306,6 +21531,13 @@ function requireValue5(tokens, optionName) {
|
|
|
21306
21531
|
}
|
|
21307
21532
|
return value;
|
|
21308
21533
|
}
|
|
21534
|
+
function parseBareRenameId3(value, entityName) {
|
|
21535
|
+
const normalized = value.trim();
|
|
21536
|
+
if (!normalized || normalized.includes(":")) {
|
|
21537
|
+
throw new Error(`Invalid ${entityName} rename id "${value}". Use bare id together with --ns.`);
|
|
21538
|
+
}
|
|
21539
|
+
return normalized;
|
|
21540
|
+
}
|
|
21309
21541
|
|
|
21310
21542
|
// src/roleCommandParser.ts
|
|
21311
21543
|
function parseRoleArgs(tokens) {
|
|
@@ -21615,9 +21847,10 @@ var HELP_TEXT = [
|
|
|
21615
21847
|
` ${import_chalk3.default.gray(" namespaces [--base-url <url>] [--json]")}`,
|
|
21616
21848
|
` ${import_chalk3.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
|
|
21617
21849
|
` ${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>]
|
|
21850
|
+
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21619
21851
|
` ${import_chalk3.default.gray(" create [<namespace>] --file <path> [--base-url <url>] [--json]")}`,
|
|
21620
21852
|
` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
21853
|
+
` ${import_chalk3.default.gray(" rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]")}`,
|
|
21621
21854
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21622
21855
|
` ${import_chalk3.default.gray(" default namespace: pmate; default base URL: https://agent-api.pmate.chat")}`,
|
|
21623
21856
|
` ${import_chalk3.default.cyan("ns")} Manage registered namespaces`,
|
|
@@ -21642,17 +21875,19 @@ var HELP_TEXT = [
|
|
|
21642
21875
|
` ${import_chalk3.default.cyan("app")} Manage app registry entries via apps-api`,
|
|
21643
21876
|
` ${import_chalk3.default.gray(" list [--ns <namespace>] [--base-url <url>] [--json]")}`,
|
|
21644
21877
|
` ${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>]
|
|
21878
|
+
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21646
21879
|
` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
|
|
21647
21880
|
` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
21881
|
+
` ${import_chalk3.default.gray(" rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]")}`,
|
|
21648
21882
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21649
21883
|
` ${import_chalk3.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
21650
21884
|
` ${import_chalk3.default.cyan("service")} Manage service registry entries via apps-api`,
|
|
21651
21885
|
` ${import_chalk3.default.gray(" list [--namespace <ns>] [--repo <owner/name|https://github.com/owner/name>] [--base-url <url>] [--json]")}`,
|
|
21652
21886
|
` ${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>]
|
|
21887
|
+
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21654
21888
|
` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
|
|
21655
21889
|
` ${import_chalk3.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
21890
|
+
` ${import_chalk3.default.gray(" rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]")}`,
|
|
21656
21891
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21657
21892
|
` ${import_chalk3.default.gray(" deploy <ns:objectId> [--cwd <dir>] [--base-url <url>]")}`,
|
|
21658
21893
|
` ${import_chalk3.default.gray(" init <ns:objectId> [--cwd <dir>] [--base-url <url>]")}`,
|