@bash0816/claude-code 2.1.153 → 2.1.154-2

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.
@@ -146,6 +146,41 @@
146
146
  "entry_js_offset": 222525028,
147
147
  "entry_end_offset": 237958345,
148
148
  "status": "termux_verified"
149
+ },
150
+ "2.1.153-1": {
151
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.153",
152
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.153",
153
+ "entry_js_offset": 222525028,
154
+ "entry_end_offset": 237958345,
155
+ "status": "termux_verified"
156
+ },
157
+ "2.1.153-2": {
158
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.153",
159
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.153",
160
+ "entry_js_offset": 222525028,
161
+ "entry_end_offset": 237958345,
162
+ "status": "termux_verified"
163
+ },
164
+ "2.1.153-3": {
165
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.153",
166
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.153",
167
+ "entry_js_offset": 222525028,
168
+ "entry_end_offset": 237958345,
169
+ "status": "termux_verified"
170
+ },
171
+ "2.1.153-4": {
172
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.153",
173
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.153",
174
+ "entry_js_offset": 222525028,
175
+ "entry_end_offset": 237958345,
176
+ "status": "termux_verified"
177
+ },
178
+ "2.1.154": {
179
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.154",
180
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.154",
181
+ "entry_js_offset": 222957396,
182
+ "entry_end_offset": 238482842,
183
+ "status": "termux_verified"
149
184
  }
150
185
  }
151
186
  }
@@ -4,10 +4,10 @@
4
4
  "canonical_package_name": "@bash0816/claude-code",
5
5
  "canonical_manifest_url": "https://raw.githubusercontent.com/bash0816/ClaudeCode-Termux/main/config/claude-termux-release-manifest.json",
6
6
  "canonical_repository_url": "https://github.com/bash0816/ClaudeCode-Termux",
7
- "bridge_package_version": "2.1.123",
8
- "default_native_version": "2.1.153",
9
- "latest_audited_version": "2.1.153",
10
- "latest_candidate_version": "2.1.153",
11
- "previous_stable_version": "2.1.150-3",
12
- "manifest_url": "https://raw.githubusercontent.com/bash0816/CluadeCode-Termux/main/config/claude-termux-release-manifest.json"
7
+ "bridge_package_version": "2.1.154-2",
8
+ "default_native_version": "2.1.154",
9
+ "latest_audited_version": "2.1.154",
10
+ "latest_candidate_version": "2.1.154",
11
+ "previous_stable_version": "2.1.126",
12
+ "manifest_url": "https://raw.githubusercontent.com/bash0816/ClaudeCode-Termux/main/config/claude-termux-release-manifest.json"
13
13
  }
@@ -24,8 +24,14 @@ const canonicalPackageName = process.env.CLAUDE_TERMUX_CANONICAL_PACKAGE_NAME ||
24
24
  const canonicalRepositoryUrl = process.env.CLAUDE_TERMUX_CANONICAL_REPOSITORY_URL || localManifest.canonical_repository_url || '';
25
25
 
