Document safe PR body flow and post-merge main sync
This commit is contained in:
39
AGENTS.md
39
AGENTS.md
@@ -42,3 +42,42 @@ Current git history is minimal (`Initial commit`), so enforce clear conventions
|
||||
## Security & Configuration Tips
|
||||
Do not commit secrets. Copy `.env.example` to `.env` locally.
|
||||
Restrict Slack access with `SLACK_ALLOWED_USER_ID` and `SLACK_ALLOWED_CHANNEL_ID` before running in shared workspaces.
|
||||
|
||||
## Git & Gitea Workflow Notes
|
||||
Use `tea` (Gitea CLI), not `gh`.
|
||||
|
||||
Hard rule:
|
||||
- Never implement changes, stage files, or commit on `main`.
|
||||
- Always create/use a feature branch first, and merge via PR.
|
||||
|
||||
- Check login:
|
||||
- `tea login ls`
|
||||
- `tea whoami`
|
||||
- Create/update feature branch:
|
||||
- `git checkout -b <branch>` (or `git checkout <branch>`)
|
||||
- `git add <files>`
|
||||
- `git commit -m "<message>"`
|
||||
- Push to Gitea:
|
||||
- Normal: `git push -u origin <branch>`
|
||||
- If HTTP username prompt fails in this environment, use the token from `~/.config/tea/config.yml`:
|
||||
- `TOKEN=$(sed -n 's/^[[:space:]]*token: //p' ~/.config/tea/config.yml | head -n1)`
|
||||
- `git push "http://agentson:${TOKEN}@localhost:3000/jihoson/LazyEnter.git" <branch>`
|
||||
- After token-based push, ensure tracking is on `origin/<branch>` (not token URL):
|
||||
- `git fetch origin <branch>:refs/remotes/origin/<branch>`
|
||||
- `git branch --set-upstream-to=origin/<branch> <branch>`
|
||||
- Create PR on Gitea:
|
||||
- `tea pr create --base main --head <branch> --title "<title>" --description "<body>"`
|
||||
- If PR body includes backticks (`` ` ``), slash commands, or markdown that can be shell-expanded, do not pass it directly in double quotes.
|
||||
- Preferred safe flow:
|
||||
- `cat > /tmp/pr_body.md <<'EOF'` ... `EOF`
|
||||
- `tea pr create --base main --head <branch> --title "<title>" --description "$(cat /tmp/pr_body.md)"`
|
||||
- If the body is malformed after creation, patch it with API:
|
||||
- `tea api -X PATCH repos/{owner}/{repo}/pulls/<number> -F body=@/tmp/pr_body.md`
|
||||
- Sync local main:
|
||||
- `git checkout main`
|
||||
- `git pull --ff-only`
|
||||
- When user confirms the PR is merged, always run this sync immediately to keep local `main` up to date before any next task.
|
||||
|
||||
Safety:
|
||||
- Do not commit or print tokens in logs/docs.
|
||||
- Keep unrelated local files (for example `uv.lock`) out of PRs unless intentionally changed.
|
||||
|
||||
Reference in New Issue
Block a user