Skip to content

feat: Add prd-copilot kit#195

Open
Mahajan-Sachin wants to merge 3 commits into
Lamatic:mainfrom
Mahajan-Sachin:main
Open

feat: Add prd-copilot kit#195
Mahajan-Sachin wants to merge 3 commits into
Lamatic:mainfrom
Mahajan-Sachin:main

Conversation

@Mahajan-Sachin

@Mahajan-Sachin Mahajan-Sachin commented Jul 8, 2026

Copy link
Copy Markdown

Description

This Pull Request introduces the PRD Copilot Kit to AgentKit. The PRD Copilot is an agentic tool that automates the generation of detailed Product Requirements Documents (PRDs) and visual application flowcharts from raw user ideas, incorporating interactive clarifying questions.

Key Features:

  • Intake & Clarification Routing: Implements low-code serverless orchestration inside Lamatic Studio with dynamic routing (mode: draft vs mode: refine).
  • Interactive Questionnaire Step: Gathers custom clarifying questions generated by the LLM in real-time, allowing users to specify exact requirements.
  • Dynamic Chart Compiler: Integrates a client-side Mermaid.js renderer to compile and display complex user flows visually in dark-mode glassmorphic layouts.
  • TypeScript & Next.js Build-ready: Completely verified locally with all lints, dependencies, and gitignores properly configured.

PR Checklist

1. Select Contribution Type

  • Kit (kits/<category>/<kit-name>/)
  • Bundle (bundles/<bundle-name>/)
  • Template (templates/<template-name>/)

2. General Requirements

  • PR is for one project only (no unrelated changes)
  • No secrets, API keys, or real credentials are committed
  • Folder name uses kebab-case and matches the flow ID
  • All changes are documented in README.md (purpose, setup, usage)

3. File Structure (Check what applies)

  • lamatic.config.ts present with valid metadata (name, description, tags, steps, author, env keys)
  • .env.example with placeholder values only (kits only)
  • No hand‑edited flow config node graphs

4. Validation

  • npm install && npm run dev works locally (kits: UI runs; bundles/templates: flows are valid)
  • PR title is clear (e.g., feat: Add prd-copilot kit)
  • No unrelated files or projects are modified
  • Added a new PRD Copilot kit with setup/docs: kits/prd-copilot/README.md, kits/prd-copilot/agent.md, kits/prd-copilot/lamatic.config.ts, .env.example files, and constitutions/default.md.
  • Added the kit app scaffold in kits/prd-copilot/apps/, including Next.js config, TypeScript config, PostCSS config, package metadata, .gitignore, shadcn config, global styles, root layout, and the main page.
  • Added orchestration/runtime code in kits/prd-copilot/apps/actions/orchestrate.ts, apps/orchestrate.ts, and apps/lib/lamatic-client.ts to call the Lamatic flow and parse draft/refine responses.
  • Added the Mermaid renderer component kits/prd-copilot/apps/components/MermaidDiagram.tsx for visualizing generated flowcharts.
  • Added the flow definition stub kits/prd-copilot/flows/prd-copilot.ts.
  • The flow is currently a placeholder export with meta, empty inputs, a constitution reference, and empty nodes/edges; no node types are defined yet in the checked-in flow file.
  • High level, the kit is designed to take a raw product idea, generate a draft PRD plus clarifying questions, then refine the PRD from answers and optionally render a Mermaid flowchart in the app.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR introduces a new "PRD Copilot" kit under kits/prd-copilot: agent and flow documentation, a default constitution, a Lamatic orchestration server action and client, and a full Next.js app scaffold (layout, styling, config, dependencies) with a Mermaid-rendering PRD workflow UI.

Changes

PRD Copilot Kit

Layer / File(s) Summary
Agent, flow, and constitution definitions
kits/prd-copilot/agent.md, kits/prd-copilot/flows/prd-copilot.ts, kits/prd-copilot/lamatic.config.ts, kits/prd-copilot/constitutions/default.md, kits/prd-copilot/README.md
Documents the draft/refine agent flow, GraphQL input schema, and output contract; defines a placeholder flow module, kit config, safety constitution, and setup README.
Server-side orchestration and flow config
kits/prd-copilot/apps/actions/orchestrate.ts, kits/prd-copilot/apps/lib/lamatic-client.ts, kits/prd-copilot/apps/orchestrate.ts, kits/prd-copilot/apps/.env.example, kits/prd-copilot/.env.example
Implements orchestratePRD/parseLLMResponse to call the Lamatic prd-copilot flow, validates required env vars for the Lamatic client, and defines flow/API config typings with environment templates.
Next.js client page and Mermaid rendering
kits/prd-copilot/apps/app/page.tsx, kits/prd-copilot/apps/components/MermaidDiagram.tsx
Implements the 3-step draft→questions→result PRD workflow UI with clipboard/download actions, and a client Mermaid rendering component with fence stripping and error handling.
Next.js app scaffolding and styling
kits/prd-copilot/apps/app/layout.tsx, kits/prd-copilot/apps/app/globals.css, kits/prd-copilot/apps/components.json, kits/prd-copilot/apps/postcss.config.mjs, kits/prd-copilot/apps/tsconfig.json, kits/prd-copilot/apps/package.json, kits/prd-copilot/apps/next.config.mjs, kits/prd-copilot/apps/.gitignore
Adds root layout with metadata/analytics, Tailwind theme tokens and dark mode variables, Shadcn/PostCSS/TypeScript/Next configuration, package dependencies, and gitignore rules.

Suggested reviewers: amanintech, d-pamneja

Your mission, should you choose to accept it: review this PRD Copilot kit before it self-destructs in five seconds. Good luck.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the new PRD Copilot kit and matches the main change.
Description check ✅ Passed The description follows the template and includes the required PR checklist items with kit scope, docs, env placeholders, and validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.1)
kits/prd-copilot/apps/app/globals.css

