@bash0816/claude-code 2.1.276 → 2.1.280
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/README.md +4 -1
- package/config/claude-native-audited-versions.json +148 -1
- package/config/claude-termux-release-manifest.json +3 -3
- package/lib/bunfs-esm-loader.mjs +156 -0
- package/lib/bunfs-esm-loader.test.js +885 -0
- package/lib/bunfs-extract.js +10 -1
- package/lib/bunfs-extract.test.js +36 -3
- package/lib/hooks-standalone-pattern.js +7 -0
- package/lib/hooks-standalone-pattern.test.js +115 -0
- package/lib/termux-run-claude-native.sh +24 -0
- package/lib/termux-run-claude-native.test.js +82 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ npm が `claude` bin link を管理する状態になれば、通常の `npm ins
|
|
|
37
37
|
Latest audited version / 最新監査済み版:
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
|
-
npm install -g @bash0816/claude-code@2.1.
|
|
40
|
+
npm install -g @bash0816/claude-code@2.1.278
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Update / 更新
|
|
@@ -140,6 +140,9 @@ force-enable するには `env` ブロックを使う必要があります:
|
|
|
140
140
|
{ "env": { "ENABLE_TOOL_SEARCH": "force" } }
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
+
> **お知らせ / Notice (2026-09-21)**: 2.1.276 は、特定の条件で起動しない問題があったため取り下げ、修正版 **2.1.276-1** を `latest` として公開しました。2.1.276 をお使いの場合は `npm install -g @bash0816/claude-code@latest` で更新してください。
|
|
144
|
+
> Version 2.1.276 was withdrawn because it could fail to start under certain conditions. The fixed release **2.1.276-1** is now `latest`. If you are on 2.1.276, update with `npm install -g @bash0816/claude-code@latest`.
|
|
145
|
+
|
|
143
146
|
## Policy / 方針
|
|
144
147
|
|
|
145
148
|
- Only audited versions in `config/claude-native-audited-versions.json` can run.
|
|
@@ -2091,7 +2091,7 @@
|
|
|
2091
2091
|
"entry_format": "esm-chunked",
|
|
2092
2092
|
"tarball_integrity": "sha512-/wzWD8U5mGmSoeiB99gGfvVuj/7/p7nh/zZACTuuPEwvo/CfMMvW/ZxBB6LG8w0nz6B//UOIx3ryKdGCENAPOA==",
|
|
2093
2093
|
"tarball_sha256": "d5e9f98cd9d382c907fa2dfe9420d0a53c8a781372bf7ad16de9933fe0349132",
|
|
2094
|
-
"status": "
|
|
2094
|
+
"status": "withdrawn",
|
|
2095
2095
|
"num_modules": 2093,
|
|
2096
2096
|
"byte_count": 143688478,
|
|
2097
2097
|
"cycle_hoists": [
|
|
@@ -2124,6 +2124,153 @@
|
|
|
2124
2124
|
"chart.umd.min.js",
|
|
2125
2125
|
"hljsBundle.generated.min.js",
|
|
2126
2126
|
"mermaid.min.js"
|
|
2127
|
+
],
|
|
2128
|
+
"hooks_standalone_patches": [
|
|
2129
|
+
{
|
|
2130
|
+
"file": "chunk-0sa9p840.js",
|
|
2131
|
+
"expectedOccurrences": 1
|
|
2132
|
+
}
|
|
2133
|
+
]
|
|
2134
|
+
},
|
|
2135
|
+
"2.1.278": {
|
|
2136
|
+
"wrapper_spec": "@anthropic-ai/claude-code@2.1.278",
|
|
2137
|
+
"native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.278",
|
|
2138
|
+
"entry_format": "esm-chunked",
|
|
2139
|
+
"tarball_integrity": "sha512-QAsHwRVX03nXgAA7pTdvZSLguegbAAPuLG1vY09YHhkukqD6FlkSDwYqK9XFh4up8rFjK7qrzXtokuNULP0nEg==",
|
|
2140
|
+
"tarball_sha256": "ec54bd853c9cb71cb03874d694a1a38638d350828f0d84e0492fe1734a172302",
|
|
2141
|
+
"status": "termux_verified",
|
|
2142
|
+
"num_modules": 2122,
|
|
2143
|
+
"byte_count": 145747588,
|
|
2144
|
+
"cycle_hoists": [
|
|
2145
|
+
{
|
|
2146
|
+
"file": "chunk-t5ss2xrm.js",
|
|
2147
|
+
"targetModule": "chunk-r0t3j03d.js",
|
|
2148
|
+
"expectedOccurrences": 1,
|
|
2149
|
+
"assertProperties": []
|
|
2150
|
+
},
|
|
2151
|
+
{
|
|
2152
|
+
"file": "chunk-zpmvczj2.js",
|
|
2153
|
+
"targetModule": "chunk-g8j6apa2.js",
|
|
2154
|
+
"expectedOccurrences": 1,
|
|
2155
|
+
"assertProperties": [
|
|
2156
|
+
"default"
|
|
2157
|
+
]
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
"file": "chunk-zpmvczj2.js",
|
|
2161
|
+
"targetModule": "chunk-ss2yxygh.js",
|
|
2162
|
+
"expectedOccurrences": 3,
|
|
2163
|
+
"assertProperties": [
|
|
2164
|
+
"getWorkflowCommands",
|
|
2165
|
+
"invalidateWorkflowCache",
|
|
2166
|
+
"warmWorkflows"
|
|
2167
|
+
]
|
|
2168
|
+
}
|
|
2169
|
+
],
|
|
2170
|
+
"cycle_hoists_skipped_assets": [
|
|
2171
|
+
"chart.umd.min.js",
|
|
2172
|
+
"hljsBundle.generated.min.js",
|
|
2173
|
+
"mermaid.min.js"
|
|
2174
|
+
],
|
|
2175
|
+
"hooks_standalone_patches": [
|
|
2176
|
+
{
|
|
2177
|
+
"file": "chunk-7nckpqfv.js",
|
|
2178
|
+
"expectedOccurrences": 1
|
|
2179
|
+
}
|
|
2180
|
+
]
|
|
2181
|
+
},
|
|
2182
|
+
"2.1.276-1": {
|
|
2183
|
+
"wrapper_spec": "@anthropic-ai/claude-code@2.1.276",
|
|
2184
|
+
"native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.276",
|
|
2185
|
+
"entry_format": "esm-chunked",
|
|
2186
|
+
"tarball_integrity": "sha512-/wzWD8U5mGmSoeiB99gGfvVuj/7/p7nh/zZACTuuPEwvo/CfMMvW/ZxBB6LG8w0nz6B//UOIx3ryKdGCENAPOA==",
|
|
2187
|
+
"tarball_sha256": "d5e9f98cd9d382c907fa2dfe9420d0a53c8a781372bf7ad16de9933fe0349132",
|
|
2188
|
+
"status": "termux_verified",
|
|
2189
|
+
"num_modules": 2093,
|
|
2190
|
+
"byte_count": 143688478,
|
|
2191
|
+
"cycle_hoists": [
|
|
2192
|
+
{
|
|
2193
|
+
"file": "chunk-4smm7vse.js",
|
|
2194
|
+
"targetModule": "chunk-x8xhn4zk.js",
|
|
2195
|
+
"expectedOccurrences": 1,
|
|
2196
|
+
"assertProperties": []
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
"file": "chunk-xyct5nvs.js",
|
|
2200
|
+
"targetModule": "chunk-77w3wy6j.js",
|
|
2201
|
+
"expectedOccurrences": 1,
|
|
2202
|
+
"assertProperties": [
|
|
2203
|
+
"default"
|
|
2204
|
+
]
|
|
2205
|
+
},
|
|
2206
|
+
{
|
|
2207
|
+
"file": "chunk-xyct5nvs.js",
|
|
2208
|
+
"targetModule": "chunk-692ppfcw.js",
|
|
2209
|
+
"expectedOccurrences": 3,
|
|
2210
|
+
"assertProperties": [
|
|
2211
|
+
"getWorkflowCommands",
|
|
2212
|
+
"invalidateWorkflowCache",
|
|
2213
|
+
"warmWorkflows"
|
|
2214
|
+
]
|
|
2215
|
+
}
|
|
2216
|
+
],
|
|
2217
|
+
"cycle_hoists_skipped_assets": [
|
|
2218
|
+
"chart.umd.min.js",
|
|
2219
|
+
"hljsBundle.generated.min.js",
|
|
2220
|
+
"mermaid.min.js"
|
|
2221
|
+
],
|
|
2222
|
+
"hooks_standalone_patches": [
|
|
2223
|
+
{
|
|
2224
|
+
"file": "chunk-0sa9p840.js",
|
|
2225
|
+
"expectedOccurrences": 1
|
|
2226
|
+
}
|
|
2227
|
+
]
|
|
2228
|
+
},
|
|
2229
|
+
"2.1.280": {
|
|
2230
|
+
"wrapper_spec": "@anthropic-ai/claude-code@2.1.280",
|
|
2231
|
+
"native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.280",
|
|
2232
|
+
"entry_format": "esm-chunked",
|
|
2233
|
+
"tarball_integrity": "sha512-zB4oqrFwimkV/FmBOkVxvv8iYgsuDSp7/MY8uYTns4SCE4DwdHz58X1cO1sgqLnCR96A0oU7Yirov1Uk3iGKAA==",
|
|
2234
|
+
"tarball_sha256": "4391334165ec11ed0d46c8d34634a31396bd3edaa91d7e876cf3d3e0784ba726",
|
|
2235
|
+
"status": "offset_discovered",
|
|
2236
|
+
"num_modules": 2196,
|
|
2237
|
+
"byte_count": 144664628,
|
|
2238
|
+
"cycle_hoists": [
|
|
2239
|
+
{
|
|
2240
|
+
"file": "chunk-36qn676k.js",
|
|
2241
|
+
"targetModule": "chunk-xhqav20w.js",
|
|
2242
|
+
"expectedOccurrences": 1,
|
|
2243
|
+
"assertProperties": []
|
|
2244
|
+
},
|
|
2245
|
+
{
|
|
2246
|
+
"file": "chunk-j9rfd11p.js",
|
|
2247
|
+
"targetModule": "chunk-x07ph9b2.js",
|
|
2248
|
+
"expectedOccurrences": 1,
|
|
2249
|
+
"assertProperties": [
|
|
2250
|
+
"default"
|
|
2251
|
+
]
|
|
2252
|
+
},
|
|
2253
|
+
{
|
|
2254
|
+
"file": "chunk-j9rfd11p.js",
|
|
2255
|
+
"targetModule": "chunk-241y9xw6.js",
|
|
2256
|
+
"expectedOccurrences": 3,
|
|
2257
|
+
"assertProperties": [
|
|
2258
|
+
"getWorkflowCommands",
|
|
2259
|
+
"invalidateWorkflowCache",
|
|
2260
|
+
"warmWorkflows"
|
|
2261
|
+
]
|
|
2262
|
+
}
|
|
2263
|
+
],
|
|
2264
|
+
"cycle_hoists_skipped_assets": [
|
|
2265
|
+
"chart.umd.min.js",
|
|
2266
|
+
"hljsBundle.generated.min.js",
|
|
2267
|
+
"mermaid.min.js"
|
|
2268
|
+
],
|
|
2269
|
+
"hooks_standalone_patches": [
|
|
2270
|
+
{
|
|
2271
|
+
"file": "chunk-rh3bvkdy.js",
|
|
2272
|
+
"expectedOccurrences": 1
|
|
2273
|
+
}
|
|
2127
2274
|
]
|
|
2128
2275
|
}
|
|
2129
2276
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 1,
|
|
3
3
|
"package_name": "@bash0816/claude-code",
|
|
4
|
-
"latest_audited_version": "2.1.
|
|
5
|
-
"latest_candidate_version": "2.1.
|
|
6
|
-
"previous_stable_version": "2.1.
|
|
4
|
+
"latest_audited_version": "2.1.278",
|
|
5
|
+
"latest_candidate_version": "2.1.280",
|
|
6
|
+
"previous_stable_version": "2.1.276-1",
|
|
7
7
|
"stable_pinned_version": "2.1.220-2",
|
|
8
8
|
"manifest_url": "https://raw.githubusercontent.com/bash0816/ClaudeCode-Termux/main/config/claude-termux-release-manifest.json"
|
|
9
9
|
}
|
package/lib/bunfs-esm-loader.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { createRequire, syncBuiltinESMExports } from 'node:module';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
|
+
const { countQleMatches, applyQlePatch } = require('./hooks-standalone-pattern.js');
|
|
7
8
|
|
|
8
9
|
let PROCESS_OWNED_DIR = null;
|
|
9
10
|
let SOURCE_BIN = null;
|
|
@@ -13,6 +14,10 @@ let WS_STUB_PATH = null;
|
|
|
13
14
|
|
|
14
15
|
let CYCLE_HOISTS = [];
|
|
15
16
|
|
|
17
|
+
let HOOKS_METADATA = { status: 'field-absent', patches: [] };
|
|
18
|
+
let hooksLayerState = null;
|
|
19
|
+
let hooksFallbackWarned = false;
|
|
20
|
+
|
|
16
21
|
let REEXTRACT = null;
|
|
17
22
|
let reExtractConsecFailures = 0;
|
|
18
23
|
let lastReExtractMs = 0;
|
|
@@ -52,6 +57,31 @@ function resolveBunfsPath(id) {
|
|
|
52
57
|
return real;
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
function normalizeHooksMetadata(m) {
|
|
61
|
+
if (!m || typeof m !== 'object') {
|
|
62
|
+
return { status: 'field-absent', patches: [] };
|
|
63
|
+
}
|
|
64
|
+
let status = m.status;
|
|
65
|
+
if (!['ok', 'field-absent', 'entry-missing', 'read-failed'].includes(status)) {
|
|
66
|
+
status = 'read-failed';
|
|
67
|
+
}
|
|
68
|
+
let patches = m.patches;
|
|
69
|
+
if (!Array.isArray(patches)) {
|
|
70
|
+
if (status === 'ok') {
|
|
71
|
+
return { status: 'field-absent', patches: [] };
|
|
72
|
+
}
|
|
73
|
+
patches = [];
|
|
74
|
+
}
|
|
75
|
+
return { status, patches };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function warnOnce(message) {
|
|
79
|
+
if (!hooksFallbackWarned) {
|
|
80
|
+
console.error('[claude-code] ' + message);
|
|
81
|
+
hooksFallbackWarned = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
55
85
|
export function initialize(data) {
|
|
56
86
|
PROCESS_OWNED_DIR = data.processOwnedDir;
|
|
57
87
|
SOURCE_BIN = data.sourceBin;
|
|
@@ -60,6 +90,9 @@ export function initialize(data) {
|
|
|
60
90
|
WS_STUB_PATH = data.wsStubPath;
|
|
61
91
|
CYCLE_HOISTS = Array.isArray(data.cycleHoists) ? data.cycleHoists : [];
|
|
62
92
|
REEXTRACT = typeof data.reExtract === 'function' ? data.reExtract : null;
|
|
93
|
+
HOOKS_METADATA = normalizeHooksMetadata(data.hooksMetadata);
|
|
94
|
+
hooksLayerState = null;
|
|
95
|
+
hooksFallbackWarned = false;
|
|
63
96
|
globalThis.__bunfsRecoverMissing = recoverMissing;
|
|
64
97
|
globalThis.__bunfsResolvePath = resolveBunfsPath;
|
|
65
98
|
// 回復状態のリセット (テスト隔離・再 initialize 対応)
|
|
@@ -67,6 +100,116 @@ export function initialize(data) {
|
|
|
67
100
|
lastReExtractMs = 0;
|
|
68
101
|
}
|
|
69
102
|
|
|
103
|
+
function ensureHooksLayerState() {
|
|
104
|
+
if (hooksLayerState !== null) {
|
|
105
|
+
return hooksLayerState;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const layer1 = new Map();
|
|
109
|
+
let layer2 = true;
|
|
110
|
+
const { status, patches } = HOOKS_METADATA;
|
|
111
|
+
|
|
112
|
+
if (status === 'ok' && Array.isArray(patches) && patches.length > 0) {
|
|
113
|
+
// 全記録について「成立」判定を先読み+各失敗箇所で理由を設定
|
|
114
|
+
let allValid = true;
|
|
115
|
+
let failReason = 'unknown reason';
|
|
116
|
+
const seenFiles = new Set();
|
|
117
|
+
|
|
118
|
+
for (const record of patches) {
|
|
119
|
+
// (a) オブジェクト、file が空でない文字列、.. を含まない、絶対パスでない、PROCESS_OWNED_DIR 配下
|
|
120
|
+
if (!record || typeof record !== 'object') {
|
|
121
|
+
failReason = 'invalid record';
|
|
122
|
+
allValid = false;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
if (typeof record.file !== 'string' || !record.file) {
|
|
126
|
+
failReason = 'invalid file field';
|
|
127
|
+
allValid = false;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
if (record.file.includes('..')) {
|
|
131
|
+
failReason = 'file contains ..';
|
|
132
|
+
allValid = false;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (path.isAbsolute(record.file)) {
|
|
136
|
+
failReason = 'file is absolute path';
|
|
137
|
+
allValid = false;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
const real = path.resolve(PROCESS_OWNED_DIR, record.file);
|
|
141
|
+
if (path.relative(PROCESS_OWNED_DIR, real).startsWith('..')) {
|
|
142
|
+
failReason = 'path escapes owned dir';
|
|
143
|
+
allValid = false;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// (b) expectedOccurrences が 1 以上の整数
|
|
148
|
+
if (!Number.isInteger(record.expectedOccurrences) || record.expectedOccurrences < 1) {
|
|
149
|
+
failReason = 'invalid expectedOccurrences';
|
|
150
|
+
allValid = false;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// (c) file が他の記録と重複していない
|
|
155
|
+
if (seenFiles.has(record.file)) {
|
|
156
|
+
failReason = 'duplicate file';
|
|
157
|
+
allValid = false;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
seenFiles.add(record.file);
|
|
161
|
+
|
|
162
|
+
// (d) 対象ファイルを読める
|
|
163
|
+
let fileSource;
|
|
164
|
+
if (!existsSync(real)) {
|
|
165
|
+
if (!recoverMissing(real)) {
|
|
166
|
+
failReason = 'file not found or recovery failed';
|
|
167
|
+
allValid = false;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
fileSource = readFileSync(real, 'utf8');
|
|
173
|
+
} catch {
|
|
174
|
+
failReason = 'file read failed';
|
|
175
|
+
allValid = false;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// (e) countQleMatches が expectedOccurrences と一致
|
|
180
|
+
if (countQleMatches(fileSource) !== record.expectedOccurrences) {
|
|
181
|
+
const actual = countQleMatches(fileSource);
|
|
182
|
+
failReason = `occurrence count mismatch (expected ${record.expectedOccurrences}, found ${actual})`;
|
|
183
|
+
allValid = false;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (allValid) {
|
|
189
|
+
// 全件成立: layer1 に記録を詰める
|
|
190
|
+
for (const record of patches) {
|
|
191
|
+
layer1.set(record.file, record.expectedOccurrences);
|
|
192
|
+
}
|
|
193
|
+
layer2 = false;
|
|
194
|
+
} else {
|
|
195
|
+
// 1件でも不成立: layer1 空, layer2=true, 警告1回
|
|
196
|
+
warnOnce(`hooks standalone patch not applied (${failReason}); falling back to import.meta.dir shim (built-in plugin hooks degraded)`);
|
|
197
|
+
}
|
|
198
|
+
} else if (status === 'field-absent') {
|
|
199
|
+
// layer2=true, 警告は前置が実際に行われたときのみ
|
|
200
|
+
layer2 = true;
|
|
201
|
+
} else if (status === 'entry-missing') {
|
|
202
|
+
layer2 = true;
|
|
203
|
+
warnOnce('audited metadata entry missing for this version; built-in plugin hooks may be degraded');
|
|
204
|
+
} else if (status === 'read-failed') {
|
|
205
|
+
layer2 = true;
|
|
206
|
+
warnOnce('audited metadata could not be read; built-in plugin hooks may be degraded');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
hooksLayerState = { layer1, layer2 };
|
|
210
|
+
return hooksLayerState;
|
|
211
|
+
}
|
|
212
|
+
|
|
70
213
|
function tryHoistCycleBreakingImports(filePath, source) {
|
|
71
214
|
const rel = path.relative(PROCESS_OWNED_DIR, filePath);
|
|
72
215
|
const records = CYCLE_HOISTS.filter((r) => r.file === rel);
|
|
@@ -215,6 +358,19 @@ export function load(url, context, nextLoad) {
|
|
|
215
358
|
}
|
|
216
359
|
}
|
|
217
360
|
|
|
361
|
+
// 層1・層2処理
|
|
362
|
+
const rel = path.relative(PROCESS_OWNED_DIR, filePath);
|
|
363
|
+
const st = ensureHooksLayerState();
|
|
364
|
+
if (st.layer1.has(rel)) {
|
|
365
|
+
source = applyQlePatch(source);
|
|
366
|
+
}
|
|
367
|
+
if (st.layer2 && /\bimport\.meta\.dir\b/.test(source)) {
|
|
368
|
+
source = 'import.meta.dir ??= import.meta.dirname;\n' + source;
|
|
369
|
+
if (HOOKS_METADATA.status === 'field-absent') {
|
|
370
|
+
warnOnce('no hooks_standalone_patches record for this version but Bun-only import.meta.dir found in ' + rel + '; using import.meta.dir shim (built-in plugin hooks degraded)');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
218
374
|
let hoistedImportLine = '';
|
|
219
375
|
const hoistResult = tryHoistCycleBreakingImports(filePath, source);
|
|
220
376
|
if (hoistResult) {
|