driggsby 0.1.14 → 0.1.16

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/LICENSE CHANGED
@@ -1,8 +1,117 @@
1
- UNLICENSED
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright (c) The Good Software Company.
4
- All rights reserved.
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
6
 
6
- This package and its source are proprietary. No license rights are granted to
7
- use, copy, modify, or distribute this software except as otherwise agreed in
8
- writing by The Good Software Company.
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work.
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
+ by the copyright owner or by an individual or Legal Entity authorized to submit
48
+ on behalf of the copyright owner. For the purposes of this definition,
49
+ "submitted" means any form of electronic, verbal, or written communication sent
50
+ to the Licensor or its representatives, including but not limited to
51
+ communication on electronic mailing lists, source code control systems, and
52
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
53
+ the purpose of discussing and improving the Work, but excluding communication
54
+ that is conspicuously marked or otherwise designated in writing by the copyright
55
+ owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
62
+ License, each Contributor hereby grants to You a perpetual, worldwide,
63
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
64
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
65
+ sublicense, and distribute the Work and such Derivative Works in Source or
66
+ Object form.
67
+
68
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
69
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
70
+ no-charge, royalty-free, irrevocable patent license to make, have made, use,
71
+ offer to sell, sell, import, and otherwise transfer the Work.
72
+
73
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
74
+ Derivative Works thereof in any medium, with or without modifications, and in
75
+ Source or Object form, provided that You meet the following conditions:
76
+
77
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
78
+ this License; and
79
+
80
+ (b) You must cause any modified files to carry prominent notices stating that
81
+ You changed the files; and
82
+
83
+ (c) You must retain, in the Source form of any Derivative Works that You
84
+ distribute, all copyright, patent, trademark, and attribution notices from the
85
+ Source form of the Work, excluding those notices that do not pertain to any part
86
+ of the Derivative Works; and
87
+
88
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
89
+ any Derivative Works that You distribute must include a readable copy of the
90
+ attribution notices contained within such NOTICE file.
91
+
92
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
93
+ Contribution intentionally submitted for inclusion in the Work by You to the
94
+ Licensor shall be under the terms and conditions of this License.
95
+
96
+ 6. Trademarks. This License does not grant permission to use the trade names,
97
+ trademarks, service marks, or product names of the Licensor, except as required
98
+ for reasonable and customary use in describing the origin of the Work.
99
+
100
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
101
+ writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR
102
+ CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
103
+ any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
104
+ FITNESS FOR A PARTICULAR PURPOSE.
105
+
106
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
107
+ tort (including negligence), contract, or otherwise, unless required by
108
+ applicable law or agreed to in writing, shall any Contributor be liable to You
109
+ for damages, including any direct, indirect, special, incidental, or
110
+ consequential damages arising as a result of this License or out of the use or
111
+ inability to use the Work.
112
+
113
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
114
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
115
+ acceptance of support, warranty, indemnity, or other liability obligations.
116
+ However, in accepting such obligations, You may act only on Your own behalf and
117
+ on Your sole responsibility.
package/README.md CHANGED
@@ -2,64 +2,20 @@
2
2
 
3
3
  `driggsby` is the local CLI for connecting AI clients to Driggsby over MCP.
4
4
 
5
- ## What You Get
6
-
7
- - browser-based sign-in to Driggsby
8
- - a local MCP server for tools like Codex and Claude Code
9
- - access to supported Driggsby tools from your AI client
10
-
11
- ## Run
12
-
13
- ```bash
14
- npx driggsby@latest login
15
- ```
16
-
17
- ## Install
18
-
19
- ```bash
20
- npm install -g driggsby
21
- ```
22
-
23
- If you prefer not to install globally, use `npx driggsby@latest` for
24
- human-invoked commands like `login`, `status`, and `logout`, and use
25
- `npx -y driggsby@latest mcp-server` for non-interactive MCP launcher flows.
26
-
27
- On machines without working platform keyring support, such as some headless
28
- Linux servers, Driggsby falls back to an owner-only local file-backed secret
29
- store so the CLI can still complete login and run the broker.
30
-
31
5
  ## Quick Start
32
6
 
33
- 1. Sign in:
34
-
35
7
  ```bash
36
8
  npx driggsby@latest login
37
- ```
38
-
39
- 2. Add Driggsby as an MCP server in your client:
40
-
41
- ```bash
42
- codex mcp add driggsby -- npx -y driggsby@latest mcp-server
43
- ```
44
-
45
- 3. Check broker status any time:
46
-
47
- ```bash
48
9
  npx driggsby@latest status
10
+ npx -y driggsby@latest mcp-server
49
11
  ```
50
12
 
51
- ## Commands
13
+ For non-interactive MCP launcher flows, use:
52
14
 
