jinzd-ai-cli 0.4.318 → 0.4.319

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 (34) hide show
  1. package/dist/{batch-Y7IG5WTY.js → batch-CQ542WJF.js} +2 -2
  2. package/dist/{chunk-RB6FKHNZ.js → chunk-2PAQOR2X.js} +8 -8
  3. package/dist/{chunk-ZXNQ37FB.js → chunk-662ZJPJE.js} +1 -1
  4. package/dist/{chunk-KPCXZJW2.js → chunk-A7YZLLWN.js} +1 -1
  5. package/dist/{chunk-IODFI5GY.js → chunk-AC44E4CV.js} +28 -16
  6. package/dist/{chunk-SPSFCJLM.js → chunk-D6BLSFYD.js} +4 -4
  7. package/dist/{chunk-ZGIMXWXZ.js → chunk-DCQDFQDW.js} +1 -1
  8. package/dist/{chunk-4MLOMT3W.js → chunk-GP24X3KJ.js} +1 -1
  9. package/dist/{chunk-6VBW3L57.js → chunk-GVAAGBHX.js} +2 -1
  10. package/dist/{chunk-DAWPHJSS.js → chunk-KEOMNFBH.js} +1 -1
  11. package/dist/{chunk-MBI4RPRN.js → chunk-N2MHUA4B.js} +1 -1
  12. package/dist/{chunk-BVEEA5BS.js → chunk-OQZIP4LU.js} +1 -1
  13. package/dist/{chunk-APGWL4CQ.js → chunk-PGQ5OV3P.js} +1 -1
  14. package/dist/{chunk-7HX3FC67.js → chunk-SZBSTSG4.js} +4 -4
  15. package/dist/{chunk-TNEGZIP6.js → chunk-Y3SEC5EC.js} +28 -16
  16. package/dist/{chunk-VXQSMWXN.js → chunk-YHMQMP2I.js} +99 -62
  17. package/dist/{ci-XE42OB7U.js → ci-HAPWBC37.js} +6 -6
  18. package/dist/{ci-format-IHLVLQ6B.js → ci-format-NGWP4GTQ.js} +2 -2
  19. package/dist/{constants-HVWL645G.js → constants-CPHZLOCQ.js} +1 -1
  20. package/dist/{constants-XUNVLHWI.js → constants-GSUK6ILC.js} +1 -1
  21. package/dist/{doctor-cli-R3WQP5FD.js → doctor-cli-L6AK2GJ7.js} +6 -6
  22. package/dist/electron-server.js +106 -68
  23. package/dist/{hub-34YQNQF3.js → hub-TCZFG2ZG.js} +1 -1
  24. package/dist/index.js +19 -19
  25. package/dist/{persistent-memory-IUALAZ5K.js → persistent-memory-E3UYP7RJ.js} +2 -2
  26. package/dist/{persistent-memory-VBVGH3P5.js → persistent-memory-IPNMYXU4.js} +2 -2
  27. package/dist/{pr-QEQH3TAH.js → pr-J5TSU5P6.js} +6 -6
  28. package/dist/{run-tests-L7FHOQAD.js → run-tests-FLGSE63O.js} +2 -2
  29. package/dist/{run-tests-OBX5CEPQ.js → run-tests-PDD4KUQL.js} +2 -2
  30. package/dist/{server-NBAC226K.js → server-3C6IK3JE.js} +6 -6
  31. package/dist/{server-ESLQPXVI.js → server-XQ3IQUZ5.js} +15 -15
  32. package/dist/{task-orchestrator-2IKNOOMG.js → task-orchestrator-544JETWF.js} +6 -6
  33. package/dist/{usage-B7TQHRIN.js → usage-MQTA7HHZ.js} +2 -2
  34. package/package.json +1 -1
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-RS7SKYTS.js";
5
5
  import {
6
6
  ConfigManager
7
- } from "./chunk-DAWPHJSS.js";
7
+ } from "./chunk-KEOMNFBH.js";
8
8
  import "./chunk-TU3L3PW7.js";
9
9
  import {
10
10
  atomicWriteFileSync
11
11
  } from "./chunk-BMLQPSHP.js";
12
- import "./chunk-KPCXZJW2.js";
12
+ import "./chunk-A7YZLLWN.js";
13
13
 
14
14
  // src/cli/batch.ts
15
15
  import Anthropic from "@anthropic-ai/sdk";
