@rse/claudex 0.9.22 → 0.9.23

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.23 (2026-05-10)
6
+ -------------------
7
+
8
+ - IMPROVEMENT: detect psmux on Windows and apply tmux.conf color fallback
9
+ - IMPROVEMENT: replace "echo $LOGNAME" with a portable variant
10
+ - BUGFIX: fix opening panes under Windows
11
+ - BUGFIX: workaround tmux statusline color issues under psmux on Windows
12
+ - BUGFIX: fix regexp use in psmux color fallback
13
+ - UPDATE: drop "--source winget" to avoid pinning to older package versions
14
+
5
15
  0.9.22 (2026-05-09)
6
16
  -------------------
7
17
 
package/claudex.js CHANGED
@@ -57,6 +57,17 @@ const findTool = (tool) => {
57
57
  }
58
58
  return null;
59
59
  };
60
+ /* helper to detect whether the active `tmux` is actually `psmux`
61
+ (the Windows port). psmux does not identify itself via `tmux -V`,
62
+ so we instead check whether we are on Windows AND a `psmux` command
63
+ is available in $PATH. The result is cached after the first call. */
64
+ let isPsmuxCached = null;
65
+ const isPsmux = () => {
66
+ if (isPsmuxCached !== null)
67
+ return isPsmuxCached;
68
+ isPsmuxCached = process.platform === "win32" && findTool("psmux") !== null;
69
+ return isPsmuxCached;
70
+ };
60
71
  /* helper for detecting the platform and package manager combination */
