feat: add bugpilot ai debugger kit.#153
Conversation
WalkthroughThis PR introduces the BugPilot Debugger kit, a complete AI-powered debugging assistant built on the Lamatic AgentKit. The kit integrates a Next.js frontend UI, a GraphQL-backed API route, an LLM-driven Lamatic workflow, and structured prompts to provide junior developers with root cause analysis, severity levels, step-by-step fixes, and corrected code examples for reported bugs. ChangesBugPilot Debugger Kit
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Validation ResultsNew Contributions Detected
Check Results
Errors
🛑 Please fix the errors above before this PR can be merged. Refer to CONTRIBUTING.md and CLAUDE.md for the expected folder structure. |
|
Hello @Amankumar259 Can you resolve the above? |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
❌ Errors
|
|
Failure recorded at 2026-06-03T15:28:45Z UTC. If this PR is not fixed within 4 weeks it will be automatically closed. |
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
Studio Runtime Validation (Phase 2)❌ Studio validation failed. The kit was rejected by Lamatic Studio. Errorsbugpilot-ai
Please fix the errors above and push a new commit to re-run validation. |
|
Hello @Amankumar259 |
There was a problem hiding this comment.
Actionable comments posted: 15
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/bugpilot-ai/apps/README.md (1)
1-37:⚠️ Potential issue | 🟠 Major | ⚡ Quick winMission directive: replace template README with operational runbook for this app.
This README is still generic create-next-app text and omits BugPilot-specific setup requirements (notably required env vars and concrete usage flow). Please document the same env keys and run/use steps the app actually requires.
As per coding guidelines, "
kits/**/README.md: Every kit must have aREADME.mdthat documents setup, environment variables, and usage."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/bugpilot-ai/apps/README.md` around lines 1 - 37, The README.md currently contains generic create-next-app boilerplate; replace it with a BugPilot operational runbook that lists concrete setup, required environment variables, and usage flow. Update README.md to (1) enumerate every env var the app actually reads (search the repo for process.env/ NEXT_PUBLIC_/ and any uses in app/page.tsx, next.config.js, API route files or server modules) and show example .env entries, (2) provide exact dev/build/start commands (npm/yarn/pnpm/bun) and the local URL (http://localhost:3000) and any port overrides, (3) document runtime behavior and user flow (how to invoke the app UI, any API endpoints or example curl/HTTP requests), and (4) include deployment notes and troubleshooting tips; ensure the runbook references the real symbols/files that require configuration (e.g., app/page.tsx, any API route filenames, next.config.js) so readers can map env keys to code.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/bugpilot-ai/apps/package.json`:
- Around line 17-24: Update the devDependencies in package.json to use exact
(pinned) versions instead of ranges: replace entries for "`@tailwindcss/postcss`",
"`@types/node`", "`@types/react`", "`@types/react-dom`", "eslint",
"eslint-config-next", "tailwindcss", and "typescript" from caret ranges (e.g.
"^4") to exact version strings (e.g. "4.0.0" or the exact tested patch versions
you want), ensuring every dependency is pinned and no ^ or ~ prefixes remain so
the kit has reproducible installs.
In `@kits/bugpilot-ai/apps/README.md`:
- Line 19: Update the README line that instructs where to edit the page: replace
the incorrect reference "app/page.tsx" with the correct path "src/app/page.tsx"
in the README content so the guidance matches this kit’s structure; locate the
exact markdown sentence containing "You can start editing the page by modifying
`app/page.tsx`." and change it to reference the corrected filename.
In `@kits/bugpilot-ai/apps/src/app/api/analyze/route.ts`:
- Line 50: Remove the debug console.log that prints the full Lamatic response
(console.log("LAMATIC RESPONSE:", data)); either delete this line or wrap it in
an environment check (e.g., only log when NODE_ENV === "development") and ensure
any logged payload is redacted to strip user-submitted code or sensitive fields
before output. Locate the console.log invocation in the analyze route handler
(the route.ts handler that processes Lamatic responses) and apply the change so
production logs never contain the raw provider/model payload.
- Around line 52-57: The handler currently returns HTTP 200 with raw GraphQL
provider error text when data?.errors?.length > 0; change this to return an
error status (e.g., NextResponse.json(..., { status: 502 })) and replace
data.errors[0].message in the client response with a sanitized, non‑leaking
message (e.g., "Upstream provider error" or "Temporary provider failure"). Keep
the original provider error for server-side logging (log data.errors) but do not
expose it in the response; update the branch that checks data?.errors to use
NextResponse.json with a 5xx status and the sanitized message.
- Around line 28-40: The handler currently uses
process.env.BUGPILOT_DEBUGGER_FLOW_ID, process.env.LAMATIC_API_URL!, and
process.env.LAMATIC_PROJECT_ID! without checks which can cause opaque runtime
failures; add an explicit guard at the start of the request handler (before
constructing the variables const and before the fetch call) that verifies
BUGPILOT_DEBUGGER_FLOW_ID, LAMATIC_API_URL, and LAMATIC_PROJECT_ID (and
optionally LAMATIC_API_KEY) are present, and if any are missing return a clear
500/configuration error response (with a descriptive message identifying the
missing env keys) instead of proceeding to build variables or calling fetch;
update any error handling around the fetch to avoid non-null assertions (remove
the ! usage) so callers reference the validated values.
- Around line 35-46: The Lamatic fetch call currently has no timeout and can
hang; modify the fetch invocation that posts to process.env.LAMATIC_API_URL to
include an AbortSignal created via AbortSignal.timeout(...) (or a configurable
timeout value) and pass it as the signal option to fetch so the request is
aborted after the timeout; ensure any Promise handling around the response (the
const response = await fetch(...) usage) properly catches the AbortError to
return a sensible error response.
In `@kits/bugpilot-ai/apps/src/app/layout.tsx`:
- Around line 15-18: Update the exported metadata object (metadata: Metadata) in
layout.tsx to replace the generic create-next-app title and description with
app-specific values for BugPilot AI; change title to something like "BugPilot
AI" (or preferred product name) and update description to a concise summary of
the app so browser tabs and search results reflect the project rather than the
boilerplate.
In `@kits/bugpilot-ai/apps/src/app/page.tsx`:
- Around line 34-38: The current substring check that mutates the response
string variable `output` (the block that looks for "503" or "high demand")
incorrectly overwrites legitimate user-facing analyses; remove this
content-based overload detection from where `output` is produced in page.tsx and
instead implement overload handling in the API route that calls the AI provider
(use the provider's status/HTTP status code or explicit error field returned by
the provider to detect overload). Update any UI to surface the API-provided
error state rather than rewriting `output`; reference the `output` variable and
the existing overload-checking block so you replace it with a pass-through of
the provider response and move the overload logic to the API handler that makes
the external request.
- Around line 11-45: handleAnalyze currently allows concurrent submissions; add
a boolean loading state (e.g., loading) and guard the function (return early if
loading) so repeated clicks do nothing while a request is in flight, set loading
= true before the fetch and ensure loading = false in a finally block after
response parsing/error handling, and wire the UI button to disabled={loading} so
the "Analyze Bug" button is visually/functional disabled while handleAnalyze
runs (update any calls to setResult remain unchanged).
In `@kits/bugpilot-ai/apps/tsconfig.json`:
- Line 5: The tsconfig currently permits JavaScript by setting "allowJs": true
which weakens the TypeScript-only policy; change the compiler option allowJs to
false in the tsconfig (look for the "allowJs" entry) so the TypeScript compiler
enforces TypeScript-only code for kit components and server actions.
In `@kits/bugpilot-ai/flows/bugpilot-debugger.ts`:
- Around line 4-16: The meta object currently has empty fields; populate
description, tags, githubUrl, documentationUrl, and deployUrl inside the
exported meta constant (the meta object) to mirror the values defined in
lamatic.config.ts so the flow is self-describing in Studio listings; if this
file is a direct Lamatic Studio export, open the flow in the Studio editor,
update those fields there and re-export rather than hand-editing to keep export
metadata consistent.
In `@kits/bugpilot-ai/lamatic.config.ts`:
- Around line 25-30: The links object in lamatic.config.ts currently has both
demo and deploy set to the same URL; open the links block and either update the
deploy property to the correct distinct deployment/clone target (if one exists)
or remove/replace the duplicate so demo and deploy are not identical—edit the
links { demo, deploy, github, docs } entry to point deploy to the intended
deployment URL or explicitly document that deploy intentionally matches demo.
In `@kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_system.md`:
- Around line 10-11: The line "Explain clearly for junior developers." is
currently indented as a sub-item of list item 6 and should be a top-level
directive; edit the prompt text in
kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_system.md to remove the
leading indentation so that the phrase "Explain clearly for junior developers."
is a standalone, top-level instruction (not part of "6. Prevention tips")—this
ensures the instruction applies globally to all six outputs rather than being
folded into item 6.
In `@kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_user.md`:
- Around line 1-5: The prompt's sixth-line directive "Provide:1. Root cause
analysis2. Simple explanation3. Severity level4. Step-by-step fix5. Corrected
code example6. Prevention tips" is jammed into one token; update the string in
kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_user.md by splitting that
single line into separate, clearly separated lines and adding a space after each
label/colon (e.g., "Provide:" on its own line followed by numbered lines "1.
Root cause analysis", "2. Simple explanation", etc.), and also add a space after
the colons on the first three template lines ("Programming Language: {{...}}",
"Error: {{...}}", "CodeSnippet: {{...}}") so the template variables are readable
and the structured-output contract is preserved.
In `@kits/bugpilot-ai/README.md`:
- Around line 163-166: Update the deployment root path string in the README:
replace the incorrect path "kits/bugpilot-debugger/apps" with the correct path
"kits/bugpilot-ai/apps" (where the README currently references the deployment
root), and scan the README for any other lingering references to
"bugpilot-debugger" to update them to "bugpilot-ai" so deployment setup points
to the correct kit.
---
Outside diff comments:
In `@kits/bugpilot-ai/apps/README.md`:
- Around line 1-37: The README.md currently contains generic create-next-app
boilerplate; replace it with a BugPilot operational runbook that lists concrete
setup, required environment variables, and usage flow. Update README.md to (1)
enumerate every env var the app actually reads (search the repo for process.env/
NEXT_PUBLIC_/ and any uses in app/page.tsx, next.config.js, API route files or
server modules) and show example .env entries, (2) provide exact dev/build/start
commands (npm/yarn/pnpm/bun) and the local URL (http://localhost:3000) and any
port overrides, (3) document runtime behavior and user flow (how to invoke the
app UI, any API endpoints or example curl/HTTP requests), and (4) include
deployment notes and troubleshooting tips; ensure the runbook references the
real symbols/files that require configuration (e.g., app/page.tsx, any API route
filenames, next.config.js) so readers can map env keys to code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 05c3418e-18b8-4a61-ba20-a923f6b7518f
⛔ Files ignored due to path filters (6)
kits/bugpilot-ai/apps/package-lock.jsonis excluded by!**/package-lock.jsonkits/bugpilot-ai/apps/public/file.svgis excluded by!**/*.svgkits/bugpilot-ai/apps/public/globe.svgis excluded by!**/*.svgkits/bugpilot-ai/apps/public/next.svgis excluded by!**/*.svgkits/bugpilot-ai/apps/public/vercel.svgis excluded by!**/*.svgkits/bugpilot-ai/apps/public/window.svgis excluded by!**/*.svg
📒 Files selected for processing (23)
kits/bugpilot-ai/.gitignorekits/bugpilot-ai/README.mdkits/bugpilot-ai/agent.mdkits/bugpilot-ai/apps/.gitignorekits/bugpilot-ai/apps/README.mdkits/bugpilot-ai/apps/eslint.config.mjskits/bugpilot-ai/apps/next.config.tskits/bugpilot-ai/apps/package.jsonkits/bugpilot-ai/apps/postcss.config.mjskits/bugpilot-ai/apps/src/app/api/analyze/route.tskits/bugpilot-ai/apps/src/app/globals.csskits/bugpilot-ai/apps/src/app/layout.tsxkits/bugpilot-ai/apps/src/app/page.tsxkits/bugpilot-ai/apps/tsconfig.jsonkits/bugpilot-ai/constitutions/default.mdkits/bugpilot-ai/flows/bugpilot-debugger.tskits/bugpilot-ai/lamatic.config.tskits/bugpilot-ai/model-configs/bugpilot-debugger_llmnode-801_generative-model-name.tskits/bugpilot-ai/model-configs/bugpilot-debugger_llmnode_generative-model.tskits/bugpilot-ai/prompts/bugpilot-debugger_llmnode-801_system_0.mdkits/bugpilot-ai/prompts/bugpilot-debugger_llmnode-801_user_1.mdkits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_system.mdkits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_user.md
| "@tailwindcss/postcss": "^4", | ||
| "@types/node": "^20", | ||
| "@types/react": "^19", | ||
| "@types/react-dom": "^19", | ||
| "eslint": "^9", | ||
| "eslint-config-next": "16.2.5", | ||
| "tailwindcss": "^4", | ||
| "typescript": "^5" |
There was a problem hiding this comment.
Mission-critical: pin all dependency versions exactly.
devDependencies currently use ranged versions (^), which breaks the kit rule requiring pinned versions and weakens reproducibility.
As per coding guidelines, “Each kit must have its own package.json with pinned dependency versions; do not rely on workspace-level hoisting or a root package.json”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/apps/package.json` around lines 17 - 24, Update the
devDependencies in package.json to use exact (pinned) versions instead of
ranges: replace entries for "`@tailwindcss/postcss`", "`@types/node`",
"`@types/react`", "`@types/react-dom`", "eslint", "eslint-config-next",
"tailwindcss", and "typescript" from caret ranges (e.g. "^4") to exact version
strings (e.g. "4.0.0" or the exact tested patch versions you want), ensuring
every dependency is pinned and no ^ or ~ prefixes remain so the kit has
reproducible installs.
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
|
||
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
There was a problem hiding this comment.
Mission correction: edit path is inaccurate for this repo layout.
The file to edit is under src/app/page.tsx, not app/page.tsx, based on this kit’s structure.
Proposed fix
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
+ You can start editing the page by modifying `src/app/page.tsx`. The page auto-updates as you edit the file.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | |
| You can start editing the page by modifying `src/app/page.tsx`. The page auto-updates as you edit the file. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/apps/README.md` at line 19, Update the README line that
instructs where to edit the page: replace the incorrect reference "app/page.tsx"
with the correct path "src/app/page.tsx" in the README content so the guidance
matches this kit’s structure; locate the exact markdown sentence containing "You
can start editing the page by modifying `app/page.tsx`." and change it to
reference the corrected filename.
| const variables = { | ||
| workflowId: process.env.BUGPILOT_DEBUGGER_FLOW_ID, | ||
| language: body.language, | ||
| error: body.error, | ||
| codeSnippet: body.codeSnippet, | ||
| }; | ||
|
|
||
| const response = await fetch(process.env.LAMATIC_API_URL!, { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`, | ||
| "Content-Type": "application/json", | ||
| "x-project-id": process.env.LAMATIC_PROJECT_ID!, |
There was a problem hiding this comment.
Validate your mission credentials before deployment, agent.
Three required env values are consumed without validation:
BUGPILOT_DEBUGGER_FLOW_ID(Line 29) feeds the GraphQL$workflowId: String!— if unset, the workflow fails with an opaque GraphQL error.LAMATIC_API_URL!(Line 35) — a non-null assertion that throwsfetch(undefined)at runtime if missing, surfacing only as the generic 500.LAMATIC_PROJECT_ID!(Line 40) — same hazard.
Add an explicit guard at the top of the handler returning a clear 500/config error so misconfiguration is diagnosable rather than masked by the catch-all.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/apps/src/app/api/analyze/route.ts` around lines 28 - 40, The
handler currently uses process.env.BUGPILOT_DEBUGGER_FLOW_ID,
process.env.LAMATIC_API_URL!, and process.env.LAMATIC_PROJECT_ID! without checks
which can cause opaque runtime failures; add an explicit guard at the start of
the request handler (before constructing the variables const and before the
fetch call) that verifies BUGPILOT_DEBUGGER_FLOW_ID, LAMATIC_API_URL, and
LAMATIC_PROJECT_ID (and optionally LAMATIC_API_KEY) are present, and if any are
missing return a clear 500/configuration error response (with a descriptive
message identifying the missing env keys) instead of proceeding to build
variables or calling fetch; update any error handling around the fetch to avoid
non-null assertions (remove the ! usage) so callers reference the validated
values.
| const response = await fetch(process.env.LAMATIC_API_URL!, { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`, | ||
| "Content-Type": "application/json", | ||
| "x-project-id": process.env.LAMATIC_PROJECT_ID!, | ||
| }, | ||
| body: JSON.stringify({ | ||
| query, | ||
| variables, | ||
| }), | ||
| }); |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Is AbortSignal.timeout supported in the Node.js runtime used by Next.js route handlers?
💡 Result:
Yes, AbortSignal.timeout is supported in the Node.js runtime [1]. It was added to Node.js in versions 17.3.0 and 16.14.0 [1][2][3]. Regarding its availability within Next.js, support depends on the specific runtime being used: 1. Node.js Runtime: When using the standard Node.js runtime for App Router or Pages API routes, AbortSignal.timeout is available because it is a built-in feature of the underlying Node.js environment [1]. 2. Edge Runtime: Historically, the Edge Runtime in Next.js used a polyfill for AbortController/AbortSignal that lacked support for certain modern spec features, including AbortSignal.timeout [4]. However, updates to the Vercel Edge Runtime have aimed to improve compliance with web standards [4]. If you are using a modern version of Next.js, it is highly likely to be supported, but if you encounter issues in the Edge runtime specifically, it may be due to the version of the edge-runtime primitives being used [4]. If you are developing in a Node.js environment, you can reliably use AbortSignal.timeout to create signals that automatically abort after a specified delay [1][5].
Citations:
- 1: https://nodejs.org/api/globals.html
- 2: https://nodejs.org/download/nightly/v21.0.0-nightly202305318aa02e81d0/docs/api/globals.html
- 3: https://nodejs.org/download/test/v22.0.0-test20240217edef3683ce/docs/api/globals.html
- 4: AbortSignal override is not following the spec vercel/next.js#38658
- 5: nodejs/node@157753bf26
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="kits/bugpilot-ai/apps/src/app/api/analyze/route.ts"
if [ ! -f "$FILE" ]; then
echo "Missing file: $FILE" >&2
exit 1
fi
nl -ba "$FILE" | sed -n '1,140p'Repository: Lamatic/AgentKit
Length of output: 103
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="kits/bugpilot-ai/apps/src/app/api/analyze/route.ts"
if [ ! -f "$FILE" ]; then
echo "Missing file: $FILE" >&2
exit 1
fi
nl -ba "$FILE" | sed -n '1,140p'Repository: Lamatic/AgentKit
Length of output: 103
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="kits/bugpilot-ai/apps/src/app/api/analyze/route.ts"
echo "=== File header (1-120) ==="
sed -n '1,120p' "$FILE"
echo "=== Search in file ==="
rg -n "export const runtime|AbortSignal|fetch\\(|LAMATIC" "$FILE"Repository: Lamatic/AgentKit
Length of output: 2720
Add a hard timeout to the Lamatic fetch call (mission: don’t let it hang forever).
fetch(process.env.LAMATIC_API_URL!, ...) has no AbortSignal/timeout, so if the provider stalls the route can tie up a request indefinitely. Node.js supports AbortSignal.timeout(...), so bind one here; if this endpoint is ever switched to an Edge runtime, re-check runtime support.
🎯 Suggested fix
const response = await fetch(process.env.LAMATIC_API_URL!, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`,
"Content-Type": "application/json",
"x-project-id": process.env.LAMATIC_PROJECT_ID!,
},
body: JSON.stringify({
query,
variables,
}),
+ signal: AbortSignal.timeout(30000),
});🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/apps/src/app/api/analyze/route.ts` around lines 35 - 46, The
Lamatic fetch call currently has no timeout and can hang; modify the fetch
invocation that posts to process.env.LAMATIC_API_URL to include an AbortSignal
created via AbortSignal.timeout(...) (or a configurable timeout value) and pass
it as the signal option to fetch so the request is aborted after the timeout;
ensure any Promise handling around the response (the const response = await
fetch(...) usage) properly catches the AbortError to return a sensible error
response.
|
|
||
| const data = await response.json(); | ||
|
|
||
| console.log("LAMATIC RESPONSE:", data); |
There was a problem hiding this comment.
Burn this evidence, agent — the full provider payload is being logged.
console.log("LAMATIC RESPONSE:", data) dumps the entire Lamatic response — including raw model output that may echo user-submitted code and error text — into server logs. This is a debug artifact and a privacy/compliance risk. Remove it or gate it behind a development-only flag with redaction.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/apps/src/app/api/analyze/route.ts` at line 50, Remove the
debug console.log that prints the full Lamatic response (console.log("LAMATIC
RESPONSE:", data)); either delete this line or wrap it in an environment check
(e.g., only log when NODE_ENV === "development") and ensure any logged payload
is redacted to strip user-submitted code or sensitive fields before output.
Locate the console.log invocation in the analyze route handler (the route.ts
handler that processes Lamatic responses) and apply the change so production
logs never contain the raw provider/model payload.
| export const meta = { | ||
| name: "bugpilot-debugger", | ||
| description: "", | ||
| tags: [], | ||
| testInput: null, | ||
| githubUrl: "", | ||
| documentationUrl: "", | ||
| deployUrl: "", | ||
| author: { | ||
| name: "Aman Kumar", | ||
| email: "amankrit61@gmail.com", | ||
| }, | ||
| }; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Metadata left in the dead-drop empty.
description, tags, githubUrl, documentationUrl, and deployUrl are all blank here, even though lamatic.config.ts already carries a solid description, tag list, and links. Mirroring those into meta keeps the flow self-describing in Studio listings. Cosmetic, but cheap to fix.
Note: if this file is a verbatim Lamatic Studio export, apply the fix in the editor and re-export rather than hand-patching.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/flows/bugpilot-debugger.ts` around lines 4 - 16, The meta
object currently has empty fields; populate description, tags, githubUrl,
documentationUrl, and deployUrl inside the exported meta constant (the meta
object) to mirror the values defined in lamatic.config.ts so the flow is
self-describing in Studio listings; if this file is a direct Lamatic Studio
export, open the flow in the Studio editor, update those fields there and
re-export rather than hand-editing to keep export metadata consistent.
| links: { | ||
| demo: "https://agent-kit-ashy.vercel.app/", | ||
| github: "https://github.com/Lamatic/AgentKit/tree/main/kits/bugpilot-ai", | ||
| deploy: "https://agent-kit-ashy.vercel.app/", | ||
| docs: "https://lamatic.ai/docs/workflows", | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
demo and deploy resolve to the same URL. Both point to https://agent-kit-ashy.vercel.app/. Likely intentional, but if a distinct deploy/clone target exists, point deploy there. Otherwise, dismiss.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/lamatic.config.ts` around lines 25 - 30, The links object in
lamatic.config.ts currently has both demo and deploy set to the same URL; open
the links block and either update the deploy property to the correct distinct
deployment/clone target (if one exists) or remove/replace the duplicate so demo
and deploy are not identical—edit the links { demo, deploy, github, docs } entry
to point deploy to the intended deployment URL or explicitly document that
deploy intentionally matches demo.
| 6. Prevention tips | ||
| Explain clearly for junior developers. |
There was a problem hiding this comment.
Line 11 reads as a sub-item of "Prevention tips," not a standalone directive.
The leading indentation folds Explain clearly for junior developers. into list item 6, so the model may treat it as part of prevention tips rather than a global instruction governing all six outputs. De-indent it to a top-level line.
🛠️ Proposed tweak
6. Prevention tips
- Explain clearly for junior developers.
+
+Explain clearly for junior developers.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 6. Prevention tips | |
| Explain clearly for junior developers. | |
| 6. Prevention tips | |
| Explain clearly for junior developers. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_system.md` around lines 10
- 11, The line "Explain clearly for junior developers." is currently indented as
a sub-item of list item 6 and should be a top-level directive; edit the prompt
text in kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_system.md to remove
the leading indentation so that the phrase "Explain clearly for junior
developers." is a standalone, top-level instruction (not part of "6. Prevention
tips")—this ensures the instruction applies globally to all six outputs rather
than being folded into item 6.
| Programming Language:{{triggerNode_1.output.language}} | ||
| Error:{{triggerNode_1.output.error}} | ||
| CodeSnippet:{{triggerNode_1.output.codeSnippet}} | ||
| Analyze and debug this issue. | ||
| Provide:1. Root cause analysis2. Simple explanation3. Severity level4. Step-by-step fix5. Corrected code example6. Prevention tips |
There was a problem hiding this comment.
The six-item directive is jammed into one unbroken string — re-establish clear comms.
Line 5 reads Provide:1. Root cause analysis2. Simple explanation3. ... with no separators. The model can usually decode it, but explicit line breaks make the structured-output contract far more reliable and match what README.md advertises. Also worth a space after each label on lines 1-3 for legibility.
🛰️ Proposed reformat
-Programming Language:{{triggerNode_1.output.language}}
-Error:{{triggerNode_1.output.error}}
-CodeSnippet:{{triggerNode_1.output.codeSnippet}}
-Analyze and debug this issue.
-Provide:1. Root cause analysis2. Simple explanation3. Severity level4. Step-by-step fix5. Corrected code example6. Prevention tips
+Programming Language: {{triggerNode_1.output.language}}
+Error: {{triggerNode_1.output.error}}
+Code Snippet: {{triggerNode_1.output.codeSnippet}}
+
+Analyze and debug this issue. Provide:
+1. Root cause analysis
+2. Simple explanation
+3. Severity level
+4. Step-by-step fix
+5. Corrected code example
+6. Prevention tipsNote: if this prompt is maintained via Lamatic Studio export, apply the change in the editor and re-export.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Programming Language:{{triggerNode_1.output.language}} | |
| Error:{{triggerNode_1.output.error}} | |
| CodeSnippet:{{triggerNode_1.output.codeSnippet}} | |
| Analyze and debug this issue. | |
| Provide:1. Root cause analysis2. Simple explanation3. Severity level4. Step-by-step fix5. Corrected code example6. Prevention tips | |
| Programming Language: {{triggerNode_1.output.language}} | |
| Error: {{triggerNode_1.output.error}} | |
| Code Snippet: {{triggerNode_1.output.codeSnippet}} | |
| Analyze and debug this issue. Provide: | |
| 1. Root cause analysis | |
| 2. Simple explanation | |
| 3. Severity level | |
| 4. Step-by-step fix | |
| 5. Corrected code example | |
| 6. Prevention tips |
🧰 Tools
🪛 LanguageTool
[grammar] ~5-~5: Ensure spelling is correct
Context: ...debug this issue. Provide:1. Root cause analysis2. Simple explanation3. Severity level4. ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~5-~5: Ensure spelling is correct
Context: ...Provide:1. Root cause analysis2. Simple explanation3. Severity level4. Step-by-step fix5. Co...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~5-~5: Ensure spelling is correct
Context: ...nalysis2. Simple explanation3. Severity level4. Step-by-step fix5. Corrected code exam...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~5-~5: Ensure spelling is correct
Context: ...anation3. Severity level4. Step-by-step fix5. Corrected code example6. Prevention ti...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~5-~5: Ensure spelling is correct
Context: ...vel4. Step-by-step fix5. Corrected code example6. Prevention tips
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🪛 markdownlint-cli2 (0.22.1)
[warning] 1-1: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_user.md` around lines 1 -
5, The prompt's sixth-line directive "Provide:1. Root cause analysis2. Simple
explanation3. Severity level4. Step-by-step fix5. Corrected code example6.
Prevention tips" is jammed into one token; update the string in
kits/bugpilot-ai/prompts/bugpilot-debugger_llmnode_user.md by splitting that
single line into separate, clearly separated lines and adding a space after each
label/colon (e.g., "Provide:" on its own line followed by numbered lines "1.
Root cause analysis", "2. Simple explanation", etc.), and also add a space after
the colons on the first three template lines ("Programming Language: {{...}}",
"Error: {{...}}", "CodeSnippet: {{...}}") so the template variables are readable
and the structured-output contract is preserved.
| Root directory: | ||
|
|
||
| kits/bugpilot-debugger/apps | ||
| Lamatic Workflow |
There was a problem hiding this comment.
Mission-critical docs drift: deployment root path points to the wrong kit.
kits/bugpilot-debugger/apps does not match this kit’s actual path (kits/bugpilot-ai/apps). This will misroute deploy setup.
Proposed fix
- kits/bugpilot-debugger/apps
+ kits/bugpilot-ai/apps📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Root directory: | |
| kits/bugpilot-debugger/apps | |
| Lamatic Workflow | |
| Root directory: | |
| kits/bugpilot-ai/apps | |
| Lamatic Workflow |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/bugpilot-ai/README.md` around lines 163 - 166, Update the deployment
root path string in the README: replace the incorrect path
"kits/bugpilot-debugger/apps" with the correct path "kits/bugpilot-ai/apps"
(where the README currently references the deployment root), and scan the README
for any other lingering references to "bugpilot-debugger" to update them to
"bugpilot-ai" so deployment setup points to the correct kit.
|
@Amankumar259 please fix the coderabbit issues and you will also need to add apps/.env.example to the kit |
|
Hi @Amankumar259! 👋 Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review. Steps to follow:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
BugPilot Debugger
BugPilot Debugger is an AI-powered debugging assistant built using Lamatic AgentKit and Next.js.
The project helps developers analyze runtime errors and code issues by generating:
Features
Tech Stack
Workflow
Frontend → Next.js API Route → Lamatic GraphQL API → AI Model → Frontend Response
This project was built as part of the Lamatic AgentKit Challenge.
Files Added
Configuration & Documentation:
.gitignore- Ignores development artifacts (.lamatic/,node_modules/,.env,.env.local)README.md- BugPilot Debugger documentation with project structure, setup, and usage examplesagent.md- AI agent specification describing input/output payload and workflowlamatic.config.ts- Kit configuration with metadata, mandatory step mappings, and external linksNext.js Frontend Application (
apps/):package.json- Dependencies: Next.js 16.2.5, React 19.2.4, Tailwind CSS, TypeScriptnext.config.ts- Next.js configuration exporttsconfig.json- TypeScript compiler settings with strict mode and Next.js plugineslint.config.mjs- ESLint configuration extendingeslint-config-nextpostcss.config.mjs- PostCSS configuration with Tailwind CSS pluginapps/.gitignore- Node.js, Next.js, and build artifact ignoresapps/README.md- Standard create-next-app documentationsrc/app/layout.tsx- Root layout with Geist fonts and global CSS importsrc/app/page.tsx- Home page client component with bug analysis UI (language, error, code inputs) and/api/analyzeintegrationsrc/app/globals.css- Tailwind CSS and theme variable definitionssrc/app/api/analyze/route.ts- POST endpoint that calls Lamatic GraphQLexecuteWorkflow, handles errors, and returns normalized analysis resultsLamatic Workflow Components:
flows/bugpilot-debugger.ts- Flow definition with 3-node orchestrationconstitutions/default.md- Assistant behavior guidelines (identity, safety, data handling, tone)prompts/bugpilot-debugger_llmnode_system.md- System prompt instructing structured debugging outputprompts/bugpilot-debugger_llmnode_user.md- User prompt template pulling language, error, and code from trigger inputprompts/bugpilot-debugger_llmnode-801_system_0.md- Alternative system prompt variantprompts/bugpilot-debugger_llmnode-801_user_1.md- Alternative user prompt variantmodel-configs/bugpilot-debugger_llmnode_generative-model.ts- LLM configuration (Groq Llama-3.3-70b-versatile)model-configs/bugpilot-debugger_llmnode-801_generative-model-name.ts- Alternative model config variantFlow Architecture
Node Types & Flow:
language,error,codeSnippet{ result: "<generated response>" }with JSON content-type headerHow It Works:
/api/analyzewhich invokes Lamatic GraphQL workflowAI Model: Groq Llama-3.3-70b-versatile (with fallback Gemini option in model configs)