Skip to content

feat: Add subsniffer kit — subscription audit agent#208

Open
SatyamSingh8306 wants to merge 6 commits into
Lamatic:mainfrom
SatyamSingh8306:feat/subsniffer
Open

feat: Add subsniffer kit — subscription audit agent#208
SatyamSingh8306 wants to merge 6 commits into
Lamatic:mainfrom
SatyamSingh8306:feat/subsniffer

Conversation

@SatyamSingh8306

@SatyamSingh8306 SatyamSingh8306 commented Jul 10, 2026

Copy link
Copy Markdown

PR Checklist

1. Select Contribution Type

  • Kit (kits/subsniffer/)
  • Bundle
  • Template

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 (subsniffer)
  • All changes are documented in README.md (purpose, setup, usage)

3. File Structure

Note: this repo uses the current AgentKit format (lamatic.config.ts + flows/<name>.ts),
not the legacy config.json + flows/<flow-name>/ layout this template originally described.

  • lamatic.config.ts present with valid metadata (name, description, tags, steps, author, env keys)
  • Flow exported as flows/subsniffer.ts (single .ts file, Lamatic Studio export format)
  • constitutions/default.md, agent.md, README.md present
  • .env.example with placeholder values only (kit root + apps/)
  • Flow graph matches the Lamatic Studio export format

4. Validation

  • npm install && npm run dev works locally (production build verified on Next 15.5.20)
  • PR title starts with feat: (required by the validation workflow)

not the legacy config.json + flows/<flow-name>/ layout this template originally described.

  • lamatic.config.ts present with valid metadata (name, description, tags, steps, author, env keys)
  • Flow exported as flows/subsniffer.ts (single .ts file, Lamatic Studio export format)
  • constitutions/default.md, agent.md, README.md present
  • .env.example with placeholder values only (kit root + apps/)
  • Flow graph matches the Lamatic Studio export format

4. Validation

  • npm install && npm run dev works locally (production build verified on Next 15.5.20)
  • PR title starts with feat: (required by the validation workflow)
  • GitHub Actions workflows pass (all checks green) — pending
  • All CodeRabbit / PR review comments addressed — pending
  • No unrelated files or projects modified
  • Added kits/subsniffer/ kit for “SubSniffer — Subscription Audit”:
    • kits/subsniffer/.env.example
    • kits/subsniffer/.gitignore
    • kits/subsniffer/README.md
    • kits/subsniffer/agent.md
    • kits/subsniffer/constitutions/default.md
    • kits/subsniffer/lamatic.config.ts
    • kits/subsniffer/flows/subsniffer.ts (flow definition/export)
    • kits/subsniffer/model-configs/
      • subsniffer_detect-subscriptions.ts
      • subsniffer_write-report.ts
    • kits/subsniffer/prompts/
      • subsniffer_detect-subscriptions_system.md
      • subsniffer_detect-subscriptions_user.md
      • subsniffer_write-report_system.md
      • subsniffer_write-report_user.md
  • Added Next.js app under kits/subsniffer/apps/:
    • kits/subsniffer/apps/.env.example
    • kits/subsniffer/apps/.gitignore
    • kits/subsniffer/apps/actions/orchestrate.ts (server action auditSubscriptions(); executes the Lamatic flow by SUBSNIFFER_FLOW_ID and normalizes the response)
    • kits/subsniffer/apps/app/globals.css
    • kits/subsniffer/apps/app/layout.tsx
    • kits/subsniffer/apps/app/page.tsx (client UI: input statement/goals → calls auditSubscriptions() → renders analysis + report)
    • kits/subsniffer/apps/components/header.tsx
    • kits/subsniffer/apps/components/ui/
      • badge.tsx
      • button.tsx
      • card.tsx
      • textarea.tsx
    • kits/subsniffer/apps/lib/lamatic-client.ts (cached SDK client; validates LAMATIC_* env vars at call time)
    • kits/subsniffer/apps/lib/utils.ts (cn Tailwind class merge helper)
    • kits/subsniffer/apps/next.config.mjs
    • kits/subsniffer/apps/package.json
    • kits/subsniffer/apps/postcss.config.mjs
    • kits/subsniffer/apps/tsconfig.json
  • Flow high-level behavior (kits/subsniffer/flows/subsniffer.ts; no flow.json present—node types defined directly in the TS flow export):
    • Purpose: parse a provided bank statement/transaction list, detect recurring subscriptions, compute totals/savings and surface recommendations + risk flags, then generate a plain-language savings/cancellation-style report.
    • How it works (node types introduced):
      • triggerNode (graphqlNode): GraphQL “API Request” trigger accepting statement (string) and goals (string).
      • dynamicNode (InstructorLLMNode_954): schema-constrained JSON “Detect Subscriptions” output containing summary, subscriptions[], totals, plus top_recommendations[] and risk_flags[] (with required fields including merchant, amount, cadence, category, usage, monthly_cost per subscription).
      • dynamicNode (LLMNode_456): “Write Report” LLM converts the structured analysis into user-facing generatedResponse (mapped to report).
      • responseNode (graphqlResponseNode): “API Response” returning JSON with:
        • analysis = {{InstructorLLMNode_954.output}}
        • report = {{LLMNode_456.output.generatedResponse}}
    • Edges: trigger → InstructorLLMNodeLLMNode → response, plus a responseEdge from trigger to response.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

