bincode-dev 0.0.24 → 0.0.26

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 +1 @@
1
- # bincode-dev
1
+ # bincode-dev
package/bin/bincode CHANGED
@@ -1,113 +1,113 @@
1
- #!/usr/bin/env node
2
-
3
- const childProcess = require("child_process")
4
- const fs = require("fs")
5
- const path = require("path")
6
- const os = require("os")
7
-
8
- function printWrapperVersionAndExit() {
9
- try {
10
- const pkgPath = path.join(__dirname, "..", "package.json")
11
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
12
- if (pkg && pkg.version) {
13
- process.stdout.write(String(pkg.version) + "\n")
14
- process.exit(0)
15
- }
16
- } catch {
17
- // ignore
18
- }
19
- }
20
-
21
- // Ensure `bincode -v/--version/version` always reports the wrapper npm package version,
22
- // not whatever is embedded inside the native binary (which can be confusing during publishing tests).
23
- const rawArgs = process.argv.slice(2)
24
- if (rawArgs.includes("-v") || rawArgs.includes("--version") || rawArgs[0] === "version") {
25
- printWrapperVersionAndExit()
26
- }
27
-
28
- function run(target) {
29
- const env = { ...process.env }
30
- // Ensure this package variant uses its own config/data directories.
31
- if (!env.BINCODE_APP_ID) env.BINCODE_APP_ID = "bincode-dev"
32
- // Provide package-level defaults, but never override user-provided env vars.
33
- // bincode -> staging (requested) -- mirror the same defaults for testing
34
- if (!env.BINERIC_API_URL) env.BINERIC_API_URL = "https://stagingapi.bineric.com/api/v1/ai"
35
- if (!env.BINERIC_FRONTEND_URL) env.BINERIC_FRONTEND_URL = "https://stagingplatform.bineric.com"
36
-
37
- // Best-effort: ensure executable bit on mac/linux.
38
- try {
39
- if (os.platform() !== "win32") fs.chmodSync(target, 0o755)
40
- } catch {
41
- // ignore
42
- }
43
-
44
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
45
- stdio: "inherit",
46
- env,
47
- })
48
- if (result.error) {
49
- console.error(result.error.message)
50
- process.exit(1)
51
- }
52
- const code = typeof result.status === "number" ? result.status : 0
53
- process.exit(code)
54
- }
55
-
56
- const platform = os.platform()
57
- const arch = os.arch()
58
-
59
- const targetPkgMap = {
60
- "darwin:arm64": "bincode-dev-darwin-arm64",
61
- "darwin:x64": "bincode-dev-darwin-x64",
62
- "linux:x64": "bincode-dev-linux-x64",
63
- "win32:x64": "bincode-dev-windows-x64",
64
- }
65
-
66
- const key = `${platform}:${arch}`
67
- const targetPkg = targetPkgMap[key]
68
- const binaryName = platform === "win32" ? "bincode.exe" : "bincode"
69
-
70
- if (!targetPkg) {
71
- console.error(
72
- [
73
- `Unsupported platform/arch: ${platform}/${arch}`,
74
- `No prebuilt bincode binary is published for this target.`,
75
- ].join("\n"),
76
- )
77
- process.exit(1)
78
- }
79
-
80
- let pkgRoot
81
- try {
82
- pkgRoot = path.dirname(require.resolve(`${targetPkg}/package.json`))
83
- } catch {
84
- console.error(
85
- [
86
- `Missing optional dependency: ${targetPkg}`,
87
- ``,
88
- `This usually happens if you installed with --no-optional (or your package manager skipped optional deps).`,
89
- `Also check that install scripts are not disabled (npm config ignore-scripts).`,
90
- `Reinstall without skipping optional dependencies, e.g.:`,
91
- ` npm i bincode-dev`,
92
- ``,
93
- `Or install the platform package directly:`,
94
- ` npm i ${targetPkg}`,
95
- ].join("\n"),
96
- )
97
- process.exit(1)
98
- }
99
-
100
- const candidate = path.join(pkgRoot, "bin", binaryName)
101
- if (!fs.existsSync(candidate)) {
102
- console.error(
103
- [
104
- `Could not find bincode binary inside ${targetPkg}.`,
105
- `Expected at:`,
106
- ` ${candidate}`,
107
- ].join("\n"),
108
- )
109
- process.exit(1)
110
- }
111
-
112
- run(candidate)
113
-
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require("child_process")
4
+ const fs = require("fs")
5
+ const path = require("path")
6
+ const os = require("os")
7
+
8
+ function printWrapperVersionAndExit() {
9
+ try {
10
+ const pkgPath = path.join(__dirname, "..", "package.json")
11
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
12
+ if (pkg && pkg.version) {
13
+ process.stdout.write(String(pkg.version) + "\n")
14
+ process.exit(0)
15
+ }
16
+ } catch {
17
+ // ignore
18
+ }
19
+ }
20
+
21
+ // Ensure `bincode -v/--version/version` always reports the wrapper npm package version,
22
+ // not whatever is embedded inside the native binary (which can be confusing during publishing tests).
23
+ const rawArgs = process.argv.slice(2)
24
+ if (rawArgs.includes("-v") || rawArgs.includes("--version") || rawArgs[0] === "version") {
25
+ printWrapperVersionAndExit()
26
+ }
27
+
28
+ function run(target) {
29
+ const env = { ...process.env }
30
+ // Ensure this package variant uses its own config/data directories.
31
+ if (!env.BINCODE_APP_ID) env.BINCODE_APP_ID = "bincode-dev"
32
+ // Provide package-level defaults, but never override user-provided env vars.
33
+ // bincode -> staging (requested) -- mirror the same defaults for testing
34
+ if (!env.BINERIC_API_URL) env.BINERIC_API_URL = "https://stagingapi.bineric.com/api/v1/ai"
35
+ if (!env.BINERIC_FRONTEND_URL) env.BINERIC_FRONTEND_URL = "https://stagingplatform.bineric.com"
36
+
37
+ // Best-effort: ensure executable bit on mac/linux.
38
+ try {
39
+ if (os.platform() !== "win32") fs.chmodSync(target, 0o755)
40
+ } catch {
41
+ // ignore
42
+ }
43
+
44
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
45
+ stdio: "inherit",
46
+ env,
47
+ })
48
+ if (result.error) {
49
+ console.error(result.error.message)
50
+ process.exit(1)
51
+ }
52
+ const code = typeof result.status === "number" ? result.status : 0
53
+ process.exit(code)
54
+ }
55
+
56
+ const platform = os.platform()
57
+ const arch = os.arch()
58
+
59
+ const targetPkgMap = {
60
+ "darwin:arm64": "bincode-dev-darwin-arm64",
61
+ "darwin:x64": "bincode-dev-darwin-x64",
62
+ "linux:x64": "bincode-dev-linux-x64",
63
+ "win32:x64": "bincode-dev-windows-x64",
64
+ }
65
+
66
+ const key = `${platform}:${arch}`
67
+ const targetPkg = targetPkgMap[key]
68
+ const binaryName = platform === "win32" ? "bincode.exe" : "bincode"
69
+
70
+ if (!targetPkg) {
71
+ console.error(
72
+ [
73
+ `Unsupported platform/arch: ${platform}/${arch}`,
74
+ `No prebuilt bincode binary is published for this target.`,
75
+ ].join("\n"),
76
+ )
77
+ process.exit(1)
78
+ }
79
+
80
+ let pkgRoot
81
+ try {
82
+ pkgRoot = path.dirname(require.resolve(`${targetPkg}/package.json`))
83
+ } catch {
84
+ console.error(
85
+ [
86
+ `Missing optional dependency: ${targetPkg}`,
87
+ ``,
88
+ `This usually happens if you installed with --no-optional (or your package manager skipped optional deps).`,
89
+ `Also check that install scripts are not disabled (npm config ignore-scripts).`,
90
+ `Reinstall without skipping optional dependencies, e.g.:`,
91
+ ` npm i bincode-dev`,
92
+ ``,
93
+ `Or install the platform package directly:`,
94
+ ` npm i ${targetPkg}`,
95
+ ].join("\n"),
96
+ )
97
+ process.exit(1)
98
+ }
99
+
100
+ const candidate = path.join(pkgRoot, "bin", binaryName)
101
+ if (!fs.existsSync(candidate)) {
102
+ console.error(
103
+ [
104
+ `Could not find bincode binary inside ${targetPkg}.`,
105
+ `Expected at:`,
106
+ ` ${candidate}`,
107
+ ].join("\n"),
108
+ )
109
+ process.exit(1)
110
+ }
111
+
112
+ run(candidate)
113
+
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "bincode-dev",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "Bincode: AI-powered development CLI (dev/test version, not affiliated with opencode)",
5
5
  "bin": {
6
6
  "bincode": "./bin/bincode"
7
7
  },
