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:
oyi77
2026-05-14 07:38:01 +07:00
parent bf83aa55de
commit 2d601ea459
35 changed files with 3806 additions and 403 deletions

View File

@@ -0,0 +1,28 @@
import { NextResponse } from "next/server";
import { requireCliToolsAuth } from "@/lib/api/requireCliToolsAuth";
import { detectAllTools, detectTool } from "@/lib/cli-helper/tool-detector";
// GET /api/cli-tools/detect - Detect all installed CLI tools
export async function GET(request: Request) {
const authError = await requireCliToolsAuth(request);
if (authError) return authError;
const { searchParams } = new URL(request.url);
const toolId = searchParams.get("tool");
try {
if (toolId) {
const tool = await detectTool(toolId);
if (!tool) {
return NextResponse.json({ error: `Unknown tool: ${toolId}` }, { status: 400 });
}
return NextResponse.json(tool);
}
const tools = await detectAllTools();
return NextResponse.json({ tools });
} catch (error) {
console.log("Error detecting tools:", error);
return NextResponse.json({ error: "Failed to detect tools" }, { status: 500 });
}
}