feat(yolo): create worktree like work does
ci / nix (push) Successful in 8s
ci / lint (push) Successful in 22s

yolo now follows COMMON.md worktree setup: stay put when already in a
worktree, create worktrees/<branch-name> when run from the main checkout.
Branch name comes from the issue, or a slug of the task description for
ad-hoc runs.

The merge step no longer does 'git checkout main' — that fails from a
worktree when the main checkout has main out. It merges and pushes in the
main worktree via git -C instead.
This commit is contained in:
Miguel Palhas
2026-09-23 15:25:23 +01:00
parent 9c7e7022a0
commit d849488582
+12 -11
View File
@@ -1,6 +1,6 @@
---
name: yolo
description: "Implement a requested task in the current session worktree and branch, then commit, merge to main, and push directly with minimal ceremony"
description: "Implement a requested task in a worktree, then commit, merge to main, and push directly with minimal ceremony"
user-invocable: true
args:
- name: input
@@ -10,14 +10,16 @@ args:
# Yolo - Quick Ship Flow
Fast autonomous workflow: current session branch -> implementation -> commit -> merge to `main` -> push. No PRs, no reviews. The harness or environment provides the worktree; never create or switch to another worktree for this skill. A tracker is optional: use one only when the user supplies an issue reference and the repository already has the relevant tracker configuration.
Fast autonomous workflow: worktree -> implementation -> commit -> merge to `main` -> push. No PRs, no reviews. A tracker is optional: use one only when the user supplies an issue reference and the repository already has the relevant tracker configuration.
**First:** Read `tracker-common/COMMON.md` (sibling skill, same skills root) for shared implementation and verification guidance. Do not follow its tracker first-time setup, task auto-picking, or worktree-creation steps for this skill.
**First:** Read `tracker-common/COMMON.md` (sibling skill, same skills root) for shared worktree, implementation, and verification guidance. Do not follow its tracker first-time setup or task auto-picking steps for this skill.
## Workflow
### 1. Setup
- Treat the current working directory and checked-out branch as authoritative. Do not create or remove worktrees, and do not switch branches during setup or implementation.
- Set up the worktree following "Worktree setup" in COMMON.md: if the current working directory is already a worktree (`git worktree list`), stay on the current branch and do not switch; only when running from the main worktree, create `worktrees/<branch-name>`, `cd` into it, and run `setupCommands`.
- Derive `<branch-name>` from the issue when one was supplied (same rules as COMMON.md), otherwise from the task description — a lowercase hyphenated slug of ~5 words, no `claude` in the name.
- Never remove a worktree.
- If the input is an explicit issue reference and tracker configuration already exists, load the issue and gather its context using COMMON.md. Do not create tracker configuration.
- If the input is an ad-hoc task description, implement it directly; do not create a tracker issue.
- If no input is provided, use the task already established in the conversation/session. Do not auto-pick or create an issue. If no task is established, stop and ask for one.
@@ -39,14 +41,13 @@ Follow the implementation guidelines from COMMON.md. Move fast — this is yolo
### 3. Ship
1. Commit the completed changes on the current branch. Never amend an existing commit.
2. If the current branch is not `main` and the work is complete and self-contained, merge it into `main`:
2. If the current branch is already `main`, just push it. Otherwise, when the work is complete and self-contained, merge it into `main` **without switching the current branch** — `main` is usually checked out in the main worktree, so `git checkout main` fails from a worktree:
```bash
MAIN_WT=$(git worktree list --porcelain | awk '/^worktree /{print $2; exit}')
git -C "$MAIN_WT" merge <branch> --no-edit
git -C "$MAIN_WT" push
```
git checkout main
git merge <branch> --no-edit
git push
git checkout <branch>
```
If the current branch is already `main`, just push it. The temporary checkout of `main` for the merge is the only branch switch permitted. Only defer the merge when the change is not clearly ready or the merge has a genuine conflict; report that condition.
If the main worktree does not have `main` checked out, check it out there first (`git -C "$MAIN_WT" checkout main`) and leave it on `main`. Only defer the merge when the change is not clearly ready or the merge has a genuine conflict; report that condition.
3. Mark a tracking issue done only when the user supplied an issue reference and the configured tracker was used:
- **linear**: move the issue to "Done".
- **gitea**: close it — `curl -sS -X PATCH -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" "$BASE/api/v1/repos/$REPO/issues/$N" -d '{"state":"closed"}'` (or put `Closes #N` in the final commit merged to the default branch).