@bash0816/claude-code 2.1.156 → 2.1.157-1

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
@@ -1,84 +1,31 @@
1
1
  # @bash0816/cluade-code
2
2
 
3
- Termux-native Claude Code wrapper package.
3
+ > **This package has been renamed.**
4
+ > Please migrate to the canonical package: [@bash0816/claude-code](https://www.npmjs.com/package/@bash0816/claude-code)
4
5
 
5
- Termux 向け Claude Code native wrapper package です。
6
+ ## Migration / 移行
6
7
 
7
- Legacy compatibility package:
8
+ Run the following command to migrate:
8
9
 
9
- 互換維持用の legacy package:
10
-
11
- - canonical package: `@bash0816/claude-code`
12
-
13
- ## Install / インストール
10
+ 移行するには以下を実行してください:
14
11
 
15
12
  ```sh
16
- npm install -g @bash0816/cluade-code@latest
13
+ npm uninstall -g @bash0816/cluade-code
14
+ npm install -g @bash0816/claude-code@latest
17
15
  ```
18
16
 
19
- If an older audited launcher from this repository already exists at `$PREFIX/bin/claude`, migrate through the updated launcher.
17
+ Or use the built-in migration:
20
18
 
21
- この repository の古い監査済み launcher が `$PREFIX/bin/claude` にある場合は、更新済み launcher 経由で移行します。
19
+ 内蔵の migration を使う場合:
22
20
 
23
21
  ```sh
24
22
  claude update
25
23
  ```
26
24
 
27
- If npm reports `EEXIST` before package scripts run, use a one-time forced migration.
28
-
29
- package script 実行前に npm が `EEXIST` を返す場合は、初回だけ forced migration を使います。
30
-
31
- ```sh
32
- npm install -g --force @bash0816/cluade-code@latest
33
- ```
34
-
35
- After npm owns the `claude` bin link, normal `npm install -g` updates work.
36
-
37
- npm が `claude` bin link を管理する状態になれば、通常の `npm install -g` 更新が使えます。
38
-
39
- Specific audited version:
40
-
41
- 監査済みの固定 version:
42
-
43
- ```sh
44
- npm install -g @bash0816/cluade-code@2.1.123
45
- ```
46
-
47
- ## Update / 更新
48
-
49
- ```sh
50
- claude update
51
- ```
52
-
53
- `claude update` checks the GitHub release manifest and installs the latest audited package version.
54
-
55
- `claude update` は GitHub release manifest を確認し、最新の監査済み package version を install します。
56
-
57
- For the final legacy bridge release, `claude update` migrates this typo package to the canonical package.
58
-
59
- 最終 legacy bridge release では、`claude update` がこの typo package から canonical package へ移行します。
60
-
61
- This final bridge package is frozen at package version `2.1.123` and launches audited native `2.1.150` by default from the synced metadata set.
62
-
63
- この最終 bridge package は package version `2.1.123` で凍結し、同期済み metadata 集合から既定では監査済み native `2.1.150` を起動します。
64
-
65
- ```sh
66
- npm install -g @bash0816/claude-code@<latest_audited_version>
67
- ```
68
-
69
- Normal launch also checks the same manifest with a short timeout and prints a notice when a newer audited version is available.
70
-
71
- 通常起動時も、同じ manifest を短い timeout で確認し、新しい監査済み version があれば通知します。
25
+ ## Note
72
26
 
73
- ## Policy / 方針
27
+ This is a legacy compatibility package with a typo in the package name.
28
+ All new releases are published under [@bash0816/claude-code](https://www.npmjs.com/package/@bash0816/claude-code).
74
29
 
75
- - Only audited versions in `config/claude-native-audited-versions.json` can run.
76
- - `config/claude-native-audited-versions.json` にある監査済み version だけを実行できます。
77
- - This legacy package is frozen at `2.1.123` and exists only as a migration bridge to `@bash0816/claude-code`.
78
- - この legacy package は `2.1.123` で凍結しており、`@bash0816/claude-code` への migration bridge としてのみ存在します。
79
- - The metadata file remains the source of truth for the audited version set.
80
- - 監査済み version 集合の source of truth は引き続き metadata file です。
81
- - Native artifacts are cached under `${HOME}/.claude-termux-native-package`.
82
- - native artifact は `${HOME}/.claude-termux-native-package` に cache します。
83
- - If native preparation fails, the command exits with an error.
84
- - native preparation に失敗した場合、command は error で終了します。
30
+ このパッケージはパッケージ名に typo がある legacy 互換パッケージです。
31
+ 新しいリリースはすべて [@bash0816/claude-code](https://www.npmjs.com/package/@bash0816/claude-code) で公開されています。
@@ -188,6 +188,20 @@
188
188
  "entry_js_offset": 222957812,
189
189
  "entry_end_offset": 238483519,
190
190
  "status": "termux_verified"
191
+ },
192
+ "2.1.157": {
193
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.157",
194
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.157",
195
+ "entry_js_offset": 223210916,
196
+ "entry_end_offset": 238725072,
197
+ "status": "termux_verified"
198
+ },
199
+ "2.1.157-1": {
200
+ "wrapper_spec": "@anthropic-ai/claude-code@2.1.157",
201
+ "native_spec": "@anthropic-ai/claude-code-linux-arm64@2.1.157",
202
+ "entry_js_offset": 223210916,
203
+ "entry_end_offset": 238725072,
204
+ "status": "candidate"
191
205
  }
192
206
  }
193
207
  }
@@ -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.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",
7
+ "bridge_package_version": "2.1.157-1",
8
+ "default_native_version": "2.1.157-1",
9
+ "latest_audited_version": "2.1.157",
10
+ "latest_candidate_version": "2.1.157-1",
11
+ "previous_stable_version": "2.1.157",
12
12
  "manifest_url": "https://raw.githubusercontent.com/bash0816/ClaudeCode-Termux/main/config/claude-termux-release-manifest.json"
13
13
  }
@@ -235,7 +235,29 @@ async function runUpdate() {
235
235
  return 0;
236
236
  }
237
237
  if (target.migration) {
238
- console.error(`Migrating from legacy package ${pkg.name} to canonical package ${target.packageName}@${target.targetVersion}`);
238
+ console.error(`Migrating from ${pkg.name} to ${target.packageName}@${target.targetVersion}`);
239
+ if (dryRun) {
240
+ console.log(`npm uninstall -g ${pkg.name}`);
241
+ console.log(`npm install -g ${target.packageName}@${target.targetVersion}`);
242
+ return 0;
243
+ }
244
+ console.error(`Step 1: Uninstalling ${pkg.name}...`);
245
+ const uninstall = cp.spawnSync('npm', ['uninstall', '-g', pkg.name], { stdio: 'inherit', env: process.env });
246
+ if (uninstall.status !== 0) {
247
+ console.error(`Uninstall failed (exit ${uninstall.status}). Cannot safely continue migration.`);
248
+ console.error(`Run manually:`);
249
+ console.error(` npm uninstall -g ${pkg.name}`);
250
+ console.error(` npm install -g ${target.packageName}@${target.targetVersion}`);
251
+ return 1;
252
+ }
253
+ console.error(`Step 2: Installing ${target.packageName}@${target.targetVersion}...`);
254
+ const result = cp.spawnSync('npm', ['install', '-g', `${target.packageName}@${target.targetVersion}`], { stdio: 'inherit', env: process.env });
255
+ if (result.status !== 0) {
256
+ console.error(`Install failed. To restore, run:`);
257
+ console.error(` npm install -g ${target.packageName}@${target.targetVersion}`);
258
+ console.error(` # or to restore legacy: npm install -g ${pkg.name}@${pkg.version}`);
259
+ }
260
+ return result.status === null ? 1 : result.status;
239
261
  }
240
262
  return installTarget(target.packageName, target.targetVersion);
241
263
  }
@@ -74,6 +74,38 @@ function ensureEntryFile() {
74
74
  }
75
75
 
