Skip to content

Claude/fix repofuse issues wj mks#74

Open
DealPatrol wants to merge 28 commits into
mainfrom
claude/fix-repofuse-issues-WjMks
Open

Claude/fix repofuse issues wj mks#74
DealPatrol wants to merge 28 commits into
mainfrom
claude/fix-repofuse-issues-WjMks

Conversation

@DealPatrol

Copy link
Copy Markdown
Owner

No description provided.

claude added 26 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
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
Root causes of the consistent 'Generating file contents' hang:
1. maxDuration=60 — Vercel killed the function before Claude finished
   generating complete files (can take 60-90s for 5+ files)
2. max_tokens=4096 — too low; large apps hit the limit and the JSON
   response was truncated, causing JSON.parse to throw

Fixes:
- maxDuration 60 → 120 to give Claude enough headroom
- Switch anthropic.messages.create to anthropic.messages.stream so
  tokens stream in continuously rather than Vercel waiting on one
  blocked response (keeps the connection warm and avoids idle timeout)
- max_tokens 4096 → 8192 to handle full multi-file generations
- Update UI copy from '30 seconds' to '2 minutes'

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Blank page root causes:
- h-[calc(100vh-12rem)] collapsed when parent had no fixed height
- bg-muted / text-foreground CSS vars don't match the black dashboard theme
Fix: use height:calc(100dvh-10rem) with flex + min-h-0 on the scroll
container, and explicit dark colors matching the rest of the dashboard.

New feature — Starter Code from Your Repos:
- When a codebase is selected, the API asks Claude to identify up to 6
  files from the user's existing repos that are relevant to what they
  want to build, each with a relevance explanation
- Returned starterFiles are validated against the actual DB file list so
  Claude can't hallucinate paths that don't exist
- UI shows a 'Starter Code from Your Repos' section with path, purpose,
  relevance, tech stack tags, and a copy-path button
- Empty state shows starter prompt chips and explains the codebase feature

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
Financial bugs (credits were never deducted for these operations):
- debt-fix: deduct 50 credits before calling Claude + creating GitHub PR
- launch-preview: deduct 100 credits before running Claude + Vercel deploy
- build-app: deduct 500 credits (CREDITS.BUILD_APP_COST was defined but
  never used — the most expensive operation had no guard at all)

Credit system updates (lib/credits.ts):
- Add DEBT_FIX_COST: 50 and LAUNCH_PREVIEW_COST: 100 constants
- Extend CreditTransaction.transaction_type union with 'debt_fix' |
  'launch_preview'
- Extend deductCredits type parameter with the same two new types

UI: Build This App button now shows '— 500 credits' so users aren't
surprised when the balance drops

Runtime bug (app-idea-chat):
- ${f.purpose} in template string rendered the string "null" when
  purpose was null; fixed with ?? ''

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
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
…locks

- templates/generate: check balance up front, deduct credits only after
  createTemplate() succeeds; add error detail to failure response; log
  getMissingGapsByBlueprint failures instead of swallowing them
- setup/init-db: broaden subscriptions CHECK to include 'byok' and 'scale'
  so Stripe webhooks for those plans no longer fail the constraint
- All dashboard pages: replace silent catch {} with console.error logging
  so errors surface in Vercel logs instead of disappearing silently

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
… fix token_usage schema

- debt-scan and debt-fix: replace upfront deductCredits() with getCreditBalance()
  check at the top; deduct only after the AI response/PR is confirmed successful
  so users don't lose credits when Claude fails or GitHub returns an error
- add app/api/analyses/[id]/blueprints/route.ts so the create-template modal
  hits a real 200 instead of a 404 that it silently falls back from
- standardize Anthropic import in debt-scan to default import (matches all other routes)
- remove invalid FOREIGN KEY constraints from trackTokenUsage's inline CREATE TABLE
  (referenced 'users' table that doesn't exist; auth table is user_auth)

https://claude.ai/code/session_01JcAQpzFeBtwmK6ZrXKZ8mx
@supabase

supabase Bot commented Jun 2, 2026

Copy link
Copy Markdown

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 ↗︎.

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
repo-app-architect Ready Ready Preview, Comment Jun 2, 2026 5:30am
repofuse Ready Ready Preview, Comment, Open in v0 Jun 2, 2026 5:30am
v0-repo-app-architect Ready Ready Preview, Comment, Open in v0 Jun 2, 2026 5:30am

@DealPatrol

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

@DealPatrol

Copy link
Copy Markdown
Owner Author

Merge

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

All merge conflicts have been resolved in commit 46ad937. I accepted the origin/main versions for all conflicting files to ensure compatibility with the latest main branch changes. The TypeScript type check passes successfully.

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.

3 participants