@diafunc/cli 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,18 +4,26 @@ Command-line interface for the [Diafunc](https://diafunc.com) platform.
4
4
 
5
5
  ## Installation
6
6
 
7
- ### Shell installer (Linux, macOS — recommended)
7
+ ### Shell installer (recommended)
8
+
9
+ Linux / macOS:
8
10
 
9
11
  ```bash
10
12
  curl -fsSL https://diafunc.com/cli/install.sh | sh
11
13
  ```
12
14
 
13
- Drops a single self-contained binary into `~/.local/bin/diafunc`. No Node.js required.
15
+ Windows (PowerShell):
16
+
17
+ ```powershell
18
+ irm https://diafunc.com/cli/install.ps1 | iex
19
+ ```
20
+
21
+ Drops a single self-contained binary at `~/.local/bin/diafunc` (Linux/macOS) or `%LOCALAPPDATA%\diafunc\bin\diafunc.exe` (Windows). No Node.js required.
14
22
 
15
23
  Environment variables:
16
24
 
17
25
  - `DIAFUNC_CLI_VERSION` — pin to a specific version (must match the latest release; older versions are available via npm only).
18
- - `DIAFUNC_CLI_INSTALL_DIR` — override the install directory (default `$HOME/.local/bin`).
26
+ - `DIAFUNC_CLI_INSTALL_DIR` — override the install directory.
19
27
 
20
28
  ### npm (if you already have Node.js 20+)
21
29
 
@@ -34,7 +42,7 @@ diafunc update # upgrade to the latest release
34
42
  diafunc uninstall # remove the binary (and optionally ~/.diafunc/)
35
43
  ```
36
44
 
37
- `diafunc update` uses the same install path as the original install — shell installer in place, npm-installed CLIs are pointed at `npm install -g @diafunc/cli@latest`.
45
+ `diafunc update` uses the same install path as the original install — shell installer (or PowerShell installer on Windows) in place, npm-installed CLIs are pointed at `npm install -g @diafunc/cli@latest`. On Windows the running `.exe` is renamed aside before the new one is dropped in; the old file is cleaned up the next time `diafunc` runs.
38
46
 
39
47
  ## Quick Start
40
48
 
@@ -69,9 +77,6 @@ diafunc auth login
69
77
  # Non-interactive, for scripts and CI. Get a token from
70
78
  # Settings → API Tokens in the web UI.
71
79
  diafunc auth login --token dfat_your_token_here
72
-
73
- # Legacy username/password, kept for environments without a browser.
74
- diafunc auth login --password
75
80
  ```
76
81
 
77
82
  `diafunc auth logout` clears the local credentials and revokes the refresh
@@ -143,7 +148,7 @@ diafunc project create --visibility PRIVATE --dry-run
143
148
 
144
149
  | Command | Description |
145
150
  |---------|-------------|
146
- | `diafunc auth` | Login (OIDC device-code, API token, or legacy password), logout, status, API token management |
151
+ | `diafunc auth` | Login (OIDC device-code or API token), logout, status, API token management |
147
152
  | `diafunc whoami` | Show the currently authenticated user |
148
153
  | `diafunc config` | Configuration and profile management |
149
154
  | `diafunc project` | Project CRUD, `recent`, `update`, lock/unlock, member management |
@@ -1,16 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createProgram
4
- } from "../chunk-7TYSZ6GC.js";
4
+ } from "../chunk-SEX4YGKJ.js";
5
5
  import {
6
6
  getUpdateNotice
7
- } from "../chunk-C2KAWAWW.js";
7
+ } from "../chunk-CXC5AQC3.js";
8
8
  import {
9
9
  package_default
10
- } from "../chunk-FCWSWCFN.js";
10
+ } from "../chunk-LXTNUI3L.js";
11
11
 
12
12
  // bin/diafunc.ts
13
13
  import chalk2 from "chalk";
14
+ import * as fs from "fs";
15
+ import * as path from "path";
14
16
 
15
17
  // src/splash.ts
16
18
  import chalk from "chalk";
@@ -113,6 +115,20 @@ function showSplash() {
113
115
  }
114
116
 
115
117
  // bin/diafunc.ts
