@pmate/cli 0.16.0 → 0.16.1
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 +23 -1
- package/dist/index.js +571 -286
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18807,167 +18807,6 @@ function parseMessageText(raw) {
|
|
|
18807
18807
|
var import_node_fs12 = require("fs");
|
|
18808
18808
|
var import_node_path17 = __toESM(require("path"));
|
|
18809
18809
|
init_sessionStore();
|
|
18810
|
-
var AgentCommandHandler = class {
|
|
18811
|
-
async handle(args) {
|
|
18812
|
-
const token = this.readToken();
|
|
18813
|
-
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
18814
|
-
switch (args.action) {
|
|
18815
|
-
case "namespaces": {
|
|
18816
|
-
const response = await this.request(
|
|
18817
|
-
baseUrl,
|
|
18818
|
-
token,
|
|
18819
|
-
"GET",
|
|
18820
|
-
"/agents/namespaces"
|
|
18821
|
-
);
|
|
18822
|
-
this.renderNamespaces(response.items, args.json);
|
|
18823
|
-
return;
|
|
18824
|
-
}
|
|
18825
|
-
case "list": {
|
|
18826
|
-
const response = await this.request(
|
|
18827
|
-
baseUrl,
|
|
18828
|
-
token,
|
|
18829
|
-
"GET",
|
|
18830
|
-
`/agents?namespace=${encodeURIComponent(args.namespace)}`
|
|
18831
|
-
);
|
|
18832
|
-
this.renderList(response.items, args.json);
|
|
18833
|
-
return;
|
|
18834
|
-
}
|
|
18835
|
-
case "get": {
|
|
18836
|
-
const record = await this.request(
|
|
18837
|
-
baseUrl,
|
|
18838
|
-
token,
|
|
18839
|
-
"GET",
|
|
18840
|
-
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
18841
|
-
);
|
|
18842
|
-
this.renderJson(record, args.json ?? true);
|
|
18843
|
-
return;
|
|
18844
|
-
}
|
|
18845
|
-
case "create": {
|
|
18846
|
-
const payload = this.readJsonFile(args.filePath);
|
|
18847
|
-
const record = await this.request(
|
|
18848
|
-
baseUrl,
|
|
18849
|
-
token,
|
|
18850
|
-
"POST",
|
|
18851
|
-
`/agents/${encodeURIComponent(args.namespace)}`,
|
|
18852
|
-
payload
|
|
18853
|
-
);
|
|
18854
|
-
ui.success(`Created agent ${record.id}`);
|
|
18855
|
-
this.renderJson(record, args.json);
|
|
18856
|
-
return;
|
|
18857
|
-
}
|
|
18858
|
-
case "update": {
|
|
18859
|
-
const payload = this.readJsonFile(args.filePath);
|
|
18860
|
-
const record = await this.request(
|
|
18861
|
-
baseUrl,
|
|
18862
|
-
token,
|
|
18863
|
-
"PUT",
|
|
18864
|
-
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`,
|
|
18865
|
-
payload
|
|
18866
|
-
);
|
|
18867
|
-
ui.success(`Updated agent ${record.id}`);
|
|
18868
|
-
this.renderJson(record, args.json);
|
|
18869
|
-
return;
|
|
18870
|
-
}
|
|
18871
|
-
case "delete": {
|
|
18872
|
-
const record = await this.request(
|
|
18873
|
-
baseUrl,
|
|
18874
|
-
token,
|
|
18875
|
-
"DELETE",
|
|
18876
|
-
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
18877
|
-
);
|
|
18878
|
-
ui.success(`Disabled agent ${record.id}`);
|
|
18879
|
-
this.renderJson(record, args.json);
|
|
18880
|
-
return;
|
|
18881
|
-
}
|
|
18882
|
-
}
|
|
18883
|
-
}
|
|
18884
|
-
resolveBaseUrl(baseUrl) {
|
|
18885
|
-
return (baseUrl || process.env.PMATE_AGENT_API_BASE_URL || "https://agent-api.pmate.chat").replace(
|
|
18886
|
-
/\/+$/,
|
|
18887
|
-
""
|
|
18888
|
-
);
|
|
18889
|
-
}
|
|
18890
|
-
readToken() {
|
|
18891
|
-
return readRequiredSession({
|
|
18892
|
-
preferredApp: DEFAULT_APP_ID
|
|
18893
|
-
}).token;
|
|
18894
|
-
}
|
|
18895
|
-
readJsonFile(filePath) {
|
|
18896
|
-
const absolutePath = import_node_path17.default.resolve(process.cwd(), filePath);
|
|
18897
|
-
if (!(0, import_node_fs12.existsSync)(absolutePath)) {
|
|
18898
|
-
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
18899
|
-
}
|
|
18900
|
-
const raw = (0, import_node_fs12.readFileSync)(absolutePath, "utf8");
|
|
18901
|
-
try {
|
|
18902
|
-
return JSON.parse(raw);
|
|
18903
|
-
} catch (error) {
|
|
18904
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
18905
|
-
throw new Error(`Invalid JSON in ${absolutePath}: ${message}`);
|
|
18906
|
-
}
|
|
18907
|
-
}
|
|
18908
|
-
async request(baseUrl, token, method, pathname, body) {
|
|
18909
|
-
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
18910
|
-
method,
|
|
18911
|
-
headers: {
|
|
18912
|
-
Authorization: `Bearer ${token}`,
|
|
18913
|
-
"Content-Type": "application/json"
|
|
18914
|
-
},
|
|
18915
|
-
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
18916
|
-
});
|
|
18917
|
-
let payload = null;
|
|
18918
|
-
try {
|
|
18919
|
-
payload = await response.json();
|
|
18920
|
-
} catch {
|
|
18921
|
-
payload = null;
|
|
18922
|
-
}
|
|
18923
|
-
if (!response.ok || !payload?.success) {
|
|
18924
|
-
throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
18925
|
-
}
|
|
18926
|
-
return payload.data;
|
|
18927
|
-
}
|
|
18928
|
-
renderList(items, asJson) {
|
|
18929
|
-
if (asJson) {
|
|
18930
|
-
ui.plain(JSON.stringify(items, null, 2));
|
|
18931
|
-
return;
|
|
18932
|
-
}
|
|
18933
|
-
if (items.length === 0) {
|
|
18934
|
-
ui.warn("No agents found.");
|
|
18935
|
-
return;
|
|
18936
|
-
}
|
|
18937
|
-
for (const item of items) {
|
|
18938
|
-
ui.info(`${item.namespace}/${item.name}`, {
|
|
18939
|
-
status: item.status,
|
|
18940
|
-
version: item.version
|
|
18941
|
-
});
|
|
18942
|
-
}
|
|
18943
|
-
}
|
|
18944
|
-
renderJson(value, asJson) {
|
|
18945
|
-
if (!asJson) {
|
|
18946
|
-
return;
|
|
18947
|
-
}
|
|
18948
|
-
ui.plain(JSON.stringify(value, null, 2));
|
|
18949
|
-
}
|
|
18950
|
-
renderNamespaces(items, asJson) {
|
|
18951
|
-
if (asJson) {
|
|
18952
|
-
ui.plain(JSON.stringify(items, null, 2));
|
|
18953
|
-
return;
|
|
18954
|
-
}
|
|
18955
|
-
if (items.length === 0) {
|
|
18956
|
-
ui.warn("No namespaces found.");
|
|
18957
|
-
return;
|
|
18958
|
-
}
|
|
18959
|
-
for (const item of items) {
|
|
18960
|
-
ui.info(item.namespace, {
|
|
18961
|
-
status: item.status,
|
|
18962
|
-
updatedAt: item.updatedAt
|
|
18963
|
-
});
|
|
18964
|
-
}
|
|
18965
|
-
}
|
|
18966
|
-
};
|
|
18967
|
-
|
|
18968
|
-
// src/commands/StoreCommandHandler.ts
|
|
18969
|
-
var import_node_fs13 = require("fs");
|
|
18970
|
-
var import_node_path18 = __toESM(require("path"));
|
|
18971
18810
|
|
|
18972
18811
|
// src/storeClient.ts
|
|
18973
18812
|
var STORE_LOG_VERSION = 1;
|
|
@@ -19015,6 +18854,13 @@ async function requestJson(url, init, fallbackMessage) {
|
|
|
19015
18854
|
}
|
|
19016
18855
|
return payload;
|
|
19017
18856
|
}
|
|
18857
|
+
function normalizeNamespace(value) {
|
|
18858
|
+
const normalized = value.trim().toLowerCase();
|
|
18859
|
+
if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(normalized)) {
|
|
18860
|
+
throw new Error("Invalid namespace. Use lowercase letters, numbers, and dashes only.");
|
|
18861
|
+
}
|
|
18862
|
+
return normalized;
|
|
18863
|
+
}
|
|
19018
18864
|
var IndexerClient = class {
|
|
19019
18865
|
constructor(baseUrl) {
|
|
19020
18866
|
this.baseUrl = baseUrl;
|
|
@@ -19187,8 +19033,320 @@ var Namespace = class {
|
|
|
19187
19033
|
};
|
|
19188
19034
|
}
|
|
19189
19035
|
};
|
|
19036
|
+
var NamespaceRegistry = class {
|
|
19037
|
+
constructor(options) {
|
|
19038
|
+
this.options = options;
|
|
19039
|
+
}
|
|
19040
|
+
async list() {
|
|
19041
|
+
return this.request("GET", "/namespaces");
|
|
19042
|
+
}
|
|
19043
|
+
async get(namespace) {
|
|
19044
|
+
const normalized = normalizeNamespace(namespace);
|
|
19045
|
+
const response = await fetch(
|
|
19046
|
+
`${this.options.registryBaseUrl.replace(/\/+$/, "")}/namespaces/${encodeURIComponent(normalized)}`,
|
|
19047
|
+
{
|
|
19048
|
+
method: "GET",
|
|
19049
|
+
headers: {
|
|
19050
|
+
Accept: "application/json",
|
|
19051
|
+
...this.options.headers
|
|
19052
|
+
}
|
|
19053
|
+
}
|
|
19054
|
+
);
|
|
19055
|
+
if (response.status === 404) {
|
|
19056
|
+
return void 0;
|
|
19057
|
+
}
|
|
19058
|
+
const payload = await response.json();
|
|
19059
|
+
if (!response.ok || !payload?.success) {
|
|
19060
|
+
throw new Error(payload?.message || `Namespace request failed: ${response.status}`);
|
|
19061
|
+
}
|
|
19062
|
+
return payload.data;
|
|
19063
|
+
}
|
|
19064
|
+
async exists(namespace) {
|
|
19065
|
+
return Boolean(await this.get(namespace));
|
|
19066
|
+
}
|
|
19067
|
+
async create(namespace) {
|
|
19068
|
+
return this.request("POST", "/namespaces", {
|
|
19069
|
+
namespace: normalizeNamespace(namespace)
|
|
19070
|
+
});
|
|
19071
|
+
}
|
|
19072
|
+
async require(namespace) {
|
|
19073
|
+
const record = await this.get(namespace);
|
|
19074
|
+
if (!record || record.status !== "active") {
|
|
19075
|
+
throw new Error(`Namespace "${normalizeNamespace(namespace)}" is not registered.`);
|
|
19076
|
+
}
|
|
19077
|
+
if (!this.options.blockchainBaseUrl || !this.options.indexerBaseUrl) {
|
|
19078
|
+
throw new Error("Namespace handle requires blockchain and indexer base URLs.");
|
|
19079
|
+
}
|
|
19080
|
+
return new Namespace({
|
|
19081
|
+
chain: this.options.chain,
|
|
19082
|
+
ns: record.namespace,
|
|
19083
|
+
baseUrl: this.options.blockchainBaseUrl,
|
|
19084
|
+
indexerBaseUrl: this.options.indexerBaseUrl
|
|
19085
|
+
});
|
|
19086
|
+
}
|
|
19087
|
+
async request(method, pathname, body) {
|
|
19088
|
+
const response = await fetch(`${this.options.registryBaseUrl.replace(/\/+$/, "")}${pathname}`, {
|
|
19089
|
+
method,
|
|
19090
|
+
headers: {
|
|
19091
|
+
Accept: "application/json",
|
|
19092
|
+
...this.options.headers,
|
|
19093
|
+
...method === "POST" ? { "Content-Type": "application/json" } : {}
|
|
19094
|
+
},
|
|
19095
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
19096
|
+
});
|
|
19097
|
+
const payload = await response.json();
|
|
19098
|
+
if (!response.ok || !payload?.success) {
|
|
19099
|
+
throw new Error(payload?.message || `Namespace request failed: ${response.status}`);
|
|
19100
|
+
}
|
|
19101
|
+
return payload.data;
|
|
19102
|
+
}
|
|
19103
|
+
};
|
|
19104
|
+
|
|
19105
|
+
// src/commands/AgentCommandHandler.ts
|
|
19106
|
+
var AgentCommandHandler = class {
|
|
19107
|
+
async handle(args) {
|
|
19108
|
+
const token = this.readToken();
|
|
19109
|
+
const baseUrl = this.resolveBaseUrl(args.baseUrl);
|
|
19110
|
+
switch (args.action) {
|
|
19111
|
+
case "namespaces": {
|
|
19112
|
+
const response = await this.request(
|
|
19113
|
+
baseUrl,
|
|
19114
|
+
token,
|
|
19115
|
+
"GET",
|
|
19116
|
+
"/agents/namespaces"
|
|
19117
|
+
);
|
|
19118
|
+
this.renderNamespaces(response.items, args.json);
|
|
19119
|
+
return;
|
|
19120
|
+
}
|
|
19121
|
+
case "list": {
|
|
19122
|
+
const response = await this.request(
|
|
19123
|
+
baseUrl,
|
|
19124
|
+
token,
|
|
19125
|
+
"GET",
|
|
19126
|
+
`/agents?namespace=${encodeURIComponent(args.namespace)}`
|
|
19127
|
+
);
|
|
19128
|
+
this.renderList(response.items, args.json);
|
|
19129
|
+
return;
|
|
19130
|
+
}
|
|
19131
|
+
case "get": {
|
|
19132
|
+
const record = await this.request(
|
|
19133
|
+
baseUrl,
|
|
19134
|
+
token,
|
|
19135
|
+
"GET",
|
|
19136
|
+
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
19137
|
+
);
|
|
19138
|
+
this.renderJson(record, args.json ?? true);
|
|
19139
|
+
return;
|
|
19140
|
+
}
|
|
19141
|
+
case "create": {
|
|
19142
|
+
await this.requireNamespace(args.namespace, baseUrl);
|
|
19143
|
+
const payload = this.readJsonFile(args.filePath);
|
|
19144
|
+
const record = await this.request(
|
|
19145
|
+
baseUrl,
|
|
19146
|
+
token,
|
|
19147
|
+
"POST",
|
|
19148
|
+
`/agents/${encodeURIComponent(args.namespace)}`,
|
|
19149
|
+
payload
|
|
19150
|
+
);
|
|
19151
|
+
ui.success(`Created agent ${record.id}`);
|
|
19152
|
+
this.renderJson(record, args.json);
|
|
19153
|
+
return;
|
|
19154
|
+
}
|
|
19155
|
+
case "update": {
|
|
19156
|
+
const payload = this.readJsonFile(args.filePath);
|
|
19157
|
+
const record = await this.request(
|
|
19158
|
+
baseUrl,
|
|
19159
|
+
token,
|
|
19160
|
+
"PUT",
|
|
19161
|
+
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`,
|
|
19162
|
+
payload
|
|
19163
|
+
);
|
|
19164
|
+
ui.success(`Updated agent ${record.id}`);
|
|
19165
|
+
this.renderJson(record, args.json);
|
|
19166
|
+
return;
|
|
19167
|
+
}
|
|
19168
|
+
case "delete": {
|
|
19169
|
+
const record = await this.request(
|
|
19170
|
+
baseUrl,
|
|
19171
|
+
token,
|
|
19172
|
+
"DELETE",
|
|
19173
|
+
`/agents/${encodeURIComponent(args.namespace)}/${encodeURIComponent(args.name)}`
|
|
19174
|
+
);
|
|
19175
|
+
ui.success(`Disabled agent ${record.id}`);
|
|
19176
|
+
this.renderJson(record, args.json);
|
|
19177
|
+
return;
|
|
19178
|
+
}
|
|
19179
|
+
}
|
|
19180
|
+
}
|
|
19181
|
+
resolveBaseUrl(baseUrl) {
|
|
19182
|
+
return (baseUrl || process.env.PMATE_AGENT_API_BASE_URL || "https://agent-api.pmate.chat").replace(
|
|
19183
|
+
/\/+$/,
|
|
19184
|
+
""
|
|
19185
|
+
);
|
|
19186
|
+
}
|
|
19187
|
+
async requireNamespace(namespace, registryBaseUrl) {
|
|
19188
|
+
const registry = new NamespaceRegistry({
|
|
19189
|
+
chain: "pmate",
|
|
19190
|
+
registryBaseUrl: this.resolveNamespaceBaseUrl(registryBaseUrl)
|
|
19191
|
+
});
|
|
19192
|
+
const exists = await registry.exists(namespace);
|
|
19193
|
+
if (!exists) {
|
|
19194
|
+
throw new Error(`Namespace "${namespace}" is not registered. Run: pmate ns create ${namespace}`);
|
|
19195
|
+
}
|
|
19196
|
+
}
|
|
19197
|
+
resolveNamespaceBaseUrl(baseUrl) {
|
|
19198
|
+
const envBaseUrl = process.env.PMATE_NAMESPACE_API_BASE_URL || process.env.PMATE_APPS_API_BASE_URL;
|
|
19199
|
+
if (envBaseUrl) {
|
|
19200
|
+
return envBaseUrl.replace(/\/+$/, "");
|
|
19201
|
+
}
|
|
19202
|
+
return baseUrl.includes("agent-api") || baseUrl.includes("agent.local") ? baseUrl.replace("agent-api", "apps-api").replace("agent.local", "apps.local") : baseUrl;
|
|
19203
|
+
}
|
|
19204
|
+
readToken() {
|
|
19205
|
+
return readRequiredSession({
|
|
19206
|
+
preferredApp: DEFAULT_APP_ID
|
|
19207
|
+
}).token;
|
|
19208
|
+
}
|
|
19209
|
+
readJsonFile(filePath) {
|
|
19210
|
+
const absolutePath = import_node_path17.default.resolve(process.cwd(), filePath);
|
|
19211
|
+
if (!(0, import_node_fs12.existsSync)(absolutePath)) {
|
|
19212
|
+
throw new Error(`JSON file not found: ${absolutePath}`);
|
|
19213
|
+
}
|
|
19214
|
+
const raw = (0, import_node_fs12.readFileSync)(absolutePath, "utf8");
|
|
19215
|
+
try {
|
|
19216
|
+
return JSON.parse(raw);
|
|
19217
|
+
} catch (error) {
|
|
19218
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19219
|
+
throw new Error(`Invalid JSON in ${absolutePath}: ${message}`);
|
|
19220
|
+
}
|
|
19221
|
+
}
|
|
19222
|
+
async request(baseUrl, token, method, pathname, body) {
|
|
19223
|
+
const response = await fetch(`${baseUrl}${pathname}`, {
|
|
19224
|
+
method,
|
|
19225
|
+
headers: {
|
|
19226
|
+
Authorization: `Bearer ${token}`,
|
|
19227
|
+
"Content-Type": "application/json"
|
|
19228
|
+
},
|
|
19229
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
19230
|
+
});
|
|
19231
|
+
let payload = null;
|
|
19232
|
+
try {
|
|
19233
|
+
payload = await response.json();
|
|
19234
|
+
} catch {
|
|
19235
|
+
payload = null;
|
|
19236
|
+
}
|
|
19237
|
+
if (!response.ok || !payload?.success) {
|
|
19238
|
+
throw new Error(payload?.message || `Request failed with status ${response.status}`);
|
|
19239
|
+
}
|
|
19240
|
+
return payload.data;
|
|
19241
|
+
}
|
|
19242
|
+
renderList(items, asJson) {
|
|
19243
|
+
if (asJson) {
|
|
19244
|
+
ui.plain(JSON.stringify(items, null, 2));
|
|
19245
|
+
return;
|
|
19246
|
+
}
|
|
19247
|
+
if (items.length === 0) {
|
|
19248
|
+
ui.warn("No agents found.");
|
|
19249
|
+
return;
|
|
19250
|
+
}
|
|
19251
|
+
for (const item of items) {
|
|
19252
|
+
ui.info(`${item.namespace}/${item.name}`, {
|
|
19253
|
+
status: item.status,
|
|
19254
|
+
version: item.version
|
|
19255
|
+
});
|
|
19256
|
+
}
|
|
19257
|
+
}
|
|
19258
|
+
renderJson(value, asJson) {
|
|
19259
|
+
if (!asJson) {
|
|
19260
|
+
return;
|
|
19261
|
+
}
|
|
19262
|
+
ui.plain(JSON.stringify(value, null, 2));
|
|
19263
|
+
}
|
|
19264
|
+
renderNamespaces(items, asJson) {
|
|
19265
|
+
if (asJson) {
|
|
19266
|
+
ui.plain(JSON.stringify(items, null, 2));
|
|
19267
|
+
return;
|
|
19268
|
+
}
|
|
19269
|
+
if (items.length === 0) {
|
|
19270
|
+
ui.warn("No namespaces found.");
|
|
19271
|
+
return;
|
|
19272
|
+
}
|
|
19273
|
+
for (const item of items) {
|
|
19274
|
+
ui.info(item.namespace, {
|
|
19275
|
+
status: item.status,
|
|
19276
|
+
updatedAt: item.updatedAt
|
|
19277
|
+
});
|
|
19278
|
+
}
|
|
19279
|
+
}
|
|
19280
|
+
};
|
|
19281
|
+
|
|
19282
|
+
// src/commands/NsCommandHandler.ts
|
|
19283
|
+
init_sessionStore();
|
|
19284
|
+
var NsCommandHandler = class {
|
|
19285
|
+
async handle(args) {
|
|
19286
|
+
switch (args.action) {
|
|
19287
|
+
case "list": {
|
|
19288
|
+
const registry = this.createRegistry(args);
|
|
19289
|
+
const items = await registry.list();
|
|
19290
|
+
this.render(items, args.json);
|
|
19291
|
+
return;
|
|
19292
|
+
}
|
|
19293
|
+
case "get": {
|
|
19294
|
+
const registry = this.createRegistry(args);
|
|
19295
|
+
const item = await registry.get(args.namespace);
|
|
19296
|
+
if (!item) {
|
|
19297
|
+
throw new Error(`Namespace "${args.namespace}" is not registered.`);
|
|
19298
|
+
}
|
|
19299
|
+
this.render(item, true);
|
|
19300
|
+
return;
|
|
19301
|
+
}
|
|
19302
|
+
case "create": {
|
|
19303
|
+
const registry = this.createRegistry(args, this.resolveAuthHeaders());
|
|
19304
|
+
const item = await registry.create(args.namespace);
|
|
19305
|
+
ui.success(`Created namespace ${item.namespace}`);
|
|
19306
|
+
this.render(item, args.json);
|
|
19307
|
+
return;
|
|
19308
|
+
}
|
|
19309
|
+
}
|
|
19310
|
+
}
|
|
19311
|
+
resolveBaseUrl(baseUrl) {
|
|
19312
|
+
return (baseUrl || process.env.PMATE_NAMESPACE_API_BASE_URL || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
19313
|
+
}
|
|
19314
|
+
resolveAuthHeaders() {
|
|
19315
|
+
return {
|
|
19316
|
+
Authorization: `Bearer ${readRequiredSession({ preferredApp: DEFAULT_APP_ID }).token}`
|
|
19317
|
+
};
|
|
19318
|
+
}
|
|
19319
|
+
createRegistry(args, headers) {
|
|
19320
|
+
return new NamespaceRegistry({
|
|
19321
|
+
chain: args.chain,
|
|
19322
|
+
registryBaseUrl: this.resolveBaseUrl(args.baseUrl),
|
|
19323
|
+
headers
|
|
19324
|
+
});
|
|
19325
|
+
}
|
|
19326
|
+
render(value, asJson) {
|
|
19327
|
+
if (asJson) {
|
|
19328
|
+
ui.plain(JSON.stringify(value, null, 2));
|
|
19329
|
+
return;
|
|
19330
|
+
}
|
|
19331
|
+
if (Array.isArray(value)) {
|
|
19332
|
+
if (value.length === 0) {
|
|
19333
|
+
ui.warn("No namespaces found.");
|
|
19334
|
+
return;
|
|
19335
|
+
}
|
|
19336
|
+
for (const item of value) {
|
|
19337
|
+
ui.info(`${item.chain ?? "pmate"}/${item.namespace}`, {
|
|
19338
|
+
status: item.status
|
|
19339
|
+
});
|
|
19340
|
+
}
|
|
19341
|
+
return;
|
|
19342
|
+
}
|
|
19343
|
+
ui.plain(JSON.stringify(value, null, 2));
|
|
19344
|
+
}
|
|
19345
|
+
};
|
|
19190
19346
|
|
|
19191
19347
|
// src/commands/StoreCommandHandler.ts
|
|
19348
|
+
var import_node_fs13 = require("fs");
|
|
19349
|
+
var import_node_path18 = __toESM(require("path"));
|
|
19192
19350
|
var StoreCommandHandler = class {
|
|
19193
19351
|
async handle(args) {
|
|
19194
19352
|
if (args.scope === "namespace") {
|
|
@@ -19196,6 +19354,9 @@ var StoreCommandHandler = class {
|
|
|
19196
19354
|
this.renderNamespaceList(items, args.json);
|
|
19197
19355
|
return;
|
|
19198
19356
|
}
|
|
19357
|
+
if (this.requiresRegisteredNamespace(args)) {
|
|
19358
|
+
await this.requireNamespace(args);
|
|
19359
|
+
}
|
|
19199
19360
|
const namespace = this.createNamespace(args);
|
|
19200
19361
|
if (args.scope === "table") {
|
|
19201
19362
|
const table = namespace.table(args.name);
|
|
@@ -19294,6 +19455,25 @@ var StoreCommandHandler = class {
|
|
|
19294
19455
|
resolveIndexerBaseUrl(indexerBaseUrl) {
|
|
19295
19456
|
return (indexerBaseUrl || process.env.PMATE_STORE_INDEXER_BASE_URL || process.env.INDEXER_BASE_URL || "https://indexer.pmate.chat").replace(/\/+$/, "");
|
|
19296
19457
|
}
|
|
19458
|
+
async requireNamespace(args) {
|
|
19459
|
+
const registry = new NamespaceRegistry({
|
|
19460
|
+
chain: args.chain,
|
|
19461
|
+
registryBaseUrl: this.resolveRegistryBaseUrl()
|
|
19462
|
+
});
|
|
19463
|
+
const exists = await registry.exists(args.namespace);
|
|
19464
|
+
if (!exists) {
|
|
19465
|
+
throw new Error(`Namespace "${args.namespace}" is not registered. Run: pmate ns create ${args.namespace}`);
|
|
19466
|
+
}
|
|
19467
|
+
}
|
|
19468
|
+
resolveRegistryBaseUrl() {
|
|
19469
|
+
return (process.env.PMATE_NAMESPACE_API_BASE_URL || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
|
|
19470
|
+
}
|
|
19471
|
+
requiresRegisteredNamespace(args) {
|
|
19472
|
+
if (args.scope === "table") {
|
|
19473
|
+
return args.action === "create" || args.action === "update" || args.action === "delete";
|
|
19474
|
+
}
|
|
19475
|
+
return args.action === "set" || args.action === "delete";
|
|
19476
|
+
}
|
|
19297
19477
|
async listNamespaces(args) {
|
|
19298
19478
|
const baseUrl = this.resolveIndexerBaseUrl(args.indexerBaseUrl);
|
|
19299
19479
|
const url = new URL(`/chains/${encodeURIComponent(args.chain)}/namespaces`, `${baseUrl}/`);
|
|
@@ -19393,6 +19573,7 @@ var AppCommandHandler = class {
|
|
|
19393
19573
|
}
|
|
19394
19574
|
case "create": {
|
|
19395
19575
|
const payload = this.readJsonFile(args.filePath);
|
|
19576
|
+
await this.requireNamespace(payload, baseUrl);
|
|
19396
19577
|
const record = await this.request(
|
|
19397
19578
|
baseUrl,
|
|
19398
19579
|
token,
|
|
@@ -19471,6 +19652,17 @@ var AppCommandHandler = class {
|
|
|
19471
19652
|
}
|
|
19472
19653
|
return payload.data;
|
|
19473
19654
|
}
|
|
19655
|
+
async requireNamespace(payload, baseUrl) {
|
|
19656
|
+
const namespace = readNamespaceFromPayload(payload);
|
|
19657
|
+
const registry = new NamespaceRegistry({
|
|
19658
|
+
chain: "pmate",
|
|
19659
|
+
registryBaseUrl: baseUrl
|
|
19660
|
+
});
|
|
19661
|
+
const exists = await registry.exists(namespace);
|
|
19662
|
+
if (!exists) {
|
|
19663
|
+
throw new Error(`Namespace "${namespace}" is not registered. Run: pmate ns create ${namespace}`);
|
|
19664
|
+
}
|
|
19665
|
+
}
|
|
19474
19666
|
renderList(items, asJson) {
|
|
19475
19667
|
if (asJson) {
|
|
19476
19668
|
ui.plain(JSON.stringify(items, null, 2));
|
|
@@ -19494,6 +19686,16 @@ var AppCommandHandler = class {
|
|
|
19494
19686
|
ui.plain(JSON.stringify(value, null, 2));
|
|
19495
19687
|
}
|
|
19496
19688
|
};
|
|
19689
|
+
function readNamespaceFromPayload(payload) {
|
|
19690
|
+
if (!payload || typeof payload !== "object") {
|
|
19691
|
+
throw new Error("App payload must be a JSON object.");
|
|
19692
|
+
}
|
|
19693
|
+
const namespace = payload.namespace;
|
|
19694
|
+
if (typeof namespace !== "string" || !namespace.trim()) {
|
|
19695
|
+
throw new Error("App payload.namespace is required.");
|
|
19696
|
+
}
|
|
19697
|
+
return namespace.trim().toLowerCase();
|
|
19698
|
+
}
|
|
19497
19699
|
|
|
19498
19700
|
// src/commands/VercelCommandHandler.ts
|
|
19499
19701
|
var import_node_child_process10 = require("child_process");
|
|
@@ -19611,7 +19813,7 @@ function parseAgentArgs(tokens) {
|
|
|
19611
19813
|
}
|
|
19612
19814
|
let baseUrl;
|
|
19613
19815
|
let json = false;
|
|
19614
|
-
const
|
|
19816
|
+
const takeSharedOptions3 = () => {
|
|
19615
19817
|
while (rest.length > 0) {
|
|
19616
19818
|
const token = rest[0];
|
|
19617
19819
|
if (token === "--base-url") {
|
|
@@ -19628,7 +19830,7 @@ function parseAgentArgs(tokens) {
|
|
|
19628
19830
|
}
|
|
19629
19831
|
};
|
|
19630
19832
|
if (action === "namespaces") {
|
|
19631
|
-
|
|
19833
|
+
takeSharedOptions3();
|
|
19632
19834
|
if (rest.length > 0) {
|
|
19633
19835
|
throw new Error(`Unknown agent namespaces option: ${rest[0]}`);
|
|
19634
19836
|
}
|
|
@@ -19670,7 +19872,7 @@ function parseAgentArgs(tokens) {
|
|
|
19670
19872
|
`Usage: agent ${action} [<namespace>] <name> [--base-url <url>] [--json]`
|
|
19671
19873
|
);
|
|
19672
19874
|
}
|
|
19673
|
-
|
|
19875
|
+
takeSharedOptions3();
|
|
19674
19876
|
if (rest.length > 0) {
|
|
19675
19877
|
throw new Error(`Unknown agent ${action} option: ${rest[0]}`);
|
|
19676
19878
|
}
|
|
@@ -19751,8 +19953,79 @@ function requireValue(tokens, optionName) {
|
|
|
19751
19953
|
return value;
|
|
19752
19954
|
}
|
|
19753
19955
|
|
|
19754
|
-
// src/
|
|
19956
|
+
// src/nsCommandParser.ts
|
|
19755
19957
|
var DEFAULT_CHAIN = "pmate";
|
|
19958
|
+
function parseNsArgs(tokens) {
|
|
19959
|
+
const rest = [...tokens];
|
|
19960
|
+
const action = rest.shift();
|
|
19961
|
+
if (!action) {
|
|
19962
|
+
throw new Error("Missing ns action. Use: ns list|get|create");
|
|
19963
|
+
}
|
|
19964
|
+
let chain = DEFAULT_CHAIN;
|
|
19965
|
+
let baseUrl;
|
|
19966
|
+
let json = false;
|
|
19967
|
+
if (action === "list") {
|
|
19968
|
+
takeSharedOptions(rest, {
|
|
19969
|
+
onChain: (value) => {
|
|
19970
|
+
chain = value;
|
|
19971
|
+
},
|
|
19972
|
+
onBaseUrl: (value) => {
|
|
19973
|
+
baseUrl = value;
|
|
19974
|
+
},
|
|
19975
|
+
onJson: () => {
|
|
19976
|
+
json = true;
|
|
19977
|
+
}
|
|
19978
|
+
});
|
|
19979
|
+
return { type: "ns" /* Ns */, action, chain, baseUrl, json };
|
|
19980
|
+
}
|
|
19981
|
+
if (action === "get" || action === "create") {
|
|
19982
|
+
const namespace = rest.shift();
|
|
19983
|
+
if (!namespace || namespace.startsWith("-")) {
|
|
19984
|
+
throw new Error(`Usage: ns ${action} <namespace> [--chain <chain>] [--base-url <url>] [--json]`);
|
|
19985
|
+
}
|
|
19986
|
+
takeSharedOptions(rest, {
|
|
19987
|
+
onChain: (value) => {
|
|
19988
|
+
chain = value;
|
|
19989
|
+
},
|
|
19990
|
+
onBaseUrl: (value) => {
|
|
19991
|
+
baseUrl = value;
|
|
19992
|
+
},
|
|
19993
|
+
onJson: () => {
|
|
19994
|
+
json = true;
|
|
19995
|
+
}
|
|
19996
|
+
});
|
|
19997
|
+
return { type: "ns" /* Ns */, action, namespace, chain, baseUrl, json };
|
|
19998
|
+
}
|
|
19999
|
+
throw new Error(`Unknown ns action: ${action}`);
|
|
20000
|
+
}
|
|
20001
|
+
function takeSharedOptions(rest, handlers) {
|
|
20002
|
+
while (rest.length > 0) {
|
|
20003
|
+
const token = rest.shift();
|
|
20004
|
+
switch (token) {
|
|
20005
|
+
case "--chain":
|
|
20006
|
+
handlers.onChain(requireValue2(rest, token));
|
|
20007
|
+
break;
|
|
20008
|
+
case "--base-url":
|
|
20009
|
+
handlers.onBaseUrl(requireValue2(rest, token));
|
|
20010
|
+
break;
|
|
20011
|
+
case "--json":
|
|
20012
|
+
handlers.onJson();
|
|
20013
|
+
break;
|
|
20014
|
+
default:
|
|
20015
|
+
throw new Error(`Unknown ns option: ${token}`);
|
|
20016
|
+
}
|
|
20017
|
+
}
|
|
20018
|
+
}
|
|
20019
|
+
function requireValue2(tokens, optionName) {
|
|
20020
|
+
const value = tokens.shift();
|
|
20021
|
+
if (!value || value.startsWith("-")) {
|
|
20022
|
+
throw new Error(`Missing value for ${optionName}`);
|
|
20023
|
+
}
|
|
20024
|
+
return value;
|
|
20025
|
+
}
|
|
20026
|
+
|
|
20027
|
+
// src/storeCommandParser.ts
|
|
20028
|
+
var DEFAULT_CHAIN2 = "pmate";
|
|
19756
20029
|
var DEFAULT_NAMESPACE2 = "pmate";
|
|
19757
20030
|
function parseStoreArgs(tokens) {
|
|
19758
20031
|
const rest = [...tokens];
|
|
@@ -19765,7 +20038,7 @@ function parseStoreArgs(tokens) {
|
|
|
19765
20038
|
throw new Error(`Missing store ${scope} action.`);
|
|
19766
20039
|
}
|
|
19767
20040
|
const shared = {
|
|
19768
|
-
chain:
|
|
20041
|
+
chain: DEFAULT_CHAIN2,
|
|
19769
20042
|
namespace: DEFAULT_NAMESPACE2,
|
|
19770
20043
|
baseUrl: void 0,
|
|
19771
20044
|
indexerBaseUrl: void 0,
|
|
@@ -19775,7 +20048,7 @@ function parseStoreArgs(tokens) {
|
|
|
19775
20048
|
if (action !== "list") {
|
|
19776
20049
|
throw new Error(`Unknown store namespace action: ${action}`);
|
|
19777
20050
|
}
|
|
19778
|
-
|
|
20051
|
+
takeSharedOptions2(rest, shared);
|
|
19779
20052
|
if (rest.length > 0) {
|
|
19780
20053
|
throw new Error(`Unknown store namespace option: ${rest[0]}`);
|
|
19781
20054
|
}
|
|
@@ -19805,7 +20078,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
19805
20078
|
const token = rest.shift();
|
|
19806
20079
|
switch (token) {
|
|
19807
20080
|
case "--page":
|
|
19808
|
-
page = parsePage(
|
|
20081
|
+
page = parsePage(requireValue3(rest, token));
|
|
19809
20082
|
break;
|
|
19810
20083
|
default:
|
|
19811
20084
|
pushSharedOption(token, rest, shared);
|
|
@@ -19819,7 +20092,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
19819
20092
|
const token = rest.shift();
|
|
19820
20093
|
switch (token) {
|
|
19821
20094
|
case "--id":
|
|
19822
|
-
id =
|
|
20095
|
+
id = requireValue3(rest, token);
|
|
19823
20096
|
break;
|
|
19824
20097
|
default:
|
|
19825
20098
|
pushSharedOption(token, rest, shared);
|
|
@@ -19836,7 +20109,7 @@ function parseTableArgs(action, rest, shared) {
|
|
|
19836
20109
|
const token = rest.shift();
|
|
19837
20110
|
switch (token) {
|
|
19838
20111
|
case "--file":
|
|
19839
|
-
filePath =
|
|
20112
|
+
filePath = requireValue3(rest, token);
|
|
19840
20113
|
break;
|
|
19841
20114
|
default:
|
|
19842
20115
|
pushSharedOption(token, rest, shared);
|
|
@@ -19860,7 +20133,7 @@ function parseKvArgs(action, rest, shared) {
|
|
|
19860
20133
|
const token = rest.shift();
|
|
19861
20134
|
switch (token) {
|
|
19862
20135
|
case "--page":
|
|
19863
|
-
page = parsePage(
|
|
20136
|
+
page = parsePage(requireValue3(rest, token));
|
|
19864
20137
|
break;
|
|
19865
20138
|
default:
|
|
19866
20139
|
pushSharedOption(token, rest, shared);
|
|
@@ -19874,7 +20147,7 @@ function parseKvArgs(action, rest, shared) {
|
|
|
19874
20147
|
const token = rest.shift();
|
|
19875
20148
|
switch (token) {
|
|
19876
20149
|
case "--key":
|
|
19877
|
-
key =
|
|
20150
|
+
key = requireValue3(rest, token);
|
|
19878
20151
|
break;
|
|
19879
20152
|
default:
|
|
19880
20153
|
pushSharedOption(token, rest, shared);
|
|
@@ -19893,13 +20166,13 @@ function parseKvArgs(action, rest, shared) {
|
|
|
19893
20166
|
const token = rest.shift();
|
|
19894
20167
|
switch (token) {
|
|
19895
20168
|
case "--key":
|
|
19896
|
-
key =
|
|
20169
|
+
key = requireValue3(rest, token);
|
|
19897
20170
|
break;
|
|
19898
20171
|
case "--value":
|
|
19899
|
-
value =
|
|
20172
|
+
value = requireValue3(rest, token);
|
|
19900
20173
|
break;
|
|
19901
20174
|
case "--file":
|
|
19902
|
-
filePath =
|
|
20175
|
+
filePath = requireValue3(rest, token);
|
|
19903
20176
|
break;
|
|
19904
20177
|
default:
|
|
19905
20178
|
pushSharedOption(token, rest, shared);
|
|
@@ -19915,7 +20188,7 @@ function parseKvArgs(action, rest, shared) {
|
|
|
19915
20188
|
}
|
|
19916
20189
|
throw new Error(`Unknown store kv action: ${action}`);
|
|
19917
20190
|
}
|
|
19918
|
-
function
|
|
20191
|
+
function takeSharedOptions2(rest, shared) {
|
|
19919
20192
|
while (rest.length > 0) {
|
|
19920
20193
|
const token = rest.shift();
|
|
19921
20194
|
pushSharedOption(token, rest, shared);
|
|
@@ -19924,17 +20197,17 @@ function takeSharedOptions(rest, shared) {
|
|
|
19924
20197
|
function pushSharedOption(token, rest, shared) {
|
|
19925
20198
|
switch (token) {
|
|
19926
20199
|
case "--chain":
|
|
19927
|
-
shared.chain =
|
|
20200
|
+
shared.chain = requireValue3(rest, token);
|
|
19928
20201
|
break;
|
|
19929
20202
|
case "--ns":
|
|
19930
20203
|
case "--namespace":
|
|
19931
|
-
shared.namespace =
|
|
20204
|
+
shared.namespace = requireValue3(rest, token);
|
|
19932
20205
|
break;
|
|
19933
20206
|
case "--base-url":
|
|
19934
|
-
shared.baseUrl =
|
|
20207
|
+
shared.baseUrl = requireValue3(rest, token);
|
|
19935
20208
|
break;
|
|
19936
20209
|
case "--indexer-base-url":
|
|
19937
|
-
shared.indexerBaseUrl =
|
|
20210
|
+
shared.indexerBaseUrl = requireValue3(rest, token);
|
|
19938
20211
|
break;
|
|
19939
20212
|
case "--json":
|
|
19940
20213
|
shared.json = true;
|
|
@@ -19943,7 +20216,7 @@ function pushSharedOption(token, rest, shared) {
|
|
|
19943
20216
|
throw new Error(`Unknown store option: ${token}`);
|
|
19944
20217
|
}
|
|
19945
20218
|
}
|
|
19946
|
-
function
|
|
20219
|
+
function requireValue3(tokens, optionName) {
|
|
19947
20220
|
const value = tokens.shift();
|
|
19948
20221
|
if (!value || value.startsWith("-")) {
|
|
19949
20222
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -19967,12 +20240,12 @@ function parseAppArgs(tokens) {
|
|
|
19967
20240
|
}
|
|
19968
20241
|
let baseUrl;
|
|
19969
20242
|
let json = false;
|
|
19970
|
-
const
|
|
20243
|
+
const takeSharedOptions3 = () => {
|
|
19971
20244
|
while (rest.length > 0) {
|
|
19972
20245
|
const token = rest[0];
|
|
19973
20246
|
if (token === "--base-url") {
|
|
19974
20247
|
rest.shift();
|
|
19975
|
-
baseUrl =
|
|
20248
|
+
baseUrl = requireValue4(rest, token);
|
|
19976
20249
|
continue;
|
|
19977
20250
|
}
|
|
19978
20251
|
if (token === "--json") {
|
|
@@ -19984,7 +20257,7 @@ function parseAppArgs(tokens) {
|
|
|
19984
20257
|
}
|
|
19985
20258
|
};
|
|
19986
20259
|
if (action === "list") {
|
|
19987
|
-
|
|
20260
|
+
takeSharedOptions3();
|
|
19988
20261
|
if (rest.length > 0) {
|
|
19989
20262
|
throw new Error(`Unknown app list option: ${rest[0]}`);
|
|
19990
20263
|
}
|
|
@@ -19997,7 +20270,7 @@ function parseAppArgs(tokens) {
|
|
|
19997
20270
|
`Usage: app ${action} <id> [--base-url <url>] [--json]`
|
|
19998
20271
|
);
|
|
19999
20272
|
}
|
|
20000
|
-
|
|
20273
|
+
takeSharedOptions3();
|
|
20001
20274
|
if (rest.length > 0) {
|
|
20002
20275
|
throw new Error(`Unknown app ${action} option: ${rest[0]}`);
|
|
20003
20276
|
}
|
|
@@ -20009,10 +20282,10 @@ function parseAppArgs(tokens) {
|
|
|
20009
20282
|
const token = rest.shift();
|
|
20010
20283
|
switch (token) {
|
|
20011
20284
|
case "--file":
|
|
20012
|
-
filePath =
|
|
20285
|
+
filePath = requireValue4(rest, token);
|
|
20013
20286
|
break;
|
|
20014
20287
|
case "--base-url":
|
|
20015
|
-
baseUrl =
|
|
20288
|
+
baseUrl = requireValue4(rest, token);
|
|
20016
20289
|
break;
|
|
20017
20290
|
case "--json":
|
|
20018
20291
|
json = true;
|
|
@@ -20038,10 +20311,10 @@ function parseAppArgs(tokens) {
|
|
|
20038
20311
|
const token = rest.shift();
|
|
20039
20312
|
switch (token) {
|
|
20040
20313
|
case "--file":
|
|
20041
|
-
filePath =
|
|
20314
|
+
filePath = requireValue4(rest, token);
|
|
20042
20315
|
break;
|
|
20043
20316
|
case "--base-url":
|
|
20044
|
-
baseUrl =
|
|
20317
|
+
baseUrl = requireValue4(rest, token);
|
|
20045
20318
|
break;
|
|
20046
20319
|
case "--json":
|
|
20047
20320
|
json = true;
|
|
@@ -20057,7 +20330,7 @@ function parseAppArgs(tokens) {
|
|
|
20057
20330
|
}
|
|
20058
20331
|
throw new Error(`Unknown app action: ${action}`);
|
|
20059
20332
|
}
|
|
20060
|
-
function
|
|
20333
|
+
function requireValue4(tokens, optionName) {
|
|
20061
20334
|
const value = tokens.shift();
|
|
20062
20335
|
if (!value || value.startsWith("-")) {
|
|
20063
20336
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -20151,6 +20424,10 @@ var HELP_TEXT = [
|
|
|
20151
20424
|
` ${import_chalk3.default.gray(" update [<namespace>] <name> --file <path> [--base-url <url>] [--json]")}`,
|
|
20152
20425
|
` ${import_chalk3.default.gray(" delete [<namespace>] <name> [--base-url <url>] [--json]")}`,
|
|
20153
20426
|
` ${import_chalk3.default.gray(" default namespace: pmate; default base URL: https://agent-api.pmate.chat")}`,
|
|
20427
|
+
` ${import_chalk3.default.cyan("ns")} Manage registered namespaces`,
|
|
20428
|
+
` ${import_chalk3.default.gray(" list [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
20429
|
+
` ${import_chalk3.default.gray(" get <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
20430
|
+
` ${import_chalk3.default.gray(" create <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
20154
20431
|
` ${import_chalk3.default.cyan("store")} Manage @pmate/store namespaces, tables, and kv stores`,
|
|
20155
20432
|
` ${import_chalk3.default.gray(" namespace list [--chain <chain>] [--indexer-base-url <url>] [--json]")}`,
|
|
20156
20433
|
` ${import_chalk3.default.gray(" table list|get|exists|create|update|delete <name> [options]")}`,
|
|
@@ -20223,7 +20500,7 @@ function parseCommandArgs(args) {
|
|
|
20223
20500
|
const token = rest.shift();
|
|
20224
20501
|
switch (token) {
|
|
20225
20502
|
case "--app":
|
|
20226
|
-
app =
|
|
20503
|
+
app = requireValue5(rest, token);
|
|
20227
20504
|
break;
|
|
20228
20505
|
default:
|
|
20229
20506
|
throw new Error(`Unknown login option: ${token}`);
|
|
@@ -20288,6 +20565,9 @@ function parseCommandArgs(args) {
|
|
|
20288
20565
|
if (args.rest[0] === "agent") {
|
|
20289
20566
|
return parseAgentArgs(args.rest.slice(1));
|
|
20290
20567
|
}
|
|
20568
|
+
if (args.rest[0] === "ns" || args.rest[0] === "namespace") {
|
|
20569
|
+
return parseNsArgs(args.rest.slice(1));
|
|
20570
|
+
}
|
|
20291
20571
|
if (args.rest[0] === "store") {
|
|
20292
20572
|
return parseStoreArgs(args.rest.slice(1));
|
|
20293
20573
|
}
|
|
@@ -20311,7 +20591,7 @@ function parseVercelArgs(tokens) {
|
|
|
20311
20591
|
const token = rest.shift();
|
|
20312
20592
|
switch (token) {
|
|
20313
20593
|
case "--scope":
|
|
20314
|
-
scope =
|
|
20594
|
+
scope = requireValue5(rest, token);
|
|
20315
20595
|
break;
|
|
20316
20596
|
default:
|
|
20317
20597
|
throw new Error(`Unknown vercel option: ${token}`);
|
|
@@ -20331,10 +20611,10 @@ function parseVercelArgs(tokens) {
|
|
|
20331
20611
|
const token = rest.shift();
|
|
20332
20612
|
switch (token) {
|
|
20333
20613
|
case "--scope":
|
|
20334
|
-
scope =
|
|
20614
|
+
scope = requireValue5(rest, token);
|
|
20335
20615
|
break;
|
|
20336
20616
|
case "--project":
|
|
20337
|
-
project =
|
|
20617
|
+
project = requireValue5(rest, token);
|
|
20338
20618
|
break;
|
|
20339
20619
|
case "--last-week":
|
|
20340
20620
|
lastWeek = true;
|
|
@@ -20365,16 +20645,16 @@ function parseAddDnsArgs(tokens) {
|
|
|
20365
20645
|
const token = rest.shift();
|
|
20366
20646
|
switch (token) {
|
|
20367
20647
|
case "--type":
|
|
20368
|
-
options.dnsType =
|
|
20648
|
+
options.dnsType = requireValue5(rest, token);
|
|
20369
20649
|
break;
|
|
20370
20650
|
case "--value":
|
|
20371
|
-
options.dnsValue =
|
|
20651
|
+
options.dnsValue = requireValue5(rest, token);
|
|
20372
20652
|
break;
|
|
20373
20653
|
case "--rr":
|
|
20374
|
-
options.dnsRr =
|
|
20654
|
+
options.dnsRr = requireValue5(rest, token);
|
|
20375
20655
|
break;
|
|
20376
20656
|
case "--ttl": {
|
|
20377
|
-
const ttlValue =
|
|
20657
|
+
const ttlValue = requireValue5(rest, token);
|
|
20378
20658
|
const ttl = Number.parseInt(ttlValue, 10);
|
|
20379
20659
|
if (!Number.isFinite(ttl) || ttl <= 0) {
|
|
20380
20660
|
throw new Error(`Invalid --ttl value: ${ttlValue}`);
|
|
@@ -20383,7 +20663,7 @@ function parseAddDnsArgs(tokens) {
|
|
|
20383
20663
|
break;
|
|
20384
20664
|
}
|
|
20385
20665
|
case "--domain":
|
|
20386
|
-
options.dnsDomain =
|
|
20666
|
+
options.dnsDomain = requireValue5(rest, token);
|
|
20387
20667
|
break;
|
|
20388
20668
|
default:
|
|
20389
20669
|
throw new Error(`Unknown add-dns option: ${token}`);
|
|
@@ -20416,13 +20696,13 @@ function parseBucketArgs(tokens) {
|
|
|
20416
20696
|
options.bucketCreate = true;
|
|
20417
20697
|
break;
|
|
20418
20698
|
case "--name":
|
|
20419
|
-
options.bucketName =
|
|
20699
|
+
options.bucketName = requireValue5(rest, token);
|
|
20420
20700
|
break;
|
|
20421
20701
|
case "--subdomain":
|
|
20422
|
-
options.bucketSubdomain =
|
|
20702
|
+
options.bucketSubdomain = requireValue5(rest, token);
|
|
20423
20703
|
break;
|
|
20424
20704
|
case "--domain":
|
|
20425
|
-
options.bucketDomain =
|
|
20705
|
+
options.bucketDomain = requireValue5(rest, token);
|
|
20426
20706
|
break;
|
|
20427
20707
|
default:
|
|
20428
20708
|
throw new Error(`Unknown bucket option: ${token}`);
|
|
@@ -20461,7 +20741,7 @@ function parseDeployArgs(tokens) {
|
|
|
20461
20741
|
options.deployAction = "logs";
|
|
20462
20742
|
break;
|
|
20463
20743
|
case "--cwd":
|
|
20464
|
-
options.deployCwd =
|
|
20744
|
+
options.deployCwd = requireValue5(rest, token);
|
|
20465
20745
|
break;
|
|
20466
20746
|
default:
|
|
20467
20747
|
throw new Error(`Unknown deploy option: ${token}`);
|
|
@@ -20486,13 +20766,13 @@ function parseLogArgs(tokens) {
|
|
|
20486
20766
|
const token = rest.shift();
|
|
20487
20767
|
switch (token) {
|
|
20488
20768
|
case "--cwd":
|
|
20489
|
-
options.logCwd =
|
|
20769
|
+
options.logCwd = requireValue5(rest, token);
|
|
20490
20770
|
break;
|
|
20491
20771
|
case "--ns":
|
|
20492
|
-
options.logNamespace =
|
|
20772
|
+
options.logNamespace = requireValue5(rest, token);
|
|
20493
20773
|
break;
|
|
20494
20774
|
case "--page": {
|
|
20495
|
-
const value =
|
|
20775
|
+
const value = requireValue5(rest, token);
|
|
20496
20776
|
const page = Number.parseInt(value, 10);
|
|
20497
20777
|
if (!Number.isFinite(page) || page < 0) {
|
|
20498
20778
|
throw new Error(`Invalid log page: ${value}`);
|
|
@@ -20504,7 +20784,7 @@ function parseLogArgs(tokens) {
|
|
|
20504
20784
|
options.logHistory = true;
|
|
20505
20785
|
break;
|
|
20506
20786
|
case "--search":
|
|
20507
|
-
options.logSearch =
|
|
20787
|
+
options.logSearch = requireValue5(rest, token);
|
|
20508
20788
|
break;
|
|
20509
20789
|
default:
|
|
20510
20790
|
throw new Error(`Unknown log option: ${token}`);
|
|
@@ -20527,7 +20807,7 @@ function parseInitArgs(tokens) {
|
|
|
20527
20807
|
const token = rest.shift();
|
|
20528
20808
|
switch (token) {
|
|
20529
20809
|
case "--cwd":
|
|
20530
|
-
options.initCwd =
|
|
20810
|
+
options.initCwd = requireValue5(rest, token);
|
|
20531
20811
|
break;
|
|
20532
20812
|
default:
|
|
20533
20813
|
throw new Error(`Unknown init option: ${token}`);
|
|
@@ -20550,7 +20830,7 @@ function parseDevArgs(tokens) {
|
|
|
20550
20830
|
const token = rest.shift();
|
|
20551
20831
|
switch (token) {
|
|
20552
20832
|
case "--cwd":
|
|
20553
|
-
options.devCwd =
|
|
20833
|
+
options.devCwd = requireValue5(rest, token);
|
|
20554
20834
|
break;
|
|
20555
20835
|
default:
|
|
20556
20836
|
throw new Error(`Unknown dev option: ${token}`);
|
|
@@ -20580,13 +20860,13 @@ function parseOssArgs(tokens) {
|
|
|
20580
20860
|
const token = rest.shift();
|
|
20581
20861
|
switch (token) {
|
|
20582
20862
|
case "--bucket":
|
|
20583
|
-
bucket =
|
|
20863
|
+
bucket = requireValue5(rest, token);
|
|
20584
20864
|
break;
|
|
20585
20865
|
case "--file":
|
|
20586
|
-
filePath =
|
|
20866
|
+
filePath = requireValue5(rest, token);
|
|
20587
20867
|
break;
|
|
20588
20868
|
case "--key":
|
|
20589
|
-
objectKey =
|
|
20869
|
+
objectKey = requireValue5(rest, token);
|
|
20590
20870
|
break;
|
|
20591
20871
|
default:
|
|
20592
20872
|
throw new Error(`Unknown oss option: ${token}`);
|
|
@@ -20619,7 +20899,7 @@ function parseEnvArgs(tokens) {
|
|
|
20619
20899
|
throw new Error("Only one env action is allowed.");
|
|
20620
20900
|
}
|
|
20621
20901
|
action = "set";
|
|
20622
|
-
key =
|
|
20902
|
+
key = requireValue5(rest, token);
|
|
20623
20903
|
break;
|
|
20624
20904
|
case "--list":
|
|
20625
20905
|
if (action) {
|
|
@@ -20632,17 +20912,17 @@ function parseEnvArgs(tokens) {
|
|
|
20632
20912
|
throw new Error("Only one env action is allowed.");
|
|
20633
20913
|
}
|
|
20634
20914
|
action = "delete";
|
|
20635
|
-
key =
|
|
20915
|
+
key = requireValue5(rest, token);
|
|
20636
20916
|
break;
|
|
20637
20917
|
case "--value":
|
|
20638
|
-
value =
|
|
20918
|
+
value = requireValue5(rest, token);
|
|
20639
20919
|
break;
|
|
20640
20920
|
case "--verbose":
|
|
20641
20921
|
case "-v":
|
|
20642
20922
|
verbose = true;
|
|
20643
20923
|
break;
|
|
20644
20924
|
case "--cwd":
|
|
20645
|
-
cwd =
|
|
20925
|
+
cwd = requireValue5(rest, token);
|
|
20646
20926
|
break;
|
|
20647
20927
|
default:
|
|
20648
20928
|
throw new Error(`Unknown env option: ${token}`);
|
|
@@ -20700,7 +20980,7 @@ function parseCommitArgs(tokens) {
|
|
|
20700
20980
|
push = true;
|
|
20701
20981
|
break;
|
|
20702
20982
|
case "--cwd":
|
|
20703
|
-
cwd =
|
|
20983
|
+
cwd = requireValue5(rest, token);
|
|
20704
20984
|
break;
|
|
20705
20985
|
default:
|
|
20706
20986
|
throw new Error(`Unknown commit option: ${token}`);
|
|
@@ -20716,10 +20996,10 @@ function parseSummaryArgs(tokens) {
|
|
|
20716
20996
|
const token = rest.shift();
|
|
20717
20997
|
switch (token) {
|
|
20718
20998
|
case "--pr":
|
|
20719
|
-
prRef =
|
|
20999
|
+
prRef = requireValue5(rest, token);
|
|
20720
21000
|
break;
|
|
20721
21001
|
case "--cwd":
|
|
20722
|
-
cwd =
|
|
21002
|
+
cwd = requireValue5(rest, token);
|
|
20723
21003
|
break;
|
|
20724
21004
|
default:
|
|
20725
21005
|
throw new Error(`Unknown summary option: ${token}`);
|
|
@@ -20788,10 +21068,10 @@ function parseLinearPrArgs(tokens) {
|
|
|
20788
21068
|
const token = rest.shift();
|
|
20789
21069
|
switch (token) {
|
|
20790
21070
|
case "--account":
|
|
20791
|
-
account =
|
|
21071
|
+
account = requireValue5(rest, token);
|
|
20792
21072
|
break;
|
|
20793
21073
|
case "--cwd":
|
|
20794
|
-
cwd =
|
|
21074
|
+
cwd = requireValue5(rest, token);
|
|
20795
21075
|
break;
|
|
20796
21076
|
default:
|
|
20797
21077
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -20820,35 +21100,35 @@ function parseLinearCreateArgs(tokens) {
|
|
|
20820
21100
|
const token = rest.shift();
|
|
20821
21101
|
switch (token) {
|
|
20822
21102
|
case "--account":
|
|
20823
|
-
account =
|
|
21103
|
+
account = requireValue5(rest, token);
|
|
20824
21104
|
break;
|
|
20825
21105
|
case "--repl":
|
|
20826
21106
|
useRepl = true;
|
|
20827
21107
|
break;
|
|
20828
21108
|
case "--title":
|
|
20829
|
-
title =
|
|
21109
|
+
title = requireValue5(rest, token);
|
|
20830
21110
|
break;
|
|
20831
21111
|
case "--desc":
|
|
20832
21112
|
case "--description":
|
|
20833
|
-
description = decodeEscapedNewlines(
|
|
21113
|
+
description = decodeEscapedNewlines(requireValue5(rest, token));
|
|
20834
21114
|
break;
|
|
20835
21115
|
case "--team-id":
|
|
20836
|
-
teamId =
|
|
21116
|
+
teamId = requireValue5(rest, token);
|
|
20837
21117
|
break;
|
|
20838
21118
|
case "--team-key":
|
|
20839
|
-
teamKey =
|
|
21119
|
+
teamKey = requireValue5(rest, token);
|
|
20840
21120
|
break;
|
|
20841
21121
|
case "--priority":
|
|
20842
|
-
priority = parseLinearPriority(
|
|
21122
|
+
priority = parseLinearPriority(requireValue5(rest, token));
|
|
20843
21123
|
break;
|
|
20844
21124
|
case "--parent-id":
|
|
20845
|
-
parentId =
|
|
21125
|
+
parentId = requireValue5(rest, token);
|
|
20846
21126
|
break;
|
|
20847
21127
|
case "--state-id":
|
|
20848
|
-
stateId =
|
|
21128
|
+
stateId = requireValue5(rest, token);
|
|
20849
21129
|
break;
|
|
20850
21130
|
case "--cwd":
|
|
20851
|
-
cwd =
|
|
21131
|
+
cwd = requireValue5(rest, token);
|
|
20852
21132
|
break;
|
|
20853
21133
|
default:
|
|
20854
21134
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -20883,10 +21163,10 @@ function parseLinearWhoamiArgs(tokens) {
|
|
|
20883
21163
|
const token = rest.shift();
|
|
20884
21164
|
switch (token) {
|
|
20885
21165
|
case "--account":
|
|
20886
|
-
account =
|
|
21166
|
+
account = requireValue5(rest, token);
|
|
20887
21167
|
break;
|
|
20888
21168
|
case "--cwd":
|
|
20889
|
-
cwd =
|
|
21169
|
+
cwd = requireValue5(rest, token);
|
|
20890
21170
|
break;
|
|
20891
21171
|
default:
|
|
20892
21172
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -20911,10 +21191,10 @@ function parseLinearViewArgs(tokens) {
|
|
|
20911
21191
|
const token = rest.shift();
|
|
20912
21192
|
switch (token) {
|
|
20913
21193
|
case "--account":
|
|
20914
|
-
account =
|
|
21194
|
+
account = requireValue5(rest, token);
|
|
20915
21195
|
break;
|
|
20916
21196
|
case "--cwd":
|
|
20917
|
-
cwd =
|
|
21197
|
+
cwd = requireValue5(rest, token);
|
|
20918
21198
|
break;
|
|
20919
21199
|
default:
|
|
20920
21200
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -20949,32 +21229,32 @@ function parseLinearUpdateArgs(tokens) {
|
|
|
20949
21229
|
const token = rest.shift();
|
|
20950
21230
|
switch (token) {
|
|
20951
21231
|
case "--account":
|
|
20952
|
-
account =
|
|
21232
|
+
account = requireValue5(rest, token);
|
|
20953
21233
|
break;
|
|
20954
21234
|
case "--title":
|
|
20955
|
-
title =
|
|
21235
|
+
title = requireValue5(rest, token);
|
|
20956
21236
|
break;
|
|
20957
21237
|
case "--desc":
|
|
20958
21238
|
case "--description":
|
|
20959
|
-
description = decodeEscapedNewlines(
|
|
21239
|
+
description = decodeEscapedNewlines(requireValue5(rest, token));
|
|
20960
21240
|
break;
|
|
20961
21241
|
case "--team-id":
|
|
20962
|
-
teamId =
|
|
21242
|
+
teamId = requireValue5(rest, token);
|
|
20963
21243
|
break;
|
|
20964
21244
|
case "--team-key":
|
|
20965
|
-
teamKey =
|
|
21245
|
+
teamKey = requireValue5(rest, token);
|
|
20966
21246
|
break;
|
|
20967
21247
|
case "--priority":
|
|
20968
|
-
priority = parseLinearPriority(
|
|
21248
|
+
priority = parseLinearPriority(requireValue5(rest, token));
|
|
20969
21249
|
break;
|
|
20970
21250
|
case "--parent-id":
|
|
20971
|
-
parentId =
|
|
21251
|
+
parentId = requireValue5(rest, token);
|
|
20972
21252
|
break;
|
|
20973
21253
|
case "--state-id":
|
|
20974
|
-
stateId =
|
|
21254
|
+
stateId = requireValue5(rest, token);
|
|
20975
21255
|
break;
|
|
20976
21256
|
case "--cwd":
|
|
20977
|
-
cwd =
|
|
21257
|
+
cwd = requireValue5(rest, token);
|
|
20978
21258
|
break;
|
|
20979
21259
|
default:
|
|
20980
21260
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21012,10 +21292,10 @@ function parseLinearSubIssuesArgs(tokens) {
|
|
|
21012
21292
|
const token = rest.shift();
|
|
21013
21293
|
switch (token) {
|
|
21014
21294
|
case "--account":
|
|
21015
|
-
account =
|
|
21295
|
+
account = requireValue5(rest, token);
|
|
21016
21296
|
break;
|
|
21017
21297
|
case "--cwd":
|
|
21018
|
-
cwd =
|
|
21298
|
+
cwd = requireValue5(rest, token);
|
|
21019
21299
|
break;
|
|
21020
21300
|
default:
|
|
21021
21301
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21042,15 +21322,15 @@ function parseLinearCommentArgs(tokens) {
|
|
|
21042
21322
|
const token = rest.shift();
|
|
21043
21323
|
switch (token) {
|
|
21044
21324
|
case "--account":
|
|
21045
|
-
account =
|
|
21325
|
+
account = requireValue5(rest, token);
|
|
21046
21326
|
break;
|
|
21047
21327
|
case "--body":
|
|
21048
21328
|
case "--desc":
|
|
21049
21329
|
case "--description":
|
|
21050
|
-
body = decodeEscapedNewlines(
|
|
21330
|
+
body = decodeEscapedNewlines(requireValue5(rest, token));
|
|
21051
21331
|
break;
|
|
21052
21332
|
case "--cwd":
|
|
21053
|
-
cwd =
|
|
21333
|
+
cwd = requireValue5(rest, token);
|
|
21054
21334
|
break;
|
|
21055
21335
|
default:
|
|
21056
21336
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21080,10 +21360,10 @@ function parseLinearCommentsArgs(tokens) {
|
|
|
21080
21360
|
const token = rest.shift();
|
|
21081
21361
|
switch (token) {
|
|
21082
21362
|
case "--account":
|
|
21083
|
-
account =
|
|
21363
|
+
account = requireValue5(rest, token);
|
|
21084
21364
|
break;
|
|
21085
21365
|
case "--cwd":
|
|
21086
|
-
cwd =
|
|
21366
|
+
cwd = requireValue5(rest, token);
|
|
21087
21367
|
break;
|
|
21088
21368
|
default:
|
|
21089
21369
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21107,16 +21387,16 @@ function parseLinearCycleArgs(tokens) {
|
|
|
21107
21387
|
const token = rest.shift();
|
|
21108
21388
|
switch (token) {
|
|
21109
21389
|
case "--account":
|
|
21110
|
-
account =
|
|
21390
|
+
account = requireValue5(rest, token);
|
|
21111
21391
|
break;
|
|
21112
21392
|
case "--team-id":
|
|
21113
|
-
teamId =
|
|
21393
|
+
teamId = requireValue5(rest, token);
|
|
21114
21394
|
break;
|
|
21115
21395
|
case "--team-key":
|
|
21116
|
-
teamKey =
|
|
21396
|
+
teamKey = requireValue5(rest, token);
|
|
21117
21397
|
break;
|
|
21118
21398
|
case "--cwd":
|
|
21119
|
-
cwd =
|
|
21399
|
+
cwd = requireValue5(rest, token);
|
|
21120
21400
|
break;
|
|
21121
21401
|
default:
|
|
21122
21402
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21139,10 +21419,10 @@ function parseLinearTeamsArgs(tokens) {
|
|
|
21139
21419
|
const token = rest.shift();
|
|
21140
21420
|
switch (token) {
|
|
21141
21421
|
case "--account":
|
|
21142
|
-
account =
|
|
21422
|
+
account = requireValue5(rest, token);
|
|
21143
21423
|
break;
|
|
21144
21424
|
case "--cwd":
|
|
21145
|
-
cwd =
|
|
21425
|
+
cwd = requireValue5(rest, token);
|
|
21146
21426
|
break;
|
|
21147
21427
|
default:
|
|
21148
21428
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21169,16 +21449,16 @@ function parseLinearUserIssuesArgs(tokens) {
|
|
|
21169
21449
|
const token = rest.shift();
|
|
21170
21450
|
switch (token) {
|
|
21171
21451
|
case "--account":
|
|
21172
|
-
account =
|
|
21452
|
+
account = requireValue5(rest, token);
|
|
21173
21453
|
break;
|
|
21174
21454
|
case "--cycle":
|
|
21175
|
-
cycle = parseLinearCycle(
|
|
21455
|
+
cycle = parseLinearCycle(requireValue5(rest, token));
|
|
21176
21456
|
break;
|
|
21177
21457
|
case "--status":
|
|
21178
|
-
status = parseLinearStatus(
|
|
21458
|
+
status = parseLinearStatus(requireValue5(rest, token));
|
|
21179
21459
|
break;
|
|
21180
21460
|
case "--cwd":
|
|
21181
|
-
cwd =
|
|
21461
|
+
cwd = requireValue5(rest, token);
|
|
21182
21462
|
break;
|
|
21183
21463
|
default:
|
|
21184
21464
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21212,28 +21492,28 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
21212
21492
|
const token = rest.shift();
|
|
21213
21493
|
switch (token) {
|
|
21214
21494
|
case "--account":
|
|
21215
|
-
account =
|
|
21495
|
+
account = requireValue5(rest, token);
|
|
21216
21496
|
break;
|
|
21217
21497
|
case "--team-id":
|
|
21218
|
-
teamId =
|
|
21498
|
+
teamId = requireValue5(rest, token);
|
|
21219
21499
|
break;
|
|
21220
21500
|
case "--team-key":
|
|
21221
|
-
teamKey =
|
|
21501
|
+
teamKey = requireValue5(rest, token);
|
|
21222
21502
|
break;
|
|
21223
21503
|
case "--user":
|
|
21224
|
-
user =
|
|
21504
|
+
user = requireValue5(rest, token);
|
|
21225
21505
|
break;
|
|
21226
21506
|
case "--cycle":
|
|
21227
|
-
cycle = parseLinearCycle(
|
|
21507
|
+
cycle = parseLinearCycle(requireValue5(rest, token));
|
|
21228
21508
|
break;
|
|
21229
21509
|
case "--status":
|
|
21230
|
-
status = parseLinearStatus(
|
|
21510
|
+
status = parseLinearStatus(requireValue5(rest, token));
|
|
21231
21511
|
break;
|
|
21232
21512
|
case "--query":
|
|
21233
|
-
query =
|
|
21513
|
+
query = requireValue5(rest, token).trim();
|
|
21234
21514
|
break;
|
|
21235
21515
|
case "--limit": {
|
|
21236
|
-
const value = Number.parseInt(
|
|
21516
|
+
const value = Number.parseInt(requireValue5(rest, token), 10);
|
|
21237
21517
|
if (!Number.isInteger(value) || value < 1 || value > 250) {
|
|
21238
21518
|
throw new Error("Invalid --limit. Expected an integer between 1 and 250.");
|
|
21239
21519
|
}
|
|
@@ -21241,7 +21521,7 @@ function parseLinearIssuesArgs(tokens) {
|
|
|
21241
21521
|
break;
|
|
21242
21522
|
}
|
|
21243
21523
|
case "--cwd":
|
|
21244
|
-
cwd =
|
|
21524
|
+
cwd = requireValue5(rest, token);
|
|
21245
21525
|
break;
|
|
21246
21526
|
default:
|
|
21247
21527
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21282,10 +21562,10 @@ function parseLinearLegacyArgs(tokens) {
|
|
|
21282
21562
|
useScreenshot = true;
|
|
21283
21563
|
break;
|
|
21284
21564
|
case "--account":
|
|
21285
|
-
account =
|
|
21565
|
+
account = requireValue5(rest, token);
|
|
21286
21566
|
break;
|
|
21287
21567
|
case "--cwd":
|
|
21288
|
-
cwd =
|
|
21568
|
+
cwd = requireValue5(rest, token);
|
|
21289
21569
|
break;
|
|
21290
21570
|
default:
|
|
21291
21571
|
throw new Error(`Unknown linear option: ${token}`);
|
|
@@ -21379,19 +21659,19 @@ function parseNotionArgs(tokens) {
|
|
|
21379
21659
|
const token = rest.shift();
|
|
21380
21660
|
switch (token) {
|
|
21381
21661
|
case "--parent":
|
|
21382
|
-
parentPageId =
|
|
21662
|
+
parentPageId = requireValue5(rest, token);
|
|
21383
21663
|
break;
|
|
21384
21664
|
case "--title":
|
|
21385
|
-
title =
|
|
21665
|
+
title = requireValue5(rest, token);
|
|
21386
21666
|
break;
|
|
21387
21667
|
case "--private":
|
|
21388
21668
|
isPrivate = true;
|
|
21389
21669
|
break;
|
|
21390
21670
|
case "--content":
|
|
21391
|
-
content2 =
|
|
21671
|
+
content2 = requireValue5(rest, token);
|
|
21392
21672
|
break;
|
|
21393
21673
|
case "--file":
|
|
21394
|
-
filePath2 =
|
|
21674
|
+
filePath2 = requireValue5(rest, token);
|
|
21395
21675
|
break;
|
|
21396
21676
|
default:
|
|
21397
21677
|
throw new Error(`Unknown notion option: ${token}`);
|
|
@@ -21435,10 +21715,10 @@ function parseNotionArgs(tokens) {
|
|
|
21435
21715
|
const token = rest.shift();
|
|
21436
21716
|
switch (token) {
|
|
21437
21717
|
case "--content":
|
|
21438
|
-
content =
|
|
21718
|
+
content = requireValue5(rest, token);
|
|
21439
21719
|
break;
|
|
21440
21720
|
case "--file":
|
|
21441
|
-
filePath =
|
|
21721
|
+
filePath = requireValue5(rest, token);
|
|
21442
21722
|
break;
|
|
21443
21723
|
case "--append":
|
|
21444
21724
|
append = true;
|
|
@@ -21483,11 +21763,11 @@ function parseRandomArgs(tokens) {
|
|
|
21483
21763
|
mode = "easy";
|
|
21484
21764
|
break;
|
|
21485
21765
|
case "--length":
|
|
21486
|
-
length = parsePositiveInt(
|
|
21766
|
+
length = parsePositiveInt(requireValue5(rest, token), token);
|
|
21487
21767
|
seenLength = true;
|
|
21488
21768
|
break;
|
|
21489
21769
|
case "--charset": {
|
|
21490
|
-
const value =
|
|
21770
|
+
const value = requireValue5(rest, token);
|
|
21491
21771
|
if (!["base64url", "hex", "alnum", "ascii"].includes(value)) {
|
|
21492
21772
|
throw new Error(
|
|
21493
21773
|
`Invalid --charset value: ${value}. Use base64url|hex|alnum|ascii.`
|
|
@@ -21498,18 +21778,18 @@ function parseRandomArgs(tokens) {
|
|
|
21498
21778
|
break;
|
|
21499
21779
|
}
|
|
21500
21780
|
case "--count":
|
|
21501
|
-
count = parsePositiveInt(
|
|
21781
|
+
count = parsePositiveInt(requireValue5(rest, token), token);
|
|
21502
21782
|
break;
|
|
21503
21783
|
case "--words":
|
|
21504
|
-
words = parsePositiveInt(
|
|
21784
|
+
words = parsePositiveInt(requireValue5(rest, token), token);
|
|
21505
21785
|
seenWords = true;
|
|
21506
21786
|
break;
|
|
21507
21787
|
case "--digits":
|
|
21508
|
-
digits = parseNonNegativeInt(
|
|
21788
|
+
digits = parseNonNegativeInt(requireValue5(rest, token), token);
|
|
21509
21789
|
seenDigits = true;
|
|
21510
21790
|
break;
|
|
21511
21791
|
case "--separator":
|
|
21512
|
-
separator =
|
|
21792
|
+
separator = requireValue5(rest, token);
|
|
21513
21793
|
seenSeparator = true;
|
|
21514
21794
|
break;
|
|
21515
21795
|
default:
|
|
@@ -21552,7 +21832,7 @@ function parseCollectArgs(tokens) {
|
|
|
21552
21832
|
const token = rest.shift();
|
|
21553
21833
|
switch (token) {
|
|
21554
21834
|
case "--endpoint":
|
|
21555
|
-
options.endpoint =
|
|
21835
|
+
options.endpoint = requireValue5(rest, token);
|
|
21556
21836
|
break;
|
|
21557
21837
|
case "--json":
|
|
21558
21838
|
options.json = true;
|
|
@@ -21562,7 +21842,7 @@ function parseCollectArgs(tokens) {
|
|
|
21562
21842
|
break;
|
|
21563
21843
|
case "--thread":
|
|
21564
21844
|
options.mode = "thread";
|
|
21565
|
-
options.threadName =
|
|
21845
|
+
options.threadName = requireValue5(rest, token);
|
|
21566
21846
|
break;
|
|
21567
21847
|
default:
|
|
21568
21848
|
throw new Error(`Unknown collect option: ${token}`);
|
|
@@ -21573,7 +21853,7 @@ function parseCollectArgs(tokens) {
|
|
|
21573
21853
|
}
|
|
21574
21854
|
return { type: "collect" /* Collect */, ...options };
|
|
21575
21855
|
}
|
|
21576
|
-
function
|
|
21856
|
+
function requireValue5(tokens, optionName) {
|
|
21577
21857
|
const value = tokens.shift();
|
|
21578
21858
|
if (!value) {
|
|
21579
21859
|
throw new Error(`Missing value for ${optionName}`);
|
|
@@ -21714,6 +21994,11 @@ async function main() {
|
|
|
21714
21994
|
await handler.handle(commandArgs);
|
|
21715
21995
|
return;
|
|
21716
21996
|
}
|
|
21997
|
+
case "ns" /* Ns */: {
|
|
21998
|
+
const handler = new NsCommandHandler();
|
|
21999
|
+
await handler.handle(commandArgs);
|
|
22000
|
+
return;
|
|
22001
|
+
}
|
|
21717
22002
|
case "store" /* Store */: {
|
|
21718
22003
|
const handler = new StoreCommandHandler();
|
|
21719
22004
|
await handler.handle(commandArgs);
|