@opencoven/cli 0.0.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.
Files changed (3) hide show
  1. package/README.md +16 -0
  2. package/bin/coven.js +73 -0
  3. package/package.json +25 -0
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @opencoven/cli
2
+
3
+ Node wrapper for the native Coven Rust CLI.
4
+
5
+ After an approved v0 release is published for macOS Apple Silicon:
6
+
7
+ ```sh
8
+ npm install -g @opencoven/cli
9
+ coven doctor
10
+ ```
11
+
12
+ The wrapper installs platform-specific native packages through `optionalDependencies` and runs the matching `coven` binary for your OS and CPU. No Rust toolchain is required for end users after a supported package is published.
13
+
14
+ ## v0 platform scope
15
+
16
+ The first publishing proof targets `@opencoven/cli-macos` for macOS Apple Silicon. Other platforms are intentionally not advertised yet; installing on unsupported platforms will report that only macOS Apple Silicon is available in v0.
package/bin/coven.js ADDED
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process';
3
+ import { createRequire } from 'node:module';
4
+
5
+ const require = createRequire(import.meta.url);
6
+
7
+ const PLATFORM_PACKAGES = {
8
+ 'darwin-arm64': '@opencoven/cli-macos'
9
+ };
10
+
11
+ const binaryName = process.platform === 'win32' ? 'coven.exe' : 'coven';
12
+ const platformKey = `${process.platform}-${process.arch}`;
13
+ const packageName = PLATFORM_PACKAGES[platformKey];
14
+
15
+ function wrapperVersion() {
16
+ return require('../package.json').version;
17
+ }
18
+
19
+ function resolveBinary() {
20
+ if (!packageName) {
21
+ throw new Error(
22
+ `Unsupported platform ${platformKey}. Coven v0 publishes native npm packages for macOS Apple Silicon only.`
23
+ );
24
+ }
25
+
26
+ try {
27
+ return require.resolve(`${packageName}/bin/${binaryName}`);
28
+ } catch (error) {
29
+ throw new Error(
30
+ `Could not find native Coven package ${packageName}. Reinstall @opencoven/cli so npm can install the macOS optional dependency. Original error: ${error.message}`
31
+ );
32
+ }
33
+ }
34
+
35
+ let binary;
36
+ try {
37
+ binary = resolveBinary();
38
+ } catch (error) {
39
+ console.error(error.message);
40
+ process.exit(1);
41
+ }
42
+
43
+ const args = process.argv.slice(2);
44
+ if (args.length === 1 && (args[0] === '--version' || args[0] === '-V')) {
45
+ console.log(wrapperVersion());
46
+ process.exit(0);
47
+ }
48
+
49
+ const child = spawn(binary, args, {
50
+ stdio: 'inherit',
51
+ windowsHide: false
52
+ });
53
+
54
+ for (const signal of ['SIGINT', 'SIGTERM']) {
55
+ process.on(signal, () => {
56
+ if (!child.killed) {
57
+ child.kill(signal);
58
+ }
59
+ });
60
+ }
61
+
62
+ child.on('error', (error) => {
63
+ console.error(`Failed to launch Coven binary at ${binary}: ${error.message}`);
64
+ process.exit(1);
65
+ });
66
+
67
+ child.on('exit', (code, signal) => {
68
+ if (signal) {
69
+ process.kill(process.pid, signal);
70
+ return;
71
+ }
72
+ process.exit(code ?? 1);
73
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@opencoven/cli",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "description": "Coven CLI wrapper for the native Rust binary.",
6
+ "type": "module",
7
+ "bin": {
8
+ "coven": "bin/coven.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "README.md"
13
+ ],
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/OpenCoven/coven.git"
18
+ },
19
+ "optionalDependencies": {
20
+ "@opencoven/cli-macos": "0.0.1"
21
+ },
22
+ "engines": {
23
+ "node": ">=18"
24
+ }
25
+ }