Changes

SubSniffer adds a Lamatic subscription-audit flow, server-side execution, a Next.js interface for submitting statements and viewing results, deployment configuration, environment templates, and setup documentation.

SubSniffer audit flow

Layer / File(s) Summary
Audit flow and model contracts
kits/subsniffer/flows/subsniffer.ts, kits/subsniffer/prompts/*, kits/subsniffer/model-configs/*, kits/subsniffer/constitutions/default.md
Defines subscription detection, structured audit output, report generation, model settings, prompt templates, and assistant behavior rules.
Server execution and Lamatic client
kits/subsniffer/apps/lib/*, kits/subsniffer/apps/actions/orchestrate.ts, kits/subsniffer/.env.example, kits/subsniffer/apps/.env.example
Initializes a cached Lamatic client and executes the configured flow with normalized success and error responses.
Next.js audit interface
kits/subsniffer/apps/app/*, kits/subsniffer/apps/components/*, kits/subsniffer/apps/lib/utils.ts, kits/subsniffer/apps/package.json, kits/subsniffer/apps/next.config.mjs, kits/subsniffer/apps/postcss.config.mjs, kits/subsniffer/apps/tsconfig.json, kits/subsniffer/apps/.gitignore
Adds the application shell, reusable UI components, input form, loading and reset states, and result views for analysis reports.
Kit configuration and setup artifacts
kits/subsniffer/lamatic.config.ts, kits/subsniffer/README.md, kits/subsniffer/agent.md, kits/subsniffer/.gitignore
Adds kit metadata, deployment settings, local artifact exclusions, and documentation for setup, operation, and repository structure.

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 45.45% 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 Clear, relevant title that names the SubSniffer kit and its subscription audit purpose.
Description check ✅ Passed The checklist covers the required sections and mostly matches the repo's template, with only non-critical validation items still pending.
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

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

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/subsniffer

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

🤖 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/subsniffer/apps/actions/orchestrate.ts`:
- Around line 24-25: Update the response normalization in the orchestration
handler to accept only the expected `{ analysis, report }` shape from
`res?.result?.answer`, `res?.result`, or `res?.output`; remove the final raw
`res` fallback and throw a descriptive error when none of the known shapes
match.
- Around line 1-37: Update auditSubscriptions to import ../../lamatic.config and
use its step definitions when selecting or executing the Lamatic flow, instead
of reading SUBSNIFFER_FLOW_ID directly from process.env. Preserve the existing
client execution, response normalization, and error handling while ensuring the
imported configuration drives the flow identifier or definition.

In `@kits/subsniffer/apps/app/globals.css`:
- Around line 8-12: Replace the hardcoded colors in the body selector with CSS
custom properties, defining appropriate --background and --foreground variables
and referencing them via var(). Follow the existing variable conventions in
globals.css and ensure the body uses those variables for background and color.

In `@kits/subsniffer/apps/app/page.tsx`:
- Around line 72-99: Refactor the form containing run to use react-hook-form
with a zodResolver and a zod schema requiring a non-empty statement while
allowing optional goals; replace the statement/goals useState bindings with
register, handleSubmit, and formState errors, and preserve the existing
auditSubscriptions flow and loading/error handling. Add react-hook-form, zod,
and the required resolver dependency to package.json, and update the submit
handler and field error rendering accordingly.
- Around line 125-145: Add matching htmlFor and id attributes for the statement
and goals form controls: update the two labels and their corresponding Textarea
components in the page component, using unique, descriptive identifiers
consistently.
- Around line 259-268: Validate the LLM-provided cancellation_url before
rendering it as an href. Add a URL sanitizer helper that parses the value and
only returns URLs using http: or https: protocols, then update the cancellation
link block to use the sanitized result and render the link only when it is
valid.

In `@kits/subsniffer/apps/components/ui/badge.tsx`:
- Around line 4-17: Wrap the exported Badge component with React.forwardRef,
adding an HTMLSpanElement ref parameter and forwarding it to the rendered span
while preserving the existing className merging and props behavior; update the
component display name if needed for linting or debugging.

In `@kits/subsniffer/apps/components/ui/button.tsx`:
- Around line 6-22: Update the Button component to use React.forwardRef, adding
an HTMLButtonElement ref parameter and passing it to the underlying button
element while preserving the existing props, variant handling, and styling;
assign an appropriate display name if needed for debugging.

In `@kits/subsniffer/apps/components/ui/textarea.tsx`:
- Around line 4-16: The Textarea component does not forward refs, preventing
react-hook-form registration and programmatic focus. Refactor Textarea to use
React.forwardRef<HTMLTextAreaElement,
React.TextareaHTMLAttributes<HTMLTextAreaElement>>, accept a ref parameter, and
pass it to the underlying textarea while preserving existing className handling
and props.

In `@kits/subsniffer/apps/lib/lamatic-client.ts`:
- Line 5: Replace the any-typed client variable with the Lamatic SDK client
type, preserving its nullable initial state. Update the declaration of client in
the lamatic client module and ensure the exported client used by orchestrate’s
executeFlow call remains properly type-checked.

In `@kits/subsniffer/apps/next.config.mjs`:
- Around line 3-4: Remove the typescript.ignoreBuildErrors and
eslint.ignoreDuringBuilds overrides from the Next.js configuration so production
builds fail on type-checking or lint errors; update the surrounding
configuration without adding replacement suppression flags.

In `@kits/subsniffer/apps/package.json`:
- Line 13: Replace the floating "latest" version for the lamatic dependency in
package.json with the specific latest stable version available at merge time,
using an exact version or approved caret range to ensure reproducible dependency
resolution.

In `@kits/subsniffer/README.md`:
- Line 3: Add a blank line immediately after every Markdown section heading in
the README, including the headings at the referenced locations, while preserving
the existing content and structure.
- Around line 23-30: Specify the text language on all fenced code blocks in the
README, including the diagram, sample input, and repository tree fences. Update
the fences around the content near the diagram and the sections identified by
the diff so they use text.
- Around line 55-68: Add a prominent warning immediately before the paste
example in the SubSniffer README instructing users to redact account numbers,
names, addresses, transaction IDs, and other unnecessary PII, and note that the
submitted text is forwarded to Lamatic as-is.
🪄 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: 3ed95a96-6bee-4934-8a6f-f791def4a017

📥 Commits

Reviewing files that changed from the base of the PR and between dafde4c and 7384fed.

⛔ Files ignored due to path filters (1)
  • kits/subsniffer/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (30)
  • kits/subsniffer/.env.example
  • kits/subsniffer/.gitignore
  • kits/subsniffer/README.md
  • kits/subsniffer/agent.md
  • kits/subsniffer/apps/.env.example
  • kits/subsniffer/apps/.gitignore
  • kits/subsniffer/apps/actions/orchestrate.ts
  • kits/subsniffer/apps/app/globals.css
  • kits/subsniffer/apps/app/layout.tsx
  • kits/subsniffer/apps/app/page.tsx
  • kits/subsniffer/apps/components/header.tsx
  • kits/subsniffer/apps/components/ui/badge.tsx
  • kits/subsniffer/apps/components/ui/button.tsx
  • kits/subsniffer/apps/components/ui/card.tsx
  • kits/subsniffer/apps/components/ui/textarea.tsx
  • kits/subsniffer/apps/lib/lamatic-client.ts
  • kits/subsniffer/apps/lib/utils.ts
  • kits/subsniffer/apps/next.config.mjs
  • kits/subsniffer/apps/package.json
  • kits/subsniffer/apps/postcss.config.mjs
  • kits/subsniffer/apps/tsconfig.json
  • kits/subsniffer/constitutions/default.md
  • kits/subsniffer/flows/subsniffer.ts
  • kits/subsniffer/lamatic.config.ts
  • kits/subsniffer/model-configs/subsniffer_detect-subscriptions.ts
  • kits/subsniffer/model-configs/subsniffer_write-report.ts
  • kits/subsniffer/prompts/subsniffer_detect-subscriptions_system.md
  • kits/subsniffer/prompts/subsniffer_detect-subscriptions_user.md
  • kits/subsniffer/prompts/subsniffer_write-report_system.md
  • kits/subsniffer/prompts/subsniffer_write-report_user.md

Comment thread kits/subsniffer/apps/actions/orchestrate.ts
Comment thread kits/subsniffer/apps/actions/orchestrate.ts
Comment thread kits/subsniffer/apps/app/globals.css
Comment thread kits/subsniffer/apps/app/page.tsx
Comment thread kits/subsniffer/apps/app/page.tsx
Comment thread kits/subsniffer/apps/next.config.mjs
Comment thread kits/subsniffer/apps/package.json
Comment thread kits/subsniffer/README.md
Comment thread kits/subsniffer/README.md
Comment thread kits/subsniffer/README.md

@SatyamSingh8306 SatyamSingh8306 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

  • suggest changes are not mandatory

@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 (4)
kits/subsniffer/apps/lib/lamatic-client.ts (1)

5-5: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Agent, your client's cover identity is compromised — any typing blows the operation.

The cached client variable is still typed as any, which means client.executeFlow() in orchestrate.ts operates without type safety. The Lamatic SDK exports a Lamatic class — use Lamatic | null for the variable declaration so downstream calls remain type-checked.

This was flagged in a previous review and remains unresolved.

🔧 Proposed fix
-let client: any;
+let client: Lamatic | null;

Also applies to: 26-26

🤖 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/subsniffer/apps/lib/lamatic-client.ts` at line 5, Replace the any type
on the cached client variable with Lamatic | null, importing Lamatic from the
Lamatic SDK as needed, so client.executeFlow() remains type-checked downstream.

Source: Learnings

kits/subsniffer/apps/actions/orchestrate.ts (2)

16-16: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Missing ../../lamatic.config import — coding guideline violation persists.

The coding guideline for kits/*/apps/actions/orchestrate.ts requires importing and using ../../lamatic.config to read step definitions from the parent kit. This file still reads SUBSNIFFER_FLOW_ID directly from process.env without referencing the kit configuration. The kit's lamatic.config.ts contains the step definitions that should drive flow execution here.

