@general-input/cli 0.2.0 → 0.4.0
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/cli.js +127 -91
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -224,7 +224,7 @@ var AuthService = class {
|
|
|
224
224
|
printSuccess("Removed ~/.config/geni/runner-session.json");
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
227
|
-
* Verify the active session by hitting `/
|
|
227
|
+
* Verify the active session by hitting `/v1/auth/me`. Returns the
|
|
228
228
|
* resolved status when the session is valid, or `null` when no
|
|
229
229
|
* local session exists. Stale-session failures throw `ApiError(401)`
|
|
230
230
|
* so commands can map them to exit code 78 with the same
|
|
@@ -384,7 +384,7 @@ import chalk4 from "chalk";
|
|
|
384
384
|
// package.json
|
|
385
385
|
var package_default = {
|
|
386
386
|
name: "@general-input/cli",
|
|
387
|
-
version: "0.
|
|
387
|
+
version: "0.4.0",
|
|
388
388
|
type: "module",
|
|
389
389
|
description: "The agent-facing CLI for General Input. Authenticate, manage workflows, run bash with operator credentials injected by the cloud.",
|
|
390
390
|
license: "SEE LICENSE IN LICENSE",
|
|
@@ -869,7 +869,7 @@ var DiscoveryService = class {
|
|
|
869
869
|
/**
|
|
870
870
|
* Look up one operation. When `service` is provided, hits the
|
|
871
871
|
* service-scoped integrations route; otherwise hits the standalone
|
|
872
|
-
* `/
|
|
872
|
+
* `/v1/operations/:opId` route which lets the server resolve the
|
|
873
873
|
* service from the id alone.
|
|
874
874
|
*/
|
|
875
875
|
async getOperation(args) {
|
|
@@ -1072,7 +1072,7 @@ import {
|
|
|
1072
1072
|
existsSync,
|
|
1073
1073
|
statSync
|
|
1074
1074
|
} from "fs";
|
|
1075
|
-
import { join,
|
|
1075
|
+
import { join, relative, sep } from "path";
|
|
1076
1076
|
var RESOURCE_MARKER_FILE = ".geni-resource.json";
|
|
1077
1077
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".turbo"]);
|
|
1078
1078
|
function readMarker(dir) {
|
|
@@ -1107,14 +1107,14 @@ function resolveResourceId(args) {
|
|
|
1107
1107
|
);
|
|
1108
1108
|
exit(ExitCode.InvalidArgs);
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function listResourceRelPaths(dir) {
|
|
1111
1111
|
if (!existsSync(dir)) {
|
|
1112
1112
|
printError(`Directory not found: ${dir}`);
|
|
1113
1113
|
exit(ExitCode.InvalidArgs);
|
|
1114
1114
|
}
|
|
1115
|
-
const
|
|
1116
|
-
walk(dir, dir,
|
|
1117
|
-
return
|
|
1115
|
+
const out = [];
|
|
1116
|
+
walk(dir, dir, out);
|
|
1117
|
+
return out;
|
|
1118
1118
|
}
|
|
1119
1119
|
function walk(root, current, out) {
|
|
1120
1120
|
for (const entry of readdirSync(current)) {
|
|
@@ -1127,27 +1127,9 @@ function walk(root, current, out) {
|
|
|
1127
1127
|
continue;
|
|
1128
1128
|
}
|
|
1129
1129
|
if (!stat.isFile()) continue;
|
|
1130
|
-
|
|
1131
|
-
out.push(bufferToCliFile(rel, readFileSync(full)));
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
function writeLocalFiles(dir, files) {
|
|
1135
|
-
for (const file of files) {
|
|
1136
|
-
const target = join(dir, file.path);
|
|
1137
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
1138
|
-
writeFileSync(target, cliFileBytes(file));
|
|
1130
|
+
out.push(relative(root, full).split(sep).join("/"));
|
|
1139
1131
|
}
|
|
1140
1132
|
}
|
|
1141
|
-
function bufferToCliFile(path, buf) {
|
|
1142
|
-
const asUtf8 = buf.toString("utf-8");
|
|
1143
|
-
if (Buffer.from(asUtf8, "utf-8").equals(buf)) {
|
|
1144
|
-
return { path, content: asUtf8, encoding: "utf8" };
|
|
1145
|
-
}
|
|
1146
|
-
return { path, content: buf.toString("base64"), encoding: "base64" };
|
|
1147
|
-
}
|
|
1148
|
-
function cliFileBytes(file) {
|
|
1149
|
-
return file.encoding === "base64" ? Buffer.from(file.content, "base64") : file.content;
|
|
1150
|
-
}
|
|
1151
1133
|
var MIME_BY_EXT = {
|
|
1152
1134
|
json: "application/json",
|
|
1153
1135
|
csv: "text/csv",
|
|
@@ -1176,6 +1158,32 @@ function dirHasResourceFiles(dir) {
|
|
|
1176
1158
|
);
|
|
1177
1159
|
}
|
|
1178
1160
|
|
|
1161
|
+
// src/lib/bundleArchive.ts
|
|
1162
|
+
import { mkdirSync as mkdirSync2 } from "fs";
|
|
1163
|
+
import { Readable } from "stream";
|
|
1164
|
+
import { create, extract } from "tar";
|
|
1165
|
+
async function packResourceDir(dir) {
|
|
1166
|
+
const files = listResourceRelPaths(dir);
|
|
1167
|
+
const stream = create({ gzip: true, cwd: dir, portable: true }, files);
|
|
1168
|
+
const chunks = [];
|
|
1169
|
+
for await (const chunk of stream) {
|
|
1170
|
+
chunks.push(Buffer.from(chunk));
|
|
1171
|
+
}
|
|
1172
|
+
return Buffer.concat(chunks);
|
|
1173
|
+
}
|
|
1174
|
+
async function extractBundle(dir, buffer) {
|
|
1175
|
+
mkdirSync2(dir, { recursive: true });
|
|
1176
|
+
await new Promise((resolve20, reject) => {
|
|
1177
|
+
const unpack = extract({
|
|
1178
|
+
cwd: dir,
|
|
1179
|
+
filter: (path) => !SKIP_DIRS.has(path.split("/")[0])
|
|
1180
|
+
});
|
|
1181
|
+
unpack.on("close", resolve20);
|
|
1182
|
+
unpack.on("error", reject);
|
|
1183
|
+
Readable.from(buffer).on("error", reject).pipe(unpack);
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1179
1187
|
// src/services/WorkflowAuthoringService.ts
|
|
1180
1188
|
var WorkflowAuthoringService = class {
|
|
1181
1189
|
constructor(sessionContext) {
|
|
@@ -1189,13 +1197,13 @@ var WorkflowAuthoringService = class {
|
|
|
1189
1197
|
workflowType: args.workflowType,
|
|
1190
1198
|
name: args.name
|
|
1191
1199
|
});
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1200
|
+
const { downloadUrl } = await client.workflows.bundleUrl(detail.id);
|
|
1201
|
+
const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
|
|
1194
1202
|
writeMarker(args.dir, {
|
|
1195
1203
|
resourceId: detail.id,
|
|
1196
1204
|
resourceType: detail.workflowType
|
|
1197
1205
|
});
|
|
1198
|
-
return { detail, fileCount
|
|
1206
|
+
return { detail, fileCount };
|
|
1199
1207
|
}
|
|
1200
1208
|
async list() {
|
|
1201
1209
|
const { client } = await this.sessionContext.requireAuthed();
|
|
@@ -1212,30 +1220,54 @@ var WorkflowAuthoringService = class {
|
|
|
1212
1220
|
/** Download a workflow's live files into `dir` + write its marker. */
|
|
1213
1221
|
async pull(args) {
|
|
1214
1222
|
const { client } = await this.sessionContext.requireAuthed();
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1223
|
+
const { workflowType, downloadUrl } = await client.workflows.bundleUrl(
|
|
1224
|
+
args.id
|
|
1225
|
+
);
|
|
1226
|
+
const fileCount = await this.downloadBundleInto(downloadUrl, args.dir);
|
|
1217
1227
|
writeMarker(args.dir, {
|
|
1218
1228
|
resourceId: args.id,
|
|
1219
|
-
resourceType:
|
|
1229
|
+
resourceType: workflowType
|
|
1220
1230
|
});
|
|
1221
|
-
return {
|
|
1222
|
-
fileCount: response.files.length,
|
|
1223
|
-
workflowType: response.workflowType
|
|
1224
|
-
};
|
|
1231
|
+
return { fileCount, workflowType };
|
|
1225
1232
|
}
|
|
1226
1233
|
async validate(args) {
|
|
1227
1234
|
const { client } = await this.sessionContext.requireAuthed();
|
|
1228
|
-
const
|
|
1229
|
-
return client.workflows.validate(args.id, {
|
|
1235
|
+
const bundleKey = await this.uploadBundle(args.id, args.dir);
|
|
1236
|
+
return client.workflows.validate(args.id, { bundleKey });
|
|
1230
1237
|
}
|
|
1231
1238
|
async publish(args) {
|
|
1232
1239
|
const { client } = await this.sessionContext.requireAuthed();
|
|
1233
|
-
const
|
|
1240
|
+
const bundleKey = await this.uploadBundle(args.id, args.dir);
|
|
1234
1241
|
return client.workflows.publish(args.id, {
|
|
1235
|
-
|
|
1242
|
+
bundleKey,
|
|
1236
1243
|
changeSummary: args.changeSummary
|
|
1237
1244
|
});
|
|
1238
1245
|
}
|
|
1246
|
+
/** Tar `dir`, PUT it to a presigned URL, return the staged `bundleKey`. */
|
|
1247
|
+
async uploadBundle(id, dir) {
|
|
1248
|
+
const { client } = await this.sessionContext.requireAuthed();
|
|
1249
|
+
const buffer = await packResourceDir(dir);
|
|
1250
|
+
const { uploadUrl, bundleKey, contentType } = await client.workflows.bundleUploadUrl(id);
|
|
1251
|
+
const response = await fetch(uploadUrl, {
|
|
1252
|
+
method: "PUT",
|
|
1253
|
+
headers: { "Content-Type": contentType },
|
|
1254
|
+
body: new Uint8Array(buffer)
|
|
1255
|
+
});
|
|
1256
|
+
if (!response.ok) {
|
|
1257
|
+
throw new Error(`Bundle upload failed (HTTP ${response.status}).`);
|
|
1258
|
+
}
|
|
1259
|
+
return bundleKey;
|
|
1260
|
+
}
|
|
1261
|
+
/** GET a presigned bundle URL, extract it into `dir`, return the file count. */
|
|
1262
|
+
async downloadBundleInto(downloadUrl, dir) {
|
|
1263
|
+
const response = await fetch(downloadUrl);
|
|
1264
|
+
if (!response.ok) {
|
|
1265
|
+
throw new Error(`Bundle download failed (HTTP ${response.status}).`);
|
|
1266
|
+
}
|
|
1267
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
1268
|
+
await extractBundle(dir, buffer);
|
|
1269
|
+
return listResourceRelPaths(dir).length;
|
|
1270
|
+
}
|
|
1239
1271
|
async getConfig(id) {
|
|
1240
1272
|
const { client } = await this.sessionContext.requireAuthed();
|
|
1241
1273
|
return client.workflows.getConfig(id);
|
|
@@ -1330,24 +1362,24 @@ var AuthApiClient = class {
|
|
|
1330
1362
|
}
|
|
1331
1363
|
http;
|
|
1332
1364
|
async startDeviceCode(clientLabel) {
|
|
1333
|
-
return this.http.fetch("/
|
|
1365
|
+
return this.http.fetch("/v1/auth/device-code", {
|
|
1334
1366
|
method: "POST",
|
|
1335
1367
|
body: { clientLabel }
|
|
1336
1368
|
});
|
|
1337
1369
|
}
|
|
1338
1370
|
async pollDeviceCode(userCode) {
|
|
1339
1371
|
return this.http.fetch(
|
|
1340
|
-
`/
|
|
1372
|
+
`/v1/auth/device-code/${encodeURIComponent(userCode)}/poll`,
|
|
1341
1373
|
{ method: "POST" }
|
|
1342
1374
|
);
|
|
1343
1375
|
}
|
|
1344
1376
|
async me() {
|
|
1345
1377
|
this.http.requireAuthed();
|
|
1346
|
-
return this.http.fetch("/
|
|
1378
|
+
return this.http.fetch("/v1/auth/me");
|
|
1347
1379
|
}
|
|
1348
1380
|
async logout() {
|
|
1349
1381
|
this.http.requireAuthed();
|
|
1350
|
-
return this.http.fetch("/
|
|
1382
|
+
return this.http.fetch("/v1/auth/logout", { method: "POST" });
|
|
1351
1383
|
}
|
|
1352
1384
|
};
|
|
1353
1385
|
|
|
@@ -1359,11 +1391,11 @@ var WorkspacesApiClient = class {
|
|
|
1359
1391
|
http;
|
|
1360
1392
|
async list() {
|
|
1361
1393
|
this.http.requireAuthed();
|
|
1362
|
-
return this.http.fetch("/
|
|
1394
|
+
return this.http.fetch("/v1/workspaces");
|
|
1363
1395
|
}
|
|
1364
1396
|
async switch(membershipId) {
|
|
1365
1397
|
this.http.requireAuthed();
|
|
1366
|
-
return this.http.fetch("/
|
|
1398
|
+
return this.http.fetch("/v1/workspaces/switch", {
|
|
1367
1399
|
method: "POST",
|
|
1368
1400
|
body: { membershipId }
|
|
1369
1401
|
});
|
|
@@ -1378,7 +1410,7 @@ var ExecApiClient = class {
|
|
|
1378
1410
|
http;
|
|
1379
1411
|
async resolve(body) {
|
|
1380
1412
|
this.http.requireAuthed();
|
|
1381
|
-
return this.http.fetch("/
|
|
1413
|
+
return this.http.fetch("/v1/exec/resolve", {
|
|
1382
1414
|
method: "POST",
|
|
1383
1415
|
body
|
|
1384
1416
|
});
|
|
@@ -1393,11 +1425,11 @@ var CredentialsApiClient = class {
|
|
|
1393
1425
|
http;
|
|
1394
1426
|
async list() {
|
|
1395
1427
|
this.http.requireAuthed();
|
|
1396
|
-
return this.http.fetch("/
|
|
1428
|
+
return this.http.fetch("/v1/credentials");
|
|
1397
1429
|
}
|
|
1398
1430
|
async get(id) {
|
|
1399
1431
|
this.http.requireAuthed();
|
|
1400
|
-
return this.http.fetch(`/
|
|
1432
|
+
return this.http.fetch(`/v1/credentials/${encodeURIComponent(id)}`);
|
|
1401
1433
|
}
|
|
1402
1434
|
};
|
|
1403
1435
|
|
|
@@ -1409,23 +1441,23 @@ var IntegrationsApiClient = class {
|
|
|
1409
1441
|
http;
|
|
1410
1442
|
async list(args) {
|
|
1411
1443
|
this.http.requireAuthed();
|
|
1412
|
-
const path = args?.query && args.query.length > 0 ? `/
|
|
1444
|
+
const path = args?.query && args.query.length > 0 ? `/v1/integrations?q=${encodeURIComponent(args.query)}` : "/v1/integrations";
|
|
1413
1445
|
return this.http.fetch(path);
|
|
1414
1446
|
}
|
|
1415
1447
|
async get(service) {
|
|
1416
1448
|
this.http.requireAuthed();
|
|
1417
|
-
return this.http.fetch(`/
|
|
1449
|
+
return this.http.fetch(`/v1/integrations/${encodeURIComponent(service)}`);
|
|
1418
1450
|
}
|
|
1419
1451
|
async listOperations(service) {
|
|
1420
1452
|
this.http.requireAuthed();
|
|
1421
1453
|
return this.http.fetch(
|
|
1422
|
-
`/
|
|
1454
|
+
`/v1/integrations/${encodeURIComponent(service)}/operations`
|
|
1423
1455
|
);
|
|
1424
1456
|
}
|
|
1425
1457
|
async getOperation(args) {
|
|
1426
1458
|
this.http.requireAuthed();
|
|
1427
1459
|
return this.http.fetch(
|
|
1428
|
-
`/
|
|
1460
|
+
`/v1/integrations/${encodeURIComponent(args.service)}/operations/${encodeURIComponent(args.opId)}`
|
|
1429
1461
|
);
|
|
1430
1462
|
}
|
|
1431
1463
|
};
|
|
@@ -1438,7 +1470,7 @@ var OperationsApiClient = class {
|
|
|
1438
1470
|
http;
|
|
1439
1471
|
async getById(opId) {
|
|
1440
1472
|
this.http.requireAuthed();
|
|
1441
|
-
return this.http.fetch(`/
|
|
1473
|
+
return this.http.fetch(`/v1/operations/${encodeURIComponent(opId)}`);
|
|
1442
1474
|
}
|
|
1443
1475
|
};
|
|
1444
1476
|
|
|
@@ -1450,58 +1482,62 @@ var WorkflowsApiClient = class {
|
|
|
1450
1482
|
http;
|
|
1451
1483
|
async list() {
|
|
1452
1484
|
this.http.requireAuthed();
|
|
1453
|
-
return this.http.fetch("/
|
|
1485
|
+
return this.http.fetch("/v1/workflows");
|
|
1454
1486
|
}
|
|
1455
1487
|
async create(body) {
|
|
1456
1488
|
this.http.requireAuthed();
|
|
1457
|
-
return this.http.fetch("/
|
|
1489
|
+
return this.http.fetch("/v1/workflows", { method: "POST", body });
|
|
1458
1490
|
}
|
|
1459
1491
|
async get(id) {
|
|
1460
1492
|
this.http.requireAuthed();
|
|
1461
|
-
return this.http.fetch(`/
|
|
1493
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}`);
|
|
1462
1494
|
}
|
|
1463
1495
|
async setType(id, body) {
|
|
1464
1496
|
this.http.requireAuthed();
|
|
1465
|
-
return this.http.fetch(`/
|
|
1497
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/type`, {
|
|
1466
1498
|
method: "PATCH",
|
|
1467
1499
|
body
|
|
1468
1500
|
});
|
|
1469
1501
|
}
|
|
1470
|
-
async
|
|
1502
|
+
async bundleUrl(id) {
|
|
1471
1503
|
this.http.requireAuthed();
|
|
1472
|
-
return this.http.fetch(`/
|
|
1504
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/bundle-url`);
|
|
1473
1505
|
}
|
|
1474
|
-
async
|
|
1506
|
+
async bundleUploadUrl(id) {
|
|
1475
1507
|
this.http.requireAuthed();
|
|
1476
1508
|
return this.http.fetch(
|
|
1477
|
-
`/
|
|
1478
|
-
{
|
|
1479
|
-
method: "POST",
|
|
1480
|
-
body
|
|
1481
|
-
}
|
|
1509
|
+
`/v1/workflows/${encodeURIComponent(id)}/bundle-upload-url`,
|
|
1510
|
+
{ method: "POST" }
|
|
1482
1511
|
);
|
|
1483
1512
|
}
|
|
1513
|
+
async validate(id, body) {
|
|
1514
|
+
this.http.requireAuthed();
|
|
1515
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/validate`, {
|
|
1516
|
+
method: "POST",
|
|
1517
|
+
body
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1484
1520
|
async publish(id, body) {
|
|
1485
1521
|
this.http.requireAuthed();
|
|
1486
|
-
return this.http.fetch(`/
|
|
1522
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/publish`, {
|
|
1487
1523
|
method: "POST",
|
|
1488
1524
|
body
|
|
1489
1525
|
});
|
|
1490
1526
|
}
|
|
1491
1527
|
async getConfig(id) {
|
|
1492
1528
|
this.http.requireAuthed();
|
|
1493
|
-
return this.http.fetch(`/
|
|
1529
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/config`);
|
|
1494
1530
|
}
|
|
1495
1531
|
async updateConfig(id, body) {
|
|
1496
1532
|
this.http.requireAuthed();
|
|
1497
|
-
return this.http.fetch(`/
|
|
1533
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/config`, {
|
|
1498
1534
|
method: "PATCH",
|
|
1499
1535
|
body
|
|
1500
1536
|
});
|
|
1501
1537
|
}
|
|
1502
1538
|
async test(id, body) {
|
|
1503
1539
|
this.http.requireAuthed();
|
|
1504
|
-
return this.http.fetch(`/
|
|
1540
|
+
return this.http.fetch(`/v1/workflows/${encodeURIComponent(id)}/test`, {
|
|
1505
1541
|
method: "POST",
|
|
1506
1542
|
body
|
|
1507
1543
|
});
|
|
@@ -1510,44 +1546,44 @@ var WorkflowsApiClient = class {
|
|
|
1510
1546
|
this.http.requireAuthed();
|
|
1511
1547
|
const query = limit ? `?limit=${limit}` : "";
|
|
1512
1548
|
return this.http.fetch(
|
|
1513
|
-
`/
|
|
1549
|
+
`/v1/workflows/${encodeURIComponent(id)}/executions${query}`
|
|
1514
1550
|
);
|
|
1515
1551
|
}
|
|
1516
1552
|
async getExecution(id, executionId) {
|
|
1517
1553
|
this.http.requireAuthed();
|
|
1518
1554
|
return this.http.fetch(
|
|
1519
|
-
`/
|
|
1555
|
+
`/v1/workflows/${encodeURIComponent(id)}/executions/${encodeURIComponent(executionId)}`
|
|
1520
1556
|
);
|
|
1521
1557
|
}
|
|
1522
1558
|
async getExecutionLogs(id, executionId) {
|
|
1523
1559
|
this.http.requireAuthed();
|
|
1524
1560
|
return this.http.fetch(
|
|
1525
|
-
`/
|
|
1561
|
+
`/v1/workflows/${encodeURIComponent(id)}/executions/${encodeURIComponent(executionId)}/logs`
|
|
1526
1562
|
);
|
|
1527
1563
|
}
|
|
1528
1564
|
async getExecutionTrace(id, executionId) {
|
|
1529
1565
|
this.http.requireAuthed();
|
|
1530
1566
|
return this.http.fetch(
|
|
1531
|
-
`/
|
|
1567
|
+
`/v1/workflows/${encodeURIComponent(id)}/executions/${encodeURIComponent(executionId)}/trace`
|
|
1532
1568
|
);
|
|
1533
1569
|
}
|
|
1534
1570
|
async triggerSample(id) {
|
|
1535
1571
|
this.http.requireAuthed();
|
|
1536
1572
|
return this.http.fetch(
|
|
1537
|
-
`/
|
|
1573
|
+
`/v1/workflows/${encodeURIComponent(id)}/trigger-sample`
|
|
1538
1574
|
);
|
|
1539
1575
|
}
|
|
1540
1576
|
async inputUploadUrl(id, body) {
|
|
1541
1577
|
this.http.requireAuthed();
|
|
1542
1578
|
return this.http.fetch(
|
|
1543
|
-
`/
|
|
1579
|
+
`/v1/workflows/${encodeURIComponent(id)}/input-upload-url`,
|
|
1544
1580
|
{ method: "POST", body }
|
|
1545
1581
|
);
|
|
1546
1582
|
}
|
|
1547
1583
|
async appBuildStatus(id) {
|
|
1548
1584
|
this.http.requireAuthed();
|
|
1549
1585
|
return this.http.fetch(
|
|
1550
|
-
`/
|
|
1586
|
+
`/v1/workflows/${encodeURIComponent(id)}/app/build-status`
|
|
1551
1587
|
);
|
|
1552
1588
|
}
|
|
1553
1589
|
async appInvocations(id, opts) {
|
|
@@ -1558,13 +1594,13 @@ var WorkflowsApiClient = class {
|
|
|
1558
1594
|
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1559
1595
|
const query = params.toString();
|
|
1560
1596
|
return this.http.fetch(
|
|
1561
|
-
`/
|
|
1597
|
+
`/v1/workflows/${encodeURIComponent(id)}/app/invocations${query ? `?${query}` : ""}`
|
|
1562
1598
|
);
|
|
1563
1599
|
}
|
|
1564
1600
|
async runHandler(id, body) {
|
|
1565
1601
|
this.http.requireAuthed();
|
|
1566
1602
|
return this.http.fetch(
|
|
1567
|
-
`/
|
|
1603
|
+
`/v1/workflows/${encodeURIComponent(id)}/app/run-handler`,
|
|
1568
1604
|
{ method: "POST", body }
|
|
1569
1605
|
);
|
|
1570
1606
|
}
|
|
@@ -1572,24 +1608,24 @@ var WorkflowsApiClient = class {
|
|
|
1572
1608
|
this.http.requireAuthed();
|
|
1573
1609
|
const query = opts.limit ? `?limit=${opts.limit}` : "";
|
|
1574
1610
|
return this.http.fetch(
|
|
1575
|
-
`/
|
|
1611
|
+
`/v1/workflows/${encodeURIComponent(id)}/app/errors${query}`
|
|
1576
1612
|
);
|
|
1577
1613
|
}
|
|
1578
1614
|
async clearHandlerCache(id) {
|
|
1579
1615
|
this.http.requireAuthed();
|
|
1580
1616
|
return this.http.fetch(
|
|
1581
|
-
`/
|
|
1617
|
+
`/v1/workflows/${encodeURIComponent(id)}/app/clear-cache`,
|
|
1582
1618
|
{ method: "POST" }
|
|
1583
1619
|
);
|
|
1584
1620
|
}
|
|
1585
1621
|
async spec(type) {
|
|
1586
1622
|
this.http.requireAuthed();
|
|
1587
|
-
return this.http.fetch(`/
|
|
1623
|
+
return this.http.fetch(`/v1/workflows/spec/${encodeURIComponent(type)}`);
|
|
1588
1624
|
}
|
|
1589
1625
|
async listTriggers(query) {
|
|
1590
1626
|
this.http.requireAuthed();
|
|
1591
1627
|
const suffix = query ? `?q=${encodeURIComponent(query)}` : "";
|
|
1592
|
-
return this.http.fetch(`/
|
|
1628
|
+
return this.http.fetch(`/v1/triggers${suffix}`);
|
|
1593
1629
|
}
|
|
1594
1630
|
};
|
|
1595
1631
|
|
|
@@ -1720,7 +1756,7 @@ function isErrnoCode(err, expected) {
|
|
|
1720
1756
|
// src/clients/ConfigStore.ts
|
|
1721
1757
|
import { readFileSync as readFileSync3 } from "fs";
|
|
1722
1758
|
import { mkdir as mkdir2, writeFile as writeFile2, unlink as unlink2 } from "fs/promises";
|
|
1723
|
-
import { dirname
|
|
1759
|
+
import { dirname } from "path";
|
|
1724
1760
|
var ConfigStore = class {
|
|
1725
1761
|
constructor(filePath) {
|
|
1726
1762
|
this.filePath = filePath;
|
|
@@ -1752,7 +1788,7 @@ var ConfigStore = class {
|
|
|
1752
1788
|
* config is non-secret, unlike the session file.
|
|
1753
1789
|
*/
|
|
1754
1790
|
async save(config) {
|
|
1755
|
-
await mkdir2(
|
|
1791
|
+
await mkdir2(dirname(this.filePath), { recursive: true });
|
|
1756
1792
|
await writeFile2(this.filePath, JSON.stringify(config, null, 2) + "\n", {
|
|
1757
1793
|
mode: 420
|
|
1758
1794
|
});
|
|
@@ -2050,7 +2086,7 @@ async function executeAuthStatus(opts) {
|
|
|
2050
2086
|
}
|
|
2051
2087
|
function registerStatus(parent) {
|
|
2052
2088
|
parent.command("status").description(
|
|
2053
|
-
'Verify the active session and print operator + active workspace. Hits `/
|
|
2089
|
+
'Verify the active session and print operator + active workspace. Hits `/v1/auth/me` to confirm the token is still valid server-side; a stale local session (server revoked, expired) exits 78 with a clear "run geni login" message rather than reporting a fake-OK from the local file alone.'
|
|
2054
2090
|
).option(
|
|
2055
2091
|
"--json",
|
|
2056
2092
|
"Emit a machine-readable JSON object: `{ authenticated, user, workspace, server }`. When unauthenticated, `{ authenticated: false }` is the only field."
|
|
@@ -3571,12 +3607,12 @@ function registerWorkflowExecutions(parent) {
|
|
|
3571
3607
|
import { resolve as resolve14 } from "path";
|
|
3572
3608
|
|
|
3573
3609
|
// src/lib/executionTrace.ts
|
|
3574
|
-
import { mkdirSync as
|
|
3610
|
+
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
3575
3611
|
import { join as join3, resolve as resolve13 } from "path";
|
|
3576
3612
|
function writeExecutionTraceBundle(args) {
|
|
3577
3613
|
const { baseDir, trace } = args;
|
|
3578
3614
|
const dir = resolve13(baseDir, trace.id);
|
|
3579
|
-
|
|
3615
|
+
mkdirSync3(dir, { recursive: true });
|
|
3580
3616
|
const files = [];
|
|
3581
3617
|
const write = (name, content) => {
|
|
3582
3618
|
const path = join3(dir, name);
|
|
@@ -4118,7 +4154,7 @@ logout (or use \`geni login --server <url>\`) to switch in one step.
|
|
|
4118
4154
|
import { homedir as homedir2 } from "os";
|
|
4119
4155
|
import { join as join4 } from "path";
|
|
4120
4156
|
import {
|
|
4121
|
-
mkdirSync as
|
|
4157
|
+
mkdirSync as mkdirSync4,
|
|
4122
4158
|
writeFileSync as writeFileSync3,
|
|
4123
4159
|
existsSync as existsSync3,
|
|
4124
4160
|
readFileSync as readFileSync4,
|
|
@@ -4177,7 +4213,7 @@ function installSkills() {
|
|
|
4177
4213
|
if (!target.detect()) continue;
|
|
4178
4214
|
const path = target.skillPath;
|
|
4179
4215
|
try {
|
|
4180
|
-
|
|
4216
|
+
mkdirSync4(target.skillDir, { recursive: true });
|
|
4181
4217
|
const previous = existsSync3(path) ? readFileSync4(path, "utf-8") : null;
|
|
4182
4218
|
const changed = previous !== GENI_SKILL_MD;
|
|
4183
4219
|
writeFileSync3(path, GENI_SKILL_MD);
|