Skip to content

feat: Add code-review-agent AgentKit#84

Open
soumik15630m wants to merge 19 commits intoLamatic:mainfrom
soumik15630m:main
Open

feat: Add code-review-agent AgentKit#84
soumik15630m wants to merge 19 commits intoLamatic:mainfrom
soumik15630m:main

Conversation

@soumik15630m
Copy link
Copy Markdown

@soumik15630m soumik15630m commented Mar 21, 2026

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

  • Groq (free) — llama-3.3-70b-versatile
  • GitHub REST API (public PRs, no token needed)
  • Lamatic API key

How to Run Locally

  1. cd kits/agentic/code-review
  2. npm install
  3. cp .env.example .env and fill in LAMATIC_API_KEY
  4. npm run dev

Live 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

  • Kit runs locally with npm run dev
  • .env.example has no secrets, only placeholders
  • README.md documents setup and usage
  • Folder structure follows kits/agentic/code-review/
  • config.json is present and valid
  • Vercel deployment works
  • Live preview URL works end-to-end
  • Files added (kits/agentic/code-review):

    • Project & config: package.json, tsconfig.json, next.config.mjs, config.json, components.json, .gitignore, .env.example, README.md
    • Frontend: app/page.tsx, app/layout.tsx, app/globals.css
    • Backend / orchestration: actions/orchestrate.ts, app/api/review/route.ts, lib/lamatic-client.ts, lib/utils.ts
    • Lamatic flow collection and flow files:
      • flows/config.json
      • flows/README.md
      • flows/code-review-agent/config.json
      • flows/code-review-agent/inputs.json
      • flows/code-review-agent/meta.json
      • flows/code-review-agent/README.md
  • Flow node types (from flows/code-review-agent/config.json):

    • triggerNode (webhookTriggerNode) — accepts owner, repo, pr_number
    • dynamicNode:
      • apiNode (API) — GitHub REST API GET /repos/{owner}/{repo}/pulls/{pr_number}/files
      • codeNode (Code) — JS transformation that concatenates file patches into output.diff
      • InstructorLLMNode (multiple) — specialized instructor LLM nodes:
        • InstructorLLMNode_312 (Bug_Analysis) → outputs { bugs: [...] }
        • InstructorLLMNode_549 (Security_Scan) → outputs { security: [...] }
        • InstructorLLMNode_538 (Style_Check) → outputs { style: [...] }
        • InstructorLLMNode_481 (Final Merge) → outputs { summary: string }
    • addNode (plus-node) — UI/graph helper
  • High-level flow behavior:

    1. Webhook trigger receives owner, repo, pr_number.
    2. API node fetches PR file list and patches from GitHub REST API.
    3. Code node builds a single concatenated diff string (output.diff) from file patches.
    4. Instructor LLM nodes analyze the diff:
      • Bug_Analysis produces structured bug items (line, issue, severity).
      • Security_Scan produces structured security findings (line, issue, severity).
      • Style_Check produces style suggestions (array of strings).
    5. Final Merge InstructorLLMNode synthesizes the three analyses into a concise summary (output.summary).
    6. Next.js backend/orchestrator invokes the Lamatic workflow and normalizes/returns structured JSON (bugs, security, style, summary) for the frontend to display.
  • Runtime / integration notes:

    • Requires Lamatic environment (LAMATIC_API_KEY, LAMATIC_API_URL, LAMATIC_PROJECT_ID, and flow-specific env keys such as AGENTIC_GENERATE_CONTENT).
    • Uses public GitHub REST API for PR diffs (no token required for public PRs).
    • Frontend POST /api/review triggers orchestration and renders normalized structured findings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

Walkthrough

Adds 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