118
+ if (process.platform === "win32") {
119
+ try {
120
+ const dir = path.dirname(process.execPath);
121
+ for (const name of fs.readdirSync(dir)) {
122
+ if (name.startsWith("diafunc.exe") && name.endsWith(".old")) {
123
+ try {
124
+ fs.unlinkSync(path.join(dir, name));
125
+ } catch {
126
+ }
127
+ }
128
+ }
129
+ } catch {
130
+ }
131
+ }
116
132
  if (process.argv.length <= 2 && process.stdout.isTTY) {
117
133
  showSplash();
118
134
  process.exit(0);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../bin/diafunc.ts","../../src/splash.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\nimport { getUpdateNotice } from '../src/util/update-check.js';\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 await program.parseAsync(process.argv);\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;;;ACAlB,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;AAEA,SAAS,IAAI,GAAsB;AAEjC,SAAO,MAAM,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,MAAM,GAAG;AAC3C;AAGA,IAAM,QAA2C,CAAC,IAAM,KAAM,GAAI;AAClE,IAAM,OAA0C,CAAC,IAAM,IAAM,EAAI;AAEjE,SAAS,YAAY,UAAk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":["chalk","chalk"]}
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';\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 await program.parseAsync(process.argv);\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,EA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Q,QAAQ,QAAQ;AACzC,eAAW,QAAW,eAAY,GAAG,GAAG;AACtC,UAAI,KAAK,WAAW,aAAa,KAAK,KAAK,SAAS,MAAM,GAAG;AAC3D,YAAI;AAAE,UAAG,cAAgB,UAAK,KAAK,IAAI,CAAC;AAAA,QAAG,QAAQ;AAAA,QAAC;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,QAAM,QAAQ,WAAW,QAAQ,IAAI;AACrC,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,MAAMC,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-FCWSWCFN.js";
3
+ } from "./chunk-LXTNUI3L.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-C2KAWAWW.js.map
75
+ //# sourceMappingURL=chunk-CXC5AQC3.js.map
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@diafunc/cli",
4
- version: "0.4.1",
4
+ version: "0.6.0",
5
5
  description: "Diafunc CLI \u2014 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-FCWSWCFN.js.map
