Skip to content

feat: AI Debt Scanner + Launch Preview on Vercel#47

Draft
DealPatrol wants to merge 24 commits into
mainfrom
claude/fix-repofuse-issues-WjMks
Draft

feat: AI Debt Scanner + Launch Preview on Vercel#47
DealPatrol wants to merge 24 commits into
mainfrom
claude/fix-repofuse-issues-WjMks

Conversation

@DealPatrol
Copy link
Copy Markdown
Owner

@DealPatrol DealPatrol commented May 21, 2026

Summary

  • New /dashboard/debt-scanner page — AI-powered technical debt analysis across 6 categories (duplicate code, unused files, security risks, slow queries, outdated deps, quick wins) with severity badges and auto-fix via GitHub PR
  • Launch Preview on Vercel — after "Build This App" completes, a "Launch Preview on Vercel" button deploys the generated app: Claude fixes package.json deps → pushes to GitHub → creates Vercel project → deploys → returns live URL (~60–90s)
  • Credit system integration — debt scans cost 150 credits, deducted atomically

New files

  • app/api/debt-scan/route.ts — POST: auth → deduct credits → load repo metadata → Claude → DebtScanResult JSON
  • app/api/debt-fix/route.ts — SSE: fetch file from GitHub → Claude fix → branch + PR
  • app/api/launch-preview/route.ts — SSE (maxDuration=120): fix deps → push → create Vercel project → deploy → poll until live
  • components/debt-scanner-client.tsx — full UI with idle/scanning/results/error states, severity summary bar, category tabs, collapsible before/after diffs, auto-fix and copy-suggestion buttons
  • components/debt-fix-modal.tsx — SSE streaming modal (Fetching → Generating → Creating PR → Done)
  • components/launch-preview-modal.tsx — step-tracker modal with Vercel token input (6 steps: fetch → fix deps → push → create project → deploy → live)
  • app/dashboard/debt-scanner/page.tsx — server wrapper loading completed analyses

Modified files

  • lib/credits.tsDEBT_SCAN_COST: 150, 'debt_scan' added to type unions
  • lib/queries.ts — added 'scale' to Subscription.plan type (fixed pre-existing Stripe webhook type error)
  • components/billing-client.tsx — fixed onClick={handleUpgrade} handler type mismatch
  • components/dashboard-header.tsx — added "Debt Scanner" nav item
  • components/build-app-modal.tsx — "Launch Preview on Vercel" button in done state, opens LaunchPreviewModal with parsed owner/name from repo URL

Test plan

  • /dashboard/debt-scanner loads with analysis selector
  • Scan returns categorized issues with severity badges
  • 150 credits deducted per scan (check /dashboard/billing)
  • Category tabs filter correctly; before/after diffs expand inline
  • Auto-fix opens modal, streams progress, shows PR link
  • Build This App → done state shows "Launch Preview on Vercel" button (GitHub only)
  • Launch Preview modal accepts Vercel token, streams 6 steps, shows live URL
  • Vercel project + deployment visible in Vercel dashboard after launch

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx

claude added 10 commits May 17, 2026 22:24
…r handling

- Tighten free tier: 1 repo, 1 analysis/mo, 1 blueprint view, 200 credits (was 2/2/3/500)
- Billing page: show all 4 plans (Free, Pro, Scale, BYOK) side-by-side for easy comparison
- Pattern Analyzer → App Idea Chat: conversational UI with chat bubbles, starter prompts,
  follow-up questions, and optional codebase grounding; new /api/app-idea-chat route
- Templates page: add Create Template button (multi-step modal to combine blueprints)
- Idea Board: restyle with status-colored cards, icon stats strip, New Analysis CTA
- Analysis detail: fix overly broad catch that called notFound() on subscription/views
  table errors, keeping free-plan defaults instead
- DashboardHeader: switch to black/cyan cyberpunk theme (bg-black/95,
  border-cyan-500/20, RepoFuseLogo3D, mono tracking-wider nav links,
  cyan ring on avatar, cyan-styled auth buttons)
- Dashboard layout: bg-black text-white to match homepage
- Pricing page: same black/cyan header with RepoFuseLogo3D; plan cards
  and credit table restyled for dark background (gray-900 cards,
  cyan accents, white text)
