@diafunc/cli 0.15.0 → 0.17.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-XK2UUCKV.js → chunk-6ZOIOHSW.js} +230 -33
- package/dist/chunk-6ZOIOHSW.js.map +1 -0
- package/dist/{chunk-37PYSRXA.js → chunk-QWSCORJH.js} +2 -2
- package/dist/{chunk-VL7FZNQK.js → chunk-ZT25YY7J.js} +2 -2
- package/dist/{chunk-VL7FZNQK.js.map → chunk-ZT25YY7J.js.map} +1 -1
- package/dist/src/index.js +2 -2
- package/dist/update-check-5CPEMV2M.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-QWSCORJH.js.map} +0 -0
- /package/dist/{update-check-2GASRVMF.js.map → update-check-5CPEMV2M.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-6ZOIOHSW.js";
|
|
8
8
|
import {
|
|
9
9
|
getUpdateNotice
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-QWSCORJH.js";
|
|
11
11
|
import {
|
|
12
12
|
package_default
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-ZT25YY7J.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-ZT25YY7J.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 }));
|
|
@@ -1597,6 +1620,22 @@ function createAnalysisService(client) {
|
|
|
1597
1620
|
body: request
|
|
1598
1621
|
});
|
|
1599
1622
|
},
|
|
1623
|
+
async patchFeatureExclusions(analysisId, request) {
|
|
1624
|
+
return client.request({
|
|
1625
|
+
method: "PATCH",
|
|
1626
|
+
service: SERVICE2,
|
|
1627
|
+
path: `/${encodeURIComponent(analysisId)}/feature-exclusions`,
|
|
1628
|
+
body: request
|
|
1629
|
+
});
|
|
1630
|
+
},
|
|
1631
|
+
async patchConfirmedInputs(analysisId, request) {
|
|
1632
|
+
return client.request({
|
|
1633
|
+
method: "PATCH",
|
|
1634
|
+
service: SERVICE2,
|
|
1635
|
+
path: `/${encodeURIComponent(analysisId)}/confirmed-inputs`,
|
|
1636
|
+
body: request
|
|
1637
|
+
});
|
|
1638
|
+
},
|
|
1600
1639
|
async patchSegment(analysisId, request) {
|
|
1601
1640
|
return client.request({
|
|
1602
1641
|
method: "PATCH",
|
|
@@ -6146,7 +6185,7 @@ var HELP = [
|
|
|
6146
6185
|
];
|
|
6147
6186
|
async function runChatRepl(options) {
|
|
6148
6187
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
6149
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
6188
|
+
const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
|
|
6150
6189
|
let sessionId = options.session;
|
|
6151
6190
|
let lastReportedSession;
|
|
6152
6191
|
console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -7004,14 +7043,18 @@ function cancelSentence(run) {
|
|
|
7004
7043
|
return `Run ${run.runId} is still ${phaseLabel(run).toLowerCase()}.`;
|
|
7005
7044
|
}
|
|
7006
7045
|
}
|
|
7007
|
-
function
|
|
7046
|
+
function runCredits(run) {
|
|
7047
|
+
return run.creditCommitted ?? run.creditSpent ?? null;
|
|
7048
|
+
}
|
|
7049
|
+
function terminalSentence(state, duration, credits = null) {
|
|
7050
|
+
const cost = credits === null ? "" : ` \xB7 ${credits.toLocaleString("en-US", { maximumFractionDigits: 0 })} ${credits === 1 ? "credit" : "credits"}`;
|
|
7008
7051
|
switch (state) {
|
|
7009
7052
|
case "COMPLETED":
|
|
7010
|
-
return `Analysis completed in ${duration}.`;
|
|
7053
|
+
return `Analysis completed in ${duration}${cost}.`;
|
|
7011
7054
|
case "CANCELLED":
|
|
7012
|
-
return `Analysis cancelled after ${duration}.`;
|
|
7055
|
+
return `Analysis cancelled after ${duration}${cost}.`;
|
|
7013
7056
|
default:
|
|
7014
|
-
return `Analysis failed after ${duration}.`;
|
|
7057
|
+
return `Analysis failed after ${duration}${cost}.`;
|
|
7015
7058
|
}
|
|
7016
7059
|
}
|
|
7017
7060
|
|
|
@@ -7361,6 +7404,118 @@ function whyNoPrompt(outputFormat, noInteractive) {
|
|
|
7361
7404
|
return "there is no terminal to ask";
|
|
7362
7405
|
}
|
|
7363
7406
|
|
|
7407
|
+
// src/commands/analyze/details.ts
|
|
7408
|
+
function analysisDetails(analysis, endpoint) {
|
|
7409
|
+
const data = {
|
|
7410
|
+
analysisId: analysis.analysisId,
|
|
7411
|
+
name: analysis.name,
|
|
7412
|
+
description: analysis.description,
|
|
7413
|
+
visibility: sentenceCase(analysis.visibility),
|
|
7414
|
+
introduction: analysis.introduction,
|
|
7415
|
+
data: dataShape(analysis.rowCount, analysis.columnCount),
|
|
7416
|
+
targets: analysis.targets,
|
|
7417
|
+
targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
|
|
7418
|
+
featureExclusions: analysis.featureExclusions,
|
|
7419
|
+
confirmedInputs: analysis.confirmedInputs,
|
|
7420
|
+
questions: analysis.questions,
|
|
7421
|
+
segment: analysis.segment,
|
|
7422
|
+
hours: hoursText(analysis.hours),
|
|
7423
|
+
budget: creditsText(analysis.budget),
|
|
7424
|
+
constraints: constraintsText(analysis),
|
|
7425
|
+
notifyByEmail: analysis.notifyByEmail == null ? "account default" : analysis.notifyByEmail ? "yes" : "no",
|
|
7426
|
+
latestRunState: analysis.latestRunState ? sentenceCase(analysis.latestRunState) : null,
|
|
7427
|
+
latestRunId: analysis.latestRunId,
|
|
7428
|
+
quality: qualityText(analysis),
|
|
7429
|
+
outputs: outputsText(analysis),
|
|
7430
|
+
resultRunId: analysis.resultRunId,
|
|
7431
|
+
creditsUsed: creditsText(analysis.creditsUsed),
|
|
7432
|
+
notebook: analysis.labUrl ? `${endpoint}${analysis.labUrl}` : null,
|
|
7433
|
+
projectId: analysis.projectId,
|
|
7434
|
+
parentAnalysisId: analysis.parentAnalysisId,
|
|
7435
|
+
createdAt: analysis.createdAt,
|
|
7436
|
+
modifiedAt: analysis.modifiedAt
|
|
7437
|
+
};
|
|
7438
|
+
const columns = [
|
|
7439
|
+
{ key: "analysisId", header: "Analysis ID", kind: "id" },
|
|
7440
|
+
{ key: "name", header: "Name" },
|
|
7441
|
+
{ key: "description", header: "Description" },
|
|
7442
|
+
{ key: "visibility", header: "Visibility" },
|
|
7443
|
+
{ key: "introduction", header: "Introduction" },
|
|
7444
|
+
{ key: "data", header: "Data" },
|
|
7445
|
+
{ key: "targets", header: "Targets" },
|
|
7446
|
+
{ key: "targetKinds", header: "Target kinds" },
|
|
7447
|
+
{ key: "featureExclusions", header: "Excluded columns" },
|
|
7448
|
+
{ key: "confirmedInputs", header: "Known before the outcome" },
|
|
7449
|
+
{ key: "questions", header: "Questions" },
|
|
7450
|
+
{ key: "segment", header: "Segment" },
|
|
7451
|
+
{ key: "hours", header: "Computation time" },
|
|
7452
|
+
{ key: "budget", header: "Credit budget" },
|
|
7453
|
+
{ key: "constraints", header: "Constraints" },
|
|
7454
|
+
{ key: "notifyByEmail", header: "Email when done" },
|
|
7455
|
+
{ key: "latestRunState", header: "Latest run", kind: "state" },
|
|
7456
|
+
{ key: "latestRunId", header: "Latest run ID", kind: "id" },
|
|
7457
|
+
{ key: "quality", header: "Quality" },
|
|
7458
|
+
{ key: "outputs", header: "Outputs" },
|
|
7459
|
+
{ key: "resultRunId", header: "Result from run", kind: "id" },
|
|
7460
|
+
{ key: "creditsUsed", header: "Credits used" },
|
|
7461
|
+
{ key: "notebook", header: "Notebook" },
|
|
7462
|
+
{ key: "projectId", header: "Project ID", kind: "id" },
|
|
7463
|
+
{ key: "parentAnalysisId", header: "Refined from", kind: "id" },
|
|
7464
|
+
{ key: "createdAt", header: "Created", kind: "date" },
|
|
7465
|
+
{ key: "modifiedAt", header: "Modified", kind: "date" }
|
|
7466
|
+
];
|
|
7467
|
+
return { data, columns };
|
|
7468
|
+
}
|
|
7469
|
+
function sentenceCase(token) {
|
|
7470
|
+
const words = token.toLowerCase().replace(/_/g, " ");
|
|
7471
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
7472
|
+
}
|
|
7473
|
+
function hoursText(hours) {
|
|
7474
|
+
if (hours == null || hours === "") return null;
|
|
7475
|
+
const n = Number(hours);
|
|
7476
|
+
if (!Number.isFinite(n)) return hours;
|
|
7477
|
+
return `${formatNumber(n)} ${n === 1 ? "hour" : "hours"}`;
|
|
7478
|
+
}
|
|
7479
|
+
function creditsText(credits) {
|
|
7480
|
+
if (credits == null || credits === "") return null;
|
|
7481
|
+
const n = Number(credits);
|
|
7482
|
+
if (!Number.isFinite(n)) return String(credits);
|
|
7483
|
+
return `${formatNumber(n)} ${n === 1 ? "credit" : "credits"}`;
|
|
7484
|
+
}
|
|
7485
|
+
function dataShape(rows, columns) {
|
|
7486
|
+
if (rows == null && columns == null) return null;
|
|
7487
|
+
const parts = [];
|
|
7488
|
+
if (rows != null) parts.push(`${formatNumber(rows)} ${rows === 1 ? "row" : "rows"}`);
|
|
7489
|
+
if (columns != null) parts.push(`${formatNumber(columns)} ${columns === 1 ? "column" : "columns"}`);
|
|
7490
|
+
return parts.join(" \xD7 ");
|
|
7491
|
+
}
|
|
7492
|
+
function qualityText(analysis) {
|
|
7493
|
+
if (analysis.heldOutQuality != null) return qualityPercent(analysis.heldOutQuality);
|
|
7494
|
+
if (analysis.resultRunQuality != null) return `${qualityPercent(analysis.resultRunQuality)} on the training rows`;
|
|
7495
|
+
return null;
|
|
7496
|
+
}
|
|
7497
|
+
function outputsText(analysis) {
|
|
7498
|
+
const outputs = analysis.outputs ?? [];
|
|
7499
|
+
if (outputs.length === 0) return null;
|
|
7500
|
+
const lines = outputs.map((o) => {
|
|
7501
|
+
const name = o.title ?? o.target ?? "output";
|
|
7502
|
+
return o.quality != null ? `${name}: ${qualityPercent(o.quality)}` : name;
|
|
7503
|
+
});
|
|
7504
|
+
const more = (analysis.outputCount ?? outputs.length) - outputs.length;
|
|
7505
|
+
if (more > 0) lines.push(`and ${formatNumber(more)} more`);
|
|
7506
|
+
return lines.join("\n");
|
|
7507
|
+
}
|
|
7508
|
+
function constraintsText(analysis) {
|
|
7509
|
+
const parts = [];
|
|
7510
|
+
if (analysis.minComplexity != null) parts.push(`complexity at least ${formatNumber(analysis.minComplexity)}`);
|
|
7511
|
+
if (analysis.maxComplexity != null) parts.push(`complexity at most ${formatNumber(analysis.maxComplexity)}`);
|
|
7512
|
+
if (analysis.targetComplexity != null) parts.push(`aim for complexity ${formatNumber(analysis.targetComplexity)}`);
|
|
7513
|
+
if (analysis.targetQuality != null) parts.push(`stop at quality ${qualityPercent(analysis.targetQuality)}`);
|
|
7514
|
+
if (analysis.targetError != null) parts.push(`stop at error ${formatNumber(analysis.targetError)}`);
|
|
7515
|
+
if (analysis.minMilliseconds != null) parts.push(`search at least ${formatDurationPrecise(analysis.minMilliseconds)}`);
|
|
7516
|
+
return parts.length > 0 ? parts.join(", ") : "none";
|
|
7517
|
+
}
|
|
7518
|
+
|
|
7364
7519
|
// src/commands/analyze/index.ts
|
|
7365
7520
|
var POLL_INTERVAL_MS = 2e3;
|
|
7366
7521
|
var COLUMN_READ_ATTEMPTS = 3;
|
|
@@ -7604,19 +7759,21 @@ function safeParse(text2) {
|
|
|
7604
7759
|
async function reportTerminalRun(api, config, run, analysisId, runId, outputFormat) {
|
|
7605
7760
|
const baseStart = run.startedAt ?? run.submittedAt ?? Date.now();
|
|
7606
7761
|
const durationMs = (run.endedAt ?? Date.now()) - baseStart;
|
|
7762
|
+
const credits = runCredits(run);
|
|
7607
7763
|
if (outputFormat !== "human") {
|
|
7608
7764
|
format({
|
|
7609
7765
|
status: run.state.toLowerCase(),
|
|
7610
7766
|
runId,
|
|
7611
7767
|
analysisId,
|
|
7612
7768
|
durationMs,
|
|
7769
|
+
credits,
|
|
7613
7770
|
error: run.errorMessage
|
|
7614
7771
|
}, { format: outputFormat });
|
|
7615
7772
|
if (run.state !== "COMPLETED") process.exit(EXIT_FAILURE);
|
|
7616
7773
|
return;
|
|
7617
7774
|
}
|
|
7618
7775
|
console.log();
|
|
7619
|
-
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs));
|
|
7776
|
+
const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs), credits);
|
|
7620
7777
|
if (run.state === "COMPLETED") {
|
|
7621
7778
|
success(sentence);
|
|
7622
7779
|
await printNotebookLink(api, config, analysisId);
|
|
@@ -7674,9 +7831,16 @@ async function getAnalysisDetails(analysisId, options, cmd) {
|
|
|
7674
7831
|
empty("analysis found");
|
|
7675
7832
|
return;
|
|
7676
7833
|
}
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7834
|
+
if (outputFormat !== "human") {
|
|
7835
|
+
format(result.analysis, { format: outputFormat });
|
|
7836
|
+
return;
|
|
7837
|
+
}
|
|
7838
|
+
const analysis = options.full ? result.analysis : { ...result.analysis, introduction: abbreviate(result.analysis.introduction) };
|
|
7839
|
+
const config = loadConfig();
|
|
7840
|
+
const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
|
|
7841
|
+
const details = analysisDetails(analysis, endpoint);
|
|
7842
|
+
format(details.data, { format: outputFormat, columns: details.columns });
|
|
7843
|
+
if (!options.full && isLong(result.analysis.introduction)) {
|
|
7680
7844
|
hint("Introduction abbreviated. Pass --full to print it whole.");
|
|
7681
7845
|
}
|
|
7682
7846
|
}
|
|
@@ -8004,7 +8168,7 @@ async function updateTriggerCmd(triggerId, options, cmd) {
|
|
|
8004
8168
|
}
|
|
8005
8169
|
function registerAnalyzeCommand(program) {
|
|
8006
8170
|
const analyze = program.command("analyze").description("Run and manage automatic analyses");
|
|
8007
|
-
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
|
|
8171
|
+
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 and more than 35 file formats; see `table import-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) => {
|
|
8008
8172
|
try {
|
|
8009
8173
|
if (!file) {
|
|
8010
8174
|
analyze.help();
|
|
@@ -8158,6 +8322,34 @@ function registerAnalyzeCommand(program) {
|
|
|
8158
8322
|
handleError(error);
|
|
8159
8323
|
}
|
|
8160
8324
|
});
|
|
8325
|
+
analyze.command("feature-exclusions").description("Set the columns every fit leaves out as an input (comma-separated; empty string leaves nothing out)").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated column names").action(async (id, csv, _options, cmd) => {
|
|
8326
|
+
try {
|
|
8327
|
+
const columns = parseCsv(csv) ?? [];
|
|
8328
|
+
await patchAndPrint(
|
|
8329
|
+
id,
|
|
8330
|
+
csv,
|
|
8331
|
+
(api, aid) => api.analysis.patchFeatureExclusions(aid, { columns }),
|
|
8332
|
+
"Columns left out of the fit",
|
|
8333
|
+
cmd
|
|
8334
|
+
);
|
|
8335
|
+
} catch (error) {
|
|
8336
|
+
handleError(error);
|
|
8337
|
+
}
|
|
8338
|
+
});
|
|
8339
|
+
analyze.command("confirmed-inputs").description("Set the columns the owner confirms as known before the outcome (comma-separated; empty string confirms nothing). A confirmed column raises no leakage concern.").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated column names").action(async (id, csv, _options, cmd) => {
|
|
8340
|
+
try {
|
|
8341
|
+
const columns = parseCsv(csv) ?? [];
|
|
8342
|
+
await patchAndPrint(
|
|
8343
|
+
id,
|
|
8344
|
+
csv,
|
|
8345
|
+
(api, aid) => api.analysis.patchConfirmedInputs(aid, { columns }),
|
|
8346
|
+
"Columns known before the outcome",
|
|
8347
|
+
cmd
|
|
8348
|
+
);
|
|
8349
|
+
} catch (error) {
|
|
8350
|
+
handleError(error);
|
|
8351
|
+
}
|
|
8352
|
+
});
|
|
8161
8353
|
analyze.command("questions").description("Set the questions list (comma-separated)").argument("<id>", "Analysis ID").argument("<csv>", "Comma-separated questions (empty string to clear)").action(async (id, csv, _options, cmd) => {
|
|
8162
8354
|
try {
|
|
8163
8355
|
const questions = parseCsv(csv) ?? [];
|
|
@@ -8185,7 +8377,7 @@ function registerAnalyzeCommand(program) {
|
|
|
8185
8377
|
handleError(error);
|
|
8186
8378
|
}
|
|
8187
8379
|
});
|
|
8188
|
-
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
|
|
8380
|
+
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 and more than 35 file formats; see `table import-formats`)").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").action(async (id, file, options) => {
|
|
8189
8381
|
try {
|
|
8190
8382
|
await uploadData(id, file, options);
|
|
8191
8383
|
} catch (error) {
|
|
@@ -8979,6 +9171,9 @@ _diafunc_completions() {
|
|
|
8979
9171
|
*) COMPREPLY=($(compgen -W "\${subcommands}" -- "\${cur}")) ;;
|
|
8980
9172
|
esac
|
|
8981
9173
|
;;
|
|
9174
|
+
analyze)
|
|
9175
|
+
COMPREPLY=($(compgen -f -- "\${cur}"))
|
|
9176
|
+
;;
|
|
8982
9177
|
*)
|
|
8983
9178
|
COMPREPLY=($(compgen -W "\${commands}" -- "\${cur}"))
|
|
8984
9179
|
;;
|
|
@@ -9038,7 +9233,7 @@ _diafunc() {
|
|
|
9038
9233
|
schedule) _values 'subcommand' call ;;
|
|
9039
9234
|
chat) _diafunc_chat ;;
|
|
9040
9235
|
admin) _diafunc_admin ;;
|
|
9041
|
-
analyze) _files
|
|
9236
|
+
analyze) _files ;;
|
|
9042
9237
|
esac
|
|
9043
9238
|
;;
|
|
9044
9239
|
esac
|
|
@@ -9521,7 +9716,7 @@ function registerShellCommand(program) {
|
|
|
9521
9716
|
});
|
|
9522
9717
|
const api = createApiClient();
|
|
9523
9718
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
9524
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
9719
|
+
const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
|
|
9525
9720
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
9526
9721
|
console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
9527
9722
|
console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
@@ -9815,6 +10010,8 @@ var INDEX = { kind: "number", min: 0, integer: true };
|
|
|
9815
10010
|
var BY_COMMAND = {
|
|
9816
10011
|
"analyze segment": { "<name>": { kind: "analysisColumns", multiple: false, allowEmpty: true } },
|
|
9817
10012
|
"analyze targets": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
|
|
10013
|
+
"analyze feature-exclusions": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
|
|
10014
|
+
"analyze confirmed-inputs": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
|
|
9818
10015
|
"analyze questions": { "<csv>": TEXT_OR_EMPTY },
|
|
9819
10016
|
"analyze description": { "<text>": TEXT_OR_EMPTY },
|
|
9820
10017
|
"analyze introduction": { "<markdown>": TEXT_OR_EMPTY },
|
|
@@ -10566,4 +10763,4 @@ export {
|
|
|
10566
10763
|
PromptCancelled,
|
|
10567
10764
|
createProgram
|
|
10568
10765
|
};
|
|
10569
|
-
//# sourceMappingURL=chunk-
|
|
10766
|
+
//# sourceMappingURL=chunk-6ZOIOHSW.js.map
|