driggsby 0.1.17 → 0.1.21
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/README.md +3 -0
- package/install.js +12 -46
- package/lib/artifacts.js +51 -0
- package/package.json +10 -5
- package/run-driggsby.js +9 -5
package/README.md
CHANGED
package/install.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { chmodSync, createWriteStream, existsSync, lstatSync, mkdtempSync, mkdirSync,
|
|
3
|
+
import { chmodSync, createWriteStream, existsSync, lstatSync, mkdtempSync, mkdirSync, rmSync, } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
|
-
import { basename,
|
|
5
|
+
import { basename, join } from "node:path";
|
|
6
6
|
import { Transform } from "node:stream";
|
|
7
7
|
import { pipeline } from "node:stream/promises";
|
|
8
|
-
import {
|
|
8
|
+
import { installDirectory, installedBinaryPath, readPackageJson, resolvePlatform, unsupportedPlatformMessage, } from "./lib/artifacts.js";
|
|
9
9
|
import { readCommandOutput, writeCommandOutputToFile } from "./lib/process.js";
|
|
10
|
-
const packageDirectory = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const installDirectory = join(packageDirectory, "node_modules", ".bin_real");
|
|
12
10
|
const maxArtifactBytes = 64 * 1024 * 1024;
|
|
13
|
-
const packageJson =
|
|
11
|
+
const packageJson = readPackageJson();
|
|
14
12
|
try {
|
|
15
13
|
await install();
|
|
16
14
|
}
|
|
@@ -24,8 +22,13 @@ catch (error) {
|
|
|
24
22
|
process.exit(1);
|
|
25
23
|
}
|
|
26
24
|
async function install() {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
25
|
+
const resolution = resolvePlatform(packageJson);
|
|
26
|
+
const platform = resolution.platform;
|
|
27
|
+
if (!platform) {
|
|
28
|
+
console.warn(unsupportedPlatformMessage(resolution));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const binaryPath = installedBinaryPath(platform.binaryPath);
|
|
29
32
|
if (existsSync(binaryPath)) {
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
@@ -41,7 +44,7 @@ async function install() {
|
|
|
41
44
|
throw new Error(`Driggsby package is missing a checksum for ${platform.artifactName}.`);
|
|
42
45
|
}
|
|
43
46
|
await downloadAndVerifyFile(artifactUrl, tempArtifact, expectedChecksum);
|
|
44
|
-
|
|
47
|
+
extractTarball(tempArtifact, installDirectory, platform.binaryPath);
|
|
45
48
|
chmodSync(binaryPath, 0o755);
|
|
46
49
|
}
|
|
47
50
|
catch (error) {
|
|
@@ -52,43 +55,6 @@ async function install() {
|
|
|
52
55
|
rmSync(tempDirectory, { force: true, recursive: true });
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
|
-
function resolvePlatform() {
|
|
56
|
-
const triple = targetTriple();
|
|
57
|
-
const platform = packageJson.driggsbyArtifacts.supportedPlatforms[triple];
|
|
58
|
-
if (!platform) {
|
|
59
|
-
const supported = Object.keys(packageJson.driggsbyArtifacts.supportedPlatforms)
|
|
60
|
-
.sort()
|
|
61
|
-
.join(", ");
|
|
62
|
-
throw new Error(`Driggsby does not currently publish a native binary for ${process.platform}/${process.arch}. Supported targets: ${supported}.`);
|
|
63
|
-
}
|
|
64
|
-
return platform;
|
|
65
|
-
}
|
|
66
|
-
function targetTriple() {
|
|
67
|
-
const architecture = mapArchitecture(process.arch);
|
|
68
|
-
const operatingSystem = mapOperatingSystem(process.platform);
|
|
69
|
-
return `${architecture}-${operatingSystem}`;
|
|
70
|
-
}
|
|
71
|
-
function mapArchitecture(architecture) {
|
|
72
|
-
if (architecture === "arm64") {
|
|
73
|
-
return "aarch64";
|
|
74
|
-
}
|
|
75
|
-
if (architecture === "x64") {
|
|
76
|
-
return "x86_64";
|
|
77
|
-
}
|
|
78
|
-
return architecture;
|
|
79
|
-
}
|
|
80
|
-
function mapOperatingSystem(platform) {
|
|
81
|
-
if (platform === "darwin") {
|
|
82
|
-
return "apple-darwin";
|
|
83
|
-
}
|
|
84
|
-
if (platform === "linux") {
|
|
85
|
-
return "unknown-linux-gnu";
|
|
86
|
-
}
|
|
87
|
-
if (platform === "win32") {
|
|
88
|
-
return "pc-windows-msvc";
|
|
89
|
-
}
|
|
90
|
-
return platform;
|
|
91
|
-
}
|
|
92
58
|
async function downloadAndVerifyFile(url, destination, expectedChecksum) {
|
|
93
59
|
const response = await fetch(url);
|
|
94
60
|
if (!response.ok || response.body === null) {
|
package/lib/artifacts.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
export const packageDirectory = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
5
|
+
export const installDirectory = join(packageDirectory, "node_modules", ".bin_real");
|
|
6
|
+
export function readPackageJson() {
|
|
7
|
+
return JSON.parse(readFileSync(join(packageDirectory, "package.json"), "utf8"));
|
|
8
|
+
}
|
|
9
|
+
export function installedBinaryPath(binaryPath) {
|
|
10
|
+
return join(installDirectory, binaryPath);
|
|
11
|
+
}
|
|
12
|
+
export function resolvePlatform(packageJson) {
|
|
13
|
+
const triple = targetTriple();
|
|
14
|
+
return {
|
|
15
|
+
platform: packageJson.driggsbyArtifacts.supportedPlatforms[triple],
|
|
16
|
+
supportedTargets: Object.keys(packageJson.driggsbyArtifacts.supportedPlatforms).sort(),
|
|
17
|
+
triple,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function unsupportedPlatformMessage(resolution) {
|
|
21
|
+
const supported = resolution.supportedTargets.length > 0
|
|
22
|
+
? resolution.supportedTargets.join(", ")
|
|
23
|
+
: "none";
|
|
24
|
+
return `Driggsby does not currently publish a native binary for ${process.platform}/${process.arch} (${resolution.triple}). Supported targets: ${supported}.`;
|
|
25
|
+
}
|
|
26
|
+
function targetTriple() {
|
|
27
|
+
const architecture = mapArchitecture(process.arch);
|
|
28
|
+
const operatingSystem = mapOperatingSystem(process.platform);
|
|
29
|
+
return `${architecture}-${operatingSystem}`;
|
|
30
|
+
}
|
|
31
|
+
function mapArchitecture(architecture) {
|
|
32
|
+
if (architecture === "arm64") {
|
|
33
|
+
return "aarch64";
|
|
34
|
+
}
|
|
35
|
+
if (architecture === "x64") {
|
|
36
|
+
return "x86_64";
|
|
37
|
+
}
|
|
38
|
+
return architecture;
|
|
39
|
+
}
|
|
40
|
+
function mapOperatingSystem(platform) {
|
|
41
|
+
if (platform === "darwin") {
|
|
42
|
+
return "apple-darwin";
|
|
43
|
+
}
|
|
44
|
+
if (platform === "linux") {
|
|
45
|
+
return "unknown-linux-gnu";
|
|
46
|
+
}
|
|
47
|
+
if (platform === "win32") {
|
|
48
|
+
return "pc-windows-msvc";
|
|
49
|
+
}
|
|
50
|
+
return platform;
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driggsby",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Local MCP broker and CLI for connecting AI clients to Driggsby",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/thegoodsoftwareco/driggsby-cli",
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"run-driggsby.js"
|
|
25
25
|
],
|
|
26
26
|
"driggsbyArtifacts": {
|
|
27
|
-
"baseUrl": "https://github.com/thegoodsoftwareco/driggsby-cli/releases/download/driggsby-v0.1.
|
|
27
|
+
"baseUrl": "https://github.com/thegoodsoftwareco/driggsby-cli/releases/download/driggsby-v0.1.21",
|
|
28
28
|
"checksums": {
|
|
29
|
-
"driggsby-aarch64-apple-darwin.tar.xz": "
|
|
30
|
-
"driggsby-x86_64-apple-darwin.tar.xz": "
|
|
31
|
-
"driggsby-
|
|
29
|
+
"driggsby-aarch64-apple-darwin.tar.xz": "1bdd63ea017a771ed5ed6e7fa1ab8fe8469949509b6763d8a71b989251611e11",
|
|
30
|
+
"driggsby-x86_64-apple-darwin.tar.xz": "cef45b06f66cd68aeb82ca288a4a52e79e1abd4d105acebb05d62ed7f04cf3a1",
|
|
31
|
+
"driggsby-aarch64-unknown-linux-gnu.tar.xz": "93b2433dede66d40c2320a7fda9eb46f31406842b63c3d436ea11f2c78fab5eb",
|
|
32
|
+
"driggsby-x86_64-unknown-linux-gnu.tar.xz": "9f41aac3cb140f59fe0cb62882f5571916b5f6fda873e30529f3732f48d80f70"
|
|
32
33
|
},
|
|
33
34
|
"supportedPlatforms": {
|
|
34
35
|
"aarch64-apple-darwin": {
|
|
@@ -39,6 +40,10 @@
|
|
|
39
40
|
"artifactName": "driggsby-x86_64-apple-darwin.tar.xz",
|
|
40
41
|
"binaryPath": "driggsby"
|
|
41
42
|
},
|
|
43
|
+
"aarch64-unknown-linux-gnu": {
|
|
44
|
+
"artifactName": "driggsby-aarch64-unknown-linux-gnu.tar.xz",
|
|
45
|
+
"binaryPath": "driggsby"
|
|
46
|
+
},
|
|
42
47
|
"x86_64-unknown-linux-gnu": {
|
|
43
48
|
"artifactName": "driggsby-x86_64-unknown-linux-gnu.tar.xz",
|
|
44
49
|
"binaryPath": "driggsby"
|
package/run-driggsby.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
-
import {
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { installedBinaryPath, readPackageJson, resolvePlatform, unsupportedPlatformMessage, } from "./lib/artifacts.js";
|
|
5
4
|
import { spawnFileAndExit } from "./lib/process.js";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const packageJson = readPackageJson();
|
|
6
|
+
const resolution = resolvePlatform(packageJson);
|
|
7
|
+
if (!resolution.platform) {
|
|
8
|
+
console.error(unsupportedPlatformMessage(resolution));
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const binaryPath = installedBinaryPath(resolution.platform.binaryPath);
|
|
8
12
|
if (!existsSync(binaryPath)) {
|
|
9
|
-
console.error("Driggsby is not installed. Reinstall
|
|
13
|
+
console.error("Driggsby native binary is not installed. Reinstall with npm scripts enabled, or rerun with npm_config_foreground_scripts=true to see installer output.");
|
|
10
14
|
process.exit(1);
|
|
11
15
|
}
|
|
12
16
|
spawnFileAndExit(binaryPath, process.argv.slice(2));
|