@pmate/cli 0.17.1 → 0.17.3
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 +1 -0
- package/dist/index.js +85 -276
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -96,36 +96,18 @@ function loadSessionStoreWithPath() {
|
|
|
96
96
|
const raw = (0, import_node_fs2.readFileSync)(sessionPath, "utf8");
|
|
97
97
|
const parsed = JSON.parse(raw);
|
|
98
98
|
const store = normalizeStore(parsed);
|
|
99
|
-
const nextRaw = JSON.stringify(store, null, 2);
|
|
100
|
-
if (nextRaw !== raw.trim()) {
|
|
101
|
-
writeSessionStore(store);
|
|
102
|
-
}
|
|
103
99
|
return { sessionPath, store };
|
|
104
100
|
}
|
|
105
101
|
function normalizeStore(value) {
|
|
106
|
-
if (isSessionStore(value)) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
sessions: value.sessions || {}
|
|
111
|
-
};
|
|
102
|
+
if (!isSessionStore(value)) {
|
|
103
|
+
throw new Error(
|
|
104
|
+
`Invalid session store format in ${buildSessionStorePath()}. Run "pmate login" again.`
|
|
105
|
+
);
|
|
112
106
|
}
|
|
113
|
-
const legacy = value;
|
|
114
|
-
const app = resolveStoredAppId(legacy, legacy.session?.app || legacy.app || DEFAULT_APP_ID);
|
|
115
107
|
return {
|
|
116
108
|
version: SESSION_STORE_VERSION,
|
|
117
|
-
activeApp:
|
|
118
|
-
sessions: {
|
|
119
|
-
[app]: {
|
|
120
|
-
...legacy,
|
|
121
|
-
app,
|
|
122
|
-
session: {
|
|
123
|
-
...legacy.session,
|
|
124
|
-
...legacy.session?.app ? {} : { app }
|
|
125
|
-
},
|
|
126
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
127
|
-
}
|
|
128
|
-
}
|
|
109
|
+
activeApp: value.activeApp || DEFAULT_APP_ID,
|
|
110
|
+
sessions: value.sessions || {}
|
|
129
111
|
};
|
|
130
112
|
}
|
|
131
113
|
function isSessionStore(value) {
|
|
@@ -14034,46 +14016,6 @@ var BucketCommandHandler = class {
|
|
|
14034
14016
|
}
|
|
14035
14017
|
};
|
|
14036
14018
|
|
|
14037
|
-
// src/commands/DeployCommandHandler.ts
|
|
14038
|
-
var DeployCommandHandler = class {
|
|
14039
|
-
async handle(args) {
|
|
14040
|
-
const serviceId = args.deployApp.trim();
|
|
14041
|
-
const namespace = args.deployNamespace?.trim() || process.env.PMATE_SERVICE_NAMESPACE || "pmate";
|
|
14042
|
-
ui.warn("Top-level deploy is no longer supported.");
|
|
14043
|
-
if (!serviceId) {
|
|
14044
|
-
throw new Error("Use: pmate service deploy <ns:objectId>");
|
|
14045
|
-
}
|
|
14046
|
-
const suggestedAction = args.deployAction === "logs" ? "log" : "deploy";
|
|
14047
|
-
throw new Error(`Use: pmate service ${suggestedAction} ${namespace}:${serviceId}`);
|
|
14048
|
-
}
|
|
14049
|
-
};
|
|
14050
|
-
|
|
14051
|
-
// src/commands/LogCommandHandler.ts
|
|
14052
|
-
var LogCommandHandler = class {
|
|
14053
|
-
async handle(args) {
|
|
14054
|
-
const serviceId = args.logApp.trim();
|
|
14055
|
-
const namespace = args.logNamespace?.trim() || process.env.PMATE_SERVICE_NAMESPACE || process.env.PMATE_LOG_NAMESPACE || "pmate";
|
|
14056
|
-
ui.warn("Top-level log is no longer supported.");
|
|
14057
|
-
if (!serviceId) {
|
|
14058
|
-
throw new Error("Use: pmate service log <ns:objectId>");
|
|
14059
|
-
}
|
|
14060
|
-
throw new Error(`Use: pmate service log ${namespace}:${serviceId}`);
|
|
14061
|
-
}
|
|
14062
|
-
};
|
|
14063
|
-
|
|
14064
|
-
// src/commands/InitCommandHandler.ts
|
|
14065
|
-
var InitCommandHandler = class {
|
|
14066
|
-
async handle(args) {
|
|
14067
|
-
const serviceId = args.initApp.trim();
|
|
14068
|
-
const namespace = args.initNamespace?.trim() || process.env.PMATE_SERVICE_NAMESPACE || "pmate";
|
|
14069
|
-
ui.warn("Top-level init is no longer supported.");
|
|
14070
|
-
if (!serviceId) {
|
|
14071
|
-
throw new Error("Use: pmate service init <ns:objectId>");
|
|
14072
|
-
}
|
|
14073
|
-
throw new Error(`Use: pmate service init ${namespace}:${serviceId}`);
|
|
14074
|
-
}
|
|
14075
|
-
};
|
|
14076
|
-
|
|
14077
14019
|
// src/commands/DeleteCommandHandler.ts
|
|
14078
14020
|
var import_node_path5 = __toESM(require("path"));
|
|
14079
14021
|
var import_node_child_process2 = require("child_process");
|
|
@@ -18937,21 +18879,6 @@ function parseNamespacedRef(value, options = {}) {
|
|
|
18937
18879
|
fullId: `${namespace2}:${objectId}`
|
|
18938
18880
|
};
|
|
18939
18881
|
}
|
|
18940
|
-
if (options.allowLegacySlash) {
|
|
18941
|
-
const slashIndex = raw.indexOf("/");
|
|
18942
|
-
if (slashIndex > 0) {
|
|
18943
|
-
const namespace2 = raw.slice(0, slashIndex).trim();
|
|
18944
|
-
const objectId = raw.slice(slashIndex + 1).trim();
|
|
18945
|
-
if (!namespace2 || !objectId) {
|
|
18946
|
-
throw new Error(`Invalid ${entityLabel} "${value}". Use <ns:objectId>.`);
|
|
18947
|
-
}
|
|
18948
|
-
return {
|
|
18949
|
-
namespace: namespace2,
|
|
18950
|
-
objectId,
|
|
18951
|
-
fullId: `${namespace2}:${objectId}`
|
|
18952
|
-
};
|
|
18953
|
-
}
|
|
18954
|
-
}
|
|
18955
18882
|
const namespace = options.defaultNamespace?.trim();
|
|
18956
18883
|
if (namespace) {
|
|
18957
18884
|
return {
|
|
@@ -19454,11 +19381,12 @@ var AppCommandHandler = class {
|
|
|
19454
19381
|
}
|
|
19455
19382
|
case "get":
|
|
19456
19383
|
case "view": {
|
|
19384
|
+
const pathname = this.buildAppPath(args.id);
|
|
19457
19385
|
const record = await this.request(
|
|
19458
19386
|
baseUrl,
|
|
19459
19387
|
token,
|
|
19460
19388
|
"GET",
|
|
19461
|
-
|
|
19389
|
+
pathname
|
|
19462
19390
|
);
|
|
19463
19391
|
if (args.action === "view" && !args.json) {
|
|
19464
19392
|
this.renderView(record);
|
|
@@ -19483,11 +19411,12 @@ var AppCommandHandler = class {
|
|
|
19483
19411
|
}
|
|
19484
19412
|
case "update": {
|
|
19485
19413
|
const payload = this.readJsonFile(args.filePath);
|
|
19414
|
+
const pathname = this.buildAppPath(args.id);
|
|
19486
19415
|
const record = await this.request(
|
|
19487
19416
|
baseUrl,
|
|
19488
19417
|
token,
|
|
19489
19418
|
"PUT",
|
|
19490
|
-
|
|
19419
|
+
pathname,
|
|
19491
19420
|
payload
|
|
19492
19421
|
);
|
|
19493
19422
|
ui.success(`Updated app ${record.id}`);
|
|
@@ -19495,11 +19424,12 @@ var AppCommandHandler = class {
|
|
|
19495
19424
|
return;
|
|
19496
19425
|
}
|
|
19497
19426
|
case "delete": {
|
|
19427
|
+
const pathname = this.buildAppPath(args.id);
|
|
19498
19428
|
const record = await this.request(
|
|
19499
19429
|
baseUrl,
|
|
19500
19430
|
token,
|
|
19501
19431
|
"DELETE",
|
|
19502
|
-
|
|
19432
|
+
pathname
|
|
19503
19433
|
);
|
|
19504
19434
|
ui.success(`Disabled app ${record.id}`);
|
|
19505
19435
|
this.renderJson(record, args.json);
|
|
@@ -19589,6 +19519,12 @@ var AppCommandHandler = class {
|
|
|
19589
19519
|
updatedAt: item.updatedAt
|
|
19590
19520
|
});
|
|
19591
19521
|
}
|
|
19522
|
+
buildAppPath(appId) {
|
|
19523
|
+
const { namespace, objectId } = parseNamespacedRef(appId, {
|
|
19524
|
+
entityLabel: "app ref"
|
|
19525
|
+
});
|
|
19526
|
+
return `/apps/${encodeURIComponent(namespace)}/${encodeURIComponent(objectId)}`;
|
|
19527
|
+
}
|
|
19592
19528
|
};
|
|
19593
19529
|
function readNamespaceFromPayload(payload) {
|
|
19594
19530
|
if (!payload || typeof payload !== "object") {
|
|
@@ -20055,6 +19991,22 @@ var ServiceRegistryClient = class {
|
|
|
20055
19991
|
constructor(baseUrl) {
|
|
20056
19992
|
this.baseUrl = baseUrl;
|
|
20057
19993
|
}
|
|
19994
|
+
async listServices(filters) {
|
|
19995
|
+
const searchParams = new URLSearchParams();
|
|
19996
|
+
const repository = normalizeRepository(filters?.repository);
|
|
19997
|
+
if (repository) {
|
|
19998
|
+
searchParams.set("repo", repository);
|
|
19999
|
+
}
|
|
20000
|
+
const payload = await this.request(
|
|
20001
|
+
"GET",
|
|
20002
|
+
`/services${searchParams.size > 0 ? `?${searchParams.toString()}` : ""}`
|
|
20003
|
+
);
|
|
20004
|
+
const namespace = filters?.namespace?.trim();
|
|
20005
|
+
if (!namespace) {
|
|
20006
|
+
return payload.items;
|
|
20007
|
+
}
|
|
20008
|
+
return payload.items.filter((item) => item.namespace === namespace);
|
|
20009
|
+
}
|
|
20058
20010
|
async getService(namespace, name) {
|
|
20059
20011
|
return this.request(
|
|
20060
20012
|
"GET",
|
|
@@ -20097,6 +20049,20 @@ var ServiceRegistryClient = class {
|
|
|
20097
20049
|
return payload.data;
|
|
20098
20050
|
}
|
|
20099
20051
|
};
|
|
20052
|
+
function normalizeRepository(repository) {
|
|
20053
|
+
if (!repository) {
|
|
20054
|
+
return void 0;
|
|
20055
|
+
}
|
|
20056
|
+
const trimmed = repository.trim().replace(/\/+$/, "").replace(/\.git$/i, "");
|
|
20057
|
+
if (!trimmed) {
|
|
20058
|
+
return void 0;
|
|
20059
|
+
}
|
|
20060
|
+
const match = trimmed.match(/^https?:\/\/github\.com\/([^/]+\/[^/]+)$/i);
|
|
20061
|
+
if (match) {
|
|
20062
|
+
return match[1];
|
|
20063
|
+
}
|
|
20064
|
+
return trimmed.replace(/^\/+/, "");
|
|
20065
|
+
}
|
|
20100
20066
|
|
|
20101
20067
|
// src/commands/ServiceCommandHandler.ts
|
|
20102
20068
|
var ServiceCommandHandler = class {
|
|
@@ -20106,12 +20072,10 @@ var ServiceCommandHandler = class {
|
|
|
20106
20072
|
const runtime = new ServiceRuntimeRunner();
|
|
20107
20073
|
switch (args.action) {
|
|
20108
20074
|
case "list": {
|
|
20109
|
-
const
|
|
20110
|
-
|
|
20111
|
-
|
|
20112
|
-
|
|
20113
|
-
);
|
|
20114
|
-
const items = args.namespace ? response.items.filter((item) => item.namespace === args.namespace) : response.items;
|
|
20075
|
+
const items = await registry.listServices({
|
|
20076
|
+
namespace: args.namespace,
|
|
20077
|
+
repository: args.repository
|
|
20078
|
+
});
|
|
20115
20079
|
this.renderList(items, args.json);
|
|
20116
20080
|
return;
|
|
20117
20081
|
}
|
|
@@ -20666,16 +20630,14 @@ function parseAgentArgs(tokens) {
|
|
|
20666
20630
|
return { type: "agent" /* Agent */, action, namespace, baseUrl, json };
|
|
20667
20631
|
}
|
|
20668
20632
|
if (action === "get" || action === "view" || action === "delete") {
|
|
20669
|
-
const
|
|
20670
|
-
if (!
|
|
20633
|
+
const ref = rest.shift();
|
|
20634
|
+
if (!ref) {
|
|
20671
20635
|
throw new Error(
|
|
20672
20636
|
`Usage: agent ${action} <ns:objectId> [--base-url <url>] [--json]`
|
|
20673
20637
|
);
|
|
20674
20638
|
}
|
|
20675
|
-
let
|
|
20676
|
-
let name = first;
|
|
20639
|
+
let namespaceFromOption;
|
|
20677
20640
|
if (action === "view") {
|
|
20678
|
-
let namespaceFromOption;
|
|
20679
20641
|
while (rest.length > 0) {
|
|
20680
20642
|
const token = rest[0];
|
|
20681
20643
|
if (token === "--ns" || token === "--namespace") {
|
|
@@ -20685,30 +20647,23 @@ function parseAgentArgs(tokens) {
|
|
|
20685
20647
|
}
|
|
20686
20648
|
break;
|
|
20687
20649
|
}
|
|
20688
|
-
const parsed = parseNamespacedRef(first, {
|
|
20689
|
-
defaultNamespace: namespaceFromOption,
|
|
20690
|
-
entityLabel: "agent ref"
|
|
20691
|
-
});
|
|
20692
|
-
namespace = parsed.namespace;
|
|
20693
|
-
name = parsed.objectId;
|
|
20694
|
-
} else if (first.includes(":")) {
|
|
20695
|
-
const parsed = parseNamespacedRef(first, { entityLabel: "agent ref" });
|
|
20696
|
-
namespace = parsed.namespace;
|
|
20697
|
-
name = parsed.objectId;
|
|
20698
|
-
} else {
|
|
20699
|
-
const second = rest.shift();
|
|
20700
|
-
if (second && !second.startsWith("-")) {
|
|
20701
|
-
namespace = first;
|
|
20702
|
-
name = second;
|
|
20703
|
-
} else if (second) {
|
|
20704
|
-
rest.unshift(second);
|
|
20705
|
-
}
|
|
20706
20650
|
}
|
|
20651
|
+
const parsed = parseNamespacedRef(ref, {
|
|
20652
|
+
defaultNamespace: action === "view" ? namespaceFromOption : void 0,
|
|
20653
|
+
entityLabel: "agent ref"
|
|
20654
|
+
});
|
|
20707
20655
|
takeSharedOptions4();
|
|
20708
20656
|
if (rest.length > 0) {
|
|
20709
20657
|
throw new Error(`Unknown agent ${action} option: ${rest[0]}`);
|
|
20710
20658
|
}
|
|
20711
|
-
return {
|
|
20659
|
+
return {
|
|
20660
|
+
type: "agent" /* Agent */,
|
|
20661
|
+
action,
|
|
20662
|
+
namespace: parsed.namespace,
|
|
20663
|
+
name: parsed.objectId,
|
|
20664
|
+
baseUrl,
|
|
20665
|
+
json
|
|
20666
|
+
};
|
|
20712
20667
|
}
|
|
20713
20668
|
if (action === "create") {
|
|
20714
20669
|
let namespace = DEFAULT_AGENT_NAMESPACE;
|
|
@@ -20738,27 +20693,13 @@ function parseAgentArgs(tokens) {
|
|
|
20738
20693
|
return { type: "agent" /* Agent */, action, namespace, filePath, baseUrl, json };
|
|
20739
20694
|
}
|
|
20740
20695
|
if (action === "update") {
|
|
20741
|
-
const
|
|
20742
|
-
if (!
|
|
20696
|
+
const ref = rest.shift();
|
|
20697
|
+
if (!ref) {
|
|
20743
20698
|
throw new Error(
|
|
20744
20699
|
"Usage: agent update <ns:objectId> --file <path> [--base-url <url>] [--json]"
|
|
20745
20700
|
);
|
|
20746
20701
|
}
|
|
20747
|
-
|
|
20748
|
-
let name = first;
|
|
20749
|
-
if (first.includes(":")) {
|
|
20750
|
-
const parsed = parseNamespacedRef(first, { entityLabel: "agent ref" });
|
|
20751
|
-
namespace = parsed.namespace;
|
|
20752
|
-
name = parsed.objectId;
|
|
20753
|
-
} else {
|
|
20754
|
-
const second = rest.shift();
|
|
20755
|
-
if (second && !second.startsWith("-")) {
|
|
20756
|
-
namespace = first;
|
|
20757
|
-
name = second;
|
|
20758
|
-
} else if (second) {
|
|
20759
|
-
rest.unshift(second);
|
|
20760
|
-
}
|
|
20761
|
-
}
|
|
20702
|
+
const parsed = parseNamespacedRef(ref, { entityLabel: "agent ref" });
|
|
20762
20703
|
let filePath;
|
|
20763
20704
|
while (rest.length > 0) {
|
|
20764
20705
|
const token = rest.shift();
|
|
@@ -20779,7 +20720,15 @@ function parseAgentArgs(tokens) {
|
|
|
20779
20720
|
if (!filePath) {
|
|
20780
20721
|
throw new Error("Missing required option --file for agent update");
|
|
20781
20722
|
}
|
|
20782
|
-
return {
|
|
20723
|
+
return {
|
|
20724
|
+
type: "agent" /* Agent */,
|
|
20725
|
+
action,
|
|
20726
|
+
namespace: parsed.namespace,
|
|
20727
|
+
name: parsed.objectId,
|
|
20728
|
+
filePath,
|
|
20729
|
+
baseUrl,
|
|
20730
|
+
json
|
|
20731
|
+
};
|
|
20783
20732
|
}
|
|
20784
20733
|
throw new Error(`Unknown agent action: ${action}`);
|
|
20785
20734
|
}
|
|
@@ -21218,12 +21167,16 @@ function parseServiceArgs(tokens) {
|
|
|
21218
21167
|
let json = false;
|
|
21219
21168
|
if (action === "list") {
|
|
21220
21169
|
let namespace;
|
|
21170
|
+
let repository;
|
|
21221
21171
|
while (rest.length > 0) {
|
|
21222
21172
|
const token = rest.shift();
|
|
21223
21173
|
switch (token) {
|
|
21224
21174
|
case "--namespace":
|
|
21225
21175
|
namespace = requireValue5(rest, token);
|
|
21226
21176
|
break;
|
|
21177
|
+
case "--repo":
|
|
21178
|
+
repository = requireValue5(rest, token);
|
|
21179
|
+
break;
|
|
21227
21180
|
case "--base-url":
|
|
21228
21181
|
baseUrl = requireValue5(rest, token);
|
|
21229
21182
|
break;
|
|
@@ -21234,7 +21187,7 @@ function parseServiceArgs(tokens) {
|
|
|
21234
21187
|
throw new Error(`Unknown service list option: ${token}`);
|
|
21235
21188
|
}
|
|
21236
21189
|
}
|
|
21237
|
-
return { type: "service" /* Service */, action, namespace, baseUrl, json };
|
|
21190
|
+
return { type: "service" /* Service */, action, namespace, repository, baseUrl, json };
|
|
21238
21191
|
}
|
|
21239
21192
|
if (action === "get" || action === "view" || action === "delete" || action === "deploy" || action === "init" || action === "log") {
|
|
21240
21193
|
const ref = rest.shift();
|
|
@@ -21277,7 +21230,6 @@ function parseServiceArgs(tokens) {
|
|
|
21277
21230
|
}
|
|
21278
21231
|
const parsedRef = parseNamespacedRef(ref, {
|
|
21279
21232
|
defaultNamespace: action === "view" || action === "deploy" || action === "init" || action === "log" ? namespaceFromOption : void 0,
|
|
21280
|
-
allowLegacySlash: action === "view" || action === "deploy" || action === "init" || action === "log",
|
|
21281
21233
|
entityLabel: "service ref"
|
|
21282
21234
|
});
|
|
21283
21235
|
const namespace = parsedRef.namespace;
|
|
@@ -21606,12 +21558,6 @@ var HELP_TEXT = [
|
|
|
21606
21558
|
` ${import_chalk3.default.cyan("sts")} Request an OSS STS token from the CI server`,
|
|
21607
21559
|
` ${import_chalk3.default.cyan("bucket")} Manage OSS buckets`,
|
|
21608
21560
|
` ${import_chalk3.default.gray(" --create --name <bucket> [--subdomain <name> --domain <name>]")}`,
|
|
21609
|
-
` ${import_chalk3.default.cyan("deploy")} Deprecated; use pmate service deploy`,
|
|
21610
|
-
` ${import_chalk3.default.gray(" <service-name> [deploy|logs] [--ns <namespace>]")}`,
|
|
21611
|
-
` ${import_chalk3.default.cyan("log")} Deprecated; use pmate service log`,
|
|
21612
|
-
` ${import_chalk3.default.gray(" <service-name> [--ns <namespace>]")}`,
|
|
21613
|
-
` ${import_chalk3.default.cyan("init")} Deprecated; use pmate service init`,
|
|
21614
|
-
` ${import_chalk3.default.gray(" <service-name> [--ns <namespace>]")}`,
|
|
21615
21561
|
` ${import_chalk3.default.cyan("delete")} Tear down app resources created by init`,
|
|
21616
21562
|
` ${import_chalk3.default.gray(" [app] <app-name> [--cwd <dir>]")}`,
|
|
21617
21563
|
` ${import_chalk3.default.cyan("dev")} Run the dev script for app dir from .pmate.yaml`,
|
|
@@ -21702,7 +21648,7 @@ var HELP_TEXT = [
|
|
|
21702
21648
|
` ${import_chalk3.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21703
21649
|
` ${import_chalk3.default.gray(" default base URL: https://apps-api.pmate.chat")}`,
|
|
21704
21650
|
` ${import_chalk3.default.cyan("service")} Manage service registry entries via apps-api`,
|
|
21705
|
-
` ${import_chalk3.default.gray(" list [--namespace <ns>] [--base-url <url>] [--json]")}`,
|
|
21651
|
+
` ${import_chalk3.default.gray(" list [--namespace <ns>] [--repo <owner/name|https://github.com/owner/name>] [--base-url <url>] [--json]")}`,
|
|
21706
21652
|
` ${import_chalk3.default.gray(" get <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
21707
21653
|
` ${import_chalk3.default.gray(" view (<ns:objectId> | <id> --ns <namespace>) [--base-url <url>] [--json]")}`,
|
|
21708
21654
|
` ${import_chalk3.default.gray(" create --file <path> [--base-url <url>] [--json]")}`,
|
|
@@ -21792,15 +21738,6 @@ function parseCommandArgs(args) {
|
|
|
21792
21738
|
if (args.rest[0] === "bucket") {
|
|
21793
21739
|
return parseBucketArgs(args.rest.slice(1));
|
|
21794
21740
|
}
|
|
21795
|
-
if (args.rest[0] === "deploy") {
|
|
21796
|
-
return parseDeployArgs(args.rest.slice(1));
|
|
21797
|
-
}
|
|
21798
|
-
if (args.rest[0] === "log") {
|
|
21799
|
-
return parseLogArgs(args.rest.slice(1));
|
|
21800
|
-
}
|
|
21801
|
-
if (args.rest[0] === "init") {
|
|
21802
|
-
return parseInitArgs(args.rest.slice(1));
|
|
21803
|
-
}
|
|
21804
21741
|
if (args.rest[0] === "delete") {
|
|
21805
21742
|
return parseDeleteArgs(args.rest.slice(1));
|
|
21806
21743
|
}
|
|
@@ -22006,119 +21943,6 @@ function parseBucketArgs(tokens) {
|
|
|
22006
21943
|
}
|
|
22007
21944
|
return { type: "bucket" /* Bucket */, ...options };
|
|
22008
21945
|
}
|
|
22009
|
-
function parseDeployArgs(tokens) {
|
|
22010
|
-
const options = {
|
|
22011
|
-
deployApp: "",
|
|
22012
|
-
deployAction: "deploy",
|
|
22013
|
-
deployCwd: process.cwd()
|
|
22014
|
-
};
|
|
22015
|
-
const rest = [...tokens];
|
|
22016
|
-
const appName = rest.shift();
|
|
22017
|
-
if (!appName || appName.startsWith("-")) {
|
|
22018
|
-
throw new Error("Missing app name for deploy command");
|
|
22019
|
-
}
|
|
22020
|
-
options.deployApp = appName;
|
|
22021
|
-
while (rest.length > 0) {
|
|
22022
|
-
const token = rest.shift();
|
|
22023
|
-
switch (token) {
|
|
22024
|
-
case "deploy":
|
|
22025
|
-
options.deployAction = "deploy";
|
|
22026
|
-
break;
|
|
22027
|
-
case "logs":
|
|
22028
|
-
options.deployAction = "logs";
|
|
22029
|
-
break;
|
|
22030
|
-
case "--cwd":
|
|
22031
|
-
options.deployCwd = requireValue8(rest, token);
|
|
22032
|
-
break;
|
|
22033
|
-
case "--ns":
|
|
22034
|
-
case "--namespace":
|
|
22035
|
-
options.deployNamespace = requireValue8(rest, token);
|
|
22036
|
-
break;
|
|
22037
|
-
case "--base-url":
|
|
22038
|
-
options.deployBaseUrl = requireValue8(rest, token);
|
|
22039
|
-
break;
|
|
22040
|
-
default:
|
|
22041
|
-
throw new Error(`Unknown deploy option: ${token}`);
|
|
22042
|
-
}
|
|
22043
|
-
}
|
|
22044
|
-
return { type: "deploy" /* Deploy */, ...options };
|
|
22045
|
-
}
|
|
22046
|
-
function parseLogArgs(tokens) {
|
|
22047
|
-
const options = {
|
|
22048
|
-
logApp: "",
|
|
22049
|
-
logCwd: process.cwd(),
|
|
22050
|
-
logPage: 0,
|
|
22051
|
-
logHistory: false
|
|
22052
|
-
};
|
|
22053
|
-
const rest = [...tokens];
|
|
22054
|
-
const appName = rest.shift();
|
|
22055
|
-
if (!appName || appName.startsWith("-")) {
|
|
22056
|
-
throw new Error("Missing app name for log command");
|
|
22057
|
-
}
|
|
22058
|
-
options.logApp = appName;
|
|
22059
|
-
while (rest.length > 0) {
|
|
22060
|
-
const token = rest.shift();
|
|
22061
|
-
switch (token) {
|
|
22062
|
-
case "--cwd":
|
|
22063
|
-
options.logCwd = requireValue8(rest, token);
|
|
22064
|
-
break;
|
|
22065
|
-
case "--ns":
|
|
22066
|
-
options.logNamespace = requireValue8(rest, token);
|
|
22067
|
-
break;
|
|
22068
|
-
case "--base-url":
|
|
22069
|
-
options.logBaseUrl = requireValue8(rest, token);
|
|
22070
|
-
break;
|
|
22071
|
-
case "--page": {
|
|
22072
|
-
const value = requireValue8(rest, token);
|
|
22073
|
-
const page = Number.parseInt(value, 10);
|
|
22074
|
-
if (!Number.isFinite(page) || page < 0) {
|
|
22075
|
-
throw new Error(`Invalid log page: ${value}`);
|
|
22076
|
-
}
|
|
22077
|
-
options.logPage = page;
|
|
22078
|
-
break;
|
|
22079
|
-
}
|
|
22080
|
-
case "--history":
|
|
22081
|
-
options.logHistory = true;
|
|
22082
|
-
break;
|
|
22083
|
-
case "--search":
|
|
22084
|
-
options.logSearch = requireValue8(rest, token);
|
|
22085
|
-
break;
|
|
22086
|
-
default:
|
|
22087
|
-
throw new Error(`Unknown log option: ${token}`);
|
|
22088
|
-
}
|
|
22089
|
-
}
|
|
22090
|
-
return { type: "log" /* Log */, ...options };
|
|
22091
|
-
}
|
|
22092
|
-
function parseInitArgs(tokens) {
|
|
22093
|
-
const options = {
|
|
22094
|
-
initApp: "",
|
|
22095
|
-
initCwd: process.cwd()
|
|
22096
|
-
};
|
|
22097
|
-
const rest = [...tokens];
|
|
22098
|
-
const appName = rest.shift();
|
|
22099
|
-
if (!appName || appName.startsWith("-")) {
|
|
22100
|
-
throw new Error("Missing app name for init command");
|
|
22101
|
-
}
|
|
22102
|
-
options.initApp = appName;
|
|
22103
|
-
while (rest.length > 0) {
|
|
22104
|
-
const token = rest.shift();
|
|
22105
|
-
switch (token) {
|
|
22106
|
-
case "--cwd":
|
|
22107
|
-
options.initCwd = requireValue8(rest, token);
|
|
22108
|
-
break;
|
|
22109
|
-
case "--ns":
|
|
22110
|
-
case "--namespace":
|
|
22111
|
-
options.initNamespace = requireValue8(rest, token);
|
|
22112
|
-
break;
|
|
22113
|
-
case "--base-url":
|
|
22114
|
-
options.initBaseUrl = requireValue8(rest, token);
|
|
22115
|
-
break;
|
|
22116
|
-
default:
|
|
22117
|
-
throw new Error(`Unknown init option: ${token}`);
|
|
22118
|
-
}
|
|
22119
|
-
}
|
|
22120
|
-
return { type: "init" /* Init */, ...options };
|
|
22121
|
-
}
|
|
22122
21946
|
function parseDevArgs(tokens) {
|
|
22123
21947
|
const options = {
|
|
22124
21948
|
devApp: "",
|
|
@@ -23330,21 +23154,6 @@ async function main() {
|
|
|
23330
23154
|
await handler.handle(commandArgs);
|
|
23331
23155
|
return;
|
|
23332
23156
|
}
|
|
23333
|
-
case "deploy" /* Deploy */: {
|
|
23334
|
-
const handler = new DeployCommandHandler();
|
|
23335
|
-
await handler.handle(commandArgs);
|
|
23336
|
-
return;
|
|
23337
|
-
}
|
|
23338
|
-
case "log" /* Log */: {
|
|
23339
|
-
const handler = new LogCommandHandler();
|
|
23340
|
-
await handler.handle(commandArgs);
|
|
23341
|
-
return;
|
|
23342
|
-
}
|
|
23343
|
-
case "init" /* Init */: {
|
|
23344
|
-
const handler = new InitCommandHandler();
|
|
23345
|
-
await handler.handle(commandArgs);
|
|
23346
|
-
return;
|
|
23347
|
-
}
|
|
23348
23157
|
case "delete" /* Delete */: {
|
|
23349
23158
|
const handler = new DeleteCommandHandler();
|
|
23350
23159
|
await handler.handle(commandArgs);
|