@rse/claudex 0.9.22 → 0.9.24

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,23 @@
2
2
  ChangeLog
3
3
  =========
4
4
 
5
+ 0.9.24 (2026-05-10)
6
+ -------------------
7
+
8
+ - BUGFIX: further Windows workarounds related to tmux configuration
9
+ - CLEANUP: make ESLint happy
10
+ - REFACTOR: simplify `tmux.conf` patching by overwriting entries
11
+
12
+ 0.9.23 (2026-05-10)
13
+ -------------------
14
+
15
+ - IMPROVEMENT: detect psmux on Windows and apply tmux.conf color fallback
16
+ - IMPROVEMENT: replace "echo $LOGNAME" with a portable variant
17
+ - BUGFIX: fix opening panes under Windows
18
+ - BUGFIX: workaround tmux statusline color issues under psmux on Windows
19
+ - BUGFIX: fix regexp use in psmux color fallback
20
+ - UPDATE: drop "--source winget" to avoid pinning to older package versions
21
+
5
22
  0.9.22 (2026-05-09)
6
23
  -------------------
7
24
 
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,31 @@ 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
+ if (isPsmux()) {
483
+ /* psmux does not honor the reverse ANSI sequence in at least the statusline
484
+ and not some expansions in the pane border format */
485
+ conf +=
486
+ "set-option -g status-style bg=black,fg=color15\n" +
487
+ "set-option -g status-left \" claudeX #[bg=blue,fg=color15] ※ @USER@ #[bg=black,fg=color15] #{?session_attached,#[bg=red,fg=color15] ⚑ #{session_name} #[bg=black,fg=color15],}\"\n" +
488
+ "set-option -g window-status-current-style bg=red,fg=color15\n" +
489
+ "set-option -g window-status-bell-style bg=blue,fg=color15\n" +
490
+ "set-option -g window-status-activity-style bg=blue,fg=color15\n" +
491
+ "set-option -g message-style bg=blue,fg=color15\n" +
492
+ "set-hook -g -u pane-exited\n" +
493
+ "set-hook -g -u after-split-window\n" +
494
+ "bind-key g display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Version Control (lazygit) )▶\" claudex internal lazygit\n" +
495
+ "bind-key s display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Shell )▶\" claudex internal shell\n" +
496
+ "bind-key q display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Task Edit (ase task edit) )▶\" claudex internal ase-task-edit\n";
497
+ }
498
+ conf = conf.replace(/@USER@/g, USER);
459
499
  const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`);
460
500
  fs.writeFileSync(confFile, conf, { mode: 0o600 });
461
501
  /* ensure the temp config is removed on normal exit AND on signal-driven
@@ -669,7 +709,9 @@ const actionDefault = (opts, args) => {
669
709
  const rest = args;
670
710
  /* build the in-pane self-invocation */
671
711
  const inPane = shQ.quote([process.execPath, selfPathJS, ...innerFlags, ...rest]);
672
- /* propagate the chosen pass-through flags to "internal tmux" */
712
+ /* propagate the chosen pass-through flags to subsequent in-pane
713
+ "claudex" invocations via the CLAUDEX_FLAGS env var (honored by
714
+ the env-merge in main()) */
673
715
  const claudexFlags = innerFlags.join(" ");
674
716
  /* dispatch according to global options */
675
717
  if (opts.capsula) {
@@ -687,7 +729,7 @@ const actionDefault = (opts, args) => {
687
729
  "bash", "-c",
688
730
  `TERM=${shQ.quote([TERM])} ` +
689
731
  `HOME=${shQ.quote([HOME])} ` +
690
- `CLAUDEX_FLAGS_PASSTHROUGH=${shQ.quote([claudexFlags])} ` +
732
+ `CLAUDEX_FLAGS=${shQ.quote([claudexFlags])} ` +
691
733
  `sudo -E -u ${shQ.quote([USER])} ` +
692
734
  `${shQ.quote([process.execPath, selfPathJS])} ` +
693
735
  `internal tmux new-session -A -s ${shQ.quote([session])}`
@@ -697,7 +739,7 @@ const actionDefault = (opts, args) => {
697
739
  /* start a new container and run tmux */
698
740
  return execInherit(process.execPath, [
699
741
  selfPathJS, "internal", "capsula",
700
- "-e", `CLAUDEX_FLAGS_PASSTHROUGH=${claudexFlags}`,
742
+ "-e", `CLAUDEX_FLAGS=${claudexFlags}`,
701
743
  "-e", `CLAUDEX_INTERNAL_EXEC=${inPane}`,
702
744
  "-C", container, process.execPath, selfPathJS, "internal", "tmux",
703
745
  "new-session", "-A", "-s", session, "-n", "claude",
@@ -714,7 +756,7 @@ const actionDefault = (opts, args) => {
714
756
  "claudex", "internal", "exec"
715
757
  ], {
716
758
  env: {
717
- CLAUDEX_FLAGS_PASSTHROUGH: claudexFlags,
759
+ CLAUDEX_FLAGS: claudexFlags,
718
760
  CLAUDEX_INTERNAL_EXEC: inPane
719
761
  }
720
762
  });
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,31 @@ 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
+ if (isPsmux()) {
554
+ /* psmux does not honor the reverse ANSI sequence in at least the statusline
555
+ and not some expansions in the pane border format */
556
+ conf +=
557
+ "set-option -g status-style bg=black,fg=color15\n" +
558
+ "set-option -g status-left \" claudeX #[bg=blue,fg=color15] ※ @USER@ #[bg=black,fg=color15] #{?session_attached,#[bg=red,fg=color15] ⚑ #{session_name} #[bg=black,fg=color15],}\"\n" +
559
+ "set-option -g window-status-current-style bg=red,fg=color15\n" +
560
+ "set-option -g window-status-bell-style bg=blue,fg=color15\n" +
561
+ "set-option -g window-status-activity-style bg=blue,fg=color15\n" +
562
+ "set-option -g message-style bg=blue,fg=color15\n" +
563
+ "set-hook -g -u pane-exited\n" +
564
+ "set-hook -g -u after-split-window\n" +
565
+ "bind-key g display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Version Control (lazygit) )▶\" claudex internal lazygit\n" +
566
+ "bind-key s display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Shell )▶\" claudex internal shell\n" +
567
+ "bind-key q display-popup -E -w 95% -h 95% -T \"─◀( ⧉ Task Edit (ase task edit) )▶\" claudex internal ase-task-edit\n"
568
+ }
569
+ conf = conf.replace(/@USER@/g, USER)
529
570
  const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`)
