@pmate/cli 0.17.4 → 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 +195 -3
- 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
|
@@ -18982,6 +18982,23 @@ var AgentCommandHandler = class {
|
|
|
18982
18982
|
this.renderJson(record, args.json);
|
|
18983
18983
|
return;
|
|
18984
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
|
+
}
|
|
18985
19002
|
}
|
|
18986
19003
|
}
|
|
18987
19004
|
resolveBaseUrl(baseUrl) {
|
|
@@ -19421,6 +19438,23 @@ var AppCommandHandler = class {
|
|
|
19421
19438
|
this.renderJson(record, args.json);
|
|
19422
19439
|
return;
|
|
19423
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
|
+
}
|
|
19424
19458
|
}
|
|
19425
19459
|
}
|
|
19426
19460
|
resolveBaseUrl(baseUrl) {
|
|
@@ -20098,6 +20132,22 @@ var ServiceCommandHandler = class {
|
|
|
20098
20132
|
this.renderJson(record, args.json);
|
|
20099
20133
|
return;
|
|
20100
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
|
+
}
|
|
20101
20151
|
case "deploy": {
|
|
20102
20152
|
const record = await registry.getService(args.namespace, args.name);
|
|
20103
20153
|
await runtime.deploy(record, { cwd: args.cwd });
|
|
@@ -20548,7 +20598,7 @@ function parseAgentArgs(tokens) {
|
|
|
20548
20598
|
const rawAction = rest.shift();
|
|
20549
20599
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
20550
20600
|
if (!action) {
|
|
20551
|
-
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");
|
|
20552
20602
|
}
|
|
20553
20603
|
let baseUrl;
|
|
20554
20604
|
let json = false;
|
|
@@ -20718,6 +20768,48 @@ function parseAgentArgs(tokens) {
|
|
|
20718
20768
|
json
|
|
20719
20769
|
};
|
|
20720
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
|
+
}
|
|
20721
20813
|
throw new Error(`Unknown agent action: ${action}`);
|
|
20722
20814
|
}
|
|
20723
20815
|
function requireValue(tokens, optionName) {
|
|
@@ -20727,6 +20819,13 @@ function requireValue(tokens, optionName) {
|
|
|
20727
20819
|
}
|
|
20728
20820
|
return value;
|
|
20729
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
|
+
}
|
|
20730
20829
|
|
|
20731
20830
|
// src/nsCommandParser.ts
|
|
20732
20831
|
var DEFAULT_CHAIN = "pmate";
|
|
@@ -21012,7 +21111,7 @@ function parseAppArgs(tokens) {
|
|
|
21012
21111
|
const rawAction = rest.shift();
|
|
21013
21112
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
21014
21113
|
if (!action) {
|
|
21015
|
-
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");
|
|
21016
21115
|
}
|
|
21017
21116
|
let baseUrl;
|
|
21018
21117
|
let json = false;
|
|
@@ -21155,6 +21254,40 @@ function parseAppArgs(tokens) {
|
|
|
21155
21254
|
}
|
|
21156
21255
|
return { type: "app" /* App */, action, id, filePath, baseUrl, json };
|
|
21157
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
|
+
}
|
|
21158
21291
|
throw new Error(`Unknown app action: ${action}`);
|
|
21159
21292
|
}
|
|
21160
21293
|
function requireValue4(tokens, optionName) {
|
|
@@ -21164,6 +21297,13 @@ function requireValue4(tokens, optionName) {
|
|
|
21164
21297
|
}
|
|
21165
21298
|
return value;
|
|
21166
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
|
+
}
|
|
21167
21307
|
|
|
21168
21308
|
// src/serviceCommandParser.ts
|
|
21169
21309
|
function parseServiceArgs(tokens) {
|
|
@@ -21171,7 +21311,7 @@ function parseServiceArgs(tokens) {
|
|
|
21171
21311
|
const rawAction = rest.shift();
|
|
21172
21312
|
const action = rawAction === "view" ? "view" : rawAction;
|
|
21173
21313
|
if (!action) {
|
|
21174
|
-
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");
|
|
21175
21315
|
}
|
|
21176
21316
|
let baseUrl;
|
|
21177
21317
|
let json = false;
|
|
@@ -21340,6 +21480,48 @@ function parseServiceArgs(tokens) {
|
|
|
21340
21480
|
}
|
|
21341
21481
|
return { type: "service" /* Service */, action, namespace, name, filePath, baseUrl, json };
|
|
21342
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
|
+
}
|
|
21343
21525
|
throw new Error(`Unknown service action: ${action}`);
|
|
21344
21526
|
}
|
|
21345
21527
|
function requireValue5(tokens, optionName) {
|
|
@@ -21349,6 +21531,13 @@ function requireValue5(tokens, optionName) {
|
|
|
21349
21531
|
}
|
|
21350
21532
|
return value;
|
|
21351
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
|
+
}
|
|
21352
21541
|
|
|
21353
21542
|
// src/roleCommandParser.ts
|
|
21354
21543
|
function parseRoleArgs(tokens) {
|
|
@@ -21661,6 +21850,7 @@ var HELP_TEXT = [
|
|
|
21661
21850
|
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21662
21851
|
` ${import_chalk3.default.gray(" create [<namespace>] --file <path> [--base-url <url>] [--json]")}`,
|
|
21663
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]")}`,
|
|
21664
21854
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21665
21855
|
` ${import_chalk3.default.gray(" default namespace: pmate; default base URL: https://agent-api.pmate.chat")}`,
|
|
21666
21856
|
` ${import_chalk3.default.cyan("ns")} Manage registered namespaces`,
|
|
@@ -21688,6 +21878,7 @@ var HELP_TEXT = [
|
|
|
21688
21878
|
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21689
21879
|
` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
|
|
21690
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]")}`,
|
|
21691
21882
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21692
21883
|
` ${import_chalk3.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
21693
21884
|
` ${import_chalk3.default.cyan("service")} Manage service registry entries via apps-api`,
|
|
@@ -21696,6 +21887,7 @@ var HELP_TEXT = [
|
|
|
21696
21887
|
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>]")}`,
|
|
21697
21888
|
` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
|
|
21698
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]")}`,
|
|
21699
21891
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21700
21892
|
` ${import_chalk3.default.gray(" deploy <ns:objectId> [--cwd <dir>] [--base-url <url>]")}`,
|
|
21701
21893
|
` ${import_chalk3.default.gray(" init <ns:objectId> [--cwd <dir>] [--base-url <url>]")}`,
|