@diafunc/cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/diafunc.js +3 -3
- package/dist/{chunk-37PYSRXA.js → chunk-3XAPBWCA.js} +2 -2
- package/dist/{chunk-VL7FZNQK.js → chunk-EZMZFU5V.js} +2 -2
- package/dist/{chunk-VL7FZNQK.js.map → chunk-EZMZFU5V.js.map} +1 -1
- package/dist/{chunk-XK2UUCKV.js → chunk-SA4Y2GNR.js} +176 -30
- package/dist/chunk-SA4Y2GNR.js.map +1 -0
- package/dist/src/index.js +2 -2
- package/dist/update-check-CBJ6R66H.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-XK2UUCKV.js.map +0 -1
- package/dist/update-check-2GASRVMF.js +0 -8
- /package/dist/{chunk-37PYSRXA.js.map → chunk-3XAPBWCA.js.map} +0 -0
- /package/dist/{update-check-2GASRVMF.js.map → update-check-CBJ6R66H.js.map} +0 -0
package/dist/bin/diafunc.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
PromptCancelled,
|
|
5
5
|
createProgram,
|
|
6
6
|
handleError
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-SA4Y2GNR.js";
|
|
8
8
|
import {
|
|
9
9
|
getUpdateNotice
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-3XAPBWCA.js";
|
|
11
11
|
import {
|
|
12
12
|
package_default
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-EZMZFU5V.js";
|
|
14
14
|
|
|
15
15
|
// bin/diafunc.ts
|
|
16
16
|
import chalk2 from "chalk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EZMZFU5V.js";
|
|
4
4
|
|
|
5
5
|
// src/util/update-check.ts
|
|
6
6
|
import * as fs from "fs";
|
|
@@ -72,4 +72,4 @@ async function getUpdateNotice() {
|
|
|
72
72
|
export {
|
|
73
73
|
getUpdateNotice
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-3XAPBWCA.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@diafunc/cli",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.16.0",
|
|
5
5
|
description: "Diafunc CLI: the command-line interface for the Diafunc platform",
|
|
6
6
|
type: "module",
|
|
7
7
|
bin: {
|
|
@@ -62,4 +62,4 @@ var package_default = {
|
|
|
62
62
|
export {
|
|
63
63
|
package_default
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-EZMZFU5V.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.16.0\",\n \"description\": \"Diafunc CLI: the command-line interface for the Diafunc platform\",\n \"type\": \"module\",\n \"bin\": {\n \"diafunc\": \"./dist/bin/diafunc.js\"\n },\n \"homepage\": \"https://diafunc.com\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://gitlab.com/diafunc/cli.git\"\n },\n \"bugs\": {\n \"url\": \"https://gitlab.com/diafunc/cli/-/issues\"\n },\n \"author\": \"Markus Pollak <markus.pollak@diafunc.com>\",\n \"scripts\": {\n \"build\": \"tsup && node -e \\\"const fs=require('fs');const f='dist/bin/diafunc.js';fs.writeFileSync(f,'#!/usr/bin/env node\\\\n'+fs.readFileSync(f,'utf8'))\\\"\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"lint\": \"tsc --noEmit\",\n \"start\": \"node dist/bin/diafunc.js\",\n \"prepublishOnly\": \"npm run lint && npm test && npm run build\"\n },\n \"files\": [\n \"dist\",\n \"LICENSE\",\n \"README.md\"\n ],\n \"keywords\": [\n \"diafunc\",\n \"cli\",\n \"data-science\",\n \"symbolic-regression\"\n ],\n \"license\": \"Apache-2.0\",\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n },\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"dependencies\": {\n \"@inquirer/prompts\": \"^7.0.0\",\n \"chalk\": \"^5.4.0\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^12.1.0\",\n \"ora\": \"^8.1.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22.0.0\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^2.1.0\"\n }\n}\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,UAAY;AAAA,EACZ,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,QAAU;AAAA,EACV,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,MAAQ;AAAA,IACR,OAAS;AAAA,IACT,gBAAkB;AAAA,EACpB;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,QAAU;AAAA,IACV,UAAY;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,cAAgB;AAAA,IACd,qBAAqB;AAAA,IACrB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAa;AAAA,IACb,KAAO;AAAA,EACT;AAAA,EACA,iBAAmB;AAAA,IACjB,eAAe;AAAA,IACf,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,QAAU;AAAA,EACZ;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EZMZFU5V.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import chalk36 from "chalk";
|
|
@@ -1059,6 +1059,25 @@ function normalizeColumns(columns) {
|
|
|
1059
1059
|
function humanizeKey(key) {
|
|
1060
1060
|
return key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").toLowerCase();
|
|
1061
1061
|
}
|
|
1062
|
+
var ACRONYMS = /* @__PURE__ */ new Map([
|
|
1063
|
+
["id", "ID"],
|
|
1064
|
+
["ids", "IDs"],
|
|
1065
|
+
["url", "URL"],
|
|
1066
|
+
["urls", "URLs"],
|
|
1067
|
+
["api", "API"],
|
|
1068
|
+
["uuid", "UUID"],
|
|
1069
|
+
["csv", "CSV"],
|
|
1070
|
+
["json", "JSON"],
|
|
1071
|
+
["cpu", "CPU"],
|
|
1072
|
+
["utm", "UTM"],
|
|
1073
|
+
["oidc", "OIDC"],
|
|
1074
|
+
["mcp", "MCP"]
|
|
1075
|
+
]);
|
|
1076
|
+
function recordLabel(key) {
|
|
1077
|
+
const words = humanizeKey(key).split(" ").filter((w) => w.length > 0).map((w) => ACRONYMS.get(w) ?? w);
|
|
1078
|
+
const sentence = words.join(" ");
|
|
1079
|
+
return sentence.charAt(0).toUpperCase() + sentence.slice(1);
|
|
1080
|
+
}
|
|
1062
1081
|
function headerOf(spec) {
|
|
1063
1082
|
return spec.header ?? humanizeKey(spec.key);
|
|
1064
1083
|
}
|
|
@@ -1157,7 +1176,7 @@ function renderValue(value, kind = "text", plain = false) {
|
|
|
1157
1176
|
if (typeof value === "boolean") return renderBoolean(value, plain);
|
|
1158
1177
|
if (typeof value === "number") return renderNumber(value, plain);
|
|
1159
1178
|
if (Array.isArray(value)) return renderArray(value, plain, dim);
|
|
1160
|
-
if (typeof value === "object") return
|
|
1179
|
+
if (typeof value === "object") return renderObject(value, plain, dim);
|
|
1161
1180
|
return String(value);
|
|
1162
1181
|
}
|
|
1163
1182
|
}
|
|
@@ -1170,6 +1189,12 @@ function renderArray(value, plain, dim) {
|
|
|
1170
1189
|
const allScalar = value.every((v) => v === null || typeof v !== "object");
|
|
1171
1190
|
return allScalar ? value.map(String).join(", ") : JSON.stringify(value);
|
|
1172
1191
|
}
|
|
1192
|
+
function renderObject(value, plain, dim) {
|
|
1193
|
+
const entries = Object.entries(value);
|
|
1194
|
+
if (entries.length === 0) return dim(ABSENT);
|
|
1195
|
+
const allScalar = entries.every(([, v]) => v === null || typeof v !== "object");
|
|
1196
|
+
return allScalar ? entries.map(([k, v]) => `${k}: ${String(v)}`).join(", ") : JSON.stringify(value);
|
|
1197
|
+
}
|
|
1173
1198
|
function renderBoolean(value, plain) {
|
|
1174
1199
|
const truthy = value === true || value === "true";
|
|
1175
1200
|
if (plain) return truthy ? "yes" : "no";
|
|
@@ -1288,7 +1313,7 @@ function formatHuman(data, columns) {
|
|
|
1288
1313
|
if (Array.isArray(data)) {
|
|
1289
1314
|
renderRows(data, columns);
|
|
1290
1315
|
} else if (data && typeof data === "object") {
|
|
1291
|
-
renderRecord(data);
|
|
1316
|
+
renderRecord(data, columns);
|
|
1292
1317
|
} else {
|
|
1293
1318
|
console.log(String(data));
|
|
1294
1319
|
}
|
|
@@ -1318,36 +1343,34 @@ function renderRows(rows, columns) {
|
|
|
1318
1343
|
console.log(row.map((c, i) => pad(truncate(c, widths[i]), widths[i])).join(GAP).trimEnd());
|
|
1319
1344
|
}
|
|
1320
1345
|
}
|
|
1321
|
-
function renderRecord(obj) {
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1346
|
+
function renderRecord(obj, columns) {
|
|
1347
|
+
const specs = columns ? normalizeColumns(columns) : Object.keys(obj).map((key) => ({ key }));
|
|
1348
|
+
if (specs.length === 0) {
|
|
1324
1349
|
console.log(chalk6.dim("No fields."));
|
|
1325
1350
|
return;
|
|
1326
1351
|
}
|
|
1327
1352
|
if (!isInteractive()) {
|
|
1328
|
-
for (const
|
|
1329
|
-
console.log(`${key} ${forPipe(
|
|
1353
|
+
for (const spec of specs) {
|
|
1354
|
+
console.log(`${spec.key} ${forPipe(obj[spec.key], spec)}`);
|
|
1330
1355
|
}
|
|
1331
1356
|
return;
|
|
1332
1357
|
}
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
entries.reduce((max, [key]) => Math.max(max, key.length), 0)
|
|
1336
|
-
);
|
|
1358
|
+
const labels = specs.map((spec) => spec.header ?? recordLabel(spec.key));
|
|
1359
|
+
const labelWidth = Math.min(24, labels.reduce((max, label) => Math.max(max, displayWidth(label)), 0));
|
|
1337
1360
|
const valueWidth = Math.max(MIN_COLUMN_WIDTH, terminalWidth() - labelWidth - GAP.length);
|
|
1338
|
-
|
|
1339
|
-
const rendered = renderValue(
|
|
1340
|
-
const label = chalk6.bold(pad(truncate(
|
|
1341
|
-
if (displayWidth(rendered) <= valueWidth) {
|
|
1361
|
+
specs.forEach((spec, i) => {
|
|
1362
|
+
const rendered = renderValue(obj[spec.key], spec.kind ?? inferKind(spec.key));
|
|
1363
|
+
const label = chalk6.bold(pad(truncate(labels[i], labelWidth), labelWidth));
|
|
1364
|
+
if (!rendered.includes("\n") && displayWidth(rendered) <= valueWidth) {
|
|
1342
1365
|
console.log(label + GAP + rendered);
|
|
1343
|
-
|
|
1366
|
+
return;
|
|
1344
1367
|
}
|
|
1345
|
-
const lines = wrap(stripAnsi(
|
|
1368
|
+
const lines = rendered.split("\n").flatMap((line) => displayWidth(line) <= valueWidth || !/\s/.test(stripAnsi(line).trim()) ? [line] : wrap(stripAnsi(line), valueWidth));
|
|
1346
1369
|
console.log(label + GAP + (lines[0] ?? ""));
|
|
1347
1370
|
for (const line of lines.slice(1)) {
|
|
1348
1371
|
console.log(" ".repeat(labelWidth + GAP.length) + line);
|
|
1349
1372
|
}
|
|
1350
|
-
}
|
|
1373
|
+
});
|
|
1351
1374
|
}
|
|
1352
1375
|
function resolveSpecs(sample, columns) {
|
|
1353
1376
|
const specs = columns ? normalizeColumns(columns) : Object.keys(sample).map((key) => ({ key }));
|
|
@@ -6146,7 +6169,7 @@ var HELP = [
|
|
|
6146
6169
|
];
|
|
6147
6170
|
async function runChatRepl(options) {
|
|
6148
6171
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
6149
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
6172
|
+
const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
|
|
6150
6173
|
let sessionId = options.session;
|
|
6151
6174
|
let lastReportedSession;
|
|
6152
6175
|
console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -7004,14 +7027,18 @@ function cancelSentence(run) {
|
|
|
7004
7027
|
return `Run ${run.runId} is still ${phaseLabel(run).toLowerCase()}.`;
|
|
7005
7028
|
}
|
|
7006
7029
|
}
|
|
7007
|
-
function
|
|
7030
|
+
function runCredits(run) {
|
|
7031
|
+
return run.creditCommitted ?? run.creditSpent ?? null;
|
|
7032
|
+
}
|
|
7033
|
+
function terminalSentence(state, duration, credits = null) {
|
|
7034
|
+
const cost = credits === null ? "" : ` \xB7 ${credits.toLocaleString("en-US", { maximumFractionDigits: 0 })} ${credits === 1 ? "credit" : "credits"}`;
|
|
7008
7035
|
switch (state) {
|
|
7009
7036
|
case "COMPLETED":
|
|
7010
|
-
return `Analysis completed in ${duration}.`;
|
|
7037
|
+
return `Analysis completed in ${duration}${cost}.`;
|
|
7011
7038
|
case "CANCELLED":
|
|
7012
|
-
return `Analysis cancelled after ${duration}.`;
|
|
7039
|
+
return `Analysis cancelled after ${duration}${cost}.`;
|
|
7013
7040
|
default:
|
|
7014
|
-
return `Analysis failed after ${duration}.`;
|
|
7041
|
+
return `Analysis failed after ${duration}${cost}.`;
|
|
7015
7042
|
}
|
|
7016
7043
|
}
|
|
7017
7044
|
|
|
@@ -7361,6 +7388,116 @@ function whyNoPrompt(outputFormat, noInteractive) {
|
|
|
7361
7388
|
return "there is no terminal to ask";
|
|
7362
7389
|
}
|
|
7363
7390
|
|
|
7391
|
+
// src/commands/analyze/details.ts
|
|
7392
|
+
function analysisDetails(analysis, endpoint) {
|
|
7393
|
+
const data = {
|
|
7394
|
+
analysisId: analysis.analysisId,
|
|
7395
|
+
name: analysis.name,
|
|
7396
|
+
description: analysis.description,
|
|
7397
|
+
visibility: sentenceCase(analysis.visibility),
|
|
7398
|
+
introduction: analysis.introduction,
|
|
7399
|
+
data: dataShape(analysis.rowCount, analysis.columnCount),
|
|
7400
|
+
targets: analysis.targets,
|
|
7401
|
+
targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
|
|
7402
|
+
featureExclusions: analysis.featureExclusions,
|
|
7403
|
+
questions: analysis.questions,
|
|
7404
|
+
segment: analysis.segment,
|
|
7405
|
+
hours: hoursText(analysis.hours),
|
|
7406
|
+
budget: creditsText(analysis.budget),
|
|
7407
|
+
constraints: constraintsText(analysis),
|
|
7408
|
+
notifyByEmail: analysis.notifyByEmail == null ? "account default" : analysis.notifyByEmail ? "yes" : "no",
|
|
7409
|
+
latestRunState: analysis.latestRunState ? sentenceCase(analysis.latestRunState) : null,
|
|
7410
|
+
latestRunId: analysis.latestRunId,
|
|
7411
|
+
quality: qualityText(analysis),
|
|
7412
|
+
outputs: outputsText(analysis),
|
|
7413
|
+
resultRunId: analysis.resultRunId,
|
|
7414
|
+
creditsUsed: creditsText(analysis.creditsUsed),
|
|
7415
|
+
notebook: analysis.labUrl ? `${endpoint}${analysis.labUrl}` : null,
|
|
7416
|
+
projectId: analysis.projectId,
|
|
7417
|
+
parentAnalysisId: analysis.parentAnalysisId,
|
|
7418
|
+
createdAt: analysis.createdAt,
|
|
7419
|
+
modifiedAt: analysis.modifiedAt
|
|
7420
|
+
};
|
|
7421
|
+
const columns = [
|
|
7422
|
+
{ key: "analysisId", header: "Analysis ID", kind: "id" },
|
|
7423
|
+
{ key: "name", header: "Name" },
|
|
7424
|
+
{ key: "description", header: "Description" },
|
|
7425
|
+
{ key: "visibility", header: "Visibility" },
|
|
7426
|
+
{ key: "introduction", header: "Introduction" },
|
|
7427
|
+
{ key: "data", header: "Data" },
|
|
7428
|
+
{ key: "targets", header: "Targets" },
|
|
7429
|
+
{ key: "targetKinds", header: "Target kinds" },
|
|
7430
|
+
{ key: "featureExclusions", header: "Excluded columns" },
|
|
7431
|
+
{ key: "questions", header: "Questions" },
|
|
7432
|
+
{ key: "segment", header: "Segment" },
|
|
7433
|
+
{ key: "hours", header: "Computation time" },
|
|
7434
|
+
{ key: "budget", header: "Credit budget" },
|
|
7435
|
+
{ key: "constraints", header: "Constraints" },
|
|
7436
|
+
{ key: "notifyByEmail", header: "Email when done" },
|
|
7437
|
+
{ key: "latestRunState", header: "Latest run", kind: "state" },
|
|
7438
|
+
{ key: "latestRunId", header: "Latest run ID", kind: "id" },
|
|
7439
|
+
{ key: "quality", header: "Quality" },
|
|
7440
|
+
{ key: "outputs", header: "Outputs" },
|
|
7441
|
+
{ key: "resultRunId", header: "Result from run", kind: "id" },
|
|
7442
|
+
{ key: "creditsUsed", header: "Credits used" },
|
|
7443
|
+
{ key: "notebook", header: "Notebook" },
|
|
7444
|
+
{ key: "projectId", header: "Project ID", kind: "id" },
|
|
7445
|
+
{ key: "parentAnalysisId", header: "Refined from", kind: "id" },
|
|
7446
|
+
{ key: "createdAt", header: "Created", kind: "date" },
|
|
7447
|
+
{ key: "modifiedAt", header: "Modified", kind: "date" }
|
|
7448
|
+
];
|
|
7449
|
+
return { data, columns };
|
|
7450
|
+
}
|
|
7451
|
+
function sentenceCase(token) {
|
|
7452
|
+
const words = token.toLowerCase().replace(/_/g, " ");
|
|
7453
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
7454
|
+
}
|
|
7455
|
+
function hoursText(hours) {
|
|
7456
|
+
if (hours == null || hours === "") return null;
|
|
7457
|
+
const n = Number(hours);
|
|
7458
|
+
if (!Number.isFinite(n)) return hours;
|
|
7459
|
+
return `${formatNumber(n)} ${n === 1 ? "hour" : "hours"}`;
|
|
7460
|
+
}
|
|
7461
|
+
function creditsText(credits) {
|
|
7462
|
+
if (credits == null || credits === "") return null;
|
|
7463
|
+
const n = Number(credits);
|
|
7464
|
+
if (!Number.isFinite(n)) return String(credits);
|
|
7465
|
+
return `${formatNumber(n)} ${n === 1 ? "credit" : "credits"}`;
|
|
7466
|
+
}
|
|
7467
|
+
function dataShape(rows, columns) {
|
|
7468
|
+
if (rows == null && columns == null) return null;
|
|
7469
|
+
const parts = [];
|
|
7470
|
+
if (rows != null) parts.push(`${formatNumber(rows)} ${rows === 1 ? "row" : "rows"}`);
|
|
7471
|
+
if (columns != null) parts.push(`${formatNumber(columns)} ${columns === 1 ? "column" : "columns"}`);
|
|
7472
|
+
return parts.join(" \xD7 ");
|
|
7473
|
+
}
|
|
7474
|
+
function qualityText(analysis) {
|
|
7475
|
+
if (analysis.heldOutQuality != null) return qualityPercent(analysis.heldOutQuality);
|
|
7476
|
+
if (analysis.resultRunQuality != null) return `${qualityPercent(analysis.resultRunQuality)} on the training rows`;
|
|
7477
|
+
return null;
|
|
7478
|
+
}
|
|
7479
|
+
function outputsText(analysis) {
|
|
7480
|
+
const outputs = analysis.outputs ?? [];
|
|
7481
|
+
if (outputs.length === 0) return null;
|
|
7482
|
+
const lines = outputs.map((o) => {
|
|
7483
|
+
const name = o.title ?? o.target ?? "output";
|
|
7484
|
+
return o.quality != null ? `${name}: ${qualityPercent(o.quality)}` : name;
|
|
7485
|
+
});
|
|
7486
|
+
const more = (analysis.outputCount ?? outputs.length) - outputs.length;
|
|
7487
|
+
if (more > 0) lines.push(`and ${formatNumber(more)} more`);
|
|
7488
|
+
return lines.join("\n");
|
|
7489
|
+
}
|
|
7490
|
+
function constraintsText(analysis) {
|
|
7491
|
+
const parts = [];
|
|
7492
|
+
if (analysis.minComplexity != null) parts.push(`complexity at least ${formatNumber(analysis.minComplexity)}`);
|
|
7493
|
+
if (analysis.maxComplexity != null) parts.push(`complexity at most ${formatNumber(analysis.maxComplexity)}`);
|
|
7494
|
+
if (analysis.targetComplexity != null) parts.push(`aim for complexity ${formatNumber(analysis.targetComplexity)}`);
|
|
7495
|
+
if (analysis.targetQuality != null) parts.push(`stop at quality ${qualityPercent(analysis.targetQuality)}`);
|
|
7496
|
+
if (analysis.targetError != null) parts.push(`stop at error ${formatNumber(analysis.targetError)}`);
|
|
7497
|
+
if (analysis.minMilliseconds != null) parts.push(`search at least ${formatDurationPrecise(analysis.minMilliseconds)}`);
|
|
7498
|
+
return parts.length > 0 ? parts.join(", ") : "none";
|
|
7499
|
+
}
|
|
7500
|
+
|
|
7364
7501
|
// src/commands/analyze/index.ts
|
|
7365
7502
|
var POLL_INTERVAL_MS = 2e3;
|
|
7366
7503
|
var COLUMN_READ_ATTEMPTS = 3;
|
|
@@ -7604,19 +7741,21 @@ function safeParse(text2) {
|
|
|
7604
7741
|
async function reportTerminalRun(api, config, run, analysisId, runId, outputFormat) {
|
|
7605
7742
|
const baseStart = run.startedAt ?? run.submittedAt ?? Date.now();
|
|
7606
7743
|
const durationMs = (run.endedAt ?? Date.now()) - baseStart;
|
|
7744
|
+
const credits = runCredits(run);
|
|
7607
7745
|
if (outputFormat !== "human") {
|
|
7608
7746
|
format({
|
|
7609
7747
|
status: run.state.toLowerCase(),
|
|
7610
7748
|
runId,
|
|
7611
7749
|
analysisId,
|
|
7612
7750
|
durationMs,
|
|
7751
|
+
credits,
|
|
7613
7752
|
error: run.errorMessage
|
|
7614
7753
|
}, { format: outputFormat });
|
|
7615
7754
|
if (run.state !== "COMPLETED") process.exit(EXIT_FAILURE);
|
|
7616
7755
|
return;
|
|
7617
7756
|
}
|
|
7618
7757
|
console.log();
|
|
7619
|
-
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs));
|
|
7758
|
+
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs), credits);
|
|
7620
7759
|
if (run.state === "COMPLETED") {
|
|
7621
7760
|
success(sentence);
|
|
7622
7761
|
await printNotebookLink(api, config, analysisId);
|
|
@@ -7674,9 +7813,16 @@ async function getAnalysisDetails(analysisId, options, cmd) {
|
|
|
7674
7813
|
empty("analysis found");
|
|
7675
7814
|
return;
|
|
7676
7815
|
}
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7816
|
+
if (outputFormat !== "human") {
|
|
7817
|
+
format(result.analysis, { format: outputFormat });
|
|
7818
|
+
return;
|
|
7819
|
+
}
|
|
7820
|
+
const analysis = options.full ? result.analysis : { ...result.analysis, introduction: abbreviate(result.analysis.introduction) };
|
|
7821
|
+
const config = loadConfig();
|
|
7822
|
+
const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
|
|
7823
|
+
const details = analysisDetails(analysis, endpoint);
|
|
7824
|
+
format(details.data, { format: outputFormat, columns: details.columns });
|
|
7825
|
+
if (!options.full && isLong(result.analysis.introduction)) {
|
|
7680
7826
|
hint("Introduction abbreviated. Pass --full to print it whole.");
|
|
7681
7827
|
}
|
|
7682
7828
|
}
|
|
@@ -9521,7 +9667,7 @@ function registerShellCommand(program) {
|
|
|
9521
9667
|
});
|
|
9522
9668
|
const api = createApiClient();
|
|
9523
9669
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
9524
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
9670
|
+
const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
|
|
9525
9671
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
9526
9672
|
console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
9527
9673
|
console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
@@ -10566,4 +10712,4 @@ export {
|
|
|
10566
10712
|
PromptCancelled,
|
|
10567
10713
|
createProgram
|
|
10568
10714
|
};
|
|
10569
|
-
//# sourceMappingURL=chunk-
|
|
10715
|
+
//# sourceMappingURL=chunk-SA4Y2GNR.js.map
|