cliskill 1.1.6 → 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-6PBITIPP.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
@@ -8379,9 +8379,33 @@ function buildSystemPrompt() {
8379
8379
  // src/mcp/client.ts
8380
8380
  import { spawn as spawn2 } from "child_process";
8381
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";
8382
8385
  var DEFAULT_REQUEST_TIMEOUT = 3e4;
8383
8386
  var CONNECT_TIMEOUT = 3e4;
8384
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
+ }
8385
8409
  var MCPClient = class {
8386
8410
  config;
8387
8411
  process = null;
@@ -8496,7 +8520,8 @@ var MCPClient = class {
8496
8520
  ...process.env,
8497
8521
  ...this.config.env
8498
8522
  };
8499
- 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, {
8500
8525
  stdio: ["pipe", "pipe", "pipe"],
8501
8526
  env
8502
8527
  });
@@ -8917,7 +8942,7 @@ var SessionSaver = class {
8917
8942
  this.sessionId = randomUUID8();
8918
8943
  const dir = getSessionsDir();
8919
8944
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
8920
- this.filePath = join12(dir, `session-${timestamp}.jsonl`);
8945
+ this.filePath = join13(dir, `session-${timestamp}.jsonl`);
8921
8946
  }
8922
8947
  async init() {
8923
8948
  const dir = getSessionsDir();
@@ -9704,8 +9729,8 @@ function colorizeAnsi(text, ansiName) {
9704
9729
  }
9705
9730
 
9706
9731
  // src/services/cron/task-store.ts
9707
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync2 } from "fs";
9708
- 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";
9709
9734
  import { randomUUID as randomUUID9 } from "crypto";
9710
9735
  var DEFAULT_STORE_DIR = getDataDir();
9711
9736
  var DEFAULT_STORE_FILE = "scheduled_tasks.json";