76
76
  function createFakeRequire(realRequire) {
77
+ const realVm = realRequire('vm');
78
+
79
+ function injectBunIntoContext(context) {
80
+ if (!context || typeof context !== 'object') return context;
81
+ try {
82
+ if (!Object.prototype.hasOwnProperty.call(context, 'Bun')) {
83
+ Object.defineProperty(context, 'Bun', {
84
+ value: globalThis.Bun,
85
+ configurable: true,
86
+ writable: true,
87
+ });
88
+ }
89
+ } catch {}
90
+ return context;
91
+ }
92
+
93
+ if (!realVm.__bunShimPatched) {
94
+ const origCreateContext = realVm.createContext.bind(realVm);
95
+ const origRunInNewContext = realVm.runInNewContext.bind(realVm);
96
+ realVm.createContext = (ctx, ...rest) => origCreateContext(injectBunIntoContext(ctx), ...rest);
97
+ realVm.runInNewContext = (code, ctx, ...rest) => origRunInNewContext(code, injectBunIntoContext(ctx), ...rest);
98
+ const ScriptProto = realVm.Script && realVm.Script.prototype;
99
+ if (ScriptProto && !ScriptProto.__bunShimPatched) {
100
+ const origRunInContext = ScriptProto.runInContext;
101
+ const origRunInNewCtx = ScriptProto.runInNewContext;
102
+ ScriptProto.runInContext = function(ctx, ...rest) { return origRunInContext.call(this, injectBunIntoContext(ctx), ...rest); };
103
+ ScriptProto.runInNewContext = function(ctx, ...rest) { return origRunInNewCtx.call(this, injectBunIntoContext(ctx), ...rest); };
104
+ Object.defineProperty(ScriptProto, '__bunShimPatched', { value: true });
105
+ }
106
+ Object.defineProperty(realVm, '__bunShimPatched', { value: true });
107
+ }
108
+
77
109
  const realChild = realRequire('child_process');
78
110
  function rewriteArgs(args) {
79
111
  if (
@@ -111,6 +143,8 @@ function createFakeRequire(realRequire) {
111
143
  };
112
144
  }
113
145
 
146
+ if (id === 'vm') return realVm;
147
+
114
148
  if (id.startsWith('/$bunfs/root/')) {
115
149
  throw new Error('bunfs require blocked: ' + id);
116
150
  }
@@ -449,6 +483,177 @@ const semver = {
449
483
  },
450
484
  };
451
485
 
486
+ function bunSpawn(argv, options) {
487
+ const childProcess = require('child_process');
488
+ options = options || {};
489
+ if (!Array.isArray(argv) || argv.length === 0) {
490
+ throw new TypeError('Bun.spawn expects a non-empty argv array');
491
+ }
492
+ const command = argv[0];
493
+ const args = argv.slice(1);
494
+ const terminal = options.terminal || null;
495
+
496
+ function resolveStdio(val, fallback) {
497
+ if (val === 'ignore' || val === 'inherit' || val === 'pipe') return val;
498
+ return fallback;
499
+ }
500
+
501
+ let stdioSpec;
502
+ if (terminal) {
503
+ stdioSpec = ['pipe', 'pipe', 'pipe'];
504
+ } else if (Array.isArray(options.stdio)) {
505
+ stdioSpec = options.stdio.map(function(s) { return resolveStdio(s, 'pipe'); });
506
+ } else {
507
+ stdioSpec = [
508
+ resolveStdio(options.stdin, 'pipe'),
509
+ resolveStdio(options.stdout, 'pipe'),
510
+ resolveStdio(options.stderr, 'pipe'),
511
+ ];
512
+ }
513
+
514
+ const nodeChild = childProcess.spawn(command, args, {
515
+ cwd: options.cwd,
516
+ env: options.env || process.env,
517
+ detached: options.detached,
518
+ windowsHide: options.windowsHide,
519
+ stdio: stdioSpec,
520
+ });
521
+
522
+ if (terminal) {
523
+ const fireData = function(chunk) {
524
+ if (!terminal._closed && terminal._options && typeof terminal._options.data === 'function') {
525
+ terminal._options.data(terminal, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
526
+ }
527
+ };
528
+ if (nodeChild.stdout) nodeChild.stdout.on('data', fireData);
529
+ if (nodeChild.stderr) nodeChild.stderr.on('data', fireData);
530
+ const origWrite = terminal.write.bind(terminal);
531
+ terminal.write = function(data) {
532
+ if (nodeChild.stdin && !nodeChild.stdin.destroyed) {
533
+ nodeChild.stdin.write(Buffer.isBuffer(data) ? data : Buffer.from(data));
534
+ }
535
+ return origWrite(data);
536
+ };
537
+ }
538
+
539
+ nodeChild.exited = new Promise(function(resolve) {
540
+ nodeChild.once('exit', function(code, signal) {
541
+ resolve(code != null ? code : (signal ? 1 : 0));
542
+ });
543
+ });
544
+
545
+ function makeTextReader(stream) {
546
+ return {
547
+ text: function() {
548
+ return new Promise(function(resolve, reject) {
549
+ if (!stream) return resolve('');
550
+ const chunks = [];
551
+ stream.on('data', function(chunk) { chunks.push(chunk); });
552
+ stream.on('end', function() { resolve(Buffer.concat(chunks).toString('utf8')); });
553
+ stream.on('error', reject);
554
+ });
555
+ },
556
+ };
557
+ }
558
+ if (nodeChild.stdout) Object.assign(nodeChild.stdout, makeTextReader(nodeChild.stdout));
559
+ if (nodeChild.stderr) Object.assign(nodeChild.stderr, makeTextReader(nodeChild.stderr));
560
+ return nodeChild;
561
+ }
562
+
563
+ class TerminalShim {
564
+ constructor(options) {
565
+ options = options || {};
566
+ this._options = options;
567
+ this._cols = options.cols || 80;
568
+ this._rows = options.rows || 24;
569
+ this._closed = false;
570
+ }
571
+ write(data) {
572
+ if (this._closed) return;
573
+ if (this._options.data) this._options.data(this, Buffer.isBuffer(data) ? data : Buffer.from(data));
574
+ }
575
+ resize(cols, rows) {
576
+ this._cols = cols;
577
+ this._rows = rows;
578
+ }
579
+ close() {
580
+ this._closed = true;
581
+ }
582
+ }
583
+
584
+ function bunListen(options) {
585
+ const net = require('net');
586
+ options = options || {};
587
+ const sockets = new Set();
588
+ const server = net.createServer(function(socket) {
589
+ sockets.add(socket);
590
+ const connection = {
591
+ data: undefined,
592
+ write: function(chunk) {
593
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
594
+ const ok = socket.write(buffer);
595
+ return ok ? buffer.length : 0;
596
+ },
597
+ end: function(chunk) { socket.end(chunk); },
598
+ destroy: function(error) { socket.destroy(error); },
599
+ };
600
+ socket.on('data', function(chunk) {
601
+ if (options.socket && typeof options.socket.data === 'function') {
602
+ options.socket.data(connection, chunk);
603
+ }
604
+ });
605
+ socket.on('drain', function() {
606
+ if (options.socket && typeof options.socket.drain === 'function') {
607
+ options.socket.drain(connection);
608
+ }
609
+ });
610
+ socket.on('close', function() {
611
+ sockets.delete(socket);
612
+ if (options.socket && typeof options.socket.close === 'function') {
613
+ options.socket.close(connection);
614
+ }
615
+ });
616
+ socket.on('error', function(error) {
617
+ if (options.socket && typeof options.socket.error === 'function') {
618
+ options.socket.error(connection, error);
619
+ }
620
+ });
621
+ if (options.socket && typeof options.socket.open === 'function') {
622
+ options.socket.open(connection);
623
+ }
624
+ });
625
+ server.listen(options.port || 0, options.hostname || '127.0.0.1');
626
+ return {
627
+ get port() {
628
+ const address = server.address();
629
+ return address && typeof address === 'object' ? address.port : 0;
630
+ },
631
+ stop: function(closeConnections) {
632
+ server.close();
633
+ if (closeConnections) {
634
+ for (const socket of sockets) socket.destroy();
635
+ }
636
+ },
637
+ };
638
+ }
639
+
640
+ class BunTranspiler {
641
+ constructor(_options) {}
642
+ transformSync(code) { return typeof code === 'string' ? code : ''; }
643
+ scanImports(code) {
644
+ const imports = [];
645
+ const str = String(code);
646
+ const reStatic = /(?:^|[^.])import\s+(?:[^'"]+\s+from\s+)?['"]([^'"]+)['"]/gm;
647
+ const reDynamic = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
648
+ const reRequire = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
649
+ let m;
650
+ while ((m = reStatic.exec(str)) !== null) imports.push({ path: m[1], kind: 'import-statement' });
651
+ while ((m = reDynamic.exec(str)) !== null) imports.push({ path: m[1], kind: 'dynamic-import' });
652
+ while ((m = reRequire.exec(str)) !== null) imports.push({ path: m[1], kind: 'require-call' });
653
+ return imports;
654
+ }
655
+ }
656
+
452
657
  async function main() {
453
658
  const extractedFile = ensureEntryFile();
454
659
  const code = fs.readFileSync(extractedFile, 'utf8');
@@ -475,15 +680,20 @@ async function main() {
475
680
  stringWidth,
476
681
  hash: hashValue,
477
682
  which,
683
+ spawn: bunSpawn,
478
684
  wrapAnsi,
479
685
  stripANSI,
480
686
  semver,
687
+ Terminal: TerminalShim,
688
+ listen: bunListen,
689
+ Transpiler: BunTranspiler,
481
690
  YAML,
482
691
  gc: (sync) => {
483
692
  try {
484
693
  if (typeof global.gc === 'function') global.gc(sync === false ? false : true);
485
694
  } catch {}
486
695
  },
696
+ generateHeapSnapshot: () => Buffer.alloc(0),
487
697
  stdin: { stream: null },
488
698
  embeddedFiles: [],
489
699
  };
@@ -528,7 +738,9 @@ async function main() {
528
738
  }
529
739
  }
530
740
 
531
- main().catch(error => {
741
+ main().then(() => {
742
+ process.exit(process.exitCode ?? 0);
743
+ }).catch(error => {
532
744
  console.error(error && error.stack ? error.stack : String(error));
533
745
  process.exit(1);
534
746
  });
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@bash0816/claude-code",
3
- "version": "2.1.156",
3
+ "version": "2.1.157-1",
4
4
  "description": "Termux-native Claude Code wrapper with audited native replay",
5
5
  "license": "MIT",
6
6
  "bin": {
7
7
  "claude": "bin/claude"
8
8
  },
9
- "scripts": {
10
- "preinstall": "node lib/preinstall.js",
11
- "postinstall": "node lib/postinstall.js"
12
- },
13
9
  "files": [
14
10
  "bin",
15
11
  "lib",