@diafunc/cli 0.11.0 → 0.13.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
@@ -22,8 +22,8 @@ Drops a single self-contained binary at `~/.local/bin/diafunc` (Linux/macOS) or
22
22
 
23
23
  Environment variables:
24
24
 
25
- - `DIAFUNC_CLI_VERSION` — pin to a specific version (must match the latest release; older versions are available via npm only).
26
- - `DIAFUNC_CLI_INSTALL_DIR` — override the install directory.
25
+ - `DIAFUNC_CLI_VERSION`: pin to a specific version (must match the latest release; older versions are available via npm only).
26
+ - `DIAFUNC_CLI_INSTALL_DIR`: override the install directory.
27
27
 
28
28
  ### npm (if you already have Node.js 20+)
29
29
 
@@ -42,12 +42,12 @@ diafunc update # upgrade to the latest release
42
42
  diafunc uninstall # remove the binary (and optionally ~/.diafunc/)
43
43
  ```
44
44
 
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.
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.
46
46
 
47
47
  ## Quick Start
48
48
 
49
49
  ```bash
50
- # Log in via the browser (OIDC device-code flow — default)
50
+ # Log in via the browser (OIDC device-code flow, the default)
51
51
  diafunc auth login
52
52
 
53
53
  # Set a default project
@@ -73,7 +73,7 @@ diafunc analyze watch
73
73
  `diafunc auth login` supports three modes:
74
74
 
75
75
  ```bash
76
- # OIDC device-code flow (default) — prints a URL and a short user code,
76
+ # OIDC device-code flow (default): prints a URL and a short user code,
77
77
  # you approve in the browser, tokens are cached locally.
78
78
  # Uses auth.<your-endpoint> (e.g. auth.diafunc.com for the default endpoint).
79
79
  diafunc auth login
@@ -148,6 +148,25 @@ Preview mutating operations without executing them:
148
148
  diafunc project create --visibility PRIVATE --dry-run
149
149
  ```
150
150
 
151
+ ## Missing Input
152
+
153
+ Run from a terminal, any command asks for a required argument or flag you left out, instead of
154
+ failing. Where the CLI can list the possible values it offers them to choose from: your projects,
155
+ tables, functions, teams, analyses, sessions and the like, filtered as you type. Otherwise it asks
156
+ for the value and checks it. Afterwards it prints the equivalent command, so you learn the form a
157
+ script would use:
158
+
159
+ ```bash
160
+ $ diafunc table view
161
+ ? Project prom
162
+ ? Table Raw Data Table
163
+ Equivalent: diafunc table view 6751a977-…/main/141cb28a-…
164
+ ```
165
+
166
+ Nothing is asked when stdin or stdout is not a terminal, with `--output json`, or with the global
167
+ `--no-interactive`: those runs fail on a missing input exactly as a script expects. See
168
+ [doc/interactive-prompts.md](doc/interactive-prompts.md).
169
+
151
170
  ## Commands
152
171
 
153
172
  | Command | Description |
@@ -169,10 +188,10 @@ diafunc project create --visibility PRIVATE --dry-run
169
188
  | `diafunc schedule` | Schedule function execution and list/stop scheduled runs |
170
189
  | `diafunc chat` | AI chat REPL (default), plus `send` / `stream` / `upload`, `usage`, and `session list/show/rename/delete` |
171
190
  | `diafunc search` | Search entities across projects |
172
- | `diafunc analyze` | Automatic analysis wizard, interactive when run from a terminal, plus `list`, `get`, `watch` (live progress), `open` (browser) |
191
+ | `diafunc analyze` | Run an automatic analysis on a data file and follow it live (interactive when run from a terminal), plus `list`, `get`, `watch`, `open`, `runs`, `cancel`, `presets`, `triggers` (see [doc/analyze.md](./doc/analyze.md)) |
173
192
  | `diafunc subscription` | View your current and upcoming subscription, plus available plans |
174
193
  | `diafunc invoice` | List and download invoices |
175
- | `diafunc utilization` | Show current credit utilization and historical usage |
194
+ | `diafunc utilization` | Show current credit utilization, and with `history` what each day of the billing cycle cost |
176
195
  | `diafunc status` | Platform health: summary, per-component status, incidents |
177
196
  | `diafunc admin` | User management, subscription, settings, backups, index rebuild, permission inspection |
178
197
  | `diafunc completion` | Generate shell completions |
