@farsight-cda/ocw 0.0.0-dev.7.8957b25.r2

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.
Files changed (2) hide show
  1. package/bin/ocw.js +51 -0
  2. package/package.json +23 -0
package/bin/ocw.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("node:child_process");
4
+
5
+ const platformPackageMap = {
6
+ "linux-x64": { packageName: "@farsight-cda/ocw-linux-x64", binaryPath: "bin/ocw" },
7
+ "darwin-arm64": { packageName: "@farsight-cda/ocw-darwin-arm64", binaryPath: "bin/ocw" },
8
+ "win32-x64": { packageName: "@farsight-cda/ocw-win32-x64", binaryPath: "bin/ocw.exe" }
9
+ };
10
+
11
+ function getPackageForHost() {
12
+ const key = `${process.platform}-${process.arch}`;
13
+ return platformPackageMap[key] ?? null;
14
+ }
15
+
16
+ function resolveHostBinaryPath() {
17
+ const match = getPackageForHost();
18
+ if (!match) {
19
+ const supported = Object.keys(platformPackageMap).join(", ");
20
+ throw new Error(`Unsupported platform '${process.platform}-${process.arch}'. Supported: ${supported}.`);
21
+ }
22
+
23
+ try {
24
+ return require.resolve(`${match.packageName}/${match.binaryPath}`);
25
+ } catch {
26
+ throw new Error(
27
+ `Missing platform binary package '${match.packageName}'. Reinstall with 'npm i -g @farsight-cda/ocw'.`
28
+ );
29
+ }
30
+ }
31
+
32
+ function run() {
33
+ const binaryPath = resolveHostBinaryPath();
34
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
35
+ stdio: "inherit"
36
+ });
37
+
38
+ if (result.error) {
39
+ throw result.error;
40
+ }
41
+
42
+ process.exit(result.status ?? 1);
43
+ }
44
+
45
+ try {
46
+ run();
47
+ } catch (error) {
48
+ const message = error instanceof Error ? error.message : String(error);
49
+ console.error(`ocw launcher error: ${message}`);
50
+ process.exit(1);
51
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@farsight-cda/ocw",
3
+ "version": "0.0.0-dev.7.8957b25.r2",
4
+ "description": "Run OpenCode in Docker with persistent state and profile management.",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "ocw": "bin/ocw.js"
8
+ },
9
+ "files": [
10
+ "bin/"
11
+ ],
12
+ "optionalDependencies": {
13
+ "@farsight-cda/ocw-linux-x64": "0.0.0-dev.7.8957b25.r2",
14
+ "@farsight-cda/ocw-darwin-arm64": "0.0.0-dev.7.8957b25.r2",
15
+ "@farsight-cda/ocw-win32-x64": "0.0.0-dev.7.8957b25.r2"
16
+ },
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ }
23
+ }