d1d2bc2505
Extract the project's operating rules into a reusable, project-agnostic skill so any repo can adopt the same safe LLM workflow. - skills/llm-project-workflow/SKILL.md: issue-first; isolated branch worktrees (main checkout = orchestration only); distinct author/reviewer identities and profile safety (secrets by reference only; stop if authenticated user == PR author); branch naming; start/review/merge/cleanup workflows; fail-closed cases; recovery patterns; and an "Adapting to a project" table for the forge-specific names. - templates/: copy/paste prompts for start-issue, review-pr, merge-pr, recover-bad-state, worktree-cleanup. - Link the skill from README.md and docs/llm-workflow-runbooks.md (the runbook is framed as the Gitea-specific application of the portable skill). Docs-only; no code, no secrets, safe placeholder examples only. No change to MCP runtime, Gitea API, credential storage, or worktree helpers. Checks: full suite 287 passed / 0 failures; git diff --check clean; secret scan of skills/ clean. Closes #46. Refs #38, #39. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.4 KiB
Markdown
33 lines
1.4 KiB
Markdown
# Template: recover from bad state
|
|
|
|
Copy, fill the `<...>` fields, paste as the task prompt. Recovery is read-then-
|
|
act: gather facts first, never discard unmerged work.
|
|
|
|
```text
|
|
Task: recover repo state for <situation>. Do not lose unmerged work.
|
|
|
|
Rules (llm-project-workflow):
|
|
- Fail closed: if state is unclear or a step would delete unmerged work, STOP.
|
|
- Never push master. Never discard commits not safely pushed to <remote>.
|
|
|
|
Diagnose first:
|
|
1. git fetch <remote> --prune
|
|
2. git status --short; git worktree list
|
|
3. git rev-list --left-right --count <remote>/master...master # ahead/behind
|
|
4. For any PR involved: confirm state (open/closed/merged) AND whether
|
|
<remote>/master actually contains its commits ("closed" != "merged").
|
|
|
|
Act per case:
|
|
- Dirty worktree from another issue: leave it; start yours in a new worktree.
|
|
- Local master ahead of remote: confirm the extra commits live on a branch
|
|
pushed to <remote>, THEN git reset --hard <remote>/master. Verify with
|
|
`git branch --contains <sha>` first.
|
|
- PR closed but not merged: re-push the branch, reopen/replace the PR, let an
|
|
eligible reviewer merge. Do not merge your own.
|
|
- Branch deleted before merge: recover commits from a local branch/reflog (or
|
|
git fsck --lost-found), re-push, reopen the PR.
|
|
- Unauthorized untracked file: do not commit it; leave pre-existing artifacts.
|
|
|
|
Handoff: what was wrong, evidence, action taken, current state, what remains.
|
|
```
|