@@ -182,10 +201,10 @@ Run `diafunc <command> --help` for detailed usage of any command.
182
201
  ## Shell Completions
183
202
 
184
203
  ```bash
185
- # Bash — add to ~/.bashrc
204
+ # Bash: add to ~/.bashrc
186
205
  eval "$(diafunc completion bash)"
187
206
 
188
- # Zsh — add to ~/.zshrc
207
+ # Zsh: add to ~/.zshrc
189
208
  eval "$(diafunc completion zsh)"
190
209
 
191
210
  # Fish
@@ -204,7 +223,7 @@ npm run lint # TypeScript type check
204
223
 
205
224
  ## Releasing to npm
206
225
 
207
- Publishing is fully automated via GitLab CI using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) over OIDC — no long-lived tokens are stored anywhere.
226
+ Publishing is fully automated via GitLab CI using [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) over OIDC, so no long-lived tokens are stored anywhere.
208
227
 
209
228
  ### One-time setup on npmjs.com
210
229
 
@@ -222,24 +241,24 @@ The first publish must be done manually (run `npm publish` locally) to create th
222
241
 
223
242
  ### Cutting a release
224
243
 
225
- **Option A — from the terminal:**
244
+ **Option A, from the terminal:**
226
245
 
227
246
  ```bash
228
- npm version patch # or minor / major — bumps package.json, commits, creates tag
247
+ npm version patch # or minor / major; bumps package.json, commits, creates tag
229
248
  git push origin main --follow-tags
230
249
  ```
231
250
 
232
- **Option B — from the GitLab UI:**
251
+ **Option B, from the GitLab UI:**
233
252
 
234
253
  1. First bump `package.json` `version` via a small MR (or direct commit to `main`).
235
254
  2. Go to https://gitlab.com/diafunc/cli/-/releases/new and create a new release with tag `v<version>` from `main`.
236
255
 
237
256
  Either way, pushing a `vX.Y.Z` tag triggers two CI jobs:
238
- - `publish` — builds and publishes to npm via OIDC trusted publishing (npm generates [provenance attestations](https://docs.npmjs.com/generating-provenance-statements) automatically)
239
- - `gitlab-release` — creates a GitLab Release entry linking to the npm package
257
+ - `publish`: builds and publishes to npm via OIDC trusted publishing (npm generates [provenance attestations](https://docs.npmjs.com/generating-provenance-statements) automatically)
258
+ - `gitlab-release`: creates a GitLab Release entry linking to the npm package
240
259
 
241
260
  No manual steps after the tag push.
242
261
 
243
262
  ## License
244
263
 
245
- Apache License 2.0 — see [LICENSE](./LICENSE).
264
+ Apache License 2.0; see [LICENSE](./LICENSE).
@@ -1,13 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- createProgram
4
- } from "../chunk-GDW62ZQX.js";
3
+ EXIT_CANCELLED,
4
+ PromptCancelled,
5
+ createProgram,
6
+ handleError
7
+ } from "../chunk-EJLRB75G.js";
5
8
  import {
6
9
  getUpdateNotice
7
- } from "../chunk-77KBGDMM.js";
10
+ } from "../chunk-GOEDVSWO.js";
8
11
  import {
9
12
  package_default
10
- } from "../chunk-Q7HG2CUO.js";
13
+ } from "../chunk-TWJWXUZL.js";
11
14
 
12
15
  // bin/diafunc.ts
13
16
  import chalk2 from "chalk";
@@ -136,7 +139,16 @@ if (process.argv.length <= 2 && process.stdout.isTTY) {
136
139
  async function main() {
137
140
  const program = createProgram();
138
141
  const noticePromise = getUpdateNotice();
139
- await program.parseAsync(process.argv);
142
+ try {
143
+ await program.parseAsync(process.argv);
144
+ } catch (error) {
145
+ if (error instanceof PromptCancelled) {
146
+ console.log();
147
+ console.log(chalk2.dim("Cancelled."));
148
+ process.exit(EXIT_CANCELLED);
149
+ }
150
+ handleError(error);
151
+ }
140
152
  try {
141
153
  const notice = await Promise.race([
142
154
  noticePromise,
@@ -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';\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,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,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C;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
+ {"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;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,UAAkB,WAA2B;AAEhE,QAAM,UAAU,YAAY,KAAK;AACjC,QAAM,IAAI,KAAK,IAAI,WAAW,MAAM,IAAI;AACxC,QAAM,IAAI,KAAK,MAAM,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC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