gsd-pi 2.70.0-dev.8f4d92b → 2.70.0-dev.c236ea4

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 (55) hide show
  1. package/dist/resources/extensions/gsd/pre-execution-checks.js +3 -1
  2. package/dist/resources/extensions/gsd/validate-directory.js +30 -12
  3. package/dist/resources/extensions/slash-commands/audit.js +2 -1
  4. package/dist/resources/extensions/subagent/isolation.js +4 -2
  5. package/dist/web/standalone/.next/BUILD_ID +1 -1
  6. package/dist/web/standalone/.next/app-path-routes-manifest.json +13 -13
  7. package/dist/web/standalone/.next/build-manifest.json +2 -2
  8. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  9. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  10. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  11. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  18. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  19. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  20. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  22. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  25. package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
  26. package/dist/web/standalone/.next/server/app/index.html +1 -1
  27. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  28. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  29. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  30. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app-paths-manifest.json +13 -13
  34. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  35. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  36. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  37. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  38. package/dist/web-mode.js +4 -0
  39. package/package.json +11 -11
  40. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -0
  41. package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
  42. package/packages/pi-coding-agent/dist/core/lsp/config.js +38 -15
  43. package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
  44. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -1
  45. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +3 -1
  46. package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -1
  47. package/packages/pi-coding-agent/src/core/lsp/config.ts +43 -17
  48. package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +7 -5
  49. package/src/resources/extensions/gsd/pre-execution-checks.ts +4 -1
  50. package/src/resources/extensions/gsd/tests/validate-directory.test.ts +33 -1
  51. package/src/resources/extensions/gsd/validate-directory.ts +33 -11
  52. package/src/resources/extensions/slash-commands/audit.ts +2 -1
  53. package/src/resources/extensions/subagent/isolation.ts +4 -3
  54. /package/dist/web/standalone/.next/static/{j_Ae_qOKzzIlA6oFOxVx4 → LWbeDf2XwDjfq_mOlqoGf}/_buildManifest.js +0 -0
  55. /package/dist/web/standalone/.next/static/{j_Ae_qOKzzIlA6oFOxVx4 → LWbeDf2XwDjfq_mOlqoGf}/_ssgManifest.js +0 -0
@@ -135,14 +135,42 @@ export function hasRootMarkers(cwd, markers) {
135
135
  // Local Binary Resolution
136
136
  // =============================================================================
137
137
  const LOCAL_BIN_PATHS = [
138
- { markers: ["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"], binDir: "node_modules/.bin" },
139
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".venv/bin" },
140
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: "venv/bin" },
141
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".env/bin" },
142
- { markers: ["Gemfile", "Gemfile.lock"], binDir: "vendor/bundle/bin" },
143
- { markers: ["Gemfile", "Gemfile.lock"], binDir: "bin" },
144
- { markers: ["go.mod", "go.sum"], binDir: "bin" },
138
+ { markers: ["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"], binDirs: ["node_modules/.bin"] },
139
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: [".venv/bin", ".venv/Scripts"] },
140
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: ["venv/bin", "venv/Scripts"] },
141
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: [".env/bin", ".env/Scripts"] },
142
+ { markers: ["Gemfile", "Gemfile.lock"], binDirs: ["vendor/bundle/bin"] },
143
+ { markers: ["Gemfile", "Gemfile.lock"], binDirs: ["bin"] },
144
+ { markers: ["go.mod", "go.sum"], binDirs: ["bin"] },
145
145
  ];
