docs(agentydragon): add worktree helper script and branch convention to README

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 12:58:46 -07:00
parent 481a76458f
commit a36ab4797c
2 changed files with 48 additions and 0 deletions

View File

@@ -22,6 +22,13 @@ This file documents the changes introduced on the `agentydragon` branch
Tasks live under `agentydragon/tasks/` as individual Markdown files. Please update each tasks **Status** and **Implementation** sections in place rather than maintaining a static list here.
### Branch & Worktree Workflow
- **Branch convention**: work on each task in its own branch named `agentydragon/<task-id>-<task-slug>`.
- **Worktree helper**: run `create-task-worktree.sh <task-id>-<task-slug>`
in `agentydragon/tasks/` to create or reuse a worktree at
`agentydragon/tasks/.worktrees/<task-id>-<task-slug>` off the `master` branch.
---
*This README was autogenerated to summarize changes on the `agentydragon` branch.*

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
#
# create-task-worktree.sh
#
# Create or reuse a git worktree for a specific task branch under agentydragon/tasks/.worktrees.
# Usage: create-task-worktree.sh <task-id>-<task-slug>
set -euo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <task-id>-<task-slug>"
exit 1
fi
task_slug="$1"
branch="agentydragon/$task_slug"
# Determine repository root
repo_root=$(git rev-parse --show-toplevel)
tasks_dir="$repo_root/agentydragon/tasks"
worktrees_dir="$tasks_dir/.worktrees"
worktree_path="$worktrees_dir/$task_slug"
mkdir -p "$worktrees_dir"
# Create branch if it does not exist
if ! git show-ref --verify --quiet "refs/heads/$branch"; then
echo "Creating branch $branch from master..."
git branch --track "$branch" master
fi
# Create worktree if it does not exist
if [ ! -d "$worktree_path" ]; then
echo "Creating worktree for $branch at $worktree_path"
git worktree add "$worktree_path" "$branch"
else
echo "Worktree for $branch already exists at $worktree_path"
fi
echo "Done."