@@ -16,7 +16,7 @@ import {
16
16
  setPreferredAgentName,
17
17
  truncateForPersist,
18
18
  undoStack
19
- } from "./chunk-VXQSMWXN.js";
19
+ } from "./chunk-YHMQMP2I.js";
20
20
  import {
21
21
  buildReviewPrompt,
22
22
  buildSecurityReviewPrompt
@@ -51,7 +51,7 @@ import {
51
51
  touchMemoryReferences,
52
52
  updateMemoryApproval,
53
53
  updateMemoryEntry
54
- } from "./chunk-APGWL4CQ.js";
54
+ } from "./chunk-PGQ5OV3P.js";
55
55
  import {
56
56
  theme
57
57
  } from "./chunk-5C76XDDF.js";
@@ -65,7 +65,7 @@ import {
65
65
  import {
66
66
  buildDoctorReport,
67
67
  formatDoctorReport
68
- } from "./chunk-SPSFCJLM.js";
68
+ } from "./chunk-D6BLSFYD.js";
69
69
  import {
70
70
  describePlugin,
71
71
  getActivePluginAssets,
@@ -80,11 +80,11 @@ import {
80
80
  trustHook,
81
81
  trustPlugin,
82
82
  untrustHook
83
- } from "./chunk-ZXNQ37FB.js";
83
+ } from "./chunk-662ZJPJE.js";
84
84
  import {
85
85
  isCleanDocumentBody,
86
86
  stripOuterCodeFence
87
- } from "./chunk-6VBW3L57.js";
87
+ } from "./chunk-GVAAGBHX.js";
88
88
  import {
89
89
  formatGitContextForPrompt,
90
90
  getGitContext
@@ -109,7 +109,7 @@ import {
109
109
  MCP_TOOL_PREFIX,
110
110
  REPO_URL,
111
111
  VERSION
112
- } from "./chunk-KPCXZJW2.js";
112
+ } from "./chunk-A7YZLLWN.js";
113
113
 
114
114
  // src/skills/manager.ts
115
115
  import { existsSync, readdirSync, mkdirSync, statSync } from "fs";
@@ -2426,7 +2426,7 @@ No tools match "${filter}".
2426
2426
  const { join: join6 } = await import("path");
2427
2427
  const { existsSync: existsSync6 } = await import("fs");
2428
2428
  const { getGitRoot } = await import("./git-context-EXOEHQSF.js");
2429
- const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-XUNVLHWI.js");
2429
+ const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-GSUK6ILC.js");
2430
2430
  const { approveProject, hashMcpFile } = await import("./project-trust-KGG2BWKC.js");
2431
2431
  const cwd = process.cwd();
2432
2432
  const projectRoot = getGitRoot(cwd) ?? cwd;
