opencode-router
Advanced tools
| #!/usr/bin/env node | ||
| import { spawnSync } from "node:child_process"; | ||
| import { basename } from "node:path"; | ||
| import { existsSync } from "node:fs"; | ||
| import { fileURLToPath } from "node:url"; | ||
| const packageRoot = fileURLToPath(new URL("..", import.meta.url)); | ||
| const args = process.argv.slice(2); | ||
| const compiledBinaryName = process.platform === "win32" ? "opencode-router.exe" : "opencode-router"; | ||
| const compiledBinary = fileURLToPath(new URL(`./dist/bin/${compiledBinaryName}`, `${new URL("../", import.meta.url)}`)); | ||
| const builtCli = fileURLToPath(new URL("./dist/cli.js", `${new URL("../", import.meta.url)}`)); | ||
| const sourceCli = fileURLToPath(new URL("./src/cli.ts", `${new URL("../", import.meta.url)}`)); | ||
| function run(command, commandArgs) { | ||
| const result = spawnSync(command, commandArgs, { stdio: "inherit" }); | ||
| if (result.error) { | ||
| if (result.error.code === "ENOENT") { | ||
| console.error(`Missing runtime dependency: ${command}`); | ||
| process.exit(1); | ||
| } | ||
| throw result.error; | ||
| } | ||
| process.exit(result.status ?? 1); | ||
| } | ||
| if (existsSync(compiledBinary)) { | ||
| run(compiledBinary, args); | ||
| } | ||
| if (existsSync(builtCli)) { | ||
| run("bun", [builtCli, ...args]); | ||
| } | ||
| if (existsSync(sourceCli)) { | ||
| run("bun", [sourceCli, ...args]); | ||
| } | ||
| console.error( | ||
| `Unable to find an opencode-router entrypoint in ${basename(packageRoot)}. Build the package or run it from a source checkout with Bun available.`, | ||
| ); | ||
| process.exit(1); |
+7
-7
@@ -24,3 +24,3 @@ #!/usr/bin/env bash | ||
| Example: | ||
| OPENCODE_ROUTER_INSTALL_DIR=~/opencode-router curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/opencode-router/install.sh | bash | ||
| OPENCODE_ROUTER_INSTALL_DIR=~/opencode-router curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/apps/opencode-router/install.sh | bash | ||
| EOF | ||
@@ -81,3 +81,3 @@ } | ||
| if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router" ]]; then | ||
| if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" ]]; then | ||
| echo "opencode-router package not found on ref '$OPENCODE_ROUTER_REF'. Trying dev/main..." >&2 | ||
@@ -92,3 +92,3 @@ git -C "$OPENCODE_ROUTER_INSTALL_DIR" fetch origin --prune | ||
| if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router" ]]; then | ||
| if [[ ! -d "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" ]]; then | ||
| echo "opencode-router package not found after checkout. Aborting." >&2 | ||
@@ -102,6 +102,6 @@ exit 1 | ||
| echo "Building opencode-router..." | ||
| pnpm -C "$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router" build | ||
| pnpm -C "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router" build | ||
| ENV_PATH="$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router/.env" | ||
| ENV_EXAMPLE="$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router/.env.example" | ||
| ENV_PATH="$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/.env" | ||
| ENV_EXAMPLE="$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/.env.example" | ||
| if [[ ! -f "$ENV_PATH" ]]; then | ||
@@ -127,3 +127,3 @@ if [[ -f "$ENV_EXAMPLE" ]]; then | ||
| set -euo pipefail | ||
| bun "$OPENCODE_ROUTER_INSTALL_DIR/packages/opencode-router/dist/cli.js" "$@" | ||
| bun "$OPENCODE_ROUTER_INSTALL_DIR/apps/opencode-router/dist/cli.js" "$@" | ||
| EOF | ||
@@ -130,0 +130,0 @@ chmod 755 "$OPENCODE_ROUTER_BIN_DIR/opencode-router" |
+8
-0
@@ -0,1 +1,9 @@ | ||
| Copyright (c) 2026-present Different AI, Inc. | ||
| Portions of this software are licensed as follows: | ||
| * All content that resides under the /ee directory of this repository (Fair Source License) is licensed under the license defined in "ee/LICENSE". | ||
| * All third party components incorporated into the OpenWork Software are licensed under the original license provided by the owner of the applicable component. | ||
| * Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined below. | ||
| MIT License | ||
@@ -2,0 +10,0 @@ |
+4
-3
| { | ||
| "name": "opencode-router", | ||
| "version": "0.11.170", | ||
| "version": "0.11.172", | ||
| "description": "opencode-router: Slack + Telegram bridge + directory routing for a running opencode server", | ||
@@ -8,3 +8,3 @@ "private": false, | ||
| "bin": { | ||
| "opencode-router": "dist/cli.js" | ||
| "opencode-router": "bin/opencode-router.mjs" | ||
| }, | ||
@@ -15,3 +15,3 @@ "license": "MIT", | ||
| "url": "git+https://github.com/different-ai/openwork.git", | ||
| "directory": "packages/opencode-router" | ||
| "directory": "apps/opencode-router" | ||
| }, | ||
@@ -27,2 +27,3 @@ "keywords": [ | ||
| "files": [ | ||
| "bin", | ||
| "dist", | ||
@@ -29,0 +30,0 @@ "README.md", |
+8
-8
@@ -12,3 +12,3 @@ # opencode-router | ||
| ```bash | ||
| curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/opencode-router/install.sh | bash | ||
| curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/apps/opencode-router/install.sh | bash | ||
| ``` | ||
@@ -33,6 +33,6 @@ | ||
| ```bash | ||
| pnpm -C packages/opencode-router setup | ||
| pnpm -C apps/opencode-router setup | ||
| ``` | ||
| 2) (Optional) Fill in `packages/opencode-router/.env` (see `.env.example`). | ||
| 2) (Optional) Fill in `apps/opencode-router/.env` (see `.env.example`). | ||
@@ -172,3 +172,3 @@ Required: | ||
| - SQLite at `~/.openwork/opencode-router/opencode-router.db` unless overridden. | ||
| - Config stored at `~/.openwork/opencode-router/opencode-router.json` (created by `opencode-router` or `pnpm -C packages/opencode-router setup`). | ||
| - Config stored at `~/.openwork/opencode-router/opencode-router.json` (created by `opencode-router` or `pnpm -C apps/opencode-router setup`). | ||
| - Group chats are disabled unless `GROUPS_ENABLED=true`. | ||
@@ -182,3 +182,3 @@ | ||
| opencode serve --port 4096 --hostname 127.0.0.1 | ||
| pnpm -C packages/opencode-router test:smoke | ||
| pnpm -C apps/opencode-router test:smoke | ||
| ``` | ||
@@ -189,5 +189,5 @@ | ||
| ```bash | ||
| pnpm -C packages/opencode-router test:unit | ||
| pnpm -C packages/opencode-router test:cli | ||
| pnpm -C packages/opencode-router test:npx | ||
| pnpm -C apps/opencode-router test:unit | ||
| pnpm -C apps/opencode-router test:cli | ||
| pnpm -C apps/opencode-router test:npx | ||
| ``` |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
220976
0.88%20
5.26%4577
0.77%