Skip to content

feat: Add code-review-agent AgentKit#84

Merged
d-pamneja merged 29 commits into
Lamatic:mainfrom
soumik15630m:main
Mar 30, 2026
Merged

feat: Add code-review-agent AgentKit#84
d-pamneja merged 29 commits into
Lamatic:mainfrom
soumik15630m:main

Conversation

@soumik15630m

@soumik15630m soumik15630m commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

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_688 (apiNode) — GET https://api.github.com/repos/{owner}/{repo}/pulls/{pr_number}/files (fetches PR files/patches)
      • codeNode_104 (codeNode) — concatenates API response into output.diff (JS snippet)
      • InstructorLLMNode_312 (Bug_Analysis) — prompts to output { bugs: [...] } (line, issue, severity)
      • InstructorLLMNode_549 (Security_Scan) — prompts to output { security: [...] } (line, issue, severity)
      • InstructorLLMNode_538 (Style_Check) — prompts to output { style: [...] } (array of strings)
      • InstructorLLMNode_481 (Final_Merge) — merges prior outputs into { summary: string }
    • addNode (plus-node) — UI/graph helper
  • High-level flow behavior:

    1. Webhook trigger provides owner, repo, pr_number.
    2. API node fetches PR file list and patches from GitHub REST API.
    3. Code node assembles a single concatenated diff string (output.diff).
    4. Instructor LLM nodes run sequentially: Bug_Analysis → Security_Scan → Style_Check, each analyzing output.diff and producing structured outputs.
    5. Final_Merge takes bugs/security/style outputs and returns a concise 2–3 sentence summary.
    6. Orchestrator/Next.js backend invokes the flow (via Lamatic) and returns normalized JSON: { bugs, security, style, summary }.
  • Runtime / integration notes:

    • Requires env vars: LAMATIC_API_KEY, LAMATIC_API_URL, LAMATIC_PROJECT_ID and flow env key (AGENTIC_GENERATE_CONTENT).
    • Uses public GitHub REST API for PR diffs (no token required for public PRs).
    • Frontend POST /api/review triggers orchestration and displays normalized findings.

@coderabbitai

coderabbitai Bot commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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. All changes are additions (new files).

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 documenting setup, usage, flow structure, Lamatic import, 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 validating inputs and proxying to Lamatic GraphQL, orchestration helper generateContent to execute flows and extract answers with error mapping, Lamatic client init that validates env vars, and 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; includes node input schemas and metadata.
Flow helper / assets
kits/agentic/code-review/flows/code-review-agent/...
Includes templated node assets, node wiring (nodes, edges), inputs.json entries for instructor LLM nodes, and add-node placeholder.
Orchestration helper env template
kits/agentic/code-review/.env.example
Defines placeholders for AGENTIC_GENERATE_CONTENT, LAMATIC_API_KEY, LAMATIC_API_URL, and LAMATIC_PROJECT_ID.

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 PR title clearly summarizes the main change: adding a code-review-agent AgentKit to the project, which aligns with all file changes and objectives.
Description check ✅ Passed The PR description covers setup instructions, prerequisites, and includes a checklist matching the template requirements for Kit contributions, though it could be more detailed on some template sections.
Linked Issues check ✅ Passed All coding objectives from issue #84 are met: the kit provides a Next.js starter, backend orchestration, Lamatic flow definitions with proper node types, frontend UI, environment configuration, and documentation.
Out of Scope Changes check ✅ Passed All changes are within scope—they focus exclusively on the code-review-agent AgentKit under kits/agentic/code-review/ with no modifications to unrelated projects or files.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

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.

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

Comment thread kits/agentic/code-review/.env.example Outdated
Comment thread kits/agentic/code-review/.gitignore
Comment thread kits/agentic/code-review/actions/orchestrate.ts Outdated
Comment thread kits/agentic/code-review/actions/orchestrate.ts Outdated
Comment thread kits/agentic/code-review/config.json
Comment thread kits/agentic/code-review/lib/lamatic-client.ts Outdated
Comment thread kits/agentic/code-review/next.config.mjs
Comment thread kits/agentic/code-review/README.md
Comment thread kits/agentic/code-review/README.md Outdated
Comment thread kits/agentic/code-review/README.md Outdated
@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>

@coderabbitai coderabbitai Bot left a comment

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.

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

Comment thread kits/agentic/code-review/.env.example Outdated
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
Contributor Author

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

