@mightybot/chief 0.3.0-rc.20

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 -0
  2. package/bin/chief.js +85 -0
  3. package/package.json +24 -0
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @mightybot/chief
2
+
3
+ Chief Runtime as an npm package: one Go binary (CLI + resident daemon + MCP
4
+ surface) that owns every mechanical fact about a running Chief estate.
5
+
6
+ The binary inside this package is byte-identical to the checksummed release
7
+ published at <https://mightybot-ai.github.io/chief>; npm is a second
8
+ distribution channel for the same attested build.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install -g @mightybot/chief@latest
14
+ chief version
15
+ ```
16
+
17
+ `@latest` is the newest final release. Release candidates publish under
18
+ `@next`:
19
+
20
+ ```sh
21
+ npm install -g @mightybot/chief@next
22
+ ```
23
+
24
+ Run without installing:
25
+
26
+ ```sh
27
+ npx @mightybot/chief@latest version
28
+ ```
29
+
30
+ ## Running Chief as a service
31
+
32
+ Chief's systemd and launchd units start the binary from the configured
33
+ `services.binary_path`. Use a global install (`npm install -g`), which gives the
34
+ binary a stable path under your npm prefix, rather than the transient `npx`
35
+ cache. `npm prefix -g` shows where it lives; the binary is at
36
+ `$(npm root -g)/@mightybot/chief-<platform>/chief`.
37
+
38
+ Full setup, Slack connection, and prerequisites (`tmux`, an authenticated
39
+ Claude Code) are documented at
40
+ <https://mightybot-ai.github.io/chief/INSTALL.md>.
41
+
42
+ ## Platforms
43
+
44
+ `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`. Each ships as its own
45
+ `@mightybot/chief-<platform>` optional dependency; npm installs only the one
46
+ matching your host.
package/bin/chief.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Thin launcher for the `chief` Go binary distributed over npm.
5
+ //
6
+ // The binary ships in a per-platform optional dependency
7
+ // (@mightybot/chief-<platform>). npm installs only the package matching the
8
+ // host's os/cpu, so this shim resolves that package's binary and execs it,
9
+ // passing argv and stdio straight through. stdio is inherited so long-lived
10
+ // subcommands (daemon, MCP server) work unchanged.
11
+ //
12
+ // The bytes inside the platform package are the exact checksummed release
13
+ // artifacts published to https://mightybot-ai.github.io/chief — npm is a
14
+ // second distribution channel for the same build, not a separate build.
15
+
16
+ const { execFileSync } = require("child_process");
17
+ const fs = require("fs");
18
+ const path = require("path");
19
+
20
+ // Derive the platform packages from THIS package's own name so the shim is
21
+ // scope-agnostic: @mightybot/chief -> @mightybot/chief-<platform>.
22
+ const SELF_NAME = require(path.join(__dirname, "..", "package.json")).name;
23
+ const SUPPORTED = new Set([
24
+ "darwin-arm64",
25
+ "darwin-x64",
26
+ "linux-x64",
27
+ "linux-arm64",
28
+ ]);
29
+
30
+ function resolveBinary() {
31
+ const key = `${process.platform}-${process.arch}`;
32
+ if (!SUPPORTED.has(key)) {
33
+ throw new Error(
34
+ `${SELF_NAME}: unsupported platform "${key}". Supported: ${[...SUPPORTED].join(", ")}.`,
35
+ );
36
+ }
37
+ const pkg = `${SELF_NAME}-${key}`;
38
+ try {
39
+ // require.resolve walks node_modules and returns the absolute file path.
40
+ return require.resolve(`${pkg}/chief`);
41
+ } catch (err) {
42
+ throw new Error(
43
+ `${SELF_NAME}: platform package "${pkg}" is not installed for "${key}".\n` +
44
+ `It is an optionalDependency — reinstall without "--no-optional" / ` +
45
+ `"--omit=optional".\n` +
46
+ `Underlying error: ${err.message}`,
47
+ );
48
+ }
49
+ }
50
+
51
+ function main() {
52
+ let binary;
53
+ try {
54
+ binary = resolveBinary();
55
+ } catch (err) {
56
+ console.error(err.message);
57
+ process.exit(1);
58
+ }
59
+
60
+ // npm normalizes non-`bin` files to 0644 on install (strips the execute
61
+ // bit), so ensure the binary is executable before launching. Best-effort: a
62
+ // global install owned by root may not be chmod-able, but is usually 0755.
63
+ try {
64
+ fs.chmodSync(binary, 0o755);
65
+ } catch (_) {
66
+ /* ignore — exec surfaces a clear error if it is really not runnable */
67
+ }
68
+
69
+ try {
70
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
71
+ } catch (err) {
72
+ // execFileSync throws on any non-zero exit; mirror the child's status.
73
+ if (typeof err.status === "number") {
74
+ process.exit(err.status);
75
+ }
76
+ if (err.signal) {
77
+ console.error(`${SELF_NAME}: chief terminated by signal ${err.signal}`);
78
+ process.exit(1);
79
+ }
80
+ console.error(`${SELF_NAME}: failed to launch chief: ${err.message}`);
81
+ process.exit(1);
82
+ }
83
+ }
84
+
85
+ main();
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@mightybot/chief",
3
+ "version": "0.3.0-rc.20",
4
+ "description": "Chief Runtime: one binary (CLI + resident daemon + MCP surface) for a running Chief estate",
5
+ "bin": {
6
+ "chief": "bin/chief.js"
7
+ },
8
+ "files": [
9
+ "bin/chief.js",
10
+ "README.md"
11
+ ],
12
+ "engines": {
13
+ "node": ">=16"
14
+ },
15
+ "homepage": "https://mightybot-ai.github.io/chief",
16
+ "license": "UNLICENSED",
17
+ "private": false,
18
+ "optionalDependencies": {
19
+ "@mightybot/chief-darwin-arm64": "0.3.0-rc.20",
20
+ "@mightybot/chief-darwin-x64": "0.3.0-rc.20",
21
+ "@mightybot/chief-linux-x64": "0.3.0-rc.20",
22
+ "@mightybot/chief-linux-arm64": "0.3.0-rc.20"
23
+ }
24
+ }