File contains syntax errors that prevent linting: Line 4: Tailwind-specific syntax is disabled.; Line 77: Tailwind-specific syntax is disabled.; Line 120: Tailwind-specific syntax is disabled.; Line 123: Tailwind-specific syntax is disabled.


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.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/prd-copilot

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/prd-copilot/apps/actions/orchestrate.ts`:
- Line 92: The logging in orchestrate.ts is exposing the full Lamatic response
payload via JSON.stringify(resData), which can leak user ideas, answers, and
generated PRDs. Update the console.log in orchestrate flow handling to log only
a minimal non-sensitive summary or metadata (for example, status or identifiers)
instead of the raw payload, and keep the rest of the response out of logs.

In `@kits/prd-copilot/apps/app/layout.tsx`:
- Around line 6-7: The Geist and Geist Mono fonts are created in layout.tsx but
never applied, so their generated font-face values won’t be used. Update the
layout component to attach the appropriate font className/variable from _geist
and _geistMono to the root DOM element (typically body), and then change
globals.css to reference those font variables instead of the literal Geist
family name. Make sure the fix is centered around the existing Geist and
Geist_Mono declarations in layout.tsx and the font-sans / font-mono settings in
globals.css.
- Around line 9-13: Update the metadata in layout.tsx so the exported metadata
for the app uses PRD Copilot branding instead of the default v0 template values.
In the metadata object, change the title, description, and generator fields in
the metadata export to match the PRD Copilot kit identity, keeping the rest of
the metadata structure intact.

In `@kits/prd-copilot/apps/app/page.tsx`:
- Around line 252-268: The clarifying questions form in the page component is
still using raw inputs with manual answer state, so replace that form handling
with react-hook-form and zod in the questions section. Update the form logic
around the questions rendering to use a schema-based resolver, register each
question field through the form API, and move the existing
handleAnswerChange/answers state flow to react-hook-form-managed values while
keeping the current UI and validation behavior compatible with React 19.

In `@kits/prd-copilot/apps/components/MermaidDiagram.tsx`:
- Around line 17-29: The Mermaid initialization in MermaidDiagram is using a
permissive security setting that can allow unsafe HTML through diagram labels.
Update the mermaid.initialize call to use strict sanitization by changing the
securityLevel setting from loose to strict while keeping the existing theme and
themeVariables configuration intact.

In `@kits/prd-copilot/apps/next.config.mjs`:
- Around line 3-5: Remove the TypeScript build override from next.config.mjs by
updating the Next.js config object so it no longer sets ignoreBuildErrors inside
the typescript block. Keep the rest of the configuration, including
images.unoptimized, unchanged, and make sure the exported config from the
Next.js settings enforces type checking during builds.

In `@kits/prd-copilot/apps/orchestrate.js`:
- Around line 1-27: Convert the orchestrate config from the current JavaScript
module to a TypeScript module so the exported shape is typed instead of inferred
as any. Define explicit interfaces/types for the config object and the nested
flow entry used by config.flows["prd-copilot"], then export config with that
type so consumers like lamatic-client.ts and orchestrate.ts get compile-time
checking for fields such as workflowId, expectedOutput, and api properties.
Update the module name/imports accordingly so the typed config remains the
single source of truth and catches drift or typos in the orchestrate contract.

In `@kits/prd-copilot/apps/package.json`:
- Line 46: Remove the redundant Tailwind v3-era dependencies from the package
manifest: drop autoprefixer and tailwindcss-animate from the apps package so
Tailwind CSS v4 relies on its built-in Lightning CSS prefixing and the existing
tw-animate-css plugin instead. Update the dependency list in the package.json
used by the app, keeping only the v4-compatible animation package, and make sure
no build/config files still reference autoprefixer or tailwindcss-animate after
the cleanup.
- Line 53: The dependency list in package.json still pins lamatic to latest, and
react-markdown should be fixed too; replace both with explicit version numbers
instead of floating tags so installs are reproducible. Update the dependencies
entries for lamatic and react-markdown together, keeping the rest of the package
manifest unchanged.

In `@kits/prd-copilot/apps/tsconfig.json`:
- Line 9: The TypeScript compiler target in the main tsconfig is too old for the
Next.js 16 / React 19 setup, so update the tsconfig `target` setting from ES6 to
ES2017 or higher. Use the existing `target` entry in the tsconfig file and keep
the rest of the compiler options unchanged unless needed, so type checking can
recognize modern built-ins like `Object.entries` and async/await without extra
lib tweaks.
🪄 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: 6425f034-fb84-4622-b9b4-3c79763c3e2b

📥 Commits

Reviewing files that changed from the base of the PR and between dafde4c and 06cd231.

⛔ Files ignored due to path filters (1)
  • kits/prd-copilot/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • kits/prd-copilot/README.md
  • kits/prd-copilot/agent.md
  • kits/prd-copilot/apps/.env.example
  • kits/prd-copilot/apps/.gitignore
  • kits/prd-copilot/apps/actions/orchestrate.ts
  • kits/prd-copilot/apps/app/globals.css
  • kits/prd-copilot/apps/app/layout.tsx
  • kits/prd-copilot/apps/app/page.tsx
  • kits/prd-copilot/apps/components.json
  • kits/prd-copilot/apps/components/MermaidDiagram.tsx
  • kits/prd-copilot/apps/lib/lamatic-client.ts
  • kits/prd-copilot/apps/next.config.mjs
  • kits/prd-copilot/apps/orchestrate.js
  • kits/prd-copilot/apps/package.json
  • kits/prd-copilot/apps/postcss.config.mjs
  • kits/prd-copilot/apps/tsconfig.json
  • kits/prd-copilot/constitutions/default.md
  • kits/prd-copilot/flows/prd-copilot.ts
  • kits/prd-copilot/lamatic.config.ts

Comment thread kits/prd-copilot/apps/actions/orchestrate.ts Outdated
Comment thread kits/prd-copilot/apps/app/layout.tsx Outdated
Comment on lines +6 to +7
const _geist = Geist({ subsets: ["latin"] });
const _geistMono = Geist_Mono({ subsets: ["latin"] });

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fonts declared but never applied — Geist fonts won't load.

The _geist and _geistMono variables are created but their .className or .variable properties are never applied to the DOM. In Next.js, next/font/google generates @font-face declarations with hashed font-family names (e.g., __Geist_hash), not the literal 'Geist'. The --font-sans: 'Geist' reference in globals.css won't match, so the app silently falls back to system fonts.

Apply the font CSS variables to <body> and update globals.css to reference them.

🔧 Proposed fix

In layout.tsx:

-const _geist = Geist({ subsets: ["latin"] });
-const _geistMono = Geist_Mono({ subsets: ["latin"] });
+const geist = Geist({ subsets: ["latin"], variable: "--font-geist" });
+const geistMono = Geist_Mono({ subsets: ["latin"], variable: "--font-geist-mono" });
-      <body className={`font-sans antialiased`}>
+      <body className={`${geist.variable} ${geistMono.variable} font-sans antialiased`}>

In globals.css (lines 78-79):

-  --font-sans: 'Geist', 'Geist Fallback';
-  --font-mono: 'Geist Mono', 'Geist Mono Fallback';
+  --font-sans: var(--font-geist), 'Geist Fallback';
+  --font-mono: var(--font-geist-mono), 'Geist Mono Fallback';

Also applies to: 39-39

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/prd-copilot/apps/app/layout.tsx` around lines 6 - 7, The Geist and Geist
Mono fonts are created in layout.tsx but never applied, so their generated
font-face values won’t be used. Update the layout component to attach the
appropriate font className/variable from _geist and _geistMono to the root DOM
element (typically body), and then change globals.css to reference those font
variables instead of the literal Geist family name. Make sure the fix is
centered around the existing Geist and Geist_Mono declarations in layout.tsx and
the font-sans / font-mono settings in globals.css.

