@reason-machines/cli 0.2.59

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.
package/bin/ara.exe ADDED
@@ -0,0 +1,3 @@
1
+ echo "Ara's native binary was not installed." >&2
2
+ echo "Reinstall with npm, or run: bun install -g --trust @reason-machines/cli" >&2
3
+ exit 1
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@reason-machines/cli",
3
+ "version": "0.2.59",
4
+ "description": "Reason CLI for coding-agent setup and the optional Ara Device worker",
5
+ "type": "module",
6
+ "bin": {
7
+ "reason": "bin/ara.exe",
8
+ "ara": "bin/ara.exe"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "postinstall.mjs"
13
+ ],
14
+ "scripts": {
15
+ "postinstall": "node ./postinstall.mjs || bun ./postinstall.mjs"
16
+ },
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "optionalDependencies": {
21
+ "@reason-machines/cli-darwin-arm64": "0.2.59",
22
+ "@reason-machines/cli-darwin-x64": "0.2.59",
23
+ "@reason-machines/cli-linux-arm64": "0.2.59",
24
+ "@reason-machines/cli-linux-arm64-musl": "0.2.59",
25
+ "@reason-machines/cli-linux-x64": "0.2.59",
26
+ "@reason-machines/cli-linux-x64-musl": "0.2.59",
27
+ "@reason-machines/cli-win32-arm64": "0.2.59",
28
+ "@reason-machines/cli-win32-x64": "0.2.59"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
33
+ },
34
+ "homepage": "https://reasonmachines.ai",
35
+ "bugs": {
36
+ "url": "https://reasonmachines.ai/contact"
37
+ },
38
+ "license": "UNLICENSED",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/reason-machines/monorepo.git"
42
+ }
43
+ }
@@ -0,0 +1,92 @@
1
+ import { chmodSync, copyFileSync, cpSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+
6
+ const require = createRequire(import.meta.url);
7
+
8
+ function linuxLibc() {
9
+ if (process.platform !== "linux") return "";
10
+ const report = process.report?.getReport?.();
11
+ if (report?.header?.glibcVersionRuntime) return "";
12
+ return "-musl";
13
+ }
14
+
15
+ const suffix = `${process.platform}-${process.arch}${linuxLibc()}`;
16
+ const executableName = process.platform === "win32" ? "ara.exe" : "ara";
17
+ const credentialLibraryName = "libara_device_keychain.dylib";
18
+
19
+ function resolvePackageName() {
20
+ const candidates = [
21
+ `@reason-machines/cli-${suffix}`,
22
+ `@ara-so/cli-${suffix}`,
23
+ ];
24
+ for (const candidate of candidates) {
25
+ try {
26
+ require.resolve(`${candidate}/bin/${executableName}`);
27
+ return candidate;
28
+ } catch {
29
+ // Try next candidate.
30
+ }
31
+ }
32
+ return candidates[0];
33
+ }
34
+
35
+ const packageName = resolvePackageName();
36
+
37
+ try {
38
+ const source = require.resolve(`${packageName}/bin/${executableName}`);
39
+ const credentialLibrarySource = process.platform === "darwin"
40
+ ? require.resolve(`${packageName}/bin/${credentialLibraryName}`)
41
+ : null;
42
+ const destination = fileURLToPath(new URL("./bin/ara.exe", import.meta.url));
43
+ copyFileSync(source, destination);
44
+ if (process.platform !== "win32") chmodSync(destination, 0o755);
45
+ if (process.platform !== "win32") {
46
+ cpSync(join(dirname(source), "runtime", "srt"), join(dirname(destination), "runtime", "srt"), {
47
+ recursive: true,
48
+ force: true,
49
+ });
50
+ }
51
+ if (credentialLibrarySource) {
52
+ const credentialLibraryDestination = fileURLToPath(
53
+ new URL(`./bin/${credentialLibraryName}`, import.meta.url),
54
+ );
55
+ copyFileSync(credentialLibrarySource, credentialLibraryDestination);
56
+ chmodSync(credentialLibraryDestination, 0o755);
57
+ const identityInfo = require.resolve(
58
+ `${packageName}/bin/Ara.app/Contents/Info.plist`,
59
+ );
60
+ const identitySource = dirname(dirname(identityInfo));
61
+ const identityDestination = fileURLToPath(
62
+ new URL("./bin/Ara.app", import.meta.url),
63
+ );
64
+ cpSync(identitySource, identityDestination, {
65
+ recursive: true,
66
+ force: true,
67
+ });
68
+ // A Sidecar-enabled CLI package carries this separately signed native app
69
+ // beside its broker. Keep older production packages installable until the
70
+ // staged GUI lane is released: absence is handled by `ara device`, not a
71
+ // reason to fail all terminal-only installation.
72
+ try {
73
+ const sidecarInfo = require.resolve(
74
+ `${packageName}/bin/Reason.app/Contents/Info.plist`,
75
+ );
76
+ const sidecarSource = dirname(dirname(sidecarInfo));
77
+ const sidecarDestination = fileURLToPath(
78
+ new URL("./bin/Reason.app", import.meta.url),
79
+ );
80
+ cpSync(sidecarSource, sidecarDestination, {
81
+ recursive: true,
82
+ force: true,
83
+ });
84
+ } catch {
85
+ // No Sidecar is expected in an older or production-only CLI package.
86
+ }
87
+ }
88
+ } catch (error) {
89
+ const detail = error instanceof Error ? error.message : String(error);
90
+ process.stderr.write(`Ara could not install its ${suffix} binary: ${detail}\n`);
91
+ process.exit(1);
92
+ }