driggsby 0.1.19 → 0.1.23

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 CHANGED
@@ -16,6 +16,9 @@ For non-interactive MCP launcher flows, use:
16
16
  npx -y driggsby@latest mcp-server
17
17
  ```
18
18
 
19
+ Supported native artifacts currently cover macOS arm64, macOS x64, Linux arm64
20
+ glibc, and Linux x64 glibc.
21
+
19
22
  ## License
20
23
 
21
24
  Apache-2.0
package/bin/driggsby ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { readPackageJson, resolvePlatform, unsupportedPlatformMessage, } from "../lib/artifacts.js";
3
+ const packageJson = readPackageJson();
4
+ const resolution = resolvePlatform(packageJson);
5
+ if (!resolution.platform) {
6
+ console.error(unsupportedPlatformMessage(resolution));
7
+ process.exit(1);
8
+ }
9
+ console.error("Driggsby native binary is not active. Reinstall with npm scripts enabled, or rerun with npm_config_foreground_scripts=true to see installer output.");
10
+ process.exit(1);
package/install.js CHANGED
@@ -1,36 +1,38 @@
1
1
  #!/usr/bin/env node
2
- import { createHash } from "node:crypto";
3
- import { chmodSync, createWriteStream, existsSync, lstatSync, mkdtempSync, mkdirSync, readFileSync, rmSync, } from "node:fs";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { chmodSync, createWriteStream, existsSync, lstatSync, mkdtempSync, mkdirSync, renameSync, rmSync, } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
- import { basename, dirname, join } from "node:path";
5
+ import { basename, join } from "node:path";
6
6
  import { Transform } from "node:stream";
7
7
  import { pipeline } from "node:stream/promises";
8
- import { fileURLToPath } from "node:url";
8
+ import { packageBinDirectory, packageBinPath, 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 = JSON.parse(readFileSync(join(packageDirectory, "package.json"), "utf8"));
11
+ const packageJson = readPackageJson();
14
12
  try {
15
13
  await install();
16
14
  }
17
15
  catch (error) {
18
- if (error instanceof Error) {
19
- console.error(error.message);
20
- }
21
- else {
22
- console.error(error);
23
- }
16
+ console.error(publicInstallErrorMessage(error));
24
17
  process.exit(1);
25
18
  }
19
+ function publicInstallErrorMessage(error) {
20
+ if (error instanceof Error && error.message.startsWith("Driggsby ")) {
21
+ return error.message;
22
+ }
23
+ return "Driggsby native binary could not be installed. Check your network connection and reinstall with npm scripts enabled.";
24
+ }
26
25
  async function install() {
27
- const platform = resolvePlatform();
28
- const binaryPath = join(installDirectory, platform.binaryPath);
29
- if (existsSync(binaryPath)) {
26
+ const resolution = resolvePlatform(packageJson);
27
+ const platform = resolution.platform;
28
+ if (!platform) {
29
+ console.warn(unsupportedPlatformMessage(resolution));
30
30
  return;
31
31
  }
32
- rmSync(installDirectory, { force: true, recursive: true });
33
- mkdirSync(installDirectory, { recursive: true });
32
+ validatePlatformConfig(platform);
33
+ ensurePackageBinDirectory();
34
+ const binaryPath = packageBinPath;
35
+ const tempBinaryPath = join(packageBinDirectory, `.${platform.binaryPath}.${randomUUID()}.tmp`);
34
36
  const artifactUrl = `${packageJson.driggsbyArtifacts.baseUrl}/${platform.artifactName}`;
35
37
  const tempDirectory = mkdtempSync(join(tmpdir(), "driggsby-install-"));
36
38
  chmodSync(tempDirectory, 0o700);
@@ -41,53 +43,34 @@ async function install() {
41
43
  throw new Error(`Driggsby package is missing a checksum for ${platform.artifactName}.`);
42
44
  }
43
45
  await downloadAndVerifyFile(artifactUrl, tempArtifact, expectedChecksum);
44
- extractTarball(tempArtifact, installDirectory, platform.binaryPath);
45
- chmodSync(binaryPath, 0o755);
46
+ extractTarball(tempArtifact, tempBinaryPath, platform.binaryPath);
47
+ chmodSync(tempBinaryPath, 0o755);
48
+ renameSync(tempBinaryPath, binaryPath);
46
49
  }
47
50
  catch (error) {
48
- rmSync(installDirectory, { force: true, recursive: true });
51
+ rmSync(tempBinaryPath, { force: true });
49
52
  throw error;
50
53
  }
51
54
  finally {
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";
58
+ function validatePlatformConfig(platform) {
59
+ if (platform.binaryPath !== "driggsby") {
60
+ throw new Error("Driggsby package contains unsupported binary metadata.");
74
61
  }
75
- if (architecture === "x64") {
76
- return "x86_64";
62
+ if (!/^driggsby-[A-Za-z0-9_-]+\.tar\.xz$/.test(platform.artifactName)) {
63
+ throw new Error("Driggsby package contains unsupported artifact metadata.");
77
64
  }
78
- return architecture;
79
65
  }
80
- function mapOperatingSystem(platform) {
81
- if (platform === "darwin") {
82
- return "apple-darwin";
66
+ function ensurePackageBinDirectory() {
67
+ if (!existsSync(packageBinDirectory)) {
68
+ mkdirSync(packageBinDirectory, { recursive: true });
83
69
  }
84
- if (platform === "linux") {
85
- return "unknown-linux-gnu";
70
+ const stats = lstatSync(packageBinDirectory);
71
+ if (!stats.isDirectory() || stats.isSymbolicLink()) {
72
+ throw new Error("Driggsby package bin directory is not a regular directory.");
86
73
  }
87
- if (platform === "win32") {
88
- return "pc-windows-msvc";
89
- }
90
- return platform;
91
74
  }
92
75
  async function downloadAndVerifyFile(url, destination, expectedChecksum) {
93
76
  const response = await fetch(url);
@@ -120,16 +103,24 @@ async function downloadAndVerifyFile(url, destination, expectedChecksum) {
120
103
  function extractTarball(artifactPath, destination, binaryPath) {
121
104
  const tarPath = trustedTarPath();
122
105
  const entry = findBinaryTarEntry(tarPath, artifactPath, binaryPath);
123
- const installedBinary = join(destination, binaryPath);
124
- writeCommandOutputToFile(tarPath, ["-xOf", artifactPath, "--", entry], installedBinary, maxArtifactBytes);
125
- if (!existsSync(installedBinary)) {
106
+ assertRegularTarEntry(tarPath, artifactPath, entry, binaryPath);
107
+ writeCommandOutputToFile(tarPath, ["-xOf", artifactPath, "--", entry], destination, maxArtifactBytes);
108
+ if (!existsSync(destination)) {
126
109
  throw new Error(`Driggsby archive did not contain expected binary ${binaryPath}.`);
127
110
  }
128
- const installedBinaryStats = lstatSync(installedBinary);
111
+ const installedBinaryStats = lstatSync(destination);
129
112
  if (!installedBinaryStats.isFile() || installedBinaryStats.isSymbolicLink()) {
130
113
  throw new Error(`Driggsby archive entry ${binaryPath} was not a regular file.`);
131
114
  }
132
115
  }
116
+ function assertRegularTarEntry(tarPath, artifactPath, entry, binaryPath) {
117
+ const listings = readCommandOutput(tarPath, ["-tvf", artifactPath, "--", entry])
118
+ .split("\n")
119
+ .filter((line) => line.trim().length > 0);
120
+ if (listings.length !== 1 || !listings[0]?.startsWith("-")) {
121
+ throw new Error(`Driggsby archive entry ${binaryPath} was not a regular file.`);
122
+ }
123
+ }
133
124
  function trustedTarPath() {
134
125
  for (const candidate of ["/usr/bin/tar", "/bin/tar"]) {
135
126
  if (existsSync(candidate)) {
@@ -0,0 +1,49 @@
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 packageBinDirectory = join(packageDirectory, "bin");
6
+ export const packageBinPath = join(packageBinDirectory, "driggsby");
7
+ export function readPackageJson() {
8
+ return JSON.parse(readFileSync(join(packageDirectory, "package.json"), "utf8"));
9
+ }
10
+ export function resolvePlatform(packageJson) {
11
+ const triple = targetTriple();
12
+ return {
13
+ platform: packageJson.driggsbyArtifacts.supportedPlatforms[triple],
14
+ supportedTargets: Object.keys(packageJson.driggsbyArtifacts.supportedPlatforms).sort(),
15
+ triple,
16
+ };
17
+ }
18
+ export function unsupportedPlatformMessage(resolution) {
19
+ const supported = resolution.supportedTargets.length > 0
20
+ ? resolution.supportedTargets.join(", ")
21
+ : "none";
22
+ return `Driggsby does not currently publish a native binary for ${process.platform}/${process.arch} (${resolution.triple}). Supported targets: ${supported}.`;
23
+ }
24
+ function targetTriple() {
25
+ const architecture = mapArchitecture(process.arch);
26
+ const operatingSystem = mapOperatingSystem(process.platform);
27
+ return `${architecture}-${operatingSystem}`;
28
+ }
29
+ function mapArchitecture(architecture) {
30
+ if (architecture === "arm64") {
31
+ return "aarch64";
32
+ }
33
+ if (architecture === "x64") {
34
+ return "x86_64";
35
+ }
36
+ return architecture;
37
+ }
38
+ function mapOperatingSystem(platform) {
39
+ if (platform === "darwin") {
40
+ return "apple-darwin";
41
+ }
42
+ if (platform === "linux") {
43
+ return "unknown-linux-gnu";
44
+ }
45
+ if (platform === "win32") {
46
+ return "pc-windows-msvc";
47
+ }
48
+ return platform;
49
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "driggsby",
3
- "version": "0.1.19",
3
+ "version": "0.1.23",
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",
7
7
  "type": "module",
8
8
  "bin": {
9
- "driggsby": "run-driggsby.js"
9
+ "driggsby": "bin/driggsby"
10
10
  },
11
11
  "scripts": {
12
12
  "postinstall": "node ./install.js"
@@ -16,19 +16,20 @@
16
16
  "npm": ">=9"
17
17
  },
18
18
  "files": [
19
+ "bin",
19
20
  "LICENSE",
20
21
  "README.md",
21
22
  "install.js",
22
23
  "lib",
23
- "package.json",
24
- "run-driggsby.js"
24
+ "package.json"
25
25
  ],
26
26
  "driggsbyArtifacts": {
27
- "baseUrl": "https://github.com/thegoodsoftwareco/driggsby-cli/releases/download/driggsby-v0.1.19",
27
+ "baseUrl": "https://github.com/thegoodsoftwareco/driggsby-cli/releases/download/driggsby-v0.1.23",
28
28
  "checksums": {
29
- "driggsby-aarch64-apple-darwin.tar.xz": "7a924b9f775a0fb10de12da6d471080f464769adeacbcb581dc1da58eeb3123c",
30
- "driggsby-x86_64-apple-darwin.tar.xz": "2b91b590424f074e3a4b08b2b5581ec97c07dbdc28f82cd42cc84cb87a3b98ab",
31
- "driggsby-x86_64-unknown-linux-gnu.tar.xz": "96ae120d4ba0b8d4720daa9151e7069f01792c0066054002fdef3a3bb8efc459"
29
+ "driggsby-aarch64-apple-darwin.tar.xz": "cd778960741ab9c20393e1f2e47b8174e625c45f8ed74e0d111c5f19e7abc8e4",
30
+ "driggsby-x86_64-apple-darwin.tar.xz": "61e422da8748ef7049b7753004c83461ddc37994f35de1576d2c4e8ac5d03612",
31
+ "driggsby-aarch64-unknown-linux-gnu.tar.xz": "c8d53da5f0e9a4259fd5f1867ca6f624d8ebaec67890f32258611a8e5dfaac37",
32
+ "driggsby-x86_64-unknown-linux-gnu.tar.xz": "a6b1928f4a2302a6744a69b59fd42f924c0ef0e6592b7fc98204ae82f9616335"
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 DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- import { existsSync } from "node:fs";
3
- import { dirname, join } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { spawnFileAndExit } from "./lib/process.js";
6
- const packageDirectory = dirname(fileURLToPath(import.meta.url));
7
- const binaryPath = join(packageDirectory, "node_modules", ".bin_real", "driggsby");
8
- if (!existsSync(binaryPath)) {
9
- console.error("Driggsby is not installed. Reinstall the npm package and try again.");
10
- process.exit(1);
11
- }
12
- spawnFileAndExit(binaryPath, process.argv.slice(2));