@aku11i/phantom 3.3.0 → 3.3.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/phantom.js +60 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aku11i/phantom",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "A powerful CLI tool for managing Git worktrees for parallel development",
5
5
  "keywords": [
6
6
  "git",
package/phantom.js CHANGED
@@ -3318,8 +3318,8 @@ var require_utils = __commonJS({
3318
3318
  }
3319
3319
  return ind;
3320
3320
  }
3321
- function removeDotSegments(path3) {
3322
- let input = path3;
3321
+ function removeDotSegments(path4) {
3322
+ let input = path4;
3323
3323
  const output2 = [];
3324
3324
  let nextSlash = -1;
3325
3325
  let len = 0;
@@ -3518,8 +3518,8 @@ var require_schemes = __commonJS({
3518
3518
  wsComponent.secure = void 0;
3519
3519
  }
3520
3520
  if (wsComponent.resourceName) {
3521
- const [path3, query] = wsComponent.resourceName.split("?");
3522
- wsComponent.path = path3 && path3 !== "/" ? path3 : void 0;
3521
+ const [path4, query] = wsComponent.resourceName.split("?");
3522
+ wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
3523
3523
  wsComponent.query = query;
3524
3524
  wsComponent.resourceName = void 0;
3525
3525
  }
@@ -7667,10 +7667,10 @@ function mergeDefs(...defs) {
7667
7667
  function cloneDef(schema5) {
7668
7668
  return mergeDefs(schema5._zod.def);
7669
7669
  }
7670
- function getElementAtPath(obj, path3) {
7671
- if (!path3)
7670
+ function getElementAtPath(obj, path4) {
7671
+ if (!path4)
7672
7672
  return obj;
7673
- return path3.reduce((acc, key) => acc?.[key], obj);
7673
+ return path4.reduce((acc, key) => acc?.[key], obj);
7674
7674
  }
7675
7675
  function promiseAllObject(promisesObj) {
7676
7676
  const keys = Object.keys(promisesObj);
@@ -8036,11 +8036,11 @@ function aborted(x, startIndex = 0) {
8036
8036
  }
8037
8037
  return false;
8038
8038
  }
8039
- function prefixIssues(path3, issues) {
8039
+ function prefixIssues(path4, issues) {
8040
8040
  return issues.map((iss) => {
8041
8041
  var _a2;
8042
8042
  (_a2 = iss).path ?? (_a2.path = []);
8043
- iss.path.unshift(path3);
8043
+ iss.path.unshift(path4);
8044
8044
  return iss;
8045
8045
  });
8046
8046
  }
@@ -8202,7 +8202,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
8202
8202
  }
8203
8203
  function treeifyError(error46, mapper = (issue2) => issue2.message) {
8204
8204
  const result = { errors: [] };
8205
- const processError = (error47, path3 = []) => {
8205
+ const processError = (error47, path4 = []) => {
8206
8206
  var _a2, _b;
8207
8207
  for (const issue2 of error47.issues) {
8208
8208
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -8212,7 +8212,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
8212
8212
  } else if (issue2.code === "invalid_element") {
8213
8213
  processError({ issues: issue2.issues }, issue2.path);
8214
8214
  } else {
8215
- const fullpath = [...path3, ...issue2.path];
8215
+ const fullpath = [...path4, ...issue2.path];
8216
8216
  if (fullpath.length === 0) {
8217
8217
  result.errors.push(mapper(issue2));
8218
8218
  continue;
@@ -8244,8 +8244,8 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
8244
8244
  }
8245
8245
  function toDotPath(_path) {
8246
8246
  const segs = [];
8247
- const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
8248
- for (const seg of path3) {
8247
+ const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
8248
+ for (const seg of path4) {
8249
8249
  if (typeof seg === "number")
8250
8250
  segs.push(`[${seg}]`);
8251
8251
  else if (typeof seg === "symbol")
@@ -19601,8 +19601,8 @@ function validateConfig(config2) {
19601
19601
  const result = phantomConfigSchema.safeParse(config2);
19602
19602
  if (!result.success) {
19603
19603
  const firstError = result.error.issues[0];
19604
- const path3 = firstError.path.join(".");
19605
- const message = path3 ? `${path3}: ${firstError.message}` : firstError.message;
19604
+ const path4 = firstError.path.join(".");
19605
+ const message = path4 ? `${path4}: ${firstError.message}` : firstError.message;
19606
19606
  return err(new ConfigValidationError(message));
19607
19607
  }
19608
19608
  return ok(result.data);
@@ -19694,8 +19694,8 @@ async function executeGitCommandInDirectory(directory, args2) {
19694
19694
 
19695
19695
  // ../git/src/libs/add-worktree.ts
19696
19696
  async function addWorktree(options) {
19697
- const { path: path3, branch, base = "HEAD" } = options;
19698
- await executeGitCommand(["worktree", "add", path3, "-b", branch, base]);
19697
+ const { path: path4, branch, base = "HEAD" } = options;
19698
+ await executeGitCommand(["worktree", "add", path4, "-b", branch, base]);
19699
19699
  }
19700
19700
 
19701
19701
  // ../git/src/libs/attach-worktree.ts
@@ -20012,15 +20012,42 @@ async function selectWithFzf(items, options = {}) {
20012
20012
  import {
20013
20013
  spawn as nodeSpawn
20014
20014
  } from "node:child_process";
20015
+
20016
+ // ../process/src/resolve-windows-command-path.ts
20017
+ import { execFileSync } from "node:child_process";
20018
+ import path2 from "node:path";
20019
+ function resolveWindowsCommandPath(commandOrPath) {
20020
+ if (process.platform !== "win32") {
20021
+ throw new Error("resolveWindowsCommandPath is only supported on Windows");
20022
+ }
20023
+ if (path2.dirname(commandOrPath) !== ".") {
20024
+ return commandOrPath;
20025
+ }
20026
+ try {
20027
+ const stdout2 = execFileSync("where.exe", [commandOrPath], {
20028
+ windowsHide: true,
20029
+ stdio: ["ignore", "pipe", "pipe"]
20030
+ });
20031
+ const executablePath = stdout2.toString().split(/\r?\n/).map((line) => line.trim()).find(Boolean);
20032
+ if (executablePath) {
20033
+ return executablePath;
20034
+ }
20035
+ } catch {
20036
+ }
20037
+ return commandOrPath;
20038
+ }
20039
+
20040
+ // ../process/src/spawn.ts
20015
20041
  async function spawnProcess(config2) {
20016
20042
  return new Promise((resolve2) => {
20017
20043
  const { command: command2, args: args2 = [], options = {} } = config2;
20018
- const childProcess = nodeSpawn(command2, args2, {
20044
+ const file2 = process.platform === "win32" ? resolveWindowsCommandPath(command2) : command2;
20045
+ const childProcess = nodeSpawn(file2, args2, {
20019
20046
  stdio: "inherit",
20020
20047
  ...options
20021
20048
  });
20022
20049
  childProcess.on("error", (error46) => {
20023
- resolve2(err(new ProcessSpawnError(command2, error46.message)));
20050
+ resolve2(err(new ProcessSpawnError(file2, error46.message)));
20024
20051
  });
20025
20052
  childProcess.on("exit", (code, signal) => {
20026
20053
  if (signal) {
@@ -20030,7 +20057,7 @@ async function spawnProcess(config2) {
20030
20057
  if (exitCode === 0) {
20031
20058
  resolve2(ok({ exitCode }));
20032
20059
  } else {
20033
- resolve2(err(new ProcessExecutionError(command2, exitCode)));
20060
+ resolve2(err(new ProcessExecutionError(file2, exitCode)));
20034
20061
  }
20035
20062
  }
20036
20063
  });
@@ -20253,7 +20280,7 @@ import { existsSync } from "node:fs";
20253
20280
 
20254
20281
  // ../core/src/worktree/file-copier.ts
20255
20282
  import { copyFile, mkdir, stat } from "node:fs/promises";
20256
- import path2 from "node:path";
20283
+ import path3 from "node:path";
20257
20284
  var FileCopyError = class extends Error {
20258
20285
  file;
20259
20286
  constructor(file2, message) {
@@ -20266,15 +20293,15 @@ async function copyFiles(sourceDir, targetDir, files) {
20266
20293
  const copiedFiles = [];
20267
20294
  const skippedFiles = [];
20268
20295
  for (const file2 of files) {
20269
- const sourcePath = path2.join(sourceDir, file2);
20270
- const targetPath = path2.join(targetDir, file2);
20296
+ const sourcePath = path3.join(sourceDir, file2);
20297
+ const targetPath = path3.join(targetDir, file2);
20271
20298
  try {
20272
20299
  const stats = await stat(sourcePath);
20273
20300
  if (!stats.isFile()) {
20274
20301
  skippedFiles.push(file2);
20275
20302
  continue;
20276
20303
  }
20277
- const targetDirPath = path2.dirname(targetPath);
20304
+ const targetDirPath = path3.dirname(targetPath);
20278
20305
  await mkdir(targetDirPath, { recursive: true });
20279
20306
  await copyFile(sourcePath, targetPath);
20280
20307
  copiedFiles.push(file2);
@@ -23202,17 +23229,17 @@ function requestLog(octokit) {
23202
23229
  octokit.log.debug("request", options);
23203
23230
  const start = Date.now();
23204
23231
  const requestOptions = octokit.request.endpoint.parse(options);
23205
- const path3 = requestOptions.url.replace(options.baseUrl, "");
23232
+ const path4 = requestOptions.url.replace(options.baseUrl, "");
23206
23233
  return request2(options).then((response) => {
23207
23234
  const requestId = response.headers["x-github-request-id"];
23208
23235
  octokit.log.info(
23209
- `${requestOptions.method} ${path3} - ${response.status} with id ${requestId} in ${Date.now() - start}ms`
23236
+ `${requestOptions.method} ${path4} - ${response.status} with id ${requestId} in ${Date.now() - start}ms`
23210
23237
  );
23211
23238
  return response;
23212
23239
  }).catch((error46) => {
23213
23240
  const requestId = error46.response?.headers["x-github-request-id"] || "UNKNOWN";
23214
23241
  octokit.log.error(
23215
- `${requestOptions.method} ${path3} - ${error46.status} with id ${requestId} in ${Date.now() - start}ms`
23242
+ `${requestOptions.method} ${path4} - ${error46.status} with id ${requestId} in ${Date.now() - start}ms`
23216
23243
  );
23217
23244
  throw error46;
23218
23245
  });
@@ -26527,8 +26554,8 @@ function getErrorMap2() {
26527
26554
 
26528
26555
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v3/helpers/parseUtil.js
26529
26556
  var makeIssue = (params) => {
26530
- const { data, path: path3, errorMaps, issueData } = params;
26531
- const fullPath = [...path3, ...issueData.path || []];
26557
+ const { data, path: path4, errorMaps, issueData } = params;
26558
+ const fullPath = [...path4, ...issueData.path || []];
26532
26559
  const fullIssue = {
26533
26560
  ...issueData,
26534
26561
  path: fullPath
@@ -26643,11 +26670,11 @@ var errorUtil;
26643
26670
 
26644
26671
  // ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v3/types.js
26645
26672
  var ParseInputLazyPath = class {
26646
- constructor(parent, value, path3, key) {
26673
+ constructor(parent, value, path4, key) {
26647
26674
  this._cachedPath = [];
26648
26675
  this.parent = parent;
26649
26676
  this.data = value;
26650
- this._path = path3;
26677
+ this._path = path4;
26651
26678
  this._key = key;
26652
26679
  }
26653
26680
  get path() {
@@ -35521,7 +35548,7 @@ var StdioServerTransport = class {
35521
35548
  // ../mcp/package.json
35522
35549
  var package_default = {
35523
35550
  name: "@aku11i/phantom-mcp",
35524
- version: "3.3.0",
35551
+ version: "3.3.1",
35525
35552
  private: true,
35526
35553
  type: "module",
35527
35554
  main: "./src/index.ts",
@@ -36160,7 +36187,7 @@ import { parseArgs as parseArgs13 } from "node:util";
36160
36187
  // package.json
36161
36188
  var package_default2 = {
36162
36189
  name: "@aku11i/phantom-cli",
36163
- version: "3.3.0",
36190
+ version: "3.3.1",
36164
36191
  private: true,
36165
36192
  type: "module",
36166
36193
  scripts: {