@@ -9715,10 +9740,10 @@ var TaskStore2 = class {
9715
9740
  loaded = false;
9716
9741
  constructor(storeDir) {
9717
9742
  const dir = storeDir ?? DEFAULT_STORE_DIR;
9718
- this.filePath = join13(dir, DEFAULT_STORE_FILE);
9743
+ this.filePath = join14(dir, DEFAULT_STORE_FILE);
9719
9744
  }
9720
9745
  load() {
9721
- if (!existsSync6(this.filePath)) {
9746
+ if (!existsSync7(this.filePath)) {
9722
9747
  this.tasks.clear();
9723
9748
  this.loaded = true;
9724
9749
  return;
@@ -9736,8 +9761,8 @@ var TaskStore2 = class {
9736
9761
  this.loaded = true;
9737
9762
  }
9738
9763
  save() {
9739
- const dir = dirname4(this.filePath);
9740
- if (!existsSync6(dir)) {
9764
+ const dir = dirname5(this.filePath);
9765
+ if (!existsSync7(dir)) {
9741
9766
  mkdirSync2(dir, { recursive: true });
9742
9767
  }
9743
9768
  const data = Array.from(this.tasks.values());
@@ -10052,8 +10077,8 @@ var CronScheduler = class {
10052
10077
 
10053
10078
  // src/services/doctor.ts
10054
10079
  import { execSync as execSync3 } from "child_process";
10055
- import { readFileSync as readFileSync4, existsSync as existsSync7, statSync as statSync2 } from "fs";
10056
- 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";
10057
10082
  var TOOLS = [
10058
10083
  { name: "git", command: "git", versionFlag: "--version", optional: false },
10059
10084
  { name: "ripgrep (rg)", command: "rg", versionFlag: "--version", optional: true },
@@ -10080,8 +10105,8 @@ var DoctorDiagnostic = class {
10080
10105
  checkInstallation() {
10081
10106
  const execPath = process.execPath;
10082
10107
  const isNpmGlobal = execPath.includes("npm") || execPath.includes("npx");
10083
- const isLocal = existsSync7(join14(process.cwd(), "node_modules", "cliskill"));
10084
- 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"));
10085
10110
  let installType = "unknown";
10086
10111
  if (isNpmGlobal) installType = "npm-global";
10087
10112
  else if (isLocal) installType = "local";
@@ -10193,7 +10218,7 @@ var DoctorDiagnostic = class {
10193
10218
  checkConfig() {
10194
10219
  const configPaths = getConfigSearchPaths();
10195
10220
  for (const configPath of configPaths) {
10196
- if (existsSync7(configPath)) {
10221
+ if (existsSync8(configPath)) {
10197
10222
  try {
10198
10223
  const raw = readFileSync4(configPath, "utf-8");
10199
10224
  JSON.parse(raw);
@@ -10224,7 +10249,7 @@ var DoctorDiagnostic = class {
10224
10249
  const configPaths = getConfigSearchPaths();
10225
10250
  let baseUrl = "";
10226
10251
  for (const configPath of configPaths) {
10227
- if (existsSync7(configPath)) {
10252
+ if (existsSync8(configPath)) {
10228
10253
  try {
10229
10254
  const raw = readFileSync4(configPath, "utf-8");
10230
10255
  const config = JSON.parse(raw);
@@ -10271,7 +10296,7 @@ var DoctorDiagnostic = class {
10271
10296
  checkDiskSpace() {
10272
10297
  const memoryDir = getDataDir();
10273
10298
  const historyFile = getDiskHistoryPath();
10274
- if (!existsSync7(memoryDir)) {
10299
+ if (!existsSync8(memoryDir)) {
10275
10300
  return {
10276
10301
  name: "Disk Space",
10277
10302
  status: "ok",
@@ -10280,7 +10305,7 @@ var DoctorDiagnostic = class {
10280
10305
  };
10281
10306
  }
10282
10307
  try {
10283
- const historyStats = existsSync7(historyFile) ? statSync2(historyFile) : null;
10308
+ const historyStats = existsSync8(historyFile) ? statSync2(historyFile) : null;
10284
10309
  const historySize = historyStats ? historyStats.size : 0;
10285
10310
  return {
10286
10311
  name: "Disk Space",
@@ -10349,8 +10374,8 @@ var DoctorDiagnostic = class {
10349
10374
 
10350
10375
  // src/services/conversation-recovery.ts
10351
10376
  import { readFile as readFile10, readdir as readdir6, stat as stat4 } from "fs/promises";
10352
- import { existsSync as existsSync8 } from "fs";
10353
- 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";
10354
10379
  var DEFAULT_RECOVERY_OPTIONS = {
10355
10380
  sessionId: "",
10356
10381
  repairMode: false,
@@ -10364,7 +10389,7 @@ var ConversationRecovery = class {
10364
10389
  const opts = { ...DEFAULT_RECOVERY_OPTIONS, ...options };
10365
10390
  const warnings = [];
10366
10391
  const repairs = [];
10367
- if (!existsSync8(filePath)) {
10392
+ if (!existsSync9(filePath)) {
10368
10393
  return {
10369
10394
  success: false,
10370
10395
  messages: [],
@@ -10421,7 +10446,7 @@ var ConversationRecovery = class {
10421
10446
  };
10422
10447
  }
10423
10448
  async findLatestSession(historyDir) {
10424
- if (!existsSync8(historyDir)) return null;
10449
+ if (!existsSync9(historyDir)) return null;
10425
10450
  const sessions = await this.listSessions(historyDir);
10426
10451
  if (sessions.length === 0) return null;
10427
10452
  sessions.sort(
@@ -10430,7 +10455,7 @@ var ConversationRecovery = class {
10430
10455
  return sessions[0].filePath;
10431
10456
  }
10432
10457
  async findSessionById(historyDir, sessionId) {
10433
- if (!existsSync8(historyDir)) return null;
10458
+ if (!existsSync9(historyDir)) return null;
10434
10459
  const sessions = await this.listSessions(historyDir);
10435
10460
  const match = sessions.find(
10436
10461
  (s) => s.id === sessionId || s.id.startsWith(sessionId) || basename3(s.filePath).includes(sessionId)
@@ -10440,7 +10465,7 @@ var ConversationRecovery = class {
10440
10465
  async validate(filePath) {
10441
10466
  const errors = [];
10442
10467
  const warnings = [];
10443
- if (!existsSync8(filePath)) {
10468
+ if (!existsSync9(filePath)) {
10444
10469
  return { valid: false, errors: ["File not found"], warnings: [] };
10445
10470
  }
10446
10471
  let rawContent;
@@ -10480,15 +10505,15 @@ var ConversationRecovery = class {
10480
10505
  };
10481
10506
  }
10482
10507
  async listSessions(historyDir) {
10483
- if (!existsSync8(historyDir)) return [];
10508
+ if (!existsSync9(historyDir)) return [];
10484
10509
  const entries = await readdir6(historyDir);
10485
10510
  const sessions = [];
10486
10511
  for (const entry of entries) {
10487
- const filePath = join15(historyDir, entry);
10512
+ const filePath = join16(historyDir, entry);
10488
10513
  const fileStat = await stat4(filePath);
10489
10514
  if (fileStat.isDirectory()) {
10490
- const sessionFile = join15(filePath, "conversation.jsonl");
10491
- if (existsSync8(sessionFile)) {
10515
+ const sessionFile = join16(filePath, "conversation.jsonl");
10516
+ if (existsSync9(sessionFile)) {
10492
10517
  const info2 = await this.buildSessionInfo(
10493
10518
  sessionFile,
10494
10519
  fileStat.mtimeMs
@@ -10698,7 +10723,7 @@ var ConversationRecovery = class {
10698
10723
 
10699
10724
  // src/services/deep-links.ts
10700
10725
  import { execFile as execFile4 } from "child_process";
10701
- import { platform as platform2 } from "os";
10726
+ import { platform as platform3 } from "os";
10702
10727
  import { resolve as resolve9, normalize, sep } from "path";
10703
10728
  import { promisify } from "util";
10704
10729
  var execFileAsync = promisify(execFile4);
@@ -10820,7 +10845,7 @@ var DeepLinkHandler = class {
10820
10845
  }
10821
10846
  }
10822
10847
  async registerProtocol() {
10823
- const os = platform2();
10848
+ const os = platform3();
10824
10849
  switch (os) {
10825
10850
  case "win32":
10826
10851
  await this.registerWindows();
@@ -10836,7 +10861,7 @@ var DeepLinkHandler = class {
10836
10861
  }
10837
10862
  }
10838
10863
  async unregisterProtocol() {
10839
- const os = platform2();
10864
+ const os = platform3();
10840
10865
  switch (os) {
10841
10866
  case "win32":
10842
10867
  await this.unregisterWindows();
@@ -10852,7 +10877,7 @@ var DeepLinkHandler = class {
10852
10877
  }
10853
10878
  }
10854
10879
  async isRegistered() {
10855
- const os = platform2();
10880
+ const os = platform3();
10856
10881
  switch (os) {
10857
10882
  case "win32":
10858
10883
  return this.checkWindows();
@@ -11000,10 +11025,10 @@ NoDisplay=true
11000
11025
  `;
11001
11026
  const { writeFile: writeFile5, mkdir: mkdir5 } = await import("fs/promises");
11002
11027
  const { homedir } = await import("os");
11003
- const { join: join16 } = await import("path");
11004
- const dir = join16(homedir(), ".local", "share", "applications");
11028
+ const { join: join17 } = await import("path");
11029
+ const dir = join17(homedir(), ".local", "share", "applications");
11005
11030
  await mkdir5(dir, { recursive: true });
11006
- await writeFile5(join16(dir, "cliskill.desktop"), desktopContent, "utf-8");
11031
+ await writeFile5(join17(dir, "cliskill.desktop"), desktopContent, "utf-8");
11007
11032
  try {
11008
11033
  await execFileAsync("update-desktop-database", [dir]);
11009
11034
  } catch {
@@ -11020,8 +11045,8 @@ NoDisplay=true
11020
11045
  async unregisterLinux() {
11021
11046
  const { unlink: unlink4 } = await import("fs/promises");
11022
11047
  const { homedir } = await import("os");
11023
- const { join: join16 } = await import("path");
11024
- const desktopPath = join16(
11048
+ const { join: join17 } = await import("path");
11049
+ const desktopPath = join17(
11025
11050
  homedir(),
11026
11051
  ".local",
11027
11052
  "share",
@@ -11037,8 +11062,8 @@ NoDisplay=true
11037
11062
  try {
11038
11063
  const { stat: stat5 } = await import("fs/promises");
11039
11064
  const { homedir } = await import("os");
11040
- const { join: join16 } = await import("path");
11041
- const desktopPath = join16(
11065
+ const { join: join17 } = await import("path");
11066
+ const desktopPath = join17(
11042
11067
  homedir(),
11043
11068
  ".local",
11044
11069
  "share",
@@ -12263,4 +12288,4 @@ export {
12263
12288
  MCPConnectionManager,
12264
12289
  runCli
12265
12290
  };
12266
- //# sourceMappingURL=chunk-6PBITIPP.js.map
12291
+ //# sourceMappingURL=chunk-TZMKZQ7N.js.map