530
571
  fs.writeFileSync(confFile, conf, { mode: 0o600 })
531
572
  /* ensure the temp config is removed on normal exit AND on signal-driven
@@ -752,7 +793,9 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
752
793
  /* build the in-pane self-invocation */
753
794
  const inPane = shQ.quote([ process.execPath, selfPathJS, ...innerFlags, ...rest ])
754
795
 
755
- /* propagate the chosen pass-through flags to "internal tmux" */
796
+ /* propagate the chosen pass-through flags to subsequent in-pane
797
+ "claudex" invocations via the CLAUDEX_FLAGS env var (honored by
798
+ the env-merge in main()) */
756
799
  const claudexFlags = innerFlags.join(" ")
757
800
 
758
801
  /* dispatch according to global options */
@@ -772,7 +815,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
772
815
  "bash", "-c",
773
816
  `TERM=${shQ.quote([ TERM ])} ` +
774
817
  `HOME=${shQ.quote([ HOME ])} ` +
775
- `CLAUDEX_FLAGS_PASSTHROUGH=${shQ.quote([ claudexFlags ])} ` +
818
+ `CLAUDEX_FLAGS=${shQ.quote([ claudexFlags ])} ` +
776
819
  `sudo -E -u ${shQ.quote([ USER ])} ` +
777
820
  `${shQ.quote([ process.execPath, selfPathJS ])} ` +
778
821
  `internal tmux new-session -A -s ${shQ.quote([ session ])}`
@@ -782,7 +825,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
782
825
  /* start a new container and run tmux */
783
826
  return execInherit(process.execPath, [
784
827
  selfPathJS, "internal", "capsula",
785
- "-e", `CLAUDEX_FLAGS_PASSTHROUGH=${claudexFlags}`,
828
+ "-e", `CLAUDEX_FLAGS=${claudexFlags}`,
786
829
  "-e", `CLAUDEX_INTERNAL_EXEC=${inPane}`,
787
830
  "-C", container, process.execPath, selfPathJS, "internal", "tmux",
788
831
  "new-session", "-A", "-s", session, "-n", "claude",
@@ -799,7 +842,7 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
799
842
  "claudex", "internal", "exec"
800
843
  ], {
801
844
  env: {
802
- CLAUDEX_FLAGS_PASSTHROUGH: claudexFlags,
845
+ CLAUDEX_FLAGS: claudexFlags,
803
846
  CLAUDEX_INTERNAL_EXEC: inPane
804
847
  }
805
848
  })
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.24",
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