@diafunc/cli 0.12.0 → 0.14.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/README.md +21 -17
- package/dist/bin/diafunc.js +3 -3
- package/dist/{chunk-A4VM56MK.js → chunk-5VMDFBM6.js} +3 -3
- package/dist/chunk-5VMDFBM6.js.map +1 -0
- package/dist/{chunk-4NQYIRPF.js → chunk-V3EXWLZP.js} +603 -221
- package/dist/chunk-V3EXWLZP.js.map +1 -0
- package/dist/{chunk-BUHZT6MT.js → chunk-XXWRNCTW.js} +3 -3
- package/dist/{chunk-BUHZT6MT.js.map → chunk-XXWRNCTW.js.map} +1 -1
- package/dist/src/index.js +2 -2
- package/dist/update-check-3ZDZSY7M.js +8 -0
- package/package.json +2 -2
- package/dist/chunk-4NQYIRPF.js.map +0 -1
- package/dist/chunk-A4VM56MK.js.map +0 -1
- package/dist/update-check-SNH7P32S.js +0 -8
- /package/dist/{update-check-SNH7P32S.js.map → update-check-3ZDZSY7M.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5VMDFBM6.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
-
import
|
|
6
|
+
import chalk36 from "chalk";
|
|
7
7
|
|
|
8
8
|
// src/commands/auth/login.ts
|
|
9
9
|
import chalk4 from "chalk";
|
|
@@ -689,6 +689,7 @@ function createAdminService(client) {
|
|
|
689
689
|
path: "/settings/"
|
|
690
690
|
});
|
|
691
691
|
},
|
|
692
|
+
// The platform expects one { name, value } pair, not a map keyed by the setting name.
|
|
692
693
|
async mergeSetting(setting) {
|
|
693
694
|
return client.request({
|
|
694
695
|
method: "PUT",
|
|
@@ -697,6 +698,23 @@ function createAdminService(client) {
|
|
|
697
698
|
body: setting
|
|
698
699
|
});
|
|
699
700
|
},
|
|
701
|
+
// Platform settings: the operator-facing catalogue, distinct from the per-user settings above.
|
|
702
|
+
// Every entry carries its compiled default, so an unset override reads as null rather than absent.
|
|
703
|
+
async listPlatformSettings() {
|
|
704
|
+
return client.request({
|
|
705
|
+
method: "GET",
|
|
706
|
+
service: SERVICE,
|
|
707
|
+
path: "/platform-settings"
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
async updatePlatformSetting(key, value, reason2) {
|
|
711
|
+
return client.request({
|
|
712
|
+
method: "PUT",
|
|
713
|
+
service: SERVICE,
|
|
714
|
+
path: `/platform-settings/${encodeURIComponent(key)}`,
|
|
715
|
+
body: { value, reason: reason2 }
|
|
716
|
+
});
|
|
717
|
+
},
|
|
700
718
|
// Subscription
|
|
701
719
|
async getCurrentSubscription() {
|
|
702
720
|
return client.request({
|
|
@@ -973,7 +991,7 @@ async function deviceCodeLogin(config, profile) {
|
|
|
973
991
|
failure("Code expired before approval. Run `diafunc auth login` again.");
|
|
974
992
|
process.exit(1);
|
|
975
993
|
}
|
|
976
|
-
failure(`Device-code flow failed: ${errorBody.error}${errorBody.error_description ? "
|
|
994
|
+
failure(`Device-code flow failed: ${errorBody.error}${errorBody.error_description ? ": " + errorBody.error_description : ""}`);
|
|
977
995
|
process.exit(1);
|
|
978
996
|
}
|
|
979
997
|
failure("Timed out waiting for approval.");
|
|
@@ -1210,6 +1228,18 @@ function formatDuration(millis) {
|
|
|
1210
1228
|
const days = Math.floor(hours / 24);
|
|
1211
1229
|
return `${days}d ${hours % 24}h`;
|
|
1212
1230
|
}
|
|
1231
|
+
function formatDurationPrecise(millis) {
|
|
1232
|
+
const total = Math.max(0, Math.trunc(millis));
|
|
1233
|
+
const days = Math.floor(total / 864e5);
|
|
1234
|
+
const hours = Math.floor(total / 36e5) % 24;
|
|
1235
|
+
const minutes = Math.floor(total / 6e4) % 60;
|
|
1236
|
+
const seconds = Math.floor(total / 1e3) % 60;
|
|
1237
|
+
if (days > 0) return hours > 0 ? `${days} d ${hours} h` : `${days} d`;
|
|
1238
|
+
if (hours > 0) return minutes > 0 ? `${hours} h ${minutes} min` : `${hours} h`;
|
|
1239
|
+
if (minutes > 0) return `${minutes} min`;
|
|
1240
|
+
if (seconds > 0) return `${seconds} sec`;
|
|
1241
|
+
return `${total} ms`;
|
|
1242
|
+
}
|
|
1213
1243
|
var GOOD_STATES = /* @__PURE__ */ new Set([
|
|
1214
1244
|
"COMPLETED",
|
|
1215
1245
|
"SUCCEEDED",
|
|
@@ -1838,11 +1868,12 @@ function createStorageService(client) {
|
|
|
1838
1868
|
});
|
|
1839
1869
|
},
|
|
1840
1870
|
// --- Linked Entities ---
|
|
1841
|
-
async getLinkedEntities(direction, ref) {
|
|
1871
|
+
async getLinkedEntities(direction, ref, linkId) {
|
|
1872
|
+
const byLink = linkId ? `/${enc(linkId)}` : "";
|
|
1842
1873
|
return client.request({
|
|
1843
1874
|
method: "GET",
|
|
1844
1875
|
service: SERVICE3,
|
|
1845
|
-
path: `/linked-entities/${enc(direction)}${entityPath(ref)}`
|
|
1876
|
+
path: `/linked-entities/${enc(direction)}${entityPath(ref)}${byLink}`
|
|
1846
1877
|
});
|
|
1847
1878
|
},
|
|
1848
1879
|
async saveLinkedEntities(ref, linkId, entities) {
|
|
@@ -2760,7 +2791,7 @@ function registerTokenCommands(parent) {
|
|
|
2760
2791
|
console.log(` Name: ${result.name}`);
|
|
2761
2792
|
console.log(` Expires: ${result.expiresAt}`);
|
|
2762
2793
|
console.log();
|
|
2763
|
-
console.log(chalk8.yellow("Save this token
|
|
2794
|
+
console.log(chalk8.yellow("Save this token. It will not be shown again."));
|
|
2764
2795
|
} else {
|
|
2765
2796
|
format(result, { format: outputFormat });
|
|
2766
2797
|
}
|
|
@@ -3236,7 +3267,7 @@ async function pollUntilFinished(storage, projectId, projectBranch, bundleId, in
|
|
|
3236
3267
|
status.stop();
|
|
3237
3268
|
}
|
|
3238
3269
|
throw new Error(
|
|
3239
|
-
`Export ${bundleId} is still running after ${formatDuration(intervalMs * maxAttempts)}
|
|
3270
|
+
`Export ${bundleId} is still running after ${formatDuration(intervalMs * maxAttempts)}. Check it with 'diafunc notebook bundles ${projectId}'.`
|
|
3240
3271
|
);
|
|
3241
3272
|
}
|
|
3242
3273
|
function progressLine(label, progress, elapsedMs) {
|
|
@@ -3265,6 +3296,28 @@ async function resolveLanguage(api, projectId, explicit) {
|
|
|
3265
3296
|
return DEFAULT_FUNCTION_LANGUAGE;
|
|
3266
3297
|
}
|
|
3267
3298
|
|
|
3299
|
+
// src/util/project-names.ts
|
|
3300
|
+
var FIRST_PAGE = 100;
|
|
3301
|
+
var CONCURRENCY = 8;
|
|
3302
|
+
async function projectNames(api, projectIds) {
|
|
3303
|
+
const wanted = new Set(projectIds);
|
|
3304
|
+
const names = /* @__PURE__ */ new Map();
|
|
3305
|
+
if (wanted.size === 0) return names;
|
|
3306
|
+
const take = (items) => {
|
|
3307
|
+
for (const item of items) {
|
|
3308
|
+
if (item.contentType !== "project" || !item.name || !wanted.has(item.projectId)) continue;
|
|
3309
|
+
if (!names.has(item.projectId)) names.set(item.projectId, item.name);
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
take((await api.index.searchPage({ query: "*", contentType: "project", limit: FIRST_PAGE })).items);
|
|
3313
|
+
const missing = [...wanted].filter((id) => !names.has(id));
|
|
3314
|
+
for (let i = 0; i < missing.length; i += CONCURRENCY) {
|
|
3315
|
+
const pages = await Promise.all(missing.slice(i, i + CONCURRENCY).map((projectId) => api.index.searchPage({ query: "*", contentType: "project", projectId, projectBranch: "main", limit: 5 }).catch(() => null)));
|
|
3316
|
+
for (const page of pages) if (page) take(page.items);
|
|
3317
|
+
}
|
|
3318
|
+
return names;
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3268
3321
|
// src/commands/project/index.ts
|
|
3269
3322
|
function getOutputFormat(cmd) {
|
|
3270
3323
|
const config = loadConfig();
|
|
@@ -3282,9 +3335,6 @@ Examples:
|
|
|
3282
3335
|
$ diafunc project list the twenty most recent
|
|
3283
3336
|
$ diafunc project list --limit 0 every one of them
|
|
3284
3337
|
$ diafunc search "housing" --type project find a project by name
|
|
3285
|
-
|
|
3286
|
-
A project's name lives on its main entity rather than on the project row, so this listing shows
|
|
3287
|
-
ids. Use 'diafunc search --type project' when you know the name but not the id.
|
|
3288
3338
|
`).action(async (options, cmd) => {
|
|
3289
3339
|
try {
|
|
3290
3340
|
const outputFormat = getOutputFormat(cmd);
|
|
@@ -3292,9 +3342,17 @@ ids. Use 'diafunc search --type project' when you know the name but not the id.
|
|
|
3292
3342
|
const projects = options.all ? await api.admin.getAllProjects() : await api.admin.getProjects();
|
|
3293
3343
|
const limit = Number.parseInt(options.limit, 10);
|
|
3294
3344
|
const capped = Number.isFinite(limit) && limit > 0 ? projects.slice(0, limit) : projects;
|
|
3295
|
-
|
|
3345
|
+
let names = /* @__PURE__ */ new Map();
|
|
3346
|
+
try {
|
|
3347
|
+
names = await projectNames(api, capped.map((p) => p.projectId));
|
|
3348
|
+
} catch {
|
|
3349
|
+
console.error(chalk12.dim("Project names are unavailable right now; showing ids."));
|
|
3350
|
+
}
|
|
3351
|
+
const rows = capped.map((p) => ({ name: names.get(p.projectId) ?? null, ...p }));
|
|
3352
|
+
format(rows, {
|
|
3296
3353
|
format: outputFormat,
|
|
3297
3354
|
columns: [
|
|
3355
|
+
{ key: "name" },
|
|
3298
3356
|
{ key: "projectId", kind: "id" },
|
|
3299
3357
|
{ key: "teamName", header: "team" },
|
|
3300
3358
|
{ key: "visibility" },
|
|
@@ -3305,7 +3363,7 @@ ids. Use 'diafunc search --type project' when you know the name but not the id.
|
|
|
3305
3363
|
]
|
|
3306
3364
|
});
|
|
3307
3365
|
if (capped.length < projects.length) {
|
|
3308
|
-
console.
|
|
3366
|
+
console.error(chalk12.dim(
|
|
3309
3367
|
`
|
|
3310
3368
|
Showing ${capped.length} of ${projects.length}. Pass --limit 0 to see them all.`
|
|
3311
3369
|
));
|
|
@@ -4419,6 +4477,130 @@ Examples:
|
|
|
4419
4477
|
import chalk15 from "chalk";
|
|
4420
4478
|
import * as fs4 from "fs";
|
|
4421
4479
|
import * as path3 from "path";
|
|
4480
|
+
|
|
4481
|
+
// src/util/table-window.ts
|
|
4482
|
+
var WINDOW_MAX_ROWS = 100;
|
|
4483
|
+
var WINDOW_MAX_COLUMNS = 50;
|
|
4484
|
+
var WINDOW_MAX_CELLS = 2e3;
|
|
4485
|
+
function decodeLongAttribute(value) {
|
|
4486
|
+
if (!value) return null;
|
|
4487
|
+
const bytes = Buffer.from(value, "base64");
|
|
4488
|
+
if (bytes.length !== 8) return null;
|
|
4489
|
+
const decoded = bytes.readBigInt64BE(0);
|
|
4490
|
+
return decoded >= 0n && decoded <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(decoded) : null;
|
|
4491
|
+
}
|
|
4492
|
+
function tableDimensions(entity) {
|
|
4493
|
+
return {
|
|
4494
|
+
rows: decodeLongAttribute(entity.attributes?.rows) ?? 0,
|
|
4495
|
+
columns: decodeLongAttribute(entity.attributes?.columns) ?? 0
|
|
4496
|
+
};
|
|
4497
|
+
}
|
|
4498
|
+
function defaultWindow(rows, columns) {
|
|
4499
|
+
const shownColumns = Math.min(columns, WINDOW_MAX_COLUMNS);
|
|
4500
|
+
const budgeted = Math.max(1, Math.floor(WINDOW_MAX_CELLS / Math.max(1, shownColumns)));
|
|
4501
|
+
const shownRows = Math.min(rows, WINDOW_MAX_ROWS, budgeted);
|
|
4502
|
+
return { rows: { from: 0, to: shownRows }, columns: { from: 0, to: shownColumns } };
|
|
4503
|
+
}
|
|
4504
|
+
function parseRange(text2, size, label) {
|
|
4505
|
+
const noun = label === "Row" ? "rows" : "columns";
|
|
4506
|
+
const match = /^\s*(\d*)\s*:\s*(\d*)\s*$/.exec(text2);
|
|
4507
|
+
if (!match || match[1] === "" && match[2] === "") {
|
|
4508
|
+
throw new CliError(`${label} range "${text2}" is not two numbers like 0:10.`, { exitCode: EXIT_USAGE });
|
|
4509
|
+
}
|
|
4510
|
+
const from = match[1] === "" ? 0 : Number(match[1]);
|
|
4511
|
+
const to = match[2] === "" ? size : Math.min(Number(match[2]), size);
|
|
4512
|
+
if (from >= size) {
|
|
4513
|
+
throw new CliError(`${label} range "${text2}" starts past the table, which has ${size} ${noun}.`, { exitCode: EXIT_USAGE });
|
|
4514
|
+
}
|
|
4515
|
+
if (to <= from) {
|
|
4516
|
+
throw new CliError(`${label} range "${text2}" selects no ${noun}.`, { exitCode: EXIT_USAGE });
|
|
4517
|
+
}
|
|
4518
|
+
return { from, to };
|
|
4519
|
+
}
|
|
4520
|
+
function cellRange(window) {
|
|
4521
|
+
return {
|
|
4522
|
+
fromRowIndex: window.rows.from,
|
|
4523
|
+
toRowIndex: window.rows.to - 1,
|
|
4524
|
+
fromColumnIndex: window.columns.from,
|
|
4525
|
+
toColumnIndex: window.columns.to - 1
|
|
4526
|
+
};
|
|
4527
|
+
}
|
|
4528
|
+
function describeWindow(window, rows, columns) {
|
|
4529
|
+
const whole = window.rows.from === 0 && window.rows.to === rows && window.columns.from === 0 && window.columns.to === columns;
|
|
4530
|
+
const line = `Rows ${window.rows.from}\u2013${window.rows.to - 1} of ${rows} \xB7 columns ${window.columns.from}\u2013${window.columns.to - 1} of ${columns}`;
|
|
4531
|
+
return whole ? line : `${line} \xB7 use --rows/--cols for more`;
|
|
4532
|
+
}
|
|
4533
|
+
function decodeCellValue(value, type) {
|
|
4534
|
+
if (!value) return "";
|
|
4535
|
+
const bytes = Buffer.from(value, "base64");
|
|
4536
|
+
switch (type) {
|
|
4537
|
+
case "integer":
|
|
4538
|
+
if (bytes.length === 8) return bytes.readBigInt64BE(0).toString();
|
|
4539
|
+
break;
|
|
4540
|
+
case "number":
|
|
4541
|
+
if (bytes.length === 8) return String(bytes.readDoubleBE(0));
|
|
4542
|
+
break;
|
|
4543
|
+
case "bool":
|
|
4544
|
+
if (bytes.length === 1) return bytes[0] !== 0 ? "true" : "false";
|
|
4545
|
+
break;
|
|
4546
|
+
}
|
|
4547
|
+
return bytes.toString("utf-8");
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4550
|
+
// src/util/entity-attributes.ts
|
|
4551
|
+
function encodeTextAttribute(value) {
|
|
4552
|
+
return Buffer.from(value, "utf-8").toString("base64");
|
|
4553
|
+
}
|
|
4554
|
+
function decodeTextAttribute(value) {
|
|
4555
|
+
if (value === null || value === void 0) return null;
|
|
4556
|
+
return Buffer.from(value, "base64").toString("utf-8");
|
|
4557
|
+
}
|
|
4558
|
+
function encodeLongAttribute(value) {
|
|
4559
|
+
if (!Number.isSafeInteger(value)) {
|
|
4560
|
+
throw new RangeError(`Not an integer attribute value: ${value}`);
|
|
4561
|
+
}
|
|
4562
|
+
const bytes = Buffer.alloc(8);
|
|
4563
|
+
bytes.writeBigInt64BE(BigInt(value));
|
|
4564
|
+
return bytes.toString("base64");
|
|
4565
|
+
}
|
|
4566
|
+
|
|
4567
|
+
// src/util/table-entity.ts
|
|
4568
|
+
function buildTableEntity(args) {
|
|
4569
|
+
const now = Date.now();
|
|
4570
|
+
const attributes = { name: encodeTextAttribute(args.name) };
|
|
4571
|
+
const attributeTypes = { name: "text" };
|
|
4572
|
+
if (args.index !== void 0) {
|
|
4573
|
+
attributes.index = encodeLongAttribute(args.index);
|
|
4574
|
+
attributeTypes.index = "integer";
|
|
4575
|
+
}
|
|
4576
|
+
return {
|
|
4577
|
+
projectId: args.projectId,
|
|
4578
|
+
projectBranch: args.projectBranch,
|
|
4579
|
+
entityId: args.entityId,
|
|
4580
|
+
entityBranch: args.entityBranch,
|
|
4581
|
+
head: true,
|
|
4582
|
+
version: 1,
|
|
4583
|
+
type: "table",
|
|
4584
|
+
attributes,
|
|
4585
|
+
attributeTypes,
|
|
4586
|
+
metaAttributes: {},
|
|
4587
|
+
metaAttributeTypes: {},
|
|
4588
|
+
tags: [],
|
|
4589
|
+
modified: now,
|
|
4590
|
+
created: now,
|
|
4591
|
+
versioned: false,
|
|
4592
|
+
versionTtl: null,
|
|
4593
|
+
retain: false,
|
|
4594
|
+
contentAvailable: false,
|
|
4595
|
+
contentLoaded: false,
|
|
4596
|
+
contentType: null,
|
|
4597
|
+
contentSize: null,
|
|
4598
|
+
content: null
|
|
4599
|
+
};
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4602
|
+
// src/commands/table/index.ts
|
|
4603
|
+
import { randomUUID } from "crypto";
|
|
4422
4604
|
function getOutputFormat7(cmd) {
|
|
4423
4605
|
const config = loadConfig();
|
|
4424
4606
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -4441,35 +4623,69 @@ function deriveOutFile(entityId, extension, archive, compression) {
|
|
|
4441
4623
|
}
|
|
4442
4624
|
return name;
|
|
4443
4625
|
}
|
|
4626
|
+
function projectPlacement(table) {
|
|
4627
|
+
return {
|
|
4628
|
+
parent: { projectId: table.projectId, projectBranch: table.projectBranch, entityId: table.projectId, entityBranch: "main" },
|
|
4629
|
+
linkId: "main"
|
|
4630
|
+
};
|
|
4631
|
+
}
|
|
4632
|
+
async function notebookPlacement(api, notebook, table) {
|
|
4633
|
+
const parent = parseEntityReference(notebook, { project: table.projectId, branch: table.projectBranch });
|
|
4634
|
+
if (parent.projectId !== table.projectId || parent.projectBranch !== table.projectBranch) {
|
|
4635
|
+
throw new CliError("The notebook must be in the same project and branch as the table.");
|
|
4636
|
+
}
|
|
4637
|
+
const entity = await api.storage.getEntity(parent, false).catch((error) => {
|
|
4638
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
4639
|
+
throw new CliError(`There is no notebook "${parent.entityId}".`, {
|
|
4640
|
+
hint: `List what the project holds with 'diafunc entity list ${parent.projectId}/${parent.projectBranch}'.`
|
|
4641
|
+
});
|
|
4642
|
+
}
|
|
4643
|
+
throw error;
|
|
4644
|
+
});
|
|
4645
|
+
if (entity.type !== "notebook" && entity.type !== "chapter") {
|
|
4646
|
+
throw new CliError(`"${parent.entityId}" is a ${entity.type ?? "untyped entity"}, not a notebook or chapter.`);
|
|
4647
|
+
}
|
|
4648
|
+
const sections = await api.storage.getLinkedEntities("FORWARD", parent, "sections");
|
|
4649
|
+
const last = sections.map((section) => decodeLongAttribute(section.attributes?.index)).filter((index) => index !== null).reduce((highest, index) => Math.max(highest, index), -1);
|
|
4650
|
+
return { parent, linkId: "sections", index: last + 1 };
|
|
4651
|
+
}
|
|
4652
|
+
function formatReference(ref) {
|
|
4653
|
+
return `${ref.projectId}/${ref.projectBranch}/${ref.entityId}/${ref.entityBranch}`;
|
|
4654
|
+
}
|
|
4444
4655
|
function registerTableCommands(program) {
|
|
4445
4656
|
const table = program.command("table").description("Manage tables").addHelpText("after", `
|
|
4446
4657
|
Examples:
|
|
4658
|
+
$ diafunc table create sales an empty table named "sales"
|
|
4447
4659
|
$ diafunc table view <ref> --rows 0:20 the first twenty rows
|
|
4448
4660
|
$ diafunc table import <ref> data.csv load a file
|
|
4449
4661
|
$ diafunc table export <ref> parquet write one out
|
|
4450
4662
|
$ diafunc table import-formats what can be loaded
|
|
4451
4663
|
`);
|
|
4452
4664
|
;
|
|
4453
|
-
table.command("view").description("View table data").argument("<ref>", "Table entity reference").option("--rows <range>", "
|
|
4665
|
+
table.command("view").description("View table data").argument("<ref>", "Table entity reference").option("--rows <range>", "Rows to show, half-open: 0:10 is the first ten, 6490: runs to the end (default: up to 100)").option("--cols <range>", "Columns to show, half-open: 0:5 is the first five (default: up to 50)").action(async (ref, options, cmd) => {
|
|
4454
4666
|
try {
|
|
4455
4667
|
const outputFormat = getOutputFormat7(cmd);
|
|
4456
4668
|
const overrides = getOverrides6(cmd);
|
|
4457
4669
|
const resolved = parseEntityReference(ref, overrides);
|
|
4458
4670
|
const api = createApiClient();
|
|
4459
|
-
const
|
|
4460
|
-
if (
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
if (!isNaN(from)) request.fromColumn = from;
|
|
4468
|
-
if (!isNaN(to)) request.toColumn = to;
|
|
4671
|
+
const { rows: totalRows, columns: totalColumns } = tableDimensions(await api.storage.getEntity(resolved, false));
|
|
4672
|
+
if (totalRows === 0 || totalColumns === 0) {
|
|
4673
|
+
if (outputFormat === "json") {
|
|
4674
|
+
format({ rows: [], columns: [], cells: [], totalRows, totalColumns, window: null }, { format: outputFormat });
|
|
4675
|
+
} else {
|
|
4676
|
+
console.log(chalk15.dim("Empty table."));
|
|
4677
|
+
}
|
|
4678
|
+
return;
|
|
4469
4679
|
}
|
|
4470
|
-
const
|
|
4680
|
+
const initial = defaultWindow(totalRows, totalColumns);
|
|
4681
|
+
const window = {
|
|
4682
|
+
rows: options.rows ? parseRange(options.rows, totalRows, "Row") : initial.rows,
|
|
4683
|
+
columns: options.cols ? parseRange(options.cols, totalColumns, "Column") : initial.columns
|
|
4684
|
+
};
|
|
4685
|
+
const snapshot = await api.storage.getTableSnapshot(resolved, { cellRanges: [cellRange(window)] });
|
|
4471
4686
|
if (outputFormat === "json") {
|
|
4472
|
-
|
|
4687
|
+
const cells = snapshot.cells.map((cell3) => ({ ...cell3, text: decodeCellValue(cell3.value, cell3.type) }));
|
|
4688
|
+
format({ ...snapshot, cells, totalRows, totalColumns, window }, { format: outputFormat });
|
|
4473
4689
|
return;
|
|
4474
4690
|
}
|
|
4475
4691
|
const colMap = new Map(snapshot.columns.map((c) => [c.index, c]));
|
|
@@ -4477,7 +4693,7 @@ Examples:
|
|
|
4477
4693
|
const colNames = sortedCols.map((c) => c.name || `col${c.index}`);
|
|
4478
4694
|
const cellMap = /* @__PURE__ */ new Map();
|
|
4479
4695
|
for (const cell3 of snapshot.cells) {
|
|
4480
|
-
cellMap.set(`${cell3.rowIndex}:${cell3.columnIndex}`, cell3.value
|
|
4696
|
+
cellMap.set(`${cell3.rowIndex}:${cell3.columnIndex}`, decodeCellValue(cell3.value, cell3.type));
|
|
4481
4697
|
}
|
|
4482
4698
|
const sortedRows = [...snapshot.rows].sort((a, b) => a.index - b.index);
|
|
4483
4699
|
const tableData = sortedRows.map((row2) => {
|
|
@@ -4493,14 +4709,57 @@ Examples:
|
|
|
4493
4709
|
console.log(colNames.map((c) => row2[c] ?? "").join(" "));
|
|
4494
4710
|
}
|
|
4495
4711
|
} else {
|
|
4496
|
-
|
|
4497
|
-
|
|
4712
|
+
format(tableData, { format: outputFormat, columns: colNames.map((name) => ({ key: name, header: name })) });
|
|
4713
|
+
console.log(chalk15.dim(describeWindow(window, totalRows, totalColumns)));
|
|
4714
|
+
}
|
|
4715
|
+
} catch (error) {
|
|
4716
|
+
handleError(error);
|
|
4717
|
+
}
|
|
4718
|
+
});
|
|
4719
|
+
table.command("create").description("Create an empty table, at project level or as a section of a notebook").argument("[ref]", "The new table's entity reference (default: a new id in the default project)").option("--name <name>", 'Display name (defaults to the entity id, or "Table" for a generated id)').option("--notebook <ref>", "Add the table as a section of this notebook or chapter instead of at project level").addHelpText("after", `
|
|
4720
|
+
A table at project level is linked from the project, where 'diafunc entity list' shows it. With --notebook it
|
|
4721
|
+
becomes the notebook's last section, as Add Table in the Lab does. Either way it starts empty; load it with
|
|
4722
|
+
'diafunc table import <ref> <file>'.
|
|
4723
|
+
|
|
4724
|
+
Examples:
|
|
4725
|
+
$ diafunc table create sales --name "Sales 2026"
|
|
4726
|
+
$ diafunc table create --notebook <notebookId>
|
|
4727
|
+
`).action(async (ref, options, cmd) => {
|
|
4728
|
+
try {
|
|
4729
|
+
const outputFormat = getOutputFormat7(cmd);
|
|
4730
|
+
const overrides = getOverrides6(cmd);
|
|
4731
|
+
const resolved = parseEntityReference(ref ?? randomUUID(), overrides);
|
|
4732
|
+
if (resolved.entityId.includes(".partition.")) {
|
|
4733
|
+
throw new CliError(`"${resolved.entityId}" contains ".partition.", which names a table's storage blocks.`, {
|
|
4734
|
+
exitCode: EXIT_USAGE,
|
|
4735
|
+
hint: "Choose an id without it."
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
const api = createApiClient();
|
|
4739
|
+
if (await api.storage.entityExists(resolved)) {
|
|
4740
|
+
throw new CliError(`An entity "${resolved.entityId}" already exists in this project.`, {
|
|
4741
|
+
hint: `Import into it with 'diafunc table import ${formatReference(resolved)} <file>', or choose another id.`
|
|
4742
|
+
});
|
|
4498
4743
|
}
|
|
4744
|
+
const name = options.name ?? (ref ? resolved.entityId : "Table");
|
|
4745
|
+
const placement = options.notebook ? await notebookPlacement(api, options.notebook, resolved) : projectPlacement(resolved);
|
|
4746
|
+
const entity = buildTableEntity({ ...resolved, name, index: placement.index });
|
|
4747
|
+
await api.storage.saveLinkedEntities(placement.parent, placement.linkId, [entity]);
|
|
4748
|
+
const created = formatReference(resolved);
|
|
4749
|
+
if (outputFormat === "json") {
|
|
4750
|
+
format(
|
|
4751
|
+
{ ...resolved, name, parent: placement.parent.entityId, linkId: placement.linkId, index: placement.index ?? null },
|
|
4752
|
+
{ format: outputFormat }
|
|
4753
|
+
);
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4756
|
+
success(`Table "${name}" created: ${created}`);
|
|
4757
|
+
hint(`Load data with 'diafunc table import ${created} <file>'.`);
|
|
4499
4758
|
} catch (error) {
|
|
4500
4759
|
handleError(error);
|
|
4501
4760
|
}
|
|
4502
4761
|
});
|
|
4503
|
-
table.command("import").description("Import data from a file (any supported format
|
|
4762
|
+
table.command("import").description("Import data from a file (any supported format; see `table import-formats`)").argument("<ref>", "Table entity reference").argument("<file>", "File to import").option("--selection <id>", "Pin a sheet / inner-table id for multi-table sources (Excel sheets, SQLite tables, archive entries)").action(async (ref, file, options, cmd) => {
|
|
4504
4763
|
try {
|
|
4505
4764
|
const overrides = getOverrides6(cmd);
|
|
4506
4765
|
const resolved = parseEntityReference(ref, overrides);
|
|
@@ -4516,7 +4775,14 @@ Examples:
|
|
|
4516
4775
|
const importId = await withStatus(
|
|
4517
4776
|
`Uploading ${path3.basename(file)}`,
|
|
4518
4777
|
() => api.storage.importTable(resolved, formData, options.selection)
|
|
4519
|
-
)
|
|
4778
|
+
).catch((error) => {
|
|
4779
|
+
if (error instanceof ApiError && error.status === 404) {
|
|
4780
|
+
throw new CliError(`There is no table "${resolved.entityId}" to import into.`, {
|
|
4781
|
+
hint: `Create it first with 'diafunc table create ${ref}', then import again.`
|
|
4782
|
+
});
|
|
4783
|
+
}
|
|
4784
|
+
throw error;
|
|
4785
|
+
});
|
|
4520
4786
|
const pollInterval = 1e3;
|
|
4521
4787
|
const maxAttempts = 300;
|
|
4522
4788
|
const status = new Status();
|
|
@@ -4541,7 +4807,7 @@ Examples:
|
|
|
4541
4807
|
status.stop();
|
|
4542
4808
|
}
|
|
4543
4809
|
failure(`Import ${importId} is still running after ${formatDuration(pollInterval * maxAttempts)}.`);
|
|
4544
|
-
hint(`It continues on the server
|
|
4810
|
+
hint(`It continues on the server. Check again with 'diafunc table view ${ref}'.`);
|
|
4545
4811
|
process.exit(EXIT_FAILURE);
|
|
4546
4812
|
} catch (error) {
|
|
4547
4813
|
handleError(error);
|
|
@@ -4582,7 +4848,7 @@ Examples:
|
|
|
4582
4848
|
handleError(error);
|
|
4583
4849
|
}
|
|
4584
4850
|
});
|
|
4585
|
-
table.command("export").description("Export table data in any supported format (see `table export-formats`)").argument("<ref>", "Table entity reference").argument("<format>", "Export format (csv, tsv, excel, parquet, arrow, orc, avro, json, jsonl, yaml, xml, html, pdf, sqlite, duckdb, hdf5, netcdf, ...)").option("--out <file>", "Output file").option("--compression <algorithm>", "Compression wrapper: gzip, bzip2, xz, or zstd").option("--archive <algorithm>", "Archive wrapper: zip or tar").option("--rows <range>", "Row range (e.g
|
|
4851
|
+
table.command("export").description("Export table data in any supported format (see `table export-formats`)").argument("<ref>", "Table entity reference").argument("<format>", "Export format (csv, tsv, excel, parquet, arrow, orc, avro, json, jsonl, yaml, xml, html, pdf, sqlite, duckdb, hdf5, netcdf, ...)").option("--out <file>", "Output file").option("--compression <algorithm>", "Compression wrapper: gzip, bzip2, xz, or zstd").option("--archive <algorithm>", "Archive wrapper: zip or tar").option("--rows <range>", "Row range, half-open (e.g. 0:1000)").option("--cols <range>", "Column range, half-open (e.g. 0:5)").option("--delimiter <char>", "CSV/TSV only: single-character delimiter override").option("--quote <char>", 'CSV/TSV only: quote character (use "" for empty)').option("--null <token>", 'CSV/TSV only: null token (default "?")').option("--no-quote-all", "CSV/TSV only: only quote fields when necessary (default quotes every field)").option("--async", "Queue an async export (with progress + later re-download) instead of streaming directly to disk", false).action(async (ref, fmt, options, cmd) => {
|
|
4586
4852
|
try {
|
|
4587
4853
|
const overrides = getOverrides6(cmd);
|
|
4588
4854
|
const resolved = parseEntityReference(ref, overrides);
|
|
@@ -4709,7 +4975,7 @@ Examples:
|
|
|
4709
4975
|
}
|
|
4710
4976
|
if (exp.finished === null) {
|
|
4711
4977
|
const pct = Math.round((exp.progress ?? 0) * 100);
|
|
4712
|
-
console.log(chalk15.dim(`Export in progress: ${pct}
|
|
4978
|
+
console.log(chalk15.dim(`Export in progress: ${pct}%. Check again later.`));
|
|
4713
4979
|
return;
|
|
4714
4980
|
}
|
|
4715
4981
|
if (!exp.succeeded) {
|
|
@@ -4982,7 +5248,7 @@ import * as fs6 from "fs";
|
|
|
4982
5248
|
import * as os2 from "os";
|
|
4983
5249
|
import * as path5 from "path";
|
|
4984
5250
|
import { spawn } from "child_process";
|
|
4985
|
-
import { randomUUID } from "crypto";
|
|
5251
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
4986
5252
|
|
|
4987
5253
|
// src/util/time-uuid.ts
|
|
4988
5254
|
import { randomBytes } from "crypto";
|
|
@@ -5046,11 +5312,11 @@ function buildFunctionEntity(args) {
|
|
|
5046
5312
|
const attributes = {};
|
|
5047
5313
|
const attributeTypes = {};
|
|
5048
5314
|
if (args.language !== null && args.language !== void 0) {
|
|
5049
|
-
attributes.language = args.language;
|
|
5315
|
+
attributes.language = encodeTextAttribute(args.language);
|
|
5050
5316
|
attributeTypes.language = "text";
|
|
5051
5317
|
}
|
|
5052
5318
|
if (args.name !== null && args.name !== void 0) {
|
|
5053
|
-
attributes.name = args.name;
|
|
5319
|
+
attributes.name = encodeTextAttribute(args.name);
|
|
5054
5320
|
attributeTypes.name = "text";
|
|
5055
5321
|
}
|
|
5056
5322
|
return {
|
|
@@ -5395,9 +5661,9 @@ Examples:
|
|
|
5395
5661
|
const api = createApiClient();
|
|
5396
5662
|
const entity = await api.storage.getEntity(resolved, true);
|
|
5397
5663
|
const currentSource = decodeFunctionSource(entity);
|
|
5398
|
-
const language = entity.attributes?.["language"] ?? "txt";
|
|
5664
|
+
const language = decodeTextAttribute(entity.attributes?.["language"]) ?? "txt";
|
|
5399
5665
|
const ext = extensionFor(language);
|
|
5400
|
-
const tmpFile = path5.join(os2.tmpdir(), `diafunc-${resolved.entityId}-${
|
|
5666
|
+
const tmpFile = path5.join(os2.tmpdir(), `diafunc-${resolved.entityId}-${randomUUID2()}.${ext}`);
|
|
5401
5667
|
fs6.writeFileSync(tmpFile, currentSource);
|
|
5402
5668
|
const editor = process.env.VISUAL ?? process.env.EDITOR ?? "vi";
|
|
5403
5669
|
await new Promise((resolve, reject) => {
|
|
@@ -5855,7 +6121,7 @@ var HELP = [
|
|
|
5855
6121
|
];
|
|
5856
6122
|
async function runChatRepl(options) {
|
|
5857
6123
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
5858
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
6124
|
+
const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
|
|
5859
6125
|
let sessionId = options.session;
|
|
5860
6126
|
let lastReportedSession;
|
|
5861
6127
|
console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -6168,14 +6434,14 @@ Examples:
|
|
|
6168
6434
|
projectBranch: projectId ? overrides.branch ?? config.defaults.branch ?? "main" : null
|
|
6169
6435
|
});
|
|
6170
6436
|
const items = dedupe(page.items);
|
|
6171
|
-
if (items.length === 0) {
|
|
6172
|
-
empty("matches", { format: outputFormat });
|
|
6173
|
-
return;
|
|
6174
|
-
}
|
|
6175
6437
|
if (outputFormat === "json") {
|
|
6176
6438
|
format({ ...page, items }, { format: outputFormat });
|
|
6177
6439
|
return;
|
|
6178
6440
|
}
|
|
6441
|
+
if (items.length === 0) {
|
|
6442
|
+
empty("matches", { format: outputFormat });
|
|
6443
|
+
return;
|
|
6444
|
+
}
|
|
6179
6445
|
if (isInteractive()) {
|
|
6180
6446
|
renderResults(items);
|
|
6181
6447
|
} else {
|
|
@@ -6190,7 +6456,7 @@ Examples:
|
|
|
6190
6456
|
});
|
|
6191
6457
|
}
|
|
6192
6458
|
if (page.nextCursor && isInteractive()) {
|
|
6193
|
-
console.log(chalk20.dim(`More results available
|
|
6459
|
+
console.log(chalk20.dim(`More results available. Raise --limit to see them.`));
|
|
6194
6460
|
}
|
|
6195
6461
|
} catch (error) {
|
|
6196
6462
|
handleError(error);
|
|
@@ -6309,12 +6575,32 @@ function registerAdminCommands(program) {
|
|
|
6309
6575
|
settings.command("set").description("Update a setting").argument("<key>", "Setting key").argument("<value>", "Setting value").action(async (key, value) => {
|
|
6310
6576
|
try {
|
|
6311
6577
|
const api = createApiClient();
|
|
6312
|
-
await api.admin.mergeSetting({
|
|
6578
|
+
await api.admin.mergeSetting({ name: key, value });
|
|
6313
6579
|
success(`Setting "${key}" updated.`);
|
|
6314
6580
|
} catch (error) {
|
|
6315
6581
|
handleError(error);
|
|
6316
6582
|
}
|
|
6317
6583
|
});
|
|
6584
|
+
const platformSettings = admin.command("platform-settings").description("Manage platform-wide settings (admin only)");
|
|
6585
|
+
platformSettings.command("list").description("Show every platform setting with its default and current override").action(async (_options, cmd) => {
|
|
6586
|
+
try {
|
|
6587
|
+
const outputFormat = getOutputFormat14(cmd);
|
|
6588
|
+
const api = createApiClient();
|
|
6589
|
+
const settingsList = await api.admin.listPlatformSettings();
|
|
6590
|
+
format(settingsList, { format: outputFormat });
|
|
6591
|
+
} catch (error) {
|
|
6592
|
+
handleError(error);
|
|
6593
|
+
}
|
|
6594
|
+
});
|
|
6595
|
+
platformSettings.command("set").description("Override one platform setting (an empty value restores the default)").argument("<key>", "Setting key, as shown by `platform-settings list`").argument("<value>", "New value; an empty string restores the compiled default").option("--reason <reason>", "Why it was changed; stored alongside the override").action(async (key, value, options) => {
|
|
6596
|
+
try {
|
|
6597
|
+
const api = createApiClient();
|
|
6598
|
+
await api.admin.updatePlatformSetting(key, value, options.reason);
|
|
6599
|
+
success(`Platform setting "${key}" set to "${value}".`);
|
|
6600
|
+
} catch (error) {
|
|
6601
|
+
handleError(error);
|
|
6602
|
+
}
|
|
6603
|
+
});
|
|
6318
6604
|
const backup = admin.command("backup").description("Manage backups");
|
|
6319
6605
|
backup.command("create-full").description("Create a full system short-term backup").option("--long-term", "Create a long-term backup instead").action(async (options) => {
|
|
6320
6606
|
try {
|
|
@@ -6626,7 +6912,6 @@ Examples:
|
|
|
6626
6912
|
}
|
|
6627
6913
|
|
|
6628
6914
|
// src/commands/analyze/index.ts
|
|
6629
|
-
import chalk26 from "chalk";
|
|
6630
6915
|
import * as fs8 from "fs";
|
|
6631
6916
|
import * as path7 from "path";
|
|
6632
6917
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -6644,22 +6929,79 @@ var RUN_PHASE_LABELS = {
|
|
|
6644
6929
|
WRITING: "Writing the report"
|
|
6645
6930
|
};
|
|
6646
6931
|
|
|
6647
|
-
// src/commands/analyze/
|
|
6648
|
-
var
|
|
6649
|
-
|
|
6650
|
-
if (run.overallFraction !== null && run.overallFraction !== void 0) return run.overallFraction;
|
|
6651
|
-
if (run.progressTotal && run.progressTotal > 0) return (run.progressDone ?? 0) / run.progressTotal;
|
|
6652
|
-
return null;
|
|
6653
|
-
}
|
|
6932
|
+
// src/commands/analyze/copy.ts
|
|
6933
|
+
var RUN_STEPS = ["PREPARING", "PROFILING", "DISCOVERING", "EXPLAINING", "WRITING"];
|
|
6934
|
+
var STARTING = "Starting";
|
|
6654
6935
|
function phaseLabel(run) {
|
|
6936
|
+
if (run.state === "QUEUED") return RUN_PHASE_LABELS.QUEUED;
|
|
6937
|
+
if (run.state === "DISPATCHING") return STARTING;
|
|
6655
6938
|
if (run.phase && RUN_PHASE_LABELS[run.phase]) return RUN_PHASE_LABELS[run.phase];
|
|
6939
|
+
if (run.state === "RUNNING" && !((run.progressTotal ?? 0) > 0)) return RUN_PHASE_LABELS.PREPARING;
|
|
6656
6940
|
return run.state.charAt(0) + run.state.slice(1).toLowerCase();
|
|
6657
6941
|
}
|
|
6658
6942
|
function stepCounter(run) {
|
|
6659
6943
|
if (!run.phase) return null;
|
|
6660
|
-
const index =
|
|
6944
|
+
const index = RUN_STEPS.indexOf(run.phase);
|
|
6661
6945
|
if (index < 0) return null;
|
|
6662
|
-
return `step ${index + 1} of ${
|
|
6946
|
+
return `step ${index + 1} of ${RUN_STEPS.length}`;
|
|
6947
|
+
}
|
|
6948
|
+
function runPhaseCell(run) {
|
|
6949
|
+
if (run.state === "COMPLETED") return null;
|
|
6950
|
+
if (run.state === "QUEUED" || run.state === "DISPATCHING") return phaseLabel(run);
|
|
6951
|
+
if (run.phase && RUN_PHASE_LABELS[run.phase]) return RUN_PHASE_LABELS[run.phase];
|
|
6952
|
+
return null;
|
|
6953
|
+
}
|
|
6954
|
+
function latestRunSentence(state) {
|
|
6955
|
+
switch (state) {
|
|
6956
|
+
case "COMPLETED":
|
|
6957
|
+
return "The latest run has already completed.";
|
|
6958
|
+
case "FAILED":
|
|
6959
|
+
return "The latest run failed.";
|
|
6960
|
+
case "CANCELLED":
|
|
6961
|
+
return "The latest run was cancelled.";
|
|
6962
|
+
case "QUEUED":
|
|
6963
|
+
return "The latest run is waiting for a slot.";
|
|
6964
|
+
case "DISPATCHING":
|
|
6965
|
+
return "The latest run is starting.";
|
|
6966
|
+
default:
|
|
6967
|
+
return "The latest run is in progress.";
|
|
6968
|
+
}
|
|
6969
|
+
}
|
|
6970
|
+
function cancelSentence(run) {
|
|
6971
|
+
switch (run.state) {
|
|
6972
|
+
case "CANCELLED":
|
|
6973
|
+
return `Cancelled run ${run.runId}.`;
|
|
6974
|
+
case "COMPLETED":
|
|
6975
|
+
return `Run ${run.runId} had already completed.`;
|
|
6976
|
+
case "FAILED":
|
|
6977
|
+
return `Run ${run.runId} had already failed.`;
|
|
6978
|
+
default:
|
|
6979
|
+
return `Run ${run.runId} is still ${phaseLabel(run).toLowerCase()}.`;
|
|
6980
|
+
}
|
|
6981
|
+
}
|
|
6982
|
+
function terminalSentence(state, duration) {
|
|
6983
|
+
switch (state) {
|
|
6984
|
+
case "COMPLETED":
|
|
6985
|
+
return `Analysis completed in ${duration}.`;
|
|
6986
|
+
case "CANCELLED":
|
|
6987
|
+
return `Analysis cancelled after ${duration}.`;
|
|
6988
|
+
default:
|
|
6989
|
+
return `Analysis failed after ${duration}.`;
|
|
6990
|
+
}
|
|
6991
|
+
}
|
|
6992
|
+
|
|
6993
|
+
// src/commands/analyze/watch-view.ts
|
|
6994
|
+
function overallProgress(run) {
|
|
6995
|
+
if (run.overallFraction !== null && run.overallFraction !== void 0) return run.overallFraction;
|
|
6996
|
+
if (run.progressTotal && run.progressTotal > 0) return (run.progressDone ?? 0) / run.progressTotal;
|
|
6997
|
+
return null;
|
|
6998
|
+
}
|
|
6999
|
+
function remainingCeiling(run, budgetHours) {
|
|
7000
|
+
if (run.phase !== "DISCOVERING") return null;
|
|
7001
|
+
if (budgetHours === null || !Number.isFinite(budgetHours) || budgetHours <= 0) return null;
|
|
7002
|
+
const fraction = run.phaseFraction;
|
|
7003
|
+
if (fraction === null || fraction === void 0) return null;
|
|
7004
|
+
return Math.max(0, budgetHours * 36e5 * (1 - Math.max(0, Math.min(fraction, 1))));
|
|
6663
7005
|
}
|
|
6664
7006
|
function phaseDetail(run) {
|
|
6665
7007
|
const parts = [];
|
|
@@ -6668,7 +7010,7 @@ function phaseDetail(run) {
|
|
|
6668
7010
|
parts.push(`generation ${formatNumber(run.fitGeneration)}`);
|
|
6669
7011
|
}
|
|
6670
7012
|
if (run.fitQuality !== null && run.fitQuality !== void 0) {
|
|
6671
|
-
parts.push(`quality ${run.fitQuality
|
|
7013
|
+
parts.push(`quality ${Math.floor(Math.max(0, Math.min(run.fitQuality, 1)) * 100)}%`);
|
|
6672
7014
|
}
|
|
6673
7015
|
if (run.fitBudgetFraction !== null && run.fitBudgetFraction !== void 0) {
|
|
6674
7016
|
parts.push(`${Math.round(run.fitBudgetFraction * 100)}% of budget used`);
|
|
@@ -6682,7 +7024,7 @@ function phaseDetail(run) {
|
|
|
6682
7024
|
return parts.length > 0 ? parts.join(" \xB7 ") : null;
|
|
6683
7025
|
}
|
|
6684
7026
|
function renderWatchBlock(input) {
|
|
6685
|
-
const { run, elapsedMs, caption } = input;
|
|
7027
|
+
const { run, elapsedMs, caption, budgetHours } = input;
|
|
6686
7028
|
const lines = [];
|
|
6687
7029
|
const step = stepCounter(run);
|
|
6688
7030
|
const headline = [
|
|
@@ -6692,30 +7034,24 @@ function renderWatchBlock(input) {
|
|
|
6692
7034
|
].filter(Boolean).join(" ");
|
|
6693
7035
|
lines.push(` ${headline}`);
|
|
6694
7036
|
const fraction = overallProgress(run);
|
|
6695
|
-
const elapsed = chalk24.dim(
|
|
7037
|
+
const elapsed = chalk24.dim(formatDurationPrecise(elapsedMs));
|
|
6696
7038
|
if (fraction === null) {
|
|
6697
7039
|
lines.push(` ${chalk24.dim("working")} ${elapsed}`);
|
|
6698
7040
|
} else {
|
|
6699
|
-
const
|
|
7041
|
+
const ceiling = remainingCeiling(run, budgetHours);
|
|
6700
7042
|
lines.push(
|
|
6701
|
-
` ${bar(fraction)} ${percent(fraction)} ${elapsed}` + (
|
|
7043
|
+
` ${bar(fraction)} ${percent(fraction)} ${elapsed}` + (ceiling !== null ? chalk24.dim(` \xB7 at most ${formatDurationPrecise(ceiling)} remaining`) : "")
|
|
6702
7044
|
);
|
|
6703
7045
|
}
|
|
6704
7046
|
const detail2 = caption ?? phaseDetail(run);
|
|
6705
7047
|
if (detail2) lines.push(` ${chalk24.dim(detail2)}`);
|
|
6706
7048
|
if (run.retryAttempts && run.retryAttempts > 0) {
|
|
6707
7049
|
lines.push(` ${chalk24.yellow("!")} ${chalk24.dim(
|
|
6708
|
-
`restarted ${run.retryAttempts === 1 ? "once" : `${run.retryAttempts} times`} after an interruption
|
|
7050
|
+
`restarted ${run.retryAttempts === 1 ? "once" : `${run.retryAttempts} times`} after an interruption; progress restarts from the beginning`
|
|
6709
7051
|
)}`);
|
|
6710
7052
|
}
|
|
6711
7053
|
return lines;
|
|
6712
7054
|
}
|
|
6713
|
-
function estimateRemaining(fraction, elapsedMs) {
|
|
6714
|
-
if (fraction <= 0.02 || fraction >= 1 || elapsedMs < 3e4) return null;
|
|
6715
|
-
const total = elapsedMs / fraction;
|
|
6716
|
-
const remaining = total - elapsedMs;
|
|
6717
|
-
return remaining > 0 ? remaining : null;
|
|
6718
|
-
}
|
|
6719
7055
|
|
|
6720
7056
|
// src/commands/analyze/wizard.ts
|
|
6721
7057
|
import chalk25 from "chalk";
|
|
@@ -6795,7 +7131,7 @@ async function promptRunFields(prompter, options) {
|
|
|
6795
7131
|
if (named.length > 0) {
|
|
6796
7132
|
const preselected = new Set(defaultTargets(named));
|
|
6797
7133
|
targets = await prompter.checkbox({
|
|
6798
|
-
message: "Target
|
|
7134
|
+
message: "Target columns: what should the analysis predict?",
|
|
6799
7135
|
choices: named.map((c) => ({
|
|
6800
7136
|
name: c.valueType ? `${c.name} ${chalk25.dim(`(${c.valueType})`)}` : c.name,
|
|
6801
7137
|
value: c.name,
|
|
@@ -6867,7 +7203,7 @@ async function promptRunFields(prompter, options) {
|
|
|
6867
7203
|
}
|
|
6868
7204
|
if (hours === void 0) {
|
|
6869
7205
|
hours = await prompter.input({
|
|
6870
|
-
message: "Computation time
|
|
7206
|
+
message: "Computation time (hours)",
|
|
6871
7207
|
default: DEFAULT_HOURS,
|
|
6872
7208
|
validate: positiveNumber("Computation time")
|
|
6873
7209
|
});
|
|
@@ -7024,13 +7360,18 @@ function parseCsv(value) {
|
|
|
7024
7360
|
function parseVisibility(value) {
|
|
7025
7361
|
const upper = value.toUpperCase();
|
|
7026
7362
|
if (upper !== "PRIVATE" && upper !== "PUBLIC") {
|
|
7027
|
-
throw new Error(`Invalid visibility "${value}"
|
|
7363
|
+
throw new Error(`Invalid visibility "${value}". Use PRIVATE or PUBLIC.`);
|
|
7028
7364
|
}
|
|
7029
7365
|
return upper;
|
|
7030
7366
|
}
|
|
7031
7367
|
function isTerminalState(state) {
|
|
7032
7368
|
return state === "COMPLETED" || state === "FAILED" || state === "CANCELLED";
|
|
7033
7369
|
}
|
|
7370
|
+
function budgetHoursOf(hours) {
|
|
7371
|
+
if (hours === null || hours === void 0) return null;
|
|
7372
|
+
const parsed = Number(hours);
|
|
7373
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
7374
|
+
}
|
|
7034
7375
|
function multipartFromFile(file) {
|
|
7035
7376
|
const buffer = fs8.readFileSync(file);
|
|
7036
7377
|
const blob = new Blob([buffer]);
|
|
@@ -7055,6 +7396,7 @@ async function runAnalysis(file, options, cmd) {
|
|
|
7055
7396
|
const opt = await api.analysis.getPreset(options.preset);
|
|
7056
7397
|
if (!opt.preset) {
|
|
7057
7398
|
failure(`Preset not found: ${options.preset}`);
|
|
7399
|
+
hint(`List your presets with 'diafunc analyze presets list'.`);
|
|
7058
7400
|
process.exit(EXIT_FAILURE);
|
|
7059
7401
|
}
|
|
7060
7402
|
const p = opt.preset;
|
|
@@ -7099,20 +7441,22 @@ async function runAnalysis(file, options, cmd) {
|
|
|
7099
7441
|
`Uploading ${path7.basename(file)}`,
|
|
7100
7442
|
() => api.analysis.uploadDataMultipart(created.analysisId, multipartFromFile(file))
|
|
7101
7443
|
);
|
|
7444
|
+
let runHours = request.hours;
|
|
7102
7445
|
if (interactive) {
|
|
7103
|
-
const
|
|
7446
|
+
const configuredHours = await configureInteractively(api, prompter, created.analysisId, request, {
|
|
7104
7447
|
targets: options.targets === void 0 ? void 0 : parseCsv(options.targets),
|
|
7105
7448
|
segment: options.segment,
|
|
7106
7449
|
questions: options.questions === void 0 ? void 0 : parseCsv(options.questions),
|
|
7107
7450
|
hours: options.hours,
|
|
7108
7451
|
budget: options.budget
|
|
7109
7452
|
});
|
|
7110
|
-
if (
|
|
7453
|
+
if (configuredHours === null) return;
|
|
7454
|
+
runHours = configuredHours;
|
|
7111
7455
|
}
|
|
7112
7456
|
const run = await withStatus("Queuing analysis run", () => api.analysis.runAnalysis(created.analysisId));
|
|
7113
7457
|
detail(`runId: ${run.runId}`);
|
|
7114
7458
|
console.log();
|
|
7115
|
-
await monitorRun(api, created.analysisId, run.runId, cmd);
|
|
7459
|
+
await monitorRun(api, created.analysisId, run.runId, budgetHoursOf(runHours), cmd);
|
|
7116
7460
|
}
|
|
7117
7461
|
async function configureInteractively(api, prompter, analysisId, recipe, supplied) {
|
|
7118
7462
|
const columns = await readColumns(api, analysisId);
|
|
@@ -7140,9 +7484,9 @@ async function configureInteractively(api, prompter, analysisId, recipe, supplie
|
|
|
7140
7484
|
if (!await prompter.confirm({ message: "Start the analysis?", default: true })) {
|
|
7141
7485
|
warn("Not started. The analysis and these settings are saved.");
|
|
7142
7486
|
hint(`Start it later with 'diafunc analyze rerun ${analysisId}'.`);
|
|
7143
|
-
return
|
|
7487
|
+
return null;
|
|
7144
7488
|
}
|
|
7145
|
-
return
|
|
7489
|
+
return answers.hours;
|
|
7146
7490
|
}
|
|
7147
7491
|
async function readColumns(api, analysisId) {
|
|
7148
7492
|
for (let attempt = 0; attempt < COLUMN_READ_ATTEMPTS; attempt++) {
|
|
@@ -7163,7 +7507,7 @@ async function readPresets(api) {
|
|
|
7163
7507
|
return [];
|
|
7164
7508
|
}
|
|
7165
7509
|
}
|
|
7166
|
-
async function monitorRun(api, analysisId, runId, cmd) {
|
|
7510
|
+
async function monitorRun(api, analysisId, runId, budgetHours, cmd) {
|
|
7167
7511
|
const config = loadConfig();
|
|
7168
7512
|
const outputFormat = getOutputFormat15(cmd);
|
|
7169
7513
|
const human = outputFormat === "human";
|
|
@@ -7204,7 +7548,7 @@ async function monitorRun(api, analysisId, runId, cmd) {
|
|
|
7204
7548
|
}
|
|
7205
7549
|
const startedAt = run.startedAt ?? run.submittedAt ?? Date.now();
|
|
7206
7550
|
if (human) {
|
|
7207
|
-
status.set(renderWatchBlock({ run, elapsedMs: Date.now() - startedAt, caption }));
|
|
7551
|
+
status.set(renderWatchBlock({ run, elapsedMs: Date.now() - startedAt, caption, budgetHours }));
|
|
7208
7552
|
} else {
|
|
7209
7553
|
const snapshot = JSON.stringify({
|
|
7210
7554
|
type: "progress",
|
|
@@ -7247,16 +7591,17 @@ async function reportTerminalRun(api, config, run, analysisId, runId, outputForm
|
|
|
7247
7591
|
return;
|
|
7248
7592
|
}
|
|
7249
7593
|
console.log();
|
|
7594
|
+
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs));
|
|
7250
7595
|
if (run.state === "COMPLETED") {
|
|
7251
|
-
success(
|
|
7596
|
+
success(sentence);
|
|
7252
7597
|
await printNotebookLink(api, config, analysisId);
|
|
7253
7598
|
return;
|
|
7254
7599
|
}
|
|
7255
7600
|
if (run.state === "CANCELLED") {
|
|
7256
|
-
warn(
|
|
7601
|
+
warn(sentence);
|
|
7257
7602
|
process.exit(EXIT_FAILURE);
|
|
7258
7603
|
}
|
|
7259
|
-
failure(
|
|
7604
|
+
failure(sentence);
|
|
7260
7605
|
if (run.errorMessage) hint(run.errorMessage);
|
|
7261
7606
|
hint(`Queue a fresh run with 'diafunc analyze rerun ${analysisId}'.`);
|
|
7262
7607
|
process.exit(EXIT_FAILURE);
|
|
@@ -7307,7 +7652,7 @@ async function getAnalysisDetails(analysisId, options, cmd) {
|
|
|
7307
7652
|
const analysis = outputFormat === "human" && !options.full ? { ...result.analysis, introduction: abbreviate(result.analysis.introduction) } : result.analysis;
|
|
7308
7653
|
format(analysis, { format: outputFormat });
|
|
7309
7654
|
if (outputFormat === "human" && !options.full && isLong(result.analysis.introduction)) {
|
|
7310
|
-
hint(
|
|
7655
|
+
hint("Introduction abbreviated. Pass --full to print it whole.");
|
|
7311
7656
|
}
|
|
7312
7657
|
}
|
|
7313
7658
|
var INTRODUCTION_PREVIEW_LINES = 3;
|
|
@@ -7327,31 +7672,26 @@ async function watchAnalysis(analysisId, cmd) {
|
|
|
7327
7672
|
empty("analysis found");
|
|
7328
7673
|
return;
|
|
7329
7674
|
}
|
|
7330
|
-
const
|
|
7331
|
-
const runs = await api.analysis.getRunsForAnalysis(
|
|
7675
|
+
const analysis = result.analysis;
|
|
7676
|
+
const runs = await api.analysis.getRunsForAnalysis(analysis.analysisId, 1);
|
|
7332
7677
|
if (runs.length === 0) {
|
|
7333
7678
|
empty("runs for this analysis");
|
|
7334
7679
|
return;
|
|
7335
7680
|
}
|
|
7336
7681
|
const latest = runs[0];
|
|
7337
7682
|
if (isTerminalState(latest.state)) {
|
|
7683
|
+
const sentence = latestRunSentence(latest.state);
|
|
7338
7684
|
if (latest.state === "COMPLETED") {
|
|
7339
|
-
success(
|
|
7685
|
+
success(sentence);
|
|
7340
7686
|
} else {
|
|
7341
|
-
warn(
|
|
7687
|
+
warn(sentence);
|
|
7342
7688
|
if (latest.errorMessage) hint(latest.errorMessage);
|
|
7343
7689
|
}
|
|
7344
|
-
|
|
7345
|
-
const nav = await api.analysis.getNavigation(recipe.analysisId);
|
|
7346
|
-
const config = loadConfig();
|
|
7347
|
-
const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
|
|
7348
|
-
console.log(` Project: ${endpoint}${nav.labUrl}`);
|
|
7349
|
-
} catch {
|
|
7350
|
-
}
|
|
7690
|
+
await printNotebookLink(api, loadConfig(), analysis.analysisId);
|
|
7351
7691
|
return;
|
|
7352
7692
|
}
|
|
7353
|
-
console.log(`Watching run ${latest.runId} for analysis ${
|
|
7354
|
-
await monitorRun(api,
|
|
7693
|
+
console.log(`Watching run ${latest.runId} for analysis ${analysis.analysisId} ...`);
|
|
7694
|
+
await monitorRun(api, analysis.analysisId, latest.runId, budgetHoursOf(analysis.hours), cmd);
|
|
7355
7695
|
}
|
|
7356
7696
|
async function rerunAnalysis(analysisId, cmd) {
|
|
7357
7697
|
const api = createApiClient();
|
|
@@ -7384,20 +7724,18 @@ async function rerunAnalysis(analysisId, cmd) {
|
|
|
7384
7724
|
questions: analysis.questions,
|
|
7385
7725
|
segment: analysis.segment
|
|
7386
7726
|
};
|
|
7387
|
-
const
|
|
7727
|
+
const configuredHours = await configureInteractively(
|
|
7388
7728
|
api,
|
|
7389
7729
|
createInquirerPrompter(),
|
|
7390
7730
|
analysisId,
|
|
7391
7731
|
recipe,
|
|
7392
7732
|
suppliedFromAnalysis(analysis)
|
|
7393
7733
|
);
|
|
7394
|
-
if (
|
|
7734
|
+
if (configuredHours === null) return;
|
|
7395
7735
|
}
|
|
7396
7736
|
const run = await api.analysis.runAnalysis(analysisId);
|
|
7397
|
-
success(`Queued
|
|
7398
|
-
|
|
7399
|
-
console.log();
|
|
7400
|
-
console.log(chalk26.dim("Track progress: diafunc analyze watch " + analysisId));
|
|
7737
|
+
success(`Queued run ${run.runId} for analysis ${analysisId}.`);
|
|
7738
|
+
hint(`Follow it with 'diafunc analyze watch ${analysisId}'.`);
|
|
7401
7739
|
}
|
|
7402
7740
|
async function openAnalysis(analysisId) {
|
|
7403
7741
|
const api = createApiClient();
|
|
@@ -7414,10 +7752,10 @@ async function openAnalysis(analysisId) {
|
|
|
7414
7752
|
console.log(`Opening ${url} ...`);
|
|
7415
7753
|
openUrl(url);
|
|
7416
7754
|
} catch {
|
|
7417
|
-
|
|
7755
|
+
hint("The notebook is not available yet. Run the analysis first.");
|
|
7418
7756
|
}
|
|
7419
7757
|
}
|
|
7420
|
-
async function
|
|
7758
|
+
async function createAnalysis(options, cmd) {
|
|
7421
7759
|
const outputFormat = getOutputFormat15(cmd);
|
|
7422
7760
|
const api = createApiClient();
|
|
7423
7761
|
const visibility = parseVisibility(options.visibility);
|
|
@@ -7438,14 +7776,14 @@ async function createRecipe(options, cmd) {
|
|
|
7438
7776
|
async function deleteAnalysis(analysisId) {
|
|
7439
7777
|
const api = createApiClient();
|
|
7440
7778
|
await api.analysis.delete(analysisId);
|
|
7441
|
-
success(`Deleted analysis ${analysisId}
|
|
7779
|
+
success(`Deleted analysis ${analysisId}.`);
|
|
7442
7780
|
}
|
|
7443
7781
|
async function patchAndPrint(analysisId, value, handler, successLabel, cmd) {
|
|
7444
7782
|
const outputFormat = getOutputFormat15(cmd);
|
|
7445
7783
|
const api = createApiClient();
|
|
7446
7784
|
const updated = await handler(api, analysisId, value);
|
|
7447
7785
|
if (outputFormat === "human") {
|
|
7448
|
-
success(`${successLabel} updated for analysis ${analysisId}
|
|
7786
|
+
success(`${successLabel} updated for analysis ${analysisId}.`);
|
|
7449
7787
|
} else {
|
|
7450
7788
|
format(updated, { format: outputFormat });
|
|
7451
7789
|
}
|
|
@@ -7479,7 +7817,8 @@ async function listColumns(analysisId, cmd) {
|
|
|
7479
7817
|
const api = createApiClient();
|
|
7480
7818
|
const columns = await api.analysis.getColumns(analysisId);
|
|
7481
7819
|
if (columns.length === 0) {
|
|
7482
|
-
empty("columns
|
|
7820
|
+
empty("columns", { format: outputFormat });
|
|
7821
|
+
if (outputFormat === "human") hint(`Upload data first: diafunc analyze upload ${analysisId} data.csv`);
|
|
7483
7822
|
return;
|
|
7484
7823
|
}
|
|
7485
7824
|
format(columns, { format: outputFormat, columns: ["name", "valueType"] });
|
|
@@ -7491,10 +7830,11 @@ async function listRuns(analysisId, count, cmd) {
|
|
|
7491
7830
|
format(runs.map((r) => ({
|
|
7492
7831
|
runId: r.runId,
|
|
7493
7832
|
state: r.state,
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7833
|
+
phase: runPhaseCell(r),
|
|
7834
|
+
submittedAt: r.submittedAt,
|
|
7835
|
+
startedAt: r.startedAt,
|
|
7836
|
+
endedAt: r.endedAt,
|
|
7837
|
+
evaluationId: r.evaluationId
|
|
7498
7838
|
})), {
|
|
7499
7839
|
format: outputFormat,
|
|
7500
7840
|
columns: [
|
|
@@ -7511,7 +7851,11 @@ async function cancelRun(runId, cmd) {
|
|
|
7511
7851
|
const api = createApiClient();
|
|
7512
7852
|
const run = await api.analysis.cancelRun(runId);
|
|
7513
7853
|
if (outputFormat === "human") {
|
|
7514
|
-
|
|
7854
|
+
if (run.state === "CANCELLED") {
|
|
7855
|
+
success(cancelSentence(run));
|
|
7856
|
+
} else {
|
|
7857
|
+
warn(cancelSentence(run));
|
|
7858
|
+
}
|
|
7515
7859
|
} else {
|
|
7516
7860
|
format(run, { format: outputFormat });
|
|
7517
7861
|
}
|
|
@@ -7521,16 +7865,24 @@ async function listPresets(cmd) {
|
|
|
7521
7865
|
const api = createApiClient();
|
|
7522
7866
|
const presets = await api.analysis.getPresets();
|
|
7523
7867
|
format(presets.map((p) => ({
|
|
7524
|
-
presetId: p.presetId
|
|
7868
|
+
presetId: p.presetId,
|
|
7525
7869
|
name: p.name,
|
|
7526
7870
|
targets: p.targetKeys.join(", "),
|
|
7527
7871
|
questions: p.questions.length,
|
|
7528
|
-
segment: p.segmentKey
|
|
7872
|
+
segment: p.segmentKey,
|
|
7529
7873
|
hours: p.time,
|
|
7530
7874
|
budget: p.budget
|
|
7531
7875
|
})), {
|
|
7532
7876
|
format: outputFormat,
|
|
7533
|
-
columns: [
|
|
7877
|
+
columns: [
|
|
7878
|
+
{ key: "presetId", kind: "id" },
|
|
7879
|
+
"name",
|
|
7880
|
+
"targets",
|
|
7881
|
+
"questions",
|
|
7882
|
+
"segment",
|
|
7883
|
+
"hours",
|
|
7884
|
+
"budget"
|
|
7885
|
+
]
|
|
7534
7886
|
});
|
|
7535
7887
|
}
|
|
7536
7888
|
async function getPreset(presetId, cmd) {
|
|
@@ -7538,7 +7890,7 @@ async function getPreset(presetId, cmd) {
|
|
|
7538
7890
|
const api = createApiClient();
|
|
7539
7891
|
const opt = await api.analysis.getPreset(presetId);
|
|
7540
7892
|
if (!opt.preset) {
|
|
7541
|
-
|
|
7893
|
+
empty("preset found", { format: outputFormat });
|
|
7542
7894
|
return;
|
|
7543
7895
|
}
|
|
7544
7896
|
format(opt.preset, { format: outputFormat });
|
|
@@ -7561,7 +7913,7 @@ async function savePreset(options, cmd) {
|
|
|
7561
7913
|
async function deletePreset(presetId) {
|
|
7562
7914
|
const api = createApiClient();
|
|
7563
7915
|
await api.analysis.deletePreset(presetId);
|
|
7564
|
-
success(`Deleted preset ${presetId}
|
|
7916
|
+
success(`Deleted preset ${presetId}.`);
|
|
7565
7917
|
}
|
|
7566
7918
|
async function listTriggers(analysisId, cmd) {
|
|
7567
7919
|
const outputFormat = getOutputFormat15(cmd);
|
|
@@ -7572,18 +7924,24 @@ async function listTriggers(analysisId, cmd) {
|
|
|
7572
7924
|
kind: t.kind,
|
|
7573
7925
|
schedule: t.scheduleSpec,
|
|
7574
7926
|
active: t.active,
|
|
7575
|
-
nextFireAt: t.nextFireAt
|
|
7927
|
+
nextFireAt: t.nextFireAt
|
|
7576
7928
|
})), {
|
|
7577
7929
|
format: outputFormat,
|
|
7578
|
-
columns: [
|
|
7930
|
+
columns: [
|
|
7931
|
+
{ key: "triggerId", kind: "id" },
|
|
7932
|
+
"kind",
|
|
7933
|
+
"schedule",
|
|
7934
|
+
{ key: "active", kind: "boolean" },
|
|
7935
|
+
{ key: "nextFireAt", header: "next fire", kind: "date" }
|
|
7936
|
+
]
|
|
7579
7937
|
});
|
|
7580
7938
|
}
|
|
7581
7939
|
async function createTrigger(analysisId, kind, schedule, cmd) {
|
|
7582
7940
|
const outputFormat = getOutputFormat15(cmd);
|
|
7583
7941
|
const upper = kind.toUpperCase();
|
|
7584
7942
|
if (upper !== "ONCE" && upper !== "CRON") {
|
|
7585
|
-
failure(`Invalid kind "${kind}"
|
|
7586
|
-
process.exit(
|
|
7943
|
+
failure(`Invalid kind "${kind}". Use ONCE or CRON.`);
|
|
7944
|
+
process.exit(EXIT_FAILURE);
|
|
7587
7945
|
}
|
|
7588
7946
|
const api = createApiClient();
|
|
7589
7947
|
const trigger = await api.analysis.createTrigger(analysisId, {
|
|
@@ -7595,7 +7953,7 @@ async function createTrigger(analysisId, kind, schedule, cmd) {
|
|
|
7595
7953
|
async function deleteTrigger(triggerId) {
|
|
7596
7954
|
const api = createApiClient();
|
|
7597
7955
|
await api.analysis.deleteTrigger(triggerId);
|
|
7598
|
-
success(`Deleted trigger ${triggerId}
|
|
7956
|
+
success(`Deleted trigger ${triggerId}.`);
|
|
7599
7957
|
}
|
|
7600
7958
|
async function updateTriggerCmd(triggerId, options, cmd) {
|
|
7601
7959
|
const outputFormat = getOutputFormat15(cmd);
|
|
@@ -7603,14 +7961,14 @@ async function updateTriggerCmd(triggerId, options, cmd) {
|
|
|
7603
7961
|
if (options.active !== void 0) {
|
|
7604
7962
|
const lc = options.active.toLowerCase();
|
|
7605
7963
|
if (lc !== "true" && lc !== "false") {
|
|
7606
|
-
failure(`Invalid --active value "${options.active}"
|
|
7607
|
-
process.exit(
|
|
7964
|
+
failure(`Invalid --active value "${options.active}". Use true or false.`);
|
|
7965
|
+
process.exit(EXIT_FAILURE);
|
|
7608
7966
|
}
|
|
7609
7967
|
activeFlag = lc === "true";
|
|
7610
7968
|
}
|
|
7611
7969
|
if (activeFlag === void 0 && !options.schedule) {
|
|
7612
7970
|
failure("Pass at least one of --active or --schedule.");
|
|
7613
|
-
process.exit(
|
|
7971
|
+
process.exit(EXIT_FAILURE);
|
|
7614
7972
|
}
|
|
7615
7973
|
const api = createApiClient();
|
|
7616
7974
|
const trigger = await api.analysis.updateTrigger(triggerId, {
|
|
@@ -7621,7 +7979,7 @@ async function updateTriggerCmd(triggerId, options, cmd) {
|
|
|
7621
7979
|
}
|
|
7622
7980
|
function registerAnalyzeCommand(program) {
|
|
7623
7981
|
const analyze = program.command("analyze").description("Run and manage automatic analyses");
|
|
7624
|
-
analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[file]", "CSV
|
|
7982
|
+
analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[file]", "Data file to analyze (CSV, Excel, Parquet, JSON and 20+ more formats)").option("--name <name>", "Analysis name (asked for, or derived from the filename)").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC (default: PRIVATE)").option("--hours <hours>", `Computation time (hours). Default ${DEFAULT_HOURS}, the Standard preset; a saved preset applies when omitted`).option("--budget <credits>", `Credit budget. Default ${Number(DEFAULT_BUDGET).toLocaleString("en-US")}, the Standard preset; a saved preset applies when omitted`).option("--targets <csv>", "Comma-separated target column names (required when not interactive)").option("--questions <csv>", "Comma-separated questions to answer").option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").option("--preset <id>", "Apply a saved preset as defaults (explicit flags override it)").action(async (file, options, cmd) => {
|
|
7625
7983
|
try {
|
|
7626
7984
|
if (!file) {
|
|
7627
7985
|
analyze.help();
|
|
@@ -7646,7 +8004,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7646
8004
|
handleError(error);
|
|
7647
8005
|
}
|
|
7648
8006
|
});
|
|
7649
|
-
analyze.command("watch").description("
|
|
8007
|
+
analyze.command("watch").description("Follow the latest run of an analysis live").argument("[id]", "Analysis ID (defaults to the most recent)").action(async (id, _options, cmd) => {
|
|
7650
8008
|
try {
|
|
7651
8009
|
await watchAnalysis(id, cmd);
|
|
7652
8010
|
} catch (error) {
|
|
@@ -7667,14 +8025,14 @@ function registerAnalyzeCommand(program) {
|
|
|
7667
8025
|
reportCommandError(error);
|
|
7668
8026
|
}
|
|
7669
8027
|
});
|
|
7670
|
-
analyze.command("create").description("Create an analysis
|
|
8028
|
+
analyze.command("create").description("Create an analysis without uploading data or running it").option("--name <name>", "Analysis name").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC", "PRIVATE").option("--hours <hours>", "Computation time (hours)").option("--budget <credits>", "Credit budget").option("--targets <csv>", "Comma-separated target column names").option("--questions <csv>", "Comma-separated questions").option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").action(async (options, cmd) => {
|
|
7671
8029
|
try {
|
|
7672
|
-
await
|
|
8030
|
+
await createAnalysis(options, cmd);
|
|
7673
8031
|
} catch (error) {
|
|
7674
8032
|
handleError(error);
|
|
7675
8033
|
}
|
|
7676
8034
|
});
|
|
7677
|
-
analyze.command("delete").description("Delete an analysis
|
|
8035
|
+
analyze.command("delete").description("Delete an analysis, cancelling any run still in flight").argument("<id>", "Analysis ID").option("-y, --yes", "Skip confirmation prompt (for CI / scripted use)").action(async (id, options) => {
|
|
7678
8036
|
try {
|
|
7679
8037
|
await confirmDestructive(`This will permanently delete analysis "${id}".`, { yes: options.yes, resourceId: id });
|
|
7680
8038
|
await deleteAnalysis(id);
|
|
@@ -7735,7 +8093,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7735
8093
|
handleError(error);
|
|
7736
8094
|
}
|
|
7737
8095
|
});
|
|
7738
|
-
analyze.command("hours").description("Set the
|
|
8096
|
+
analyze.command("hours").description("Set the computation time (hours) for the next run").argument("<id>", "Analysis ID").argument("<hours>", "Computation time (hours), e.g. 4").action(async (id, hours, _options, cmd) => {
|
|
7739
8097
|
try {
|
|
7740
8098
|
await patchAndPrint(
|
|
7741
8099
|
id,
|
|
@@ -7748,7 +8106,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7748
8106
|
handleError(error);
|
|
7749
8107
|
}
|
|
7750
8108
|
});
|
|
7751
|
-
analyze.command("budget").description("Set the
|
|
8109
|
+
analyze.command("budget").description("Set the credit budget for the next run").argument("<id>", "Analysis ID").argument("<credits>", "Credit budget, e.g. 10000").action(async (id, credits, _options, cmd) => {
|
|
7752
8110
|
try {
|
|
7753
8111
|
await patchAndPrint(
|
|
7754
8112
|
id,
|
|
@@ -7802,14 +8160,14 @@ function registerAnalyzeCommand(program) {
|
|
|
7802
8160
|
handleError(error);
|
|
7803
8161
|
}
|
|
7804
8162
|
});
|
|
7805
|
-
analyze.command("upload").description("Replace the analysis
|
|
8163
|
+
analyze.command("upload").description("Replace the analysis data with a new file (any supported format; see `table import-formats`)").argument("<id>", "Analysis ID").argument("[file]", "Data file to upload (CSV, Excel, Parquet, JSON and 20+ more formats)").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").action(async (id, file, options) => {
|
|
7806
8164
|
try {
|
|
7807
8165
|
await uploadData(id, file, options);
|
|
7808
8166
|
} catch (error) {
|
|
7809
8167
|
handleError(error);
|
|
7810
8168
|
}
|
|
7811
8169
|
});
|
|
7812
|
-
analyze.command("columns").description("List columns of the analysis
|
|
8170
|
+
analyze.command("columns").description("List the columns of the analysis data").argument("<id>", "Analysis ID").action(async (id, _options, cmd) => {
|
|
7813
8171
|
try {
|
|
7814
8172
|
await listColumns(id, cmd);
|
|
7815
8173
|
} catch (error) {
|
|
@@ -7823,7 +8181,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7823
8181
|
handleError(error);
|
|
7824
8182
|
}
|
|
7825
8183
|
});
|
|
7826
|
-
analyze.command("cancel").description("Cancel a
|
|
8184
|
+
analyze.command("cancel").description("Cancel a run that has not finished (a finished run is left as it is)").argument("<runId>", "Run ID to cancel").action(async (runId, _options, cmd) => {
|
|
7827
8185
|
try {
|
|
7828
8186
|
await cancelRun(runId, cmd);
|
|
7829
8187
|
} catch (error) {
|
|
@@ -7845,7 +8203,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7845
8203
|
handleError(error);
|
|
7846
8204
|
}
|
|
7847
8205
|
});
|
|
7848
|
-
presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <csv>", "Comma-separated target column names").requiredOption("--hours <
|
|
8206
|
+
presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <csv>", "Comma-separated target column names").requiredOption("--hours <hours>", "Computation time (hours)").requiredOption("--budget <credits>", "Credit budget").option("--questions <csv>", "Comma-separated questions").option("--segment <name>", "Column to segment the analysis by").option("--id <id>", "Existing preset ID (update mode)").action(async (options, cmd) => {
|
|
7849
8207
|
try {
|
|
7850
8208
|
await savePreset(options, cmd);
|
|
7851
8209
|
} catch (error) {
|
|
@@ -7883,7 +8241,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7883
8241
|
handleError(error);
|
|
7884
8242
|
}
|
|
7885
8243
|
});
|
|
7886
|
-
triggers.command("update").description("Update a trigger
|
|
8244
|
+
triggers.command("update").description("Update a trigger: pause or resume it (--active), reschedule it (--schedule), or both").argument("<triggerId>", "Trigger ID").option("--active <bool>", "true to resume, false to pause").option("--schedule <spec>", "New schedule spec (ISO-8601 instant for ONCE, Quartz cron for CRON)").action(async (triggerId, options, cmd) => {
|
|
7887
8245
|
try {
|
|
7888
8246
|
await updateTriggerCmd(triggerId, options, cmd);
|
|
7889
8247
|
} catch (error) {
|
|
@@ -7893,7 +8251,7 @@ function registerAnalyzeCommand(program) {
|
|
|
7893
8251
|
}
|
|
7894
8252
|
|
|
7895
8253
|
// src/commands/data-sources/index.ts
|
|
7896
|
-
import
|
|
8254
|
+
import chalk26 from "chalk";
|
|
7897
8255
|
function getOutputFormat16(cmd) {
|
|
7898
8256
|
const config = loadConfig();
|
|
7899
8257
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -7905,12 +8263,12 @@ function parseConfigPairs(pairs) {
|
|
|
7905
8263
|
for (const pair of pairs) {
|
|
7906
8264
|
const idx = pair.indexOf("=");
|
|
7907
8265
|
if (idx <= 0) {
|
|
7908
|
-
throw new Error(`Invalid --config "${pair}"
|
|
8266
|
+
throw new Error(`Invalid --config "${pair}". Expected key=value.`);
|
|
7909
8267
|
}
|
|
7910
8268
|
const key = pair.substring(0, idx).trim();
|
|
7911
8269
|
const value = pair.substring(idx + 1);
|
|
7912
8270
|
if (!key) {
|
|
7913
|
-
throw new Error(`Invalid --config "${pair}"
|
|
8271
|
+
throw new Error(`Invalid --config "${pair}". The key is empty.`);
|
|
7914
8272
|
}
|
|
7915
8273
|
out[key] = value;
|
|
7916
8274
|
}
|
|
@@ -8029,7 +8387,7 @@ async function showDashboard(projectId, cmd) {
|
|
|
8029
8387
|
return;
|
|
8030
8388
|
}
|
|
8031
8389
|
const r = dashboard.rollup;
|
|
8032
|
-
let line =
|
|
8390
|
+
let line = chalk26.bold(`DataSources in ${projectId}: `) + `${r.totalSources} total, ${r.scheduledSources} scheduled, ${r.sourcesWithRecentFailure} failing recently`;
|
|
8033
8391
|
if (r.lastActivityAt) line += `, last activity ${r.lastActivityAt}`;
|
|
8034
8392
|
console.log(line);
|
|
8035
8393
|
if (dashboard.sources.length === 0) {
|
|
@@ -8067,8 +8425,8 @@ async function createDataSource(options, cmd) {
|
|
|
8067
8425
|
const ds = await api.storage.createDataSource(request);
|
|
8068
8426
|
if (outputFormat === "human") {
|
|
8069
8427
|
success(`Created data source ${ds.id}`);
|
|
8070
|
-
console.log(
|
|
8071
|
-
if (ds.lastRunError) console.log(
|
|
8428
|
+
console.log(chalk26.dim(` Last run: ${ds.lastRunStatus ?? "\u2014"}`));
|
|
8429
|
+
if (ds.lastRunError) console.log(chalk26.dim(` Error: ${ds.lastRunError}`));
|
|
8072
8430
|
} else {
|
|
8073
8431
|
format(ds, { format: outputFormat });
|
|
8074
8432
|
}
|
|
@@ -8113,8 +8471,8 @@ async function refreshDataSource(id, cmd) {
|
|
|
8113
8471
|
const api = createApiClient();
|
|
8114
8472
|
const run = await api.storage.refreshDataSource(id);
|
|
8115
8473
|
if (outputFormat === "human") {
|
|
8116
|
-
success(`Refresh queued
|
|
8117
|
-
if (run.errorMessage) console.log(
|
|
8474
|
+
success(`Refresh queued: run ${run.runId}, status ${run.status}.`);
|
|
8475
|
+
if (run.errorMessage) console.log(chalk26.red(` Error: ${run.errorMessage}`));
|
|
8118
8476
|
} else {
|
|
8119
8477
|
format(run, { format: outputFormat });
|
|
8120
8478
|
}
|
|
@@ -8188,14 +8546,14 @@ Examples:
|
|
|
8188
8546
|
handleError(error);
|
|
8189
8547
|
}
|
|
8190
8548
|
});
|
|
8191
|
-
dataSources.command("create").description("Create a data source (runs the initial fetch synchronously)").requiredOption("--project-id <id>", "Project ID").requiredOption("--project-branch <branch>", 'Project branch (usually "main")').requiredOption("--target-entity-id <id>", "Target table entity ID").requiredOption("--target-entity-branch <branch>", "Target table entity branch").requiredOption("--name <name>", "Display name").requiredOption("--type <type>", "Connector type (google_sheets, s3_url, jdbc)").option("--config <key=value>", "Connector config field
|
|
8549
|
+
dataSources.command("create").description("Create a data source (runs the initial fetch synchronously)").requiredOption("--project-id <id>", "Project ID").requiredOption("--project-branch <branch>", 'Project branch (usually "main")').requiredOption("--target-entity-id <id>", "Target table entity ID").requiredOption("--target-entity-branch <branch>", "Target table entity branch").requiredOption("--name <name>", "Display name").requiredOption("--type <type>", "Connector type (google_sheets, s3_url, jdbc)").option("--config <key=value>", "Connector config field; repeat for multiple", (value, prev = []) => prev.concat([value]), []).option("--schedule-cron <expr>", 'Quartz cron expression (e.g. "0 0 2 * * ?" for daily 02:00 UTC); omit for manual-only').action(async (options, cmd) => {
|
|
8192
8550
|
try {
|
|
8193
8551
|
await createDataSource(options, cmd);
|
|
8194
8552
|
} catch (error) {
|
|
8195
8553
|
handleError(error);
|
|
8196
8554
|
}
|
|
8197
8555
|
});
|
|
8198
|
-
dataSources.command("update").description("Update a data source (omit a flag to leave that field unchanged)").argument("<id>", "Data source ID").option("--name <name>", "New display name").option("--type <type>", "New connector type").option("--config <key=value>", 'Replace the entire config map
|
|
8556
|
+
dataSources.command("update").description("Update a data source (omit a flag to leave that field unchanged)").argument("<id>", "Data source ID").option("--name <name>", "New display name").option("--type <type>", "New connector type").option("--config <key=value>", 'Replace the entire config map; repeat for multiple. Send "[redacted]" as a value to keep the existing encrypted credential.', (value, prev = []) => prev.concat([value]), []).option("--schedule-cron <expr>", "New Quartz cron expression").option("--clear-schedule", "Switch this data source to manual-only").action(async (id, options, cmd) => {
|
|
8199
8557
|
try {
|
|
8200
8558
|
await updateDataSource(id, options, cmd);
|
|
8201
8559
|
} catch (error) {
|
|
@@ -8241,14 +8599,14 @@ Examples:
|
|
|
8241
8599
|
}
|
|
8242
8600
|
|
|
8243
8601
|
// src/commands/table-exporters/index.ts
|
|
8244
|
-
import
|
|
8602
|
+
import chalk27 from "chalk";
|
|
8245
8603
|
function getOutputFormat17(cmd) {
|
|
8246
8604
|
const config = loadConfig();
|
|
8247
8605
|
const globalOpts = cmd.optsWithGlobals();
|
|
8248
8606
|
return globalOpts.output ?? config.defaults.output ?? "human";
|
|
8249
8607
|
}
|
|
8250
8608
|
function registerTableExportersCommands(program) {
|
|
8251
|
-
const exporters = program.command("table-exporters").description("Manage user-defined exporters (UDE)
|
|
8609
|
+
const exporters = program.command("table-exporters").description("Manage user-defined exporters (UDE); admin only");
|
|
8252
8610
|
exporters.command("list").description("List all registered user-defined exporters").action(async (_options, cmd) => {
|
|
8253
8611
|
try {
|
|
8254
8612
|
const outputFormat = getOutputFormat17(cmd);
|
|
@@ -8272,7 +8630,7 @@ function registerTableExportersCommands(program) {
|
|
|
8272
8630
|
format: outputFormat,
|
|
8273
8631
|
columns: ["id", "name", "format", "extension", "mimeType", "priority", "function", "createdBy"]
|
|
8274
8632
|
});
|
|
8275
|
-
console.log(
|
|
8633
|
+
console.log(chalk27.dim(`${list.length} exporter(s)`));
|
|
8276
8634
|
} catch (error) {
|
|
8277
8635
|
handleError(error);
|
|
8278
8636
|
}
|
|
@@ -8330,7 +8688,7 @@ function registerTableExportersCommands(program) {
|
|
|
8330
8688
|
}
|
|
8331
8689
|
|
|
8332
8690
|
// src/commands/skeleton/index.ts
|
|
8333
|
-
import
|
|
8691
|
+
import chalk28 from "chalk";
|
|
8334
8692
|
import * as fs9 from "fs";
|
|
8335
8693
|
function getOutputFormat18(cmd) {
|
|
8336
8694
|
const config = loadConfig();
|
|
@@ -8366,7 +8724,7 @@ function parseWeight(raw) {
|
|
|
8366
8724
|
if (raw === void 0) return null;
|
|
8367
8725
|
const value = Number(raw);
|
|
8368
8726
|
if (!Number.isFinite(value) || value <= 0) {
|
|
8369
|
-
throw new Error(`Invalid --weight "${raw}"
|
|
8727
|
+
throw new Error(`Invalid --weight "${raw}". Use a positive number.`);
|
|
8370
8728
|
}
|
|
8371
8729
|
return value;
|
|
8372
8730
|
}
|
|
@@ -8397,10 +8755,10 @@ async function createSkeleton(options, cmd) {
|
|
|
8397
8755
|
const skeleton = await api.storage.createSkeleton(request);
|
|
8398
8756
|
if (outputFormat === "human") {
|
|
8399
8757
|
success(`Created skeleton ${skeleton.id}`);
|
|
8400
|
-
console.log(
|
|
8401
|
-
console.log(
|
|
8402
|
-
console.log(
|
|
8403
|
-
console.log(
|
|
8758
|
+
console.log(chalk28.dim(` name: ${skeleton.name}`));
|
|
8759
|
+
console.log(chalk28.dim(` template: ${skeleton.template}`));
|
|
8760
|
+
console.log(chalk28.dim(` paramCount: ${skeleton.paramCount}`));
|
|
8761
|
+
console.log(chalk28.dim(` weight: ${skeleton.weight}`));
|
|
8404
8762
|
} else {
|
|
8405
8763
|
format(skeleton, { format: outputFormat });
|
|
8406
8764
|
}
|
|
@@ -8439,10 +8797,10 @@ async function updateSkeleton(id, options, cmd) {
|
|
|
8439
8797
|
const skeleton = await api.storage.updateSkeleton(id, request);
|
|
8440
8798
|
if (outputFormat === "human") {
|
|
8441
8799
|
success(`Updated skeleton ${skeleton.id}`);
|
|
8442
|
-
console.log(
|
|
8443
|
-
console.log(
|
|
8444
|
-
console.log(
|
|
8445
|
-
console.log(
|
|
8800
|
+
console.log(chalk28.dim(` name: ${skeleton.name}`));
|
|
8801
|
+
console.log(chalk28.dim(` template: ${skeleton.template}`));
|
|
8802
|
+
console.log(chalk28.dim(` paramCount: ${skeleton.paramCount}`));
|
|
8803
|
+
console.log(chalk28.dim(` weight: ${skeleton.weight}`));
|
|
8446
8804
|
} else {
|
|
8447
8805
|
format(skeleton, { format: outputFormat });
|
|
8448
8806
|
}
|
|
@@ -8759,7 +9117,7 @@ function registerCompletionCommand(program) {
|
|
|
8759
9117
|
}
|
|
8760
9118
|
|
|
8761
9119
|
// src/commands/whoami/index.ts
|
|
8762
|
-
import
|
|
9120
|
+
import chalk29 from "chalk";
|
|
8763
9121
|
function registerWhoamiCommand(program) {
|
|
8764
9122
|
program.command("whoami").description("Show the currently authenticated user").action(async (_options, cmd) => {
|
|
8765
9123
|
try {
|
|
@@ -8769,8 +9127,8 @@ function registerWhoamiCommand(program) {
|
|
|
8769
9127
|
const api = createApiClient();
|
|
8770
9128
|
const user = await api.admin.getMyUser();
|
|
8771
9129
|
if (outputFormat === "human") {
|
|
8772
|
-
console.log(
|
|
8773
|
-
console.log(
|
|
9130
|
+
console.log(chalk29.bold(user.name) + chalk29.dim(` <${user.email}>`));
|
|
9131
|
+
console.log(chalk29.dim(` Role: ${user.role} \xB7 Remaining credits: ${user.remainingCredits} \xB7 Profile: ${config.currentProfile}`));
|
|
8774
9132
|
} else {
|
|
8775
9133
|
format(user, { format: outputFormat });
|
|
8776
9134
|
}
|
|
@@ -8781,7 +9139,7 @@ function registerWhoamiCommand(program) {
|
|
|
8781
9139
|
}
|
|
8782
9140
|
|
|
8783
9141
|
// src/commands/utilization/index.ts
|
|
8784
|
-
import
|
|
9142
|
+
import chalk30 from "chalk";
|
|
8785
9143
|
function getOutputFormat19(cmd) {
|
|
8786
9144
|
const config = loadConfig();
|
|
8787
9145
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -8798,19 +9156,44 @@ function windowLabel(u) {
|
|
|
8798
9156
|
}
|
|
8799
9157
|
function printUtilizationHuman(u, label) {
|
|
8800
9158
|
const when2 = windowLabel(u);
|
|
8801
|
-
console.log(label ?
|
|
9159
|
+
console.log(label ? chalk30.bold(label) + " " + chalk30.dim(when2) : chalk30.bold(when2));
|
|
8802
9160
|
if (u.types.length === 0) {
|
|
8803
|
-
console.log(
|
|
9161
|
+
console.log(chalk30.dim(" (no usage)"));
|
|
8804
9162
|
return;
|
|
8805
9163
|
}
|
|
8806
9164
|
const types = [...u.types].sort((a, b) => b.credits - a.credits);
|
|
8807
9165
|
const width = Math.max(...types.map((t) => t.type.length));
|
|
8808
9166
|
for (const t of types) {
|
|
8809
|
-
const line = ` ${t.type.padEnd(width)} ${formatNumber(t.quantity).padStart(12)} ${
|
|
8810
|
-
console.log(t.credits === 0 ?
|
|
9167
|
+
const line = ` ${t.type.padEnd(width)} ${formatNumber(t.quantity).padStart(12)} ${chalk30.dim("credits")} ${t.credits.toFixed(2).padStart(10)}`;
|
|
9168
|
+
console.log(t.credits === 0 ? chalk30.dim(line) : line);
|
|
8811
9169
|
}
|
|
8812
9170
|
const total = u.totalCredits ?? u.types.reduce((s, t) => s + t.credits, 0);
|
|
8813
|
-
console.log(
|
|
9171
|
+
console.log(chalk30.bold(` ${"Total".padEnd(width)} ${" ".repeat(12)} ${chalk30.dim("credits")} ${total.toFixed(2).padStart(10)}`));
|
|
9172
|
+
}
|
|
9173
|
+
function formatDailyHistory(history) {
|
|
9174
|
+
const spentOn = (u) => u.dailyCredits ?? u.types.reduce((sum, t) => sum + (t.dailyCredits ?? 0), 0);
|
|
9175
|
+
const costly = (u) => u.types.filter((t) => (t.dailyCredits ?? 0) > 0).sort((a, b) => (b.dailyCredits ?? 0) - (a.dailyCredits ?? 0));
|
|
9176
|
+
const totalLabel = `Total, ${history.length} ${history.length === 1 ? "day" : "days"}`;
|
|
9177
|
+
const width = Math.max(
|
|
9178
|
+
totalLabel.length,
|
|
9179
|
+
...history.map((u) => windowLabel(u).length),
|
|
9180
|
+
...history.flatMap((u) => costly(u).map((t) => t.type.length + 2))
|
|
9181
|
+
);
|
|
9182
|
+
const amount = (credits) => credits.toFixed(2).padStart(10);
|
|
9183
|
+
const lines = [];
|
|
9184
|
+
let total = 0;
|
|
9185
|
+
for (const u of history) {
|
|
9186
|
+
const spent = spentOn(u);
|
|
9187
|
+
total += spent;
|
|
9188
|
+
const line = `${windowLabel(u).padEnd(width)} ${amount(spent)} ${chalk30.dim("credits")}`;
|
|
9189
|
+
lines.push(spent > 0 ? chalk30.bold(line) : chalk30.dim(line));
|
|
9190
|
+
for (const t of costly(u)) {
|
|
9191
|
+
lines.push(` ${t.type.padEnd(width - 2)} ${amount(t.dailyCredits ?? 0)}`);
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
lines.push("");
|
|
9195
|
+
lines.push(chalk30.bold(`${totalLabel.padEnd(width)} ${amount(total)} ${chalk30.dim("credits")}`));
|
|
9196
|
+
return lines;
|
|
8814
9197
|
}
|
|
8815
9198
|
function registerUtilizationCommand(program) {
|
|
8816
9199
|
const util = program.command("utilization").description("Show credit utilization for the current billing cycle").addHelpText("after", `
|
|
@@ -8834,7 +9217,7 @@ Examples:
|
|
|
8834
9217
|
handleError(error);
|
|
8835
9218
|
}
|
|
8836
9219
|
});
|
|
8837
|
-
util.command("history").description("Show
|
|
9220
|
+
util.command("history").description("Show what each day of the billing cycle cost").action(async (_options, cmd) => {
|
|
8838
9221
|
try {
|
|
8839
9222
|
const outputFormat = getOutputFormat19(cmd);
|
|
8840
9223
|
const api = createApiClient();
|
|
@@ -8844,9 +9227,8 @@ Examples:
|
|
|
8844
9227
|
empty("usage recorded");
|
|
8845
9228
|
return;
|
|
8846
9229
|
}
|
|
8847
|
-
for (const
|
|
8848
|
-
|
|
8849
|
-
console.log();
|
|
9230
|
+
for (const line of formatDailyHistory(history)) {
|
|
9231
|
+
console.log(line);
|
|
8850
9232
|
}
|
|
8851
9233
|
} else {
|
|
8852
9234
|
format(history, { format: outputFormat });
|
|
@@ -9013,12 +9395,12 @@ Examples:
|
|
|
9013
9395
|
}
|
|
9014
9396
|
|
|
9015
9397
|
// src/commands/shell/index.ts
|
|
9016
|
-
import
|
|
9398
|
+
import chalk31 from "chalk";
|
|
9017
9399
|
import * as fs11 from "fs";
|
|
9018
9400
|
import * as os3 from "os";
|
|
9019
9401
|
import * as path8 from "path";
|
|
9020
9402
|
import { spawn as spawn3 } from "child_process";
|
|
9021
|
-
import { randomUUID as
|
|
9403
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
9022
9404
|
function extensionFor2(language) {
|
|
9023
9405
|
const l = language.toLowerCase();
|
|
9024
9406
|
if (l === "java") return "java";
|
|
@@ -9029,7 +9411,7 @@ function extensionFor2(language) {
|
|
|
9029
9411
|
return "txt";
|
|
9030
9412
|
}
|
|
9031
9413
|
async function openInEditor(initial, ext) {
|
|
9032
|
-
const tmpFile = path8.join(os3.tmpdir(), `diafunc-shell-${
|
|
9414
|
+
const tmpFile = path8.join(os3.tmpdir(), `diafunc-shell-${randomUUID3()}.${ext}`);
|
|
9033
9415
|
fs11.writeFileSync(tmpFile, initial);
|
|
9034
9416
|
const editor = process.env.VISUAL ?? process.env.EDITOR ?? "vi";
|
|
9035
9417
|
await new Promise((resolve, reject) => {
|
|
@@ -9079,21 +9461,21 @@ async function evaluate(api, fnRef, language, sourceCode) {
|
|
|
9079
9461
|
}, false);
|
|
9080
9462
|
if (result.outputs?.length) {
|
|
9081
9463
|
for (const out of result.outputs) {
|
|
9082
|
-
console.log(
|
|
9464
|
+
console.log(chalk31.dim(` [${out.type}]`) + " " + out.output);
|
|
9083
9465
|
}
|
|
9084
9466
|
}
|
|
9085
9467
|
if (result.successful) {
|
|
9086
9468
|
if (result.result) {
|
|
9087
|
-
console.log(
|
|
9469
|
+
console.log(chalk31.green("=>") + " " + result.result);
|
|
9088
9470
|
} else {
|
|
9089
|
-
console.log(
|
|
9471
|
+
console.log(chalk31.dim("=> (no value)"));
|
|
9090
9472
|
}
|
|
9091
9473
|
const duration = result.completed - result.started;
|
|
9092
|
-
console.log(
|
|
9474
|
+
console.log(chalk31.dim(` [${duration}ms \xB7 ${evaluationId}]`));
|
|
9093
9475
|
} else {
|
|
9094
|
-
console.log(
|
|
9476
|
+
console.log(chalk31.red("error: ") + result.error);
|
|
9095
9477
|
if (result.lineNumber > 0) {
|
|
9096
|
-
console.log(
|
|
9478
|
+
console.log(chalk31.dim(` at line ${result.lineNumber}, col ${result.columnNumber}`));
|
|
9097
9479
|
}
|
|
9098
9480
|
}
|
|
9099
9481
|
}
|
|
@@ -9114,19 +9496,19 @@ function registerShellCommand(program) {
|
|
|
9114
9496
|
});
|
|
9115
9497
|
const api = createApiClient();
|
|
9116
9498
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
9117
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
9499
|
+
const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
|
|
9118
9500
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
9119
|
-
console.log(
|
|
9120
|
-
console.log(
|
|
9121
|
-
console.log(
|
|
9501
|
+
console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
9502
|
+
console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
9503
|
+
console.log(chalk31.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
|
|
9122
9504
|
const notice = await getUpdateNotice();
|
|
9123
|
-
if (notice) console.log(
|
|
9505
|
+
if (notice) console.log(chalk31.dim(notice));
|
|
9124
9506
|
console.log();
|
|
9125
9507
|
let language = resolvedLanguage;
|
|
9126
9508
|
for (; ; ) {
|
|
9127
9509
|
let line;
|
|
9128
9510
|
try {
|
|
9129
|
-
line = await promptInput({ message:
|
|
9511
|
+
line = await promptInput({ message: chalk31.cyan.bold(`${language} >`) });
|
|
9130
9512
|
} catch {
|
|
9131
9513
|
console.log();
|
|
9132
9514
|
return;
|
|
@@ -9144,54 +9526,54 @@ function registerShellCommand(program) {
|
|
|
9144
9526
|
case "help":
|
|
9145
9527
|
case "h":
|
|
9146
9528
|
case "?":
|
|
9147
|
-
console.log(
|
|
9148
|
-
console.log(
|
|
9149
|
-
console.log(
|
|
9150
|
-
console.log(
|
|
9529
|
+
console.log(chalk31.dim(" /edit open $EDITOR for multi-line code"));
|
|
9530
|
+
console.log(chalk31.dim(" /file <path> evaluate the contents of a file"));
|
|
9531
|
+
console.log(chalk31.dim(" /lang <name> switch language (Java, JavaScript, Kotlin, Python, Scala)"));
|
|
9532
|
+
console.log(chalk31.dim(" /quit exit the shell"));
|
|
9151
9533
|
continue;
|
|
9152
9534
|
case "lang":
|
|
9153
9535
|
if (arg) language = arg;
|
|
9154
|
-
console.log(
|
|
9536
|
+
console.log(chalk31.dim(`Language: ${language}`));
|
|
9155
9537
|
continue;
|
|
9156
9538
|
case "edit": {
|
|
9157
9539
|
const sourceCode = await openInEditor("", extensionFor2(language));
|
|
9158
9540
|
if (!sourceCode.trim()) {
|
|
9159
|
-
console.log(
|
|
9541
|
+
console.log(chalk31.dim("(empty; not evaluated)"));
|
|
9160
9542
|
continue;
|
|
9161
9543
|
}
|
|
9162
9544
|
try {
|
|
9163
9545
|
await evaluate(api, fnRef, language, sourceCode);
|
|
9164
9546
|
} catch (e) {
|
|
9165
|
-
console.error(
|
|
9547
|
+
console.error(chalk31.red(e.message));
|
|
9166
9548
|
}
|
|
9167
9549
|
continue;
|
|
9168
9550
|
}
|
|
9169
9551
|
case "file": {
|
|
9170
9552
|
if (!arg) {
|
|
9171
|
-
console.log(
|
|
9553
|
+
console.log(chalk31.dim("usage: /file <path>"));
|
|
9172
9554
|
continue;
|
|
9173
9555
|
}
|
|
9174
9556
|
if (!fs11.existsSync(arg)) {
|
|
9175
|
-
console.log(
|
|
9557
|
+
console.log(chalk31.red(`file not found: ${arg}`));
|
|
9176
9558
|
continue;
|
|
9177
9559
|
}
|
|
9178
9560
|
const sourceCode = fs11.readFileSync(arg, "utf-8");
|
|
9179
9561
|
try {
|
|
9180
9562
|
await evaluate(api, fnRef, language, sourceCode);
|
|
9181
9563
|
} catch (e) {
|
|
9182
|
-
console.error(
|
|
9564
|
+
console.error(chalk31.red(e.message));
|
|
9183
9565
|
}
|
|
9184
9566
|
continue;
|
|
9185
9567
|
}
|
|
9186
9568
|
default:
|
|
9187
|
-
console.log(
|
|
9569
|
+
console.log(chalk31.dim(`Unknown command: /${cmd2}. Try /help.`));
|
|
9188
9570
|
continue;
|
|
9189
9571
|
}
|
|
9190
9572
|
}
|
|
9191
9573
|
try {
|
|
9192
9574
|
await evaluate(api, fnRef, language, trimmed);
|
|
9193
9575
|
} catch (e) {
|
|
9194
|
-
console.error(
|
|
9576
|
+
console.error(chalk31.red(e.message));
|
|
9195
9577
|
}
|
|
9196
9578
|
}
|
|
9197
9579
|
} catch (error) {
|
|
@@ -9201,7 +9583,7 @@ function registerShellCommand(program) {
|
|
|
9201
9583
|
}
|
|
9202
9584
|
|
|
9203
9585
|
// src/commands/update/index.ts
|
|
9204
|
-
import
|
|
9586
|
+
import chalk32 from "chalk";
|
|
9205
9587
|
import * as path9 from "path";
|
|
9206
9588
|
import { spawn as spawn4 } from "child_process";
|
|
9207
9589
|
|
|
@@ -9247,14 +9629,14 @@ function registerUpdateCommand(program) {
|
|
|
9247
9629
|
const install = detectInstall();
|
|
9248
9630
|
const latest = await fetchLatestVersion();
|
|
9249
9631
|
if (latest === package_default.version) {
|
|
9250
|
-
console.log(
|
|
9632
|
+
console.log(chalk32.dim(`diafunc is already at the latest version (${package_default.version}).`));
|
|
9251
9633
|
return;
|
|
9252
9634
|
}
|
|
9253
|
-
console.log(
|
|
9635
|
+
console.log(chalk32.dim(`Current: ${package_default.version} \u2192 Available: ${latest}`));
|
|
9254
9636
|
if (install.method === "npm") {
|
|
9255
9637
|
console.log();
|
|
9256
9638
|
console.log("Installed via npm. Upgrade with:");
|
|
9257
|
-
console.log(
|
|
9639
|
+
console.log(chalk32.bold(` npm install -g @diafunc/cli@${latest}`));
|
|
9258
9640
|
return;
|
|
9259
9641
|
}
|
|
9260
9642
|
const installDir = path9.dirname(install.binaryPath);
|
|
@@ -9268,7 +9650,7 @@ function registerUpdateCommand(program) {
|
|
|
9268
9650
|
}
|
|
9269
9651
|
|
|
9270
9652
|
// src/commands/uninstall/index.ts
|
|
9271
|
-
import
|
|
9653
|
+
import chalk33 from "chalk";
|
|
9272
9654
|
import { spawn as spawn5 } from "child_process";
|
|
9273
9655
|
import * as fs13 from "fs";
|
|
9274
9656
|
import * as os4 from "os";
|
|
@@ -9280,11 +9662,11 @@ function registerUninstallCommand(program) {
|
|
|
9280
9662
|
const configDir = path10.join(os4.homedir(), ".diafunc");
|
|
9281
9663
|
if (install.method === "npm") {
|
|
9282
9664
|
console.log("Installed via npm. Remove with:");
|
|
9283
|
-
console.log(
|
|
9665
|
+
console.log(chalk33.bold(" npm uninstall -g @diafunc/cli"));
|
|
9284
9666
|
if (fs13.existsSync(configDir)) {
|
|
9285
9667
|
console.log();
|
|
9286
|
-
console.log(`Config
|
|
9287
|
-
console.log(
|
|
9668
|
+
console.log(`Config and credentials live at ${configDir}. Remove them manually with:`);
|
|
9669
|
+
console.log(chalk33.bold(` rm -rf ${configDir}`));
|
|
9288
9670
|
}
|
|
9289
9671
|
return;
|
|
9290
9672
|
}
|
|
@@ -9294,7 +9676,7 @@ function registerUninstallCommand(program) {
|
|
|
9294
9676
|
default: false
|
|
9295
9677
|
});
|
|
9296
9678
|
if (!removeBinary) {
|
|
9297
|
-
console.log(
|
|
9679
|
+
console.log(chalk33.dim("Aborted."));
|
|
9298
9680
|
return;
|
|
9299
9681
|
}
|
|
9300
9682
|
let removeConfig = options.purge ?? false;
|
|
@@ -9306,7 +9688,7 @@ function registerUninstallCommand(program) {
|
|
|
9306
9688
|
}
|
|
9307
9689
|
if (removeConfig && fs13.existsSync(configDir)) {
|
|
9308
9690
|
fs13.rmSync(configDir, { recursive: true, force: true });
|
|
9309
|
-
console.log(
|
|
9691
|
+
console.log(chalk33.dim(`Removed ${configDir}`));
|
|
9310
9692
|
}
|
|
9311
9693
|
if (process.platform === "win32") {
|
|
9312
9694
|
const cmd = `timeout /t 2 /nobreak >nul & del /f /q "${install.binaryPath}"`;
|
|
@@ -9316,13 +9698,13 @@ function registerUninstallCommand(program) {
|
|
|
9316
9698
|
windowsHide: true
|
|
9317
9699
|
});
|
|
9318
9700
|
child.unref();
|
|
9319
|
-
console.log(
|
|
9701
|
+
console.log(chalk33.dim(`Removing ${install.binaryPath} on exit...`));
|
|
9320
9702
|
console.log();
|
|
9321
9703
|
console.log("diafunc uninstalled.");
|
|
9322
9704
|
return;
|
|
9323
9705
|
}
|
|
9324
9706
|
fs13.rmSync(install.binaryPath, { force: true });
|
|
9325
|
-
console.log(
|
|
9707
|
+
console.log(chalk33.dim(`Removed ${install.binaryPath}`));
|
|
9326
9708
|
console.log();
|
|
9327
9709
|
console.log("diafunc uninstalled.");
|
|
9328
9710
|
} catch (error) {
|
|
@@ -9386,7 +9768,7 @@ var DiafuncCommand = class _DiafuncCommand extends Command {
|
|
|
9386
9768
|
};
|
|
9387
9769
|
|
|
9388
9770
|
// src/prompting/fill.ts
|
|
9389
|
-
import
|
|
9771
|
+
import chalk35 from "chalk";
|
|
9390
9772
|
|
|
9391
9773
|
// src/prompting/resolvers.ts
|
|
9392
9774
|
var PROJECT_ROLES = ["OWNER", "ADMIN", "DEVELOPER", "GUEST"];
|
|
@@ -9579,7 +9961,7 @@ function dependencies(spec) {
|
|
|
9579
9961
|
|
|
9580
9962
|
// src/prompting/pickers.ts
|
|
9581
9963
|
import * as fs14 from "fs";
|
|
9582
|
-
import
|
|
9964
|
+
import chalk34 from "chalk";
|
|
9583
9965
|
var SEARCH_THRESHOLD = 10;
|
|
9584
9966
|
var TYPE_IT = "\0type-it";
|
|
9585
9967
|
async function askFor(spec, input, ctx) {
|
|
@@ -9772,7 +10154,7 @@ async function projectContext(ctx, projectFrom) {
|
|
|
9772
10154
|
const [projectId, branch] = raw.split("/");
|
|
9773
10155
|
return { projectId, projectBranch: branch || ctx.globals.branch || config.defaults.branch || "main" };
|
|
9774
10156
|
}
|
|
9775
|
-
var
|
|
10157
|
+
var FIRST_PAGE2 = 100;
|
|
9776
10158
|
async function fromIndex(ctx, message, query, answer) {
|
|
9777
10159
|
let firstPage = null;
|
|
9778
10160
|
let warned = false;
|
|
@@ -9784,7 +10166,7 @@ async function fromIndex(ctx, message, query, answer) {
|
|
|
9784
10166
|
message,
|
|
9785
10167
|
source: async (term) => {
|
|
9786
10168
|
try {
|
|
9787
|
-
firstPage ??= await indexItems(ctx, "*", query,
|
|
10169
|
+
firstPage ??= await indexItems(ctx, "*", query, FIRST_PAGE2);
|
|
9788
10170
|
const needle = term.trim().toLowerCase();
|
|
9789
10171
|
let items = needle ? firstPage.filter((item) => `${item.name ?? ""} ${item.entityId ?? item.projectId}`.toLowerCase().includes(needle)) : firstPage;
|
|
9790
10172
|
if (needle && items.length === 0) items = await indexItems(ctx, term.trim(), query, 30);
|
|
@@ -9927,7 +10309,7 @@ function typedValue(ctx, message) {
|
|
|
9927
10309
|
return typed(ctx, message);
|
|
9928
10310
|
}
|
|
9929
10311
|
function typeItChoice() {
|
|
9930
|
-
return { name:
|
|
10312
|
+
return { name: chalk34.dim("Type it instead"), value: TYPE_IT };
|
|
9931
10313
|
}
|
|
9932
10314
|
function text(ctx, name) {
|
|
9933
10315
|
const value = ctx.known.get(name);
|
|
@@ -9957,7 +10339,7 @@ function capitalize(value) {
|
|
|
9957
10339
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
9958
10340
|
}
|
|
9959
10341
|
function labelled(label, hint2) {
|
|
9960
|
-
return hint2 && hint2 !== label ? `${label} ${
|
|
10342
|
+
return hint2 && hint2 !== label ? `${label} ${chalk34.dim(hint2)}` : label;
|
|
9961
10343
|
}
|
|
9962
10344
|
function numberRule(spec) {
|
|
9963
10345
|
return (raw) => {
|
|
@@ -10003,7 +10385,7 @@ async function fillPendingInputs(actionCommand) {
|
|
|
10003
10385
|
known: knownValues(actionCommand),
|
|
10004
10386
|
globals: actionCommand.optsWithGlobals(),
|
|
10005
10387
|
prefill: /* @__PURE__ */ new Map(),
|
|
10006
|
-
note: (line) => process.stderr.write(
|
|
10388
|
+
note: (line) => process.stderr.write(chalk35.dim(` ${line}
|
|
10007
10389
|
`))
|
|
10008
10390
|
};
|
|
10009
10391
|
for (const item of orderByDependencies(pending)) {
|
|
@@ -10012,7 +10394,7 @@ async function fillPendingInputs(actionCommand) {
|
|
|
10012
10394
|
ctx.known.set(item.input.name, value);
|
|
10013
10395
|
}
|
|
10014
10396
|
const log = env.log ?? ((line) => console.log(line));
|
|
10015
|
-
log(
|
|
10397
|
+
log(chalk35.dim(` Equivalent: ${equivalentCommand(actionCommand)}`));
|
|
10016
10398
|
}
|
|
10017
10399
|
function commandChain(cmd) {
|
|
10018
10400
|
const chain = [];
|
|
@@ -10109,7 +10491,7 @@ Docs: https://diafunc.com/documentation
|
|
|
10109
10491
|
function createProgram(environment = {}) {
|
|
10110
10492
|
const program = new DiafuncCommand();
|
|
10111
10493
|
program.promptEnvironment = environment;
|
|
10112
|
-
program.name("diafunc").description("Diafunc CLI
|
|
10494
|
+
program.name("diafunc").description("Diafunc CLI: the command-line interface for the Diafunc platform").version(package_default.version).option("-p, --profile <name>", "Profile to use").option("-o, --output <format>", "Output format: human, json, table (default: human)").option("--project <id>", "Project to work in (overrides defaults.project)").option("--branch <name>", "Project branch (overrides defaults.branch)").option("--dry-run", "Preview mutating operations without executing them").option("--verbose", "Echo every HTTP request to stderr").option("--no-color", "Disable coloured output").option("--no-interactive", "Never prompt: a missing required input fails as it would in a script").showSuggestionAfterError().showHelpAfterError(`(run 'diafunc --help' to see the available commands)`).configureHelp({ showGlobalOptions: true }).configureOutput({
|
|
10113
10495
|
// Commander writes usage errors to stdout by default, which puts a complaint in the middle
|
|
10114
10496
|
// of whatever a caller was capturing.
|
|
10115
10497
|
writeErr: (str) => process.stderr.write(str)
|
|
@@ -10117,7 +10499,7 @@ function createProgram(environment = {}) {
|
|
|
10117
10499
|
const opts = thisCommand.optsWithGlobals();
|
|
10118
10500
|
if (opts.dryRun) setDryRun(true);
|
|
10119
10501
|
if (opts.verbose) setVerbose(true);
|
|
10120
|
-
if (opts.color === false)
|
|
10502
|
+
if (opts.color === false) chalk36.level = 0;
|
|
10121
10503
|
}).hook("preAction", (_thisCommand, actionCommand) => fillPendingInputs(actionCommand));
|
|
10122
10504
|
program.addHelpText("after", HELP_EPILOGUE);
|
|
10123
10505
|
registerAuthCommands(program);
|
|
@@ -10159,4 +10541,4 @@ export {
|
|
|
10159
10541
|
PromptCancelled,
|
|
10160
10542
|
createProgram
|
|
10161
10543
|
};
|
|
10162
|
-
//# sourceMappingURL=chunk-
|
|
10544
|
+
//# sourceMappingURL=chunk-V3EXWLZP.js.map
|