@bitfun-test/bitfun 0.2.19-daily.20260828 → 0.2.19-daily.20260828.linux-x64

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/package.json CHANGED
@@ -1,28 +1,21 @@
1
1
  {
2
2
  "name": "@bitfun-test/bitfun",
3
- "version": "0.2.19-daily.20260828",
4
- "description": "BitFun CLI - terminal AI agent",
3
+ "version": "0.2.19-daily.20260828.linux-x64",
4
+ "description": "Native BitFun CLI binary for linux x64",
5
5
  "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "bitfun": "bin/bitfun.js"
9
- },
10
- "engines": {
11
- "node": ">=18"
12
- },
6
+ "os": [
7
+ "linux"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
13
12
  "files": [
14
- "bin",
13
+ "vendor",
15
14
  "README.md",
16
15
  "LICENSE",
17
16
  "THIRD_PARTY_NOTICES.md",
18
17
  "third-party"
19
18
  ],
20
- "optionalDependencies": {
21
- "@bitfun-test/bitfun-linux-x64": "npm:@bitfun-test/bitfun@0.2.19-daily.20260828.linux-x64",
22
- "@bitfun-test/bitfun-darwin-arm64": "npm:@bitfun-test/bitfun@0.2.19-daily.20260828.darwin-arm64",
23
- "@bitfun-test/bitfun-win32-x64": "npm:@bitfun-test/bitfun@0.2.19-daily.20260828.win32-x64",
24
- "@bitfun-test/bitfun-ohos-arm64": "npm:@bitfun-test/bitfun@0.2.19-daily.20260828.ohos-arm64"
25
- },
26
19
  "repository": {
27
20
  "type": "git",
28
21
  "url": "git+https://github.com/GCWing/BitFun.git",
package/bin/bitfun.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { run } from "./launcher.js";
4
-
5
- await run("bitfun");
package/bin/launcher.js DELETED
@@ -1,101 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { existsSync } from "node:fs";
3
- import { createRequire } from "node:module";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
-
7
- const require = createRequire(import.meta.url);
8
- const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
- const packageManifest = require(path.join(packageRoot, "package.json"));
10
- const packageScope = packageManifest.name.split("/")[0];
11
-
12
- const PLATFORM_BY_RUNTIME = new Map([
13
- ["linux:x64", {
14
- packageName: `${packageScope}/bitfun-linux-x64`,
15
- target: "x86_64-unknown-linux-gnu",
16
- }],
17
- ["darwin:arm64", {
18
- packageName: `${packageScope}/bitfun-darwin-arm64`,
19
- target: "aarch64-apple-darwin",
20
- }],
21
- ["win32:x64", {
22
- packageName: `${packageScope}/bitfun-win32-x64`,
23
- target: "x86_64-pc-windows-msvc",
24
- }],
25
- ["openharmony:arm64", {
26
- packageName: `${packageScope}/bitfun-ohos-arm64`,
27
- target: "aarch64-unknown-linux-ohos",
28
- }],
29
- ]);
30
-
31
- export function platformPackage(platform = process.platform, arch = process.arch) {
32
- return PLATFORM_BY_RUNTIME.get(`${platform}:${arch}`) ?? null;
33
- }
34
-
35
- export function findNativeExecutable(command, platform = process.platform, arch = process.arch) {
36
- if (command !== "bitfun") {
37
- throw new Error(`Unsupported BitFun CLI command: ${command}`);
38
- }
39
-
40
- const selected = platformPackage(platform, arch);
41
- if (!selected) {
42
- throw new Error(`Unsupported platform: ${platform} (${arch})`);
43
- }
44
-
45
- let vendorRoot;
46
- try {
47
- const packageJson = require.resolve(`${selected.packageName}/package.json`);
48
- vendorRoot = path.join(path.dirname(packageJson), "vendor");
49
- } catch {
50
- // This fallback supports a manually assembled package with vendor content.
51
- vendorRoot = path.join(packageRoot, "vendor");
52
- }
53
-
54
- const executableName = platform === "win32" ? "bitfun.exe" : "bitfun";
55
- const executable = path.join(vendorRoot, selected.target, "bin", executableName);
56
- if (existsSync(executable)) {
57
- return executable;
58
- }
59
-
60
- throw new Error(
61
- `Missing optional dependency ${selected.packageName}. ` +
62
- `Reinstall BitFun CLI with: npm install -g ${packageManifest.name}@latest`,
63
- );
64
- }
65
-
66
- export async function run(command) {
67
- const executable = findNativeExecutable(command);
68
- const child = spawn(executable, process.argv.slice(2), {
69
- stdio: "inherit",
70
- env: {
71
- ...process.env,
72
- BITFUN_MANAGED_BY_NPM: "1",
73
- BITFUN_MANAGED_PACKAGE_ROOT: packageRoot,
74
- },
75
- });
76
-
77
- const forwardSignal = (signal) => {
78
- if (!child.killed) {
79
- try {
80
- child.kill(signal);
81
- } catch {
82
- // The child may have exited between the killed check and child.kill().
83
- }
84
- }
85
- };
86
-
87
- for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
88
- process.on(signal, () => forwardSignal(signal));
89
- }
90
-
91
- const result = await new Promise((resolve, reject) => {
92
- child.once("error", reject);
93
- child.once("exit", (code, signal) => resolve({ code, signal }));
94
- });
95
-
96
- if (result.signal) {
97
- process.kill(process.pid, result.signal);
98
- return;
99
- }
100
- process.exit(result.code ?? 1);
101
- }