@alexgreensh/token-optimizer 5.13.57 → 5.13.60
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/hooks/hooks.json +16 -16
- package/hooks/python-launcher.sh +10 -0
- package/hooks/stop_runner.py +27 -4
- package/hooks/windows-launcher.py +57 -3
- package/package.json +1 -1
- package/skills/fleet-auditor/scripts/shared.py +29 -1
- package/skills/token-optimizer/pricing/prices.json +13 -1
- package/skills/token-optimizer/scripts/codex_doctor.py +78 -1
- package/skills/token-optimizer/scripts/codex_install.py +379 -41
- package/skills/token-optimizer/scripts/codex_session.py +38 -8
- package/skills/token-optimizer/scripts/copilot_doctor.py +129 -6
- package/skills/token-optimizer/scripts/copilot_hook_bridge.py +62 -14
- package/skills/token-optimizer/scripts/copilot_install.py +56 -4
- package/skills/token-optimizer/scripts/detectors/cache_instability.py +18 -4
- package/skills/token-optimizer/scripts/deterministic_candidates.py +55 -15
- package/skills/token-optimizer/scripts/devin_source.py +1 -1
- package/skills/token-optimizer/scripts/hermes_doctor.py +258 -16
- package/skills/token-optimizer/scripts/hermes_hook_bridge.py +229 -9
- package/skills/token-optimizer/scripts/hermes_install.py +43 -0
- package/skills/token-optimizer/scripts/hermes_session.py +133 -0
- package/skills/token-optimizer/scripts/hermes_state.py +76 -9
- package/skills/token-optimizer/scripts/hermes_tool_hooks.py +291 -0
- package/skills/token-optimizer/scripts/measure.py +1340 -321
- package/skills/token-optimizer/scripts/plugin_env.py +18 -0
- package/skills/token-optimizer/scripts/recovery_output.py +15 -2
- package/skills/token-optimizer/scripts/refetch_fingerprint.py +36 -1
- package/skills/token-optimizer/scripts/runtime_env.py +5 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"name": "token-optimizer",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.",
|
|
16
|
-
"version": "5.13.
|
|
16
|
+
"version": "5.13.60",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Alex Greenshpun",
|
|
19
19
|
"url": "https://linkedin.com/in/alexgreensh"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"name": "token-optimizer-cowork",
|
|
56
56
|
"source": "./cowork/token-optimizer",
|
|
57
57
|
"description": "Token Optimizer for Claude Cowork \u2014 full skills + Cowork-native hooks (beta). Install THIS in Cowork; the standard token-optimizer entry is for desktop Claude Code.",
|
|
58
|
-
"version": "5.13.
|
|
58
|
+
"version": "5.13.60",
|
|
59
59
|
"author": {
|
|
60
60
|
"name": "Alex Greenshpun",
|
|
61
61
|
"url": "https://linkedin.com/in/alexgreensh"
|
package/hooks/hooks.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"hooks": [
|
|
10
10
|
{
|
|
11
11
|
"type": "command",
|
|
12
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
12
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/read_cache.py --quiet; done; exit 0",
|
|
13
13
|
"timeout": 10
|
|
14
14
|
}
|
|
15
15
|
]
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"hooks": [
|
|
20
20
|
{
|
|
21
21
|
"type": "command",
|
|
22
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
22
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/bash_hook.py --quiet; done; exit 0",
|
|
23
23
|
"timeout": 10
|
|
24
24
|
}
|
|
25
25
|
]
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"hooks": [
|
|
30
30
|
{
|
|
31
31
|
"type": "command",
|
|
32
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
32
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/measure.py checkpoint-trigger --milestone pre-fanout --quiet; done; exit 0",
|
|
33
33
|
"async": true,
|
|
34
34
|
"timeout": 20
|
|
35
35
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"hooks": [
|
|
41
41
|
{
|
|
42
42
|
"type": "command",
|
|
43
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
43
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/refetch_guard.py --quiet; done; exit 0",
|
|
44
44
|
"timeout": 10
|
|
45
45
|
}
|
|
46
46
|
]
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"hooks": [
|
|
52
52
|
{
|
|
53
53
|
"type": "command",
|
|
54
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
54
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/measure.py dynamic-compact-instructions --quiet; done; exit 0",
|
|
55
55
|
"timeout": 20
|
|
56
56
|
}
|
|
57
57
|
]
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"hooks": [
|
|
61
61
|
{
|
|
62
62
|
"type": "command",
|
|
63
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
63
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/measure.py compact-capture --trigger auto --quiet; done; exit 0",
|
|
64
64
|
"async": true,
|
|
65
65
|
"timeout": 30
|
|
66
66
|
}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"hooks": [
|
|
71
71
|
{
|
|
72
72
|
"type": "command",
|
|
73
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
73
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0",
|
|
74
74
|
"timeout": 10
|
|
75
75
|
}
|
|
76
76
|
]
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"hooks": [
|
|
82
82
|
{
|
|
83
83
|
"type": "command",
|
|
84
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
84
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/sessionstart_runner.py; done; exit 0",
|
|
85
85
|
"timeout": 20
|
|
86
86
|
}
|
|
87
87
|
]
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"hooks": [
|
|
93
93
|
{
|
|
94
94
|
"type": "command",
|
|
95
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
95
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/stop_runner.py; done; exit 0",
|
|
96
96
|
"timeout": 15
|
|
97
97
|
}
|
|
98
98
|
]
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"hooks": [
|
|
104
104
|
{
|
|
105
105
|
"type": "command",
|
|
106
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
106
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/stop_runner.py; done; exit 0",
|
|
107
107
|
"async": true,
|
|
108
108
|
"timeout": 60
|
|
109
109
|
}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"hooks": [
|
|
116
116
|
{
|
|
117
117
|
"type": "command",
|
|
118
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
118
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/measure.py compact-capture --trigger stop-failure --quiet; done; exit 0",
|
|
119
119
|
"timeout": 12
|
|
120
120
|
}
|
|
121
121
|
]
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"hooks": [
|
|
127
127
|
{
|
|
128
128
|
"type": "command",
|
|
129
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
129
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/userpromptsubmit_runner.py; done; exit 0",
|
|
130
130
|
"timeout": 20
|
|
131
131
|
}
|
|
132
132
|
]
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"hooks": [
|
|
139
139
|
{
|
|
140
140
|
"type": "command",
|
|
141
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
141
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/posttooluse_runner.py; done; exit 0",
|
|
142
142
|
"timeout": 10
|
|
143
143
|
}
|
|
144
144
|
]
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"hooks": [
|
|
151
151
|
{
|
|
152
152
|
"type": "command",
|
|
153
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
153
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" hooks/posttooluse_runner.py; done; exit 0",
|
|
154
154
|
"timeout": 10
|
|
155
155
|
}
|
|
156
156
|
]
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"hooks": [
|
|
162
162
|
{
|
|
163
163
|
"type": "command",
|
|
164
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
164
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/measure.py quality-cache --force --quiet; done; exit 0",
|
|
165
165
|
"timeout": 20
|
|
166
166
|
}
|
|
167
167
|
]
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"hooks": [
|
|
173
173
|
{
|
|
174
174
|
"type": "command",
|
|
175
|
-
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D
|
|
175
|
+
"command": "for b in bash /bin/bash /usr/bin/bash /usr/local/bin/bash /opt/homebrew/bin/bash; do command -v \"$b\" >/dev/null 2>&1 || continue; D=\"${CLAUDE_PLUGIN_ROOT}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || D=\"$(ls -d \"${D%[/\\\\]*}\"/*/ 2>/dev/null | grep -E \"/[0-9]+[.][0-9]+[.][0-9]+/$\" | sort -V | tail -n1)\"; D=\"${D%/}\"; [ -r \"$D/hooks/python-launcher.sh\" ] || exit 0; exec \"$b\" \"$D/hooks/python-launcher.sh\" \"$D/hooks/run.py\" skills/token-optimizer/scripts/read_cache.py --clear --quiet; done; exit 0",
|
|
176
176
|
"timeout": 10
|
|
177
177
|
}
|
|
178
178
|
]
|
package/hooks/python-launcher.sh
CHANGED
|
@@ -187,6 +187,16 @@ _is_safe_prefix() {
|
|
|
187
187
|
# managers are enumerated here. (mise pattern, trekie86.)
|
|
188
188
|
/[a-zA-Z]/Users/*/AppData/Local/mise/shims/*) return 0 ;;
|
|
189
189
|
/[a-zA-Z]/Users/*/.pyenv/pyenv-win/shims/*) return 0 ;;
|
|
190
|
+
# Default per-user installs of conda, Scoop and uv-managed Pythons,
|
|
191
|
+
# and the all-users conda dirs under ProgramData (admin-writable).
|
|
192
|
+
# Same trust tier as AppData/Local/Programs/Python above: without
|
|
193
|
+
# them every hook exited 0 doing nothing for these users.
|
|
194
|
+
/[a-zA-Z]/Users/*/miniconda3/*|/[a-zA-Z]/Users/*/anaconda3/*) return 0 ;;
|
|
195
|
+
/[a-zA-Z]/Users/*/miniforge3/*|/[a-zA-Z]/Users/*/mambaforge/*) return 0 ;;
|
|
196
|
+
/[a-zA-Z]/ProgramData/miniconda3/*|/[a-zA-Z]/ProgramData/anaconda3/*) return 0 ;;
|
|
197
|
+
/[a-zA-Z]/Users/*/scoop/apps/python+([0-9])/*) return 0 ;;
|
|
198
|
+
/[a-zA-Z]/Users/*/scoop/apps/python/*) return 0 ;;
|
|
199
|
+
/[a-zA-Z]/Users/*/AppData/Roaming/uv/python/*) return 0 ;;
|
|
190
200
|
# All-users `py` launcher lives in the (admin-only-writable) Windows dir.
|
|
191
201
|
# Exact filename keeps the anti-hijack intent (no wildcard in that dir).
|
|
192
202
|
/[a-zA-Z]/Windows/py.exe) return 0 ;;
|
package/hooks/stop_runner.py
CHANGED
|
@@ -125,6 +125,23 @@ def _read_hook_input() -> dict:
|
|
|
125
125
|
return {}
|
|
126
126
|
|
|
127
127
|
|
|
128
|
+
def _record_payload_shape(hook_input: dict) -> None:
|
|
129
|
+
"""Remember WHICH identity fields the host sent this Stop hook (never their
|
|
130
|
+
values), so the doctor can tell "host sent nothing" from "we lost it"
|
|
131
|
+
(issue #278). Best effort."""
|
|
132
|
+
try:
|
|
133
|
+
def has(key):
|
|
134
|
+
return "yes" if isinstance(hook_input.get(key), str) and hook_input.get(key) else "no"
|
|
135
|
+
measure._record_hook_status(
|
|
136
|
+
"stop_payload",
|
|
137
|
+
f"stdin fields: {len(hook_input)}; session_id={has('session_id')}; "
|
|
138
|
+
f"transcript_path={has('transcript_path')}; "
|
|
139
|
+
f"CODEX_THREAD_ID env={'yes' if os.environ.get('CODEX_THREAD_ID') else 'no'}",
|
|
140
|
+
)
|
|
141
|
+
except Exception:
|
|
142
|
+
pass
|
|
143
|
+
|
|
144
|
+
|
|
128
145
|
def _is_session_end(hook_input: dict) -> bool:
|
|
129
146
|
"""True when the firing hook is SessionEnd, not Stop.
|
|
130
147
|
|
|
@@ -292,10 +309,15 @@ def _sub_session_end_flush_stop(hook_input: dict) -> None:
|
|
|
292
309
|
budget = _runner_budget(8)
|
|
293
310
|
if budget < 0.1:
|
|
294
311
|
return
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
)
|
|
312
|
+
args = ["session-end-flush", "--trigger", "stop", "--quiet", "--defer"]
|
|
313
|
+
# The deferred worker has no stdin, so hand it the session identity the
|
|
314
|
+
# host gave THIS hook; without it the worker can only guess and (on Codex)
|
|
315
|
+
# wrote an "unknown" placeholder checkpoint (issue #278).
|
|
316
|
+
for flag, key in (("--session-id", "session_id"), ("--transcript-path", "transcript_path")):
|
|
317
|
+
value = hook_input.get(key)
|
|
318
|
+
if isinstance(value, str) and value and len(value) <= 4096 and "\x00" not in value:
|
|
319
|
+
args += [flag, value]
|
|
320
|
+
measure._dispatch_session_end_flush(args, budget_seconds=budget)
|
|
299
321
|
|
|
300
322
|
|
|
301
323
|
def _sub_keepwarm_arm(hook_input: dict) -> None:
|
|
@@ -345,6 +367,7 @@ def main() -> int:
|
|
|
345
367
|
try:
|
|
346
368
|
hook_input = _read_hook_input()
|
|
347
369
|
is_session_end = _is_session_end(hook_input)
|
|
370
|
+
_record_payload_shape(hook_input)
|
|
348
371
|
|
|
349
372
|
# ONE shared HookDeadline for the entire runner. The budget differs by
|
|
350
373
|
# event: 13s for Stop (under the 15s declared timeout), 58s for SessionEnd
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Token Optimizer Windows launcher for Codex hooks.
|
|
3
3
|
|
|
4
|
-
Codex spawns ``command`` hooks through
|
|
5
|
-
|
|
4
|
+
Codex spawns ``command`` hooks through the session shell on native Windows
|
|
5
|
+
(PowerShell, ``-NoProfile -Command``) and falls back to ``%COMSPEC% /C``
|
|
6
|
+
(cmd.exe) when it has none, so the generated command is written to parse the
|
|
7
|
+
same in both (issue #278). cmd.exe parses a /C command line ONCE, before
|
|
8
|
+
anything on it runs:
|
|
6
9
|
``%VAR%`` expands to the pre-line value and ``setlocal
|
|
7
10
|
EnableDelayedExpansion`` only takes effect from the NEXT line, so no cmd
|
|
8
11
|
expansion form can carry a resolved marketplace version into the runner
|
|
@@ -28,9 +31,19 @@ Invocation contract (generated by codex_install._windows_launcher_command):
|
|
|
28
31
|
* ``--baked-root`` is the install dir the command was generated from. It is
|
|
29
32
|
the fail-open fallback only: the launcher rescans its sibling version
|
|
30
33
|
dirs on every run and runs the NEWEST semver install, so hooks keep
|
|
31
|
-
working after a marketplace upgrade prunes the baked one.
|
|
34
|
+
working after a marketplace upgrade prunes the baked one. A relative
|
|
35
|
+
value (just the version name) is taken relative to this file's folder.
|
|
36
|
+
* When the launcher path holds ``$`` or ``%`` (for example in the Windows user
|
|
37
|
+
name), the command starts it as ``python.exe -c "import os,runpy;
|
|
38
|
+
runpy.run_path(os.path.join(os.environ['USERPROFILE'],...))"``: plain
|
|
39
|
+
source that reads the folder from the environment, so neither shell ever
|
|
40
|
+
sees the character.
|
|
41
|
+
* PowerShell 5.1 may drop the bare ``--`` before a native program sees it;
|
|
42
|
+
the parser below already treats the first unknown token as the script.
|
|
32
43
|
* ``--env KEY=VALUE`` applies per-hook environment (e.g.
|
|
33
44
|
TOKEN_OPTIMIZER_NO_UPDATED_TOOL_OUTPUT=1) before dispatch.
|
|
45
|
+
``--env TOKEN_OPTIMIZER_HOOK_SILENT=1`` is not forwarded: it sends the
|
|
46
|
+
hook's stdout/stderr to the null device, in place of a shell ``>NUL``.
|
|
34
47
|
* Everything after ``--`` is forwarded verbatim: ``sys.argv`` for the
|
|
35
48
|
runner becomes ``[run.py, script, *args]`` and stdin passes through
|
|
36
49
|
untouched. A trailing token equal to the generated-command ownership
|
|
@@ -96,11 +109,38 @@ def _parse(argv: list[str]) -> tuple[str, list[str], str, list[str]]:
|
|
|
96
109
|
return baked_root, env, rest[0], rest[1:]
|
|
97
110
|
|
|
98
111
|
|
|
112
|
+
_SILENT_ENV = "TOKEN_OPTIMIZER_HOOK_SILENT"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _silence_output() -> None:
|
|
116
|
+
"""Point fds 1 and 2 (and the Python streams) at the null device."""
|
|
117
|
+
try:
|
|
118
|
+
sys.stdout.flush()
|
|
119
|
+
sys.stderr.flush()
|
|
120
|
+
except (OSError, ValueError):
|
|
121
|
+
pass
|
|
122
|
+
try:
|
|
123
|
+
null = os.open(os.devnull, os.O_WRONLY)
|
|
124
|
+
os.dup2(null, 1)
|
|
125
|
+
os.dup2(null, 2)
|
|
126
|
+
os.close(null)
|
|
127
|
+
except OSError:
|
|
128
|
+
pass
|
|
129
|
+
|
|
130
|
+
|
|
99
131
|
def main(argv: list[str] | None = None) -> None:
|
|
100
132
|
baked_root, env_pairs, script, args = _parse(
|
|
101
133
|
sys.argv[1:] if argv is None else argv
|
|
102
134
|
)
|
|
103
135
|
root = Path(baked_root)
|
|
136
|
+
# A bare version name ("5.13.59") is relative to this file's own folder.
|
|
137
|
+
# The generator writes that form only when the full path holds a character
|
|
138
|
+
# PowerShell or cmd.exe would expand, and then starts this file through a
|
|
139
|
+
# ``python -c`` bootstrap that reads the folder from the environment
|
|
140
|
+
# (issue #278).
|
|
141
|
+
here = globals().get("__file__")
|
|
142
|
+
if not root.is_absolute() and here:
|
|
143
|
+
root = Path(here).parent / root
|
|
104
144
|
baked = root
|
|
105
145
|
# Resolve the newest semver sibling of the install parent; on any
|
|
106
146
|
# listing failure keep the baked install (fail-open, same contract the
|
|
@@ -117,6 +157,9 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
117
157
|
# opens with real content: an unreadable, missing, or incomplete
|
|
118
158
|
# candidate is skipped (not fatal), and a genuine ACL denial is honored.
|
|
119
159
|
try:
|
|
160
|
+
if not _SEMVER_DIR_RE.fullmatch(root.name):
|
|
161
|
+
# A development checkout is pinned: never trade it for a sibling.
|
|
162
|
+
raise OSError("not a versioned install")
|
|
120
163
|
candidates = sorted(
|
|
121
164
|
(p for p in root.parent.iterdir()
|
|
122
165
|
if _SEMVER_DIR_RE.fullmatch(p.name)),
|
|
@@ -149,10 +192,21 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
149
192
|
pass
|
|
150
193
|
os.environ["TOKEN_OPTIMIZER_RUNTIME"] = "codex"
|
|
151
194
|
os.environ["TOKEN_OPTIMIZER_RUNTIME_ROOT"] = str(root)
|
|
195
|
+
# Per-hook "no output" request: replaces the ">NUL 2>&1" redirect, which
|
|
196
|
+
# PowerShell and cmd.exe do not spell the same way (issue #278). Carried
|
|
197
|
+
# as an --env pair so a launcher older than this one still parses the
|
|
198
|
+
# command (it just stays noisy). Consumed here, never set in the runner's
|
|
199
|
+
# environment.
|
|
200
|
+
silent = False
|
|
152
201
|
for pair in env_pairs:
|
|
153
202
|
key, sep, value = pair.partition("=")
|
|
203
|
+
if key == _SILENT_ENV:
|
|
204
|
+
silent = silent or value == "1"
|
|
205
|
+
continue
|
|
154
206
|
if sep and key: # skip malformed pairs rather than breaking the hook
|
|
155
207
|
os.environ[key] = value
|
|
208
|
+
if silent:
|
|
209
|
+
_silence_output()
|
|
156
210
|
runner = root / "hooks" / "run.py"
|
|
157
211
|
sys.argv = [str(runner), script, *args]
|
|
158
212
|
sys.path.insert(0, str(runner.parent))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexgreensh/token-optimizer",
|
|
3
|
-
"version": "5.13.
|
|
3
|
+
"version": "5.13.60",
|
|
4
4
|
"description": "Token Optimizer for Claude Code cloud sessions: the real plugin, installed by your cloud environment's setup script.",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Alex Greenshpun (https://linkedin.com/in/alexgreensh)",
|
|
@@ -9,6 +9,7 @@ Zero external dependencies. Python 3.10+ (for match/case and type unions).
|
|
|
9
9
|
from __future__ import annotations # PEP 604 union syntax compat for Python 3.9
|
|
10
10
|
|
|
11
11
|
import json
|
|
12
|
+
import os
|
|
12
13
|
import re
|
|
13
14
|
import sqlite3
|
|
14
15
|
from datetime import datetime
|
|
@@ -19,7 +20,34 @@ from pathlib import Path
|
|
|
19
20
|
# ---------------------------------------------------------------------------
|
|
20
21
|
|
|
21
22
|
HOME = Path.home()
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _resolve_claude_dir() -> Path:
|
|
26
|
+
"""Claude Code's config dir, honoring CLAUDE_CONFIG_DIR (#198).
|
|
27
|
+
|
|
28
|
+
Uses Token Optimizer's runtime_env.claude_home() when it is importable (the
|
|
29
|
+
plugin layout puts it on sys.path); standalone, applies the same rules: an
|
|
30
|
+
absolute, existing, non-symlink directory wins, else ~/.claude.
|
|
31
|
+
"""
|
|
32
|
+
try:
|
|
33
|
+
from runtime_env import claude_home # type: ignore
|
|
34
|
+
return claude_home()
|
|
35
|
+
except Exception:
|
|
36
|
+
pass
|
|
37
|
+
fallback = HOME / ".claude"
|
|
38
|
+
raw = os.environ.get("CLAUDE_CONFIG_DIR", "").strip()
|
|
39
|
+
if not raw:
|
|
40
|
+
return fallback
|
|
41
|
+
try:
|
|
42
|
+
candidate = Path(raw).expanduser()
|
|
43
|
+
if candidate.is_absolute() and candidate.is_dir() and not candidate.is_symlink():
|
|
44
|
+
return candidate.resolve(strict=False)
|
|
45
|
+
except (OSError, RuntimeError):
|
|
46
|
+
pass
|
|
47
|
+
return fallback
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
CLAUDE_DIR = _resolve_claude_dir()
|
|
23
51
|
CHARS_PER_TOKEN = 4.0
|
|
24
52
|
_KNOWN_PROVIDER_PREFIXES = {
|
|
25
53
|
"anthropic", "openai", "google", "gemini", "vertex", "bedrock",
|
|
@@ -445,6 +445,12 @@
|
|
|
445
445
|
"cache_read": 0.1,
|
|
446
446
|
"cache_write": 2.5
|
|
447
447
|
},
|
|
448
|
+
"gpt-6.1-terra": {
|
|
449
|
+
"input": 1.0,
|
|
450
|
+
"output": 5.0,
|
|
451
|
+
"cache_read": 0.05,
|
|
452
|
+
"cache_write": 1.25
|
|
453
|
+
},
|
|
448
454
|
"o1": {
|
|
449
455
|
"input": 15.0,
|
|
450
456
|
"output": 60.0,
|
|
@@ -550,6 +556,12 @@
|
|
|
550
556
|
"output": 15.0,
|
|
551
557
|
"cache_read": 0.2,
|
|
552
558
|
"cache_write": 5.0
|
|
559
|
+
},
|
|
560
|
+
"gpt-6.1-terra": {
|
|
561
|
+
"input": 2.0,
|
|
562
|
+
"output": 7.5,
|
|
563
|
+
"cache_read": 0.1,
|
|
564
|
+
"cache_write": 2.5
|
|
553
565
|
}
|
|
554
566
|
},
|
|
555
567
|
"gemini": {
|
|
@@ -691,5 +703,5 @@
|
|
|
691
703
|
"cache_read": 0.4
|
|
692
704
|
}
|
|
693
705
|
},
|
|
694
|
-
"generated_at": "2026-10-
|
|
706
|
+
"generated_at": "2026-10-27T06:50:43Z"
|
|
695
707
|
}
|
|
@@ -253,7 +253,16 @@ def _stop_hook_activity_check() -> dict[str, str]:
|
|
|
253
253
|
when = entry.get("at", "unknown time")
|
|
254
254
|
result = str(entry.get("result", "unknown"))
|
|
255
255
|
level = "WARN" if result.startswith("error") else "OK"
|
|
256
|
-
|
|
256
|
+
detail = f"{when}: {result}"
|
|
257
|
+
# What the host actually sent (field presence only, never values) and
|
|
258
|
+
# whether the checkpoint could be tied to a session (issue #278).
|
|
259
|
+
for key, label in (("stop_payload", "host payload"), ("stop_capture", "checkpoint")):
|
|
260
|
+
extra = data.get(key) if isinstance(data, dict) else None
|
|
261
|
+
if isinstance(extra, dict) and extra.get("result"):
|
|
262
|
+
detail += f"; {label} ({extra.get('at', 'unknown time')}): {extra['result']}"
|
|
263
|
+
if key == "stop_capture" and str(extra["result"]).startswith("skipped"):
|
|
264
|
+
level = "WARN"
|
|
265
|
+
return _check(level, "Stop hook last run", detail)
|
|
257
266
|
|
|
258
267
|
|
|
259
268
|
def _status_line_check() -> dict[str, str]:
|
|
@@ -290,6 +299,73 @@ def _global_hook_check() -> dict[str, str]:
|
|
|
290
299
|
return _check("WARN", "Global hooks", f"no Token Optimizer hooks in {hooks_path}; run measure.py codex-install")
|
|
291
300
|
|
|
292
301
|
|
|
302
|
+
def _hook_shell_check() -> list[dict[str, str]]:
|
|
303
|
+
"""Flag Windows launcher hook commands only cmd.exe can run (issue #278).
|
|
304
|
+
|
|
305
|
+
Codex runs a command hook in the session shell, normally PowerShell, which
|
|
306
|
+
cannot parse the ``set ... &&`` prefix or a quoted first token that older
|
|
307
|
+
installs wrote. The hook then exits 1 before Token Optimizer starts.
|
|
308
|
+
"""
|
|
309
|
+
hooks_path = codex_home() / "hooks.json"
|
|
310
|
+
data, error = _load_json(hooks_path)
|
|
311
|
+
if error or not isinstance(data, dict) or not isinstance(data.get("hooks"), dict):
|
|
312
|
+
return []
|
|
313
|
+
ours = 0
|
|
314
|
+
cmd_only = 0
|
|
315
|
+
dev_only = 0
|
|
316
|
+
advices: list[str] = []
|
|
317
|
+
for groups in data["hooks"].values():
|
|
318
|
+
if not isinstance(groups, list):
|
|
319
|
+
continue
|
|
320
|
+
for group in groups:
|
|
321
|
+
if not isinstance(group, dict):
|
|
322
|
+
continue
|
|
323
|
+
group_ours = codex_install._is_token_optimizer_group(group)
|
|
324
|
+
for hook in group.get("hooks", []):
|
|
325
|
+
command = hook.get("command") if isinstance(hook, dict) else None
|
|
326
|
+
if not isinstance(command, str):
|
|
327
|
+
continue
|
|
328
|
+
# Dev-checkout installs (non-semver root) carry no launcher
|
|
329
|
+
# marker: they are `set "TOKEN_OPTIMIZER_RUNTIME=codex" && ...
|
|
330
|
+
# hooks/run.py`, cmd-only by construction.
|
|
331
|
+
dev_checkout = (command.startswith('set "TOKEN_OPTIMIZER_RUNTIME=codex" && ')
|
|
332
|
+
and re.search(r"hooks[/\\]+run\.py", command) is not None
|
|
333
|
+
and codex_install._LAUNCHER_MARKER not in command)
|
|
334
|
+
if not dev_checkout and not (group_ours and codex_install._LAUNCHER_MARKER in command):
|
|
335
|
+
continue
|
|
336
|
+
ours += 1
|
|
337
|
+
if dev_checkout:
|
|
338
|
+
dev_only += 1
|
|
339
|
+
continue
|
|
340
|
+
if not codex_install.is_shell_neutral_command(command):
|
|
341
|
+
cmd_only += 1
|
|
342
|
+
advice = codex_install.explain_cmd_only_command(command)
|
|
343
|
+
if advice and advice not in advices:
|
|
344
|
+
advices.append(advice)
|
|
345
|
+
if not ours:
|
|
346
|
+
return []
|
|
347
|
+
if dev_only and not cmd_only:
|
|
348
|
+
return [_check(
|
|
349
|
+
"WARN", "Hook shell compatibility",
|
|
350
|
+
f"{dev_only} of {ours} hook command(s) come from a development checkout and only run under cmd.exe; "
|
|
351
|
+
"Codex normally runs hooks in PowerShell, where they exit 1. To fix: run measure.py codex-install "
|
|
352
|
+
"again from the checkout (it now writes a form PowerShell runs), then restart Codex")]
|
|
353
|
+
if dev_only or cmd_only:
|
|
354
|
+
cmd_only += dev_only
|
|
355
|
+
if cmd_only:
|
|
356
|
+
# Say exactly what to change when the cause is known (an interpreter or
|
|
357
|
+
# plugin folder no PowerShell-safe spelling exists for), else the
|
|
358
|
+
# generic repair (issue #278).
|
|
359
|
+
fix = "; ".join(advices) if advices else (
|
|
360
|
+
"run any measure.py command to repair them or rerun measure.py codex-install, "
|
|
361
|
+
"then restart Codex")
|
|
362
|
+
return [_check(
|
|
363
|
+
"WARN", "Hook shell compatibility",
|
|
364
|
+
f"{cmd_only} of {ours} hook command(s) only run under cmd.exe, but Codex normally runs hooks in "
|
|
365
|
+
f"PowerShell, where they exit 1 before Token Optimizer starts. To fix: {fix}")]
|
|
366
|
+
return [_check("OK", "Hook shell compatibility", f"{ours} hook command(s) run under PowerShell and cmd.exe")]
|
|
367
|
+
|
|
368
|
+
|
|
293
369
|
def _global_hook_config_checks() -> list[dict[str, str]]:
|
|
294
370
|
hooks_path = codex_home() / "hooks.json"
|
|
295
371
|
data, error = _load_json(hooks_path)
|
|
@@ -456,6 +532,7 @@ def run_checks(project: Path | None = None) -> list[dict[str, str]]:
|
|
|
456
532
|
checks.append(_status_line_check())
|
|
457
533
|
checks.append(_global_hook_check())
|
|
458
534
|
checks.append(_stop_hook_activity_check())
|
|
535
|
+
checks.extend(_hook_shell_check())
|
|
459
536
|
checks.extend(_global_hook_config_checks())
|
|
460
537
|
checks.append(_project_hook_check(project))
|
|
461
538
|
checks.extend(_project_feature_checks(project))
|