@coderabbitai coderabbitai Bot left a comment

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.

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 thread kits/agentic/code-review/actions/orchestrate.ts Outdated
Comment thread kits/agentic/code-review/actions/orchestrate.ts Outdated
Comment thread kits/agentic/code-review/config.json Outdated
Comment thread kits/agentic/code-review/config.json
Comment thread kits/agentic/code-review/config.json
Comment thread kits/agentic/code-review/flows/code-review-agent/config.json Outdated
Comment thread kits/agentic/code-review/lib/lamatic-client.ts
Comment thread kits/agentic/code-review/lib/lamatic-client.ts Outdated
Comment thread kits/agentic/code-review/README.md Outdated
soumik15630m and others added 3 commits March 29, 2026 21:16
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>

@coderabbitai coderabbitai Bot left a comment

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.

♻️ Duplicate comments (2)
kits/agentic/code-review/config.json (1)

23-28: ⚠️ Potential issue | 🟠 Major

Mission mismatch: steps.envKey targets credentials, not the workflow ID variable.

Line 27 uses LAMATIC_API_KEY, but this step should reference the flow/workflow env var (AGENTIC_GENERATE_CONTENT) configured on Line 9.

🔧 Suggested patch
   "steps": [
     {
       "id": "code-review-flow",
       "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."

🤖 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, The step with id
"code-review-flow" has the wrong envKey: it's set to LAMATIC_API_KEY but should
reference the workflow's environment variable AGENTIC_GENERATE_CONTENT; update
the "envKey" value for the "code-review-flow" step in config.json to
"AGENTIC_GENERATE_CONTENT" so the step maps to the correct flow/workflow
variable.
kits/agentic/code-review/lib/lamatic-client.ts (1)

1-12: ⚠️ Potential issue | 🔴 Critical

Mission-critical: disarm duplicate import/guard before this module can load.

Line 1 and Line 4 both declare Lamatic, Line 2 pulls in ../orchestrate.js, and Lines 6/8 duplicate the same env guard with a broken structure. This can fail parsing/module initialization.

🔧 Suggested patch
 import { Lamatic } from "lamatic";
-import {config} from '../orchestrate.js'
-
-import { Lamatic } from "lamatic";
-
-if (!process.env.LAMATIC_API_URL || !process.env.LAMATIC_PROJECT_ID || !process.env.LAMATIC_API_KEY) {
 
 if (!process.env.LAMATIC_API_URL || !process.env.LAMATIC_PROJECT_ID || !process.env.LAMATIC_API_KEY) {
   throw new Error(
     "All API Credentials in environment variable are not set. Please add it to your .env.local file."
   );
 }
#!/bin/bash
set -euo pipefail

FILE="kits/agentic/code-review/lib/lamatic-client.ts"

echo "== Lamatic imports =="
rg -n 'import\s+\{\s*Lamatic\s*\}\s+from\s+"lamatic";' "$FILE"

echo "== orchestrate module candidates (should confirm intended import target) =="
fd -t f 'orchestrate\.(ts|js)$' kits/agentic/code-review || true

echo "== duplicated env guard condition =="
rg -n 'if\s*\(!process\.env\.LAMATIC_API_URL\s*\|\|\s*!process\.env\.LAMATIC_PROJECT_ID\s*\|\|\s*!process\.env\.LAMATIC_API_KEY\)' "$FILE"
🤖 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 1 - 12, This
file has duplicate imports of Lamatic and two repeated, malformed environment
guards; remove the second "import { Lamatic } from \"lamatic\";" and the
duplicated if-block, leaving one proper import of Lamatic and one well-formed
guard that checks process.env.LAMATIC_API_URL, process.env.LAMATIC_PROJECT_ID
and process.env.LAMATIC_API_KEY and throws an Error with a clear message if any
are missing; also ensure the existing import of config (import {config} from
'../orchestrate.js') remains once and positioned before you use config or
Lamatic so module initialization parses correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@kits/agentic/code-review/config.json`:
- Around line 23-28: The step with id "code-review-flow" has the wrong envKey:
it's set to LAMATIC_API_KEY but should reference the workflow's environment
variable AGENTIC_GENERATE_CONTENT; update the "envKey" value for the
"code-review-flow" step in config.json to "AGENTIC_GENERATE_CONTENT" so the step
maps to the correct flow/workflow variable.

In `@kits/agentic/code-review/lib/lamatic-client.ts`:
- Around line 1-12: This file has duplicate imports of Lamatic and two repeated,
malformed environment guards; remove the second "import { Lamatic } from
\"lamatic\";" and the duplicated if-block, leaving one proper import of Lamatic
and one well-formed guard that checks process.env.LAMATIC_API_URL,
process.env.LAMATIC_PROJECT_ID and process.env.LAMATIC_API_KEY and throws an
Error with a clear message if any are missing; also ensure the existing import
of config (import {config} from '../orchestrate.js') remains once and positioned
before you use config or Lamatic so module initialization parses correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 95e02e53-079d-431a-945a-c1daf4cf1a3a

📥 Commits

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

📒 Files selected for processing (2)
  • kits/agentic/code-review/config.json
  • kits/agentic/code-review/lib/lamatic-client.ts

soumik15630m and others added 3 commits March 29, 2026 23:21
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 left a comment

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.

Actionable comments posted: 2

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

36-36: ⚠️ Potential issue | 🔴 Critical

Mission failure at runtime: wrong variable used for response parsing.

Line [36] reads from data, but the SDK response variable is resData (Line [33]). This throws ReferenceError and prevents all reviews from returning results.

Suggested fix
-    const answer = data?.data?.executeWorkflow?.result
+    const answer = resData?.data?.executeWorkflow?.result
🤖 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 36, The runtime
error is caused by reading from the undefined variable data instead of the SDK
response variable resData; update the parsing to use resData (e.g., replace
occurrences where answer is assigned from data?.data?.executeWorkflow?.result
with resData?.data?.executeWorkflow?.result) so the variable names match
(resData and answer) and prevent the ReferenceError in the function that
computes answer.
🤖 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 24-25: The code currently uses flow.workflowId from the config;
instead, before calling executeFlow resolve the workflow id from environment
variables at runtime: read process.env for a known key (for example a generic
FLOW_ID or a name-specific key like `${flow.name.toUpperCase()}_WORKFLOW_ID`),
validate the env value is present and non-empty, then pass that resolved string
to executeFlow (replace any use of flow.workflowId), and update the console log
to show the resolved env workflow id; refer to the existing symbols flow,
firstFlowKey, flows and the call site executeFlow when making this change.
- Around line 16-17: The code references an undefined variable config when
accessing config.flows and computing firstFlowKey; import or obtain the proper
configuration object and use it instead of the undefined symbol. Locate the
orchestrate module and either add the correct import (e.g., import { config }
from <module> or import { getConfig } and call getConfig()) or accept a config
parameter into the function that contains const flows = config.flows and compute
firstFlowKey from Object.keys(flows)[0]; ensure the chosen fix propagates the
config value to where flows and firstFlowKey are used (update function signature
or imports) so config is defined at runtime.

---

Duplicate comments:
In `@kits/agentic/code-review/actions/orchestrate.ts`:
- Line 36: The runtime error is caused by reading from the undefined variable
data instead of the SDK response variable resData; update the parsing to use
resData (e.g., replace occurrences where answer is assigned from
data?.data?.executeWorkflow?.result with resData?.data?.executeWorkflow?.result)
so the variable names match (resData and answer) and prevent the ReferenceError
in the function that computes answer.
🪄 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: 5efe0c7d-0bbe-4899-bcbf-49bdd8c46c9e

📥 Commits

Reviewing files that changed from the base of the PR and between 82b8178 and 382c7d7.

📒 Files selected for processing (1)
  • kits/agentic/code-review/actions/orchestrate.ts

Comment thread kits/agentic/code-review/actions/orchestrate.ts
Comment thread kits/agentic/code-review/actions/orchestrate.ts
Updated README.md to reflect correct node structure and project layout.
Updated the workflow ID retrieval to use an environment variable and added error handling for missing variables.
@soumik15630m

Copy link
Copy Markdown
Contributor Author

now all the issues are clear @amanintech @d-pamneja

@github-actions

Copy link
Copy Markdown
Contributor

Hi @soumik15630m! 👋

Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review.

Steps to follow:

  1. Read through all CodeRabbit comments carefully
  2. Address each issue raised (or reply explaining why you disagree)
  3. Push your fixes as new commits
  4. Once all issues are resolved, comment here so we can re-review

This helps keep the review process efficient for everyone. Thank you! 🙏

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.

In the live demo, it gives the error Request failed Lamatic request failed (400): ERROR in running Instructor Agent: '401 groq error: Invalid API Key' so you could fix that, rest looks good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's just api key issue - you can create your own api key and update env it will work ....
For me I intentionally I kept the expiry to 7 days that's why

@d-pamneja d-pamneja left a comment

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.

LGTM

@d-pamneja d-pamneja merged commit 817678b into Lamatic:main Mar 30, 2026
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.

4 participants