feat: Add code-review-agent AgentKit#84
Conversation
WalkthroughAdds a new "Code Review Agent" kit: a Next.js app, Lamatic flow definitions, backend orchestration and API route, Lamatic client and utilities, UI and layout, configuration files, and documentation for AI-powered GitHub PR reviews. (New files only.) Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 13
🧹 Nitpick comments (4)
kits/agentic/code-review/flows/code-review-agent/meta.json (1)
3-8: Populate flow metadata instead of leaving placeholders empty.Line 3 through Line 8 are empty, which makes the flow harder to discover, test, and document in tooling. Fill at least
description,testInput, and URLs with starter values.kits/agentic/code-review/config.json (1)
4-4: Trim the accidental leading space in thetagsentry.Line 4 has
" Security"(leading whitespace), which can fragment filtering/grouping logic.kits/agentic/code-review/app/api/review/route.ts (1)
46-65: Hardcoded endpoint, project ID, and workflow ID reduce portability.The Lamatic endpoint URL,
x-project-id, andworkflowIdare hardcoded. This ties the kit to a specific Lamatic deployment and makes it difficult for users to deploy with their own flows.Consider moving these to environment variables for configurability:
♻️ Proposed refactor to use environment variables
+ const endpoint = process.env.LAMATIC_API_URL + const projectId = process.env.LAMATIC_PROJECT_ID + const workflowId = process.env.LAMATIC_WORKFLOW_ID + + if (!endpoint || !projectId || !workflowId) { + return NextResponse.json( + { error: "Lamatic configuration is incomplete. Check LAMATIC_API_URL, LAMATIC_PROJECT_ID, and LAMATIC_WORKFLOW_ID." }, + { status: 500 } + ) + } + const res = await fetch( - "https://soumiksorganization573-codereviewagent135.lamatic.dev/graphql", + endpoint, { method: "POST", headers: { Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`, "Content-Type": "application/json", - "x-project-id": "4da47f5c-f38d-4519-89b3-82feda6e81ab", + "x-project-id": projectId, }, body: JSON.stringify({ query, variables: { - workflowId: "597871bb-6b0b-4cef-9771-05514dee60cd", + workflowId, owner, repo, pr_number, }, }), } )kits/agentic/code-review/app/page.tsx (1)
237-557: Consider extracting styles to a separate CSS module for maintainability.The inline
<style jsx global>block is ~320 lines. While this works and keeps the component self-contained (useful for a starter kit), extracting to a CSS module or external stylesheet would improve maintainability and enable better IDE support.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 73fbb584-cec6-40f6-a247-87f652e6d7b7
⛔ Files ignored due to path filters (4)
kits/agentic/code-review/.next-dev-3001.err.logis excluded by!**/*.logkits/agentic/code-review/.next-dev-3001.logis excluded by!**/*.logkits/agentic/code-review/image.pngis excluded by!**/*.pngkits/agentic/code-review/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (21)
kits/agentic/code-review/.env.examplekits/agentic/code-review/.gitignorekits/agentic/code-review/README.mdkits/agentic/code-review/actions/orchestrate.tskits/agentic/code-review/app/api/review/route.tskits/agentic/code-review/app/globals.csskits/agentic/code-review/app/layout.tsxkits/agentic/code-review/app/page.tsxkits/agentic/code-review/components.jsonkits/agentic/code-review/config.jsonkits/agentic/code-review/flows/README.mdkits/agentic/code-review/flows/code-review-agent/README.mdkits/agentic/code-review/flows/code-review-agent/config.jsonkits/agentic/code-review/flows/code-review-agent/inputs.jsonkits/agentic/code-review/flows/code-review-agent/meta.jsonkits/agentic/code-review/flows/config.jsonkits/agentic/code-review/lib/lamatic-client.tskits/agentic/code-review/lib/utils.tskits/agentic/code-review/next.config.mjskits/agentic/code-review/package.jsonkits/agentic/code-review/tsconfig.json
| "use server" | ||
|
|
||
| import { lamaticClient } from "@/lib/lamatic-client" | ||
| import {config} from "../orchestrate.js" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if orchestrate.js exists in the code-review kit
fd -t f 'orchestrate' kits/agentic/code-review/
# Check if generateContent is imported/used anywhere
rg -n 'generateContent' kits/agentic/code-review/ --type ts --type tsxRepository: Lamatic/AgentKit
Length of output: 152
🏁 Script executed:
cat -n kits/agentic/code-review/actions/orchestrate.tsRepository: Lamatic/AgentKit
Length of output: 3086
🏁 Script executed:
rg -n 'generateContent' kits/agentic/code-review/ --type tsRepository: Lamatic/AgentKit
Length of output: 148
🏁 Script executed:
ls -la kits/agentic/code-review/ | grep -E 'orchestrate|\.js|\.ts'Repository: Lamatic/AgentKit
Length of output: 387
🏁 Script executed:
# List all files in the code-review directory to see the structure
fd -t f . kits/agentic/code-review/ | head -30Repository: Lamatic/AgentKit
Length of output: 993
Fix broken import: ../orchestrate.js does not exist.
Line 4 imports config from ../orchestrate.js, but this file does not exist in the kits/agentic/code-review/ directory. This will cause a runtime error when the module loads. Either create the missing orchestrate.js file or correct the import path.
Additionally, the generateContent function exported from this module is unused—it's never imported elsewhere in the codebase, suggesting this file may be incomplete or orphaned.
|
Kindly resolve all the pending issues first. |
|
Kindl resolve all code rabbit comments |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@kits/agentic/code-review/.env.example`:
- Around line 1-4: The .env.example uses quoted placeholder values that trigger
dotenv-linter QuoteCharacter warnings; edit the AGENTIC_GENERATE_CONTENT,
LAMATIC_API_KEY, LAMATIC_API_URL, and LAMATIC_PROJECT_ID entries to remove the
surrounding quotes and any spaces in the placeholder values so they are plain,
unquoted tokens (e.g., AGENTIC_GENERATE_CONTENT=AGENTIC_GENERATE_CONTENT) to
satisfy the linter and dotenv parsing.
🪄 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: 686f6396-2dac-4d52-9d44-676faca425ee
📒 Files selected for processing (2)
kits/agentic/code-review/.env.examplekits/agentic/code-review/.gitignore
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment out error check for AGENTIC_GENERATE_CONTENT.
Removed the steps configuration for the code review agent.
|
@amanintech Rest of the changes asked in this review i didn't even touched , those were present even in sample |
There was a problem hiding this comment.
Actionable comments posted: 9
♻️ Duplicate comments (3)
kits/agentic/code-review/actions/orchestrate.ts (1)
4-4:⚠️ Potential issue | 🔴 CriticalAgent, this import references a ghost asset.
The import
{config} from "../orchestrate.js"targets a file that does not exist in the kit directory. This will cause immediate module load failure.This is the same issue flagged in
lib/lamatic-client.ts. Both files import from a non-existentorchestrate.js.#!/bin/bash # Verify orchestrate.js does not exist echo "=== Searching for orchestrate.js in code-review kit ===" fd -t f 'orchestrate' kits/agentic/code-review/ echo "=== List all JS files in the kit ===" fd -e js kits/agentic/code-review/🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@kits/agentic/code-review/actions/orchestrate.ts` at line 4, The import statement "import {config} from \"../orchestrate.js\"" in kits/agentic/code-review/actions/orchestrate.ts points to a missing module (same problem exists in lib/lamatic-client.ts); fix by either (A) creating a module named orchestrate.js that exports the config symbol so the import resolves, or (B) change the import to reference the actual existing module that provides config (e.g., the correct config module or index that currently holds the config export) and update both occurrences (the import in orchestrate.ts and in lib/lamatic-client.ts) to the correct path so the config symbol resolves at runtime.kits/agentic/code-review/README.md (1)
47-51:⚠️ Potential issue | 🟠 MajorAgent, the mission briefing is incomplete.
The Environment Variables section promises a
.envfile specification but delivers nothing — the variable table is missing. This will leave field operatives stranded without proper configuration intel.Based on the codebase requirements, the following variables must be documented:
LAMATIC_API_URL- Your Lamatic API endpoint URLLAMATIC_PROJECT_ID- Your Lamatic project IDLAMATIC_API_KEY- Your Lamatic project API keyAGENTIC_GENERATE_CONTENT- Workflow ID for the code review agent flow📋 Complete the environment variables table
## Environment Variables Create a `.env` file in the kit root: +| Variable | Description | +|---|---| +| `LAMATIC_API_URL` | Your Lamatic API endpoint URL | +| `LAMATIC_PROJECT_ID` | Your Lamatic project ID | +| `LAMATIC_API_KEY` | Your Lamatic project API key from Settings → API Keys | +| `AGENTIC_GENERATE_CONTENT` | Workflow ID for the code review agent flow | + ---🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@kits/agentic/code-review/README.md` around lines 47 - 51, Add the missing environment variables table to the "Environment Variables" section of kits/agentic/code-review/README.md: document LAMATIC_API_URL (Lamatic API endpoint URL), LAMATIC_PROJECT_ID (Lamatic project ID), LAMATIC_API_KEY (Lamatic project API key), and AGENTIC_GENERATE_CONTENT (workflow ID for the code review agent flow), providing a short description and example format for each so users can create a proper .env file; ensure the variable names exactly match LAMATIC_API_URL, LAMATIC_PROJECT_ID, LAMATIC_API_KEY, and AGENTIC_GENERATE_CONTENT and place the table immediately after the "Create a `.env` file in the kit root:" line.kits/agentic/code-review/.env.example (1)
1-4: 🧹 Nitpick | 🔵 TrivialMission assets properly secured, agent.
The environment template has been sanitized — no spaces around
=, no quoted values, proper UPPER_SNAKE_CASE nomenclature. All critical Lamatic credentials are documented.One minor protocol detail: POSIX compliance recommends a trailing newline at end-of-file. Some deployment pipelines may flag this.
📋 Add trailing newline
AGENTIC_GENERATE_CONTENT=AGENTIC_GENERATE_CONTENT_FLOW_ID LAMATIC_API_KEY=LAMATIC_API_KEY LAMATIC_API_URL=LAMATIC_API_URL LAMATIC_PROJECT_ID=LAMATIC_PROJECT_ID +🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@kits/agentic/code-review/.env.example` around lines 1 - 4, Add a POSIX-compliant trailing newline to the end of the environment template file: ensure the file ends with a single newline character after the last variable (e.g., after LAMATIC_PROJECT_ID) so that AGENTIC_GENERATE_CONTENT, LAMATIC_API_KEY, LAMATIC_API_URL, and LAMATIC_PROJECT_ID lines all terminate with a newline.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@kits/agentic/code-review/actions/orchestrate.ts`:
- Around line 31-44: The mapping in orchestrate.ts is wrong for the flow's real
schema: update the inputs->flow.inputSchema handling so that when the schema
contains "prUrl" you populate inputs["prUrl"] from the correct source (e.g., add
a prUrl parameter to the function signature or extract it from an existing value
like instructions if that holds the PR URL); modify the loop that currently
checks for "inputType"/"type" and "instructions"/"query" to also check for
"prUrl" (or refactor to map keys dynamically from available params), ensuring
the inputs object passed to the flow matches flow.inputSchema exactly (refer to
inputs, flow.inputSchema, inputType, instructions).
- Line 55: The code uses an undefined variable `data` when setting `answer`
(const answer = data?.data?.executeWorkflow?.result), which causes a runtime
ReferenceError; replace that line to read from the SDK response `resData` (use
the same pattern as other agentic kits) e.g. set `answer` using
`resData?.result?.answer`, ensuring you reference `resData` (the variable
declared earlier) instead of `data` and maintain optional chaining to avoid
null/undefined errors.
In `@kits/agentic/code-review/config.json`:
- Around line 23-28: Update the step entry in config.json so the "id" matches
the actual flow folder name and the envKey references the workflow ID variable:
change the step with "id": "code-review-flow" to "id": "code-review-agent" and
replace "envKey": "LAMATIC_API_KEY" with "envKey": "AGENTIC_GENERATE_CONTENT"
(locate the steps array entry where the id and envKey are defined to make these
edits).
- Around line 19-22: Replace the placeholder author email in the author object:
update the "email" field inside the author JSON (the "author" object with "name"
and "email") from "your@email.com" to the real contact email for Soumik so the
dossier contains the correct attribution.
- Line 5: The tags array contains an entry with a leading space (" Security")
which can break filtering; edit the tags array in config.json and trim the
whitespace so the tag reads "Security" (adjust the value in the "tags" array to
remove the leading space).
In `@kits/agentic/code-review/flows/code-review-agent/config.json`:
- Around line 112-113: Several nodes in the config leave the JSON key
"generativeModelName" empty; update each empty "generativeModelName" occurrence
to the explicit model "llama-3.3-70b-versatile" so Lamatic receives a required
model value (replace the empty string values for the four nodes that currently
have "generativeModelName": "" with "generativeModelName":
"llama-3.3-70b-versatile").
In `@kits/agentic/code-review/lib/lamatic-client.ts`:
- Around line 4-8: Remove the dead commented-out validation block that checks
process.env.AGENTIC_GENERATE_CONTENT (the three-line comment starting with "//
if (!process.env.AGENTIC_GENERATE_CONTENT) {") from lib/lamatic-client.ts to
eliminate noisy, decommissioned code; simply delete the entire commented section
and any now-unused related comments so the file contains only active, relevant
logic.
- Line 2: Remove the dead import statement "import {config} from
'../orchestrate.js'" and any lingering references to the unused identifier
config in lib/lamatic-client.ts; this eliminates the phantom dependency that
causes a module-load failure—simply delete the import line and ensure no other
code in the file relies on config (or replace with the correct module if it was
intended to be used).
In `@kits/agentic/code-review/README.md`:
- Around line 57-73: Two fenced code blocks in the README (the block starting
with "API Request Trigger (owner, repo, pr_number)" and the block starting with
"kits/agentic/code-review/") lack language specifiers and violate markdown
linting; edit those fenced code blocks in README.md (the two code blocks around
the diagram and the path listing) and add a language tag such as ```text (or
```plaintext) immediately after the opening backticks so each block becomes
```text ... ``` to satisfy the markdown linter.
---
Duplicate comments:
In `@kits/agentic/code-review/.env.example`:
- Around line 1-4: Add a POSIX-compliant trailing newline to the end of the
environment template file: ensure the file ends with a single newline character
after the last variable (e.g., after LAMATIC_PROJECT_ID) so that
AGENTIC_GENERATE_CONTENT, LAMATIC_API_KEY, LAMATIC_API_URL, and
LAMATIC_PROJECT_ID lines all terminate with a newline.
In `@kits/agentic/code-review/actions/orchestrate.ts`:
- Line 4: The import statement "import {config} from \"../orchestrate.js\"" in
kits/agentic/code-review/actions/orchestrate.ts points to a missing module (same
problem exists in lib/lamatic-client.ts); fix by either (A) creating a module
named orchestrate.js that exports the config symbol so the import resolves, or
(B) change the import to reference the actual existing module that provides
config (e.g., the correct config module or index that currently holds the config
export) and update both occurrences (the import in orchestrate.ts and in
lib/lamatic-client.ts) to the correct path so the config symbol resolves at
runtime.
In `@kits/agentic/code-review/README.md`:
- Around line 47-51: Add the missing environment variables table to the
"Environment Variables" section of kits/agentic/code-review/README.md: document
LAMATIC_API_URL (Lamatic API endpoint URL), LAMATIC_PROJECT_ID (Lamatic project
ID), LAMATIC_API_KEY (Lamatic project API key), and AGENTIC_GENERATE_CONTENT
(workflow ID for the code review agent flow), providing a short description and
example format for each so users can create a proper .env file; ensure the
variable names exactly match LAMATIC_API_URL, LAMATIC_PROJECT_ID,
LAMATIC_API_KEY, and AGENTIC_GENERATE_CONTENT and place the table immediately
after the "Create a `.env` file in the kit root:" line.
🪄 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: 1d9c8d00-31a0-4906-b875-5b58effca8f7
📒 Files selected for processing (7)
kits/agentic/code-review/.env.examplekits/agentic/code-review/README.mdkits/agentic/code-review/actions/orchestrate.tskits/agentic/code-review/config.jsonkits/agentic/code-review/flows/code-review-agent/config.jsonkits/agentic/code-review/flows/config.jsonkits/agentic/code-review/lib/lamatic-client.ts
| // Prepare inputs based on the flow's input schema | ||
| const inputs: Record<string, any> = { | ||
| mode: inputType, | ||
| instructions, | ||
| } | ||
|
|
||
| // Map to schema if needed | ||
| for (const inputKey of Object.keys(flow.inputSchema || {})) { | ||
| if (inputKey === "inputType" || inputKey === "type") { | ||
| inputs[inputKey] = inputType | ||
| } else if (inputKey === "instructions" || inputKey === "query") { | ||
| inputs[inputKey] = instructions | ||
| } | ||
| } |
There was a problem hiding this comment.
Schema mapping logic is incompatible with actual flow config, agent.
Your mapping logic searches for keys like inputType, type, instructions, query in the inputSchema. However, the actual config.json defines:
"inputSchema": { "prUrl": "string" }The flow expects a prUrl (GitHub PR URL), not the inputType/instructions parameters this function accepts. This fundamental mismatch means the flow will receive unexpected inputs and likely fail.
Either:
- Update the function signature to accept
prUrl, or - Update
config.jsoninputSchema to match what this function provides
🔧 Option: Align with actual flow requirements
-type InputType = "text" | "image" | "json"
-
-export async function generateContent(
- inputType: InputType,
- instructions: string,
+export async function generateContent(
+ prUrl: string,
): Promise<{
success: boolean
data?: any
error?: string
}> {
try {
- console.log("[v0] Generating content with:", { inputType, instructions })
+ console.log("[v0] Generating content with:", { prUrl })
// Get the first workflow from the config
const flows = config.flows
const firstFlowKey = Object.keys(flows)[0]
if (!firstFlowKey) {
throw new Error("No workflows found in configuration")
}
const flow = flows[firstFlowKey as keyof typeof flows] as (typeof flows)[keyof typeof flows];
console.log("[v0] Using workflow:", flow.name, flow.workflowId);
- // Prepare inputs based on the flow's input schema
- const inputs: Record<string, any> = {
- mode: inputType,
- instructions,
- }
-
- // Map to schema if needed
- for (const inputKey of Object.keys(flow.inputSchema || {})) {
- if (inputKey === "inputType" || inputKey === "type") {
- inputs[inputKey] = inputType
- } else if (inputKey === "instructions" || inputKey === "query") {
- inputs[inputKey] = instructions
- }
- }
+ const inputs: Record<string, any> = { prUrl }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/actions/orchestrate.ts` around lines 31 - 44, The
mapping in orchestrate.ts is wrong for the flow's real schema: update the
inputs->flow.inputSchema handling so that when the schema contains "prUrl" you
populate inputs["prUrl"] from the correct source (e.g., add a prUrl parameter to
the function signature or extract it from an existing value like instructions if
that holds the PR URL); modify the loop that currently checks for
"inputType"/"type" and "instructions"/"query" to also check for "prUrl" (or
refactor to map keys dynamically from available params), ensuring the inputs
object passed to the flow matches flow.inputSchema exactly (refer to inputs,
flow.inputSchema, inputType, instructions).
| console.log("[v0] Raw response:", resData) | ||
|
|
||
| // Parse the answer from resData?.output.answer | ||
| const answer = data?.data?.executeWorkflow?.result |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the variable name discrepancy
echo "=== Checking for 'data' vs 'resData' usage ==="
rg -n 'resData|const data' kits/agentic/code-review/actions/orchestrate.tsRepository: Lamatic/AgentKit
Length of output: 291
🏁 Script executed:
#!/bin/bash
# Get the actual content around line 55
sed -n '45,65p' kits/agentic/code-review/actions/orchestrate.ts | cat -nRepository: Lamatic/AgentKit
Length of output: 731
🏁 Script executed:
#!/bin/bash
# Search for how executeFlow response is being used elsewhere in the codebase
echo "=== Searching for executeFlow usage patterns ==="
rg -A 5 'executeFlow' kits/ --type ts --type tsx | head -60Repository: Lamatic/AgentKit
Length of output: 153
🏁 Script executed:
#!/bin/bash
# Search for executeFlow in the entire repo with simpler pattern
echo "=== Searching for executeFlow usage ==="
rg -n 'executeFlow' --type ts | head -40
echo ""
echo "=== Checking lamatic-client implementation ==="
fd -t f lamatic-clientRepository: Lamatic/AgentKit
Length of output: 2324
🏁 Script executed:
#!/bin/bash
# Check how similar agentic files parse the executeFlow response
echo "=== agentic/generation response parsing ==="
sed -n '51,70p' kits/agentic/generation/actions/orchestrate.ts
echo ""
echo "=== agentic/deep-search response parsing (first instance) ==="
sed -n '107,126p' kits/agentic/deep-search/actions/orchestrate.ts
echo ""
echo "=== Check the lamatic-client implementation ==="
cat kits/agentic/code-review/lib/lamatic-client.tsRepository: Lamatic/AgentKit
Length of output: 2322
This mission will self-destruct: Undefined variable on line 55 causes immediate runtime failure.
Line 55 references data?.data?.executeWorkflow?.result, but the variable data is never defined in this scope. The SDK response is stored in resData (line 51). This will throw a ReferenceError at runtime.
The correct extraction path should follow the pattern used in other agentic kits: resData?.result?.answer (see agentic/generation for reference).
🔧 Fix the variable reference
- // Parse the answer from resData?.output.answer
- const answer = data?.data?.executeWorkflow?.result
+ // Parse the answer from the SDK response
+ const answer = resData?.result?.answer📝 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.
| const answer = data?.data?.executeWorkflow?.result | |
| const answer = resData?.result?.answer |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/actions/orchestrate.ts` at line 55, The code uses an
undefined variable `data` when setting `answer` (const answer =
data?.data?.executeWorkflow?.result), which causes a runtime ReferenceError;
replace that line to read from the SDK response `resData` (use the same pattern
as other agentic kits) e.g. set `answer` using `resData?.result?.answer`,
ensuring you reference `resData` (the variable declared earlier) instead of
`data` and maintain optional chaining to avoid null/undefined errors.
| "type": "atomic", | ||
| "name": "Code Review Agent", | ||
| "description": "Analyzes GitHub PRs for bugs, security vulnerabilities, and style issues using multi-step agentic reasoning.", | ||
| "tags": ["Agentic", "Code Review", " Security"], |
There was a problem hiding this comment.
Agent, your tags contain unauthorized whitespace.
The tag " Security" has a leading space which could cause filtering/display inconsistencies in downstream systems.
🏷️ Trim the whitespace
- "tags": ["Agentic", "Code Review", " Security"],
+ "tags": ["Agentic", "Code Review", "Security"],📝 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.
| "tags": ["Agentic", "Code Review", " Security"], | |
| "tags": ["Agentic", "Code Review", "Security"], |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/config.json` at line 5, The tags array contains an
entry with a leading space (" Security") which can break filtering; edit the
tags array in config.json and trim the whitespace so the tag reads "Security"
(adjust the value in the "tags" array to remove the leading space).
| "author": { | ||
| "name": "Soumik", | ||
| "email": "your@email.com" | ||
| }, |
There was a problem hiding this comment.
Placeholder credentials in the dossier, agent.
The author email "your@email.com" is a placeholder. Update this to the actual author contact for proper attribution.
📝 Update author email
"author": {
"name": "Soumik",
- "email": "your@email.com"
+ "email": "soumik15630m@example.com"
},📝 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.
| "author": { | |
| "name": "Soumik", | |
| "email": "your@email.com" | |
| }, | |
| "author": { | |
| "name": "Soumik", | |
| "email": "soumik15630m@example.com" | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/config.json` around lines 19 - 22, Replace the
placeholder author email in the author object: update the "email" field inside
the author JSON (the "author" object with "name" and "email") from
"your@email.com" to the real contact email for Soumik so the dossier contains
the correct attribution.
| "steps": [ | ||
| { | ||
| "id": "code-review-flow", | ||
| "type": "mandatory", | ||
| "envKey": "LAMATIC_API_KEY" | ||
| } |
There was a problem hiding this comment.
Mission-critical misalignment detected, agent.
The step configuration has two issues:
-
Step ID mismatch:
"id": "code-review-flow"does not match the actual flow folder namecode-review-agent/. As per coding guidelines, step IDs must align with flow folder names. -
envKey mismatch:
"envKey": "LAMATIC_API_KEY"should reference the workflow ID environment variableAGENTIC_GENERATE_CONTENT, not the API key credential.
🔧 Realign step configuration
"steps": [
{
- "id": "code-review-flow",
+ "id": "code-review-agent",
"type": "mandatory",
- "envKey": "LAMATIC_API_KEY"
+ "envKey": "AGENTIC_GENERATE_CONTENT"
}
],As per coding guidelines: "Kit step IDs in config.json must align with flow folder names and corresponding environment variable keys."
📝 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.
| "steps": [ | |
| { | |
| "id": "code-review-flow", | |
| "type": "mandatory", | |
| "envKey": "LAMATIC_API_KEY" | |
| } | |
| "steps": [ | |
| { | |
| "id": "code-review-agent", | |
| "type": "mandatory", | |
| "envKey": "AGENTIC_GENERATE_CONTENT" | |
| } | |
| ] |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/config.json` around lines 23 - 28, Update the step
entry in config.json so the "id" matches the actual flow folder name and the
envKey references the workflow ID variable: change the step with "id":
"code-review-flow" to "id": "code-review-agent" and replace "envKey":
"LAMATIC_API_KEY" with "envKey": "AGENTIC_GENERATE_CONTENT" (locate the steps
array entry where the id and envKey are defined to make these edits).
| "generativeModelName": "" | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Does Lamatic InstructorLLMNode default to a specific model when generativeModelName is empty?
💡 Result:
No, Lamatic InstructorLLMNode does not default to a specific model when generativeModelName is empty. The generativeModelName parameter is required for all documented Lamatic LLM nodes (e.g., LLMNode, multiModalLLMNode, agentNode), as it specifies the provider, credential, and model_name needed to generate text. Leaving it empty would result in configuration errors, as no sources indicate a default model fallback. Official Lamatic documentation consistently shows it as a selectable/required field with examples like gpt-4-turbo or mistral-large-2402.
Citations:
- 1: https://lamatic.ai/docs/nodes/text-llm-node
- 2: https://lamatic.ai/docs/nodes/ai/multimodel-node
- 3: https://www.lamatic.ai/docs/nodes/agent-classifier-node
- 4: https://lamatic.ai/docs/nodes/ai/classifier-node
- 5: https://lamatic.ai/docs/nodes/agent-classifier-node
🏁 Script executed:
# Locate and inspect the config.json file
find . -name "config.json" -path "*/kits/agentic/code-review/flows/code-review-agent/*" | head -5Repository: Lamatic/AgentKit
Length of output: 122
🏁 Script executed:
# Once located, inspect the specific lines mentioned in the review
cat -n kits/agentic/code-review/flows/code-review-agent/config.json | sed -n '110,115p; 150,155p; 190,195p; 247,252p'Repository: Lamatic/AgentKit
Length of output: 830
🏁 Script executed:
# Search for README files that might mention the Groq model default
find . -iname "README*" -type f | xargs grep -l "llama-3.3-70b-versatile\|groq" 2>/dev/null | head -10Repository: Lamatic/AgentKit
Length of output: 96
🏁 Script executed:
# Search for any default model configuration in the codebase
rg "generativeModelName" -A 3 -B 3 | head -100Repository: Lamatic/AgentKit
Length of output: 5790
🏁 Script executed:
# Inspect the README to see if it documents the Groq model default
cat ./kits/agentic/code-review/README.mdRepository: Lamatic/AgentKit
Length of output: 4276
🏁 Script executed:
# Check if there are any runtime initialization files or docs that explain defaults
find ./kits/agentic/code-review -type f \( -name "*.md" -o -name "*.txt" -o -name "*.json" \) | xargs grep -l "llama-3.3-70b-versatile\|groq\|default.*model\|model.*default" 2>/dev/nullRepository: Lamatic/AgentKit
Length of output: 96
🏁 Script executed:
# Inspect the broader kit structure to understand how these configs are used
cat -n ./kits/agentic/code-review/config.json | head -50Repository: Lamatic/AgentKit
Length of output: 1248
Populate empty generativeModelName fields with explicit model specification.
The generativeModelName fields at lines 112–113, 152–153, 192–193, and 249–250 are left empty, but Lamatic requires this field to be explicitly set. The official Lamatic documentation confirms generativeModelName is a required parameter with no default fallback — leaving it empty results in configuration errors. The README documents the intended model as Groq llama-3.3-70b-versatile, so these four nodes must specify this model explicitly in their configurations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/flows/code-review-agent/config.json` around lines
112 - 113, Several nodes in the config leave the JSON key "generativeModelName"
empty; update each empty "generativeModelName" occurrence to the explicit model
"llama-3.3-70b-versatile" so Lamatic receives a required model value (replace
the empty string values for the four nodes that currently have
"generativeModelName": "" with "generativeModelName":
"llama-3.3-70b-versatile").
| @@ -0,0 +1,20 @@ | |||
| import { Lamatic } from "lamatic"; | |||
| import {config} from '../orchestrate.js' | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify orchestrate.js does not exist and config is unused
echo "=== Checking for orchestrate.js existence ==="
fd -t f 'orchestrate.js' kits/agentic/code-review/
echo "=== Checking if 'config' is referenced anywhere in this file ==="
rg -n 'config\.' kits/agentic/code-review/lib/lamatic-client.ts || echo "config is not used in this file"Repository: Lamatic/AgentKit
Length of output: 202
This file contains a phantom asset that will self-destruct on module load.
The import {config} from '../orchestrate.js' references a non-existent file in your directory structure. Additionally, the config variable is never used in this file—it's orphaned code left behind from a previous fix.
Remove the dead import to prevent runtime failure:
🔧 Proposed extraction
import { Lamatic } from "lamatic";
-import {config} from '../orchestrate.js'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/lib/lamatic-client.ts` at line 2, Remove the dead
import statement "import {config} from '../orchestrate.js'" and any lingering
references to the unused identifier config in lib/lamatic-client.ts; this
eliminates the phantom dependency that causes a module-load failure—simply
delete the import line and ensure no other code in the file relies on config (or
replace with the correct module if it was intended to be used).
| // if (!process.env.AGENTIC_GENERATE_CONTENT) { | ||
| // throw new Error( | ||
| // "All Workflow IDs in environment variable are not set. Please add it to your .env.local file." | ||
| // ); | ||
| // } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Recommend removing commented-out code, agent.
This decommissioned validation block adds noise to the mission dossier. If the AGENTIC_GENERATE_CONTENT check is no longer required, expunge it entirely rather than leaving classified debris behind.
🧹 Clean extraction
import { Lamatic } from "lamatic";
-import {config} from '../orchestrate.js'
-
-// if (!process.env.AGENTIC_GENERATE_CONTENT) {
-// throw new Error(
-// "All Workflow IDs in environment variable are not set. Please add it to your .env.local file."
-// );
-// }
if (!process.env.LAMATIC_API_URL || !process.env.LAMATIC_PROJECT_ID || !process.env.LAMATIC_API_KEY) {📝 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.
| // if (!process.env.AGENTIC_GENERATE_CONTENT) { | |
| // throw new Error( | |
| // "All Workflow IDs in environment variable are not set. Please add it to your .env.local file." | |
| // ); | |
| // } | |
| import { Lamatic } from "lamatic"; | |
| if (!process.env.LAMATIC_API_URL || !process.env.LAMATIC_PROJECT_ID || !process.env.LAMATIC_API_KEY) { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/lib/lamatic-client.ts` around lines 4 - 8, Remove
the dead commented-out validation block that checks
process.env.AGENTIC_GENERATE_CONTENT (the three-line comment starting with "//
if (!process.env.AGENTIC_GENERATE_CONTENT) {") from lib/lamatic-client.ts to
eliminate noisy, decommissioned code; simply delete the entire commented section
and any now-unused related comments so the file contains only active, relevant
logic.
| ``` | ||
| API Request Trigger (owner, repo, pr_number) | ||
| ↓ | ||
| Code Node — extract diff from GitHub API response | ||
| ↓ | ||
| GitHub API Node — GET /repos/{owner}/{repo}/pulls/{pr_number}/files | ||
| ↓ | ||
| Generate JSON — Bug Analysis | ||
| ↓ | ||
| Generate JSON — Security Scan | ||
| ↓ | ||
| Generate JSON — Style Check | ||
| ↓ | ||
| Generate JSON — Final Merge (summary) | ||
| ↓ | ||
| API Response | ||
| ``` |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Minor markdown protocol violations, agent.
Static analysis flagged fenced code blocks at lines 57 and 116 without language specifiers. Adding text or plaintext will satisfy markdown lint requirements.
📝 Add language specifiers
Line 57:
-```
+```text
API Request Trigger (owner, repo, pr_number)Line 116:
-```
+```text
kits/agentic/code-review/Also applies to: 116-131
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 57-57: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/agentic/code-review/README.md` around lines 57 - 73, Two fenced code
blocks in the README (the block starting with "API Request Trigger (owner, repo,
pr_number)" and the block starting with "kits/agentic/code-review/") lack
language specifiers and violate markdown linting; edit those fenced code blocks
in README.md (the two code blocks around the diagram and the path listing) and
add a language tag such as ```text (or ```plaintext) immediately after the
opening backticks so each block becomes ```text ... ``` to satisfy the markdown
linter.
What This Kit Does
Closes #84
An agentic Next.js starter kit that performs AI-powered code reviews on GitHub Pull Requests using Lamatic Flows. Enter any public GitHub PR and get a structured analysis of bugs, security vulnerabilities, and style issues.
Providers & Prerequisites
How to Run Locally
cd kits/agentic/code-reviewnpm installcp .env.example .envand fill inLAMATIC_API_KEYnpm run devLive Preview
https://agent-kit-stk.vercel.app
Lamatic Flow
Multi-step agentic flow: GitHub API fetch → diff extraction → Bug Analysis → Security Scan → Style Check → Summary merge
PR Checklist
npm run dev.env.examplehas no secrets, only placeholdersREADME.mddocuments setup and usagekits/agentic/code-review/config.jsonis present and validFiles added (kits/agentic/code-review):
Flow node types (from flows/code-review-agent/config.json):
High-level flow behavior:
Runtime / integration notes: