chore(dev): add prepare worktree command to mage

This commit is contained in:
kolaente
2026-01-24 18:32:23 +01:00
parent 4df8da549e
commit 5050cd7162
3 changed files with 167 additions and 85 deletions

View File

@@ -11,13 +11,49 @@ The project consists of:
- `desktop/` Electron wrapper application
- `docs/` Documentation website
## Plans
## Plans and Worktrees
When the user asks you to create a plan to fix or implement something:
- ALWAYS write that plan to the plans/ directory on the root of the repo.
- NEVER commit plans to git
- Give the plan a descriptive name
- Give the plan a descriptive name using kebab-case (e.g., `fix-position-healing.md`, `feat-new-feature.md`)
### Preparing a Worktree for Implementation
When the user tells you to prepare a worktree for a plan, use the mage command to set up an isolated workspace:
```bash
mage dev:prepare-worktree <name> <plan-path>
```
**Arguments:**
- `<name>` - Required. Becomes both the folder name and branch name. Use conventions like `fix-<description>` for bug fixes or `feat-<description>` for new features.
- `<plan-path>` - Required. Path to a plan file (relative to repo root) that will be copied to the new worktree's `plans/` directory. Pass `""` to skip copying a plan.
This will initialize a new worktree in the parent directory and copy some files over.
**Example:**
```bash
# Create worktree for a bug fix with a plan
mage dev:prepare-worktree fix-position-healing plans/fix-position-healing.md
# Create worktree for a new feature without a plan
mage dev:prepare-worktree feat-dark-mode ""
```
**Result:**
```
parent-directory/
├── main/ # Original workspace
├── fix-position-healing/ # New worktree
│ ├── config.yml # With updated rootpath
│ └── plans/
│ └── fix-position-healing.md
└── ...
```
After creation, tell the user where they can find the new worktree.
## Development Commands
@@ -37,8 +73,9 @@ When the user asks you to create a plan to fix or implement something:
-Development helpers under the `dev` namespace:
- **Migration**: `mage dev:make-migration <StructName>` - Creates new database migration. If you omit `<StructName>`, the command will prompt for it.
- **Event**: `mage dev:make-event` - Create an event type
- **Listener**: `mage dev:make-listener` - Create an event listener
- **Listener**: `mage dev:make-listener` - Create an event listener
- **Notification**: `mage dev:make-notification` - Create a notification skeleton
- **Prepare Worktree**: `mage dev:prepare-worktree <name> <plan-path>` - Creates a new git worktree in `../` with the given name as folder and branch. Copies a plan file if provided (pass `""` to skip). Copies `config.yml` with updated rootpath and initializes the frontend.
### Frontend (Vue.js)
Navigate to `frontend/` directory: