feat: Add changelog-generator AgentKit #86
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a new Next.js kit "changelog-generator": app UI, Tailwind theme, reusable UI primitives, Lamatic flow export and orchestration code to run a Groq LLaMA-based changelog generation flow, plus docs, configs, and environment examples. Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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: 11
🧹 Nitpick comments (1)
kits/automation/changelog-generator/components/ui/select.tsx (1)
78-86: Remove dead code in Viewport className.Line 82 contains
position === "popper" && ""which is a no-op—it adds an empty string when the condition is true, having no effect on the rendered output. This appears to be leftover placeholder code.🧹 Proposed cleanup
<SelectPrimitive.Viewport data-position={position} - className={cn( - "data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)", - position === "popper" && "" - )} + className="data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)" >
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f1065c4-d11a-4669-9ad4-83277942160b
⛔ Files ignored due to path filters (7)
kits/automation/changelog-generator/app/favicon.icois excluded by!**/*.icokits/automation/changelog-generator/package-lock.jsonis excluded by!**/package-lock.jsonkits/automation/changelog-generator/public/file.svgis excluded by!**/*.svgkits/automation/changelog-generator/public/globe.svgis excluded by!**/*.svgkits/automation/changelog-generator/public/next.svgis excluded by!**/*.svgkits/automation/changelog-generator/public/vercel.svgis excluded by!**/*.svgkits/automation/changelog-generator/public/window.svgis excluded by!**/*.svg
📒 Files selected for processing (18)
kits/automation/changelog-generator/.gitignorekits/automation/changelog-generator/README.mdkits/automation/changelog-generator/actions/orchestrate.tskits/automation/changelog-generator/app/globals.csskits/automation/changelog-generator/app/layout.tsxkits/automation/changelog-generator/app/page.tsxkits/automation/changelog-generator/components.jsonkits/automation/changelog-generator/components/ui/button.tsxkits/automation/changelog-generator/components/ui/card.tsxkits/automation/changelog-generator/components/ui/select.tsxkits/automation/changelog-generator/components/ui/textarea.tsxkits/automation/changelog-generator/config.jsonkits/automation/changelog-generator/eslint.config.mjskits/automation/changelog-generator/lib/utils.tskits/automation/changelog-generator/next.config.tskits/automation/changelog-generator/package.jsonkits/automation/changelog-generator/postcss.config.mjskits/automation/changelog-generator/tsconfig.json
| ``` | ||
| changelog-generator/ | ||
| ├── app/ | ||
| │ └── page.tsx # Main UI | ||
| ├── actions/ | ||
| │ └── orchestrate.ts # Lamatic Flow API call | ||
| ├── flows/ | ||
| │ └── changelog-flow/ # Exported Lamatic flow files | ||
| ├── .env.example # Environment variables template | ||
| ├── config.json # Kit metadata | ||
| └── README.md | ||
| ``` |
There was a problem hiding this comment.
Add a language to the fenced structure block.
This block is currently tripping the markdownlint warning that was attached to the review. text is enough here.
📝 Suggested doc fix
-```
+```text
changelog-generator/
├── app/
│ └── page.tsx # Main UI
@@
├── config.json # Kit metadata
└── README.md</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **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.
```suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 83-83: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
kits/automation/changelog-generator/.env.example (1)
1-4: Add a trailing newline for POSIX compliance.Most text editors and POSIX tools expect files to end with a newline character.
📝 Suggested fix
LAMATIC_PROJECT_ENDPOINT=YOUR_API_ENDPOINT LAMATIC_FLOW_ID=YOUR_FLOW_ID LAMATIC_PROJECT_ID=YOUR_PROJECT_ID -LAMATIC_PROJECT_API_KEY=YOUR_API_KEY +LAMATIC_PROJECT_API_KEY=YOUR_API_KEY +kits/automation/changelog-generator/app/page.tsx (2)
126-139: Consider usinglucide-reacticons instead of inline SVGs.As per coding guidelines, kits should use
lucide-reactfor icons. The inline SVGs for the spinner, lightning bolt, checkmark, clipboard, and document icons could be replaced with their lucide equivalents (e.g.,Loader2,Zap,Check,Copy,FileText).♻️ Example replacement for the submit button icons
+"use client"; + +import { useState } from "react"; +import { generateChangelog } from "@/actions/orchestrate"; +import ReactMarkdown from "react-markdown"; +import { Loader2, Zap, Check, Copy, FileText } from "lucide-react"; ... <button type="submit" disabled={isLoading} className="..."> {isLoading ? ( <> - <svg className="animate-spin w-4 h-4" viewBox="0 0 24 24" fill="none"> - <circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" /> - <path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8z" /> - </svg> + <Loader2 className="animate-spin w-4 h-4" /> Generating... </> ) : ( <> - <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}> - <path strokeLinecap="round" strokeLinejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" /> - </svg> + <Zap className="w-4 h-4" /> Generate Changelog </> )} </button>As per coding guidelines: "Use lucide-react for icons throughout kits".
35-41: Consider handling clipboard API failures.
navigator.clipboard.writeText()can fail in non-secure contexts or when permissions are denied. Wrapping it in a try-catch would prevent silent failures.🛡️ Suggested fix
const handleCopy = () => { if (result) { - navigator.clipboard.writeText(result); - setCopied(true); - setTimeout(() => setCopied(false), 2000); + navigator.clipboard.writeText(result) + .then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }) + .catch(() => { + setError("Failed to copy to clipboard"); + }); } };kits/automation/changelog-generator/actions/orchestrate.ts (1)
5-16: Consider lazy initialization to improve error diagnostics.The Lamatic client is created at module load time (line 16). If env vars are missing, the error is thrown during server startup rather than when the action is invoked, which can make debugging harder in serverless environments.
♻️ Lazy initialization pattern
-const lamaticClient = createLamaticClient(); +let lamaticClient: Lamatic | null = null; + +function getLamaticClient() { + if (!lamaticClient) { + lamaticClient = createLamaticClient(); + } + return lamaticClient; +} export async function generateChangelog({ ... }: ChangelogInput): Promise<string> { ... - const response = await lamaticClient.executeFlow(flowId, { + const response = await getLamaticClient().executeFlow(flowId, {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d444bb34-e03b-4eff-bf85-1a4918bb5ace
📒 Files selected for processing (7)
kits/automation/changelog-generator/.env.examplekits/automation/changelog-generator/.gitignorekits/automation/changelog-generator/README.mdkits/automation/changelog-generator/actions/orchestrate.tskits/automation/changelog-generator/app/globals.csskits/automation/changelog-generator/app/layout.tsxkits/automation/changelog-generator/app/page.tsx
✅ Files skipped from review due to trivial changes (1)
- kits/automation/changelog-generator/.gitignore
🚧 Files skipped from review as they are similar to previous changes (1)
- kits/automation/changelog-generator/app/layout.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
kits/automation/changelog-generator/actions/orchestrate.ts (1)
52-57: Consider adding fallbacks forrequestIdextraction.Other kits (e.g.,
embed/sheets) use a fallback chain likeresponse?.result?.requestId || response?.requestId || response?.idto handle API response variations. If Lamatic's response structure can vary, a single-point extraction may miss valid async responses.♻️ Optional improvement
// Handle async flow (returns requestId) - if (response?.result?.requestId) { + const requestId = response?.result?.requestId || response?.requestId; + if (requestId) { const finalResult = await lamaticClient.checkStatus( - response.result.requestId, + requestId, 5, 120 ) as any;
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f24cf9f9-b8c8-4a4a-b0e6-c54d651ea1c5
📒 Files selected for processing (2)
kits/automation/changelog-generator/README.mdkits/automation/changelog-generator/actions/orchestrate.ts
| const parsedRepoUrl = new URL(repoUrl); | ||
| const [owner, repo] = parsedRepoUrl.pathname.split("/").filter(Boolean); | ||
| if (parsedRepoUrl.hostname !== "github.com" || !owner || !repo) { | ||
| throw new Error("repoUrl must be a valid GitHub repository URL"); | ||
| } |
There was a problem hiding this comment.
Wrap URL parsing in try-catch to return a friendly error.
new URL(repoUrl) throws a TypeError if repoUrl is not a valid URL. This surfaces as an opaque server error instead of the descriptive message on line 32.
🛡️ Suggested fix
- const parsedRepoUrl = new URL(repoUrl);
- const [owner, repo] = parsedRepoUrl.pathname.split("/").filter(Boolean);
- if (parsedRepoUrl.hostname !== "github.com" || !owner || !repo) {
+ let parsedRepoUrl: URL;
+ try {
+ parsedRepoUrl = new URL(repoUrl);
+ } catch {
+ throw new Error("repoUrl must be a valid GitHub repository URL");
+ }
+ const [owner, repo] = parsedRepoUrl.pathname.split("/").filter(Boolean);
+ if (parsedRepoUrl.hostname !== "github.com" || !owner || !repo) {
throw new Error("repoUrl must be a valid GitHub repository URL");
}There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/automation/changelog-generator/flows/changelog-flow/config.json`:
- Around line 35-46: The prompt in config.json asks LLMNode_549 to generate a
changelog without any repo data, enabling hallucinations; add a GitHub data
retrieval node (e.g., a GitHub API node) placed before LLMNode_549 that fetches
structured activity (PRs with titles/authors/merge dates, commit messages, and
release notes) for the requested date range, then update the LLMNode_549 prompt
to consume those structured outputs (for example use placeholders like
{{GitHubNode.output.prs}}, {{GitHubNode.output.commits}},
{{GitHubNode.output.releases}}) and validate empty results by instructing the
model to return “No changes found” when no data is present.
In `@kits/automation/changelog-generator/flows/changelog-flow/meta.json`:
- Around line 3-8: Populate the empty flow metadata fields in meta.json by
filling "description" with a concise summary of the changelog-generator flow and
its purpose, add relevant comma-separated "tags" for discoverability, provide a
representative "testInput" JSON example that exercises the flow, and set
"githubUrl", "documentationUrl", and "deployUrl" to the correct repository,
user-facing docs page, and deployment/installation link respectively so
automated cataloging and tests can validate the flow.
In `@kits/automation/changelog-generator/flows/changelog-flow/README.md`:
- Line 57: Replace the plain text "Check the Lamatic documentation at
docs.lamatic.ai" in the README entry with a clickable Markdown link by changing
it to the full URL in Markdown form (e.g.,
[https://docs.lamatic.ai](https://docs.lamatic.ai)); update the sentence so the
documentation reference becomes an actionable hyperlink for readers.
🪄 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: 6d97ea5b-f7f4-4dbc-817e-75302a82dd87
📒 Files selected for processing (4)
kits/automation/changelog-generator/flows/changelog-flow/README.mdkits/automation/changelog-generator/flows/changelog-flow/config.jsonkits/automation/changelog-generator/flows/changelog-flow/inputs.jsonkits/automation/changelog-generator/flows/changelog-flow/meta.json
| "tools": [], | ||
| "prompts": [ | ||
| { | ||
| "id": "187c2f4b-c23d-4545-abef-73dc897d6b7b", | ||
| "role": "system", | ||
| "content": "You are an expert developer assistant that generates professional, well-structured changelogs from GitHub repository information. You always format output in clean markdown with emoji section headers. You write clearly for both technical and non-technical audiences." | ||
| }, | ||
| { | ||
| "id": "187c2f4b-c23d-4545-abef-73dc897d6b7d", | ||
| "role": "user", | ||
| "content": "Generate a professional changelog for the following GitHub repository:\nRepository: {{triggerNode_1.output.repo_url}}\nFrom Date: {{triggerNode_1.output.date_from}}\nTo Date: {{triggerNode_1.output.date_to}}\nCreate a well-structured changelog in this exact format:\n## 📋 Summary\n(2-sentence plain English summary for non-technical stakeholders)\n## 🚀 New Features\n(list new features, or omit section if none)\n## 🐛 Bug Fixes\n(list bug fixes, or omit section if none)\n## 🔧 Improvements\n(list improvements/enhancements, or omit section if none)\n## ⚠️ Breaking Changes\n(list breaking changes, or omit section if none)\n## 📦 Dependencies\n(list dependency updates, or omit section if none)" | ||
| } |
There was a problem hiding this comment.
Mission-critical defect: changelog generation is ungrounded and can hallucinate.
Line [35] and Line [45] show the model is asked to generate a changelog without any fetched repo activity (commits/PRs/releases). This can produce fabricated release notes, which breaks the feature objective.
Add a GitHub data retrieval node before LLMNode_549 and pass structured results (PR titles, commit messages, release notes) into the prompt context.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@kits/automation/changelog-generator/flows/changelog-flow/config.json` around
lines 35 - 46, The prompt in config.json asks LLMNode_549 to generate a
changelog without any repo data, enabling hallucinations; add a GitHub data
retrieval node (e.g., a GitHub API node) placed before LLMNode_549 that fetches
structured activity (PRs with titles/authors/merge dates, commit messages, and
release notes) for the requested date range, then update the LLMNode_549 prompt
to consume those structured outputs (for example use placeholders like
{{GitHubNode.output.prs}}, {{GitHubNode.output.commits}},
{{GitHubNode.output.releases}}) and validate empty results by instructing the
model to return “No changes found” when no data is present.
kits/automation/changelog-generator/flows/changelog-flow/meta.json
Outdated
Show resolved
Hide resolved
kits/automation/changelog-generator/flows/changelog-flow/README.md
Outdated
Show resolved
Hide resolved
|
Hi @RoBWarrior! 👋 Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review. Steps to follow:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
|
Addressed all CodeRabbit review comments. Fixed meta.json metadata, updated README link, and clarified AI-generated nature of changelog in flow config. |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
kits/automation/changelog-generator/flows/changelog-flow/config.json (1)
45-45:⚠️ Potential issue | 🔴 CriticalMission-critical defect: changelog generation is intentionally ungrounded.
Line 45 instructs the model to produce a plausible changelog while explicitly saying repo activity was not fetched. That creates fabricated release notes and breaks trust in output correctness.
Proposed hardening path
- "content": "Generate a professional changelog ... generate a plausible AI-assisted changelog ... actual commit data was not fetched." + "content": "Generate a professional changelog from fetched repository activity only. + Repository: {{triggerNode_1.output.repo_url}} + From Date: {{triggerNode_1.output.date_from}} + To Date: {{triggerNode_1.output.date_to}} + PRs: {{GitHubActivityNode.output.prs}} + Commits: {{GitHubActivityNode.output.commits}} + Releases: {{GitHubActivityNode.output.releases}} + If activity inputs are empty, return exactly: 'No changes found for the selected date range.'"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@kits/automation/changelog-generator/flows/changelog-flow/config.json` at line 45, The prompt in the config.json "content" field currently asks the model to generate a "plausible" changelog without fetching real commits, which allows fabrication; update the prompt so the model only uses actual fetched data or explicitly returns an error if no data is available. Concretely, edit the "content" string used by the changelog flow to (a) remove the word "plausible" and the note that commit data was not fetched, (b) require using commit/PR data from the flow (e.g., use placeholders like {{triggerNode_1.output.commits}} or {{triggerNode_1.output.prs}} and instruct the model to base the changelog only on those items), and (c) add a fallback instruction to respond with a clear "No changelog: no commit/PR data available for the given range" message if the trigger outputs are empty; target the "content" field in config.json and the templating around triggerNode_1.output.*.
🤖 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/automation/changelog-generator/flows/changelog-flow/config.json`:
- Line 45: The prompt in the config.json "content" field currently asks the
model to generate a "plausible" changelog without fetching real commits, which
allows fabrication; update the prompt so the model only uses actual fetched data
or explicitly returns an error if no data is available. Concretely, edit the
"content" string used by the changelog flow to (a) remove the word "plausible"
and the note that commit data was not fetched, (b) require using commit/PR data
from the flow (e.g., use placeholders like {{triggerNode_1.output.commits}} or
{{triggerNode_1.output.prs}} and instruct the model to base the changelog only
on those items), and (c) add a fallback instruction to respond with a clear "No
changelog: no commit/PR data available for the given range" message if the
trigger outputs are empty; target the "content" field in config.json and the
templating around triggerNode_1.output.*.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 07e590a2-e373-41c2-a165-ae5694918a4a
📒 Files selected for processing (3)
kits/automation/changelog-generator/flows/changelog-flow/README.mdkits/automation/changelog-generator/flows/changelog-flow/config.jsonkits/automation/changelog-generator/flows/changelog-flow/meta.json
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
What This Kit Does
An AI-powered changelog generator that takes a GitHub repository URL and a date range, then produces a professional, well-structured changelog in seconds.
Providers & Prerequisites
How to Run Locally
cd kits/automation/changelog-generatornpm installcp .env.example .env.localand fill in valuesnpm run devLive Preview
https://agent-kit-sable.vercel.app/
Lamatic Flow
Flow ID:
4c3801ea-0353-4678-afc1-db47efd231eaChecklist
npm run dev.env.examplehas no secrets, only placeholdersREADME.mddocuments setup and usagekits/automation/changelog-generator/config.jsonis present and valid