claude-use 0.2.2 → 0.2.4
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/dist/cli.cjs +63 -29
- 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.
|
|
221860
|
+
version: "0.2.4",
|
|
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"));
|
|
@@ -238709,14 +238710,33 @@ function listVersionsDir(dir) {
|
|
|
238709
238710
|
};
|
|
238710
238711
|
});
|
|
238711
238712
|
}
|
|
238712
|
-
|
|
238713
|
+
var WINDOWS_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PS1";
|
|
238714
|
+
function windowsPathExtensions(pathext) {
|
|
238715
|
+
return (pathext ?? WINDOWS_DEFAULT_PATHEXT).split(";").map((ext) => ext.trim()).filter((ext) => ext.length > 0);
|
|
238716
|
+
}
|
|
238717
|
+
function resolveExecutableCandidate(dir, name, env) {
|
|
238713
238718
|
const candidate = import_node_path12.default.join(dir, name);
|
|
238714
|
-
|
|
238715
|
-
const
|
|
238716
|
-
|
|
238717
|
-
|
|
238719
|
+
if (env.platform === "win32") {
|
|
238720
|
+
const extensions = windowsPathExtensions(env.pathext);
|
|
238721
|
+
const alreadyHasRecognisedExtension = extensions.some((ext) => candidate.toLowerCase().endsWith(ext.toLowerCase()));
|
|
238722
|
+
if (alreadyHasRecognisedExtension) {
|
|
238723
|
+
return env.statFileMode(candidate) !== void 0 ? candidate : void 0;
|
|
238724
|
+
}
|
|
238725
|
+
for (const ext of extensions) {
|
|
238726
|
+
const withExt = candidate + ext;
|
|
238727
|
+
if (env.statFileMode(withExt) !== void 0) {
|
|
238728
|
+
return withExt;
|
|
238729
|
+
}
|
|
238718
238730
|
}
|
|
238719
238731
|
return void 0;
|
|
238732
|
+
}
|
|
238733
|
+
const mode = env.statFileMode(candidate);
|
|
238734
|
+
return mode !== void 0 && (mode & 73) !== 0 ? candidate : void 0;
|
|
238735
|
+
}
|
|
238736
|
+
function realStatFileMode(candidate) {
|
|
238737
|
+
try {
|
|
238738
|
+
const stat = import_node_fs3.default.statSync(candidate);
|
|
238739
|
+
return stat.isFile() ? stat.mode : void 0;
|
|
238720
238740
|
} catch (error51) {
|
|
238721
238741
|
if (isEnoent2(error51)) {
|
|
238722
238742
|
return void 0;
|
|
@@ -238724,6 +238744,13 @@ function findExecutableInDir(dir, name) {
|
|
|
238724
238744
|
throw error51;
|
|
238725
238745
|
}
|
|
238726
238746
|
}
|
|
238747
|
+
function findExecutableInDir(dir, name) {
|
|
238748
|
+
return resolveExecutableCandidate(dir, name, {
|
|
238749
|
+
platform: process.platform,
|
|
238750
|
+
pathext: process.env.PATHEXT,
|
|
238751
|
+
statFileMode: realStatFileMode
|
|
238752
|
+
});
|
|
238753
|
+
}
|
|
238727
238754
|
function searchPathForExecutable(pathDirs, name, findExecutableInDir2) {
|
|
238728
238755
|
for (const dir of pathDirs) {
|
|
238729
238756
|
const found = findExecutableInDir2(dir, name);
|
|
@@ -238734,20 +238761,17 @@ function searchPathForExecutable(pathDirs, name, findExecutableInDir2) {
|
|
|
238734
238761
|
return void 0;
|
|
238735
238762
|
}
|
|
238736
238763
|
function resolveOwnExecutablePath(env) {
|
|
238737
|
-
if (env.argv1
|
|
238738
|
-
return env.execPath;
|
|
238739
|
-
}
|
|
238740
|
-
if (!env.argv1.includes("/") && !env.argv1.includes("\\")) {
|
|
238764
|
+
if (env.argv1 !== void 0 && !env.argv1.includes("/") && !env.argv1.includes("\\")) {
|
|
238741
238765
|
return searchPathForExecutable(env.pathDirs, env.argv1, env.findExecutableInDir) ?? env.execPath;
|
|
238742
238766
|
}
|
|
238743
|
-
const
|
|
238744
|
-
const
|
|
238745
|
-
const
|
|
238746
|
-
if (
|
|
238747
|
-
return
|
|
238767
|
+
const candidate = env.argv1 === void 0 ? env.execPath : import_node_path12.default.resolve(env.cwd, env.argv1);
|
|
238768
|
+
const candidateDir = import_node_path12.default.dirname(candidate);
|
|
238769
|
+
const candidateDirOnPath = env.pathDirs.some((dir) => import_node_path12.default.resolve(dir) === candidateDir);
|
|
238770
|
+
if (candidateDirOnPath) {
|
|
238771
|
+
return candidate;
|
|
238748
238772
|
}
|
|
238749
|
-
const viaPath = searchPathForExecutable(env.pathDirs, import_node_path12.default.basename(
|
|
238750
|
-
return viaPath ??
|
|
238773
|
+
const viaPath = searchPathForExecutable(env.pathDirs, import_node_path12.default.basename(candidate), env.findExecutableInDir);
|
|
238774
|
+
return viaPath ?? candidate;
|
|
238751
238775
|
}
|
|
238752
238776
|
function realOwnExecutablePath() {
|
|
238753
238777
|
return resolveOwnExecutablePath({
|
|
@@ -238758,6 +238782,12 @@ function realOwnExecutablePath() {
|
|
|
238758
238782
|
findExecutableInDir
|
|
238759
238783
|
});
|
|
238760
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
|
+
}
|
|
238761
238791
|
function realResolveClaudeBinary(ownInstallDirs) {
|
|
238762
238792
|
return () => discoverClaudeBinary({
|
|
238763
238793
|
listVersionsDir,
|
|
@@ -240915,14 +240945,14 @@ var ForeignClaudeEntryError = class extends Error {
|
|
|
240915
240945
|
action;
|
|
240916
240946
|
};
|
|
240917
240947
|
var UnsupportedShimSourceError = class extends Error {
|
|
240918
|
-
constructor(
|
|
240948
|
+
constructor(contentSourcePath) {
|
|
240919
240949
|
super(
|
|
240920
|
-
`Cannot create a working \`claude\` command 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.`
|
|
240921
240951
|
);
|
|
240922
|
-
this.
|
|
240952
|
+
this.contentSourcePath = contentSourcePath;
|
|
240923
240953
|
this.name = "UnsupportedShimSourceError";
|
|
240924
240954
|
}
|
|
240925
|
-
|
|
240955
|
+
contentSourcePath;
|
|
240926
240956
|
};
|
|
240927
240957
|
function claudeTargetFilename(ownExecutablePath) {
|
|
240928
240958
|
return ownExecutablePath.toLowerCase().endsWith(".exe") ? "claude.exe" : "claude";
|
|
@@ -240956,15 +240986,15 @@ function lstatOrUndefined(target) {
|
|
|
240956
240986
|
}
|
|
240957
240987
|
var nodeLinkFs = { link: import_node_fs7.default.linkSync, copyFile: import_node_fs7.default.copyFileSync, chmod: import_node_fs7.default.chmodSync };
|
|
240958
240988
|
function enableClaudeShim(params, linkFs = nodeLinkFs) {
|
|
240959
|
-
const
|
|
240960
|
-
if (params.platform === "win32" && !
|
|
240961
|
-
throw new UnsupportedShimSourceError(
|
|
240989
|
+
const realContentPath = import_node_fs7.default.realpathSync(params.contentSourcePath);
|
|
240990
|
+
if (params.platform === "win32" && !realContentPath.toLowerCase().endsWith(".exe")) {
|
|
240991
|
+
throw new UnsupportedShimSourceError(realContentPath);
|
|
240962
240992
|
}
|
|
240963
240993
|
const targetPath = resolveClaudeTargetPath(params.ownExecutablePath, params.dir);
|
|
240964
240994
|
import_node_fs7.default.mkdirSync(import_node_path17.default.dirname(targetPath), { recursive: true });
|
|
240965
240995
|
const existing = lstatOrUndefined(targetPath);
|
|
240966
240996
|
if (existing !== void 0) {
|
|
240967
|
-
const ownStat = import_node_fs7.default.statSync(
|
|
240997
|
+
const ownStat = import_node_fs7.default.statSync(realContentPath);
|
|
240968
240998
|
const state = readJson(params.paths.claudeShimFile, ClaudeShimStateSchema);
|
|
240969
240999
|
const sameInode = existing.dev === ownStat.dev && existing.ino === ownStat.ino;
|
|
240970
241000
|
const markerMatches = state !== void 0 && import_node_path17.default.resolve(state.targetPath) === targetPath;
|
|
@@ -240975,13 +241005,13 @@ function enableClaudeShim(params, linkFs = nodeLinkFs) {
|
|
|
240975
241005
|
}
|
|
240976
241006
|
let method;
|
|
240977
241007
|
try {
|
|
240978
|
-
linkFs.link(
|
|
241008
|
+
linkFs.link(realContentPath, targetPath);
|
|
240979
241009
|
method = "hardlink";
|
|
240980
241010
|
} catch (error51) {
|
|
240981
241011
|
if (!isCrossDeviceError(error51)) {
|
|
240982
241012
|
throw error51;
|
|
240983
241013
|
}
|
|
240984
|
-
linkFs.copyFile(
|
|
241014
|
+
linkFs.copyFile(realContentPath, targetPath);
|
|
240985
241015
|
linkFs.chmod(targetPath, 493);
|
|
240986
241016
|
method = "copy";
|
|
240987
241017
|
}
|
|
@@ -240990,7 +241020,7 @@ function enableClaudeShim(params, linkFs = nodeLinkFs) {
|
|
|
240990
241020
|
return { action: existing === void 0 ? "enabled" : "reenabled", targetPath, method };
|
|
240991
241021
|
}
|
|
240992
241022
|
function disableClaudeShim(params) {
|
|
240993
|
-
const
|
|
241023
|
+
const realContentPath = import_node_fs7.default.realpathSync(params.contentSourcePath);
|
|
240994
241024
|
const state = readJson(params.paths.claudeShimFile, ClaudeShimStateSchema);
|
|
240995
241025
|
const targetPath = params.dir !== void 0 ? import_node_path17.default.join(params.dir, claudeTargetFilename(params.ownExecutablePath)) : state?.targetPath ?? resolveClaudeTargetPath(params.ownExecutablePath);
|
|
240996
241026
|
const existing = lstatOrUndefined(targetPath);
|
|
@@ -241000,7 +241030,7 @@ function disableClaudeShim(params) {
|
|
|
241000
241030
|
}
|
|
241001
241031
|
return { action: "not-enabled", targetPath };
|
|
241002
241032
|
}
|
|
241003
|
-
const ownStat = import_node_fs7.default.statSync(
|
|
241033
|
+
const ownStat = import_node_fs7.default.statSync(realContentPath);
|
|
241004
241034
|
const sameInode = existing.dev === ownStat.dev && existing.ino === ownStat.ino;
|
|
241005
241035
|
const markerMatches = state !== void 0 && import_node_path17.default.resolve(state.targetPath) === targetPath;
|
|
241006
241036
|
if (!sameInode && !markerMatches && !params.force) {
|
|
@@ -241027,9 +241057,11 @@ function registerShimCommand(program2, paths) {
|
|
|
241027
241057
|
);
|
|
241028
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) => {
|
|
241029
241059
|
const ownExecutablePath = realOwnExecutablePath();
|
|
241060
|
+
const contentSourcePath = realContentSourcePath();
|
|
241030
241061
|
const result = enableClaudeShim({
|
|
241031
241062
|
paths,
|
|
241032
241063
|
ownExecutablePath,
|
|
241064
|
+
contentSourcePath,
|
|
241033
241065
|
platform: process.platform,
|
|
241034
241066
|
...options.dir === void 0 ? {} : { dir: import_node_path17.default.resolve(options.dir) },
|
|
241035
241067
|
force: options.force ?? false
|
|
@@ -241051,9 +241083,11 @@ function registerShimCommand(program2, paths) {
|
|
|
241051
241083
|
});
|
|
241052
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) => {
|
|
241053
241085
|
const ownExecutablePath = realOwnExecutablePath();
|
|
241086
|
+
const contentSourcePath = realContentSourcePath();
|
|
241054
241087
|
const result = disableClaudeShim({
|
|
241055
241088
|
paths,
|
|
241056
241089
|
ownExecutablePath,
|
|
241090
|
+
contentSourcePath,
|
|
241057
241091
|
...options.dir === void 0 ? {} : { dir: import_node_path17.default.resolve(options.dir) },
|
|
241058
241092
|
force: options.force ?? false
|
|
241059
241093
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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>",
|