feat: v0.2 agent-first registry with CLI, MCP, and static registry#28
Conversation
The /shaders route's validateSearch was redirecting /shaders/$name to /shaders/$name?q=, blocking the detail page from loading (307 loop). Fix: remove validateSearch from the parent /shaders route and read the query param manually. Add Outlet support so the /shaders route acts as a layout when child routes (/shaders/$name) are active. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The /shaders route was both a page and a parent for /shaders/$name, causing the browse page to not render when using Outlet. Split into: - shaders.tsx: layout route that renders <Outlet> - shaders.index.tsx: browse page (renders at /shaders) - shaders.$name.tsx: detail page (renders at /shaders/$name) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add .data/ (SQLite databases), .output/ and .nitro/ (build artifacts), and .playwright-mcp/ (test screenshots) to gitignore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scaffold packages/cli/ with Zod schemas for the static registry format: - RegistryIndexEntry: searchable metadata per shader - RegistryIndex: top-level index with version and shader list - RegistryShaderBundle: full shader detail with inlined GLSL and recipes - Full provenance passthrough for adapted/ported shaders Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…orpus Reads shaders/*/shader.json, validates, inlines GLSL source and recipe code, produces registry/index.json + per-shader bundles. Adds bun run build:registry command. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- search: filter shaders by query, category, pipeline, environment, tags - add: write GLSL + recipe files into user's project (shadcn-style) - registry-client: HTTP fetch for index and shader bundles from CDN Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
npx shaderbase search --query gradient npx shaderbase add gradient-radial --env r3f --dir src/shaders Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cloudflare Worker skeleton with: - handleSearchShaders: filters registry index by query/category/pipeline/env/tags - handleGetShader: returns full shader bundle with optional env filtering - /health and /tools HTTP endpoints Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- bun run test now runs schema + CLI + MCP + registry tests (25 total) - Add @shaderbase/cli path alias to tsconfig.base.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Delete submission-draft.ts (564 lines of manual form builder) - Delete RecipeEditor.tsx and SourceEditor.tsx form components - Remove submissions/ directory (filesystem intake queue) - Simplify AiSubmitWizard to: paste → AI parse → read-only review - Remove saveDraftSubmission server function (filesystem writes) - Add "Create Pull Request" placeholder button (wired in Task 9) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract resolveSource() from createServerFn for testability - 8 tests for URL resolution (GLSL, Shadertoy, gist, GitHub file) - 7 tests for reviews CRUD (add, get, average, ratings map) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract core logic into testable functions: - listShadersFromDisk: reads shader corpus from filesystem - loadShaderDetail: loads full shader detail with inlined sources Server functions delegate to these, adding DB concerns. 9 tests covering listing, detail loading, recipes, uniforms, provenance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Submit flow now creates a PR via GitHub REST API: - Creates branch, blobs, tree, commit, and PR - Builds proper shader.json manifest from AI-parsed data - Shows PR URL on success, error message on failure - Requires GITHUB_TOKEN and GITHUB_REPO env vars Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Build registry on every PR/push (validates generation works) - Upload registry as artifact for inspection - Deploy to Cloudflare Pages on master push (requires CLOUDFLARE_API_TOKEN) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- README: add architecture diagram, CLI/MCP usage, repository map - CLAUDE.md: add packages, commands, distribution model - git-contract: list registry, CLI, MCP as derived artifacts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Create shaderbase-reviews D1 database (WEUR region) - Add 0001_reviews.sql migration (applied to remote) - Add wrangler.toml with D1 binding configuration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Registry: https://shaderbase-registry.pages.dev (4 JSON files) - MCP server: https://shaderbase-mcp.bats-678.workers.dev - /health returns ok, /tools lists search_shaders + get_shader Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ubuntu-latest ships Node 18 which doesn't support --experimental-strip-types. Tests require Node 22.6+. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Findings
Verification Signed, |
1. Auth: add Better Auth session check to createShaderPR handler 2. GitHub API: resolve tree SHA from commit SHA for base_tree 3. Manifest: add recipes, preview, and requiredNotice to buildManifest 4. MCP server: wire /search_shaders and /get_shader to handlers 5. TypeScript: fix TS2532 (non-null assertions) and TS2345 (fetch type) Add typecheck step to CI pipeline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Follow-up review after the fix commit:
Verification: Signed, |
Non-original shaders now include source URL, kind, revision, author, and retrievedAt from the resolved source metadata (Shadertoy, gist, GitHub file). Ensures manifests pass schema validation for adapted and ported shaders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI's tsc doesn't have Bun's built-in Node type globals. Adding @types/node and types: ["node"] in tsconfig ensures console, process, node:fs, etc. resolve on all platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Transforms ShaderBase from a git-backed shader corpus into a full agent-first registry (shadcn-style distribution model):
scripts/build-registry.tsgeneratesindex.json+ per-shader bundles fromshaders/*/, deployed to Cloudflare Pages CDNshaderbase) —searchandaddcommands; copies GLSL + recipe files into the user's projectsearch_shadersandget_shadertools for AI agent integrationshaderbase-reviewswith migration appliedLive Deployments
Architecture Decisions
Documented in GitHub issues #23-#27 under milestone "v0.2 — Agent-First Registry"
Test plan
bun run test— 25 tests pass (schema, CLI, MCP, registry)bun run validate:shaders— 3 manifests validbun run build:registry— generates 4 JSON files🤖 Generated with Claude Code