Cohort / File(s) Summary
Project config & metadata
kits/agentic/code-review/.env.example, kits/agentic/code-review/.gitignore, kits/agentic/code-review/package.json, kits/agentic/code-review/tsconfig.json, kits/agentic/code-review/next.config.mjs, kits/agentic/code-review/components.json, kits/agentic/code-review/config.json
Add env placeholders (including AGENTIC_GENERATE_CONTENT, LAMATIC_API_KEY, LAMATIC_API_URL, LAMATIC_PROJECT_ID), VCS ignore rules, package/TS/Next configs, Shadcn UI config, and agent kit manifest mapping Lamatic API settings and flow workflowId.
Documentation
kits/agentic/code-review/README.md, kits/agentic/code-review/flows/README.md, kits/agentic/code-review/flows/code-review-agent/README.md
Add kit and flow READMEs describing setup, usage, flow structure, and contribution guidance.
Next.js app (UI & layout)
kits/agentic/code-review/app/page.tsx, kits/agentic/code-review/app/layout.tsx, kits/agentic/code-review/app/globals.css
Add root layout, global styles, and client page implementing PR input form, POST to /api/review, response parsing/validation, and UI for summary, stats, and findings.
Backend & orchestration
kits/agentic/code-review/app/api/review/route.ts, kits/agentic/code-review/actions/orchestrate.ts, kits/agentic/code-review/lib/lamatic-client.ts, kits/agentic/code-review/lib/utils.ts
Add API POST handler that validates inputs and proxies to Lamatic GraphQL, orchestration helper generateContent to execute flows and extract answers with error mapping, Lamatic client initialization that validates required env vars, and a cn utility for class merging.
Lamatic flow collection
kits/agentic/code-review/flows/config.json, kits/agentic/code-review/flows/README.md
Add flow-collection manifest and overview for included flow(s).
Code Review flow files
kits/agentic/code-review/flows/code-review-agent/config.json, kits/agentic/code-review/flows/code-review-agent/inputs.json, kits/agentic/code-review/flows/code-review-agent/meta.json
Add multi-node Lamatic flow: webhook trigger → GitHub PR files fetch → diff assembly → Bug Analysis / Security Scan / Style Check instructor LLM nodes → Final merge summary; with node input schemas and metadata.
Flow helper
kits/agentic/code-review/flows/code-review-agent/...
Includes templated node assets and flow node wiring (nodes, edges, and add-node placeholder).

Suggested reviewers

  • amanintech
  • d-pamneja
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Add code-review-agent AgentKit' accurately describes the primary change—introduction of a new code review agent kit in the agentic category.
Description check ✅ Passed The PR description comprehensively covers what the kit does, prerequisites, local setup instructions, live preview URL, flow architecture, and includes a completed checklist matching the template requirements.
Linked Issues check ✅ Passed All code objectives from issue #84 are met: multi-step Lamatic flow (GitHub fetch → analyses → merge), backend orchestrator and API endpoint, Next.js frontend for PR input/output display, environment configuration, local execution support, and comprehensive documentation.
Out of Scope Changes check ✅ Passed All changes are scoped to the new kits/agentic/code-review/ directory and directly support the code-review-agent kit objective; no unrelated files or projects are modified.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the tags entry.

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, and workflowId are 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

📥 Commits

Reviewing files that changed from the base of the PR and between e1ceb47 and d3af5a5.

