This guide covers commit message format, code style, and the PR submission process.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/TecharoHq/Anubis/llms.txt
Use this file to discover all available pages before exploring further.
Commit Message Format
All commits must follow Conventional Commits format:Commit Types
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, no logic changes)refactor: Code refactoring (no behavior changes)perf: Performance improvementstest: Adding or updating testsbuild: Build system or dependency changesci: CI/CD configuration changeschore: Maintenance tasksrevert: Revert a previous commit
Examples
Commit Rules
- Keep descriptions concise
- Use imperative mood (“add feature” not “added feature”)
- Use lowercase for descriptions
- No trailing period
- Add
!after type/scope for breaking changes - Use
BREAKING CHANGE:in footer for breaking changes - Reference issues/PRs in footer when applicable
Signed Commits (REQUIRED)
Sign Your Commits
Every commit must include aSigned-off-by line:
-s shorthand:
AI Agent Attribution
If you’re using an AI coding tool, you must disclose it in the commit footer:Automatic Signoff
Configure Git to sign off commits automatically:.husky/commit-msg in the repository).
Code Style
Go
Anubis follows Go standard library idioms:- Formatting: Use
goimports(runnpm run format) - Package aliases: Only when names collide
- Naming:
PublicFunctionsAndTypesin PascalCaseprivateFunctionsAndTypesin camelCase- Acronyms stay uppercase (
URL,HTTP,IP,DNS)
- Errors:
- Sentinel errors as package-level
Errprefixed variables - Wrap with
fmt.Errorf("package: context: %w", err) - Use
errors.Isfor validation
- Sentinel errors as package-level
- Logging:
- Use
log/slogfor structured logging - Pass loggers as function arguments
- Prefer
slog.Debugunless users need to see the message
- Use
- Configuration:
- Use both
jsonandyamlstruct tags - Use pointer values for optional fields
- Validate with
Valid() errormethods
- Use both
- Tests:
- Use table-driven tests
- Use
t.Helper()in helper functions - Use
t.Cleanup()for teardown - Prefer same-package tests over
_testpackages
JavaScript/TypeScript
- Source in
web/js/ - Built with esbuild
- Uses Preact (not React)
- Use
constby default - Keep functions small
- No linter config - rely on code review
Templ Templates
.templfiles inweb/generate Go code- Run
npm run assetsafter modifying - Keep logic in Go, not templates
- Templates receive typed Go parameters
Pull Request Process
Before Submitting
-
Build assets:
-
Run tests:
-
Run linting:
-
Format code:
-
Update CHANGELOG:
Add your changes to
[Unreleased]indocs/docs/CHANGELOG.md
PR Checklist
- All commits follow Conventional Commits format
- All commits are signed with
--signoff - All commits have verified (signed) signatures
- Tests added for bug fixes and new features
- Integration tests pass (
npm run test:integration) - CHANGELOG updated in
docs/docs/CHANGELOG.md - AI tool attribution added if applicable
- Code follows project style guidelines
Creating the PR
-
Push your branch:
- Open PR on GitHub
-
Fill out template (see
.github/PULL_REQUEST_TEMPLATE.md) - Request review
PR Review
Anubis is security software - code reviews are strict:- Security implications are carefully evaluated
- Test coverage is required
- Adversarial inputs are considered
- Breaking changes require discussion
Security Considerations
Security-First Principles
- Input validation: Validate all external input
- Error handling: Don’t leak internal state in error messages
- Rate limiting: Consider DoS scenarios
- Cryptography: Use standard library crypto packages
- Dependencies: Minimize external dependencies
Reporting Security Issues
SeeSECURITY.md for the security policy and reporting process.
Key Conventions
Configuration
- YAML-based policy files
- Config structs validate via
Valid() errorreturning sentinel errors - See
lib/config/for examples
Store Interface
lib/store.Interfaceabstracts key-value storage- Implementations in
lib/store/ - Always handle errors from Store operations
Environment Variables
- Parsed from flags via
flagenv - Use
.envfiles locally (loaded bygodotenv/autoload) - NEVER commit
.envfiles
Asset Building
- JS/CSS assets embed into Go binary
- Always run
npm run assetsbeforego testorgo build - Generated files are committed to the repo
CEL Expressions
- Policy rules support Common Expression Language
- See
lib/policy/expressions/for implementation - Use for advanced bot matching rules
Project Layout
Key directories:cmd/anubis/- Main entrypointlib/*/- Public library code (no API stability guarantees)internal/*/- Private implementation codetest/*/- Smoke testsweb/- Frontend templatesxess/- CSS framework
Getting Help
- Open an issue for bugs
- Join Patreon for live chat in
#anubisDiscord channel - Read the documentation