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/CONTRIBUTING.md
112 lines · 5.7 KBRaw History
1# Contributing to Diffinery
2
3Thanks for your interest in Diffinery. Bug reports, fixes, documentation, compatibility
4reports and new features are all welcome, from people and from AI agents working for
5them.
6
7## Where development happens
8
9Diffinery is developed at
10[github.com/codician-team/diffinery](https://github.com/codician-team/diffinery). Open
11issues and pull requests there. Its CI runs on Diffinery's own runners for GitHub, and
12merges to `main` deploy diffinery.com.
13
14[diffinery.com/codician/diffinery](https://diffinery.com/codician/diffinery) is an older
15copy that is no longer updated, and its Actions are off. Don't open issues or pull
16requests there.
17
18Security problems are the exception: report them privately, never in an issue or pull
19request. See [SECURITY.md](SECURITY.md).
20
21## Before you start
22
23- For anything bigger than a small fix, open an issue first and describe what you want to
24 change, so we can agree on the approach before you spend time on it.
25- Check [Compatibility with GitHub Actions](https://diffinery.com/docs/actions/compatibility)
26 before reporting a workflow difference: known gaps are listed there.
27- Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
28
29## Set up a development environment
30
31You need Node.js 22 and pnpm 10 (the repository pins `[email protected]`; `corepack enable`
32picks it up). Docker is only needed to build the runner image. No Cloudflare account is
33needed: everything runs locally under `wrangler dev`.
34
35```sh
36pnpm install
37pnpm -r build # runner agent, web islands and docs
38pnpm --filter @diffinery/app db:migrate:local # local D1
39pnpm dev # http://localhost:8787, signed in as [email protected]
40```
41
42## Tests
43
44```sh
45pnpm -r typecheck
46pnpm -r test # unit tests (Vitest)
47pnpm --filter @diffinery/app e2e # end-to-end: wrangler dev, real git, the runner agent and Chromium
48```
49
50The end-to-end suite pushes real repositories with `git`, runs their workflows through the
51real runner agent, drives the MCP server and the REST API with `@octokit/rest`, and signs
52in with passkeys in Chromium with a virtual authenticator. It takes a while and uses a lot
53of memory for the large-push tests; run the file you changed first, for example
54`cd apps/diffinery && node --test --test-timeout=600000 test/e2e/registry.test.mjs`.
55
56Pull requests must pass CI (typecheck, the Worker bundle and the unit tests) and the
57end-to-end shards before they merge. Tests must not depend on the speed of the machine
58they run on.
59
60The "End-to-end (runner Docker)" job needs one of Diffinery's own runners, which GitHub
61picks through the repository variable `DIFFINERY_RUNS_ON`. GitHub doesn't pass repository
62variables to pull requests from forks, so on a fork's pull request that job is skipped,
63not failed. If your change touches the runner's Docker support (`containers/runner`), a
64maintainer runs the job by pushing your branch to this repository.
65
66## Conventions
67
68- **TypeScript everywhere**, in strict mode, sharing code through the workspace packages in
69 `packages/`. Keep dependencies few: the git core (`packages/git-core`) needs only `pako` and `diff`.
70- **Comments say why**, in plain sentences, next to the code they explain. Match the
71 density and style of the code around your change.
72- **Docs ship with the feature.** Every user- or admin-visible change updates the pages in
73 `apps/diffinery/docs` (served at [diffinery.com/docs](https://diffinery.com/docs), also as
74 Markdown and in `llms.txt`). Write for people and for AI agents: short sentences, exact
75 names of buttons, settings, endpoints and flags, and tables for reference material.
76- **GitHub compatibility.** Where GitHub has an API, a workflow feature or an event,
77 Diffinery follows it, so existing tools (git, `gh`, Octokit, actions) work unchanged.
78 When Diffinery has to differ, say so in the docs.
79- **Open-source runtime.** Diffinery also runs on [celld](https://celld.dev), the open-source
80 Workers runtime. A Cloudflare feature celld lacks must be optional, a new `wrangler.jsonc`
81 key must be mapped in `scripts/celld-config.mjs`, and the unit test `celld.test.ts` checks
82 both. See [Run on celld](https://diffinery.com/docs/self-hosting/celld).
83- **Database migrations.** D1 migrations live in `apps/diffinery/migrations`. Use the next
84 free number and never edit a migration that has shipped.
85- **Security first.** Agents never get a bypass: guardrails are enforced on the server for
86 git, REST, MCP and the web UI alike. Never log secrets or tokens. Changes to sign-in,
87 tokens, permissions, secrets or the runner sandbox get extra review.
88- **UI and product conventions** (passkeys first, Kumo components, no native `<select>` or
89 checkboxes) are in [docs/PREFERENCES.md](docs/PREFERENCES.md).
90
91## Pull requests
92
93- Keep each pull request to one change, with a title that says what it does
94 ("Merge queue: rebuild groups behind a failed one") and a description of why and how it
95 was tested. The [pull request template](.github/pull_request_template.md) has the
96 checklist.
97- Changes to files under `.github/workflows` always need a maintainer to merge them, on
98 purpose: agents can't land workflow changes.
99- Pull requests are squash-merged.
100
101## AI agents
102
103Agents are welcome contributors. An agent working on this repository should follow the
104same conventions, run the tests before asking for review, and say in the pull request
105which person it works for. The [docs for AI agents](https://diffinery.com/docs/agents/docs-for-agents)
106explain how to read the documentation as Markdown and over MCP.
107
108## License
109
110Diffinery is licensed under the [Apache License 2.0](LICENSE). By contributing, you agree
111that your contributions are licensed under the same license, as section 5 of the license
112describes.