Next.js <Link> performs client-side navigation via fetch, which triggers
a CORS preflight that GitHub's OAuth server blocks. Using plain <a href>
forces a full browser navigation (top-level redirect) that GitHub expects.

Affected: homepage (3 buttons), dashboard-header (GitHub + GitLab),
pricing page (Sign in button).
On mobile, the left column (text) was pushed down by 96px of padding before
showing any content. Fix: reduce section/container top padding and use CSS
order-* classes so the terminal window appears first above the text on small
screens, matching the visual hierarchy on desktop (left-first layout preserved
via lg:order-1 / lg:order-2).

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
- Simplified header: logo + name, desktop nav, single cyan "Get Started" button; NavDropdown shown in mobile header
- Hero: centered single column instead of 2-col grid; trust badge with Zap icon + divider; large two-line headline (white/cyan); single full-width-on-mobile CTA button; avatar stack social proof
- Terminal preview moved below CTA, full-width card with window chrome and Online badge
- Metrics, How It Works, Features, bottom CTA, footer all updated to match clean dark style (white/5 borders, rounded-2xl cards)
- Background updated to #0a0a0f for warmer deep-dark feel

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Mirrors MyClaw's before/after layout: broken terminal showing repos
collecting dust + four ✕ pain-point lines, red arrow transition, then
a success terminal showing 7 detected app ideas + three ✓ benefit lines
and headline 'turns your graveyard into a goldmine'. Inserted between
Metrics Strip and How It Works.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
- Add maxDuration=60 and force-dynamic to build-app route so Vercel
  allows up to 60s for Claude file generation (was 10s default)
- Reduce max_tokens 8192→4096 to finish faster and stay within budget
- Client: detect stream-ended-without-done (silent timeout) and show
  actionable retry message instead of freezing on the progress screen
- Client: map Safari's 'Load failed' / 'Failed to fetch' network errors
  to a clear 'Connection timed out — please try again' message

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Webhook fixes:
- checkout.session.completed: read plan from sub.metadata.plan instead of
  hardcoding 'pro' — Scale subscribers now get plan='scale' in DB
- Also correctly set status='trialing' on trial subscriptions at signup
- customer.subscription.updated: preserve 'scale' plan when subscription
  is still active; read from metadata.plan or existing DB plan
- invoice.payment_succeeded: replace fragile invoice.number!='0001' check
  with invoice.billing_reason==='subscription_cycle' for reliable renewal
  credit granting

Checkout flow fixes:
- billing-client: Scale plan now calls /api/stripe/checkout with
  {plan:'scale'} so github_id metadata is attached to the Stripe
  subscription; falls back to payment link only if STRIPE_SCALE_PRICE_ID
  is not configured (503 response)
- billing-client: plan comparison buttons pass correct plan id to
  handleUpgrade() instead of always defaulting to 'pro'
- pricing page: Scale CTA links to /dashboard/billing instead of bare
  Stripe payment link, routing authenticated users through checkout API

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
New feature that scans connected repositories for technical debt across 6
categories (duplicates, unused files, security risks, slow queries, outdated
dependencies, quick wins) and surfaces actionable issues with severity badges.
Auto-fixable issues support one-click GitHub PR generation via Claude.

- lib/credits.ts: add DEBT_SCAN_COST (150), extend transaction_type union and
  deductCredits type parameter with 'debt_scan'
- app/api/debt-scan/route.ts: POST endpoint — auth, deduct credits, load repo
  file metadata, build Claude prompt, parse and return DebtScanResult
- app/api/debt-fix/route.ts: SSE endpoint — fetch file from GitHub, Claude
  generates fix, creates branch + PR on the user's repo
- components/debt-scanner-client.tsx: full client UI with idle/scanning/results
  states, severity summary bar, category tabs, issue cards with before/after
  snippets, auto-fix and copy-suggestion actions
- components/debt-fix-modal.tsx: SSE streaming modal (fetch → generating → PR)
  following the same pattern as build-app-modal
- app/dashboard/debt-scanner/page.tsx: server wrapper that loads completed
  analyses and passes them to the client component
- components/dashboard-header.tsx: add Debt Scanner nav item (ShieldAlert icon)

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repo-app-architect Ready Ready Preview, Comment May 23, 2026 9:20pm
repofuse Ready Ready Preview, Comment, Open in v0 May 23, 2026 9:20pm
v0-repo-app-architect Ready Ready Preview, Comment, Open in v0 May 23, 2026 9:20pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented May 21, 2026

