@@ -26,7 +26,7 @@ If you prefer manual control without installing CLI tools like `tea`:
26262 . ** Push via AGit:**
2727 ``` bash
2828 # Replace 'feature-branch' with your actual branch name
29- git push origin HEAD:refs/for/main /feature-branch \
29+ git push origin HEAD:refs/for/dev /feature-branch \
3030 -o title=" feat: description" \
3131 -o description=" Extended details..."
3232 ```
@@ -44,11 +44,13 @@ The `scripts/auto-pr` script automates the entire PR lifecycle: push, CI polling
4444
4545### What it does
4646
47- 1 . ** Push** — Pushes your branch using Forgejo's AGit workflow (` refs/for/main /<branch> ` )
47+ 1 . ** Push** — Pushes your branch using Forgejo's AGit workflow (` refs/for/dev /<branch> ` )
48482 . ** Create PR** — The push automatically creates a PR on Codeberg
49493 . ** Poll CI** — Waits for CI status checks to complete (polls every 10 seconds)
50504 . ** Merge** — Automatically merges when CI passes
51- 5 . ** Cleanup** — Switches back to ` main ` , pulls, and deletes the local feature branch
51+ 5 . ** Cleanup** — Switches back to ` dev ` , pulls, and deletes the local feature branch
52+
53+ If the remote is unavailable (503 errors, network issues), the PR is ** queued locally** and can be pushed later with ` ./scripts/auto-pr flush ` .
5254
5355### Requirements
5456
@@ -66,8 +68,8 @@ FORGEJO_TOKEN=your_token_here
6668```
6769
6870** Prerequisites:**
69- - Must be on a feature branch (not ` main ` )
70- - Branch must have commits ahead of ` main `
71+ - Must be on a feature branch (not ` main ` or ` dev ` )
72+ - Branch must have commits ahead of ` dev `
7173- ` python3 ` , ` curl ` , and ` git ` must be available
7274
7375### Usage
@@ -81,6 +83,11 @@ FORGEJO_TOKEN=your_token_here
8183
8284# Custom title and description
8385./scripts/auto-pr " feat: add new feature" " Detailed description here"
86+
87+ # Queue management (when remote is unavailable)
88+ ./scripts/auto-pr list # Show queued PRs
89+ ./scripts/auto-pr flush # Push queued PRs when remote is back
90+ ./scripts/auto-pr --help # Show all options
8491```
8592
8693### The PR_PENDING Gate (for AI agents)
@@ -97,18 +104,34 @@ The file is automatically removed when the PR is merged.
97104### Workflow Example
98105
99106``` bash
100- # 1. Make changes on main
101- git add . && git commit -s -m " feat: my change "
107+ # 1. Start from dev
108+ git checkout dev && git pull
102109
103- # 2. Create a feature branch (auto-pr requires this)
110+ # 2. Create a feature branch
104111git checkout -b my-feature
105112
106- # 3. Run auto-pr
113+ # 3. Make changes and commit
114+ git add . && git commit -s -m " feat: my change"
115+
116+ # 4. Run auto-pr
107117./scripts/auto-pr
108118
109- # 4 . Script handles everything, you end up back on main with changes merged
119+ # 5 . Script handles everything, you end up back on dev with changes merged
110120```
111121
122+ ### Offline Resilience (vPR Queue)
123+
124+ When Codeberg is unavailable, ` auto-pr ` automatically:
125+ 1 . Retries up to 3 times with 10-second delays
126+ 2 . If still failing, queues as a ** vPR (virtual PR)** in ` .git/PR_QUEUE `
127+ 3 . Exits cleanly so you can continue working
128+
129+ ** vPR workflow:**
130+ - vPRs form a linear chain (each branches from the previous)
131+ - To add more changes: ` git checkout -b new-branch $(./scripts/auto-pr status | grep tip | awk '{print $3}') `
132+ - When Codeberg is back: ` ./scripts/auto-pr flush `
133+ - Flush pushes ALL vPRs as a ** single atomic PR** (individual commits preserved)
134+
112135### Troubleshooting
113136
114137| Error | Cause | Solution |
@@ -118,13 +141,14 @@ git checkout -b my-feature
118141| ` Could not find open PR ` | API timing issue | Wait and retry, or check Codeberg UI |
119142| ` CI Failed ` | Tests/linting failed | Fix issues, amend commit, re-run |
120143| ` Merge failed ` | Conflicts or permissions | Check PR on Codeberg for details |
144+ | ` PR queued locally ` | Remote unavailable | Run ` ./scripts/auto-pr flush ` when remote is back |
121145
122146### How AGit Works
123147
124148This script uses Forgejo's AGit flow, which creates PRs via specially-formatted push refs:
125149
126150``` bash
127- git push origin HEAD:refs/for/main /< branch-name> -o title=" ..." -o description=" ..."
151+ git push origin HEAD:refs/for/dev /< branch-name> -o title=" ..." -o description=" ..."
128152```
129153
130154This is different from GitHub's flow where you push a branch and then create a PR separately. With AGit, the push * is* the PR creation.
0 commit comments