From fb6dac289178325e99752bc383aec2948ecfaffc Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Mon, 6 Apr 2026 23:41:04 +0000 Subject: [PATCH] feat: add more tested common patterns to reduce agent discovery time - Add Git push conflict handling patterns (tested) - Add PR number extraction patterns (tested) - Document these patterns agents frequently need - Keep branch protection as untested pattern These patterns save time for agents that work with git and PRs. --- .opencode/agents/COMMON_PATTERNS.md | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.opencode/agents/COMMON_PATTERNS.md b/.opencode/agents/COMMON_PATTERNS.md index 19dd27363..77474229b 100644 --- a/.opencode/agents/COMMON_PATTERNS.md +++ b/.opencode/agents/COMMON_PATTERNS.md @@ -129,12 +129,43 @@ The project uses the monolithic format: Note: The split format (`docs/specification/`) is not used in this project. +### Git Push Conflict Handling + +**Status**: ✅ TESTED (used by multiple agents) + +When `git push` is rejected due to diverged branches: +```bash +git pull --rebase origin && git push +``` + +For force push (use sparingly and only on feature branches): +```bash +git push --force-with-lease # Safer than --force +``` + ### Branch Protection Settings **Status**: ⚠️ UNTESTED (assumed defaults) Default for master/main: -- Require CI checks to pass +- Require CI checks to pass - Dismiss stale reviews - No force push allowed -- No deletion allowed \ No newline at end of file +- No deletion allowed + +### PR Number Extraction Patterns + +**Status**: ✅ TESTED + +Extract PR number from various sources: +```python +# From PR title/branch name +pr_pattern = r'PR[-#]?(\d+)' + +# From PR body closing keywords +closes_pattern = r'(?:Closes|Fixes|Resolves)\s*#(\d+)' + +# From action run URLs +run_pattern = r'/actions/runs/(\d+)' +job_pattern = r'/actions/runs/\d+/jobs/(\d+)' +``` \ No newline at end of file