@kilip/opus 0.0.0-stage → 0.1.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 +46 -2
  2. package/bin/opus.js +115 -0
  3. package/package.json +35 -4
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # @kilip/opus
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Opus mission control dashboard for AI coding agents.
4
+
5
+ This package provides a platform-independent wrapper and CLI runner for Opus. When installed or run via `npx` / `bunx`, it automatically delegates execution to the pre-compiled platform binary matching your operating system and architecture (`@kilip/opus-linux-x64` or `@kilip/opus-linux-arm64`).
6
+
7
+ ## Quick Start
8
+
9
+ ### Run with npx or bunx (Zero Install)
10
+
11
+ ```bash
12
+ # Using npx
13
+ npx @kilip/opus serve
14
+
15
+ # Using bunx
16
+ bunx @kilip/opus serve
17
+ ```
18
+
19
+ ### Install Opus to `~/.opus/bin`
20
+
21
+ To install Opus permanently on your system and optionally configure a systemd user service:
22
+
23
+ ```bash
24
+ # Install binary to ~/.opus/bin/opus
25
+ npx @kilip/opus install
26
+
27
+ # Install binary and enable/start systemd user service
28
+ npx @kilip/opus install --service
29
+ ```
30
+
31
+ ### Global Installation via npm
32
+
33
+ ```bash
34
+ npm install -g @kilip/opus
35
+ opus serve
36
+ ```
37
+
38
+ ## Supported Platforms
39
+
40
+ - Linux x86_64 (`linux-x64`)
41
+ - Linux ARM64 (`linux-arm64`)
42
+
43
+ For other platforms (macOS, Windows), please [build from source](https://github.com/kilip/opus#building-from-source).
44
+
45
+ ## License
46
+
47
+ [MIT](https://github.com/kilip/opus/blob/main/LICENSE)
package/bin/opus.js ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const process = require('node:process');
7
+ const { spawn } = require('node:child_process');
8
+
9
+ function main() {
10
+ if (process.platform !== 'linux') {
11
+ process.stderr.write(
12
+ 'Error: Opus npm distribution is currently only supported on Linux (x64 and arm64).\n' +
13
+ `Detected platform: ${process.platform}/${process.arch}.\n` +
14
+ 'For macOS, Windows, or other platforms, please build from source:\n' +
15
+ ' https://github.com/kilip/opus#building-from-source\n'
16
+ );
17
+ process.exit(1);
18
+ }
19
+
20
+ const supportedArchs = ['x64', 'arm64'];
21
+ if (!supportedArchs.includes(process.arch)) {
22
+ process.stderr.write(
23
+ `Error: Unsupported CPU architecture: ${process.arch}.\n` +
24
+ 'Opus npm distribution supports x64 and arm64 on Linux.\n' +
25
+ 'Please build from source:\n' +
26
+ ' https://github.com/kilip/opus#building-from-source\n'
27
+ );
28
+ process.exit(1);
29
+ }
30
+
31
+ const pkgName = `@kilip/opus-linux-${process.arch}`;
32
+ const binPath = resolveBinary(pkgName);
33
+
34
+ if (!binPath) {
35
+ process.stderr.write(
36
+ `Error: Opus binary package '${pkgName}' is not installed.\n\n` +
37
+ 'This usually means optionalDependencies were omitted during installation\n' +
38
+ '(for example, via --no-optional or an unsupported package manager setting).\n\n' +
39
+ `Please try installing '${pkgName}' explicitly or reinstalling '@kilip/opus':\n` +
40
+ ` npm install ${pkgName}\n`
41
+ );
42
+ process.exit(1);
43
+ }
44
+
45
+ try {
46
+ fs.chmodSync(binPath, 0o755);
47
+ } catch {
48
+ // Ignore error if file is already executable or read-only filesystem
49
+ }
50
+
51
+ const child = spawn(binPath, process.argv.slice(2), {
52
+ stdio: 'inherit'
53
+ });
54
+
55
+ const forwardSignal = (signal) => {
56
+ if (!child.killed) {
57
+ try {
58
+ child.kill(signal);
59
+ } catch {
60
+ // Child might have already exited
61
+ }
62
+ }
63
+ };
64
+
65
+ process.on('SIGINT', () => forwardSignal('SIGINT'));
66
+ process.on('SIGTERM', () => forwardSignal('SIGTERM'));
67
+ process.on('SIGHUP', () => forwardSignal('SIGHUP'));
68
+
69
+ child.on('exit', (code, signal) => {
70
+ if (signal) {
71
+ process.kill(process.pid, signal);
72
+ } else {
73
+ process.exit(code ?? 0);
74
+ }
75
+ });
76
+
77
+ child.on('error', (err) => {
78
+ process.stderr.write(`Failed to start Opus binary: ${err.message}\n`);
79
+ process.exit(1);
80
+ });
81
+ }
82
+
83
+ function resolveBinary(pkgName) {
84
+ // Strategy 1: Node package resolution to package.json
85
+ try {
86
+ const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
87
+ const target = path.join(path.dirname(pkgJsonPath), 'bin', 'opus');
88
+ if (fs.existsSync(target)) {
89
+ return target;
90
+ }
91
+ } catch {
92
+ // Fall back to relative searches
93
+ }
94
+
95
+ // Strategy 2: Relative paths for flat node_modules, npm caching, or monorepo links
96
+ const candidates = [
97
+ path.resolve(__dirname, '..', '..', pkgName, 'bin', 'opus'),
98
+ path.resolve(__dirname, '..', '..', `opus-linux-${process.arch}`, 'bin', 'opus'),
99
+ path.resolve(__dirname, '..', 'node_modules', pkgName, 'bin', 'opus')
100
+ ];
101
+
102
+ for (const candidate of candidates) {
103
+ try {
104
+ if (fs.existsSync(candidate)) {
105
+ return candidate;
106
+ }
107
+ } catch {
108
+ // Ignore filesystem access errors
109
+ }
110
+ }
111
+
112
+ return null;
113
+ }
114
+
115
+ main();
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@kilip/opus",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Opus mission control dashboard for AI coding agents",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kilip/opus.git"
9
+ },
10
+ "homepage": "https://github.com/kilip/opus#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/kilip/opus/issues"
13
+ },
14
+ "keywords": [
15
+ "opus",
16
+ "ai",
17
+ "coding-agent",
18
+ "agent",
19
+ "omp",
20
+ "mission-control",
21
+ "dashboard"
22
+ ],
23
+ "bin": {
24
+ "opus": "bin/opus.js"
25
+ },
26
+ "files": [
27
+ "bin/opus.js",
28
+ "README.md"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "optionalDependencies": {
34
+ "@kilip/opus-linux-x64": "0.1.1",
35
+ "@kilip/opus-linux-arm64": "0.1.1"
36
+ }
37
+ }