@rse/claudex 0.9.16 → 0.9.18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
  ChangeLog
3
3
  =========
4
4
 
5
+ 0.9.18 (2026-05-09)
6
+ -------------------
7
+
8
+ - BUGFIX: try to workaround problems in self-reference under Windows
9
+
10
+ 0.9.17 (2026-05-09)
11
+ -------------------
12
+
13
+ - BUGFIX: fix tool finding under Windows
14
+
5
15
  0.9.16 (2026-05-09)
6
16
  -------------------
7
17
 
package/README.md CHANGED
@@ -76,9 +76,9 @@ Usage
76
76
  -----
77
77
 
78
78
  ```sh
79
- $ claudex \
79
+ $ claudex
80
80
  [-C|--capsula] # execute Claude Code inside a Capsula sandbox container")
81
- [-T|--tmux [session]], # wrap Claude Code in a Tmux terminal multiplexing session (optional session name)")
81
+ [-T|--tmux [session]] # wrap Claude Code in a Tmux terminal multiplexing session (optional session name)")
82
82
  [-R|--recolor] # wrap Claude Code with ANSI recoloing for improved theming")
83
83
  [-A|--ase] # enable ASE-specific Claude Code statusline and ASE_* environment variables")
84
84
  [...options...] # arbitrary Claude Code options
package/claudex.js CHANGED
@@ -29,7 +29,7 @@ const basedir = findBaseDir();
29
29
  next to the compiled JS, since the JS itself is not executable
30
30
  and embedded shell strings (docker/tmux) need a runnable command */
31
31
  const selfPath = path.join(basedir, "claudex");
32
- const selfPathJS = process.argv[1] ?? path.join(basedir, "claudex.js");
32
+ const selfPathJS = path.join(basedir, "claudex.js");
33
33
  /* helper for displaying info messages */
34
34
  const info = (msg) => {
35
35
  process.stderr.write(`${chalk.blue("claudex: ")}${chalk.blue.bold("INFO:")}${chalk.blue(` ${msg}`)}\n`);
@@ -39,9 +39,30 @@ const fatal = (msg) => {
39
39
  process.stderr.write(`${chalk.red("claudex: ")}${chalk.red.bold("ERROR:")}${chalk.red(` ${msg}`)}\n`);
40
40
  process.exit(1);
41
41
  };
42
+ /* helper to locate a tool in $PATH (cross-platform).
43
+ On Windows, `which.sync` can fail to find App Execution Aliases
44
+ (zero-byte reparse-point stubs under %LOCALAPPDATA%\Microsoft\WindowsApps,
45
+ e.g. winget.exe, python.exe), because the `stat()` check inside the
46
+ `which` package may not classify them as regular files. As a fallback
47
+ we therefore also consult the native `where` command on Windows. */
48
+ const findTool = (tool) => {
49
+ const r = which.sync(tool, { nothrow: true });
50
+ if (r !== null)
51
+ return r;
52
+ if (process.platform === "win32") {
53
+ const r2 = execaSync("where", [tool], { reject: false, windowsHide: true });
54
+ if ((r2.exitCode ?? 1) === 0) {
55
+ const line = (r2.stdout ?? "").toString().split(/\r?\n/)[0].trim();
56
+ if (line !== "")
57
+ return line;
58
+ }
59
+ }
60
+ return null;
61
+ };
42
62
  /* helper for detecting the platform and package manager combination */
43
63
  const detectPlatform = () => {
44
- const has = (tool) => which.sync(tool, { nothrow: true }) !== null;
64
+ /* helper function for finding a tool in PATH */
65
+ const has = (tool) => findTool(tool) !== null;
45
66
  /* honor explicit override via CLAUDEX_PKG (e.g. "brew", "ports", "apt", ...)
46
67
  to disambiguate hosts where multiple package managers are installed */
47
68
  const override = process.env.CLAUDEX_PKG ?? "";
@@ -111,7 +132,7 @@ const executeCommand = (config) => {
111
132
  const ensureTool = (tool, options = {}) => {
112
133
  const tools = typeof tool === "string" ? [tool] : tool;
113
134
  for (const tool of tools) {
114
- let r = which.sync(tool, { nothrow: true });
135
+ let r = findTool(tool);
115
136
  if (r === null && options.install) {
116
137
  const rc = executeCommand(options.install);
117
138
  if (rc !== 0) {
@@ -120,7 +141,7 @@ const ensureTool = (tool, options = {}) => {
120
141
  fatal(`failed to install required tool "${tool}" (exit ${rc})` +
121
142
  (options.hint !== undefined ? ` -- hint: ${options.hint}` : ""));
122
143
  }
123
- r = which.sync(tool, { nothrow: true });
144
+ r = findTool(tool);
124
145
  }
125
146
  if (r !== null)
126
147
  continue;
@@ -242,7 +263,7 @@ const actionInstall = async (capsula) => {
242
263
  info("install Tmux");
243
264
  ensureTool("tmux", {
244
265
  hint: platform.match(/^windows:/) ?
245
- "https://github.com/psmux/psmux" :
266
+ "https://github.com/psmux/psmux/" :
246
267
  "https://github.com/tmux/tmux/",
247
268
  install: {
248
269
  "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e psmux",
@@ -828,10 +849,10 @@ const actionHelp = () => {
828
849
  /* append our claudeX extension information */
829
850
  process.stdout.write("\n" +
830
851
  "claudeX extension options (honored before claude):\n" +
831
- " -A, --ase enable ASE-specific Claude Code statusline and ASE_* environment variables\n" +
832
852
  " -C, --capsula execute Claude Code inside a Capsula sandbox container\n" +
833
- " -R, --recolor wrap Claude Code with ANSI recoloring for improved theming\n" +
834
853
  " -T, --tmux [session] wrap Claude Code in a Tmux terminal multiplexing session (optional session name)\n" +
854
+ " -R, --recolor wrap Claude Code with ANSI recoloring for improved theming\n" +
855
+ " -A, --ase enable ASE-specific Claude Code statusline and ASE_* environment variables\n" +
835
856
  "\n" +
836
857
  "claudeX extension subcommands (honored before claude):\n" +
837
858
  " install install host-side or in-container dependencies\n" +
@@ -860,10 +881,10 @@ const main = async () => {
860
881
  .passThroughOptions()
861
882
  .allowUnknownOption()
862
883
  .helpOption(false)
863
- .option("-A, --ase", "enable ASE-specific Claude Code statusline and ASE_* environment variables")
864
884
  .option("-C, --capsula", "execute Claude Code inside a Capsula sandbox container")
865
- .option("-R, --recolor", "wrap Claude Code with ANSI recoloing for improved theming")
866
885
  .option("-T, --tmux [session]", "wrap Claude Code in a Tmux terminal multiplexing session (optional session name)")
886
+ .option("-R, --recolor", "wrap Claude Code with ANSI recoloing for improved theming")
887
+ .option("-A, --ase", "enable ASE-specific Claude Code statusline and ASE_* environment variables")
867
888
  .argument("[args...]", "arguments passed unparsed to Claude Code")
868
889
  .action((args, opts) => {
869
890
  actionDefault(opts, args);
package/claudex.ts CHANGED
@@ -35,7 +35,7 @@ const basedir = findBaseDir()
35
35
  next to the compiled JS, since the JS itself is not executable
36
36
  and embedded shell strings (docker/tmux) need a runnable command */
37
37
  const selfPath = path.join(basedir, "claudex")
38
- const selfPathJS = process.argv[1] ?? path.join(basedir, "claudex.js")
38
+ const selfPathJS = path.join(basedir, "claudex.js")
39
39
 
40
40
  /* helper for displaying info messages */
41
41
  const info = (msg: string): void => {
@@ -48,9 +48,33 @@ const fatal = (msg: string): never => {
48
48
  process.exit(1)
49
49
  }
50
50
 
51
+ /* helper to locate a tool in $PATH (cross-platform).
52
+ On Windows, `which.sync` can fail to find App Execution Aliases
53
+ (zero-byte reparse-point stubs under %LOCALAPPDATA%\Microsoft\WindowsApps,
54
+ e.g. winget.exe, python.exe), because the `stat()` check inside the
55
+ `which` package may not classify them as regular files. As a fallback
56
+ we therefore also consult the native `where` command on Windows. */
57
+ const findTool = (tool: string): string | null => {
58
+ const r = which.sync(tool, { nothrow: true })
59
+ if (r !== null)
60
+ return r
61
+ if (process.platform === "win32") {
62
+ const r2 = execaSync("where", [ tool ], { reject: false, windowsHide: true })
63
+ if ((r2.exitCode ?? 1) === 0) {
64
+ const line = (r2.stdout ?? "").toString().split(/\r?\n/)[0].trim()
65
+ if (line !== "")
66
+ return line
67
+ }
68
+ }
69
+ return null
70
+ }
71
+
51
72
  /* helper for detecting the platform and package manager combination */
52
73
  const detectPlatform = (): string => {
53
- const has = (tool: string): boolean => which.sync(tool, { nothrow: true }) !== null
74
+ /* helper function for finding a tool in PATH */
75
+ const has = (tool: string): boolean =>
76
+ findTool(tool) !== null
77
+
54
78
  /* honor explicit override via CLAUDEX_PKG (e.g. "brew", "ports", "apt", ...)
55
79
  to disambiguate hosts where multiple package managers are installed */
56
80
  const override = process.env.CLAUDEX_PKG ?? ""
@@ -127,7 +151,7 @@ const ensureTool = (tool: string | string[], options: {
127
151
  } = {}): void => {
128
152
  const tools = typeof tool === "string" ? [ tool ] : tool
129
153
  for (const tool of tools) {
130
- let r = which.sync(tool, { nothrow: true })
154
+ let r = findTool(tool)
131
155
  if (r === null && options.install) {
132
156
  const rc = executeCommand(options.install)
133
157
  if (rc !== 0) {
@@ -136,7 +160,7 @@ const ensureTool = (tool: string | string[], options: {
136
160
  fatal(`failed to install required tool "${tool}" (exit ${rc})` +
137
161
  (options.hint !== undefined ? ` -- hint: ${options.hint}` : ""))
138
162
  }
139
- r = which.sync(tool, { nothrow: true })
163
+ r = findTool(tool)
140
164
  }
141
165
  if (r !== null)
142
166
  continue
@@ -286,7 +310,7 @@ const actionInstall = async (capsula: boolean): Promise<void> => {
286
310
  info("install Tmux")
287
311
  ensureTool("tmux", {
288
312
  hint: platform.match(/^windows:/) ?
289
- "https://github.com/psmux/psmux" :
313
+ "https://github.com/psmux/psmux/" :
290
314
  "https://github.com/tmux/tmux/",
291
315
  install: {
292
316
  "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e psmux",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rse/claudex",
3
3
  "publishConfig": { "access": "public" },
4
- "version": "0.9.16",
4
+ "version": "0.9.18",
5
5
  "description": "Claude Code eXtended",
6
6
  "type": "module",
7
7
  "keywords": [ "claude", "code", "extension", "wrapper" ],