Comment thread kits/prd-copilot/apps/app/layout.tsx
Comment on lines +252 to +268
<div className="space-y-6">
{questions.map((q, index) => (
<div key={index} className="space-y-2">
<label className="text-sm font-medium text-slate-200 flex items-start space-x-2">
<ChevronRight className="h-4 w-4 mt-0.5 text-blue-500 shrink-0" />
<span>{q}</span>
</label>
<input
type="text"
value={answers[index] || ""}
onChange={(e) => handleAnswerChange(index, e.target.value)}
placeholder="Your answer..."
className="w-full rounded-xl border border-slate-800 bg-slate-950/60 p-3 text-sm text-slate-100 placeholder:text-slate-700 focus:border-blue-500/50 focus:outline-none transition"
/>
</div>
))}
</div>

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.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use react-hook-form + zod for the questions form per coding guidelines.

The clarifying questions form uses raw <input> elements with manual state management. The kit coding guidelines require react-hook-form + zod for forms. While the current implementation works, migrating would add validation, cleaner state handling, and guideline compliance.

Based on learnings, the platform standard is Next.js 16.0.0 and React 19.2.0, so ensure any react-hook-form usage is compatible with React 19. As per coding guidelines, kit Next.js apps must use react-hook-form + zod for forms.

♻️ Suggested refactor for the questions form
+import { useForm } from "react-hook-form";
+import { z } from "zod";

+const answersSchema = z.object({
+  answers: z.array(z.string().default("")),
+});

 // Inside component:
+const { register, handleSubmit, watch } = useForm({
+  defaultValues: { answers: new Array(questions.length).fill("") },
+});

 // Replace the manual input mapping:
-<input
-  type="text"
-  value={answers[index] || ""}
-  onChange={(e) => handleAnswerChange(index, e.target.value)}
-  placeholder="Your answer..."
-  className="..."
-/>
+<input
+  type="text"
+  {...register(`answers.${index}`)}
+  placeholder="Your answer..."
+  className="..."
+/>

 // Replace handleFinalizePRD call:
-<button onClick={handleFinalizePRD} ...>
+<button onClick={handleSubmit((data) => handleFinalizePRD(data.answers))} ...>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/prd-copilot/apps/app/page.tsx` around lines 252 - 268, The clarifying
questions form in the page component is still using raw inputs with manual
answer state, so replace that form handling with react-hook-form and zod in the
questions section. Update the form logic around the questions rendering to use a
schema-based resolver, register each question field through the form API, and
move the existing handleAnswerChange/answers state flow to
react-hook-form-managed values while keeping the current UI and validation
behavior compatible with React 19.

Sources: Coding guidelines, Learnings

Comment thread kits/prd-copilot/apps/components/MermaidDiagram.tsx
Comment thread kits/prd-copilot/apps/next.config.mjs Outdated
Comment thread kits/prd-copilot/apps/orchestrate.js Outdated
Comment on lines +1 to +27
export const config = {
"type": "atomic",
"flows": {
"prd-copilot": {
"name": "PRD Copilot",
"type": "graphQL",
"workflowId": process.env.PRD_COPILOT_FLOW_ID,
"description": "Draft and refine a Product Requirement Document (PRD) and generate a Mermaid flowchart",
"expectedOutput": ["answer"],
"inputSchema": {
"mode": "string",
"instructions": "string",
"answers": "string"
},
"outputSchema": {
"answer": "string"
},
"mode": "sync",
"polling": "false"
}
},
"api": {
"endpoint": process.env.LAMATIC_API_URL,
"projectId": process.env.LAMATIC_PROJECT_ID,
"apiKey": process.env.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.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider converting orchestrate.js to TypeScript for type safety.

This .js config is imported by .ts files (lamatic-client.ts, orchestrate.ts). With allowJs: true, TypeScript infers any for the export, so config.flows, config.api, and field names like workflowId are untyped. Converting to orchestrate.ts with an explicit interface would catch typos and contract drift at compile time.

♻️ Proposed TypeScript version
export interface FlowConfig {
  name: string;
  type: string;
  workflowId: string | undefined;
  description: string;
  expectedOutput: string[];
  inputSchema: Record<string, string>;
  outputSchema: Record<string, string>;
  mode: string;
  polling: boolean;
}

export interface AppConfig {
  type: string;
  flows: Record<string, FlowConfig>;
  api: {
    endpoint: string | undefined;
    projectId: string | undefined;
    apiKey: string | undefined;
  };
}

export const config: AppConfig = {
  type: "atomic",
  flows: {
    "prd-copilot": {
      name: "PRD Copilot",
      type: "graphQL",
      workflowId: process.env.PRD_COPILOT_FLOW_ID,
      description: "Draft and refine a Product Requirement Document (PRD) and generate a Mermaid flowchart",
      expectedOutput: ["answer"],
      inputSchema: { mode: "string", instructions: "string", answers: "string" },
      outputSchema: { answer: "string" },
      mode: "sync",
      polling: false,
    },
  },
  api: {
    endpoint: process.env.LAMATIC_API_URL,
    projectId: process.env.LAMATIC_PROJECT_ID,
    apiKey: process.env.LAMATIC_API_KEY,
  },
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/prd-copilot/apps/orchestrate.js` around lines 1 - 27, Convert the
orchestrate config from the current JavaScript module to a TypeScript module so
the exported shape is typed instead of inferred as any. Define explicit
interfaces/types for the config object and the nested flow entry used by
config.flows["prd-copilot"], then export config with that type so consumers like
lamatic-client.ts and orchestrate.ts get compile-time checking for fields such
as workflowId, expectedOutput, and api properties. Update the module
name/imports accordingly so the typed config remains the single source of truth
and catches drift or typos in the orchestrate contract.