@@ -3534,7 +3534,7 @@ function createReviewCommands() {
3534
3534
  usage: "/test [command|filter]",
3535
3535
  async execute(args, ctx) {
3536
3536
  try {
3537
- const { executeTests } = await import("./run-tests-L7FHOQAD.js");
3537
+ const { executeTests } = await import("./run-tests-FLGSE63O.js");
3538
3538
  const argStr = args.join(" ").trim();
3539
3539
  let testArgs = {};
3540
3540
  if (argStr) {
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  CONFIG_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-KPCXZJW2.js";
11
+ } from "./chunk-A7YZLLWN.js";
12
12
 
13
13
  // src/diagnostics/tool-stats.ts
14
14
  import { mkdirSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.318";
4
+ var VERSION = "0.4.319";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-QMFMST2T.js";
5
5
  import {
6
6
  TEST_TIMEOUT
7
- } from "./chunk-ZGIMXWXZ.js";
7
+ } from "./chunk-DCQDFQDW.js";
8
8
 
9
9
  // src/tools/builtin/run-tests.ts
10
10
  import { spawn as spawn2 } from "child_process";
@@ -17,9 +17,14 @@ function currentAbortSignal() {
17
17
 
18
18
  // src/tools/win-shell.ts
19
19
  import { platform } from "os";
20
+ import { existsSync } from "fs";
20
21
  import { spawn } from "child_process";
21
22
  var IS_WINDOWS = platform() === "win32";
22
23
  var WIN_UTF8_PREAMBLE = "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $OutputEncoding = [System.Text.Encoding]::UTF8; ";
24
+ function posixShell() {
25
+ if (existsSync("/bin/bash")) return "/bin/bash";
26
+ return process.env["SHELL"] ?? "/bin/sh";
27
+ }
23
28
  function shellInvocation(command) {
24
29
  if (IS_WINDOWS) {
25
30
  return {
@@ -27,7 +32,7 @@ function shellInvocation(command) {
27
32
  args: ["-NoProfile", "-NonInteractive", "-Command", WIN_UTF8_PREAMBLE + command]
28
33
  };
29
34
  }
30
- return { shell: process.env["SHELL"] ?? "/bin/bash", args: ["-c", command] };
35
+ return { shell: posixShell(), args: ["-c", command] };
31
36
  }
32
37
  function decodeWindowsBuffer(buf) {
33
38
  const utf8 = buf.toString("utf-8");
@@ -151,8 +156,14 @@ function killProcessTree(proc, processGroup = false) {
151
156
  return;
152
157
  }
153
158
  const signal = (value) => {
154
- if (processGroup && proc.pid) process.kill(-proc.pid, value);
155
- else proc.kill(value);
159
+ if (processGroup && proc.pid) {
160
+ try {
161
+ process.kill(-proc.pid, value);
162
+ return;
163
+ } catch {
164
+ }
165
+ }
166
+ proc.kill(value);
156
167
  };
157
168
  try {
158
169
  signal("SIGTERM");
@@ -169,7 +180,7 @@ function killProcessTree(proc, processGroup = false) {
169
180
  }
170
181
 
171
182
  // src/tools/builtin/run-tests.ts
172
- import { existsSync, readFileSync, readdirSync } from "fs";
183
+ import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
173
184
  import { join } from "path";
174
185
  import { platform as platform2 } from "os";
175
186
  import chalk from "chalk";
@@ -179,13 +190,13 @@ function detectNodeTestFramework(cwd, pkg) {
179
190
  const devDeps = pkg.devDependencies ?? {};
180
191
  const deps = pkg.dependencies ?? {};
181
192
  const allDeps = { ...deps, ...devDeps };
182
- if ("vitest" in allDeps || existsSync(join(cwd, "vitest.config.ts")) || existsSync(join(cwd, "vitest.config.js")) || existsSync(join(cwd, "vitest.config.mts"))) {
193
+ if ("vitest" in allDeps || existsSync2(join(cwd, "vitest.config.ts")) || existsSync2(join(cwd, "vitest.config.js")) || existsSync2(join(cwd, "vitest.config.mts"))) {
183
194
  return { type: "node", framework: "vitest", command: "npx vitest run" };
184
195
  }
185
- if ("jest" in allDeps || existsSync(join(cwd, "jest.config.js")) || existsSync(join(cwd, "jest.config.ts")) || existsSync(join(cwd, "jest.config.mjs"))) {
196
+ if ("jest" in allDeps || existsSync2(join(cwd, "jest.config.js")) || existsSync2(join(cwd, "jest.config.ts")) || existsSync2(join(cwd, "jest.config.mjs"))) {
186
197
  return { type: "node", framework: "jest", command: "npx jest" };
187
198
  }
188
- if ("mocha" in allDeps || existsSync(join(cwd, ".mocharc.yml")) || existsSync(join(cwd, ".mocharc.yaml")) || existsSync(join(cwd, ".mocharc.json")) || existsSync(join(cwd, ".mocharc.js"))) {
199
+ if ("mocha" in allDeps || existsSync2(join(cwd, ".mocharc.yml")) || existsSync2(join(cwd, ".mocharc.yaml")) || existsSync2(join(cwd, ".mocharc.json")) || existsSync2(join(cwd, ".mocharc.js"))) {
189
200
  return { type: "node", framework: "mocha", command: "npx mocha" };
190
201
  }
191
202
  if ("ava" in allDeps) {
@@ -243,15 +254,15 @@ function safeReadPackageJson(cwd) {
243
254
  }
244
255
  }
245
256
  function detectProject(cwd) {
246
- if (existsSync(join(cwd, "pom.xml"))) {
257
+ if (existsSync2(join(cwd, "pom.xml"))) {
247
258
  return { type: "java", framework: "Maven (JUnit)", command: IS_WINDOWS2 ? "mvn.cmd test" : "mvn test" };
248
259
  }
249
- if (existsSync(join(cwd, "build.gradle")) || existsSync(join(cwd, "build.gradle.kts"))) {
260
+ if (existsSync2(join(cwd, "build.gradle")) || existsSync2(join(cwd, "build.gradle.kts"))) {
250
261
  const wrapper = IS_WINDOWS2 ? "gradlew.bat" : "./gradlew";
251
- const cmd = existsSync(join(cwd, IS_WINDOWS2 ? "gradlew.bat" : "gradlew")) ? `${wrapper} test` : "gradle test";
262
+ const cmd = existsSync2(join(cwd, IS_WINDOWS2 ? "gradlew.bat" : "gradlew")) ? `${wrapper} test` : "gradle test";
252
263
  return { type: "java", framework: "Gradle (JUnit)", command: cmd };
253
264
  }
254
- if (existsSync(join(cwd, "package.json"))) {
265
+ if (existsSync2(join(cwd, "package.json"))) {
255
266
  const pkg = safeReadPackageJson(cwd);
256
267
  if (pkg) {
257
268
  const testScript = pkg.scripts?.test;
@@ -264,13 +275,13 @@ function detectProject(cwd) {
264
275
  return { type: "node", framework: "npm (package.json error)", command: "npm test" };
265
276
  }
266
277
  }
267
- if (existsSync(join(cwd, "pyproject.toml")) || existsSync(join(cwd, "setup.py")) || existsSync(join(cwd, "pytest.ini"))) {
278
+ if (existsSync2(join(cwd, "pyproject.toml")) || existsSync2(join(cwd, "setup.py")) || existsSync2(join(cwd, "pytest.ini"))) {
268
279
  return { type: "python", framework: "pytest", command: "pytest -v" };
269
280
  }
270
- if (existsSync(join(cwd, "Cargo.toml"))) {
281
+ if (existsSync2(join(cwd, "Cargo.toml"))) {
271
282
  return { type: "rust", framework: "cargo", command: "cargo test" };
272
283
  }
273
- if (existsSync(join(cwd, "go.mod"))) {
284
+ if (existsSync2(join(cwd, "go.mod"))) {
274
285
  return { type: "go", framework: "go test", command: "go test ./..." };
275
286
  }
276
287
  return null;
@@ -311,7 +322,7 @@ function findJUnitReports(cwd) {
311
322
  ];
312
323
  const xmlFiles = [];
313
324
  for (const dir of dirs) {
314
- if (!existsSync(dir)) continue;
325
+ if (!existsSync2(dir)) continue;
315
326
  try {
316
327
  const files = readdirSync(dir);
317
328
  for (const f of files) {
@@ -600,6 +611,7 @@ export {
600
611
  currentAbortSignal,
601
612
  IS_WINDOWS,
602
613
  WIN_UTF8_PREAMBLE,
614
+ posixShell,
603
615
  shellInvocation,
604
616
  decodeWindowsBuffer,
605
617
  recoverGbkMojibake,
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-ZXNQ37FB.js";
11
+ } from "./chunk-662ZJPJE.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-MBI4RPRN.js";
14
+ } from "./chunk-N2MHUA4B.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-DAWPHJSS.js";
17
+ } from "./chunk-KEOMNFBH.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-KPCXZJW2.js";
29
+ } from "./chunk-A7YZLLWN.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.318";
2
+ var VERSION = "0.4.319";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -12,7 +12,7 @@ import {
12
12
  MEMORY_FILE_NAME,
13
13
  MEMORY_MAX_CHARS,
14
14
  MEMORY_STORE_FILE_NAME
15
- } from "./chunk-ZGIMXWXZ.js";
15
+ } from "./chunk-DCQDFQDW.js";
16
16
 
17
17
  // src/memory/persistent-memory.ts
18
18
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1219,7 +1219,8 @@ function getDangerLevel(toolName, args) {
1219
1219
  if (/\bgit\s+(?:clean\b|reset\s+--hard\b|push\b[^\n]*(?:--force\b|\s-f\b))/i.test(cmd)) return "destructive";
1220
1220
  if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
1221
1221
  if (/\brm\s+\S/.test(cmd)) return "destructive";
1222
- if (/\brmdir\b|\bformat\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
1222
+ if (/\brmdir\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
1223
+ if (/(?:^|[;&|(\n]\s*)format(?:\.com)?\s+[A-Za-z]:/im.test(cmd)) return "destructive";
1223
1224
  if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
1224
1225
  if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
1225
1226
  if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-KPCXZJW2.js";
14
+ } from "./chunk-A7YZLLWN.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -3,7 +3,7 @@ import {
3
3
  detectsHallucinatedFileOp,
4
4
  parseToolCallArguments,
5
5
  schemaToJsonSchema
6
- } from "./chunk-6VBW3L57.js";
6
+ } from "./chunk-GVAAGBHX.js";
7
7
  import {
8
8
  AuthError,
9
9
  ProviderError,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-KPCXZJW2.js";
4
+ } from "./chunk-A7YZLLWN.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-KPCXZJW2.js";
16
+ } from "./chunk-A7YZLLWN.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-BVEEA5BS.js";
5
+ } from "./chunk-OQZIP4LU.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -13,13 +13,13 @@ import {
13
13
  } from "./chunk-6YZEZFX5.js";
14
14
  import {
15
15
  ProviderRegistry
16
- } from "./chunk-MBI4RPRN.js";
16
+ } from "./chunk-N2MHUA4B.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-DAWPHJSS.js";
19
+ } from "./chunk-KEOMNFBH.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-KPCXZJW2.js";
22
+ } from "./chunk-A7YZLLWN.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-KPCXZJW2.js";
4
+ } from "./chunk-A7YZLLWN.js";
5
5
  import {
6
6
  getExecutionConfigDir,
7
7
  getExecutionSignal
@@ -32,9 +32,14 @@ function resetInterrupt() {
32
32
 
33
33
  // src/tools/win-shell.ts
34
34
  import { platform } from "os";
35
+ import { existsSync } from "fs";
35
36
  import { spawn } from "child_process";
36
37
  var IS_WINDOWS = platform() === "win32";
37
38
  var WIN_UTF8_PREAMBLE = "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $OutputEncoding = [System.Text.Encoding]::UTF8; ";
39
+ function posixShell() {
40
+ if (existsSync("/bin/bash")) return "/bin/bash";
41
+ return process.env["SHELL"] ?? "/bin/sh";
42
+ }
38
43
  function shellInvocation(command) {
39
44
  if (IS_WINDOWS) {
40
45
  return {
@@ -42,7 +47,7 @@ function shellInvocation(command) {
42
47
  args: ["-NoProfile", "-NonInteractive", "-Command", WIN_UTF8_PREAMBLE + command]
43
48
  };
44
49
  }
45
- return { shell: process.env["SHELL"] ?? "/bin/bash", args: ["-c", command] };
50
+ return { shell: posixShell(), args: ["-c", command] };
46
51
  }
47
52
  function decodeWindowsBuffer(buf) {
48
53
  const utf8 = buf.toString("utf-8");
@@ -166,8 +171,14 @@ function killProcessTree(proc, processGroup = false) {
166
171
  return;
167
172
  }
168
173
  const signal = (value) => {
169
- if (processGroup && proc.pid) process.kill(-proc.pid, value);
170
- else proc.kill(value);
174
+ if (processGroup && proc.pid) {
175
+ try {
176
+ process.kill(-proc.pid, value);
177
+ return;
178
+ } catch {
179
+ }
180
+ }
181
+ proc.kill(value);
171
182
  };
172
183
  try {
173
184
  signal("SIGTERM");
@@ -184,7 +195,7 @@ function killProcessTree(proc, processGroup = false) {
184
195
  }
185
196
 
186
197
  // src/tools/builtin/run-tests.ts
187
- import { existsSync, readFileSync, readdirSync } from "fs";
198
+ import { existsSync as existsSync2, readFileSync, readdirSync } from "fs";
188
199
  import { join } from "path";
189
200
  import { platform as platform2 } from "os";
190
201
  import chalk from "chalk";
@@ -194,13 +205,13 @@ function detectNodeTestFramework(cwd, pkg) {
194
205
  const devDeps = pkg.devDependencies ?? {};
195
206
  const deps = pkg.dependencies ?? {};
196
207
  const allDeps = { ...deps, ...devDeps };
197
- if ("vitest" in allDeps || existsSync(join(cwd, "vitest.config.ts")) || existsSync(join(cwd, "vitest.config.js")) || existsSync(join(cwd, "vitest.config.mts"))) {
208
+ if ("vitest" in allDeps || existsSync2(join(cwd, "vitest.config.ts")) || existsSync2(join(cwd, "vitest.config.js")) || existsSync2(join(cwd, "vitest.config.mts"))) {
198
209
  return { type: "node", framework: "vitest", command: "npx vitest run" };
199
210
  }
200
- if ("jest" in allDeps || existsSync(join(cwd, "jest.config.js")) || existsSync(join(cwd, "jest.config.ts")) || existsSync(join(cwd, "jest.config.mjs"))) {
211
+ if ("jest" in allDeps || existsSync2(join(cwd, "jest.config.js")) || existsSync2(join(cwd, "jest.config.ts")) || existsSync2(join(cwd, "jest.config.mjs"))) {
201
212
  return { type: "node", framework: "jest", command: "npx jest" };
202
213
  }
203
- if ("mocha" in allDeps || existsSync(join(cwd, ".mocharc.yml")) || existsSync(join(cwd, ".mocharc.yaml")) || existsSync(join(cwd, ".mocharc.json")) || existsSync(join(cwd, ".mocharc.js"))) {
214
+ if ("mocha" in allDeps || existsSync2(join(cwd, ".mocharc.yml")) || existsSync2(join(cwd, ".mocharc.yaml")) || existsSync2(join(cwd, ".mocharc.json")) || existsSync2(join(cwd, ".mocharc.js"))) {
204
215
  return { type: "node", framework: "mocha", command: "npx mocha" };
205
216
  }
206
217
  if ("ava" in allDeps) {
@@ -258,15 +269,15 @@ function safeReadPackageJson(cwd) {
258
269
  }
259
270
  }
260
271
  function detectProject(cwd) {
261
- if (existsSync(join(cwd, "pom.xml"))) {
272
+ if (existsSync2(join(cwd, "pom.xml"))) {
262
273
  return { type: "java", framework: "Maven (JUnit)", command: IS_WINDOWS2 ? "mvn.cmd test" : "mvn test" };
263
274
  }
264
- if (existsSync(join(cwd, "build.gradle")) || existsSync(join(cwd, "build.gradle.kts"))) {
275
+ if (existsSync2(join(cwd, "build.gradle")) || existsSync2(join(cwd, "build.gradle.kts"))) {
265
276
  const wrapper = IS_WINDOWS2 ? "gradlew.bat" : "./gradlew";
266
- const cmd = existsSync(join(cwd, IS_WINDOWS2 ? "gradlew.bat" : "gradlew")) ? `${wrapper} test` : "gradle test";
277
+ const cmd = existsSync2(join(cwd, IS_WINDOWS2 ? "gradlew.bat" : "gradlew")) ? `${wrapper} test` : "gradle test";
267
278
  return { type: "java", framework: "Gradle (JUnit)", command: cmd };
268
279
  }
269
- if (existsSync(join(cwd, "package.json"))) {
280
+ if (existsSync2(join(cwd, "package.json"))) {
270
281
  const pkg = safeReadPackageJson(cwd);
271
282
  if (pkg) {
272
283
  const testScript = pkg.scripts?.test;
@@ -279,13 +290,13 @@ function detectProject(cwd) {
279
290
  return { type: "node", framework: "npm (package.json error)", command: "npm test" };
280
291
  }
281
292
  }
282
- if (existsSync(join(cwd, "pyproject.toml")) || existsSync(join(cwd, "setup.py")) || existsSync(join(cwd, "pytest.ini"))) {
293
+ if (existsSync2(join(cwd, "pyproject.toml")) || existsSync2(join(cwd, "setup.py")) || existsSync2(join(cwd, "pytest.ini"))) {
283
294
  return { type: "python", framework: "pytest", command: "pytest -v" };
284
295
  }
285
- if (existsSync(join(cwd, "Cargo.toml"))) {
296
+ if (existsSync2(join(cwd, "Cargo.toml"))) {
286
297
  return { type: "rust", framework: "cargo", command: "cargo test" };
287
298
  }
288
- if (existsSync(join(cwd, "go.mod"))) {
299
+ if (existsSync2(join(cwd, "go.mod"))) {
289
300
  return { type: "go", framework: "go test", command: "go test ./..." };
290
301
  }
291
302
  return null;
@@ -326,7 +337,7 @@ function findJUnitReports(cwd) {
326
337
  ];
327
338
  const xmlFiles = [];
328
339
  for (const dir of dirs) {
329
- if (!existsSync(dir)) continue;
340
+ if (!existsSync2(dir)) continue;
330
341
  try {
331
342
  const files = readdirSync(dir);
332
343
  for (const f of files) {
@@ -614,6 +625,7 @@ async function runTestProcess(argv, command, cwd, signal) {
614
625
  export {
615
626
  IS_WINDOWS,
616
627
  WIN_UTF8_PREAMBLE,
628
+ posixShell,
617
629
  shellInvocation,
618
630
  decodeWindowsBuffer,
619
631
  recoverGbkMojibake,