65
+ //# sourceMappingURL=chunk-LXTNUI3L.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@diafunc/cli\",\n \"version\": \"0.4.1\",\n \"description\": \"Diafunc CLI — 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.6.0\",\n \"description\": \"Diafunc CLI — 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-FCWSWCFN.js";
3
+ } from "./chunk-LXTNUI3L.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { Command } from "commander";
@@ -110,14 +110,14 @@ function getAuthHeader(auth) {
110
110
  if (auth.type === "api-token") {
111
111
  return `Bearer ${auth.token}`;
112
112
  }
113
- if (auth.type === "session" || auth.type === "device-code") {
113
+ if (auth.type === "device-code") {
114
114
  return `Bearer ${auth.accessToken}`;
115
115
  }
116
116
  return void 0;
117
117
  }
118
118
  function isTokenExpired(auth) {
119
119
  if (!auth) return false;
120
- if (auth.type === "session" || auth.type === "device-code") {
120
+ if (auth.type === "device-code") {
121
121
  return Date.now() >= auth.accessTokenExpiry - 3e4;
122
122
  }
123
123
  return false;
@@ -132,22 +132,6 @@ function deriveAuthUrl(endpoint) {
132
132
  url.pathname = "";
133
133
  return url.toString().replace(/\/+$/, "");
134
134
  }
135
- async function refreshSession(endpoint, refreshToken) {
136
- const url = `${endpoint}/api/v1/admin/sessions/`;
137
- const response = await fetch(url, {
138
- method: "PUT",
139
- headers: { "Content-Type": "text/plain" },
140
- body: refreshToken
141
- });
142
- if (!response.ok) {
143
- throw new ApiError(response.status, "Session refresh failed. Please log in again.");
144
- }
145
- const session = await response.json();
146
- return {
147
- accessToken: session.accessToken.raw,
148
- accessTokenExpiry: session.accessToken.expiry
149
- };
150
- }
151
135
  async function refreshOAuthTokens(endpoint, clientId, refreshToken) {
152
136
  const authUrl = deriveAuthUrl(endpoint);
153
137
  const response = await fetch(`${authUrl}/token`, {
@@ -177,16 +161,7 @@ async function ensureValidAuth(config, profileOverride) {
177
161
  return profile.auth;
178
162
  }
179
163
  const endpoint = resolveEndpoint(config, profileOverride);
180
- if (profile.auth.type === "session") {
181
- const refreshed = await refreshSession(endpoint, profile.auth.refreshToken);
182
- profile.auth = {
183
- type: "session",
184
- accessToken: refreshed.accessToken,
185
- refreshToken: profile.auth.refreshToken,
186
- accessTokenExpiry: refreshed.accessTokenExpiry
187
- };
188
- saveConfig(config);
189
- } else if (profile.auth.type === "device-code") {
164
+ if (profile.auth.type === "device-code") {
190
165
  const refreshed = await refreshOAuthTokens(endpoint, profile.auth.clientId, profile.auth.refreshToken);
191
166
  profile.auth = {
192
167
  type: "device-code",
@@ -664,7 +639,7 @@ function deriveAuthUrl2(endpoint) {
664
639
  return url.toString().replace(/\/+$/, "");
665
640
  }
666
641
  function registerLoginCommand(parent) {
667
- parent.command("login").description("Authenticate with the Diafunc platform").option("--token <token>", "API token (dfat_...) for non-interactive token-based auth").option("--endpoint <url>", "Override the endpoint URL for this login").option("--password", "Use legacy username/password login instead of OIDC device code").action(async (options) => {
642
+ parent.command("login").description("Authenticate with the Diafunc platform").option("--token <token>", "API token (dfat_...) for non-interactive token-based auth").option("--endpoint <url>", "Override the endpoint URL for this login").action(async (options) => {
668
643
  try {
669
644
  const config = loadConfig();
670
645
  const profile = config.profiles[config.currentProfile];
@@ -688,10 +663,6 @@ function registerLoginCommand(parent) {
688
663
  console.log(` Endpoint: ${profile.endpoint}`);
689
664
  return;
690
665
  }
691
- if (options.password) {
692
- await legacyPasswordLogin(config, profile);
693
- return;
694
- }
695
666
  await deviceCodeLogin(config, profile);
696
667
  } catch (error) {
697
668
  handleError(error);
@@ -771,38 +742,6 @@ Device-code flow failed: ${errorBody.error}${errorBody.error_description ? " \u2
771
742
  console.error(chalk2.red("\nTimed out waiting for approval."));
772
743
  process.exit(1);
773
744
  }
774
- async function legacyPasswordLogin(config, profile) {
775
- const { input, password } = await import("@inquirer/prompts");
776
- const username = await input({ message: "Username or email:" });
777
- const pwd = await password({ message: "Password:" });
778
- const endpoint = profile.endpoint.replace(/\/+$/, "");
779
- const response = await fetch(`${endpoint}/api/v1/admin/sessions/`, {
780
- method: "POST",
781
- headers: { "Content-Type": "application/json" },
782
- body: JSON.stringify({ userNameOrEmail: username, password: pwd })
783
- });
784
- if (!response.ok) {
785
- const text = await response.text();
786
- console.error(chalk2.red("Login failed:"), text || response.statusText);
787
- process.exit(1);
788
- }
789
- const session = await response.json();
790
- profile.auth = {
791
- type: "session",
792
- accessToken: session.accessToken.raw,
793
- refreshToken: session.refreshToken.raw,
794
- accessTokenExpiry: session.accessToken.expiry
795
- };
796
- saveConfig(config);
797
- const client = createHttpClient();
798
- const admin = createAdminService(client);
799
- const user = await admin.getMyUser();
800
- console.log(chalk2.green("Logged in successfully (legacy password path)."));
801
- console.log(` User: ${chalk2.bold(user.name)}`);
802
- console.log(` Email: ${user.email}`);
803
- console.log(` Profile: ${config.currentProfile}`);
804
- console.log(` Endpoint: ${profile.endpoint}`);
805
- }
806
745
  function sleep(ms) {
807
746
  return new Promise((resolve) => setTimeout(resolve, ms));
808
747
  }
@@ -844,12 +783,6 @@ function registerLogoutCommand(parent) {
844
783
  });
845
784
  } catch {
846
785
  }
847
- } else if (profile.auth.type === "session") {
848
- try {
849
- const endpoint = profile.endpoint.replace(/\/+$/, "");
850
- await fetch(`${endpoint}/api/v1/admin/sessions/`, { method: "DELETE" });
851
- } catch {
852
- }
853
786
  }
854
787
  delete profile.auth;
855
788
  saveConfig(config);
@@ -3693,7 +3626,7 @@ Error: ${event.content}`));
3693
3626
  }
3694
3627
  async function runChatRepl(options) {
3695
3628
  const { input: promptInput } = await import("@inquirer/prompts");
3696
- const { getUpdateNotice } = await import("./update-check-4DNIH3LQ.js");
3629
+ const { getUpdateNotice } = await import("./update-check-M7H4GTM7.js");
3697
3630
  let sessionId = options.session;
3698
3631
  console.log(chalk17.bold("Diafunc chat") + chalk17.dim(" \xB7 /help for commands, /quit to exit"));
3699
3632
  if (sessionId) {
@@ -5680,7 +5613,7 @@ function registerShellCommand(program) {
5680
5613
  });
5681
5614
  const api = createApiClient();
5682
5615
  const { input: promptInput } = await import("@inquirer/prompts");
5683
- const { getUpdateNotice } = await import("./update-check-4DNIH3LQ.js");
5616
+ const { getUpdateNotice } = await import("./update-check-M7H4GTM7.js");
5684
5617
  console.log(chalk28.bold("Diafunc shell") + chalk28.dim(` \xB7 function ${fnRef.entityId} \xB7 ${options.language}`));
5685
5618
  console.log(chalk28.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
5686
5619
  console.log(chalk28.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
@@ -5784,7 +5717,8 @@ function detectInstall() {
5784
5717
 
5785
5718
  // src/commands/update/index.ts
5786
5719
  var MANIFEST_URL = "https://diafunc.com/cli/latest.json";
5787
- var INSTALLER_URL = "https://diafunc.com/cli/install.sh";
5720
+ var POSIX_INSTALLER_URL = "https://diafunc.com/cli/install.sh";
5721
+ var WINDOWS_INSTALLER_URL = "https://diafunc.com/cli/install.ps1";
5788
5722
  async function fetchLatestVersion() {
5789
5723
  const res = await fetch(MANIFEST_URL);
5790
5724
  if (!res.ok) throw new Error(`Failed to fetch ${MANIFEST_URL}: HTTP ${res.status}`);
@@ -5794,7 +5728,10 @@ async function fetchLatestVersion() {
5794
5728
  }
5795
5729
  function runInstaller(installDir) {
5796
5730
  return new Promise((resolve, reject) => {
5797
- const child = spawn4("sh", ["-c", `curl -fsSL ${INSTALLER_URL} | sh`], {
5731
+ const isWindows = process.platform === "win32";
5732
+ const cmd = isWindows ? "powershell.exe" : "sh";
5733
+ const args = isWindows ? ["-NoProfile", "-Command", `& { iwr -useb ${WINDOWS_INSTALLER_URL} | iex }`] : ["-c", `curl -fsSL ${POSIX_INSTALLER_URL} | sh`];
5734
+ const child = spawn4(cmd, args, {
5798
5735
  stdio: "inherit",
5799
5736
  env: { ...process.env, DIAFUNC_CLI_INSTALL_DIR: installDir }
5800
5737
  });
@@ -5818,12 +5755,6 @@ function registerUpdateCommand(program) {
5818
5755
  console.log(chalk29.bold(` npm install -g @diafunc/cli@${latest}`));
5819
5756
  return;
5820
5757
  }
5821
- if (process.platform === "win32") {
5822
- console.log();
5823
- console.log("In-place update is not supported on Windows. Re-download from:");
5824
- console.log(chalk29.bold(" https://diafunc.com/cli/diafunc-windows-x64.zip"));
5825
- return;
5826
- }
5827
5758
  const installDir = path7.dirname(install.binaryPath);
5828
5759
  console.log(`Installing diafunc ${latest} to ${installDir}...`);
5829
5760
  console.log();
@@ -5836,6 +5767,7 @@ function registerUpdateCommand(program) {
5836
5767
 
5837
5768
  // src/commands/uninstall/index.ts
5838
5769
  import chalk30 from "chalk";
5770
+ import { spawn as spawn5 } from "child_process";
5839
5771
  import * as fs10 from "fs";
5840
5772
  import * as os4 from "os";
5841
5773
  import * as path8 from "path";
@@ -5854,11 +5786,6 @@ function registerUninstallCommand(program) {
5854
5786
  }
5855
5787
  return;
5856
5788
  }
5857
- if (process.platform === "win32") {
5858
- console.log("Self-uninstall is not supported on Windows (the running .exe is locked).");
5859
- console.log(`Delete the binary manually: ${install.binaryPath}`);
5860
- return;
5861
- }
5862
5789
  const { confirm } = await import("@inquirer/prompts");
5863
5790
  const removeBinary = options.yes ? true : await confirm({
5864
5791
  message: `Remove binary at ${install.binaryPath}?`,
@@ -5879,6 +5806,19 @@ function registerUninstallCommand(program) {
5879
5806
  fs10.rmSync(configDir, { recursive: true, force: true });
5880
5807
  console.log(chalk30.dim(`Removed ${configDir}`));
5881
5808
  }
5809
+ if (process.platform === "win32") {
5810
+ const cmd = `timeout /t 2 /nobreak >nul & del /f /q "${install.binaryPath}"`;
5811
+ const child = spawn5("cmd.exe", ["/c", cmd], {
5812
+ detached: true,
5813
+ stdio: "ignore",
5814
+ windowsHide: true
5815
+ });
5816
+ child.unref();
5817
+ console.log(chalk30.dim(`Removing ${install.binaryPath} on exit...`));
5818
+ console.log();
5819
+ console.log("diafunc uninstalled.");
5820
+ return;
5821
+ }
5882
5822
  fs10.rmSync(install.binaryPath, { force: true });
5883
5823
  console.log(chalk30.dim(`Removed ${install.binaryPath}`));
5884
5824
  console.log();
@@ -5930,4 +5870,4 @@ function createProgram() {
5930
5870
  export {
5931
5871
  createProgram
5932
5872
  };
5933
- //# sourceMappingURL=chunk-7TYSZ6GC.js.map
5873
+ //# sourceMappingURL=chunk-SEX4YGKJ.js.map