8
8
  "optionalDependencies": {
9
- "bincode-dev-darwin-arm64": "0.0.24",
10
- "bincode-dev-darwin-x64": "0.0.24",
11
- "bincode-dev-linux-x64": "0.0.24",
12
- "bincode-dev-windows-x64": "0.0.24"
9
+ "bincode-dev-darwin-arm64": "0.0.26",
10
+ "bincode-dev-darwin-x64": "0.0.26",
11
+ "bincode-dev-linux-x64": "0.0.26",
12
+ "bincode-dev-windows-x64": "0.0.26"
13
13
  },
14
14
  "scripts": {
15
15
  "build": "bun script/build.ts",
@@ -1,27 +1,27 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const os = require('os');
4
-
5
- const platformMap = {
6
- darwin: ['darwin-arm64', 'darwin-x64'],
7
- linux: ['linux-x64'],
8
- win32: ['windows-x64']
9
- };
10
-
11
- const distDir = path.join(__dirname, '..', 'dist');
12
-
13
- const currentPlatform = os.platform();
14
- const archs = platformMap[currentPlatform] || [];
15
-
16
- archs.forEach(arch => {
17
- const binPath = path.join(distDir, `opencode-${arch}`, 'bin', currentPlatform === 'win32' ? 'bincode.exe' : 'bincode');
18
- if (fs.existsSync(binPath)) {
19
- try {
20
- fs.chmodSync(binPath, 0o755);
21
- console.log(`Set executable: ${binPath}`);
22
- } catch (e) {
23
- console.warn(`Failed to chmod ${binPath}:`, e.message);
24
- }
25
- }
26
- });
27
-
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ const platformMap = {
6
+ darwin: ['darwin-arm64', 'darwin-x64'],
7
+ linux: ['linux-x64'],
8
+ win32: ['windows-x64']
9
+ };
10
+
11
+ const distDir = path.join(__dirname, '..', 'dist');
12
+
13
+ const currentPlatform = os.platform();
14
+ const archs = platformMap[currentPlatform] || [];
15
+
16
+ archs.forEach(arch => {
17
+ const binPath = path.join(distDir, `opencode-${arch}`, 'bin', currentPlatform === 'win32' ? 'bincode.exe' : 'bincode');
18
+ if (fs.existsSync(binPath)) {
19
+ try {
20
+ fs.chmodSync(binPath, 0o755);
21
+ console.log(`Set executable: ${binPath}`);
22
+ } catch (e) {
23
+ console.warn(`Failed to chmod ${binPath}:`, e.message);
24
+ }
25
+ }
26
+ });
27
+
@@ -1,46 +1,46 @@
1
- /**
2
- * Self-heal install: ensure the correct platform binary package exists.
3
- *
4
- * Some npm setups (especially global installs) may skip optionalDependencies.
5
- * We still want `npm i(-g) bincode-dev` to work without manual platform installs.
6
- */
7
- const childProcess = require("child_process")
8
- const fs = require("fs")
9
- const path = require("path")
10
- const os = require("os")
11
-
12
- const root = path.join(__dirname, "..")
13
- const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"))
14
- const version = pkg.version
15
-
16
- const platform = os.platform()
17
- const arch = os.arch()
18
-
19
- const targetPkgMap = {
20
- "darwin:arm64": "bincode-dev-darwin-arm64",
21
- "darwin:x64": "bincode-dev-darwin-x64",
22
- "linux:x64": "bincode-dev-linux-x64",
23
- "win32:x64": "bincode-dev-windows-x64",
24
- }
25
-
26
- const targetPkg = targetPkgMap[`${platform}:${arch}`]
27
- if (!targetPkg || !version) process.exit(0)
28
-
29
- function isInstalled() {
30
- try {
31
- require.resolve(`${targetPkg}/package.json`, { paths: [root] })
32
- return true
33
- } catch {
34
- return false
35
- }
36
- }
37
-
38
- if (isInstalled()) process.exit(0)
39
-
40
- const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm"
41
- const args = ["install", "--no-save", "--no-audit", "--no-fund", `${targetPkg}@${version}`]
42
-
43
- // Install into bincode-dev's own node_modules so `require.resolve()` works reliably.
44
- childProcess.spawnSync(npmCmd, args, { cwd: root, stdio: "inherit", env: process.env })
45
-
46
-
1
+ /**
2
+ * Self-heal install: ensure the correct platform binary package exists.
3
+ *
4
+ * Some npm setups (especially global installs) may skip optionalDependencies.
5
+ * We still want `npm i(-g) bincode-dev` to work without manual platform installs.
6
+ */
7
+ const childProcess = require("child_process")
8
+ const fs = require("fs")
9
+ const path = require("path")
10
+ const os = require("os")
11
+
12
+ const root = path.join(__dirname, "..")
13
+ const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"))
14
+ const version = pkg.version
15
+
16
+ const platform = os.platform()
17
+ const arch = os.arch()
18
+
19
+ const targetPkgMap = {
20
+ "darwin:arm64": "bincode-dev-darwin-arm64",
21
+ "darwin:x64": "bincode-dev-darwin-x64",
22
+ "linux:x64": "bincode-dev-linux-x64",
23
+ "win32:x64": "bincode-dev-windows-x64",
24
+ }
25
+
26
+ const targetPkg = targetPkgMap[`${platform}:${arch}`]
27
+ if (!targetPkg || !version) process.exit(0)
28
+
29
+ function isInstalled() {
30
+ try {
31
+ require.resolve(`${targetPkg}/package.json`, { paths: [root] })
32
+ return true
33
+ } catch {
34
+ return false
35
+ }
36
+ }
37
+
38
+ if (isInstalled()) process.exit(0)
39
+
40
+ const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm"
41
+ const args = ["install", "--no-save", "--no-audit", "--no-fund", `${targetPkg}@${version}`]
42
+
43
+ // Install into bincode-dev's own node_modules so `require.resolve()` works reliably.
44
+ childProcess.spawnSync(npmCmd, args, { cwd: root, stdio: "inherit", env: process.env })
45
+
46
+
@@ -1,90 +1,90 @@
1
- /**
2
- * prepack cleanup to keep the published npm tarball small.
3
- *
4
- * Runs automatically on `npm pack` and `npm publish`.
5
- *
6
- * What it does:
7
- * - Removes accidental nested package output at `dist/bincode-dev` (it includes a full copy of the web console).
8
- * - Removes non-target platform binary variants (baseline/musl/extra arches).
9
- * - Removes sourcemaps from `app/dist` to reduce file count/size.
10
- */
11
- const fs = require("fs")
12
- const path = require("path")
13
-
14
- const root = path.join(__dirname, "..")
15
- const appDistDir = path.join(root, "app", "dist")
16
-
17
- function syncOptionalDependencyVersions() {
18
- const pkgPath = path.join(root, "package.json")
19
- let pkg
20
- try {
21
- pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
22
- } catch {
23
- return
24
- }
25
-
26
- const version = pkg.version
27
- if (!version) return
28
-
29
- const opt = pkg.optionalDependencies
30
- if (!opt) return
31
-
32
- // Keep these pinned exactly to the wrapper version to avoid mismatches.
33
- const keys = [
34
- "bincode-dev-darwin-arm64",
35
- "bincode-dev-darwin-x64",
36
- "bincode-dev-linux-x64",
37
- "bincode-dev-windows-x64",
38
- ]
39
-
40
- let changed = false
41
- for (const k of keys) {
42
- if (opt[k] !== version) {
43
- opt[k] = version
44
- changed = true
45
- }
46
- }
47
-
48
- if (changed) {
49
- pkg.optionalDependencies = opt
50
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n")
51
- console.log(`[prepack] synced optionalDependencies versions to ${version}`)
52
- }
53
- }
54
-
55
- function rmrf(targetPath) {
56
- try {
57
- fs.rmSync(targetPath, { recursive: true, force: true })
58
- } catch {
59
- // ignore
60
- }
61
- }
62
-
63
- function walkFiles(dir, visitor) {
64
- let entries
65
- try {
66
- entries = fs.readdirSync(dir, { withFileTypes: true })
67
- } catch {
68
- return
69
- }
70
-
71
- for (const e of entries) {
72
- const p = path.join(dir, e.name)
73
- if (e.isDirectory()) walkFiles(p, visitor)
74
- else if (e.isFile()) visitor(p)
75
- }
76
- }
77
-
78
- function removeSourcemaps() {
79
- // app/dist/**/*.map
80
- walkFiles(appDistDir, (p) => {
81
- if (p.endsWith(".map")) rmrf(p)
82
- })
83
- }
84
-
85
- syncOptionalDependencyVersions()
86
- removeSourcemaps()
87
-
88
- console.log("[prepack] removed sourcemaps")
89
-
90
-
1
+ /**
2
+ * prepack cleanup to keep the published npm tarball small.
3
+ *
4
+ * Runs automatically on `npm pack` and `npm publish`.
5
+ *
6
+ * What it does:
7
+ * - Removes accidental nested package output at `dist/bincode-dev` (it includes a full copy of the web console).
8
+ * - Removes non-target platform binary variants (baseline/musl/extra arches).
9
+ * - Removes sourcemaps from `app/dist` to reduce file count/size.
10
+ */
11
+ const fs = require("fs")
12
+ const path = require("path")
13
+
14
+ const root = path.join(__dirname, "..")
15
+ const appDistDir = path.join(root, "app", "dist")
16
+
17
+ function syncOptionalDependencyVersions() {
18
+ const pkgPath = path.join(root, "package.json")
19
+ let pkg
20
+ try {
21
+ pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
22
+ } catch {
23
+ return
24
+ }
25
+
26
+ const version = pkg.version
27
+ if (!version) return
28
+
29
+ const opt = pkg.optionalDependencies
30
+ if (!opt) return
31
+
32
+ // Keep these pinned exactly to the wrapper version to avoid mismatches.
33
+ const keys = [
34
+ "bincode-dev-darwin-arm64",
35
+ "bincode-dev-darwin-x64",
36
+ "bincode-dev-linux-x64",
37
+ "bincode-dev-windows-x64",
38
+ ]
39
+
40
+ let changed = false
41
+ for (const k of keys) {
42
+ if (opt[k] !== version) {
43
+ opt[k] = version
44
+ changed = true
45
+ }
46
+ }
47
+
48
+ if (changed) {
49
+ pkg.optionalDependencies = opt
50
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n")
51
+ console.log(`[prepack] synced optionalDependencies versions to ${version}`)
52
+ }
53
+ }
54
+
55
+ function rmrf(targetPath) {
56
+ try {
57
+ fs.rmSync(targetPath, { recursive: true, force: true })
58
+ } catch {
59
+ // ignore
60
+ }
61
+ }
62
+
63
+ function walkFiles(dir, visitor) {
64
+ let entries
65
+ try {
66
+ entries = fs.readdirSync(dir, { withFileTypes: true })
67
+ } catch {
68
+ return
69
+ }
70
+
71
+ for (const e of entries) {
72
+ const p = path.join(dir, e.name)
73
+ if (e.isDirectory()) walkFiles(p, visitor)
74
+ else if (e.isFile()) visitor(p)
75
+ }
76
+ }
77
+
78
+ function removeSourcemaps() {
79
+ // app/dist/**/*.map
80
+ walkFiles(appDistDir, (p) => {
81
+ if (p.endsWith(".map")) rmrf(p)
82
+ })
83
+ }
84
+
85
+ syncOptionalDependencyVersions()
86
+ removeSourcemaps()
87
+
88
+ console.log("[prepack] removed sourcemaps")
89
+
90
+