opencode-collab 1.3.10 → 1.3.11

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,35 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const platform = process.platform;
7
+ const arch = process.arch;
8
+
9
+ let binName;
10
+ if (platform === 'darwin') {
11
+ binName = arch === 'arm64' ? 'opencode-collab-darwin-arm64' : 'opencode-collab-darwin-x64';
12
+ } else if (platform === 'linux') {
13
+ binName = arch === 'arm64' ? 'opencode-collab-linux-arm64' : 'opencode-collab-linux-x64';
14
+ } else if (platform === 'win32') {
15
+ binName = 'opencode-collab-windows-x64';
16
+ } else {
17
+ console.error('Unsupported platform:', platform, arch);
18
+ process.exit(1);
19
+ }
20
+
21
+ const binPath = path.join(
22
+ __dirname,
23
+ '..',
24
+ binName,
25
+ 'bin',
26
+ platform === 'win32' ? 'opencode.exe' : 'opencode'
27
+ );
28
+
29
+ if (!fs.existsSync(binPath)) {
30
+ console.error('Binary not found:', binPath);
31
+ console.error('Please ensure the package was installed correctly.');
32
+ process.exit(1);
33
+ }
34
+
35
+ execFileSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
package/install.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const platform = process.platform;
6
+ const arch = process.arch;
7
+
8
+ const platformMap = {
9
+ 'darwin-arm64': 'opencode-collab-darwin-arm64',
10
+ 'darwin-x64': 'opencode-collab-darwin-x64',
11
+ 'linux-arm64': 'opencode-collab-linux-arm64',
12
+ 'linux-x64': 'opencode-collab-linux-x64',
13
+ 'win32-x64': 'opencode-collab-windows-x64',
14
+ };
15
+
16
+ const key = platform + '-' + arch;
17
+ const needed = platformMap[key];
18
+
19
+ if (!needed) {
20
+ console.log('No binary available for platform:', key);
21
+ process.exit(0);
22
+ }
23
+
24
+ for (const [pkg, neededPkg] of Object.entries(platformMap)) {
25
+ if (pkg !== key) {
26
+ const pkgPath = path.join(__dirname, '..', neededPkg);
27
+ if (fs.existsSync(pkgPath)) {
28
+ try {
29
+ fs.rmSync(pkgPath, { recursive: true });
30
+ console.log('Removed unnecessary package:', neededPkg);
31
+ } catch (e) {
32
+ // ignore
33
+ }
34
+ }
35
+ }
36
+ }
package/package.json CHANGED
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "opencode-collab",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "opencode with real-time collaboration — zero-config network access",
5
5
  "license": "MIT",
6
6
  "bin": {
7
- "opencode-collab": "./bin/opencode"
7
+ "opencode-collab": "./bin/opencode-collab.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node install.js"
11
+ },
12
+ "optionalDependencies": {
13
+ "opencode-collab-darwin-arm64": "1.3.11",
14
+ "opencode-collab-darwin-x64": "1.3.11",
15
+ "opencode-collab-linux-arm64": "1.3.11",
16
+ "opencode-collab-linux-x64": "1.3.11",
17
+ "opencode-collab-windows-x64": "1.3.11"
8
18
  },
9
19
  "repository": {
10
20
  "type": "git",
package/bin/opencode DELETED
Binary file