@bash0816/claude-code 2.1.276 → 2.1.278

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 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.272
40
+ npm install -g @bash0816/claude-code@2.1.276-1
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,101 @@
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": "withdrawn",
2095
+ "num_modules": 2093,
2096
+ "byte_count": 143688478,
2097
+ "cycle_hoists": [
2098
+ {
2099
+ "file": "chunk-4smm7vse.js",
2100
+ "targetModule": "chunk-x8xhn4zk.js",
2101
+ "expectedOccurrences": 1,
2102
+ "assertProperties": []
2103
+ },
2104
+ {
2105
+ "file": "chunk-xyct5nvs.js",
2106
+ "targetModule": "chunk-77w3wy6j.js",
2107
+ "expectedOccurrences": 1,
2108
+ "assertProperties": [
2109
+ "default"
2110
+ ]
2111
+ },
2112
+ {
2113
+ "file": "chunk-xyct5nvs.js",
2114
+ "targetModule": "chunk-692ppfcw.js",
2115
+ "expectedOccurrences": 3,
2116
+ "assertProperties": [
2117
+ "getWorkflowCommands",
2118
+ "invalidateWorkflowCache",
2119
+ "warmWorkflows"
2120
+ ]
2121
+ }
2122
+ ],
2123
+ "cycle_hoists_skipped_assets": [
2124
+ "chart.umd.min.js",
2125
+ "hljsBundle.generated.min.js",
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",
2094
2141
  "status": "offset_discovered",
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",
2095
2189
  "num_modules": 2093,
2096
2190
  "byte_count": 143688478,
2097
2191
  "cycle_hoists": [
@@ -2124,6 +2218,12 @@
2124
2218
  "chart.umd.min.js",
2125
2219
  "hljsBundle.generated.min.js",
2126
2220
  "mermaid.min.js"
2221
+ ],
2222
+ "hooks_standalone_patches": [
2223
+ {
2224
+ "file": "chunk-0sa9p840.js",
2225
+ "expectedOccurrences": 1
2226
+ }
2127
2227
  ]
2128
2228
  }
2129
2229
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "manifest_version": 1,
3
3
  "package_name": "@bash0816/claude-code",
4
- "latest_audited_version": "2.1.272",
5
- "latest_candidate_version": "2.1.276",
6
- "previous_stable_version": "2.1.270",
4
+ "latest_audited_version": "2.1.276-1",
5
+ "latest_candidate_version": "2.1.278",
6
+ "previous_stable_version": "2.1.272",
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
  }
@@ -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) {