-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
root: add AGENTS.md #22073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dominic-r
wants to merge
4
commits into
main
Choose a base branch
from
sdko/agentsmd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
root: add AGENTS.md #22073
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # AGENTS.md | ||
|
|
||
| This is **authentik** — an open-source Identity Provider. The codebase spans a | ||
| Django backend, Go outposts, Rust components, and a Lit/TS web UI, with pieces | ||
| wired together through Django signals, Channels, blueprints, flow plans, and a | ||
| generated API client. It's a lot of moving parts. Before changing something | ||
| non-trivial, pause to think about what else touches it: a model edit can ripple | ||
| through serializers, signals, blueprints, and the generated TS client. | ||
|
|
||
| ## Commits | ||
|
|
||
| Format the subject as `area: short message`. Skip the long body unless | ||
| something genuinely needs explaining. The `area` is wherever you worked, e.g.: | ||
|
|
||
| - `root:` — repo-wide changes | ||
| - `core:` — `authentik/core` and dependency bumps | ||
| - `api:` — API surface | ||
| - `web:`, `web/admin:`, `web/flows:`, `web/stages:` — frontend | ||
| - `website:`, `website/docs:`, `website/integrations:` | ||
| - `stages/invitation:`, `providers/oauth2:`, `providers/oauth:` — feature modules | ||
| - `enterprise/providers/ssf:` | ||
| - `lifecycle/worker_process:` | ||
| - `tenants:`, `ci:`, `docs:`, `translate:` | ||
|
|
||
| When the user gives you a PR or issue for the bug being fixed, add a | ||
| `Closes: #NNN` trailer on its own line — don't tack `(#NNN)` onto the subject. | ||
|
|
||
| **Never** include customer information or any potentially sensitive *content* | ||
| taken from internal sources — verbatim or reworded — anywhere in the repo | ||
| (code, comments, commit messages, PR descriptions, docs) unless explicitly | ||
| allowed. This covers customer names, support ticket contents, quoted Slack | ||
| messages, private incident details, and similar. | ||
|
|
||
| Links are fine. A Slack permalink, a GitHub issue link, or an internal ticket | ||
| URL in a commit message or PR description is good context — it's the | ||
| sensitive *content* that must not be copied into the repo. When in doubt, | ||
| leave the content out and link instead. | ||
|
|
||
| A commit should be a finished, working unit. Don't commit half-done work. | ||
| Before committing, run whatever applies: | ||
|
|
||
| - `make lint-fix` | ||
| - `make gen` if you touched models or serializers | ||
| - `make web` if you touched `web/` | ||
| - `make docs` if you touched `website/docs/` | ||
| - `make integrations` if you touched `website/integrations/` | ||
| - `./manage.py makemigrations --check` — no pending migrations | ||
|
|
||
| The `Makefile` has more targets per area (tests, Go, Rust) — use them when | ||
| relevant. | ||
|
|
||
| ## Don't hand-edit generated or vendored files | ||
|
|
||
| Run `make gen` instead. Off-limits: | ||
|
|
||
| - `schema.yml` (OpenAPI) | ||
| - `gen-ts-api/` | ||
| - `packages/client-go/`, `packages/client-ts/`, `packages/client-rust/` | ||
| - `schemas/` — these are upstream SAML / SCIM / WS-* specs, not ours | ||
|
|
||
| If the output looks wrong, fix the source (models, serializers, generator | ||
| config) and regenerate. | ||
|
|
||
| ## Migrations | ||
|
|
||
| Generate them with `./manage.py makemigrations`. Don't hand-write or hand-edit | ||
| migration files unless the user specifically asks (data migrations, squashes, | ||
| or repairing a bad one). Read what Django produced before committing — autogen | ||
| sometimes catches more than you intended. | ||
|
|
||
| ## Localization | ||
|
|
||
| Anything user-visible needs to be translatable: | ||
|
|
||
| - Python: `from django.utils.translation import gettext_lazy as _`, then `_("...")` | ||
| - TS / Lit: `msg("...")` from `@lit/localize` | ||
| - Django templates: `{% trans %}` / `{% blocktrans %}` | ||
|
|
||
| No raw English strings in user-facing surfaces. | ||
|
|
||
| ## Tests, proportionate | ||
|
|
||
| Size tests to the code. A 28-line function doesn't need a 400-line test file. | ||
| Cover meaningful behavior and obvious edge cases; don't pad for coverage or | ||
| re-test the framework. Mechanical changes (renames, type tweaks) usually ride | ||
| on existing tests. | ||
|
|
||
| ## Reuse what's already there | ||
|
|
||
| There's a large pool of helpers — find them before writing new ones. | ||
|
|
||
| - **Django first.** `django.utils`, `django.shortcuts`, the ORM, the auth | ||
| framework — most generic things already exist there. | ||
| - **Then authentik.** `authentik/lib/`, `authentik/core/`, and the feature | ||
| module you're working in. | ||
| - **Call helpers, don't inline them.** If `plan.to_redirect()` exists, use it | ||
| instead of rebuilding the redirect at every call site. Same goes for | ||
| permission checks, flow plan helpers, event logging, serializer mixins, etc. | ||
|
|
||
| ## DRY, with judgment | ||
|
|
||
| Deduplicate behavior, not boilerplate. Some things are cheap to restate and | ||
| often clearer that way — serializers, simple model definitions, view glue, | ||
| short config blocks — don't twist them through inheritance or shared bases | ||
| just to save lines. But duplicated *behavior* — a function body copy-pasted | ||
| across modules, a permission check reimplemented inline, a redirect built from | ||
| scratch next to a helper that already does it — should collapse to one place. | ||
| If changing the logic later would mean hunting down every copy, it belongs in | ||
| one spot. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.