opencode-router 0.11.170 → 0.11.173
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 +8 -0
- package/README.md +8 -8
- package/bin/opencode-router.mjs +43 -0
- package/dist/cli.js +0 -0
- package/install.sh +7 -7
- package/package.json +4 -3
package/LICENSE
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
Copyright (c) 2026-present Different AI, Inc.
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
* All content that resides under the /ee directory of this repository (Fair Source License) is licensed under the license defined in "ee/LICENSE".
|
|
6
|
+
* All third party components incorporated into the OpenWork Software are licensed under the original license provided by the owner of the applicable component.
|
|
7
|
+
* Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined below.
|
|
8
|
+
|
|
1
9
|
MIT License
|
|
2
10
|
|
|
3
11
|
Copyright (c) 2026 Different AI
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Runtime requirement: Bun 1.3+ (`bun --version`).
|
|
|
9
9
|
One-command install (recommended):
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/
|
|
12
|
+
curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/apps/opencode-router/install.sh | bash
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Install from npm:
|
|
@@ -29,10 +29,10 @@ Then configure identities and start.
|
|
|
29
29
|
1) One-command setup (installs deps, builds, creates `.env` if missing):
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
pnpm -C
|
|
32
|
+
pnpm -C apps/opencode-router setup
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
2) (Optional) Fill in `
|
|
35
|
+
2) (Optional) Fill in `apps/opencode-router/.env` (see `.env.example`).
|
|
36
36
|
|
|
37
37
|
Required:
|
|
38
38
|
- `OPENCODE_URL`
|
|
@@ -167,7 +167,7 @@ opencode-router send --channel slack --identity default --to D123 --file ./repor
|
|
|
167
167
|
## Defaults
|
|
168
168
|
|
|
169
169
|
- SQLite at `~/.openwork/opencode-router/opencode-router.db` unless overridden.
|
|
170
|
-
- Config stored at `~/.openwork/opencode-router/opencode-router.json` (created by `opencode-router` or `pnpm -C
|
|
170
|
+
- Config stored at `~/.openwork/opencode-router/opencode-router.json` (created by `opencode-router` or `pnpm -C apps/opencode-router setup`).
|
|
171
171
|
- Group chats are disabled unless `GROUPS_ENABLED=true`.
|
|
172
172
|
|
|
173
173
|
## Tests
|
|
@@ -176,13 +176,13 @@ opencode-router send --channel slack --identity default --to D123 --file ./repor
|
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
178
|
opencode serve --port 4096 --hostname 127.0.0.1
|
|
179
|
-
pnpm -C
|
|
179
|
+
pnpm -C apps/opencode-router test:smoke
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
Other test suites:
|
|
183
183
|
|
|
184
184
|
```bash
|
|
185
|
-
pnpm -C
|
|
186
|
-
pnpm -C
|
|
187
|
-
pnpm -C
|
|
185
|
+
pnpm -C apps/opencode-router test:unit
|
|
186
|
+
pnpm -C apps/opencode-router test:cli
|
|
187
|
+
pnpm -C apps/opencode-router test:npx
|
|
188
188
|
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { basename } from "node:path";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const packageRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
const compiledBinaryName = process.platform === "win32" ? "opencode-router.exe" : "opencode-router";
|
|
12
|
+
const compiledBinary = fileURLToPath(new URL(`./dist/bin/${compiledBinaryName}`, `${new URL("../", import.meta.url)}`));
|
|
13
|
+
const builtCli = fileURLToPath(new URL("./dist/cli.js", `${new URL("../", import.meta.url)}`));
|
|
14
|
+
const sourceCli = fileURLToPath(new URL("./src/cli.ts", `${new URL("../", import.meta.url)}`));
|
|
15
|
+
|
|
16
|
+
function run(command, commandArgs) {
|
|
17
|
+
const result = spawnSync(command, commandArgs, { stdio: "inherit" });
|
|
18
|
+
if (result.error) {
|
|
19
|
+
if (result.error.code === "ENOENT") {
|
|
20
|
+
console.error(`Missing runtime dependency: ${command}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
throw result.error;
|
|
24
|
+
}
|
|
25
|
+
process.exit(result.status ?? 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (existsSync(compiledBinary)) {
|
|
29
|
+
run(compiledBinary, args);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (existsSync(builtCli)) {
|
|
33
|
+
run("bun", [builtCli, ...args]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (existsSync(sourceCli)) {
|
|
37
|
+
run("bun", [sourceCli, ...args]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.error(
|
|
41
|
+
`Unable to find an opencode-router entrypoint in ${basename(packageRoot)}. Build the package or run it from a source checkout with Bun available.`,
|
|
42
|
+
);
|
|
43
|
+
process.exit(1);
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/install.sh
CHANGED
|
@@ -21,7 +21,7 @@ Environment variables:
|
|
|
21
21
|
OPENCODE_ROUTER_INSTALL_METHOD Install method: npm|git (default: npm)
|
|
22
22
|
|
|
23
23
|
Example:
|
|
24
|
-
OPENCODE_ROUTER_INSTALL_DIR=~/opencode-router curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/
|
|
24
|
+
OPENCODE_ROUTER_INSTALL_DIR=~/opencode-router curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/apps/opencode-router/install.sh | bash
|
|
25
25
|
EOF
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -77,7 +77,7 @@ else
|
|
|
77
77
|
fi
|
|
78
78
|
fi
|
|
79
79
|
|
|
80
|
-
if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/
|
|
80
|
+
if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" ]]; then
|
|
81
81
|
echo "opencode-router package not found on ref '$OPENCODE_ROUTER_REF'. Trying dev/main..." >&2
|
|
82
82
|
git -C "$OPENCODE_ROUTER_INSTALL_DIR" fetch origin --prune
|
|
83
83
|
if git -C "$OPENCODE_ROUTER_INSTALL_DIR" show-ref --verify --quiet refs/remotes/origin/dev; then
|
|
@@ -87,7 +87,7 @@ else
|
|
|
87
87
|
fi
|
|
88
88
|
fi
|
|
89
89
|
|
|
90
|
-
if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/
|
|
90
|
+
if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" ]]; then
|
|
91
91
|
echo "opencode-router package not found after checkout. Aborting." >&2
|
|
92
92
|
exit 1
|
|
93
93
|
fi
|
|
@@ -96,10 +96,10 @@ else
|
|
|
96
96
|
pnpm -C "$OPENCODE_ROUTER_INSTALL_DIR" install
|
|
97
97
|
|
|
98
98
|
echo "Building opencode-router..."
|
|
99
|
-
pnpm -C "$OPENCODE_ROUTER_INSTALL_DIR/
|
|
99
|
+
pnpm -C "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" build
|
|
100
100
|
|
|
101
|
-
ENV_PATH="$OPENCODE_ROUTER_INSTALL_DIR/
|
|
102
|
-
ENV_EXAMPLE="$OPENCODE_ROUTER_INSTALL_DIR/
|
|
101
|
+
ENV_PATH="$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/.env"
|
|
102
|
+
ENV_EXAMPLE="$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/.env.example"
|
|
103
103
|
if [[ ! -f "$ENV_PATH" ]]; then
|
|
104
104
|
if [[ -f "$ENV_EXAMPLE" ]]; then
|
|
105
105
|
cp "$ENV_EXAMPLE" "$ENV_PATH"
|
|
@@ -120,7 +120,7 @@ EOF
|
|
|
120
120
|
cat <<EOF > "$OPENCODE_ROUTER_BIN_DIR/opencode-router"
|
|
121
121
|
#!/usr/bin/env bash
|
|
122
122
|
set -euo pipefail
|
|
123
|
-
bun "$OPENCODE_ROUTER_INSTALL_DIR/
|
|
123
|
+
bun "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/dist/cli.js" "$@"
|
|
124
124
|
EOF
|
|
125
125
|
chmod 755 "$OPENCODE_ROUTER_BIN_DIR/opencode-router"
|
|
126
126
|
CUSTOM_SHIM_CREATED=true
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-router",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.173",
|
|
4
4
|
"description": "opencode-router: Slack + Telegram bridge + directory routing for a running opencode server",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"opencode-router": "
|
|
8
|
+
"opencode-router": "bin/opencode-router.mjs"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git+https://github.com/different-ai/openwork.git",
|
|
14
|
-
"directory": "
|
|
14
|
+
"directory": "apps/opencode-router"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"opencode",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"bot"
|
|
23
23
|
],
|
|
24
24
|
"files": [
|
|
25
|
+
"bin",
|
|
25
26
|
"dist",
|
|
26
27
|
"README.md",
|
|
27
28
|
".env.example",
|