cliskill 1.1.5 → 1.1.7

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-GEH466DM.js";
4
+ } from "../chunk-TZMKZQ7N.js";
5
5
  import "../chunk-S7IQHES2.js";
6
6
  export {
7
7
  runCli
@@ -4430,11 +4430,11 @@ async function cleanup(path) {
4430
4430
  var ScreenCapture = class {
4431
4431
  lastCapture = null;
4432
4432
  async getScreenSize() {
4433
- const platform3 = getPlatform();
4434
- if (platform3 === "win32") {
4433
+ const platform4 = getPlatform();
4434
+ if (platform4 === "win32") {
4435
4435
  return this.getScreenSizeWindows();
4436
4436
  }
4437
- if (platform3 === "darwin") {
4437
+ if (platform4 === "darwin") {
4438
4438
  return this.getScreenSizeMac();
4439
4439
  }
4440
4440
  return this.getScreenSizeLinux();
@@ -4469,11 +4469,11 @@ var ScreenCapture = class {
4469
4469
  return { width: parseInt(match[1], 10), height: parseInt(match[2], 10) };
4470
4470
  }
4471
4471
  async capture(options) {
4472
- const platform3 = getPlatform();
4472
+ const platform4 = getPlatform();
4473
4473
  let result;
4474
- if (platform3 === "win32") {
4474
+ if (platform4 === "win32") {
4475
4475
  result = await this.captureWindows(options);
4476
- } else if (platform3 === "darwin") {
4476
+ } else if (platform4 === "darwin") {
4477
4477
  result = await this.captureMac(options);
4478
4478
  } else {
4479
4479
  result = await this.captureLinux(options);
@@ -4670,12 +4670,12 @@ var KEY_MAP_LINUX = {
4670
4670
  };
4671
4671
  var InputController = class {
4672
4672
  async click(options) {
4673
- const platform3 = getPlatform2();
4673
+ const platform4 = getPlatform2();
4674
4674
  const { x, y, button = "left", count = 1 } = options;
4675
- if (platform3 === "win32") {
4675
+ if (platform4 === "win32") {
4676
4676
  return this.clickWindows(x, y, button, count);
4677
4677
  }
4678
- if (platform3 === "darwin") {
4678
+ if (platform4 === "darwin") {
4679
4679
  return this.clickMac(x, y, button, count);
4680
4680
  }
4681
4681
  return this.clickLinux(x, y, button, count);
@@ -4774,13 +4774,13 @@ var InputController = class {
4774
4774
  return `Clicked ${button} at (${x}, ${y})${count > 1 ? ` x${count}` : ""}`;
4775
4775
  }
4776
4776
  async moveMouse(x, y) {
4777
- const platform3 = getPlatform2();
4778
- if (platform3 === "win32") {
4777
+ const platform4 = getPlatform2();
4778
+ if (platform4 === "win32") {
4779
4779
  await execPowerShell2(`
4780
4780
  Add-Type -AssemblyName System.Windows.Forms
4781
4781
  [System.Windows.Forms.Cursor]::Position = [System.Drawing.Point]::new(${x}, ${y})
4782
4782
  `.trim());
4783
- } else if (platform3 === "darwin") {
4783
+ } else if (platform4 === "darwin") {
4784
4784
  await execCommand2("cliclick", [`m:${x},${y}`]);
4785
4785
  } else {
4786
4786
  await execCommand2("xdotool", ["mousemove", "--sync", String(x), String(y)]);
@@ -4788,9 +4788,9 @@ var InputController = class {
4788
4788
  return `Moved cursor to (${x}, ${y})`;
4789
4789
  }
4790
4790
  async drag(options) {
4791
- const platform3 = getPlatform2();
4791
+ const platform4 = getPlatform2();
4792
4792
  const { startX, startY, endX, endY } = options;
4793
- if (platform3 === "win32") {
4793
+ if (platform4 === "win32") {
4794
4794
  await execPowerShell2(`
4795
4795
  Add-Type @'
4796
4796
  using System;
@@ -4819,7 +4819,7 @@ var InputController = class {
4819
4819
  Start-Sleep -Milliseconds 50
4820
4820
  [DragMouse]::mouse_event([DragMouse]::LEFTUP, 0, 0, 0, [IntPtr]::Zero)
4821
4821
  `.trim());
4822
- } else if (platform3 === "darwin") {
4822
+ } else if (platform4 === "darwin") {
4823
4823
  await execCommand2("cliclick", [`dd:${startX},${startY}`, `du:${endX},${endY}`]);
4824
4824
  } else {
4825
4825
  await execCommand2("xdotool", [
@@ -4840,12 +4840,12 @@ var InputController = class {
4840
4840
  return `Dragged from (${startX}, ${startY}) to (${endX}, ${endY})`;
4841
4841
  }
4842
4842
  async typeText(options) {
4843
- const platform3 = getPlatform2();
4843
+ const platform4 = getPlatform2();
4844
4844
  const { text } = options;
4845
- if (platform3 === "win32") {
4845
+ if (platform4 === "win32") {
4846
4846
  return this.typeTextWindows(text);
4847
4847
  }
4848
- if (platform3 === "darwin") {
4848
+ if (platform4 === "darwin") {
4849
4849
  return this.typeTextMac(text);
4850
4850
  }
4851
4851
  return this.typeTextLinux(text);
@@ -4869,13 +4869,13 @@ var InputController = class {
4869
4869
  return `Typed text (${text.length} chars)`;
4870
4870
  }
4871
4871
  async keyPress(options) {
4872
- const platform3 = getPlatform2();
4872
+ const platform4 = getPlatform2();
4873
4873
  const { key } = options;
4874
4874
  const normalizedKey = key.toLowerCase();
4875
- if (platform3 === "win32") {
4875
+ if (platform4 === "win32") {
4876
4876
  return this.keyPressWindows(normalizedKey);
4877
4877
  }
4878
- if (platform3 === "darwin") {
4878
+ if (platform4 === "darwin") {
4879
4879
  return this.keyPressMac(normalizedKey);
4880
4880
  }
4881
4881
  return this.keyPressLinux(normalizedKey);
@@ -4929,15 +4929,15 @@ var InputController = class {
4929
4929
  return `Pressed key: ${key}`;
4930
4930
  }
4931
4931
  async scroll(options) {
4932
- const platform3 = getPlatform2();
4932
+ const platform4 = getPlatform2();
4933
4933
  const { amount, x, y } = options;
4934
4934
  if (x !== void 0 && y !== void 0) {
4935
4935
  await this.moveMouse(x, y);
4936
4936
  }
4937
- if (platform3 === "win32") {
4937
+ if (platform4 === "win32") {
4938
4938
  return this.scrollWindows(amount);
4939
4939
  }
4940
- if (platform3 === "darwin") {
4940
+ if (platform4 === "darwin") {
4941
4941
  return this.scrollMac(amount);
4942
4942
  }
4943
4943
  return this.scrollLinux(amount);
@@ -8193,7 +8193,7 @@ function MessageList({ messages }) {
8193
8193
 
8194
8194
  // src/ui/repl.ts
8195
8195
  import { mkdir as mkdir4, appendFile } from "fs/promises";
8196
- import { join as join12 } from "path";
8196
+ import { join as join13 } from "path";
8197
8197
  import { randomUUID as randomUUID8 } from "crypto";
8198
8198
 
8199
8199
  // src/prompts/system-prompt.ts
@@ -8247,15 +8247,16 @@ Examples of the kind of risky actions that warrant user confirmation:
8247
8247
  }
8248
8248
  function getUsingYourToolsSection() {
8249
8249
  return `# Using your tools
8250
- - Do NOT use the ${BASH} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
8250
+ - Do NOT use the ${BASH} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
8251
8251
  - To read files use ${FILE_READ} instead of cat, head, tail, or sed
8252
8252
  - To edit files use ${FILE_EDIT} instead of sed or awk
8253
8253
  - To create files use ${FILE_WRITE} instead of cat with heredoc or echo redirection
8254
8254
  - To search for files use ${GLOB} instead of find or ls
8255
8255
  - To search the content of files, use ${GREP} instead of grep or rg
8256
8256
  - Reserve using the ${BASH} exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool.
8257
- - Break down and manage your work with the ${TODO_WRITE} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.
8258
- - You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially.`;
8257
+ - Break down and manage your work with the ${TODO_WRITE} tool. These tools are helpful for planning your work and helping the user track your progress. Mark each task as completed as soon as you are done with the task. Do not batch up multiple tasks before marking them as completed.
8258
+ - You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency. However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially.
8259
+ - In addition to the built-in tools listed above, you may have access to MCP (Model Context Protocol) tools from external servers. If an "MCP Tools" section appears in your system prompt, those tools are available to you. When the user asks about your tools or capabilities, include MCP tools in your response \u2014 do NOT claim you have no external tools if MCP tools are listed.`;
8259
8260
  }
8260
8261
  function getAgentToolSection() {
8261
8262
  return ` - Use the ${AGENT} tool with specialized sub-agents when the task at hand benefits from parallelization or when you need to protect the main context window from excessive results. Importantly, avoid duplicating work that sub-agents are already doing \u2014 if you delegate research to a sub-agent, do not also perform the same searches yourself.`;
@@ -8324,24 +8325,39 @@ You have been invoked in the following environment:
8324
8325
  - Hostname: ${hostname()}
8325
8326
  - Shell: ${isWin ? "cmd.exe (use Windows-compatible commands)" : "bash/zsh"}`;
8326
8327
  }
8327
- function buildMcpToolsSection(servers) {
8328
- if (servers.length === 0) return "";
8328
+ function buildMcpToolsSection(servers, failedServers = []) {
8329
+ if (servers.length === 0 && failedServers.length === 0) return "";
8329
8330
  const lines = [
8330
8331
  "# MCP (Model Context Protocol) Tools",
8331
8332
  "",
8332
- "You have access to tools from connected MCP (Model Context Protocol) servers.",
8333
+ "You have access to tools from MCP (Model Context Protocol) servers.",
8333
8334
  "These are external tools provided by MCP services that extend your capabilities beyond the built-in tools.",
8334
8335
  "Use them like any other tool when they are relevant to the task.",
8335
8336
  "",
8336
- "When the user asks about MCP services, MCP tools, or what external tools are available, refer to the list below.",
8337
+ "IMPORTANT: When the user asks about your available tools, MCP capabilities, or what external services you can access,",
8338
+ "you MUST include the MCP tools listed below in your response. Do NOT claim you have no MCP tools if this section exists.",
8337
8339
  ""
8338
8340
  ];
8339
- for (const server of servers) {
8340
- lines.push(`## MCP Server: ${server.name}`);
8341
- for (const tool of server.tools) {
8342
- lines.push(`- **${tool.name}**: ${tool.description}`);
8341
+ if (servers.length > 0) {
8342
+ lines.push("## Connected MCP Servers");
8343
+ lines.push("");
8344
+ for (const server of servers) {
8345
+ lines.push(`### ${server.name}`);
8346
+ for (const tool of server.tools) {
8347
+ lines.push(`- **${tool.name}**: ${tool.description}`);
8348
+ }
8349
+ lines.push("");
8350
+ }
8351
+ }
8352
+ if (failedServers.length > 0) {
8353
+ lines.push("## MCP Servers (Connection Failed)");
8354
+ lines.push("");
8355
+ for (const failed of failedServers) {
8356
+ lines.push(`- **${failed.name}**: ${failed.error}`);
8343
8357
  }
8344
8358
  lines.push("");
8359
+ lines.push("The above MCP servers are configured but failed to connect. Inform the user if they ask about MCP.");
8360
+ lines.push("");
8345
8361
  }
8346
8362
  return lines.join("\n");
8347
8363
  }
@@ -8363,9 +8379,33 @@ function buildSystemPrompt() {
8363
8379
  // src/mcp/client.ts
8364
8380
  import { spawn as spawn2 } from "child_process";
8365
8381
  import { createInterface } from "readline";
8382
+ import { platform as platform2 } from "os";
8383
+ import { dirname as dirname4, join as join12 } from "path";
8384
+ import { existsSync as existsSync6 } from "fs";
8366
8385
  var DEFAULT_REQUEST_TIMEOUT = 3e4;
8367
8386
  var CONNECT_TIMEOUT = 3e4;
8368
8387
  var MCP_PROTOCOL_VERSION = "2024-11-05";
8388
+ var IS_WIN32 = platform2() === "win32";
8389
+ function resolveSpawnCommand(command, args) {
8390
+ if (!IS_WIN32) return { command, args };
8391
+ const cliMap = {
8392
+ npx: "npx-cli.js",
8393
+ npm: "npm-cli.js"
8394
+ };
8395
+ const cliFile = cliMap[command];
8396
+ if (!cliFile) return { command, args };
8397
+ const nodeDir = dirname4(process.execPath);
8398
+ const candidates = [
8399
+ join12(nodeDir, "node_modules", "npm", "bin", cliFile),
8400
+ join12(nodeDir, cliFile)
8401
+ ];
8402
+ for (const candidate of candidates) {
8403
+ if (existsSync6(candidate)) {
8404
+ return { command: process.execPath, args: [candidate, ...args] };
8405
+ }
8406
+ }
8407
+ return { command: "cmd", args: ["/c", command, ...args] };
8408
+ }
8369
8409
  var MCPClient = class {
8370
8410
  config;
8371
8411
  process = null;
@@ -8480,7 +8520,8 @@ var MCPClient = class {
8480
8520
  ...process.env,
8481
8521
  ...this.config.env
8482
8522
  };
8483
- this.process = spawn2(this.config.command, this.config.args, {
8523
+ const { command, args } = resolveSpawnCommand(this.config.command, this.config.args);
8524
+ this.process = spawn2(command, args, {
8484
8525
  stdio: ["pipe", "pipe", "pipe"],
8485
8526
  env
8486
8527
  });
@@ -8901,7 +8942,7 @@ var SessionSaver = class {
8901
8942
  this.sessionId = randomUUID8();
8902
8943
  const dir = getSessionsDir();
8903
8944
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
8904
- this.filePath = join12(dir, `session-${timestamp}.jsonl`);
8945
+ this.filePath = join13(dir, `session-${timestamp}.jsonl`);
8905
8946
  }
8906
8947
  async init() {
8907
8948
  const dir = getSessionsDir();
@@ -8940,7 +8981,10 @@ function buildModelRouter(adapterRegistry, config) {
8940
8981
  });
8941
8982
  }
8942
8983
  async function connectMcpServers(config, toolRegistry) {
8943
- if (config.mcpServers.length === 0) return null;
8984
+ const failedServers = [];
8985
+ if (config.mcpServers.length === 0) {
8986
+ return { manager: null, failedServers };
8987
+ }
8944
8988
  const mcpManager = new MCPConnectionManager();
8945
8989
  let connectedCount = 0;
8946
8990
  for (const serverConfig of config.mcpServers) {
@@ -8954,10 +8998,14 @@ async function connectMcpServers(config, toolRegistry) {
8954
8998
  });
8955
8999
  connectedCount++;
8956
9000
  } catch (err) {
8957
- console.error(`MCP server "${serverConfig.name}" connection failed: ${err.message}`);
9001
+ const message = err.message;
9002
+ console.error(`MCP server "${serverConfig.name}" connection failed: ${message}`);
9003
+ failedServers.push({ name: serverConfig.name, error: message });
8958
9004
  }
8959
9005
  }
8960
- if (connectedCount === 0) return null;
9006
+ if (connectedCount === 0) {
9007
+ return { manager: null, failedServers };
9008
+ }
8961
9009
  const registeredTools = await registerMCPTools(mcpManager, (tool) => {
8962
9010
  try {
8963
9011
  toolRegistry.register(tool);
@@ -8968,13 +9016,16 @@ async function connectMcpServers(config, toolRegistry) {
8968
9016
  console.log(` MCP: ${connectedCount} server(s) connected, ${registeredTools.length} tool(s) loaded`);
8969
9017
  }
8970
9018
  mcpManager.registerShutdownHandlers();
8971
- return mcpManager;
9019
+ return { manager: mcpManager, failedServers };
8972
9020
  }
8973
- async function buildMcpSystemSection(mcpManager) {
8974
- if (!mcpManager) return "";
9021
+ async function buildMcpSystemSection(mcpResult) {
9022
+ const { manager, failedServers } = mcpResult;
9023
+ if (!manager) {
9024
+ return buildMcpToolsSection([], failedServers);
9025
+ }
8975
9026
  const servers = [];
8976
- for (const serverName of mcpManager.getConnectedServers()) {
8977
- const tools = await mcpManager.getToolsForServer(serverName);
9027
+ for (const serverName of manager.getConnectedServers()) {
9028
+ const tools = await manager.getToolsForServer(serverName);
8978
9029
  if (tools.length === 0) continue;
8979
9030
  servers.push({
8980
9031
  name: serverName,
@@ -8984,7 +9035,7 @@ async function buildMcpSystemSection(mcpManager) {
8984
9035
  }))
8985
9036
  });
8986
9037
  }
8987
- return buildMcpToolsSection(servers);
9038
+ return buildMcpToolsSection(servers, failedServers);
8988
9039
  }
8989
9040
  async function runTuiRepl(config) {
8990
9041
  const adapterRegistry = new AdapterRegistry();
@@ -8998,8 +9049,8 @@ async function runTuiRepl(config) {
8998
9049
  const adapter = config.defaultProvider ? adapterRegistry.get(config.defaultProvider) : adapterRegistry.getAll()[0];
8999
9050
  const modelRouter = buildModelRouter(adapterRegistry, config);
9000
9051
  const toolRegistry = createDefaultToolRegistry(modelRouter);
9001
- const mcpManager = await connectMcpServers(config, toolRegistry);
9002
- const mcpSection = await buildMcpSystemSection(mcpManager);
9052
+ const mcpResult = await connectMcpServers(config, toolRegistry);
9053
+ const mcpSection = await buildMcpSystemSection(mcpResult);
9003
9054
  const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
9004
9055
  const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
9005
9056
  ensureDataDir();
@@ -9099,8 +9150,8 @@ async function runBasicRepl(config) {
9099
9150
  `);
9100
9151
  }
9101
9152
  const toolRegistry = createDefaultToolRegistry(modelRouter);
9102
- const mcpManager = await connectMcpServers(config, toolRegistry);
9103
- const mcpSection = await buildMcpSystemSection(mcpManager);
9153
+ const mcpResult = await connectMcpServers(config, toolRegistry);
9154
+ const mcpSection = await buildMcpSystemSection(mcpResult);
9104
9155
  const baseSystemPrompt = config.systemPrompt ?? buildSystemPrompt();
9105
9156
  const systemPrompt = mcpSection ? baseSystemPrompt + "\n\n" + mcpSection : baseSystemPrompt;
9106
9157
  const abortController = new AbortController();
@@ -9678,8 +9729,8 @@ function colorizeAnsi(text, ansiName) {
9678
9729
  }
9679
9730
 
9680
9731
  // src/services/cron/task-store.ts
9681
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync2 } from "fs";
9682
- import { join as join13, dirname as dirname4 } from "path";
9732
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
9733
+ import { join as join14, dirname as dirname5 } from "path";
9683
9734
  import { randomUUID as randomUUID9 } from "crypto";
9684
9735
  var DEFAULT_STORE_DIR = getDataDir();
9685
9736
  var DEFAULT_STORE_FILE = "scheduled_tasks.json";
@@ -9689,10 +9740,10 @@ var TaskStore2 = class {
9689
9740
  loaded = false;
9690
9741
  constructor(storeDir) {
9691
9742
  const dir = storeDir ?? DEFAULT_STORE_DIR;
9692
- this.filePath = join13(dir, DEFAULT_STORE_FILE);
9743
+ this.filePath = join14(dir, DEFAULT_STORE_FILE);
9693
9744
  }
9694
9745
  load() {
9695
- if (!existsSync6(this.filePath)) {
9746
+ if (!existsSync7(this.filePath)) {
9696
9747
  this.tasks.clear();
9697
9748
  this.loaded = true;
9698
9749
  return;
@@ -9710,8 +9761,8 @@ var TaskStore2 = class {
9710
9761
  this.loaded = true;
9711
9762
  }
9712
9763
  save() {
9713
- const dir = dirname4(this.filePath);
9714
- if (!existsSync6(dir)) {
9764
+ const dir = dirname5(this.filePath);
9765
+ if (!existsSync7(dir)) {
9715
9766
  mkdirSync2(dir, { recursive: true });
9716
9767
  }
9717
9768
  const data = Array.from(this.tasks.values());
@@ -10026,8 +10077,8 @@ var CronScheduler = class {
10026
10077
 
10027
10078
  // src/services/doctor.ts
10028
10079
  import { execSync as execSync3 } from "child_process";
10029
- import { readFileSync as readFileSync4, existsSync as existsSync7, statSync as statSync2 } from "fs";
10030
- import { join as join14 } from "path";
10080
+ import { readFileSync as readFileSync4, existsSync as existsSync8, statSync as statSync2 } from "fs";
10081
+ import { join as join15 } from "path";
10031
10082
  var TOOLS = [
10032
10083
  { name: "git", command: "git", versionFlag: "--version", optional: false },
10033
10084
  { name: "ripgrep (rg)", command: "rg", versionFlag: "--version", optional: true },
@@ -10054,8 +10105,8 @@ var DoctorDiagnostic = class {
10054
10105
  checkInstallation() {
10055
10106
  const execPath = process.execPath;
10056
10107
  const isNpmGlobal = execPath.includes("npm") || execPath.includes("npx");
10057
- const isLocal = existsSync7(join14(process.cwd(), "node_modules", "cliskill"));
10058
- const isPackageManager = existsSync7(join14(process.cwd(), "package.json"));
10108
+ const isLocal = existsSync8(join15(process.cwd(), "node_modules", "cliskill"));
10109
+ const isPackageManager = existsSync8(join15(process.cwd(), "package.json"));
10059
10110
  let installType = "unknown";
10060
10111
  if (isNpmGlobal) installType = "npm-global";
10061
10112
  else if (isLocal) installType = "local";
@@ -10167,7 +10218,7 @@ var DoctorDiagnostic = class {
10167
10218
  checkConfig() {
10168
10219
  const configPaths = getConfigSearchPaths();
10169
10220
  for (const configPath of configPaths) {
10170
- if (existsSync7(configPath)) {
10221
+ if (existsSync8(configPath)) {
10171
10222
  try {
10172
10223
  const raw = readFileSync4(configPath, "utf-8");
10173
10224
  JSON.parse(raw);
@@ -10198,7 +10249,7 @@ var DoctorDiagnostic = class {
10198
10249
  const configPaths = getConfigSearchPaths();
10199
10250
  let baseUrl = "";
10200
10251
  for (const configPath of configPaths) {
10201
- if (existsSync7(configPath)) {
10252
+ if (existsSync8(configPath)) {
10202
10253
  try {
10203
10254
  const raw = readFileSync4(configPath, "utf-8");
10204
10255
  const config = JSON.parse(raw);
@@ -10245,7 +10296,7 @@ var DoctorDiagnostic = class {
10245
10296
  checkDiskSpace() {
10246
10297
  const memoryDir = getDataDir();
10247
10298
  const historyFile = getDiskHistoryPath();
10248
- if (!existsSync7(memoryDir)) {
10299
+ if (!existsSync8(memoryDir)) {
10249
10300
  return {
10250
10301
  name: "Disk Space",
10251
10302
  status: "ok",
@@ -10254,7 +10305,7 @@ var DoctorDiagnostic = class {
10254
10305
  };
10255
10306
  }
10256
10307
  try {
10257
- const historyStats = existsSync7(historyFile) ? statSync2(historyFile) : null;
10308
+ const historyStats = existsSync8(historyFile) ? statSync2(historyFile) : null;
10258
10309
  const historySize = historyStats ? historyStats.size : 0;
10259
10310
  return {
10260
10311
  name: "Disk Space",
@@ -10323,8 +10374,8 @@ var DoctorDiagnostic = class {
10323
10374
 
10324
10375
  // src/services/conversation-recovery.ts
10325
10376
  import { readFile as readFile10, readdir as readdir6, stat as stat4 } from "fs/promises";
10326
- import { existsSync as existsSync8 } from "fs";
10327
- import { join as join15, basename as basename3 } from "path";
10377
+ import { existsSync as existsSync9 } from "fs";
10378
+ import { join as join16, basename as basename3 } from "path";
10328
10379
  var DEFAULT_RECOVERY_OPTIONS = {
10329
10380
  sessionId: "",
10330
10381
  repairMode: false,
@@ -10338,7 +10389,7 @@ var ConversationRecovery = class {
10338
10389
  const opts = { ...DEFAULT_RECOVERY_OPTIONS, ...options };
10339
10390
  const warnings = [];
10340
10391
  const repairs = [];
10341
- if (!existsSync8(filePath)) {
10392
+ if (!existsSync9(filePath)) {
10342
10393
  return {
10343
10394
  success: false,
10344
10395
  messages: [],
@@ -10395,7 +10446,7 @@ var ConversationRecovery = class {
10395
10446
  };
10396
10447
  }
10397
10448
  async findLatestSession(historyDir) {
10398
- if (!existsSync8(historyDir)) return null;
10449
+ if (!existsSync9(historyDir)) return null;
10399
10450
  const sessions = await this.listSessions(historyDir);
10400
10451
  if (sessions.length === 0) return null;
10401
10452
  sessions.sort(
@@ -10404,7 +10455,7 @@ var ConversationRecovery = class {
10404
10455
  return sessions[0].filePath;
10405
10456
  }
10406
10457
  async findSessionById(historyDir, sessionId) {
10407
- if (!existsSync8(historyDir)) return null;
10458
+ if (!existsSync9(historyDir)) return null;
10408
10459
  const sessions = await this.listSessions(historyDir);
10409
10460
  const match = sessions.find(
10410
10461
  (s) => s.id === sessionId || s.id.startsWith(sessionId) || basename3(s.filePath).includes(sessionId)
@@ -10414,7 +10465,7 @@ var ConversationRecovery = class {
10414
10465
  async validate(filePath) {
10415
10466
  const errors = [];
10416
10467
  const warnings = [];
10417
- if (!existsSync8(filePath)) {
10468
+ if (!existsSync9(filePath)) {
10418
10469
  return { valid: false, errors: ["File not found"], warnings: [] };
10419
10470
  }
10420
10471
  let rawContent;
@@ -10454,15 +10505,15 @@ var ConversationRecovery = class {
10454
10505
  };
10455
10506
  }
10456
10507
  async listSessions(historyDir) {
10457
- if (!existsSync8(historyDir)) return [];
10508
+ if (!existsSync9(historyDir)) return [];
10458
10509
  const entries = await readdir6(historyDir);
10459
10510
  const sessions = [];
10460
10511
  for (const entry of entries) {
10461
- const filePath = join15(historyDir, entry);
10512
+ const filePath = join16(historyDir, entry);
10462
10513
  const fileStat = await stat4(filePath);
10463
10514
  if (fileStat.isDirectory()) {
10464
- const sessionFile = join15(filePath, "conversation.jsonl");
10465
- if (existsSync8(sessionFile)) {
10515
+ const sessionFile = join16(filePath, "conversation.jsonl");
10516
+ if (existsSync9(sessionFile)) {
10466
10517
  const info2 = await this.buildSessionInfo(
10467
10518
  sessionFile,
10468
10519
  fileStat.mtimeMs
@@ -10672,7 +10723,7 @@ var ConversationRecovery = class {
10672
10723
 
10673
10724
  // src/services/deep-links.ts
10674
10725
  import { execFile as execFile4 } from "child_process";
10675
- import { platform as platform2 } from "os";
10726
+ import { platform as platform3 } from "os";
10676
10727
  import { resolve as resolve9, normalize, sep } from "path";
10677
10728
  import { promisify } from "util";
10678
10729
  var execFileAsync = promisify(execFile4);
@@ -10794,7 +10845,7 @@ var DeepLinkHandler = class {
10794
10845
  }
10795
10846
  }
10796
10847
  async registerProtocol() {
10797
- const os = platform2();
10848
+ const os = platform3();
10798
10849
  switch (os) {
10799
10850
  case "win32":
10800
10851
  await this.registerWindows();
@@ -10810,7 +10861,7 @@ var DeepLinkHandler = class {
10810
10861
  }
10811
10862
  }
10812
10863
  async unregisterProtocol() {
10813
- const os = platform2();
10864
+ const os = platform3();
10814
10865
  switch (os) {
10815
10866
  case "win32":
10816
10867
  await this.unregisterWindows();
@@ -10826,7 +10877,7 @@ var DeepLinkHandler = class {
10826
10877
  }
10827
10878
  }
10828
10879
  async isRegistered() {
10829
- const os = platform2();
10880
+ const os = platform3();
10830
10881
  switch (os) {
10831
10882
  case "win32":
10832
10883
  return this.checkWindows();
@@ -10974,10 +11025,10 @@ NoDisplay=true
10974
11025
  `;
10975
11026
  const { writeFile: writeFile5, mkdir: mkdir5 } = await import("fs/promises");
10976
11027
  const { homedir } = await import("os");
10977
- const { join: join16 } = await import("path");
10978
- const dir = join16(homedir(), ".local", "share", "applications");
11028
+ const { join: join17 } = await import("path");
11029
+ const dir = join17(homedir(), ".local", "share", "applications");
10979
11030
  await mkdir5(dir, { recursive: true });
10980
- await writeFile5(join16(dir, "cliskill.desktop"), desktopContent, "utf-8");
11031
+ await writeFile5(join17(dir, "cliskill.desktop"), desktopContent, "utf-8");
10981
11032
  try {
10982
11033
  await execFileAsync("update-desktop-database", [dir]);
10983
11034
  } catch {
@@ -10994,8 +11045,8 @@ NoDisplay=true
10994
11045
  async unregisterLinux() {
10995
11046
  const { unlink: unlink4 } = await import("fs/promises");
10996
11047
  const { homedir } = await import("os");
10997
- const { join: join16 } = await import("path");
10998
- const desktopPath = join16(
11048
+ const { join: join17 } = await import("path");
11049
+ const desktopPath = join17(
10999
11050
  homedir(),
11000
11051
  ".local",
11001
11052
  "share",
@@ -11011,8 +11062,8 @@ NoDisplay=true
11011
11062
  try {
11012
11063
  const { stat: stat5 } = await import("fs/promises");
11013
11064
  const { homedir } = await import("os");
11014
- const { join: join16 } = await import("path");
11015
- const desktopPath = join16(
11065
+ const { join: join17 } = await import("path");
11066
+ const desktopPath = join17(
11016
11067
  homedir(),
11017
11068
  ".local",
11018
11069
  "share",
@@ -12237,4 +12288,4 @@ export {
12237
12288
  MCPConnectionManager,
12238
12289
  runCli
12239
12290
  };
12240
- //# sourceMappingURL=chunk-GEH466DM.js.map
12291
+ //# sourceMappingURL=chunk-TZMKZQ7N.js.map