53
15
  ```bash
54
- npx driggsby@latest login
55
- npx driggsby@latest status
56
16
  npx -y driggsby@latest mcp-server
57
- npx driggsby@latest logout
58
17
  ```
59
18
 
60
19
  ## License
61
20
 
62
- This package is currently published as `UNLICENSED`.
63
-
64
- No license rights are granted beyond what The Good Software Company agrees to in
65
- writing.
21
+ Apache-2.0
package/install.js CHANGED
@@ -1,4 +1,168 @@
1
1
  #!/usr/bin/env node
2
-
3
- const { install } = require("./binary");
4
- install(false);
2
+ import { createHash } from "node:crypto";
3
+ import { chmodSync, createWriteStream, existsSync, lstatSync, mkdtempSync, mkdirSync, readFileSync, rmSync, } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { basename, dirname, join } from "node:path";
6
+ import { Transform } from "node:stream";
7
+ import { pipeline } from "node:stream/promises";
8
+ import { fileURLToPath } from "node:url";
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
+ const maxArtifactBytes = 64 * 1024 * 1024;
13
+ const packageJson = JSON.parse(readFileSync(join(packageDirectory, "package.json"), "utf8"));
14
+ try {
15
+ await install();
16
+ }
17
+ catch (error) {
18
+ if (error instanceof Error) {
19
+ console.error(error.message);
20
+ }
21
+ else {
22
+ console.error(error);
23
+ }
24
+ process.exit(1);
25
+ }
26
+ async function install() {
27
+ const platform = resolvePlatform();
28
+ const binaryPath = join(installDirectory, platform.binaryPath);
29
+ if (existsSync(binaryPath)) {
30
+ return;
31
+ }
32
+ rmSync(installDirectory, { force: true, recursive: true });
33
+ mkdirSync(installDirectory, { recursive: true });
34
+ const artifactUrl = `${packageJson.driggsbyArtifacts.baseUrl}/${platform.artifactName}`;
35
+ const tempDirectory = mkdtempSync(join(tmpdir(), "driggsby-install-"));
36
+ chmodSync(tempDirectory, 0o700);
37
+ const tempArtifact = join(tempDirectory, platform.artifactName);
38
+ try {
39
+ const expectedChecksum = packageJson.driggsbyArtifacts.checksums[platform.artifactName];
40
+ if (!expectedChecksum) {
41
+ throw new Error(`Driggsby package is missing a checksum for ${platform.artifactName}.`);
42
+ }
43
+ await downloadAndVerifyFile(artifactUrl, tempArtifact, expectedChecksum);
44
+ await extractTarball(tempArtifact, installDirectory, platform.binaryPath);
45
+ chmodSync(binaryPath, 0o755);
46
+ }
47
+ catch (error) {
48
+ rmSync(installDirectory, { force: true, recursive: true });
49
+ throw error;
50
+ }
51
+ finally {
52
+ rmSync(tempDirectory, { force: true, recursive: true });
53
+ }
54
+ }
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
+ async function downloadAndVerifyFile(url, destination, expectedChecksum) {
93
+ const response = await fetch(url);
94
+ if (!response.ok || response.body === null) {
95
+ throw new Error(`Could not download Driggsby binary ${url}: HTTP ${response.status}.`);
96
+ }
97
+ const contentLength = response.headers.get("content-length");
98
+ if (contentLength && Number(contentLength) > maxArtifactBytes) {
99
+ throw new Error(`Driggsby binary download is unexpectedly large: ${contentLength} bytes.`);
100
+ }
101
+ const hash = createHash("sha256");
102
+ let bytesRead = 0;
103
+ const verifier = new Transform({
104
+ transform(chunk, _encoding, callback) {
105
+ bytesRead += chunk.byteLength;
106
+ if (bytesRead > maxArtifactBytes) {
107
+ callback(new Error(`Driggsby binary download exceeded ${maxArtifactBytes} bytes.`));
108
+ return;
109
+ }
110
+ hash.update(chunk);
111
+ callback(null, chunk);
112
+ },
113
+ });
114
+ await pipeline(response.body, verifier, createWriteStream(destination, { flags: "wx", mode: 0o600 }));
115
+ const actualChecksum = hash.digest("hex");
116
+ if (actualChecksum !== expectedChecksum) {
117
+ throw new Error(`Driggsby binary checksum mismatch for ${basename(destination)}. Expected ${expectedChecksum}, got ${actualChecksum}.`);
118
+ }
119
+ }
120
+ function extractTarball(artifactPath, destination, binaryPath) {
121
+ const tarPath = trustedTarPath();
122
+ const entry = findBinaryTarEntry(tarPath, artifactPath, binaryPath);
123
+ const installedBinary = join(destination, binaryPath);
124
+ writeCommandOutputToFile(tarPath, ["-xOf", artifactPath, "--", entry], installedBinary, maxArtifactBytes);
125
+ if (!existsSync(installedBinary)) {
126
+ throw new Error(`Driggsby archive did not contain expected binary ${binaryPath}.`);
127
+ }
128
+ const installedBinaryStats = lstatSync(installedBinary);
129
+ if (!installedBinaryStats.isFile() || installedBinaryStats.isSymbolicLink()) {
130
+ throw new Error(`Driggsby archive entry ${binaryPath} was not a regular file.`);
131
+ }
132
+ }
133
+ function trustedTarPath() {
134
+ for (const candidate of ["/usr/bin/tar", "/bin/tar"]) {
135
+ if (existsSync(candidate)) {
136
+ return candidate;
137
+ }
138
+ }
139
+ throw new Error("Could not find the system tar executable required to unpack Driggsby.");
140
+ }
141
+ function findBinaryTarEntry(tarPath, artifactPath, binaryPath) {
142
+ const entries = readCommandOutput(tarPath, ["-tf", artifactPath])
143
+ .split("\n")
144
+ .map((entry) => entry.trim())
145
+ .filter((entry) => entry.length > 0);
146
+ const binaryEntries = [];
147
+ for (const entry of entries) {
148
+ const normalizedEntry = entry.replace(/\\/g, "/");
149
+ const segments = normalizedEntry.split("/").filter((segment) => segment.length > 0);
150
+ if (normalizedEntry.startsWith("/") ||
151
+ /^[A-Za-z]:/.test(normalizedEntry) ||
152
+ segments.includes("..") ||
153
+ segments.some((segment) => segment.startsWith("-"))) {
154
+ throw new Error(`Driggsby archive contains unsafe path ${entry}.`);
155
+ }
156
+ if (segments.length === 2 && segments[1] === binaryPath) {
157
+ binaryEntries.push(entry);
158
+ }
159
+ }
160
+ if (binaryEntries.length !== 1) {
161
+ throw new Error(`Driggsby archive did not contain exactly one ${binaryPath} binary.`);
162
+ }
163
+ const [binaryEntry] = binaryEntries;
164
+ if (!binaryEntry) {
165
+ throw new Error(`Driggsby archive did not contain expected binary ${binaryPath}.`);
166
+ }
167
+ return binaryEntry;
168
+ }
package/lib/process.js ADDED
@@ -0,0 +1,65 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { writeFileSync } from "node:fs";
3
+ export function runFile(command, args) {
4
+ const result = spawnSync(command, args, {
5
+ cwd: process.cwd(),
6
+ stdio: "inherit",
7
+ });
8
+ if (result.error) {
9
+ throw result.error;
10
+ }
11
+ return { status: result.status ?? 1 };
12
+ }
13
+ export function spawnFile(command, args) {
14
+ const result = runFile(command, args);
15
+ if (result.status !== 0) {
16
+ throw new Error(`${command} exited with status ${result.status}.`);
17
+ }
18
+ }
19
+ export function readCommandOutput(command, args) {
20
+ const result = spawnSync(command, args, {
21
+ cwd: process.cwd(),
22
+ encoding: "utf8",
23
+ maxBuffer: 1024 * 1024,
24
+ });
25
+ if (result.error) {
26
+ throw result.error;
27
+ }
28
+ if (result.status !== 0) {
29
+ const stderr = result.stderr.trim();
30
+ const detail = stderr.length > 0 ? `: ${stderr}` : "";
31
+ throw new Error(`${command} exited with status ${result.status ?? 1}${detail}.`);
32
+ }
33
+ return result.stdout;
34
+ }
35
+ export function writeCommandOutputToFile(command, args, destination, maxBytes) {
36
+ const result = spawnSync(command, args, {
37
+ cwd: process.cwd(),
38
+ encoding: "buffer",
39
+ maxBuffer: maxBytes,
40
+ });
41
+ if (result.error) {
42
+ throw result.error;
43
+ }
44
+ if (result.status !== 0) {
45
+ const stderr = result.stderr.toString("utf8").trim();
46
+ const detail = stderr.length > 0 ? `: ${stderr}` : "";
47
+ throw new Error(`${command} exited with status ${result.status ?? 1}${detail}.`);
48
+ }
49
+ writeFileSync(destination, result.stdout, { flag: "wx", mode: 0o700 });
50
+ }
51
+ export function spawnFileAndExit(command, args) {
52
+ try {
53
+ const result = runFile(command, args);
54
+ process.exit(result.status);
55
+ }
56
+ catch (error) {
57
+ if (error instanceof Error) {
58
+ console.error(error.message);
59
+ }
60
+ else {
61
+ console.error(error);
62
+ }
63
+ process.exit(1);
64
+ }
65
+ }
package/package.json CHANGED
@@ -1,63 +1,48 @@
1
1
  {
2
- "artifactDownloadUrls": [
3
- "https://github.com/thegoodsoftwareco/driggsby/releases/download/driggsby-v0.1.14"
4
- ],
2
+ "name": "driggsby",
3
+ "version": "0.1.16",
4
+ "description": "Local MCP broker and CLI for connecting AI clients to Driggsby",
5
+ "license": "Apache-2.0",
6
+ "repository": "https://github.com/thegoodsoftwareco/driggsby-cli",
7
+ "type": "module",
5
8
  "bin": {
6
9
  "driggsby": "run-driggsby.js"
7
10
  },
8
- "dependencies": {
9
- "axios": "^1.13.5",
10
- "axios-proxy-builder": "^0.1.2",
11
- "console.table": "^0.10.0",
12
- "detect-libc": "^2.1.2",
13
- "rimraf": "^6.1.3"
14
- },
15
- "description": "Local MCP broker and CLI for connecting AI clients to Driggsby",
16
- "devDependencies": {
17
- "prettier": "^3.8.1"
18
- },
19
- "engines": {
20
- "node": ">=14",
21
- "npm": ">=6"
22
- },
23
- "glibcMinimum": {
24
- "major": 2,
25
- "series": 35
26
- },
27
- "name": "driggsby",
28
- "preferUnplugged": true,
29
- "repository": "https://github.com/thegoodsoftwareco/driggsby",
30
11
  "scripts": {
31
- "fmt": "prettier --write **/*.js",
32
- "fmt:check": "prettier --check **/*.js",
33
12
  "postinstall": "node ./install.js"
34
13
  },
35
- "supportedPlatforms": {
36
- "aarch64-apple-darwin": {
37
- "artifactName": "driggsby-aarch64-apple-darwin.tar.xz",
38
- "bins": {
39
- "driggsby": "driggsby"
40
- },
41
- "zipExt": ".tar.xz"
14
+ "engines": {
15
+ "node": ">=18",
16
+ "npm": ">=9"
17
+ },
18
+ "files": [
19
+ "LICENSE",
20
+ "README.md",
21
+ "install.js",
22
+ "lib",
23
+ "package.json",
24
+ "run-driggsby.js"
25
+ ],
26
+ "driggsbyArtifacts": {
27
+ "baseUrl": "https://github.com/thegoodsoftwareco/driggsby-cli/releases/download/driggsby-v0.1.16",
28
+ "checksums": {
29
+ "driggsby-aarch64-apple-darwin.tar.xz": "627b0b53f288270d3a4f29c12811c92e34fd7eba8107a92e0854d98d9a6d845d",
30
+ "driggsby-x86_64-apple-darwin.tar.xz": "3ab8735d30f98b15f878fe397fd5f2496a75192e155a5626987869394748acb1",
31
+ "driggsby-x86_64-unknown-linux-gnu.tar.xz": "515cacd5a00b42e742a84e81fcb08f32a3d76d9ce24b300b7ccaf3850550bd21"
42
32
  },
43
- "x86_64-apple-darwin": {
44
- "artifactName": "driggsby-x86_64-apple-darwin.tar.xz",
45
- "bins": {
46
- "driggsby": "driggsby"
33
+ "supportedPlatforms": {
34
+ "aarch64-apple-darwin": {
35
+ "artifactName": "driggsby-aarch64-apple-darwin.tar.xz",
36
+ "binaryPath": "driggsby"
47
37
  },
48
- "zipExt": ".tar.xz"
49
- },
50
- "x86_64-unknown-linux-gnu": {
51
- "artifactName": "driggsby-x86_64-unknown-linux-gnu.tar.xz",
52
- "bins": {
53
- "driggsby": "driggsby"
38
+ "x86_64-apple-darwin": {
39
+ "artifactName": "driggsby-x86_64-apple-darwin.tar.xz",
40
+ "binaryPath": "driggsby"
54
41
  },
55
- "zipExt": ".tar.xz"
42
+ "x86_64-unknown-linux-gnu": {
43
+ "artifactName": "driggsby-x86_64-unknown-linux-gnu.tar.xz",
44
+ "binaryPath": "driggsby"
45
+ }
56
46
  }
57
- },
58
- "version": "0.1.14",
59
- "volta": {
60
- "node": "18.14.1",
61
- "npm": "9.5.0"
62
47
  }
63
- }
48
+ }
package/run-driggsby.js CHANGED
@@ -1,4 +1,12 @@
1
1
  #!/usr/bin/env node
2
-
3
- const { run } = require("./binary");
4
- run("driggsby");
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));
package/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- /node_modules
2
-