mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-19 21:52:21 +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:
28
src/app/api/cli-tools/detect/route.ts
Normal file
28
src/app/api/cli-tools/detect/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user