@nevaberry/opencodecommit 0.8.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.
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ const os = require("os");
3
+ const platform = os.platform();
4
+ const arch = os.arch();
5
+ console.error(
6
+ `opencodecommit: pre-built binary not yet available for ${platform}-${arch}.\n` +
7
+ `Install from source: cargo install opencodecommit\n` +
8
+ `Track progress: https://github.com/Nevaberry/opencodecommit`
9
+ );
10
+ process.exit(1);
package/index.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // Resolves the correct platform binary and returns its path.
3
+ // Used by: require("opencodecommit") in programmatic contexts.
4
+
5
+ const path = require("path")
6
+
7
+ const PLATFORMS = {
8
+ "linux-x64": "@nevaberry/opencodecommit-linux-x64",
9
+ "linux-arm64": "@nevaberry/opencodecommit-linux-arm64",
10
+ "darwin-x64": "@nevaberry/opencodecommit-darwin-x64",
11
+ "darwin-arm64": "@nevaberry/opencodecommit-darwin-arm64",
12
+ "win32-x64": "@nevaberry/opencodecommit-win32-x64",
13
+ }
14
+
15
+ function getBinaryPath() {
16
+ const platform = `${process.platform}-${process.arch}`
17
+ const pkg = PLATFORMS[platform]
18
+ if (!pkg) {
19
+ throw new Error(`opencodecommit: unsupported platform ${platform}`)
20
+ }
21
+
22
+ const binaryDir = path.dirname(require.resolve(`${pkg}/package.json`))
23
+ const ext = process.platform === "win32" ? ".exe" : ""
24
+ return path.join(binaryDir, `opencodecommit${ext}`)
25
+ }
26
+
27
+ module.exports = { getBinaryPath, PLATFORMS }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@nevaberry/opencodecommit",
3
+ "version": "0.8.1",
4
+ "description": "AI-powered git commit message generator that delegates to terminal AI agents",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/Nevaberry/opencodecommit"
9
+ },
10
+ "bin": {
11
+ "opencodecommit": "bin/opencodecommit"
12
+ },
13
+ "scripts": {
14
+ "postinstall": "node scripts/postinstall.js"
15
+ },
16
+ "optionalDependencies": {
17
+ "@nevaberry/opencodecommit-linux-x64": "0.8.1",
18
+ "@nevaberry/opencodecommit-linux-arm64": "0.8.1",
19
+ "@nevaberry/opencodecommit-darwin-x64": "0.8.1",
20
+ "@nevaberry/opencodecommit-darwin-arm64": "0.8.1",
21
+ "@nevaberry/opencodecommit-win32-x64": "0.8.1"
22
+ },
23
+ "keywords": [
24
+ "git",
25
+ "commit",
26
+ "ai",
27
+ "cli",
28
+ "opencode",
29
+ "claude",
30
+ "codex"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ }
35
+ }
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ // Resolve the platform-specific binary and symlink it to bin/opencodecommit
3
+
4
+ const fs = require("fs")
5
+ const path = require("path")
6
+
7
+ const PLATFORMS = {
8
+ "linux-x64": "@nevaberry/opencodecommit-linux-x64",
9
+ "linux-arm64": "@nevaberry/opencodecommit-linux-arm64",
10
+ "darwin-x64": "@nevaberry/opencodecommit-darwin-x64",
11
+ "darwin-arm64": "@nevaberry/opencodecommit-darwin-arm64",
12
+ "win32-x64": "@nevaberry/opencodecommit-win32-x64",
13
+ }
14
+
15
+ const platform = `${process.platform}-${process.arch}`
16
+ const pkg = PLATFORMS[platform]
17
+
18
+ if (!pkg) {
19
+ console.error(`opencodecommit: unsupported platform ${platform}`)
20
+ console.error(`Supported: ${Object.keys(PLATFORMS).join(", ")}`)
21
+ process.exit(0) // Don't fail install, just warn
22
+ }
23
+
24
+ try {
25
+ const binaryDir = path.dirname(require.resolve(`${pkg}/package.json`))
26
+ const ext = process.platform === "win32" ? ".exe" : ""
27
+ const binaryPath = path.join(binaryDir, `opencodecommit${ext}`)
28
+ const binTarget = path.join(__dirname, "..", "bin", `opencodecommit${ext}`)
29
+
30
+ // Remove existing symlink/file
31
+ try { fs.unlinkSync(binTarget) } catch { /* ok */ }
32
+
33
+ // Create symlink (or copy on Windows)
34
+ if (process.platform === "win32") {
35
+ fs.copyFileSync(binaryPath, binTarget)
36
+ } else {
37
+ fs.symlinkSync(binaryPath, binTarget)
38
+ fs.chmodSync(binTarget, 0o755)
39
+ }
40
+ } catch (err) {
41
+ console.error(`opencodecommit: failed to link binary for ${platform}`)
42
+ console.error(err.message)
43
+ process.exit(0) // Don't fail install
44
+ }