@diafunc/cli 0.28.0 → 0.29.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-YK663CPM.js → chunk-CWZPEFGN.js} +2 -2
- package/dist/{chunk-YK663CPM.js.map → chunk-CWZPEFGN.js.map} +1 -1
- package/dist/{chunk-ZBC2S7R6.js → chunk-T7BPK4LW.js} +55 -11
- package/dist/chunk-T7BPK4LW.js.map +1 -0
- package/dist/{chunk-5SPTUGOJ.js → chunk-Z5XCMRDG.js} +2 -2
- package/dist/src/index.js +2 -2
- package/dist/update-check-7CVBVYDK.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-ZBC2S7R6.js.map +0 -1
- package/dist/update-check-JLTGX3S4.js +0 -8
- /package/dist/{chunk-5SPTUGOJ.js.map → chunk-Z5XCMRDG.js.map} +0 -0
- /package/dist/{update-check-JLTGX3S4.js.map → update-check-7CVBVYDK.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-T7BPK4LW.js";
|
|
8
8
|
import {
|
|
9
9
|
getUpdateNotice
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-Z5XCMRDG.js";
|
|
11
11
|
import {
|
|
12
12
|
package_default
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-CWZPEFGN.js";
|
|
14
14
|
|
|
15
15
|
// bin/diafunc.ts
|
|
16
16
|
import chalk2 from "chalk";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@diafunc/cli",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.29.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-CWZPEFGN.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.29.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-CWZPEFGN.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import chalk40 from "chalk";
|
|
@@ -7000,7 +7000,7 @@ var HELP = [
|
|
|
7000
7000
|
];
|
|
7001
7001
|
async function runChatRepl(options) {
|
|
7002
7002
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
7003
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
7003
|
+
const { getUpdateNotice } = await import("./update-check-7CVBVYDK.js");
|
|
7004
7004
|
let sessionId = options.session;
|
|
7005
7005
|
let lastReportedSession;
|
|
7006
7006
|
console.log(chalk20.bold("Diafunc chat") + chalk20.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -8052,6 +8052,29 @@ function importingLabel(dataImport) {
|
|
|
8052
8052
|
if (progress === null || progress === void 0 || !Number.isFinite(progress)) return "Importing data";
|
|
8053
8053
|
return `Importing data, ${Math.floor(Math.max(0, Math.min(progress, 1)) * 100)} %`;
|
|
8054
8054
|
}
|
|
8055
|
+
function verdictLabel(run) {
|
|
8056
|
+
switch (run.validity) {
|
|
8057
|
+
case "valid":
|
|
8058
|
+
if (!run.validityByStatement) return "Valid";
|
|
8059
|
+
return run.validityReviewedAt != null ? "Valid by the owner's statement, reviewed" : "Valid by the owner's statement";
|
|
8060
|
+
case "needs_review":
|
|
8061
|
+
return "Needs review";
|
|
8062
|
+
case "not_valid":
|
|
8063
|
+
return "Not valid";
|
|
8064
|
+
default:
|
|
8065
|
+
return null;
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
function verdictSentence(validity) {
|
|
8069
|
+
switch (validity) {
|
|
8070
|
+
case "needs_review":
|
|
8071
|
+
return "The result needs review: the report's Validity chapter says why and what settles it.";
|
|
8072
|
+
case "not_valid":
|
|
8073
|
+
return "The result is not valid: the report's Validity chapter says why.";
|
|
8074
|
+
default:
|
|
8075
|
+
return null;
|
|
8076
|
+
}
|
|
8077
|
+
}
|
|
8055
8078
|
|
|
8056
8079
|
// src/commands/analyze/watch-view.ts
|
|
8057
8080
|
function overallProgress(run) {
|
|
@@ -8612,7 +8635,7 @@ function whyNoPrompt(outputFormat, noInteractive) {
|
|
|
8612
8635
|
import chalk28 from "chalk";
|
|
8613
8636
|
|
|
8614
8637
|
// src/commands/analyze/details.ts
|
|
8615
|
-
function analysisDetails(analysis, endpoint) {
|
|
8638
|
+
function analysisDetails(analysis, endpoint, verdict = null) {
|
|
8616
8639
|
const data = {
|
|
8617
8640
|
analysisId: analysis.analysisId,
|
|
8618
8641
|
name: analysis.name,
|
|
@@ -8635,7 +8658,8 @@ function analysisDetails(analysis, endpoint) {
|
|
|
8635
8658
|
// While the data is still arriving no run can start, so the import is what the analysis is doing.
|
|
8636
8659
|
latestRunState: isImporting(analysis.dataImport) ? importingLabel(analysis.dataImport) : analysis.latestRunState ? sentenceCase(analysis.latestRunState) : null,
|
|
8637
8660
|
latestRunId: analysis.latestRunId,
|
|
8638
|
-
quality: qualityText(analysis),
|
|
8661
|
+
quality: qualityText(analysis, verdict),
|
|
8662
|
+
validity: verdict ? verdictLabel(verdict) : null,
|
|
8639
8663
|
targetResults: targetResultsText(analysis),
|
|
8640
8664
|
resultRunId: analysis.resultRunId,
|
|
8641
8665
|
creditsUsed: creditsText(analysis.creditsUsed),
|
|
@@ -8667,6 +8691,7 @@ function analysisDetails(analysis, endpoint) {
|
|
|
8667
8691
|
{ key: "latestRunState", header: "Latest run", kind: "state" },
|
|
8668
8692
|
{ key: "latestRunId", header: "Latest run ID", kind: "id" },
|
|
8669
8693
|
{ key: "quality", header: "Quality" },
|
|
8694
|
+
{ key: "validity", header: "Validity" },
|
|
8670
8695
|
{ key: "targetResults", header: "Target results" },
|
|
8671
8696
|
{ key: "resultRunId", header: "Result from run", kind: "id" },
|
|
8672
8697
|
{ key: "creditsUsed", header: "Credits used" },
|
|
@@ -8705,10 +8730,11 @@ function dataShape(rows, columns) {
|
|
|
8705
8730
|
if (columns != null) parts.push(`${formatNumber(columns)} ${columns === 1 ? "column" : "columns"}`);
|
|
8706
8731
|
return parts.join(" \xD7 ");
|
|
8707
8732
|
}
|
|
8708
|
-
function qualityText(analysis) {
|
|
8709
|
-
if (
|
|
8710
|
-
|
|
8711
|
-
return null;
|
|
8733
|
+
function qualityText(analysis, verdict) {
|
|
8734
|
+
if (verdict?.validity === "not_valid") return "not shown: the result is not valid";
|
|
8735
|
+
const figure = analysis.heldOutQuality != null ? qualityPercent(analysis.heldOutQuality) : analysis.resultRunQuality != null ? `${qualityPercent(analysis.resultRunQuality)} on the training rows` : null;
|
|
8736
|
+
if (figure == null) return null;
|
|
8737
|
+
return verdict?.validity === "needs_review" ? `${figure}, needs review` : figure;
|
|
8712
8738
|
}
|
|
8713
8739
|
function targetResultsText(analysis) {
|
|
8714
8740
|
const results = analysis.targetResults ?? [];
|
|
@@ -9439,6 +9465,7 @@ async function reportTerminalRun(api, config, run, analysisId, runId, outputForm
|
|
|
9439
9465
|
analysisId,
|
|
9440
9466
|
durationMs,
|
|
9441
9467
|
credits,
|
|
9468
|
+
validity: run.validity ?? null,
|
|
9442
9469
|
error: run.errorMessage
|
|
9443
9470
|
}, { format: outputFormat });
|
|
9444
9471
|
if (run.state !== "COMPLETED") process.exit(EXIT_FAILURE);
|
|
@@ -9448,6 +9475,8 @@ async function reportTerminalRun(api, config, run, analysisId, runId, outputForm
|
|
|
9448
9475
|
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs), credits);
|
|
9449
9476
|
if (run.state === "COMPLETED") {
|
|
9450
9477
|
success(sentence);
|
|
9478
|
+
const verdict = verdictSentence(run.validity);
|
|
9479
|
+
if (verdict) warn(verdict);
|
|
9451
9480
|
await printNotebookLink(api, config, analysisId);
|
|
9452
9481
|
return;
|
|
9453
9482
|
}
|
|
@@ -9513,12 +9542,23 @@ async function getAnalysisDetails(analysisId, options, cmd) {
|
|
|
9513
9542
|
const analysis = options.full ? result.analysis : { ...result.analysis, introduction: abbreviate(result.analysis.introduction) };
|
|
9514
9543
|
const config = loadConfig();
|
|
9515
9544
|
const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
|
|
9516
|
-
const details = analysisDetails(analysis, endpoint);
|
|
9545
|
+
const details = analysisDetails(analysis, endpoint, await resultVerdict(api, result.analysis));
|
|
9517
9546
|
format(details.data, { format: outputFormat, columns: details.columns });
|
|
9518
9547
|
if (!options.full && isLong(result.analysis.introduction)) {
|
|
9519
9548
|
hint("Introduction abbreviated. Pass --full to print it whole.");
|
|
9520
9549
|
}
|
|
9521
9550
|
}
|
|
9551
|
+
async function resultVerdict(api, analysis) {
|
|
9552
|
+
if (!analysis.resultRunId) return null;
|
|
9553
|
+
try {
|
|
9554
|
+
const runs = await api.analysis.getRunsForAnalysis(analysis.analysisId, RESULT_RUN_LOOKBACK);
|
|
9555
|
+
return runs.find((r) => r.runId === analysis.resultRunId) ?? null;
|
|
9556
|
+
} catch (error) {
|
|
9557
|
+
if (isAuthenticationFailure(error)) throw error;
|
|
9558
|
+
return null;
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9561
|
+
var RESULT_RUN_LOOKBACK = 20;
|
|
9522
9562
|
var INTRODUCTION_PREVIEW_LINES = 3;
|
|
9523
9563
|
function isLong(text2) {
|
|
9524
9564
|
return Boolean(text2 && text2.split("\n").length > INTRODUCTION_PREVIEW_LINES);
|
|
@@ -9547,6 +9587,8 @@ async function watchAnalysis(analysisId, cmd) {
|
|
|
9547
9587
|
const sentence = latestRunSentence(latest.state);
|
|
9548
9588
|
if (latest.state === "COMPLETED") {
|
|
9549
9589
|
success(sentence);
|
|
9590
|
+
const verdict = verdictSentence(latest.validity);
|
|
9591
|
+
if (verdict) warn(verdict);
|
|
9550
9592
|
} else {
|
|
9551
9593
|
warn(sentence);
|
|
9552
9594
|
if (latest.errorMessage) hint(latest.errorMessage);
|
|
@@ -9804,6 +9846,7 @@ async function listRuns(analysisId, count, cmd) {
|
|
|
9804
9846
|
runId: r.runId,
|
|
9805
9847
|
state: r.state,
|
|
9806
9848
|
phase: runPhaseCell(r),
|
|
9849
|
+
validity: verdictLabel(r),
|
|
9807
9850
|
submittedAt: r.submittedAt,
|
|
9808
9851
|
startedAt: r.startedAt,
|
|
9809
9852
|
endedAt: r.endedAt,
|
|
@@ -9814,6 +9857,7 @@ async function listRuns(analysisId, count, cmd) {
|
|
|
9814
9857
|
{ key: "runId", kind: "id" },
|
|
9815
9858
|
{ key: "state", kind: "state" },
|
|
9816
9859
|
{ key: "phase" },
|
|
9860
|
+
{ key: "validity" },
|
|
9817
9861
|
{ key: "submittedAt", header: "submitted", kind: "date" },
|
|
9818
9862
|
{ key: "endedAt", header: "ended", kind: "date" }
|
|
9819
9863
|
]
|
|
@@ -11884,7 +11928,7 @@ function registerShellCommand(program) {
|
|
|
11884
11928
|
});
|
|
11885
11929
|
const api = createApiClient();
|
|
11886
11930
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
11887
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
11931
|
+
const { getUpdateNotice } = await import("./update-check-7CVBVYDK.js");
|
|
11888
11932
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
11889
11933
|
console.log(chalk35.bold("Diafunc shell") + chalk35.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
11890
11934
|
console.log(chalk35.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
@@ -12943,4 +12987,4 @@ export {
|
|
|
12943
12987
|
PromptCancelled,
|
|
12944
12988
|
createProgram
|
|
12945
12989
|
};
|
|
12946
|
-
//# sourceMappingURL=chunk-
|
|
12990
|
+
//# sourceMappingURL=chunk-T7BPK4LW.js.map
|