{"path":"README.md","content":"# cf-workflows-pipeline\n\n[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/nexarq-ai/cf-workflows-pipeline)\n\nA durable content pipeline in a \"Mission control\" UI. It shows **Cloudflare Workflows** (`step.do` with retries and timeouts, `step.waitForEvent` human approval), **Workers AI through AI Gateway**, a **D1** mirror of step state, and a live step timeline.\n\n## Architecture\n\n```mermaid\nflowchart LR\n  B[Browser] -->|POST /api/runs, poll 1s| W[Worker]\n  W -->|create / sendEvent| P[ContentPipeline Workflow]\n  P --> I[ingest] --> E[extract] --> S[summarise]\n  S -->|env.AI.run via AI Gateway| AI[Workers AI]\n  S --> A{{waitForEvent approval}}\n  A -->|approve| U[publish]\n  A -->|reject| R[rejected]\n  P -. mirror state .-> D[(D1 runs, steps, published)]\n  W --> D\n  B -->|/p/id| W\n```\n\nSee [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) and [docs/API.md](docs/API.md).\n\n## Local dev\n```\nnpm install\nnpx wrangler d1 migrations apply DB --local\nnpm run dev\n```\n\n## Tests\n`npm test` (Vitest, Node environment) and `npm run typecheck`.\n\n## Deploy\n`npm run deploy`, `npm run deploy:staging`. Deploying with the button or Gitflare Deploys creates the D1 databases: `wrangler.jsonc` deliberately has no `database_id` values. If deploying by hand, create the databases and add their ids.\n\n## Configuration\n| Name | Kind | Purpose |\n|---|---|---|\n| `DB` | D1 | runs, steps, published |\n| `AI` | Workers AI | summarisation |\n| `PIPELINE` | Workflow | `ContentPipeline` |\n| `AI_GATEWAY_ID` | var | AI Gateway id, default `gitflare` |\n\n## Costs\nWorkers, Workflows, D1 and Workers AI have free allowances, then usage-based billing. Each run makes one model call; if AI fails, a deterministic extractive summary is used and marked as fallback. See Cloudflare pricing for current rates.\n\n## Screenshots\nAdd screenshots of the timeline and approval card here.\n\n## Built with Gitflare\nThis repository was built by cooperating coding agents on Gitflare, verified with `npx vitest run`.\n\n## License\nApache-2.0\n","commitSha":"629b2faa417e687853ed68ec913bf2a004f44d6b"}