@minhduydev/mdpi 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/index.js +1187 -0
- package/dist/template/.pi/.env.example +28 -0
- package/dist/template/.pi/AGENTS.md +226 -0
- package/dist/template/.pi/QUALITY.md +13 -0
- package/dist/template/.pi/README.md +452 -0
- package/dist/template/.pi/VERSION +1 -0
- package/dist/template/.pi/agents/INDEX.md +54 -0
- package/dist/template/.pi/agents/build.md +194 -0
- package/dist/template/.pi/agents/explore.md +85 -0
- package/dist/template/.pi/agents/general.md +189 -0
- package/dist/template/.pi/agents/plan.md +407 -0
- package/dist/template/.pi/agents/review.md +198 -0
- package/dist/template/.pi/agents/scout.md +142 -0
- package/dist/template/.pi/agents/vision.md +157 -0
- package/dist/template/.pi/artifacts/example/plan.md +12 -0
- package/dist/template/.pi/artifacts/example/progress.md +4 -0
- package/dist/template/.pi/artifacts/example/research.md +4 -0
- package/dist/template/.pi/artifacts/example/spec.md +16 -0
- package/dist/template/.pi/context/architecture.md +141 -0
- package/dist/template/.pi/context/fallow.md +137 -0
- package/dist/template/.pi/extensions/templates-injector.ts +76 -0
- package/dist/template/.pi/extensions/workflows-runner.ts +301 -0
- package/dist/template/.pi/guard.example.json +75 -0
- package/dist/template/.pi/prompts/INDEX.md +78 -0
- package/dist/template/.pi/prompts/audit.md +109 -0
- package/dist/template/.pi/prompts/close.md +88 -0
- package/dist/template/.pi/prompts/create.md +197 -0
- package/dist/template/.pi/prompts/fix.md +117 -0
- package/dist/template/.pi/prompts/gc.md +112 -0
- package/dist/template/.pi/prompts/init.md +206 -0
- package/dist/template/.pi/prompts/loop-check.md +87 -0
- package/dist/template/.pi/prompts/loop-init.md +157 -0
- package/dist/template/.pi/prompts/loop-review.md +90 -0
- package/dist/template/.pi/prompts/plan.md +254 -0
- package/dist/template/.pi/prompts/research.md +136 -0
- package/dist/template/.pi/prompts/ship.md +219 -0
- package/dist/template/.pi/prompts/status.md +92 -0
- package/dist/template/.pi/prompts/verify.md +154 -0
- package/dist/template/.pi/scripts/gc-check.sh +86 -0
- package/dist/template/.pi/settings.json +15 -0
- package/dist/template/.pi/skills/INDEX.md +331 -0
- package/dist/template/.pi/skills/accessibility-audit/SKILL.md +205 -0
- package/dist/template/.pi/skills/accessibility-audit/references/accessibility-checklist.md +109 -0
- package/dist/template/.pi/skills/agent-code-quality-gate/SKILL.md +131 -0
- package/dist/template/.pi/skills/api-and-interface-design/SKILL.md +159 -0
- package/dist/template/.pi/skills/behavioral-kernel/SKILL.md +92 -0
- package/dist/template/.pi/skills/brainstorming/SKILL.md +138 -0
- package/dist/template/.pi/skills/browser-testing-with-devtools/SKILL.md +90 -0
- package/dist/template/.pi/skills/chrome-devtools/SKILL.md +129 -0
- package/dist/template/.pi/skills/ci-cd-and-automation/SKILL.md +199 -0
- package/dist/template/.pi/skills/cloudflare/SKILL.md +271 -0
- package/dist/template/.pi/skills/cloudflare/references/agents-sdk/README.md +35 -0
- package/dist/template/.pi/skills/cloudflare/references/agents-sdk/api.md +100 -0
- package/dist/template/.pi/skills/cloudflare/references/agents-sdk/configuration.md +99 -0
- package/dist/template/.pi/skills/cloudflare/references/agents-sdk/gotchas.md +59 -0
- package/dist/template/.pi/skills/cloudflare/references/agents-sdk/patterns.md +89 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-gateway/README.md +695 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-search/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-search/api.md +38 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-search/configuration.md +52 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-search/gotchas.md +41 -0
- package/dist/template/.pi/skills/cloudflare/references/ai-search/patterns.md +45 -0
- package/dist/template/.pi/skills/cloudflare/references/analytics-engine/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/analytics-engine/api.md +27 -0
- package/dist/template/.pi/skills/cloudflare/references/analytics-engine/configuration.md +45 -0
- package/dist/template/.pi/skills/cloudflare/references/analytics-engine/gotchas.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/analytics-engine/patterns.md +36 -0
- package/dist/template/.pi/skills/cloudflare/references/api/README.md +21 -0
- package/dist/template/.pi/skills/cloudflare/references/api/api.md +31 -0
- package/dist/template/.pi/skills/cloudflare/references/api/configuration.md +20 -0
- package/dist/template/.pi/skills/cloudflare/references/api/gotchas.md +28 -0
- package/dist/template/.pi/skills/cloudflare/references/api/patterns.md +47 -0
- package/dist/template/.pi/skills/cloudflare/references/api-shield/README.md +20 -0
- package/dist/template/.pi/skills/cloudflare/references/api-shield/api.md +78 -0
- package/dist/template/.pi/skills/cloudflare/references/api-shield/configuration.md +128 -0
- package/dist/template/.pi/skills/cloudflare/references/api-shield/gotchas.md +51 -0
- package/dist/template/.pi/skills/cloudflare/references/api-shield/patterns.md +145 -0
- package/dist/template/.pi/skills/cloudflare/references/argo-smart-routing/README.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/argo-smart-routing/api.md +50 -0
- package/dist/template/.pi/skills/cloudflare/references/argo-smart-routing/configuration.md +53 -0
- package/dist/template/.pi/skills/cloudflare/references/argo-smart-routing/gotchas.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/argo-smart-routing/patterns.md +45 -0
- package/dist/template/.pi/skills/cloudflare/references/bindings/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/bindings/api.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/bindings/configuration.md +58 -0
- package/dist/template/.pi/skills/cloudflare/references/bindings/gotchas.md +35 -0
- package/dist/template/.pi/skills/cloudflare/references/bindings/patterns.md +37 -0
- package/dist/template/.pi/skills/cloudflare/references/bot-management/README.md +71 -0
- package/dist/template/.pi/skills/cloudflare/references/bot-management/api.md +168 -0
- package/dist/template/.pi/skills/cloudflare/references/bot-management/configuration.md +114 -0
- package/dist/template/.pi/skills/cloudflare/references/bot-management/gotchas.md +99 -0
- package/dist/template/.pi/skills/cloudflare/references/bot-management/patterns.md +125 -0
- package/dist/template/.pi/skills/cloudflare/references/browser-rendering/README.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/browser-rendering/api.md +54 -0
- package/dist/template/.pi/skills/cloudflare/references/browser-rendering/configuration.md +47 -0
- package/dist/template/.pi/skills/cloudflare/references/browser-rendering/gotchas.md +29 -0
- package/dist/template/.pi/skills/cloudflare/references/browser-rendering/patterns.md +29 -0
- package/dist/template/.pi/skills/cloudflare/references/c3/README.md +264 -0
- package/dist/template/.pi/skills/cloudflare/references/cache-reserve/README.md +93 -0
- package/dist/template/.pi/skills/cloudflare/references/cache-reserve/api.md +176 -0
- package/dist/template/.pi/skills/cloudflare/references/cache-reserve/configuration.md +164 -0
- package/dist/template/.pi/skills/cloudflare/references/cache-reserve/gotchas.md +203 -0
- package/dist/template/.pi/skills/cloudflare/references/cache-reserve/patterns.md +180 -0
- package/dist/template/.pi/skills/cloudflare/references/containers/README.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/containers/api.md +43 -0
- package/dist/template/.pi/skills/cloudflare/references/containers/configuration.md +56 -0
- package/dist/template/.pi/skills/cloudflare/references/containers/gotchas.md +21 -0
- package/dist/template/.pi/skills/cloudflare/references/containers/patterns.md +40 -0
- package/dist/template/.pi/skills/cloudflare/references/cron-triggers/README.md +85 -0
- package/dist/template/.pi/skills/cloudflare/references/cron-triggers/api.md +198 -0
- package/dist/template/.pi/skills/cloudflare/references/cron-triggers/configuration.md +151 -0
- package/dist/template/.pi/skills/cloudflare/references/cron-triggers/gotchas.md +129 -0
- package/dist/template/.pi/skills/cloudflare/references/cron-triggers/patterns.md +122 -0
- package/dist/template/.pi/skills/cloudflare/references/d1/README.md +92 -0
- package/dist/template/.pi/skills/cloudflare/references/d1/api.md +141 -0
- package/dist/template/.pi/skills/cloudflare/references/d1/configuration.md +127 -0
- package/dist/template/.pi/skills/cloudflare/references/d1/gotchas.md +70 -0
- package/dist/template/.pi/skills/cloudflare/references/d1/patterns.md +144 -0
- package/dist/template/.pi/skills/cloudflare/references/ddos/README.md +34 -0
- package/dist/template/.pi/skills/cloudflare/references/ddos/api.md +136 -0
- package/dist/template/.pi/skills/cloudflare/references/ddos/configuration.md +67 -0
- package/dist/template/.pi/skills/cloudflare/references/ddos/gotchas.md +114 -0
- package/dist/template/.pi/skills/cloudflare/references/ddos/patterns.md +158 -0
- package/dist/template/.pi/skills/cloudflare/references/do-storage/README.md +62 -0
- package/dist/template/.pi/skills/cloudflare/references/do-storage/api.md +89 -0
- package/dist/template/.pi/skills/cloudflare/references/do-storage/configuration.md +116 -0
- package/dist/template/.pi/skills/cloudflare/references/do-storage/gotchas.md +93 -0
- package/dist/template/.pi/skills/cloudflare/references/do-storage/patterns.md +112 -0
- package/dist/template/.pi/skills/cloudflare/references/durable-objects/README.md +125 -0
- package/dist/template/.pi/skills/cloudflare/references/durable-objects/api.md +152 -0
- package/dist/template/.pi/skills/cloudflare/references/durable-objects/configuration.md +148 -0
- package/dist/template/.pi/skills/cloudflare/references/durable-objects/gotchas.md +158 -0
- package/dist/template/.pi/skills/cloudflare/references/durable-objects/patterns.md +255 -0
- package/dist/template/.pi/skills/cloudflare/references/email-routing/README.md +18 -0
- package/dist/template/.pi/skills/cloudflare/references/email-routing/api.md +46 -0
- package/dist/template/.pi/skills/cloudflare/references/email-routing/configuration.md +63 -0
- package/dist/template/.pi/skills/cloudflare/references/email-routing/gotchas.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/email-routing/patterns.md +46 -0
- package/dist/template/.pi/skills/cloudflare/references/email-workers/README.md +598 -0
- package/dist/template/.pi/skills/cloudflare/references/hyperdrive/README.md +62 -0
- package/dist/template/.pi/skills/cloudflare/references/hyperdrive/api.md +137 -0
- package/dist/template/.pi/skills/cloudflare/references/hyperdrive/configuration.md +133 -0
- package/dist/template/.pi/skills/cloudflare/references/hyperdrive/gotchas.md +184 -0
- package/dist/template/.pi/skills/cloudflare/references/hyperdrive/patterns.md +176 -0
- package/dist/template/.pi/skills/cloudflare/references/images/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/images/api.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/images/configuration.md +45 -0
- package/dist/template/.pi/skills/cloudflare/references/images/gotchas.md +23 -0
- package/dist/template/.pi/skills/cloudflare/references/images/patterns.md +31 -0
- package/dist/template/.pi/skills/cloudflare/references/kv/README.md +60 -0
- package/dist/template/.pi/skills/cloudflare/references/kv/api.md +114 -0
- package/dist/template/.pi/skills/cloudflare/references/kv/configuration.md +92 -0
- package/dist/template/.pi/skills/cloudflare/references/kv/gotchas.md +117 -0
- package/dist/template/.pi/skills/cloudflare/references/kv/patterns.md +139 -0
- package/dist/template/.pi/skills/cloudflare/references/miniflare/README.md +64 -0
- package/dist/template/.pi/skills/cloudflare/references/miniflare/api.md +144 -0
- package/dist/template/.pi/skills/cloudflare/references/miniflare/configuration.md +203 -0
- package/dist/template/.pi/skills/cloudflare/references/miniflare/gotchas.md +187 -0
- package/dist/template/.pi/skills/cloudflare/references/miniflare/patterns.md +211 -0
- package/dist/template/.pi/skills/cloudflare/references/network-interconnect/README.md +60 -0
- package/dist/template/.pi/skills/cloudflare/references/network-interconnect/api.md +240 -0
- package/dist/template/.pi/skills/cloudflare/references/network-interconnect/configuration.md +127 -0
- package/dist/template/.pi/skills/cloudflare/references/network-interconnect/gotchas.md +171 -0
- package/dist/template/.pi/skills/cloudflare/references/network-interconnect/patterns.md +171 -0
- package/dist/template/.pi/skills/cloudflare/references/observability/README.md +18 -0
- package/dist/template/.pi/skills/cloudflare/references/observability/api.md +51 -0
- package/dist/template/.pi/skills/cloudflare/references/observability/configuration.md +60 -0
- package/dist/template/.pi/skills/cloudflare/references/observability/gotchas.md +36 -0
- package/dist/template/.pi/skills/cloudflare/references/observability/patterns.md +42 -0
- package/dist/template/.pi/skills/cloudflare/references/pages/README.md +76 -0
- package/dist/template/.pi/skills/cloudflare/references/pages/api.md +200 -0
- package/dist/template/.pi/skills/cloudflare/references/pages/configuration.md +228 -0
- package/dist/template/.pi/skills/cloudflare/references/pages/gotchas.md +161 -0
- package/dist/template/.pi/skills/cloudflare/references/pages/patterns.md +145 -0
- package/dist/template/.pi/skills/cloudflare/references/pages-functions/README.md +57 -0
- package/dist/template/.pi/skills/cloudflare/references/pages-functions/api.md +201 -0
- package/dist/template/.pi/skills/cloudflare/references/pages-functions/configuration.md +159 -0
- package/dist/template/.pi/skills/cloudflare/references/pages-functions/gotchas.md +151 -0
- package/dist/template/.pi/skills/cloudflare/references/pages-functions/patterns.md +190 -0
- package/dist/template/.pi/skills/cloudflare/references/pipelines/README.md +664 -0
- package/dist/template/.pi/skills/cloudflare/references/pulumi/README.md +107 -0
- package/dist/template/.pi/skills/cloudflare/references/pulumi/api.md +194 -0
- package/dist/template/.pi/skills/cloudflare/references/pulumi/configuration.md +216 -0
- package/dist/template/.pi/skills/cloudflare/references/pulumi/gotchas.md +223 -0
- package/dist/template/.pi/skills/cloudflare/references/pulumi/patterns.md +139 -0
- package/dist/template/.pi/skills/cloudflare/references/queues/README.md +69 -0
- package/dist/template/.pi/skills/cloudflare/references/queues/api.md +138 -0
- package/dist/template/.pi/skills/cloudflare/references/queues/configuration.md +125 -0
- package/dist/template/.pi/skills/cloudflare/references/queues/gotchas.md +112 -0
- package/dist/template/.pi/skills/cloudflare/references/queues/patterns.md +155 -0
- package/dist/template/.pi/skills/cloudflare/references/r2/README.md +61 -0
- package/dist/template/.pi/skills/cloudflare/references/r2/api.md +127 -0
- package/dist/template/.pi/skills/cloudflare/references/r2/configuration.md +76 -0
- package/dist/template/.pi/skills/cloudflare/references/r2/gotchas.md +94 -0
- package/dist/template/.pi/skills/cloudflare/references/r2/patterns.md +127 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-data-catalog/README.md +18 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-data-catalog/api.md +29 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-data-catalog/configuration.md +39 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-data-catalog/gotchas.md +20 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-data-catalog/patterns.md +46 -0
- package/dist/template/.pi/skills/cloudflare/references/r2-sql/README.md +512 -0
- package/dist/template/.pi/skills/cloudflare/references/realtime-sfu/README.md +21 -0
- package/dist/template/.pi/skills/cloudflare/references/realtime-sfu/api.md +135 -0
- package/dist/template/.pi/skills/cloudflare/references/realtime-sfu/configuration.md +63 -0
- package/dist/template/.pi/skills/cloudflare/references/realtime-sfu/gotchas.md +75 -0
- package/dist/template/.pi/skills/cloudflare/references/realtime-sfu/patterns.md +102 -0
- package/dist/template/.pi/skills/cloudflare/references/realtimekit/README.md +81 -0
- package/dist/template/.pi/skills/cloudflare/references/realtimekit/api.md +164 -0
- package/dist/template/.pi/skills/cloudflare/references/realtimekit/configuration.md +147 -0
- package/dist/template/.pi/skills/cloudflare/references/realtimekit/gotchas.md +172 -0
- package/dist/template/.pi/skills/cloudflare/references/realtimekit/patterns.md +155 -0
- package/dist/template/.pi/skills/cloudflare/references/sandbox/README.md +90 -0
- package/dist/template/.pi/skills/cloudflare/references/sandbox/api.md +178 -0
- package/dist/template/.pi/skills/cloudflare/references/sandbox/configuration.md +131 -0
- package/dist/template/.pi/skills/cloudflare/references/sandbox/gotchas.md +156 -0
- package/dist/template/.pi/skills/cloudflare/references/sandbox/patterns.md +203 -0
- package/dist/template/.pi/skills/cloudflare/references/secrets-store/README.md +58 -0
- package/dist/template/.pi/skills/cloudflare/references/secrets-store/api.md +182 -0
- package/dist/template/.pi/skills/cloudflare/references/secrets-store/configuration.md +140 -0
- package/dist/template/.pi/skills/cloudflare/references/secrets-store/gotchas.md +129 -0
- package/dist/template/.pi/skills/cloudflare/references/secrets-store/patterns.md +218 -0
- package/dist/template/.pi/skills/cloudflare/references/smart-placement/README.md +91 -0
- package/dist/template/.pi/skills/cloudflare/references/smart-placement/api.md +139 -0
- package/dist/template/.pi/skills/cloudflare/references/smart-placement/configuration.md +129 -0
- package/dist/template/.pi/skills/cloudflare/references/smart-placement/gotchas.md +87 -0
- package/dist/template/.pi/skills/cloudflare/references/smart-placement/patterns.md +135 -0
- package/dist/template/.pi/skills/cloudflare/references/snippets/README.md +15 -0
- package/dist/template/.pi/skills/cloudflare/references/snippets/api.md +47 -0
- package/dist/template/.pi/skills/cloudflare/references/snippets/configuration.md +33 -0
- package/dist/template/.pi/skills/cloudflare/references/snippets/gotchas.md +21 -0
- package/dist/template/.pi/skills/cloudflare/references/snippets/patterns.md +34 -0
- package/dist/template/.pi/skills/cloudflare/references/spectrum/README.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/spectrum/api.md +24 -0
- package/dist/template/.pi/skills/cloudflare/references/spectrum/configuration.md +43 -0
- package/dist/template/.pi/skills/cloudflare/references/spectrum/gotchas.md +42 -0
- package/dist/template/.pi/skills/cloudflare/references/spectrum/patterns.md +40 -0
- package/dist/template/.pi/skills/cloudflare/references/static-assets/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/static-assets/api.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/static-assets/configuration.md +47 -0
- package/dist/template/.pi/skills/cloudflare/references/static-assets/gotchas.md +44 -0
- package/dist/template/.pi/skills/cloudflare/references/static-assets/patterns.md +42 -0
- package/dist/template/.pi/skills/cloudflare/references/stream/README.md +103 -0
- package/dist/template/.pi/skills/cloudflare/references/stream/api.md +204 -0
- package/dist/template/.pi/skills/cloudflare/references/stream/configuration.md +127 -0
- package/dist/template/.pi/skills/cloudflare/references/stream/gotchas.md +131 -0
- package/dist/template/.pi/skills/cloudflare/references/stream/patterns.md +152 -0
- package/dist/template/.pi/skills/cloudflare/references/tail-workers/README.md +640 -0
- package/dist/template/.pi/skills/cloudflare/references/terraform/README.md +76 -0
- package/dist/template/.pi/skills/cloudflare/references/terraform/api.md +159 -0
- package/dist/template/.pi/skills/cloudflare/references/terraform/configuration.md +156 -0
- package/dist/template/.pi/skills/cloudflare/references/terraform/gotchas.md +207 -0
- package/dist/template/.pi/skills/cloudflare/references/terraform/patterns.md +135 -0
- package/dist/template/.pi/skills/cloudflare/references/tunnel/README.md +82 -0
- package/dist/template/.pi/skills/cloudflare/references/tunnel/api.md +105 -0
- package/dist/template/.pi/skills/cloudflare/references/tunnel/configuration.md +113 -0
- package/dist/template/.pi/skills/cloudflare/references/tunnel/gotchas.md +115 -0
- package/dist/template/.pi/skills/cloudflare/references/tunnel/patterns.md +157 -0
- package/dist/template/.pi/skills/cloudflare/references/turn/README.md +699 -0
- package/dist/template/.pi/skills/cloudflare/references/turnstile/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/turnstile/api.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/turnstile/configuration.md +19 -0
- package/dist/template/.pi/skills/cloudflare/references/turnstile/gotchas.md +27 -0
- package/dist/template/.pi/skills/cloudflare/references/turnstile/patterns.md +41 -0
- package/dist/template/.pi/skills/cloudflare/references/vectorize/README.md +682 -0
- package/dist/template/.pi/skills/cloudflare/references/waf/README.md +14 -0
- package/dist/template/.pi/skills/cloudflare/references/waf/api.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/waf/configuration.md +44 -0
- package/dist/template/.pi/skills/cloudflare/references/waf/gotchas.md +24 -0
- package/dist/template/.pi/skills/cloudflare/references/waf/patterns.md +29 -0
- package/dist/template/.pi/skills/cloudflare/references/web-analytics/README.md +19 -0
- package/dist/template/.pi/skills/cloudflare/references/web-analytics/api.md +52 -0
- package/dist/template/.pi/skills/cloudflare/references/web-analytics/configuration.md +31 -0
- package/dist/template/.pi/skills/cloudflare/references/web-analytics/gotchas.md +28 -0
- package/dist/template/.pi/skills/cloudflare/references/web-analytics/patterns.md +52 -0
- package/dist/template/.pi/skills/cloudflare/references/workerd/README.md +47 -0
- package/dist/template/.pi/skills/cloudflare/references/workerd/api.md +199 -0
- package/dist/template/.pi/skills/cloudflare/references/workerd/configuration.md +185 -0
- package/dist/template/.pi/skills/cloudflare/references/workerd/gotchas.md +203 -0
- package/dist/template/.pi/skills/cloudflare/references/workerd/patterns.md +216 -0
- package/dist/template/.pi/skills/cloudflare/references/workers/README.md +96 -0
- package/dist/template/.pi/skills/cloudflare/references/workers/api.md +137 -0
- package/dist/template/.pi/skills/cloudflare/references/workers/configuration.md +147 -0
- package/dist/template/.pi/skills/cloudflare/references/workers/gotchas.md +99 -0
- package/dist/template/.pi/skills/cloudflare/references/workers/patterns.md +149 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-ai/README.md +116 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-for-platforms/README.md +48 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-for-platforms/api.md +169 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-for-platforms/configuration.md +136 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-for-platforms/gotchas.md +130 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-for-platforms/patterns.md +170 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-playground/README.md +16 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-playground/api.md +20 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-playground/configuration.md +3 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-playground/gotchas.md +35 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-playground/patterns.md +42 -0
- package/dist/template/.pi/skills/cloudflare/references/workers-vpc/README.md +579 -0
- package/dist/template/.pi/skills/cloudflare/references/workflows/README.md +62 -0
- package/dist/template/.pi/skills/cloudflare/references/workflows/api.md +125 -0
- package/dist/template/.pi/skills/cloudflare/references/workflows/configuration.md +177 -0
- package/dist/template/.pi/skills/cloudflare/references/workflows/gotchas.md +136 -0
- package/dist/template/.pi/skills/cloudflare/references/workflows/patterns.md +132 -0
- package/dist/template/.pi/skills/cloudflare/references/wrangler/README.md +90 -0
- package/dist/template/.pi/skills/cloudflare/references/wrangler/api.md +140 -0
- package/dist/template/.pi/skills/cloudflare/references/wrangler/configuration.md +128 -0
- package/dist/template/.pi/skills/cloudflare/references/wrangler/gotchas.md +93 -0
- package/dist/template/.pi/skills/cloudflare/references/wrangler/patterns.md +150 -0
- package/dist/template/.pi/skills/cloudflare/references/zaraz/README.md +360 -0
- package/dist/template/.pi/skills/code-cleanup/SKILL.md +232 -0
- package/dist/template/.pi/skills/code-review-and-quality/SKILL.md +344 -0
- package/dist/template/.pi/skills/code-simplification/SKILL.md +348 -0
- package/dist/template/.pi/skills/context-engineering/SKILL.md +296 -0
- package/dist/template/.pi/skills/core-data-expert/SKILL.md +117 -0
- package/dist/template/.pi/skills/core-data-expert/references/batch-operations.md +543 -0
- package/dist/template/.pi/skills/core-data-expert/references/cloudkit-integration.md +259 -0
- package/dist/template/.pi/skills/core-data-expert/references/concurrency.md +522 -0
- package/dist/template/.pi/skills/core-data-expert/references/fetch-requests.md +643 -0
- package/dist/template/.pi/skills/core-data-expert/references/glossary.md +233 -0
- package/dist/template/.pi/skills/core-data-expert/references/migration.md +393 -0
- package/dist/template/.pi/skills/core-data-expert/references/model-configuration.md +597 -0
- package/dist/template/.pi/skills/core-data-expert/references/performance.md +300 -0
- package/dist/template/.pi/skills/core-data-expert/references/persistent-history.md +553 -0
- package/dist/template/.pi/skills/core-data-expert/references/project-audit.md +60 -0
- package/dist/template/.pi/skills/core-data-expert/references/saving.md +574 -0
- package/dist/template/.pi/skills/core-data-expert/references/stack-setup.md +625 -0
- package/dist/template/.pi/skills/core-data-expert/references/testing.md +300 -0
- package/dist/template/.pi/skills/core-data-expert/references/threading.md +589 -0
- package/dist/template/.pi/skills/debugging-and-error-recovery/SKILL.md +274 -0
- package/dist/template/.pi/skills/deep-module-design/SKILL.md +218 -0
- package/dist/template/.pi/skills/defense-in-depth/SKILL.md +161 -0
- package/dist/template/.pi/skills/deprecation-and-migration/SKILL.md +186 -0
- package/dist/template/.pi/skills/design-system-audit/SKILL.md +176 -0
- package/dist/template/.pi/skills/design-taste-frontend/SKILL.md +255 -0
- package/dist/template/.pi/skills/development-lifecycle/SKILL.md +285 -0
- package/dist/template/.pi/skills/documentation-and-adrs/SKILL.md +217 -0
- package/dist/template/.pi/skills/doubt-driven-development/SKILL.md +207 -0
- package/dist/template/.pi/skills/fallow/SKILL.md +457 -0
- package/dist/template/.pi/skills/fallow/references/cli-reference.md +1905 -0
- package/dist/template/.pi/skills/fallow/references/gotchas.md +644 -0
- package/dist/template/.pi/skills/fallow/references/patterns.md +791 -0
- package/dist/template/.pi/skills/figma/SKILL.md +241 -0
- package/dist/template/.pi/skills/frontend-design/SKILL.md +262 -0
- package/dist/template/.pi/skills/frontend-design/references/animation/motion-advanced.md +224 -0
- package/dist/template/.pi/skills/frontend-design/references/animation/motion-core.md +181 -0
- package/dist/template/.pi/skills/frontend-design/references/canvas/execution.md +90 -0
- package/dist/template/.pi/skills/frontend-design/references/canvas/philosophy.md +94 -0
- package/dist/template/.pi/skills/frontend-design/references/design/color-system.md +111 -0
- package/dist/template/.pi/skills/frontend-design/references/design/interaction.md +149 -0
- package/dist/template/.pi/skills/frontend-design/references/design/typography-rules.md +106 -0
- package/dist/template/.pi/skills/frontend-design/references/design/ux-writing.md +99 -0
- package/dist/template/.pi/skills/frontend-design/references/shadcn/accessibility.md +132 -0
- package/dist/template/.pi/skills/frontend-design/references/shadcn/core-components.md +153 -0
- package/dist/template/.pi/skills/frontend-design/references/shadcn/form-components.md +158 -0
- package/dist/template/.pi/skills/frontend-design/references/shadcn/setup.md +69 -0
- package/dist/template/.pi/skills/frontend-design/references/shadcn/theming.md +152 -0
- package/dist/template/.pi/skills/frontend-design/references/tailwind/responsive.md +112 -0
- package/dist/template/.pi/skills/frontend-design/references/tailwind/utilities-layout.md +134 -0
- package/dist/template/.pi/skills/frontend-design/references/tailwind/utilities-styling.md +165 -0
- package/dist/template/.pi/skills/frontend-design/references/tailwind/v4-config.md +147 -0
- package/dist/template/.pi/skills/frontend-design/references/tailwind/v4-features.md +128 -0
- package/dist/template/.pi/skills/frontend-ui-engineering/SKILL.md +217 -0
- package/dist/template/.pi/skills/gemini-large-context/SKILL.md +238 -0
- package/dist/template/.pi/skills/git-workflow-and-versioning/SKILL.md +217 -0
- package/dist/template/.pi/skills/grill-me/SKILL.md +162 -0
- package/dist/template/.pi/skills/high-end-visual-design/SKILL.md +128 -0
- package/dist/template/.pi/skills/idea-refine/SKILL.md +195 -0
- package/dist/template/.pi/skills/idea-refine/examples.md +62 -0
- package/dist/template/.pi/skills/idea-refine/frameworks.md +63 -0
- package/dist/template/.pi/skills/idea-refine/refinement-criteria.md +56 -0
- package/dist/template/.pi/skills/incremental-implementation/SKILL.md +190 -0
- package/dist/template/.pi/skills/industrial-brutalist-ui/SKILL.md +131 -0
- package/dist/template/.pi/skills/interview-me/SKILL.md +227 -0
- package/dist/template/.pi/skills/jira/SKILL.md +306 -0
- package/dist/template/.pi/skills/loop-audit/SKILL.md +141 -0
- package/dist/template/.pi/skills/loop-cost/SKILL.md +130 -0
- package/dist/template/.pi/skills/loop-engineering/SKILL.md +175 -0
- package/dist/template/.pi/skills/minimalist-ui/SKILL.md +124 -0
- package/dist/template/.pi/skills/mockup-to-code/SKILL.md +197 -0
- package/dist/template/.pi/skills/observability-and-instrumentation/SKILL.md +202 -0
- package/dist/template/.pi/skills/opensrc/SKILL.md +297 -0
- package/dist/template/.pi/skills/opensrc/references/architecture.md +176 -0
- package/dist/template/.pi/skills/opensrc/references/cli-usage.md +176 -0
- package/dist/template/.pi/skills/opensrc/references/registry-support.md +137 -0
- package/dist/template/.pi/skills/pdf-extract/SKILL.md +461 -0
- package/dist/template/.pi/skills/performance-optimization/SKILL.md +233 -0
- package/dist/template/.pi/skills/performance-optimization/references/performance-checklist.md +85 -0
- package/dist/template/.pi/skills/planning-and-task-breakdown/SKILL.md +204 -0
- package/dist/template/.pi/skills/playwright/SKILL.md +404 -0
- package/dist/template/.pi/skills/playwright/references/agent-browser-cli.md +405 -0
- package/dist/template/.pi/skills/polar/SKILL.md +125 -0
- package/dist/template/.pi/skills/react-best-practices/SKILL.md +156 -0
- package/dist/template/.pi/skills/react-best-practices/rules/_sections.md +46 -0
- package/dist/template/.pi/skills/react-best-practices/rules/_template.md +28 -0
- package/dist/template/.pi/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/template/.pi/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
- package/dist/template/.pi/skills/react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/template/.pi/skills/react-best-practices/rules/async-defer-await.md +80 -0
- package/dist/template/.pi/skills/react-best-practices/rules/async-dependencies.md +36 -0
- package/dist/template/.pi/skills/react-best-practices/rules/async-parallel.md +28 -0
- package/dist/template/.pi/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/template/.pi/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/dist/template/.pi/skills/react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/template/.pi/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/template/.pi/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/template/.pi/skills/react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/template/.pi/skills/react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/template/.pi/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/template/.pi/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/template/.pi/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-length-check-first.md +49 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/template/.pi/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/template/.pi/skills/react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/template/.pi/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/template/.pi/skills/react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/template/.pi/skills/react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/template/.pi/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/template/.pi/skills/react-best-practices/rules/server-serialization.md +38 -0
- package/dist/template/.pi/skills/redesign-existing-projects/SKILL.md +217 -0
- package/dist/template/.pi/skills/resend/SKILL.md +196 -0
- package/dist/template/.pi/skills/resend/references/react-email.md +287 -0
- package/dist/template/.pi/skills/resend/references/receive-email.md +248 -0
- package/dist/template/.pi/skills/resend/references/send-email.md +318 -0
- package/dist/template/.pi/skills/root-cause-tracing/SKILL.md +216 -0
- package/dist/template/.pi/skills/security-and-hardening/SKILL.md +293 -0
- package/dist/template/.pi/skills/security-and-hardening/references/security-checklist.md +105 -0
- package/dist/template/.pi/skills/shipping-and-launch/SKILL.md +101 -0
- package/dist/template/.pi/skills/source-driven-development/SKILL.md +108 -0
- package/dist/template/.pi/skills/spec-driven-development/SKILL.md +177 -0
- package/dist/template/.pi/skills/srcwalk/SKILL.md +182 -0
- package/dist/template/.pi/skills/subagent-driven-development/SKILL.md +253 -0
- package/dist/template/.pi/skills/supabase/SKILL.md +153 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/SKILL.md +88 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/advanced-full-text-search.md +55 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/advanced-jsonb-indexing.md +49 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/conn-idle-timeout.md +46 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/conn-limits.md +44 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/conn-pooling.md +41 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/conn-prepared-statements.md +46 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/data-batch-inserts.md +54 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/data-n-plus-one.md +53 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/data-pagination.md +50 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/data-upsert.md +50 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/lock-advisory.md +56 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/lock-deadlock-prevention.md +68 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/lock-short-transactions.md +50 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/lock-skip-locked.md +54 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/monitor-explain-analyze.md +45 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/monitor-pg-stat-statements.md +55 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/monitor-vacuum-analyze.md +55 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/query-composite-indexes.md +44 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/query-covering-indexes.md +40 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/query-index-types.md +45 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/query-missing-indexes.md +43 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/query-partial-indexes.md +45 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/schema-data-types.md +46 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/schema-foreign-key-indexes.md +59 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/schema-lowercase-identifiers.md +55 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/schema-partitioning.md +55 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/schema-primary-keys.md +61 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/security-privileges.md +54 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/security-rls-basics.md +50 -0
- package/dist/template/.pi/skills/supabase-postgres-best-practices/rules/security-rls-performance.md +57 -0
- package/dist/template/.pi/skills/swift-concurrency/SKILL.md +290 -0
- package/dist/template/.pi/skills/swift-concurrency/references/actors.md +640 -0
- package/dist/template/.pi/skills/swift-concurrency/references/async-algorithms.md +822 -0
- package/dist/template/.pi/skills/swift-concurrency/references/async-await-basics.md +249 -0
- package/dist/template/.pi/skills/swift-concurrency/references/async-sequences.md +670 -0
- package/dist/template/.pi/skills/swift-concurrency/references/core-data.md +533 -0
- package/dist/template/.pi/skills/swift-concurrency/references/glossary.md +128 -0
- package/dist/template/.pi/skills/swift-concurrency/references/linting.md +142 -0
- package/dist/template/.pi/skills/swift-concurrency/references/memory-management.md +542 -0
- package/dist/template/.pi/skills/swift-concurrency/references/migration.md +1076 -0
- package/dist/template/.pi/skills/swift-concurrency/references/performance.md +574 -0
- package/dist/template/.pi/skills/swift-concurrency/references/sendable.md +578 -0
- package/dist/template/.pi/skills/swift-concurrency/references/tasks.md +604 -0
- package/dist/template/.pi/skills/swift-concurrency/references/testing.md +565 -0
- package/dist/template/.pi/skills/swift-concurrency/references/threading.md +452 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/SKILL.md +343 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/animation-advanced.md +351 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/animation-basics.md +284 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/animation-transitions.md +326 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/image-optimization.md +286 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/layout-best-practices.md +312 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/liquid-glass.md +377 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/list-patterns.md +153 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/modern-apis.md +400 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/performance-patterns.md +377 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/scroll-patterns.md +305 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/sheet-navigation-patterns.md +292 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/state-management.md +447 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/text-formatting.md +285 -0
- package/dist/template/.pi/skills/swiftui-expert-skill/references/view-structure.md +276 -0
- package/dist/template/.pi/skills/test-driven-development/SKILL.md +400 -0
- package/dist/template/.pi/skills/test-driven-development/references/testing-patterns.md +155 -0
- package/dist/template/.pi/skills/testing-anti-patterns/SKILL.md +339 -0
- package/dist/template/.pi/skills/using-agent-skills/SKILL.md +371 -0
- package/dist/template/.pi/skills/using-git-worktrees/SKILL.md +275 -0
- package/dist/template/.pi/skills/vercel-deploy-claimable/SKILL.md +144 -0
- package/dist/template/.pi/skills/vercel-deploy-claimable/scripts/deploy.sh +249 -0
- package/dist/template/.pi/skills/verification-before-completion/SKILL.md +348 -0
- package/dist/template/.pi/skills/webclaw/SKILL.md +188 -0
- package/dist/template/.pi/skills/writing-skills/SKILL.md +329 -0
- package/dist/template/.pi/skills/writing-skills/references/anti-patterns.md +25 -0
- package/dist/template/.pi/skills/writing-skills/references/claude-search-optimization.md +140 -0
- package/dist/template/.pi/skills/writing-skills/references/discovery-workflow.md +11 -0
- package/dist/template/.pi/skills/writing-skills/references/file-organization.md +32 -0
- package/dist/template/.pi/skills/writing-skills/references/flowcharts-and-examples.md +57 -0
- package/dist/template/.pi/skills/writing-skills/references/rationalization-hardening.md +75 -0
- package/dist/template/.pi/skills/writing-skills/references/testing-methodology.md +397 -0
- package/dist/template/.pi/skills/writing-skills/references/testing-skill-types.md +52 -0
- package/dist/template/.pi/subagents.json +10 -0
- package/dist/template/.pi/templates/adr.md +47 -0
- package/dist/template/.pi/templates/design.md +61 -0
- package/dist/template/.pi/templates/loop-github-action.yml +162 -0
- package/dist/template/.pi/templates/loop-orchestrator.sh +514 -0
- package/dist/template/.pi/templates/loop-orchestrator.test.ts +332 -0
- package/dist/template/.pi/templates/loop-orchestrator.ts +936 -0
- package/dist/template/.pi/templates/loop-state.json +24 -0
- package/dist/template/.pi/templates/loop-state.md +98 -0
- package/dist/template/.pi/templates/loop-vision.md +110 -0
- package/dist/template/.pi/templates/prd.md +204 -0
- package/dist/template/.pi/templates/progress.md +55 -0
- package/dist/template/.pi/templates/project.md +58 -0
- package/dist/template/.pi/templates/proposal.md +40 -0
- package/dist/template/.pi/templates/review-state.json +20 -0
- package/dist/template/.pi/templates/roadmap.md +93 -0
- package/dist/template/.pi/templates/state.md +97 -0
- package/dist/template/.pi/templates/tasks.md +202 -0
- package/dist/template/.pi/templates/tech-stack.md +85 -0
- package/dist/template/.pi/templates/user.md +26 -0
- package/dist/template/.pi/workflows/INDEX.md +63 -0
- package/dist/template/.pi/workflows/audit-pattern.md +84 -0
- package/dist/template/.pi/workflows/batch-implement.md +121 -0
- package/dist/template/.pi/workflows/deep-research.md +89 -0
- package/dist/template/.pi/workflows/development-lifecycle-workflow.md +175 -0
- package/dist/template/.pi/workflows/garbage-collection.md +144 -0
- package/dist/template/.pi/workflows/quality-loop.md +211 -0
- package/package.json +57 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Queues Gotchas & Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Idempotency Required
|
|
4
|
+
|
|
5
|
+
At-least-once delivery means duplicates possible. Design consumers to handle duplicates:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// [x] GOOD: Track processed messages
|
|
9
|
+
const processed = await env.PROCESSED_KV.get(msg.id);
|
|
10
|
+
if (processed) { msg.ack(); continue; }
|
|
11
|
+
await processMessage(msg.body);
|
|
12
|
+
await env.PROCESSED_KV.put(msg.id, '1', { expirationTtl: 86400 });
|
|
13
|
+
msg.ack();
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Content Type Visibility
|
|
17
|
+
|
|
18
|
+
- `json`: Visible in dashboard, works with pull consumers
|
|
19
|
+
- `v8`: NOT decodable by pull consumers or dashboard
|
|
20
|
+
- Use `json` for pull consumers
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// [x] For pull consumers
|
|
24
|
+
await env.MY_QUEUE.send(data, { contentType: 'json' });
|
|
25
|
+
|
|
26
|
+
// [ ] Avoid v8 with pull
|
|
27
|
+
await env.MY_QUEUE.send(new Date(), { contentType: 'v8' }); // Can't decode
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Retry Behavior
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// If you DON'T call ack() or retry(), message retries automatically
|
|
34
|
+
async queue(batch: MessageBatch): Promise<void> {
|
|
35
|
+
for (const msg of batch.messages) {
|
|
36
|
+
try {
|
|
37
|
+
await processMessage(msg.body);
|
|
38
|
+
msg.ack(); // Explicit success
|
|
39
|
+
} catch (error) {
|
|
40
|
+
// Don't call retry() - auto-retries with configured delay
|
|
41
|
+
// OR call retry() with custom delay
|
|
42
|
+
msg.retry({ delaySeconds: 600 });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## CPU Time Limits
|
|
49
|
+
|
|
50
|
+
Default: 30s per consumer invocation. Increase if needed:
|
|
51
|
+
|
|
52
|
+
```jsonc
|
|
53
|
+
{ "limits": { "cpu_ms": 300000 } } // 5 minutes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cost Optimization
|
|
57
|
+
|
|
58
|
+
Operations: write + read + delete = 3 ops per message
|
|
59
|
+
Retries add read ops
|
|
60
|
+
Formula: `((messages × 3) - 1M) / 1M × $0.40` per month
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// Keep messages <64 KB (charged per 64 KB chunk)
|
|
64
|
+
// Batch aggressively to reduce frequency
|
|
65
|
+
{ "max_batch_size": 100, "max_batch_timeout": 30 }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Message Not Delivered
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Check queue paused
|
|
72
|
+
wrangler queues list
|
|
73
|
+
|
|
74
|
+
# Verify consumer configured
|
|
75
|
+
wrangler queues consumer worker remove my-queue my-worker
|
|
76
|
+
wrangler queues consumer add my-queue my-worker
|
|
77
|
+
|
|
78
|
+
# Check logs for errors
|
|
79
|
+
wrangler tail my-worker
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## High DLQ Rate
|
|
83
|
+
|
|
84
|
+
- Review consumer error logs
|
|
85
|
+
- Check external dependency availability
|
|
86
|
+
- Verify message format matches expectations
|
|
87
|
+
- Increase retry delay: `"retry_delay": 300`
|
|
88
|
+
|
|
89
|
+
## Limits
|
|
90
|
+
|
|
91
|
+
| Limit | Value |
|
|
92
|
+
|-------|-------|
|
|
93
|
+
| Max queues | 10,000 |
|
|
94
|
+
| Message size | 128 KB |
|
|
95
|
+
| Batch size (consumer) | 100 messages |
|
|
96
|
+
| Batch size (sendBatch) | 100 msgs/256 KB |
|
|
97
|
+
| Throughput | 5,000 msgs/sec/queue |
|
|
98
|
+
| Retention | 4-14 days |
|
|
99
|
+
| Max backlog | 25 GB |
|
|
100
|
+
| Max delay | 12 hours (43,200s) |
|
|
101
|
+
| Max retries | 100 |
|
|
102
|
+
|
|
103
|
+
## Best Practices
|
|
104
|
+
|
|
105
|
+
- [x] Design for idempotency (at-least-once delivery)
|
|
106
|
+
- [x] Use `json` content type for visibility
|
|
107
|
+
- [x] Log failures with context
|
|
108
|
+
- [x] Configure DLQ for permanent failures
|
|
109
|
+
- [x] Use `waitUntil()` for non-blocking sends
|
|
110
|
+
- [x] Batch sends when possible
|
|
111
|
+
- [ ] Don't use v8 with pull consumers
|
|
112
|
+
- [ ] Don't rely on message ordering
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Queues Patterns & Best Practices
|
|
2
|
+
|
|
3
|
+
## Async Task Processing
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// Producer: Accept request, queue work
|
|
7
|
+
export default {
|
|
8
|
+
async fetch(request: Request, env: Env): Promise<Response> {
|
|
9
|
+
const { userId, reportType } = await request.json();
|
|
10
|
+
await env.REPORT_QUEUE.send({ userId, reportType, requestedAt: Date.now() });
|
|
11
|
+
return Response.json({ message: 'Report queued', status: 'pending' });
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Consumer: Process reports
|
|
16
|
+
export default {
|
|
17
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
18
|
+
for (const msg of batch.messages) {
|
|
19
|
+
const { userId, reportType } = msg.body;
|
|
20
|
+
const report = await generateReport(userId, reportType, env);
|
|
21
|
+
await env.REPORTS_BUCKET.put(`${userId}/${reportType}.pdf`, report);
|
|
22
|
+
msg.ack();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Buffering API Calls
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// Producer: Queue log entries
|
|
32
|
+
ctx.waitUntil(env.LOGS_QUEUE.send({
|
|
33
|
+
method: request.method,
|
|
34
|
+
url: request.url,
|
|
35
|
+
timestamp: Date.now()
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
// Consumer: Batch write to external API
|
|
39
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
40
|
+
const logs = batch.messages.map(m => m.body);
|
|
41
|
+
await fetch(env.LOG_ENDPOINT, { method: 'POST', body: JSON.stringify({ logs }) });
|
|
42
|
+
batch.ackAll();
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Rate Limiting Upstream
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
50
|
+
for (const msg of batch.messages) {
|
|
51
|
+
try {
|
|
52
|
+
await callRateLimitedAPI(msg.body);
|
|
53
|
+
msg.ack();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (error.status === 429) {
|
|
56
|
+
const retryAfter = parseInt(error.headers.get('Retry-After') || '60');
|
|
57
|
+
msg.retry({ delaySeconds: retryAfter });
|
|
58
|
+
} else throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Event-Driven Workflows
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// R2 event → Queue → Worker
|
|
68
|
+
export default {
|
|
69
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
70
|
+
for (const msg of batch.messages) {
|
|
71
|
+
const event = msg.body;
|
|
72
|
+
if (event.action === 'PutObject') {
|
|
73
|
+
await processNewFile(event.object.key, env);
|
|
74
|
+
} else if (event.action === 'DeleteObject') {
|
|
75
|
+
await cleanupReferences(event.object.key, env);
|
|
76
|
+
}
|
|
77
|
+
msg.ack();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Dead Letter Queue Pattern
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Main queue: After max_retries, goes to DLQ automatically
|
|
87
|
+
export default {
|
|
88
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
89
|
+
for (const msg of batch.messages) {
|
|
90
|
+
try {
|
|
91
|
+
await riskyOperation(msg.body);
|
|
92
|
+
msg.ack();
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error(`Failed after ${msg.attempts} attempts:`, error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// DLQ consumer: Log and store failed messages
|
|
101
|
+
export default {
|
|
102
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
103
|
+
for (const msg of batch.messages) {
|
|
104
|
+
await env.FAILED_KV.put(msg.id, JSON.stringify(msg.body));
|
|
105
|
+
msg.ack();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Priority Queues
|
|
112
|
+
|
|
113
|
+
High priority: `max_batch_size: 5, max_batch_timeout: 1`. Low priority: `max_batch_size: 100, max_batch_timeout: 30`.
|
|
114
|
+
|
|
115
|
+
## Delayed Job Processing
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
await env.EMAIL_QUEUE.send({ to, template, userId }, { delaySeconds: 3600 });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Fan-out Pattern
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
async fetch(request: Request, env: Env): Promise<Response> {
|
|
125
|
+
const event = await request.json();
|
|
126
|
+
|
|
127
|
+
// Send to multiple queues for parallel processing
|
|
128
|
+
await Promise.all([
|
|
129
|
+
env.ANALYTICS_QUEUE.send(event),
|
|
130
|
+
env.NOTIFICATIONS_QUEUE.send(event),
|
|
131
|
+
env.AUDIT_LOG_QUEUE.send(event)
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
return Response.json({ status: 'processed' });
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Idempotency Pattern
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
async queue(batch: MessageBatch, env: Env): Promise<void> {
|
|
142
|
+
for (const msg of batch.messages) {
|
|
143
|
+
// Check if already processed
|
|
144
|
+
const processed = await env.PROCESSED_KV.get(msg.id);
|
|
145
|
+
if (processed) {
|
|
146
|
+
msg.ack();
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
await processMessage(msg.body);
|
|
151
|
+
await env.PROCESSED_KV.put(msg.id, '1', { expirationTtl: 86400 });
|
|
152
|
+
msg.ack();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Cloudflare R2 Object Storage
|
|
2
|
+
|
|
3
|
+
S3-compatible object storage with zero egress fees, optimized for large file storage and delivery.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
R2 provides:
|
|
8
|
+
- S3-compatible API (Workers API + S3 REST)
|
|
9
|
+
- Zero egress fees globally
|
|
10
|
+
- Strong consistency for writes/deletes
|
|
11
|
+
- Storage classes (Standard/Infrequent Access)
|
|
12
|
+
- SSE-C encryption support
|
|
13
|
+
|
|
14
|
+
**Use cases:** Media storage, backups, static assets, user uploads, data lakes
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
wrangler r2 bucket create my-bucket --location=enam
|
|
20
|
+
wrangler r2 object put my-bucket/file.txt --file=./local.txt
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// Upload
|
|
25
|
+
await env.MY_BUCKET.put(key, data, {
|
|
26
|
+
httpMetadata: { contentType: 'image/jpeg' }
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Download
|
|
30
|
+
const object = await env.MY_BUCKET.get(key);
|
|
31
|
+
if (object) return new Response(object.body);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Core Operations
|
|
35
|
+
|
|
36
|
+
| Method | Purpose | Returns |
|
|
37
|
+
|--------|---------|---------|
|
|
38
|
+
| `put(key, value, options?)` | Upload object | `R2Object \| null` |
|
|
39
|
+
| `get(key, options?)` | Download object | `R2ObjectBody \| R2Object \| null` |
|
|
40
|
+
| `head(key)` | Get metadata only | `R2Object \| null` |
|
|
41
|
+
| `delete(keys)` | Delete object(s) | `Promise<void>` |
|
|
42
|
+
| `list(options?)` | List objects | `R2Objects` |
|
|
43
|
+
|
|
44
|
+
## Storage Classes
|
|
45
|
+
|
|
46
|
+
- **Standard**: Frequent access, low latency reads
|
|
47
|
+
- **InfrequentAccess**: 30-day minimum storage, retrieval fees, lower storage cost
|
|
48
|
+
|
|
49
|
+
## In This Reference
|
|
50
|
+
|
|
51
|
+
- [configuration.md](./configuration.md) - wrangler.jsonc bindings, S3 SDK setup, location hints
|
|
52
|
+
- [api.md](./api.md) - Workers API methods, multipart uploads, conditional requests
|
|
53
|
+
- [patterns.md](./patterns.md) - Streaming, caching, presigned URLs, storage transitions
|
|
54
|
+
- [gotchas.md](./gotchas.md) - List truncation, etag format, checksum limits, multipart pitfalls
|
|
55
|
+
|
|
56
|
+
## See Also
|
|
57
|
+
|
|
58
|
+
- [workers](../workers/) - Worker runtime and fetch handlers
|
|
59
|
+
- [kv](../kv/) - Metadata storage for R2 objects
|
|
60
|
+
- [d1](../d1/) - Store R2 URLs in relational database
|
|
61
|
+
- [queues](../queues/) - Process R2 uploads asynchronously
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# R2 API Reference
|
|
2
|
+
|
|
3
|
+
## PUT (Upload)
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// Basic
|
|
7
|
+
await env.MY_BUCKET.put(key, value);
|
|
8
|
+
|
|
9
|
+
// With metadata
|
|
10
|
+
await env.MY_BUCKET.put(key, value, {
|
|
11
|
+
httpMetadata: {
|
|
12
|
+
contentType: 'image/jpeg',
|
|
13
|
+
contentDisposition: 'attachment; filename="photo.jpg"',
|
|
14
|
+
cacheControl: 'max-age=3600'
|
|
15
|
+
},
|
|
16
|
+
customMetadata: { userId: '123', version: '2' },
|
|
17
|
+
storageClass: 'Standard', // or 'InfrequentAccess'
|
|
18
|
+
sha256: arrayBufferOrHex, // Integrity check
|
|
19
|
+
ssecKey: arrayBuffer32bytes // SSE-C encryption
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Value types: ReadableStream | ArrayBuffer | string | Blob
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## GET (Download)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
const object = await env.MY_BUCKET.get(key);
|
|
29
|
+
if (!object) return new Response('Not found', { status: 404 });
|
|
30
|
+
|
|
31
|
+
// Body formats
|
|
32
|
+
const buffer = await object.arrayBuffer();
|
|
33
|
+
const text = await object.text();
|
|
34
|
+
const json = await object.json();
|
|
35
|
+
const stream = object.body; // ReadableStream
|
|
36
|
+
|
|
37
|
+
// Ranged reads
|
|
38
|
+
const object = await env.MY_BUCKET.get(key, {
|
|
39
|
+
range: { offset: 0, length: 1024 }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Conditional GET
|
|
43
|
+
const object = await env.MY_BUCKET.get(key, {
|
|
44
|
+
onlyIf: { etagMatches: '"abc123"' }
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## HEAD (Metadata Only)
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const object = await env.MY_BUCKET.head(key);
|
|
52
|
+
console.log(object?.size, object?.etag, object?.storageClass);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## DELETE
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
await env.MY_BUCKET.delete(key);
|
|
59
|
+
await env.MY_BUCKET.delete([key1, key2, key3]); // Batch (max 1000)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## LIST
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const listed = await env.MY_BUCKET.list({
|
|
66
|
+
limit: 1000,
|
|
67
|
+
prefix: 'photos/',
|
|
68
|
+
cursor: cursorFromPrevious,
|
|
69
|
+
delimiter: '/',
|
|
70
|
+
include: ['httpMetadata', 'customMetadata']
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Pagination (always use truncated flag)
|
|
74
|
+
while (listed.truncated) {
|
|
75
|
+
const next = await env.MY_BUCKET.list({ cursor: listed.cursor });
|
|
76
|
+
listed.objects.push(...next.objects);
|
|
77
|
+
listed.truncated = next.truncated;
|
|
78
|
+
listed.cursor = next.cursor;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Multipart Uploads
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
const multipart = await env.MY_BUCKET.createMultipartUpload(key, {
|
|
86
|
+
httpMetadata: { contentType: 'video/mp4' }
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const uploadedParts: R2UploadedPart[] = [];
|
|
90
|
+
for (let i = 0; i < partCount; i++) {
|
|
91
|
+
const part = await multipart.uploadPart(i + 1, partData);
|
|
92
|
+
uploadedParts.push(part);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const object = await multipart.complete(uploadedParts);
|
|
96
|
+
// OR: await multipart.abort();
|
|
97
|
+
|
|
98
|
+
// Resume
|
|
99
|
+
const multipart = env.MY_BUCKET.resumeMultipartUpload(key, uploadId);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## R2Object Interface
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
interface R2Object {
|
|
106
|
+
key: string;
|
|
107
|
+
version: string;
|
|
108
|
+
size: number;
|
|
109
|
+
etag: string; // Unquoted
|
|
110
|
+
httpEtag: string; // Quoted (use for headers)
|
|
111
|
+
uploaded: Date;
|
|
112
|
+
httpMetadata: R2HTTPMetadata;
|
|
113
|
+
customMetadata: Record<string, string>;
|
|
114
|
+
storageClass: 'Standard' | 'InfrequentAccess';
|
|
115
|
+
checksums: R2Checksums;
|
|
116
|
+
writeHttpMetadata(headers: Headers): void;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## CLI Operations
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
wrangler r2 object put my-bucket/file.txt --file=./local.txt --content-type=text/plain
|
|
124
|
+
wrangler r2 object get my-bucket/file.txt --file=./download.txt
|
|
125
|
+
wrangler r2 object delete my-bucket/file.txt
|
|
126
|
+
wrangler r2 object list my-bucket --prefix=photos/ --delimiter=/
|
|
127
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# R2 Configuration
|
|
2
|
+
|
|
3
|
+
## Workers Binding
|
|
4
|
+
|
|
5
|
+
**wrangler.jsonc:**
|
|
6
|
+
```jsonc
|
|
7
|
+
{
|
|
8
|
+
"r2_buckets": [
|
|
9
|
+
{
|
|
10
|
+
"binding": "MY_BUCKET",
|
|
11
|
+
"bucket_name": "my-bucket-name"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**wrangler.toml:**
|
|
18
|
+
```toml
|
|
19
|
+
[[r2_buckets]]
|
|
20
|
+
binding = 'MY_BUCKET'
|
|
21
|
+
bucket_name = 'my-bucket-name'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## TypeScript Types
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
interface Env { MY_BUCKET: R2Bucket; }
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
async fetch(request: Request, env: Env): Promise<Response> {
|
|
31
|
+
const object = await env.MY_BUCKET.get('file.txt');
|
|
32
|
+
return new Response(object?.body);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## S3 SDK Setup
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
|
41
|
+
|
|
42
|
+
const s3 = new S3Client({
|
|
43
|
+
region: 'auto',
|
|
44
|
+
endpoint: `https://${accountId}.r2.cloudflarestorage.com`,
|
|
45
|
+
credentials: {
|
|
46
|
+
accessKeyId: env.R2_ACCESS_KEY_ID,
|
|
47
|
+
secretAccessKey: env.R2_SECRET_ACCESS_KEY
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await s3.send(new PutObjectCommand({
|
|
52
|
+
Bucket: 'my-bucket',
|
|
53
|
+
Key: 'file.txt',
|
|
54
|
+
Body: data,
|
|
55
|
+
StorageClass: 'STANDARD' // or 'STANDARD_IA'
|
|
56
|
+
}));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Location Hints
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
wrangler r2 bucket create my-bucket --location=enam
|
|
63
|
+
|
|
64
|
+
# Hints: wnam, enam, weur, eeur, apac, oc
|
|
65
|
+
# Jurisdictions (override hint): --jurisdiction=eu (or fedramp)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Bucket Management
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
wrangler r2 bucket create my-bucket --location=enam --storage-class=Standard
|
|
72
|
+
wrangler r2 bucket list
|
|
73
|
+
wrangler r2 bucket info my-bucket
|
|
74
|
+
wrangler r2 bucket delete my-bucket # Must be empty
|
|
75
|
+
wrangler r2 bucket update-storage-class my-bucket --storage-class=InfrequentAccess
|
|
76
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# R2 Gotchas & Troubleshooting
|
|
2
|
+
|
|
3
|
+
## List Truncation
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// [ ] WRONG: Don't compare object count when using include
|
|
7
|
+
while (listed.objects.length < options.limit) { ... }
|
|
8
|
+
|
|
9
|
+
// [x] CORRECT: Always use truncated property
|
|
10
|
+
while (listed.truncated) {
|
|
11
|
+
const next = await env.MY_BUCKET.list({ cursor: listed.cursor });
|
|
12
|
+
// ...
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Reason:** `include` with metadata may return fewer objects per page to fit metadata.
|
|
17
|
+
|
|
18
|
+
## ETag Format
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// [ ] WRONG: Using etag (unquoted) in headers
|
|
22
|
+
headers.set('etag', object.etag); // Missing quotes
|
|
23
|
+
|
|
24
|
+
// [x] CORRECT: Use httpEtag (quoted)
|
|
25
|
+
headers.set('etag', object.httpEtag);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Checksum Limits
|
|
29
|
+
|
|
30
|
+
Only ONE checksum algorithm allowed per PUT:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// [ ] WRONG: Multiple checksums
|
|
34
|
+
await env.MY_BUCKET.put(key, data, { md5: hash1, sha256: hash2 }); // Error
|
|
35
|
+
|
|
36
|
+
// [x] CORRECT: Pick one
|
|
37
|
+
await env.MY_BUCKET.put(key, data, { sha256: hash });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Multipart Requirements
|
|
41
|
+
|
|
42
|
+
- All parts must be uniform size (except last part)
|
|
43
|
+
- Part numbers start at 1 (not 0)
|
|
44
|
+
- Uncompleted uploads auto-abort after 7 days
|
|
45
|
+
- `resumeMultipartUpload` doesn't validate uploadId existence
|
|
46
|
+
|
|
47
|
+
## Conditional Operations
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Precondition failure returns object WITHOUT body
|
|
51
|
+
const object = await env.MY_BUCKET.get(key, {
|
|
52
|
+
onlyIf: { etagMatches: '"wrong"' }
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Check for body, not just null
|
|
56
|
+
if (!object) return new Response('Not found', { status: 404 });
|
|
57
|
+
if (!object.body) return new Response(null, { status: 304 }); // Precondition failed
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Key Validation
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// [ ] DANGEROUS: Path traversal
|
|
64
|
+
const key = url.pathname.slice(1); // Could be ../../../etc/passwd
|
|
65
|
+
await env.MY_BUCKET.get(key);
|
|
66
|
+
|
|
67
|
+
// [x] SAFE: Validate keys
|
|
68
|
+
if (!key || key.includes('..') || key.startsWith('/')) {
|
|
69
|
+
return new Response('Invalid key', { status: 400 });
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Storage Class Pitfalls
|
|
74
|
+
|
|
75
|
+
- InfrequentAccess: 30-day minimum billing (even if deleted early)
|
|
76
|
+
- Can't transition IA → Standard via lifecycle (use S3 CopyObject)
|
|
77
|
+
- Retrieval fees apply for IA reads
|
|
78
|
+
|
|
79
|
+
## Limits
|
|
80
|
+
|
|
81
|
+
| Limit | Value |
|
|
82
|
+
|-------|-------|
|
|
83
|
+
| Object size | 5 TB |
|
|
84
|
+
| Multipart part count | 10,000 |
|
|
85
|
+
| Batch delete | 1,000 keys |
|
|
86
|
+
| List limit | 1,000 per request |
|
|
87
|
+
| Key size | 1024 bytes |
|
|
88
|
+
| Custom metadata | 2 KB per object |
|
|
89
|
+
|
|
90
|
+
## Common Errors
|
|
91
|
+
|
|
92
|
+
**"oldString not found"**: Object key doesn't exist
|
|
93
|
+
**List compatibility_date**: Set `compatibility_date >= 2022-08-04` or enable `r2_list_honor_include` flag
|
|
94
|
+
**Multipart part size**: Ensure uniform size except final part
|