⛔ Files ignored due to path filters (4)
  • kits/agentic/code-review/.next-dev-3001.err.log is excluded by !**/*.log
  • kits/agentic/code-review/.next-dev-3001.log is excluded by !**/*.log
  • kits/agentic/code-review/image.png is excluded by !**/*.png
  • kits/agentic/code-review/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • kits/agentic/code-review/.env.example
  • kits/agentic/code-review/.gitignore
  • kits/agentic/code-review/README.md
  • kits/agentic/code-review/actions/orchestrate.ts
  • kits/agentic/code-review/app/api/review/route.ts
  • kits/agentic/code-review/app/globals.css
  • kits/agentic/code-review/app/layout.tsx
  • kits/agentic/code-review/app/page.tsx
  • kits/agentic/code-review/components.json
  • kits/agentic/code-review/config.json
  • kits/agentic/code-review/flows/README.md
  • kits/agentic/code-review/flows/code-review-agent/README.md
  • kits/agentic/code-review/flows/code-review-agent/config.json
  • kits/agentic/code-review/flows/code-review-agent/inputs.json
  • kits/agentic/code-review/flows/code-review-agent/meta.json
  • kits/agentic/code-review/flows/config.json
  • kits/agentic/code-review/lib/lamatic-client.ts
  • kits/agentic/code-review/lib/utils.ts
  • kits/agentic/code-review/next.config.mjs
  • kits/agentic/code-review/package.json
  • kits/agentic/code-review/tsconfig.json

"use server"

import { lamaticClient } from "@/lib/lamatic-client"
import {config} from "../orchestrate.js"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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 tsx

Repository: Lamatic/AgentKit

Length of output: 152


🏁 Script executed:

cat -n kits/agentic/code-review/actions/orchestrate.ts

Repository: Lamatic/AgentKit

Length of output: 3086


🏁 Script executed:

rg -n 'generateContent' kits/agentic/code-review/ --type ts

Repository: 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 -30

Repository: 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.

@amanintech
Copy link
Copy Markdown
Member

Kindly resolve all the pending issues first.

@amanintech
Copy link
Copy Markdown
Member

Kindl resolve all code rabbit comments

amanintech and others added 3 commits March 27, 2026 15:33
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot requested review from amanintech and d-pamneja March 28, 2026 05:38
soumik15630m and others added 2 commits March 28, 2026 11:09
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d3af5a5 and cbc6304.

📒 Files selected for processing (2)
  • kits/agentic/code-review/.env.example
  • kits/agentic/code-review/.gitignore

soumik15630m and others added 11 commits March 28, 2026 11:10
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.
@soumik15630m
Copy link
Copy Markdown
Author

@amanintech Rest of the changes asked in this review i didn't even touched , those were present even in sample

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

♻️ Duplicate comments (3)
kits/agentic/code-review/actions/orchestrate.ts (1)

4-4: ⚠️ Potential issue | 🔴 Critical

Agent, 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-existent orchestrate.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 | 🟠 Major

Agent, the mission briefing is incomplete.

The Environment Variables section promises a .env file 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 URL
  • LAMATIC_PROJECT_ID - Your Lamatic project ID
  • LAMATIC_API_KEY - Your Lamatic project API key
  • AGENTIC_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 | 🔵 Trivial

Mission 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

📥 Commits

Reviewing files that changed from the base of the PR and between cbc6304 and 3236287.

📒 Files selected for processing (7)
  • kits/agentic/code-review/.env.example
  • kits/agentic/code-review/README.md
  • kits/agentic/code-review/actions/orchestrate.ts
  • kits/agentic/code-review/config.json
  • kits/agentic/code-review/flows/code-review-agent/config.json
  • kits/agentic/code-review/flows/config.json
  • kits/agentic/code-review/lib/lamatic-client.ts

Comment on lines +31 to +44
// 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
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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:

  1. Update the function signature to accept prUrl, or
  2. Update config.json inputSchema 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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.ts

Repository: 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 -n

Repository: 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 -60

Repository: 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-client

Repository: 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.ts

Repository: 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.

Suggested change
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"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
"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).

Comment on lines +19 to +22
"author": {
"name": "Soumik",
"email": "your@email.com"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
"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.

Comment on lines +23 to +28
"steps": [
{
"id": "code-review-flow",
"type": "mandatory",
"envKey": "LAMATIC_API_KEY"
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Mission-critical misalignment detected, agent.

The step configuration has two issues:

  1. Step ID mismatch: "id": "code-review-flow" does not match the actual flow folder name code-review-agent/. As per coding guidelines, step IDs must align with flow folder names.

  2. envKey mismatch: "envKey": "LAMATIC_API_KEY" should reference the workflow ID environment variable AGENTIC_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.

Suggested change
"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).

Comment on lines +112 to +113
"generativeModelName": ""
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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:


🏁 Script executed:

# Locate and inspect the config.json file
find . -name "config.json" -path "*/kits/agentic/code-review/flows/code-review-agent/*" | head -5

Repository: 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 -10

Repository: Lamatic/AgentKit

Length of output: 96


🏁 Script executed:

# Search for any default model configuration in the codebase
rg "generativeModelName" -A 3 -B 3 | head -100

Repository: 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.md

Repository: 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/null

Repository: 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 -50

Repository: 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'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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).

Comment on lines +4 to +8
// 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."
// );
// }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Suggested change
// 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.

Comment on lines +57 to +73
```
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
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants