chore: adopt trunk-based development — update PROJECT.md, cd.yml, add pre-push hook #27

Closed
opened 2026-05-17 06:31:52 +00:00 by mathias · 0 comments
Owner

Summary

Update .context/PROJECT.md to explicitly adopt Trunk-Based Development for this repo, override the cd.yml PR trigger to remove the quality gate on pull_request events (since PRs are no longer the default), and optionally add a pre-push git hook.

Background

gitea-mcp is a solo-owned, single-maintainer internal tool with a mature CI pipeline. It is the ideal candidate for strict TBD:

  • No external contributors
  • No client four-eyes requirement
  • CI already runs task check on every push to main
  • Conflicts caused by long-lived branches were demonstrated on 2026-05-14

Changes to .context/PROJECT.md

In the Git conventions section, replace:

- Conventional commits: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:`
- Branch naming: `feat/short-description`, `fix/short-description`
- PRs: one concern per PR, description explains *why* not *what*
- **Branch protection:** always work on a feature branch, open a PR, never push directly to main

With:

- Conventional commits: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:`
- **Trunk-Based Development:** commit directly to main. One logical change per commit.
- Run `task check` locally before every push. CI is the quality gate, not branch protection.
- No feature branches, no PRs for solo/agent work.
- Exception: if a parallel agent session is active on this repo, use a short-lived
  `agent/<description>` branch and merge within the same session.

In Agent instructions, replace rule 6:

6. Always work on a feature branch and open a PR — never push directly to main

With:

6. Commit directly to main. Run `task check` before every push. Never create
   feature branches unless a parallel agent is simultaneously active on this repo.

Changes to .gitea/workflows/cd.yml

The current workflow triggers on pull_request events for the check job:

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request:
    branches: [main]

Since PRs are no longer the default, the pull_request trigger is vestigial.
Remove it to reduce noise:

on:
  push:
    branches: [main]
    tags: ["v*"]

The check job's if: github.event_name != 'pull_request' guard on the build
job can also be simplified to just run on every push:

if: github.ref == 'refs/heads/main' && github.event_name == 'push'

Optional: add pre-push git hook

Add .githooks/pre-push to the repo so any agent or human working locally
gets the quality gate enforced before push:

#!/usr/bin/env bash
set -euo pipefail
echo "→ Running task check before push..."
task check
echo "✓ pre-push check passed"

And in Taskfile.yml, add a setup task:

setup:hooks:
  desc: Install git hooks
  cmds:
    - git config core.hooksPath .githooks
    - chmod +x .githooks/pre-push
    - echo "✓ git hooks installed"

Document in README: task setup:hooks on first clone.

Acceptance criteria

  • PROJECT.md Git section updated with TBD as explicit convention
  • PROJECT.md agent instruction rule 6 updated
  • cd.yml pull_request trigger removed
  • .githooks/pre-push added (optional but recommended)
  • task setup:hooks added to Taskfile.yml (if hook added)
  • task check passes
  • Committed directly to main in one commit: chore: adopt trunk-based development

Note on branch protection

Do NOT enable Gitea branch protection (required_approvals > 0) for this repo.
CI is the quality gate. Branch protection adds friction without safety for a
solo-maintained project.

## Summary Update `.context/PROJECT.md` to explicitly adopt Trunk-Based Development for this repo, override the `cd.yml` PR trigger to remove the quality gate on pull_request events (since PRs are no longer the default), and optionally add a pre-push git hook. ## Background `gitea-mcp` is a solo-owned, single-maintainer internal tool with a mature CI pipeline. It is the ideal candidate for strict TBD: - No external contributors - No client four-eyes requirement - CI already runs `task check` on every push to main - Conflicts caused by long-lived branches were demonstrated on 2026-05-14 ## Changes to `.context/PROJECT.md` In the **Git** conventions section, replace: ```markdown - Conventional commits: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:` - Branch naming: `feat/short-description`, `fix/short-description` - PRs: one concern per PR, description explains *why* not *what* - **Branch protection:** always work on a feature branch, open a PR, never push directly to main ``` With: ```markdown - Conventional commits: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:` - **Trunk-Based Development:** commit directly to main. One logical change per commit. - Run `task check` locally before every push. CI is the quality gate, not branch protection. - No feature branches, no PRs for solo/agent work. - Exception: if a parallel agent session is active on this repo, use a short-lived `agent/<description>` branch and merge within the same session. ``` In **Agent instructions**, replace rule 6: ```markdown 6. Always work on a feature branch and open a PR — never push directly to main ``` With: ```markdown 6. Commit directly to main. Run `task check` before every push. Never create feature branches unless a parallel agent is simultaneously active on this repo. ``` ## Changes to `.gitea/workflows/cd.yml` The current workflow triggers on `pull_request` events for the `check` job: ```yaml on: push: branches: [main] tags: ["v*"] pull_request: branches: [main] ``` Since PRs are no longer the default, the `pull_request` trigger is vestigial. Remove it to reduce noise: ```yaml on: push: branches: [main] tags: ["v*"] ``` The `check` job's `if: github.event_name != 'pull_request'` guard on the `build` job can also be simplified to just run on every push: ```yaml if: github.ref == 'refs/heads/main' && github.event_name == 'push' ``` ## Optional: add pre-push git hook Add `.githooks/pre-push` to the repo so any agent or human working locally gets the quality gate enforced before push: ```bash #!/usr/bin/env bash set -euo pipefail echo "→ Running task check before push..." task check echo "✓ pre-push check passed" ``` And in `Taskfile.yml`, add a setup task: ```yaml setup:hooks: desc: Install git hooks cmds: - git config core.hooksPath .githooks - chmod +x .githooks/pre-push - echo "✓ git hooks installed" ``` Document in README: `task setup:hooks` on first clone. ## Acceptance criteria - [ ] PROJECT.md Git section updated with TBD as explicit convention - [ ] PROJECT.md agent instruction rule 6 updated - [ ] `cd.yml` pull_request trigger removed - [ ] `.githooks/pre-push` added (optional but recommended) - [ ] `task setup:hooks` added to Taskfile.yml (if hook added) - [ ] `task check` passes - [ ] Committed directly to main in one commit: `chore: adopt trunk-based development` ## Note on branch protection Do NOT enable Gitea branch protection (required_approvals > 0) for this repo. CI is the quality gate. Branch protection adds friction without safety for a solo-maintained project.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#27