@diafunc/cli 0.17.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-6ZOIOHSW.js";
7
+ } from "../chunk-ZVC7B6VZ.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-QWSCORJH.js";
10
+ } from "../chunk-GQT5HO6G.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-ZT25YY7J.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;AA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AAA,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;A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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-ZT25YY7J.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-QWSCORJH.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.17.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-ZT25YY7J.js.map
65
+ //# sourceMappingURL=chunk-JG3FMXGU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.17.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-ZT25YY7J.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
  }
@@ -4581,6 +4584,22 @@ function parseRange(text2, size, label) {
4581
4584
  }
4582
4585
  return { from, to };
4583
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
+ }
4584
4603
  function cellRange(window) {
4585
4604
  return {
4586
4605
  fromRowIndex: window.rows.from,
@@ -4589,6 +4608,18 @@ function cellRange(window) {
4589
4608
  toColumnIndex: window.columns.to - 1
4590
4609
  };
4591
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
+ }
4592
4623
  function describeWindow(window, rows, columns) {
4593
4624
  const whole = window.rows.from === 0 && window.rows.to === rows && window.columns.from === 0 && window.columns.to === columns;
4594
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}`;
@@ -4746,7 +4777,10 @@ Examples:
4746
4777
  rows: options.rows ? parseRange(options.rows, totalRows, "Row") : initial.rows,
4747
4778
  columns: options.cols ? parseRange(options.cols, totalColumns, "Column") : initial.columns
4748
4779
  };
4749
- 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
+ );
4750
4784
  if (outputFormat === "json") {
4751
4785
  const cells = snapshot.cells.map((cell3) => ({ ...cell3, text: decodeCellValue(cell3.value, cell3.type) }));
4752
4786
  format({ ...snapshot, cells, totalRows, totalColumns, window }, { format: outputFormat });
@@ -6185,7 +6219,7 @@ var HELP = [
6185
6219
  ];
6186
6220
  async function runChatRepl(options) {
6187
6221
  const { input: promptInput } = await import("@inquirer/prompts");
6188
- const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
6222
+ const { getUpdateNotice } = await import("./update-check-HMBNFIA5.js");
6189
6223
  let sessionId = options.session;
6190
6224
  let lastReportedSession;
6191
6225
  console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
@@ -7518,6 +7552,7 @@ function constraintsText(analysis) {
7518
7552
 
7519
7553
  // src/commands/analyze/index.ts
7520
7554
  var POLL_INTERVAL_MS = 2e3;
7555
+ var MISSING_RUN_POLLS = 5;
7521
7556
  var COLUMN_READ_ATTEMPTS = 3;
7522
7557
  var COLUMN_READ_INTERVAL_MS = 1e3;
7523
7558
  function openUrl(url) {
@@ -7537,6 +7572,13 @@ function parseCsv(value) {
7537
7572
  if (value === void 0) return null;
7538
7573
  return value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
7539
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
+ }
7540
7582
  function parseVisibility(value) {
7541
7583
  const upper = value.toUpperCase();
7542
7584
  if (upper !== "PRIVATE" && upper !== "PUBLIC") {
@@ -7581,7 +7623,7 @@ async function runAnalysis(file, options, cmd) {
7581
7623
  }
7582
7624
  const p = opt.preset;
7583
7625
  if (options.targets === void 0 && p.targetKeys.length > 0) options.targets = p.targetKeys.join(",");
7584
- 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];
7585
7627
  if (options.segment === void 0 && p.segmentKey) options.segment = p.segmentKey;
7586
7628
  if (options.hours === void 0) options.hours = p.time;
7587
7629
  if (options.budget === void 0) options.budget = p.budget;
@@ -7612,10 +7654,14 @@ async function runAnalysis(file, options, cmd) {
7612
7654
  hours: options.hours ?? DEFAULT_HOURS,
7613
7655
  budget: options.budget ?? DEFAULT_BUDGET,
7614
7656
  targets: flagTargets,
7615
- questions: parseCsv(options.questions),
7657
+ questions: questionsOf(options.question),
7616
7658
  segment: options.segment ?? null
7617
7659
  };
7618
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
+ }
7619
7665
  detail(`analysisId: ${created.analysisId}`);
7620
7666
  await withStatus(
7621
7667
  `Uploading ${path7.basename(file)}`,
@@ -7626,7 +7672,7 @@ async function runAnalysis(file, options, cmd) {
7626
7672
  const configuredHours = await configureInteractively(api, prompter, created.analysisId, request, {
7627
7673
  targets: options.targets === void 0 ? void 0 : parseCsv(options.targets),
7628
7674
  segment: options.segment,
7629
- questions: options.questions === void 0 ? void 0 : parseCsv(options.questions),
7675
+ questions: options.question === void 0 ? void 0 : questionsOf(options.question),
7630
7676
  hours: options.hours,
7631
7677
  budget: options.budget
7632
7678
  });
@@ -7695,16 +7741,30 @@ async function monitorRun(api, analysisId, runId, budgetHours, cmd) {
7695
7741
  const seenOutputs = /* @__PURE__ */ new Set();
7696
7742
  let caption = null;
7697
7743
  let lastReported = "";
7744
+ let missingPolls = 0;
7698
7745
  if (human) status.start();
7699
7746
  try {
7700
7747
  for (; ; ) {
7701
7748
  await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
7702
7749
  let run = null;
7750
+ let absent = false;
7703
7751
  try {
7704
7752
  run = (await api.analysis.getRun(runId)).run;
7705
- } 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;
7706
7766
  }
7707
- if (!run) continue;
7767
+ missingPolls = 0;
7708
7768
  try {
7709
7769
  for (const out of await api.analysis.getRunOutputs(analysisId, runId)) {
7710
7770
  const key = `${out.outputId}:${out.output}`;
@@ -7923,6 +7983,10 @@ async function rerunAnalysis(analysisId, cmd) {
7923
7983
  if (configuredHours === null) return;
7924
7984
  }
7925
7985
  const run = await api.analysis.runAnalysis(analysisId);
7986
+ if (isDryRun()) {
7987
+ hint("Dry run: no run was queued.");
7988
+ return;
7989
+ }
7926
7990
  success(`Queued run ${run.runId} for analysis ${analysisId}.`);
7927
7991
  hint(`Follow it with 'diafunc analyze watch ${analysisId}'.`);
7928
7992
  }
@@ -7956,21 +8020,33 @@ async function createAnalysis(options, cmd) {
7956
8020
  hours: options.hours ?? null,
7957
8021
  budget: options.budget ?? null,
7958
8022
  targets: parseCsv(options.targets),
7959
- questions: parseCsv(options.questions),
8023
+ questions: questionsOf(options.question),
7960
8024
  segment: options.segment ?? null
7961
8025
  };
7962
8026
  const created = await api.analysis.create(request);
8027
+ if (isDryRun()) {
8028
+ hint("Dry run: nothing was created.");
8029
+ return;
8030
+ }
7963
8031
  format(created, { format: outputFormat });
7964
8032
  }
7965
8033
  async function deleteAnalysis(analysisId) {
7966
8034
  const api = createApiClient();
7967
8035
  await api.analysis.delete(analysisId);
8036
+ if (isDryRun()) {
8037
+ hint("Dry run: nothing was deleted.");
8038
+ return;
8039
+ }
7968
8040
  success(`Deleted analysis ${analysisId}.`);
7969
8041
  }
7970
8042
  async function patchAndPrint(analysisId, value, handler, successLabel, cmd) {
7971
8043
  const outputFormat = getOutputFormat15(cmd);
7972
8044
  const api = createApiClient();
7973
8045
  const updated = await handler(api, analysisId, value);
8046
+ if (isDryRun()) {
8047
+ hint("Dry run: nothing was changed.");
8048
+ return;
8049
+ }
7974
8050
  if (outputFormat === "human") {
7975
8051
  success(`${successLabel} updated for analysis ${analysisId}.`);
7976
8052
  } else {
@@ -8091,12 +8167,16 @@ async function savePreset(options, cmd) {
8091
8167
  presetId: options.id ?? null,
8092
8168
  name: options.name,
8093
8169
  targetKeys: parseCsv(options.targets) ?? [],
8094
- questions: parseCsv(options.questions) ?? [],
8170
+ questions: questionsOf(options.question) ?? [],
8095
8171
  segmentKey: options.segment ?? null,
8096
8172
  time: options.hours,
8097
8173
  budget: options.budget
8098
8174
  };
8099
8175
  const saved = await api.analysis.savePreset(preset);
8176
+ if (isDryRun()) {
8177
+ hint("Dry run: nothing was saved.");
8178
+ return;
8179
+ }
8100
8180
  format(saved, { format: outputFormat });
8101
8181
  }
8102
8182
  async function deletePreset(presetId) {
@@ -8168,7 +8248,7 @@ async function updateTriggerCmd(triggerId, options, cmd) {
8168
8248
  }
8169
8249
  function registerAnalyzeCommand(program) {
8170
8250
  const analyze = program.command("analyze").description("Run and manage automatic analyses");
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) => {
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) => {
8172
8252
  try {
8173
8253
  if (!file) {
8174
8254
  analyze.help();
@@ -8214,7 +8294,7 @@ function registerAnalyzeCommand(program) {
8214
8294
  reportCommandError(error);
8215
8295
  }
8216
8296
  });
8217
- 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) => {
8218
8298
  try {
8219
8299
  await createAnalysis(options, cmd);
8220
8300
  } catch (error) {
@@ -8350,12 +8430,12 @@ function registerAnalyzeCommand(program) {
8350
8430
  handleError(error);
8351
8431
  }
8352
8432
  });
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) => {
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) => {
8354
8434
  try {
8355
- const questions = parseCsv(csv) ?? [];
8435
+ const questions = questionsOf(Array.isArray(given) ? given : [given]) ?? [];
8356
8436
  await patchAndPrint(
8357
8437
  id,
8358
- csv,
8438
+ questions.join(" | "),
8359
8439
  (api, aid) => api.analysis.patchQuestions(aid, { questions }),
8360
8440
  "Questions",
8361
8441
  cmd
@@ -8377,7 +8457,7 @@ function registerAnalyzeCommand(program) {
8377
8457
  handleError(error);
8378
8458
  }
8379
8459
  });
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) => {
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) => {
8381
8461
  try {
8382
8462
  await uploadData(id, file, options);
8383
8463
  } catch (error) {
@@ -8420,7 +8500,7 @@ function registerAnalyzeCommand(program) {
8420
8500
  handleError(error);
8421
8501
  }
8422
8502
  });
8423
- 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) => {
8424
8504
  try {
8425
8505
  await savePreset(options, cmd);
8426
8506
  } catch (error) {
@@ -9716,7 +9796,7 @@ function registerShellCommand(program) {
9716
9796
  });
9717
9797
  const api = createApiClient();
9718
9798
  const { input: promptInput } = await import("@inquirer/prompts");
9719
- const { getUpdateNotice } = await import("./update-check-5CPEMV2M.js");
9799
+ const { getUpdateNotice } = await import("./update-check-HMBNFIA5.js");
9720
9800
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
9721
9801
  console.log(chalk31.bold("Diafunc shell") + chalk31.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
9722
9802
  console.log(chalk31.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
@@ -10012,7 +10092,7 @@ var BY_COMMAND = {
10012
10092
  "analyze targets": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
10013
10093
  "analyze feature-exclusions": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
10014
10094
  "analyze confirmed-inputs": { "<csv>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
10015
- "analyze questions": { "<csv>": TEXT_OR_EMPTY },
10095
+ "analyze questions": { "<question>": TEXT_OR_EMPTY },
10016
10096
  "analyze description": { "<text>": TEXT_OR_EMPTY },
10017
10097
  "analyze introduction": { "<markdown>": TEXT_OR_EMPTY },
10018
10098
  "analyze presets save": { "--targets": TEXT, "--hours": POSITIVE, "--budget": POSITIVE },
@@ -10763,4 +10843,4 @@ export {
10763
10843
  PromptCancelled,
10764
10844
  createProgram
10765
10845
  };
10766
- //# sourceMappingURL=chunk-6ZOIOHSW.js.map
10846
+ //# sourceMappingURL=chunk-ZVC7B6VZ.js.map