61
72
  const detectPlatform = () => {
62
73
  /* helper function for finding a tool in PATH */
@@ -180,7 +191,21 @@ const detectSessionName = () => {
180
191
  };
181
192
  /* determine information */
182
193
  const HOME = process.env.HOME ?? os.homedir();
183
- const USER = process.env.USER ?? "";
194
+ const detectUser = () => {
195
+ if (process.env.USER)
196
+ return process.env.USER;
197
+ if (process.env.LOGNAME)
198
+ return process.env.LOGNAME;
199
+ if (process.env.USERNAME)
200
+ return process.env.USERNAME;
201
+ try {
202
+ return os.userInfo().username;
203
+ }
204
+ catch (_e) {
205
+ return "";
206
+ }
207
+ };
208
+ const USER = detectUser();
184
209
  const TERM = process.env.TERM ?? "";
185
210
  const ENVIRONMENT = process.env.ENVIRONMENT ?? "";
186
211
  /* helper: prune all but the given active Claude Code version */
@@ -286,7 +311,7 @@ const actionInstall = async (capsula) => {
286
311
  optional: true,
287
312
  hint: "https://git-scm.com",
288
313
  install: {
289
- "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e --id Git.Git --source winget",
314
+ "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e --id Git.Git",
290
315
  "windows:choco": "choco install -y --accept-license --no-progress git",
291
316
  "macos:ports": "sudo port -N install git",
292
317
  "macos:brew": "sudo brew install git",
@@ -446,16 +471,26 @@ const actionUpdate = async (capsula) => {
446
471
  }
447
472
  };
448
473
  /* action: internal "tmux" -- spawn tmux with our generated configuration.
449
- The tmux.conf bind-keys for new claude panes embed the parent invocation's
450
- pass-through flags (e.g. "-R") so panes inherit the user's choice; flags
451
- are transported via the CLAUDEX_FLAGS_PASSTHROUGH env var (set by
452
- actionDefault when entering tmux mode). */
474
+ The tmux.conf bind-keys for new claude panes invoke "claudex" (which is
475
+ expected to be in $PATH); the parent invocation's pass-through flags
476
+ (e.g. "-R") are propagated to those panes via the CLAUDEX_FLAGS env var
477
+ (set by actionDefault when entering tmux mode), which the env-merge in
478
+ main() picks up. */
453
479
  const actionInternalTmux = (args) => {
454
480
  ensureTool("tmux");
455
- const claudexFlags = process.env.CLAUDEX_FLAGS_PASSTHROUGH ?? "";
456
- const conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8")
457
- .replace(/@CLAUDEX@/g, `${shQ.quote([process.execPath, selfPathJS])}`)
458
- .replace(/@CLAUDEX_FLAGS_PASSTHROUGH@/g, claudexFlags);
481
+ let conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8");
482
+ conf = conf.replace(/@USER@/g, USER);
483
+ if (isPsmux()) {
484
+ /* psmux does not honor the reverse ANSI sequence in at least the statusline
485
+ and no expansions at all in the pane border format */
486
+ conf = conf.replace(/fg=default,bg=default,reverse/, "bg=black,fg=color15")
487
+ .replaceAll(/(status.*?)fg=blue,reverse/g, "$1bg=blue,fg=color15")
488
+ .replaceAll(/(status.*?)fg=blue/g, "$1bg=blue,fg=color15")
489
+ .replaceAll(/(status.*?)fg=red/g, "$1bg=red,fg=color15")
490
+ .replaceAll(/(status.*?)fg=default/g, "$1bg=black,fg=color15")
491
+ .replaceAll(/#\[reverse\]/g, "")
492
+ .replaceAll(/#\[noreverse\]/g, "");
493
+ }
459
494
  const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`);
460
495
  fs.writeFileSync(confFile, conf, { mode: 0o600 });
461
496
  /* ensure the temp config is removed on normal exit AND on signal-driven
@@ -669,7 +704,9 @@ const actionDefault = (opts, args) => {
669
704
  const rest = args;
670
705
  /* build the in-pane self-invocation */
671
706
  const inPane = shQ.quote([process.execPath, selfPathJS, ...innerFlags, ...rest]);
672
- /* propagate the chosen pass-through flags to "internal tmux" */
707
+ /* propagate the chosen pass-through flags to subsequent in-pane
708
+ "claudex" invocations via the CLAUDEX_FLAGS env var (honored by
709
+ the env-merge in main()) */
673
710
  const claudexFlags = innerFlags.join(" ");
674
711
  /* dispatch according to global options */
675
712
  if (opts.capsula) {
@@ -687,7 +724,7 @@ const actionDefault = (opts, args) => {
687
724
  "bash", "-c",
688
725
  `TERM=${shQ.quote([TERM])} ` +
689
726
  `HOME=${shQ.quote([HOME])} ` +
690
- `CLAUDEX_FLAGS_PASSTHROUGH=${shQ.quote([claudexFlags])} ` +
727
+ `CLAUDEX_FLAGS=${shQ.quote([claudexFlags])} ` +
691
728
  `sudo -E -u ${shQ.quote([USER])} ` +
692
729
  `${shQ.quote([process.execPath, selfPathJS])} ` +
693
730
  `internal tmux new-session -A -s ${shQ.quote([session])}`
@@ -697,7 +734,7 @@ const actionDefault = (opts, args) => {
697
734
  /* start a new container and run tmux */
698
735
  return execInherit(process.execPath, [
699
736
  selfPathJS, "internal", "capsula",
700
- "-e", `CLAUDEX_FLAGS_PASSTHROUGH=${claudexFlags}`,
737
+ "-e", `CLAUDEX_FLAGS=${claudexFlags}`,
701
738
  "-e", `CLAUDEX_INTERNAL_EXEC=${inPane}`,
702
739
  "-C", container, process.execPath, selfPathJS, "internal", "tmux",
703
740
  "new-session", "-A", "-s", session, "-n", "claude",
@@ -714,7 +751,7 @@ const actionDefault = (opts, args) => {
714
751
  "claudex", "internal", "exec"
715
752
  ], {
716
753
  env: {
717
- CLAUDEX_FLAGS_PASSTHROUGH: claudexFlags,
754
+ CLAUDEX_FLAGS: claudexFlags,
718
755
  CLAUDEX_INTERNAL_EXEC: inPane
719
756
  }
720
757
  });
package/claudex.ts CHANGED
@@ -67,6 +67,18 @@ const findTool = (tool: string): string | null => {
67
67
  return null
68
68
  }
69
69
 
70
+ /* helper to detect whether the active `tmux` is actually `psmux`
71
+ (the Windows port). psmux does not identify itself via `tmux -V`,
72
+ so we instead check whether we are on Windows AND a `psmux` command
73
+ is available in $PATH. The result is cached after the first call. */
74
+ let isPsmuxCached: boolean | null = null
75
+ const isPsmux = (): boolean => {
76
+ if (isPsmuxCached !== null)
77
+ return isPsmuxCached
78
+ isPsmuxCached = process.platform === "win32" && findTool("psmux") !== null
79
+ return isPsmuxCached
80
+ }
81
+
70
82
  /* helper for detecting the platform and package manager combination */
71
83
  const detectPlatform = (): string => {
72
84
  /* helper function for finding a tool in PATH */
@@ -202,7 +214,21 @@ const detectSessionName = (): string => {
202
214
 
203
215
  /* determine information */
204
216
  const HOME = process.env.HOME ?? os.homedir()
205
- const USER = process.env.USER ?? ""
217
+ const detectUser = (): string => {
218
+ if (process.env.USER)
219
+ return process.env.USER
220
+ if (process.env.LOGNAME)
221
+ return process.env.LOGNAME
222
+ if (process.env.USERNAME)
223
+ return process.env.USERNAME
224
+ try {
225
+ return os.userInfo().username
226
+ }
227
+ catch (_e) {
228
+ return ""
229
+ }
230
+ }
231
+ const USER = detectUser()
206
232
  const TERM = process.env.TERM ?? ""
207
233
  const ENVIRONMENT = process.env.ENVIRONMENT ?? ""
208
234
 
@@ -333,7 +359,7 @@ const actionInstall = async (capsula: boolean): Promise<void> => {
333
359
  optional: true,
334
360
  hint: "https://git-scm.com",
335
361
  install: {
336
- "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e --id Git.Git --source winget",
362
+ "windows:winget": "winget install --accept-package-agreements --accept-source-agreements --silent -e --id Git.Git",
337
363
  "windows:choco": "choco install -y --accept-license --no-progress git",
338
364
  "macos:ports": "sudo port -N install git",
339
365
  "macos:brew": "sudo brew install git",
@@ -516,16 +542,26 @@ const actionUpdate = async (capsula: boolean): Promise<void> => {
516
542
  }
517
543
 
518
544
  /* action: internal "tmux" -- spawn tmux with our generated configuration.
519
- The tmux.conf bind-keys for new claude panes embed the parent invocation's
520
- pass-through flags (e.g. "-R") so panes inherit the user's choice; flags
521
- are transported via the CLAUDEX_FLAGS_PASSTHROUGH env var (set by
522
- actionDefault when entering tmux mode). */
545
+ The tmux.conf bind-keys for new claude panes invoke "claudex" (which is
546
+ expected to be in $PATH); the parent invocation's pass-through flags
547
+ (e.g. "-R") are propagated to those panes via the CLAUDEX_FLAGS env var
548
+ (set by actionDefault when entering tmux mode), which the env-merge in
549
+ main() picks up. */
523
550
  const actionInternalTmux = (args: string[]): never => {
524
551
  ensureTool("tmux")
525
- const claudexFlags = process.env.CLAUDEX_FLAGS_PASSTHROUGH ?? ""
526
- const conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8")
527
- .replace(/@CLAUDEX@/g, `${shQ.quote([ process.execPath, selfPathJS ])}`)
528
- .replace(/@CLAUDEX_FLAGS_PASSTHROUGH@/g, claudexFlags)
552
+ let conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8")
553
+ conf = conf.replace(/@USER@/g, USER)
554
+ if (isPsmux()) {
555
+ /* psmux does not honor the reverse ANSI sequence in at least the statusline
556
+ and no expansions at all in the pane border format */
557
+ conf = conf.replace(/fg=default,bg=default,reverse/, "bg=black,fg=color15")
558
+ .replaceAll(/(status.*?)fg=blue,reverse/g, "$1bg=blue,fg=color15")
559
+ .replaceAll(/(status.*?)fg=blue/g, "$1bg=blue,fg=color15")
560
+ .replaceAll(/(status.*?)fg=red/g, "$1bg=red,fg=color15")
561
+ .replaceAll(/(status.*?)fg=default/g, "$1bg=black,fg=color15")
562
+ .replaceAll(/#\[reverse\]/g, "")
563
+ .replaceAll(/#\[noreverse\]/g, "")
564
+ }
529
565
  const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`)
530
566
  fs.writeFileSync(confFile, conf, { mode: 0o600 })
531
567
  /* ensure the temp config is removed on normal exit AND on signal-driven
@@ -752,7 +788,9 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
752
788
  /* build the in-pane self-invocation */
753
789
  const inPane = shQ.quote([ process.execPath, selfPathJS, ...innerFlags, ...rest ])
754
790
 
755
- /* propagate the chosen pass-through flags to "internal tmux" */
791
+ /* propagate the chosen pass-through flags to subsequent in-pane
792
+ "claudex" invocations via the CLAUDEX_FLAGS env var (honored by
793
+ the env-merge in main()) */
756
794
  const claudexFlags = innerFlags.join(" ")
757
795
 
758
796
  /* dispatch according to global options */
@@ -772,7 +810,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
772
810
  "bash", "-c",
773
811
  `TERM=${shQ.quote([ TERM ])} ` +
774
812
  `HOME=${shQ.quote([ HOME ])} ` +
775
- `CLAUDEX_FLAGS_PASSTHROUGH=${shQ.quote([ claudexFlags ])} ` +
813
+ `CLAUDEX_FLAGS=${shQ.quote([ claudexFlags ])} ` +
776
814
  `sudo -E -u ${shQ.quote([ USER ])} ` +
777
815
  `${shQ.quote([ process.execPath, selfPathJS ])} ` +
778
816
  `internal tmux new-session -A -s ${shQ.quote([ session ])}`
@@ -782,7 +820,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
782
820
  /* start a new container and run tmux */
783
821
  return execInherit(process.execPath, [
784
822
  selfPathJS, "internal", "capsula",
785
- "-e", `CLAUDEX_FLAGS_PASSTHROUGH=${claudexFlags}`,
823
+ "-e", `CLAUDEX_FLAGS=${claudexFlags}`,
786
824
  "-e", `CLAUDEX_INTERNAL_EXEC=${inPane}`,
787
825
  "-C", container, process.execPath, selfPathJS, "internal", "tmux",
788
826
  "new-session", "-A", "-s", session, "-n", "claude",
@@ -799,7 +837,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
799
837
  "claudex", "internal", "exec"
800
838
  ], {
801
839
  env: {
802
- CLAUDEX_FLAGS_PASSTHROUGH: claudexFlags,
840
+ CLAUDEX_FLAGS: claudexFlags,
803
841
  CLAUDEX_INTERNAL_EXEC: inPane
804
842
  }
805
843
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rse/claudex",
3
3
  "publishConfig": { "access": "public" },
4
- "version": "0.9.22",
4
+ "version": "0.9.23",
5
5
  "description": "Claude Code eXtended",
6
6
  "type": "module",
7
7
  "keywords": [ "claude", "code", "extension", "wrapper" ],
package/tmux.conf CHANGED
@@ -175,7 +175,7 @@ set-option -g -s escape-time 50
175
175
  set-option -g status-keys emacs
176
176
  set-option -g status-style fg=default,bg=default,reverse
177
177
  set-option -g status-justify right
178
- set-option -g status-left " claudeX #[fg=blue] ※ #(echo $LOGNAME) #[fg=default] #{?session_attached,#[fg=red] ⚑ #{session_name} #[fg=default],}"
178
+ set-option -g status-left " claudeX #[fg=blue] ※ @USER@ #[fg=default] #{?session_attached,#[fg=red] ⚑ #{session_name} #[fg=default],}"
179
179
  set-option -g status-left-length 30
180
180
  set-option -g status-right ""
181
181
  set-option -g status-right-length 90
@@ -196,12 +196,12 @@ set-option -as terminal-overrides ",*:RGB"
196
196
  set-option -as terminal-overrides ',*:Tc:sitm=\E[3m:ritm=\E[23m'
197
197
 
198
198
  # claudeX specifics
199
- bind-key c new-window -c "#{pane_current_path}" -n claude "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@"
200
- bind-key | split-window -c "#{pane_current_path}" -h "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@"
201
- bind-key - split-window -c "#{pane_current_path}" -v "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@"
202
- bind-key g display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Version Control (lazygit) #[noreverse]▶" "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@ internal lazygit"
203
- bind-key s display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Shell #[noreverse]▶" "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@ internal shell"
204
- bind-key q display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Task Edit (ase task edit) #[noreverse]▶" "@CLAUDEX@ @CLAUDEX_FLAGS_PASSTHROUGH@ internal ase-task-edit"
199
+ bind-key c new-window -c "#{pane_current_path}" -n claude "claudex"
200
+ bind-key | split-window -c "#{pane_current_path}" -h "claudex"
201
+ bind-key - split-window -c "#{pane_current_path}" -v "claudex"
202
+ bind-key g display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Version Control (lazygit) #[noreverse]▶" "claudex internal lazygit"
203
+ bind-key s display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Shell #[noreverse]▶" "claudex internal shell"
204
+ bind-key q display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Task Edit (ase task edit) #[noreverse]▶" "claudex internal ase-task-edit"
205
205
  bind-key t send-keys "/ase:ase-meta-task "
206
206
  bind-key p send-keys "/ase:ase-meta-persona "
207
207