26
26
  function compareVersions(a, b) {
27
- const aParts = String(a).split('.').map(Number);
28
- const bParts = String(b).split('.').map(Number);
27
+ const parse = v => {
28
+ const [main, patch] = String(v).split('-');
29
+ const parts = main.split('.').map(Number);
30
+ parts.push(patch !== undefined ? Number(patch) : 0);
31
+ return parts;
32
+ };
33
+ const aParts = parse(a);
34
+ const bParts = parse(b);
29
35
  const len = Math.max(aParts.length, bParts.length);
30
36
  for (let index = 0; index < len; index += 1) {
31
37
  const diff = (aParts[index] || 0) - (bParts[index] || 0);
@@ -119,317 +119,336 @@ function createFakeRequire(realRequire) {
119
119
  };
120
120
  }
121
121
 
122
- function createBunShim() {
123
- const childProcess = require('child_process');
124
- const crypto = require('crypto');
125
- const net = require('net');
126
- const os = require('os');
127
- const ansiPattern =
128
- /[\u001B\u009B][[\]()#;?]*(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?(?:\u0007|\u001B\u005C|\u009C)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g;
129
-
130
- function stripANSI(value) {
131
- if (typeof value !== 'string' || value.length === 0) return '';
132
- return value.replace(ansiPattern, '');
133
- }
122
+ const ansiPattern =
123
+ /[\u001B\u009B][[\]()#;?]*(?:(?:(?:;[-a-zA-Z\d\/\#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/\#&.:=?%@~_]*)*)?(?:\u0007|\u001B\u005C|\u009C)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g;
124
+ const ansiPatternSingle = new RegExp(ansiPattern.source);
125
+ const debugBunShim = process.env.CLAUDE_TERMUX_DEBUG_BUN_SHIM === '1';
126
+
127
+ function stripANSI(text) {
128
+ if (typeof text !== 'string' || text.length === 0) return '';
129
+ return text.replace(ansiPattern, '');
130
+ }
134
131
 
135
- function isZeroWidth(codePoint) {
136
- return (
137
- codePoint <= 0x1f ||
138
- (codePoint >= 0x7f && codePoint <= 0x9f) ||
139
- (codePoint >= 0x300 && codePoint <= 0x36f) ||
140
- (codePoint >= 0x200b && codePoint <= 0x200f) ||
141
- codePoint === 0xfeff ||
142
- (codePoint >= 0xfe00 && codePoint <= 0xfe0f)
143
- );
132
+ function codePointWidth(codePoint) {
133
+ if (
134
+ codePoint <= 0x1f ||
135
+ (codePoint >= 0x7f && codePoint <= 0x9f) ||
136
+ (codePoint >= 0x300 && codePoint <= 0x36f) ||
137
+ (codePoint >= 0x200b && codePoint <= 0x200f) ||
138
+ codePoint === 0xfeff ||
139
+ (codePoint >= 0xfe00 && codePoint <= 0xfe0f)
140
+ ) {
141
+ return 0;
144
142
  }
145
143
 
146
- function isWide(codePoint) {
147
- return (
148
- (codePoint >= 0x1100 && codePoint <= 0x115f) ||
149
- (codePoint >= 0x2329 && codePoint <= 0x232a) ||
150
- (codePoint >= 0x2e80 && codePoint <= 0xa4cf && codePoint !== 0x303f) ||
151
- (codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
152
- (codePoint >= 0xf900 && codePoint <= 0xfaff) ||
153
- (codePoint >= 0xfe10 && codePoint <= 0xfe19) ||
154
- (codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
155
- (codePoint >= 0xff00 && codePoint <= 0xff60) ||
156
- (codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
157
- (codePoint >= 0x1f300 && codePoint <= 0x1faf8) ||
158
- (codePoint >= 0x20000 && codePoint <= 0x3fffd)
159
- );
144
+ if (
145
+ (codePoint >= 0x1100 && codePoint <= 0x115f) ||
146
+ (codePoint >= 0x2329 && codePoint <= 0x232a) ||
147
+ (codePoint >= 0x2e80 && codePoint <= 0xa4cf && codePoint !== 0x303f) ||
148
+ (codePoint >= 0xac00 && codePoint <= 0xd7a3) ||
149
+ (codePoint >= 0xf900 && codePoint <= 0xfaff) ||
150
+ (codePoint >= 0xfe10 && codePoint <= 0xfe19) ||
151
+ (codePoint >= 0xfe30 && codePoint <= 0xfe6f) ||
152
+ (codePoint >= 0xff00 && codePoint <= 0xff60) ||
153
+ (codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
154
+ (codePoint >= 0x1f300 && codePoint <= 0x1faf8) ||
155
+ (codePoint >= 0x20000 && codePoint <= 0x3fffd)
156
+ ) {
157
+ return 2;
160
158
  }
161
159
 
162
- function stringWidth(value) {
163
- const text = stripANSI(typeof value === 'string' ? value : String(value ?? ''));
164
- let width = 0;
165
- for (const char of text) {
166
- const codePoint = char.codePointAt(0);
167
- if (isZeroWidth(codePoint)) continue;
168
- width += isWide(codePoint) ? 2 : 1;
169
- }
170
- return width;
160
+ return 1;
161
+ }
162
+
163
+ function stringWidth(value) {
164
+ const text = stripANSI(typeof value === 'string' ? value : String(value ?? ''));
165
+ let width = 0;
166
+ for (const char of text) {
167
+ const codePoint = char.codePointAt(0);
168
+ width += codePointWidth(codePoint);
171
169
  }
170
+ return width;
171
+ }
172
172
 
173
- function normalizeInput(value) {
174
- if (Buffer.isBuffer(value) || value instanceof Uint8Array) return Buffer.from(value);
175
- if (typeof value === 'string') return Buffer.from(value);
176
- return Buffer.from(String(value ?? ''));
173
+ function toHashBytes(value) {
174
+ if (Buffer.isBuffer(value)) return Buffer.from(value);
175
+ if (value instanceof Uint8Array) return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
176
+ if (value instanceof ArrayBuffer) return Buffer.from(value);
177
+ if (ArrayBuffer.isView(value)) {
178
+ return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
177
179
  }
180
+ return Buffer.from(String(value ?? ''));
181
+ }
182
+
183
+ function hashValue(value, seed = 0) {
184
+ const FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325n;
185
+ const FNV_PRIME_64 = 0x100000001b3n;
186
+ const MASK_64 = 0xffffffffffffffffn;
178
187
 
179
- function hash(value) {
180
- const digest = crypto.createHash('sha256').update(normalizeInput(value)).digest();
181
- return digest.readUInt32LE(0);
188
+ const seedNumber = typeof seed === 'bigint' ? Number(seed) : Number(seed);
189
+ const seedValue = Number.isFinite(seedNumber) ? Math.trunc(seedNumber) : 0;
190
+ let result = BigInt.asUintN(64, FNV_OFFSET_BASIS_64 ^ BigInt(seedValue));
191
+
192
+ const bytes = toHashBytes(value);
193
+ for (const byte of bytes) {
194
+ result ^= BigInt(byte);
195
+ result = (result * FNV_PRIME_64) & MASK_64;
182
196
  }
183
197
 
184
- function which(command) {
185
- if (typeof command !== 'string' || command.length === 0) return null;
186
- const pathValue = process.env.PATH || '';
187
- const separator = os.platform() === 'win32' ? ';' : ':';
188
- for (const entry of pathValue.split(separator)) {
189
- if (!entry) continue;
190
- const candidate = path.join(entry, command);
191
- try {
192
- fs.accessSync(candidate, fs.constants.X_OK);
193
- return candidate;
194
- } catch {}
198
+ return BigInt(result);
199
+ }
200
+
201
+ function which(cmd) {
202
+ const fs = require('fs');
203
+ const path = require('path');
204
+
205
+ if (typeof cmd !== 'string' || cmd.length === 0) return null;
206
+
207
+ const isExecutable = candidate => {
208
+ try {
209
+ fs.accessSync(candidate, fs.constants.X_OK);
210
+ const stat = fs.statSync(candidate);
211
+ return stat.isFile();
212
+ } catch {
213
+ return false;
195
214
  }
196
- return null;
215
+ };
216
+
217
+ if (cmd.includes(path.sep)) {
218
+ return isExecutable(cmd) ? path.resolve(cmd) : null;
197
219
  }
198
220
 
199
- function spawn(argv, options = {}) {
200
- if (!Array.isArray(argv) || argv.length === 0) {
201
- throw new TypeError('Bun.spawn expects a non-empty argv array');
202
- }
203
- const [command, ...args] = argv;
204
- const terminal = options.terminal || null;
221
+ const searchPath = process.env.PATH || '';
222
+ for (const entry of searchPath.split(path.delimiter)) {
223
+ if (!entry) continue;
224
+ const candidate = path.join(entry, cmd);
225
+ if (isExecutable(candidate)) return candidate;
226
+ }
227
+ return null;
228
+ }
205
229
 
206
- function resolveStdio(val, fallback) {
207
- if (val === 'ignore' || val === 'inherit' || val === 'pipe') return val;
208
- return fallback;
209
- }
230
+ function wrapAnsi(str, columns, options) {
231
+ const input = typeof str === 'string' ? str : String(str ?? '');
232
+ const widthLimit = Number(columns);
233
+ if (!Number.isFinite(widthLimit) || widthLimit <= 0) return input;
210
234
 
211
- let stdioSpec;
212
- if (terminal) {
213
- stdioSpec = ['pipe', 'pipe', 'pipe'];
214
- } else if (Array.isArray(options.stdio)) {
215
- stdioSpec = options.stdio.map(s => resolveStdio(s, 'pipe'));
216
- } else {
217
- stdioSpec = [
218
- resolveStdio(options.stdin, 'pipe'),
219
- resolveStdio(options.stdout, 'pipe'),
220
- resolveStdio(options.stderr, 'pipe'),
221
- ];
222
- }
235
+ const wordWrap = !options || options.wordWrap !== false;
236
+ const hard = !!(options && options.hard);
223
237
 
224
- const nodeChild = childProcess.spawn(command, args, {
225
- cwd: options.cwd,
226
- env: options.env || process.env,
227
- detached: options.detached,
228
- windowsHide: options.windowsHide,
229
- stdio: stdioSpec,
230
- });
238
+ if (!wordWrap || hard) {
239
+ const result = [];
240
+ let width = 0;
231
241
 
232
- if (terminal) {
233
- const fireData = chunk => {
234
- if (!terminal._closed && terminal._options && typeof terminal._options.data === 'function') {
235
- terminal._options.data(terminal, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
236
- }
237
- };
238
- nodeChild.stdout?.on('data', fireData);
239
- nodeChild.stderr?.on('data', fireData);
240
- const origWrite = terminal.write.bind(terminal);
241
- terminal.write = data => {
242
- if (nodeChild.stdin && !nodeChild.stdin.destroyed) {
243
- nodeChild.stdin.write(Buffer.isBuffer(data) ? data : Buffer.from(data));
242
+ for (let i = 0; i < input.length; ) {
243
+ const char = input[i];
244
+
245
+ if (char === '\u001b' || char === '\u009b') {
246
+ const match = input.slice(i).match(ansiPatternSingle);
247
+ if (match && match.index === 0) {
248
+ result.push(match[0]);
249
+ i += match[0].length;
250
+ continue;
244
251
  }
245
- return origWrite(data);
246
- };
247
- }
252
+ }
248
253
 
249
- nodeChild.exited = new Promise(resolve => {
250
- nodeChild.once('exit', (code, signal) => resolve(code != null ? code : (signal ? 1 : 0)));
251
- });
254
+ if (char === '\n') {
255
+ result.push(char);
256
+ width = 0;
257
+ i += 1;
258
+ continue;
259
+ }
252
260
 
253
- function makeTextReader(stream) {
254
- return {
255
- text() {
256
- return new Promise((resolve, reject) => {
257
- if (!stream) return resolve('');
258
- const chunks = [];
259
- stream.on('data', chunk => chunks.push(chunk));
260
- stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
261
- stream.on('error', reject);
262
- });
263
- },
264
- };
261
+ const codePoint = input.codePointAt(i);
262
+ const charText = String.fromCodePoint(codePoint);
263
+ const charWidth = codePointWidth(codePoint);
264
+
265
+ if (width > 0 && width + charWidth > widthLimit) {
266
+ result.push('\n');
267
+ width = 0;
268
+ }
269
+
270
+ result.push(charText);
271
+ width += charWidth;
272
+ i += charText.length;
265
273
  }
266
- if (nodeChild.stdout) Object.assign(nodeChild.stdout, makeTextReader(nodeChild.stdout));
267
- if (nodeChild.stderr) Object.assign(nodeChild.stderr, makeTextReader(nodeChild.stderr));
268
- return nodeChild;
274
+
275
+ return result.join('');
269
276
  }
270
277
 
271
- class TerminalShim {
272
- constructor(options = {}) {
273
- this._options = options;
274
- this._cols = options.cols || 80;
275
- this._rows = options.rows || 24;
276
- this._closed = false;
277
- }
278
- write(data) {
279
- if (this._closed) return;
278
+ const result = [];
279
+ let line = '';
280
+ let lineWidth = 0;
281
+ let pendingSpaces = '';
282
+
283
+ for (let i = 0; i < input.length; ) {
284
+ const char = input[i];
285
+
286
+ if (char === '\u001b' || char === '\u009b') {
287
+ const match = input.slice(i).match(ansiPatternSingle);
288
+ if (match && match.index === 0) {
289
+ line += match[0];
290
+ i += match[0].length;
291
+ continue;
292
+ }
280
293
  }
281
- resize(cols, rows) {
282
- this._cols = cols;
283
- this._rows = rows;
294
+
295
+ if (char === '\n') {
296
+ if (line.length > 0) result.push(line);
297
+ result.push('\n');
298
+ line = '';
299
+ lineWidth = 0;
300
+ pendingSpaces = '';
301
+ i += 1;
302
+ continue;
284
303
  }
285
- close() {
286
- this._closed = true;
304
+
305
+ const codePoint = input.codePointAt(i);
306
+ const charText = String.fromCodePoint(codePoint);
307
+ if (charText === ' ' || charText === '\t') {
308
+ pendingSpaces += charText;
309
+ i += charText.length;
310
+ continue;
287
311
  }
288
- }
289
312
 
290
- function listen(options) {
291
- const sockets = new Set();
292
- const server = net.createServer(socket => {
293
- sockets.add(socket);
294
- const connection = {
295
- data: undefined,
296
- write(chunk) {
297
- const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
298
- const ok = socket.write(buffer);
299
- return ok ? buffer.length : 0;
300
- },
301
- end(chunk) {
302
- socket.end(chunk);
303
- },
304
- destroy(error) {
305
- socket.destroy(error);
306
- },
307
- };
308
- socket.on('data', chunk => {
309
- if (options.socket && typeof options.socket.data === 'function') {
310
- options.socket.data(connection, chunk);
311
- }
312
- });
313
- socket.on('drain', () => {
314
- if (options.socket && typeof options.socket.drain === 'function') {
315
- options.socket.drain(connection);
316
- }
317
- });
318
- socket.on('close', () => {
319
- sockets.delete(socket);
320
- if (options.socket && typeof options.socket.close === 'function') {
321
- options.socket.close(connection);
322
- }
323
- });
324
- socket.on('error', error => {
325
- if (options.socket && typeof options.socket.error === 'function') {
326
- options.socket.error(connection, error);
327
- }
328
- });
329
- if (options.socket && typeof options.socket.open === 'function') {
330
- options.socket.open(connection);
313
+ let end = i + charText.length;
314
+ while (end < input.length) {
315
+ const nextChar = input[end];
316
+ if (nextChar === '\n' || nextChar === ' ' || nextChar === '\t' || nextChar === '\u001b' || nextChar === '\u009b') {
317
+ break;
331
318
  }
332
- });
319
+ const nextCodePoint = input.codePointAt(end);
320
+ end += String.fromCodePoint(nextCodePoint).length;
321
+ }
333
322
 
334
- server.listen(options.port || 0, options.hostname || '127.0.0.1');
323
+ const text = input.slice(i, end);
324
+ const textWidth = stringWidth(text);
325
+ const pendingWidth = pendingSpaces ? stringWidth(pendingSpaces) : 0;
335
326
 
336
- return {
337
- get port() {
338
- const address = server.address();
339
- return address && typeof address === 'object' ? address.port : 0;
340
- },
341
- stop(closeConnections) {
342
- server.close();
343
- if (closeConnections) {
344
- for (const socket of sockets) socket.destroy();
345
- }
346
- },
347
- };
348
- }
327
+ if (lineWidth > 0 && lineWidth + pendingWidth + textWidth > widthLimit) {
328
+ result.push(line);
329
+ result.push('\n');
330
+ line = '';
331
+ lineWidth = 0;
332
+ pendingSpaces = '';
333
+ }
349
334
 
350
- const semver = {
351
- order(left, right) {
352
- const leftParts = String(left).replace(/^[^0-9]*/, '').split('.').map(Number);
353
- const rightParts = String(right).replace(/^[^0-9]*/, '').split('.').map(Number);
354
- const size = Math.max(leftParts.length, rightParts.length);
355
- for (let index = 0; index < size; index += 1) {
356
- const diff = (leftParts[index] || 0) - (rightParts[index] || 0);
357
- if (diff !== 0) return diff > 0 ? 1 : -1;
358
- }
359
- return 0;
360
- },
361
- satisfies(version, range) {
362
- const v = String(version).replace(/^[^0-9]*/, '');
363
- const clean = String(range).trim();
364
- const match = clean.match(/^([><=!^~]+)\s*([0-9][^\s]*)/);
365
- if (!match) return true;
366
- const [, op, rv] = match;
367
- const cmp = semver.order(v, rv);
368
- if (op === '>=' || op === '=>') return cmp >= 0;
369
- if (op === '>') return cmp > 0;
370
- if (op === '<=' || op === '=<') return cmp <= 0;
371
- if (op === '<') return cmp < 0;
372
- if (op === '==' || op === '=') return cmp === 0;
373
- if (op === '!=') return cmp !== 0;
374
- return true;
375
- },
376
- };
335
+ if (lineWidth > 0 && pendingSpaces) {
336
+ line += pendingSpaces;
337
+ lineWidth += pendingWidth;
338
+ }
339
+ pendingSpaces = '';
377
340
 
378
- const YAML = {
379
- parse(text) {
380
- try {
381
- const lines = String(text).split('\n');
382
- const result = {};
383
- for (const line of lines) {
384
- const m = line.match(/^([^:#]+):\s*(.*)$/);
385
- if (m) result[m[1].trim()] = m[2].trim().replace(/^["']|["']$/g, '');
386
- }
387
- return result;
388
- } catch { return {}; }
389
- },
390
- stringify(obj) {
391
- try {
392
- return Object.entries(obj || {}).map(([k, v]) => `${k}: ${v}`).join('\n') + '\n';
393
- } catch { return ''; }
394
- },
395
- };
341
+ line += text;
342
+ lineWidth += textWidth;
343
+ i = end;
344
+ }
396
345
 
397
- class Transpiler {
398
- constructor(_options) {}
399
- transformSync(code) { return typeof code === 'string' ? code : ''; }
400
- scanImports(code) {
401
- const imports = [];
402
- const reStatic = /(?:^|[^.])import\s+(?:[^'"]+\s+from\s+)?['"]([^'"]+)['"]/gm;
403
- const reDynamic = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
404
- const reRequire = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
405
- let m;
406
- while ((m = reStatic.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'import-statement' });
407
- while ((m = reDynamic.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'dynamic-import' });
408
- while ((m = reRequire.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'require-call' });
409
- return imports;
410
- }
346
+ if (pendingSpaces && lineWidth > 0) {
347
+ line += pendingSpaces;
411
348
  }
349
+ if (line.length > 0) result.push(line);
350
+
351
+ return result.join('');
352
+ }
412
353
 
354
+ const YAML = {
355
+ parse(text) {
356
+ try {
357
+ const lines = String(text).split('\n');
358
+ const result = {};
359
+ for (const line of lines) {
360
+ const m = line.match(/^([^:#]+):\s*(.*)$/);
361
+ if (m) result[m[1].trim()] = m[2].trim().replace(/^['"]|['"]$/g, '');
362
+ }
363
+ return result;
364
+ } catch { return {}; }
365
+ },
366
+ stringify(obj) {
367
+ try {
368
+ return Object.entries(obj || {}).map(([k, v]) => k + ': ' + v).join('\n') + '\n';
369
+ } catch { return ''; }
370
+ },
371
+ };
372
+
373
+ function parseSemverVersion(value) {
374
+ const text = String(value ?? '').trim().replace(/^[v=]/, '');
375
+ const match = text.match(/^(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:\.(0|[1-9]\d*))?(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/);
376
+ if (!match) return null;
413
377
  return {
414
- version: '1.1.8',
415
- embeddedFiles: [],
416
- gc: typeof global.gc === 'function' ? () => global.gc() : () => {},
417
- generateHeapSnapshot: () => Buffer.alloc(0),
418
- hash,
419
- listen,
420
- semver,
421
- spawn,
422
- stdin: process.stdin,
423
- stripANSI,
424
- stringWidth,
425
- Terminal: TerminalShim,
426
- Transpiler,
427
- which,
428
- wrapAnsi: value => String(value ?? ''),
429
- YAML,
378
+ parts: [match[1], match[2] ?? '0', match[3] ?? '0'].map(Number),
379
+ pre: match[4] ? match[4].split('.') : null,
430
380
  };
431
381
  }
432
382
 
383
+ function comparePrerelease(a, b) {
384
+ const size = Math.max(a.length, b.length);
385
+ for (let i = 0; i < size; i++) {
386
+ if (a[i] === undefined) return -1;
387
+ if (b[i] === undefined) return 1;
388
+ const aNum = /^\d+$/.test(a[i]);
389
+ const bNum = /^\d+$/.test(b[i]);
390
+ if (aNum && bNum) { const d = Number(a[i]) - Number(b[i]); if (d) return d < 0 ? -1 : 1; }
391
+ else if (aNum) return -1;
392
+ else if (bNum) return 1;
393
+ else if (a[i] < b[i]) return -1;
394
+ else if (a[i] > b[i]) return 1;
395
+ }
396
+ return 0;
397
+ }
398
+
399
+ const semver = {
400
+ order(left, right) {
401
+ const a = parseSemverVersion(left), b = parseSemverVersion(right);
402
+ if (!a || !b) return NaN;
403
+ for (let i = 0; i < 3; i++) {
404
+ const d = a.parts[i] - b.parts[i];
405
+ if (d) return d < 0 ? -1 : 1;
406
+ }
407
+ if (a.pre && !b.pre) return -1;
408
+ if (!a.pre && b.pre) return 1;
409
+ if (a.pre && b.pre) return comparePrerelease(a.pre, b.pre);
410
+ return 0;
411
+ },
412
+ satisfies(version, range) {
413
+ if (!version || !range) return false;
414
+ const v = String(version).replace(/^[v=]/, '');
415
+ const clean = String(range).trim();
416
+ if (!clean) return false;
417
+ if (clean.includes('||')) return clean.split('||').some(r => semver.satisfies(v, r.trim()));
418
+ const parts = clean.split(/\s+/).filter(Boolean);
419
+ if (parts.length > 1) return parts.every(p => semver.satisfies(v, p));
420
+ const caret = clean.match(/^\^([0-9].*)$/);
421
+ if (caret) {
422
+ const p = parseSemverVersion(caret[1]);
423
+ if (!p) return false;
424
+ const upper = p.parts[0] > 0 ? (p.parts[0] + 1) + '.0.0'
425
+ : p.parts[1] > 0 ? '0.' + (p.parts[1] + 1) + '.0'
426
+ : '0.0.' + (p.parts[2] + 1);
427
+ return semver.satisfies(v, '>=' + caret[1]) && semver.satisfies(v, '<' + upper);
428
+ }
429
+ const tilde = clean.match(/^~([0-9].*)$/);
430
+ if (tilde) {
431
+ const p = parseSemverVersion(tilde[1]);
432
+ if (!p) return false;
433
+ const original = tilde[1].split('.');
434
+ const upper = original.length >= 2
435
+ ? p.parts[0] + '.' + (p.parts[1] + 1) + '.0'
436
+ : (p.parts[0] + 1) + '.0.0';
437
+ return semver.satisfies(v, '>=' + tilde[1]) && semver.satisfies(v, '<' + upper);
438
+ }
439
+ const m = clean.match(/^([><=!]{1,2})\s*([0-9].*)$/);
440
+ if (m) {
441
+ const cmp = semver.order(v, m[2]);
442
+ if (!Number.isFinite(cmp)) return false;
443
+ return m[1] === '>=' ? cmp >= 0 : m[1] === '>' ? cmp > 0 :
444
+ m[1] === '<=' ? cmp <= 0 : m[1] === '<' ? cmp < 0 :
445
+ m[1] === '=' || m[1] === '==' ? cmp === 0 : m[1] === '!=' ? cmp !== 0 : false;
446
+ }
447
+ const exact = parseSemverVersion(clean);
448
+ return exact ? semver.order(v, clean) === 0 : false;
449
+ },
450
+ };
451
+
433
452
  async function main() {
434
453
  const extractedFile = ensureEntryFile();
435
454
  const code = fs.readFileSync(extractedFile, 'utf8');
@@ -451,7 +470,33 @@ async function main() {
451
470
  process.once('uncaughtException', onAsyncError);
452
471
  process.once('unhandledRejection', onAsyncError);
453
472
  Object.defineProperty(process.versions, 'bun', { value: '1.1.8', configurable: true });
454
- globalThis.Bun = createBunShim();
473
+ const BunShim = {
474
+ version: '1.1.8',
475
+ stringWidth,
476
+ hash: hashValue,
477
+ which,
478
+ wrapAnsi,
479
+ stripANSI,
480
+ semver,
481
+ YAML,
482
+ gc: (sync) => {
483
+ try {
484
+ if (typeof global.gc === 'function') global.gc(sync === false ? false : true);
485
+ } catch {}
486
+ },
487
+ stdin: { stream: null },
488
+ embeddedFiles: [],
489
+ };
490
+ const BunProxy = new Proxy(BunShim, {
491
+ get(target, key, receiver) {
492
+ if (!(key in target) && typeof key !== 'symbol' && debugBunShim) {
493
+ console.error('[BunShim missing]', key);
494
+ }
495
+ return Reflect.get(target, key, receiver);
496
+ },
497
+ });
498
+ globalThis.Bun = BunProxy;
499
+
455
500
  process.argv = ['node', extractedFile, ...argv];
456
501
  process.exit = code => {
457
502
  throw new RequestedExit(code);
@@ -480,8 +525,6 @@ async function main() {
480
525
  Object.defineProperty(process.versions, 'bun', { value: originalBun, configurable: true });
481
526
  }
482
527
  } catch {}
483
- if (hadGlobalBun) globalThis.Bun = originalGlobalBun;
484
- else delete globalThis.Bun;
485
528
  }
486
529
  }
487
530
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash0816/claude-code",
3
- "version": "2.1.153",
3
+ "version": "2.1.154-2",
4
4
  "description": "Termux-native Claude Code wrapper with audited native replay",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -17,6 +17,6 @@
17
17
  "README.md"
18
18
  ],
19
19
  "engines": {
20
- "node": ">=20"
20
+ "node": ">=18"
21
21
  }
22
22
  }