Lines 1-35javascript
2// cli.ts — the unified vitrinka CLI. Maintains `.screenshots/manifest.json` + a self-contained,
3// clickable `index.html` gallery, publishes sets to vitrinka (the internal artifacts app), and
4// one-shots capture (`snap`) + artifact scaffolding (`artifact-init`, `artifact-from-set`).
6// Zero dependencies (node: builtins only). Erasable TypeScript only — Node 24 type-stripping
7// and bun both run it directly: `node cli.ts <cmd>`.
9// add / build / meta / remote-init / push are ported verbatim in behavior from
10// skills/screenshot/gallery.mjs (offline marker, COPYFILE_DISABLE, control-file excludes,
11// `--key`, repeatable `--chip`). gallery.mjs is now a passthrough shim to this file.
12// Design: vitrinka/docs/plans/2026-07-03-hand-in-hand-tooling-design.md
13import { readFileSync, writeFileSync, existsSync, mkdirSync, rmSync, readdirSync, copyFileSync, mkdtempSync, chmodSync, appendFileSync, statSync, openSync, readSync, closeSync, realpathSync, } from 'node:fs';
14import { join, resolve, basename, dirname, extname, relative, sep } from 'node:path';
15import { tmpdir, hostname } from 'node:os';
16import { spawnSync, spawn } from 'node:child_process';
17import { createHash } from 'node:crypto';
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
dist/cli.jsView on unpkg · L15 MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/cli.jsView on unpkg · L15 18import { fileURLToPath, pathToFileURL } from 'node:url';
19import { createInterface } from 'node:readline';
20import { readToken, tokenSource, tokenPath, tokenHelp } from "./lib/token.js";
21import { operatorPath, readOperator, actorHeaderValue } from "./lib/operator.js";
22import { resolveBaseUrl } from "./lib/base-url.js";
23const CLI_PATH = fileURLToPath(import.meta.url);
24export function parseArgs(argv) {
26 for (let i = 0; i < argv.length; i++) {
28 if (!a.startsWith('--'))
30 const key = a.slice(2);
31 const next = argv[i + 1];
32 const val = next === undefined || next.startsWith('--') ? true : argv[++i];
34 if (cur === undefined)
35 out[key] = val; // repeated flags (e.g. --chip) accumulate