This pull request has been ignored for the connected project bpjftwoiosftvjvxpovz because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

upsertSubscription and the Subscription interface only allowed
'free' | 'byok' | 'pro', causing a build-breaking type error in the
Stripe webhook handler which correctly writes 'scale' for Scale plan
subscribers.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
handleUpgrade takes (targetPlan?: 'pro' | 'scale') but was passed
directly as onClick, which expects a MouseEventHandler. Wrapping with
() => handleUpgrade() fixes the type mismatch on all four call sites.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
…nner

The button sits inside a block guarded by scanState==='idle'||'error',
so TypeScript correctly flags the inner === 'scanning' check as having
no overlap. Removed the redundant condition.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
After Build This App completes, users can click "Launch Preview on Vercel"
to deploy their generated app as an ephemeral Vercel preview. The flow:
- Claude updates package.json dependencies to latest stable versions
- Pushes the updated file back to GitHub
- Creates a Vercel project linked to the GitHub repo
- Triggers a deployment and polls until live (~60–90s)
- Returns a clickable preview URL

New files:
- app/api/launch-preview/route.ts  — SSE endpoint (maxDuration=120)
- components/launch-preview-modal.tsx — step-tracker modal with Vercel token input

Modified:
- components/build-app-modal.tsx — adds "Launch Preview on Vercel" button in done state

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
@DealPatrol DealPatrol changed the title feat: AI Code Cleanup + Technical Debt Scanner feat: AI Debt Scanner + Launch Preview on Vercel May 21, 2026
Before/after comparison graphic matching the site's actual style
(#0a0a0f bg, cyan-400 accent, monospace terminals). Awaiting user
approval before wiring into the homepage.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Swaps the ~90-line inline JSX terminal mockup with a single <img> tag
pointing to the approved /comparison-preview.svg, which matches the
site's dark style and actual product messaging.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
- app/dashboard/error.tsx: add Next.js error boundary so any dashboard
  page crash shows a recoverable UI instead of a raw 500 screen
- migrations/002 used MySQL-style inline INDEX in CREATE TABLE which is
  invalid PostgreSQL, so missing_file_gaps and templates tables were
  never created; added migration 007 with correct syntax
- app/api/setup/init-db: added missing_file_gaps, completed_gaps, and
  templates table creation with correct PostgreSQL syntax
- app/api/templates/generate: wrap getMissingGapsByBlueprint in
  try/catch so missing tables don't block template creation; add auth
  check; surface "run /api/setup/init-db" hint when tables are missing

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Adds a MyClaw-style phone mockup carousel to the landing page (between
the metrics strip and the before/after comparison), showing RepoFuse in
action across three slides: Discover, Build, and Ship.

- components/phone-slideshow.tsx: client component with iOS phone frame,
  auto-advancing every 4s, click-to-navigate dot indicators, and a
  sidebar slide-list nav with cyan accent for the active item
- app/page.tsx: new "SEE IT IN ACTION" section wrapping the slideshow
- public/screenshots/: directory for blueprints.png, build-modal.png,
  build-progress.png (user must add these three images)

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Adds a 4th slide showing the finished product (Memorial QR screenshot)
inside a mini browser-chrome frame with a green LIVE badge, completing
the narrative arc: Discover → Build → Ship → Launched.

Desktop screenshots render with a browser-chrome header instead of the
plain full-bleed style used for mobile slides. Green accent colors signal
the live/launched state throughout (dot indicator, label, sidebar accent).

User must add: public/screenshots/result.png

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
- build-app: deduct credits only after a successful build instead of
  up front, so failed generation/repo-creation/push no longer burns
  500 credits. Balance is still checked before work begins.
- Delete the unused OpenAI gpt-4-turbo analysis route and the unused
  cross-platform analyze route (plus their orphaned libs); the live
  /run flow already uses Claude.
- build-app-modal: align timeout copy on 2 minutes, surface HTTP
  status on request failures, and explain Vercel preview is GitHub-only.
- queries: log blueprint_views catch blocks instead of swallowing
  errors silently.

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
The analyses list page and analysis detail page had bare catch blocks
that silently discarded DB/connectivity errors, making them impossible
to diagnose in production. Both now log the error before falling back
to empty data or notFound().

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants