Piyaz is an agentic workspace for project management, where people and coding
agents work on the same project. It runs as an MCP server
(app/api/mcp/route.ts, nine ref-first tools) with a Next.js web app on top, storing
a project as a graph of tasks, dependency edges, decisions, and execution records.
Full contributor guidance is in CLAUDE.md and CONTRIBUTING.md. This file is the short version.
bun install
bun run dev # next dev
bun run lint # eslint, the linter
bun run typecheck # tsc --noEmit
bun run format # biome, the formatter only
bun test # full suite; use `bun run test` so the test DB starts
bun test tests/api/task.test.ts # one file, once the test DB is upCI gates in order: bun audit, format:check, lint, typecheck, a db:generate
diff check, test, check:plugins.
app/routes, RSCs, and UI; route handlers underapp/api/**lib/actions/server actions, the auth-checked mutation entry pointslib/data/all RLS-scoped DB access, one module per aggregate; the only layer that toucheswithUserContextlib/db/Drizzle client, driver selection, RLS helperslib/auth/better-auth wiring, sessions, MCP token verificationlib/mcp/tool registration and schemas;lib/graph/tools/one handler module per tool;lib/context/_core/the context lenses tasks are read throughplugins/vendor plugins for Claude Code, Codex, Cursor, and Antigravity
- Row-level security is the tenant boundary. Never call
db.select,db.query.*,db.transaction(), or.batch()directly. Go throughwithUserContext(userId, tx)orwithUserContextReadfrom@/lib/db/rls. ESLint rejects the alternatives with the reason inline. - Two build targets from one codebase: self-host Node and Cloudflare Workers.
Runtime-specific modules come in
.node.ts/.workers.tspairs; the bare module re-exports the Node variant andnext.config.tsswaps it for Workers builds. Editing one variant usually means editing its sibling, because typecheck only sees.node. publicschema belongs to Drizzle (lib/db/schema.ts+bun run db:generate); thepiyaz_authschema, roles, grants, and RLS policies are hand-written SQL underdocker/. Migrations are roll-forward only;db:pushis for throwaway test DBs.- Generated files.
plugins/claude-code/is canonical; runbun run sync:pluginsafter editing shared skills. The MCP tool docs are generated byscripts/generate-docs.tsinto a separate repo. Do not hand-edit either output. - This repository is public. No real project data, ids, emails, or tokens in commits, comments, or PR text.
Conventional Commits, imperative, lowercase, under 72 characters, signed. Squash merge
only. Versions and CHANGELOG.md are managed by release-please; do not bump them by
hand.