diff --git a/.gitignore b/.gitignore index 307e875..187e047 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,10 @@ # production /build +# database backups +backups/ +/backups/ + # misc .DS_Store *.pem @@ -51,6 +55,7 @@ agent_skills claude.md agents.md # Screenshots & Visual Audits +.recordings/ .screenshots/ public/audit-screenshots/ .taste-skill/ @@ -63,3 +68,12 @@ AGENTS.md # References infrasity_ref/ +# Temporary Benchmark & Measurement Artifacts +scripts/*.json +scripts/*.py +scripts/capture-* +scripts/record-* +scripts/measure-* +scripts/verify-landing-complete.js +scripts/fetch-21st-components.mjs + diff --git a/EVALS.md b/EVALS.md index 36dca35..0c306aa 100644 --- a/EVALS.md +++ b/EVALS.md @@ -1,12 +1,18 @@ # AppForge Generation Evaluation Harness Report **Evaluation Timestamp:** 2026-11-18T00:15:12Z -**Current Prompt Version:** `v1.2.1-backend` (dynamic reflection from `lib/copilot-prompt.ts`) +**Current Prompt Version:** `v1.4.0` (bumped from `v1.3.0` in `lib/copilot-prompt.ts`) **Reproduction Command:** `node scripts/run-evals.mjs` **Resumption Command (for 120b after quota reset):** `node scripts/run-evals.mjs 120b-only` > [!NOTE] -> **Schema & Prompt Version Notice (`v1.2.1-backend`):** `PROMPT_VERSION` is set to `v1.2.1-backend` for the interview-hardening branch. It reflects strict per-component schemas with native AST types (`Header`, `Statistic`, `DataTable`, `Card`, `Grid`, `ButtonAction`) without landing-redesign UI extensions (such as status/icon columns or gradient variants). Historical evaluation benchmarks recorded below predate this version and are not directly comparable to `v1.3.0` or `v1.4.0`. No new LLM evals have been run under `v1.2.1-backend`. +> **Schema & Prompt Version Notice (`v1.3.0` → `v1.4.0` & Statistic `valueSuffix` Addition):** `PROMPT_VERSION` bumped to `v1.4.0` following the addition of `valueSuffix` (and `suffix` alias) to `StatisticSchema` in `lib/validation.ts`. This dynamically updates the schema-derived Copilot system prompt specification to declare `valueSuffix?: string`. Evaluation results recorded below predate this prompt version. + +> [!NOTE] +> **Schema & Prompt Version Notice (`v1.2.0` → `v1.3.0` & Strict Validation Defense):** All recorded evaluation results below predate the `PROMPT_VERSION` bump to `v1.3.0`. In `v1.3.0`, component AST validation across all schemas (`HeaderSchema`, `StatisticSchema`, `DataTableSchema`, `CardSchema`, `GridSchema`, `ButtonActionSchema`) and `AppConfigSchema` transitioned to `.strict()`. Unrecognized or extra keys that previously passed through or were ignored now strictly fail validation. Consequently, evaluation pass rates, node validity percentages, and benchmark results recorded prior to `v1.3.0` are not comparable with results produced under this version. No new LLM evals have been run under `v1.3.0`. + +> [!NOTE] +> **Historical Schema Notice (`v1.1.0` → `v1.2.0`):** Evaluation datasets below were originally executed under `v1.1.0` before `DataTableSchema` added `type: "status"` and `colors?: Record`. --- @@ -64,7 +70,7 @@ A node is considered **Valid** if and only if: 2. `node` strictly satisfies its component-specific Zod schema via `schema.safeParse(node).success === true`: * `HeaderSchema`: Requires valid string `title`, optional `subtitle`, and `size` strictly in `["sm", "md", "lg"]`. * `StatisticSchema`: Requires numeric/string `value`, valid `label` or `title`, and optional `trend` strictly adhering to trend union schemas (`up | down | neutral` or `{ value, label, direction, sentiment }`). - * `DataTableSchema`: Requires structured `columns` (`string` or `{ key, label, type, align }`) and `data` or `rows` records. + * `DataTableSchema`: Requires structured `columns` (`string` or `{ key, label, type, colors, align }`, where `type` supports `"status"` and `colors` maps status values to `"success" | "warning" | "danger" | "info" | "neutral" | "violet"`) and `data` or `rows` records. *(Note: historical `v1.1.0` runs below used the prior schema without `type: "status"` or `colors`.)* * `ButtonActionSchema`: Requires `label` and `variant` strictly in `["default", "outline", "secondary", "ghost"]`. * `CardSchema` / `GridSchema`: Recursively validates that all child `content`, `footer`, or `items` are themselves valid component nodes. diff --git a/README.md b/README.md index 1bfcf07..1b9c47c 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,7 @@ The enterprise pipeline heavily restricts branches. It is comprised strictly of --- ## Known Limitations / TODO +- **AST `className` on Public Apps (UI Redress & Defacement Concern)**: Component schemas currently accept an optional `className?: string` property (e.g. on `Header`, `Statistic`, `Card`, `Grid`, and `ButtonAction`) validated only as a generic string without class-name whitelisting or sanitization. While dangerous raw HTML attributes (`dangerouslySetInnerHTML`, `style`, event handlers like `onClick`) are strictly rejected by the component Zod schemas, arbitrary Tailwind utility classes can still be supplied in the application config JSON. On publicly published apps (`/apps/[appId]`), a malicious author could inject viewport-covering classes (e.g., `fixed inset-0 z-50 bg-background`), misleading overlay banners, phishing overlays, or destructive styling that obscures application chrome. *Resolution planned for post-freeze:* Introduce a strict CSS utility whitelist or sanitizer in `RenderNode` for public app routes to strip layout-breaking positioning (`fixed`, `absolute`, `z-[...]`) and arbitrary value brackets (`[...]`). - **Security & Database Access Model**: Server-only DB access with app-level ownership checks; RLS blocks anonymous key access only. Native Clerk Third-Party Auth (JWKS token validation) is not configured in Supabase PostgREST. All database queries and mutations from authenticated users execute server-side in Next.js Server Actions and Route Handlers using the Supabase Service Role key (`SUPABASE_SERVICE_ROLE_KEY`), with tenant isolation verified by Clerk `auth()` (`eq('user_id', userId)`). Postgres Row-Level Security (RLS) is active strictly to block anonymous key access (`anon`), restricting public reads solely to published applications (`published_config IS NOT NULL`). Direct authenticated PostgREST calls with Clerk JWTs return `PGRST301` without Supabase Dashboard JWKS configuration. - **TODO / Verify (React Testing Layer):** There is currently no active e2e testing interface. Adding `Playwright` to strictly verify DOM layout alignment output from generic JSON structures would guarantee a vastly more secure build layer. - **TODO / Verify:** AI Provider Failover Logic is extremely simplistic. Migrating to a complex load-balancer tracking API quota exhaustions heavily per key natively rather than sequential cascading fallbacks. diff --git a/app/builder/[appId]/page.tsx b/app/builder/[appId]/page.tsx index 17d5587..f35b7b1 100644 --- a/app/builder/[appId]/page.tsx +++ b/app/builder/[appId]/page.tsx @@ -19,10 +19,13 @@ import { IconButton } from "@/components/ui/icon-button"; import { StatusPill } from "@/components/ui/status-pill"; import { ThemeToggle } from "@/components/layout/ThemeToggle"; import { Kbd } from "@/components/ui/kbd"; +import { motion, AnimatePresence } from "framer-motion"; +import { MOTION_TOKENS } from "@/lib/motion-tokens"; import { ArrowLeft, Save, Play, + Check, Loader2, FileCode, Layout, @@ -38,6 +41,7 @@ import { useParams, useRouter, useSearchParams } from "next/navigation"; import { useAuth, SignInButton } from "@clerk/nextjs"; import { useTheme } from "next-themes"; import { getAppConfig, saveAppConfig, publishAppConfig } from "@/actions/apps"; +import { TEMPLATES_DATA } from "@/lib/templates-data"; const DEFAULT_EDITOR_WIDTH = 460; const MIN_EDITOR_WIDTH = 340; @@ -271,6 +275,13 @@ function BuilderContent() { appId === "demo" || appId.startsWith("template-") || appId === "mock-new-id"; const [configStr, setConfigStr] = useState(() => { + const templateParam = searchParams.get("template"); + const matchedTemplate = TEMPLATES_DATA.find( + (t) => t.id === templateParam || appId === `template-${t.id}` || appId === t.id + ); + if (matchedTemplate) { + return JSON.stringify(matchedTemplate.config, null, 2); + } if (appId.includes("template-blank")) { return JSON.stringify({ app: "Untitled Template", pages: [] }, null, 2); } @@ -338,7 +349,9 @@ function BuilderContent() { [configStr], ); const [isSaving, setIsSaving] = useState(false); + const [saveState, setSaveState] = useState<"idle" | "saving" | "saved">("idle"); const [isPublishing, setIsPublishing] = useState(false); + const [publishState, setPublishState] = useState<"idle" | "publishing" | "published">("idle"); const [showPublishDialog, setShowPublishDialog] = useState(false); const [isGenerating, setIsGenerating] = useState(false); const [authRequireMessage, setAuthRequireMessage] = useState( @@ -446,9 +459,11 @@ function BuilderContent() { const handleSave = async () => { setIsSaving(true); + setSaveState("saving"); try { const res = await saveAppConfig(appId, configStr); if (!res.success) { + setSaveState("idle"); if (res.error?.toLowerCase().includes("unauthorized")) { setAuthRequireMessage( "Please sign in to save your application to your personal account.", @@ -461,6 +476,8 @@ function BuilderContent() { }); } } else { + setSaveState("saved"); + setTimeout(() => setSaveState("idle"), 2000); setNotificationModal({ type: "success", title: "Draft Saved", @@ -468,6 +485,7 @@ function BuilderContent() { }); } } catch (e: unknown) { + setSaveState("idle"); const msg = (e as Error).message || ""; if (msg.toLowerCase().includes("unauthorized")) { setAuthRequireMessage( @@ -487,9 +505,11 @@ function BuilderContent() { const handlePublish = async () => { setIsPublishing(true); + setPublishState("publishing"); try { const res = await publishAppConfig(appId, configStr); if (!res.success) { + setPublishState("idle"); if (res.error?.toLowerCase().includes("unauthorized")) { setAuthRequireMessage( "Please sign in to deploy and publish your dynamic application.", @@ -502,6 +522,8 @@ function BuilderContent() { }); } } else { + setPublishState("published"); + setTimeout(() => setPublishState("idle"), 2000); setNotificationModal({ type: "success", title: "App Published!", @@ -510,6 +532,7 @@ function BuilderContent() { }); } } catch (e: unknown) { + setPublishState("idle"); const msg = (e as Error).message || ""; if (msg.toLowerCase().includes("unauthorized")) { setAuthRequireMessage( @@ -608,29 +631,11 @@ function BuilderContent() { return (
- {/* Background treatment: same canvas and washes at half strength */} + {/* Background treatment: STATIC frame of the mesh gradient at ~60% intensity. No WebGL animation in builder */}