@diafunc/cli 0.14.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.
@@ -4,13 +4,13 @@ import {
4
4
  PromptCancelled,
5
5
  createProgram,
6
6
  handleError
7
- } from "../chunk-V3EXWLZP.js";
7
+ } from "../chunk-SA4Y2GNR.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-XXWRNCTW.js";
10
+ } from "../chunk-3XAPBWCA.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-5VMDFBM6.js";
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-5VMDFBM6.js";
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-XXWRNCTW.js.map
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.14.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-5VMDFBM6.js.map
65
+ //# sourceMappingURL=chunk-EZMZFU5V.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.14.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
+ {"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-5VMDFBM6.js";
3
+ } from "./chunk-EZMZFU5V.js";
4
4
 
5
5
  // src/index.ts
6
6
  import chalk36 from "chalk";
@@ -270,6 +270,7 @@ ${bodyPreview}`));
270
270
  body = JSON.stringify(opts.body);
271
271
  }
272
272
  headers["User-Agent"] = `diafunc-cli/${package_default.version} (${process.platform}; node ${process.versions.node})`;
273
+ headers["X-Diafunc-Client"] = `cli/${package_default.version}`;
273
274
  const retryable = RETRYABLE_METHODS.has(opts.method);
274
275
  const maxAttempts = retryable ? MAX_ATTEMPTS : 1;
275
276
  let lastError;
@@ -1058,6 +1059,25 @@ function normalizeColumns(columns) {
1058
1059
  function humanizeKey(key) {
1059
1060
  return key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").toLowerCase();
1060
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
+ }
1061
1081
  function headerOf(spec) {
1062
1082
  return spec.header ?? humanizeKey(spec.key);
1063
1083
  }
@@ -1156,7 +1176,7 @@ function renderValue(value, kind = "text", plain = false) {
1156
1176
  if (typeof value === "boolean") return renderBoolean(value, plain);
1157
1177
  if (typeof value === "number") return renderNumber(value, plain);
1158
1178
  if (Array.isArray(value)) return renderArray(value, plain, dim);
1159
- if (typeof value === "object") return JSON.stringify(value);
1179
+ if (typeof value === "object") return renderObject(value, plain, dim);
1160
1180
  return String(value);
1161
1181
  }
1162
1182
  }
@@ -1169,6 +1189,12 @@ function renderArray(value, plain, dim) {
1169
1189
  const allScalar = value.every((v) => v === null || typeof v !== "object");
1170
1190
  return allScalar ? value.map(String).join(", ") : JSON.stringify(value);
1171
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
+ }
1172
1198
  function renderBoolean(value, plain) {
1173
1199
  const truthy = value === true || value === "true";
1174
1200
  if (plain) return truthy ? "yes" : "no";
@@ -1287,7 +1313,7 @@ function formatHuman(data, columns) {
1287
1313
  if (Array.isArray(data)) {
1288
1314
  renderRows(data, columns);
1289
1315
  } else if (data && typeof data === "object") {
1290
- renderRecord(data);
1316
+ renderRecord(data, columns);
1291
1317
  } else {
1292
1318
  console.log(String(data));
1293
1319
  }
@@ -1317,36 +1343,34 @@ function renderRows(rows, columns) {
1317
1343
  console.log(row.map((c, i) => pad(truncate(c, widths[i]), widths[i])).join(GAP).trimEnd());
1318
1344
  }
1319
1345
  }
1320
- function renderRecord(obj) {
1321
- const entries = Object.entries(obj);
1322
- if (entries.length === 0) {
1346
+ function renderRecord(obj, columns) {
1347
+ const specs = columns ? normalizeColumns(columns) : Object.keys(obj).map((key) => ({ key }));
1348
+ if (specs.length === 0) {
1323
1349
  console.log(chalk6.dim("No fields."));
1324
1350
  return;
1325
1351
  }
1326
1352
  if (!isInteractive()) {
1327
- for (const [key, value] of entries) {
1328
- console.log(`${key} ${forPipe(value, { key })}`);
1353
+ for (const spec of specs) {
1354
+ console.log(`${spec.key} ${forPipe(obj[spec.key], spec)}`);
1329
1355
  }
1330
1356
  return;
1331
1357
  }
1332
- const labelWidth = Math.min(
1333
- 24,
1334
- entries.reduce((max, [key]) => Math.max(max, key.length), 0)
1335
- );
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));
1336
1360
  const valueWidth = Math.max(MIN_COLUMN_WIDTH, terminalWidth() - labelWidth - GAP.length);
1337
- for (const [key, value] of entries) {
1338
- const rendered = renderValue(value, inferKind(key));
1339
- const label = chalk6.bold(pad(truncate(key, labelWidth), labelWidth));
1340
- 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) {
1341
1365
  console.log(label + GAP + rendered);
1342
- continue;
1366
+ return;
1343
1367
  }
1344
- const lines = wrap(stripAnsi(rendered), valueWidth);
1368
+ const lines = rendered.split("\n").flatMap((line) => displayWidth(line) <= valueWidth || !/\s/.test(stripAnsi(line).trim()) ? [line] : wrap(stripAnsi(line), valueWidth));
1345
1369
  console.log(label + GAP + (lines[0] ?? ""));
1346
1370
  for (const line of lines.slice(1)) {
1347
1371
  console.log(" ".repeat(labelWidth + GAP.length) + line);
1348
1372
  }
1349
- }
1373
+ });
1350
1374
  }
1351
1375
  function resolveSpecs(sample, columns) {
1352
1376
  const specs = columns ? normalizeColumns(columns) : Object.keys(sample).map((key) => ({ key }));
@@ -3170,6 +3194,25 @@ function percent(fraction) {
3170
3194
  const clamped = Math.max(0, Math.min(1, Number.isFinite(fraction) ? fraction : 0));
3171
3195
  return `${Math.round(clamped * 100)}%`.padStart(4);
3172
3196
  }
3197
+ var QUALITY_MAX_DECIMALS = 4;
3198
+ function qualityPercent(quality) {
3199
+ const unit = Math.max(0, Math.min(Number.isFinite(quality) ? quality : 0, 1));
3200
+ if (unit >= 1) return "100%";
3201
+ let decimals = 1;
3202
+ let shown = flooredPercent(unit, decimals);
3203
+ while (decimals < QUALITY_MAX_DECIMALS && /\.9+$/.test(shown)) {
3204
+ decimals++;
3205
+ shown = flooredPercent(unit, decimals);
3206
+ }
3207
+ return `${decimals > 1 ? shown.replace(/0+$/, "") : shown}%`;
3208
+ }
3209
+ function flooredPercent(unit, decimals) {
3210
+ return (shift(Math.floor(shift(unit, decimals + 2)), -(decimals + 2)) * 100).toFixed(decimals);
3211
+ }
3212
+ function shift(value, exponent) {
3213
+ const [mantissa, magnitude] = value.toExponential().split("e");
3214
+ return Number(`${mantissa}e${Number(magnitude) + exponent}`);
3215
+ }
3173
3216
 
3174
3217
  // src/commands/bundle-helpers.ts
3175
3218
  async function streamResponseToFile(response, outFile) {
@@ -3391,6 +3434,11 @@ Showing ${capped.length} of ${projects.length}. Pass --limit 0 to see them all.`
3391
3434
  language: options.language,
