@raysonmeng/agentbridge 0.1.5 → 0.1.6
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +2 -3
- package/README.zh-CN.md +2 -3
- package/dist/cli.js +324 -88
- package/package.json +1 -1
- package/plugins/agentbridge/.claude-plugin/plugin.json +1 -1
- package/plugins/agentbridge/server/bridge-server.js +121 -117
- package/plugins/agentbridge/server/daemon.js +336 -124
- package/scripts/postinstall.cjs +44 -4
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* postinstall
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* postinstall: verify Bun, register marketplace, install plugin.
|
|
5
|
+
* Runs after `npm install -g @raysonmeng/agentbridge`.
|
|
6
|
+
*
|
|
7
|
+
* All steps are best-effort — a failure here does not block the npm install.
|
|
8
|
+
* Users can always fall back to `abg init` for manual setup.
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
const { execFileSync } = require("child_process");
|
|
12
|
+
const path = require("path");
|
|
10
13
|
|
|
14
|
+
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
15
|
+
const MARKETPLACE_NAME = "agentbridge";
|
|
16
|
+
const PLUGIN_NAME = "agentbridge";
|
|
17
|
+
|
|
18
|
+
// Step 1: Check Bun
|
|
19
|
+
let bunOk = false;
|
|
11
20
|
try {
|
|
12
21
|
const version = execFileSync("bun", ["--version"], { encoding: "utf-8" }).trim();
|
|
13
22
|
console.log(`\x1b[32m✔\x1b[0m AgentBridge: Bun ${version} detected.`);
|
|
23
|
+
bunOk = true;
|
|
14
24
|
} catch {
|
|
15
25
|
console.warn(`
|
|
16
26
|
\x1b[33m⚠ AgentBridge requires Bun (v1.0+) as its runtime.\x1b[0m
|
|
@@ -22,6 +32,36 @@ Install Bun with:
|
|
|
22
32
|
|
|
23
33
|
Then restart your terminal and run:
|
|
24
34
|
|
|
25
|
-
abg
|
|
35
|
+
abg init
|
|
26
36
|
`);
|
|
27
37
|
}
|
|
38
|
+
|
|
39
|
+
// Step 2: Register marketplace + install plugin (requires Claude Code)
|
|
40
|
+
if (bunOk) {
|
|
41
|
+
try {
|
|
42
|
+
execFileSync("claude", ["--version"], { encoding: "utf-8" });
|
|
43
|
+
} catch {
|
|
44
|
+
console.log(`\x1b[33m⚠\x1b[0m AgentBridge: Claude Code not found — skipping plugin install.`);
|
|
45
|
+
console.log(` After installing Claude Code, run: abg init`);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
execFileSync("claude", ["plugin", "marketplace", "add", PACKAGE_ROOT], {
|
|
51
|
+
stdio: "pipe",
|
|
52
|
+
});
|
|
53
|
+
console.log(`\x1b[32m✔\x1b[0m AgentBridge: Marketplace registered.`);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.log(`\x1b[33m⚠\x1b[0m AgentBridge: Marketplace registration failed — run \`abg init\` to retry.`);
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
execFileSync("claude", ["plugin", "install", `${PLUGIN_NAME}@${MARKETPLACE_NAME}`], {
|
|
61
|
+
stdio: "pipe",
|
|
62
|
+
});
|
|
63
|
+
console.log(`\x1b[32m✔\x1b[0m AgentBridge: Plugin installed. Run \`abg claude\` to start.`);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log(`\x1b[33m⚠\x1b[0m AgentBridge: Plugin install failed — run \`abg init\` to retry.`);
|
|
66
|
+
}
|
|
67
|
+
}
|