@hopla/claude-setup 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,18 @@
1
1
  ---
2
2
  name: worktree
3
- description: "Git worktree management for isolated feature development. Use when starting a new feature that benefits from isolation, when the user says 'worktree', 'isolated branch', 'parallel development', or when implementing multiple features simultaneously. Do NOT use for quick fixes or single-file changes."
3
+ description: "Git worktree management for isolated feature development with Git Flow awareness. Use when starting a new feature that benefits from isolation, when the user says 'worktree', 'isolated branch', 'parallel development', or when implementing multiple features simultaneously. Do NOT use for quick fixes or single-file changes."
4
4
  ---
5
5
 
6
- # Git Worktrees for Isolated Development
6
+ # Git Worktrees Isolated Development with Git Flow
7
7
 
8
- ## What Are Worktrees?
9
- Git worktrees create separate working directories for different branches, sharing the same git history. Each worktree is an independent workspace.
8
+ > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
9
+
10
+ ## What are worktrees?
11
+
12
+ Git worktrees create separate working directories for different branches while sharing the same git history. Each worktree is an independent workspace.
13
+
14
+ ## When to use
10
15
 
11
- ## When to Use
12
16
  - Starting a feature that should be isolated from other work
13
17
  - Developing multiple features in parallel
14
18
  - Needing a clean baseline to test against
@@ -16,58 +20,99 @@ Git worktrees create separate working directories for different branches, sharin
16
20
 
17
21
  ## Setup Process
18
22
 
19
- ### Step 1: Choose Worktree Directory
23
+ ### Step 1: Identify branch type and resolve base branch
24
+
25
+ Ask the user (or infer from context) which type of branch to create:
26
+
27
+ | Prefix | Purpose | Base (Git Flow) | Base (GitHub Flow) |
28
+ |---|---|---|---|
29
+ | `feature/*` | New functionality | `develop` / `dev` | `main` |
30
+ | `fix/*` | Non-urgent bug fix | `develop` / `dev` | `main` |
31
+ | `hotfix/*` | Urgent production fix | `main` | `main` |
32
+ | `release/*` | Release candidate | `main` | N/A — ask user |
33
+
34
+ Use `../git/flow-detection.md` (Steps 1–2) to resolve the base branch from the prefix. Confirm it exists remotely (Step 4).
35
+
36
+ **Guard rails:**
37
+
38
+ - **Refuse** to create a `hotfix/*` worktree from `develop`/`dev`. Hotfixes must come from `main` — correct the base before proceeding.
39
+ - If the prefix is unknown, ask the user which base to use.
40
+ - Always show the resolved base to the user before executing `git worktree add`.
41
+
42
+ ### Step 2: Choose worktree directory
43
+
20
44
  Check in order:
45
+
21
46
  1. Existing `.worktrees/` or `worktrees/` directory
22
- 2. CLAUDE.md preference (if configured)
23
- 3. Ask the user
47
+ 2. `CLAUDE.md` preference (if configured)
48
+ 3. Ask the user (default: `worktrees/<kebab-name>`)
49
+
50
+ ### Step 3: Ensure the worktree directory is gitignored
24
51
 
25
- ### Step 2: Ensure Directory is Gitignored
26
52
  ```bash
27
- # Verify the worktree directory is in .gitignore
28
- grep -q "worktrees" .gitignore || echo "worktrees/" >> .gitignore
53
+ grep -q "^worktrees/" .gitignore 2>/dev/null || echo "worktrees/" >> .gitignore
29
54
  ```
30
55
 
31
- ### Step 3: Create Worktree
56
+ ### Step 4: Create the worktree from the correct base
57
+
58
+ Fetch first so the local base tracks the remote:
59
+
32
60
  ```bash
33
- # Create worktree with a new feature branch
34
- git worktree add worktrees/feature-name -b feature/feature-name
61
+ git fetch origin <base-branch>
62
+ git worktree add worktrees/<name> -b <prefix>/<name> origin/<base-branch>
35
63
  ```
36
64
 
37
- ### Step 4: Setup Project in Worktree
38
- Auto-detect and run setup:
39
- - **Node.js**: `npm install` or `yarn install`
40
- - **Python**: `pip install -r requirements.txt` or `poetry install`
41
- - **Rust**: `cargo build`
42
- - **Go**: `go mod download`
65
+ Examples:
43
66
 
44
- ### Step 5: Verify Clean Baseline
45
67
  ```bash
46
- cd worktrees/feature-name
47
- # Run tests to ensure baseline is green
48
- npm test # or equivalent
68
+ # Feature off develop
69
+ git worktree add worktrees/auth -b feature/auth origin/develop
70
+
71
+ # Hotfix off main
72
+ git worktree add worktrees/crash-fix -b hotfix/crash-fix origin/main
73
+
74
+ # Fix on GitHub Flow project
75
+ git worktree add worktrees/typo -b fix/typo origin/main
49
76
  ```
50
77
 
51
- If tests fail before any changes, STOP and report — the baseline is broken.
78
+ ### Step 5: Install project dependencies (if applicable)
79
+
80
+ Auto-detect from the project root — run only what matches:
81
+
82
+ - `package-lock.json` → `npm install`
83
+ - `yarn.lock` → `yarn install`
84
+ - `pnpm-lock.yaml` → `pnpm install`
85
+ - `requirements.txt` → `pip install -r requirements.txt`
86
+ - `pyproject.toml` with `poetry.lock` → `poetry install`
87
+ - `Cargo.toml` → `cargo build`
88
+ - `go.mod` → `go mod download`
89
+
90
+ If none match, skip.
91
+
92
+ ### Step 6: Verify clean baseline (optional)
93
+
94
+ If `CLAUDE.md` or `package.json` defines a test command, run it once inside the worktree to confirm the baseline is green. If no test command is defined, skip.
52
95
 
53
- ### Step 6: Work in the Worktree
54
- All work for this feature happens in `worktrees/feature-name/`.
96
+ If tests fail **before any changes**, STOP and report — the baseline is broken.
97
+
98
+ ### Step 7: Work in the worktree
99
+
100
+ All work for this branch happens in `worktrees/<name>/`. Use the `git` skill from inside the worktree directory for commits and PRs — it detects the worktree context automatically.
55
101
 
56
102
  ## Cleanup
57
103
 
58
- ### After Merge
59
- ```bash
60
- git worktree remove worktrees/feature-name
61
- git branch -d feature/feature-name
62
- ```
104
+ Post-merge cleanup is handled by the `git` skill — see `../git/pr.md` Step 7. It detects the worktree and runs `git worktree remove` automatically.
105
+
106
+ If the branch is **abandoned** before merge, confirm with the user and then:
63
107
 
64
- ### If Abandoned
65
108
  ```bash
66
- git worktree remove --force worktrees/feature-name
67
- git branch -D feature/feature-name
109
+ cd "$(dirname "$(git rev-parse --git-common-dir)")" # back to main repo
110
+ git worktree remove --force worktrees/<name>
111
+ git branch -D <prefix>/<name>
68
112
  ```
69
113
 
70
114
  ## Integration
