@rse/claudex 0.9.14 → 0.9.16
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 +171 -0
- package/LICENSE.txt +674 -0
- package/README.md +17 -25
- package/ansi-recolor.conf +3 -1
- package/claude +8 -3
- package/claude-settings.json +8 -0
- package/claudex +1 -1
- package/claudex.js +82 -37
- package/claudex.ts +86 -39
- package/eslint.mjs +1 -1
- package/lazygit.yaml +5 -0
- package/package.json +4 -3
- package/stx.conf +1 -1
- package/tmux.conf +9 -11
package/README.md
CHANGED
|
@@ -64,46 +64,38 @@ Installation
|
|
|
64
64
|
------------
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
|
+
# initially
|
|
67
68
|
$ npm install -h @rse/claudex
|
|
68
|
-
$ claudex install
|
|
69
|
+
$ claudex [-C/--capsula] install
|
|
70
|
+
|
|
71
|
+
# regularly
|
|
72
|
+
$ claudex [-C/--capsula] update
|
|
69
73
|
```
|
|
70
74
|
|
|
71
75
|
Usage
|
|
72
76
|
-----
|
|
73
77
|
|
|
74
78
|
```sh
|
|
75
|
-
$ claudex
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
$ claudex \
|
|
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)")
|
|
82
|
+
[-R|--recolor] # wrap Claude Code with ANSI recoloing for improved theming")
|
|
83
|
+
[-A|--ase] # enable ASE-specific Claude Code statusline and ASE_* environment variables")
|
|
84
|
+
[...options...] # arbitrary Claude Code options
|
|
79
85
|
```
|
|
80
86
|
|
|
81
87
|
See Also
|
|
82
88
|
--------
|
|
83
89
|
|
|
90
|
+
- [Claude Code](https://code.claude.com)
|
|
91
|
+
- [Capsula](https://github.com/rse/capsula)
|
|
92
|
+
- [Tmux](https://github.com/tmux/tmux)
|
|
93
|
+
- [ANSI Recolor](https://github.com/rse/ansi-recolor)
|
|
84
94
|
- [Agentic Software Engineering (ASE)](https://github.com/rse/ase)
|
|
85
95
|
|
|
86
96
|
License
|
|
87
97
|
-------
|
|
88
98
|
|
|
89
|
-
Copyright ©
|
|
90
|
-
|
|
91
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
92
|
-
a copy of this software and associated documentation files (the
|
|
93
|
-
"Software"), to deal in the Software without restriction, including
|
|
94
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
95
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
96
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
97
|
-
the following conditions:
|
|
98
|
-
|
|
99
|
-
The above copyright notice and this permission notice shall be included
|
|
100
|
-
in all copies or substantial portions of the Software.
|
|
101
|
-
|
|
102
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
103
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
104
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
105
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
106
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
107
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
108
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
99
|
+
Copyright © 2026 [Dr. Ralf S. Engelschall](https://engelschall.com)<br/>
|
|
100
|
+
Licensed under [GPL 3.0](https://spdx.org/licenses/GPL-3.0-only)
|
|
109
101
|
|
package/ansi-recolor.conf
CHANGED
package/claude
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
+
##
|
|
3
|
+
## claudeX -- Claude Code eXtended
|
|
4
|
+
## Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
+
## Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
|
+
##
|
|
2
7
|
|
|
3
|
-
if [ ".$
|
|
4
|
-
PATH="$
|
|
8
|
+
if [ ".$CLAUDEX_BASEDIR" != . ]; then
|
|
9
|
+
PATH="$CLAUDEX_BASEDIR:$PATH"
|
|
5
10
|
fi
|
|
6
11
|
|
|
7
|
-
exec claudex $
|
|
12
|
+
exec claudex ${1+"$@"}
|
|
8
13
|
|
package/claude-settings.json
CHANGED
package/claudex
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
##
|
|
3
3
|
## claudeX -- Claude Code eXtended
|
|
4
4
|
## Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
-
## Licensed under
|
|
5
|
+
## Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
6
|
##
|
|
7
7
|
## Thin POSIX-sh launcher: resolve our own path (handling symlinks),
|
|
8
8
|
## then exec the compiled Node.js program (claudex.js) next to it.
|
package/claudex.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
** claudeX -- Claude Code eXtended
|
|
4
4
|
** Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
-
** Licensed under
|
|
5
|
+
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
6
|
*/
|
|
7
7
|
import * as fs from "node:fs";
|
|
8
8
|
import * as path from "node:path";
|
|
@@ -10,6 +10,7 @@ import * as os from "node:os";
|
|
|
10
10
|
import { execa, execaSync } from "execa";
|
|
11
11
|
import which from "which";
|
|
12
12
|
import chalk from "chalk";
|
|
13
|
+
import deepmerge from "deepmerge";
|
|
13
14
|
import { Command } from "commander";
|
|
14
15
|
/* determine our base directory (handle absolute, relative, PATH, symlinks) */
|
|
15
16
|
const findBaseDir = () => {
|
|
@@ -439,7 +440,7 @@ const actionInternalTmux = (args) => {
|
|
|
439
440
|
const claudexFlags = process.env.CLAUDEX_FLAGS ?? "";
|
|
440
441
|
const conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8")
|
|
441
442
|
.replace(/@SELFPATH@/g, selfPath)
|
|
442
|
-
.replace(/@
|
|
443
|
+
.replace(/@CLAUDEX_FLAGS@/g, claudexFlags);
|
|
443
444
|
const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`);
|
|
444
445
|
fs.writeFileSync(confFile, conf, { mode: 0o600 });
|
|
445
446
|
const r = execaSync("tmux", [
|
|
@@ -491,18 +492,24 @@ const actionInternalAseTaskEdit = async () => {
|
|
|
491
492
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
492
493
|
}
|
|
493
494
|
};
|
|
494
|
-
/* action: internal "lazygit" -- spawn lazygit (recolored) */
|
|
495
|
-
const actionInternalLazygit = (args) => {
|
|
496
|
-
ensureTool("ansi-recolor");
|
|
495
|
+
/* action: internal "lazygit" -- spawn lazygit (optionally recolored) */
|
|
496
|
+
const actionInternalLazygit = (recolor, args) => {
|
|
497
497
|
ensureTool("git");
|
|
498
498
|
ensureTool("lazygit");
|
|
499
499
|
const env = { ...process.env, TERM: "xterm-color" };
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
"-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
500
|
+
if (recolor) {
|
|
501
|
+
ensureTool("ansi-recolor");
|
|
502
|
+
return execInherit("ansi-recolor", [
|
|
503
|
+
"-c", path.join(basedir, "ansi-recolor.conf"),
|
|
504
|
+
"-m",
|
|
505
|
+
"-n", "lazygit",
|
|
506
|
+
"-t", path.join(HOME, "ansi-recolor.txt"),
|
|
507
|
+
"lazygit", "-ucf", path.join(basedir, "lazygit.yaml"),
|
|
508
|
+
...args
|
|
509
|
+
], { env });
|
|
510
|
+
}
|
|
511
|
+
return execInherit("lazygit", [
|
|
512
|
+
"-ucf", path.join(basedir, "lazygit.yaml"),
|
|
506
513
|
...args
|
|
507
514
|
], { env });
|
|
508
515
|
};
|
|
@@ -577,14 +584,14 @@ const actionInternalCapsula = (args) => {
|
|
|
577
584
|
]);
|
|
578
585
|
};
|
|
579
586
|
/* action: internal sub-dispatch (tmux, shell, ase-task-edit, lazygit, capsula) */
|
|
580
|
-
const actionInternal = async (args) => {
|
|
587
|
+
const actionInternal = async (opts, args) => {
|
|
581
588
|
const util = args[0];
|
|
582
589
|
const rest = args.slice(1);
|
|
583
590
|
switch (util) {
|
|
584
591
|
case "tmux": return actionInternalTmux(rest);
|
|
585
592
|
case "shell": return actionInternalShell(rest);
|
|
586
593
|
case "ase-task-edit": return actionInternalAseTaskEdit();
|
|
587
|
-
case "lazygit": return actionInternalLazygit(rest);
|
|
594
|
+
case "lazygit": return actionInternalLazygit(opts.recolor === true, rest);
|
|
588
595
|
case "capsula": return actionInternalCapsula(rest);
|
|
589
596
|
default:
|
|
590
597
|
fatal(`invalid internal command "${util ?? ""}"`);
|
|
@@ -592,11 +599,13 @@ const actionInternal = async (args) => {
|
|
|
592
599
|
};
|
|
593
600
|
/* action: top-level command -- run "claude" */
|
|
594
601
|
const actionDefault = (opts, args) => {
|
|
595
|
-
/* build the inner self-invocation flag list. Pass-through "-R" only,
|
|
602
|
+
/* build the inner self-invocation flag list. Pass-through "-R"/"-A" only,
|
|
596
603
|
as "-C" and "-T" are consumed at the outer layer to avoid recursion. */
|
|
597
604
|
const innerFlags = [];
|
|
598
605
|
if (opts.recolor)
|
|
599
606
|
innerFlags.push("-R");
|
|
607
|
+
if (opts.ase)
|
|
608
|
+
innerFlags.push("-A");
|
|
600
609
|
/* branch: tmux mode (with or without capsula) */
|
|
601
610
|
if (opts.tmux) {
|
|
602
611
|
/* sanity check environment */
|
|
@@ -731,32 +740,65 @@ const actionDefault = (opts, args) => {
|
|
|
731
740
|
env.DISABLE_LOGOUT_COMMAND = "1";
|
|
732
741
|
}
|
|
733
742
|
/* override ASE configuration (for its diagram rendering) */
|
|
734
|
-
if (
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
743
|
+
if (opts.ase) {
|
|
744
|
+
if (process.env.ASE_TERM_WIDTH === undefined) {
|
|
745
|
+
let width = 0;
|
|
746
|
+
if (process.stdout.isTTY) {
|
|
747
|
+
const cols = process.stdout.columns;
|
|
748
|
+
if (typeof cols === "number" && cols > 0)
|
|
749
|
+
width = cols;
|
|
750
|
+
}
|
|
751
|
+
process.env.ASE_TERM_WIDTH = `${width}`;
|
|
740
752
|
}
|
|
741
|
-
process.env.
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
try {
|
|
746
|
-
const { stdout } = execaSync("tput", ["colors"], { reject: false });
|
|
747
|
-
const n = parseInt(stdout.trim(), 10);
|
|
748
|
-
if (!Number.isNaN(n) && n >= 256)
|
|
753
|
+
if (process.env.ASE_TERM_COLORS === undefined) {
|
|
754
|
+
let colorMode = "none";
|
|
755
|
+
const depth = process.stdout.getColorDepth();
|
|
756
|
+
if (depth >= 8)
|
|
749
757
|
colorMode = "ansi256";
|
|
750
|
-
else if (
|
|
758
|
+
else if (depth >= 4)
|
|
751
759
|
colorMode = "ansi16";
|
|
760
|
+
process.env.ASE_TERM_COLORS = `${colorMode}`;
|
|
752
761
|
}
|
|
753
|
-
|
|
754
|
-
|
|
762
|
+
}
|
|
763
|
+
/* determine Claude Code settings */
|
|
764
|
+
let claudeSettings = {
|
|
765
|
+
"env": {
|
|
766
|
+
"DISABLE_TELEMETRY": "1",
|
|
767
|
+
"DISABLE_AUTOUPDATER": "1",
|
|
768
|
+
"DISABLE_BUG_COMMAND": "1",
|
|
769
|
+
"DISABLE_ERROR_REPORTING": "1"
|
|
770
|
+
},
|
|
771
|
+
"verbose": false,
|
|
772
|
+
"spinnerTipsEnabled": false,
|
|
773
|
+
"spinnerVerbs": {
|
|
774
|
+
"mode": "replace",
|
|
775
|
+
"verbs": [
|
|
776
|
+
"Working",
|
|
777
|
+
"Working (Just be patient)"
|
|
778
|
+
]
|
|
755
779
|
}
|
|
756
|
-
|
|
780
|
+
};
|
|
781
|
+
if (opts.ase) {
|
|
782
|
+
claudeSettings = deepmerge(claudeSettings, {
|
|
783
|
+
"statusLine": {
|
|
784
|
+
"type": "command",
|
|
785
|
+
"command": "ase statusline -w 0 -m 2 '<blue>%u</blue> <red>%p</red> <black>%T</black> %s' '%m %e %t' '%P %c'",
|
|
786
|
+
"padding": 0
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
if (opts.tmux) {
|
|
791
|
+
claudeSettings = deepmerge(claudeSettings, {
|
|
792
|
+
"env": {
|
|
793
|
+
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
|
|
794
|
+
},
|
|
795
|
+
"teammateMode": "tmux",
|
|
796
|
+
"preferences": {
|
|
797
|
+
"tmuxSplitPanes": true
|
|
798
|
+
}
|
|
799
|
+
});
|
|
757
800
|
}
|
|
758
801
|
/* execute "claude" */
|
|
759
|
-
const settings = fs.readFileSync(path.join(basedir, "claude-settings.json"), "utf8");
|
|
760
802
|
const claudeBin = path.join(HOME, ".local/bin/claude");
|
|
761
803
|
if (recolor) {
|
|
762
804
|
return execInherit("ansi-recolor", [
|
|
@@ -765,13 +807,13 @@ const actionDefault = (opts, args) => {
|
|
|
765
807
|
"-n", "claude",
|
|
766
808
|
"-t", path.join(HOME, "ansi-recolor.txt"),
|
|
767
809
|
claudeBin,
|
|
768
|
-
"--settings",
|
|
810
|
+
"--settings", JSON.stringify(claudeSettings),
|
|
769
811
|
...args
|
|
770
812
|
], { env });
|
|
771
813
|
}
|
|
772
814
|
else {
|
|
773
815
|
return execInherit(claudeBin, [
|
|
774
|
-
"--settings",
|
|
816
|
+
"--settings", JSON.stringify(claudeSettings),
|
|
775
817
|
...args
|
|
776
818
|
], { env });
|
|
777
819
|
}
|
|
@@ -786,6 +828,7 @@ const actionHelp = () => {
|
|
|
786
828
|
/* append our claudeX extension information */
|
|
787
829
|
process.stdout.write("\n" +
|
|
788
830
|
"claudeX extension options (honored before claude):\n" +
|
|
831
|
+
" -A, --ase enable ASE-specific Claude Code statusline and ASE_* environment variables\n" +
|
|
789
832
|
" -C, --capsula execute Claude Code inside a Capsula sandbox container\n" +
|
|
790
833
|
" -R, --recolor wrap Claude Code with ANSI recoloring for improved theming\n" +
|
|
791
834
|
" -T, --tmux [session] wrap Claude Code in a Tmux terminal multiplexing session (optional session name)\n" +
|
|
@@ -817,6 +860,7 @@ const main = async () => {
|
|
|
817
860
|
.passThroughOptions()
|
|
818
861
|
.allowUnknownOption()
|
|
819
862
|
.helpOption(false)
|
|
863
|
+
.option("-A, --ase", "enable ASE-specific Claude Code statusline and ASE_* environment variables")
|
|
820
864
|
.option("-C, --capsula", "execute Claude Code inside a Capsula sandbox container")
|
|
821
865
|
.option("-R, --recolor", "wrap Claude Code with ANSI recoloing for improved theming")
|
|
822
866
|
.option("-T, --tmux [session]", "wrap Claude Code in a Tmux terminal multiplexing session (optional session name)")
|
|
@@ -849,8 +893,9 @@ const main = async () => {
|
|
|
849
893
|
.helpOption("-h, --help", "display help for command")
|
|
850
894
|
.allowUnknownOption()
|
|
851
895
|
.argument("[args...]", "internal command name and its arguments")
|
|
852
|
-
.action(async (args) => {
|
|
853
|
-
|
|
896
|
+
.action(async (args, _opts, cmd) => {
|
|
897
|
+
const opts = (cmd.parent?.opts() ?? {});
|
|
898
|
+
await actionInternal(opts, args);
|
|
854
899
|
});
|
|
855
900
|
await program.parseAsync(process.argv);
|
|
856
901
|
};
|
package/claudex.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
** claudeX -- Claude Code eXtended
|
|
4
4
|
** Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
-
** Licensed under
|
|
5
|
+
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as fs from "node:fs"
|
|
@@ -11,6 +11,7 @@ import * as os from "node:os"
|
|
|
11
11
|
import { execa, execaSync } from "execa"
|
|
12
12
|
import which from "which"
|
|
13
13
|
import chalk from "chalk"
|
|
14
|
+
import deepmerge from "deepmerge"
|
|
14
15
|
import { Command } from "commander"
|
|
15
16
|
|
|
16
17
|
/* type for environment variable map */
|
|
@@ -223,6 +224,7 @@ const detectActiveClaudeVersion = (binName: string): string | null => {
|
|
|
223
224
|
|
|
224
225
|
/* options for the top-level command */
|
|
225
226
|
type TopOpts = {
|
|
227
|
+
ase?: boolean,
|
|
226
228
|
capsula?: boolean,
|
|
227
229
|
recolor?: boolean,
|
|
228
230
|
tmux?: boolean | string
|
|
@@ -507,7 +509,7 @@ const actionInternalTmux = (args: string[]): never => {
|
|
|
507
509
|
const claudexFlags = process.env.CLAUDEX_FLAGS ?? ""
|
|
508
510
|
const conf = fs.readFileSync(path.join(basedir, "tmux.conf"), "utf8")
|
|
509
511
|
.replace(/@SELFPATH@/g, selfPath)
|
|
510
|
-
.replace(/@
|
|
512
|
+
.replace(/@CLAUDEX_FLAGS@/g, claudexFlags)
|
|
511
513
|
const confFile = path.join(os.tmpdir(), `claudex-tmux-${process.pid}.conf`)
|
|
512
514
|
fs.writeFileSync(confFile, conf, { mode: 0o600 })
|
|
513
515
|
const r = execaSync("tmux", [
|
|
@@ -562,18 +564,24 @@ const actionInternalAseTaskEdit = async (): Promise<void> => {
|
|
|
562
564
|
}
|
|
563
565
|
}
|
|
564
566
|
|
|
565
|
-
/* action: internal "lazygit" -- spawn lazygit (recolored) */
|
|
566
|
-
const actionInternalLazygit = (args: string[]): never => {
|
|
567
|
-
ensureTool("ansi-recolor")
|
|
567
|
+
/* action: internal "lazygit" -- spawn lazygit (optionally recolored) */
|
|
568
|
+
const actionInternalLazygit = (recolor: boolean, args: string[]): never => {
|
|
568
569
|
ensureTool("git")
|
|
569
570
|
ensureTool("lazygit")
|
|
570
571
|
const env: Env = { ...process.env, TERM: "xterm-color" }
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
"-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
572
|
+
if (recolor) {
|
|
573
|
+
ensureTool("ansi-recolor")
|
|
574
|
+
return execInherit("ansi-recolor", [
|
|
575
|
+
"-c", path.join(basedir, "ansi-recolor.conf"),
|
|
576
|
+
"-m",
|
|
577
|
+
"-n", "lazygit",
|
|
578
|
+
"-t", path.join(HOME, "ansi-recolor.txt"),
|
|
579
|
+
"lazygit", "-ucf", path.join(basedir, "lazygit.yaml"),
|
|
580
|
+
...args
|
|
581
|
+
], { env })
|
|
582
|
+
}
|
|
583
|
+
return execInherit("lazygit", [
|
|
584
|
+
"-ucf", path.join(basedir, "lazygit.yaml"),
|
|
577
585
|
...args
|
|
578
586
|
], { env })
|
|
579
587
|
}
|
|
@@ -654,14 +662,14 @@ const actionInternalCapsula = (args: string[]): never => {
|
|
|
654
662
|
}
|
|
655
663
|
|
|
656
664
|
/* action: internal sub-dispatch (tmux, shell, ase-task-edit, lazygit, capsula) */
|
|
657
|
-
const actionInternal = async (args: string[]): Promise<void> => {
|
|
665
|
+
const actionInternal = async (opts: TopOpts, args: string[]): Promise<void> => {
|
|
658
666
|
const util = args[0]
|
|
659
667
|
const rest = args.slice(1)
|
|
660
668
|
switch (util) {
|
|
661
669
|
case "tmux": return actionInternalTmux(rest)
|
|
662
670
|
case "shell": return actionInternalShell(rest)
|
|
663
671
|
case "ase-task-edit": return actionInternalAseTaskEdit()
|
|
664
|
-
case "lazygit": return actionInternalLazygit(rest)
|
|
672
|
+
case "lazygit": return actionInternalLazygit(opts.recolor === true, rest)
|
|
665
673
|
case "capsula": return actionInternalCapsula(rest)
|
|
666
674
|
default:
|
|
667
675
|
fatal(`invalid internal command "${util ?? ""}"`)
|
|
@@ -670,11 +678,13 @@ const actionInternal = async (args: string[]): Promise<void> => {
|
|
|
670
678
|
|
|
671
679
|
/* action: top-level command -- run "claude" */
|
|
672
680
|
const actionDefault = (opts: TopOpts, args: string[]): never => {
|
|
673
|
-
/* build the inner self-invocation flag list. Pass-through "-R" only,
|
|
681
|
+
/* build the inner self-invocation flag list. Pass-through "-R"/"-A" only,
|
|
674
682
|
as "-C" and "-T" are consumed at the outer layer to avoid recursion. */
|
|
675
683
|
const innerFlags: string[] = []
|
|
676
684
|
if (opts.recolor)
|
|
677
685
|
innerFlags.push("-R")
|
|
686
|
+
if (opts.ase)
|
|
687
|
+
innerFlags.push("-A")
|
|
678
688
|
|
|
679
689
|
/* branch: tmux mode (with or without capsula) */
|
|
680
690
|
if (opts.tmux) {
|
|
@@ -816,33 +826,67 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
|
|
|
816
826
|
}
|
|
817
827
|
|
|
818
828
|
/* override ASE configuration (for its diagram rendering) */
|
|
819
|
-
if (
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
829
|
+
if (opts.ase) {
|
|
830
|
+
if (process.env.ASE_TERM_WIDTH === undefined) {
|
|
831
|
+
let width = 0
|
|
832
|
+
if (process.stdout.isTTY) {
|
|
833
|
+
const cols = process.stdout.columns
|
|
834
|
+
if (typeof cols === "number" && cols > 0)
|
|
835
|
+
width = cols
|
|
836
|
+
}
|
|
837
|
+
process.env.ASE_TERM_WIDTH = `${width}`
|
|
825
838
|
}
|
|
826
|
-
process.env.
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
try {
|
|
831
|
-
const { stdout } = execaSync("tput", [ "colors" ], { reject: false })
|
|
832
|
-
const n = parseInt(stdout.trim(), 10)
|
|
833
|
-
if (!Number.isNaN(n) && n >= 256)
|
|
839
|
+
if (process.env.ASE_TERM_COLORS === undefined) {
|
|
840
|
+
let colorMode = "none"
|
|
841
|
+
const depth = process.stdout.getColorDepth()
|
|
842
|
+
if (depth >= 8)
|
|
834
843
|
colorMode = "ansi256"
|
|
835
|
-
else if (
|
|
844
|
+
else if (depth >= 4)
|
|
836
845
|
colorMode = "ansi16"
|
|
846
|
+
process.env.ASE_TERM_COLORS = `${colorMode}`
|
|
837
847
|
}
|
|
838
|
-
|
|
839
|
-
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/* determine Claude Code settings */
|
|
851
|
+
let claudeSettings = {
|
|
852
|
+
"env": {
|
|
853
|
+
"DISABLE_TELEMETRY": "1",
|
|
854
|
+
"DISABLE_AUTOUPDATER": "1",
|
|
855
|
+
"DISABLE_BUG_COMMAND": "1",
|
|
856
|
+
"DISABLE_ERROR_REPORTING": "1"
|
|
857
|
+
},
|
|
858
|
+
"verbose": false,
|
|
859
|
+
"spinnerTipsEnabled": false,
|
|
860
|
+
"spinnerVerbs": {
|
|
861
|
+
"mode": "replace",
|
|
862
|
+
"verbs": [
|
|
863
|
+
"Working",
|
|
864
|
+
"Working (Just be patient)"
|
|
865
|
+
]
|
|
840
866
|
}
|
|
841
|
-
|
|
867
|
+
} as Record<string, unknown>
|
|
868
|
+
if (opts.ase) {
|
|
869
|
+
claudeSettings = deepmerge(claudeSettings, {
|
|
870
|
+
"statusLine": {
|
|
871
|
+
"type": "command",
|
|
872
|
+
"command": "ase statusline -w 0 -m 2 '<blue>%u</blue> <red>%p</red> <black>%T</black> %s' '%m %e %t' '%P %c'",
|
|
873
|
+
"padding": 0
|
|
874
|
+
}
|
|
875
|
+
})
|
|
876
|
+
}
|
|
877
|
+
if (opts.tmux) {
|
|
878
|
+
claudeSettings = deepmerge(claudeSettings, {
|
|
879
|
+
"env": {
|
|
880
|
+
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
|
|
881
|
+
},
|
|
882
|
+
"teammateMode": "tmux",
|
|
883
|
+
"preferences": {
|
|
884
|
+
"tmuxSplitPanes": true
|
|
885
|
+
}
|
|
886
|
+
})
|
|
842
887
|
}
|
|
843
888
|
|
|
844
889
|
/* execute "claude" */
|
|
845
|
-
const settings = fs.readFileSync(path.join(basedir, "claude-settings.json"), "utf8")
|
|
846
890
|
const claudeBin = path.join(HOME, ".local/bin/claude")
|
|
847
891
|
if (recolor) {
|
|
848
892
|
return execInherit("ansi-recolor", [
|
|
@@ -851,13 +895,13 @@ const actionDefault = (opts: TopOpts, args: string[]): never => {
|
|
|
851
895
|
"-n", "claude",
|
|
852
896
|
"-t", path.join(HOME, "ansi-recolor.txt"),
|
|
853
897
|
claudeBin,
|
|
854
|
-
"--settings",
|
|
898
|
+
"--settings", JSON.stringify(claudeSettings),
|
|
855
899
|
...args
|
|
856
900
|
], { env })
|
|
857
901
|
}
|
|
858
902
|
else {
|
|
859
903
|
return execInherit(claudeBin, [
|
|
860
|
-
"--settings",
|
|
904
|
+
"--settings", JSON.stringify(claudeSettings),
|
|
861
905
|
...args
|
|
862
906
|
], { env })
|
|
863
907
|
}
|
|
@@ -876,8 +920,9 @@ const actionHelp = (): never => {
|
|
|
876
920
|
"\n" +
|
|
877
921
|
"claudeX extension options (honored before claude):\n" +
|
|
878
922
|
" -C, --capsula execute Claude Code inside a Capsula sandbox container\n" +
|
|
879
|
-
" -R, --recolor wrap Claude Code with ANSI recoloring for improved theming\n" +
|
|
880
923
|
" -T, --tmux [session] wrap Claude Code in a Tmux terminal multiplexing session (optional session name)\n" +
|
|
924
|
+
" -R, --recolor wrap Claude Code with ANSI recoloring for improved theming\n" +
|
|
925
|
+
" -A, --ase enable ASE-specific Claude Code statusline and ASE_* environment variables\n" +
|
|
881
926
|
"\n" +
|
|
882
927
|
"claudeX extension subcommands (honored before claude):\n" +
|
|
883
928
|
" install install host-side or in-container dependencies\n" +
|
|
@@ -910,8 +955,9 @@ const main = async (): Promise<void> => {
|
|
|
910
955
|
.allowUnknownOption()
|
|
911
956
|
.helpOption(false)
|
|
912
957
|
.option("-C, --capsula", "execute Claude Code inside a Capsula sandbox container")
|
|
913
|
-
.option("-R, --recolor", "wrap Claude Code with ANSI recoloing for improved theming")
|
|
914
958
|
.option("-T, --tmux [session]", "wrap Claude Code in a Tmux terminal multiplexing session (optional session name)")
|
|
959
|
+
.option("-R, --recolor", "wrap Claude Code with ANSI recoloing for improved theming")
|
|
960
|
+
.option("-A, --ase", "enable ASE-specific Claude Code statusline and ASE_* environment variables")
|
|
915
961
|
.argument("[args...]", "arguments passed unparsed to Claude Code")
|
|
916
962
|
.action((args: string[], opts: TopOpts) => {
|
|
917
963
|
actionDefault(opts, args)
|
|
@@ -944,8 +990,9 @@ const main = async (): Promise<void> => {
|
|
|
944
990
|
.helpOption("-h, --help", "display help for command")
|
|
945
991
|
.allowUnknownOption()
|
|
946
992
|
.argument("[args...]", "internal command name and its arguments")
|
|
947
|
-
.action(async (args: string[]) => {
|
|
948
|
-
|
|
993
|
+
.action(async (args: string[], _opts: object, cmd: Command) => {
|
|
994
|
+
const opts = (cmd.parent?.opts() ?? {}) as TopOpts
|
|
995
|
+
await actionInternal(opts, args)
|
|
949
996
|
})
|
|
950
997
|
|
|
951
998
|
await program.parseAsync(process.argv)
|
package/eslint.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** claudeX -- Claude Code eXtended
|
|
3
3
|
** Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
-
** Licensed under
|
|
4
|
+
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import pluginJs from "@eslint/js"
|
package/lazygit.yaml
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rse/claudex",
|
|
3
3
|
"publishConfig": { "access": "public" },
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.16",
|
|
5
5
|
"description": "Claude Code eXtended",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [ "claude", "code", "extension", "wrapper" ],
|
|
8
8
|
"homepage": "http://github.com/rse/claudex",
|
|
9
9
|
"repository": { "url": "git+https://github.com/rse/claudex.git", "type": "git" },
|
|
10
10
|
"bugs": { "url": "http://github.com/rse/claudex/issues" },
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "GPL-3.0",
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Dr. Ralf S. Engelschall",
|
|
14
14
|
"email": "rse@engelschall.com",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"which": "7.0.0",
|
|
20
20
|
"execa": "9.6.1",
|
|
21
21
|
"chalk": "5.6.2",
|
|
22
|
-
"commander": "14.0.3"
|
|
22
|
+
"commander": "14.0.3",
|
|
23
|
+
"deepmerge": "4.3.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"typescript": "6.0.3",
|
package/stx.conf
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
##
|
|
2
2
|
## claudeX -- Claude Code eXtended
|
|
3
3
|
## Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
-
## Licensed under
|
|
4
|
+
## Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
5
5
|
##
|
|
6
6
|
|
|
7
7
|
# build entire project
|
package/tmux.conf
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
##
|
|
2
|
-
##
|
|
3
|
-
## Copyright (c)
|
|
4
|
-
##
|
|
5
|
-
##
|
|
6
|
-
## ~/.tmux.conf: tmux(1) configuration
|
|
2
|
+
## claudeX -- Claude Code eXtended
|
|
3
|
+
## Copyright (c) 2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
|
+
## Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
7
5
|
##
|
|
8
6
|
|
|
9
7
|
# switch prefix key to CTRL+a like screen(1)
|
|
@@ -198,10 +196,10 @@ set-option -as terminal-overrides ",*:RGB"
|
|
|
198
196
|
set-option -as terminal-overrides ',*:Tc:sitm=\E[3m:ritm=\E[23m'
|
|
199
197
|
|
|
200
198
|
# claudeX runtime bind-keys (@SELFPATH@ and @CLAUDEXFLAGS@ are substituted at launch)
|
|
201
|
-
bind-key c new-window -c "#{pane_current_path}" -n claude "@SELFPATH@ @
|
|
202
|
-
bind-key | split-window -c "#{pane_current_path}" -h "@SELFPATH@ @
|
|
203
|
-
bind-key - split-window -c "#{pane_current_path}" -v "@SELFPATH@ @
|
|
204
|
-
bind-key g display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Version Control (lazygit) #[noreverse]▶" "@SELFPATH@ internal lazygit"
|
|
205
|
-
bind-key s display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Shell #[noreverse]▶" "@SELFPATH@ internal shell"
|
|
206
|
-
bind-key q display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Task Edit (ase task edit) #[noreverse]▶" "@SELFPATH@ internal ase-task-edit"
|
|
199
|
+
bind-key c new-window -c "#{pane_current_path}" -n claude "@SELFPATH@ @CLAUDEX_FLAGS@"
|
|
200
|
+
bind-key | split-window -c "#{pane_current_path}" -h "@SELFPATH@ @CLAUDEX_FLAGS@"
|
|
201
|
+
bind-key - split-window -c "#{pane_current_path}" -v "@SELFPATH@ @CLAUDEX_FLAGS@"
|
|
202
|
+
bind-key g display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Version Control (lazygit) #[noreverse]▶" "@SELFPATH@ @CLAUDEX_FLAGS@ internal lazygit"
|
|
203
|
+
bind-key s display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Shell #[noreverse]▶" "@SELFPATH@ @CLAUDEX_FLAGS@ internal shell"
|
|
204
|
+
bind-key q display-popup -E -w 95% -h 95% -T "─◀#[reverse] ⧉ Task Edit (ase task edit) #[noreverse]▶" "@SELFPATH@ @CLAUDEX_FLAGS@ internal ase-task-edit"
|
|
207
205
|
|