hermit-bridge 0.1.0
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 +31 -0
- package/bin/hermit-bridge +0 -0
- package/package.json +39 -0
- package/run.js +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# hermit-bridge
|
|
2
|
+
|
|
3
|
+
Hermit's build of [cc-connect](https://github.com/chenhg5/cc-connect) — a bridge
|
|
4
|
+
that connects local AI coding agents (Claude Code, Codex, …) to messaging
|
|
5
|
+
platforms (Feishu, DingTalk, Slack, Telegram, Discord, LINE, WeChat) and, on top
|
|
6
|
+
of upstream, **broadcasts per-turn token usage to bridge observers** so a control
|
|
7
|
+
plane such as [Hermit](https://github.com/yancyuu) can record telemetry in real
|
|
8
|
+
time without parsing session files.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx hermit-bridge --force -config /path/to/config.toml
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Same CLI as `cc-connect` (`-config`, `--force`, subcommands). A connection may
|
|
17
|
+
register over the bridge WebSocket with `observe_usage: true` to receive a
|
|
18
|
+
content-free `usage` event (token counts only) after every turn, for every IM
|
|
19
|
+
platform — not just bridge-backed ones.
|
|
20
|
+
|
|
21
|
+
## Build
|
|
22
|
+
|
|
23
|
+
This package ships the **arm64-darwin** binary inside the tarball (built with
|
|
24
|
+
`go build -tags no_web`). `os`/`cpu` are pinned in `package.json`, so installing
|
|
25
|
+
on Linux / Windows / x64 fails fast with a clear platform error instead of
|
|
26
|
+
shipping a non-runnable binary. Cross-platform packaging (postinstall downloader
|
|
27
|
+
per OS, like upstream) is a follow-up.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT (same as upstream cc-connect).
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hermit-bridge",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Hermit's build of cc-connect — bridges AI coding agents (Claude Code, Codex, ...) to IM platforms (Feishu, DingTalk, Slack, Telegram, Discord, LINE, WeChat) and broadcasts per-turn token usage to observers. arm64-darwin build.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"ai-coding",
|
|
8
|
+
"feishu",
|
|
9
|
+
"dingtalk",
|
|
10
|
+
"slack",
|
|
11
|
+
"telegram",
|
|
12
|
+
"discord",
|
|
13
|
+
"line",
|
|
14
|
+
"wechat",
|
|
15
|
+
"bridge",
|
|
16
|
+
"hermit"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "yancyyu",
|
|
20
|
+
"homepage": "https://github.com/chenhg5/cc-connect",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/chenhg5/cc-connect.git"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"hermit-bridge": "run.js"
|
|
27
|
+
},
|
|
28
|
+
"os": [
|
|
29
|
+
"darwin"
|
|
30
|
+
],
|
|
31
|
+
"cpu": [
|
|
32
|
+
"arm64"
|
|
33
|
+
],
|
|
34
|
+
"files": [
|
|
35
|
+
"run.js",
|
|
36
|
+
"bin/hermit-bridge",
|
|
37
|
+
"README.md"
|
|
38
|
+
]
|
|
39
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Thin shim that launches the bundled cc-connect (hermit-bridge) binary with the
|
|
5
|
+
// caller's argv and inherited stdio. Mirrors how the upstream cc-connect npm
|
|
6
|
+
// package exposes its binary, but ships the binary inside the tarball instead of
|
|
7
|
+
// downloading it at install time.
|
|
8
|
+
|
|
9
|
+
const { spawn } = require('node:child_process');
|
|
10
|
+
const path = require('node:path');
|
|
11
|
+
const fs = require('node:fs');
|
|
12
|
+
|
|
13
|
+
const binPath = path.join(__dirname, 'bin', 'hermit-bridge');
|
|
14
|
+
if (!fs.existsSync(binPath)) {
|
|
15
|
+
console.error(`hermit-bridge: binary not found at ${binPath}`);
|
|
16
|
+
process.exit(127);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
20
|
+
|
|
21
|
+
child.on('error', (err) => {
|
|
22
|
+
console.error(`hermit-bridge: failed to launch binary: ${err.message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('exit', (code, signal) => {
|
|
27
|
+
if (signal) {
|
|
28
|
+
try {
|
|
29
|
+
process.kill(process.pid, signal);
|
|
30
|
+
} catch {
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
process.exit(code ?? 0);
|
|
35
|
+
}
|
|
36
|
+
});
|