Added 20+ lang support
Browse filesX-Lovable-Edit-ID: edt-77b99ba9-cd4d-467a-8d3a-88a8596e55fe
src/routeTree.gen.ts
CHANGED
|
@@ -258,12 +258,3 @@ const rootRouteChildren: RootRouteChildren = {
|
|
| 258 |
export const routeTree = rootRouteImport
|
| 259 |
._addFileChildren(rootRouteChildren)
|
| 260 |
._addFileTypes<FileRouteTypes>()
|
| 261 |
-
|
| 262 |
-
import type { getRouter } from './router.tsx'
|
| 263 |
-
import type { createStart } from '@tanstack/react-start'
|
| 264 |
-
declare module '@tanstack/react-start' {
|
| 265 |
-
interface Register {
|
| 266 |
-
ssr: true
|
| 267 |
-
router: Awaited<ReturnType<typeof getRouter>>
|
| 268 |
-
}
|
| 269 |
-
}
|
|
|
|
| 258 |
export const routeTree = rootRouteImport
|
| 259 |
._addFileChildren(rootRouteChildren)
|
| 260 |
._addFileTypes<FileRouteTypes>()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/routes/dashboard.branch-debug.tsx
CHANGED
|
@@ -19,11 +19,26 @@ type Zone = "user" | "server" | "ai";
|
|
| 19 |
const LANGUAGES = [
|
| 20 |
{ id: "auto", label: "Auto-detect language" },
|
| 21 |
{ id: "python", label: "Python" },
|
| 22 |
-
{ id: "cpp", label: "C / C++" },
|
| 23 |
{ id: "typescript", label: "TypeScript / JS" },
|
| 24 |
-
{ id: "
|
| 25 |
-
{ id: "
|
| 26 |
{ id: "java", label: "Java" },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
];
|
| 28 |
|
| 29 |
function detectInputType(text: string): "diff" | "snippet" | "unknown" {
|
|
|
|
| 19 |
const LANGUAGES = [
|
| 20 |
{ id: "auto", label: "Auto-detect language" },
|
| 21 |
{ id: "python", label: "Python" },
|
|
|
|
| 22 |
{ id: "typescript", label: "TypeScript / JS" },
|
| 23 |
+
{ id: "cpp", label: "C / C++" },
|
| 24 |
+
{ id: "csharp", label: "C#" },
|
| 25 |
{ id: "java", label: "Java" },
|
| 26 |
+
{ id: "kotlin", label: "Kotlin" },
|
| 27 |
+
{ id: "swift", label: "Swift" },
|
| 28 |
+
{ id: "go", label: "Go" },
|
| 29 |
+
{ id: "rust", label: "Rust" },
|
| 30 |
+
{ id: "ruby", label: "Ruby" },
|
| 31 |
+
{ id: "php", label: "PHP" },
|
| 32 |
+
{ id: "scala", label: "Scala" },
|
| 33 |
+
{ id: "elixir", label: "Elixir" },
|
| 34 |
+
{ id: "haskell", label: "Haskell" },
|
| 35 |
+
{ id: "lua", label: "Lua" },
|
| 36 |
+
{ id: "r", label: "R" },
|
| 37 |
+
{ id: "dart", label: "Dart" },
|
| 38 |
+
{ id: "sql", label: "SQL" },
|
| 39 |
+
{ id: "bash", label: "Bash / Shell" },
|
| 40 |
+
{ id: "html", label: "HTML / CSS" },
|
| 41 |
+
{ id: "yaml", label: "YAML / JSON / TOML" },
|
| 42 |
];
|
| 43 |
|
| 44 |
function detectInputType(text: string): "diff" | "snippet" | "unknown" {
|
src/server/branch-debug.functions.ts
CHANGED
|
@@ -267,7 +267,7 @@ export async function analyzeDiff(diff: string, failureDescription: string): Pro
|
|
| 267 |
method: "POST",
|
| 268 |
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
| 269 |
body: JSON.stringify({
|
| 270 |
-
model: "google/gemini-2.5-
|
| 271 |
messages: [
|
| 272 |
{ role: "system", content: SYSTEM_PROMPT },
|
| 273 |
{ role: "user", content: userContent },
|
|
@@ -372,9 +372,24 @@ const snippetTool = {
|
|
| 372 |
},
|
| 373 |
};
|
| 374 |
|
| 375 |
-
const SNIPPET_SYSTEM = `You are BranchDebug in SNIPPET mode
|
| 376 |
-
|
| 377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
|
| 379 |
export async function analyzeSnippet(
|
| 380 |
snippet: string,
|
|
@@ -393,7 +408,7 @@ export async function analyzeSnippet(
|
|
| 393 |
method: "POST",
|
| 394 |
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
| 395 |
body: JSON.stringify({
|
| 396 |
-
model: "google/gemini-2.5-
|
| 397 |
messages: [
|
| 398 |
{ role: "system", content: SNIPPET_SYSTEM },
|
| 399 |
{ role: "user", content: userContent },
|
|
|
|
| 267 |
method: "POST",
|
| 268 |
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
| 269 |
body: JSON.stringify({
|
| 270 |
+
model: "google/gemini-2.5-pro",
|
| 271 |
messages: [
|
| 272 |
{ role: "system", content: SYSTEM_PROMPT },
|
| 273 |
{ role: "user", content: userContent },
|
|
|
|
| 372 |
},
|
| 373 |
};
|
| 374 |
|
| 375 |
+
const SNIPPET_SYSTEM = `You are BranchDebug in SNIPPET mode — an expert code reviewer with deep knowledge of every mainstream programming language (Python, TypeScript/JavaScript, C/C++, C#, Java, Kotlin, Swift, Go, Rust, Ruby, PHP, Scala, Elixir, Haskell, Lua, R, Dart, SQL, Bash, HTML/CSS, YAML/JSON/TOML, and more).
|
| 376 |
+
|
| 377 |
+
The user pasted a raw code snippet (not a diff). Identifiers are tokenized as fn_NNNN; treat them as opaque names. Carefully analyze the snippet and find ANY of the following classes of bugs that match the failure description (or are obvious defects, even if not described):
|
| 378 |
+
|
| 379 |
+
• Syntax errors (missing colons, brackets, semicolons, quotes, indentation)
|
| 380 |
+
• Type errors / wrong argument count / missing or extra parameters
|
| 381 |
+
• Off-by-one errors, bad thresholds, wrong comparison operators
|
| 382 |
+
• Null / undefined / None / nil dereferences
|
| 383 |
+
• Uninitialized variables, scope/closure mistakes, shadowing
|
| 384 |
+
• Logic errors, wrong control flow, unreachable code, infinite loops
|
| 385 |
+
• Race conditions, async/await misuse, unhandled promise rejections
|
| 386 |
+
• Resource leaks (unclosed files, connections, listeners)
|
| 387 |
+
• Security issues (SQL injection, XSS, path traversal, weak crypto, secrets)
|
| 388 |
+
• Performance pitfalls (N+1 queries, quadratic loops on large input)
|
| 389 |
+
• API misuse, deprecated calls, framework-specific anti-patterns
|
| 390 |
+
• Incorrect return values, missing return statements
|
| 391 |
+
|
| 392 |
+
For EACH defect you find, return one suspect with the 1-based line number from the snippet, a confidence rating, and a clear cause-and-effect mechanism. Be thorough but precise — return multiple suspects when there are multiple bugs (e.g. a syntax error AND a wrong argument count). Only mark "high" when the mechanism directly explains the failure or is an obvious defect. Always call submit_snippet_analysis.`;
|
| 393 |
|
| 394 |
export async function analyzeSnippet(
|
| 395 |
snippet: string,
|
|
|
|
| 408 |
method: "POST",
|
| 409 |
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
| 410 |
body: JSON.stringify({
|
| 411 |
+
model: "google/gemini-2.5-pro",
|
| 412 |
messages: [
|
| 413 |
{ role: "system", content: SNIPPET_SYSTEM },
|
| 414 |
{ role: "user", content: userContent },
|