3392
3435
  active: true
3393
3436
  });
3437
+ await api.storage.createProjectBranch({
3438
+ projectId: p.projectId,
3439
+ sourceProjectBranch: null,
3440
+ targetProjectBranch: "main"
3441
+ });
3394
3442
  if (outputFormat === "human") {
3395
3443
  success("Project created.");
3396
3444
  console.log(` Project ID: ${chalk12.bold(p.projectId)}`);
@@ -6121,7 +6169,7 @@ var HELP = [
6121
6169
  ];
6122
6170
  async function runChatRepl(options) {
6123
6171
  const { input: promptInput } = await import("@inquirer/prompts");
6124
- const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
6172
+ const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
6125
6173
  let sessionId = options.session;
6126
6174
  let lastReportedSession;
6127
6175
  console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
@@ -6979,14 +7027,18 @@ function cancelSentence(run) {
6979
7027
  return `Run ${run.runId} is still ${phaseLabel(run).toLowerCase()}.`;
6980
7028
  }
6981
7029
  }
6982
- function terminalSentence(state, duration) {
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"}`;
6983
7035
  switch (state) {
6984
7036
  case "COMPLETED":
6985
- return `Analysis completed in ${duration}.`;
7037
+ return `Analysis completed in ${duration}${cost}.`;
6986
7038
  case "CANCELLED":
6987
- return `Analysis cancelled after ${duration}.`;
7039
+ return `Analysis cancelled after ${duration}${cost}.`;
6988
7040
  default:
6989
- return `Analysis failed after ${duration}.`;
7041
+ return `Analysis failed after ${duration}${cost}.`;
6990
7042
  }
6991
7043
  }
6992
7044
 
@@ -7010,7 +7062,7 @@ function phaseDetail(run) {
7010
7062
  parts.push(`generation ${formatNumber(run.fitGeneration)}`);
7011
7063
  }
7012
7064
  if (run.fitQuality !== null && run.fitQuality !== void 0) {
7013
- parts.push(`quality ${Math.floor(Math.max(0, Math.min(run.fitQuality, 1)) * 100)}%`);
7065
+ parts.push(`quality ${qualityPercent(run.fitQuality)}`);
7014
7066
  }
7015
7067
  if (run.fitBudgetFraction !== null && run.fitBudgetFraction !== void 0) {
7016
7068
  parts.push(`${Math.round(run.fitBudgetFraction * 100)}% of budget used`);
@@ -7336,6 +7388,116 @@ function whyNoPrompt(outputFormat, noInteractive) {
7336
7388
  return "there is no terminal to ask";
7337
7389
  }
7338
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
+
7339
7501
  // src/commands/analyze/index.ts
7340
7502
  var POLL_INTERVAL_MS = 2e3;
7341
7503
  var COLUMN_READ_ATTEMPTS = 3;
@@ -7579,19 +7741,21 @@ function safeParse(text2) {
7579
7741
  async function reportTerminalRun(api, config, run, analysisId, runId, outputFormat) {
7580
7742
  const baseStart = run.startedAt ?? run.submittedAt ?? Date.now();
7581
7743
  const durationMs = (run.endedAt ?? Date.now()) - baseStart;
7744
+ const credits = runCredits(run);
7582
7745
  if (outputFormat !== "human") {
7583
7746
  format({
7584
7747
  status: run.state.toLowerCase(),
7585
7748
  runId,
7586
7749
  analysisId,
7587
7750
  durationMs,
7751
+ credits,
7588
7752
  error: run.errorMessage
7589
7753
  }, { format: outputFormat });
7590
7754
  if (run.state !== "COMPLETED") process.exit(EXIT_FAILURE);
7591
7755
  return;
7592
7756
  }
7593
7757
  console.log();
7594
- const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs));
7758
+ const sentence = terminalSentence(run.state, formatDurationPrecise(durationMs), credits);
7595
7759
  if (run.state === "COMPLETED") {
7596
7760
  success(sentence);
7597
7761
  await printNotebookLink(api, config, analysisId);
@@ -7649,9 +7813,16 @@ async function getAnalysisDetails(analysisId, options, cmd) {
7649
7813
  empty("analysis found");
7650
7814
  return;
7651
7815
  }
7652
- const analysis = outputFormat === "human" && !options.full ? { ...result.analysis, introduction: abbreviate(result.analysis.introduction) } : result.analysis;
7653
- format(analysis, { format: outputFormat });
7654
- if (outputFormat === "human" && !options.full && isLong(result.analysis.introduction)) {
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)) {
7655
7826
  hint("Introduction abbreviated. Pass --full to print it whole.");
7656
7827
  }
7657
7828
  }
@@ -9496,7 +9667,7 @@ function registerShellCommand(program) {
9496
9667
  });
9497
9668
  const api = createApiClient();
9498
9669
  const { input: promptInput } = await import("@inquirer/prompts");
9499
- const { getUpdateNotice } = await import("./update-check-3ZDZSY7M.js");
9670
+ const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
9500
9671
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
9501
9672
  console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
9502
9673
  console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
@@ -10541,4 +10712,4 @@ export {
10541
10712
  PromptCancelled,
10542
10713
  createProgram
10543
10714
  };
10544
- //# sourceMappingURL=chunk-V3EXWLZP.js.map
10715
+ //# sourceMappingURL=chunk-SA4Y2GNR.js.map