@snack-kit/porygon 0.5.0 → 0.6.0

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.
package/README.md CHANGED
@@ -630,6 +630,19 @@ npm run playground # 启动 Playground
630
630
 
631
631
  ## Changelog
632
632
 
633
+ ### v0.6.0
634
+
635
+ #### 改进
636
+
637
+ - **Windows 跨平台兼容** — 使用 `cross-spawn` 替换原生 `child_process.spawn`,解决 Windows 上因 PATH 解析、PATHEXT 扩展名(`.exe`、`.cmd` 等)导致的 `ENOENT` 错误。所有进程启动(`EphemeralProcess`、`PersistentProcess`)均已适配
638
+ - **`isAvailable()` Windows 适配** — Claude adapter 的 CLI 存在性检测在 Windows 上使用 `where` 命令替代 `which`
639
+
640
+ #### 新增依赖
641
+
642
+ - `cross-spawn` — Node.js 生态标准的跨平台进程启动库,正确处理 Windows 上的命令解析、参数转义和 PATHEXT 查找
643
+
644
+ ---
645
+
633
646
  ### v0.5.0
634
647
 
635
648
  #### 新特性
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -278,7 +288,7 @@ var InterceptorManager = class {
278
288
  };
279
289
 
280
290
  // src/process/process-handle.ts
281
- var import_node_child_process = require("child_process");
291
+ var import_cross_spawn = __toESM(require("cross-spawn"), 1);
282
292
  var import_node_events = require("events");
283
293
  var import_node_readline = require("readline");
284
294
  var GRACE_PERIOD_MS = 5e3;
@@ -298,7 +308,7 @@ var EphemeralProcess = class {
298
308
  return;
299
309
  }
300
310
  this.aborted = false;
301
- const child = (0, import_node_child_process.spawn)(options.command, options.args, {
311
+ const child = (0, import_cross_spawn.default)(options.command, options.args, {
302
312
  cwd: options.cwd,
303
313
  env: options.env ? { ...process.env, ...options.env } : void 0,
304
314
  stdio: ["pipe", "pipe", "pipe"]
@@ -354,7 +364,7 @@ var EphemeralProcess = class {
354
364
  }
355
365
  this.aborted = false;
356
366
  const useStdin = options.stdinData !== void 0;
357
- const child = (0, import_node_child_process.spawn)(options.command, options.args, {
367
+ const child = (0, import_cross_spawn.default)(options.command, options.args, {
358
368
  cwd: options.cwd,
359
369
  env: options.env ?? void 0,
360
370
  stdio: [useStdin ? "pipe" : "ignore", "pipe", "pipe"]
@@ -437,7 +447,7 @@ var PersistentProcess = class extends import_node_events.EventEmitter {
437
447
  /** 启动持久进程 */
438
448
  async start() {
439
449
  this.stopped = false;
440
- const child = (0, import_node_child_process.spawn)(this.options.command, this.options.args, {
450
+ const child = (0, import_cross_spawn.default)(this.options.command, this.options.args, {
441
451
  cwd: this.options.cwd,
442
452
  env: this.options.env ? { ...process.env, ...this.options.env } : void 0,
443
453
  stdio: ["pipe", "pipe", "pipe"]
@@ -939,8 +949,9 @@ var ClaudeAdapter = class extends AbstractAgentAdapter {
939
949
  async isAvailable() {
940
950
  try {
941
951
  const proc = new EphemeralProcess();
952
+ const findCmd = process.platform === "win32" ? "where" : "which";
942
953
  const result = await proc.execute({
943
- command: "which",
954
+ command: findCmd,
944
955
  args: [this.cliCommand]
945
956
  });
946
957
  return result.exitCode === 0;