Comment thread kits/prd-copilot/apps/package.json Outdated
Comment thread kits/prd-copilot/apps/package.json Outdated
Comment thread kits/prd-copilot/apps/tsconfig.json Outdated
@Mahajan-Sachin

Copy link
Copy Markdown
Author

@coderabbitai Please re-review the pull request. We have addressed all your review feedback in the latest commits:

  1. Security / Privacy: Replaced sensitive raw logs in orchestrate.ts with minimal execution status logging.
  2. Mermaid Sanitization: Switched securityLevel to "strict" in MermaidDiagram.tsx to secure SVG rendering.
  3. Fonts & Metadata: Removed next/font/google loader to bypass Turbopack font compilation issues, replaced it with system font stacks in globals.css, and updated metadata branding to reflect PRD Copilot.
  4. TypeScript Migration: Converted orchestrate.js config to a typed orchestrate.ts module with explicit interfaces.
  5. Dependencies: Pinned lamatic (0.3.2) and react-markdown (10.1.0) to their exact resolved versions, and cleaned up redundant Tailwind v3 packages (autoprefixer and tailwindcss-animate).
  6. Strict Types: Cast resData as any in orchestrate.ts to satisfy compiler checks for LamaticResponse.

Please verify these fixes and update the PR status accordingly. Thanks!

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
cd /tmp 2>/dev/null || true

# Check orchestrate.ts logging
echo "=== orchestrate.ts ==="
fd orchestrate.ts kits/prd-copilot || true
cat kits/prd-copilot/apps/actions/orchestrate.ts 2>/dev/null || true

echo "=== orchestrate.ts (root, formerly .js) ==="
cat kits/prd-copilot/apps/orchestrate.ts 2>/dev/null || echo "not found"
fd 'orchestrate.js' kits/prd-copilot || echo "orchestrate.js not found"

echo "=== MermaidDiagram.tsx ==="
cat kits/prd-copilot/apps/components/MermaidDiagram.tsx 2>/dev/null

echo "=== layout.tsx ==="
cat kits/prd-copilot/apps/app/layout.tsx 2>/dev/null

echo "=== globals.css ==="
cat kits/prd-copilot/apps/app/globals.css 2>/dev/null

echo "=== package.json ==="
cat kits/prd-copilot/apps/package.json 2>/dev/null

Length of output: 1418


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pwd
ls

echo "=== find kits ==="
fd -t d prd-copilot

echo "=== orchestrate files ==="
fd orchestrate kits/prd-copilot

Length of output: 569


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== actions/orchestrate.ts ==="
cat kits/prd-copilot/apps/actions/orchestrate.ts

echo "=== apps/orchestrate.ts ==="
cat kits/prd-copilot/apps/orchestrate.ts

echo "=== MermaidDiagram.tsx ==="
cat kits/prd-copilot/apps/components/MermaidDiagram.tsx

echo "=== layout.tsx ==="
cat kits/prd-copilot/apps/app/layout.tsx

echo "=== globals.css (head) ==="
sed -n '1,40p' kits/prd-copilot/apps/app/globals.css

echo "=== package.json ==="
cat kits/prd-copilot/apps/package.json

Length of output: 13517


@Mahajan-Sachin Your mission, should you choose to accept it, has already been accomplished. 🕶️ I've infiltrated the codebase and confirmed all six objectives:

  1. Security / Privacy ✅ — orchestrate.ts now logs only { mode, instructionsLength, answersLength } and resData?.status, no raw payloads or credentials in sight.
  2. Mermaid Sanitization ✅ — securityLevel: "strict" is set in MermaidDiagram.tsx's mermaid.initialize() call.
  3. Fonts & Metadata ✅ — layout.tsx no longer imports next/font/google; it uses font-sans antialiased, and metadata now reads "PRD Copilot - AgentKit".
  4. TypeScript Migration ✅ — orchestrate.js is now orchestrate.ts with explicit FlowConfig, ApiConfig, and KitConfig interfaces.
  5. Dependencies ✅ — lamatic pinned to 0.3.2, react-markdown pinned to 10.1.0, and no stray autoprefixer/tailwindcss-animate packages remain (only tw-animate-css for Tailwind v4).
  6. Strict Types ✅ — (resData as any)?.output?.answer cast is in place to satisfy the compiler on the fallback path.

This message will self-destruct... just kidding, but the mission is a success. Triggering a fresh review now to lock in the verification.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mahajan-Sachin

Copy link
Copy Markdown
Author

@coderabbitai Please verify if all review checks are now complete and resolved with the latest commits.

If everything is perfect and ready for merge, @amanintech / @d-pamneja (maintainers) please review and merge this pull request. Thank you!

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@Mahajan-Sachin Mission status: all clear. 🕶️ All six checkpoints from the previous debrief remain verified against the latest commits — security logging sanitized, Mermaid locked to strict mode, fonts/metadata cleaned up, TypeScript migration complete, dependencies pinned, and strict-type casts in place. No outstanding review flags from my side.

This tape will self-destruct in five seconds — but before it does: @amanintech @d-pamneja, the PR is green-lit from CodeRabbit's review and ready for your final human sign-off and merge decision.

Good luck, and godspeed. 🫡

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/prd-copilot/apps/actions/orchestrate.ts`:
- Line 95: The fallback in orchestrate.ts currently uses an unsafe as any cast
on the Lamatic response path, which bypasses type checking. Update the rawAnswer
assignment to use a precise type assertion for the alternate output.answer shape
instead of any, and keep the existing resData/result/answer access pattern
intact. Use the surrounding symbols rawAnswer and resData to locate the change.
🪄 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: a32b01d9-4d40-4eb8-a40f-84093c13cb6e

📥 Commits

Reviewing files that changed from the base of the PR and between 6c35a02 and 2ce313d.

📒 Files selected for processing (9)
  • kits/prd-copilot/apps/actions/orchestrate.ts
  • kits/prd-copilot/apps/app/globals.css
  • kits/prd-copilot/apps/app/layout.tsx
  • kits/prd-copilot/apps/components/MermaidDiagram.tsx
  • kits/prd-copilot/apps/lib/lamatic-client.ts
  • kits/prd-copilot/apps/next.config.mjs
  • kits/prd-copilot/apps/orchestrate.ts
  • kits/prd-copilot/apps/package.json
  • kits/prd-copilot/apps/tsconfig.json
💤 Files with no reviewable changes (1)
  • kits/prd-copilot/apps/next.config.mjs

console.log("[PRD Copilot] Flow execution completed. Status:", resData?.status);

// Lamatic SDK response mapping normally puts the output inside result?.answer
const rawAnswer = resData?.result?.answer || (resData as any)?.output?.answer;

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.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace as any with a precise type assertion.

The as any cast disables all type checking on the Lamatic response fallback path. A targeted type assertion preserves compile-time safety while accommodating the alternative output.answer shape.

♻️ Proposed refactor
-    const rawAnswer = resData?.result?.answer || (resData as any)?.output?.answer;
+    const rawAnswer = resData?.result?.answer || (resData as { output?: { answer?: string } })?.output?.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 rawAnswer = resData?.result?.answer || (resData as any)?.output?.answer;
const rawAnswer = resData?.result?.answer || (resData as { output?: { answer?: string } })?.output?.answer;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/prd-copilot/apps/actions/orchestrate.ts` at line 95, The fallback in
orchestrate.ts currently uses an unsafe as any cast on the Lamatic response
path, which bypasses type checking. Update the rawAnswer assignment to use a
precise type assertion for the alternate output.answer shape instead of any, and
keep the existing resData/result/answer access pattern intact. Use the
surrounding symbols rawAnswer and resData to locate the change.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Hi @Mahajan-Sachin! 👋

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! 🙏

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.

1 participant