@vreko/cli 3.3.0 → 3.3.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.
Files changed (47) hide show
  1. package/dist/{InitApp-YM5CK55D.js → InitApp-ZMT3KED7.js} +3 -3
  2. package/dist/{InitApp-YM5CK55D.js.map → InitApp-ZMT3KED7.js.map} +1 -1
  3. package/dist/{analysis-ABEO6RTN.js → analysis-PHENF2QA.js} +3 -3
  4. package/dist/{analysis-ABEO6RTN.js.map → analysis-PHENF2QA.js.map} +1 -1
  5. package/dist/{chunk-F7GEJLP7.js → chunk-53CCA4NS.js} +21 -11
  6. package/dist/chunk-53CCA4NS.js.map +1 -0
  7. package/dist/{chunk-FROYVC6U.js → chunk-7TRHJ4SF.js} +5 -5
  8. package/dist/{chunk-FROYVC6U.js.map → chunk-7TRHJ4SF.js.map} +1 -1
  9. package/dist/{chunk-HEUTZR52.js → chunk-MWTSOZTM.js} +3 -2
  10. package/dist/chunk-MWTSOZTM.js.map +1 -0
  11. package/dist/{chunk-3YXBGNHD.js → chunk-V2YKHPZH.js} +3 -3
  12. package/dist/{chunk-3YXBGNHD.js.map → chunk-V2YKHPZH.js.map} +1 -1
  13. package/dist/{chunk-53BJRUUT.js → chunk-XB7D22SX.js} +4 -4
  14. package/dist/{chunk-53BJRUUT.js.map → chunk-XB7D22SX.js.map} +1 -1
  15. package/dist/{dashboardServer-2T7OBLSV.js → dashboardServer-MELKRCBX.js} +3 -3
  16. package/dist/{dashboardServer-2T7OBLSV.js.map → dashboardServer-MELKRCBX.js.map} +1 -1
  17. package/dist/index.js +21 -17
  18. package/dist/index.js.map +1 -1
  19. package/dist/init-command-WJMWYVZN.js +7 -0
  20. package/dist/{init-command-LXEBDSYX.js.map → init-command-WJMWYVZN.js.map} +1 -1
  21. package/dist/{init-core-ETGVVENN.js → init-core-DX4VN3IY.js} +5 -5
  22. package/dist/{init-core-ETGVVENN.js.map → init-core-DX4VN3IY.js.map} +1 -1
  23. package/package.json +1 -2
  24. package/scripts/publish-clean.mjs +14 -3
  25. package/dist/chunk-F7GEJLP7.js.map +0 -1
  26. package/dist/chunk-HEUTZR52.js.map +0 -1
  27. package/dist/init-command-LXEBDSYX.js +0 -7
  28. /package/dist/{._InitApp-YM5CK55D.js → ._InitApp-ZMT3KED7.js} +0 -0
  29. /package/dist/{._InitApp-YM5CK55D.js.map → ._InitApp-ZMT3KED7.js.map} +0 -0
  30. /package/dist/{._analysis-ABEO6RTN.js → ._analysis-PHENF2QA.js} +0 -0
  31. /package/dist/{._analysis-ABEO6RTN.js.map → ._analysis-PHENF2QA.js.map} +0 -0
  32. /package/dist/{._chunk-3YXBGNHD.js → ._chunk-53CCA4NS.js} +0 -0
  33. /package/dist/{._chunk-3YXBGNHD.js.map → ._chunk-53CCA4NS.js.map} +0 -0
  34. /package/dist/{._chunk-53BJRUUT.js → ._chunk-7TRHJ4SF.js} +0 -0
  35. /package/dist/{._chunk-53BJRUUT.js.map → ._chunk-7TRHJ4SF.js.map} +0 -0
  36. /package/dist/{._chunk-F7GEJLP7.js → ._chunk-MWTSOZTM.js} +0 -0
  37. /package/dist/{._chunk-F7GEJLP7.js.map → ._chunk-MWTSOZTM.js.map} +0 -0
  38. /package/dist/{._chunk-FROYVC6U.js → ._chunk-V2YKHPZH.js} +0 -0
  39. /package/dist/{._chunk-FROYVC6U.js.map → ._chunk-V2YKHPZH.js.map} +0 -0
  40. /package/dist/{._chunk-HEUTZR52.js → ._chunk-XB7D22SX.js} +0 -0
  41. /package/dist/{._chunk-HEUTZR52.js.map → ._chunk-XB7D22SX.js.map} +0 -0
  42. /package/dist/{._dashboardServer-2T7OBLSV.js → ._dashboardServer-MELKRCBX.js} +0 -0
  43. /package/dist/{._dashboardServer-2T7OBLSV.js.map → ._dashboardServer-MELKRCBX.js.map} +0 -0
  44. /package/dist/{._init-command-LXEBDSYX.js → ._init-command-WJMWYVZN.js} +0 -0
  45. /package/dist/{._init-command-LXEBDSYX.js.map → ._init-command-WJMWYVZN.js.map} +0 -0
  46. /package/dist/{._init-core-ETGVVENN.js → ._init-core-DX4VN3IY.js} +0 -0
  47. /package/dist/{._init-core-ETGVVENN.js.map → ._init-core-DX4VN3IY.js.map} +0 -0
@@ -114,10 +114,11 @@ function resolveWorkspaceJsonPath(workspacePath) {
114
114
  if (existsSync(primary)) {
115
115
  return primary;
116
116
  }
117
+ console.warn(`[vreko] .agents/workspace.json not found, falling back to legacy .agents/agents.workspace.json in ${workspacePath}`);
117
118
  return join(workspacePath, ".agents", "agents.workspace.json");
118
119
  }
119
120
  __name(resolveWorkspaceJsonPath, "resolveWorkspaceJsonPath");
120
121
 
121
122
  export { findGitRoot, findWorkspaceRoot, resolveWorkspaceJsonPath, resolveWorkspaceRoot };
122
- //# sourceMappingURL=chunk-HEUTZR52.js.map
123
- //# sourceMappingURL=chunk-HEUTZR52.js.map
123
+ //# sourceMappingURL=chunk-MWTSOZTM.js.map
124
+ //# sourceMappingURL=chunk-MWTSOZTM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/workspace.ts"],"names":["validateWorkspacePath","workspacePath","normalizedPath","normalize","absolutePath","resolve","startsWith","process","cwd","valid","root","error","hasGit","existsSync","hasPackageJson","hasVreko","stat","lstatSync","isSymbolicLink","Error","message","resolveWorkspaceRoot","explicitPath","validation","currentPath","maxIterations","i","hasMarker","parent","findWorkspaceRoot","dir","join","findGitRoot","execSync","require","encoding","stdio","trim","resolveWorkspaceJsonPath","primary","console","warn"],"mappings":";;;;;;AA0BO,SAASA,sBAAsBC,aAAAA,EAAqB;AAC1D,EAAA,IAAI;AACH,IAAA,MAAMC,cAAAA,GAAiBC,UAAUF,aAAAA,CAAAA;AACjC,IAAA,MAAMG,YAAAA,GAAeC,QAAQH,cAAAA,CAAAA;AAE7B,IAAA,IAAI,CAACE,YAAAA,CAAaE,UAAAA,CAAWC,OAAAA,CAAQC,GAAAA,EAAG,CAAA,IAAO,CAACJ,YAAAA,CAAaE,UAAAA,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AAAA,EAAe,SAAA,EAAW,uBAAA,CAAA;AACvC;AATgBqC,MAAAA,CAAAA,wBAAAA,EAAAA,0BAAAA,CAAAA","file":"chunk-MWTSOZTM.js","sourcesContent":["/**\n * Workspace Utilities\n *\n * Shared workspace detection and path utilities for CLI commands.\n * Supersedes @vreko/mcp/middleware workspace helpers - no transitive engine/intelligence deps.\n *\n * @module utils/workspace\n */\n\nimport { existsSync, lstatSync } from \"node:fs\";\nimport { join, normalize, resolve } from \"node:path\";\n\n// =============================================================================\n// WORKSPACE VALIDATION (migrated from @vreko/mcp/middleware - Phase 3A)\n// =============================================================================\n\nexport interface WorkspaceValidationResult {\n\tvalid: boolean;\n\troot: string;\n\terror?: string;\n}\n\n/**\n * Validate a workspace path according to security criteria.\n * Checks for .git, package.json, or .vreko markers; rejects symlinks.\n */\nexport function validateWorkspacePath(workspacePath: string): WorkspaceValidationResult {\n\ttry {\n\t\tconst normalizedPath = normalize(workspacePath);\n\t\tconst absolutePath = resolve(normalizedPath);\n\n\t\tif (!absolutePath.startsWith(process.cwd()) && !absolutePath.startsWith(\"/\")) {\n\t\t\treturn { valid: false, root: \"\", error: \"Invalid workspace path\" };\n\t\t}\n\n\t\tconst hasGit = existsSync(resolve(absolutePath, \".git\"));\n\t\tconst hasPackageJson = existsSync(resolve(absolutePath, \"package.json\"));\n\t\tconst hasVreko = existsSync(resolve(absolutePath, \".vreko\"));\n\n\t\tif (!hasGit && !hasPackageJson && !hasVreko) {\n\t\t\treturn {\n\t\t\t\tvalid: false,\n\t\t\t\troot: absolutePath,\n\t\t\t\terror: \"Workspace must contain at least one marker: .git, package.json, or .vreko\",\n\t\t\t};\n\t\t}\n\n\t\ttry {\n\t\t\tconst stat = lstatSync(absolutePath);\n\t\t\tif (stat.isSymbolicLink()) {\n\t\t\t\treturn {\n\t\t\t\t\tvalid: false,\n\t\t\t\t\troot: absolutePath,\n\t\t\t\t\terror: \"Workspace path cannot be a symbolic link\",\n\t\t\t\t};\n\t\t\t}\n\t\t} catch {\n\t\t\treturn { valid: false, root: absolutePath, error: \"Cannot access workspace path\" };\n\t\t}\n\n\t\treturn { valid: true, root: absolutePath };\n\t} catch (error) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\troot: \"\",\n\t\t\terror: error instanceof Error ? error.message : \"Unknown error validating workspace\",\n\t\t};\n\t}\n}\n\n/**\n * Resolve workspace root with fallback chain:\n * 1. Explicit path (if provided and valid)\n * 2. Traversal upward from cwd looking for .git / package.json / .vreko\n * 3. cwd itself as last resort\n */\nexport function resolveWorkspaceRoot(explicitPath?: string): WorkspaceValidationResult {\n\tif (explicitPath) {\n\t\tconst validation = validateWorkspacePath(explicitPath);\n\t\tif (validation.valid) {\n\t\t\treturn validation;\n\t\t}\n\t}\n\n\t// Traverse upward\n\tlet currentPath = resolve(process.cwd());\n\tconst maxIterations = 50;\n\tfor (let i = 0; i < maxIterations; i++) {\n\t\tconst hasMarker =\n\t\t\texistsSync(resolve(currentPath, \".git\")) ||\n\t\t\texistsSync(resolve(currentPath, \"package.json\")) ||\n\t\t\texistsSync(resolve(currentPath, \".vreko\"));\n\t\tif (hasMarker) {\n\t\t\treturn validateWorkspacePath(currentPath);\n\t\t}\n\t\tconst parent = resolve(currentPath, \"..\");\n\t\tif (parent === currentPath) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentPath = parent;\n\t}\n\n\t// Fallback: cwd\n\treturn validateWorkspacePath(process.cwd());\n}\n\n/**\n * Find the workspace root by traversing up from the given directory\n * looking for a .vreko directory.\n *\n * @param cwd - Current working directory to start from\n * @returns Absolute path to workspace root, or null if not found\n */\nexport function findWorkspaceRoot(cwd: string): string | null {\n\tlet dir = cwd;\n\twhile (dir !== \"/\") {\n\t\tif (existsSync(join(dir, \".vreko\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tconst parent = join(dir, \"..\");\n\t\tif (parent === dir) {\n\t\t\tbreak;\n\t\t}\n\t\tdir = parent;\n\t}\n\treturn null;\n}\n\n/**\n * Find git root by traversing up from the given directory.\n *\n * @param cwd - Current working directory to start from\n * @returns Absolute path to git root, or null if not in a git repo\n */\nexport function findGitRoot(cwd: string): string | null {\n\ttry {\n\t\tconst { execSync } = require(\"node:child_process\");\n\t\treturn execSync(\"git rev-parse --show-toplevel\", {\n\t\t\tcwd,\n\t\t\tencoding: \"utf-8\",\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t}).trim();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Resolve the canonical path to workspace.json.\n * Tries the v0.4 path first (`.agents/workspace.json`),\n * then falls back to the legacy path (`.agents/agents.workspace.json`).\n *\n * @param workspacePath - Absolute path to the workspace root\n * @returns Absolute path to workspace.json (may or may not exist)\n */\nexport function resolveWorkspaceJsonPath(workspacePath: string): string {\n\tconst primary = join(workspacePath, \".agents\", \"workspace.json\");\n\tif (existsSync(primary)) {\n\t\treturn primary;\n\t}\n\tconsole.warn(\n\t\t`[vreko] .agents/workspace.json not found, falling back to legacy .agents/agents.workspace.json in ${workspacePath}`,\n\t);\n\treturn join(workspacePath, \".agents\", \"agents.workspace.json\");\n}\n"]}
@@ -34,7 +34,7 @@ __name(renderDegradedState, "renderDegradedState");
34
34
  // src/services/service-client.ts
35
35
  var version = "0.0.0";
36
36
  {
37
- version = "3.2.0";
37
+ version = "3.3.2";
38
38
  }
39
39
  var client = null;
40
40
  var connectionPromise = null;
