@bash0816/claude-code 2.1.154 → 2.1.156
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.
|
@@ -181,6 +181,13 @@
|
|
|
181
181
|
"entry_js_offset": 222957396,
|
|
182
182
|
"entry_end_offset": 238482842,
|
|
183
183
|
"status": "termux_verified"
|
|
184
|
+
},
|
|
185
|
+
"2.1.156": {
|
|
186
|
+
"wrapper_spec": "@anthropic-ai/claude-code@2.1.156",
|
|
187
|
+
"native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.156",
|
|
188
|
+
"entry_js_offset": 222957812,
|
|
189
|
+
"entry_end_offset": 238483519,
|
|
190
|
+
"status": "termux_verified"
|
|
184
191
|
}
|
|
185
192
|
}
|
|
186
193
|
}
|
|
@@ -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.
|
|
8
|
-
"default_native_version": "2.1.
|
|
9
|
-
"latest_audited_version": "2.1.
|
|
10
|
-
"latest_candidate_version": "2.1.
|
|
11
|
-
"previous_stable_version": "2.1.
|
|
7
|
+
"bridge_package_version": "2.1.156",
|
|
8
|
+
"default_native_version": "2.1.156",
|
|
9
|
+
"latest_audited_version": "2.1.156",
|
|
10
|
+
"latest_candidate_version": "2.1.156",
|
|
11
|
+
"previous_stable_version": "2.1.154",
|
|
12
12
|
"manifest_url": "https://raw.githubusercontent.com/bash0816/ClaudeCode-Termux/main/config/claude-termux-release-manifest.json"
|
|
13
13
|
}
|
|
@@ -75,38 +75,6 @@ function ensureEntryFile() {
|
|
|
75
75
|
|
|
76
76
|
function createFakeRequire(realRequire) {
|
|
77
77
|
const realChild = realRequire('child_process');
|
|
78
|
-
const realVm = realRequire('vm');
|
|
79
|
-
|
|
80
|
-
function injectBunIntoContext(context) {
|
|
81
|
-
if (!context || typeof context !== 'object') return context;
|
|
82
|
-
try {
|
|
83
|
-
if (!Object.prototype.hasOwnProperty.call(context, 'Bun')) {
|
|
84
|
-
Object.defineProperty(context, 'Bun', {
|
|
85
|
-
value: globalThis.Bun,
|
|
86
|
-
configurable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
} catch {}
|
|
91
|
-
return context;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!realVm.__bunShimPatched) {
|
|
95
|
-
const origCreateContext = realVm.createContext.bind(realVm);
|
|
96
|
-
const origRunInNewContext = realVm.runInNewContext.bind(realVm);
|
|
97
|
-
realVm.createContext = (ctx, ...rest) => origCreateContext(injectBunIntoContext(ctx), ...rest);
|
|
98
|
-
realVm.runInNewContext = (code, ctx, ...rest) => origRunInNewContext(code, injectBunIntoContext(ctx), ...rest);
|
|
99
|
-
const ScriptProto = realVm.Script && realVm.Script.prototype;
|
|
100
|
-
if (ScriptProto && !ScriptProto.__bunShimPatched) {
|
|
101
|
-
const origRunInContext = ScriptProto.runInContext;
|
|
102
|
-
const origRunInNewCtx = ScriptProto.runInNewContext;
|
|
103
|
-
ScriptProto.runInContext = function(ctx, ...rest) { return origRunInContext.call(this, injectBunIntoContext(ctx), ...rest); };
|
|
104
|
-
ScriptProto.runInNewContext = function(ctx, ...rest) { return origRunInNewCtx.call(this, injectBunIntoContext(ctx), ...rest); };
|
|
105
|
-
Object.defineProperty(ScriptProto, '__bunShimPatched', { value: true });
|
|
106
|
-
}
|
|
107
|
-
Object.defineProperty(realVm, '__bunShimPatched', { value: true });
|
|
108
|
-
}
|
|
109
|
-
|
|
110
78
|
function rewriteArgs(args) {
|
|
111
79
|
if (
|
|
112
80
|
Array.isArray(args) &&
|
|
@@ -120,8 +88,6 @@ function createFakeRequire(realRequire) {
|
|
|
120
88
|
}
|
|
121
89
|
|
|
122
90
|
return function fakeRequire(id) {
|
|
123
|
-
if (id === 'vm') return realVm;
|
|
124
|
-
|
|
125
91
|
if (id === 'ws') {
|
|
126
92
|
class WS {
|
|
127
93
|
on() {}
|
|
@@ -153,321 +119,340 @@ function createFakeRequire(realRequire) {
|
|
|
153
119
|
};
|
|
154
120
|
}
|
|
155
121
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (typeof value !== 'string' || value.length === 0) return '';
|
|
166
|
-
return value.replace(ansiPattern, '');
|
|
167
|
-
}
|
|
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
|
+
}
|
|
168
131
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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;
|
|
178
142
|
}
|
|
179
143
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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;
|
|
194
158
|
}
|
|
195
159
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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);
|
|
205
169
|
}
|
|
170
|
+
return width;
|
|
171
|
+
}
|
|
206
172
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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);
|
|
211
179
|
}
|
|
180
|
+
return Buffer.from(String(value ?? ''));
|
|
181
|
+
}
|
|
212
182
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
183
|
+
function hashValue(value, seed = 0) {
|
|
184
|
+
const FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325n;
|
|
185
|
+
const FNV_PRIME_64 = 0x100000001b3n;
|
|
186
|
+
const MASK_64 = 0xffffffffffffffffn;
|
|
187
|
+
|
|
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;
|
|
216
196
|
}
|
|
217
197
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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;
|
|
229
214
|
}
|
|
230
|
-
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
if (cmd.includes(path.sep)) {
|
|
218
|
+
return isExecutable(cmd) ? path.resolve(cmd) : null;
|
|
231
219
|
}
|
|
232
220
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
+
}
|
|
239
229
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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;
|
|
244
234
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
stdioSpec = ['pipe', 'pipe', 'pipe'];
|
|
248
|
-
} else if (Array.isArray(options.stdio)) {
|
|
249
|
-
stdioSpec = options.stdio.map(s => resolveStdio(s, 'pipe'));
|
|
250
|
-
} else {
|
|
251
|
-
stdioSpec = [
|
|
252
|
-
resolveStdio(options.stdin, 'pipe'),
|
|
253
|
-
resolveStdio(options.stdout, 'pipe'),
|
|
254
|
-
resolveStdio(options.stderr, 'pipe'),
|
|
255
|
-
];
|
|
256
|
-
}
|
|
235
|
+
const wordWrap = !options || options.wordWrap !== false;
|
|
236
|
+
const hard = !!(options && options.hard);
|
|
257
237
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
detached: options.detached,
|
|
262
|
-
windowsHide: options.windowsHide,
|
|
263
|
-
stdio: stdioSpec,
|
|
264
|
-
});
|
|
238
|
+
if (!wordWrap || hard) {
|
|
239
|
+
const result = [];
|
|
240
|
+
let width = 0;
|
|
265
241
|
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
terminal.write = data => {
|
|
276
|
-
if (nodeChild.stdin && !nodeChild.stdin.destroyed) {
|
|
277
|
-
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;
|
|
278
251
|
}
|
|
279
|
-
|
|
280
|
-
};
|
|
281
|
-
}
|
|
252
|
+
}
|
|
282
253
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
254
|
+
if (char === '\n') {
|
|
255
|
+
result.push(char);
|
|
256
|
+
width = 0;
|
|
257
|
+
i += 1;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
286
260
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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;
|
|
299
273
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return nodeChild;
|
|
274
|
+
|
|
275
|
+
return result.join('');
|
|
303
276
|
}
|
|
304
277
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
+
}
|
|
315
293
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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;
|
|
319
303
|
}
|
|
320
|
-
|
|
321
|
-
|
|
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;
|
|
322
311
|
}
|
|
323
|
-
}
|
|
324
312
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
data: undefined,
|
|
331
|
-
write(chunk) {
|
|
332
|
-
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
333
|
-
const ok = socket.write(buffer);
|
|
334
|
-
return ok ? buffer.length : 0;
|
|
335
|
-
},
|
|
336
|
-
end(chunk) {
|
|
337
|
-
socket.end(chunk);
|
|
338
|
-
},
|
|
339
|
-
destroy(error) {
|
|
340
|
-
socket.destroy(error);
|
|
341
|
-
},
|
|
342
|
-
};
|
|
343
|
-
socket.on('data', chunk => {
|
|
344
|
-
if (options.socket && typeof options.socket.data === 'function') {
|
|
345
|
-
options.socket.data(connection, chunk);
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
socket.on('drain', () => {
|
|
349
|
-
if (options.socket && typeof options.socket.drain === 'function') {
|
|
350
|
-
options.socket.drain(connection);
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
socket.on('close', () => {
|
|
354
|
-
sockets.delete(socket);
|
|
355
|
-
if (options.socket && typeof options.socket.close === 'function') {
|
|
356
|
-
options.socket.close(connection);
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
socket.on('error', error => {
|
|
360
|
-
if (options.socket && typeof options.socket.error === 'function') {
|
|
361
|
-
options.socket.error(connection, error);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
if (options.socket && typeof options.socket.open === 'function') {
|
|
365
|
-
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;
|
|
366
318
|
}
|
|
367
|
-
|
|
319
|
+
const nextCodePoint = input.codePointAt(end);
|
|
320
|
+
end += String.fromCodePoint(nextCodePoint).length;
|
|
321
|
+
}
|
|
368
322
|
|
|
369
|
-
|
|
323
|
+
const text = input.slice(i, end);
|
|
324
|
+
const textWidth = stringWidth(text);
|
|
325
|
+
const pendingWidth = pendingSpaces ? stringWidth(pendingSpaces) : 0;
|
|
370
326
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (closeConnections) {
|
|
379
|
-
for (const socket of sockets) socket.destroy();
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
}
|
|
327
|
+
if (lineWidth > 0 && lineWidth + pendingWidth + textWidth > widthLimit) {
|
|
328
|
+
result.push(line);
|
|
329
|
+
result.push('\n');
|
|
330
|
+
line = '';
|
|
331
|
+
lineWidth = 0;
|
|
332
|
+
pendingSpaces = '';
|
|
333
|
+
}
|
|
384
334
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
for (let index = 0; index < size; index += 1) {
|
|
391
|
-
const diff = (leftParts[index] || 0) - (rightParts[index] || 0);
|
|
392
|
-
if (diff !== 0) return diff > 0 ? 1 : -1;
|
|
393
|
-
}
|
|
394
|
-
return 0;
|
|
395
|
-
},
|
|
396
|
-
satisfies(version, range) {
|
|
397
|
-
const v = String(version).replace(/^[^0-9]*/, '');
|
|
398
|
-
const clean = String(range).trim();
|
|
399
|
-
const match = clean.match(/^([><=!^~]+)\s*([0-9][^\s]*)/);
|
|
400
|
-
if (!match) return true;
|
|
401
|
-
const [, op, rv] = match;
|
|
402
|
-
const cmp = semver.order(v, rv);
|
|
403
|
-
if (op === '>=' || op === '=>') return cmp >= 0;
|
|
404
|
-
if (op === '>') return cmp > 0;
|
|
405
|
-
if (op === '<=' || op === '=<') return cmp <= 0;
|
|
406
|
-
if (op === '<') return cmp < 0;
|
|
407
|
-
if (op === '==' || op === '=') return cmp === 0;
|
|
408
|
-
if (op === '!=') return cmp !== 0;
|
|
409
|
-
return true;
|
|
410
|
-
},
|
|
411
|
-
};
|
|
335
|
+
if (lineWidth > 0 && pendingSpaces) {
|
|
336
|
+
line += pendingSpaces;
|
|
337
|
+
lineWidth += pendingWidth;
|
|
338
|
+
}
|
|
339
|
+
pendingSpaces = '';
|
|
412
340
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const result = {};
|
|
418
|
-
for (const line of lines) {
|
|
419
|
-
const m = line.match(/^([^:#]+):\s*(.*)$/);
|
|
420
|
-
if (m) result[m[1].trim()] = m[2].trim().replace(/^["']|["']$/g, '');
|
|
421
|
-
}
|
|
422
|
-
return result;
|
|
423
|
-
} catch { return {}; }
|
|
424
|
-
},
|
|
425
|
-
stringify(obj) {
|
|
426
|
-
try {
|
|
427
|
-
return Object.entries(obj || {}).map(([k, v]) => `${k}: ${v}`).join('\n') + '\n';
|
|
428
|
-
} catch { return ''; }
|
|
429
|
-
},
|
|
430
|
-
};
|
|
341
|
+
line += text;
|
|
342
|
+
lineWidth += textWidth;
|
|
343
|
+
i = end;
|
|
344
|
+
}
|
|
431
345
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
transformSync(code) { return typeof code === 'string' ? code : ''; }
|
|
435
|
-
scanImports(code) {
|
|
436
|
-
const imports = [];
|
|
437
|
-
const reStatic = /(?:^|[^.])import\s+(?:[^'"]+\s+from\s+)?['"]([^'"]+)['"]/gm;
|
|
438
|
-
const reDynamic = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
439
|
-
const reRequire = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
440
|
-
let m;
|
|
441
|
-
while ((m = reStatic.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'import-statement' });
|
|
442
|
-
while ((m = reDynamic.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'dynamic-import' });
|
|
443
|
-
while ((m = reRequire.exec(String(code))) !== null) imports.push({ path: m[1], kind: 'require-call' });
|
|
444
|
-
return imports;
|
|
445
|
-
}
|
|
346
|
+
if (pendingSpaces && lineWidth > 0) {
|
|
347
|
+
line += pendingSpaces;
|
|
446
348
|
}
|
|
349
|
+
if (line.length > 0) result.push(line);
|
|
447
350
|
|
|
351
|
+
return result.join('');
|
|
352
|
+
}
|
|
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;
|
|
448
377
|
return {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
gc: typeof global.gc === 'function' ? () => global.gc() : () => {},
|
|
452
|
-
generateHeapSnapshot: () => Buffer.alloc(0),
|
|
453
|
-
hash,
|
|
454
|
-
listen,
|
|
455
|
-
semver,
|
|
456
|
-
spawn,
|
|
457
|
-
stdin: process.stdin,
|
|
458
|
-
stripANSI,
|
|
459
|
-
stringWidth,
|
|
460
|
-
Terminal: TerminalShim,
|
|
461
|
-
Transpiler,
|
|
462
|
-
which,
|
|
463
|
-
wrapAnsi: value => String(value ?? ''),
|
|
464
|
-
YAML,
|
|
378
|
+
parts: [match[1], match[2] ?? '0', match[3] ?? '0'].map(Number),
|
|
379
|
+
pre: match[4] ? match[4].split('.') : null,
|
|
465
380
|
};
|
|
466
381
|
}
|
|
467
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
|
+
|
|
468
452
|
async function main() {
|
|
469
453
|
const extractedFile = ensureEntryFile();
|
|
470
454
|
const code = fs.readFileSync(extractedFile, 'utf8');
|
|
455
|
+
const fn = eval('(' + code);
|
|
471
456
|
|
|
472
457
|
const originalArgv = process.argv.slice();
|
|
473
458
|
const originalExit = process.exit;
|
|
@@ -476,6 +461,7 @@ async function main() {
|
|
|
476
461
|
const originalGlobalBun = globalThis.Bun;
|
|
477
462
|
const asyncErrors = [];
|
|
478
463
|
|
|
464
|
+
const fakeRequire = createFakeRequire(require);
|
|
479
465
|
function onAsyncError(error) {
|
|
480
466
|
asyncErrors.push(error);
|
|
481
467
|
}
|
|
@@ -484,14 +470,38 @@ async function main() {
|
|
|
484
470
|
process.once('uncaughtException', onAsyncError);
|
|
485
471
|
process.once('unhandledRejection', onAsyncError);
|
|
486
472
|
Object.defineProperty(process.versions, 'bun', { value: '1.1.8', configurable: true });
|
|
487
|
-
|
|
488
|
-
|
|
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
|
+
|
|
489
500
|
process.argv = ['node', extractedFile, ...argv];
|
|
490
501
|
process.exit = code => {
|
|
491
502
|
throw new RequestedExit(code);
|
|
492
503
|
};
|
|
493
504
|
|
|
494
|
-
const fn = eval('(' + code);
|
|
495
505
|
const moduleLike = { exports: {} };
|
|
496
506
|
const maybePromise = fn(moduleLike.exports, fakeRequire, moduleLike, extractedFile, workdir);
|
|
497
507
|
if (maybePromise && typeof maybePromise.then === 'function') await maybePromise;
|
|
@@ -515,10 +525,6 @@ async function main() {
|
|
|
515
525
|
Object.defineProperty(process.versions, 'bun', { value: originalBun, configurable: true });
|
|
516
526
|
}
|
|
517
527
|
} catch {}
|
|
518
|
-
try {
|
|
519
|
-
if (hadGlobalBun) globalThis.Bun = originalGlobalBun;
|
|
520
|
-
else delete globalThis.Bun;
|
|
521
|
-
} catch {}
|
|
522
528
|
}
|
|
523
529
|
}
|
|
524
530
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bash0816/claude-code",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.156",
|
|
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
|
+
"node": ">=18"
|
|
21
21
|
}
|
|
22
22
|
}
|