apiVersion: devrunbook.io/v1alpha1 kind: Playbook metadata: id: git-gitea.branch-protection-plan slug: branch-protection-plan version: 1.0.0 title: Design Branch Protection Rules summary: Produce a repository-appropriate branch protection plan covering pushes, merges, reviews, status checks and exceptions. category: git-gitea tags: - gitea - branch-protection - governance lifecycle: reviewed riskTier: moderate authors: - name: DevRunbook Core Team license: MIT package: files: - path: prompt.md role: template digest: true exportByDefault: false - path: README.md role: documentation digest: true exportByDefault: false - path: CHANGELOG.md role: changelog digest: true exportByDefault: false - path: examples/minimal.yaml role: example digest: true exportByDefault: false - path: evaluations/static-structure.yaml role: evaluation digest: true exportByDefault: false spec: type: guided intent: problem: Development work around design branch protection rules is often underspecified, inconsistently executed or reported without enough evidence. outcome: Produce a repository-appropriate branch protection plan covering pushes, merges, reviews, status checks and exceptions. whenToUse: - Use this playbook when the repository needs a bounded design branch protection rules task with explicit evidence and completion criteria. - Use it when Codex should follow a repeatable workflow rather than improvise from a one-line request. whenNotToUse: - Do not use it when the desired outcome or authority boundaries are still materially undecided. - Do not use it to access unavailable production credentials, bypass safeguards or claim validation that cannot be performed. modes: - plan defaultMode: plan autonomy: min: diagnose max: plan default: plan inputs: - key: branchStrategy label: Branch strategy description: Describe the intended development and release branch model. type: enum required: true sensitive: false includeInOutput: true default: trunk-with-feature-branches options: - trunk-based - trunk-with-feature-branches - git-flow - release-branches - custom - key: teamModel label: Team model description: Describe who pushes, reviews and administers the repository. type: enum required: true sensitive: false includeInOutput: true default: solo-with-agents options: - solo - solo-with-agents - small-team - multi-team - open-source compatibility: repositoryRequired: true languages: [] frameworks: [] packageManagers: [] databases: [] deploymentTypes: [] requiredProfileCapabilities: [] incompatibleConditions: [] guardrails: - id: guardrail-1 severity: blocking text: Do not change live Gitea settings in this planning playbook. - id: guardrail-2 severity: blocking text: Avoid rules that make solo recovery impossible; document emergency bypass and audit expectations. - id: guardrail-3 severity: blocking text: Base required checks on actual workflows, not imagined CI jobs. workflow: - id: inventory-current title: Inventory current governance instruction: Inspect branches, protection, collaborators, workflows, release tags and merge practices. required: true - id: model-risks title: Model risks instruction: Identify accidental push, unreviewed agent change, failing CI and release integrity risks. required: true - id: design-rules title: Design rules instruction: Specify protection per branch pattern, required checks, reviews, force-push, deletion and admin behavior. required: true - id: design-exceptions title: Design exceptions instruction: Define emergency access, bot or Codex branches and recovery procedures. required: true - id: rollout title: Plan rollout instruction: Sequence configuration changes so contributors are not locked out. required: true - id: verify-plan title: Verify feasibility instruction: Map every proposed required check to an existing or planned workflow and permission. required: true validation: commandRoles: [] checks: - id: check-1 type: assertion description: Every proposed rule maps to an evidenced risk and repository capability. blocking: true evidence: Referenced files, command results or explicit review notes. - id: check-2 type: assertion description: Emergency recovery and solo-maintainer behavior are explicit. blocking: true evidence: Referenced files, command results or explicit review notes. completion: criteria: - Rules balance safety and realistic workflow. - Exceptions and rollout risks are documented. - Validation evidence and unresolved limitations are reported honestly. failurePolicy: onValidationFailure: Investigate failures caused by the current work, repair them when they remain within scope, rerun affected validation and report any genuine blocker without claiming success. onAmbiguity: Use repository evidence and existing conventions for minor reversible choices. Preserve current behavior and stop before any material irreversible decision that the specification does not resolve. onMissingContext: Inspect the repository for missing non-sensitive context. Never invent commands, credentials, production behavior or validation results; report what remains unavailable. onOutOfScopeCause: Explain the evidenced out-of-scope cause, avoid unrelated changes and provide the smallest safe follow-up recommendation. onExternalDependencyUnavailable: Use an approved local substitute or fixture only when it preserves the behavior under test. Otherwise record the blocked validation and do not claim the external path succeeded. onUnableToReproduce: Record attempted reproduction, environment and observed evidence. Do not apply speculative production changes; provide the narrowest next diagnostic action. reporting: sections: - id: outcome title: Outcome required: true description: State the delivered result or audit conclusion without overstating evidence. - id: evidence title: Evidence and scope required: true description: List inspected or changed areas and the evidence supporting the result. - id: validation title: Validation required: true description: Report commands, manual checks and their actual outcomes. - id: risks title: Risks and limitations required: true description: State residual risk, inaccessible evidence and untested conditions. - id: follow-up title: Recommended follow-up required: true description: List the smallest useful next actions or state None. template: main: prompt.md partials: [] exports: prompt: true markdown: true runPack: false agentsSuggestion: false quality: reviewStatus: editorial-reviewed testedStacks: [] knownLimitations: - Repository-specific effectiveness depends on the accuracy of the selected profile and the evidence available to Codex. evaluationCaseIds: - branch-protection-plan.static-structure