71
- - Use with `/hopla-execute` for isolated feature implementation
72
- - Use with `/hopla-git-pr` for creating PRs from the worktree branch
73
- - Combine with parallel dispatch for multiple features simultaneously
115
+
116
+ - Combine with `/hopla-execute` run execution from inside the worktree
117
+ - Combine with the `git` skill commit and PR from inside the worktree; cleanup happens post-merge
118
+ - Combine with parallel dispatch — multiple worktrees active simultaneously
@@ -1,67 +0,0 @@
1
- # End-to-End Feature Implementation
2
-
3
- > Execute the complete PIV loop for a feature in one go: prime → brainstorm → plan → review → execute → validate → commit.
4
-
5
- > ⚠️ **Advanced**: Only use this command after you've proven each individual command works reliably. Build trust gradually.
6
-
7
- ## Input
8
- - `$ARGUMENTS`: Feature description or requirement
9
-
10
- ## Autonomy Levels
11
-
12
- This command represents **Level 3 autonomy**. Make sure you've mastered:
13
- - Level 1: Manual prompts (writing everything each time)
14
- - Level 2: Individual commands (/hopla-plan-feature, /hopla-execute, etc.)
15
- - Level 3: Command chaining (this command)
16
-
17
- ## Process
18
-
19
- ### Phase 1: Context Loading
20
- Load project context:
21
- - Read CLAUDE.md, README, package.json
22
- - Check git state (branch, status, pending plans)
23
- - Identify current development phase
24
-
25
- ### Phase 2: Brainstorm (if needed)
26
- If the feature is non-trivial (estimated > 1 hour):
27
- - Explore 2-3 approaches with trade-offs
28
- - Get user approval on approach
29
- - Save design doc to `.agents/specs/`
30
-
31
- If trivial: skip to Phase 3.
32
-
33
- ### Phase 3: Plan
34
- - Research codebase for related patterns
35
- - Generate structured implementation plan
36
- - Save to `.agents/plans/[feature-name].md`
37
-
38
- ### 🔒 GATE: Plan Review
39
- **STOP and present the plan to the user.**
40
- - Show executive summary
41
- - Wait for explicit approval before proceeding
42
- - If changes requested: iterate on the plan
43
-
44
- ### Phase 4: Execute
45
- - Create feature branch (`feature/[name]` from develop)
46
- - Execute all plan tasks sequentially
47
- - Validate after each phase boundary
48
-
49
- ### Phase 5: Validate
50
- - Run full validation pyramid (lint → types → tests → integration)
51
- - Run code review
52
- - Fix any critical/important issues found
53
-
54
- ### 🔒 GATE: Human Review
55
- **STOP and present results to the user.**
56
- - Show what was built, what was validated
57
- - Wait for approval before committing
58
-
59
- ### Phase 6: Commit & PR
60
- - Create conventional commit(s)
61
- - Suggest creating a PR if on a feature branch
62
-
63
- ## Rules
64
- - Never skip the human gates (plan review, final review)
65
- - If any phase fails, stop and report — don't push through
66
- - Each phase should feel like a natural conversation, not a script
67
- - Adapt: skip brainstorming for small features, skip PR for hotfixes
@@ -1,76 +0,0 @@
1
- ---
2
- description: Create a conventional commit with Git Flow awareness
3
- argument-hint: "[optional: commit message or scope]"
4
- ---
5
-
6
- > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
7
-
8
- Review the current git state and create an appropriate commit.
9
-
10
- ## Step 1: Gather Context
11
-
12
- Run these commands to understand what changed:
13
-
14
- ```bash
15
- git status
16
- git diff --staged
17
- git diff
18
- git log --oneline -5
19
- ```
20
-
21
- ## Step 2: Analyze Changes
22
-
23
- - Identify what was added, modified, or deleted
24
- - Determine the appropriate commit type: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `style`
25
- - Identify the scope if relevant (e.g., `auth`, `api`, `ui`)
26
- - Check current branch — confirm it follows Git Flow naming (`feature/`, `fix/`, `hotfix/`, `develop`, `dev`)
27
-
28
- ## Step 3: Stage Files
29
-
30
- Stage only the relevant files for this commit (avoid `git add -A` unless all changes belong together):
31
-
32
- ```bash
33
- git add <specific files>
34
- ```
35
-
36
- ## Step 4: Propose Commit
37
-
38
- Present the proposed commit message to the user **before executing**:
39
-
40
- > "Proposed commit:
41
- > `feat(products): add price filter to search endpoint`
42
- >
43
- > Files included: [list files]
44
- > Shall I proceed?"
45
-
46
- Wait for explicit approval before running `git commit`.
47
-
48
- ## Step 5: Version Bump (if configured)
49
-
50
- Before committing, check the project's `CLAUDE.md` for a `## Versioning` section. If it exists:
51
-
52
- 1. Read the versioning configuration (command, trigger, files)
53
- 2. Check if the **trigger condition** matches (e.g., specific branches, always, etc.)
54
- 3. If it matches, run the version bump command
55
- 4. Stage the version files alongside the other changes
56
-
57
- If no `## Versioning` section exists in the project's `CLAUDE.md`, skip this step entirely.
58
-
59
- ## Step 6: Execute Commit
60
-
61
- Once approved, create the commit:
62
-
63
- ```bash
64
- git commit -m "<type>(<scope>): <description>"
65
- ```
66
-
67
- ## Step 7: Push Reminder
68
-
69
- After committing, remind the user:
70
-
71
- > "Commit created locally. Do you want to push to `origin/<branch>`?"
72
-
73
- **Never push automatically** — wait for explicit confirmation.
74
-
75
- If the user confirms the push (or if the branch was already pushed), suggest:
76
- > "Ready to create a Pull Request? Run `/hopla-git-pr` to create one."
@@ -1,138 +0,0 @@
1
- ---
2
- description: Create a GitHub Pull Request with a structured description
3
- argument-hint: "[optional: base branch, defaults to develop]"
4
- ---
5
-
6
- > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
7
-
8
- Create a Pull Request on GitHub for the current branch.
9
-
10
- ## Step 1: Gather Context
11
-
12
- ```bash
13
- git status
14
- git branch --show-current
15
- git log --oneline origin/$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null | sed 's|.*/||' || echo 'develop')..HEAD
16
- git diff --stat origin/$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null | sed 's|.*/||' || echo 'develop')..HEAD
17
- ```
18
-
19
- Read the following if they exist:
20
- - The plan file in `.agents/plans/` related to this feature
21
- - `CLAUDE.md` — for project context
22
-
23
- ## Step 2: Determine Base Branch
24
-
25
- **If `$1` is provided**, use it as the base branch.
26
-
27
- **Otherwise, infer from Git Flow branch naming:**
28
-
29
- | Current branch prefix | Base branch |
30
- |---|---|
31
- | `feature/*` | `develop` or `dev` |
32
- | `fix/*` | `develop` or `dev` |
33
- | `hotfix/*` | `main` |
34
- | `release/*` | `main` |
35
-
36
- To resolve `develop` vs `dev`: run `git branch -r` and look for `origin/develop` or `origin/dev`. Use whichever exists.
37
-
38
- **Guard rails:**
39
- - If the current branch is `main`, `master`, `develop`, or `dev` → stop and warn: "You're on `[branch]` — PRs should come from feature branches."
40
- - If the branch name doesn't match any Git Flow prefix → ask the user: "I can't determine the base branch from `[branch]`. Should this PR target `develop` or `main`?"
41
- - **Always show the resolved base branch in Step 5** so the user can catch mistakes before the PR is created.
42
-
43
- ## Step 3: Check Push Status
44
-
45
- ```bash
46
- git status
47
- ```
48
-
49
- If the branch hasn't been pushed yet:
50
- > "Branch not pushed yet. Push to origin first?"
51
-
52
- Wait for confirmation before pushing:
53
- ```bash
54
- git push -u origin <branch>
55
- ```
56
-
57
- ## Step 4: Build PR Description
58
-
59
- Using the commits and plan context, draft:
60
-
61
- **Title:** `[type(scope)]: short description` — match the main commit or feature name, max 70 chars
62
-
63
- **Body:**
64
- ```markdown
65
- ## Summary
66
- - [What was built — 2-3 bullets max]
67
-
68
- ## Changes
69
- - [Key files modified and why]
70
-
71
- ## Test Plan
72
- - [ ] [How to verify this works]
73
- - [ ] [Edge cases to check]
74
-
75
- ## Related
76
- - Plan: `.agents/plans/[feature-name].md` (if exists)
77
- ```
78
-
79
- ## Step 5: Propose and Confirm
80
-
81
- Show the proposed PR title and body to the user:
82
- > "Proposed PR:
83
- > Title: `[title]`
84
- > Base: `[base branch]`
85
- > [body preview]
86
- > Shall I create it?"
87
-
88
- Wait for explicit approval before creating.
89
-
90
- ## Step 6: Create PR
91
-
92
- ```bash
93
- gh pr create --title "[title]" --body "[body]" --base [base-branch]
94
- ```
95
-
96
- After creating, show the PR URL to the user.
97
-
98
- **Never merge automatically** — the PR is for human review.
99
-
100
- After showing the PR URL, suggest:
101
- > "PR created. To complete the cycle, run `/hopla-execution-report` (if not done yet) and `/hopla-system-review` after the PR is merged."
102
-
103
- ## Step 7: Post-Merge Cleanup
104
-
105
- After the user confirms the PR was approved and merged on GitHub, run the cleanup workflow based on the branch type:
106
-
107
- ### For feature and fix branches (merged to `dev`/`develop`):
108
-
109
- ```bash
110
- git checkout [base-branch]
111
- git pull origin [base-branch]
112
- git branch -d [merged-branch]
113
- git push origin --delete [merged-branch] 2>/dev/null # skip if GitHub already deleted it
114
- ```
115
-
116
- **Important:** When `dev` is merged to `main` via PR, do NOT pull `main` back into `dev` — `dev` already has all the commits. Only sync `main` → `dev` for hotfix/release branches (see below).
117
-
118
- ### Additional steps for `hotfix/*` and `release/*` ONLY:
119
-
120
- These branches were merged to `main` but `develop` also needs the changes:
121
-
122
- ```bash
123
- git checkout develop
124
- git pull origin develop
125
- git merge main
126
- git push origin develop
127
- ```
128
-
129
- Then create a version tag:
130
-
131
- ```bash
132
- git tag -a v[version] -m "Release [version]"
133
- git push origin v[version]
134
- ```
135
-
136
- Ask the user for the version number before tagging.
137
-
138
- **Always confirm each destructive action** (branch deletion, tag creation) before executing.