Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

diffinery/AGENTS.md
84 lines · 4.7 KBRaw History
1# AGENTS.md
2
3Guidance for AI coding agents (Claude Code, Codex, Cursor and others) working on this
4repository. People should read [CONTRIBUTING.md](CONTRIBUTING.md); everything here agrees
5with it.
6
7## What this repository is
8
9Diffinery: an open-source git forge with GitHub Actions–compatible CI that runs entirely on
10Cloudflare. One Cloudflare Worker serves the web UI, git over HTTPS, a GitHub-compatible
11REST and GraphQL API and an MCP server; each repository is a Durable Object with its own
12SQLite database; CI jobs run in Cloudflare Containers. Development happens at
13https://github.com/codician-team/diffinery: push branches and open pull requests there.
14https://diffinery.com/codician/diffinery is an older copy that is no longer updated, with
15Actions off.
16
17## Layout
18
19```
20apps/diffinery the Worker: src/ (web UI, git, REST/GraphQL, MCP, Actions), migrations/ (D1),
21 docs/ (served at diffinery.com/docs), site/ (marketing pages), test/ (unit and e2e)
22apps/cli the `diffinery` command-line client
23apps/vscode the VS Code, Cursor and Windsurf extension
24apps/jetbrains the JetBrains IDE plugin
25plugins the Claude Code and Codex plugins
26containers/runner the runner agent, sandbox server and container image
27packages/git-core git objects, packfiles, deltas, diff and merge, in pure TypeScript
28packages/workflow-yaml the GitHub Actions workflow parser, expressions, matrices and cron
29packages/shared types shared by the Worker and the runner
30scripts setup and deploy scripts for Cloudflare
31```
32
33## Commands
34
35Node.js 22 and pnpm 10 (`corepack enable`). No Cloudflare account is needed to develop.
36
37```sh
38pnpm install
39pnpm -r build # runner agent, web islands and docs
40pnpm -r typecheck
41pnpm -r test # unit tests (Vitest)
42pnpm --filter @diffinery/app db:migrate:local # local D1
43pnpm dev # http://localhost:8787, signed in as [email protected]
44cd apps/diffinery && node --test --test-timeout=600000 test/e2e/<file>.test.mjs # one e2e file
45```
46
47Run repository tools with `pnpm exec`, never bare `npx`. Run the typecheck and the unit
48tests before you ask for review, and the end-to-end file closest to your change. Tests must
49not depend on the speed of the machine they run on.
50
51## Rules
52
53- **Docs ship with the feature.** Any user- or admin-visible change updates the Markdown in
54 `apps/diffinery/docs` (and `apps/diffinery/site` for product pages). Write for people and
55 agents: short sentences, exact names of buttons, settings, endpoints and flags.
56- **Follow GitHub where GitHub has an API, event or workflow feature**, so git, `gh`,
57 Octokit and actions keep working. Document any difference in
58 `apps/diffinery/docs/actions/compatibility.md` or the relevant page.
59- **Keep it running on celld**, the open-source Workers runtime
60 (`apps/diffinery/docs/self-hosting/celld.md`). Make a binding celld lacks optional (and list it in
61 `CELLD_ABSENT_BINDINGS`), map any new `wrangler.jsonc` key in `scripts/celld-config.mjs`, and import only
62 `cloudflare:workers`, `cloudflare:workflows`, `cloudflare:sockets` and the `node:` modules celld has. Never return a stream or a
63 `Response` from a Durable Object RPC method: stream through its `fetch()`. `test/unit/celld.test.ts` checks it.
64- **D1 migrations** live in `apps/diffinery/migrations`. Use the next free number and never
65 edit a migration that has shipped.
66- **Security:** guardrails for agents are enforced on the server for git, REST, MCP and the
67 web UI alike. Never add a bypass, never log secrets or tokens, and never weaken push
68 protection, branch protection or the runner sandbox to make something pass.
69- **UI:** passkeys first, no passwords; Kumo components through `KSelect`, `KCheckbox` and
70 `KRadio`, never a native `<select>`, checkbox or radio. See
71 [docs/PREFERENCES.md](docs/PREFERENCES.md).
72- **Code style:** strict TypeScript, few dependencies, comments that say why, matching the
73 density and style of the code around your change.
74- **Pull requests:** one change each, a title that says what it does, an `intent` that says
75 what it is for, and the person you work for in the description. Changes under
76 `.github/workflows` need a maintainer to merge them. Never skip or disable a test to get
77 green.
78
79## Reading the docs as an agent
80
81Every docs page is Markdown at `https://diffinery.com/docs/<page>.md`, the whole set is in
82https://diffinery.com/llms.txt and https://diffinery.com/llms-full.txt, and the MCP server
83at `https://diffinery.com/mcp` has `search_docs` and `read_docs`. See
84[Docs for AI agents](https://diffinery.com/docs/agents/docs-for-agents).