claude-use 0.2.3 → 0.2.5

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/dist/cli.cjs +24 -13
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -221857,7 +221857,7 @@ var categories_default_default = {
221857
221857
  // package.json
221858
221858
  var package_default = {
221859
221859
  name: "claude-use",
221860
- version: "0.2.3",
221860
+ version: "0.2.5",
221861
221861
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
221862
221862
  license: "Apache-2.0",
221863
221863
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -238480,6 +238480,7 @@ var import_node_child_process2 = require("node:child_process");
238480
238480
  var import_node_crypto3 = require("node:crypto");
238481
238481
  var import_node_fs3 = __toESM(require("node:fs"));
238482
238482
  var import_node_path12 = __toESM(require("node:path"));
238483
+ var import_node_sea = require("node:sea");
238483
238484
 
238484
238485
  // src/versionDiscovery.ts
238485
238486
  var import_node_os2 = __toESM(require("node:os"));
@@ -238781,6 +238782,12 @@ function realOwnExecutablePath() {
238781
238782
  findExecutableInDir
238782
238783
  });
238783
238784
  }
238785
+ function resolveContentSourcePath(env) {
238786
+ return env.isSea ? env.execPath : env.argv1 ?? env.execPath;
238787
+ }
238788
+ function realContentSourcePath() {
238789
+ return resolveContentSourcePath({ isSea: (0, import_node_sea.isSea)(), execPath: process.execPath, argv1: process.argv[1] });
238790
+ }
238784
238791
  function realResolveClaudeBinary(ownInstallDirs) {
238785
238792
  return () => discoverClaudeBinary({
238786
238793
  listVersionsDir,
@@ -240938,14 +240945,14 @@ var ForeignClaudeEntryError = class extends Error {
240938
240945
  action;
240939
240946
  };
240940
240947
  var UnsupportedShimSourceError = class extends Error {
240941
- constructor(ownExecutablePath) {
240948
+ constructor(contentSourcePath) {
240942
240949
  super(
240943
- `Cannot create a working \`claude\` command from ${ownExecutablePath} on Windows: an npm-installed claude-use running under Node.js has no .exe to hardlink/copy, and Windows has no shebang-based dispatch the way POSIX does. Install claude-use via Scoop instead (see README), which ships a real claude-use.exe this command can link from.`
240950
+ `Cannot create a working \`claude\` command from ${contentSourcePath} on Windows: an npm-installed claude-use running under Node.js has no .exe to hardlink/copy, and Windows has no shebang-based dispatch the way POSIX does. Install claude-use via Scoop instead (see README), which ships a real claude-use.exe this command can link from.`
240944
240951
  );
240945
- this.ownExecutablePath = ownExecutablePath;
240952
+ this.contentSourcePath = contentSourcePath;
240946
240953
  this.name = "UnsupportedShimSourceError";
240947
240954
  }
240948
- ownExecutablePath;
240955
+ contentSourcePath;
240949
240956
  };
240950
240957
  function claudeTargetFilename(ownExecutablePath) {
240951
240958
  return ownExecutablePath.toLowerCase().endsWith(".exe") ? "claude.exe" : "claude";
@@ -240979,15 +240986,15 @@ function lstatOrUndefined(target) {
240979
240986
  }
240980
240987
  var nodeLinkFs = { link: import_node_fs7.default.linkSync, copyFile: import_node_fs7.default.copyFileSync, chmod: import_node_fs7.default.chmodSync };
240981
240988
  function enableClaudeShim(params, linkFs = nodeLinkFs) {
240982
- const realOwnPath = import_node_fs7.default.realpathSync(params.ownExecutablePath);
240983
- if (params.platform === "win32" && !realOwnPath.toLowerCase().endsWith(".exe")) {
240984
- throw new UnsupportedShimSourceError(realOwnPath);
240989
+ const realContentPath = import_node_fs7.default.realpathSync(params.contentSourcePath);
240990
+ if (params.platform === "win32" && !realContentPath.toLowerCase().endsWith(".exe")) {
240991
+ throw new UnsupportedShimSourceError(realContentPath);
240985
240992
  }
240986
240993
  const targetPath = resolveClaudeTargetPath(params.ownExecutablePath, params.dir);
240987
240994
  import_node_fs7.default.mkdirSync(import_node_path17.default.dirname(targetPath), { recursive: true });
240988
240995
  const existing = lstatOrUndefined(targetPath);
240989
240996
  if (existing !== void 0) {
240990
- const ownStat = import_node_fs7.default.statSync(realOwnPath);
240997
+ const ownStat = import_node_fs7.default.statSync(realContentPath);
240991
240998
  const state = readJson(params.paths.claudeShimFile, ClaudeShimStateSchema);
240992
240999
  const sameInode = existing.dev === ownStat.dev && existing.ino === ownStat.ino;
240993
241000
  const markerMatches = state !== void 0 && import_node_path17.default.resolve(state.targetPath) === targetPath;
@@ -240998,13 +241005,13 @@ function enableClaudeShim(params, linkFs = nodeLinkFs) {
240998
241005
  }
240999
241006
  let method;
241000
241007
  try {
241001
- linkFs.link(realOwnPath, targetPath);
241008
+ linkFs.link(realContentPath, targetPath);
241002
241009
  method = "hardlink";
241003
241010
  } catch (error51) {
241004
241011
  if (!isCrossDeviceError(error51)) {
241005
241012
  throw error51;
241006
241013
  }
241007
- linkFs.copyFile(realOwnPath, targetPath);
241014
+ linkFs.copyFile(realContentPath, targetPath);
241008
241015
  linkFs.chmod(targetPath, 493);
241009
241016
  method = "copy";
241010
241017
  }
@@ -241013,7 +241020,7 @@ function enableClaudeShim(params, linkFs = nodeLinkFs) {
241013
241020
  return { action: existing === void 0 ? "enabled" : "reenabled", targetPath, method };
241014
241021
  }
241015
241022
  function disableClaudeShim(params) {
241016
- const realOwnPath = import_node_fs7.default.realpathSync(params.ownExecutablePath);
241023
+ const realContentPath = import_node_fs7.default.realpathSync(params.contentSourcePath);
241017
241024
  const state = readJson(params.paths.claudeShimFile, ClaudeShimStateSchema);
241018
241025
  const targetPath = params.dir !== void 0 ? import_node_path17.default.join(params.dir, claudeTargetFilename(params.ownExecutablePath)) : state?.targetPath ?? resolveClaudeTargetPath(params.ownExecutablePath);
241019
241026
  const existing = lstatOrUndefined(targetPath);
@@ -241023,7 +241030,7 @@ function disableClaudeShim(params) {
241023
241030
  }
241024
241031
  return { action: "not-enabled", targetPath };
241025
241032
  }
241026
- const ownStat = import_node_fs7.default.statSync(realOwnPath);
241033
+ const ownStat = import_node_fs7.default.statSync(realContentPath);
241027
241034
  const sameInode = existing.dev === ownStat.dev && existing.ino === ownStat.ino;
241028
241035
  const markerMatches = state !== void 0 && import_node_path17.default.resolve(state.targetPath) === targetPath;
241029
241036
  if (!sameInode && !markerMatches && !params.force) {
@@ -241050,9 +241057,11 @@ function registerShimCommand(program2, paths) {
241050
241057
  );
241051
241058
  shim.command("enable").description("Create a `claude`-named copy of this same executable, alongside claude-use by default.").option("--dir <path>", "Enable into this directory instead of alongside the running claude-use executable.").option("--force", "Overwrite the target even if it doesn't look like claude-use's own doing.").action((options) => {
241052
241059
  const ownExecutablePath = realOwnExecutablePath();
241060
+ const contentSourcePath = realContentSourcePath();
241053
241061
  const result = enableClaudeShim({
241054
241062
  paths,
241055
241063
  ownExecutablePath,
241064
+ contentSourcePath,
241056
241065
  platform: process.platform,
241057
241066
  ...options.dir === void 0 ? {} : { dir: import_node_path17.default.resolve(options.dir) },
241058
241067
  force: options.force ?? false
@@ -241074,9 +241083,11 @@ function registerShimCommand(program2, paths) {
241074
241083
  });
241075
241084
  shim.command("disable").description("Remove the `claude` command shim `shim enable` previously created. A no-op, not an error, if none is enabled.").option("--dir <path>", "Look in this directory instead of trusting the recorded location.").option("--force", "Remove the target even if it doesn't look like claude-use's own doing.").action((options) => {
241076
241085
  const ownExecutablePath = realOwnExecutablePath();
241086
+ const contentSourcePath = realContentSourcePath();
241077
241087
  const result = disableClaudeShim({
241078
241088
  paths,
241079
241089
  ownExecutablePath,
241090
+ contentSourcePath,
241080
241091
  ...options.dir === void 0 ? {} : { dir: import_node_path17.default.resolve(options.dir) },
241081
241092
  force: options.force ?? false
241082
241093
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",