@diafunc/cli 0.16.0 → 0.18.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-SA4Y2GNR.js";
7
+ } from "../chunk-ZVC7B6VZ.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-3XAPBWCA.js";
10
+ } from "../chunk-GQT5HO6G.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-EZMZFU5V.js";
13
+ } from "../chunk-JG3FMXGU.js";
14
14
 
15
15
  // bin/diafunc.ts
16
16
  import chalk2 from "chalk";
@@ -117,7 +117,19 @@ function showSplash() {
117
117
  console.log();
118
118
  }
119
119
 
120
+ // src/output/console.ts
121
+ import { format } from "util";
122
+ function routeConsoleThroughStreams() {
123
+ console.log = (...args) => {
124
+ process.stdout.write(format(...args) + "\n");
125
+ };
126
+ console.error = (...args) => {
127
+ process.stderr.write(format(...args) + "\n");
128
+ };
129
+ }
130
+
120
131
  // bin/diafunc.ts
132
+ routeConsoleThroughStreams();
121
133
  if (process.platform === "win32") {
122
134
  try {
123
135
  const dir = path.dirname(process.execPath);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../bin/diafunc.ts","../../src/splash.ts"],"sourcesContent":["import chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\nimport { getUpdateNotice } from '../src/util/update-check.js';\nimport { PromptCancelled } from '../src/prompting/prompter.js';\nimport { EXIT_CANCELLED, handleError } from '../src/util/errors.js';\n\n// On Windows the installer renames the previous diafunc.exe to <path>.old (or\n// to <path>.<guid>.old if a prior .old still exists) since the running .exe\n// can't be replaced in place. Clean those up at startup. Best-effort — they\n// may still be locked by another running diafunc, in which case the next\n// launch picks them up.\nif (process.platform === 'win32') {\n try {\n const dir = path.dirname(process.execPath);\n for (const name of fs.readdirSync(dir)) {\n if (name.startsWith('diafunc.exe') && name.endsWith('.old')) {\n try { fs.unlinkSync(path.join(dir, name)); } catch {}\n }\n }\n } catch {}\n}\n\nif (process.argv.length <= 2 && process.stdout.isTTY) {\n showSplash();\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n const program = createProgram();\n // Kick off the update check in the background so it doesn't block real work.\n // It only does anything for TTY runs and is heavily cached, so the network\n // round-trip is rare; even when it fires, we wait at most a hair after the\n // command completes before printing.\n const noticePromise = getUpdateNotice();\n try {\n await program.parseAsync(process.argv);\n } catch (error) {\n // A prompt can be interrupted before any action runs (the missing-input questions are asked in\n // a hook), so the one outcome that is not an error is handled here, once, for every command.\n if (error instanceof PromptCancelled) {\n console.log();\n console.log(chalk.dim('Cancelled.'));\n process.exit(EXIT_CANCELLED);\n }\n handleError(error);\n }\n try {\n const notice = await Promise.race([\n noticePromise,\n new Promise<null>((resolve) => setTimeout(() => resolve(null), 100)),\n ]);\n if (notice) console.error(chalk.dim(notice));\n } catch {}\n}\n\nmain();\n","import chalk from 'chalk';\nimport pkg from '../package.json' with { type: 'json' };\n\n// Diafunc gem logo rendered with a pixel mask + vertical gradient.\n//\n// The silhouette approximates app/src/assets/images/logos/icon.svg: flat top at\n// ~60% width, widening to shoulder points, tapering to a bottom tip.\n//\n// Each character cell packs two vertical pixels. By using ▀ with an independent\n// foreground (upper pixel) and background (lower pixel) color, we get 2×\n// vertical color resolution — enough for a smooth gradient across 14 pixel\n// rows in only 7 character rows. The gradient mirrors the SVG's linearGradient\n// stops: lighter at the top and bottom, darker in the middle (polished-gem\n// highlight effect).\n\n// 14 rows × 20 cols pixel mask. true = filled, false = empty.\n// Silhouette: flat top (60% wide), widening to shoulders (row 3, full width),\n// then tapering to a single-pixel tip.\nconst MASK: readonly (readonly boolean[])[] = [\n row(' ████████████ '), // 0 flat top\n row(' ██████████████ '), // 1\n row(' ██████████████████ '), // 2\n row('████████████████████'), // 3 shoulder (max width)\n row('████████████████████'), // 4 shoulder\n row(' ██████████████████ '), // 5\n row(' ████████████████ '), // 6\n row(' ██████████████ '), // 7\n row(' ████████████ '), // 8\n row(' ██████████ '), // 9\n row(' ████████ '), // 10\n row(' ██████ '), // 11\n row(' ████ '), // 12\n row(' ██ '), // 13 tip\n];\n\nfunction row(s: string): boolean[] {\n // Any non-space character counts as filled.\n return Array.from(s).map((c) => c !== ' ');\n}\n\n// Gradient endpoints: light blue from the SVG stops, dark blue in the middle.\nconst LIGHT: readonly [number, number, number] = [0x47, 0x75, 0xb8]; // #4775B8\nconst DARK: readonly [number, number, number] = [0x2d, 0x2d, 0x5d]; // #2D2D5D\n\nfunction gradientHex(pixelRow: number, pixelRows: number): string {\n // t = 0 at vertical center, 1 at top/bottom edges.\n const center = (pixelRows - 1) / 2;\n const t = Math.abs(pixelRow - center) / center;\n const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);\n const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);\n const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);\n return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');\n}\n\nfunction renderGem(): string[] {\n const pixelRows = MASK.length;\n const cols = MASK[0].length;\n const charRows = pixelRows / 2;\n const lines: string[] = [];\n\n for (let c = 0; c < charRows; c++) {\n let line = '';\n for (let x = 0; x < cols; x++) {\n const top = MASK[2 * c][x];\n const bot = MASK[2 * c + 1][x];\n const topHex = gradientHex(2 * c, pixelRows);\n const botHex = gradientHex(2 * c + 1, pixelRows);\n\n if (top && bot) {\n line += chalk.hex(topHex).bgHex(botHex)('▀');\n } else if (top) {\n line += chalk.hex(topHex)('▀');\n } else if (bot) {\n line += chalk.hex(botHex)('▄');\n } else {\n line += ' ';\n }\n }\n lines.push(line);\n }\n return lines;\n}\n\n// \"Diafunc\" in figlet \"standard\" font, rendered in a single brand color\n// alongside the gem (a gradient on thin text glyphs would look noisy).\nconst WORDMARK: readonly string[] = [\n ' ____ _ __ ',\n '| _ \\\\(_) __ _ / _|_ _ _ __ ___ ',\n \"| | | | |/ _` | |_| | | | '_ \\\\ / __|\",\n '| |_| | | (_| | _| |_| | | | | (__ ',\n '|____/|_|\\\\__,_|_| \\\\__,_|_| |_|\\\\___|',\n];\n\nconst GAP = ' ';\n\nexport function showSplash(): void {\n const brand = chalk.hex('#4775B8');\n const gem = renderGem();\n\n // Center the 5-row wordmark vertically against the 7-row gem.\n const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);\n\n console.log();\n for (let i = 0; i < gem.length; i++) {\n const w = i - wordmarkOffset;\n const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : '';\n console.log(gem[i] + GAP + brand.bold(text));\n }\n console.log();\n console.log(\n ' ' +\n chalk.bold('CLI') +\n chalk.dim(` v${pkg.version}`) +\n chalk.dim(' · https://diafunc.com'),\n );\n console.log();\n console.log(\n chalk.dim(\" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.\"),\n );\n console.log();\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,YAAY,QAAQ;AACpB,YAAY,UAAU;;;ACFtB,OAAO,WAAW;AAkBlB,IAAM,OAAwC;AAAA,EAC5C,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,sGAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,wEAAsB;AAAA;AAAA,EAC1B,IAAI,8DAAsB;AAAA;AAAA,EAC1B,IAAI,oDAAsB;AAAA;AAAA,EAC1B,IAAI,0CAAsB;AAAA;AAAA,EAC1B,IAAI,gCAAsB;AAAA;AAC5B;A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AAAA,MACtD;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAAC;AACX;AAEA,IAAI,QAAQ,KAAK,UAAU,KAAK,QAAQ,OAAO,OAAO;AACpD,aAAW;AACX,UAAQ,KAAK,CAAC;AAChB;AAEA,eAAe,OAAsB;AACnC,QAAM,UAAU,cAAc;AAK9B,QAAM,gBAAgB,gBAAgB;AACtC,MAAI;AACF,UAAM,QAAQ,WAAW,QAAQ,IAAI;AAAA,EACvC,SAAS,OAAO;AAGd,QAAI,iBAAiB,iBAAiB;AACpC,cAAQ,IAAI;AACZ,cAAQ,IAAIC,OAAM,IAAI,YAAY,CAAC;AACnC,cAAQ,KAAK,cAAc;AAAA,IAC7B;AACA,gBAAY,KAAK;AAAA,EACnB;AACA,MAAI;AACF,UAAM,SAAS,MAAM,QAAQ,KAAK;AAAA,MAChC;AAAA,MACA,IAAI,QAAc,CAAC,YAAY,WAAW,MAAM,QAAQ,IAAI,GAAG,GAAG,CAAC;AAAA,IACrE,CAAC;AACD,QAAI,OAAQ,SAAQ,MAAMA,OAAM,IAAI,MAAM,CAAC;AAAA,EAC7C,QAAQ;AAAA,EAAC;AACX;AAEA,KAAK;","names":["chalk","chalk"]}
1
+ {"version":3,"sources":["../../bin/diafunc.ts","../../src/splash.ts","../../src/output/console.ts"],"sourcesContent":["import chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\nimport { getUpdateNotice } from '../src/util/update-check.js';\nimport { PromptCancelled } from '../src/prompting/prompter.js';\nimport { EXIT_CANCELLED, handleError } from '../src/util/errors.js';\nimport { routeConsoleThroughStreams } from '../src/output/console.js';\n\nrouteConsoleThroughStreams();\n\n// On Windows the installer renames the previous diafunc.exe to <path>.old (or\n// to <path>.<guid>.old if a prior .old still exists) since the running .exe\n// can't be replaced in place. Clean those up at startup. Best-effort — they\n// may still be locked by another running diafunc, in which case the next\n// launch picks them up.\nif (process.platform === 'win32') {\n try {\n const dir = path.dirname(process.execPath);\n for (const name of fs.readdirSync(dir)) {\n if (name.startsWith('diafunc.exe') && name.endsWith('.old')) {\n try { fs.unlinkSync(path.join(dir, name)); } catch {}\n }\n }\n } catch {}\n}\n\nif (process.argv.length <= 2 && process.stdout.isTTY) {\n showSplash();\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n const program = createProgram();\n // Kick off the update check in the background so it doesn't block real work.\n // It only does anything for TTY runs and is heavily cached, so the network\n // round-trip is rare; even when it fires, we wait at most a hair after the\n // command completes before printing.\n const noticePromise = getUpdateNotice();\n try {\n await program.parseAsync(process.argv);\n } catch (error) {\n // A prompt can be interrupted before any action runs (the missing-input questions are asked in\n // a hook), so the one outcome that is not an error is handled here, once, for every command.\n if (error instanceof PromptCancelled) {\n console.log();\n console.log(chalk.dim('Cancelled.'));\n process.exit(EXIT_CANCELLED);\n }\n handleError(error);\n }\n try {\n const notice = await Promise.race([\n noticePromise,\n new Promise<null>((resolve) => setTimeout(() => resolve(null), 100)),\n ]);\n if (notice) console.error(chalk.dim(notice));\n } catch {}\n}\n\nmain();\n","import chalk from 'chalk';\nimport pkg from '../package.json' with { type: 'json' };\n\n// Diafunc gem logo rendered with a pixel mask + vertical gradient.\n//\n// The silhouette approximates app/src/assets/images/logos/icon.svg: flat top at\n// ~60% width, widening to shoulder points, tapering to a bottom tip.\n//\n// Each character cell packs two vertical pixels. By using ▀ with an independent\n// foreground (upper pixel) and background (lower pixel) color, we get 2×\n// vertical color resolution — enough for a smooth gradient across 14 pixel\n// rows in only 7 character rows. The gradient mirrors the SVG's linearGradient\n// stops: lighter at the top and bottom, darker in the middle (polished-gem\n// highlight effect).\n\n// 14 rows × 20 cols pixel mask. true = filled, false = empty.\n// Silhouette: flat top (60% wide), widening to shoulders (row 3, full width),\n// then tapering to a single-pixel tip.\nconst MASK: readonly (readonly boolean[])[] = [\n row(' ████████████ '), // 0 flat top\n row(' ██████████████ '), // 1\n row(' ██████████████████ '), // 2\n row('████████████████████'), // 3 shoulder (max width)\n row('████████████████████'), // 4 shoulder\n row(' ██████████████████ '), // 5\n row(' ████████████████ '), // 6\n row(' ██████████████ '), // 7\n row(' ████████████ '), // 8\n row(' ██████████ '), // 9\n row(' ████████ '), // 10\n row(' ██████ '), // 11\n row(' ████ '), // 12\n row(' ██ '), // 13 tip\n];\n\nfunction row(s: string): boolean[] {\n // Any non-space character counts as filled.\n return Array.from(s).map((c) => c !== ' ');\n}\n\n// Gradient endpoints: light blue from the SVG stops, dark blue in the middle.\nconst LIGHT: readonly [number, number, number] = [0x47, 0x75, 0xb8]; // #4775B8\nconst DARK: readonly [number, number, number] = [0x2d, 0x2d, 0x5d]; // #2D2D5D\n\nfunction gradientHex(pixelRow: number, pixelRows: number): string {\n // t = 0 at vertical center, 1 at top/bottom edges.\n const center = (pixelRows - 1) / 2;\n const t = Math.abs(pixelRow - center) / center;\n const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);\n const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);\n const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);\n return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');\n}\n\nfunction renderGem(): string[] {\n const pixelRows = MASK.length;\n const cols = MASK[0].length;\n const charRows = pixelRows / 2;\n const lines: string[] = [];\n\n for (let c = 0; c < charRows; c++) {\n let line = '';\n for (let x = 0; x < cols; x++) {\n const top = MASK[2 * c][x];\n const bot = MASK[2 * c + 1][x];\n const topHex = gradientHex(2 * c, pixelRows);\n const botHex = gradientHex(2 * c + 1, pixelRows);\n\n if (top && bot) {\n line += chalk.hex(topHex).bgHex(botHex)('▀');\n } else if (top) {\n line += chalk.hex(topHex)('▀');\n } else if (bot) {\n line += chalk.hex(botHex)('▄');\n } else {\n line += ' ';\n }\n }\n lines.push(line);\n }\n return lines;\n}\n\n// \"Diafunc\" in figlet \"standard\" font, rendered in a single brand color\n// alongside the gem (a gradient on thin text glyphs would look noisy).\nconst WORDMARK: readonly string[] = [\n ' ____ _ __ ',\n '| _ \\\\(_) __ _ / _|_ _ _ __ ___ ',\n \"| | | | |/ _` | |_| | | | '_ \\\\ / __|\",\n '| |_| | | (_| | _| |_| | | | | (__ ',\n '|____/|_|\\\\__,_|_| \\\\__,_|_| |_|\\\\___|',\n];\n\nconst GAP = ' ';\n\nexport function showSplash(): void {\n const brand = chalk.hex('#4775B8');\n const gem = renderGem();\n\n // Center the 5-row wordmark vertically against the 7-row gem.\n const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);\n\n console.log();\n for (let i = 0; i < gem.length; i++) {\n const w = i - wordmarkOffset;\n const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : '';\n console.log(gem[i] + GAP + brand.bold(text));\n }\n console.log();\n console.log(\n ' ' +\n chalk.bold('CLI') +\n chalk.dim(` v${pkg.version}`) +\n chalk.dim(' · https://diafunc.com'),\n );\n console.log();\n console.log(\n chalk.dim(\" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.\"),\n );\n console.log();\n}\n","import { format } from 'node:util';\n\n/**\n * Sends `console.log` and `console.error` through the process streams.\n *\n * The released binary is compiled with Bun. There, once `process.stdout` has been touched (asking\n * whether it is a terminal is enough), a `console.log` larger than a pipe's buffer is cut at exactly\n * 65,536 bytes when the output goes to a pipe: `diafunc analyze list -o json | jq` received the first\n * 64 KiB of a 140 KiB document and failed on the cut-off JSON, while the same command into a file\n * was complete. A write through the stream itself waits for the pipe and loses nothing, so every\n * line the CLI prints takes that way. Formatting is `util.format`, which is what `console.log` uses.\n */\nexport function routeConsoleThroughStreams(): void {\n console.log = (...args: unknown[]): void => {\n process.stdout.write(format(...args) + '\\n');\n };\n console.error = (...args: unknown[]): void => {\n process.stderr.write(format(...args) + '\\n');\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,YAAY,QAAQ;AACpB,YAAY,UAAU;;;ACFtB,OAAO,WAAW;AAkBlB,IAAM,OAAwC;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,SAAS,MAAM,QAAQ,KAAK;AAAA,MAChC;AAAA,MACA,IAAI,QAAc,CAAC,YAAY,WAAW,MAAM,QAAQ,IAAI,GAAG,GAAG,CAAC;AAAA,IACrE,CAAC;AACD,QAAI,OAAQ,SAAQ,MAAMA,OAAM,IAAI,MAAM,CAAC;AAAA,EAC7C,QAAQ;AAAA,EAAC;AACX;AAEA,KAAK;","names":["chalk","chalk"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-EZMZFU5V.js";
3
+ } from "./chunk-JG3FMXGU.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-3XAPBWCA.js.map
75
+ //# sourceMappingURL=chunk-GQT5HO6G.js.map
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@diafunc/cli",
4
- version: "0.16.0",
4
+ version: "0.18.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-EZMZFU5V.js.map
65
+ //# sourceMappingURL=chunk-JG3FMXGU.js.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.18.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-EZMZFU5V.js";
3
+ } from "./chunk-JG3FMXGU.js";
4
4
 
5
5
  // src/index.ts
6
6
  import chalk36 from "chalk";
@@ -224,6 +224,9 @@ var _verbose = false;
224
224
  function setDryRun(enabled) {
225
225
  _dryRun = enabled;
226
226
  }
227
+ function isDryRun() {
228
+ return _dryRun;
229
+ }
227
230
  function setVerbose(enabled) {
228
231
  _verbose = enabled;
229
232
  }
@@ -1620,6 +1623,22 @@ function createAnalysisService(client) {
1620
1623
  body: request
1621
1624
  });
1622
1625
  },
1626
+ async patchFeatureExclusions(analysisId, request) {
1627
+ return client.request({
1628
+ method: "PATCH",
1629
+ service: SERVICE2,
1630
+ path: `/${encodeURIComponent(analysisId)}/feature-exclusions`,
1631
+ body: request
1632
+ });
1633
+ },
1634
+ async patchConfirmedInputs(analysisId, request) {
1635
+ return client.request({
1636
+ method: "PATCH",
1637
+ service: SERVICE2,
1638
+ path: `/${encodeURIComponent(analysisId)}/confirmed-inputs`,
1639
+ body: request
1640
+ });
1641
+ },
1623
1642
  async patchSegment(analysisId, request) {
1624
1643
  return client.request({
1625
1644
  method: "PATCH",
@@ -4565,6 +4584,22 @@ function parseRange(text2, size, label) {
4565
4584
  }
4566
4585
  return { from, to };
4567
4586
  }
4587
+ var SNAPSHOT_MAX_CELLS = 65536;
4588
+ function windowParts(window, maxCells = SNAPSHOT_MAX_CELLS) {
4589
+ const columns = window.columns.to - window.columns.from;
4590
+ const columnsPerPart = Math.max(1, Math.min(columns, maxCells));
4591
+ const rowsPerPart = Math.max(1, Math.floor(maxCells / columnsPerPart));
4592
+ const parts = [];
4593
+ for (let row = window.rows.from; row < window.rows.to; row += rowsPerPart) {
4594
+ for (let column = window.columns.from; column < window.columns.to; column += columnsPerPart) {
4595
+ parts.push({
4596
+ rows: { from: row, to: Math.min(row + rowsPerPart, window.rows.to) },
4597
+ columns: { from: column, to: Math.min(column + columnsPerPart, window.columns.to) }
4598
+ });
4599
+ }
4600
+ }
4601
+ return parts;
4602
+ }
4568
4603
  function cellRange(window) {
4569
4604
  return {
4570
4605
  fromRowIndex: window.rows.from,
@@ -4573,6 +4608,18 @@ function cellRange(window) {
4573
4608
  toColumnIndex: window.columns.to - 1
4574
4609
  };
4575
4610
  }
4611
+ async function fetchWindow(fetchPart, window, maxCells = SNAPSHOT_MAX_CELLS) {
4612
+ const rows = /* @__PURE__ */ new Map();
4613
+ const columns = /* @__PURE__ */ new Map();
4614
+ const cells = [];
4615
+ for (const part of windowParts(window, maxCells)) {
4616
+ const snapshot = await fetchPart(cellRange(part));
4617
+ for (const row of snapshot.rows) rows.set(row.index, row);
4618
+ for (const column of snapshot.columns) columns.set(column.index, column);
4619
+ for (const cell2 of snapshot.cells) cells.push(cell2);
4620
+ }
4621
+ return { rows: [...rows.values()], columns: [...columns.values()], cells };
4622
+ }
4576
4623
  function describeWindow(window, rows, columns) {
4577
4624
  const whole = window.rows.from === 0 && window.rows.to === rows && window.columns.from === 0 && window.columns.to === columns;
4578
4625
  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}`;
@@ -4730,7 +4777,10 @@ Examples:
4730
4777
  rows: options.rows ? parseRange(options.rows, totalRows, "Row") : initial.rows,
4731
4778
  columns: options.cols ? parseRange(options.cols, totalColumns, "Column") : initial.columns
4732
4779
  };
4733
- const snapshot = await api.storage.getTableSnapshot(resolved, { cellRanges: [cellRange(window)] });
4780
+ const snapshot = await fetchWindow(
4781
+ (range) => api.storage.getTableSnapshot(resolved, { cellRanges: [range] }),
4782
+ window
4783
+ );
4734
4784
  if (outputFormat === "json") {
4735
4785
  const cells = snapshot.cells.map((cell3) => ({ ...cell3, text: decodeCellValue(cell3.value, cell3.type) }));
4736
4786
  format({ ...snapshot, cells, totalRows, totalColumns, window }, { format: outputFormat });
@@ -6169,7 +6219,7 @@ var HELP = [
6169
6219
  ];
6170
6220
  async function runChatRepl(options) {
6171
6221
  const { input: promptInput } = await import("@inquirer/prompts");
6172
- const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
6222
+ const { getUpdateNotice } = await import("./update-check-HMBNFIA5.js");
6173
6223
  let sessionId = options.session;
6174
6224
  let lastReportedSession;
6175
6225
  console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
@@ -7400,6 +7450,7 @@ function analysisDetails(analysis, endpoint) {
7400
7450
  targets: analysis.targets,
7401
7451
  targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
7402
7452
  featureExclusions: analysis.featureExclusions,
7453
+ confirmedInputs: analysis.confirmedInputs,
7403
7454
  questions: analysis.questions,
7404
7455
  segment: analysis.segment,
7405
7456
  hours: hoursText(analysis.hours),
@@ -7428,6 +7479,7 @@ function analysisDetails(analysis, endpoint) {
7428
7479
  { key: "targets", header: "Targets" },
7429
7480
  { key: "targetKinds", header: "Target kinds" },
7430
7481
  { key: "featureExclusions", header: "Excluded columns" },
7482
+ { key: "confirmedInputs", header: "Known before the outcome" },
7431
7483
  { key: "questions", header: "Questions" },
7432
7484
  { key: "segment", header: "Segment" },
7433
7485
  { key: "hours", header: "Computation time" },
@@ -7500,6 +7552,7 @@ function constraintsText(analysis) {
7500
7552
 
7501
7553
  // src/commands/analyze/index.ts
7502
7554
  var POLL_INTERVAL_MS = 2e3;
7555
+ var MISSING_RUN_POLLS = 5;
7503
7556
  var COLUMN_READ_ATTEMPTS = 3;
7504
7557
  var COLUMN_READ_INTERVAL_MS = 1e3;
7505
7558
  function openUrl(url) {
@@ -7519,6 +7572,13 @@ function parseCsv(value) {
7519
7572
  if (value === void 0) return null;
7520
7573
  return value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
7521
7574
  }
7575
+ function collectQuestion(value, previous = []) {
7576
+ return previous.concat([value]);
7577
+ }
7578
+ function questionsOf(given) {
7579
+ if (given === void 0) return null;
7580
+ return given.map((question2) => question2.trim()).filter((question2) => question2.length > 0);
7581
+ }
7522
7582
  function parseVisibility(value) {
7523
7583
  const upper = value.toUpperCase();
7524
7584
  if (upper !== "PRIVATE" && upper !== "PUBLIC") {
@@ -7563,7 +7623,7 @@ async function runAnalysis(file, options, cmd) {
7563
7623
  }
7564
7624
  const p = opt.preset;
7565
7625
  if (options.targets === void 0 && p.targetKeys.length > 0) options.targets = p.targetKeys.join(",");
7566
- if (options.questions === void 0 && p.questions.length > 0) options.questions = p.questions.join(",");
7626
+ if (options.question === void 0 && p.questions.length > 0) options.question = [...p.questions];
7567
7627
  if (options.segment === void 0 && p.segmentKey) options.segment = p.segmentKey;
7568
7628
  if (options.hours === void 0) options.hours = p.time;
7569
7629
  if (options.budget === void 0) options.budget = p.budget;
@@ -7594,10 +7654,14 @@ async function runAnalysis(file, options, cmd) {
7594
7654
  hours: options.hours ?? DEFAULT_HOURS,
7595
7655
  budget: options.budget ?? DEFAULT_BUDGET,
7596
7656
  targets: flagTargets,
7597
- questions: parseCsv(options.questions),
7657
+ questions: questionsOf(options.question),
7598
7658
  segment: options.segment ?? null
7599
7659
  };
7600
7660
  const created = await withStatus(`Creating analysis "${creation.name}"`, () => api.analysis.create(request));
7661
+ if (isDryRun()) {
7662
+ hint(`Dry run: nothing was created. A real run would upload ${path7.basename(file)}, queue the analysis and follow it.`);
7663
+ return;
7664
+ }
7601
7665
  detail(`analysisId: ${created.analysisId}`);
7602
7666
  await withStatus(
7603
7667
  `Uploading ${path7.basename(file)}`,
@@ -7608,7 +7672,7 @@ async function runAnalysis(file, options, cmd) {
7608
7672
  const configuredHours = await configureInteractively(api, prompter, created.analysisId, request, {
7609
7673
  targets: options.targets === void 0 ? void 0 : parseCsv(options.targets),
7610
7674
  segment: options.segment,
7611
- questions: options.questions === void 0 ? void 0 : parseCsv(options.questions),
7675
+ questions: options.question === void 0 ? void 0 : questionsOf(options.question),
7612
7676
  hours: options.hours,
7613
7677
  budget: options.budget
7614
7678
  });
@@ -7677,16 +7741,30 @@ async function monitorRun(api, analysisId, runId, budgetHours, cmd) {
7677
7741
  const seenOutputs = /* @__PURE__ */ new Set();
7678
7742
  let caption = null;
7679
7743
  let lastReported = "";
7744
+ let missingPolls = 0;
7680
7745
  if (human) status.start();
7681
7746
  try {
7682
7747
  for (; ; ) {
7683
7748
  await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
7684
7749
  let run = null;
7750
+ let absent = false;
7685
7751
  try {
7686
7752
  run = (await api.analysis.getRun(runId)).run;
7687
- } catch {
7753
+ absent = run === null;
7754
+ } catch (error) {
7755
+ absent = error instanceof ApiError && error.status === 404;
7756
+ }
7757
+ if (!run) {
7758
+ missingPolls = absent ? missingPolls + 1 : 0;
7759
+ if (missingPolls >= MISSING_RUN_POLLS) {
7760
+ status.stop();
7761
+ failure(`Run ${runId} was not found.`);
7762
+ hint(`List the runs with 'diafunc analyze runs ${analysisId}'.`);
7763
+ process.exit(EXIT_FAILURE);
7764
+ }
7765
+ continue;
7688
7766
  }
7689
- if (!run) continue;
7767
+ missingPolls = 0;
7690
7768
  try {
7691
7769
  for (const out of await api.analysis.getRunOutputs(analysisId, runId)) {
7692
7770
  const key = `${out.outputId}:${out.output}`;
@@ -7905,6 +7983,10 @@ async function rerunAnalysis(analysisId, cmd) {
7905
7983
  if (configuredHours === null) return;
7906
7984
  }
7907
7985
  const run = await api.analysis.runAnalysis(analysisId);
7986
+ if (isDryRun()) {
7987
+ hint("Dry run: no run was queued.");
7988
+ return;
7989
+ }
7908
7990
  success(`Queued run ${run.runId} for analysis ${analysisId}.`);
7909
7991
  hint(`Follow it with 'diafunc analyze watch ${analysisId}'.`);
7910
7992
  }
@@ -7938,21 +8020,33 @@ async function createAnalysis(options, cmd) {
7938
8020
  hours: options.hours ?? null,
7939
8021
  budget: options.budget ?? null,
7940
8022
  targets: parseCsv(options.targets),
7941
- questions: parseCsv(options.questions),
8023
+ questions: questionsOf(options.question),
7942
8024
  segment: options.segment ?? null
7943
8025
  };
7944
8026
  const created = await api.analysis.create(request);
8027
+ if (isDryRun()) {
8028
+ hint("Dry run: nothing was created.");
8029
+ return;
8030
+ }
7945
8031
  format(created, { format: outputFormat });
7946
8032
  }
7947
8033
  async function deleteAnalysis(analysisId) {
7948
8034
  const api = createApiClient();
7949
8035
  await api.analysis.delete(analysisId);
8036
+ if (isDryRun()) {
8037
+ hint("Dry run: nothing was deleted.");
8038
+ return;
8039
+ }
7950
8040
  success(`Deleted analysis ${analysisId}.`);
7951
8041
  }
7952
8042
  async function patchAndPrint(analysisId, value, handler, successLabel, cmd) {
7953
8043
  const outputFormat = getOutputFormat15(cmd);
7954
8044
  const api = createApiClient();
7955
8045
  const updated = await handler(api, analysisId, value);
8046
+ if (isDryRun()) {
8047
+ hint("Dry run: nothing was changed.");
8048
+ return;
8049
+ }
7956
8050
  if (outputFormat === "human") {
7957
8051
  success(`${successLabel} updated for analysis ${analysisId}.`);
7958
8052
  } else {
@@ -8073,12 +8167,16 @@ async function savePreset(options, cmd) {
8073
8167
  presetId: options.id ?? null,
8074
8168
  name: options.name,
8075
8169
  targetKeys: parseCsv(options.targets) ?? [],
8076
- questions: parseCsv(options.questions) ?? [],
8170
+ questions: questionsOf(options.question) ?? [],
8077
8171
  segmentKey: options.segment ?? null,
8078
8172
  time: options.hours,
8079
8173
  budget: options.budget
8080
8174
  };
8081
8175
  const saved = await api.analysis.savePreset(preset);
8176
+ if (isDryRun()) {
8177
+ hint("Dry run: nothing was saved.");
8178
+ return;
8179
+ }
8082
8180
  format(saved, { format: outputFormat });
8083
8181
  }
8084
8182
  async function deletePreset(presetId) {
@@ -8150,7 +8248,7 @@ async function updateTriggerCmd(triggerId, options, cmd) {
8150
8248
  }
8151
8249
  function registerAnalyzeCommand(program) {
8152
8250
  const analyze = program.command("analyze").description("Run and manage automatic analyses");
8153
- 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) => {
8251
+ 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 45 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("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).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) => {
8154
8252
  try {
8155
8253
  if (!file) {
8156
8254
  analyze.help();
@@ -8196,7 +8294,7 @@ function registerAnalyzeCommand(program) {
8196
8294
  reportCommandError(error);
8197
8295
  }
8198
8296
  });
8199
- 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) => {
8297
+ 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("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).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) => {
8200
8298
  try {
8201
8299
  await createAnalysis(options, cmd);
8202
8300
  } catch (error) {
@@ -8304,12 +8402,40 @@ function registerAnalyzeCommand(program) {
8304
8402
  handleError(error);
8305
8403
  }
8306
8404
  });
8307
- 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) => {
8405
+ 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) => {
8308
8406
  try {
8309
- const questions = parseCsv(csv) ?? [];
8407
+ const columns = parseCsv(csv) ?? [];
8310
8408
  await patchAndPrint(
8311
8409
  id,
8312
8410
  csv,
8411
+ (api, aid) => api.analysis.patchFeatureExclusions(aid, { columns }),
8412
+ "Columns left out of the fit",
8413
+ cmd
8414
+ );
8415
+ } catch (error) {
8416
+ handleError(error);
8417
+ }
8418
+ });
8419
+ 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) => {
8420
+ try {
8421
+ const columns = parseCsv(csv) ?? [];
8422
+ await patchAndPrint(
8423
+ id,
8424
+ csv,
8425
+ (api, aid) => api.analysis.patchConfirmedInputs(aid, { columns }),
8426
+ "Columns known before the outcome",
8427
+ cmd
8428
+ );
8429
+ } catch (error) {
8430
+ handleError(error);
8431
+ }
8432
+ });
8433
+ analyze.command("questions").description("Set the questions the analysis answers, one argument per question").argument("<id>", "Analysis ID").argument("<question...>", "The questions, each quoted as one argument (a single empty string clears them)").action(async (id, given, _options, cmd) => {
8434
+ try {
8435
+ const questions = questionsOf(Array.isArray(given) ? given : [given]) ?? [];
8436
+ await patchAndPrint(
8437
+ id,
8438
+ questions.join(" | "),
8313
8439
  (api, aid) => api.analysis.patchQuestions(aid, { questions }),
8314
8440
  "Questions",
8315
8441
  cmd
@@ -8331,7 +8457,7 @@ function registerAnalyzeCommand(program) {
8331
8457
  handleError(error);
8332
8458
  }
8333
8459
  });
8334
- 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) => {
8460
+ 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 45 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) => {
8335
8461
  try {
8336
8462
  await uploadData(id, file, options);
8337
8463
  } catch (error) {
@@ -8374,7 +8500,7 @@ function registerAnalyzeCommand(program) {
8374
8500
  handleError(error);
8375
8501
  }
8376
8502
  });
8377
- 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) => {
8503
+ 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("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--id <id>", "Existing preset ID (update mode)").action(async (options, cmd) => {
8378
8504
  try {
8379
8505
  await savePreset(options, cmd);
8380
8506
  } catch (error) {
@@ -9125,6 +9251,9 @@ _diafunc_completions() {
9125
9251
  *) COMPREPLY=($(compgen -W "\${subcommands}" -- "\${cur}")) ;;
9126
9252
  esac
9127
9253
  ;;
9254
+ analyze)
9255
+ COMPREPLY=($(compgen -f -- "\${cur}"))
9256
+ ;;
9128
9257
  *)
9129
9258
  COMPREPLY=($(compgen -W "\${commands}" -- "\${cur}"))
9130
9259
  ;;
@@ -9184,7 +9313,7 @@ _diafunc() {
9184
9313
  schedule) _values 'subcommand' call ;;
9185
9314
  chat) _diafunc_chat ;;
9186
9315
  admin) _diafunc_admin ;;
9187
- analyze) _files '*.csv' '*.xlsx' '*.xls' ;;
9316
+ analyze) _files ;;
9188
9317
  esac
9189
9318
  ;;
9190
9319
  esac
@@ -9667,7 +9796,7 @@ function registerShellCommand(program) {
9667
9796
  });
9668
9797
  const api = createApiClient();
9669
9798
  const { input: promptInput } = await import("@inquirer/prompts");
9670
- const { getUpdateNotice } = await import("./update-check-CBJ6R66H.js");
9799
+ const { getUpdateNotice } = await import("./update-check-HMBNFIA5.js");
9671
9800
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
9672
9801
  console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
9673
9802
  console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
@@ -9961,7 +10090,9 @@ var INDEX = { kind: "number", min: 0, integer: true };
9961
10090
  var BY_COMMAND = {
9962
10091
  "analyze segment": { "<name>": { kind: "analysisColumns", multiple: false, allowEmpty: true } },
9963
10092
  "analyze targets": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
9964
- "analyze questions": { "<csv>": TEXT_OR_EMPTY },
10093
+ "analyze feature-exclusions": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
10094
+ "analyze confirmed-inputs": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
10095
+ "analyze questions": { "<question>": TEXT_OR_EMPTY },
9965
10096
  "analyze description": { "<text>": TEXT_OR_EMPTY },
9966
10097
  "analyze introduction": { "<markdown>": TEXT_OR_EMPTY },
9967
10098
  "analyze presets save": { "--targets": TEXT, "--hours": POSITIVE, "--budget": POSITIVE },
@@ -10712,4 +10843,4 @@ export {
10712
10843
  PromptCancelled,
10713
10844
  createProgram
10714
10845
  };
10715
- //# sourceMappingURL=chunk-SA4Y2GNR.js.map
10846
+ //# sourceMappingURL=chunk-ZVC7B6VZ.js.map