mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
feat: CLI Integration Suite for issue #2016
- Add tool-detector.ts (6 CLI tools: claude, codex, opencode, cline, kilocode, continue) - Add config-generator/ factory + 6 generators (JSON + YAML) - Add doctor/checks.ts for CLI tool health checks - Add log-streamer.ts for usage log streaming - Add @omniroute/opencode-provider npm package - Add 5 CLI commands: config, status, logs, update, provider - Add 3 API routes: config, detect, apply - Update bin/omniroute.mjs, bin/cli/index.mjs, package.json - Update docs: SETUP_GUIDE.md, CLI-TOOLS.md - All tests pass (4302/4326, 24 pre-existing failures unchanged)
This commit is contained in:
45
@omniroute/opencode-provider/README.md
Normal file
45
@omniroute/opencode-provider/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# @omniroute/opencode-provider
|
||||
|
||||
Provider plugin for connecting [OpenCode](https://github.com/anomalyco/opencode) to [OmniRoute](https://github.com/diegosouzapw/OmniRoute).
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @omniroute/opencode-provider
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import { createOmniRouteProvider } from "@omniroute/opencode-provider";
|
||||
|
||||
const provider = createOmniRouteProvider({
|
||||
baseURL: "http://localhost:20128/v1",
|
||||
apiKey: "your-omniroute-api-key",
|
||||
});
|
||||
```
|
||||
|
||||
Then configure OpenCode to use the provider:
|
||||
|
||||
```jsonc
|
||||
// OpenCode settings
|
||||
{
|
||||
"provider": provider
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `createOmniRouteProvider(options)`
|
||||
|
||||
Creates an OpenCode-compatible provider object that routes requests through OmniRoute.
|
||||
|
||||
**Options:**
|
||||
|
||||
| Option | Type | Required | Description |
|
||||
| --------- | -------- | -------- | ---------------------------------------------------------- |
|
||||
| `baseURL` | `string` | Yes | OmniRoute API base URL (e.g., `http://localhost:20128/v1`) |
|
||||
| `apiKey` | `string` | Yes | OmniRoute API key |
|
||||
| `model` | `string` | No | Model identifier (default: `"opencode"`) |
|
||||
|
||||
**Returns:** An OpenCode-compatible provider object with `id`, `name`, `npm`, `options`, and `auth` fields.
|
||||
3
@omniroute/opencode-provider/index.d.ts
vendored
Normal file
3
@omniroute/opencode-provider/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import OmniRouteProvider from "./index.js";
|
||||
export { OmniRouteProvider };
|
||||
export default OmniRouteProvider;
|
||||
1
@omniroute/opencode-provider/index.js
Normal file
1
@omniroute/opencode-provider/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export { createOmniRouteProvider, default as default } from "./index.ts";
|
||||
54
@omniroute/opencode-provider/index.ts
Normal file
54
@omniroute/opencode-provider/index.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* OpenCode provider plugin for OmniRoute AI Gateway
|
||||
*
|
||||
* Usage:
|
||||
* import { createOmniRouteProvider } from "@omniroute/opencode-provider";
|
||||
* const provider = createOmniRouteProvider({
|
||||
* baseURL: "http://localhost:20128/v1",
|
||||
* apiKey: "your-api-key",
|
||||
* });
|
||||
*
|
||||
* Then add to OpenCode settings:
|
||||
* { "provider": provider }
|
||||
*/
|
||||
|
||||
export interface OmniRouteProviderOptions {
|
||||
baseURL: string;
|
||||
apiKey: string;
|
||||
model?: string;
|
||||
}
|
||||
|
||||
export interface OmniRouteProvider {
|
||||
id: string;
|
||||
name: string;
|
||||
npm: string;
|
||||
options: Record<string, unknown>;
|
||||
auth: { type: string; apiKey: string };
|
||||
}
|
||||
|
||||
export function createOmniRouteProvider(options: OmniRouteProviderOptions): OmniRouteProvider {
|
||||
if (!options.baseURL) {
|
||||
throw new Error("baseURL is required");
|
||||
}
|
||||
if (!options.apiKey) {
|
||||
throw new Error("apiKey is required");
|
||||
}
|
||||
|
||||
const baseURL = options.baseURL.replace(/\/+$/, "");
|
||||
|
||||
return {
|
||||
id: "omniroute",
|
||||
name: "OmniRoute AI Gateway",
|
||||
npm: "@omniroute/opencode-provider",
|
||||
options: {
|
||||
baseURL: `${baseURL}/v1`,
|
||||
model: options.model || "opencode",
|
||||
},
|
||||
auth: {
|
||||
type: "apiKey",
|
||||
apiKey: options.apiKey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default createOmniRouteProvider;
|
||||
20
@omniroute/opencode-provider/package.json
Normal file
20
@omniroute/opencode-provider/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@omniroute/opencode-provider",
|
||||
"version": "1.0.0",
|
||||
"description": "OpenCode provider plugin for OmniRoute AI Gateway",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"README.md"
|
||||
],
|
||||
"keywords": [
|
||||
"omniroute",
|
||||
"opencode",
|
||||
"provider"
|
||||
],
|
||||
"license": "MIT",
|
||||
"peerDependencies": {}
|
||||
}
|
||||
Reference in New Issue
Block a user