146
+ function getWindowsBinaryCandidates(command) {
147
+ const ext = path.extname(command).toLowerCase();
148
+ if (ext) {
149
+ return [command];
150
+ }
151
+ return [
152
+ command,
153
+ `${command}.cmd`,
154
+ `${command}.bat`,
155
+ `${command}.exe`,
156
+ ];
157
+ }
158
+ export function resolveLocalBinaryPath(command, cwd, isWindows) {
159
+ for (const { markers, binDirs } of LOCAL_BIN_PATHS) {
160
+ if (!hasRootMarkers(cwd, markers))
161
+ continue;
162
+ for (const binDir of binDirs) {
163
+ const basePath = path.join(cwd, binDir, command);
164
+ const candidates = isWindows ? getWindowsBinaryCandidates(basePath) : [basePath];
165
+ for (const candidate of candidates) {
166
+ if (fs.existsSync(candidate)) {
167
+ return candidate;
168
+ }
169
+ }
170
+ }
171
+ }
172
+ return null;
173
+ }
146
174
  export function which(command) {
147
175
  // On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`
148
176
  // returns POSIX paths (/c/Users/...) that Node's spawn() can't execute.
@@ -157,14 +185,9 @@ export function which(command) {
157
185
  return resolved || null;
158
186
  }
159
187
  export function resolveCommand(command, cwd) {
160
- for (const { markers, binDir } of LOCAL_BIN_PATHS) {
161
- if (hasRootMarkers(cwd, markers)) {
162
- const localPath = path.join(cwd, binDir, command);
163
- if (fs.existsSync(localPath)) {
164
- return localPath;
165
- }
166
- }
167
- }
188
+ const localPath = resolveLocalBinaryPath(command, cwd, process.platform === "win32");
189
+ if (localPath)
190
+ return localPath;
168
191
  return which(command);
169
192
  }
170
193
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/core/lsp/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,C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,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO,SAAS,GAAG,SAAS,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,QAAgB;IACnE,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACvD,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport YAML from \"yaml\";\nimport { globSync } from \"glob\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport { isRecord } from \"./helpers.js\";\nimport type { ServerConfig } from \"./types.js\";\n\nconst require = createRequire(import.meta.url);\nconst DEFAULTS = require(\"./defaults.json\") as Record<string, Partial<ServerConfig>>;\n\n/** Map legacy server keys to their current names so user overrides still merge. */\nconst LEGACY_ALIASES: Record<string, string> = {\n\t\"kotlin-language-server\": \"kotlin-lsp\",\n};\n\nexport interface LspConfig {\n\tservers: Record<string, ServerConfig>;\n\t/** Idle timeout in milliseconds. If set, LSP clients will be shutdown after this period of inactivity. Disabled by default. */\n\tidleTimeoutMs?: number;\n}\n\n// =============================================================================\n// Default Server Configuration Loading\n// =============================================================================\n\nconst PID_TOKEN = \"$PID\";\n\ninterface NormalizedConfig {\n\tservers: Record<string, Partial<ServerConfig>>;\n\tidleTimeoutMs?: number;\n}\n\nfunction parseConfigContent(content: string, filePath: string): unknown {\n\tconst extension = path.extname(filePath).toLowerCase();\n\tif (extension === \".yaml\" || extension === \".yml\") {\n\t\treturn YAML.parse(content) as unknown;\n\t}\n\treturn JSON.parse(content) as unknown;\n}\n\nfunction normalizeConfig(value: unknown): NormalizedConfig | null {\n\tif (!isRecord(value)) return null;\n\n\tconst idleTimeoutMs = typeof value.idleTimeoutMs === \"number\" ? value.idleTimeoutMs : undefined;\n\tconst rawServers = value.servers;\n\n\tif (isRecord(rawServers)) {\n\t\treturn { servers: rawServers as Record<string, Partial<ServerConfig>>, idleTimeoutMs };\n\t}\n\n\tconst servers = Object.fromEntries(Object.entries(value).filter(([key]) => key !== \"idleTimeoutMs\")) as Record<\n\t\tstring,\n\t\tPartial<ServerConfig>\n\t>;\n\n\treturn { servers, idleTimeoutMs };\n}\n\nfunction normalizeStringArray(value: unknown): string[] | null {\n\tif (!Array.isArray(value)) return null;\n\tconst items = value.filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0);\n\treturn items.length > 0 ? items : null;\n}\n\nfunction normalizeServerConfig(name: string, config: Partial<ServerConfig>): ServerConfig | null {\n\tconst command = typeof config.command === \"string\" && config.command.length > 0 ? config.command : null;\n\tconst fileTypes = normalizeStringArray(config.fileTypes);\n\tconst rootMarkers = normalizeStringArray(config.rootMarkers);\n\n\tif (!command || !fileTypes || !rootMarkers) {\n\t\treturn null;\n\t}\n\n\tconst args = Array.isArray(config.args)\n\t\t? config.args.filter((entry): entry is string => typeof entry === \"string\")\n\t\t: undefined;\n\n\treturn {\n\t\t...config,\n\t\tcommand,\n\t\targs,\n\t\tfileTypes,\n\t\trootMarkers,\n\t};\n}\n\nfunction readConfigFile(filePath: string): NormalizedConfig | null {\n\ttry {\n\t\tconst content = fs.readFileSync(filePath, \"utf-8\");\n\t\tconst parsed = parseConfigContent(content, filePath);\n\t\treturn normalizeConfig(parsed);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction coerceServerConfigs(servers: Record<string, Partial<ServerConfig>>): Record<string, ServerConfig> {\n\tconst result: Record<string, ServerConfig> = {};\n\tfor (const [name, config] of Object.entries(servers)) {\n\t\tconst normalized = normalizeServerConfig(name, config);\n\t\tif (normalized) {\n\t\t\tresult[name] = normalized;\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction mergeServers(\n\tbase: Record<string, ServerConfig>,\n\toverrides: Record<string, Partial<ServerConfig>>,\n): Record<string, ServerConfig> {\n\tconst merged: Record<string, ServerConfig> = { ...base };\n\tfor (const [rawName, config] of Object.entries(overrides)) {\n\t\tconst name = LEGACY_ALIASES[rawName] ?? rawName;\n\t\tif (merged[name]) {\n\t\t\tconst candidate = { ...merged[name], ...config };\n\t\t\tconst normalized = normalizeServerConfig(name, candidate);\n\t\t\tif (normalized) {\n\t\t\t\tmerged[name] = normalized;\n\t\t\t}\n\t\t} else {\n\t\t\tconst normalized = normalizeServerConfig(name, config);\n\t\t\tif (normalized) {\n\t\t\t\tmerged[name] = normalized;\n\t\t\t}\n\t\t}\n\t}\n\treturn merged;\n}\n\nfunction applyRuntimeDefaults(servers: Record<string, ServerConfig>): Record<string, ServerConfig> {\n\tconst updated: Record<string, ServerConfig> = { ...servers };\n\n\tif (updated.omnisharp?.args) {\n\t\tconst args = updated.omnisharp.args.map((arg: string) => (arg === PID_TOKEN ? String(process.pid) : arg));\n\t\tupdated.omnisharp = { ...updated.omnisharp, args };\n\t}\n\n\treturn updated;\n}\n\n// =============================================================================\n// Configuration Loading\n// =============================================================================\n\nexport function hasRootMarkers(cwd: string, markers: string[]): boolean {\n\tfor (const marker of markers) {\n\t\tif (marker.includes(\"*\")) {\n\t\t\ttry {\n\t\t\t\tconst matches = globSync(marker, { cwd, nodir: false });\n\t\t\t\tif (matches.length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Failed to resolve glob root marker\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst filePath = path.join(cwd, marker);\n\t\tif (fs.existsSync(filePath)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n// =============================================================================\n// Local Binary Resolution\n// =============================================================================\n\nconst LOCAL_BIN_PATHS: Array<{ markers: string[]; binDir: string }> = [\n\t{ markers: [\"package.json\", \"package-lock.json\", \"yarn.lock\", \"pnpm-lock.yaml\"], binDir: \"node_modules/.bin\" },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDir: \".venv/bin\" },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDir: \"venv/bin\" },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDir: \".env/bin\" },\n\t{ markers: [\"Gemfile\", \"Gemfile.lock\"], binDir: \"vendor/bundle/bin\" },\n\t{ markers: [\"Gemfile\", \"Gemfile.lock\"], binDir: \"bin\" },\n\t{ markers: [\"go.mod\", \"go.sum\"], binDir: \"bin\" },\n];\n\nexport function which(command: string): string | null {\n\t// On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`\n\t// returns POSIX paths (/c/Users/...) that Node's spawn() can't execute.\n\t// `where.exe` returns native Windows paths (C:\\Users\\...).\n\tconst isWindows = process.platform === \"win32\";\n\tconst cmd = isWindows ? \"where.exe\" : \"which\";\n\tconst result = spawnSync(cmd, [command], { encoding: \"utf-8\", shell: isWindows });\n\tif (result.status !== 0) return null;\n\t// `where.exe` may return multiple lines — take the first\n\tconst resolved = result.stdout.trim().split(/\\r?\\n/)[0]?.trim();\n\treturn resolved || null;\n}\n\nexport function resolveCommand(command: string, cwd: string): string | null {\n\tfor (const { markers, binDir } of LOCAL_BIN_PATHS) {\n\t\tif (hasRootMarkers(cwd, markers)) {\n\t\t\tconst localPath = path.join(cwd, binDir, command);\n\t\t\tif (fs.existsSync(localPath)) {\n\t\t\t\treturn localPath;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn which(command);\n}\n\n/**\n * Configuration file search paths (in priority order).\n */\nfunction getConfigPaths(cwd: string): string[] {\n\tconst filenames = [\"lsp.json\", \".lsp.json\", \"lsp.yaml\", \".lsp.yaml\", \"lsp.yml\", \".lsp.yml\"];\n\tconst paths: string[] = [];\n\n\t// Project root files (highest priority)\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(cwd, filename));\n\t}\n\n\t// Project config directory\n\tconst projectConfigDir = path.join(cwd, CONFIG_DIR_NAME);\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(projectConfigDir, filename));\n\t}\n\n\t// User config directory\n\tconst userConfigDir = path.join(os.homedir(), CONFIG_DIR_NAME, \"agent\");\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(userConfigDir, filename));\n\t}\n\n\t// User home root files (lowest priority fallback)\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(os.homedir(), filename));\n\t}\n\n\treturn paths;\n}\n\n/**\n * Load LSP configuration.\n *\n * Priority (highest to lowest):\n * 1. Project root: lsp.json/.lsp.json/lsp.yml/.lsp.yml/lsp.yaml/.lsp.yaml\n * 2. Project config dir: {CONFIG_DIR_NAME}/lsp.* (+ hidden variants)\n * 3. User config dir: ~/{CONFIG_DIR_NAME}/agent/lsp.* (+ hidden variants)\n * 4. User home root: ~/lsp.*, ~/.lsp.*\n * 5. Auto-detect from project markers + available binaries\n */\nexport function loadConfig(cwd: string): LspConfig {\n\tlet mergedServers = coerceServerConfigs(DEFAULTS);\n\n\tconst configPaths = getConfigPaths(cwd).reverse();\n\tlet hasOverrides = false;\n\n\tlet idleTimeoutMs: number | undefined;\n\tfor (const configPath of configPaths) {\n\t\tconst parsed = readConfigFile(configPath);\n\t\tif (!parsed) continue;\n\t\tconst hasServerOverrides = Object.keys(parsed.servers).length > 0;\n\t\tif (hasServerOverrides) {\n\t\t\thasOverrides = true;\n\t\t\tmergedServers = mergeServers(mergedServers, parsed.servers);\n\t\t}\n\t\tif (parsed.idleTimeoutMs !== undefined) {\n\t\t\tidleTimeoutMs = parsed.idleTimeoutMs;\n\t\t}\n\t}\n\n\tif (!hasOverrides) {\n\t\tconst detected: Record<string, ServerConfig> = {};\n\t\tconst defaultsWithRuntime = applyRuntimeDefaults(mergedServers);\n\n\t\tfor (const [name, config] of Object.entries(defaultsWithRuntime)) {\n\t\t\tif (!hasRootMarkers(cwd, config.rootMarkers)) continue;\n\t\t\tconst resolved = resolveCommand(config.command, cwd);\n\t\t\tif (!resolved) continue;\n\t\t\tdetected[name] = { ...config, resolvedCommand: resolved };\n\t\t}\n\n\t\treturn { servers: detected, idleTimeoutMs };\n\t}\n\n\tconst mergedWithRuntime = applyRuntimeDefaults(mergedServers);\n\tconst available: Record<string, ServerConfig> = {};\n\n\tfor (const [name, config] of Object.entries(mergedWithRuntime)) {\n\t\tif (config.disabled) continue;\n\t\tconst resolved = resolveCommand(config.command, cwd);\n\t\tif (!resolved) continue;\n\t\tavailable[name] = { ...config, resolvedCommand: resolved };\n\t}\n\n\treturn { servers: available, idleTimeoutMs };\n}\n\n// =============================================================================\n// Server Selection\n// =============================================================================\n\nexport function getServersForFile(config: LspConfig, filePath: string): Array<[string, ServerConfig]> {\n\tconst ext = path.extname(filePath).toLowerCase();\n\tconst fileName = path.basename(filePath).toLowerCase();\n\tconst matches: Array<[string, ServerConfig]> = [];\n\n\tfor (const [name, serverConfig] of Object.entries(config.servers)) {\n\t\tconst supportsFile = serverConfig.fileTypes.some(fileType => {\n\t\t\tconst normalized = fileType.toLowerCase();\n\t\t\treturn normalized === ext || normalized === fileName;\n\t\t});\n\n\t\tif (supportsFile) {\n\t\t\tmatches.push([name, serverConfig]);\n\t\t}\n\t}\n\n\t// Sort: primary servers (non-linters) first, then linters\n\treturn matches.sort((a, b) => {\n\t\tconst aIsLinter = a[1].isLinter ? 1 : 0;\n\t\tconst bIsLinter = b[1].isLinter ? 1 : 0;\n\t\treturn aIsLinter - bIsLinter;\n\t});\n}\n\nexport function getServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null {\n\treturn getServersForFile(config, filePath)[0] ?? null;\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/core/lsp/config.ts"],"names":[],"mapp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AC;QACxC,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO,SAAS,GAAG,SAAS,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,QAAgB;IACnE,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACvD,CAAC","sourcesContent":["import * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { spawnSync } from \"node:child_process\";\nimport YAML from \"yaml\";\nimport { globSync } from \"glob\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport { isRecord } from \"./helpers.js\";\nimport type { ServerConfig } from \"./types.js\";\n\nconst require = createRequire(import.meta.url);\nconst DEFAULTS = require(\"./defaults.json\") as Record<string, Partial<ServerConfig>>;\n\n/** Map legacy server keys to their current names so user overrides still merge. */\nconst LEGACY_ALIASES: Record<string, string> = {\n\t\"kotlin-language-server\": \"kotlin-lsp\",\n};\n\nexport interface LspConfig {\n\tservers: Record<string, ServerConfig>;\n\t/** Idle timeout in milliseconds. If set, LSP clients will be shutdown after this period of inactivity. Disabled by default. */\n\tidleTimeoutMs?: number;\n}\n\n// =============================================================================\n// Default Server Configuration Loading\n// =============================================================================\n\nconst PID_TOKEN = \"$PID\";\n\ninterface NormalizedConfig {\n\tservers: Record<string, Partial<ServerConfig>>;\n\tidleTimeoutMs?: number;\n}\n\nfunction parseConfigContent(content: string, filePath: string): unknown {\n\tconst extension = path.extname(filePath).toLowerCase();\n\tif (extension === \".yaml\" || extension === \".yml\") {\n\t\treturn YAML.parse(content) as unknown;\n\t}\n\treturn JSON.parse(content) as unknown;\n}\n\nfunction normalizeConfig(value: unknown): NormalizedConfig | null {\n\tif (!isRecord(value)) return null;\n\n\tconst idleTimeoutMs = typeof value.idleTimeoutMs === \"number\" ? value.idleTimeoutMs : undefined;\n\tconst rawServers = value.servers;\n\n\tif (isRecord(rawServers)) {\n\t\treturn { servers: rawServers as Record<string, Partial<ServerConfig>>, idleTimeoutMs };\n\t}\n\n\tconst servers = Object.fromEntries(Object.entries(value).filter(([key]) => key !== \"idleTimeoutMs\")) as Record<\n\t\tstring,\n\t\tPartial<ServerConfig>\n\t>;\n\n\treturn { servers, idleTimeoutMs };\n}\n\nfunction normalizeStringArray(value: unknown): string[] | null {\n\tif (!Array.isArray(value)) return null;\n\tconst items = value.filter((entry): entry is string => typeof entry === \"string\" && entry.length > 0);\n\treturn items.length > 0 ? items : null;\n}\n\nfunction normalizeServerConfig(name: string, config: Partial<ServerConfig>): ServerConfig | null {\n\tconst command = typeof config.command === \"string\" && config.command.length > 0 ? config.command : null;\n\tconst fileTypes = normalizeStringArray(config.fileTypes);\n\tconst rootMarkers = normalizeStringArray(config.rootMarkers);\n\n\tif (!command || !fileTypes || !rootMarkers) {\n\t\treturn null;\n\t}\n\n\tconst args = Array.isArray(config.args)\n\t\t? config.args.filter((entry): entry is string => typeof entry === \"string\")\n\t\t: undefined;\n\n\treturn {\n\t\t...config,\n\t\tcommand,\n\t\targs,\n\t\tfileTypes,\n\t\trootMarkers,\n\t};\n}\n\nfunction readConfigFile(filePath: string): NormalizedConfig | null {\n\ttry {\n\t\tconst content = fs.readFileSync(filePath, \"utf-8\");\n\t\tconst parsed = parseConfigContent(content, filePath);\n\t\treturn normalizeConfig(parsed);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction coerceServerConfigs(servers: Record<string, Partial<ServerConfig>>): Record<string, ServerConfig> {\n\tconst result: Record<string, ServerConfig> = {};\n\tfor (const [name, config] of Object.entries(servers)) {\n\t\tconst normalized = normalizeServerConfig(name, config);\n\t\tif (normalized) {\n\t\t\tresult[name] = normalized;\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction mergeServers(\n\tbase: Record<string, ServerConfig>,\n\toverrides: Record<string, Partial<ServerConfig>>,\n): Record<string, ServerConfig> {\n\tconst merged: Record<string, ServerConfig> = { ...base };\n\tfor (const [rawName, config] of Object.entries(overrides)) {\n\t\tconst name = LEGACY_ALIASES[rawName] ?? rawName;\n\t\tif (merged[name]) {\n\t\t\tconst candidate = { ...merged[name], ...config };\n\t\t\tconst normalized = normalizeServerConfig(name, candidate);\n\t\t\tif (normalized) {\n\t\t\t\tmerged[name] = normalized;\n\t\t\t}\n\t\t} else {\n\t\t\tconst normalized = normalizeServerConfig(name, config);\n\t\t\tif (normalized) {\n\t\t\t\tmerged[name] = normalized;\n\t\t\t}\n\t\t}\n\t}\n\treturn merged;\n}\n\nfunction applyRuntimeDefaults(servers: Record<string, ServerConfig>): Record<string, ServerConfig> {\n\tconst updated: Record<string, ServerConfig> = { ...servers };\n\n\tif (updated.omnisharp?.args) {\n\t\tconst args = updated.omnisharp.args.map((arg: string) => (arg === PID_TOKEN ? String(process.pid) : arg));\n\t\tupdated.omnisharp = { ...updated.omnisharp, args };\n\t}\n\n\treturn updated;\n}\n\n// =============================================================================\n// Configuration Loading\n// =============================================================================\n\nexport function hasRootMarkers(cwd: string, markers: string[]): boolean {\n\tfor (const marker of markers) {\n\t\tif (marker.includes(\"*\")) {\n\t\t\ttry {\n\t\t\t\tconst matches = globSync(marker, { cwd, nodir: false });\n\t\t\t\tif (matches.length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Failed to resolve glob root marker\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst filePath = path.join(cwd, marker);\n\t\tif (fs.existsSync(filePath)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n// =============================================================================\n// Local Binary Resolution\n// =============================================================================\n\nconst LOCAL_BIN_PATHS: Array<{ markers: string[]; binDirs: string[] }> = [\n\t{ markers: [\"package.json\", \"package-lock.json\", \"yarn.lock\", \"pnpm-lock.yaml\"], binDirs: [\"node_modules/.bin\"] },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDirs: [\".venv/bin\", \".venv/Scripts\"] },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDirs: [\"venv/bin\", \"venv/Scripts\"] },\n\t{ markers: [\"pyproject.toml\", \"requirements.txt\", \"setup.py\", \"Pipfile\"], binDirs: [\".env/bin\", \".env/Scripts\"] },\n\t{ markers: [\"Gemfile\", \"Gemfile.lock\"], binDirs: [\"vendor/bundle/bin\"] },\n\t{ markers: [\"Gemfile\", \"Gemfile.lock\"], binDirs: [\"bin\"] },\n\t{ markers: [\"go.mod\", \"go.sum\"], binDirs: [\"bin\"] },\n];\n\nfunction getWindowsBinaryCandidates(command: string): string[] {\n\tconst ext = path.extname(command).toLowerCase();\n\tif (ext) {\n\t\treturn [command];\n\t}\n\n\treturn [\n\t\tcommand,\n\t\t`${command}.cmd`,\n\t\t`${command}.bat`,\n\t\t`${command}.exe`,\n\t];\n}\n\nexport function resolveLocalBinaryPath(command: string, cwd: string, isWindows: boolean): string | null {\n\tfor (const { markers, binDirs } of LOCAL_BIN_PATHS) {\n\t\tif (!hasRootMarkers(cwd, markers)) continue;\n\n\t\tfor (const binDir of binDirs) {\n\t\t\tconst basePath = path.join(cwd, binDir, command);\n\t\t\tconst candidates = isWindows ? getWindowsBinaryCandidates(basePath) : [basePath];\n\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (fs.existsSync(candidate)) {\n\t\t\t\t\treturn candidate;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function which(command: string): string | null {\n\t// On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`\n\t// returns POSIX paths (/c/Users/...) that Node's spawn() can't execute.\n\t// `where.exe` returns native Windows paths (C:\\Users\\...).\n\tconst isWindows = process.platform === \"win32\";\n\tconst cmd = isWindows ? \"where.exe\" : \"which\";\n\tconst result = spawnSync(cmd, [command], { encoding: \"utf-8\", shell: isWindows });\n\tif (result.status !== 0) return null;\n\t// `where.exe` may return multiple lines — take the first\n\tconst resolved = result.stdout.trim().split(/\\r?\\n/)[0]?.trim();\n\treturn resolved || null;\n}\n\nexport function resolveCommand(command: string, cwd: string): string | null {\n\tconst localPath = resolveLocalBinaryPath(command, cwd, process.platform === \"win32\");\n\tif (localPath) return localPath;\n\treturn which(command);\n}\n\n/**\n * Configuration file search paths (in priority order).\n */\nfunction getConfigPaths(cwd: string): string[] {\n\tconst filenames = [\"lsp.json\", \".lsp.json\", \"lsp.yaml\", \".lsp.yaml\", \"lsp.yml\", \".lsp.yml\"];\n\tconst paths: string[] = [];\n\n\t// Project root files (highest priority)\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(cwd, filename));\n\t}\n\n\t// Project config directory\n\tconst projectConfigDir = path.join(cwd, CONFIG_DIR_NAME);\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(projectConfigDir, filename));\n\t}\n\n\t// User config directory\n\tconst userConfigDir = path.join(os.homedir(), CONFIG_DIR_NAME, \"agent\");\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(userConfigDir, filename));\n\t}\n\n\t// User home root files (lowest priority fallback)\n\tfor (const filename of filenames) {\n\t\tpaths.push(path.join(os.homedir(), filename));\n\t}\n\n\treturn paths;\n}\n\n/**\n * Load LSP configuration.\n *\n * Priority (highest to lowest):\n * 1. Project root: lsp.json/.lsp.json/lsp.yml/.lsp.yml/lsp.yaml/.lsp.yaml\n * 2. Project config dir: {CONFIG_DIR_NAME}/lsp.* (+ hidden variants)\n * 3. User config dir: ~/{CONFIG_DIR_NAME}/agent/lsp.* (+ hidden variants)\n * 4. User home root: ~/lsp.*, ~/.lsp.*\n * 5. Auto-detect from project markers + available binaries\n */\nexport function loadConfig(cwd: string): LspConfig {\n\tlet mergedServers = coerceServerConfigs(DEFAULTS);\n\n\tconst configPaths = getConfigPaths(cwd).reverse();\n\tlet hasOverrides = false;\n\n\tlet idleTimeoutMs: number | undefined;\n\tfor (const configPath of configPaths) {\n\t\tconst parsed = readConfigFile(configPath);\n\t\tif (!parsed) continue;\n\t\tconst hasServerOverrides = Object.keys(parsed.servers).length > 0;\n\t\tif (hasServerOverrides) {\n\t\t\thasOverrides = true;\n\t\t\tmergedServers = mergeServers(mergedServers, parsed.servers);\n\t\t}\n\t\tif (parsed.idleTimeoutMs !== undefined) {\n\t\t\tidleTimeoutMs = parsed.idleTimeoutMs;\n\t\t}\n\t}\n\n\tif (!hasOverrides) {\n\t\tconst detected: Record<string, ServerConfig> = {};\n\t\tconst defaultsWithRuntime = applyRuntimeDefaults(mergedServers);\n\n\t\tfor (const [name, config] of Object.entries(defaultsWithRuntime)) {\n\t\t\tif (!hasRootMarkers(cwd, config.rootMarkers)) continue;\n\t\t\tconst resolved = resolveCommand(config.command, cwd);\n\t\t\tif (!resolved) continue;\n\t\t\tdetected[name] = { ...config, resolvedCommand: resolved };\n\t\t}\n\n\t\treturn { servers: detected, idleTimeoutMs };\n\t}\n\n\tconst mergedWithRuntime = applyRuntimeDefaults(mergedServers);\n\tconst available: Record<string, ServerConfig> = {};\n\n\tfor (const [name, config] of Object.entries(mergedWithRuntime)) {\n\t\tif (config.disabled) continue;\n\t\tconst resolved = resolveCommand(config.command, cwd);\n\t\tif (!resolved) continue;\n\t\tavailable[name] = { ...config, resolvedCommand: resolved };\n\t}\n\n\treturn { servers: available, idleTimeoutMs };\n}\n\n// =============================================================================\n// Server Selection\n// =============================================================================\n\nexport function getServersForFile(config: LspConfig, filePath: string): Array<[string, ServerConfig]> {\n\tconst ext = path.extname(filePath).toLowerCase();\n\tconst fileName = path.basename(filePath).toLowerCase();\n\tconst matches: Array<[string, ServerConfig]> = [];\n\n\tfor (const [name, serverConfig] of Object.entries(config.servers)) {\n\t\tconst supportsFile = serverConfig.fileTypes.some(fileType => {\n\t\t\tconst normalized = fileType.toLowerCase();\n\t\t\treturn normalized === ext || normalized === fileName;\n\t\t});\n\n\t\tif (supportsFile) {\n\t\t\tmatches.push([name, serverConfig]);\n\t\t}\n\t}\n\n\t// Sort: primary servers (non-linters) first, then linters\n\treturn matches.sort((a, b) => {\n\t\tconst aIsLinter = a[1].isLinter ? 1 : 0;\n\t\tconst bIsLinter = b[1].isLinter ? 1 : 0;\n\t\treturn aIsLinter - bIsLinter;\n\t});\n}\n\nexport function getServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null {\n\treturn getServersForFile(config, filePath)[0] ?? null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slash-command-handlers.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/slash-command-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAEX,eAAe,EACf,aAAa,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EAIT,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAUtE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAMvC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAEnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;IACjB,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IAGzC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,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IACpC,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,uBAAuB,IAAI,IAAI,CAAC;IAChC,gBAAgB,IAAI,IAAI,CAAC;IACzB,mBAAmB,IAAI,IAAI,CAAC;IAC5B,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,mBAAmB,IAAI,IAAI,CAAC;IAC5B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,kBAAkB,IAAI,IAAI,CAAC;IAC3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1B,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAGnF,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7I;AAMD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,mBAAmB,GACtB,OAAO,CAAC,OAAO,CAAC,CAmHlB;AAoND,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUjD;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,GAAG,MAAM,CAE3F"}
@@ -208,7 +208,9 @@ async function handleShareCommand(ctx) {
208
208
  };