@@ -157,5 +157,5 @@ async function withDaemonOptional(command, fn) {
157
157
  __name(withDaemonOptional, "withDaemonOptional");
158
158
 
159
159
  export { connectToDaemon, disconnectFromDaemon, getDaemonClient, getDaemonStatus, isDaemonAvailable, isDaemonConnected, withDaemon, withDaemonOptional };
160
- //# sourceMappingURL=chunk-3YXBGNHD.js.map
161
- //# sourceMappingURL=chunk-3YXBGNHD.js.map
160
+ //# sourceMappingURL=chunk-V2YKHPZH.js.map
161
+ //# sourceMappingURL=chunk-V2YKHPZH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ui/degraded-state.ts","../src/services/service-client.ts"],"names":["renderDegradedState","opts","reason","messages","unreachable","timeout","fixes","lines","command","process","stderr","write","join","version","__CLI_VERSION__","client","connectionPromise","getDaemonClient","options","VrekoLocalClient","socketPath","autoReconnect","connectToDaemon","daemonClient","isConnected","connect","initialize","protocolVersion","clientInfo","name","isDaemonConnected","isDaemonAvailable","getDaemonStatus","connected","health","check","uptime","disconnectFromDaemon","close","withDaemon","fn","healthy","isServiceHealthy","exit","withDaemonOptional","_error"],"mappings":";;;;;;;AAuBO,SAASA,oBAAoBC,IAAAA,EAA0B;AAC7D,EAAA,MAAMC,MAAAA,GAASD,KAAKC,MAAAA,IAAU,aAAA;AAE9B,EAAA,MAAMC,QAAAA,GAA0C;IAC/CC,WAAAA,EAAa,+CAAA;IACbC,OAAAA,EAAS,uCAAA;IACT,kBAAA,EAAoB,kDAAA;IACpB,aAAA,EAAe;AAChB,GAAA;AAEA,EAAA,MAAMC,KAAAA,GAAuC;IAC5CF,WAAAA,EAAa,iBAAA;IACbC,OAAAA,EAAS,mBAAA;IACT,kBAAA,EAAoB,YAAA;IACpB,aAAA,EAAe;AAChB,GAAA;AAOA,EAAA,MAAME,KAAAA,GAAQ;IACb,CAAA,QAAA,EAAWJ,QAAAA,CAASD,MAAAA,CAAO,CAAA,CAAA;AAC3B,IAAA,CAAA,WAAA,EAAcD,KAAKO,OAAO,CAAA,sBAAA,CAAA;IAC1B,CAAA,OAAA,EAAUF,KAAAA,CAAMJ,MAAAA,CAAO,CAAA,CAAA;AACvB,IAAA,qEAAA;AACA,IAAA;;AAGDO,EAAAA,OAAAA,CAAQC,OAAOC,KAAAA,CAAM,CAAA,EAAGJ,KAAAA,CAAMK,IAAAA,CAAK,IAAA,CAAA;AAAS,CAAA,CAAA;AAC7C;AA/BgBZ,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA;;;ACgChB,IAAIa,OAAAA,GAAU,OAAA;AAC8B;AAC3CA,EAAAA,OAAAA,GAAUC,OA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,IAAI,CAACD,OAAAA,EAAS;AACbzC,IAAAA,mBAAAA,CAAoB;AAAEQ,MAAAA,OAAAA;AAASN,MAAAA,MAAAA,EAAQD,MAAMC,MAAAA,IAAU;KAAc,CAAA;AACrEO,IAAAA,OAAAA,CAAQkC,KAAK,CAAA,CAAA;AACd,EAAA;AAEA,EAAA,IAAI5B,OAAAA,GAAkC,IAAA;AAEtC,EAAA,IAAI;AACHA,IAAAA,OAAAA,GAAS,MAAMO,eAAAA,EAAAA;AACf,IAAA,MAAMP,OAAAA,CAAOmB,OAAOC,KAAAA,EAAK;EAC1B,CAAA,CAAA,MAAQ;AACPnC,IAAAA,mBAAAA,CAAoB;AAAEQ,MAAAA,OAAAA;AAASN,MAAAA,MAAAA,EAAQD,MAAMC,MAAAA,IAAU;KAAc,CAAA;AACrEO,IAAAA,OAAAA,CAAQkC,KAAK,CAAA,CAAA;AACd,EAAA;AAEA,EAAA,OAAOH,GAAGzB,OAAAA,CAAAA;AACX;AAxBsBwB,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAyCtB,eAAsBK,kBAAAA,CACrBpC,SACAgC,EAAAA,EAAmD;AAEnD,EAAA,IAAIzB,OAAAA,GAAkC,IAAA;AAEtC,EAAA,IAAI;AACHA,IAAAA,OAAAA,GAAS,MAAMO,eAAAA,EAAAA;AACf,IAAA,MAAMP,OAAAA,CAAOmB,OAAOC,KAAAA,EAAK;AAC1B,EAAA,CAAA,CAAA,OAASU,MAAAA,EAAQ;AAEhB9B,IAAAA,OAAAA,GAAS,IAAA;AACV,EAAA;AAEA,EAAA,OAAOyB,GAAGzB,OAAAA,CAAAA;AACX;AAfsB6B,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA","file":"chunk-3YXBGNHD.js","sourcesContent":["/**\n * Degraded State Rendering\n *\n * Single source of truth for daemon-unavailable UX.\n * All commands must use renderDegradedState() when the daemon is unavailable.\n * No command may inline its own daemon-unavailable messaging.\n *\n * @module ui/degraded-state\n */\n\nexport interface DegradedStateOptions {\n\tcommand: string;\n\treason?: \"unreachable\" | \"timeout\" | \"version-mismatch\" | \"not-started\";\n}\n\n/**\n * Render consistent daemon-unavailable error message.\n *\n * This is the ONLY place that renders daemon-unavailable messaging.\n * All future changes to daemon-unavailable UX happen here and propagate automatically.\n *\n * @param opts - Options for rendering the degraded state\n */\nexport function renderDegradedState(opts: DegradedStateOptions): void {\n\tconst reason = opts.reason ?? \"unreachable\";\n\n\tconst messages: Record<typeof reason, string> = {\n\t\tunreachable: \"Vreko daemon is not running or not reachable.\",\n\t\ttimeout: \"Vreko daemon did not respond in time.\",\n\t\t\"version-mismatch\": \"Vreko daemon version does not match CLI version.\",\n\t\t\"not-started\": \"Vreko daemon has not been started.\",\n\t};\n\n\tconst fixes: Record<typeof reason, string> = {\n\t\tunreachable: \"vr daemon start\",\n\t\ttimeout: \"vr daemon restart\",\n\t\t\"version-mismatch\": \"vr upgrade\",\n\t\t\"not-started\": \"vr daemon start\",\n\t};\n\n\t// Four-part degraded-state message per industry standard (Docker, GitHub CLI, WCAG):\n\t// 1. What is unavailable (text severity prefix, no color dependence)\n\t// 2. What is affected (the specific command that failed)\n\t// 3. What to do (primary recovery action)\n\t// 4. What still works (offline fallback)\n\tconst lines = [\n\t\t`[ERROR] ${messages[reason]}`,\n\t\t` Command '${opts.command}' requires the daemon.`,\n\t\t` Run: ${fixes[reason]}`,\n\t\t\" Commands that work offline: vr learn, vr check, vr session status\",\n\t\t\" Diagnostics: vr doctor\",\n\t];\n\n\tprocess.stderr.write(`${lines.join(\"\\n\")}\\n`);\n}\n","/**\n * Daemon Client Service\n *\n * Manages connection to the Vreko local service daemon (vrekod).\n * All intelligence operations are proxied through the daemon for IP protection.\n *\n * ## Architecture\n *\n * ```\n * CLI Commands\n * ↓\n * DaemonClientService (this file)\n * ↓\n * @vreko/local-service-client (IPC client)\n * ↓\n * vrekod daemon (Unix socket / named pipe)\n * ↓\n * @vreko/intelligence (runs in daemon process)\n * ```\n *\n * ## IP Protection\n *\n * - CLI has NO direct imports of @vreko/intelligence\n * - All intelligence code runs in the daemon process\n * - CLI only has types from @vreko/contracts and local-service-client\n *\n * ## Canonical Daemon Connection Patterns\n *\n * **For commands that require the daemon:**\n * - Use `withDaemon(command, fn)` - exits with code 1 on failure\n * - Always calls `renderDegradedState()` for consistent error messaging\n * - No inline daemon-unavailable messaging allowed\n *\n * **For commands with graceful degraded mode:**\n * - Use `withDaemonOptional(command, fn)` - does not exit on failure\n * - Callback receives `client | null` to handle degraded state\n * - Surfaces clear \"limited mode\" indicator to user\n *\n * **Do NOT use:**\n * - `requireDaemon()` - deprecated, replaced by withDaemon/withDaemonOptional\n * - Inline error handling for daemon unavailability\n *\n * @module services/service-client\n */\n\n// Version is inlined at build time by tsup's define option\n// This avoids runtime package.json resolution issues in bundled output\ndeclare const __CLI_VERSION__: string | undefined;\n\nimport { VrekoLocalClient } from \"@vreko/local-service-client\";\nimport { isServiceHealthy } from \"../service-adapter/local-service-adapter.js\";\nimport { type DegradedStateOptions, renderDegradedState } from \"../ui/degraded-state.js\";\n\n// Use build-time version if available, otherwise fall back to package.json\n// This supports both production builds (tsup defines __CLI_VERSION__) and dev (tsx)\nlet version = \"0.0.0\";\nif (typeof __CLI_VERSION__ !== \"undefined\") {\n\tversion = __CLI_VERSION__;\n} else {\n\ttry {\n\t\t// Dynamic import for dev mode - works with tsx\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst pkg = require(\"../../package.json\") as { version: string };\n\t\tversion = pkg.version ?? \"0.0.0\";\n\t} catch {\n\t\t// Fallback if package.json can't be loaded\n\t\tversion = \"0.0.0-dev\";\n\t}\n}\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface DaemonStatus {\n\tconnected: boolean;\n\tversion?: string;\n\tuptime?: number;\n}\n\nexport interface DaemonClientOptions {\n\t/** Socket path for IPC (default: OS-specific) */\n\tsocketPath?: string;\n\t/** Auto-reconnect on disconnect */\n\tautoReconnect?: boolean;\n\t/**\n\t * Connection probe timeout hint (ms). Accepted but not forwarded to\n\t * VrekoLocalClient - per DAEMON-06, the 5s probe hint must not become\n\t * the per-request RPC timeout. Reserved for a future probe mechanism.\n\t */\n\ttimeout?: number;\n}\n\n// =============================================================================\n// SINGLETON CLIENT\n// =============================================================================\n\nlet client: VrekoLocalClient | null = null;\nlet connectionPromise: Promise<void> | null = null;\n\n/**\n * Get or create the daemon client\n *\n * @param options - Client options\n * @returns The daemon client instance\n */\nexport function getDaemonClient(options: DaemonClientOptions = {}): VrekoLocalClient {\n\tif (!client) {\n\t\tclient = new VrekoLocalClient({\n\t\t\tsocketPath: options.socketPath,\n\t\t\t// DAEMON-06: No timeout forwarded. IpcConnection hardcodes its own 5s connect\n\t\t\t// timeout (client.ts:140). Per-request RPC timeout defaults to 30s from\n\t\t\t// VrekoLocalClient constructor - unverified against large-repo cold-start\n\t\t\t// (workspace/analyze on next.js/shadcn). If hero-capture runs hit this ceiling,\n\t\t\t// VrekoLocalClient.call() needs a per-request timeout override.\n\t\t\tautoReconnect: options.autoReconnect ?? true,\n\t\t});\n\t}\n\treturn client;\n}\n\n/**\n * Connect to the daemon\n *\n * @param options - Connection options\n * @throws If connection fails\n */\nexport async function connectToDaemon(options: DaemonClientOptions = {}): Promise<VrekoLocalClient> {\n\tconst daemonClient = getDaemonClient(options);\n\n\t// Avoid duplicate connection attempts\n\tif (connectionPromise) {\n\t\tawait connectionPromise;\n\t\treturn daemonClient;\n\t}\n\n\tif (daemonClient.isConnected()) {\n\t\treturn daemonClient;\n\t}\n\n\tconnectionPromise = (async () => {\n\t\tawait daemonClient.connect();\n\n\t\t// Initialize protocol\n\t\tawait daemonClient.initialize({\n\t\t\tprotocolVersion: \"1.0.0\",\n\t\t\tclientInfo: {\n\t\t\t\tname: \"@vreko/cli\",\n\t\t\t\tversion,\n\t\t\t},\n\t\t});\n\t})();\n\n\ttry {\n\t\tawait connectionPromise;\n\t} finally {\n\t\tconnectionPromise = null;\n\t}\n\n\treturn daemonClient;\n}\n\n/**\n * Check if daemon is connected\n */\nexport function isDaemonConnected(): boolean {\n\treturn client?.isConnected() ?? false;\n}\n\n/**\n * Check if daemon is available (try to connect)\n *\n * @returns true if daemon is running and accessible\n */\nexport async function isDaemonAvailable(): Promise<boolean> {\n\ttry {\n\t\tawait connectToDaemon();\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Get daemon status\n */\nexport async function getDaemonStatus(): Promise<DaemonStatus> {\n\tif (!isDaemonConnected()) {\n\t\treturn { connected: false };\n\t}\n\n\ttry {\n\t\tconst daemonClient = getDaemonClient();\n\t\tconst health = await daemonClient.health.check();\n\t\treturn {\n\t\t\tconnected: true,\n\t\t\tversion: health.version,\n\t\t\tuptime: health.uptime,\n\t\t};\n\t} catch {\n\t\treturn { connected: false };\n\t}\n}\n\n/**\n * Disconnect from the daemon\n */\nexport function disconnectFromDaemon(): void {\n\tif (client) {\n\t\tclient.close();\n\t\tclient = null;\n\t}\n}\n\n/**\n * Canonical wrapper for commands that require daemon connectivity.\n *\n * Rules:\n * - withDaemon() always calls renderDegradedState() on failure - never logs inline\n * - withDaemon() always exits with code 1 on failure - no silent degradation\n * - withDaemon() accepts the command name string for telemetry attribution\n *\n * @param command - Command name for telemetry attribution\n * @param fn - Function to execute with daemon client\n * @param opts - Optional degradation reason\n * @returns Result from fn, or never exits on failure\n */\nexport async function withDaemon<T>(\n\tcommand: string,\n\tfn: (client: VrekoLocalClient) => Promise<T>,\n\topts?: { reason?: DegradedStateOptions[\"reason\"] },\n): Promise<T | never> {\n\t// DAEMON-03: pre-flight socket probe - catches zombie daemon (PID alive, socket dead).\n\t// isServiceHealthy() is async; the missing-await form would be silently truthy (Pitfall 4).\n\tconst healthy = await isServiceHealthy();\n\tif (!healthy) {\n\t\trenderDegradedState({ command, reason: opts?.reason ?? \"unreachable\" });\n\t\tprocess.exit(1);\n\t}\n\n\tlet client: VrekoLocalClient | null = null;\n\n\ttry {\n\t\tclient = await connectToDaemon();\n\t\tawait client.health.check();\n\t} catch {\n\t\trenderDegradedState({ command, reason: opts?.reason ?? \"unreachable\" });\n\t\tprocess.exit(1);\n\t}\n\n\treturn fn(client);\n}\n\n/**\n * Canonical wrapper for commands with graceful offline mode.\n *\n * Some commands can show partial data without the daemon. These use a different\n * wrapper that does not exit on failure but surfaces a clear \"limited mode\" indicator.\n *\n * Rules:\n * - withDaemonOptional() does not exit on failure\n * - withDaemonOptional() surfaces a clear \"limited mode\" indicator\n * - withDaemonOptional() accepts client | null in the callback function\n *\n * @param command - Command name for telemetry attribution\n * @param fn - Function to execute with daemon client (may receive null)\n * @returns Result from fn\n */\nexport async function withDaemonOptional<T>(\n\tcommand: string,\n\tfn: (client: VrekoLocalClient | null) => Promise<T>,\n): Promise<T> {\n\tlet client: VrekoLocalClient | null = null;\n\n\ttry {\n\t\tclient = await connectToDaemon();\n\t\tawait client.health.check();\n\t} catch (_error) {\n\t\tvoid _error;\n\t\tclient = null;\n\t}\n\n\treturn fn(client);\n}\n"]}
1
+ {"version":3,"sources":["../src/ui/degraded-state.ts","../src/services/service-client.ts"],"names":["renderDegradedState","opts","reason","messages","unreachable","timeout","fixes","lines","command","process","stderr","write","join","version","__CLI_VERSION__","client","connectionPromise","getDaemonClient","options","VrekoLocalClient","socketPath","autoReconnect","connectToDaemon","daemonClient","isConnected","connect","initialize","protocolVersion","clientInfo","name","isDaemonConnected","isDaemonAvailable","getDaemonStatus","connected","health","check","uptime","disconnectFromDaemon","close","withDaemon","fn","healthy","isServiceHealthy","exit","withDaemonOptional","_error"],"mappings":";;;;;;;AAuBO,SAASA,oBAAoBC,IAAAA,EAA0B;AAC7D,EAAA,MAAMC,MAAAA,GAASD,KAAKC,MAAAA,IAAU,aAAA;AAE9B,EAAA,MAAMC,QAAAA,GAA0C;IAC/CC,WAAAA,EAAa,+CAAA;IACbC,OAAAA,EAAS,uCAAA;IACT,kBAAA,EAAoB,kDAAA;IACpB,aAAA,EAAe;AAChB,GAAA;AAE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,OAAOH,GAAGzB,OAAAA,CAAAA;AACX;AAxBsBwB,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA;AAyCtB,eAAsBK,kBAAAA,CACrBpC,SACAgC,EAAAA,EAAmD;AAEnD,EAAA,IAAIzB,OAAAA,GAAkC,IAAA;AAEtC,EAAA,IAAI;AACHA,IAAAA,OAAAA,GAAS,MAAMO,eAAAA,EAAAA;AACf,IAAA,MAAMP,OAAAA,CAAOmB,OAAOC,KAAAA,EAAK;AAC1B,EAAA,CAAA,CAAA,OAASU,MAAAA,EAAQ;AAEhB9B,IAAAA,OAAAA,GAAS,IAAA;AACV,EAAA;AAEA,EAAA,OAAOyB,GAAGzB,OAAAA,CAAAA;AACX;AAfsB6B,MAAAA,CAAAA,kBAAAA,EAAAA,oBAAAA,CAAAA","file":"chunk-V2YKHPZH.js","sourcesContent":["/**\n * Degraded State Rendering\n *\n * Single source of truth for daemon-unavailable UX.\n * All commands must use renderDegradedState() when the daemon is unavailable.\n * No command may inline its own daemon-unavailable messaging.\n *\n * @module ui/degraded-state\n */\n\nexport interface DegradedStateOptions {\n\tcommand: string;\n\treason?: \"unreachable\" | \"timeout\" | \"version-mismatch\" | \"not-started\";\n}\n\n/**\n * Render consistent daemon-unavailable error message.\n *\n * This is the ONLY place that renders daemon-unavailable messaging.\n * All future changes to daemon-unavailable UX happen here and propagate automatically.\n *\n * @param opts - Options for rendering the degraded state\n */\nexport function renderDegradedState(opts: DegradedStateOptions): void {\n\tconst reason = opts.reason ?? \"unreachable\";\n\n\tconst messages: Record<typeof reason, string> = {\n\t\tunreachable: \"Vreko daemon is not running or not reachable.\",\n\t\ttimeout: \"Vreko daemon did not respond in time.\",\n\t\t\"version-mismatch\": \"Vreko daemon version does not match CLI version.\",\n\t\t\"not-started\": \"Vreko daemon has not been started.\",\n\t};\n\n\tconst fixes: Record<typeof reason, string> = {\n\t\tunreachable: \"vr daemon start\",\n\t\ttimeout: \"vr daemon restart\",\n\t\t\"version-mismatch\": \"vr upgrade\",\n\t\t\"not-started\": \"vr daemon start\",\n\t};\n\n\t// Four-part degraded-state message per industry standard (Docker, GitHub CLI, WCAG):\n\t// 1. What is unavailable (text severity prefix, no color dependence)\n\t// 2. What is affected (the specific command that failed)\n\t// 3. What to do (primary recovery action)\n\t// 4. What still works (offline fallback)\n\tconst lines = [\n\t\t`[ERROR] ${messages[reason]}`,\n\t\t` Command '${opts.command}' requires the daemon.`,\n\t\t` Run: ${fixes[reason]}`,\n\t\t\" Commands that work offline: vr learn, vr check, vr session status\",\n\t\t\" Diagnostics: vr doctor\",\n\t];\n\n\tprocess.stderr.write(`${lines.join(\"\\n\")}\\n`);\n}\n","/**\n * Daemon Client Service\n *\n * Manages connection to the Vreko local service daemon (vrekod).\n * All intelligence operations are proxied through the daemon for IP protection.\n *\n * ## Architecture\n *\n * ```\n * CLI Commands\n * ↓\n * DaemonClientService (this file)\n * ↓\n * @vreko/local-service-client (IPC client)\n * ↓\n * vrekod daemon (Unix socket / named pipe)\n * ↓\n * @vreko/intelligence (runs in daemon process)\n * ```\n *\n * ## IP Protection\n *\n * - CLI has NO direct imports of @vreko/intelligence\n * - All intelligence code runs in the daemon process\n * - CLI only has types from @vreko/contracts and local-service-client\n *\n * ## Canonical Daemon Connection Patterns\n *\n * **For commands that require the daemon:**\n * - Use `withDaemon(command, fn)` - exits with code 1 on failure\n * - Always calls `renderDegradedState()` for consistent error messaging\n * - No inline daemon-unavailable messaging allowed\n *\n * **For commands with graceful degraded mode:**\n * - Use `withDaemonOptional(command, fn)` - does not exit on failure\n * - Callback receives `client | null` to handle degraded state\n * - Surfaces clear \"limited mode\" indicator to user\n *\n * **Do NOT use:**\n * - `requireDaemon()` - deprecated, replaced by withDaemon/withDaemonOptional\n * - Inline error handling for daemon unavailability\n *\n * @module services/service-client\n */\n\n// Version is inlined at build time by tsup's define option\n// This avoids runtime package.json resolution issues in bundled output\ndeclare const __CLI_VERSION__: string | undefined;\n\nimport { VrekoLocalClient } from \"@vreko/local-service-client\";\nimport { isServiceHealthy } from \"../service-adapter/local-service-adapter.js\";\nimport { type DegradedStateOptions, renderDegradedState } from \"../ui/degraded-state.js\";\n\n// Use build-time version if available, otherwise fall back to package.json\n// This supports both production builds (tsup defines __CLI_VERSION__) and dev (tsx)\nlet version = \"0.0.0\";\nif (typeof __CLI_VERSION__ !== \"undefined\") {\n\tversion = __CLI_VERSION__;\n} else {\n\ttry {\n\t\t// Dynamic import for dev mode - works with tsx\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst pkg = require(\"../../package.json\") as { version: string };\n\t\tversion = pkg.version ?? \"0.0.0\";\n\t} catch {\n\t\t// Fallback if package.json can't be loaded\n\t\tversion = \"0.0.0-dev\";\n\t}\n}\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface DaemonStatus {\n\tconnected: boolean;\n\tversion?: string;\n\tuptime?: number;\n}\n\nexport interface DaemonClientOptions {\n\t/** Socket path for IPC (default: OS-specific) */\n\tsocketPath?: string;\n\t/** Auto-reconnect on disconnect */\n\tautoReconnect?: boolean;\n\t/**\n\t * Connection probe timeout hint (ms). Accepted but not forwarded to\n\t * VrekoLocalClient - per DAEMON-06, the 5s probe hint must not become\n\t * the per-request RPC timeout. Reserved for a future probe mechanism.\n\t */\n\ttimeout?: number;\n}\n\n// =============================================================================\n// SINGLETON CLIENT\n// =============================================================================\n\nlet client: VrekoLocalClient | null = null;\nlet connectionPromise: Promise<void> | null = null;\n\n/**\n * Get or create the daemon client\n *\n * @param options - Client options\n * @returns The daemon client instance\n */\nexport function getDaemonClient(options: DaemonClientOptions = {}): VrekoLocalClient {\n\tif (!client) {\n\t\tclient = new VrekoLocalClient({\n\t\t\tsocketPath: options.socketPath,\n\t\t\t// DAEMON-06: No timeout forwarded. IpcConnection hardcodes its own 5s connect\n\t\t\t// timeout (client.ts:140). Per-request RPC timeout defaults to 30s from\n\t\t\t// VrekoLocalClient constructor - unverified against large-repo cold-start\n\t\t\t// (workspace/analyze on next.js/shadcn). If hero-capture runs hit this ceiling,\n\t\t\t// VrekoLocalClient.call() needs a per-request timeout override.\n\t\t\tautoReconnect: options.autoReconnect ?? true,\n\t\t});\n\t}\n\treturn client;\n}\n\n/**\n * Connect to the daemon\n *\n * @param options - Connection options\n * @throws If connection fails\n */\nexport async function connectToDaemon(options: DaemonClientOptions = {}): Promise<VrekoLocalClient> {\n\tconst daemonClient = getDaemonClient(options);\n\n\t// Avoid duplicate connection attempts\n\tif (connectionPromise) {\n\t\tawait connectionPromise;\n\t\treturn daemonClient;\n\t}\n\n\tif (daemonClient.isConnected()) {\n\t\treturn daemonClient;\n\t}\n\n\tconnectionPromise = (async () => {\n\t\tawait daemonClient.connect();\n\n\t\t// Initialize protocol\n\t\tawait daemonClient.initialize({\n\t\t\tprotocolVersion: \"1.0.0\",\n\t\t\tclientInfo: {\n\t\t\t\tname: \"@vreko/cli\",\n\t\t\t\tversion,\n\t\t\t},\n\t\t});\n\t})();\n\n\ttry {\n\t\tawait connectionPromise;\n\t} finally {\n\t\tconnectionPromise = null;\n\t}\n\n\treturn daemonClient;\n}\n\n/**\n * Check if daemon is connected\n */\nexport function isDaemonConnected(): boolean {\n\treturn client?.isConnected() ?? false;\n}\n\n/**\n * Check if daemon is available (try to connect)\n *\n * @returns true if daemon is running and accessible\n */\nexport async function isDaemonAvailable(): Promise<boolean> {\n\ttry {\n\t\tawait connectToDaemon();\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Get daemon status\n */\nexport async function getDaemonStatus(): Promise<DaemonStatus> {\n\tif (!isDaemonConnected()) {\n\t\treturn { connected: false };\n\t}\n\n\ttry {\n\t\tconst daemonClient = getDaemonClient();\n\t\tconst health = await daemonClient.health.check();\n\t\treturn {\n\t\t\tconnected: true,\n\t\t\tversion: health.version,\n\t\t\tuptime: health.uptime,\n\t\t};\n\t} catch {\n\t\treturn { connected: false };\n\t}\n}\n\n/**\n * Disconnect from the daemon\n */\nexport function disconnectFromDaemon(): void {\n\tif (client) {\n\t\tclient.close();\n\t\tclient = null;\n\t}\n}\n\n/**\n * Canonical wrapper for commands that require daemon connectivity.\n *\n * Rules:\n * - withDaemon() always calls renderDegradedState() on failure - never logs inline\n * - withDaemon() always exits with code 1 on failure - no silent degradation\n * - withDaemon() accepts the command name string for telemetry attribution\n *\n * @param command - Command name for telemetry attribution\n * @param fn - Function to execute with daemon client\n * @param opts - Optional degradation reason\n * @returns Result from fn, or never exits on failure\n */\nexport async function withDaemon<T>(\n\tcommand: string,\n\tfn: (client: VrekoLocalClient) => Promise<T>,\n\topts?: { reason?: DegradedStateOptions[\"reason\"] },\n): Promise<T | never> {\n\t// DAEMON-03: pre-flight socket probe - catches zombie daemon (PID alive, socket dead).\n\t// isServiceHealthy() is async; the missing-await form would be silently truthy (Pitfall 4).\n\tconst healthy = await isServiceHealthy();\n\tif (!healthy) {\n\t\trenderDegradedState({ command, reason: opts?.reason ?? \"unreachable\" });\n\t\tprocess.exit(1);\n\t}\n\n\tlet client: VrekoLocalClient | null = null;\n\n\ttry {\n\t\tclient = await connectToDaemon();\n\t\tawait client.health.check();\n\t} catch {\n\t\trenderDegradedState({ command, reason: opts?.reason ?? \"unreachable\" });\n\t\tprocess.exit(1);\n\t}\n\n\treturn fn(client);\n}\n\n/**\n * Canonical wrapper for commands with graceful offline mode.\n *\n * Some commands can show partial data without the daemon. These use a different\n * wrapper that does not exit on failure but surfaces a clear \"limited mode\" indicator.\n *\n * Rules:\n * - withDaemonOptional() does not exit on failure\n * - withDaemonOptional() surfaces a clear \"limited mode\" indicator\n * - withDaemonOptional() accepts client | null in the callback function\n *\n * @param command - Command name for telemetry attribution\n * @param fn - Function to execute with daemon client (may receive null)\n * @returns Result from fn\n */\nexport async function withDaemonOptional<T>(\n\tcommand: string,\n\tfn: (client: VrekoLocalClient | null) => Promise<T>,\n): Promise<T> {\n\tlet client: VrekoLocalClient | null = null;\n\n\ttry {\n\t\tclient = await connectToDaemon();\n\t\tawait client.health.check();\n\t} catch (_error) {\n\t\tvoid _error;\n\t\tclient = null;\n\t}\n\n\treturn fn(client);\n}\n"]}
@@ -8,7 +8,7 @@ process.env.VREKO_CLI='true';process.env.NODE_NO_WARNINGS='1';
8
8
  function createInitCommand() {
9
9
  return new Command("init").description("Bootstrap Vreko for a repository").argument("[path]", "Workspace path (default: current directory)").option("-y, --yes", "Skip confirmation prompts").option("--non-interactive", "Run without prompts").option("--json", "Output structured JSON summary").option("--force", "Re-initialize even if already set up").option("--dry-run", "Show what would be configured").option("--skip-mcp", "Skip MCP configuration").option("--skip-service", "Skip service registration").option("--api-key <key>", "API key for Pro features").option("--dev", "Use local dev mode for MCP").option("--npm", "Use npm/npx mode for MCP").option("-q, --quiet", "Suppress informational output").option("-v, --verbose", "Show detailed detection reasoning").action(async (pathArg, options) => {
10
10
  if (options.json || options.nonInteractive || !process.stdin.isTTY) {
11
- const { createInitCommand: createCoreInit } = await import('./init-core-ETGVVENN.js');
11
+ const { createInitCommand: createCoreInit } = await import('./init-core-DX4VN3IY.js');
12
12
  const coreCmd = createCoreInit();
13
13
  const argv = [
14
14
  "node",
@@ -60,7 +60,7 @@ function createInitCommand() {
60
60
  }
61
61
  const { render } = await import('ink');
62
62
  const React = await import('react');
63
- const { InitApp: App } = await import('./InitApp-YM5CK55D.js');
63
+ const { InitApp: App } = await import('./InitApp-ZMT3KED7.js');
64
64
  const initProfile = "VIRGIN";
65
65
  const { waitUntilExit } = render(React.createElement(App, {
66
66
  pathArg,
@@ -73,5 +73,5 @@ function createInitCommand() {
73
73
  __name(createInitCommand, "createInitCommand");
74
74
 
75
75
  export { createInitCommand };
76
- //# sourceMappingURL=chunk-53BJRUUT.js.map
77
- //# sourceMappingURL=chunk-53BJRUUT.js.map
76
+ //# sourceMappingURL=chunk-XB7D22SX.js.map
77
+ //# sourceMappingURL=chunk-XB7D22SX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/init/init-command.ts"],"names":["createInitCommand","Command","description","argument","option","action","pathArg","options","json","nonInteractive","process","stdin","isTTY","createCoreInit","coreCmd","argv","push","yes","force","dryRun","skipMcp","skipService","quiet","verbose","dev","npm","apiKey","parseAsync","from","render","React","InitApp","App","initProfile","waitUntilExit","createElement"],"mappings":";;;;;;;AAmBO,SAASA,iBAAAA,GAAAA;AACf,EAAA,OAAO,IAAIC,OAAAA,CAAQ,MAAA,CAAA,CACjBC,WAAAA,CAAY,kCAAA,CAAA,CACZC,QAAAA,CAAS,QAAA,EAAU,6CAAA,CAAA,CACnBC,MAAAA,CAAO,WAAA,EAAa,2BAAA,CAAA,CACpBA,MAAAA,CAAO,mBAAA,EAAqB,qBAAA,CAAA,CAC5BA,MAAAA,CAAO,QAAA,EAAU,gCAAA,CAAA,CACjBA,MAAAA,CAAO,SAAA,EAAW,sCAAA,CAAA,CAClBA,MAAAA,CAAO,aAAa,+BAAA,CAAA,CACpBA,MAAAA,CAAO,YAAA,EAAc,wBAAA,CAAA,CACrBA,MAAAA,CAAO,gBAAA,EAAkB,2BAAA,CAAA,CACzBA,MAAAA,CAAO,iBAAA,EAAmB,0BAAA,CAAA,CAC1BA,MAAAA,CAAO,OAAA,EAAS,4BAAA,CAAA,CAChBA,MAAAA,CAAO,OAAA,EAAS,0BAAA,CAAA,CAChBA,MAAAA,CAAO,aAAA,EAAe,+BAAA,CAAA,CACtBA,MAAAA,CAAO,eAAA,EAAiB,mCAAA,CAAA,CACxBC,MAAAA,CAAO,OAAOC,SAA6BC,OAAAA,KAAAA;AAG3C,IAAA,IAAIA,QAAQC,IAAAA,IAAQD,OAAAA,CAAQE,kBAAkB,CAACC,OAAAA,CAAQC,MAAMC,KAAAA,EAAO;AACnE,MAAA,MAAM,EAAEZ,iBAAAA,EAAmBa,cAAAA,EAAc,GAAK,MAAM,OAAO,yBAAA,CAAA;AAC3D,MAAA,MAAMC,UAAUD,cAAAA,EAAAA;AAEhB,MAAA,MAAME,IAAAA,GAAO;AAAC,QAAA,MAAA;AAAQ,QAAA;;AACtB,MAAA,IAAIT,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EAAaT,OAAAA,CAAQmB,MAAM,CAAA;AACtC,MAAA;AACA,MAAA,MAAMZ,OAAAA,CAAQa,WAAWZ,IAAAA,EAAM;QAAEa,IAAAA,EAAM;OAAO,CAAA;AAC9C,MAAA;AACD,IAAA;AAGA,IAAA,MAAM,EAAEC,MAAAA,EAAM,GAAK,MAAM,OAAO,KAAA,CAAA;AAChC,IAAA,MAAMC,KAAAA,GAAQ,MAAM,OAAO,OAAA,CAAA;AAC3B,IAAA,MAAM,EAAEC,OAAAA,EAASC,GAAAA,EAAG,GAAK,MAAM,OAAO,uBAAA,CAAA;AAGtC,IAAA,MAAMC,WAAAA,GAAc,QAAA;AACpB,IAAA,MAAM,EAAEC,aAAAA,EAAa,GAAKL,MAAAA,CAAOC,KAAAA,CAAMK,cAAcH,GAAAA,EAAK;AAAE1B,MAAAA,OAAAA;AAASC,MAAAA,OAAAA;AAAS0B,MAAAA;AAAY,KAAA,CAAA,CAAA;AAC1F,IAAA,MAAMC,aAAAA,EAAAA;EACP,CAAA,CAAA;AACF;AA7EgBlC,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA","file":"chunk-53BJRUUT.js","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { BootProfileType } from \"@vreko/contracts/local-service\";\nimport { Command } from \"commander\";\n\ndeclare const __CLI_VERSION__: string | undefined;\n\n/**\n * Derive the correct BootProfileType from filesystem state.\n * VIRGIN: no .vreko/config.json - first-time init, Detection frame must render.\n * WARM_RETURN: config exists - already initialized; InitApp exits via its guard.\n * WARM_RETURN rendering path is deferred (P2-Medium post-launch work).\n */\nfunction deriveInitProfile(pathArg: string | undefined): BootProfileType {\n\tconst workspacePath = resolve(pathArg || process.cwd());\n\treturn existsSync(join(workspacePath, \".vreko\", \"config.json\")) ? \"WARM_RETURN\" : \"VIRGIN\";\n}\n\n// Export the command maker\nexport function createInitCommand(): Command {\n\treturn new Command(\"init\")\n\t\t.description(\"Bootstrap Vreko for a repository\")\n\t\t.argument(\"[path]\", \"Workspace path (default: current directory)\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompts\")\n\t\t.option(\"--non-interactive\", \"Run without prompts\")\n\t\t.option(\"--json\", \"Output structured JSON summary\")\n\t\t.option(\"--force\", \"Re-initialize even if already set up\")\n\t\t.option(\"--dry-run\", \"Show what would be configured\")\n\t\t.option(\"--skip-mcp\", \"Skip MCP configuration\")\n\t\t.option(\"--skip-service\", \"Skip service registration\")\n\t\t.option(\"--api-key <key>\", \"API key for Pro features\")\n\t\t.option(\"--dev\", \"Use local dev mode for MCP\")\n\t\t.option(\"--npm\", \"Use npm/npx mode for MCP\")\n\t\t.option(\"-q, --quiet\", \"Suppress informational output\")\n\t\t.option(\"-v, --verbose\", \"Show detailed detection reasoning\")\n\t\t.action(async (pathArg: string | undefined, options) => {\n\t\t\t// Guard: if non-TTY, --json, or --non-interactive, delegate to core init\n\t\t\t// The TUI requires a TTY with raw mode support and crashes without one.\n\t\t\tif (options.json || options.nonInteractive || !process.stdin.isTTY) {\n\t\t\t\tconst { createInitCommand: createCoreInit } = await import(\"./init-core.js\");\n\t\t\t\tconst coreCmd = createCoreInit();\n\t\t\t\t// Build argv array for commander parsing\n\t\t\t\tconst argv = [\"node\", \"init\"];\n\t\t\t\tif (pathArg) {\n\t\t\t\t\targv.push(pathArg);\n\t\t\t\t}\n\t\t\t\tif (options.json) {\n\t\t\t\t\targv.push(\"--json\");\n\t\t\t\t}\n\t\t\t\tif (options.nonInteractive) {\n\t\t\t\t\targv.push(\"--non-interactive\");\n\t\t\t\t}\n\t\t\t\tif (options.yes) {\n\t\t\t\t\targv.push(\"--yes\");\n\t\t\t\t}\n\t\t\t\tif (options.force) {\n\t\t\t\t\targv.push(\"--force\");\n\t\t\t\t}\n\t\t\t\tif (options.dryRun) {\n\t\t\t\t\targv.push(\"--dry-run\");\n\t\t\t\t}\n\t\t\t\tif (options.skipMcp) {\n\t\t\t\t\targv.push(\"--skip-mcp\");\n\t\t\t\t}\n\t\t\t\tif (options.skipService) {\n\t\t\t\t\targv.push(\"--skip-service\");\n\t\t\t\t}\n\t\t\t\tif (options.quiet) {\n\t\t\t\t\targv.push(\"--quiet\");\n\t\t\t\t}\n\t\t\t\tif (options.verbose) {\n\t\t\t\t\targv.push(\"--verbose\");\n\t\t\t\t}\n\t\t\t\tif (options.dev) {\n\t\t\t\t\targv.push(\"--dev\");\n\t\t\t\t}\n\t\t\t\tif (options.npm) {\n\t\t\t\t\targv.push(\"--npm\");\n\t\t\t\t}\n\t\t\t\tif (options.apiKey) {\n\t\t\t\t\targv.push(\"--api-key\", options.apiKey);\n\t\t\t\t}\n\t\t\t\tawait coreCmd.parseAsync(argv, { from: \"node\" });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// TTY mode: render the TUI with the correct boot profile.\n\t\t\tconst { render } = await import(\"ink\");\n\t\t\tconst React = await import(\"react\");\n\t\t\tconst { InitApp: App } = await import(\"../../ui/init/InitApp.js\");\n\t\t\t// Always VIRGIN in TUI - WARM_RETURN skips scan so profile state stays\n\t\t\t// null and activation never renders. Re-init runs the full flow instead.\n\t\t\tconst initProfile = \"VIRGIN\" as const;\n\t\t\tconst { waitUntilExit } = render(React.createElement(App, { pathArg, options, initProfile }));\n\t\t\tawait waitUntilExit();\n\t\t});\n}\n"]}
1
+ {"version":3,"sources":["../src/commands/init/init-command.ts"],"names":["createInitCommand","Command","description","argument","option","action","pathArg","options","json","nonInteractive","process","stdin","isTTY","createCoreInit","coreCmd","argv","push","yes","force","dryRun","skipMcp","skipService","quiet","verbose","dev","npm","apiKey","parseAsync","from","render","React","InitApp","App","initProfile","waitUntilExit","createElement"],"mappings":";;;;;;;AAmBO,SAASA,iBAAAA,GAAAA;AACf,EAAA,OAAO,IAAIC,OAAAA,CAAQ,MAAA,CAAA,CACjBC,WAAAA,CAAY,kCAAA,CAAA,CACZC,QAAAA,CAAS,QAAA,EAAU,6CAAA,CAAA,CACnBC,MAAAA,CAAO,WAAA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AAG,GAAK,MAAM,OAAO,uBAAA,CAAA;AAGtC,IAAA,MAAMC,WAAAA,GAAc,QAAA;AACpB,IAAA,MAAM,EAAEC,aAAAA,EAAa,GAAKL,MAAAA,CAAOC,KAAAA,CAAMK,cAAcH,GAAAA,EAAK;AAAE1B,MAAAA,OAAAA;AAASC,MAAAA,OAAAA;AAAS0B,MAAAA;AAAY,KAAA,CAAA,CAAA;AAC1F,IAAA,MAAMC,aAAAA,EAAAA;EACP,CAAA,CAAA;AACF;AA7EgBlC,MAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA","file":"chunk-XB7D22SX.js","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { BootProfileType } from \"@vreko/contracts/local-service\";\nimport { Command } from \"commander\";\n\ndeclare const __CLI_VERSION__: string | undefined;\n\n/**\n * Derive the correct BootProfileType from filesystem state.\n * VIRGIN: no .vreko/config.json - first-time init, Detection frame must render.\n * WARM_RETURN: config exists - already initialized; InitApp exits via its guard.\n * WARM_RETURN rendering path is deferred (P2-Medium post-launch work).\n */\nfunction deriveInitProfile(pathArg: string | undefined): BootProfileType {\n\tconst workspacePath = resolve(pathArg || process.cwd());\n\treturn existsSync(join(workspacePath, \".vreko\", \"config.json\")) ? \"WARM_RETURN\" : \"VIRGIN\";\n}\n\n// Export the command maker\nexport function createInitCommand(): Command {\n\treturn new Command(\"init\")\n\t\t.description(\"Bootstrap Vreko for a repository\")\n\t\t.argument(\"[path]\", \"Workspace path (default: current directory)\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompts\")\n\t\t.option(\"--non-interactive\", \"Run without prompts\")\n\t\t.option(\"--json\", \"Output structured JSON summary\")\n\t\t.option(\"--force\", \"Re-initialize even if already set up\")\n\t\t.option(\"--dry-run\", \"Show what would be configured\")\n\t\t.option(\"--skip-mcp\", \"Skip MCP configuration\")\n\t\t.option(\"--skip-service\", \"Skip service registration\")\n\t\t.option(\"--api-key <key>\", \"API key for Pro features\")\n\t\t.option(\"--dev\", \"Use local dev mode for MCP\")\n\t\t.option(\"--npm\", \"Use npm/npx mode for MCP\")\n\t\t.option(\"-q, --quiet\", \"Suppress informational output\")\n\t\t.option(\"-v, --verbose\", \"Show detailed detection reasoning\")\n\t\t.action(async (pathArg: string | undefined, options) => {\n\t\t\t// Guard: if non-TTY, --json, or --non-interactive, delegate to core init\n\t\t\t// The TUI requires a TTY with raw mode support and crashes without one.\n\t\t\tif (options.json || options.nonInteractive || !process.stdin.isTTY) {\n\t\t\t\tconst { createInitCommand: createCoreInit } = await import(\"./init-core.js\");\n\t\t\t\tconst coreCmd = createCoreInit();\n\t\t\t\t// Build argv array for commander parsing\n\t\t\t\tconst argv = [\"node\", \"init\"];\n\t\t\t\tif (pathArg) {\n\t\t\t\t\targv.push(pathArg);\n\t\t\t\t}\n\t\t\t\tif (options.json) {\n\t\t\t\t\targv.push(\"--json\");\n\t\t\t\t}\n\t\t\t\tif (options.nonInteractive) {\n\t\t\t\t\targv.push(\"--non-interactive\");\n\t\t\t\t}\n\t\t\t\tif (options.yes) {\n\t\t\t\t\targv.push(\"--yes\");\n\t\t\t\t}\n\t\t\t\tif (options.force) {\n\t\t\t\t\targv.push(\"--force\");\n\t\t\t\t}\n\t\t\t\tif (options.dryRun) {\n\t\t\t\t\targv.push(\"--dry-run\");\n\t\t\t\t}\n\t\t\t\tif (options.skipMcp) {\n\t\t\t\t\targv.push(\"--skip-mcp\");\n\t\t\t\t}\n\t\t\t\tif (options.skipService) {\n\t\t\t\t\targv.push(\"--skip-service\");\n\t\t\t\t}\n\t\t\t\tif (options.quiet) {\n\t\t\t\t\targv.push(\"--quiet\");\n\t\t\t\t}\n\t\t\t\tif (options.verbose) {\n\t\t\t\t\targv.push(\"--verbose\");\n\t\t\t\t}\n\t\t\t\tif (options.dev) {\n\t\t\t\t\targv.push(\"--dev\");\n\t\t\t\t}\n\t\t\t\tif (options.npm) {\n\t\t\t\t\targv.push(\"--npm\");\n\t\t\t\t}\n\t\t\t\tif (options.apiKey) {\n\t\t\t\t\targv.push(\"--api-key\", options.apiKey);\n\t\t\t\t}\n\t\t\t\tawait coreCmd.parseAsync(argv, { from: \"node\" });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// TTY mode: render the TUI with the correct boot profile.\n\t\t\tconst { render } = await import(\"ink\");\n\t\t\tconst React = await import(\"react\");\n\t\t\tconst { InitApp: App } = await import(\"../../ui/init/InitApp.js\");\n\t\t\t// Always VIRGIN in TUI - WARM_RETURN skips scan so profile state stays\n\t\t\t// null and activation never renders. Re-init runs the full flow instead.\n\t\t\tconst initProfile = \"VIRGIN\" as const;\n\t\t\tconst { waitUntilExit } = render(React.createElement(App, { pathArg, options, initProfile }));\n\t\t\tawait waitUntilExit();\n\t\t});\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { writeDashboardDescriptor, deleteDashboardDescriptor } from './chunk-I4LIA7HE.js';
3
- import { resolveWorkspaceJsonPath } from './chunk-HEUTZR52.js';
3
+ import { resolveWorkspaceJsonPath } from './chunk-MWTSOZTM.js';
4
4
  import { __name } from './chunk-EWOJGXRX.js';
5
5
  import { readFileSync } from 'fs';
6
6
  import { createServer } from 'http';
@@ -898,5 +898,5 @@ async function startDashboardServer(options) {
898
898
  __name(startDashboardServer, "startDashboardServer");
899
899
 
900
900
  export { startDashboardServer };
901
- //# sourceMappingURL=dashboardServer-2T7OBLSV.js.map
902
- //# sourceMappingURL=dashboardServer-2T7OBLSV.js.map
901
+ //# sourceMappingURL=dashboardServer-MELKRCBX.js.map
902
+ //# sourceMappingURL=dashboardServer-MELKRCBX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ui/dashboard/EmptyState.tsx","../src/ui/dashboard/panels/AIAttributionPanel.tsx","../src/ui/dashboard/panels/CoChangeClustersPanel.tsx","../src/ui/dashboard/panels/FragileZonesPanel.tsx","../src/ui/dashboard/panels/RecentIntelligencePanel.tsx","../src/ui/dashboard/panels/WatchStatusPanel.tsx","../src/ui/dashboard/BrowserDashboardApp.tsx","../src/ui/dashboard/server/sse.ts","../src/ui/dashboard/server/dashboardServer.ts"],"names":["EmptyState","icon","title","hint","div","className","_jsx","span","aria-hidden","p","AIAttributionPanel","data","_data","_jsxs","shortPath","file","parts","split","length","slice","join","CoChangeClustersPanel","clusters","generated","coChange","ul","map","cluster","i","li","files","occurrences","rate","toFixed","fragilityColor","score","FragileZonesPanel","items","fragility","filter","e","excluded","entry","fragilityScore","style","width","Math","round","RecentIntelligencePanel","WatchStatusPanel","serviceConnected","health","fileIndex","fileCount","confidence","observationCount","state","intelligenceState","toLocaleString","BrowserDashboardApp","generatedAt","ts","Date","toLocaleTimeString","id","header","main","footer","a","href","target","rel","SseManager","clients","Set","addClient","res","writeHead","Connection","write","add","on","removeClient","delete","broadcast","event","payload","client","clientCount","size","DASHBOARD_CSS","DASHBOARD_JS","readWorkspaceJson","workspaceJsonPath","raw","readFileSync","JSON","parse","buildHtmlPage","bodyHtml","renderToStaticMarkup","createElement","build503Page","reason","empty","replace","findFreePort","startPort","net","maxAttempts","port","free","Promise","resolve","probe","createServer","once","close","listen","Error","startDashboardServer","options","workspacePath","requestedPort","Number","process","env","VREKO_DASHBOARD_PORT","resolveWorkspaceJsonPath","sseManager","url","watcher","chokidar","watch","persistent","ignoreInitial","awaitWriteFinish","stabilityThreshold","pollInterval","server","req","pathname","end","stringify","degraded","sseClients","html","reject","writeDashboardDescriptor","pid","deleteDashboardDescriptor","exit"],"mappings":";;;;;;;;;;;;AAWO,SAASA,UAAAA,CAAW,EAAEC,IAAAA,EAAMC,KAAAA,EAAOC,MAAI,EAAmB;AAChE,EAAA,4BACEC,KAAAA,EAAAA;IAAIC,SAAAA,EAAU,aAAA;;AACd,sBAAAC,GAAA,CAACC,MAAAA,EAAAA;QAAKF,SAAAA,EAAU,YAAA;QAAaG,aAAAA,EAAY,MAAA;AACvCP,QAAAA,QAAAA,EAAAA;;AAEF,sBAAAK,GAAA,CAACG,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AAAA;AACAQ,IAAAA,OAAAA,CAAQ0B,KAAK,CAAA,CAAA;EACd,CAAA,CAAA;AAEA,EAAA,OAAO;AAAEzC,IAAAA,IAAAA;AAAMoB,IAAAA,GAAAA;AAAKS,IAAAA,MAAAA;AAAQtB,IAAAA;AAAM,GAAA;AACnC;AA1GsBG,MAAAA,CAAAA,oBAAAA,EAAAA,sBAAAA,CAAAA","file":"dashboardServer-2T7OBLSV.js","sourcesContent":["/**\n * EmptyState - shared empty/partial state component for dashboard panels.\n * Every panel reuses this instead of rendering a blank box.\n */\n\ninterface EmptyStateProps {\n\ticon: string;\n\ttitle: string;\n\thint: string;\n}\n\nexport function EmptyState({ icon, title, hint }: EmptyStateProps) {\n\treturn (\n\t\t<div className=\"empty-state\">\n\t\t\t<span className=\"empty-icon\" aria-hidden=\"true\">\n\t\t\t\t{icon}\n\t\t\t</span>\n\t\t\t<p className=\"empty-title\">{title}</p>\n\t\t\t<p className=\"empty-hint\">{hint}</p>\n\t\t</div>\n\t);\n}\n","/**\n * AIAttributionPanel - AI-change attribution breakdown.\n *\n * SCHEMA GAP: generated.attribution does NOT exist in workspace.json.\n * This panel always renders an informative empty state.\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nexport function AIAttributionPanel({ data: _data }: Props) {\n\t// generated.attribution is not present in the schema - always empty state\n\treturn (\n\t\t<div className=\"panel panel-attribution\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">AI Attribution</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t<EmptyState\n\t\t\t\t\ticon=\"&#x2728;\"\n\t\t\t\t\ttitle=\"AI attribution not yet available\"\n\t\t\t\t\thint=\"Per-file AI change attribution will appear here once the Vreko service has captured enough sessions.\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * CoChangeClustersPanel - file pairs that frequently change together.\n * Reads from: generated.coChange (spec says \"clusters\" - actual field is \"coChange\").\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nfunction shortPath(file: string): string {\n\tconst parts = file.split(\"/\");\n\tif (parts.length <= 2) return file;\n\treturn `…/${parts.slice(-1).join(\"/\")}`;\n}\n\nexport function CoChangeClustersPanel({ data }: Props) {\n\t// Actual field is coChange, not clusters\n\tconst clusters = (data.generated?.coChange ?? []).slice(0, 6);\n\n\treturn (\n\t\t<div className=\"panel panel-cochange\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Co-change Clusters</span>\n\t\t\t\t{clusters.length > 0 && <span className=\"panel-count\">{clusters.length} pairs</span>}\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{clusters.length === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x1F517;\"\n\t\t\t\t\t\ttitle=\"No co-change patterns yet\"\n\t\t\t\t\t\thint=\"Vreko detects files that change together. These clusters appear after enough commit history is observed.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"cochange-list\">\n\t\t\t\t\t\t{clusters.map((cluster, i) => (\n\t\t\t\t\t\t\t<li key={i} className=\"cochange-item\">\n\t\t\t\t\t\t\t\t<div className=\"cochange-files\">\n\t\t\t\t\t\t\t\t\t{cluster.files.slice(0, 3).map((file) => (\n\t\t\t\t\t\t\t\t\t\t<span key={file} className=\"cochange-badge\" title={file}>\n\t\t\t\t\t\t\t\t\t\t\t{shortPath(file)}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t{cluster.files.length > 3 && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"cochange-badge cochange-more\">\n\t\t\t\t\t\t\t\t\t\t\t+{cluster.files.length - 3}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<span className=\"cochange-rate\">\n\t\t\t\t\t\t\t\t\t{cluster.occurrences}x · {(cluster.rate * 100).toFixed(0)}%\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * FragileZonesPanel - top fragile files with heat-bar scores.\n * Reads from: generated.fragility\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nfunction fragilityColor(score: number): string {\n\tif (score >= 0.7) return \"fragility-high\";\n\tif (score >= 0.35) return \"fragility-medium\";\n\treturn \"fragility-low\";\n}\n\nfunction shortPath(file: string): string {\n\tconst parts = file.split(\"/\");\n\tif (parts.length <= 3) return file;\n\treturn `…/${parts.slice(-2).join(\"/\")}`;\n}\n\nexport function FragileZonesPanel({ data }: Props) {\n\tconst items = (data.generated?.fragility ?? []).filter((e) => !e.excluded).slice(0, 8);\n\n\treturn (\n\t\t<div className=\"panel panel-fragile\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Fragile Zones</span>\n\t\t\t\t{items.length > 0 && <span className=\"panel-count\">{items.length} files</span>}\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{items.length === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x2665;\"\n\t\t\t\t\t\ttitle=\"No fragile files detected\"\n\t\t\t\t\t\thint=\"Vreko tracks reverts and churn - fragile files surface here after enough observations.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"fragile-list\">\n\t\t\t\t\t\t{items.map((entry) => (\n\t\t\t\t\t\t\t<li key={entry.file} className=\"fragile-item\">\n\t\t\t\t\t\t\t\t<span className=\"fragile-path\" title={entry.file}>\n\t\t\t\t\t\t\t\t\t{shortPath(entry.file)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"fragile-bar-wrap\">\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName={`fragile-bar ${fragilityColor(entry.fragilityScore)}`}\n\t\t\t\t\t\t\t\t\t\tstyle={{ width: `${Math.round(entry.fragilityScore * 100)}%` }}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"fragile-score\">{entry.fragilityScore.toFixed(2)}</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * RecentIntelligencePanel - recent learned patterns and insights.\n *\n * SCHEMA GAP: generated.learnings does NOT exist in workspace.json.\n * This panel always renders an informative empty state.\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nexport function RecentIntelligencePanel({ data: _data }: Props) {\n\t// generated.learnings is not present in the schema - always empty state\n\treturn (\n\t\t<div className=\"panel panel-intelligence\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Recent Intelligence</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t<EmptyState\n\t\t\t\t\ticon=\"&#x1F9E0;\"\n\t\t\t\t\ttitle=\"No intelligence captured yet\"\n\t\t\t\t\thint=\"Run vr learn or use AI coding tools to capture patterns. Insights will surface here as they accumulate.\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * WatchStatusPanel - Vreko service connection status and file index summary.\n * Reads from: health, generated.fileIndex\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n\tserviceConnected: boolean;\n};\n\nexport function WatchStatusPanel({ data, serviceConnected }: Props) {\n\tconst health = data.health;\n\tconst fileIndex = data.generated?.fileIndex ?? [];\n\tconst fileCount = fileIndex.length;\n\tconst confidence = health?.confidence ?? 0;\n\tconst observationCount = health?.observationCount ?? 0;\n\tconst state = health?.intelligenceState ?? \"unknown\";\n\n\treturn (\n\t\t<div className=\"panel panel-watch\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Watch Status</span>\n\t\t\t\t<span className={`status-dot ${serviceConnected ? \"status-connected\" : \"status-disconnected\"}`} />\n\t\t\t\t<span className=\"status-label\">{serviceConnected ? \"Connected\" : \"Not connected\"}</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{fileCount === 0 && observationCount === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x25CF;\"\n\t\t\t\t\t\ttitle=\"No observations yet\"\n\t\t\t\t\t\thint=\"Run vr sync to start collecting workspace intelligence.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"stat-list\">\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Files indexed</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{fileCount.toLocaleString()}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Observations</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{observationCount.toLocaleString()}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Confidence</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{(confidence * 100).toFixed(0)}%</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">State</span>\n\t\t\t\t\t\t\t<span className=\"stat-value stat-mono\">{state}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * BrowserDashboardApp - SSR root for the browser-based local dashboard.\n *\n * Rendered server-side via react-dom/server renderToStaticMarkup.\n * Wraps all five panels and wires them to the workspace.json payload.\n * This is NOT the TUI Ink dashboard (DashboardApp.tsx) - it is a\n * separate, React-to-HTML-string entry point for the HTTP server.\n */\n\nimport { AIAttributionPanel } from \"./panels/AIAttributionPanel.js\";\nimport { CoChangeClustersPanel } from \"./panels/CoChangeClustersPanel.js\";\nimport { FragileZonesPanel } from \"./panels/FragileZonesPanel.js\";\nimport { RecentIntelligencePanel } from \"./panels/RecentIntelligencePanel.js\";\nimport { WatchStatusPanel } from \"./panels/WatchStatusPanel.js\";\nimport type { WorkspaceJson } from \"./types.js\";\n\ninterface BrowserDashboardAppProps {\n\tdata: WorkspaceJson;\n\tserviceConnected: boolean;\n\tgeneratedAt?: string;\n}\n\nexport function BrowserDashboardApp({ data, serviceConnected, generatedAt }: BrowserDashboardAppProps) {\n\tconst ts = generatedAt ? new Date(generatedAt).toLocaleTimeString() : \" - \";\n\n\treturn (\n\t\t<div id=\"vreko-dashboard\">\n\t\t\t<header className=\"dashboard-header\">\n\t\t\t\t<div className=\"header-brand\">\n\t\t\t\t\t<span className=\"brand-mark\">v</span>\n\t\t\t\t\t<span className=\"brand-name\">Vreko</span>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"header-meta\">\n\t\t\t\t\t<span className={`header-status-dot ${serviceConnected ? \"dot-connected\" : \"dot-disconnected\"}`} />\n\t\t\t\t\t<span className=\"header-status-label\">\n\t\t\t\t\t\t{serviceConnected ? \"Service connected\" : \"Service not connected\"}\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"header-ts\">Updated {ts}</span>\n\t\t\t\t</div>\n\t\t\t</header>\n\n\t\t\t{!serviceConnected && (\n\t\t\t\t<div className=\"degraded-banner\">\n\t\t\t\t\tVreko service not connected - showing last captured state. Live updates resume when the service is\n\t\t\t\t\trunning.\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<main className=\"dashboard-grid\">\n\t\t\t\t<WatchStatusPanel data={data} serviceConnected={serviceConnected} />\n\t\t\t\t<FragileZonesPanel data={data} />\n\t\t\t\t<CoChangeClustersPanel data={data} />\n\t\t\t\t<AIAttributionPanel data={data} />\n\t\t\t\t<RecentIntelligencePanel data={data} />\n\t\t\t</main>\n\n\t\t\t<footer className=\"dashboard-footer\">\n\t\t\t\t<span>\n\t\t\t\t\t<a href=\"https://vreko.dev\" target=\"_blank\" rel=\"noopener noreferrer\">\n\t\t\t\t\t\tvreko.dev\n\t\t\t\t\t</a>\n\t\t\t\t</span>\n\t\t\t\t<span>Local dashboard · 127.0.0.1</span>\n\t\t\t</footer>\n\t\t</div>\n\t);\n}\n","/**\n * SSE Manager\n *\n * Manages a set of connected SSE clients and broadcasts events.\n * SSE is a notification-only channel - workspace.json body is never pushed over SSE.\n *\n * Emit format: event: workspace:updated\\ndata: {}\\n\\n\n */\n\nimport type { ServerResponse } from \"node:http\";\n\nexport class SseManager {\n\tprivate clients: Set<ServerResponse> = new Set();\n\n\t/**\n\t * Register a new SSE client connection.\n\t * Sets appropriate headers for the SSE stream.\n\t */\n\taddClient(res: ServerResponse): void {\n\t\tres.writeHead(200, {\n\t\t\t\"Content-Type\": \"text/event-stream\",\n\t\t\t\"Cache-Control\": \"no-cache\",\n\t\t\tConnection: \"keep-alive\",\n\t\t\t\"X-Accel-Buffering\": \"no\",\n\t\t});\n\t\tres.write(\": connected\\n\\n\");\n\t\tthis.clients.add(res);\n\n\t\tres.on(\"close\", () => {\n\t\t\tthis.removeClient(res);\n\t\t});\n\t}\n\n\t/**\n\t * Deregister a client.\n\t */\n\tremoveClient(res: ServerResponse): void {\n\t\tthis.clients.delete(res);\n\t}\n\n\t/**\n\t * Broadcast an event to all connected clients.\n\t * Only sends the event name and an empty data payload (notification-only).\n\t */\n\tbroadcast(event: string): void {\n\t\tconst payload = `event: ${event}\\ndata: {}\\n\\n`;\n\t\tfor (const client of this.clients) {\n\t\t\ttry {\n\t\t\t\tclient.write(payload);\n\t\t\t} catch {\n\t\t\t\t// Client disconnected mid-write - remove it\n\t\t\t\tthis.removeClient(client);\n\t\t\t}\n\t\t}\n\t}\n\n\tget clientCount(): number {\n\t\treturn this.clients.size;\n\t}\n}\n","/**\n * Dashboard HTTP Server\n *\n * Serves the Vreko local browser dashboard.\n * - Binds 127.0.0.1 ONLY (never 0.0.0.0)\n * - Default port: 7842 (VREKO_DASHBOARD_PORT env / --port flag)\n * - On EADDRINUSE: scans port+1 to port+20\n * - Serves SSR HTML, /api/workspace, /api/health, /events (SSE)\n * - SSE is notification-only; workspace.json body is fetched via /api/workspace\n * - File-watch fallback via chokidar when service not connected\n */\n\nimport { readFileSync } from \"node:fs\";\nimport type { IncomingMessage, Server, ServerResponse } from \"node:http\";\nimport { createServer } from \"node:http\";\nimport chokidar from \"chokidar\";\nimport { createElement } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { resolveWorkspaceJsonPath } from \"../../../utils/workspace.js\";\nimport { BrowserDashboardApp } from \"../BrowserDashboardApp.js\";\nimport type { WorkspaceJson } from \"../types.js\";\nimport { deleteDashboardDescriptor, writeDashboardDescriptor } from \"./descriptor.js\";\nimport { SseManager } from \"./sse.js\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface DashboardServerOptions {\n\tworkspacePath: string;\n\tport?: number;\n}\n\nexport interface DashboardServerHandle {\n\tport: number;\n\turl: string;\n\tserver: Server;\n\tclose: () => void;\n}\n\n// =============================================================================\n// INLINE CSS - production-grade dark terminal aesthetic\n// =============================================================================\n\nconst DASHBOARD_CSS = `\n*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\n:root {\n --green: #4ADE80;\n --green-dim: #22c55e;\n --amber: #f59e0b;\n --red: #f87171;\n --bg: #0d1117;\n --bg-panel: #161b22;\n --bg-panel-header: #1c2330;\n --border: #30363d;\n --text: #e6edf3;\n --text-dim: #8b949e;\n --text-mono: #d2a8ff;\n --radius: 8px;\n}\n\nbody {\n background: var(--bg);\n color: var(--text);\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n font-size: 14px;\n line-height: 1.5;\n min-height: 100vh;\n}\n\n#vreko-dashboard {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n max-width: 1200px;\n margin: 0 auto;\n padding: 0 16px;\n}\n\n/* HEADER */\n.dashboard-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 0 12px;\n border-bottom: 1px solid var(--border);\n margin-bottom: 20px;\n}\n.header-brand {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.brand-mark {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n background: var(--green);\n color: #000;\n font-weight: 700;\n font-size: 14px;\n border-radius: 6px;\n}\n.brand-name {\n font-size: 18px;\n font-weight: 600;\n color: var(--text);\n letter-spacing: -0.3px;\n}\n.header-meta {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 12px;\n color: var(--text-dim);\n}\n.header-status-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n}\n.dot-connected { background: var(--green); box-shadow: 0 0 6px var(--green); }\n.dot-disconnected { background: var(--amber); }\n.header-ts { color: var(--text-dim); }\n\n/* DEGRADED BANNER */\n.degraded-banner {\n background: rgba(245,158,11,0.12);\n border: 1px solid rgba(245,158,11,0.35);\n border-radius: var(--radius);\n padding: 10px 14px;\n margin-bottom: 16px;\n color: var(--amber);\n font-size: 13px;\n}\n\n/* GRID */\n.dashboard-grid {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 16px;\n flex: 1;\n}\n@media (max-width: 700px) {\n .dashboard-grid { grid-template-columns: 1fr; }\n}\n\n/* PANEL */\n.panel {\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n overflow: hidden;\n}\n.panel-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n background: var(--bg-panel-header);\n border-bottom: 1px solid var(--border);\n}\n.panel-title {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.6px;\n color: var(--green);\n}\n.panel-count {\n margin-left: auto;\n font-size: 11px;\n color: var(--text-dim);\n}\n.panel-body { padding: 14px; }\n\n/* STATUS DOT IN PANEL */\n.status-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.status-connected { background: var(--green); box-shadow: 0 0 5px var(--green); }\n.status-disconnected { background: var(--amber); }\n.status-label { font-size: 12px; color: var(--text-dim); }\n\n/* STAT LIST */\n.stat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }\n.stat-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 13px;\n}\n.stat-label { color: var(--text-dim); }\n.stat-value { font-weight: 500; }\n.stat-mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-mono); }\n\n/* FRAGILE LIST */\n.fragile-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }\n.fragile-item {\n display: grid;\n grid-template-columns: 1fr 80px 36px;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n}\n.fragile-path {\n font-family: ui-monospace, monospace;\n color: var(--text-dim);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fragile-bar-wrap {\n height: 6px;\n background: rgba(255,255,255,0.07);\n border-radius: 3px;\n overflow: hidden;\n}\n.fragile-bar {\n display: block;\n height: 100%;\n border-radius: 3px;\n transition: width 0.4s ease;\n}\n.fragility-high { background: var(--red); }\n.fragility-medium { background: var(--amber); }\n.fragility-low { background: var(--green-dim); }\n.fragile-score {\n font-family: ui-monospace, monospace;\n text-align: right;\n color: var(--text-dim);\n}\n\n/* CO-CHANGE LIST */\n.cochange-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }\n.cochange-item { display: flex; flex-direction: column; gap: 4px; }\n.cochange-files { display: flex; flex-wrap: wrap; gap: 4px; }\n.cochange-badge {\n display: inline-block;\n padding: 2px 7px;\n background: rgba(74,222,128,0.1);\n border: 1px solid rgba(74,222,128,0.25);\n border-radius: 4px;\n font-family: ui-monospace, monospace;\n font-size: 11px;\n color: var(--green);\n white-space: nowrap;\n max-width: 180px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.cochange-more {\n background: rgba(255,255,255,0.05);\n border-color: var(--border);\n color: var(--text-dim);\n}\n.cochange-rate { font-size: 11px; color: var(--text-dim); }\n\n/* EMPTY STATE */\n.empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n padding: 24px 16px;\n text-align: center;\n}\n.empty-icon {\n font-size: 22px;\n opacity: 0.4;\n}\n.empty-title {\n font-size: 13px;\n font-weight: 500;\n color: var(--text-dim);\n}\n.empty-hint {\n font-size: 12px;\n color: var(--text-dim);\n opacity: 0.7;\n max-width: 240px;\n}\n\n/* FOOTER */\n.dashboard-footer {\n display: flex;\n justify-content: space-between;\n padding: 12px 0 16px;\n border-top: 1px solid var(--border);\n margin-top: 20px;\n font-size: 11px;\n color: var(--text-dim);\n}\n.dashboard-footer a { color: var(--text-dim); text-decoration: none; }\n.dashboard-footer a:hover { color: var(--green); }\n\n/* SSE FADE-IN ANIMATION */\n@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }\n.sse-updated { animation: fadeIn 0.35s ease; }\n`;\n\n// =============================================================================\n// INLINE JS - SSE client + workspace refresh\n// =============================================================================\n\nconst DASHBOARD_JS = `\n(function() {\n var es = new EventSource('/events');\n es.addEventListener('workspace:updated', function() {\n fetch('/api/workspace')\n .then(function(r) { return r.json(); })\n .then(function(data) {\n if (data && !data.degraded) {\n // Reload page to re-render SSR with fresh data\n // A future enhancement can do fine-grained DOM patching here\n document.body.classList.add('sse-updated');\n setTimeout(function() { window.location.reload(); }, 300);\n }\n })\n .catch(function() {});\n });\n es.onerror = function() {\n // SSE reconnect is handled automatically by EventSource\n };\n})();\n`;\n\n// =============================================================================\n// UTILITIES\n// =============================================================================\n\nfunction readWorkspaceJson(workspaceJsonPath: string): WorkspaceJson | null {\n\ttry {\n\t\tconst raw = readFileSync(workspaceJsonPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as WorkspaceJson;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction buildHtmlPage(data: WorkspaceJson, serviceConnected: boolean): string {\n\tconst generatedAt = data.generated?.generatedAt;\n\tconst bodyHtml = renderToStaticMarkup(createElement(BrowserDashboardApp, { data, serviceConnected, generatedAt }));\n\n\treturn `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Vreko Local Dashboard</title>\n<style>${DASHBOARD_CSS}</style>\n</head>\n<body>\n${bodyHtml}\n<script>${DASHBOARD_JS}</script>\n</body>\n</html>`;\n}\n\nfunction build503Page(reason: string, serviceConnected: boolean): string {\n\tconst empty: WorkspaceJson = {};\n\treturn buildHtmlPage(empty, serviceConnected).replace(\"</body>\", `<!-- degraded: ${reason} --></body>`);\n}\n\n// =============================================================================\n// PORT SCANNING\n// =============================================================================\n\nasync function findFreePort(startPort: number): Promise<number> {\n\tconst net = await import(\"node:net\");\n\tconst maxAttempts = 21;\n\tfor (let i = 0; i < maxAttempts; i++) {\n\t\tconst port = startPort + i;\n\t\tconst free = await new Promise<boolean>((resolve) => {\n\t\t\tconst probe = net.createServer();\n\t\t\tprobe.once(\"error\", () => resolve(false));\n\t\t\tprobe.once(\"listening\", () => {\n\t\t\t\tprobe.close(() => resolve(true));\n\t\t\t});\n\t\t\tprobe.listen(port, \"127.0.0.1\");\n\t\t});\n\t\tif (free) return port;\n\t}\n\tthrow new Error(`No free port found in range ${startPort}–${startPort + 20}. Stop another process and retry.`);\n}\n\n// =============================================================================\n// SERVER FACTORY\n// =============================================================================\n\n// biome-ignore lint/complexity/noExcessiveLinesPerFunction: server factory integrates port-scan, watch, and request routing\nexport async function startDashboardServer(options: DashboardServerOptions): Promise<DashboardServerHandle> {\n\tconst { workspacePath } = options;\n\tconst requestedPort = options.port ?? Number(process.env.VREKO_DASHBOARD_PORT ?? 7842);\n\n\tconst workspaceJsonPath = resolveWorkspaceJsonPath(workspacePath);\n\tconst sseManager = new SseManager();\n\n\t// Try to find a free port\n\tconst port = await findFreePort(requestedPort);\n\tconst url = `http://127.0.0.1:${port}`;\n\n\t// We don't import @vreko/intelligence directly (ARCH-01), so service\n\t// connection is detected by whether the workspace.json file exists and\n\t// was recently modified. A future phase can wire the IPC service emitter.\n\tlet serviceConnected = false;\n\n\t// Set up chokidar file-watch fallback (SSE fallback)\n\tconst watcher = chokidar.watch(workspaceJsonPath, {\n\t\tpersistent: true,\n\t\tignoreInitial: true,\n\t\tawaitWriteFinish: { stabilityThreshold: 200, pollInterval: 50 },\n\t});\n\n\twatcher.on(\"change\", () => {\n\t\tserviceConnected = true;\n\t\tsseManager.broadcast(\"workspace:updated\");\n\t});\n\n\tconst server = createServer((req: IncomingMessage, res: ServerResponse) => {\n\t\tconst pathname = req.url?.split(\"?\")[0] ?? \"/\";\n\n\t\t// SSE endpoint\n\t\tif (pathname === \"/events\") {\n\t\t\tsseManager.addClient(res);\n\t\t\treturn;\n\t\t}\n\n\t\t// API: workspace data\n\t\tif (pathname === \"/api/workspace\") {\n\t\t\tconst data = readWorkspaceJson(workspaceJsonPath);\n\t\t\tif (!data) {\n\t\t\t\tres.writeHead(503, { \"Content-Type\": \"application/json\" });\n\t\t\t\tres.end(JSON.stringify({ degraded: true, reason: \"workspace.json not found or unreadable\" }));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres.writeHead(200, { \"Content-Type\": \"application/json\" });\n\t\t\tres.end(JSON.stringify(data));\n\t\t\treturn;\n\t\t}\n\n\t\t// API: health\n\t\tif (pathname === \"/api/health\") {\n\t\t\tres.writeHead(200, { \"Content-Type\": \"application/json\" });\n\t\t\tres.end(\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tserver: true,\n\t\t\t\t\tserviceConnected,\n\t\t\t\t\tworkspaceJsonPath,\n\t\t\t\t\tsseClients: sseManager.clientCount,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// SPA fallback - serve SSR HTML\n\t\tconst data = readWorkspaceJson(workspaceJsonPath);\n\t\tif (!data) {\n\t\t\tres.writeHead(503, { \"Content-Type\": \"text/html; charset=utf-8\" });\n\t\t\tres.end(build503Page(\"workspace.json not found\", serviceConnected));\n\t\t\treturn;\n\t\t}\n\n\t\tconst html = buildHtmlPage(data, serviceConnected);\n\t\tres.writeHead(200, { \"Content-Type\": \"text/html; charset=utf-8\" });\n\t\tres.end(html);\n\t});\n\n\tawait new Promise<void>((resolve, reject) => {\n\t\tserver.once(\"error\", reject);\n\t\t// NEVER bind to 0.0.0.0\n\t\tserver.listen(port, \"127.0.0.1\", () => {\n\t\t\tresolve();\n\t\t});\n\t});\n\n\t// Write discovery descriptor\n\twriteDashboardDescriptor(url, port, process.pid);\n\n\tconst close = () => {\n\t\twatcher.close();\n\t\tserver.close();\n\t\tdeleteDashboardDescriptor();\n\t};\n\n\t// Clean up descriptor on process exit\n\tprocess.once(\"exit\", close);\n\tprocess.once(\"SIGINT\", () => {\n\t\tclose();\n\t\tprocess.exit(0);\n\t});\n\tprocess.once(\"SIGTERM\", () => {\n\t\tclose();\n\t\tprocess.exit(0);\n\t});\n\n\treturn { port, url, server, close };\n}\n"]}
1
+ {"version":3,"sources":["../src/ui/dashboard/EmptyState.tsx","../src/ui/dashboard/panels/AIAttributionPanel.tsx","../src/ui/dashboard/panels/CoChangeClustersPanel.tsx","../src/ui/dashboard/panels/FragileZonesPanel.tsx","../src/ui/dashboard/panels/RecentIntelligencePanel.tsx","../src/ui/dashboard/panels/WatchStatusPanel.tsx","../src/ui/dashboard/BrowserDashboardApp.tsx","../src/ui/dashboard/server/sse.ts","../src/ui/dashboard/server/dashboardServer.ts"],"names":["EmptyState","icon","title","hint","div","className","_jsx","span","aria-hidden","p","AIAttributionPanel","data","_data","_jsxs","shortPath","file","parts","split","length","slice","join","CoChangeClustersPanel","clusters","generated","coChange","ul","map","cluster","i","li","files","occurrences","rate","toFixed","fragilityColor","score","FragileZonesPanel","items","fragility","filter","e","excluded","entry","fragilityScore","style","width","Math","round","RecentIntelligencePanel","WatchStatusPanel","serviceConnected","health","fileIndex","fileCount","confidence","observationCount","state","intelligenceState","toLocaleString","BrowserDashboardApp","generatedAt","ts","Date","toLocaleTimeString","id","header","main","footer","a","href","target","rel","SseManager","clients","Set","addClient","res","writeHead","Connection","write","add","on","removeClient","delete","broadcast","event","payload","client","clientCount","size","DASHBOARD_CSS","DASHBOARD_JS","readWorkspaceJson","workspaceJsonPath","raw","readFileSync","JSON","parse","buildHtmlPage","bodyHtml","renderToStaticMarkup","createElement","build503Page","reason","empty","replace","findFreePort","startPort","net","maxAttempts","port","free","Promise","resolve","probe","createServer","once","close","listen","Error","startDashboardServer","options","workspacePath","requestedPort","Number","process","env","VREKO_DASHBOARD_PORT","resolveWorkspaceJsonPath","sseManager","url","watcher","chokidar","watch","persistent","ignoreInitial","awaitWriteFinish","stabilityThreshold","pollInterval","server","req","pathname","end","stringify","degraded","sseClients","html","reject","writeDashboardDescriptor","pid","deleteDashboardDescriptor","exit"],"mappings":";;;;;;;;;;;;AAWO,SAASA,UAAAA,CAAW,EAAEC,IAAAA,EAAMC,KAAAA,EAAOC,MAAI,EAAmB;AAChE,EAAA,4BACEC,KAAAA,EAAAA;IAAIC,SAAAA,EAAU,aAAA;;AACd,sBAAAC,GAAA,CAACC,MAAAA,EAAAA;QAAKF,SAAAA,EAAU,YAAA;QAAaG,aAAAA,EAAY,MAAA;AACvCP,QAAAA,Q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CAAK,WAAW,MAAA;AACvBC,IAAAA,KAAAA,EAAAA;AACAQ,IAAAA,OAAAA,CAAQ0B,KAAK,CAAA,CAAA;EACd,CAAA,CAAA;AAEA,EAAA,OAAO;AAAEzC,IAAAA,IAAAA;AAAMoB,IAAAA,GAAAA;AAAKS,IAAAA,MAAAA;AAAQtB,IAAAA;AAAM,GAAA;AACnC;AA1GsBG,MAAAA,CAAAA,oBAAAA,EAAAA,sBAAAA,CAAAA","file":"dashboardServer-MELKRCBX.js","sourcesContent":["/**\n * EmptyState - shared empty/partial state component for dashboard panels.\n * Every panel reuses this instead of rendering a blank box.\n */\n\ninterface EmptyStateProps {\n\ticon: string;\n\ttitle: string;\n\thint: string;\n}\n\nexport function EmptyState({ icon, title, hint }: EmptyStateProps) {\n\treturn (\n\t\t<div className=\"empty-state\">\n\t\t\t<span className=\"empty-icon\" aria-hidden=\"true\">\n\t\t\t\t{icon}\n\t\t\t</span>\n\t\t\t<p className=\"empty-title\">{title}</p>\n\t\t\t<p className=\"empty-hint\">{hint}</p>\n\t\t</div>\n\t);\n}\n","/**\n * AIAttributionPanel - AI-change attribution breakdown.\n *\n * SCHEMA GAP: generated.attribution does NOT exist in workspace.json.\n * This panel always renders an informative empty state.\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nexport function AIAttributionPanel({ data: _data }: Props) {\n\t// generated.attribution is not present in the schema - always empty state\n\treturn (\n\t\t<div className=\"panel panel-attribution\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">AI Attribution</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t<EmptyState\n\t\t\t\t\ticon=\"&#x2728;\"\n\t\t\t\t\ttitle=\"AI attribution not yet available\"\n\t\t\t\t\thint=\"Per-file AI change attribution will appear here once the Vreko service has captured enough sessions.\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * CoChangeClustersPanel - file pairs that frequently change together.\n * Reads from: generated.coChange (spec says \"clusters\" - actual field is \"coChange\").\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nfunction shortPath(file: string): string {\n\tconst parts = file.split(\"/\");\n\tif (parts.length <= 2) return file;\n\treturn `…/${parts.slice(-1).join(\"/\")}`;\n}\n\nexport function CoChangeClustersPanel({ data }: Props) {\n\t// Actual field is coChange, not clusters\n\tconst clusters = (data.generated?.coChange ?? []).slice(0, 6);\n\n\treturn (\n\t\t<div className=\"panel panel-cochange\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Co-change Clusters</span>\n\t\t\t\t{clusters.length > 0 && <span className=\"panel-count\">{clusters.length} pairs</span>}\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{clusters.length === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x1F517;\"\n\t\t\t\t\t\ttitle=\"No co-change patterns yet\"\n\t\t\t\t\t\thint=\"Vreko detects files that change together. These clusters appear after enough commit history is observed.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"cochange-list\">\n\t\t\t\t\t\t{clusters.map((cluster, i) => (\n\t\t\t\t\t\t\t<li key={i} className=\"cochange-item\">\n\t\t\t\t\t\t\t\t<div className=\"cochange-files\">\n\t\t\t\t\t\t\t\t\t{cluster.files.slice(0, 3).map((file) => (\n\t\t\t\t\t\t\t\t\t\t<span key={file} className=\"cochange-badge\" title={file}>\n\t\t\t\t\t\t\t\t\t\t\t{shortPath(file)}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t{cluster.files.length > 3 && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"cochange-badge cochange-more\">\n\t\t\t\t\t\t\t\t\t\t\t+{cluster.files.length - 3}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<span className=\"cochange-rate\">\n\t\t\t\t\t\t\t\t\t{cluster.occurrences}x · {(cluster.rate * 100).toFixed(0)}%\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * FragileZonesPanel - top fragile files with heat-bar scores.\n * Reads from: generated.fragility\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nfunction fragilityColor(score: number): string {\n\tif (score >= 0.7) return \"fragility-high\";\n\tif (score >= 0.35) return \"fragility-medium\";\n\treturn \"fragility-low\";\n}\n\nfunction shortPath(file: string): string {\n\tconst parts = file.split(\"/\");\n\tif (parts.length <= 3) return file;\n\treturn `…/${parts.slice(-2).join(\"/\")}`;\n}\n\nexport function FragileZonesPanel({ data }: Props) {\n\tconst items = (data.generated?.fragility ?? []).filter((e) => !e.excluded).slice(0, 8);\n\n\treturn (\n\t\t<div className=\"panel panel-fragile\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Fragile Zones</span>\n\t\t\t\t{items.length > 0 && <span className=\"panel-count\">{items.length} files</span>}\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{items.length === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x2665;\"\n\t\t\t\t\t\ttitle=\"No fragile files detected\"\n\t\t\t\t\t\thint=\"Vreko tracks reverts and churn - fragile files surface here after enough observations.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"fragile-list\">\n\t\t\t\t\t\t{items.map((entry) => (\n\t\t\t\t\t\t\t<li key={entry.file} className=\"fragile-item\">\n\t\t\t\t\t\t\t\t<span className=\"fragile-path\" title={entry.file}>\n\t\t\t\t\t\t\t\t\t{shortPath(entry.file)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"fragile-bar-wrap\">\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclassName={`fragile-bar ${fragilityColor(entry.fragilityScore)}`}\n\t\t\t\t\t\t\t\t\t\tstyle={{ width: `${Math.round(entry.fragilityScore * 100)}%` }}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"fragile-score\">{entry.fragilityScore.toFixed(2)}</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * RecentIntelligencePanel - recent learned patterns and insights.\n *\n * SCHEMA GAP: generated.learnings does NOT exist in workspace.json.\n * This panel always renders an informative empty state.\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n};\n\nexport function RecentIntelligencePanel({ data: _data }: Props) {\n\t// generated.learnings is not present in the schema - always empty state\n\treturn (\n\t\t<div className=\"panel panel-intelligence\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Recent Intelligence</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t<EmptyState\n\t\t\t\t\ticon=\"&#x1F9E0;\"\n\t\t\t\t\ttitle=\"No intelligence captured yet\"\n\t\t\t\t\thint=\"Run vr learn or use AI coding tools to capture patterns. Insights will surface here as they accumulate.\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * WatchStatusPanel - Vreko service connection status and file index summary.\n * Reads from: health, generated.fileIndex\n */\n\nimport { EmptyState } from \"../EmptyState.js\";\nimport type { WorkspaceJson } from \"../types.js\";\n\ntype Props = {\n\tdata: WorkspaceJson;\n\tserviceConnected: boolean;\n};\n\nexport function WatchStatusPanel({ data, serviceConnected }: Props) {\n\tconst health = data.health;\n\tconst fileIndex = data.generated?.fileIndex ?? [];\n\tconst fileCount = fileIndex.length;\n\tconst confidence = health?.confidence ?? 0;\n\tconst observationCount = health?.observationCount ?? 0;\n\tconst state = health?.intelligenceState ?? \"unknown\";\n\n\treturn (\n\t\t<div className=\"panel panel-watch\">\n\t\t\t<div className=\"panel-header\">\n\t\t\t\t<span className=\"panel-title\">Watch Status</span>\n\t\t\t\t<span className={`status-dot ${serviceConnected ? \"status-connected\" : \"status-disconnected\"}`} />\n\t\t\t\t<span className=\"status-label\">{serviceConnected ? \"Connected\" : \"Not connected\"}</span>\n\t\t\t</div>\n\t\t\t<div className=\"panel-body\">\n\t\t\t\t{fileCount === 0 && observationCount === 0 ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\ticon=\"&#x25CF;\"\n\t\t\t\t\t\ttitle=\"No observations yet\"\n\t\t\t\t\t\thint=\"Run vr sync to start collecting workspace intelligence.\"\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<ul className=\"stat-list\">\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Files indexed</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{fileCount.toLocaleString()}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Observations</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{observationCount.toLocaleString()}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">Confidence</span>\n\t\t\t\t\t\t\t<span className=\"stat-value\">{(confidence * 100).toFixed(0)}%</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"stat-item\">\n\t\t\t\t\t\t\t<span className=\"stat-label\">State</span>\n\t\t\t\t\t\t\t<span className=\"stat-value stat-mono\">{state}</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","/**\n * BrowserDashboardApp - SSR root for the browser-based local dashboard.\n *\n * Rendered server-side via react-dom/server renderToStaticMarkup.\n * Wraps all five panels and wires them to the workspace.json payload.\n * This is NOT the TUI Ink dashboard (DashboardApp.tsx) - it is a\n * separate, React-to-HTML-string entry point for the HTTP server.\n */\n\nimport { AIAttributionPanel } from \"./panels/AIAttributionPanel.js\";\nimport { CoChangeClustersPanel } from \"./panels/CoChangeClustersPanel.js\";\nimport { FragileZonesPanel } from \"./panels/FragileZonesPanel.js\";\nimport { RecentIntelligencePanel } from \"./panels/RecentIntelligencePanel.js\";\nimport { WatchStatusPanel } from \"./panels/WatchStatusPanel.js\";\nimport type { WorkspaceJson } from \"./types.js\";\n\ninterface BrowserDashboardAppProps {\n\tdata: WorkspaceJson;\n\tserviceConnected: boolean;\n\tgeneratedAt?: string;\n}\n\nexport function BrowserDashboardApp({ data, serviceConnected, generatedAt }: BrowserDashboardAppProps) {\n\tconst ts = generatedAt ? new Date(generatedAt).toLocaleTimeString() : \" - \";\n\n\treturn (\n\t\t<div id=\"vreko-dashboard\">\n\t\t\t<header className=\"dashboard-header\">\n\t\t\t\t<div className=\"header-brand\">\n\t\t\t\t\t<span className=\"brand-mark\">v</span>\n\t\t\t\t\t<span className=\"brand-name\">Vreko</span>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"header-meta\">\n\t\t\t\t\t<span className={`header-status-dot ${serviceConnected ? \"dot-connected\" : \"dot-disconnected\"}`} />\n\t\t\t\t\t<span className=\"header-status-label\">\n\t\t\t\t\t\t{serviceConnected ? \"Service connected\" : \"Service not connected\"}\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"header-ts\">Updated {ts}</span>\n\t\t\t\t</div>\n\t\t\t</header>\n\n\t\t\t{!serviceConnected && (\n\t\t\t\t<div className=\"degraded-banner\">\n\t\t\t\t\tVreko service not connected - showing last captured state. Live updates resume when the service is\n\t\t\t\t\trunning.\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<main className=\"dashboard-grid\">\n\t\t\t\t<WatchStatusPanel data={data} serviceConnected={serviceConnected} />\n\t\t\t\t<FragileZonesPanel data={data} />\n\t\t\t\t<CoChangeClustersPanel data={data} />\n\t\t\t\t<AIAttributionPanel data={data} />\n\t\t\t\t<RecentIntelligencePanel data={data} />\n\t\t\t</main>\n\n\t\t\t<footer className=\"dashboard-footer\">\n\t\t\t\t<span>\n\t\t\t\t\t<a href=\"https://vreko.dev\" target=\"_blank\" rel=\"noopener noreferrer\">\n\t\t\t\t\t\tvreko.dev\n\t\t\t\t\t</a>\n\t\t\t\t</span>\n\t\t\t\t<span>Local dashboard · 127.0.0.1</span>\n\t\t\t</footer>\n\t\t</div>\n\t);\n}\n","/**\n * SSE Manager\n *\n * Manages a set of connected SSE clients and broadcasts events.\n * SSE is a notification-only channel - workspace.json body is never pushed over SSE.\n *\n * Emit format: event: workspace:updated\\ndata: {}\\n\\n\n */\n\nimport type { ServerResponse } from \"node:http\";\n\nexport class SseManager {\n\tprivate clients: Set<ServerResponse> = new Set();\n\n\t/**\n\t * Register a new SSE client connection.\n\t * Sets appropriate headers for the SSE stream.\n\t */\n\taddClient(res: ServerResponse): void {\n\t\tres.writeHead(200, {\n\t\t\t\"Content-Type\": \"text/event-stream\",\n\t\t\t\"Cache-Control\": \"no-cache\",\n\t\t\tConnection: \"keep-alive\",\n\t\t\t\"X-Accel-Buffering\": \"no\",\n\t\t});\n\t\tres.write(\": connected\\n\\n\");\n\t\tthis.clients.add(res);\n\n\t\tres.on(\"close\", () => {\n\t\t\tthis.removeClient(res);\n\t\t});\n\t}\n\n\t/**\n\t * Deregister a client.\n\t */\n\tremoveClient(res: ServerResponse): void {\n\t\tthis.clients.delete(res);\n\t}\n\n\t/**\n\t * Broadcast an event to all connected clients.\n\t * Only sends the event name and an empty data payload (notification-only).\n\t */\n\tbroadcast(event: string): void {\n\t\tconst payload = `event: ${event}\\ndata: {}\\n\\n`;\n\t\tfor (const client of this.clients) {\n\t\t\ttry {\n\t\t\t\tclient.write(payload);\n\t\t\t} catch {\n\t\t\t\t// Client disconnected mid-write - remove it\n\t\t\t\tthis.removeClient(client);\n\t\t\t}\n\t\t}\n\t}\n\n\tget clientCount(): number {\n\t\treturn this.clients.size;\n\t}\n}\n","/**\n * Dashboard HTTP Server\n *\n * Serves the Vreko local browser dashboard.\n * - Binds 127.0.0.1 ONLY (never 0.0.0.0)\n * - Default port: 7842 (VREKO_DASHBOARD_PORT env / --port flag)\n * - On EADDRINUSE: scans port+1 to port+20\n * - Serves SSR HTML, /api/workspace, /api/health, /events (SSE)\n * - SSE is notification-only; workspace.json body is fetched via /api/workspace\n * - File-watch fallback via chokidar when service not connected\n */\n\nimport { readFileSync } from \"node:fs\";\nimport type { IncomingMessage, Server, ServerResponse } from \"node:http\";\nimport { createServer } from \"node:http\";\nimport chokidar from \"chokidar\";\nimport { createElement } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport { resolveWorkspaceJsonPath } from \"../../../utils/workspace.js\";\nimport { BrowserDashboardApp } from \"../BrowserDashboardApp.js\";\nimport type { WorkspaceJson } from \"../types.js\";\nimport { deleteDashboardDescriptor, writeDashboardDescriptor } from \"./descriptor.js\";\nimport { SseManager } from \"./sse.js\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport interface DashboardServerOptions {\n\tworkspacePath: string;\n\tport?: number;\n}\n\nexport interface DashboardServerHandle {\n\tport: number;\n\turl: string;\n\tserver: Server;\n\tclose: () => void;\n}\n\n// =============================================================================\n// INLINE CSS - production-grade dark terminal aesthetic\n// =============================================================================\n\nconst DASHBOARD_CSS = `\n*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\n:root {\n --green: #4ADE80;\n --green-dim: #22c55e;\n --amber: #f59e0b;\n --red: #f87171;\n --bg: #0d1117;\n --bg-panel: #161b22;\n --bg-panel-header: #1c2330;\n --border: #30363d;\n --text: #e6edf3;\n --text-dim: #8b949e;\n --text-mono: #d2a8ff;\n --radius: 8px;\n}\n\nbody {\n background: var(--bg);\n color: var(--text);\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n font-size: 14px;\n line-height: 1.5;\n min-height: 100vh;\n}\n\n#vreko-dashboard {\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n max-width: 1200px;\n margin: 0 auto;\n padding: 0 16px;\n}\n\n/* HEADER */\n.dashboard-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 0 12px;\n border-bottom: 1px solid var(--border);\n margin-bottom: 20px;\n}\n.header-brand {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.brand-mark {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n background: var(--green);\n color: #000;\n font-weight: 700;\n font-size: 14px;\n border-radius: 6px;\n}\n.brand-name {\n font-size: 18px;\n font-weight: 600;\n color: var(--text);\n letter-spacing: -0.3px;\n}\n.header-meta {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 12px;\n color: var(--text-dim);\n}\n.header-status-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n}\n.dot-connected { background: var(--green); box-shadow: 0 0 6px var(--green); }\n.dot-disconnected { background: var(--amber); }\n.header-ts { color: var(--text-dim); }\n\n/* DEGRADED BANNER */\n.degraded-banner {\n background: rgba(245,158,11,0.12);\n border: 1px solid rgba(245,158,11,0.35);\n border-radius: var(--radius);\n padding: 10px 14px;\n margin-bottom: 16px;\n color: var(--amber);\n font-size: 13px;\n}\n\n/* GRID */\n.dashboard-grid {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 16px;\n flex: 1;\n}\n@media (max-width: 700px) {\n .dashboard-grid { grid-template-columns: 1fr; }\n}\n\n/* PANEL */\n.panel {\n background: var(--bg-panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n overflow: hidden;\n}\n.panel-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n background: var(--bg-panel-header);\n border-bottom: 1px solid var(--border);\n}\n.panel-title {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.6px;\n color: var(--green);\n}\n.panel-count {\n margin-left: auto;\n font-size: 11px;\n color: var(--text-dim);\n}\n.panel-body { padding: 14px; }\n\n/* STATUS DOT IN PANEL */\n.status-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.status-connected { background: var(--green); box-shadow: 0 0 5px var(--green); }\n.status-disconnected { background: var(--amber); }\n.status-label { font-size: 12px; color: var(--text-dim); }\n\n/* STAT LIST */\n.stat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }\n.stat-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 13px;\n}\n.stat-label { color: var(--text-dim); }\n.stat-value { font-weight: 500; }\n.stat-mono { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-mono); }\n\n/* FRAGILE LIST */\n.fragile-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }\n.fragile-item {\n display: grid;\n grid-template-columns: 1fr 80px 36px;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n}\n.fragile-path {\n font-family: ui-monospace, monospace;\n color: var(--text-dim);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.fragile-bar-wrap {\n height: 6px;\n background: rgba(255,255,255,0.07);\n border-radius: 3px;\n overflow: hidden;\n}\n.fragile-bar {\n display: block;\n height: 100%;\n border-radius: 3px;\n transition: width 0.4s ease;\n}\n.fragility-high { background: var(--red); }\n.fragility-medium { background: var(--amber); }\n.fragility-low { background: var(--green-dim); }\n.fragile-score {\n font-family: ui-monospace, monospace;\n text-align: right;\n color: var(--text-dim);\n}\n\n/* CO-CHANGE LIST */\n.cochange-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }\n.cochange-item { display: flex; flex-direction: column; gap: 4px; }\n.cochange-files { display: flex; flex-wrap: wrap; gap: 4px; }\n.cochange-badge {\n display: inline-block;\n padding: 2px 7px;\n background: rgba(74,222,128,0.1);\n border: 1px solid rgba(74,222,128,0.25);\n border-radius: 4px;\n font-family: ui-monospace, monospace;\n font-size: 11px;\n color: var(--green);\n white-space: nowrap;\n max-width: 180px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.cochange-more {\n background: rgba(255,255,255,0.05);\n border-color: var(--border);\n color: var(--text-dim);\n}\n.cochange-rate { font-size: 11px; color: var(--text-dim); }\n\n/* EMPTY STATE */\n.empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n padding: 24px 16px;\n text-align: center;\n}\n.empty-icon {\n font-size: 22px;\n opacity: 0.4;\n}\n.empty-title {\n font-size: 13px;\n font-weight: 500;\n color: var(--text-dim);\n}\n.empty-hint {\n font-size: 12px;\n color: var(--text-dim);\n opacity: 0.7;\n max-width: 240px;\n}\n\n/* FOOTER */\n.dashboard-footer {\n display: flex;\n justify-content: space-between;\n padding: 12px 0 16px;\n border-top: 1px solid var(--border);\n margin-top: 20px;\n font-size: 11px;\n color: var(--text-dim);\n}\n.dashboard-footer a { color: var(--text-dim); text-decoration: none; }\n.dashboard-footer a:hover { color: var(--green); }\n\n/* SSE FADE-IN ANIMATION */\n@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }\n.sse-updated { animation: fadeIn 0.35s ease; }\n`;\n\n// =============================================================================\n// INLINE JS - SSE client + workspace refresh\n// =============================================================================\n\nconst DASHBOARD_JS = `\n(function() {\n var es = new EventSource('/events');\n es.addEventListener('workspace:updated', function() {\n fetch('/api/workspace')\n .then(function(r) { return r.json(); })\n .then(function(data) {\n if (data && !data.degraded) {\n // Reload page to re-render SSR with fresh data\n // A future enhancement can do fine-grained DOM patching here\n document.body.classList.add('sse-updated');\n setTimeout(function() { window.location.reload(); }, 300);\n }\n })\n .catch(function() {});\n });\n es.onerror = function() {\n // SSE reconnect is handled automatically by EventSource\n };\n})();\n`;\n\n// =============================================================================\n// UTILITIES\n// =============================================================================\n\nfunction readWorkspaceJson(workspaceJsonPath: string): WorkspaceJson | null {\n\ttry {\n\t\tconst raw = readFileSync(workspaceJsonPath, \"utf-8\");\n\t\treturn JSON.parse(raw) as WorkspaceJson;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction buildHtmlPage(data: WorkspaceJson, serviceConnected: boolean): string {\n\tconst generatedAt = data.generated?.generatedAt;\n\tconst bodyHtml = renderToStaticMarkup(createElement(BrowserDashboardApp, { data, serviceConnected, generatedAt }));\n\n\treturn `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Vreko Local Dashboard</title>\n<style>${DASHBOARD_CSS}</style>\n</head>\n<body>\n${bodyHtml}\n<script>${DASHBOARD_JS}</script>\n</body>\n</html>`;\n}\n\nfunction build503Page(reason: string, serviceConnected: boolean): string {\n\tconst empty: WorkspaceJson = {};\n\treturn buildHtmlPage(empty, serviceConnected).replace(\"</body>\", `<!-- degraded: ${reason} --></body>`);\n}\n\n// =============================================================================\n// PORT SCANNING\n// =============================================================================\n\nasync function findFreePort(startPort: number): Promise<number> {\n\tconst net = await import(\"node:net\");\n\tconst maxAttempts = 21;\n\tfor (let i = 0; i < maxAttempts; i++) {\n\t\tconst port = startPort + i;\n\t\tconst free = await new Promise<boolean>((resolve) => {\n\t\t\tconst probe = net.createServer();\n\t\t\tprobe.once(\"error\", () => resolve(false));\n\t\t\tprobe.once(\"listening\", () => {\n\t\t\t\tprobe.close(() => resolve(true));\n\t\t\t});\n\t\t\tprobe.listen(port, \"127.0.0.1\");\n\t\t});\n\t\tif (free) return port;\n\t}\n\tthrow new Error(`No free port found in range ${startPort}–${startPort + 20}. Stop another process and retry.`);\n}\n\n// =============================================================================\n// SERVER FACTORY\n// =============================================================================\n\n// biome-ignore lint/complexity/noExcessiveLinesPerFunction: server factory integrates port-scan, watch, and request routing\nexport async function startDashboardServer(options: DashboardServerOptions): Promise<DashboardServerHandle> {\n\tconst { workspacePath } = options;\n\tconst requestedPort = options.port ?? Number(process.env.VREKO_DASHBOARD_PORT ?? 7842);\n\n\tconst workspaceJsonPath = resolveWorkspaceJsonPath(workspacePath);\n\tconst sseManager = new SseManager();\n\n\t// Try to find a free port\n\tconst port = await findFreePort(requestedPort);\n\tconst url = `http://127.0.0.1:${port}`;\n\n\t// We don't import @vreko/intelligence directly (ARCH-01), so service\n\t// connection is detected by whether the workspace.json file exists and\n\t// was recently modified. A future phase can wire the IPC service emitter.\n\tlet serviceConnected = false;\n\n\t// Set up chokidar file-watch fallback (SSE fallback)\n\tconst watcher = chokidar.watch(workspaceJsonPath, {\n\t\tpersistent: true,\n\t\tignoreInitial: true,\n\t\tawaitWriteFinish: { stabilityThreshold: 200, pollInterval: 50 },\n\t});\n\n\twatcher.on(\"change\", () => {\n\t\tserviceConnected = true;\n\t\tsseManager.broadcast(\"workspace:updated\");\n\t});\n\n\tconst server = createServer((req: IncomingMessage, res: ServerResponse) => {\n\t\tconst pathname = req.url?.split(\"?\")[0] ?? \"/\";\n\n\t\t// SSE endpoint\n\t\tif (pathname === \"/events\") {\n\t\t\tsseManager.addClient(res);\n\t\t\treturn;\n\t\t}\n\n\t\t// API: workspace data\n\t\tif (pathname === \"/api/workspace\") {\n\t\t\tconst data = readWorkspaceJson(workspaceJsonPath);\n\t\t\tif (!data) {\n\t\t\t\tres.writeHead(503, { \"Content-Type\": \"application/json\" });\n\t\t\t\tres.end(JSON.stringify({ degraded: true, reason: \"workspace.json not found or unreadable\" }));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tres.writeHead(200, { \"Content-Type\": \"application/json\" });\n\t\t\tres.end(JSON.stringify(data));\n\t\t\treturn;\n\t\t}\n\n\t\t// API: health\n\t\tif (pathname === \"/api/health\") {\n\t\t\tres.writeHead(200, { \"Content-Type\": \"application/json\" });\n\t\t\tres.end(\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tserver: true,\n\t\t\t\t\tserviceConnected,\n\t\t\t\t\tworkspaceJsonPath,\n\t\t\t\t\tsseClients: sseManager.clientCount,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// SPA fallback - serve SSR HTML\n\t\tconst data = readWorkspaceJson(workspaceJsonPath);\n\t\tif (!data) {\n\t\t\tres.writeHead(503, { \"Content-Type\": \"text/html; charset=utf-8\" });\n\t\t\tres.end(build503Page(\"workspace.json not found\", serviceConnected));\n\t\t\treturn;\n\t\t}\n\n\t\tconst html = buildHtmlPage(data, serviceConnected);\n\t\tres.writeHead(200, { \"Content-Type\": \"text/html; charset=utf-8\" });\n\t\tres.end(html);\n\t});\n\n\tawait new Promise<void>((resolve, reject) => {\n\t\tserver.once(\"error\", reject);\n\t\t// NEVER bind to 0.0.0.0\n\t\tserver.listen(port, \"127.0.0.1\", () => {\n\t\t\tresolve();\n\t\t});\n\t});\n\n\t// Write discovery descriptor\n\twriteDashboardDescriptor(url, port, process.pid);\n\n\tconst close = () => {\n\t\twatcher.close();\n\t\tserver.close();\n\t\tdeleteDashboardDescriptor();\n\t};\n\n\t// Clean up descriptor on process exit\n\tprocess.once(\"exit\", close);\n\tprocess.once(\"SIGINT\", () => {\n\t\tclose();\n\t\tprocess.exit(0);\n\t});\n\tprocess.once(\"SIGTERM\", () => {\n\t\tclose();\n\t\tprocess.exit(0);\n\t});\n\n\treturn { port, url, server, close };\n}\n"]}
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { Sentry, createSentryConfig } from './chunk-YPTTIXKC.js';
3
- import { detectOrphans } from './chunk-F7GEJLP7.js';
3
+ import { detectOrphans } from './chunk-53CCA4NS.js';
4
4
  import './chunk-ZIIRQODJ.js';
5
5
  import { readDashboardDescriptor } from './chunk-I4LIA7HE.js';
6
- import { generateClaudeIntegration, createHooksCommand } from './chunk-FROYVC6U.js';
6
+ import { generateClaudeIntegration, createHooksCommand } from './chunk-7TRHJ4SF.js';
7
7
  import { cliState } from './chunk-GRMRYWYS.js';
8
8
  export { cliState } from './chunk-GRMRYWYS.js';
9
- import { resolveWorkspaceRoot, findWorkspaceRoot } from './chunk-HEUTZR52.js';
9
+ import { resolveWorkspaceRoot, findWorkspaceRoot } from './chunk-MWTSOZTM.js';
10
10
  import { isVrekoInitialized, getWorkspaceDir, getViolations, getProtectedFiles, appendVrekoJsonl, getCredentials, createGlobalDirectory, saveCredentials, clearCredentials, getWorkspaceVitals, saveProtectedFiles, getCurrentSession, endCurrentSession, isLoggedIn, getWorkspaceConfig, recordLearning, getLearnings, readVrekoJson, recordViolation, writeVrekoJson, getGlobalPath, getGlobalDir, saveCurrentSession, loadVrekoJsonl, getGlobalConfig, saveGlobalConfig, saveWorkspaceConfig } from './chunk-P4EZUU47.js';
11
- import { connectToDaemon, isDaemonAvailable, withDaemon, getDaemonClient, withDaemonOptional, disconnectFromDaemon, isDaemonConnected } from './chunk-3YXBGNHD.js';
11
+ import { connectToDaemon, isDaemonAvailable, withDaemon, getDaemonClient, withDaemonOptional, disconnectFromDaemon, isDaemonConnected } from './chunk-V2YKHPZH.js';
12
12
  import { JsonRpcClientError, getDefaultSocketPath, createServiceClient, connectServiceClient, createSessionViaDaemon, endSessionViaDaemon, WorkspaceStatusOutput, isServiceRunning, VrekoLocalClient, readServicePid, isServiceHealthy, StartStatusOutput, getLogPath, formatDuration, formatBytes, getServiceSocketPath, getServicePidPath } from './chunk-AV5Y3YR6.js';
13
- import { createInitCommand } from './chunk-53BJRUUT.js';
13
+ import { createInitCommand } from './chunk-XB7D22SX.js';
14
14
  import { isInteractive, getRenderMode } from './chunk-H7773ONB.js';
15
15
  import './chunk-DMXC2JTC.js';
16
16
  import { isRedisAvailable, getCache, setCache } from './chunk-3KKPXC3D.js';
@@ -72,7 +72,7 @@ var require_package = __commonJS({
72
72
  "package.json"(exports, module) {
73
73
  module.exports = {
74
74
  name: "@vreko/cli",
75
- version: "3.2.0",
75
+ version: "3.3.2",
76
76
  description: "Vreko CLI \u2014 AI-aware developer intelligence for the command line",
77
77
  homepage: "https://vreko.dev",
78
78
  repository: {
@@ -116,8 +116,8 @@ var require_package = __commonJS({
116
116
  "@asteasolutions/zod-to-openapi": "catalog:",
117
117
  "@babel/parser": "catalog:",
118
118
  "@babel/traverse": "catalog:",
119
- "@better-auth/passkey": "catalog:",
120
- "@better-auth/sso": "catalog:",
119
+ "@better-auth/passkey": "1.6.19",
120
+ "@better-auth/sso": "1.6.19",
121
121
  "@clack/prompts": "catalog:",
122
122
  "@electric-sql/pglite": "catalog:",
123
123
  "@hubspot/api-client": "catalog:",
@@ -133,7 +133,6 @@ var require_package = __commonJS({
133
133
  "@react-email/render": "catalog:",
134
134
  "@sentry/node": "catalog:",
135
135
  "@sindresorhus/slugify": "catalog:",
136
- "@typescript-eslint/parser": "catalog:",
137
136
  "@vreko/auth": "workspace:*",
138
137
  "@vreko/claims-ledger": "workspace:*",
139
138
  "@vreko/contracts": "workspace:*",
@@ -144,7 +143,7 @@ var require_package = __commonJS({
144
143
  "@vreko/mcp-client": "workspace:*",
145
144
  "@vreko/mcp-config": "workspace:*",
146
145
  "@vreko/sentry-privacy": "workspace:*",
147
- "better-auth": "catalog:",
146
+ "better-auth": "1.6.19",
148
147
  boxen: "catalog:",
149
148
  chalk: "catalog:",
150
149
  chokidar: "catalog:",
@@ -191,6 +190,7 @@ var require_package = __commonJS({
191
190
  keytar: "7.9.0"
192
191
  },
193
192
  bundledDependencies: [
193
+ "@asteasolutions/zod-to-openapi",
194
194
  "@vreko/auth",
195
195
  "@vreko/claims-ledger",
196
196
  "@vreko/intelligence",
@@ -2542,7 +2542,7 @@ function createOnboardCommand() {
2542
2542
  const quiet = !!options.quiet;
2543
2543
  if (!quiet) console.log(chalk2.bold("\nVreko Onboarding\n"));
2544
2544
  try {
2545
- const { createInitCommand: createInitCommand3 } = await import('./init-command-LXEBDSYX.js');
2545
+ const { createInitCommand: createInitCommand3 } = await import('./init-command-WJMWYVZN.js');
2546
2546
  const initCmd = createInitCommand3();
2547
2547
  const argv = [
2548
2548
  "node",
@@ -28730,7 +28730,7 @@ async function runStaticAnalysis(files, workspaceRoot) {
28730
28730
  result7.duration = Date.now() - startTime;
28731
28731
  return result7;
28732
28732
  }
28733
- const { analyzeSkippedTests } = await import('./analysis-ABEO6RTN.js');
28733
+ const { analyzeSkippedTests } = await import('./analysis-PHENF2QA.js');
28734
28734
  const analysisResults = analyzeSkippedTests(fileMap);
28735
28735
  for (const analysisResult of analysisResults) {
28736
28736
  if (!analysisResult.parsed && analysisResult.error) {
@@ -55394,7 +55394,7 @@ function createDiagnosticsCommand() {
55394
55394
  return diagnostics;
55395
55395
  }
55396
55396
  __name(createDiagnosticsCommand, "createDiagnosticsCommand");
55397
- var cliVersion = "3.2.0" ;
55397
+ var cliVersion = "3.3.2" ;
55398
55398
  function createDoctorCommand() {
55399
55399
  return new Command("doctor").description("Diagnose Vreko installation and ecosystem health").option("--json", "Output structured JSON result").option("--local", "Skip network checks").option("--check <system>", "Check specific subsystem (cli|service|workspace|knowledge|mcp|network|auth|extension)").option("--fix", "Attempt automatic repair for known issues").option("--sync-config", "Trigger immediate fingerprint config sync from cloud").option("-q, --quiet", "Only show failures").option("-v, --verbose", "Show all check details").action(async (options) => {
55400
55400
  if (options.syncConfig) {
@@ -55975,7 +55975,11 @@ __name(checkWorkspace, "checkWorkspace");
55975
55975
  function resolveWorkspaceJsonPath(workspacePath) {
55976
55976
  const newPath = join(workspacePath, ".agents", "workspace.json");
55977
55977
  const legacyPath = join(workspacePath, ".agents", "agents.workspace.json");
55978
- return existsSync(newPath) ? newPath : legacyPath;
55978
+ if (existsSync(newPath)) {
55979
+ return newPath;
55980
+ }
55981
+ console.warn(`[vreko] .agents/workspace.json not found, falling back to legacy .agents/agents.workspace.json in ${workspacePath}`);
55982
+ return legacyPath;
55979
55983
  }
55980
55984
  __name(resolveWorkspaceJsonPath, "resolveWorkspaceJsonPath");
55981
55985
  function checkAgentsJsonFreshness(workspacePath) {
@@ -56923,7 +56927,7 @@ function createUpgradeCommand() {
56923
56927
  }
56924
56928
  __name(createUpgradeCommand, "createUpgradeCommand");
56925
56929
  async function getVersionInfo(canary = false) {
56926
- const current = "3.2.0";
56930
+ const current = "3.3.2";
56927
56931
  let latest = current;
56928
56932
  try {
56929
56933
  const tag = canary ? "canary" : "latest";
@@ -57506,7 +57510,7 @@ function createDashboardCommand() {
57506
57510
  }
57507
57511
  return;
57508
57512
  }
57509
- const { startDashboardServer } = await import('./dashboardServer-2T7OBLSV.js');
57513
+ const { startDashboardServer } = await import('./dashboardServer-MELKRCBX.js');
57510
57514
  const resolvedWorkspace = process.env.VREKO_DASHBOARD_WORKSPACE ?? workspacePath;
57511
57515
  try {
57512
57516
  const handle = await startDashboardServer({
@@ -57766,7 +57770,7 @@ Sentry.init(createSentryConfig({
57766
57770
  }));
57767
57771
  async function createCLI() {
57768
57772
  const program = new Command();
57769
- program.name("vreko").description("Intelligence-driven development - observe, learn, and surface warnings before the next mistake").version("3.2.0", "-v, --version", "Display version number").helpOption("-h, --help", "Display help for command").addOption(new Option("--verbose", "Enable verbose output").env("VREKO_VERBOSE").default(process.env.VREKO_VERBOSE ?? false)).addOption(new Option("-q, --quiet", "Suppress non-essential output").default(false)).addOption(new Option("--no-color", "Disable colored output").env("NO_COLOR").default(false)).addOption(new Option("--debug", "Enable debug mode with detailed logging").env("VREKO_DEBUG").default(process.env.VREKO_DEBUG ?? false)).addOption(new Option("--json", "Output in JSON format for LLM consumption").env("VREKO_JSON").default(process.env.VREKO_JSON ?? false)).addOption(new Option("--plain", "Disable TUI; output JSON for scripts and CI (same as VREKO_PLAIN=1)").env("VREKO_PLAIN").default(process.env.VREKO_PLAIN ?? false)).addOption(new Option("-y, --yes", "Skip confirmation prompts (for CI/automation)").default(false)).hook("preAction", (thisCommand) => {
57773
+ program.name("vreko").description("Intelligence-driven development - observe, learn, and surface warnings before the next mistake").version("3.3.2", "-v, --version", "Display version number").helpOption("-h, --help", "Display help for command").addOption(new Option("--verbose", "Enable verbose output").env("VREKO_VERBOSE").default(process.env.VREKO_VERBOSE ?? false)).addOption(new Option("-q, --quiet", "Suppress non-essential output").default(false)).addOption(new Option("--no-color", "Disable colored output").env("NO_COLOR").default(false)).addOption(new Option("--debug", "Enable debug mode with detailed logging").env("VREKO_DEBUG").default(process.env.VREKO_DEBUG ?? false)).addOption(new Option("--json", "Output in JSON format for LLM consumption").env("VREKO_JSON").default(process.env.VREKO_JSON ?? false)).addOption(new Option("--plain", "Disable TUI; output JSON for scripts and CI (same as VREKO_PLAIN=1)").env("VREKO_PLAIN").default(process.env.VREKO_PLAIN ?? false)).addOption(new Option("-y, --yes", "Skip confirmation prompts (for CI/automation)").default(false)).hook("preAction", (thisCommand) => {
57770
57774
  const opts = thisCommand.opts();
57771
57775
  cliState.verbose = opts.verbose || false;
57772
57776
  cliState.quiet = opts.quiet || false;