@sys9/chord-cli 0.1.409-linux-x64 → 0.1.409

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,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+ const { spawnSync } = require("node:child_process");
8
+
9
+ const packageJSON = require("../package.json");
10
+ const { resolveSupportedTarget } = require("../lib/platform");
11
+
12
+ const resolveBinaryArg = "__chord-resolve-binary";
13
+
14
+ function main() {
15
+ if (process.argv.length !== 3 || process.argv[2] !== resolveBinaryArg) {
16
+ throw new Error(
17
+ "@sys9/chord-cli is not a user command; run npx -y @sys9/chord-ctl@latest setup --server URL",
18
+ );
19
+ }
20
+
21
+ const target = resolveSupportedTarget();
22
+ const platformPackage = packageJSON.name + "-" + target.slug;
23
+ const platformPackageJSON = require.resolve(platformPackage + "/package.json");
24
+ const binaryPath = path.join(
25
+ path.dirname(platformPackageJSON),
26
+ "vendor",
27
+ target.vendorDir,
28
+ "chord-daemon",
29
+ );
30
+ if (!fs.statSync(binaryPath).isFile()) {
31
+ throw new Error("the Chord platform package has no daemon binary");
32
+ }
33
+
34
+ const version = spawnSync(binaryPath, ["version"], {
35
+ encoding: "utf8",
36
+ stdio: ["ignore", "pipe", "inherit"],
37
+ });
38
+ if (version.error) {
39
+ throw version.error;
40
+ }
41
+ if (version.signal || version.status !== 0) {
42
+ throw new Error("the Chord daemon version check failed");
43
+ }
44
+ if (version.stdout.trim() !== "chord-daemon version " + packageJSON.version) {
45
+ throw new Error("the Chord daemon does not match its npm package version");
46
+ }
47
+
48
+ process.stdout.write(JSON.stringify({
49
+ version: packageJSON.version,
50
+ binary_path: binaryPath,
51
+ }) + "\n");
52
+ }
53
+
54
+ try {
55
+ main();
56
+ } catch (error) {
57
+ console.error("chord-daemon: " + error.message);
58
+ process.exitCode = 1;
59
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ const SUPPORTED_TARGETS = [
4
+ {
5
+ slug: "linux-x64",
6
+ os: "linux",
7
+ cpu: "x64",
8
+ vendorDir: "linux_amd64",
9
+ targetTriple: "x86_64-unknown-linux-musl",
10
+ },
11
+ {
12
+ slug: "linux-arm64",
13
+ os: "linux",
14
+ cpu: "arm64",
15
+ vendorDir: "linux_arm64",
16
+ targetTriple: "aarch64-unknown-linux-musl",
17
+ },
18
+ {
19
+ slug: "darwin-x64",
20
+ os: "darwin",
21
+ cpu: "x64",
22
+ vendorDir: "darwin_amd64",
23
+ targetTriple: "x86_64-apple-darwin",
24
+ },
25
+ {
26
+ slug: "darwin-arm64",
27
+ os: "darwin",
28
+ cpu: "arm64",
29
+ vendorDir: "darwin_arm64",
30
+ targetTriple: "aarch64-apple-darwin",
31
+ }
32
+ ];
33
+
34
+ function resolveSupportedTarget(platform = process.platform, arch = process.arch) {
35
+ for (const target of SUPPORTED_TARGETS) {
36
+ if (target.os === platform && target.cpu === arch) {
37
+ return target;
38
+ }
39
+ }
40
+ throw new Error("unsupported platform: " + platform + " (" + arch + ")");
41
+ }
42
+
43
+ module.exports = {
44
+ SUPPORTED_TARGETS,
45
+ resolveSupportedTarget,
46
+ };
package/package.json CHANGED
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "name": "@sys9/chord-cli",
3
- "version": "0.1.409-linux-x64",
3
+ "version": "0.1.409",
4
4
  "description": "Chord native runner, daemon, and Agent bridge binaries",
5
5
  "license": "UNLICENSED",
6
- "os": [
7
- "linux"
8
- ],
9
- "cpu": [
10
- "x64"
11
- ],
12
- "files": [
13
- "vendor"
14
- ],
15
6
  "repository": {
16
7
  "type": "git",
17
8
  "url": "git+https://github.com/sys9-ai/chord.git"
18
9
  },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "files": [
14
+ "README.md",
15
+ "bin",
16
+ "lib"
17
+ ],
19
18
  "engines": {
20
19
  "node": ">=16"
20
+ },
21
+ "bin": {
22
+ "chord-daemon": "bin/chord-daemon"
23
+ },
24
+ "optionalDependencies": {
25
+ "@sys9/chord-cli-linux-x64": "npm:@sys9/chord-cli@0.1.409-linux-x64",
26
+ "@sys9/chord-cli-linux-arm64": "npm:@sys9/chord-cli@0.1.409-linux-arm64",
27
+ "@sys9/chord-cli-darwin-x64": "npm:@sys9/chord-cli@0.1.409-darwin-x64",
28
+ "@sys9/chord-cli-darwin-arm64": "npm:@sys9/chord-cli@0.1.409-darwin-arm64"
21
29
  }
22
30
  }
Binary file
Binary file
Binary file