209
209
  try {
210
210
  const result = await new Promise((resolve) => {
211
- proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
211
+ proc = spawn("gh", ["gist", "create", "--public=false", tmpFile], {
212
+ shell: process.platform === "win32",
213
+ });
212
214
  let stdout = "";
213
215
  let stderr = "";
214
216
  proc.stdout?.on("data", (data) => {
@@ -1 +1 @@
1
- {"version":3,"file":"slash-command-handlers.js","sourceRoot":"","sources":["../../../src/modes/interactive/slash-command-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAOlC,OAAO,EAGN,QAAQ,EACR,MAAM,EACN,IAAI,GACJ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACN,iBAAiB,GACjB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAsEzC,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,IAAY,EACZ,GAAwB;IAExB,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QAC1B,GAAG,CAAC,oBAAoB,EAAE,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;YACnD,GAAG,CAAC,UAAU,CAAC,sBAAsB,GAAG,kCAAkC,CAAC,CAAC;YAC5E,OAAO;QACR,CAAC;QACD,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAA+B,CAAC,CAAC;QACzD,GAAG,CAAC,UAAU,CAAC,cAAc,IAAI,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC;QACjH,OAAO;IACR,CAAC;IAED,SAAS;IACT,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAC9D,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,GAAG,CAAC,UAAU,CAAC,cAAc,IAAI,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAClH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAwB;IAClD,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,GAAG,CAAC,aAAa,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Slash command dispatch and handler implementations extracted from InteractiveMode.\n *\n * The `dispatchSlashCommand` function contains the dispatch logic (routing text\n * to handlers), and individual handler functions implement each command.\n *\n * Handlers that are also invoked from keybindings or other subsystems remain on\n * InteractiveMode and are called through the `SlashCommandContext` interface.\n */\n\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport type { ThinkingLevel } from \"@gsd/pi-agent-core\";\nimport type {\n\tEditorAction,\n\tEditorComponent,\n\tMarkdownTheme,\n} from \"@gsd/pi-tui\";\nimport {\n\ttype Component,\n\tContainer,\n\tMarkdown,\n\tSpacer,\n\tText,\n} from \"@gsd/pi-tui\";\nimport { spawn, spawnSync } from \"child_process\";\nimport {\n\tgetShareViewerUrl,\n} from \"../../config.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AppAction, KeybindingsManager } from \"../../core/keybindings.js\";\nimport type { SessionManager } from \"../../core/session-manager.js\";\nimport type { SettingsManager } from \"../../core/settings-manager.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport { getChangelogPath, parseChangelog } from \"../../utils/changelog.js\";\nimport { ArminComponent } from \"./components/armin.js\";\nimport { BorderedLoader } from \"./components/bordered-loader.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport { appKey, editorKey, formatKeyForDisplay } from \"./components/keybinding-hints.js\";\nimport { SelectSubmenu, THINKING_DESCRIPTIONS } from \"./components/settings-selector.js\";\nimport { theme } from \"./theme/theme.js\";\n\nimport type { TUI } from \"@gsd/pi-tui\";\n\n// ---------------------------------------------------------------------------\n// Context interface — the subset of InteractiveMode needed by slash commands\n// ---------------------------------------------------------------------------\n\n/**\n * Provides slash command handlers with access to the parts of InteractiveMode\n * they need without coupling them to the entire class.\n */\nexport interface SlashCommandContext {\n\t// Core objects\n\treadonly session: AgentSession;\n\treadonly ui: TUI;\n\treadonly keybindings: KeybindingsManager;\n\n\t// Containers\n\treadonly chatContainer: Container;\n\treadonly statusContainer: Container;\n\treadonly editorContainer: Container;\n\treadonly headerContainer: Container;\n\treadonly pendingMessagesContainer: Container;\n\n\t// Editor\n\treadonly editor: EditorComponent;\n\treadonly defaultEditor: EditorComponent & {\n\t\tonEscape?: () => void;\n\t};\n\n\t// Accessors\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\t// Footer\n\tinvalidateFooter(): void;\n\n\t// UI helpers\n\tshowStatus(message: string): void;\n\tshowError(message: string): void;\n\tshowWarning(message: string): void;\n\tshowSelector(create: (done: () => void) => { component: Component; focus: Component }): void;\n\tupdateEditorBorderColor(): void;\n\tgetMarkdownThemeWithSettings(): MarkdownTheme;\n\trequestRender(): void;\n\n\tupdateTerminalTitle(): void;\n\n\t// Methods that stay on InteractiveMode (called from both dispatch and keybindings/events)\n\tshowSettingsSelector(): void;\n\tshowModelsSelector(): Promise<void>;\n\thandleModelCommand(searchTerm?: string): Promise<void>;\n\tshowUserMessageSelector(): void;\n\tshowTreeSelector(): void;\n\tshowProviderManager(): void;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\tshowSessionSelector(): void;\n\thandleClearCommand(): Promise<void>;\n\thandleReloadCommand(): Promise<void>;\n\thandleDebugCommand(): void;\n\tshutdown(): Promise<void>;\n\n\t// For compaction\n\texecuteCompaction(customInstructions?: string, isAuto?: boolean): Promise<unknown>;\n\n\t// Bash execution\n\thandleBashCommand(command: string, options?: { excludeFromContext?: boolean; displayCommand?: string; loginShell?: boolean }): Promise<void>;\n}\n\n// ---------------------------------------------------------------------------\n// Dispatch\n// ---------------------------------------------------------------------------\n\n/**\n * Routes a slash command string to the appropriate handler.\n *\n * @returns `true` if the text was handled as a slash command (caller should\n * not process it further), `false` otherwise.\n */\nexport async function dispatchSlashCommand(\n\ttext: string,\n\tctx: SlashCommandContext,\n): Promise<boolean> {\n\tif (text === \"/settings\") {\n\t\tctx.showSettingsSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/scoped-models\") {\n\t\tawait ctx.showModelsSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/model\" || text.startsWith(\"/model \")) {\n\t\tconst searchTerm = text.startsWith(\"/model \") ? text.slice(7).trim() : undefined;\n\t\tawait ctx.handleModelCommand(searchTerm);\n\t\treturn true;\n\t}\n\tif (text === \"/export\" || text.startsWith(\"/export \")) {\n\t\tawait handleExportCommand(text, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/share\") {\n\t\tawait handleShareCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/copy\") {\n\t\thandleCopyCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/name\" || text.startsWith(\"/name \")) {\n\t\thandleNameCommand(text, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/session\") {\n\t\thandleSessionCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/changelog\") {\n\t\thandleChangelogCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/hotkeys\") {\n\t\thandleHotkeysCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/fork\") {\n\t\tctx.showUserMessageSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/tree\") {\n\t\tctx.showTreeSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/provider\") {\n\t\tctx.showProviderManager();\n\t\treturn true;\n\t}\n\tif (text === \"/login\") {\n\t\tawait ctx.showOAuthSelector(\"login\");\n\t\treturn true;\n\t}\n\tif (text === \"/logout\") {\n\t\tawait ctx.showOAuthSelector(\"logout\");\n\t\treturn true;\n\t}\n\tif (text === \"/new\") {\n\t\tawait ctx.handleClearCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/compact\" || text.startsWith(\"/compact \")) {\n\t\tconst customInstructions = text.startsWith(\"/compact \") ? text.slice(9).trim() : undefined;\n\t\tawait handleCompactCommand(customInstructions, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/reload\") {\n\t\tawait ctx.handleReloadCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/thinking\" || text.startsWith(\"/thinking \")) {\n\t\tconst arg = text.startsWith(\"/thinking \") ? text.slice(10).trim() : undefined;\n\t\thandleThinkingCommand(arg, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/edit-mode\" || text.startsWith(\"/edit-mode \")) {\n\t\tconst arg = text.startsWith(\"/edit-mode \") ? text.slice(11).trim() : undefined;\n\t\thandleEditModeCommand(arg, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/debug\") {\n\t\tctx.handleDebugCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/arminsayshi\") {\n\t\thandleArminSaysHi(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/resume\") {\n\t\tctx.showSessionSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/quit\") {\n\t\tawait ctx.shutdown();\n\t\treturn true;\n\t}\n\tif (text === \"/terminal\" || text.startsWith(\"/terminal \")) {\n\t\tconst command = text.startsWith(\"/terminal \") ? text.slice(10).trim() : \"\";\n\t\tif (!command) {\n\t\t\tctx.showWarning(\"Usage: /terminal <command> (e.g. /terminal ping -c3 1.1.1.1)\");\n\t\t\treturn true;\n\t\t}\n\t\t// Run in the user's login shell ($SHELL -l -c) so PATH additions\n\t\t// and env vars from shell profiles (.zprofile/.profile) are available.\n\t\t// Note: shell aliases are not loaded (requires -i which has side effects).\n\t\tawait ctx.handleBashCommand(command, { loginShell: true });\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n// ---------------------------------------------------------------------------\n// Individual command handlers\n// ---------------------------------------------------------------------------\n\nasync function handleExportCommand(text: string, ctx: SlashCommandContext): Promise<void> {\n\tconst parts = text.split(/\\s+/);\n\tconst outputPath = parts.length > 1 ? parts[1] : undefined;\n\n\ttry {\n\t\tconst filePath = await ctx.session.exportToHtml(outputPath);\n\t\tctx.showStatus(`Session exported to: ${filePath}`);\n\t} catch (error: unknown) {\n\t\tctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t}\n}\n\nasync function handleShareCommand(ctx: SlashCommandContext): Promise<void> {\n\t// Check if gh is available and logged in\n\ttry {\n\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], { encoding: \"utf-8\" });\n\t\tif (authResult.status !== 0) {\n\t\t\tctx.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\tctx.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\treturn;\n\t}\n\n\t// Export to a temp file\n\tconst tmpFile = path.join(os.tmpdir(), \"session.html\");\n\ttry {\n\t\tawait ctx.session.exportToHtml(tmpFile);\n\t} catch (error: unknown) {\n\t\tctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\t// Show cancellable loader, replacing the editor\n\tconst loader = new BorderedLoader(ctx.ui, theme, \"Creating gist...\");\n\tctx.editorContainer.clear();\n\tctx.editorContainer.addChild(loader);\n\tctx.ui.setFocus(loader);\n\tctx.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tloader.dispose();\n\t\tctx.editorContainer.clear();\n\t\tctx.editorContainer.addChild(ctx.editor);\n\t\tctx.ui.setFocus(ctx.editor);\n\t\ttry {\n\t\t\tfs.unlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t};\n\n\t// Create a secret gist asynchronously\n\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\tloader.onAbort = () => {\n\t\tproc?.kill();\n\t\trestoreEditor();\n\t\tctx.showStatus(\"Share cancelled\");\n\t};\n\n\ttry {\n\t\tconst result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {\n\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile]);\n\t\t\tlet stdout = \"\";\n\t\t\tlet stderr = \"\";\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\tstderr += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t});\n\n\t\tif (loader.signal.aborted) return;\n\n\t\trestoreEditor();\n\n\t\tif (result.code !== 0) {\n\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\tctx.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Extract gist ID from the URL returned by gh\n\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\tconst gistUrl = result.stdout?.trim();\n\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\tif (!gistId) {\n\t\t\tctx.showError(\"Failed to parse gist ID from gh output\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Create the preview URL\n\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\tctx.showStatus(`Share URL: ${previewUrl}\\nGist: ${gistUrl}`);\n\t} catch (error: unknown) {\n\t\tif (!loader.signal.aborted) {\n\t\t\trestoreEditor();\n\t\t\tctx.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n}\n\nfunction handleCopyCommand(ctx: SlashCommandContext): void {\n\tconst text = ctx.session.getLastAssistantText();\n\tif (!text) {\n\t\tctx.showError(\"No agent messages to copy yet.\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tcopyToClipboard(text);\n\t\tctx.showStatus(\"Copied last agent message to clipboard\");\n\t} catch (error) {\n\t\tctx.showError(error instanceof Error ? error.message : String(error));\n\t}\n}\n\nfunction handleNameCommand(text: string, ctx: SlashCommandContext): void {\n\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\tif (!name) {\n\t\tconst currentName = ctx.sessionManager.getSessionName();\n\t\tif (currentName) {\n\t\t\tctx.chatContainer.addChild(new Spacer(1));\n\t\t\tctx.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name: ${currentName}`), 1, 0));\n\t\t} else {\n\t\t\tctx.showWarning(\"Usage: /name <name>\");\n\t\t}\n\t\tctx.requestRender();\n\t\treturn;\n\t}\n\n\tctx.sessionManager.appendSessionInfo(name);\n\tctx.updateTerminalTitle();\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name set: ${name}`), 1, 0));\n\tctx.requestRender();\n}\n\nfunction handleSessionCommand(ctx: SlashCommandContext): void {\n\tconst stats = ctx.session.getSessionStats();\n\tconst sessionName = ctx.sessionManager.getSessionName();\n\n\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\tif (sessionName) {\n\t\tinfo += `${theme.fg(\"dim\", \"Name:\")} ${sessionName}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\tif (stats.tokens.cacheRead > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t}\n\tif (stats.tokens.cacheWrite > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\n\tif (stats.cost > 0) {\n\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t}\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Text(info, 1, 0));\n\tctx.requestRender();\n}\n\nfunction handleChangelogCommand(ctx: SlashCommandContext): void {\n\tconst changelogPath = getChangelogPath();\n\tconst allEntries = parseChangelog(changelogPath);\n\n\tconst changelogMarkdown =\n\t\tallEntries.length > 0\n\t\t\t? allEntries\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.map((e) => e.content)\n\t\t\t\t\t.join(\"\\n\\n\")\n\t\t\t: \"No changelog entries found.\";\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, ctx.getMarkdownThemeWithSettings()));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.requestRender();\n}\n\n// ---------------------------------------------------------------------------\n// /hotkeys helpers\n// ---------------------------------------------------------------------------\n\nexport function capitalizeKey(key: string): string {\n\treturn key\n\t\t.split(\"/\")\n\t\t.map((k) =>\n\t\t\tk\n\t\t\t\t.split(\"+\")\n\t\t\t\t.map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t\t\t.join(\"+\"),\n\t\t)\n\t\t.join(\"/\");\n}\n\nexport function getAppKeyDisplay(keybindings: KeybindingsManager, action: AppAction): string {\n\treturn capitalizeKey(appKey(keybindings, action));\n}\n\nfunction getEditorKeyDisplay(action: EditorAction): string {\n\treturn capitalizeKey(editorKey(action));\n}\n\nfunction handleHotkeysCommand(ctx: SlashCommandContext): void {\n\t// Navigation keybindings\n\tconst cursorWordLeft = getEditorKeyDisplay(\"cursorWordLeft\");\n\tconst cursorWordRight = getEditorKeyDisplay(\"cursorWordRight\");\n\tconst cursorLineStart = getEditorKeyDisplay(\"cursorLineStart\");\n\tconst cursorLineEnd = getEditorKeyDisplay(\"cursorLineEnd\");\n\tconst jumpForward = getEditorKeyDisplay(\"jumpForward\");\n\tconst jumpBackward = getEditorKeyDisplay(\"jumpBackward\");\n\tconst pageUp = getEditorKeyDisplay(\"pageUp\");\n\tconst pageDown = getEditorKeyDisplay(\"pageDown\");\n\n\t// Editing keybindings\n\tconst submit = getEditorKeyDisplay(\"submit\");\n\tconst newLine = getEditorKeyDisplay(\"newLine\");\n\tconst deleteWordBackward = getEditorKeyDisplay(\"deleteWordBackward\");\n\tconst deleteWordForward = getEditorKeyDisplay(\"deleteWordForward\");\n\tconst deleteToLineStart = getEditorKeyDisplay(\"deleteToLineStart\");\n\tconst deleteToLineEnd = getEditorKeyDisplay(\"deleteToLineEnd\");\n\tconst yank = getEditorKeyDisplay(\"yank\");\n\tconst yankPop = getEditorKeyDisplay(\"yankPop\");\n\tconst undo = getEditorKeyDisplay(\"undo\");\n\tconst tab = getEditorKeyDisplay(\"tab\");\n\n\t// App keybindings\n\tconst interrupt = getAppKeyDisplay(ctx.keybindings, \"interrupt\");\n\tconst clear = getAppKeyDisplay(ctx.keybindings, \"clear\");\n\tconst exit = getAppKeyDisplay(ctx.keybindings, \"exit\");\n\tconst suspend = getAppKeyDisplay(ctx.keybindings, \"suspend\");\n\tconst cycleThinkingLevel = getAppKeyDisplay(ctx.keybindings, \"cycleThinkingLevel\");\n\tconst cycleModelForward = getAppKeyDisplay(ctx.keybindings, \"cycleModelForward\");\n\tconst selectModel = getAppKeyDisplay(ctx.keybindings, \"selectModel\");\n\tconst expandTools = getAppKeyDisplay(ctx.keybindings, \"expandTools\");\n\tconst toggleThinking = getAppKeyDisplay(ctx.keybindings, \"toggleThinking\");\n\tconst externalEditor = getAppKeyDisplay(ctx.keybindings, \"externalEditor\");\n\tconst followUp = getAppKeyDisplay(ctx.keybindings, \"followUp\");\n\tconst dequeue = getAppKeyDisplay(ctx.keybindings, \"dequeue\");\n\n\tlet hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`Arrow keys\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (Ctrl+Enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`Ctrl+V\\` | Paste image from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n\t// Add extension-registered shortcuts\n\tconst extensionRunner = ctx.session.extensionRunner;\n\tif (extensionRunner) {\n\t\tconst shortcuts = extensionRunner.getShortcuts(ctx.keybindings.getEffectiveConfig());\n\t\tif (shortcuts.size > 0) {\n\t\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\t\tconst keyDisplay = formatKeyForDisplay(key).replace(/\\b\\w/g, (c) => c.toUpperCase());\n\t\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t\t}\n\t\t}\n\t}\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, ctx.getMarkdownThemeWithSettings()));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.requestRender();\n}\n\nasync function handleCompactCommand(customInstructions: string | undefined, ctx: SlashCommandContext): Promise<void> {\n\tconst entries = ctx.sessionManager.getEntries();\n\tconst messageCount = entries.filter((e) => e.type === \"message\").length;\n\n\tif (messageCount < 2) {\n\t\tctx.showWarning(\"Nothing to compact (no messages yet)\");\n\t\treturn;\n\t}\n\n\tawait ctx.executeCompaction(customInstructions, false);\n}\n\nfunction handleThinkingCommand(arg: string | undefined, ctx: SlashCommandContext): void {\n\tif (!ctx.session.supportsThinking()) {\n\t\tctx.showStatus(\"Current model does not support thinking\");\n\t\treturn;\n\t}\n\n\tconst availableLevels = ctx.session.getAvailableThinkingLevels();\n\n\tif (arg) {\n\t\tconst level = arg.toLowerCase();\n\t\tif (!availableLevels.includes(level as ThinkingLevel)) {\n\t\t\tctx.showStatus(`Invalid thinking level \"${arg}\". Available: ${availableLevels.join(\", \")}`);\n\t\t\treturn;\n\t\t}\n\t\tctx.session.setThinkingLevel(level as ThinkingLevel);\n\t\tctx.invalidateFooter();\n\t\tctx.updateEditorBorderColor();\n\t\tctx.showStatus(`Thinking level: ${level}`);\n\t\treturn;\n\t}\n\n\tshowThinkingSelector(ctx, availableLevels);\n}\n\nfunction showThinkingSelector(ctx: SlashCommandContext, availableLevels: readonly ThinkingLevel[]): void {\n\tctx.showSelector((done) => {\n\t\tconst selector = new SelectSubmenu(\n\t\t\t\"Thinking Level\",\n\t\t\t\"Select reasoning depth for thinking-capable models\",\n\t\t\tavailableLevels.map((level) => ({\n\t\t\t\tvalue: level,\n\t\t\t\tlabel: level,\n\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t})),\n\t\t\tctx.session.thinkingLevel,\n\t\t\t(value) => {\n\t\t\t\tctx.session.setThinkingLevel(value as ThinkingLevel);\n\t\t\t\tctx.invalidateFooter();\n\t\t\t\tctx.updateEditorBorderColor();\n\t\t\t\tdone();\n\t\t\t\tctx.showStatus(`Thinking level: ${value}`);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nfunction handleEditModeCommand(arg: string | undefined, ctx: SlashCommandContext): void {\n\tconst modes = [\"standard\", \"hashline\"] as const;\n\n\tif (arg) {\n\t\tconst mode = arg.toLowerCase();\n\t\tif (!modes.includes(mode as typeof modes[number])) {\n\t\t\tctx.showStatus(`Invalid edit mode \"${arg}\". Available: standard, hashline`);\n\t\t\treturn;\n\t\t}\n\t\tctx.session.setEditMode(mode as \"standard\" | \"hashline\");\n\t\tctx.showStatus(`Edit mode: ${mode}${mode === \"hashline\" ? \" (LINE#ID anchored edits)\" : \" (text-match edits)\"}`);\n\t\treturn;\n\t}\n\n\t// Toggle\n\tconst current = ctx.session.editMode;\n\tconst next = current === \"standard\" ? \"hashline\" : \"standard\";\n\tctx.session.setEditMode(next);\n\tctx.showStatus(`Edit mode: ${next}${next === \"hashline\" ? \" (LINE#ID anchored edits)\" : \" (text-match edits)\"}`);\n}\n\nfunction handleArminSaysHi(ctx: SlashCommandContext): void {\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new ArminComponent(ctx.ui));\n\tctx.requestRender();\n}\n"]}
1
+ {"version":3,"file":"slash-command-handlers.js","sourceRoot":"","sources":["../../../src/modes/interactive/slash-command-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAOlC,OAAO,EAGN,QAAQ,EACR,MAAM,EACN,IAAI,GACJ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACN,iBAAiB,GACjB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAsEzC,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,IAAY,EACZ,GAAwB;IAExB,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QAC1B,GAAG,CAAC,oBAAoB,EAAE,CAAC;QAC3B,O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K,CAAC,QAAQ,CAAC,IAA4B,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,UAAU,CAAC,sBAAsB,GAAG,kCAAkC,CAAC,CAAC;YAC5E,OAAO;QACR,CAAC;QACD,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAA+B,CAAC,CAAC;QACzD,GAAG,CAAC,UAAU,CAAC,cAAc,IAAI,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC;QACjH,OAAO;IACR,CAAC;IAED,SAAS;IACT,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAC9D,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,GAAG,CAAC,UAAU,CAAC,cAAc,IAAI,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAClH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAwB;IAClD,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,GAAG,CAAC,aAAa,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Slash command dispatch and handler implementations extracted from InteractiveMode.\n *\n * The `dispatchSlashCommand` function contains the dispatch logic (routing text\n * to handlers), and individual handler functions implement each command.\n *\n * Handlers that are also invoked from keybindings or other subsystems remain on\n * InteractiveMode and are called through the `SlashCommandContext` interface.\n */\n\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport type { ThinkingLevel } from \"@gsd/pi-agent-core\";\nimport type {\n\tEditorAction,\n\tEditorComponent,\n\tMarkdownTheme,\n} from \"@gsd/pi-tui\";\nimport {\n\ttype Component,\n\tContainer,\n\tMarkdown,\n\tSpacer,\n\tText,\n} from \"@gsd/pi-tui\";\nimport { spawn, spawnSync } from \"child_process\";\nimport {\n\tgetShareViewerUrl,\n} from \"../../config.js\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AppAction, KeybindingsManager } from \"../../core/keybindings.js\";\nimport type { SessionManager } from \"../../core/session-manager.js\";\nimport type { SettingsManager } from \"../../core/settings-manager.js\";\nimport { copyToClipboard } from \"../../utils/clipboard.js\";\nimport { getChangelogPath, parseChangelog } from \"../../utils/changelog.js\";\nimport { ArminComponent } from \"./components/armin.js\";\nimport { BorderedLoader } from \"./components/bordered-loader.js\";\nimport { DynamicBorder } from \"./components/dynamic-border.js\";\nimport { appKey, editorKey, formatKeyForDisplay } from \"./components/keybinding-hints.js\";\nimport { SelectSubmenu, THINKING_DESCRIPTIONS } from \"./components/settings-selector.js\";\nimport { theme } from \"./theme/theme.js\";\n\nimport type { TUI } from \"@gsd/pi-tui\";\n\n// ---------------------------------------------------------------------------\n// Context interface — the subset of InteractiveMode needed by slash commands\n// ---------------------------------------------------------------------------\n\n/**\n * Provides slash command handlers with access to the parts of InteractiveMode\n * they need without coupling them to the entire class.\n */\nexport interface SlashCommandContext {\n\t// Core objects\n\treadonly session: AgentSession;\n\treadonly ui: TUI;\n\treadonly keybindings: KeybindingsManager;\n\n\t// Containers\n\treadonly chatContainer: Container;\n\treadonly statusContainer: Container;\n\treadonly editorContainer: Container;\n\treadonly headerContainer: Container;\n\treadonly pendingMessagesContainer: Container;\n\n\t// Editor\n\treadonly editor: EditorComponent;\n\treadonly defaultEditor: EditorComponent & {\n\t\tonEscape?: () => void;\n\t};\n\n\t// Accessors\n\treadonly sessionManager: SessionManager;\n\treadonly settingsManager: SettingsManager;\n\n\t// Footer\n\tinvalidateFooter(): void;\n\n\t// UI helpers\n\tshowStatus(message: string): void;\n\tshowError(message: string): void;\n\tshowWarning(message: string): void;\n\tshowSelector(create: (done: () => void) => { component: Component; focus: Component }): void;\n\tupdateEditorBorderColor(): void;\n\tgetMarkdownThemeWithSettings(): MarkdownTheme;\n\trequestRender(): void;\n\n\tupdateTerminalTitle(): void;\n\n\t// Methods that stay on InteractiveMode (called from both dispatch and keybindings/events)\n\tshowSettingsSelector(): void;\n\tshowModelsSelector(): Promise<void>;\n\thandleModelCommand(searchTerm?: string): Promise<void>;\n\tshowUserMessageSelector(): void;\n\tshowTreeSelector(): void;\n\tshowProviderManager(): void;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\tshowSessionSelector(): void;\n\thandleClearCommand(): Promise<void>;\n\thandleReloadCommand(): Promise<void>;\n\thandleDebugCommand(): void;\n\tshutdown(): Promise<void>;\n\n\t// For compaction\n\texecuteCompaction(customInstructions?: string, isAuto?: boolean): Promise<unknown>;\n\n\t// Bash execution\n\thandleBashCommand(command: string, options?: { excludeFromContext?: boolean; displayCommand?: string; loginShell?: boolean }): Promise<void>;\n}\n\n// ---------------------------------------------------------------------------\n// Dispatch\n// ---------------------------------------------------------------------------\n\n/**\n * Routes a slash command string to the appropriate handler.\n *\n * @returns `true` if the text was handled as a slash command (caller should\n * not process it further), `false` otherwise.\n */\nexport async function dispatchSlashCommand(\n\ttext: string,\n\tctx: SlashCommandContext,\n): Promise<boolean> {\n\tif (text === \"/settings\") {\n\t\tctx.showSettingsSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/scoped-models\") {\n\t\tawait ctx.showModelsSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/model\" || text.startsWith(\"/model \")) {\n\t\tconst searchTerm = text.startsWith(\"/model \") ? text.slice(7).trim() : undefined;\n\t\tawait ctx.handleModelCommand(searchTerm);\n\t\treturn true;\n\t}\n\tif (text === \"/export\" || text.startsWith(\"/export \")) {\n\t\tawait handleExportCommand(text, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/share\") {\n\t\tawait handleShareCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/copy\") {\n\t\thandleCopyCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/name\" || text.startsWith(\"/name \")) {\n\t\thandleNameCommand(text, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/session\") {\n\t\thandleSessionCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/changelog\") {\n\t\thandleChangelogCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/hotkeys\") {\n\t\thandleHotkeysCommand(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/fork\") {\n\t\tctx.showUserMessageSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/tree\") {\n\t\tctx.showTreeSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/provider\") {\n\t\tctx.showProviderManager();\n\t\treturn true;\n\t}\n\tif (text === \"/login\") {\n\t\tawait ctx.showOAuthSelector(\"login\");\n\t\treturn true;\n\t}\n\tif (text === \"/logout\") {\n\t\tawait ctx.showOAuthSelector(\"logout\");\n\t\treturn true;\n\t}\n\tif (text === \"/new\") {\n\t\tawait ctx.handleClearCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/compact\" || text.startsWith(\"/compact \")) {\n\t\tconst customInstructions = text.startsWith(\"/compact \") ? text.slice(9).trim() : undefined;\n\t\tawait handleCompactCommand(customInstructions, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/reload\") {\n\t\tawait ctx.handleReloadCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/thinking\" || text.startsWith(\"/thinking \")) {\n\t\tconst arg = text.startsWith(\"/thinking \") ? text.slice(10).trim() : undefined;\n\t\thandleThinkingCommand(arg, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/edit-mode\" || text.startsWith(\"/edit-mode \")) {\n\t\tconst arg = text.startsWith(\"/edit-mode \") ? text.slice(11).trim() : undefined;\n\t\thandleEditModeCommand(arg, ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/debug\") {\n\t\tctx.handleDebugCommand();\n\t\treturn true;\n\t}\n\tif (text === \"/arminsayshi\") {\n\t\thandleArminSaysHi(ctx);\n\t\treturn true;\n\t}\n\tif (text === \"/resume\") {\n\t\tctx.showSessionSelector();\n\t\treturn true;\n\t}\n\tif (text === \"/quit\") {\n\t\tawait ctx.shutdown();\n\t\treturn true;\n\t}\n\tif (text === \"/terminal\" || text.startsWith(\"/terminal \")) {\n\t\tconst command = text.startsWith(\"/terminal \") ? text.slice(10).trim() : \"\";\n\t\tif (!command) {\n\t\t\tctx.showWarning(\"Usage: /terminal <command> (e.g. /terminal ping -c3 1.1.1.1)\");\n\t\t\treturn true;\n\t\t}\n\t\t// Run in the user's login shell ($SHELL -l -c) so PATH additions\n\t\t// and env vars from shell profiles (.zprofile/.profile) are available.\n\t\t// Note: shell aliases are not loaded (requires -i which has side effects).\n\t\tawait ctx.handleBashCommand(command, { loginShell: true });\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n// ---------------------------------------------------------------------------\n// Individual command handlers\n// ---------------------------------------------------------------------------\n\nasync function handleExportCommand(text: string, ctx: SlashCommandContext): Promise<void> {\n\tconst parts = text.split(/\\s+/);\n\tconst outputPath = parts.length > 1 ? parts[1] : undefined;\n\n\ttry {\n\t\tconst filePath = await ctx.session.exportToHtml(outputPath);\n\t\tctx.showStatus(`Session exported to: ${filePath}`);\n\t} catch (error: unknown) {\n\t\tctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t}\n}\n\nasync function handleShareCommand(ctx: SlashCommandContext): Promise<void> {\n\t// Check if gh is available and logged in\n\ttry {\n\t\tconst authResult = spawnSync(\"gh\", [\"auth\", \"status\"], { encoding: \"utf-8\" });\n\t\tif (authResult.status !== 0) {\n\t\t\tctx.showError(\"GitHub CLI is not logged in. Run 'gh auth login' first.\");\n\t\t\treturn;\n\t\t}\n\t} catch {\n\t\tctx.showError(\"GitHub CLI (gh) is not installed. Install it from https://cli.github.com/\");\n\t\treturn;\n\t}\n\n\t// Export to a temp file\n\tconst tmpFile = path.join(os.tmpdir(), \"session.html\");\n\ttry {\n\t\tawait ctx.session.exportToHtml(tmpFile);\n\t} catch (error: unknown) {\n\t\tctx.showError(`Failed to export session: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\treturn;\n\t}\n\n\t// Show cancellable loader, replacing the editor\n\tconst loader = new BorderedLoader(ctx.ui, theme, \"Creating gist...\");\n\tctx.editorContainer.clear();\n\tctx.editorContainer.addChild(loader);\n\tctx.ui.setFocus(loader);\n\tctx.requestRender();\n\n\tconst restoreEditor = () => {\n\t\tloader.dispose();\n\t\tctx.editorContainer.clear();\n\t\tctx.editorContainer.addChild(ctx.editor);\n\t\tctx.ui.setFocus(ctx.editor);\n\t\ttry {\n\t\t\tfs.unlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// Ignore cleanup errors\n\t\t}\n\t};\n\n\t// Create a secret gist asynchronously\n\tlet proc: ReturnType<typeof spawn> | null = null;\n\n\tloader.onAbort = () => {\n\t\tproc?.kill();\n\t\trestoreEditor();\n\t\tctx.showStatus(\"Share cancelled\");\n\t};\n\n\t\ttry {\n\t\t\tconst result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {\n\t\t\t\tproc = spawn(\"gh\", [\"gist\", \"create\", \"--public=false\", tmpFile], {\n\t\t\t\t\tshell: process.platform === \"win32\",\n\t\t\t\t});\n\t\t\t\tlet stdout = \"\";\n\t\t\t\tlet stderr = \"\";\n\t\t\tproc.stdout?.on(\"data\", (data) => {\n\t\t\t\tstdout += data.toString();\n\t\t\t});\n\t\t\tproc.stderr?.on(\"data\", (data) => {\n\t\t\t\tstderr += data.toString();\n\t\t\t});\n\t\t\tproc.on(\"close\", (code) => resolve({ stdout, stderr, code }));\n\t\t});\n\n\t\tif (loader.signal.aborted) return;\n\n\t\trestoreEditor();\n\n\t\tif (result.code !== 0) {\n\t\t\tconst errorMsg = result.stderr?.trim() || \"Unknown error\";\n\t\t\tctx.showError(`Failed to create gist: ${errorMsg}`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Extract gist ID from the URL returned by gh\n\t\t// gh returns something like: https://gist.github.com/username/GIST_ID\n\t\tconst gistUrl = result.stdout?.trim();\n\t\tconst gistId = gistUrl?.split(\"/\").pop();\n\t\tif (!gistId) {\n\t\t\tctx.showError(\"Failed to parse gist ID from gh output\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Create the preview URL\n\t\tconst previewUrl = getShareViewerUrl(gistId);\n\t\tctx.showStatus(`Share URL: ${previewUrl}\\nGist: ${gistUrl}`);\n\t} catch (error: unknown) {\n\t\tif (!loader.signal.aborted) {\n\t\t\trestoreEditor();\n\t\t\tctx.showError(`Failed to create gist: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\t\t}\n\t}\n}\n\nfunction handleCopyCommand(ctx: SlashCommandContext): void {\n\tconst text = ctx.session.getLastAssistantText();\n\tif (!text) {\n\t\tctx.showError(\"No agent messages to copy yet.\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tcopyToClipboard(text);\n\t\tctx.showStatus(\"Copied last agent message to clipboard\");\n\t} catch (error) {\n\t\tctx.showError(error instanceof Error ? error.message : String(error));\n\t}\n}\n\nfunction handleNameCommand(text: string, ctx: SlashCommandContext): void {\n\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\tif (!name) {\n\t\tconst currentName = ctx.sessionManager.getSessionName();\n\t\tif (currentName) {\n\t\t\tctx.chatContainer.addChild(new Spacer(1));\n\t\t\tctx.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name: ${currentName}`), 1, 0));\n\t\t} else {\n\t\t\tctx.showWarning(\"Usage: /name <name>\");\n\t\t}\n\t\tctx.requestRender();\n\t\treturn;\n\t}\n\n\tctx.sessionManager.appendSessionInfo(name);\n\tctx.updateTerminalTitle();\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Text(theme.fg(\"dim\", `Session name set: ${name}`), 1, 0));\n\tctx.requestRender();\n}\n\nfunction handleSessionCommand(ctx: SlashCommandContext): void {\n\tconst stats = ctx.session.getSessionStats();\n\tconst sessionName = ctx.sessionManager.getSessionName();\n\n\tlet info = `${theme.bold(\"Session Info\")}\\n\\n`;\n\tif (sessionName) {\n\t\tinfo += `${theme.fg(\"dim\", \"Name:\")} ${sessionName}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"File:\")} ${stats.sessionFile ?? \"In-memory\"}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"ID:\")} ${stats.sessionId}\\n\\n`;\n\tinfo += `${theme.bold(\"Messages\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"User:\")} ${stats.userMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Assistant:\")} ${stats.assistantMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Calls:\")} ${stats.toolCalls}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Tool Results:\")} ${stats.toolResults}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.totalMessages}\\n\\n`;\n\tinfo += `${theme.bold(\"Tokens\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Input:\")} ${stats.tokens.input.toLocaleString()}\\n`;\n\tinfo += `${theme.fg(\"dim\", \"Output:\")} ${stats.tokens.output.toLocaleString()}\\n`;\n\tif (stats.tokens.cacheRead > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Read:\")} ${stats.tokens.cacheRead.toLocaleString()}\\n`;\n\t}\n\tif (stats.tokens.cacheWrite > 0) {\n\t\tinfo += `${theme.fg(\"dim\", \"Cache Write:\")} ${stats.tokens.cacheWrite.toLocaleString()}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.tokens.total.toLocaleString()}\\n`;\n\n\tif (stats.cost > 0) {\n\t\tinfo += `\\n${theme.bold(\"Cost\")}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", \"Total:\")} ${stats.cost.toFixed(4)}`;\n\t}\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Text(info, 1, 0));\n\tctx.requestRender();\n}\n\nfunction handleChangelogCommand(ctx: SlashCommandContext): void {\n\tconst changelogPath = getChangelogPath();\n\tconst allEntries = parseChangelog(changelogPath);\n\n\tconst changelogMarkdown =\n\t\tallEntries.length > 0\n\t\t\t? allEntries\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.map((e) => e.content)\n\t\t\t\t\t.join(\"\\n\\n\")\n\t\t\t: \"No changelog entries found.\";\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0));\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, ctx.getMarkdownThemeWithSettings()));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.requestRender();\n}\n\n// ---------------------------------------------------------------------------\n// /hotkeys helpers\n// ---------------------------------------------------------------------------\n\nexport function capitalizeKey(key: string): string {\n\treturn key\n\t\t.split(\"/\")\n\t\t.map((k) =>\n\t\t\tk\n\t\t\t\t.split(\"+\")\n\t\t\t\t.map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t\t\t.join(\"+\"),\n\t\t)\n\t\t.join(\"/\");\n}\n\nexport function getAppKeyDisplay(keybindings: KeybindingsManager, action: AppAction): string {\n\treturn capitalizeKey(appKey(keybindings, action));\n}\n\nfunction getEditorKeyDisplay(action: EditorAction): string {\n\treturn capitalizeKey(editorKey(action));\n}\n\nfunction handleHotkeysCommand(ctx: SlashCommandContext): void {\n\t// Navigation keybindings\n\tconst cursorWordLeft = getEditorKeyDisplay(\"cursorWordLeft\");\n\tconst cursorWordRight = getEditorKeyDisplay(\"cursorWordRight\");\n\tconst cursorLineStart = getEditorKeyDisplay(\"cursorLineStart\");\n\tconst cursorLineEnd = getEditorKeyDisplay(\"cursorLineEnd\");\n\tconst jumpForward = getEditorKeyDisplay(\"jumpForward\");\n\tconst jumpBackward = getEditorKeyDisplay(\"jumpBackward\");\n\tconst pageUp = getEditorKeyDisplay(\"pageUp\");\n\tconst pageDown = getEditorKeyDisplay(\"pageDown\");\n\n\t// Editing keybindings\n\tconst submit = getEditorKeyDisplay(\"submit\");\n\tconst newLine = getEditorKeyDisplay(\"newLine\");\n\tconst deleteWordBackward = getEditorKeyDisplay(\"deleteWordBackward\");\n\tconst deleteWordForward = getEditorKeyDisplay(\"deleteWordForward\");\n\tconst deleteToLineStart = getEditorKeyDisplay(\"deleteToLineStart\");\n\tconst deleteToLineEnd = getEditorKeyDisplay(\"deleteToLineEnd\");\n\tconst yank = getEditorKeyDisplay(\"yank\");\n\tconst yankPop = getEditorKeyDisplay(\"yankPop\");\n\tconst undo = getEditorKeyDisplay(\"undo\");\n\tconst tab = getEditorKeyDisplay(\"tab\");\n\n\t// App keybindings\n\tconst interrupt = getAppKeyDisplay(ctx.keybindings, \"interrupt\");\n\tconst clear = getAppKeyDisplay(ctx.keybindings, \"clear\");\n\tconst exit = getAppKeyDisplay(ctx.keybindings, \"exit\");\n\tconst suspend = getAppKeyDisplay(ctx.keybindings, \"suspend\");\n\tconst cycleThinkingLevel = getAppKeyDisplay(ctx.keybindings, \"cycleThinkingLevel\");\n\tconst cycleModelForward = getAppKeyDisplay(ctx.keybindings, \"cycleModelForward\");\n\tconst selectModel = getAppKeyDisplay(ctx.keybindings, \"selectModel\");\n\tconst expandTools = getAppKeyDisplay(ctx.keybindings, \"expandTools\");\n\tconst toggleThinking = getAppKeyDisplay(ctx.keybindings, \"toggleThinking\");\n\tconst externalEditor = getAppKeyDisplay(ctx.keybindings, \"externalEditor\");\n\tconst followUp = getAppKeyDisplay(ctx.keybindings, \"followUp\");\n\tconst dequeue = getAppKeyDisplay(ctx.keybindings, \"dequeue\");\n\n\tlet hotkeys = `\n**Navigation**\n| Key | Action |\n|-----|--------|\n| \\`Arrow keys\\` | Move cursor / browse history (Up when empty) |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | Move by word |\n| \\`${cursorLineStart}\\` | Start of line |\n| \\`${cursorLineEnd}\\` | End of line |\n| \\`${jumpForward}\\` | Jump forward to character |\n| \\`${jumpBackward}\\` | Jump backward to character |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | Scroll by page |\n\n**Editing**\n| Key | Action |\n|-----|--------|\n| \\`${submit}\\` | Send message |\n| \\`${newLine}\\` | New line${process.platform === \"win32\" ? \" (Ctrl+Enter on Windows Terminal)\" : \"\"} |\n| \\`${deleteWordBackward}\\` | Delete word backwards |\n| \\`${deleteWordForward}\\` | Delete word forwards |\n| \\`${deleteToLineStart}\\` | Delete to start of line |\n| \\`${deleteToLineEnd}\\` | Delete to end of line |\n| \\`${yank}\\` | Paste the most-recently-deleted text |\n| \\`${yankPop}\\` | Cycle through the deleted text after pasting |\n| \\`${undo}\\` | Undo |\n\n**Other**\n| Key | Action |\n|-----|--------|\n| \\`${tab}\\` | Path completion / accept autocomplete |\n| \\`${interrupt}\\` | Cancel autocomplete / abort streaming |\n| \\`${clear}\\` | Clear editor (first) / exit (second) |\n| \\`${exit}\\` | Exit (when editor is empty) |\n| \\`${suspend}\\` | Suspend to background |\n| \\`${cycleThinkingLevel}\\` | Cycle thinking level |\n| \\`${cycleModelForward}\\` | Cycle models |\n| \\`${selectModel}\\` | Open model selector |\n| \\`${expandTools}\\` | Toggle tool output expansion |\n| \\`${toggleThinking}\\` | Toggle thinking block visibility |\n| \\`${externalEditor}\\` | Edit message in external editor |\n| \\`${followUp}\\` | Queue follow-up message |\n| \\`${dequeue}\\` | Restore queued messages |\n| \\`Ctrl+V\\` | Paste image from clipboard |\n| \\`/\\` | Slash commands |\n| \\`!\\` | Run bash command |\n| \\`!!\\` | Run bash command (excluded from context) |\n`;\n\n\t// Add extension-registered shortcuts\n\tconst extensionRunner = ctx.session.extensionRunner;\n\tif (extensionRunner) {\n\t\tconst shortcuts = extensionRunner.getShortcuts(ctx.keybindings.getEffectiveConfig());\n\t\tif (shortcuts.size > 0) {\n\t\t\thotkeys += `\n**Extensions**\n| Key | Action |\n|-----|--------|\n`;\n\t\t\tfor (const [key, shortcut] of shortcuts) {\n\t\t\t\tconst description = shortcut.description ?? shortcut.extensionPath;\n\t\t\t\tconst keyDisplay = formatKeyForDisplay(key).replace(/\\b\\w/g, (c) => c.toUpperCase());\n\t\t\t\thotkeys += `| \\`${keyDisplay}\\` | ${description} |\\n`;\n\t\t\t}\n\t\t}\n\t}\n\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Keyboard Shortcuts\")), 1, 0));\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, ctx.getMarkdownThemeWithSettings()));\n\tctx.chatContainer.addChild(new DynamicBorder());\n\tctx.requestRender();\n}\n\nasync function handleCompactCommand(customInstructions: string | undefined, ctx: SlashCommandContext): Promise<void> {\n\tconst entries = ctx.sessionManager.getEntries();\n\tconst messageCount = entries.filter((e) => e.type === \"message\").length;\n\n\tif (messageCount < 2) {\n\t\tctx.showWarning(\"Nothing to compact (no messages yet)\");\n\t\treturn;\n\t}\n\n\tawait ctx.executeCompaction(customInstructions, false);\n}\n\nfunction handleThinkingCommand(arg: string | undefined, ctx: SlashCommandContext): void {\n\tif (!ctx.session.supportsThinking()) {\n\t\tctx.showStatus(\"Current model does not support thinking\");\n\t\treturn;\n\t}\n\n\tconst availableLevels = ctx.session.getAvailableThinkingLevels();\n\n\tif (arg) {\n\t\tconst level = arg.toLowerCase();\n\t\tif (!availableLevels.includes(level as ThinkingLevel)) {\n\t\t\tctx.showStatus(`Invalid thinking level \"${arg}\". Available: ${availableLevels.join(\", \")}`);\n\t\t\treturn;\n\t\t}\n\t\tctx.session.setThinkingLevel(level as ThinkingLevel);\n\t\tctx.invalidateFooter();\n\t\tctx.updateEditorBorderColor();\n\t\tctx.showStatus(`Thinking level: ${level}`);\n\t\treturn;\n\t}\n\n\tshowThinkingSelector(ctx, availableLevels);\n}\n\nfunction showThinkingSelector(ctx: SlashCommandContext, availableLevels: readonly ThinkingLevel[]): void {\n\tctx.showSelector((done) => {\n\t\tconst selector = new SelectSubmenu(\n\t\t\t\"Thinking Level\",\n\t\t\t\"Select reasoning depth for thinking-capable models\",\n\t\t\tavailableLevels.map((level) => ({\n\t\t\t\tvalue: level,\n\t\t\t\tlabel: level,\n\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t})),\n\t\t\tctx.session.thinkingLevel,\n\t\t\t(value) => {\n\t\t\t\tctx.session.setThinkingLevel(value as ThinkingLevel);\n\t\t\t\tctx.invalidateFooter();\n\t\t\t\tctx.updateEditorBorderColor();\n\t\t\t\tdone();\n\t\t\t\tctx.showStatus(`Thinking level: ${value}`);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nfunction handleEditModeCommand(arg: string | undefined, ctx: SlashCommandContext): void {\n\tconst modes = [\"standard\", \"hashline\"] as const;\n\n\tif (arg) {\n\t\tconst mode = arg.toLowerCase();\n\t\tif (!modes.includes(mode as typeof modes[number])) {\n\t\t\tctx.showStatus(`Invalid edit mode \"${arg}\". Available: standard, hashline`);\n\t\t\treturn;\n\t\t}\n\t\tctx.session.setEditMode(mode as \"standard\" | \"hashline\");\n\t\tctx.showStatus(`Edit mode: ${mode}${mode === \"hashline\" ? \" (LINE#ID anchored edits)\" : \" (text-match edits)\"}`);\n\t\treturn;\n\t}\n\n\t// Toggle\n\tconst current = ctx.session.editMode;\n\tconst next = current === \"standard\" ? \"hashline\" : \"standard\";\n\tctx.session.setEditMode(next);\n\tctx.showStatus(`Edit mode: ${next}${next === \"hashline\" ? \" (LINE#ID anchored edits)\" : \" (text-match edits)\"}`);\n}\n\nfunction handleArminSaysHi(ctx: SlashCommandContext): void {\n\tctx.chatContainer.addChild(new Spacer(1));\n\tctx.chatContainer.addChild(new ArminComponent(ctx.ui));\n\tctx.requestRender();\n}\n"]}
@@ -172,16 +172,49 @@ export function hasRootMarkers(cwd: string, markers: string[]): boolean {
172
172
  // Local Binary Resolution
173
173
  // =============================================================================
174
174
 
175
- const LOCAL_BIN_PATHS: Array<{ markers: string[]; binDir: string }> = [
176
- { markers: ["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"], binDir: "node_modules/.bin" },
177
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".venv/bin" },
178
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: "venv/bin" },
179
- { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".env/bin" },
180
- { markers: ["Gemfile", "Gemfile.lock"], binDir: "vendor/bundle/bin" },
181
- { markers: ["Gemfile", "Gemfile.lock"], binDir: "bin" },
182
- { markers: ["go.mod", "go.sum"], binDir: "bin" },
175
+ const LOCAL_BIN_PATHS: Array<{ markers: string[]; binDirs: string[] }> = [
176
+ { markers: ["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"], binDirs: ["node_modules/.bin"] },
177
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: [".venv/bin", ".venv/Scripts"] },
178
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: ["venv/bin", "venv/Scripts"] },
179
+ { markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDirs: [".env/bin", ".env/Scripts"] },
180
+ { markers: ["Gemfile", "Gemfile.lock"], binDirs: ["vendor/bundle/bin"] },
181
+ { markers: ["Gemfile", "Gemfile.lock"], binDirs: ["bin"] },
182
+ { markers: ["go.mod", "go.sum"], binDirs: ["bin"] },
183
183
  ];
184
184
 
185
+ function getWindowsBinaryCandidates(command: string): string[] {
186
+ const ext = path.extname(command).toLowerCase();
187
+ if (ext) {
188
+ return [command];
189
+ }
190
+
191
+ return [
192
+ command,
193
+ `${command}.cmd`,
194
+ `${command}.bat`,
195
+ `${command}.exe`,
196
+ ];
197
+ }
198
+
199
+ export function resolveLocalBinaryPath(command: string, cwd: string, isWindows: boolean): string | null {
200
+ for (const { markers, binDirs } of LOCAL_BIN_PATHS) {
201
+ if (!hasRootMarkers(cwd, markers)) continue;
202
+
203
+ for (const binDir of binDirs) {
204
+ const basePath = path.join(cwd, binDir, command);
205
+ const candidates = isWindows ? getWindowsBinaryCandidates(basePath) : [basePath];
206
+
207
+ for (const candidate of candidates) {
208
+ if (fs.existsSync(candidate)) {
209
+ return candidate;
210
+ }
211
+ }
212
+ }
213
+ }
214
+
215
+ return null;
216
+ }
217
+
185
218
  export function which(command: string): string | null {
186
219
  // On Windows, prefer `where.exe` over `which` — MSYS/Git Bash's `which`
187
220
  // returns POSIX paths (/c/Users/...) that Node's spawn() can't execute.
@@ -196,15 +229,8 @@ export function which(command: string): string | null {
196
229
  }
197
230
 
198
231
  export function resolveCommand(command: string, cwd: string): string | null {
199
- for (const { markers, binDir } of LOCAL_BIN_PATHS) {
200
- if (hasRootMarkers(cwd, markers)) {
201
- const localPath = path.join(cwd, binDir, command);
202
- if (fs.existsSync(localPath)) {
203
- return localPath;
204
- }
205
- }
206
- }
207
-
232
+ const localPath = resolveLocalBinaryPath(command, cwd, process.platform === "win32");
233
+ if (localPath) return localPath;
208
234
  return which(command);
209
235
  }
210
236
 
@@ -305,11 +305,13 @@ async function handleShareCommand(ctx: SlashCommandContext): Promise<void> {
305
305
  ctx.showStatus("Share cancelled");
306
306
  };
307
307
 
308
- try {
309
- const result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {
310
- proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
311
- let stdout = "";
312
- let stderr = "";
308
+ try {
309
+ const result = await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve) => {
310
+ proc = spawn("gh", ["gist", "create", "--public=false", tmpFile], {
311
+ shell: process.platform === "win32",
312
+ });
313
+ let stdout = "";
314
+ let stderr = "";
313
315
  proc.stdout?.on("data", (data) => {
314
316
  stdout += data.toString();
315
317
  });
@@ -20,6 +20,8 @@ import { resolve } from "node:path";
20
20
  import type { TaskRow } from "./gsd-db.ts";
21
21
  import type { PreExecutionCheckJSON } from "./verification-evidence.ts";
22
22
 
23
+ const NPM_COMMAND = process.platform === "win32" ? "npm.cmd" : "npm";
24
+
23
25
  // ─── Result Types ────────────────────────────────────────────────────────────
24
26
 
25
27
  export interface PreExecutionResult {
@@ -126,9 +128,10 @@ async function checkPackageOnNpm(
126
128
  timeoutMs = 5000
127
129
  ): Promise<{ exists: boolean; error?: string }> {
128
130
  return new Promise((resolve) => {
129
- const child = spawn("npm", ["view", packageName, "name"], {
131
+ const child = spawn(NPM_COMMAND, ["view", packageName, "name"], {
130
132
  stdio: ["ignore", "pipe", "pipe"],
131
133
  timeout: timeoutMs,
134
+ shell: process.platform === "win32",
132
135
  });
133
136
 
134
137
  let stdout = "";
@@ -74,6 +74,27 @@ test("validateDirectory: C:\\Windows is blocked", { skip: !isWindows ? "Windows-
74
74
  assert.equal(result.severity, "blocked");
75
75
  });
76
76
 
77
+ test("validateDirectory: D:\\Windows is blocked", { skip: !isWindows ? "Windows-only test" : undefined }, () => {
78
+ const result = validateDirectory("D:\\Windows");
79
+ assert.equal(result.safe, false);
80
+ assert.equal(result.severity, "blocked");
81
+ assert.ok(result.reason?.includes("system directory"));
82
+ });
83
+
84
+ test("validateDirectory: E:\\Program Files is blocked", { skip: !isWindows ? "Windows-only test" : undefined }, () => {
85
+ const result = validateDirectory("E:\\Program Files");
86
+ assert.equal(result.safe, false);
87
+ assert.equal(result.severity, "blocked");
88
+ assert.ok(result.reason?.includes("system directory"));
89
+ });
90
+
91
+ test("validateDirectory: any Windows drive root is blocked", { skip: !isWindows ? "Windows-only test" : undefined }, () => {
92
+ const result = validateDirectory("D:\\");
93
+ assert.equal(result.safe, false);
94
+ assert.equal(result.severity, "blocked");
95
+ assert.ok(result.reason?.includes("system directory"));
96
+ });
97
+
77
98
  // ─── Home directory (cross-platform) ─────────────────────────────────────────────
78
99
 
79
100
  test("validateDirectory: home directory itself is blocked", () => {
@@ -104,7 +125,13 @@ test("validateDirectory: subdirectory of home is NOT blocked", () => {
104
125
  // Regression test for #1317: GSD worktree inside $HOME must not be blocked even
105
126
  // when the resolved project root equals $HOME (e.g. home dir is a git repo).
106
127
  test("validateDirectory: GSD worktree path nested under home is NOT blocked (#1317)", () => {
128
+ const originalHome = process.env.HOME;
129
+ const originalUserProfile = process.env.USERPROFILE;
130
+ const fakeHome = makeTempDir("fake-home");
131
+ process.env.HOME = fakeHome;
132
+ process.env.USERPROFILE = fakeHome;
107
133
  const worktreePath = join(homedir(), ".gsd", "worktrees", "M001");
134
+ const worktreeRoot = join(fakeHome, ".gsd", "worktrees", "M001");
108
135
  mkdirSync(worktreePath, { recursive: true });
109
136
  try {
110
137
  // The worktree CWD itself is a valid location — it must pass.
@@ -112,7 +139,12 @@ test("validateDirectory: GSD worktree path nested under home is NOT blocked (#13
112
139
  assert.equal(result.safe, true, "GSD worktree path should be safe to run in");
113
140
  assert.equal(result.severity, "ok");
114
141
  } finally {
115
- rmSync(join(homedir(), ".gsd", "worktrees", "M001"), { recursive: true, force: true });
142
+ if (originalHome === undefined) delete process.env.HOME;
143
+ else process.env.HOME = originalHome;
144
+ if (originalUserProfile === undefined) delete process.env.USERPROFILE;
145
+ else process.env.USERPROFILE = originalUserProfile;
146
+ rmSync(worktreeRoot, { recursive: true, force: true });
147
+ rmSync(fakeHome, { recursive: true, force: true });
116
148
  }
117
149
  });
118
150