@v1nvn/statusline 0.27.0 → 0.27.2
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 +7 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,13 +22,13 @@ In Claude Code — type `/lab`, run the wizard it hands you (`!`
|
|
|
22
22
|
runs it in your session with a real terminal):
|
|
23
23
|
|
|
24
24
|
```
|
|
25
|
-
! npx -y @v1nvn/statusline@0.27.
|
|
25
|
+
! npx -y @v1nvn/statusline@0.27.2 configure
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
In a terminal — same command, bare:
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
|
-
npx -y @v1nvn/statusline@0.27.
|
|
31
|
+
npx -y @v1nvn/statusline@0.27.2 configure
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
`j/k` move · `h/l` switch design · `s` sets the focused item to none · `w`
|
|
@@ -48,11 +48,11 @@ to operate on another home instead of `$HOME`.
|
|
|
48
48
|
| `restore` | both keys back to their pre-lab values from `backup.json`, then deletes the lab data — `--dry-run` prints the plan; `--force` splices over a key changed after the takeover |
|
|
49
49
|
|
|
50
50
|
```sh
|
|
51
|
-
npx -y @v1nvn/statusline@0.27.
|
|
52
|
-
npx -y @v1nvn/statusline@0.27.
|
|
53
|
-
npx -y @v1nvn/statusline@0.27.
|
|
54
|
-
npx -y @v1nvn/statusline@0.27.
|
|
55
|
-
npx -y @v1nvn/statusline@0.27.
|
|
51
|
+
npx -y @v1nvn/statusline@0.27.2 catalog
|
|
52
|
+
npx -y @v1nvn/statusline@0.27.2 configure --model block --bar gauge --fallback=default --dry-run # preview, write nothing
|
|
53
|
+
npx -y @v1nvn/statusline@0.27.2 configure --model block --bar gauge --fallback=default # the write
|
|
54
|
+
npx -y @v1nvn/statusline@0.27.2 status
|
|
55
|
+
npx -y @v1nvn/statusline@0.27.2 restore
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Develop
|
package/dist/index.js
CHANGED
|
@@ -163,7 +163,7 @@ function catalog(options) {
|
|
|
163
163
|
//#region src/cli.ts
|
|
164
164
|
var VERSION = {
|
|
165
165
|
name: "@v1nvn/statusline",
|
|
166
|
-
version: "0.27.
|
|
166
|
+
version: "0.27.2",
|
|
167
167
|
description: "Browse statusline variants and configure the live status line and agent panel — the statusline CLI behind the statusline plugin.",
|
|
168
168
|
type: "module",
|
|
169
169
|
bin: "dist/index.js",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../core/dist/index.js","../src/resolve.ts","../src/catalog.ts","../package.json","../src/cli.ts","../src/demo-repo.ts","../src/payloads.ts","../src/configure.ts","../src/restore.ts","../src/status.ts","../src/wizard-tui.ts","../src/wizard.ts","../src/index.ts"],"sourcesContent":["import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n//#region src/input.ts\nfunction readAll(stream) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet data = \"\";\n\t\tstream.setEncoding(\"utf8\");\n\t\tstream.on(\"data\", (chunk) => {\n\t\t\tdata += chunk;\n\t\t});\n\t\tstream.on(\"end\", () => {\n\t\t\tresolve(data);\n\t\t});\n\t\tstream.on(\"error\", reject);\n\t});\n}\nfunction readStdin(stream = process.stdin) {\n\treturn readAll(stream);\n}\n/** A markdown file's contents, with the CLI's no-such-file error. */\nfunction readMarkdownFile(path) {\n\tif (!statSync(path, { throwIfNoEntry: false })?.isFile()) throw new Error(`no such file: ${path}`);\n\treturn readFileSync(path, \"utf8\");\n}\n//#endregion\n//#region src/hook.ts\n/**\n* Read the Claude Code hook event JSON from stdin; empty or unparseable input\n* yields an empty event, never a thrown error — a hook must always answer.\n*/\nfunction readHookEvent(stream = process.stdin) {\n\treturn readAll(stream).then((data) => {\n\t\ttry {\n\t\t\treturn JSON.parse(data);\n\t\t} catch {\n\t\t\treturn {};\n\t\t}\n\t}, () => ({}));\n}\n/**\n* Which transcript lastReply should read, per the hook event: transcript_path\n* when it names a real file, else session_id, else nothing (lastReply then\n* falls back to the newest session for the current project).\n*/\nfunction replyTarget(event) {\n\tif (event.transcript_path !== void 0 && isFile(event.transcript_path)) return event.transcript_path;\n\treturn event.session_id || void 0;\n}\nfunction isFile(path) {\n\ttry {\n\t\treturn statSync(path).isFile();\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Print the UserPromptExpansion decision for a zero-token command: `block`\n* keeps the command from reaching the model, with the output as the `reason`.\n*/\nfunction emitHookBlock(reason) {\n\tprocess.stdout.write(`${JSON.stringify({\n\t\tdecision: \"block\",\n\t\treason\n\t})}\\n`);\n}\n//#endregion\n//#region src/cli.ts\nfunction parseQuietly(program, args, recover) {\n\ttry {\n\t\tprogram.allowExcessArguments(false).exitOverride().configureOutput({\n\t\t\twriteOut: () => void 0,\n\t\t\twriteErr: () => void 0\n\t\t}).parse([...args], { from: \"user\" });\n\t\treturn program;\n\t} catch (err) {\n\t\treturn recover?.(err);\n\t}\n}\nfunction printUsageAndExit(program) {\n\tconsole.error(program.helpInformation());\n\tprocess.exit(1);\n}\nasync function hookOrPrint(hook, failure, run, stdin = process.stdin) {\n\tif (hook) {\n\t\tlet reason;\n\t\ttry {\n\t\t\treason = await run(await readHookEvent(stdin));\n\t\t} catch (e) {\n\t\t\treason = `${failure}: ${e.message}`;\n\t\t}\n\t\temitHookBlock(reason);\n\t\treturn;\n\t}\n\ttry {\n\t\tconsole.log(await run(void 0));\n\t} catch (e) {\n\t\tconsole.error(e.message);\n\t\tprocess.exit(1);\n\t}\n}\n//#endregion\n//#region src/dev.ts\nvar RELOAD_DEBOUNCE_MS = 150;\nvar IGNORED_SEGMENTS = [\n\t\"/node_modules/\",\n\t\"/dist/\",\n\t\"/.git/\",\n\t\"/coverage/\"\n];\nfunction shouldReload(file) {\n\treturn IGNORED_SEGMENTS.every((seg) => !file.includes(seg));\n}\n/**\n* Debounced file-change reloads, serialized via a promise chain: concurrent\n* saves never overlap, and a mid-reload save still produces a follow-up.\n*/\nfunction watchWithReload(vite, reload) {\n\tlet chain = Promise.resolve();\n\tlet timer;\n\tvite.watcher.on(\"change\", (file) => {\n\t\tif (!shouldReload(file)) return;\n\t\tif (timer) clearTimeout(timer);\n\t\ttimer = setTimeout(() => {\n\t\t\ttimer = void 0;\n\t\t\tchain = chain.then(reload);\n\t\t}, RELOAD_DEBOUNCE_MS);\n\t});\n}\n//#endregion\n//#region src/last-reply.ts\nfunction textBlocks(entry) {\n\tconst content = entry.message?.content;\n\tif (entry.type !== \"assistant\" || !Array.isArray(content)) return;\n\tconst blocks = content.filter((b) => typeof b === \"object\" && b !== null && b.type === \"text\");\n\treturn blocks.length > 0 ? blocks : void 0;\n}\nfunction claudeProjectsDir() {\n\tconst claudeDir = process.env.CLAUDE_DIR ?? join(homedir(), \".claude\");\n\treturn join(claudeDir, \"projects\");\n}\n/**\n* The last assistant text reply from a Claude Code session, reproducing Claude\n* Code's `/copy` byte-for-byte: the last assistant entry that contains a\n* `text` block, only its `text` block(s) (tool_use / thinking dropped), blocks\n* joined with a blank line, and no trailing newline.\n*\n* @param arg a transcript file, a session UUID under the project dir, or\n* nothing to use the newest session for the current project.\n*/\nfunction lastReply(arg) {\n\tconst proj = (process.env.CLAUDE_PROJECT_DIR ?? process.cwd()).replaceAll(\"/\", \"-\");\n\tconst projDir = join(claudeProjectsDir(), proj);\n\tlet file;\n\tif (arg !== void 0) file = isFile(arg) ? arg : join(projDir, `${arg}.jsonl`);\n\telse if (existsSync(projDir)) {\n\t\tconst newest = readdirSync(projDir).filter((f) => f.endsWith(\".jsonl\")).map((f) => ({\n\t\t\tf,\n\t\t\tmtimeMs: statSync(join(projDir, f)).mtimeMs\n\t\t})).sort((a, b) => b.mtimeMs - a.mtimeMs).at(0);\n\t\tif (newest) file = join(projDir, newest.f);\n\t}\n\tif (file === void 0 || !isFile(file)) throw new Error(`no session transcript found in ${projDir}`);\n\tlet last;\n\tfor (const line of readFileSync(file, \"utf8\").split(\"\\n\")) {\n\t\tif (!line.includes(\"\\\"assistant\\\"\")) continue;\n\t\tlet entry;\n\t\ttry {\n\t\t\tentry = JSON.parse(line);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tconst blocks = textBlocks(entry);\n\t\tif (blocks) last = blocks;\n\t}\n\treturn (last ?? []).map((b) => b.text ?? \"\").join(\"\\n\\n\");\n}\n//#endregion\n//#region src/logger.ts\nvar LEVEL_RANK = {\n\tdebug: 10,\n\tinfo: 20,\n\twarn: 30,\n\terror: 40,\n\tsilent: Number.MAX_SAFE_INTEGER\n};\nfunction levelEnabled(active, wanted) {\n\treturn LEVEL_RANK[wanted] >= LEVEL_RANK[active];\n}\nvar LEVEL_LABEL = {\n\tdebug: \"DEBUG\",\n\terror: \"ERROR\",\n\tinfo: \"INFO\",\n\twarn: \"WARN\"\n};\nvar Logger = class {\n\tactiveLevel;\n\tstderr;\n\tconstructor(activeLevel, stderr = (line) => process.stderr.write(`${line}\\n`)) {\n\t\tthis.activeLevel = activeLevel;\n\t\tthis.stderr = stderr;\n\t}\n\tdebug(message) {\n\t\tthis.log(\"debug\", message);\n\t}\n\terror(message) {\n\t\tthis.log(\"error\", message);\n\t}\n\tinfo(message) {\n\t\tthis.log(\"info\", message);\n\t}\n\twarn(message) {\n\t\tthis.log(\"warn\", message);\n\t}\n\tlog(level, message) {\n\t\tif (levelEnabled(this.activeLevel, level)) this.stderr(`${LEVEL_LABEL[level]} ${message}`);\n\t}\n};\n//#endregion\n//#region src/shutdown.ts\n/** Close each closable in order (best-effort), then force-exit. */\nfunction shutdownOnSignals(closables, signals = [\"SIGINT\", \"SIGTERM\"]) {\n\tconst shutdown = () => {\n\t\tclosables.reduce((acc, closable) => acc.then(async () => {\n\t\t\ttry {\n\t\t\t\tawait closable.close();\n\t\t\t} catch {}\n\t\t}), Promise.resolve()).finally(() => {\n\t\t\tprocess.exit(0);\n\t\t});\n\t};\n\tfor (const signal of signals) process.on(signal, shutdown);\n}\n//#endregion\n//#region src/text-format.ts\n/**\n* Plain-text rendering primitives shared by the zai and tokens report\n* renderers. Output targets a monospace terminal / hook-block `reason`, so\n* everything here is fixed-width: padding, block-glyph bars, and compact\n* number formatting.\n*/\nvar MONTHS = [\n\t\"Jan\",\n\t\"Feb\",\n\t\"Mar\",\n\t\"Apr\",\n\t\"May\",\n\t\"Jun\",\n\t\"Jul\",\n\t\"Aug\",\n\t\"Sep\",\n\t\"Oct\",\n\t\"Nov\",\n\t\"Dec\"\n];\nvar EIGHTHS = [\n\t\"\",\n\t\"▏\",\n\t\"▎\",\n\t\"▍\",\n\t\"▌\",\n\t\"▋\",\n\t\"▊\",\n\t\"▉\"\n];\nvar RULE_WIDTH = 68;\nfunction rule() {\n\treturn \"─\".repeat(68);\n}\nfunction pad2(n) {\n\treturn String(n).padStart(2, \"0\");\n}\n/** Local-time `YYYY-MM-DD` key. */\nfunction ymd(date) {\n\treturn `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;\n}\nfunction fmtTokens(n) {\n\tif (n == null || Number.isNaN(n)) return \"—\";\n\tif (n >= 1e9) return (n / 1e9).toFixed(1) + \"B\";\n\tif (n >= 1e6) return (n / 1e6).toFixed(1) + \"M\";\n\tif (n >= 1e3) return (n / 1e3).toFixed(1) + \"K\";\n\treturn String(n);\n}\nfunction fmtNum(n) {\n\treturn (n || 0).toLocaleString(\"en-US\");\n}\nfunction padR(s, n) {\n\treturn s.length >= n ? s : s + \" \".repeat(n - s.length);\n}\nfunction padL(s, n) {\n\treturn s.length >= n ? s : \" \".repeat(n - s.length) + s;\n}\n/** Fixed-width bar field (width cols): █ blocks + an eighth-fraction + trailing spaces. */\nfunction barField(v, max, width) {\n\tif (!v || v <= 0 || max <= 0) return \" \".repeat(width);\n\tconst scaled = v / max * width;\n\tlet full = Math.floor(scaled);\n\tlet fi = Math.round((scaled - full) * 8);\n\tif (fi === 8) {\n\t\tfull += 1;\n\t\tfi = 0;\n\t}\n\tif (full === 0 && fi === 0) fi = 1;\n\tlet s = \"█\".repeat(Math.min(full, width));\n\tif (full < width && fi > 0) s += EIGHTHS[fi];\n\tif (s.length < width) s += \" \".repeat(width - s.length);\n\treturn s.slice(0, width);\n}\n/** Filled/empty meter: █ for used, ░ for remaining. */\nfunction meter(pct, width) {\n\tlet filled = Math.round((pct || 0) / 100 * width);\n\tfilled = Math.max(0, Math.min(width, filled));\n\treturn \"█\".repeat(filled) + \"░\".repeat(width - filled);\n}\n//#endregion\nexport { Logger, MONTHS, RULE_WIDTH, barField, claudeProjectsDir, emitHookBlock, fmtNum, fmtTokens, hookOrPrint, isFile, lastReply, levelEnabled, meter, pad2, padL, padR, parseQuietly, printUsageAndExit, readAll, readHookEvent, readMarkdownFile, readStdin, replyTarget, rule, shutdownOnSignals, watchWithReload, ymd };\n\n//# sourceMappingURL=index.js.map","import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const DATA_REL = join(\n '.claude',\n 'plugins',\n 'data',\n 'statusline-agentic',\n);\n\nexport function capturePath(home: string, surface: 'main' | 'tick'): string {\n return join(home, DATA_REL, 'captures', `${surface}.json`);\n}\n\nexport function backupPath(home: string): string {\n return join(home, DATA_REL, 'backup.json');\n}\n\nexport interface RuntimeItem {\n readonly alternatives: readonly string[];\n readonly default: string;\n readonly item: string;\n}\n\nexport interface ResolvedRuntime {\n readonly defaultLayout: string;\n readonly dir: string;\n readonly items: readonly RuntimeItem[];\n}\n\nexport interface ScriptConfig {\n readonly layout: null | string;\n readonly values: Readonly<Record<string, string>>;\n}\n\n// The env assignments must immediately precede bash: a prefix on the d=\n// assignment dies with that statement.\nexport const KEY_RESOLVER =\n \"d=$(printf '%s\\\\n' ~/.claude/plugins/cache/agentic/statusline/*/ | sort -V | tail -1)\";\nconst MAIN_PREFIX = `${KEY_RESOLVER}; `;\nconst MAIN_SUFFIX = 'bash \"${d}runtime/statusline.sh\" 2>/dev/null || true';\n\nexport function mainKeyValue(\n layout: string,\n assignments: readonly string[],\n): string {\n const env = [`STATUSLINE_LAB_LAYOUT='${layout}'`, ...assignments].join(' ');\n return `${MAIN_PREFIX}${env} ${MAIN_SUFFIX}`;\n}\n\nexport const subagentKeyValue = `${KEY_RESOLVER}; bash \"\\${d}runtime/subagent.sh\" 2>/dev/null || true`;\n\nexport function isOurMainCommand(command: string): boolean {\n return command.startsWith(MAIN_PREFIX) && command.endsWith(` ${MAIN_SUFFIX}`);\n}\n\nfunction mainKeyMiddle(command: string): null | string {\n if (!isOurMainCommand(command)) {\n return null;\n }\n return command.slice(\n MAIN_PREFIX.length,\n command.length - MAIN_SUFFIX.length - 1,\n );\n}\n\nfunction settingsCommand(home: string): null | string {\n let raw: string;\n try {\n raw = readFileSync(join(home, '.claude', 'settings.json'), 'utf8');\n } catch {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n const member = (parsed as null | { statusLine?: unknown })?.statusLine;\n if (typeof member !== 'object' || member === null) {\n return null;\n }\n const command = (member as { command?: unknown }).command;\n return typeof command === 'string' ? command : null;\n}\n\nexport function readKeyConfig(home: string): ScriptConfig {\n const command = settingsCommand(home);\n const middle = command === null ? null : mainKeyMiddle(command);\n if (middle === null) {\n return { layout: null, values: {} };\n }\n const layout = /^STATUSLINE_LAB_LAYOUT='([^']*)'/.exec(middle);\n if (layout === null) {\n return { layout: null, values: {} };\n }\n const values: Record<string, string> = {};\n for (const [, name, alt] of middle.matchAll(\n /(?:^| )STATUSLINE_LAB_([A-Z][A-Z0-9_]*)=([a-z0-9]+)/g,\n )) {\n values[name.toLowerCase()] = alt;\n }\n return { layout: layout[1], values };\n}\n\nfunction byVersion(a: string, b: string): number {\n const left = a.split('.');\n const right = b.split('.');\n for (let i = 0; i < left.length || i < right.length; i += 1) {\n const delta =\n (parseInt(left[i] ?? '0', 10) || 0) -\n (parseInt(right[i] ?? '0', 10) || 0);\n if (delta !== 0) {\n return delta;\n }\n }\n return 0;\n}\n\nfunction newestCacheDir(cacheRoot: string): null | string {\n let versions: string[];\n try {\n versions = readdirSync(cacheRoot, { withFileTypes: true })\n .filter(entry => entry.isDirectory())\n .map(entry => entry.name);\n } catch {\n return null;\n }\n if (versions.length === 0) {\n return null;\n }\n versions.sort(byVersion);\n return join(cacheRoot, versions[versions.length - 1]);\n}\n\nfunction readAlternatives(dir: string): Map<string, readonly string[]> {\n const declared = new Map<string, readonly string[]>();\n const components = join(dir, 'components');\n for (const file of readdirSync(components).sort()) {\n if (!file.endsWith('.sh')) {\n continue;\n }\n for (const line of readFileSync(join(components, file), 'utf8').split(\n '\\n',\n )) {\n if (!line.startsWith('#')) {\n break;\n }\n const match = /alternatives:\\s*(.+)$/.exec(line);\n if (match) {\n declared.set(\n file.slice(0, -'.sh'.length),\n match[1]\n .split('|')\n .map(alt => alt.trim().replace(/\\s*\\(current\\)$/, '')),\n );\n }\n }\n }\n return declared;\n}\n\nfunction readItems(dir: string): readonly RuntimeItem[] {\n const alternatives = readAlternatives(dir);\n const defaults = new Map<string, string>();\n for (const [, item, alt] of readFileSync(\n join(dir, 'lib.sh'),\n 'utf8',\n ).matchAll(/([a-z]+)\\) echo ([a-z]+) ;;/g)) {\n defaults.set(item, alt);\n }\n const match = /^COMPS=\"(.+)\"$/m.exec(\n readFileSync(join(dir, 'statusline.sh'), 'utf8'),\n );\n if (match === null) {\n throw new Error(`statusline.sh in ${dir} declares no COMPS order`);\n }\n return match[1].split(' ').map(item => {\n const alt = defaults.get(item);\n if (alt === undefined) {\n throw new Error(`lib.sh in ${dir} declares no default for '${item}'`);\n }\n return {\n alternatives: alternatives.get(item) ?? [],\n default: alt,\n item,\n };\n });\n}\n\nfunction readDefaultLayout(dir: string): string {\n const match = /^export DEFAULT_LAYOUT='(.*)'$/m.exec(\n readFileSync(join(dir, 'lib.sh'), 'utf8'),\n );\n if (match === null) {\n throw new Error(`lib.sh in ${dir} declares no DEFAULT_LAYOUT`);\n }\n return match[1];\n}\n\nexport function resolveRuntime({ home }: { home: string }): ResolvedRuntime {\n const pluginDir = newestCacheDir(\n join(home, '.claude', 'plugins', 'cache', 'agentic', 'statusline'),\n );\n const dir = pluginDir === null ? null : join(pluginDir, 'runtime');\n if (dir === null || !existsSync(join(dir, 'statusline.sh'))) {\n throw new Error(\n `no statusline runtime under ${home} — install the plugin first: claude plugin install statusline@agentic`,\n );\n }\n return {\n defaultLayout: readDefaultLayout(dir),\n dir,\n items: readItems(dir),\n };\n}\n","import { readKeyConfig, resolveRuntime } from './resolve.js';\n\nexport interface CatalogOptions {\n readonly home: string;\n readonly items?: readonly string[];\n}\n\nexport function catalog(options: CatalogOptions): string {\n const runtime = resolveRuntime({ home: options.home });\n const live = readKeyConfig(options.home).values;\n const byItem = new Map(runtime.items.map(item => [item.item, item]));\n const wanted = options.items ?? runtime.items.map(item => item.item);\n return wanted\n .map(item => {\n const entry = byItem.get(item);\n if (entry === undefined) {\n throw new Error(\n `unknown item '${item}' — valid items: ${[...byItem.keys()].join(' ')}`,\n );\n }\n const current = live[item] ?? entry.default;\n return `${item}: ${entry.alternatives\n .map(alt => (alt === current ? `${alt}*` : alt))\n .join(' | ')}`;\n })\n .join('\\n');\n}\n","{\n \"name\": \"@v1nvn/statusline\",\n \"version\": \"0.27.0\",\n \"description\": \"Browse statusline variants and configure the live status line and agent panel — the statusline CLI behind the statusline plugin.\",\n \"type\": \"module\",\n \"bin\": \"dist/index.js\",\n \"scripts\": {\n \"build\": \"vite build\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\"\n },\n \"keywords\": [\n \"claude-code\",\n \"statusline\",\n \"cli\"\n ],\n \"author\": {\n \"name\": \"v1nvn\",\n \"email\": \"v1n@outlook.com\"\n },\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/v1nvn/agentic.git\",\n \"directory\": \"packages/statusline\"\n },\n \"files\": [\n \"dist\",\n \"assets\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"dependencies\": {\n \"@v1nvn/agentic-core\": \"workspace:^\",\n \"commander\": \"^15.0.0\"\n },\n \"devDependencies\": {\n \"vite\": \"^8.1.4\",\n \"vitest\": \"^4.1.10\"\n }\n}\n","import { parseQuietly } from '@v1nvn/agentic-core';\nimport { Command, Option } from 'commander';\n\nimport pkg from '../package.json' with { type: 'json' };\n\nexport const VERSION = pkg.version;\n\n// The flag surface mirrors statusline.sh's COMPS item registry; the catalog\n// and configure suites pin the two together.\nconst ITEM_IDS = [\n 'model',\n 'effort',\n 'state',\n 'cwd',\n 'branch',\n 'status',\n 'ahead',\n 'pr',\n 'bar',\n 'tokens',\n 'cache',\n 'cost',\n 'duration',\n 'lines',\n 'rate',\n 'style',\n] as const satisfies readonly string[];\n\nexport type Subcommand = 'catalog' | 'configure' | 'restore' | 'status';\n\nexport interface ParsedArgs {\n readonly command?: Subcommand;\n readonly dryRun?: boolean;\n readonly fallback?: 'default' | 'existing';\n readonly force?: boolean;\n readonly help?: Subcommand;\n readonly home?: string;\n readonly items?: readonly string[];\n readonly layout?: string;\n readonly variants?: Readonly<Record<string, string>>;\n readonly version: boolean;\n}\n\ntype SubcommandOptions = Record<string, unknown>;\n\nconst QUIET = { writeOut: () => undefined, writeErr: () => undefined };\n\nclass HelpRequested extends Error {\n constructor(readonly command: Subcommand) {\n super(`${command} --help`);\n }\n}\n\nfunction quiet(name: Subcommand, command: Command): Command {\n return command\n .exitOverride(err => {\n const code = (err as { code?: string }).code;\n if (code === 'commander.help' || code === 'commander.helpDisplayed') {\n throw new HelpRequested(name);\n }\n throw err;\n })\n .configureOutput(QUIET)\n .allowExcessArguments(false);\n}\n\nexport function buildProgram(\n onSubcommand?: (command: Subcommand, options: SubcommandOptions) => void,\n): Command {\n const catalog = quiet('catalog', new Command('catalog'))\n .description('print one line per item — * marks the live variant')\n .option('--home <dir>', 'operate on this home instead of $HOME');\n for (const item of ITEM_IDS) {\n catalog.option(`--${item}`, `cut the listing to the ${item} item`);\n }\n catalog.action((options: SubcommandOptions) =>\n onSubcommand?.('catalog', options),\n );\n\n const configure = quiet('configure', new Command('configure'))\n .description('write both settings keys with the inline lab commands')\n .option('--home <dir>', 'operate on this home instead of $HOME')\n .option(\n '--layout <spec>',\n \"brace clusters of item ids, e.g. '{cwd branch} {model effort}'\",\n )\n .addOption(\n new Option(\n '--fallback <mode>',\n 'fill unflagged layout items from defaults or the existing config',\n ).choices(['default', 'existing']),\n )\n .option('--dry-run', 'render both surfaces, write nothing')\n .option('--force', 'take over foreign settings keys');\n for (const item of ITEM_IDS) {\n configure.option(`--${item} <alt>`, `variant for the ${item} item`);\n }\n configure.action((options: SubcommandOptions) =>\n onSubcommand?.('configure', options),\n );\n\n const restore = quiet('restore', new Command('restore'))\n .description(\n 'revert both settings keys to their pre-lab values, clean the data dir',\n )\n .option('--home <dir>', 'operate on this home instead of $HOME')\n .option('--dry-run', 'print the plan, write nothing')\n .option(\n '--force',\n 'splice the saved value over a key changed after the takeover',\n );\n restore.action((options: SubcommandOptions) =>\n onSubcommand?.('restore', options),\n );\n\n const status = quiet('status', new Command('status'))\n .description(\n 'check install, keys, config, and backup — exit 0 healthy, 1 when a row needs action',\n )\n .option('--home <dir>', 'operate on this home instead of $HOME');\n status.action((options: SubcommandOptions) =>\n onSubcommand?.('status', options),\n );\n\n return new Command()\n .name('statusline')\n .description('Configure the status line and agent panel designs')\n .option('-V, --version', 'print the version and exit')\n .action(() => undefined)\n .addCommand(catalog)\n .addCommand(configure)\n .addCommand(restore)\n .addCommand(status);\n}\n\nexport function subcommandHelp(name: Subcommand): string {\n const command = buildProgram().commands.find(c => c.name() === name);\n if (command === undefined) {\n throw new Error(`no '${name}' command to describe`);\n }\n return command.helpInformation();\n}\n\nexport function parseArgs(args: readonly string[]): ParsedArgs | undefined {\n let chosen:\n | undefined\n | { readonly command: Subcommand; readonly options: SubcommandOptions };\n const program = buildProgram((command, options) => {\n chosen = { command, options };\n });\n const parsed = parseQuietly(program, args, err =>\n err instanceof HelpRequested ? { help: err.command } : undefined,\n );\n if (parsed === undefined) {\n return undefined;\n }\n if (!(parsed instanceof Command)) {\n return { version: false, help: parsed.help };\n }\n const { version } = program.opts<{ version: boolean | undefined }>();\n if (version) {\n return { version: true };\n }\n if (chosen === undefined) {\n return undefined;\n }\n const options = chosen.options;\n if (chosen.command === 'catalog') {\n const items = ITEM_IDS.filter(item => options[item] === true);\n return {\n version: false,\n command: 'catalog',\n ...(items.length > 0 ? { items } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n if (chosen.command === 'restore') {\n return {\n version: false,\n command: 'restore',\n ...(typeof options.dryRun === 'boolean'\n ? { dryRun: options.dryRun }\n : {}),\n ...(typeof options.force === 'boolean' ? { force: options.force } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n if (chosen.command === 'status') {\n return {\n version: false,\n command: 'status',\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n const variants: Record<string, string> = {};\n for (const item of ITEM_IDS) {\n if (typeof options[item] === 'string') {\n variants[item] = options[item];\n }\n }\n return {\n version: false,\n command: 'configure',\n ...(Object.keys(variants).length > 0 ? { variants } : {}),\n ...(typeof options.dryRun === 'boolean' ? { dryRun: options.dryRun } : {}),\n ...(typeof options.fallback === 'string'\n ? { fallback: options.fallback as 'default' | 'existing' }\n : {}),\n ...(typeof options.force === 'boolean' ? { force: options.force } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n ...(typeof options.layout === 'string' ? { layout: options.layout } : {}),\n };\n}\n","import { execFileSync } from 'node:child_process';\nimport { mkdirSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst NAME = 'Lab';\nconst EMAIL = 'lab@local';\nconst D_INIT = '2026-09-01T10:00:00+00:00';\nconst D_REMOTE = '2026-09-01T11:00:00+00:00';\nconst D_LOCAL1 = '2026-09-02T09:00:00+00:00';\nconst D_LOCAL2 = '2026-09-02T09:30:00+00:00';\nconst D_STASH = '2026-09-02T10:00:00+00:00';\n\nconst API_INIT = \"export const api = {\\n host: 'demo.local',\\n};\\n\";\n\nexport function materializeDemoRepo(home: string): string {\n const dir = join(home, 'demo', 'atlas-web');\n for (const sub of ['src', 'docs', 'scratch', 'scripts']) {\n mkdirSync(join(dir, sub), { recursive: true });\n }\n function git(args: string[], date?: string): string {\n return execFileSync('git', ['-c', 'commit.gpgsign=false', ...args], {\n cwd: dir,\n encoding: 'utf8',\n // execFileSync inherits stderr by default; git checkout chatter must\n // not print over a wizard frame.\n stdio: ['ignore', 'pipe', 'pipe'],\n env: {\n PATH: process.env.PATH ?? '',\n HOME: home,\n LC_ALL: 'C',\n TZ: 'UTC',\n GIT_AUTHOR_NAME: NAME,\n GIT_AUTHOR_EMAIL: EMAIL,\n GIT_COMMITTER_NAME: NAME,\n GIT_COMMITTER_EMAIL: EMAIL,\n ...(date ? { GIT_AUTHOR_DATE: date, GIT_COMMITTER_DATE: date } : {}),\n },\n });\n }\n function write(rel: string, body: string): void {\n writeFileSync(join(dir, rel), body);\n }\n function commit(message: string, date: string): void {\n git(['add', '-A']);\n git(['commit', '-m', message], date);\n }\n\n git(['init', '-b', 'main']);\n git(['config', 'user.name', NAME]);\n git(['config', 'user.email', EMAIL]);\n write('README.md', 'atlas-web demo repo\\n');\n write('src/index.js', 'export function start() {}\\n');\n write('src/api.js', API_INIT);\n write('src/style.css', 'body { margin: 0; }\\n');\n write('src/util.js', 'export const id = (x) => x;\\n');\n commit('init', D_INIT);\n\n write('src/api.js', `${API_INIT}// remote: pinned host\\n`);\n commit('remote1', D_REMOTE);\n const originMain = git(['rev-parse', 'HEAD']).trim();\n\n git(['checkout', '-b', 'feature/login-flow', 'HEAD~1']);\n write(\n 'src/util.js',\n 'export const id = (x) => x;\\nexport const tag = (x) => x;\\n',\n );\n commit('local1', D_LOCAL1);\n write('src/render.js', 'export function render() {}\\n');\n commit('local2', D_LOCAL2);\n git(['update-ref', 'refs/remotes/origin/main', originMain]);\n git(['config', 'remote.origin.url', '../atlas-web.git']);\n git(['config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*']);\n git(['config', 'branch.feature/login-flow.remote', 'origin']);\n git(['config', 'branch.feature/login-flow.merge', 'refs/heads/main']);\n\n write('README.md', 'atlas-web demo repo (wip)\\n');\n git(\n ['stash', 'push', '-m', 'wip: context refactor', '--', 'README.md'],\n D_STASH,\n );\n\n write('README.md', 'atlas-web demo repo\\n\\nstaged: pin the render loop\\n');\n write(\n 'src/index.js',\n 'export function start() {\\n return Promise.resolve();\\n}\\n',\n );\n git(['add', 'README.md', 'src/index.js']);\n write('src/api.js', `${API_INIT}// local tweak\\n`);\n write('src/style.css', 'body { margin: 0; padding: 0; }\\n');\n write('docs/wip.txt', '');\n write('scratch/todo.md', '');\n write('scripts/deploy.sh', '');\n write('note1.md', '');\n write('note2.md', '');\n return dir;\n}\n","import { spawnSync } from 'node:child_process';\nimport { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { isObject } from './configure.js';\nimport { materializeDemoRepo } from './demo-repo.js';\nimport { capturePath } from './resolve.js';\n\nconst PAYLOADS_DIR = fileURLToPath(\n new URL('../assets/payloads', import.meta.url),\n);\nconst TICKS_DIR = fileURLToPath(new URL('../assets/ticks', import.meta.url));\n\nconst P1_WARM_IN = 1920;\nconst P1_RESETS_IN: Readonly<Record<string, number>> = {\n five_hour: 13830,\n seven_day: 518400,\n spend_limit: 950400,\n};\nconst PANEL_STEP_S = 300;\n\nexport interface RenderSpec {\n readonly bin: string;\n readonly env: Readonly<Record<string, string>>;\n readonly stdin: string;\n}\n\nexport interface PreviewSources {\n readonly cleanup: () => void;\n readonly main: string;\n readonly tick: string;\n}\n\ntype Loose = Record<string, unknown>;\n\nfunction anchoredP1(repoDir: string, now: number): string {\n const payload = JSON.parse(\n readFileSync(join(PAYLOADS_DIR, 'p1.json'), 'utf8'),\n ) as Loose;\n const cache = payload.prompt_cache;\n if (isObject(cache)) {\n if (cache.warm === true) {\n cache.expires_at = now + P1_WARM_IN;\n cache.last_miss_at = now + P1_WARM_IN - 3900;\n } else {\n cache.expires_at = now - 10;\n delete cache.last_miss_at;\n }\n }\n const limits = payload.rate_limits;\n if (isObject(limits)) {\n for (const [limitKey, offset] of Object.entries(P1_RESETS_IN)) {\n const limit = limits[limitKey];\n if (isObject(limit)) {\n limit.resets_at = now + offset;\n }\n }\n }\n (payload.workspace as { current_dir: string }).current_dir = repoDir;\n return `${JSON.stringify(payload, null, 2)}\\n`;\n}\n\nfunction hasStart(value: unknown): boolean {\n return typeof value === 'number' && Number.isFinite(value) && value > 0;\n}\n\n// subagent.sh drops a row's duration unless its start is at or before NOW\n// (the elapsed >= 0 guard), so the demo schedule staggers every started row\n// strictly into the past — ids and order ride over untouched.\nfunction anchoredTick(now: number): string {\n const tick = JSON.parse(\n readFileSync(join(TICKS_DIR, 'multi.json'), 'utf8'),\n ) as Loose;\n const tasks = (Array.isArray(tick.tasks) ? tick.tasks : []) as Loose[];\n let started = 0;\n const staggered = {\n ...tick,\n tasks: tasks.map(task => {\n if (!hasStart(task.startTime)) {\n return task;\n }\n started += 1;\n return { ...task, startTime: now - PANEL_STEP_S * started };\n }),\n };\n return `${JSON.stringify(staggered, null, 2)}\\n`;\n}\n\n// A capture renders verbatim; a shipped fixture is anchored to the render\n// moment and pointed at a freshly materialized demo repo so the git segments\n// preview. The repo is torn down with the preview's last render.\nexport function previewSources(home: string, now: number): PreviewSources {\n const mainCapture = capturePath(home, 'main');\n if (existsSync(mainCapture)) {\n const tickCapture = capturePath(home, 'tick');\n return {\n cleanup: () => undefined,\n main: readFileSync(mainCapture, 'utf8'),\n tick: existsSync(tickCapture)\n ? readFileSync(tickCapture, 'utf8')\n : anchoredTick(now),\n };\n }\n const demoHome = mkdtempSync(join(tmpdir(), 'statusline-preview-'));\n return {\n cleanup: () => {\n rmSync(demoHome, { recursive: true, force: true });\n },\n main: anchoredP1(materializeDemoRepo(demoHome), now),\n tick: anchoredTick(now),\n };\n}\n\n// subagent.sh answers with one {\"id\",\"content\"} JSON line per task; a frame\n// carries the first row's content.\nexport function firstPanelRow(output: string): string {\n const [row] = output.split('\\n');\n if (row === '') {\n return '';\n }\n const content = (JSON.parse(row) as { content?: unknown }).content;\n return typeof content === 'string' ? content : '';\n}\n\nexport function runtimeRenderer(spec: RenderSpec): string {\n const run = spawnSync('bash', [spec.bin], {\n input: spec.stdin,\n env: {\n PATH: process.env.PATH ?? '',\n ...spec.env,\n LC_ALL: 'C',\n TZ: 'UTC',\n },\n timeout: 30_000,\n });\n if (run.status !== 0) {\n throw new Error(`render failed: ${run.stderr.toString('utf8')}`);\n }\n const stdout = run.stdout.toString('utf8');\n const warn = run.stderr.toString('utf8').trim();\n return warn === '' ? stdout : `${stdout}${warn}\\n`;\n}\n","import {\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport { firstPanelRow, previewSources, runtimeRenderer } from './payloads.js';\nimport {\n backupPath,\n isOurMainCommand,\n mainKeyValue,\n readKeyConfig,\n type ResolvedRuntime,\n resolveRuntime,\n subagentKeyValue,\n} from './resolve.js';\n\nexport interface ConfigureOptions {\n readonly dryRun?: boolean;\n readonly fallback?: 'default' | 'existing';\n readonly force?: boolean;\n readonly home: string;\n readonly layout?: string;\n readonly variants?: Readonly<Record<string, string>>;\n}\n\nexport type ConfigureResult =\n | { mode: 'dry-run'; text: string }\n | { mode: 'printed'; text: string }\n | { mode: 'written' };\n\nexport type SettingsKey = 'statusLine' | 'subagentStatusLine';\n\nexport const SETTINGS_KEYS = ['statusLine', 'subagentStatusLine'] as const;\n\nexport function layoutItems(\n layout: string,\n valid: readonly string[],\n): string[] {\n const known = new Set(valid);\n const items: string[] = [];\n for (const cluster of parseClusters(layout)) {\n for (const word of cluster) {\n if (!known.has(word)) {\n throw new Error(\n `unknown layout item '${word}' — valid items: ${valid.join(' ')}`,\n );\n }\n if (!items.includes(word)) {\n items.push(word);\n }\n }\n }\n return items;\n}\n\nexport function parseClusters(layout: string): string[][] {\n const clusters: string[][] = [];\n let words: string[] = [];\n let word = '';\n let open = false;\n function pushWord(): void {\n if (word !== '') {\n words.push(word);\n word = '';\n }\n }\n for (const c of layout) {\n if (c === '{') {\n if (open) {\n throw new Error(`layout '${layout}': '{' inside a cluster`);\n }\n open = true;\n words = [];\n } else if (c === '}') {\n if (!open) {\n throw new Error(`layout '${layout}': '}' outside a cluster`);\n }\n pushWord();\n open = false;\n if (words.length > 0) {\n clusters.push(words);\n }\n } else if (c === ' ') {\n if (open) {\n pushWord();\n } else if (word !== '') {\n throw new Error(`layout '${layout}': '${word}' sits outside a cluster`);\n }\n } else if (/[a-z0-9]/.test(c)) {\n word += c;\n } else {\n throw new Error(\n `layout '${layout}': '${c}' is not layout grammar (braces, item ids, spaces)`,\n );\n }\n }\n if (open) {\n throw new Error(`layout '${layout}': unterminated cluster`);\n }\n if (word !== '') {\n throw new Error(`layout '${layout}': '${word}' sits outside a cluster`);\n }\n if (clusters.length === 0) {\n throw new Error(`layout '${layout}': no clusters`);\n }\n return clusters;\n}\n\nexport function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function readOrNull(file: string): null | string {\n try {\n return readFileSync(file, 'utf8');\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code === 'ENOENT') {\n return null;\n }\n throw e;\n }\n}\n\nexport function parseSettings(\n file: string,\n raw: string,\n): Record<string, unknown> {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n throw new Error(`${file} is not valid JSON`, { cause: e });\n }\n if (!isObject(parsed)) {\n throw new Error(`${file} does not hold a settings object`);\n }\n return parsed;\n}\n\nexport function memberCommand(value: unknown): null | string {\n if (!isObject(value) || value.type !== 'command') {\n return null;\n }\n return typeof value.command === 'string' ? value.command : null;\n}\n\nexport function isOurMember(key: SettingsKey, value: unknown): boolean {\n const command = memberCommand(value);\n if (command === null) {\n return false;\n }\n return key === 'statusLine'\n ? isOurMainCommand(command)\n : command === subagentKeyValue;\n}\n\ninterface SettingsPlan {\n readonly adds: readonly (readonly [SettingsKey, string])[];\n readonly file: string;\n readonly raw: null | string;\n readonly repoints: readonly (readonly [SettingsKey, string])[];\n}\n\nfunction planSettings(\n home: string,\n mainCommand: string,\n force: boolean,\n): SettingsPlan {\n const file = join(home, '.claude', 'settings.json');\n const wanted: Readonly<Record<SettingsKey, string>> = {\n statusLine: mainCommand,\n subagentStatusLine: subagentKeyValue,\n };\n const raw = readOrNull(file);\n if (raw === null) {\n return {\n adds: SETTINGS_KEYS.map(key => [key, wanted[key]] as const),\n file,\n raw: null,\n repoints: [],\n };\n }\n const parsed = parseSettings(file, raw);\n const adds: (readonly [SettingsKey, string])[] = [];\n const repoints: (readonly [SettingsKey, string])[] = [];\n for (const key of SETTINGS_KEYS) {\n const command = wanted[key];\n const value = parsed[key];\n if (value === undefined) {\n adds.push([key, command]);\n } else if (memberCommand(value) === command) {\n continue;\n } else if (isOurMember(key, value) || force) {\n repoints.push([key, command]);\n } else {\n throw new Error(\n `settings.json ${key} is foreign — rerun with --force added to your configuration flags to take it over`,\n );\n }\n }\n return { adds, file, raw, repoints };\n}\n\nexport function settingsValue(command: string): string {\n return JSON.stringify({ command, type: 'command' });\n}\n\nfunction skipString(raw: string, at: number): number {\n let i = at + 1;\n while (i < raw.length) {\n if (raw[i] === '\\\\') {\n i += 2;\n } else if (raw[i] === '\"') {\n return i + 1;\n } else {\n i += 1;\n }\n }\n throw new Error('unterminated string in settings.json');\n}\n\nfunction skipValue(raw: string, at: number): number {\n const first = raw[at];\n if (first === '\"') {\n return skipString(raw, at);\n }\n if (first === '{' || first === '[') {\n let depth = 0;\n let i = at;\n while (i < raw.length) {\n const c = raw[i];\n if (c === '\"') {\n i = skipString(raw, i);\n } else if (c === '{' || c === '[') {\n depth += 1;\n i += 1;\n } else if (c === '}' || c === ']') {\n depth -= 1;\n i += 1;\n if (depth === 0) {\n return i;\n }\n } else {\n i += 1;\n }\n }\n throw new Error('unterminated container in settings.json');\n }\n let i = at;\n while (\n i < raw.length &&\n !',}]'.includes(raw[i] ?? '') &&\n !/\\s/.test(raw[i] ?? '~')\n ) {\n i += 1;\n }\n return i;\n}\n\ninterface RootMember {\n readonly name: string;\n readonly nameStart: number;\n readonly valueEnd: number;\n readonly valueStart: number;\n}\n\nfunction rootMembers(raw: string): readonly RootMember[] {\n const members: RootMember[] = [];\n let i = raw.indexOf('{') + 1;\n while (i < raw.length) {\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] === '}') {\n break;\n }\n if (raw[i] !== '\"') {\n throw new Error('malformed member in settings.json');\n }\n const nameStart = i;\n const nameEnd = skipString(raw, i);\n const name = JSON.parse(raw.slice(i, nameEnd)) as string;\n i = nameEnd;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] !== ':') {\n throw new Error('malformed member in settings.json');\n }\n i += 1;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n const valueStart = i;\n const valueEnd = skipValue(raw, i);\n members.push({ name, nameStart, valueEnd, valueStart });\n i = valueEnd;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] === ',') {\n i += 1;\n } else if (raw[i] !== '}') {\n throw new Error('malformed member in settings.json');\n }\n }\n return members;\n}\n\nexport function rootMemberValueSpan(\n raw: string,\n key: string,\n): null | readonly [number, number] {\n const member = rootMembers(raw).find(m => m.name === key);\n return member === undefined ? null : [member.valueStart, member.valueEnd];\n}\n\nexport function removeMembers(raw: string, keys: readonly string[]): string {\n let text = raw;\n for (const key of keys) {\n const members = rootMembers(text);\n const at = members.findIndex(m => m.name === key);\n if (at === -1) {\n throw new Error(\n `cannot find the \"${key}\" member to remove in settings.json`,\n );\n }\n if (members.length === 1) {\n return '{}';\n }\n const member = members[at];\n if (at > 0) {\n let start = member.nameStart;\n while (/\\s/.test(text[start - 1] ?? '~')) {\n start -= 1;\n }\n text = `${text.slice(0, start - 1)}${text.slice(member.valueEnd)}`;\n } else {\n text = `${text.slice(0, member.nameStart)}${text.slice(members[1].nameStart)}`;\n }\n }\n return text;\n}\n\nexport function insertMembers(\n raw: string,\n members: readonly (readonly [SettingsKey, string])[],\n): string {\n const close = raw.lastIndexOf('}');\n if (close === -1) {\n throw new Error('settings.json has no closing brace to splice into');\n }\n let at = close;\n while (/\\s/.test(raw[at - 1] ?? '~')) {\n at -= 1;\n }\n const comma = raw.replace(/\\s/g, '') === '{}' ? '' : ',';\n return `${raw.slice(0, at)}${comma}\\n ${renderMembers(members)}${raw.slice(at)}`;\n}\n\nfunction renderMembers(\n members: readonly (readonly [string, string])[],\n): string {\n return members\n .map(([key, command]) => `\"${key}\": ${settingsValue(command)}`)\n .join(',\\n ');\n}\n\n/** Splice each rendered value over its root member. */\nexport function repointRootMembers(\n raw: string,\n entries: readonly { key: string; value: string }[],\n): string {\n let text = raw;\n for (const { key, value } of entries) {\n const span = rootMemberValueSpan(text, key);\n if (span === null) {\n throw new Error(`cannot find the \"${key}\" member in settings.json`);\n }\n text = `${text.slice(0, span[0])}${value}${text.slice(span[1])}`;\n }\n return text;\n}\n\nfunction splicedSettings(raw: string, plan: SettingsPlan): string {\n const text = plan.adds.length > 0 ? insertMembers(raw, plan.adds) : raw;\n return repointRootMembers(\n text,\n plan.repoints.map(([key, command]) => ({\n key,\n value: settingsValue(command),\n })),\n );\n}\n\nexport interface SettingsBackup {\n readonly createdFile: boolean;\n readonly keys: Readonly<Partial<Record<SettingsKey, string>>>;\n}\n\nfunction writeBackupIfAbsent(home: string, plan: SettingsPlan): void {\n const file = backupPath(home);\n if (existsSync(file)) {\n return;\n }\n const keys: Partial<Record<SettingsKey, string>> = {};\n if (plan.raw !== null) {\n for (const key of SETTINGS_KEYS) {\n const span = rootMemberValueSpan(plan.raw, key);\n if (span === null) {\n continue;\n }\n const memberRaw = plan.raw.slice(span[0], span[1]);\n if (isOurMember(key, JSON.parse(memberRaw))) {\n continue;\n }\n keys[key] = memberRaw;\n }\n }\n const dir = dirname(file);\n mkdirSync(dir, { recursive: true });\n const tmp = `${file}.tmp`;\n writeFileSync(\n tmp,\n `${JSON.stringify({ createdFile: plan.raw === null, keys }, null, 2)}\\n`,\n );\n renameSync(tmp, file);\n}\n\nfunction commitSettings(plan: SettingsPlan): void {\n if (plan.raw === null) {\n mkdirSync(dirname(plan.file), { recursive: true });\n const members = plan.adds\n .map(([key, command]) => `\"${key}\": ${settingsValue(command)}`)\n .join(',\\n ');\n writeFileSync(plan.file, `{\\n ${members}\\n}\\n`);\n return;\n }\n if (plan.adds.length === 0 && plan.repoints.length === 0) {\n return;\n }\n writeFileSync(plan.file, splicedSettings(plan.raw, plan));\n}\n\nfunction renderPreview(\n runtime: ResolvedRuntime,\n home: string,\n values: Readonly<Record<string, string>>,\n layout: string,\n now: string,\n): string {\n const sources = previewSources(home, Number(now));\n try {\n const variantEnv = Object.fromEntries(\n Object.entries(values).map(([item, alt]) => [\n `STATUSLINE_LAB_${item.toUpperCase()}`,\n alt,\n ]),\n );\n const line = runtimeRenderer({\n bin: join(runtime.dir, 'statusline.sh'),\n env: {\n COLUMNS: '200',\n HOME: home,\n NOW: now,\n STATUSLINE_LAB_LAYOUT: layout,\n ...variantEnv,\n },\n stdin: sources.main,\n }).replace(/\\n+$/, '');\n const panel = firstPanelRow(\n runtimeRenderer({\n bin: join(runtime.dir, 'subagent.sh'),\n env: { COLUMNS: '200', HOME: home, NOW: now },\n stdin: sources.tick,\n }).replace(/\\n+$/, ''),\n );\n return `dry-run at 200 columns — nothing written\\n${line}\\npanel ${panel}\\n`;\n } finally {\n sources.cleanup();\n }\n}\n\nfunction printedConfig(runtime: ResolvedRuntime, home: string): string {\n const existing = readKeyConfig(home);\n const lines = [\n `layout='${existing.layout ?? runtime.defaultLayout}'`,\n ...runtime.items.map(\n item =>\n `${item.item}=${existingValue(existing.values, item.item) ?? item.default}`,\n ),\n ];\n return [\n ...lines,\n 'nothing written — pass variants (`statusline configure --model block`) or run bare on a TTY for the wizard',\n ].join('\\n');\n}\n\nfunction existingValue(\n values: Readonly<Record<string, string>>,\n item: string,\n): string | undefined {\n return item in values ? values[item] : undefined;\n}\n\nexport function configure(options: ConfigureOptions): ConfigureResult {\n const runtime = resolveRuntime({ home: options.home });\n const existing = readKeyConfig(options.home);\n const variants = options.variants ?? {};\n const explicit =\n options.layout !== undefined || Object.keys(variants).length > 0;\n\n if (!explicit && options.fallback === undefined && !options.dryRun) {\n return { mode: 'printed', text: printedConfig(runtime, options.home) };\n }\n\n const layout =\n options.layout === undefined || options.layout === ''\n ? (existing.layout ?? runtime.defaultLayout)\n : options.layout;\n const byItem = new Map(runtime.items.map(item => [item.item, item]));\n const items = layoutItems(\n layout,\n runtime.items.map(item => item.item),\n );\n\n for (const item of Object.keys(variants)) {\n if (!byItem.has(item)) {\n throw new Error(\n `unknown item '${item}' — valid items: ${[...byItem.keys()].join(' ')}`,\n );\n }\n if (!items.includes(item)) {\n throw new Error(\n `variant for '${item}' is not in the layout (layout items: ${items.join(' ')})`,\n );\n }\n }\n\n const values: Record<string, string> = {};\n for (const item of items) {\n let base: string | undefined;\n if (options.fallback === 'default') {\n base = byItem.get(item)?.default;\n } else if (options.fallback === 'existing') {\n base = existingValue(existing.values, item);\n } else if (!explicit) {\n base = existingValue(existing.values, item) ?? byItem.get(item)?.default;\n }\n if (base !== undefined) {\n values[item] = base;\n }\n }\n const missing = items.filter(\n item => !(item in values) && !(item in variants),\n );\n if (missing.length > 0) {\n throw new Error(\n `no variant for layout item${missing.length > 1 ? 's' : ''} ${missing.join(' ')} — pass --<item> <alt> for each or use --fallback=default|existing`,\n );\n }\n for (const [item, alt] of Object.entries(variants)) {\n values[item] = alt;\n }\n for (const item of items) {\n const alt = values[item];\n const offered = byItem.get(item)?.alternatives ?? [];\n if (!offered.includes(alt)) {\n throw new Error(\n `unknown variant '${alt}' for item '${item}' — valid: ${offered.join(' | ')}`,\n );\n }\n }\n\n if (options.dryRun) {\n const now = String(Math.floor(Date.now() / 1000));\n return {\n mode: 'dry-run',\n text: renderPreview(runtime, options.home, values, layout, now),\n };\n }\n\n const assignments = items.map(\n item => `STATUSLINE_LAB_${item.toUpperCase()}=${values[item]}`,\n );\n const plan = planSettings(\n options.home,\n mainKeyValue(layout, assignments),\n options.force ?? false,\n );\n if (plan.adds.length > 0 || plan.repoints.length > 0) {\n writeBackupIfAbsent(options.home, plan);\n }\n commitSettings(plan);\n return { mode: 'written' };\n}\n","import {\n existsSync,\n readdirSync,\n rmdirSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { join } from 'node:path';\n\nimport {\n isObject,\n isOurMember,\n readOrNull,\n removeMembers,\n repointRootMembers,\n rootMemberValueSpan,\n SETTINGS_KEYS,\n type SettingsBackup,\n type SettingsKey,\n} from './configure.js';\nimport { backupPath, DATA_REL } from './resolve.js';\n\nexport interface RestoreOptions {\n readonly dryRun?: boolean;\n readonly force?: boolean;\n readonly home: string;\n}\n\nexport type RestoreResult =\n | { mode: 'dry-run'; text: string }\n | { mode: 'nothing'; text: string }\n | { mode: 'restored'; text: string };\n\ntype KeyAction =\n | { readonly key: SettingsKey; readonly kind: 'remove' }\n | {\n readonly key: SettingsKey;\n readonly kind: 'splice';\n readonly text: string;\n };\n\nexport function readBackup(home: string): null | SettingsBackup {\n const file = backupPath(home);\n const raw = readOrNull(file);\n if (raw === null) {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n throw new Error(`${file} is not valid JSON`, { cause: e });\n }\n if (\n !isObject(parsed) ||\n typeof parsed.createdFile !== 'boolean' ||\n !isObject(parsed.keys)\n ) {\n throw new Error(`${file} is not a lab backup`);\n }\n const keys: Partial<Record<SettingsKey, string>> = {};\n for (const key of SETTINGS_KEYS) {\n const saved = parsed.keys[key];\n if (typeof saved === 'string') {\n keys[key] = saved;\n }\n }\n return { createdFile: parsed.createdFile, keys };\n}\n\nfunction rmdirIfEmpty(dir: string): void {\n try {\n rmdirSync(dir);\n } catch (e) {\n const code = (e as NodeJS.ErrnoException).code;\n if (code !== 'ENOTEMPTY' && code !== 'ENOENT' && code !== 'ENOTDIR') {\n throw e;\n }\n }\n}\n\nfunction clearCaptures(dir: string): void {\n if (!existsSync(dir)) {\n return;\n }\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (entry.isFile()) {\n rmSync(join(dir, entry.name), { force: true });\n }\n }\n rmdirIfEmpty(dir);\n}\n\nfunction planActions(\n raw: string,\n backup: null | SettingsBackup,\n force: boolean,\n): readonly KeyAction[] {\n const actions: KeyAction[] = [];\n for (const key of SETTINGS_KEYS) {\n const span = rootMemberValueSpan(raw, key);\n if (span === null) {\n continue;\n }\n const memberRaw = raw.slice(span[0], span[1]);\n const saved = backup === null ? undefined : backup.keys[key];\n if (isOurMember(key, JSON.parse(memberRaw))) {\n actions.push(\n saved === undefined\n ? { kind: 'remove', key }\n : { kind: 'splice', key, text: saved },\n );\n } else if (saved !== undefined && memberRaw !== saved) {\n if (!force) {\n throw new Error(\n `settings.json ${key} changed since the lab took it over — rerun with --force to put the saved value back`,\n );\n }\n actions.push({ kind: 'splice', key, text: saved });\n }\n }\n return actions;\n}\n\nexport function restore(options: RestoreOptions): RestoreResult {\n const settings = join(options.home, '.claude', 'settings.json');\n const backup = readBackup(options.home);\n const raw = readOrNull(settings);\n\n const actions =\n raw === null ? [] : planActions(raw, backup, options.force ?? false);\n const removals: SettingsKey[] = [];\n const splices: { key: SettingsKey; text: string }[] = [];\n for (const action of actions) {\n if (action.kind === 'remove') {\n removals.push(action.key);\n } else {\n splices.push(action);\n }\n }\n\n let next: null | string = raw;\n let deleteFile = false;\n if (actions.length > 0 && raw !== null) {\n const stripped = removals.length > 0 ? removeMembers(raw, removals) : raw;\n const text = repointRootMembers(\n stripped,\n splices.map(({ key, text: value }) => ({ key, value })),\n );\n const membersLeft = Object.keys(JSON.parse(text) as object).length;\n if (backup !== null && backup.createdFile && membersLeft === 0) {\n deleteFile = true;\n next = null;\n } else {\n next = text;\n }\n }\n\n const dataDir = join(options.home, DATA_REL);\n const capturesDir = join(dataDir, 'captures');\n const backupFile = backupPath(options.home);\n if (\n actions.length === 0 &&\n !existsSync(backupFile) &&\n !existsSync(capturesDir)\n ) {\n return {\n mode: 'nothing',\n text: 'nothing to restore — no lab keys in settings.json, no backup, no captures',\n };\n }\n\n if (options.dryRun) {\n const lines = ['restore plan — nothing written'];\n for (const action of actions) {\n lines.push(\n action.kind === 'remove'\n ? ` remove ${action.key} (absent before the lab)`\n : ` splice the saved ${action.key} value back`,\n );\n }\n if (deleteFile) {\n lines.push(\n ' delete settings.json (the lab created it and it is now empty)',\n );\n }\n if (existsSync(capturesDir)) {\n lines.push(' delete captures/');\n }\n if (existsSync(backupFile)) {\n lines.push(' delete backup.json');\n }\n lines.push(' remove the data dir if empty');\n return { mode: 'dry-run', text: lines.join('\\n') };\n }\n\n if (deleteFile) {\n rmSync(settings, { force: true });\n } else if (next !== null && actions.length > 0) {\n writeFileSync(settings, next);\n }\n clearCaptures(capturesDir);\n rmSync(backupFile, { force: true });\n rmdirIfEmpty(dataDir);\n let line: string;\n if (deleteFile) {\n line = 'restored — settings.json is gone, exactly as before the lab';\n } else if (actions.length > 0) {\n line = 'keys restored — settings.json holds its pre-lab values again';\n } else {\n line = 'lab data cleaned — no lab keys in settings.json';\n }\n return { mode: 'restored', text: line };\n}\n","import { statSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\n\nimport {\n isOurMember,\n memberCommand,\n parseClusters,\n parseSettings,\n readOrNull,\n SETTINGS_KEYS,\n type SettingsBackup,\n type SettingsKey,\n} from './configure.js';\nimport {\n capturePath,\n DATA_REL,\n readKeyConfig,\n type ResolvedRuntime,\n resolveRuntime,\n type ScriptConfig,\n} from './resolve.js';\nimport { readBackup } from './restore.js';\n\nexport interface StatusOptions {\n readonly home: string;\n}\n\nexport interface StatusResult {\n readonly healthy: boolean;\n readonly rows: readonly string[];\n}\n\nconst INSTALL_FIX = 'claude plugin install statusline@agentic';\n\ntype KeyState =\n | { readonly command: null | string; readonly kind: 'foreign' }\n | { readonly kind: 'absent' }\n | { readonly kind: 'ours' };\n\nfunction keyState(key: SettingsKey, value: unknown): KeyState {\n if (value === undefined) {\n return { kind: 'absent' };\n }\n if (isOurMember(key, value)) {\n return { kind: 'ours' };\n }\n return { kind: 'foreign', command: memberCommand(value) };\n}\n\nfunction keyRow(key: SettingsKey, state: KeyState, detail = ''): string {\n if (state.kind === 'ours') {\n return `${key}: ours${detail === '' ? '' : ` — ${detail}`}`;\n }\n if (state.kind === 'absent') {\n return `${key}: absent — fix: rerun configure --fallback=default`;\n }\n return `${key}: foreign${state.command === null ? '' : ` (${state.command})`} — fix: rerun configure --force --fallback=default`;\n}\n\nfunction layoutItemsOf(layout: string): readonly string[] {\n const items: string[] = [];\n for (const cluster of parseClusters(layout)) {\n for (const item of cluster) {\n if (!items.includes(item)) {\n items.push(item);\n }\n }\n }\n return items;\n}\n\nfunction configDetail(config: ScriptConfig): string {\n if (config.layout === null) {\n return '';\n }\n const assignments = layoutItemsOf(config.layout)\n .filter(item => Object.hasOwn(config.values, item))\n .map(item => `${item}=${config.values[item]}`);\n return [`layout='${config.layout}'`, ...assignments].join(' ');\n}\n\ntype DriftFinding =\n | {\n readonly alt: string;\n readonly item: string;\n readonly kind: 'unknown-variant';\n }\n | { readonly item: string; readonly kind: 'unknown-item' };\n\nfunction findingText(finding: DriftFinding): string {\n return finding.kind === 'unknown-item'\n ? `unknown item '${finding.item}'`\n : `unknown variant '${finding.alt}' for '${finding.item}'`;\n}\n\nfunction driftFindings(\n config: ScriptConfig,\n runtime: ResolvedRuntime,\n): readonly DriftFinding[] {\n if (config.layout === null) {\n return [];\n }\n const byItem = new Map(runtime.items.map(entry => [entry.item, entry]));\n const findings: DriftFinding[] = [];\n for (const item of layoutItemsOf(config.layout)) {\n const entry = byItem.get(item);\n if (entry === undefined) {\n findings.push({ item, kind: 'unknown-item' });\n continue;\n }\n const alt = Object.hasOwn(config.values, item) ? config.values[item] : null;\n if (alt !== null && !entry.alternatives.includes(alt)) {\n findings.push({ alt, item, kind: 'unknown-variant' });\n }\n }\n return findings;\n}\n\nfunction runtimeRow(runtime: null | ResolvedRuntime): string {\n if (runtime === null) {\n return `runtime: missing — fix: ${INSTALL_FIX}`;\n }\n const version = basename(dirname(runtime.dir));\n return `runtime: ${version} — ${runtime.items.length} items`;\n}\n\nfunction configRow(\n findings: readonly DriftFinding[],\n runtime: ResolvedRuntime,\n): string {\n if (findings.length === 0) {\n return 'config: no drift';\n }\n const fix = findings.some(finding => finding.kind === 'unknown-item')\n ? `rerun configure --layout '${runtime.defaultLayout}' --fallback=default`\n : 'rerun configure --fallback=default';\n return `config: drift — ${findings.map(findingText).join(', ')} — fix: ${fix}`;\n}\n\nfunction backupRow(home: string): string {\n let backup: null | SettingsBackup;\n try {\n backup = readBackup(home);\n } catch {\n return `backup: unreadable — fix: delete ~/${DATA_REL}/backup.json`;\n }\n if (backup === null) {\n return 'backup: absent';\n }\n const saved = SETTINGS_KEYS.filter(key => backup.keys[key] !== undefined);\n const parts = [\n ...(backup.createdFile ? ['created settings.json'] : []),\n saved.length > 0 ? `saved ${saved.join(', ')}` : 'saved nothing',\n ];\n return `backup: present — ${parts.join(', ')}`;\n}\n\nfunction ageText(ms: number): string {\n const minutes = Math.floor(ms / 60000);\n if (minutes < 1) {\n return `${Math.floor(ms / 1000)}s`;\n }\n if (minutes < 60) {\n return `${minutes}m`;\n }\n const hours = Math.floor(minutes / 60);\n if (hours < 24) {\n return `${hours}h`;\n }\n return `${Math.floor(hours / 24)}d`;\n}\n\nfunction captureText(home: string, surface: 'main' | 'tick'): string {\n try {\n const age = ageText(\n Date.now() - statSync(capturePath(home, surface)).mtimeMs,\n );\n return `${age} ago`;\n } catch {\n return 'absent';\n }\n}\n\nfunction capturesRow(home: string): string {\n const surfaces = (['main', 'tick'] as const).map(\n surface => `${surface} ${captureText(home, surface)}`,\n );\n return `captures: ${surfaces.join(', ')}`;\n}\n\nfunction settingsMembers(home: string): Record<string, unknown> {\n const file = join(home, '.claude', 'settings.json');\n const raw = readOrNull(file);\n return raw === null ? {} : parseSettings(file, raw);\n}\n\nfunction resolveOrNull(home: string): null | ResolvedRuntime {\n try {\n return resolveRuntime({ home });\n } catch {\n return null;\n }\n}\n\nexport function status(options: StatusOptions): StatusResult {\n const runtime = resolveOrNull(options.home);\n const members = settingsMembers(options.home);\n const main = keyState('statusLine', members.statusLine);\n const subagent = keyState('subagentStatusLine', members.subagentStatusLine);\n const config = readKeyConfig(options.home);\n const findings =\n runtime === null || main.kind !== 'ours'\n ? []\n : driftFindings(config, runtime);\n\n const rows = [\n runtimeRow(runtime),\n keyRow('statusLine', main, configDetail(config)),\n keyRow('subagentStatusLine', subagent),\n ...(runtime !== null && main.kind === 'ours'\n ? [configRow(findings, runtime)]\n : []),\n backupRow(options.home),\n capturesRow(options.home),\n ];\n const healthy =\n runtime !== null &&\n main.kind === 'ours' &&\n subagent.kind === 'ours' &&\n findings.length === 0;\n return { healthy, rows: [...rows, healthy ? 'healthy' : 'unhealthy'] };\n}\n","import type { RenderSpec } from './payloads.js';\nimport type { WizardDeps } from './wizard.js';\n\nimport { runtimeRenderer } from './payloads.js';\n\nfunction nextKey(buffer: string): readonly [string, string] | undefined {\n if (buffer === '') {\n return undefined;\n }\n const head = buffer[0];\n if (head !== '\\x1b') {\n return [head, buffer.slice(1)];\n }\n if (buffer.length < 3) {\n return undefined;\n }\n if (buffer[1] === '[' && 'ABCD'.includes(buffer[2])) {\n return [buffer.slice(0, 3), buffer.slice(3)];\n }\n return ['', buffer.slice(1)];\n}\n\nexport function terminalDeps(\n input: NodeJS.ReadStream = process.stdin,\n output: NodeJS.WriteStream = process.stdout,\n): WizardDeps {\n return {\n async *readKeys(): AsyncGenerator<string> {\n const chunks: string[] = [];\n const waiters: (() => void)[] = [];\n const state = { closed: false };\n function notify(): void {\n for (const wake of waiters.splice(0)) {\n wake();\n }\n }\n function onData(chunk: Buffer): void {\n chunks.push(chunk.toString('utf8'));\n notify();\n }\n function onEnd(): void {\n state.closed = true;\n notify();\n }\n input.on('data', onData);\n input.on('end', onEnd);\n input.on('close', onEnd);\n if (input.isTTY) {\n input.setRawMode(true);\n }\n input.resume();\n try {\n let buffer = '';\n for (;;) {\n for (\n let chunk = chunks.shift();\n chunk !== undefined;\n chunk = chunks.shift()\n ) {\n buffer += chunk;\n }\n while (buffer !== '') {\n const next = nextKey(buffer);\n if (next === undefined) {\n break;\n }\n buffer = next[1];\n if (next[0] !== '') {\n yield next[0];\n }\n }\n if (state.closed && chunks.length === 0) {\n return;\n }\n await new Promise<void>(resolve => {\n waiters.push(resolve);\n });\n }\n } finally {\n if (input.isTTY) {\n input.setRawMode(false);\n }\n input.pause();\n input.off('data', onData);\n input.off('end', onEnd);\n input.off('close', onEnd);\n }\n },\n render(frame: string): void {\n output.write(`\\x1b[2J\\x1b[H${frame}\\n`);\n },\n preview(spec: RenderSpec): string {\n return runtimeRenderer(spec);\n },\n };\n}\n","import { join } from 'node:path';\n\nimport type { RenderSpec } from './payloads.js';\nimport type { RuntimeItem } from './resolve.js';\n\nimport { VERSION } from './cli.js';\nimport { configure, layoutItems } from './configure.js';\nimport { firstPanelRow, previewSources } from './payloads.js';\nimport { readKeyConfig, resolveRuntime } from './resolve.js';\n\nexport interface WizardDeps {\n preview(spec: RenderSpec): string;\n readKeys(): AsyncGenerator<string>;\n render(frame: string): void;\n}\n\nexport type WizardOutcome = 'cancelled' | 'save-failed' | 'saved';\n\nexport interface WizardOptions {\n readonly home: string;\n readonly now: string;\n}\n\nconst WIDTHS: readonly number[] = [80, 120, 200];\nconst KEYMAP =\n 'j/k move · h/l variant · s none · w width · enter save · q cancel';\n\nexport async function createWizard(\n options: WizardOptions,\n deps: WizardDeps,\n): Promise<WizardOutcome> {\n const runtime = resolveRuntime({ home: options.home });\n const existing = readKeyConfig(options.home);\n const layout = existing.layout ?? runtime.defaultLayout;\n const byItem = new Map<string, RuntimeItem>(\n runtime.items.map(item => [item.item, item] as const),\n );\n const names = layoutItems(\n layout,\n runtime.items.map(item => item.item),\n );\n const offered: {\n readonly alternatives: readonly string[];\n readonly item: string;\n }[] = [];\n const draft = new Map<string, string>();\n for (const name of names) {\n const entry = byItem.get(name);\n if (entry === undefined) {\n continue;\n }\n offered.push({ alternatives: entry.alternatives, item: name });\n draft.set(\n name,\n name in existing.values &&\n entry.alternatives.includes(existing.values[name])\n ? existing.values[name]\n : entry.default,\n );\n }\n const sources = previewSources(options.home, Number(options.now));\n const mainBin = join(runtime.dir, 'statusline.sh');\n const panelBin = join(runtime.dir, 'subagent.sh');\n\n let focus = 0;\n let widthAt = 0;\n\n function variantEnv(): Record<string, string> {\n return Object.fromEntries(\n [...draft].map(([item, alt]) => [\n `STATUSLINE_LAB_${item.toUpperCase()}`,\n alt,\n ]),\n );\n }\n\n function env(): Record<string, string> {\n return {\n COLUMNS: String(WIDTHS[widthAt]),\n HOME: options.home,\n NOW: options.now,\n STATUSLINE_LAB_LAYOUT: layout,\n ...variantEnv(),\n };\n }\n\n function cycle(delta: number): void {\n const focused = offered.at(focus);\n if (focused === undefined || focused.alternatives.length === 0) {\n return;\n }\n const alts = focused.alternatives;\n const at = alts.indexOf(draft.get(focused.item) ?? '');\n draft.set(focused.item, alts[(at + delta + alts.length) % alts.length]);\n }\n\n function step(key: string): void {\n if (key === '\\x1b[B' || key === 'j') {\n focus = (focus + 1) % offered.length;\n } else if (key === '\\x1b[A' || key === 'k') {\n focus = (focus + offered.length - 1) % offered.length;\n } else if (key === '\\x1b[C' || key === 'l') {\n cycle(1);\n } else if (key === '\\x1b[D' || key === 'h') {\n cycle(-1);\n } else if (key === 's') {\n const focused = offered.at(focus);\n if (focused?.alternatives.includes('none')) {\n draft.set(focused.item, 'none');\n }\n } else if (key === 'w') {\n widthAt = (widthAt + 1) % WIDTHS.length;\n }\n }\n\n function draw(): void {\n const focused = offered.at(focus);\n if (focused === undefined) {\n return;\n }\n const samples = focused.alternatives.map(alt =>\n deps\n .preview({\n bin: mainBin,\n env: {\n ...env(),\n STATUSLINE_LAB_LAYOUT: `{${focused.item}}`,\n [`STATUSLINE_LAB_${focused.item.toUpperCase()}`]: alt,\n },\n stdin: sources.main,\n })\n .replace(/\\n+$/, ''),\n );\n const line = deps\n .preview({ bin: mainBin, env: env(), stdin: sources.main })\n .replace(/\\n+$/, '');\n // subagent.sh reads the width out of the tick itself, not COLUMNS.\n const tick = JSON.parse(sources.tick) as { columns?: number };\n tick.columns = WIDTHS[widthAt];\n const panel = deps\n .preview({\n bin: panelBin,\n env: {\n COLUMNS: String(WIDTHS[widthAt]),\n HOME: options.home,\n NOW: options.now,\n },\n stdin: `${JSON.stringify(tick, null, 2)}\\n`,\n })\n .replace(/\\n+$/, '');\n const rows = offered.map(\n (entry, at) =>\n `${at === focus ? '>' : ' '} ${entry.item.padEnd(9)} ${draft.get(entry.item)}`,\n );\n deps.render(\n [\n `statusline configure · ${WIDTHS[widthAt]} columns (w cycles)`,\n '',\n ` ${line}`,\n ` panel ${firstPanelRow(panel)}`,\n '',\n `${focused.item}: ${focused.alternatives.join(' | ')}`,\n ...focused.alternatives.map(\n (alt, at) =>\n ` ${alt === draft.get(focused.item) ? '*' : ' '} ${samples[at]}`,\n ),\n '',\n ...rows,\n '',\n KEYMAP,\n ].join('\\n'),\n );\n }\n\n function finish(): WizardOutcome {\n try {\n configure({\n home: options.home,\n layout,\n variants: Object.fromEntries(draft),\n });\n } catch (e) {\n deps.render(\n `save failed: ${(e as Error).message}\\nfix it and rerun: npx -y @v1nvn/statusline@${VERSION} configure\\n`,\n );\n return 'save-failed';\n }\n deps.render('saved — live on the next paint\\n');\n return 'saved';\n }\n\n try {\n const keys = deps.readKeys();\n draw();\n for await (const key of keys) {\n if (key === '\\r') {\n return finish();\n }\n if (key === 'q' || key === '\\x03') {\n break;\n }\n step(key);\n draw();\n }\n deps.render('cancelled — nothing written\\n');\n return 'cancelled';\n } finally {\n sources.cleanup();\n }\n}\n","import { printUsageAndExit } from '@v1nvn/agentic-core';\n\nimport { catalog } from './catalog.js';\nimport { buildProgram, parseArgs, subcommandHelp, VERSION } from './cli.js';\nimport { configure } from './configure.js';\nimport { restore } from './restore.js';\nimport { status } from './status.js';\nimport { terminalDeps } from './wizard-tui.js';\nimport { createWizard } from './wizard.js';\n\nconst parsed =\n parseArgs(process.argv.slice(2)) ?? printUsageAndExit(buildProgram());\n\nfunction homeOf(flag: string | undefined): string {\n const home = flag ?? process.env.HOME;\n if (home === undefined || home === '') {\n throw new Error('no home to operate on: set $HOME or pass --home');\n }\n return home;\n}\n\nfunction run(job: () => void): void {\n try {\n job();\n } catch (e) {\n console.error((e as Error).message);\n process.exitCode = 1;\n }\n}\n\nif (parsed.help !== undefined) {\n console.log(subcommandHelp(parsed.help));\n} else if (parsed.version) {\n console.log(VERSION);\n} else if (parsed.command === 'catalog') {\n run(() => {\n console.log(catalog({ home: homeOf(parsed.home), items: parsed.items }));\n });\n} else if (parsed.command === 'configure') {\n const home = homeOf(parsed.home);\n const interactive =\n parsed.layout === undefined &&\n parsed.variants === undefined &&\n parsed.fallback === undefined &&\n !parsed.dryRun &&\n !parsed.force;\n if (interactive && process.stdin.isTTY) {\n const outcome = await createWizard(\n { home, now: String(Math.floor(Date.now() / 1000)) },\n terminalDeps(),\n );\n if (outcome === 'save-failed') {\n process.exitCode = 1;\n }\n } else {\n run(() => {\n const result = configure({\n dryRun: parsed.dryRun,\n fallback: parsed.fallback,\n force: parsed.force,\n home,\n layout: parsed.layout,\n variants: parsed.variants,\n });\n console.log(\n result.mode === 'written'\n ? 'configured — live on the next paint'\n : result.text,\n );\n });\n }\n} else if (parsed.command === 'restore') {\n run(() => {\n const result = restore({\n dryRun: parsed.dryRun,\n force: parsed.force,\n home: homeOf(parsed.home),\n });\n console.log(result.text);\n });\n} else if (parsed.command === 'status') {\n run(() => {\n const result = status({ home: homeOf(parsed.home) });\n console.log(result.rows.join('\\n'));\n process.exitCode = result.healthy ? 0 : 1;\n });\n}\n"],"mappings":";;;;;;;;AAoEA,SAAS,aAAa,SAAS,MAAM,SAAS;CAC7C,IAAI;EACH,QAAQ,qBAAqB,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,gBAAgB;GAClE,gBAAgB,KAAK;GACrB,gBAAgB,KAAK;EACtB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;EACpC,OAAO;CACR,SAAS,KAAK;EACb,OAAO,UAAU,GAAG;CACrB;AACD;AACA,SAAS,kBAAkB,SAAS;CACnC,QAAQ,MAAM,QAAQ,gBAAgB,CAAC;CACvC,QAAQ,KAAK,CAAC;AACf;AAsGS,OAAO;;;ACrLhB,IAAa,WAAW,KACtB,WACA,WACA,QACA,oBACF;AAEA,SAAgB,YAAY,MAAc,SAAkC;CAC1E,OAAO,KAAK,MAAM,UAAU,YAAY,GAAG,QAAQ,MAAM;AAC3D;AAEA,SAAgB,WAAW,MAAsB;CAC/C,OAAO,KAAK,MAAM,UAAU,aAAa;AAC3C;AAqBA,IAAa,eACX;AACF,IAAM,cAAc,GAAG,aAAa;AACpC,IAAM,cAAc;AAEpB,SAAgB,aACd,QACA,aACQ;CAER,OAAO,GAAG,cADE,CAAC,0BAA0B,OAAO,IAAI,GAAG,WAAW,CAAC,CAAC,KAAK,GAC/C,EAAI,GAAG;AACjC;AAEA,IAAa,mBAAmB,GAAG,aAAa;AAEhD,SAAgB,iBAAiB,SAA0B;CACzD,OAAO,QAAQ,WAAW,WAAW,KAAK,QAAQ,SAAS,IAAI,aAAa;AAC9E;AAEA,SAAS,cAAc,SAAgC;CACrD,IAAI,CAAC,iBAAiB,OAAO,GAC3B,OAAO;CAET,OAAO,QAAQ,MACb,YAAY,QACZ,QAAQ,SA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QAAQ,OAAO;GACf,UAAU,OAAO;EACnB,CAAC;EACD,QAAQ,IACN,OAAO,SAAS,YACZ,wCACA,OAAO,IACb;CACF,CAAC;AAEL,OAAO,IAAI,OAAO,YAAY,WAC5B,UAAU;CACR,MAAM,SAAS,QAAQ;EACrB,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,MAAM,OAAO,OAAO,IAAI;CAC1B,CAAC;CACD,QAAQ,IAAI,OAAO,IAAI;AACzB,CAAC;KACI,IAAI,OAAO,YAAY,UAC5B,UAAU;CACR,MAAM,SAAS,OAAO,EAAE,MAAM,OAAO,OAAO,IAAI,EAAE,CAAC;CACnD,QAAQ,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC;CAClC,QAAQ,WAAW,OAAO,UAAU,IAAI;AAC1C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../core/dist/index.js","../src/resolve.ts","../src/catalog.ts","../package.json","../src/cli.ts","../src/demo-repo.ts","../src/payloads.ts","../src/configure.ts","../src/restore.ts","../src/status.ts","../src/wizard-tui.ts","../src/wizard.ts","../src/index.ts"],"sourcesContent":["import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n//#region src/input.ts\nfunction readAll(stream) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet data = \"\";\n\t\tstream.setEncoding(\"utf8\");\n\t\tstream.on(\"data\", (chunk) => {\n\t\t\tdata += chunk;\n\t\t});\n\t\tstream.on(\"end\", () => {\n\t\t\tresolve(data);\n\t\t});\n\t\tstream.on(\"error\", reject);\n\t});\n}\nfunction readStdin(stream = process.stdin) {\n\treturn readAll(stream);\n}\n/** A markdown file's contents, with the CLI's no-such-file error. */\nfunction readMarkdownFile(path) {\n\tif (!statSync(path, { throwIfNoEntry: false })?.isFile()) throw new Error(`no such file: ${path}`);\n\treturn readFileSync(path, \"utf8\");\n}\n//#endregion\n//#region src/hook.ts\n/**\n* Read the Claude Code hook event JSON from stdin; empty or unparseable input\n* yields an empty event, never a thrown error — a hook must always answer.\n*/\nfunction readHookEvent(stream = process.stdin) {\n\treturn readAll(stream).then((data) => {\n\t\ttry {\n\t\t\treturn JSON.parse(data);\n\t\t} catch {\n\t\t\treturn {};\n\t\t}\n\t}, () => ({}));\n}\n/**\n* Which transcript lastReply should read, per the hook event: transcript_path\n* when it names a real file, else session_id, else nothing (lastReply then\n* falls back to the newest session for the current project).\n*/\nfunction replyTarget(event) {\n\tif (event.transcript_path !== void 0 && isFile(event.transcript_path)) return event.transcript_path;\n\treturn event.session_id || void 0;\n}\nfunction isFile(path) {\n\ttry {\n\t\treturn statSync(path).isFile();\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Print the UserPromptExpansion decision for a zero-token command: `block`\n* keeps the command from reaching the model, with the output as the `reason`.\n*/\nfunction emitHookBlock(reason) {\n\tprocess.stdout.write(`${JSON.stringify({\n\t\tdecision: \"block\",\n\t\treason\n\t})}\\n`);\n}\n//#endregion\n//#region src/cli.ts\nfunction parseQuietly(program, args, recover) {\n\ttry {\n\t\tprogram.allowExcessArguments(false).exitOverride().configureOutput({\n\t\t\twriteOut: () => void 0,\n\t\t\twriteErr: () => void 0\n\t\t}).parse([...args], { from: \"user\" });\n\t\treturn program;\n\t} catch (err) {\n\t\treturn recover?.(err);\n\t}\n}\nfunction printUsageAndExit(program) {\n\tconsole.error(program.helpInformation());\n\tprocess.exit(1);\n}\nasync function hookOrPrint(hook, failure, run, stdin = process.stdin) {\n\tif (hook) {\n\t\tlet reason;\n\t\ttry {\n\t\t\treason = await run(await readHookEvent(stdin));\n\t\t} catch (e) {\n\t\t\treason = `${failure}: ${e.message}`;\n\t\t}\n\t\temitHookBlock(reason);\n\t\treturn;\n\t}\n\ttry {\n\t\tconsole.log(await run(void 0));\n\t} catch (e) {\n\t\tconsole.error(e.message);\n\t\tprocess.exit(1);\n\t}\n}\n//#endregion\n//#region src/dev.ts\nvar RELOAD_DEBOUNCE_MS = 150;\nvar IGNORED_SEGMENTS = [\n\t\"/node_modules/\",\n\t\"/dist/\",\n\t\"/.git/\",\n\t\"/coverage/\"\n];\nfunction shouldReload(file) {\n\treturn IGNORED_SEGMENTS.every((seg) => !file.includes(seg));\n}\n/**\n* Debounced file-change reloads, serialized via a promise chain: concurrent\n* saves never overlap, and a mid-reload save still produces a follow-up.\n*/\nfunction watchWithReload(vite, reload) {\n\tlet chain = Promise.resolve();\n\tlet timer;\n\tvite.watcher.on(\"change\", (file) => {\n\t\tif (!shouldReload(file)) return;\n\t\tif (timer) clearTimeout(timer);\n\t\ttimer = setTimeout(() => {\n\t\t\ttimer = void 0;\n\t\t\tchain = chain.then(reload);\n\t\t}, RELOAD_DEBOUNCE_MS);\n\t});\n}\n//#endregion\n//#region src/last-reply.ts\nfunction textBlocks(entry) {\n\tconst content = entry.message?.content;\n\tif (entry.type !== \"assistant\" || !Array.isArray(content)) return;\n\tconst blocks = content.filter((b) => typeof b === \"object\" && b !== null && b.type === \"text\");\n\treturn blocks.length > 0 ? blocks : void 0;\n}\nfunction claudeProjectsDir() {\n\tconst claudeDir = process.env.CLAUDE_DIR ?? join(homedir(), \".claude\");\n\treturn join(claudeDir, \"projects\");\n}\n/**\n* The last assistant text reply from a Claude Code session, reproducing Claude\n* Code's `/copy` byte-for-byte: the last assistant entry that contains a\n* `text` block, only its `text` block(s) (tool_use / thinking dropped), blocks\n* joined with a blank line, and no trailing newline.\n*\n* @param arg a transcript file, a session UUID under the project dir, or\n* nothing to use the newest session for the current project.\n*/\nfunction lastReply(arg) {\n\tconst proj = (process.env.CLAUDE_PROJECT_DIR ?? process.cwd()).replaceAll(\"/\", \"-\");\n\tconst projDir = join(claudeProjectsDir(), proj);\n\tlet file;\n\tif (arg !== void 0) file = isFile(arg) ? arg : join(projDir, `${arg}.jsonl`);\n\telse if (existsSync(projDir)) {\n\t\tconst newest = readdirSync(projDir).filter((f) => f.endsWith(\".jsonl\")).map((f) => ({\n\t\t\tf,\n\t\t\tmtimeMs: statSync(join(projDir, f)).mtimeMs\n\t\t})).sort((a, b) => b.mtimeMs - a.mtimeMs).at(0);\n\t\tif (newest) file = join(projDir, newest.f);\n\t}\n\tif (file === void 0 || !isFile(file)) throw new Error(`no session transcript found in ${projDir}`);\n\tlet last;\n\tfor (const line of readFileSync(file, \"utf8\").split(\"\\n\")) {\n\t\tif (!line.includes(\"\\\"assistant\\\"\")) continue;\n\t\tlet entry;\n\t\ttry {\n\t\t\tentry = JSON.parse(line);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tconst blocks = textBlocks(entry);\n\t\tif (blocks) last = blocks;\n\t}\n\treturn (last ?? []).map((b) => b.text ?? \"\").join(\"\\n\\n\");\n}\n//#endregion\n//#region src/logger.ts\nvar LEVEL_RANK = {\n\tdebug: 10,\n\tinfo: 20,\n\twarn: 30,\n\terror: 40,\n\tsilent: Number.MAX_SAFE_INTEGER\n};\nfunction levelEnabled(active, wanted) {\n\treturn LEVEL_RANK[wanted] >= LEVEL_RANK[active];\n}\nvar LEVEL_LABEL = {\n\tdebug: \"DEBUG\",\n\terror: \"ERROR\",\n\tinfo: \"INFO\",\n\twarn: \"WARN\"\n};\nvar Logger = class {\n\tactiveLevel;\n\tstderr;\n\tconstructor(activeLevel, stderr = (line) => process.stderr.write(`${line}\\n`)) {\n\t\tthis.activeLevel = activeLevel;\n\t\tthis.stderr = stderr;\n\t}\n\tdebug(message) {\n\t\tthis.log(\"debug\", message);\n\t}\n\terror(message) {\n\t\tthis.log(\"error\", message);\n\t}\n\tinfo(message) {\n\t\tthis.log(\"info\", message);\n\t}\n\twarn(message) {\n\t\tthis.log(\"warn\", message);\n\t}\n\tlog(level, message) {\n\t\tif (levelEnabled(this.activeLevel, level)) this.stderr(`${LEVEL_LABEL[level]} ${message}`);\n\t}\n};\n//#endregion\n//#region src/shutdown.ts\n/** Close each closable in order (best-effort), then force-exit. */\nfunction shutdownOnSignals(closables, signals = [\"SIGINT\", \"SIGTERM\"]) {\n\tfunction shutdown() {\n\t\tclosables.reduce((acc, closable) => acc.then(async () => {\n\t\t\ttry {\n\t\t\t\tawait closable.close();\n\t\t\t} catch {}\n\t\t}), Promise.resolve()).finally(() => {\n\t\t\tprocess.exit(0);\n\t\t});\n\t}\n\tfor (const signal of signals) process.on(signal, shutdown);\n}\n//#endregion\n//#region src/text-format.ts\n/**\n* Plain-text rendering primitives shared by the zai and tokens report\n* renderers. Output targets a monospace terminal / hook-block `reason`, so\n* everything here is fixed-width: padding, block-glyph bars, and compact\n* number formatting.\n*/\nvar MONTHS = [\n\t\"Jan\",\n\t\"Feb\",\n\t\"Mar\",\n\t\"Apr\",\n\t\"May\",\n\t\"Jun\",\n\t\"Jul\",\n\t\"Aug\",\n\t\"Sep\",\n\t\"Oct\",\n\t\"Nov\",\n\t\"Dec\"\n];\nvar EIGHTHS = [\n\t\"\",\n\t\"▏\",\n\t\"▎\",\n\t\"▍\",\n\t\"▌\",\n\t\"▋\",\n\t\"▊\",\n\t\"▉\"\n];\nvar RULE_WIDTH = 68;\nfunction rule() {\n\treturn \"─\".repeat(68);\n}\nfunction pad2(n) {\n\treturn String(n).padStart(2, \"0\");\n}\n/** Local-time `YYYY-MM-DD` key. */\nfunction ymd(date) {\n\treturn `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;\n}\nfunction fmtTokens(n) {\n\tif (n == null || Number.isNaN(n)) return \"—\";\n\tif (n >= 1e9) return (n / 1e9).toFixed(1) + \"B\";\n\tif (n >= 1e6) return (n / 1e6).toFixed(1) + \"M\";\n\tif (n >= 1e3) return (n / 1e3).toFixed(1) + \"K\";\n\treturn String(n);\n}\nfunction fmtNum(n) {\n\treturn (n || 0).toLocaleString(\"en-US\");\n}\nfunction padR(s, n) {\n\treturn s.length >= n ? s : s + \" \".repeat(n - s.length);\n}\nfunction padL(s, n) {\n\treturn s.length >= n ? s : \" \".repeat(n - s.length) + s;\n}\n/** Fixed-width bar field (width cols): █ blocks + an eighth-fraction + trailing spaces. */\nfunction barField(v, max, width) {\n\tif (!v || v <= 0 || max <= 0) return \" \".repeat(width);\n\tconst scaled = v / max * width;\n\tlet full = Math.floor(scaled);\n\tlet fi = Math.round((scaled - full) * 8);\n\tif (fi === 8) {\n\t\tfull += 1;\n\t\tfi = 0;\n\t}\n\tif (full === 0 && fi === 0) fi = 1;\n\tlet s = \"█\".repeat(Math.min(full, width));\n\tif (full < width && fi > 0) s += EIGHTHS[fi];\n\tif (s.length < width) s += \" \".repeat(width - s.length);\n\treturn s.slice(0, width);\n}\n/** Filled/empty meter: █ for used, ░ for remaining. */\nfunction meter(pct, width) {\n\tlet filled = Math.round((pct || 0) / 100 * width);\n\tfilled = Math.max(0, Math.min(width, filled));\n\treturn \"█\".repeat(filled) + \"░\".repeat(width - filled);\n}\n//#endregion\nexport { Logger, MONTHS, RULE_WIDTH, barField, claudeProjectsDir, emitHookBlock, fmtNum, fmtTokens, hookOrPrint, isFile, lastReply, levelEnabled, meter, pad2, padL, padR, parseQuietly, printUsageAndExit, readAll, readHookEvent, readMarkdownFile, readStdin, replyTarget, rule, shutdownOnSignals, watchWithReload, ymd };\n\n//# sourceMappingURL=index.js.map","import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const DATA_REL = join(\n '.claude',\n 'plugins',\n 'data',\n 'statusline-agentic',\n);\n\nexport function capturePath(home: string, surface: 'main' | 'tick'): string {\n return join(home, DATA_REL, 'captures', `${surface}.json`);\n}\n\nexport function backupPath(home: string): string {\n return join(home, DATA_REL, 'backup.json');\n}\n\nexport interface RuntimeItem {\n readonly alternatives: readonly string[];\n readonly default: string;\n readonly item: string;\n}\n\nexport interface ResolvedRuntime {\n readonly defaultLayout: string;\n readonly dir: string;\n readonly items: readonly RuntimeItem[];\n}\n\nexport interface ScriptConfig {\n readonly layout: null | string;\n readonly values: Readonly<Record<string, string>>;\n}\n\n// The env assignments must immediately precede bash: a prefix on the d=\n// assignment dies with that statement.\nexport const KEY_RESOLVER =\n \"d=$(printf '%s\\\\n' ~/.claude/plugins/cache/agentic/statusline/*/ | sort -V | tail -1)\";\nconst MAIN_PREFIX = `${KEY_RESOLVER}; `;\nconst MAIN_SUFFIX = 'bash \"${d}runtime/statusline.sh\" 2>/dev/null || true';\n\nexport function mainKeyValue(\n layout: string,\n assignments: readonly string[],\n): string {\n const env = [`STATUSLINE_LAB_LAYOUT='${layout}'`, ...assignments].join(' ');\n return `${MAIN_PREFIX}${env} ${MAIN_SUFFIX}`;\n}\n\nexport const subagentKeyValue = `${KEY_RESOLVER}; bash \"\\${d}runtime/subagent.sh\" 2>/dev/null || true`;\n\nexport function isOurMainCommand(command: string): boolean {\n return command.startsWith(MAIN_PREFIX) && command.endsWith(` ${MAIN_SUFFIX}`);\n}\n\nfunction mainKeyMiddle(command: string): null | string {\n if (!isOurMainCommand(command)) {\n return null;\n }\n return command.slice(\n MAIN_PREFIX.length,\n command.length - MAIN_SUFFIX.length - 1,\n );\n}\n\nfunction settingsCommand(home: string): null | string {\n let raw: string;\n try {\n raw = readFileSync(join(home, '.claude', 'settings.json'), 'utf8');\n } catch {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n return null;\n }\n const member = (parsed as null | { statusLine?: unknown })?.statusLine;\n if (typeof member !== 'object' || member === null) {\n return null;\n }\n const command = (member as { command?: unknown }).command;\n return typeof command === 'string' ? command : null;\n}\n\nexport function readKeyConfig(home: string): ScriptConfig {\n const command = settingsCommand(home);\n const middle = command === null ? null : mainKeyMiddle(command);\n if (middle === null) {\n return { layout: null, values: {} };\n }\n const layout = /^STATUSLINE_LAB_LAYOUT='([^']*)'/.exec(middle);\n if (layout === null) {\n return { layout: null, values: {} };\n }\n const values: Record<string, string> = {};\n for (const [, name, alt] of middle.matchAll(\n /(?:^| )STATUSLINE_LAB_([A-Z][A-Z0-9_]*)=([a-z0-9]+)/g,\n )) {\n values[name.toLowerCase()] = alt;\n }\n return { layout: layout[1], values };\n}\n\nfunction byVersion(a: string, b: string): number {\n const left = a.split('.');\n const right = b.split('.');\n for (let i = 0; i < left.length || i < right.length; i += 1) {\n const delta =\n (parseInt(left[i] ?? '0', 10) || 0) -\n (parseInt(right[i] ?? '0', 10) || 0);\n if (delta !== 0) {\n return delta;\n }\n }\n return 0;\n}\n\nfunction newestCacheDir(cacheRoot: string): null | string {\n let versions: string[];\n try {\n versions = readdirSync(cacheRoot, { withFileTypes: true })\n .filter(entry => entry.isDirectory())\n .map(entry => entry.name);\n } catch {\n return null;\n }\n if (versions.length === 0) {\n return null;\n }\n versions.sort(byVersion);\n return join(cacheRoot, versions[versions.length - 1]);\n}\n\nfunction readAlternatives(dir: string): Map<string, readonly string[]> {\n const declared = new Map<string, readonly string[]>();\n const components = join(dir, 'components');\n for (const file of readdirSync(components).sort()) {\n if (!file.endsWith('.sh')) {\n continue;\n }\n for (const line of readFileSync(join(components, file), 'utf8').split(\n '\\n',\n )) {\n if (!line.startsWith('#')) {\n break;\n }\n const match = /alternatives:\\s*(.+)$/.exec(line);\n if (match) {\n declared.set(\n file.slice(0, -'.sh'.length),\n match[1]\n .split('|')\n .map(alt => alt.trim().replace(/\\s*\\(current\\)$/, '')),\n );\n }\n }\n }\n return declared;\n}\n\nfunction readItems(dir: string): readonly RuntimeItem[] {\n const alternatives = readAlternatives(dir);\n const defaults = new Map<string, string>();\n for (const [, item, alt] of readFileSync(\n join(dir, 'lib.sh'),\n 'utf8',\n ).matchAll(/([a-z]+)\\) echo ([a-z]+) ;;/g)) {\n defaults.set(item, alt);\n }\n const match = /^COMPS=\"(.+)\"$/m.exec(\n readFileSync(join(dir, 'statusline.sh'), 'utf8'),\n );\n if (match === null) {\n throw new Error(`statusline.sh in ${dir} declares no COMPS order`);\n }\n return match[1].split(' ').map(item => {\n const alt = defaults.get(item);\n if (alt === undefined) {\n throw new Error(`lib.sh in ${dir} declares no default for '${item}'`);\n }\n return {\n alternatives: alternatives.get(item) ?? [],\n default: alt,\n item,\n };\n });\n}\n\nfunction readDefaultLayout(dir: string): string {\n const match = /^export DEFAULT_LAYOUT='(.*)'$/m.exec(\n readFileSync(join(dir, 'lib.sh'), 'utf8'),\n );\n if (match === null) {\n throw new Error(`lib.sh in ${dir} declares no DEFAULT_LAYOUT`);\n }\n return match[1];\n}\n\nexport function resolveRuntime({ home }: { home: string }): ResolvedRuntime {\n const pluginDir = newestCacheDir(\n join(home, '.claude', 'plugins', 'cache', 'agentic', 'statusline'),\n );\n const dir = pluginDir === null ? null : join(pluginDir, 'runtime');\n if (dir === null || !existsSync(join(dir, 'statusline.sh'))) {\n throw new Error(\n `no statusline runtime under ${home} — install the plugin first: claude plugin install statusline@agentic`,\n );\n }\n return {\n defaultLayout: readDefaultLayout(dir),\n dir,\n items: readItems(dir),\n };\n}\n","import { readKeyConfig, resolveRuntime } from './resolve.js';\n\nexport interface CatalogOptions {\n readonly home: string;\n readonly items?: readonly string[];\n}\n\nexport function catalog(options: CatalogOptions): string {\n const runtime = resolveRuntime({ home: options.home });\n const live = readKeyConfig(options.home).values;\n const byItem = new Map(runtime.items.map(item => [item.item, item]));\n const wanted = options.items ?? runtime.items.map(item => item.item);\n return wanted\n .map(item => {\n const entry = byItem.get(item);\n if (entry === undefined) {\n throw new Error(\n `unknown item '${item}' — valid items: ${[...byItem.keys()].join(' ')}`,\n );\n }\n const current = live[item] ?? entry.default;\n return `${item}: ${entry.alternatives\n .map(alt => (alt === current ? `${alt}*` : alt))\n .join(' | ')}`;\n })\n .join('\\n');\n}\n","{\n \"name\": \"@v1nvn/statusline\",\n \"version\": \"0.27.2\",\n \"description\": \"Browse statusline variants and configure the live status line and agent panel — the statusline CLI behind the statusline plugin.\",\n \"type\": \"module\",\n \"bin\": \"dist/index.js\",\n \"scripts\": {\n \"build\": \"vite build\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\"\n },\n \"keywords\": [\n \"claude-code\",\n \"statusline\",\n \"cli\"\n ],\n \"author\": {\n \"name\": \"v1nvn\",\n \"email\": \"v1n@outlook.com\"\n },\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/v1nvn/agentic.git\",\n \"directory\": \"packages/statusline\"\n },\n \"files\": [\n \"dist\",\n \"assets\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"dependencies\": {\n \"@v1nvn/agentic-core\": \"workspace:^\",\n \"commander\": \"^15.0.0\"\n },\n \"devDependencies\": {\n \"vite\": \"^8.1.4\",\n \"vitest\": \"^4.1.10\"\n }\n}\n","import { parseQuietly } from '@v1nvn/agentic-core';\nimport { Command, Option } from 'commander';\n\nimport pkg from '../package.json' with { type: 'json' };\n\nexport const VERSION = pkg.version;\n\n// The flag surface mirrors statusline.sh's COMPS item registry; the catalog\n// and configure suites pin the two together.\nconst ITEM_IDS = [\n 'model',\n 'effort',\n 'state',\n 'cwd',\n 'branch',\n 'status',\n 'ahead',\n 'pr',\n 'bar',\n 'tokens',\n 'cache',\n 'cost',\n 'duration',\n 'lines',\n 'rate',\n 'style',\n] as const satisfies readonly string[];\n\nexport type Subcommand = 'catalog' | 'configure' | 'restore' | 'status';\n\nexport interface ParsedArgs {\n readonly command?: Subcommand;\n readonly dryRun?: boolean;\n readonly fallback?: 'default' | 'existing';\n readonly force?: boolean;\n readonly help?: Subcommand;\n readonly home?: string;\n readonly items?: readonly string[];\n readonly layout?: string;\n readonly variants?: Readonly<Record<string, string>>;\n readonly version: boolean;\n}\n\ntype SubcommandOptions = Record<string, unknown>;\n\nconst QUIET = { writeOut: () => undefined, writeErr: () => undefined };\n\nclass HelpRequested extends Error {\n constructor(readonly command: Subcommand) {\n super(`${command} --help`);\n }\n}\n\nfunction quiet(name: Subcommand, command: Command): Command {\n return command\n .exitOverride(err => {\n const code = (err as { code?: string }).code;\n if (code === 'commander.help' || code === 'commander.helpDisplayed') {\n throw new HelpRequested(name);\n }\n throw err;\n })\n .configureOutput(QUIET)\n .allowExcessArguments(false);\n}\n\nexport function buildProgram(\n onSubcommand?: (command: Subcommand, options: SubcommandOptions) => void,\n): Command {\n const catalog = quiet('catalog', new Command('catalog'))\n .description('print one line per item — * marks the live variant')\n .option('--home <dir>', 'operate on this home instead of $HOME');\n for (const item of ITEM_IDS) {\n catalog.option(`--${item}`, `cut the listing to the ${item} item`);\n }\n catalog.action((options: SubcommandOptions) =>\n onSubcommand?.('catalog', options),\n );\n\n const configure = quiet('configure', new Command('configure'))\n .description('write both settings keys with the inline lab commands')\n .option('--home <dir>', 'operate on this home instead of $HOME')\n .option(\n '--layout <spec>',\n \"brace clusters of item ids, e.g. '{cwd branch} {model effort}'\",\n )\n .addOption(\n new Option(\n '--fallback <mode>',\n 'fill unflagged layout items from defaults or the existing config',\n ).choices(['default', 'existing']),\n )\n .option('--dry-run', 'render both surfaces, write nothing')\n .option('--force', 'take over foreign settings keys');\n for (const item of ITEM_IDS) {\n configure.option(`--${item} <alt>`, `variant for the ${item} item`);\n }\n configure.action((options: SubcommandOptions) =>\n onSubcommand?.('configure', options),\n );\n\n const restore = quiet('restore', new Command('restore'))\n .description(\n 'revert both settings keys to their pre-lab values, clean the data dir',\n )\n .option('--home <dir>', 'operate on this home instead of $HOME')\n .option('--dry-run', 'print the plan, write nothing')\n .option(\n '--force',\n 'splice the saved value over a key changed after the takeover',\n );\n restore.action((options: SubcommandOptions) =>\n onSubcommand?.('restore', options),\n );\n\n const status = quiet('status', new Command('status'))\n .description(\n 'check install, keys, config, and backup — exit 0 healthy, 1 when a row needs action',\n )\n .option('--home <dir>', 'operate on this home instead of $HOME');\n status.action((options: SubcommandOptions) =>\n onSubcommand?.('status', options),\n );\n\n return new Command()\n .name('statusline')\n .description('Configure the status line and agent panel designs')\n .option('-V, --version', 'print the version and exit')\n .action(() => undefined)\n .addCommand(catalog)\n .addCommand(configure)\n .addCommand(restore)\n .addCommand(status);\n}\n\nexport function subcommandHelp(name: Subcommand): string {\n const command = buildProgram().commands.find(c => c.name() === name);\n if (command === undefined) {\n throw new Error(`no '${name}' command to describe`);\n }\n return command.helpInformation();\n}\n\nexport function parseArgs(args: readonly string[]): ParsedArgs | undefined {\n let chosen:\n | undefined\n | { readonly command: Subcommand; readonly options: SubcommandOptions };\n const program = buildProgram((command, options) => {\n chosen = { command, options };\n });\n const parsed = parseQuietly(program, args, err =>\n err instanceof HelpRequested ? { help: err.command } : undefined,\n );\n if (parsed === undefined) {\n return undefined;\n }\n if (!(parsed instanceof Command)) {\n return { version: false, help: parsed.help };\n }\n const { version } = program.opts<{ version: boolean | undefined }>();\n if (version) {\n return { version: true };\n }\n if (chosen === undefined) {\n return undefined;\n }\n const options = chosen.options;\n if (chosen.command === 'catalog') {\n const items = ITEM_IDS.filter(item => options[item] === true);\n return {\n version: false,\n command: 'catalog',\n ...(items.length > 0 ? { items } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n if (chosen.command === 'restore') {\n return {\n version: false,\n command: 'restore',\n ...(typeof options.dryRun === 'boolean'\n ? { dryRun: options.dryRun }\n : {}),\n ...(typeof options.force === 'boolean' ? { force: options.force } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n if (chosen.command === 'status') {\n return {\n version: false,\n command: 'status',\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n };\n }\n const variants: Record<string, string> = {};\n for (const item of ITEM_IDS) {\n if (typeof options[item] === 'string') {\n variants[item] = options[item];\n }\n }\n return {\n version: false,\n command: 'configure',\n ...(Object.keys(variants).length > 0 ? { variants } : {}),\n ...(typeof options.dryRun === 'boolean' ? { dryRun: options.dryRun } : {}),\n ...(typeof options.fallback === 'string'\n ? { fallback: options.fallback as 'default' | 'existing' }\n : {}),\n ...(typeof options.force === 'boolean' ? { force: options.force } : {}),\n ...(typeof options.home === 'string' ? { home: options.home } : {}),\n ...(typeof options.layout === 'string' ? { layout: options.layout } : {}),\n };\n}\n","import { execFileSync } from 'node:child_process';\nimport { mkdirSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst NAME = 'Lab';\nconst EMAIL = 'lab@local';\nconst D_INIT = '2026-09-01T10:00:00+00:00';\nconst D_REMOTE = '2026-09-01T11:00:00+00:00';\nconst D_LOCAL1 = '2026-09-02T09:00:00+00:00';\nconst D_LOCAL2 = '2026-09-02T09:30:00+00:00';\nconst D_STASH = '2026-09-02T10:00:00+00:00';\n\nconst API_INIT = \"export const api = {\\n host: 'demo.local',\\n};\\n\";\n\nexport function materializeDemoRepo(home: string): string {\n const dir = join(home, 'demo', 'atlas-web');\n for (const sub of ['src', 'docs', 'scratch', 'scripts']) {\n mkdirSync(join(dir, sub), { recursive: true });\n }\n function git(args: string[], date?: string): string {\n return execFileSync('git', ['-c', 'commit.gpgsign=false', ...args], {\n cwd: dir,\n encoding: 'utf8',\n // execFileSync inherits stderr by default; git checkout chatter must\n // not print over a wizard frame.\n stdio: ['ignore', 'pipe', 'pipe'],\n env: {\n PATH: process.env.PATH ?? '',\n HOME: home,\n LC_ALL: 'C',\n TZ: 'UTC',\n GIT_AUTHOR_NAME: NAME,\n GIT_AUTHOR_EMAIL: EMAIL,\n GIT_COMMITTER_NAME: NAME,\n GIT_COMMITTER_EMAIL: EMAIL,\n ...(date ? { GIT_AUTHOR_DATE: date, GIT_COMMITTER_DATE: date } : {}),\n },\n });\n }\n function write(rel: string, body: string): void {\n writeFileSync(join(dir, rel), body);\n }\n function commit(message: string, date: string): void {\n git(['add', '-A']);\n git(['commit', '-m', message], date);\n }\n\n git(['init', '-b', 'main']);\n git(['config', 'user.name', NAME]);\n git(['config', 'user.email', EMAIL]);\n write('README.md', 'atlas-web demo repo\\n');\n write('src/index.js', 'export function start() {}\\n');\n write('src/api.js', API_INIT);\n write('src/style.css', 'body { margin: 0; }\\n');\n write('src/util.js', 'export const id = (x) => x;\\n');\n commit('init', D_INIT);\n\n write('src/api.js', `${API_INIT}// remote: pinned host\\n`);\n commit('remote1', D_REMOTE);\n const originMain = git(['rev-parse', 'HEAD']).trim();\n\n git(['checkout', '-b', 'feature/login-flow', 'HEAD~1']);\n write(\n 'src/util.js',\n 'export const id = (x) => x;\\nexport const tag = (x) => x;\\n',\n );\n commit('local1', D_LOCAL1);\n write('src/render.js', 'export function render() {}\\n');\n commit('local2', D_LOCAL2);\n git(['update-ref', 'refs/remotes/origin/main', originMain]);\n git(['config', 'remote.origin.url', '../atlas-web.git']);\n git(['config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*']);\n git(['config', 'branch.feature/login-flow.remote', 'origin']);\n git(['config', 'branch.feature/login-flow.merge', 'refs/heads/main']);\n\n write('README.md', 'atlas-web demo repo (wip)\\n');\n git(\n ['stash', 'push', '-m', 'wip: context refactor', '--', 'README.md'],\n D_STASH,\n );\n\n write('README.md', 'atlas-web demo repo\\n\\nstaged: pin the render loop\\n');\n write(\n 'src/index.js',\n 'export function start() {\\n return Promise.resolve();\\n}\\n',\n );\n git(['add', 'README.md', 'src/index.js']);\n write('src/api.js', `${API_INIT}// local tweak\\n`);\n write('src/style.css', 'body { margin: 0; padding: 0; }\\n');\n write('docs/wip.txt', '');\n write('scratch/todo.md', '');\n write('scripts/deploy.sh', '');\n write('note1.md', '');\n write('note2.md', '');\n return dir;\n}\n","import { spawnSync } from 'node:child_process';\nimport { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { isObject } from './configure.js';\nimport { materializeDemoRepo } from './demo-repo.js';\nimport { capturePath } from './resolve.js';\n\nconst PAYLOADS_DIR = fileURLToPath(\n new URL('../assets/payloads', import.meta.url),\n);\nconst TICKS_DIR = fileURLToPath(new URL('../assets/ticks', import.meta.url));\n\nconst P1_WARM_IN = 1920;\nconst P1_RESETS_IN: Readonly<Record<string, number>> = {\n five_hour: 13830,\n seven_day: 518400,\n spend_limit: 950400,\n};\nconst PANEL_STEP_S = 300;\n\nexport interface RenderSpec {\n readonly bin: string;\n readonly env: Readonly<Record<string, string>>;\n readonly stdin: string;\n}\n\nexport interface PreviewSources {\n readonly cleanup: () => void;\n readonly main: string;\n readonly tick: string;\n}\n\ntype Loose = Record<string, unknown>;\n\nfunction anchoredP1(repoDir: string, now: number): string {\n const payload = JSON.parse(\n readFileSync(join(PAYLOADS_DIR, 'p1.json'), 'utf8'),\n ) as Loose;\n const cache = payload.prompt_cache;\n if (isObject(cache)) {\n if (cache.warm === true) {\n cache.expires_at = now + P1_WARM_IN;\n cache.last_miss_at = now + P1_WARM_IN - 3900;\n } else {\n cache.expires_at = now - 10;\n delete cache.last_miss_at;\n }\n }\n const limits = payload.rate_limits;\n if (isObject(limits)) {\n for (const [limitKey, offset] of Object.entries(P1_RESETS_IN)) {\n const limit = limits[limitKey];\n if (isObject(limit)) {\n limit.resets_at = now + offset;\n }\n }\n }\n (payload.workspace as { current_dir: string }).current_dir = repoDir;\n return `${JSON.stringify(payload, null, 2)}\\n`;\n}\n\nfunction hasStart(value: unknown): boolean {\n return typeof value === 'number' && Number.isFinite(value) && value > 0;\n}\n\n// subagent.sh drops a row's duration unless its start is at or before NOW\n// (the elapsed >= 0 guard), so the demo schedule staggers every started row\n// strictly into the past — ids and order ride over untouched.\nfunction anchoredTick(now: number): string {\n const tick = JSON.parse(\n readFileSync(join(TICKS_DIR, 'multi.json'), 'utf8'),\n ) as Loose;\n const tasks = (Array.isArray(tick.tasks) ? tick.tasks : []) as Loose[];\n let started = 0;\n const staggered = {\n ...tick,\n tasks: tasks.map(task => {\n if (!hasStart(task.startTime)) {\n return task;\n }\n started += 1;\n return { ...task, startTime: now - PANEL_STEP_S * started };\n }),\n };\n return `${JSON.stringify(staggered, null, 2)}\\n`;\n}\n\n// A capture renders verbatim; a shipped fixture is anchored to the render\n// moment and pointed at a freshly materialized demo repo so the git segments\n// preview. The repo is torn down with the preview's last render.\nexport function previewSources(home: string, now: number): PreviewSources {\n const mainCapture = capturePath(home, 'main');\n if (existsSync(mainCapture)) {\n const tickCapture = capturePath(home, 'tick');\n return {\n cleanup: () => undefined,\n main: readFileSync(mainCapture, 'utf8'),\n tick: existsSync(tickCapture)\n ? readFileSync(tickCapture, 'utf8')\n : anchoredTick(now),\n };\n }\n const demoHome = mkdtempSync(join(tmpdir(), 'statusline-preview-'));\n return {\n cleanup: () => {\n rmSync(demoHome, { recursive: true, force: true });\n },\n main: anchoredP1(materializeDemoRepo(demoHome), now),\n tick: anchoredTick(now),\n };\n}\n\n// subagent.sh answers with one {\"id\",\"content\"} JSON line per task; a frame\n// carries the first row's content.\nexport function firstPanelRow(output: string): string {\n const [row] = output.split('\\n');\n if (row === '') {\n return '';\n }\n const content = (JSON.parse(row) as { content?: unknown }).content;\n return typeof content === 'string' ? content : '';\n}\n\nexport function runtimeRenderer(spec: RenderSpec): string {\n const run = spawnSync('bash', [spec.bin], {\n input: spec.stdin,\n env: {\n PATH: process.env.PATH ?? '',\n ...spec.env,\n LC_ALL: 'C',\n TZ: 'UTC',\n },\n timeout: 30_000,\n });\n if (run.status !== 0) {\n throw new Error(`render failed: ${run.stderr.toString('utf8')}`);\n }\n const stdout = run.stdout.toString('utf8');\n const warn = run.stderr.toString('utf8').trim();\n return warn === '' ? stdout : `${stdout}${warn}\\n`;\n}\n","import {\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n writeFileSync,\n} from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport { firstPanelRow, previewSources, runtimeRenderer } from './payloads.js';\nimport {\n backupPath,\n isOurMainCommand,\n mainKeyValue,\n readKeyConfig,\n type ResolvedRuntime,\n resolveRuntime,\n subagentKeyValue,\n} from './resolve.js';\n\nexport interface ConfigureOptions {\n readonly dryRun?: boolean;\n readonly fallback?: 'default' | 'existing';\n readonly force?: boolean;\n readonly home: string;\n readonly layout?: string;\n readonly variants?: Readonly<Record<string, string>>;\n}\n\nexport type ConfigureResult =\n | { mode: 'dry-run'; text: string }\n | { mode: 'printed'; text: string }\n | { mode: 'written' };\n\nexport type SettingsKey = 'statusLine' | 'subagentStatusLine';\n\nexport const SETTINGS_KEYS = ['statusLine', 'subagentStatusLine'] as const;\n\nexport function layoutItems(\n layout: string,\n valid: readonly string[],\n): string[] {\n const known = new Set(valid);\n const items: string[] = [];\n for (const cluster of parseClusters(layout)) {\n for (const word of cluster) {\n if (!known.has(word)) {\n throw new Error(\n `unknown layout item '${word}' — valid items: ${valid.join(' ')}`,\n );\n }\n if (!items.includes(word)) {\n items.push(word);\n }\n }\n }\n return items;\n}\n\nexport function parseClusters(layout: string): string[][] {\n const clusters: string[][] = [];\n let words: string[] = [];\n let word = '';\n let open = false;\n function pushWord(): void {\n if (word !== '') {\n words.push(word);\n word = '';\n }\n }\n for (const c of layout) {\n if (c === '{') {\n if (open) {\n throw new Error(`layout '${layout}': '{' inside a cluster`);\n }\n open = true;\n words = [];\n } else if (c === '}') {\n if (!open) {\n throw new Error(`layout '${layout}': '}' outside a cluster`);\n }\n pushWord();\n open = false;\n if (words.length > 0) {\n clusters.push(words);\n }\n } else if (c === ' ') {\n if (open) {\n pushWord();\n } else if (word !== '') {\n throw new Error(`layout '${layout}': '${word}' sits outside a cluster`);\n }\n } else if (/[a-z0-9]/.test(c)) {\n word += c;\n } else {\n throw new Error(\n `layout '${layout}': '${c}' is not layout grammar (braces, item ids, spaces)`,\n );\n }\n }\n if (open) {\n throw new Error(`layout '${layout}': unterminated cluster`);\n }\n if (word !== '') {\n throw new Error(`layout '${layout}': '${word}' sits outside a cluster`);\n }\n if (clusters.length === 0) {\n throw new Error(`layout '${layout}': no clusters`);\n }\n return clusters;\n}\n\nexport function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function readOrNull(file: string): null | string {\n try {\n return readFileSync(file, 'utf8');\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code === 'ENOENT') {\n return null;\n }\n throw e;\n }\n}\n\nexport function parseSettings(\n file: string,\n raw: string,\n): Record<string, unknown> {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n throw new Error(`${file} is not valid JSON`, { cause: e });\n }\n if (!isObject(parsed)) {\n throw new Error(`${file} does not hold a settings object`);\n }\n return parsed;\n}\n\nexport function memberCommand(value: unknown): null | string {\n if (!isObject(value) || value.type !== 'command') {\n return null;\n }\n return typeof value.command === 'string' ? value.command : null;\n}\n\nexport function isOurMember(key: SettingsKey, value: unknown): boolean {\n const command = memberCommand(value);\n if (command === null) {\n return false;\n }\n return key === 'statusLine'\n ? isOurMainCommand(command)\n : command === subagentKeyValue;\n}\n\ninterface SettingsPlan {\n readonly adds: readonly (readonly [SettingsKey, string])[];\n readonly file: string;\n readonly raw: null | string;\n readonly repoints: readonly (readonly [SettingsKey, string])[];\n}\n\nfunction planSettings(\n home: string,\n mainCommand: string,\n force: boolean,\n): SettingsPlan {\n const file = join(home, '.claude', 'settings.json');\n const wanted: Readonly<Record<SettingsKey, string>> = {\n statusLine: mainCommand,\n subagentStatusLine: subagentKeyValue,\n };\n const raw = readOrNull(file);\n if (raw === null) {\n return {\n adds: SETTINGS_KEYS.map(key => [key, wanted[key]] as const),\n file,\n raw: null,\n repoints: [],\n };\n }\n const parsed = parseSettings(file, raw);\n const adds: (readonly [SettingsKey, string])[] = [];\n const repoints: (readonly [SettingsKey, string])[] = [];\n for (const key of SETTINGS_KEYS) {\n const command = wanted[key];\n const value = parsed[key];\n if (value === undefined) {\n adds.push([key, command]);\n } else if (memberCommand(value) === command) {\n continue;\n } else if (isOurMember(key, value) || force) {\n repoints.push([key, command]);\n } else {\n throw new Error(\n `settings.json ${key} is foreign — rerun with --force added to your configuration flags to take it over`,\n );\n }\n }\n return { adds, file, raw, repoints };\n}\n\nexport function settingsValue(command: string): string {\n return JSON.stringify({ command, type: 'command' });\n}\n\nfunction skipString(raw: string, at: number): number {\n let i = at + 1;\n while (i < raw.length) {\n if (raw[i] === '\\\\') {\n i += 2;\n } else if (raw[i] === '\"') {\n return i + 1;\n } else {\n i += 1;\n }\n }\n throw new Error('unterminated string in settings.json');\n}\n\nfunction skipValue(raw: string, at: number): number {\n const first = raw[at];\n if (first === '\"') {\n return skipString(raw, at);\n }\n if (first === '{' || first === '[') {\n let depth = 0;\n let i = at;\n while (i < raw.length) {\n const c = raw[i];\n if (c === '\"') {\n i = skipString(raw, i);\n } else if (c === '{' || c === '[') {\n depth += 1;\n i += 1;\n } else if (c === '}' || c === ']') {\n depth -= 1;\n i += 1;\n if (depth === 0) {\n return i;\n }\n } else {\n i += 1;\n }\n }\n throw new Error('unterminated container in settings.json');\n }\n let i = at;\n while (\n i < raw.length &&\n !',}]'.includes(raw[i] ?? '') &&\n !/\\s/.test(raw[i] ?? '~')\n ) {\n i += 1;\n }\n return i;\n}\n\ninterface RootMember {\n readonly name: string;\n readonly nameStart: number;\n readonly valueEnd: number;\n readonly valueStart: number;\n}\n\nfunction rootMembers(raw: string): readonly RootMember[] {\n const members: RootMember[] = [];\n let i = raw.indexOf('{') + 1;\n while (i < raw.length) {\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] === '}') {\n break;\n }\n if (raw[i] !== '\"') {\n throw new Error('malformed member in settings.json');\n }\n const nameStart = i;\n const nameEnd = skipString(raw, i);\n const name = JSON.parse(raw.slice(i, nameEnd)) as string;\n i = nameEnd;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] !== ':') {\n throw new Error('malformed member in settings.json');\n }\n i += 1;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n const valueStart = i;\n const valueEnd = skipValue(raw, i);\n members.push({ name, nameStart, valueEnd, valueStart });\n i = valueEnd;\n while (/\\s/.test(raw[i] ?? '~')) {\n i += 1;\n }\n if (raw[i] === ',') {\n i += 1;\n } else if (raw[i] !== '}') {\n throw new Error('malformed member in settings.json');\n }\n }\n return members;\n}\n\nexport function rootMemberValueSpan(\n raw: string,\n key: string,\n): null | readonly [number, number] {\n const member = rootMembers(raw).find(m => m.name === key);\n return member === undefined ? null : [member.valueStart, member.valueEnd];\n}\n\nexport function removeMembers(raw: string, keys: readonly string[]): string {\n let text = raw;\n for (const key of keys) {\n const members = rootMembers(text);\n const at = members.findIndex(m => m.name === key);\n if (at === -1) {\n throw new Error(\n `cannot find the \"${key}\" member to remove in settings.json`,\n );\n }\n if (members.length === 1) {\n return '{}';\n }\n const member = members[at];\n if (at > 0) {\n let start = member.nameStart;\n while (/\\s/.test(text[start - 1] ?? '~')) {\n start -= 1;\n }\n text = `${text.slice(0, start - 1)}${text.slice(member.valueEnd)}`;\n } else {\n text = `${text.slice(0, member.nameStart)}${text.slice(members[1].nameStart)}`;\n }\n }\n return text;\n}\n\nexport function insertMembers(\n raw: string,\n members: readonly (readonly [SettingsKey, string])[],\n): string {\n const close = raw.lastIndexOf('}');\n if (close === -1) {\n throw new Error('settings.json has no closing brace to splice into');\n }\n let at = close;\n while (/\\s/.test(raw[at - 1] ?? '~')) {\n at -= 1;\n }\n const comma = raw.replace(/\\s/g, '') === '{}' ? '' : ',';\n return `${raw.slice(0, at)}${comma}\\n ${renderMembers(members)}${raw.slice(at)}`;\n}\n\nfunction renderMembers(\n members: readonly (readonly [string, string])[],\n): string {\n return members\n .map(([key, command]) => `\"${key}\": ${settingsValue(command)}`)\n .join(',\\n ');\n}\n\n/** Splice each rendered value over its root member. */\nexport function repointRootMembers(\n raw: string,\n entries: readonly { key: string; value: string }[],\n): string {\n let text = raw;\n for (const { key, value } of entries) {\n const span = rootMemberValueSpan(text, key);\n if (span === null) {\n throw new Error(`cannot find the \"${key}\" member in settings.json`);\n }\n text = `${text.slice(0, span[0])}${value}${text.slice(span[1])}`;\n }\n return text;\n}\n\nfunction splicedSettings(raw: string, plan: SettingsPlan): string {\n const text = plan.adds.length > 0 ? insertMembers(raw, plan.adds) : raw;\n return repointRootMembers(\n text,\n plan.repoints.map(([key, command]) => ({\n key,\n value: settingsValue(command),\n })),\n );\n}\n\nexport interface SettingsBackup {\n readonly createdFile: boolean;\n readonly keys: Readonly<Partial<Record<SettingsKey, string>>>;\n}\n\nfunction writeBackupIfAbsent(home: string, plan: SettingsPlan): void {\n const file = backupPath(home);\n if (existsSync(file)) {\n return;\n }\n const keys: Partial<Record<SettingsKey, string>> = {};\n if (plan.raw !== null) {\n for (const key of SETTINGS_KEYS) {\n const span = rootMemberValueSpan(plan.raw, key);\n if (span === null) {\n continue;\n }\n const memberRaw = plan.raw.slice(span[0], span[1]);\n if (isOurMember(key, JSON.parse(memberRaw))) {\n continue;\n }\n keys[key] = memberRaw;\n }\n }\n const dir = dirname(file);\n mkdirSync(dir, { recursive: true });\n const tmp = `${file}.tmp`;\n writeFileSync(\n tmp,\n `${JSON.stringify({ createdFile: plan.raw === null, keys }, null, 2)}\\n`,\n );\n renameSync(tmp, file);\n}\n\nfunction commitSettings(plan: SettingsPlan): void {\n if (plan.raw === null) {\n mkdirSync(dirname(plan.file), { recursive: true });\n const members = plan.adds\n .map(([key, command]) => `\"${key}\": ${settingsValue(command)}`)\n .join(',\\n ');\n writeFileSync(plan.file, `{\\n ${members}\\n}\\n`);\n return;\n }\n if (plan.adds.length === 0 && plan.repoints.length === 0) {\n return;\n }\n writeFileSync(plan.file, splicedSettings(plan.raw, plan));\n}\n\nfunction renderPreview(\n runtime: ResolvedRuntime,\n home: string,\n values: Readonly<Record<string, string>>,\n layout: string,\n now: string,\n): string {\n const sources = previewSources(home, Number(now));\n try {\n const variantEnv = Object.fromEntries(\n Object.entries(values).map(([item, alt]) => [\n `STATUSLINE_LAB_${item.toUpperCase()}`,\n alt,\n ]),\n );\n const line = runtimeRenderer({\n bin: join(runtime.dir, 'statusline.sh'),\n env: {\n COLUMNS: '200',\n HOME: home,\n NOW: now,\n STATUSLINE_LAB_LAYOUT: layout,\n ...variantEnv,\n },\n stdin: sources.main,\n }).replace(/\\n+$/, '');\n const panel = firstPanelRow(\n runtimeRenderer({\n bin: join(runtime.dir, 'subagent.sh'),\n env: { COLUMNS: '200', HOME: home, NOW: now },\n stdin: sources.tick,\n }).replace(/\\n+$/, ''),\n );\n return `dry-run at 200 columns — nothing written\\n${line}\\npanel ${panel}\\n`;\n } finally {\n sources.cleanup();\n }\n}\n\nfunction printedConfig(runtime: ResolvedRuntime, home: string): string {\n const existing = readKeyConfig(home);\n const lines = [\n `layout='${existing.layout ?? runtime.defaultLayout}'`,\n ...runtime.items.map(\n item =>\n `${item.item}=${existingValue(existing.values, item.item) ?? item.default}`,\n ),\n ];\n return [\n ...lines,\n 'nothing written — pass variants (`statusline configure --model block`) or run bare on a TTY for the wizard',\n ].join('\\n');\n}\n\nfunction existingValue(\n values: Readonly<Record<string, string>>,\n item: string,\n): string | undefined {\n return item in values ? values[item] : undefined;\n}\n\nexport function configure(options: ConfigureOptions): ConfigureResult {\n const runtime = resolveRuntime({ home: options.home });\n const existing = readKeyConfig(options.home);\n const variants = options.variants ?? {};\n const explicit =\n options.layout !== undefined || Object.keys(variants).length > 0;\n\n if (!explicit && options.fallback === undefined && !options.dryRun) {\n return { mode: 'printed', text: printedConfig(runtime, options.home) };\n }\n\n const layout =\n options.layout === undefined || options.layout === ''\n ? (existing.layout ?? runtime.defaultLayout)\n : options.layout;\n const byItem = new Map(runtime.items.map(item => [item.item, item]));\n const items = layoutItems(\n layout,\n runtime.items.map(item => item.item),\n );\n\n for (const item of Object.keys(variants)) {\n if (!byItem.has(item)) {\n throw new Error(\n `unknown item '${item}' — valid items: ${[...byItem.keys()].join(' ')}`,\n );\n }\n if (!items.includes(item)) {\n throw new Error(\n `variant for '${item}' is not in the layout (layout items: ${items.join(' ')})`,\n );\n }\n }\n\n const values: Record<string, string> = {};\n for (const item of items) {\n let base: string | undefined;\n if (options.fallback === 'default') {\n base = byItem.get(item)?.default;\n } else if (options.fallback === 'existing') {\n base = existingValue(existing.values, item);\n } else if (!explicit) {\n base = existingValue(existing.values, item) ?? byItem.get(item)?.default;\n }\n if (base !== undefined) {\n values[item] = base;\n }\n }\n const missing = items.filter(\n item => !(item in values) && !(item in variants),\n );\n if (missing.length > 0) {\n throw new Error(\n `no variant for layout item${missing.length > 1 ? 's' : ''} ${missing.join(' ')} — pass --<item> <alt> for each or use --fallback=default|existing`,\n );\n }\n for (const [item, alt] of Object.entries(variants)) {\n values[item] = alt;\n }\n for (const item of items) {\n const alt = values[item];\n const offered = byItem.get(item)?.alternatives ?? [];\n if (!offered.includes(alt)) {\n throw new Error(\n `unknown variant '${alt}' for item '${item}' — valid: ${offered.join(' | ')}`,\n );\n }\n }\n\n if (options.dryRun) {\n const now = String(Math.floor(Date.now() / 1000));\n return {\n mode: 'dry-run',\n text: renderPreview(runtime, options.home, values, layout, now),\n };\n }\n\n const assignments = items.map(\n item => `STATUSLINE_LAB_${item.toUpperCase()}=${values[item]}`,\n );\n const plan = planSettings(\n options.home,\n mainKeyValue(layout, assignments),\n options.force ?? false,\n );\n if (plan.adds.length > 0 || plan.repoints.length > 0) {\n writeBackupIfAbsent(options.home, plan);\n }\n commitSettings(plan);\n return { mode: 'written' };\n}\n","import {\n existsSync,\n readdirSync,\n rmdirSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { join } from 'node:path';\n\nimport {\n isObject,\n isOurMember,\n readOrNull,\n removeMembers,\n repointRootMembers,\n rootMemberValueSpan,\n SETTINGS_KEYS,\n type SettingsBackup,\n type SettingsKey,\n} from './configure.js';\nimport { backupPath, DATA_REL } from './resolve.js';\n\nexport interface RestoreOptions {\n readonly dryRun?: boolean;\n readonly force?: boolean;\n readonly home: string;\n}\n\nexport type RestoreResult =\n | { mode: 'dry-run'; text: string }\n | { mode: 'nothing'; text: string }\n | { mode: 'restored'; text: string };\n\ntype KeyAction =\n | { readonly key: SettingsKey; readonly kind: 'remove' }\n | {\n readonly key: SettingsKey;\n readonly kind: 'splice';\n readonly text: string;\n };\n\nexport function readBackup(home: string): null | SettingsBackup {\n const file = backupPath(home);\n const raw = readOrNull(file);\n if (raw === null) {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (e) {\n throw new Error(`${file} is not valid JSON`, { cause: e });\n }\n if (\n !isObject(parsed) ||\n typeof parsed.createdFile !== 'boolean' ||\n !isObject(parsed.keys)\n ) {\n throw new Error(`${file} is not a lab backup`);\n }\n const keys: Partial<Record<SettingsKey, string>> = {};\n for (const key of SETTINGS_KEYS) {\n const saved = parsed.keys[key];\n if (typeof saved === 'string') {\n keys[key] = saved;\n }\n }\n return { createdFile: parsed.createdFile, keys };\n}\n\nfunction rmdirIfEmpty(dir: string): void {\n try {\n rmdirSync(dir);\n } catch (e) {\n const code = (e as NodeJS.ErrnoException).code;\n if (code !== 'ENOTEMPTY' && code !== 'ENOENT' && code !== 'ENOTDIR') {\n throw e;\n }\n }\n}\n\nfunction clearCaptures(dir: string): void {\n if (!existsSync(dir)) {\n return;\n }\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (entry.isFile()) {\n rmSync(join(dir, entry.name), { force: true });\n }\n }\n rmdirIfEmpty(dir);\n}\n\nfunction planActions(\n raw: string,\n backup: null | SettingsBackup,\n force: boolean,\n): readonly KeyAction[] {\n const actions: KeyAction[] = [];\n for (const key of SETTINGS_KEYS) {\n const span = rootMemberValueSpan(raw, key);\n if (span === null) {\n continue;\n }\n const memberRaw = raw.slice(span[0], span[1]);\n const saved = backup === null ? undefined : backup.keys[key];\n if (isOurMember(key, JSON.parse(memberRaw))) {\n actions.push(\n saved === undefined\n ? { kind: 'remove', key }\n : { kind: 'splice', key, text: saved },\n );\n } else if (saved !== undefined && memberRaw !== saved) {\n if (!force) {\n throw new Error(\n `settings.json ${key} changed since the lab took it over — rerun with --force to put the saved value back`,\n );\n }\n actions.push({ kind: 'splice', key, text: saved });\n }\n }\n return actions;\n}\n\nexport function restore(options: RestoreOptions): RestoreResult {\n const settings = join(options.home, '.claude', 'settings.json');\n const backup = readBackup(options.home);\n const raw = readOrNull(settings);\n\n const actions =\n raw === null ? [] : planActions(raw, backup, options.force ?? false);\n const removals: SettingsKey[] = [];\n const splices: { key: SettingsKey; text: string }[] = [];\n for (const action of actions) {\n if (action.kind === 'remove') {\n removals.push(action.key);\n } else {\n splices.push(action);\n }\n }\n\n let next: null | string = raw;\n let deleteFile = false;\n if (actions.length > 0 && raw !== null) {\n const stripped = removals.length > 0 ? removeMembers(raw, removals) : raw;\n const text = repointRootMembers(\n stripped,\n splices.map(({ key, text: value }) => ({ key, value })),\n );\n const membersLeft = Object.keys(JSON.parse(text) as object).length;\n if (backup !== null && backup.createdFile && membersLeft === 0) {\n deleteFile = true;\n next = null;\n } else {\n next = text;\n }\n }\n\n const dataDir = join(options.home, DATA_REL);\n const capturesDir = join(dataDir, 'captures');\n const backupFile = backupPath(options.home);\n if (\n actions.length === 0 &&\n !existsSync(backupFile) &&\n !existsSync(capturesDir)\n ) {\n return {\n mode: 'nothing',\n text: 'nothing to restore — no lab keys in settings.json, no backup, no captures',\n };\n }\n\n if (options.dryRun) {\n const lines = ['restore plan — nothing written'];\n for (const action of actions) {\n lines.push(\n action.kind === 'remove'\n ? ` remove ${action.key} (absent before the lab)`\n : ` splice the saved ${action.key} value back`,\n );\n }\n if (deleteFile) {\n lines.push(\n ' delete settings.json (the lab created it and it is now empty)',\n );\n }\n if (existsSync(capturesDir)) {\n lines.push(' delete captures/');\n }\n if (existsSync(backupFile)) {\n lines.push(' delete backup.json');\n }\n lines.push(' remove the data dir if empty');\n return { mode: 'dry-run', text: lines.join('\\n') };\n }\n\n if (deleteFile) {\n rmSync(settings, { force: true });\n } else if (next !== null && actions.length > 0) {\n writeFileSync(settings, next);\n }\n clearCaptures(capturesDir);\n rmSync(backupFile, { force: true });\n rmdirIfEmpty(dataDir);\n let line: string;\n if (deleteFile) {\n line = 'restored — settings.json is gone, exactly as before the lab';\n } else if (actions.length > 0) {\n line = 'keys restored — settings.json holds its pre-lab values again';\n } else {\n line = 'lab data cleaned — no lab keys in settings.json';\n }\n return { mode: 'restored', text: line };\n}\n","import { statSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\n\nimport {\n isOurMember,\n memberCommand,\n parseClusters,\n parseSettings,\n readOrNull,\n SETTINGS_KEYS,\n type SettingsBackup,\n type SettingsKey,\n} from './configure.js';\nimport {\n capturePath,\n DATA_REL,\n readKeyConfig,\n type ResolvedRuntime,\n resolveRuntime,\n type ScriptConfig,\n} from './resolve.js';\nimport { readBackup } from './restore.js';\n\nexport interface StatusOptions {\n readonly home: string;\n}\n\nexport interface StatusResult {\n readonly healthy: boolean;\n readonly rows: readonly string[];\n}\n\nconst INSTALL_FIX = 'claude plugin install statusline@agentic';\n\ntype KeyState =\n | { readonly command: null | string; readonly kind: 'foreign' }\n | { readonly kind: 'absent' }\n | { readonly kind: 'ours' };\n\nfunction keyState(key: SettingsKey, value: unknown): KeyState {\n if (value === undefined) {\n return { kind: 'absent' };\n }\n if (isOurMember(key, value)) {\n return { kind: 'ours' };\n }\n return { kind: 'foreign', command: memberCommand(value) };\n}\n\nfunction keyRow(key: SettingsKey, state: KeyState, detail = ''): string {\n if (state.kind === 'ours') {\n return `${key}: ours${detail === '' ? '' : ` — ${detail}`}`;\n }\n if (state.kind === 'absent') {\n return `${key}: absent — fix: rerun configure --fallback=default`;\n }\n return `${key}: foreign${state.command === null ? '' : ` (${state.command})`} — fix: rerun configure --force --fallback=default`;\n}\n\nfunction layoutItemsOf(layout: string): readonly string[] {\n const items: string[] = [];\n for (const cluster of parseClusters(layout)) {\n for (const item of cluster) {\n if (!items.includes(item)) {\n items.push(item);\n }\n }\n }\n return items;\n}\n\nfunction configDetail(config: ScriptConfig): string {\n if (config.layout === null) {\n return '';\n }\n const assignments = layoutItemsOf(config.layout)\n .filter(item => Object.hasOwn(config.values, item))\n .map(item => `${item}=${config.values[item]}`);\n return [`layout='${config.layout}'`, ...assignments].join(' ');\n}\n\ntype DriftFinding =\n | {\n readonly alt: string;\n readonly item: string;\n readonly kind: 'unknown-variant';\n }\n | { readonly item: string; readonly kind: 'unknown-item' };\n\nfunction findingText(finding: DriftFinding): string {\n return finding.kind === 'unknown-item'\n ? `unknown item '${finding.item}'`\n : `unknown variant '${finding.alt}' for '${finding.item}'`;\n}\n\nfunction driftFindings(\n config: ScriptConfig,\n runtime: ResolvedRuntime,\n): readonly DriftFinding[] {\n if (config.layout === null) {\n return [];\n }\n const byItem = new Map(runtime.items.map(entry => [entry.item, entry]));\n const findings: DriftFinding[] = [];\n for (const item of layoutItemsOf(config.layout)) {\n const entry = byItem.get(item);\n if (entry === undefined) {\n findings.push({ item, kind: 'unknown-item' });\n continue;\n }\n const alt = Object.hasOwn(config.values, item) ? config.values[item] : null;\n if (alt !== null && !entry.alternatives.includes(alt)) {\n findings.push({ alt, item, kind: 'unknown-variant' });\n }\n }\n return findings;\n}\n\nfunction runtimeRow(runtime: null | ResolvedRuntime): string {\n if (runtime === null) {\n return `runtime: missing — fix: ${INSTALL_FIX}`;\n }\n const version = basename(dirname(runtime.dir));\n return `runtime: ${version} — ${runtime.items.length} items`;\n}\n\nfunction configRow(\n findings: readonly DriftFinding[],\n runtime: ResolvedRuntime,\n): string {\n if (findings.length === 0) {\n return 'config: no drift';\n }\n const fix = findings.some(finding => finding.kind === 'unknown-item')\n ? `rerun configure --layout '${runtime.defaultLayout}' --fallback=default`\n : 'rerun configure --fallback=default';\n return `config: drift — ${findings.map(findingText).join(', ')} — fix: ${fix}`;\n}\n\nfunction backupRow(home: string): string {\n let backup: null | SettingsBackup;\n try {\n backup = readBackup(home);\n } catch {\n return `backup: unreadable — fix: delete ~/${DATA_REL}/backup.json`;\n }\n if (backup === null) {\n return 'backup: absent';\n }\n const saved = SETTINGS_KEYS.filter(key => backup.keys[key] !== undefined);\n const parts = [\n ...(backup.createdFile ? ['created settings.json'] : []),\n saved.length > 0 ? `saved ${saved.join(', ')}` : 'saved nothing',\n ];\n return `backup: present — ${parts.join(', ')}`;\n}\n\nfunction ageText(ms: number): string {\n const minutes = Math.floor(ms / 60000);\n if (minutes < 1) {\n return `${Math.floor(ms / 1000)}s`;\n }\n if (minutes < 60) {\n return `${minutes}m`;\n }\n const hours = Math.floor(minutes / 60);\n if (hours < 24) {\n return `${hours}h`;\n }\n return `${Math.floor(hours / 24)}d`;\n}\n\nfunction captureText(home: string, surface: 'main' | 'tick'): string {\n try {\n const age = ageText(\n Date.now() - statSync(capturePath(home, surface)).mtimeMs,\n );\n return `${age} ago`;\n } catch {\n return 'absent';\n }\n}\n\nfunction capturesRow(home: string): string {\n const surfaces = (['main', 'tick'] as const).map(\n surface => `${surface} ${captureText(home, surface)}`,\n );\n return `captures: ${surfaces.join(', ')}`;\n}\n\nfunction settingsMembers(home: string): Record<string, unknown> {\n const file = join(home, '.claude', 'settings.json');\n const raw = readOrNull(file);\n return raw === null ? {} : parseSettings(file, raw);\n}\n\nfunction resolveOrNull(home: string): null | ResolvedRuntime {\n try {\n return resolveRuntime({ home });\n } catch {\n return null;\n }\n}\n\nexport function status(options: StatusOptions): StatusResult {\n const runtime = resolveOrNull(options.home);\n const members = settingsMembers(options.home);\n const main = keyState('statusLine', members.statusLine);\n const subagent = keyState('subagentStatusLine', members.subagentStatusLine);\n const config = readKeyConfig(options.home);\n const findings =\n runtime === null || main.kind !== 'ours'\n ? []\n : driftFindings(config, runtime);\n\n const rows = [\n runtimeRow(runtime),\n keyRow('statusLine', main, configDetail(config)),\n keyRow('subagentStatusLine', subagent),\n ...(runtime !== null && main.kind === 'ours'\n ? [configRow(findings, runtime)]\n : []),\n backupRow(options.home),\n capturesRow(options.home),\n ];\n const healthy =\n runtime !== null &&\n main.kind === 'ours' &&\n subagent.kind === 'ours' &&\n findings.length === 0;\n return { healthy, rows: [...rows, healthy ? 'healthy' : 'unhealthy'] };\n}\n","import type { RenderSpec } from './payloads.js';\nimport type { WizardDeps } from './wizard.js';\n\nimport { runtimeRenderer } from './payloads.js';\n\nfunction nextKey(buffer: string): readonly [string, string] | undefined {\n if (buffer === '') {\n return undefined;\n }\n const head = buffer[0];\n if (head !== '\\x1b') {\n return [head, buffer.slice(1)];\n }\n if (buffer.length < 3) {\n return undefined;\n }\n if (buffer[1] === '[' && 'ABCD'.includes(buffer[2])) {\n return [buffer.slice(0, 3), buffer.slice(3)];\n }\n return ['', buffer.slice(1)];\n}\n\nexport function terminalDeps(\n input: NodeJS.ReadStream = process.stdin,\n output: NodeJS.WriteStream = process.stdout,\n): WizardDeps {\n return {\n async *readKeys(): AsyncGenerator<string> {\n const chunks: string[] = [];\n const waiters: (() => void)[] = [];\n const state = { closed: false };\n function notify(): void {\n for (const wake of waiters.splice(0)) {\n wake();\n }\n }\n function onData(chunk: Buffer): void {\n chunks.push(chunk.toString('utf8'));\n notify();\n }\n function onEnd(): void {\n state.closed = true;\n notify();\n }\n input.on('data', onData);\n input.on('end', onEnd);\n input.on('close', onEnd);\n if (input.isTTY) {\n input.setRawMode(true);\n }\n input.resume();\n try {\n let buffer = '';\n for (;;) {\n for (\n let chunk = chunks.shift();\n chunk !== undefined;\n chunk = chunks.shift()\n ) {\n buffer += chunk;\n }\n while (buffer !== '') {\n const next = nextKey(buffer);\n if (next === undefined) {\n break;\n }\n buffer = next[1];\n if (next[0] !== '') {\n yield next[0];\n }\n }\n if (state.closed && chunks.length === 0) {\n return;\n }\n await new Promise<void>(resolve => {\n waiters.push(resolve);\n });\n }\n } finally {\n if (input.isTTY) {\n input.setRawMode(false);\n }\n input.pause();\n input.off('data', onData);\n input.off('end', onEnd);\n input.off('close', onEnd);\n }\n },\n render(frame: string): void {\n output.write(`\\x1b[2J\\x1b[H${frame}\\n`);\n },\n preview(spec: RenderSpec): string {\n return runtimeRenderer(spec);\n },\n };\n}\n","import { join } from 'node:path';\n\nimport type { RenderSpec } from './payloads.js';\nimport type { RuntimeItem } from './resolve.js';\n\nimport { VERSION } from './cli.js';\nimport { configure, layoutItems } from './configure.js';\nimport { firstPanelRow, previewSources } from './payloads.js';\nimport { readKeyConfig, resolveRuntime } from './resolve.js';\n\nexport interface WizardDeps {\n preview(spec: RenderSpec): string;\n readKeys(): AsyncGenerator<string>;\n render(frame: string): void;\n}\n\nexport type WizardOutcome = 'cancelled' | 'save-failed' | 'saved';\n\nexport interface WizardOptions {\n readonly home: string;\n readonly now: string;\n}\n\nconst WIDTHS: readonly number[] = [80, 120, 200];\nconst KEYMAP =\n 'j/k move · h/l variant · s none · w width · enter save · q cancel';\n\nexport async function createWizard(\n options: WizardOptions,\n deps: WizardDeps,\n): Promise<WizardOutcome> {\n const runtime = resolveRuntime({ home: options.home });\n const existing = readKeyConfig(options.home);\n const layout = existing.layout ?? runtime.defaultLayout;\n const byItem = new Map<string, RuntimeItem>(\n runtime.items.map(item => [item.item, item] as const),\n );\n const names = layoutItems(\n layout,\n runtime.items.map(item => item.item),\n );\n const offered: {\n readonly alternatives: readonly string[];\n readonly item: string;\n }[] = [];\n const draft = new Map<string, string>();\n for (const name of names) {\n const entry = byItem.get(name);\n if (entry === undefined) {\n continue;\n }\n offered.push({ alternatives: entry.alternatives, item: name });\n draft.set(\n name,\n name in existing.values &&\n entry.alternatives.includes(existing.values[name])\n ? existing.values[name]\n : entry.default,\n );\n }\n const sources = previewSources(options.home, Number(options.now));\n const mainBin = join(runtime.dir, 'statusline.sh');\n const panelBin = join(runtime.dir, 'subagent.sh');\n\n let focus = 0;\n let widthAt = 0;\n\n function variantEnv(): Record<string, string> {\n return Object.fromEntries(\n [...draft].map(([item, alt]) => [\n `STATUSLINE_LAB_${item.toUpperCase()}`,\n alt,\n ]),\n );\n }\n\n function env(): Record<string, string> {\n return {\n COLUMNS: String(WIDTHS[widthAt]),\n HOME: options.home,\n NOW: options.now,\n STATUSLINE_LAB_LAYOUT: layout,\n ...variantEnv(),\n };\n }\n\n function cycle(delta: number): void {\n const focused = offered.at(focus);\n if (focused === undefined || focused.alternatives.length === 0) {\n return;\n }\n const alts = focused.alternatives;\n const at = alts.indexOf(draft.get(focused.item) ?? '');\n draft.set(focused.item, alts[(at + delta + alts.length) % alts.length]);\n }\n\n function step(key: string): void {\n if (key === '\\x1b[B' || key === 'j') {\n focus = (focus + 1) % offered.length;\n } else if (key === '\\x1b[A' || key === 'k') {\n focus = (focus + offered.length - 1) % offered.length;\n } else if (key === '\\x1b[C' || key === 'l') {\n cycle(1);\n } else if (key === '\\x1b[D' || key === 'h') {\n cycle(-1);\n } else if (key === 's') {\n const focused = offered.at(focus);\n if (focused?.alternatives.includes('none')) {\n draft.set(focused.item, 'none');\n }\n } else if (key === 'w') {\n widthAt = (widthAt + 1) % WIDTHS.length;\n }\n }\n\n function draw(): void {\n const focused = offered.at(focus);\n if (focused === undefined) {\n return;\n }\n const samples = focused.alternatives.map(alt =>\n deps\n .preview({\n bin: mainBin,\n env: {\n ...env(),\n STATUSLINE_LAB_LAYOUT: `{${focused.item}}`,\n [`STATUSLINE_LAB_${focused.item.toUpperCase()}`]: alt,\n },\n stdin: sources.main,\n })\n .replace(/\\n+$/, ''),\n );\n const line = deps\n .preview({ bin: mainBin, env: env(), stdin: sources.main })\n .replace(/\\n+$/, '');\n // subagent.sh reads the width out of the tick itself, not COLUMNS.\n const tick = JSON.parse(sources.tick) as { columns?: number };\n tick.columns = WIDTHS[widthAt];\n const panel = deps\n .preview({\n bin: panelBin,\n env: {\n COLUMNS: String(WIDTHS[widthAt]),\n HOME: options.home,\n NOW: options.now,\n },\n stdin: `${JSON.stringify(tick, null, 2)}\\n`,\n })\n .replace(/\\n+$/, '');\n const rows = offered.map(\n (entry, at) =>\n `${at === focus ? '>' : ' '} ${entry.item.padEnd(9)} ${draft.get(entry.item)}`,\n );\n deps.render(\n [\n `statusline configure · ${WIDTHS[widthAt]} columns (w cycles)`,\n '',\n ` ${line}`,\n ` panel ${firstPanelRow(panel)}`,\n '',\n `${focused.item}: ${focused.alternatives.join(' | ')}`,\n ...focused.alternatives.map(\n (alt, at) =>\n ` ${alt === draft.get(focused.item) ? '*' : ' '} ${samples[at]}`,\n ),\n '',\n ...rows,\n '',\n KEYMAP,\n ].join('\\n'),\n );\n }\n\n function finish(): WizardOutcome {\n try {\n configure({\n home: options.home,\n layout,\n variants: Object.fromEntries(draft),\n });\n } catch (e) {\n deps.render(\n `save failed: ${(e as Error).message}\\nfix it and rerun: npx -y @v1nvn/statusline@${VERSION} configure\\n`,\n );\n return 'save-failed';\n }\n deps.render('saved — live on the next paint\\n');\n return 'saved';\n }\n\n try {\n const keys = deps.readKeys();\n draw();\n for await (const key of keys) {\n if (key === '\\r') {\n return finish();\n }\n if (key === 'q' || key === '\\x03') {\n break;\n }\n step(key);\n draw();\n }\n deps.render('cancelled — nothing written\\n');\n return 'cancelled';\n } finally {\n sources.cleanup();\n }\n}\n","import { printUsageAndExit } from '@v1nvn/agentic-core';\n\nimport { catalog } from './catalog.js';\nimport { buildProgram, parseArgs, subcommandHelp, VERSION } from './cli.js';\nimport { configure } from './configure.js';\nimport { restore } from './restore.js';\nimport { status } from './status.js';\nimport { terminalDeps } from './wizard-tui.js';\nimport { createWizard } from './wizard.js';\n\nconst parsed =\n parseArgs(process.argv.slice(2)) ?? printUsageAndExit(buildProgram());\n\nfunction homeOf(flag: string | undefined): string {\n const home = flag ?? process.env.HOME;\n if (home === undefined || home === '') {\n throw new Error('no home to operate on: set $HOME or pass --home');\n }\n return home;\n}\n\nfunction run(job: () => void): void {\n try {\n job();\n } catch (e) {\n console.error((e as Error).message);\n process.exitCode = 1;\n }\n}\n\nif (parsed.help !== undefined) {\n console.log(subcommandHelp(parsed.help));\n} else if (parsed.version) {\n console.log(VERSION);\n} else if (parsed.command === 'catalog') {\n run(() => {\n console.log(catalog({ home: homeOf(parsed.home), items: parsed.items }));\n });\n} else if (parsed.command === 'configure') {\n const home = homeOf(parsed.home);\n const interactive =\n parsed.layout === undefined &&\n parsed.variants === undefined &&\n parsed.fallback === undefined &&\n !parsed.dryRun &&\n !parsed.force;\n if (interactive && process.stdin.isTTY) {\n const outcome = await createWizard(\n { home, now: String(Math.floor(Date.now() / 1000)) },\n terminalDeps(),\n );\n if (outcome === 'save-failed') {\n process.exitCode = 1;\n }\n } else {\n run(() => {\n const result = configure({\n dryRun: parsed.dryRun,\n fallback: parsed.fallback,\n force: parsed.force,\n home,\n layout: parsed.layout,\n variants: parsed.variants,\n });\n console.log(\n result.mode === 'written'\n ? 'configured — live on the next paint'\n : result.text,\n );\n });\n }\n} else if (parsed.command === 'restore') {\n run(() => {\n const result = restore({\n dryRun: parsed.dryRun,\n force: parsed.force,\n home: homeOf(parsed.home),\n });\n console.log(result.text);\n });\n} else if (parsed.command === 'status') {\n run(() => {\n const result = status({ home: homeOf(parsed.home) });\n console.log(result.rows.join('\\n'));\n process.exitCode = result.healthy ? 0 : 1;\n });\n}\n"],"mappings":";;;;;;;;AAoEA,SAAS,aAAa,SAAS,MAAM,SAAS;CAC7C,IAAI;EACH,QAAQ,qBAAqB,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,gBAAgB;GAClE,gBAAgB,KAAK;GACrB,gBAAgB,KAAK;EACtB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;EACpC,OAAO;CACR,SAAS,KAAK;EACb,OAAO,UAAU,GAAG;CACrB;AACD;AACA,SAAS,kBAAkB,SAAS;CACnC,QAAQ,MAAM,QAAQ,gBAAgB,CAAC;CACvC,QAAQ,KAAK,CAAC;AACf;AAsGS,OAAO;;;ACrLhB,IAAa,WAAW,KACtB,WACA,WACA,QACA,oBACF;AAEA,SAAgB,YAAY,MAAc,SAAkC;CAC1E,OAAO,KAAK,MAAM,UAAU,YAAY,GAAG,QAAQ,MAAM;AAC3D;AAEA,SAAgB,WAAW,MAAsB;CAC/C,OAAO,KAAK,MAAM,UAAU,aAAa;AAC3C;AAqBA,IAAa,eACX;AACF,IAAM,cAAc,GAAG,aAAa;AACpC,IAAM,cAAc;AAEpB,SAAgB,aACd,QACA,aACQ;CAER,OAAO,GAAG,cADE,CAAC,0BAA0B,OAAO,IAAI,GAAG,WAAW,CAAC,CAAC,KAAK,GAC/C,EAAI,GAAG;AACjC;AAEA,IAAa,mBAAmB,GAAG,aAAa;AAEhD,SAAgB,iBAAiB,SAA0B;CACzD,OAAO,QAAQ,WAAW,WAAW,KAAK,QAAQ,SAAS,IAAI,aAAa;AA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,QAAQ,WAAW;CAAA,OAGrB,UAAU;EACR,MAAM,SAAS,UAAU;GACvB,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,OAAO,OAAO;GACd;GACA,QAAQ,OAAO;GACf,UAAU,OAAO;EACnB,CAAC;EACD,QAAQ,IACN,OAAO,SAAS,YACZ,wCACA,OAAO,IACb;CACF,CAAC;AAEL,OAAO,IAAI,OAAO,YAAY,WAC5B,UAAU;CACR,MAAM,SAAS,QAAQ;EACrB,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,MAAM,OAAO,OAAO,IAAI;CAC1B,CAAC;CACD,QAAQ,IAAI,OAAO,IAAI;AACzB,CAAC;KACI,IAAI,OAAO,YAAY,UAC5B,UAAU;CACR,MAAM,SAAS,OAAO,EAAE,MAAM,OAAO,OAAO,IAAI,EAAE,CAAC;CACnD,QAAQ,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC;CAClC,QAAQ,WAAW,OAAO,UAAU,IAAI;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v1nvn/statusline",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.2",
|
|
4
4
|
"description": "Browse statusline variants and configure the live status line and agent panel — the statusline CLI behind the statusline plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"node": ">=22"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@v1nvn/agentic-core": "^0.27.
|
|
38
|
+
"@v1nvn/agentic-core": "^0.27.2",
|
|
39
39
|
"commander": "^15.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|