@johngaynor/entourage 0.1.0 → 0.1.2
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.
- package/README.md +67 -4
- package/cli/entourage +49 -184
- package/cli/lib/commands.sh +86 -0
- package/cli/lib/common.sh +33 -0
- package/cli/lib/links.sh +93 -0
- package/cli/lib/project.sh +172 -0
- package/cli/lib/task.sh +194 -0
- package/herdr/README.md +92 -0
- package/herdr/projects/template/PROJECT.md +19 -0
- package/package.json +6 -3
- package/prompts/task-new.md +14 -0
- package/skills/sdlc-breakdown/SKILL.md +178 -0
- package/skills/sdlc-define/SKILL.md +153 -0
- package/skills/sdlc-plan/SKILL.md +159 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Projects: groups of repos shown in Herdr as spaces. Sourced by cli/entourage.
|
|
2
|
+
|
|
3
|
+
# A project is a folder in $PROJECTS:
|
|
4
|
+
# PROJECT.md what the project is and what belongs in each repo
|
|
5
|
+
# repos one repo path per line (~/ for the home folder, # for comments)
|
|
6
|
+
# links/ generated: a link to each repo, named after its folder
|
|
7
|
+
# CLAUDE.md, AGENTS.md generated: links to PROJECT.md, so agents read it
|
|
8
|
+
|
|
9
|
+
valid_name() { case ${1:-} in '' | *[!a-z0-9-]*) return 1 ;; esac; }
|
|
10
|
+
|
|
11
|
+
# Print a project's folder, or stop if there is no such project.
|
|
12
|
+
project_dir() {
|
|
13
|
+
local name=${1:-}
|
|
14
|
+
[ -n "$name" ] || die "which project? See: entourage project ls"
|
|
15
|
+
valid_name "$name" && [ -d "$PROJECTS/$name" ] ||
|
|
16
|
+
die "no project called '$name'. Make it with: entourage project new $name"
|
|
17
|
+
(cd -P "$PROJECTS/$name" && pwd)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Print a project's repo paths, absolute, one per line.
|
|
21
|
+
project_repos() {
|
|
22
|
+
local dir=$1 line
|
|
23
|
+
[ -f "$dir/repos" ] || return 0
|
|
24
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
25
|
+
case $line in
|
|
26
|
+
'' | '#'*) continue ;;
|
|
27
|
+
'~/'*) line=$HOME/${line#'~/'} ;;
|
|
28
|
+
esac
|
|
29
|
+
printf '%s\n' "$line"
|
|
30
|
+
done < "$dir/repos"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
is_repo() { [ -e "$1/.git" ]; }
|
|
34
|
+
|
|
35
|
+
# Rebuild what is generated in a project folder. Only links are ever removed
|
|
36
|
+
# or replaced; a real file in the way is reported and left alone.
|
|
37
|
+
sync_links() {
|
|
38
|
+
local dir=$1 src dst base names=$'\n'
|
|
39
|
+
mkdir -p "$dir/links"
|
|
40
|
+
while IFS= read -r src; do
|
|
41
|
+
base=${src##*/}
|
|
42
|
+
dst=$dir/links/$base
|
|
43
|
+
names+=$base$'\n'
|
|
44
|
+
is_repo "$src" || say " warning: $src is missing or is not a git repo"
|
|
45
|
+
if [ -L "$dst" ]; then
|
|
46
|
+
[ "$(readlink "$dst")" = "$src" ] || { rm "$dst"; ln -s "$src" "$dst"; }
|
|
47
|
+
elif [ -e "$dst" ]; then
|
|
48
|
+
say " skipped links/$base (a real file is in the way)"
|
|
49
|
+
else
|
|
50
|
+
ln -s "$src" "$dst"
|
|
51
|
+
fi
|
|
52
|
+
done < <(project_repos "$dir")
|
|
53
|
+
for dst in "$dir"/links/*; do
|
|
54
|
+
[ -L "$dst" ] || continue
|
|
55
|
+
case $names in *$'\n'"${dst##*/}"$'\n'*) ;; *) rm "$dst" ;; esac
|
|
56
|
+
done
|
|
57
|
+
for base in CLAUDE.md AGENTS.md; do
|
|
58
|
+
[ -e "$dir/$base" ] || [ -L "$dir/$base" ] || ln -s PROJECT.md "$dir/$base"
|
|
59
|
+
done
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
project_new() {
|
|
63
|
+
local name=${1:-} dir
|
|
64
|
+
valid_name "$name" || die "a project name is lowercase letters, digits and dashes, like: my-project"
|
|
65
|
+
dir=$PROJECTS/$name
|
|
66
|
+
[ ! -e "$dir" ] || die "project '$name' already exists at $dir"
|
|
67
|
+
[ -f "$TEMPLATE/PROJECT.md" ] || die "the project template is missing from $TEMPLATE"
|
|
68
|
+
mkdir -p "$dir"
|
|
69
|
+
sed "s/__NAME__/$name/" "$TEMPLATE/PROJECT.md" > "$dir/PROJECT.md"
|
|
70
|
+
: > "$dir/repos"
|
|
71
|
+
sync_links "$dir"
|
|
72
|
+
say "Made project '$name' at $dir"
|
|
73
|
+
say "Next:"
|
|
74
|
+
say " entourage project add $name <path to a repo>"
|
|
75
|
+
say " fill in $dir/PROJECT.md"
|
|
76
|
+
say " entourage project open $name"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
project_add() {
|
|
80
|
+
local name=${1:-} path=${2:-} dir abs other stored
|
|
81
|
+
dir=$(project_dir "$name")
|
|
82
|
+
[ -n "$path" ] || die "which repo? Usage: entourage project add $name <path>"
|
|
83
|
+
[ -d "$path" ] || die "$path is not a folder"
|
|
84
|
+
abs=$(cd "$path" && pwd -P)
|
|
85
|
+
is_repo "$abs" || die "$abs is not a git repo (the top folder of a clone is needed)"
|
|
86
|
+
while IFS= read -r other; do
|
|
87
|
+
[ "$other" != "$abs" ] || die "$abs is already in project '$name'"
|
|
88
|
+
[ "${other##*/}" != "${abs##*/}" ] ||
|
|
89
|
+
die "project '$name' already has a repo called ${abs##*/} ($other); two repos in a project cannot share a folder name"
|
|
90
|
+
done < <(project_repos "$dir")
|
|
91
|
+
case $abs in
|
|
92
|
+
"$HOME"/*) stored="~/${abs#"$HOME"/}" ;;
|
|
93
|
+
*) stored=$abs ;;
|
|
94
|
+
esac
|
|
95
|
+
printf '%s\n' "$stored" >> "$dir/repos"
|
|
96
|
+
sync_links "$dir"
|
|
97
|
+
say "Added ${abs##*/} to project '$name'"
|
|
98
|
+
say "Describe what it owns in $dir/PROJECT.md"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Show the Herdr space for a project, making it if it is not open.
|
|
102
|
+
show_space() {
|
|
103
|
+
local name=$1 dir=$2 id
|
|
104
|
+
# Find an open space whose folder is this project's. `herdr-app ls` prints
|
|
105
|
+
# indented JSON; a space's own "id" and "folder" sit at six spaces. Closed
|
|
106
|
+
# spaces are listed after "recent" in the same shape, so stop there.
|
|
107
|
+
id=$(herdr_app ls 2>/dev/null | awk -v want="$dir" '
|
|
108
|
+
/^ "recent"/ { exit }
|
|
109
|
+
/^ "id": / { id = $2; gsub(/[",]/, "", id) }
|
|
110
|
+
/^ "folder": / { f = $0; sub(/^ *"folder": "/, "", f); sub(/",?$/, "", f)
|
|
111
|
+
if (f == want) { print id; exit } }') || true
|
|
112
|
+
if [ -n "$id" ]; then
|
|
113
|
+
herdr_app do space.select "{\"id\":\"$id\"}" >/dev/null 2>&1 ||
|
|
114
|
+
die "could not show the space for '$name'. Is Herdr open?"
|
|
115
|
+
say "Showing the space for '$name'"
|
|
116
|
+
else
|
|
117
|
+
herdr_app do space.new "{\"name\":\"$name\",\"folder\":\"$dir\"}" >/dev/null 2>&1 ||
|
|
118
|
+
die "could not make a space for '$name'. Is Herdr open?"
|
|
119
|
+
say "Opened a space for '$name' in $dir"
|
|
120
|
+
fi
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
project_open() {
|
|
124
|
+
local name=${1:-} dir
|
|
125
|
+
dir=$(project_dir "$name")
|
|
126
|
+
require_herdr
|
|
127
|
+
sync_links "$dir"
|
|
128
|
+
show_space "$name" "$dir"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
project_ls() {
|
|
132
|
+
local d any=0 repo
|
|
133
|
+
for d in "$PROJECTS"/*/; do
|
|
134
|
+
[ -d "$d" ] || continue
|
|
135
|
+
any=1
|
|
136
|
+
d=${d%/}
|
|
137
|
+
say "${d##*/}"
|
|
138
|
+
while IFS= read -r repo; do say " $repo"; done < <(project_repos "$d")
|
|
139
|
+
done
|
|
140
|
+
[ "$any" = 1 ] || say "No projects yet. Make one with: entourage project new <name>"
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
# Print what is wrong with each project; return how many problems there are.
|
|
144
|
+
check_projects() {
|
|
145
|
+
local d repo problems=0 bad
|
|
146
|
+
for d in "$PROJECTS"/*/; do
|
|
147
|
+
[ -d "$d" ] || continue
|
|
148
|
+
d=${d%/}
|
|
149
|
+
bad=0
|
|
150
|
+
if [ ! -f "$d/PROJECT.md" ]; then
|
|
151
|
+
say " problem ${d##*/}: PROJECT.md is missing"; bad=$((bad + 1))
|
|
152
|
+
elif grep -qF -- "$TEMPLATE_MARK" "$d/PROJECT.md"; then
|
|
153
|
+
say " problem ${d##*/}: PROJECT.md is still the template; fill it in and delete its first line"; bad=$((bad + 1))
|
|
154
|
+
fi
|
|
155
|
+
while IFS= read -r repo; do
|
|
156
|
+
is_repo "$repo" || { say " problem ${d##*/}: $repo is missing or is not a git repo"; bad=$((bad + 1)); }
|
|
157
|
+
done < <(project_repos "$d")
|
|
158
|
+
[ "$bad" -gt 0 ] || say " ok ${d##*/}"
|
|
159
|
+
problems=$((problems + bad))
|
|
160
|
+
done
|
|
161
|
+
return "$problems"
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
cmd_project() {
|
|
165
|
+
case ${1:-} in
|
|
166
|
+
new) shift; project_new "$@" ;;
|
|
167
|
+
add) shift; project_add "$@" ;;
|
|
168
|
+
open) shift; project_open "$@" ;;
|
|
169
|
+
ls | list) shift; project_ls ;;
|
|
170
|
+
*) die "usage: entourage project new|add|open|ls (see: entourage help)" ;;
|
|
171
|
+
esac
|
|
172
|
+
}
|
package/cli/lib/task.sh
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Tasks: a card an agent writes up, then a worktree of each repo on one
|
|
2
|
+
# branch. Sourced by cli/entourage.
|
|
3
|
+
|
|
4
|
+
# A task is one piece of work in a project, usually a Linear card. It has two
|
|
5
|
+
# commands, in the order they are used:
|
|
6
|
+
# task new an agent writes the card up, in a tab in the project's space
|
|
7
|
+
# task start a worktree of each repo on the card's branch, in a tab of its own
|
|
8
|
+
|
|
9
|
+
# A card ID is a team key and a number, like ABC-122.
|
|
10
|
+
CARD_RE='^[A-Za-z][A-Za-z0-9]*-[0-9]+$'
|
|
11
|
+
# The skills the agent writes a card up with, in the order it uses them.
|
|
12
|
+
CARD_SKILLS='sdlc-define sdlc-plan sdlc-breakdown'
|
|
13
|
+
# The agent's first message. {card} and {project} are filled in.
|
|
14
|
+
CARD_PROMPT=$REPO/prompts/task-new.md
|
|
15
|
+
# The agent a new task's tab runs: one word, a command on PATH.
|
|
16
|
+
AGENT=${ENTOURAGE_AGENT:-claude}
|
|
17
|
+
|
|
18
|
+
# Start writing a card up: a tab in the project's space, in the project's
|
|
19
|
+
# folder, running an agent whose first message names the card and the skills.
|
|
20
|
+
# It makes no branch, worktree or task folder; `task start` does that once the
|
|
21
|
+
# card has a type.
|
|
22
|
+
task_new() {
|
|
23
|
+
local name=${1:-} card=${2:-} dir skill prompt
|
|
24
|
+
dir=$(project_dir "$name")
|
|
25
|
+
[ -n "$card" ] ||
|
|
26
|
+
die "which card? Usage: entourage task new $name <card>, like: entourage task new $name ABC-122"
|
|
27
|
+
[[ $card =~ $CARD_RE ]] ||
|
|
28
|
+
die "'$card' is not a card ID like ABC-122. To make a worktree for a branch, use: entourage task start $name <type>/<description>"
|
|
29
|
+
card=$(printf '%s' "$card" | tr '[:lower:]' '[:upper:]')
|
|
30
|
+
# The agent runs in a tab, so Herdr has to be there before anything is opened.
|
|
31
|
+
require_herdr
|
|
32
|
+
herdr_running || die "Herdr is not running. Open it, then run this again."
|
|
33
|
+
command -v "$AGENT" >/dev/null 2>&1 ||
|
|
34
|
+
die "'$AGENT' is not on your PATH, so there is no agent to start. Install it, or set ENTOURAGE_AGENT to the one you use."
|
|
35
|
+
for skill in $CARD_SKILLS; do
|
|
36
|
+
[ -f "$SKILLS_HOME/$skill/SKILL.md" ] ||
|
|
37
|
+
die "the $skill skill is not in $SKILLS_HOME, so the agent could not use it. Run: entourage update"
|
|
38
|
+
done
|
|
39
|
+
[ -f "$CARD_PROMPT" ] || die "the agent's first message is missing from $CARD_PROMPT"
|
|
40
|
+
prompt=$(sed -e "s/{card}/$card/g" -e "s/{project}/$name/g" "$CARD_PROMPT")
|
|
41
|
+
|
|
42
|
+
sync_links "$dir"
|
|
43
|
+
(show_space "$name" "$dir") ||
|
|
44
|
+
die "could not show the space for '$name', so no agent was started."
|
|
45
|
+
# No `space` argument: the tab goes in the selected space, which show_space
|
|
46
|
+
# has just selected or made. argv is the agent and task is its first message.
|
|
47
|
+
herdr_app do tab.new "{\"name\":\"$card\",\"folder\":\"$(json_str "$dir")\",\"argv\":[\"$(json_str "$AGENT")\"],\"task\":\"$(json_str "$prompt")\"}" >/dev/null 2>&1 ||
|
|
48
|
+
die "could not open a tab for $card. Is Herdr open?"
|
|
49
|
+
say "Started $card in the space for '$name'"
|
|
50
|
+
say "The agent writes the card up, then asks you to approve it."
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# `task start` makes a folder in a project's tasks/ folder, named after its
|
|
54
|
+
# branch's description, holding one git worktree per repo of the project:
|
|
55
|
+
# tasks/abc-122-short-title/api a worktree of api on feat/abc-122-short-title
|
|
56
|
+
|
|
57
|
+
# Branch names follow Conventional Branch 1.1.0 (https://conventionalbranch.org):
|
|
58
|
+
# <type>/<description>. Trunk names (main, master, develop) have no type, so
|
|
59
|
+
# they do not match.
|
|
60
|
+
BRANCH_RE='^(feature|feat|bugfix|fix|hotfix|release|chore|ai|claude|codex|copilot|cursor)/[a-z0-9]+(\.[a-z0-9]+)*(-[a-z0-9]+(\.[a-z0-9]+)*)*$'
|
|
61
|
+
|
|
62
|
+
valid_branch() { [[ ${1:-} =~ $BRANCH_RE ]]; }
|
|
63
|
+
|
|
64
|
+
# A task's name is its branch without the type.
|
|
65
|
+
task_name() { printf '%s\n' "${1#*/}"; }
|
|
66
|
+
|
|
67
|
+
has_origin() { git -C "$1" remote get-url origin >/dev/null 2>&1; }
|
|
68
|
+
resolves() { git -C "$1" rev-parse -q --verify "$2^{commit}" >/dev/null 2>&1; }
|
|
69
|
+
|
|
70
|
+
# Print the ref a repo's new task branch is cut from: the remote's default
|
|
71
|
+
# branch, or the local one in a repo with no origin.
|
|
72
|
+
base_ref() {
|
|
73
|
+
local repo=$1 ref
|
|
74
|
+
if has_origin "$repo"; then
|
|
75
|
+
ref=$(git -C "$repo" symbolic-ref -q --short refs/remotes/origin/HEAD 2>/dev/null) || ref=
|
|
76
|
+
for ref in ${ref:+"$ref"} origin/main origin/master; do
|
|
77
|
+
if resolves "$repo" "$ref"; then printf '%s\n' "$ref"; return; fi
|
|
78
|
+
done
|
|
79
|
+
fi
|
|
80
|
+
for ref in main master; do
|
|
81
|
+
if resolves "$repo" "refs/heads/$ref"; then printf '%s\n' "$ref"; return; fi
|
|
82
|
+
done
|
|
83
|
+
git -C "$repo" rev-parse --abbrev-ref HEAD
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# What the current `task start` is in the middle of making, so that it can be
|
|
87
|
+
# removed if the run fails or is interrupted. Empty when nothing is half-made.
|
|
88
|
+
UNDO_DIR='' UNDO_BRANCH=''
|
|
89
|
+
MADE=() # the repos a worktree has been started in
|
|
90
|
+
|
|
91
|
+
# Remove a half-made task. The task folder and the branch did not exist before
|
|
92
|
+
# the run (task_start checks both), so this never removes someone's work.
|
|
93
|
+
task_undo() {
|
|
94
|
+
local tdir=$UNDO_DIR branch=$UNDO_BRANCH repo
|
|
95
|
+
[ -n "$tdir" ] || return 0
|
|
96
|
+
UNDO_DIR=''
|
|
97
|
+
for repo in ${MADE[@]+"${MADE[@]}"}; do
|
|
98
|
+
git -C "$repo" worktree remove --force "$tdir/${repo##*/}" >/dev/null 2>&1 || true
|
|
99
|
+
git -C "$repo" branch -q -D "$branch" >/dev/null 2>&1 || true
|
|
100
|
+
done
|
|
101
|
+
rm -f "$tdir/CLAUDE.md" "$tdir/AGENTS.md"
|
|
102
|
+
rmdir "$tdir" 2>/dev/null || true
|
|
103
|
+
rmdir "${tdir%/*}" 2>/dev/null || true
|
|
104
|
+
[ ! -e "$tdir" ] || printf 'entourage: could not remove everything in %s\n' "$tdir" >&2
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
task_start() {
|
|
108
|
+
local name=${1:-} branch=${2:-} dir task
|
|
109
|
+
dir=$(project_dir "$name")
|
|
110
|
+
[ -n "$branch" ] ||
|
|
111
|
+
die "which branch? Usage: entourage task start $name <type>/<description> (see https://conventionalbranch.org)"
|
|
112
|
+
valid_branch "$branch" ||
|
|
113
|
+
die "'$branch' is not a branch name entourage accepts. Use <type>/<description>, like: feat/abc-122-short-title (see https://conventionalbranch.org)"
|
|
114
|
+
task=$(task_name "$branch")
|
|
115
|
+
# A task is shown as a tab, so Herdr has to be there before anything is made.
|
|
116
|
+
require_herdr
|
|
117
|
+
herdr_running || die "Herdr is not running. Open it, then run this again."
|
|
118
|
+
|
|
119
|
+
# Check everything before making anything.
|
|
120
|
+
local repos=() bases=() repo base i tdir=$dir/tasks/$task
|
|
121
|
+
while IFS= read -r repo; do repos+=("$repo"); done < <(project_repos "$dir")
|
|
122
|
+
[ "${#repos[@]}" -gt 0 ] ||
|
|
123
|
+
die "project '$name' has no repos. Add one with: entourage project add $name <path>"
|
|
124
|
+
for repo in "${repos[@]}"; do
|
|
125
|
+
is_repo "$repo" || die "$repo is missing or is not a git repo (see: entourage status)"
|
|
126
|
+
done
|
|
127
|
+
[ ! -e "$tdir" ] || die "task '$task' already exists at $tdir"
|
|
128
|
+
# Fetch first, so that the branch check below sees what is on the remote
|
|
129
|
+
# and the task starts from the latest default branch.
|
|
130
|
+
for repo in "${repos[@]}"; do
|
|
131
|
+
has_origin "$repo" || continue
|
|
132
|
+
git -C "$repo" fetch -q origin 2>/dev/null ||
|
|
133
|
+
say " warning: could not fetch ${repo##*/}; starting from what is local"
|
|
134
|
+
done
|
|
135
|
+
for repo in "${repos[@]}"; do
|
|
136
|
+
if resolves "$repo" "refs/heads/$branch" || resolves "$repo" "refs/remotes/origin/$branch"; then
|
|
137
|
+
die "branch '$branch' already exists in ${repo##*/}"
|
|
138
|
+
fi
|
|
139
|
+
base=$(base_ref "$repo" 2>/dev/null) && resolves "$repo" "$base" ||
|
|
140
|
+
die "${repo##*/} has no commit to start a branch from"
|
|
141
|
+
bases+=("$base")
|
|
142
|
+
done
|
|
143
|
+
sync_links "$dir"
|
|
144
|
+
|
|
145
|
+
say "Making task '$task' in $tdir"
|
|
146
|
+
# From here until the worktrees and links are all made, any failure or
|
|
147
|
+
# interruption removes what was made.
|
|
148
|
+
MADE=() UNDO_DIR=$tdir UNDO_BRANCH=$branch
|
|
149
|
+
trap task_undo EXIT
|
|
150
|
+
trap 'exit 130' INT
|
|
151
|
+
trap 'exit 143' TERM
|
|
152
|
+
mkdir -p "$tdir"
|
|
153
|
+
i=0
|
|
154
|
+
for repo in "${repos[@]}"; do
|
|
155
|
+
base=${bases[$i]}; i=$((i + 1))
|
|
156
|
+
# Recorded before the attempt: a failed `worktree add` can leave its branch.
|
|
157
|
+
MADE+=("$repo")
|
|
158
|
+
# --no-track: the branch is new work, not a copy of the default branch, so
|
|
159
|
+
# a plain push or pull must not go to or from it.
|
|
160
|
+
# -f: reuse a path git still has registered for a folder deleted by hand.
|
|
161
|
+
git -C "$repo" worktree add -q -f --no-track -b "$branch" "$tdir/${repo##*/}" "$base" ||
|
|
162
|
+
die "could not make a worktree in ${repo##*/}; the task was not made"
|
|
163
|
+
say " worktree ${repo##*/} (from $base)"
|
|
164
|
+
done
|
|
165
|
+
# With several repos the session starts in the task folder, so the project's
|
|
166
|
+
# doc is linked there for an agent to read.
|
|
167
|
+
if [ "${#repos[@]}" -gt 1 ]; then
|
|
168
|
+
ln -s ../../PROJECT.md "$tdir/CLAUDE.md"
|
|
169
|
+
ln -s ../../PROJECT.md "$tdir/AGENTS.md"
|
|
170
|
+
fi
|
|
171
|
+
UNDO_DIR=''
|
|
172
|
+
trap - EXIT INT TERM
|
|
173
|
+
|
|
174
|
+
# One repo: the tab starts in its worktree, where git and the repo's own
|
|
175
|
+
# docs work as usual. Several: it starts in the task folder above them.
|
|
176
|
+
local folder=$tdir
|
|
177
|
+
[ "${#repos[@]}" -gt 1 ] || folder=$tdir/${repos[0]##*/}
|
|
178
|
+
# The task exists now. If Herdr cannot show it, keep it and say where it is.
|
|
179
|
+
(show_space "$name" "$dir") ||
|
|
180
|
+
die "made the task at $folder but could not show it in Herdr. Open that folder in the project's space yourself."
|
|
181
|
+
# No `space` argument: the tab goes in the selected space, which show_space
|
|
182
|
+
# has just selected or made.
|
|
183
|
+
herdr_app do tab.new "{\"name\":\"$task\",\"folder\":\"$folder\"}" >/dev/null 2>&1 ||
|
|
184
|
+
die "made the task at $folder but could not open its tab. Is Herdr open?"
|
|
185
|
+
say "Opened task '$task' on branch $branch"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
cmd_task() {
|
|
189
|
+
case ${1:-} in
|
|
190
|
+
new) shift; task_new "$@" ;;
|
|
191
|
+
start) shift; task_start "$@" ;;
|
|
192
|
+
*) die "usage: entourage task new <project> <card>, or: entourage task start <project> <branch> (see: entourage help)" ;;
|
|
193
|
+
esac
|
|
194
|
+
}
|
package/herdr/README.md
CHANGED
|
@@ -11,6 +11,11 @@ layouts (whole-window arrangements of mods).
|
|
|
11
11
|
| `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
|
|
12
12
|
| `layouts/default.json` | Herdr's own layout, plus the layout dropdown. |
|
|
13
13
|
| `layouts/test.json` | `default` plus the CPU mod in the sidebar. |
|
|
14
|
+
| `projects/template/` | The starting `PROJECT.md` for every new project. |
|
|
15
|
+
|
|
16
|
+
The skills are in [../skills/](../skills/), outside this folder. They are
|
|
17
|
+
linked into `~/.claude/skills` (`CLAUDE_CONFIG_DIR` picks another `~/.claude`)
|
|
18
|
+
by the same `entourage install` and `entourage update`.
|
|
14
19
|
|
|
15
20
|
## How it works
|
|
16
21
|
|
|
@@ -76,6 +81,93 @@ re-reads everything.
|
|
|
76
81
|
- **Something broke the window:** `ctrl-alt-shift-escape` always returns Herdr
|
|
77
82
|
to its own default layout.
|
|
78
83
|
|
|
84
|
+
## Projects
|
|
85
|
+
|
|
86
|
+
A project is a group of repos that shows up in Herdr as one space. Only the
|
|
87
|
+
template is in this repo. Your own projects are in
|
|
88
|
+
`~/.config/entourage/projects` (`ENTOURAGE_HOME` picks another
|
|
89
|
+
`~/.config/entourage`), one folder each:
|
|
90
|
+
|
|
91
|
+
| In a project folder | What it is |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `PROJECT.md` | What the project is and what belongs in each repo. You write this. |
|
|
94
|
+
| `repos` | One repo path per line. `entourage project add` writes it; you can edit it. |
|
|
95
|
+
| `links/` | Generated: a link to each repo, named after its folder. |
|
|
96
|
+
| `tasks/` | One folder per task, holding a worktree of each repo. See [Tasks](#tasks). |
|
|
97
|
+
| `CLAUDE.md`, `AGENTS.md` | Generated: links to `PROJECT.md`, so an agent started in the space reads it. |
|
|
98
|
+
|
|
99
|
+
- **Make one:** `entourage project new <name>`, then
|
|
100
|
+
`entourage project add <name> <path>` for each repo. The repo must already
|
|
101
|
+
be cloned on this machine.
|
|
102
|
+
- **Open it:** `entourage project open <name>` rebuilds the links and shows
|
|
103
|
+
the project's space, making it if it is not open. The space's folder is the
|
|
104
|
+
project folder.
|
|
105
|
+
- **Check them:** `entourage status` reports a repo that has moved or gone,
|
|
106
|
+
and a `PROJECT.md` that is still the template. Delete the template's first
|
|
107
|
+
line once you have filled it in.
|
|
108
|
+
- **Remove a repo:** delete its line from `repos`; the next `open` drops its
|
|
109
|
+
link. To remove a project, close its space and delete its folder.
|
|
110
|
+
- **The linked repos are shared.** A repo in two projects is the same clone
|
|
111
|
+
in both, so switching branches in one changes it in the other.
|
|
112
|
+
|
|
113
|
+
## Tasks
|
|
114
|
+
|
|
115
|
+
A task is one piece of work in a project, usually a Linear card. It has two
|
|
116
|
+
commands, used in this order.
|
|
117
|
+
|
|
118
|
+
### Writing the card up
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
entourage task new <project> <card>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- **The card is its ID**, like `ABC-122`. Upper or lower case both work.
|
|
125
|
+
- **It opens a tab named after the card** in the project's space, in the
|
|
126
|
+
project folder, and starts an agent in it. The agent is `claude`;
|
|
127
|
+
`ENTOURAGE_AGENT` picks another command.
|
|
128
|
+
- **The agent's first message** is [prompts/task-new.md](../prompts/task-new.md)
|
|
129
|
+
with the card and project filled in. It tells the agent to run
|
|
130
|
+
`sdlc-define`, `sdlc-plan` and `sdlc-breakdown` in order, in that one
|
|
131
|
+
session, and to wait for your approval at the end. Edit that file to change
|
|
132
|
+
what the agent is told.
|
|
133
|
+
- **It makes no branch, worktree or task folder.** The card has no type until
|
|
134
|
+
the agent has defined it, and the type is the start of the branch name.
|
|
135
|
+
- **It checks first.** An unknown project, something that is not a card ID,
|
|
136
|
+
Herdr not running, no agent on your `PATH`, or the skills not linked into
|
|
137
|
+
`~/.claude/skills` stops it before anything is opened. Run
|
|
138
|
+
`entourage update` to link the skills.
|
|
139
|
+
|
|
140
|
+
### Starting the work
|
|
141
|
+
|
|
142
|
+
One branch, checked out as a git worktree of every repo in the project, and
|
|
143
|
+
shown as a tab in the project's space.
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
entourage task start <project> <branch>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- **The branch is `<type>/<description>`**, following
|
|
150
|
+
[Conventional Branch](https://conventionalbranch.org): `feat/abc-122-insert-task-here`,
|
|
151
|
+
`fix/abc-140-header-bug`, `chore/update-dependencies`. Put the card's ID in
|
|
152
|
+
the description. The types are `feature`, `feat`, `bugfix`, `fix`, `hotfix`,
|
|
153
|
+
`release` and `chore`, plus `ai`, `claude`, `codex`, `copilot` and `cursor`.
|
|
154
|
+
- **The description names the task.** `feat/abc-122-insert-task-here` makes
|
|
155
|
+
the folder `tasks/abc-122-insert-task-here` and a tab of that name.
|
|
156
|
+
- **Each repo gets a worktree** at `tasks/<task>/<repo>`, on the new branch,
|
|
157
|
+
cut from the remote's default branch after a fetch. A repo that cannot be
|
|
158
|
+
fetched starts from what is local, with a warning.
|
|
159
|
+
- **The repos' own checkouts are not touched.** They stay on whatever branch
|
|
160
|
+
they were on.
|
|
161
|
+
- **Where the tab starts:** in the worktree when the project has one repo; in
|
|
162
|
+
the task folder when it has several. That folder has `CLAUDE.md` and
|
|
163
|
+
`AGENTS.md` links to the project's `PROJECT.md`.
|
|
164
|
+
- **Nothing is made unless everything can be.** A task or branch of that name
|
|
165
|
+
that already exists, a missing repo, or Herdr not running stops it first,
|
|
166
|
+
and a worktree that fails partway is undone.
|
|
167
|
+
- **Remove a task by hand for now:** in each repo run
|
|
168
|
+
`git worktree remove <project folder>/tasks/<task>/<repo>` and
|
|
169
|
+
`git branch -D <branch>`, then delete the task's folder and close its tab.
|
|
170
|
+
|
|
79
171
|
## Changing things
|
|
80
172
|
|
|
81
173
|
- Work from a git clone, not the npm install: clone the repo and run
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- entourage:template -->
|
|
2
|
+
<!-- Delete the line above once this doc is filled in. `entourage status` reports the project as unfinished until then. -->
|
|
3
|
+
|
|
4
|
+
# __NAME__
|
|
5
|
+
|
|
6
|
+
One paragraph: what this project is, who it is for, and what "done" usually
|
|
7
|
+
looks like for a piece of work in it.
|
|
8
|
+
|
|
9
|
+
## Repos
|
|
10
|
+
|
|
11
|
+
One section per repo in this project. An agent reads this to decide which
|
|
12
|
+
repo a piece of work belongs in, so be specific.
|
|
13
|
+
|
|
14
|
+
### example-repo
|
|
15
|
+
|
|
16
|
+
- **Owns:** what lives here and nowhere else.
|
|
17
|
+
- **Does not own:** things people expect to find here but that live in
|
|
18
|
+
another repo, and which repo that is.
|
|
19
|
+
- **Run and test:** how to set it up and how to run its tests.
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johngaynor/entourage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"entourage": "cli/entourage"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"cli/entourage",
|
|
10
|
-
"
|
|
10
|
+
"cli/lib/",
|
|
11
|
+
"herdr/",
|
|
12
|
+
"prompts/",
|
|
13
|
+
"skills/"
|
|
11
14
|
],
|
|
12
15
|
"scripts": {
|
|
13
|
-
"test": "
|
|
16
|
+
"test": "test/run.sh"
|
|
14
17
|
},
|
|
15
18
|
"os": [
|
|
16
19
|
"darwin",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Write up Linear card {card} so that it is ready to build. This session is in the entourage project `{project}`.
|
|
2
|
+
|
|
3
|
+
Use these three skills, in this order: sdlc-define, then sdlc-plan, then sdlc-breakdown.
|
|
4
|
+
|
|
5
|
+
- Do all three yourself, in this session. Don't hand a step to a subagent.
|
|
6
|
+
- Finish each skill's section on the card before you start the next skill.
|
|
7
|
+
- When a skill tells you to report and stop, carry on to the next skill instead. I only need to hear from you when a skill says to ask me something, and at the end.
|
|
8
|
+
- sdlc-breakdown ends by asking me to approve the card. Wait for my answer.
|
|
9
|
+
|
|
10
|
+
Once I approve, give me the command that starts the work, and don't run it yourself:
|
|
11
|
+
|
|
12
|
+
entourage task start {project} <type>/<card-id>-<short-name>
|
|
13
|
+
|
|
14
|
+
Use the type you set on the card, the card's ID in lowercase, and two to four words from its title, in lowercase with hyphens. If the card was sliced, give the command for the first sub-issue.
|