Search
Code16
import { Hono } from "https://esm.sh/hono@3.11.7";import { anthropic } from "https://esm.sh/@ai-sdk/anthropic@1.2.12";import { generateText } from "https://esm.sh/ai@4.3.15";import { createRecipe } from "../database/queries.ts"; try { const result = await generateText({ model: anthropic("claude-3-5-haiku-latest"), prompt: `Extract the recipe from this page content and return ONLY valid JSON matching this schema:{## Environment Variable- **ANTHROPIC_API_KEY** - Available on Val Town and locally## Files to Create```typescriptimport { Hono } from "https://esm.sh/hono@4.4.2";import { anthropic } from "https://esm.sh/@ai-sdk/anthropic";import { generateText } from "https://esm.sh/ai";import { createRecipe } from "../database/queries.ts";// 4. Call Claude API for extraction using Vercel AI SDKconst { text } = await generateText({model: anthropic("claude-3-5-haiku-latest"),prompt: `Extract the recipe from this page content and return ONLY valid JSON matching this schema:{## Vercel AI SDK Usage (Recommended by Val Town)- Package: `@ai-sdk/anthropic` with `ai` core- API key auto-read from `ANTHROPIC_API_KEY` env var- Model: `claude-3-5-haiku-latest` (fast and efficient for extraction)- Function: `generateText()` for simple text generation## Technical Notes- Use `https://esm.sh/@ai-sdk/anthropic` and `https://esm.sh/ai` for imports- Claude 3.5 Haiku is fast and efficient for extraction tasks- 15k char limit prevents token overflow## References- [Val Town @ai-sdk/anthropic examples](https://www.val.town/examples/packages/@ai-sdk%2Fanthropic)- [AI SDK Anthropic Provider docs](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)DEPENDS ON- Strips HTML to plain text (removes script/style tags, then all HTML tags)- Limits content to 15k characters- Calls Claude 3.5 Haiku via the Vercel AI SDK (`@ai-sdk/anthropic` + `ai`)- Parses the AI response as JSON- Handles the "No recipe found" error case
* Examples: * /api/resolve/davila7/claude-code-templates/supabase-toolkit * /api/resolve/anthropics/claude-code-plugins/agent-sdk-dev */export async function resolvePlugin(c: Context) { "Bash(find:*)", "Bash(git add:*)", "Bash(git commit -m \"$(cat <<''EOF''\nImplement critical fixes and cleanup legacy code\n\nCritical Improvements:\n- Add React Error Boundary for graceful error handling\n- Implement pagination (100 rows/page) to prevent browser freeze\n- Enable TypeScript strict mode (noImplicitAny, strict, lock)\n- Remove all ''any'' types, add SQLValue type for type safety\n- Add error type guards (isError, getErrorMessage)\n- Remove all production console.log statements\n- Fix Hono context typing with proper UserData types\n\nType Safety Enhancements:\n- Replace any[][] with SQLValue[][] throughout\n- Add type guards for safe error handling\n- Properly type all React hooks and components\n- Add ''override'' modifiers for class methods\n- Zero type errors with strict mode enabled\n\nPerformance & UX:\n- Paginated table with First/Previous/Next/Last controls\n- Shows \"X to Y of Z rows\" indicator\n- Only displays pagination when needed (>100 rows)\n- Better error propagation in download handlers\n\nCode Cleanup:\n- Remove 3 legacy directories (scripts/, sqliteExplorerApp/, sqliteExplorerApp_DEV/)\n- Delete 11 legacy files (HTMX scripts, duplicate CSS, old helpers)\n- Remove .DS_Store files\n- Clean up duplicate export helpers\n\nDocumentation:\n- Add comprehensive README.md with setup, API docs, architecture\n- Include installation, deployment, and troubleshooting guides\n- Document project structure and development workflow\n\nStats: -1046 lines of legacy code, +160 lines of improvements\nType checks: ✓ backend ✓ frontend ✓ shared\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")" ], "deny": [],**Example:**- `/api/resolve/anthropics/claude-code-plugins/agent-sdk-dev`**Response:**{ "name": "agent-sdk-dev", "namespace": "anthropics/claude-code-plugins", "gitUrl": "https://github.com/anthropics/claude-code-plugins.git", "description": "Development tools for building agents", "version": "1.0.0", "author": "Anthropic", "keywords": ["agent", "sdk"], "category": "development",**Example:**- `/api/skills/anthropics/skills/algorithmic-art`### Install Skill Returns git URL, metadata, and increments download stats. Example: `/api/resolve/anthropics/claude-code-plugins/agent-sdk-dev`2. **Search Plugins:** Returns skill info (read-only, no install increment). Example: `/api/skills/anthropics/skills/algorithmic-art`2. **Install Skill:**Vals
No vals found
Users
No users found
Docs
No docs found