As per coding guidelines, kits/*/apps/actions/orchestrate.ts: Kit Next.js apps must import and use ../../lamatic.config to read step definitions from the parent kit.

This was flagged in a previous review and remains unresolved.

🔧 Proposed fix
 "use server";
 
 import { getLamaticClient } from "`@/lib/lamatic-client`";
+import lamaticConfig from "../../lamatic.config";
 
 export async function auditSubscriptions(
   statement: string,
   goals?: string,
 ): Promise<{ success: boolean; data?: any; error?: string }> {
   try {
-    const flowId = process.env.SUBSNIFFER_FLOW_ID;
+    const flowStep = lamaticConfig.steps?.find((s) => s.id === "subsniffer");
+    const flowId = flowStep?.flowId ?? process.env.SUBSNIFFER_FLOW_ID;
     if (!flowId) {
       throw new Error(
-        "SUBSNIFFER_FLOW_ID is not set. Deploy the SubSniffer flow in Lamatic and add its id to apps/.env.local.",
+        "SubSniffer flow ID not found. Ensure lamatic.config.ts defines the step or set SUBSNIFFER_FLOW_ID in apps/.env.local.",
       );
     }
🤖 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/subsniffer/apps/actions/orchestrate.ts` at line 16, Update the
orchestration entrypoint to import the parent kit configuration from
../../lamatic.config and use its step definitions to determine the flow instead
of reading SUBSNIFFER_FLOW_ID directly from process.env; ensure the execution
logic references the imported configuration consistently.

Source: Coding guidelines


30-31: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Overly permissive response normalization — the raw res fallback is a liability.

The chain res?.result?.answer ?? res?.result ?? res?.output ?? res will return the entire raw response object as data when none of the expected fields exist. The downstream consumer in page.tsx (lines 83-112) expects { analysis, report } — passing the raw response would set analysis to the entire response object, producing a broken UI.

This was flagged in a previous review and remains unresolved.

🤖 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/subsniffer/apps/actions/orchestrate.ts` around lines 30 - 31, The
response normalization in orchestrate.ts is too permissive because it falls back
to the entire raw response. Update the normalization logic around data and the
downstream consumer in page.tsx to accept only the expected result fields, such
as result.answer, result, or output when they contain the required { analysis,
report } shape; otherwise return or handle an invalid/empty result explicitly
instead of passing res through.
kits/subsniffer/apps/components/ui/button.tsx (1)

10-27: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Agent, this component can't accept a ref — your cover is blown.

Button still doesn't forward refs, limiting consumers who need imperative access (focus management, scroll-into-view). Based on learnings, prefer React.forwardRef when exposing components to maintain backward compatibility expectations with React 18-style ref forwarding.

This was flagged in a previous review and remains unresolved.

Based on learnings: "For UI components, prefer React.forwardRef when exposing components to maintain backward compatibility expectations with React 18-style ref forwarding."

♻️ Proposed fix
-export function Button({
-  className,
-  variant = "default",
-  ...props
-}: React.ButtonHTMLAttributes<HTMLButtonElement> & { variant?: Variant }) {
-  return (
-    <button
-      className={cn(
-        "inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold shadow-sm transition focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:cursor-not-allowed disabled:opacity-60",
-        variant === "outline"
-          ? "border border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
-          : "bg-indigo-600 text-white hover:bg-indigo-500",
-        className,
-      )}
-      {...props}
-    />
-  );
-}
+export const Button = React.forwardRef<
+  HTMLButtonElement,
+  React.ButtonHTMLAttributes<HTMLButtonElement> & { variant?: Variant }
+>(function Button({ className, variant = "default", ...props }, ref) {
+  return (
+    <button
+      ref={ref}
+      className={cn(
+        "inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold shadow-sm transition focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:cursor-not-allowed disabled:opacity-60",
+        variant === "outline"
+          ? "border border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
+          : "bg-indigo-600 text-white hover:bg-indigo-500",
+        className,
+      )}
+      {...props}
+    />
+  );
+});
🤖 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/subsniffer/apps/components/ui/button.tsx` around lines 10 - 27, Button
does not forward refs to its underlying button element. Update the Button
component to use React.forwardRef, accept a React.Ref<HTMLButtonElement>
alongside its existing props, and pass that ref to the rendered button while
preserving the current variant, className, and prop behavior.

Source: Learnings

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

Duplicate comments:
In `@kits/subsniffer/apps/actions/orchestrate.ts`:
- Line 16: Update the orchestration entrypoint to import the parent kit
configuration from ../../lamatic.config and use its step definitions to
determine the flow instead of reading SUBSNIFFER_FLOW_ID directly from
process.env; ensure the execution logic references the imported configuration
consistently.
- Around line 30-31: The response normalization in orchestrate.ts is too
permissive because it falls back to the entire raw response. Update the
normalization logic around data and the downstream consumer in page.tsx to
accept only the expected result fields, such as result.answer, result, or output
when they contain the required { analysis, report } shape; otherwise return or
handle an invalid/empty result explicitly instead of passing res through.

In `@kits/subsniffer/apps/components/ui/button.tsx`:
- Around line 10-27: Button does not forward refs to its underlying button
element. Update the Button component to use React.forwardRef, accept a
React.Ref<HTMLButtonElement> alongside its existing props, and pass that ref to
the rendered button while preserving the current variant, className, and prop
behavior.

In `@kits/subsniffer/apps/lib/lamatic-client.ts`:
- Line 5: Replace the any type on the cached client variable with Lamatic |
null, importing Lamatic from the Lamatic SDK as needed, so client.executeFlow()
remains type-checked downstream.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: ebf67853-32e9-4028-be80-bf71c6f001d6

📥 Commits

Reviewing files that changed from the base of the PR and between 7384fed and 651a5e7.

📒 Files selected for processing (10)
  • kits/subsniffer/apps/actions/orchestrate.ts
  • kits/subsniffer/apps/app/layout.tsx
  • kits/subsniffer/apps/app/page.tsx
  • kits/subsniffer/apps/components/header.tsx
  • kits/subsniffer/apps/components/ui/badge.tsx
  • kits/subsniffer/apps/components/ui/button.tsx
  • kits/subsniffer/apps/components/ui/card.tsx
  • kits/subsniffer/apps/components/ui/textarea.tsx
  • kits/subsniffer/apps/lib/lamatic-client.ts
  • kits/subsniffer/apps/lib/utils.ts

@github-actions

Copy link
Copy Markdown
Contributor

Hi @SatyamSingh8306! 👋

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

@SatyamSingh8306 SatyamSingh8306 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

  • required changes are not mandatory (can be improved in iterative way)

- model-configs: leave model/credential empty so importing user picks any
  provider in their own Lamatic project (no hardcoded model, no leaked id)
- flows/subsniffer.ts: add meta.author for Studio registration
Studio's runtime validator reported 'config_json.nodes must be a non-empty
array' even though the .ts is syntactically valid and contains 4 nodes.
The large top-of-file block comment was the suspect (escaped quotes and
long multiline ASCII content inside a TS comment block). Replaced with a
short single-line comment. The full documentation lives in README.md and
agent.md.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/subsniffer/flows/subsniffer.ts (1)

132-133: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Schema required arrays omit fields the system prompt explicitly requests.

The detect-subscriptions system prompt instructs the model to output reason, cancellation_url (per subscription), top_recommendations, and risk_flags. However, the InstructorLLMNode schema only requires ["merchant", "amount", "cadence", "category", "usage", "monthly_cost"] at the item level and ["summary", "subscriptions", "totals"] at the top level. Since InstructorLLMNode enforces schema validation, the model may omit non-required fields, producing incomplete audit results with missing reasons, cancellation URLs, recommendations, and risk flags.

🔧 Proposed fix: add missing fields to schema `required` arrays
 "required": ["merchant", "amount", "cadence", "category", "usage", "monthly_cost"]
+ "required": ["merchant", "amount", "cadence", "category", "usage", "reason", "monthly_cost", "cancellation_url"]

And at the top level:

 "required": ["summary", "subscriptions", "totals"]
+ "required": ["summary", "subscriptions", "totals", "top_recommendations", "risk_flags"]
🤖 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/subsniffer/flows/subsniffer.ts` around lines 132 - 133, Update the JSON
schema used by the detect-subscriptions InstructorLLMNode so each subscription
item’s required array also includes reason and cancellation_url, and the
top-level required array includes top_recommendations and risk_flags. Keep these
entries aligned with the fields requested by the detect-subscriptions system
prompt.
🤖 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.

Outside diff comments:
In `@kits/subsniffer/flows/subsniffer.ts`:
- Around line 132-133: Update the JSON schema used by the detect-subscriptions
InstructorLLMNode so each subscription item’s required array also includes
reason and cancellation_url, and the top-level required array includes
top_recommendations and risk_flags. Keep these entries aligned with the fields
requested by the detect-subscriptions system prompt.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: fda51e77-4df5-4205-9d92-6a3614faa5ef

📥 Commits

Reviewing files that changed from the base of the PR and between 5dfcedf and 65db43a.

📒 Files selected for processing (1)
  • kits/subsniffer/flows/subsniffer.ts

- Rewrite flows/subsniffer.ts using the JSON-style exported format
  (double-quoted keys, meta.tags as array, matching the Studio export).
  The previous JS-literal key style prevented the Studio validator's
  config_json parser from extracting nodes, causing
  'config_json.nodes must be a non-empty array'.
- Drop deprecated baseUrl from apps/tsconfig.json (TypeScript 7.0
  warning). paths now resolves relative to tsconfig location.
- Gitignore apps/tsconfig.tsbuildinfo (TypeScript incremental cache).
- Update meta.author email to match the registered Lamatic account.

@SatyamSingh8306 SatyamSingh8306 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Non mandatory changes (Subsniffer can be improved interatively)

@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/subsniffer/flows/subsniffer.ts`:
- Around line 141-166: The edges array is missing the execution link from
triggerNode_1 to InstructorLLMNode_954. Add an edge connecting triggerNode_1 to
InstructorLLMNode_954 with the appropriate source/target handles and edge type,
so the flow executes through InstructorLLMNode_954 before LLMNode_456 and
responseNode_triggerNode_1.
🪄 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: 1524fe8e-7aeb-42b1-ba77-80645abce697

📥 Commits

Reviewing files that changed from the base of the PR and between 65db43a and 92057e9.

📒 Files selected for processing (4)
  • kits/subsniffer/apps/.gitignore
  • kits/subsniffer/apps/tsconfig.json
  • kits/subsniffer/flows/subsniffer.ts
  • kits/subsniffer/lamatic.config.ts
💤 Files with no reviewable changes (1)
  • kits/subsniffer/apps/tsconfig.json

Comment thread kits/subsniffer/flows/subsniffer.ts
CodeRabbit flagged: the API Request trigger was only wired to the
response node, leaving the detection stage un-reachable. Adds the
triggerNode_1 -> InstructorLLMNode_954 defaultEdge so the full
trigger -> detect -> write -> response chain executes.

@SatyamSingh8306 SatyamSingh8306 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed in upcoming version

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