added git management

This commit is contained in:
bastien
2026-04-03 03:46:34 +02:00
parent 5b4112fbff
commit fa50c0f402
8 changed files with 1270 additions and 183 deletions
+15
View File
@@ -0,0 +1,15 @@
---
name: git-pr
description: Analyze all changes on the current branch since it diverged from base (retroactive across sessions), create logical commits, push, and open a draft PR/MR. Works with GitHub, GitLab, Gogs, and Gitea. Never merges — creates a draft for user validation.
argument-hint: [PR title or leave empty for auto-detection]
disable-model-invocation: true
allowed-tools: Read, Bash, Grep, Glob
---
Load and follow strictly:
- .claude/agents/git-workflow.md
Execute the GIT WORKFLOW on the current repository.
User context (optional title or instructions):
$ARGUMENTS
+39 -3
View File
@@ -35,7 +35,42 @@ $ARGUMENTS
---
### STEP 0 — PLUGIN CHECK
### STEP 0a — BRANCH SETUP
Load the BRANCH SETUP section from: `.claude/agents/git-workflow.md`
Before anything else, ensure we are NOT on a protected branch.
```bash
git branch --show-current
```
**If on `main`, `master`, `develop`, or any protected branch:**
Derive a branch slug from the initial request:
- Take the first 3–4 meaningful words
- Lowercase, hyphen-separated
- Max 50 chars
```bash
git fetch origin
git pull origin <current> --ff-only 2>/dev/null || true
git checkout -b feature/<project-slug>
```
Print: `✅ Working branch created: feature/<project-slug>`
**If already on a feature branch:**
Run the CONFLICT-SAFE REBASE procedure from git-workflow.md
to sync with main before starting.
Print: `✅ Branch: <current> (synced with main)`
**Do not proceed until the branch is clean and ready.**
---
### STEP 0b — PLUGIN CHECK
Load and follow: `.claude/agents/plugin-advisor.md`
@@ -53,7 +88,7 @@ B) Type "force" to proceed without them
================================================================
```
**STOP. Wait for user response.**
- Re-run → restart from STEP 0
- Re-run → restart from STEP 0b
- "force" → note missing plugins, continue to STEP 1
**If `ACTION REQUIRED: NO`:**
@@ -306,7 +341,8 @@ SYNC mode — no stop required. The readme-updater:
## RULES
- Never skip STEP 0 — plugin check is mandatory.
- Never skip STEP 0a — branch setup is mandatory. Never commit on main/master.
- Never skip STEP 0b — plugin check is mandatory.
- Never skip STEP 1 — no assumptions about missing info.
- Never implement without explicit user approval at STEP 4.
- Never implement without explicit user approval at STEP 7.
+75 -3
View File
@@ -33,7 +33,48 @@ $ARGUMENTS
---
### STEP 0 — PLUGIN CHECK (mandatory gate)
### STEP 0a — BRANCH SETUP
Load the BRANCH SETUP section from: `.claude/agents/git-workflow.md`
```bash
git branch --show-current
```
**If on `main`, `master`, `develop`, or any protected branch:**
Derive a branch slug from the feature request:
- Take the first 3–4 meaningful words from $ARGUMENTS
- Lowercase, hyphen-separated, max 50 chars
- Prefix with `feature/`
```bash
git fetch origin
git pull origin <current> --ff-only 2>/dev/null || true
git checkout -b feature/<feature-slug>
```
Print: `✅ Working branch created: feature/<feature-slug>`
**If already on a feature/bugfix/hotfix branch:**
Run the CONFLICT-SAFE REBASE procedure from git-workflow.md
to sync with the base branch before implementing.
Print: `✅ Branch: <current> (synced)`
**Special case — bugfix on a feature branch:**
If the user explicitly says "bugfix" or "fix" in the request AND
the current branch is a feature branch:
```bash
git checkout -b bugfix/<bug-slug>
```
Creates the bugfix branch FROM the feature branch — correct hierarchy.
**Do not proceed until the branch is clean.**
---
### STEP 0b — PLUGIN CHECK (mandatory gate)
Load and follow: `.claude/agents/plugin-advisor.md`
@@ -64,7 +105,7 @@ Options:
```
Wait for user response.
- If user re-runs `/ship-feature` → start from STEP 0 again
- If user re-runs `/ship-feature` → start from STEP 0a again
- If user types "force" → note missing plugins and continue to STEP 1
**If the advisor output says `ACTION REQUIRED: NO`:**
@@ -157,9 +198,40 @@ SYNC mode — no stop required. The readme-updater:
---
### STEP 9 — CREATE PR (optional gate)
Ask the user:
```
================================================================
SHIP FEATURE — PR CREATION
================================================================
Feature is implemented, tested, and README is synced.
Create a PR/MR now?
yes → run /git-pr and open a draft PR
no → stop here, you can run /git-pr manually later
================================================================
```
**STOP — wait for user response.**
IF yes:
Load and follow: `.claude/agents/git-workflow.md`
The git-workflow agent will:
- Show all changes since branch start (retroactive)
- Propose a commit plan for approval
- Push and create a draft PR/MR on GitHub/GitLab/Gogs/Gitea
IF no:
Print: `✅ Feature shipped. Run /git-pr when ready to open a PR.`
Stop.
---
## RULES
- Never skip STEP 0 — plugin check is mandatory.
- Never skip STEP 0a — branch setup is mandatory. Never implement on main/master.
- Never skip STEP 0b — plugin check is mandatory.
- Never skip brainstorming.
- Never implement without explicit user approval of the plan.
- Keep subagents isolated — no shared context between tasks.