Skip to content

AI Gateway uses a fork-and-branch workflow:

  1. Fork the repository on GitHub.
  2. Clone your fork locally and run mise run install.
  3. Create a feature branch from main (e.g., feat/bedrock-streaming).
  4. Make your changes and commit using Conventional Commits format.
  5. Push your branch and open a pull request against main.
  6. All CI checks must pass and a CODEOWNERS review is required before merge.

Every commit message must follow the Conventional Commits format. The commit-msg git hook enforces this automatically.

<type>(<scope>): <description>

Supported types:

TypeWhen to Use
featA new feature
fixA bug fix
docsDocumentation changes only
styleFormatting, whitespace (no logic change)
refactorCode restructuring (no feature change, no bug fix)
perfPerformance improvement
testAdding or updating tests
buildBuild system or external dependency changes
ciCI/CD pipeline changes
choreMaintenance tasks (tooling, config)
revertReverting a previous commit

Examples:

Terminal window
git commit -m "feat(auth): add Cognito custom scope validation"
git commit -m "fix(compute): correct OTel sidecar memory limit"
git commit -m "docs(adr): add ADR-008 for rate limiting strategy"
git commit -m "ci: upgrade trivy action to v0.36"

Lefthook manages git hooks. All hooks within each stage run in parallel for speed.

CheckScopeAuto-fixes
ruff lint*.py staged filesYes (stages fixed files)
ruff format*.py staged filesYes (stages fixed files)
pyrightsrc/No
gitleaksStaged changesNo
hadolintDockerfile* staged filesNo
terraform fmtinfrastructure/**/*.tfNo (check only)
terraform validateinfrastructure/**/*.tfNo
terraform-docsinfrastructure/**/*.tfYes (regenerates and stages README)
CheckScope
pytesttests/ (fail-fast mode)
semgrepFull repository (OWASP Top 10 rules)
checkovinfrastructure/ (Terraform framework)
trivy fsFull repository (HIGH + CRITICAL)

Validates that the commit message matches Conventional Commits format. Rejects commits that do not match.

Use mise run to execute any project task. The most common workflows:

Terminal window
# Run the full CI pipeline locally (lint + typecheck + test + security)
mise run ci
# Individual checks
mise run lint # ruff check + format check
mise run typecheck # pyright on src/
mise run test # pytest on tests/
mise run security # all security scans (SAST, secrets, IaC, Dockerfile, trivy fs)
# Format code (auto-fix)
mise run format # ruff format + ruff check --fix + terraform fmt
# Terraform operations
mise run tf:validate # terraform init + validate
mise run tf:plan # terraform init + plan
mise run tf:fmt # terraform fmt -recursive
mise run tf:docs # regenerate infrastructure/README.md

All tasks are defined in mise.toml and run with mise run <task>.

TaskDescription
installInstall all project dependencies and git hooks
devRun the API gateway in development mode (uvicorn, port 8000)
testRun test suite with pytest
lintRun ruff linter and format check
formatAuto-format Python (ruff) and Terraform (fmt)
typecheckRun pyright type checker on src/
TaskDescription
securityRun all security scans (depends on all sub-tasks below)
security:sastSAST scan with semgrep (OWASP Top 10, security audit)
security:secretsSecret detection with gitleaks
security:iacIaC security scan with checkov (Terraform framework)
security:dockerfileLint Dockerfiles with hadolint
security:imageScan container image with trivy (HIGH + CRITICAL)
security:fsFilesystem vulnerability scan with trivy
TaskDescription
tf:initInitialize Terraform
tf:planTerraform plan (depends on tf:init)
tf:fmtFormat Terraform files recursively
tf:validateValidate Terraform configuration (depends on tf:init)
tf:docsGenerate Terraform documentation with terraform-docs
TaskDescription
tg:initTerragrunt init for a specific environment
tg:planTerragrunt plan for a specific environment
tg:plan-allTerragrunt plan all environments
tg:validate-allTerragrunt validate all environments
TaskDescription
ciFull CI pipeline (lint, typecheck, test, security)
ci:lintValidate GitHub Actions workflows with actionlint
ci:validateValidate all CI + quality gates in one shot
TaskDescription
docs:serveServe documentation locally with hot reload
docs:buildBuild documentation site

Before a PR can be merged:

  1. All CI jobs must pass — quality, SAST, IaC security, and container security.
  2. CODEOWNERS review@theagenticguy is the default owner for all files. Infrastructure changes (infrastructure/) require explicit review.
  3. Dependency review — The dependency-review workflow blocks PRs that introduce HIGH/CRITICAL vulnerabilities or GPL-3.0/AGPL-3.0 licensed dependencies.
  4. Conventional commit messages — Every commit in the PR must follow the format.

Follow the existing module pattern:

  1. Create a directory under infrastructure/modules/<module-name>/.
  2. Add three files following the standard structure:
    • variables.tf — Input variables with descriptions and types.
    • main.tf — Resource definitions.
    • outputs.tf — Output values with descriptions.
  3. Wire the module in infrastructure/main.tf with explicit dependency ordering.
  4. Add any new root-level variables in infrastructure/variables.tf.
  5. Run mise run tf:docs to regenerate the infrastructure README.
  6. Run mise run tf:validate to confirm the module is valid.
  • Place source code in src/ and tests in tests/.
  • Follow the ruff configuration in ruff.toml (30+ rule sets enabled, 120-char line length, Python 3.13 target).
  • Add type hints to all function signatures — pyright runs in standard mode.
  • Write tests using pytest. Use fixtures for shared setup and markers for test categorization.
  • Add new dependencies with uv add <package> (or uv add --dev <package> for dev-only).