@johngaynor/entourage 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ A collection of agent skills for the software development lifecycle (SDLC).
4
4
 
5
5
  ## Status
6
6
 
7
- Early setup. Three skills are in, and none has been run on a real card yet:
7
+ Early setup. Three skills are in, and they have had only a few runs on real cards:
8
8
 
9
9
  | Skill | What it does |
10
10
  |---|---|
@@ -16,10 +16,10 @@ They live in [skills/](skills/). `entourage install` links them into
16
16
  `~/.claude/skills`, so any Claude Code session on the machine can run one by
17
17
  name, such as `/sdlc-define ABC-122`.
18
18
 
19
- Whenever a skill stops, it ends with a handoff block: which step it was, and
20
- whether it is `done`, `needs-human` or `failed`. A `done` block also names the
21
- step that comes next. Whoever is driving, you or `entourage task new`, reads
22
- that block to know what happens next.
19
+ Whenever a skill ends or pauses, it hands off with a block: which step it was,
20
+ and whether it is `done`, `needs-human` or `failed`. A `done` block also names
21
+ the step that comes next. The agent records each block with
22
+ `entourage task handoff`, and `entourage task log` shows them for a card.
23
23
 
24
24
  ## Setting up a machine
25
25
 
@@ -45,14 +45,26 @@ entourage project add my-project ~/Dev/web
45
45
  entourage project open my-project
46
46
  ```
47
47
 
48
+ `project new` also takes the repos after the name, to do the first three
49
+ lines in one: `entourage project new my-project ~/Dev/api ~/Dev/web`.
50
+
51
+ In Herdr, the `+` above the projects list does the same without a terminal:
52
+ choose a repo's folder, name the project, and its space opens.
53
+
48
54
  Your projects live in `~/.config/entourage/projects`, outside this repo, so
49
55
  they are never published and survive updates. See
50
56
  [herdr/README.md](herdr/README.md#projects) for how a project is laid out.
51
57
 
58
+ `project new` also marks the project's folder as trusted in Claude Code's own
59
+ file, `~/.claude.json`, so an agent started there is not stopped by the "do
60
+ you trust this folder?" question. Only a project folder that entourage made
61
+ is marked: never a repo, and not a project folder you linked in from somewhere
62
+ else. This needs `jq`; without it Claude Code asks once.
63
+
52
64
  ## Tasks
53
65
 
54
- A task is one piece of work in a project, usually a Linear card. It has two
55
- commands, used in this order.
66
+ A task is one piece of work in a project, usually a Linear card. You run two
67
+ commands, in this order.
56
68
 
57
69
  `task new` writes the card up. It opens a tab in the project's Herdr space and
58
70
  starts an agent there, which runs the three skills on the card and then asks
@@ -62,6 +74,13 @@ you to approve it:
62
74
  entourage task new my-project ABC-122
63
75
  ```
64
76
 
77
+ As it goes, the agent records how each step ended. `task log` lists that for
78
+ a card, oldest first:
79
+
80
+ ```sh
81
+ entourage task log my-project ABC-122
82
+ ```
83
+
65
84
  `task start` starts the work. It makes a branch and a git worktree of it in
66
85
  every repo of the project, and opens a tab for it:
67
86
 
@@ -95,7 +114,9 @@ the task's tab, so the checkout is ready to work in. See
95
114
  See [herdr/README.md](herdr/README.md#tasks) for the details.
96
115
 
97
116
  To work on entourage itself, clone the repo and run `cli/entourage install`
98
- from the clone instead. Run the CLI's tests with `npm test`.
117
+ from the clone instead. Run the CLI's tests with `npm test`. The cases run
118
+ side by side, one per processor; `ENTOURAGE_TEST_JOBS=1 npm test` runs them
119
+ one at a time.
99
120
 
100
121
  ## Releasing
101
122
 
package/cli/entourage CHANGED
@@ -14,17 +14,22 @@ Usage:
14
14
  entourage install first-time setup: link everything into the tools on this machine
15
15
  entourage update [--no-pull] get the latest entourage, link anything new, drop stale links, refresh Herdr
16
16
  entourage status show what is linked and what is not, and check your projects
17
- entourage project new <name> make a project from the template
18
- entourage project add <name> <path> add a repo that is already on this machine
19
- entourage project open <name> show the project as a Herdr space
20
- entourage project ls [--json] list projects and their repos (--json for programs)
17
+ entourage project new <name> [<path>...] make a project from the template, with the repos at those paths
18
+ entourage project add <name> <path> add a repo that is already on this machine
19
+ entourage project open <name> show the project as a Herdr space
20
+ entourage project ls [--json] list projects and their repos (--json for programs)
21
21
  entourage task new <project> <card> write a card up: an agent defines, plans and breaks it down
22
22
  entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...]
23
23
  start the work: a worktree per repo, opened as a tab
24
+ entourage task handoff <project> <card> record how a step ended: a handoff block on stdin
25
+ entourage task log <project> <card> list a card's hand-offs, oldest first
24
26
  entourage help
25
27
 
26
28
  A project groups repos that belong together, with a PROJECT.md saying what
27
- each repo is for. A repo can be in several projects.
29
+ each repo is for. A repo can be in several projects. `project new` also
30
+ marks the project's folder as trusted in Claude Code's own file
31
+ (~/.claude.json), so an agent started there is not stopped by the trust
32
+ question. It needs jq; without it Claude Code asks once.
28
33
 
29
34
  A task is one piece of work in a project, usually a Linear card.
30
35
  `task new` takes the card's ID, like ABC-122. It opens a tab in the project's
@@ -38,12 +43,18 @@ gets `just setup` run in that tab, so the checkout is ready to work in.
38
43
  Targets after the branch narrow the task: `app` takes only that repo, and
39
44
  `app:athlete` sets it up for its athlete group (`just setup athlete`).
40
45
  Join several groups with a comma: `app:athlete,coach`.
46
+ `task handoff` is run by the agent each time a step ends or pauses. It reads
47
+ a handoff block on stdin (phase, status, next and so on, one per line),
48
+ refuses one that breaks the rules, and records it. `task log` lists what was
49
+ recorded for a card. Run `entourage task handoff <project> <card>` with no
50
+ block to see the rules.
41
51
 
42
52
  Herdr's folder is ~/.config/herdr-app (HERDR_APP_HOME picks another).
43
53
  Skills are linked into ~/.claude/skills (CLAUDE_CONFIG_DIR picks another
44
54
  ~/.claude). The agent is claude (ENTOURAGE_AGENT picks another command).
45
55
  Your projects are in ~/.config/entourage/projects (ENTOURAGE_HOME picks
46
- another ~/.config/entourage).
56
+ another ~/.config/entourage). Hand-offs are recorded beside them, in
57
+ entourage.db, with sqlite3 (ENTOURAGE_SQLITE picks another command).
47
58
  EOF
48
59
  }
49
60
 
@@ -62,6 +73,9 @@ REPO=$(cd -P "$(dirname "$self")/.." && pwd)
62
73
  APP_HOME=${HERDR_APP_HOME:-$HOME/.config/herdr-app}
63
74
  # Where Claude Code looks for a person's own skills.
64
75
  SKILLS_HOME=${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills
76
+ # Claude Code's own record for this machine. Among much else it holds the
77
+ # folders Claude Code starts in without asking.
78
+ CLAUDE_STATE=${CLAUDE_CONFIG_DIR:-$HOME}/.claude.json
65
79
  BIN_DIR=$HOME/.local/bin
66
80
  HERDR_INSTALL='curl -fsSL https://releases.herdr.dev/app/install.sh | sh'
67
81
  # What `update` reinstalls when entourage came from npm rather than a git clone.
@@ -79,7 +93,7 @@ TEMPLATE_MARK='<!-- entourage:template -->'
79
93
 
80
94
  # Sourced, so every file shares the settings above and each other's functions.
81
95
  LIB=$REPO/cli/lib
82
- for part in common links recipes project task commands; do
96
+ for part in common links recipes trust project task handoff commands; do
83
97
  [ -f "$LIB/$part.sh" ] ||
84
98
  { printf 'entourage: %s is missing; reinstall entourage\n' "$LIB/$part.sh" >&2; exit 1; }
85
99
  # shellcheck source=/dev/null
@@ -82,6 +82,9 @@ cmd_status() {
82
82
  if ! have_just && [ -n "$(ls -d "$PROJECTS"/*/ 2>/dev/null)" ]; then
83
83
  say " note just is not installed, so tasks start without setup. Install it: https://just.systems"
84
84
  fi
85
+ if ! have_sqlite && [ -n "$(ls -d "$PROJECTS"/*/ 2>/dev/null)" ]; then
86
+ say " note $SQLITE is not installed, so hand-offs are not recorded."
87
+ fi
85
88
  if [ "$problems" -gt 0 ] || [ "$project_problems" -gt 0 ]; then
86
89
  [ "$project_problems" = 0 ] || say "$project_problems project problem(s)."
87
90
  return 1
@@ -0,0 +1,211 @@
1
+ # Hand-offs: how each step of a task ended, recorded on this machine. Sourced
2
+ # by cli/entourage.
3
+
4
+ # A step of the lifecycle ends with a handoff block: which step it was, how it
5
+ # ended and what comes next. An agent runs `task handoff` with the block on
6
+ # stdin each time a step ends or pauses. The rules for a block are here, once;
7
+ # the skills only say to run the command.
8
+
9
+ # The store: one SQLite file beside the projects, so it is never published and
10
+ # an npm reinstall does not delete it.
11
+ STORE=$ENT_HOME/entourage.db
12
+ # The command that reads and writes it: one word, a command on PATH.
13
+ SQLITE=${ENTOURAGE_SQLITE:-sqlite3}
14
+
15
+ # The lines a block can have, in the order they are printed.
16
+ HANDOFF_KEYS='phase status next summary flags question options reason'
17
+ # The steps a block can name as its phase or as what comes next.
18
+ HANDOFF_STEPS='define plan breakdown setup'
19
+ # A block is a summary. A line longer than this is not one, and a very long
20
+ # line is slow to check and too big to hand to sqlite3 as an argument.
21
+ HANDOFF_LINE_MAX=2000
22
+
23
+ HANDOFF_USAGE="Usage: entourage task handoff <project> <card>, with the block on stdin:
24
+
25
+ entourage task handoff <project> <card> <<'EOF'
26
+ phase: define
27
+ status: done
28
+ next: plan
29
+ summary: One to three sentences on what was done.
30
+ EOF
31
+
32
+ status is done (needs next and summary, may have flags), needs-human (needs
33
+ question and options, may have summary) or failed (needs reason). phase and
34
+ next are one of: $HANDOFF_STEPS. Every value goes on one line."
35
+
36
+ have_sqlite() { command -v "$SQLITE" >/dev/null 2>&1; }
37
+
38
+ # Run one statement against the store.
39
+ # -init /dev/null: a person's own ~/.sqliterc must not change how answers are
40
+ # printed. .timeout: wait for another task's write to finish, not fail at once.
41
+ store() { "$SQLITE" -init /dev/null -batch -cmd '.timeout 5000' "$@" 2>/dev/null; }
42
+
43
+ # Print a value as an SQL string literal, or NULL when it is empty. Doubling
44
+ # the quote is SQLite's only escape, and no value holds a newline, so nothing
45
+ # in a value can end the literal or start a sqlite3 dot-command.
46
+ # LC_ALL=C: sed must not give up on text that is not valid in this locale.
47
+ sql_str() {
48
+ [ -n "$1" ] || { printf 'NULL'; return; }
49
+ printf "'%s'" "$(printf '%s' "$1" | LC_ALL=C sed "s/'/''/g")"
50
+ }
51
+
52
+ # Make the store if this is its first use.
53
+ store_ready() {
54
+ mkdir -p "$ENT_HOME"
55
+ store "$STORE" 'create table if not exists handoffs (
56
+ id integer primary key, at text not null, project text not null,
57
+ card text not null, phase text not null, status text not null,
58
+ next text, summary text, flags text, question text, options text, reason text);'
59
+ }
60
+
61
+ # Record one hand-off, timed now in UTC:
62
+ # store_handoff <project> <card> <phase> <status> <next> <summary> <flags> <question> <options> <reason>
63
+ store_handoff() {
64
+ local at values='' v
65
+ at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
66
+ for v in "$at" "$@"; do values="$values${values:+, }$(sql_str "$v")"; done
67
+ store "$STORE" "insert into handoffs
68
+ (at, project, card, phase, status, next, summary, flags, question, options, reason)
69
+ values ($values);"
70
+ }
71
+
72
+ # Note that a card's write-up has begun, so the first step's length can be
73
+ # read from the store. It never fails a `task new`: it only says when it could
74
+ # not record.
75
+ record_start() {
76
+ if ! have_sqlite; then
77
+ say " note $SQLITE is not installed, so hand-offs are not recorded"
78
+ return 0
79
+ fi
80
+ { store_ready && store_handoff "$1" "$2" new done define '' '' '' '' ''; } ||
81
+ say " note could not record the start in $STORE"
82
+ }
83
+
84
+ # Is $1 one of the words in $2? A value with a space in it never is, so
85
+ # "define plan" does not pass as a step.
86
+ in_list() {
87
+ case $1 in '' | *[[:space:]]*) return 1 ;; esac
88
+ case " $2 " in *" $1 "*) return 0 ;; *) return 1 ;; esac
89
+ }
90
+
91
+ # Is there a project folder with exactly this name? On a Mac the folder demo
92
+ # also answers to Demo, and a hand-off recorded as Demo would never show in
93
+ # demo's log.
94
+ project_named() {
95
+ local d
96
+ for d in "$PROJECTS"/*/; do
97
+ d=${d%/}
98
+ [ "${d##*/}" != "$1" ] || return 0
99
+ done
100
+ return 1
101
+ }
102
+
103
+ # Check a card ID as the task commands take it, and print it in its usual
104
+ # upper-case form.
105
+ handoff_card() {
106
+ local name=$1 card=$2 what=$3
107
+ [ -n "$card" ] || die "which card? Usage: entourage task $what $name <card>, like: entourage task $what $name ABC-122"
108
+ [[ $card =~ $CARD_RE ]] || die "'$card' is not a card ID like ABC-122."
109
+ printf '%s' "$card" | tr '[:lower:]' '[:upper:]'
110
+ }
111
+
112
+ # Read a handoff block on stdin, refuse one that breaks the rules, record it
113
+ # and print it back with its lines in the usual order.
114
+ task_handoff() {
115
+ local name=${1:-} card=${2:-}
116
+ [ -n "$name" ] || die "$HANDOFF_USAGE"
117
+ # Not project_dir: its advice is to make the project, which is not for an
118
+ # agent to do in the middle of a step.
119
+ project_named "$name" ||
120
+ die "there is no entourage project called '$name', so the hand-off was not recorded. Write the block in your message instead."
121
+ card=$(handoff_card "$name" "$card" handoff) || exit 1
122
+ [ "$#" -le 2 ] || die "$HANDOFF_USAGE"
123
+ [ ! -t 0 ] || die "$HANDOFF_USAGE"
124
+
125
+ local phase='' status='' next='' summary='' flags='' question='' options='' reason=''
126
+ local line key value n=0 seen=' '
127
+ local re='^[[:space:]]*([a-z]+):[[:space:]]*(.*)$' blank='^[[:space:]]*$' hint='^<.*>$'
128
+ while IFS= read -r line || [ -n "$line" ]; do
129
+ n=$((n + 1))
130
+ [ "${#line}" -le "$HANDOFF_LINE_MAX" ] ||
131
+ die "line $n of the block is ${#line} characters long. A block is a summary: keep each line under $HANDOFF_LINE_MAX characters."
132
+ line=${line%$'\r'}
133
+ [[ $line =~ $blank ]] && continue
134
+ [[ $line =~ $re ]] ||
135
+ die "line $n of the block is not 'key: value'. Every value goes on one line."
136
+ key=${BASH_REMATCH[1]} value=${BASH_REMATCH[2]}
137
+ # Drop spaces after the value.
138
+ value=${value%"${value##*[![:space:]]}"}
139
+ in_list "$key" "$HANDOFF_KEYS" ||
140
+ die "a handoff block has no '$key:' line. Its lines are: $HANDOFF_KEYS."
141
+ ! in_list "$key" "$seen" || die "the block has '$key:' twice."
142
+ seen="$seen$key "
143
+ [ -n "$value" ] || die "'$key:' is empty. Leave the line out when there is nothing to say."
144
+ case $value in *[[:cntrl:]]*) die "'$key:' has a tab or another control character in it. Use plain text on one line." ;; esac
145
+ ! [[ $value =~ $hint ]] ||
146
+ die "'$key:' still holds a placeholder in angle brackets. Write what happened, or leave the line out."
147
+ printf -v "$key" '%s' "$value"
148
+ done
149
+ [ "$seen" != ' ' ] || die "there is no block on stdin. $HANDOFF_USAGE"
150
+
151
+ [ -n "$phase" ] || die "the block has no 'phase:' line, the step that is handing off."
152
+ in_list "$phase" "$HANDOFF_STEPS" || die "'$phase' is not a step. The steps are: $HANDOFF_STEPS."
153
+ [ -n "$status" ] || die "the block has no 'status:' line. Use done, needs-human or failed."
154
+ local need allow
155
+ case $status in
156
+ done) need='next summary' allow='flags' ;;
157
+ needs-human) need='question options' allow='summary' ;;
158
+ failed) need='reason' allow='' ;;
159
+ *) die "'$status' is not a status. Use done, needs-human or failed." ;;
160
+ esac
161
+ for key in $need; do
162
+ [ -n "${!key}" ] || die "a $status hand-off needs a '$key:' line."
163
+ done
164
+ for key in next summary flags question options reason; do
165
+ [ -z "${!key}" ] || in_list "$key" "$need $allow" ||
166
+ die "a $status hand-off has no '$key:' line. Take it out."
167
+ done
168
+ [ -z "$next" ] || in_list "$next" "$HANDOFF_STEPS" ||
169
+ die "'$next' is not a step that can come next. The steps are: $HANDOFF_STEPS."
170
+
171
+ have_sqlite ||
172
+ die "$SQLITE is not installed, so the hand-off was not recorded. Write the block in your message instead."
173
+ { store_ready && store_handoff "$name" "$card" "$phase" "$status" "$next" "$summary" "$flags" "$question" "$options" "$reason"; } ||
174
+ die "the hand-off was not recorded: could not write to $STORE. Write the block in your message instead."
175
+ for key in $HANDOFF_KEYS; do
176
+ [ -z "${!key}" ] || printf '%s: %s\n' "$key" "${!key}"
177
+ done
178
+ }
179
+
180
+ # List a card's hand-offs, oldest first.
181
+ task_log() {
182
+ local name=${1:-} card=${2:-}
183
+ [ -n "$name" ] || die "usage: entourage task log <project> <card>"
184
+ project_named "$name" || die "there is no entourage project called '$name'. See: entourage project ls"
185
+ card=$(handoff_card "$name" "$card" log) || exit 1
186
+ [ "$#" -le 2 ] || die "usage: entourage task log <project> <card>"
187
+ have_sqlite || die "$SQLITE is not installed, so no hand-offs have been recorded on this machine."
188
+
189
+ # The unit separator: no value can hold it, and unlike a tab it does not let
190
+ # `read` run two empty fields together.
191
+ local sep=$'\x1f' count=0 key found=''
192
+ local at phase status next summary flags question options reason
193
+ if [ -e "$STORE" ]; then
194
+ # A store that cannot be read is an error, not an empty history.
195
+ found=$(store -separator "$sep" "$STORE" "select at, phase, status, coalesce(next, ''),
196
+ coalesce(summary, ''), coalesce(flags, ''), coalesce(question, ''), coalesce(options, ''),
197
+ coalesce(reason, '') from handoffs
198
+ where project = $(sql_str "$name") and card = $(sql_str "$card") order by id;") ||
199
+ die "could not read the hand-offs in $STORE. It may not be entourage's store."
200
+ fi
201
+ while IFS=$sep read -r at phase status next summary flags question options reason; do
202
+ [ -n "$at" ] || continue
203
+ [ "$count" -gt 0 ] || say "$card in '$name'"
204
+ count=$((count + 1))
205
+ printf '%s %-10s %s%s\n' "$at" "$phase" "$status" "${next:+, then $next}"
206
+ for key in summary flags question options reason; do
207
+ [ -z "${!key}" ] || printf ' %s: %s\n' "$key" "${!key}"
208
+ done
209
+ done <<< "$found"
210
+ [ "$count" -gt 0 ] || say "No hand-offs recorded for $card in '$name'."
211
+ }
@@ -17,6 +17,18 @@ project_dir() {
17
17
  (cd -P "$PROJECTS/$name" && pwd)
18
18
  }
19
19
 
20
+ # Mark a project's folder as trusted by Claude Code (see trust.sh), when
21
+ # entourage made it: a folder of its own in $PROJECTS. A project name that is
22
+ # a link leads to a folder someone else made, perhaps a repo, and entourage
23
+ # does not answer for that. Claude Code asks about it itself, once.
24
+ trust_project() {
25
+ local name=$1
26
+ [ ! -L "$PROJECTS/$name" ] || return 0
27
+ # The real path, which is what Claude Code looks up: $PROJECTS may run
28
+ # through a link.
29
+ trust_folder "$(project_dir "$name")"
30
+ }
31
+
20
32
  # Print a project's repo paths, absolute, one per line.
21
33
  project_repos() {
22
34
  local dir=$1 line
@@ -59,40 +71,70 @@ sync_links() {
59
71
  done
60
72
  }
61
73
 
74
+ # Print the real folder of the repo a path names, or stop if it is not one.
75
+ repo_at() {
76
+ local path=$1 abs
77
+ [ -d "$path" ] || die "$path is not a folder"
78
+ abs=$(cd "$path" && pwd -P)
79
+ is_repo "$abs" || die "$abs is not a git repo (the top folder of a clone is needed)"
80
+ printf '%s\n' "$abs"
81
+ }
82
+
83
+ # Add a line for a repo to a project's repos file, with ~/ for the home folder.
84
+ store_repo() {
85
+ local dir=$1 abs=$2
86
+ case $abs in
87
+ "$HOME"/*) abs="~/${abs#"$HOME"/}" ;;
88
+ esac
89
+ printf '%s\n' "$abs" >> "$dir/repos"
90
+ }
91
+
92
+ # With repo paths after the name, the project starts with those repos. The
93
+ # projects mod makes a project this way, in one command.
62
94
  project_new() {
63
- local name=${1:-} dir
95
+ local name=${1:-} dir path abs other
96
+ local -a repos=()
64
97
  valid_name "$name" || die "a project name is lowercase letters, digits and dashes, like: my-project"
65
98
  dir=$PROJECTS/$name
66
99
  [ ! -e "$dir" ] || die "project '$name' already exists at $dir"
67
100
  [ -f "$TEMPLATE/PROJECT.md" ] || die "the project template is missing from $TEMPLATE"
101
+ shift
102
+ # Every repo is checked before anything is made, so that a bad one does not
103
+ # leave a project behind with only some of them.
104
+ for path in "$@"; do
105
+ abs=$(repo_at "$path")
106
+ for other in ${repos[@]+"${repos[@]}"}; do
107
+ [ "$other" != "$abs" ] || die "$abs is listed twice"
108
+ [ "${other##*/}" != "${abs##*/}" ] ||
109
+ die "$other and $abs are both called ${abs##*/}; two repos in a project cannot share a folder name"
110
+ done
111
+ repos+=("$abs")
112
+ done
68
113
  mkdir -p "$dir"
69
114
  sed "s/__NAME__/$name/" "$TEMPLATE/PROJECT.md" > "$dir/PROJECT.md"
70
115
  : > "$dir/repos"
116
+ for abs in ${repos[@]+"${repos[@]}"}; do store_repo "$dir" "$abs"; done
71
117
  sync_links "$dir"
118
+ trust_project "$name"
72
119
  say "Made project '$name' at $dir"
120
+ for abs in ${repos[@]+"${repos[@]}"}; do say " added ${abs##*/}"; done
73
121
  say "Next:"
74
- say " entourage project add $name <path to a repo>"
122
+ [ "${#repos[@]}" -gt 0 ] || say " entourage project add $name <path to a repo>"
75
123
  say " fill in $dir/PROJECT.md"
76
124
  say " entourage project open $name"
77
125
  }
78
126
 
79
127
  project_add() {
80
- local name=${1:-} path=${2:-} dir abs other stored
128
+ local name=${1:-} path=${2:-} dir abs other
81
129
  dir=$(project_dir "$name")
82
130
  [ -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)"
131
+ abs=$(repo_at "$path")
86
132
  while IFS= read -r other; do
87
133
  [ "$other" != "$abs" ] || die "$abs is already in project '$name'"
88
134
  [ "${other##*/}" != "${abs##*/}" ] ||
89
135
  die "project '$name' already has a repo called ${abs##*/} ($other); two repos in a project cannot share a folder name"
90
136
  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"
137
+ store_repo "$dir" "$abs"
96
138
  sync_links "$dir"
97
139
  say "Added ${abs##*/} to project '$name'"
98
140
  say "Describe what it owns in $dir/PROJECT.md"
package/cli/lib/task.sh CHANGED
@@ -1,10 +1,12 @@
1
1
  # Tasks: a card an agent writes up, then a worktree of each repo on one
2
2
  # branch. Sourced by cli/entourage.
3
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:
4
+ # A task is one piece of work in a project, usually a Linear card. A person
5
+ # runs two commands, in this order:
6
6
  # task new an agent writes the card up, in a tab in the project's space
7
7
  # task start a worktree of each repo on the card's branch, in a tab of its own
8
+ # The agent runs `task handoff` as each step ends, and `task log` shows what
9
+ # it recorded. Both are in handoff.sh.
8
10
 
9
11
  # A card ID is a team key and a number, like ABC-122.
10
12
  CARD_RE='^[A-Za-z][A-Za-z0-9]*-[0-9]+$'
@@ -40,12 +42,17 @@ task_new() {
40
42
  prompt=$(sed -e "s/{card}/$card/g" -e "s/{project}/$name/g" "$CARD_PROMPT")
41
43
 
42
44
  sync_links "$dir"
45
+ # `project new` does this too. Here it covers a project made before it did,
46
+ # or on a day Claude Code's file could not be written. It comes before the
47
+ # tab, because the agent meets the trust question the moment it starts.
48
+ trust_project "$name"
43
49
  (show_space "$name" "$dir") ||
44
50
  die "could not show the space for '$name', so no agent was started."
45
51
  # No `space` argument: the tab goes in the selected space, which show_space
46
52
  # has just selected or made. argv is the agent and task is its first message.
47
53
  herdr_app do tab.new "{\"name\":\"$card\",\"folder\":\"$(json_str "$dir")\",\"argv\":[\"$(json_str "$AGENT")\"],\"task\":\"$(json_str "$prompt")\"}" >/dev/null 2>&1 ||
48
54
  die "could not open a tab for $card. Is Herdr open?"
55
+ record_start "$name" "$card"
49
56
  say "Started $card in the space for '$name'"
50
57
  say "The agent writes the card up, then asks you to approve it."
51
58
  }
@@ -312,6 +319,8 @@ cmd_task() {
312
319
  case ${1:-} in
313
320
  new) shift; task_new "$@" ;;
314
321
  start) shift; task_start "$@" ;;
315
- *) die "usage: entourage task new <project> <card>, or: entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...] (see: entourage help)" ;;
322
+ handoff) shift; task_handoff "$@" ;;
323
+ log) shift; task_log "$@" ;;
324
+ *) die "usage: entourage task new <project> <card>, or: entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...], or: entourage task handoff <project> <card>, or: entourage task log <project> <card> (see: entourage help)" ;;
316
325
  esac
317
326
  }
@@ -0,0 +1,70 @@
1
+ # Folders Claude Code starts in without asking. Sourced by cli/entourage.
2
+
3
+ # Claude Code asks "do you trust this folder?" the first time it starts in one,
4
+ # and keeps the answer in its own file, $CLAUDE_STATE, as
5
+ # .projects["<the folder's real path>"].hasTrustDialogAccepted
6
+ # A folder cannot answer for itself. entourage answers for the folders it made
7
+ # itself (a project's folder), so that an agent `task new` starts there is not
8
+ # left waiting on the question. It never answers for a repo.
9
+ #
10
+ # The file is Claude Code's. It holds much more than this, and every running
11
+ # session rewrites it. So this is the only place that writes it, it changes one
12
+ # value, and what it cannot do cleanly it leaves undone and says so.
13
+
14
+ # The jq test for "this folder is trusted". $d is the folder.
15
+ TRUST_TEST='.projects[$d].hasTrustDialogAccepted == true'
16
+
17
+ # Whether a state file ($2) says a folder ($1) is trusted. The answer is read
18
+ # from what jq prints, never from its exit code: jq 1.6 exits zero for an
19
+ # empty file even with -e. One "true" and nothing else is a yes, so a file
20
+ # holding two values where there should be one is a no as well.
21
+ trust_recorded() { [ "$(jq --arg d "$1" "$TRUST_TEST" "$2" 2>/dev/null)" = true ]; }
22
+
23
+ # "may ask": not every case below can tell whether the folder is trusted.
24
+ trust_note() { say " note Claude Code may ask to trust $1: $2"; }
25
+
26
+ # Record a folder as trusted. The folder is a real path, as project_dir prints
27
+ # it, because that is what Claude Code looks up. Always returns 0: a project or
28
+ # a task is never held up by this, so every command here that can fail is
29
+ # guarded.
30
+ trust_folder() {
31
+ local dir=$1 file=$CLAUDE_STATE lock tmp tries=0 ok=0
32
+ lock=$file.lock
33
+ tmp=$file.entourage.$$
34
+ if [ ! -e "$file" ] && [ ! -L "$file" ]; then trust_note "$dir" "there is no $file yet"; return 0; fi
35
+ if ! command -v jq >/dev/null 2>&1; then trust_note "$dir" "jq is not installed"; return 0; fi
36
+ # Reading is harmless, through a link too, so this comes before anything
37
+ # that refuses to write.
38
+ if trust_recorded "$dir" "$file"; then return 0; fi
39
+ # Replacing a link with a plain file would break whatever keeps the real
40
+ # file somewhere else.
41
+ if [ -L "$file" ]; then trust_note "$dir" "$file is a link, so it was left alone"; return 0; fi
42
+
43
+ # Claude Code's own lock: a folder beside the file, held while it writes. It
44
+ # clears a lock that nobody refreshes, so a run killed in here does no
45
+ # lasting harm. A lock someone else holds is waited for, never removed.
46
+ until mkdir "$lock" 2>/dev/null; do
47
+ tries=$((tries + 1))
48
+ if [ "$tries" -ge 10 ]; then trust_note "$dir" "$file is in use, so it was left alone"; return 0; fi
49
+ sleep 0.1 || true
50
+ done
51
+ # The new file is made for its owner's eyes only, as Claude Code makes it.
52
+ # It is checked before it replaces the old one: jq prints nothing for an
53
+ # empty file and still exits zero.
54
+ if (umask 077 && jq --arg d "$dir" \
55
+ 'if type == "object" then .projects[$d].hasTrustDialogAccepted = true else error("not an object") end' \
56
+ "$file" > "$tmp") 2>/dev/null &&
57
+ trust_recorded "$dir" "$tmp" &&
58
+ mv -f "$tmp" "$file" 2>/dev/null; then
59
+ ok=1
60
+ fi
61
+ rm -f "$tmp" 2>/dev/null || true
62
+ rmdir "$lock" 2>/dev/null || true
63
+
64
+ if [ "$ok" = 1 ]; then
65
+ say " trusted $dir (Claude Code will not ask to trust it)"
66
+ else
67
+ trust_note "$dir" "$file could not be updated, so it was left alone"
68
+ fi
69
+ return 0
70
+ }
package/herdr/README.md CHANGED
@@ -9,7 +9,7 @@ layouts (whole-window arrangements of mods).
9
9
  |---|---|
10
10
  | `mods/cpu/` | Live CPU usage with a scrolling history. macOS only (reads `/usr/bin/top`). |
11
11
  | `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
12
- | `mods/projects/` | Every project in your config, open or not. Click one to show its space. |
12
+ | `mods/projects/` | Every project in your config, open or not. Click one to show its space; `+` makes a new one. |
13
13
  | `layouts/default.json` | Herdr's own layout, plus the layout dropdown. |
14
14
  | `layouts/test.json` | `default` with the projects list in place of spaces, plus the CPU mod in the sidebar. |
15
15
  | `projects/template/` | The starting `PROJECT.md` for every new project. |
@@ -99,7 +99,14 @@ template is in this repo. Your own projects are in
99
99
 
100
100
  - **Make one:** `entourage project new <name>`, then
101
101
  `entourage project add <name> <path>` for each repo. The repo must already
102
- be cloned on this machine.
102
+ be cloned on this machine. Paths after the name add those repos as the
103
+ project is made: `entourage project new <name> <path>...`. Every one is
104
+ checked first, and a path that is not a repo stops it with nothing made.
105
+ - **Make one in Herdr:** click the `+` above the projects list (on the `test`
106
+ layout) and choose a repo's folder. A dialog suggests a name from the
107
+ folder, lists the repo, and can add more. Create makes the project with
108
+ `entourage project new` and shows its space; whatever the command refuses
109
+ (a name in use, a folder that is not a repo) is shown in the dialog.
103
110
  - **Open it:** `entourage project open <name>` rebuilds the links and shows
104
111
  the project's space, making it if it is not open. The space's folder is the
105
112
  project folder.
@@ -115,8 +122,9 @@ template is in this repo. Your own projects are in
115
122
 
116
123
  ## Tasks
117
124
 
118
- A task is one piece of work in a project, usually a Linear card. It has two
119
- commands, used in this order.
125
+ A task is one piece of work in a project, usually a Linear card. You run two
126
+ commands, in this order: `task new`, then `task start`. Two more, `task
127
+ handoff` and `task log`, record and show how each step of the write-up ended.
120
128
 
121
129
  ### Writing the card up
122
130
 
@@ -128,6 +136,14 @@ entourage task new <project> <card>
128
136
  - **It opens a tab named after the card** in the project's space, in the
129
137
  project folder, and starts an agent in it. The agent is `claude`;
130
138
  `ENTOURAGE_AGENT` picks another command.
139
+ - **The project folder is trusted first.** Claude Code asks "do you trust this
140
+ folder?" the first time it starts somewhere, which would leave the agent
141
+ waiting. So `project new`, and `task new` before it opens the tab, mark the
142
+ project's folder as trusted in Claude Code's own file (`~/.claude.json`).
143
+ Only a project folder entourage made is marked: never a repo, and not a
144
+ project folder you linked in from somewhere else. Where it cannot be done
145
+ (no `jq`, or Claude Code has never run on the machine), entourage says so
146
+ and Claude Code asks once.
131
147
  - **The agent's first message** is [prompts/task-new.md](../prompts/task-new.md)
132
148
  with the card and project filled in. It tells the agent to start with
133
149
  `sdlc-define` and follow each skill's handoff block to the next
@@ -140,6 +156,42 @@ entourage task new <project> <card>
140
156
  `~/.claude/skills` stops it before anything is opened. Run
141
157
  `entourage update` to link the skills.
142
158
 
159
+ ### Hand-offs
160
+
161
+ Each step of a write-up ends by handing off: which step it was, how it ended
162
+ (`done`, `needs-human` or `failed`) and what comes next. The agent records
163
+ that itself, with the block on stdin:
164
+
165
+ ```sh
166
+ entourage task handoff <project> <card> <<'EOF'
167
+ phase: define
168
+ status: done
169
+ next: plan
170
+ summary: Set the type to fix. The Specification has six Done when items.
171
+ EOF
172
+ ```
173
+
174
+ ```sh
175
+ entourage task log <project> <card>
176
+ ```
177
+
178
+ - **The command holds the rules.** It refuses a block with a missing line, an
179
+ unknown status or step, a line that doesn't belong to that status, or a
180
+ value that runs onto a second line, and says what to fix. Run it with no
181
+ block to see the rules.
182
+ - **It is a command because wording wasn't enough.** An agent going from one
183
+ skill straight into the next writes nothing in between, but it does run
184
+ commands.
185
+ - **`task new` records the start,** so the time each step took can be read
186
+ from the hand-offs alone.
187
+ - **They are kept in `~/.config/entourage/entourage.db`,** a SQLite file
188
+ beside your projects, on this machine only. It needs `sqlite3`, which macOS
189
+ ships; `ENTOURAGE_SQLITE` picks another command. Without it `task new`
190
+ still starts the agent, the hand-offs are not recorded, and
191
+ `entourage status` says so.
192
+ - **The card stays in Linear.** The store records how a step ended, not what
193
+ was written.
194
+
143
195
  ### Starting the work
144
196
 
145
197
  One branch, checked out as a git worktree of the repos the task needs, and
@@ -2,9 +2,17 @@
2
2
  // project while its space has a tab, so the list comes from the entourage
3
3
  // command, which owns where projects live and what counts as one. Click a
4
4
  // project to show its space; one with no space is opened by the command.
5
+ //
6
+ // One mod, two faces: the list a layout places, and the New project dialog
7
+ // (the same mod again, with props { create: true }). The + above the list
8
+ // asks for a repo's folder with the system's picker, then opens the dialog on
9
+ // it. The dialog makes the project with the command too.
5
10
  import { View, div } from "gpui-kit";
6
- import { v_flex, h_flex } from "gpui-base";
7
- import { exec, spaces, run, notify, theme, layout, window, checking, appHome } from "herdr";
11
+ import { v_flex, h_flex, InputState, Input } from "gpui-base";
12
+ import {
13
+ exec, spaces, run, notify, theme, layout, window, checking, appHome, home, props,
14
+ pickFolder, openOverlay, closeOverlay, nextCommand,
15
+ } from "herdr";
8
16
 
9
17
  const REFRESH_MS = 15000; // projects change rarely; the open marks are live anyway
10
18
  const TIMEOUT_MS = 10000;
@@ -12,7 +20,7 @@ const ROW = 30;
12
20
  const RAIL_CELL = 32;
13
21
  // How this mod's own link into the repo that ships it ends.
14
22
  const LINKED_AT = "/herdr/mods/projects";
15
- const EMPTY = "No projects yet. Make one with: entourage project new <name>";
23
+ const EMPTY = "No projects yet. Make one with the + above.";
16
24
  const OLD_CLI = "This entourage cannot list projects as JSON. Run: entourage update";
17
25
 
18
26
  function find(node, id) {
@@ -41,6 +49,14 @@ function parse(text) {
41
49
  // What a failed command said, without the name it starts its errors with.
42
50
  const said = (r) => (r.stderr || r.stdout).trim().replace(/^entourage: /, "");
43
51
 
52
+ // A picked folder without the slash a picker may end it with.
53
+ const tidy = (path) => (path.length > 1 ? path.replace(/\/+$/, "") : path);
54
+ const base = (path) => path.split("/").pop();
55
+ const tilde = (path) => (path.startsWith(`${home()}/`) ? `~${path.slice(home().length)}` : path);
56
+ // A name to start the dialog with, from the first repo's folder. Only a
57
+ // suggestion: the command decides what a project may be called.
58
+ const suggest = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
59
+
44
60
  export default class Projects extends View {
45
61
  init(_props, cx) {
46
62
  this.projects = null; // null until the first listing answers
@@ -48,11 +64,43 @@ export default class Projects extends View {
48
64
  this.busy = false;
49
65
  this.opening = null; // the project a click is making a space for
50
66
  this.cmd = "entourage"; // the one on PATH, until that cannot start
67
+ this.picking = false; // the system's folder picker is up
68
+ if (props()?.create) return this.initForm(cx);
51
69
  if (checking()) return;
52
70
  cx.timer.every(REFRESH_MS, (cx) => this.refresh(cx));
71
+ // The dialog says when it has made a project, so its row need not wait
72
+ // for the timer.
73
+ cx.spawn(async (cx) => {
74
+ for (;;) {
75
+ if ((await nextCommand()) === "refresh") this.refresh(cx);
76
+ cx.notify();
77
+ }
78
+ });
53
79
  this.refresh(cx);
54
80
  }
55
81
 
82
+ // The dialog. props: { create: true, folder: the first repo, cmd: the
83
+ // entourage command the list found, overlay }.
84
+ initForm(cx) {
85
+ const p = props() ?? {};
86
+ if (p.cmd) this.cmd = p.cmd;
87
+ this.repos = p.folder ? [tidy(p.folder)] : [];
88
+ this.name = suggest(base(this.repos[0] ?? ""));
89
+ this.error = "";
90
+ this.working = false;
91
+ this.input = InputState.new({ value: this.name, placeholder: "my-project" });
92
+ if (this.name) this.input.set_selected_range({ start: 0, end: this.name.length });
93
+ this.input.on("change", (_e, cx) => { this.name = this.input.value(); this.error = ""; cx.notify(); });
94
+ this.input.on("submit", (_e, cx) => this.submit(cx));
95
+ this.inputFocused = true;
96
+ this.input.on("focus", (_e, cx) => { this.inputFocused = true; cx.notify(); });
97
+ this.input.on("blur", (_e, cx) => { this.inputFocused = false; cx.notify(); });
98
+ this.handle = cx.focus_handle();
99
+ // Twice, as Herdr's own prompt does: the first lands before the dialog shows.
100
+ this.input.focus();
101
+ cx.timer.after(600, () => this.input.focus());
102
+ }
103
+
56
104
  // Runs the entourage command. With `fallback`, a command that cannot run is
57
105
  // tried again as the copy this mod is linked from (Herdr may have been
58
106
  // started without the user's PATH). Only the listing asks for that: it is
@@ -115,6 +163,28 @@ export default class Projects extends View {
115
163
  });
116
164
  }
117
165
 
166
+ // The + above the list: choose the first repo, then name the project.
167
+ create(cx) {
168
+ if (this.picking) return;
169
+ this.picking = true;
170
+ cx.spawn(async (cx) => {
171
+ let folder = null;
172
+ try {
173
+ folder = await pickFolder({ prompt: "Choose" });
174
+ } catch (e) {
175
+ notify({ title: "Could not open the folder picker", body: String(e?.message ?? e), level: "error" });
176
+ }
177
+ this.picking = false;
178
+ if (folder) {
179
+ openOverlay({
180
+ mod: "projects", kind: "dialog", modal: true, width: 480,
181
+ props: { create: true, folder, cmd: this.cmd },
182
+ });
183
+ }
184
+ cx.notify();
185
+ });
186
+ }
187
+
118
188
  row(p, space, t) {
119
189
  const on = Boolean(space?.active);
120
190
  const n = (p.repos ?? []).length;
@@ -143,6 +213,10 @@ export default class Projects extends View {
143
213
  }
144
214
 
145
215
  render() {
216
+ return props()?.create ? this.form() : this.list();
217
+ }
218
+
219
+ list() {
146
220
  const t = theme();
147
221
  const collapsed = narrow();
148
222
  // A project is open when a space on this computer has its folder.
@@ -159,9 +233,125 @@ export default class Projects extends View {
159
233
  items.push(collapsed ? this.compact(p, space, t) : this.row(p, space, t));
160
234
  }
161
235
  return v_flex().size_full().min_h(0).bg(t.chrome).text_size(13)
162
- .child(h_flex().h(31).flex_none().pl(16).pr(10).items_center().text_size(11.5).text_color(t.dim)
163
- .when(!collapsed, (el) => el.child("Projects")))
236
+ .child(h_flex().h(31).flex_none().pl(16).pr(10).items_center().justify_between()
237
+ .text_size(11.5).text_color(t.dim)
238
+ .when(collapsed, (el) => el.pl(0).pr(0).justify_center())
239
+ .when(!collapsed, (el) => el.child("Projects"))
240
+ .child(div().id("project-new").size(26).flex_none().flex().items_center().justify_center()
241
+ .rounded(6).text_size(15).tooltip("New project")
242
+ .hover((s) => s.bg(t.hover).text_color(t.foreground))
243
+ .on_click((_e, cx) => this.create(cx))
244
+ .child("+")))
164
245
  .child(v_flex().id("project-list").flex_1().min_h(0).px(collapsed ? 0 : 8).pb(14)
165
246
  .overflow_y_scrollbar().mode("always").children(items));
166
247
  }
248
+
249
+ // --- the New project dialog ----------------------------------------------
250
+
251
+ close() {
252
+ closeOverlay(props().overlay);
253
+ }
254
+
255
+ // Another repo for the project, from the system's picker.
256
+ addRepo(cx) {
257
+ if (this.picking || this.working) return;
258
+ this.picking = true;
259
+ cx.spawn(async (cx) => {
260
+ try {
261
+ const folder = await pickFolder({ prompt: "Add" });
262
+ if (folder && !this.repos.includes(tidy(folder))) this.repos.push(tidy(folder));
263
+ this.error = "";
264
+ } catch (e) {
265
+ this.error = `Could not open the folder picker: ${e?.message ?? e}`;
266
+ }
267
+ this.picking = false;
268
+ this.input.focus();
269
+ cx.notify();
270
+ });
271
+ }
272
+
273
+ // Makes the project and shows its space. The command checks the name and
274
+ // every repo before it makes anything, so what it refuses is shown here and
275
+ // the dialog stays open to be put right.
276
+ submit(cx) {
277
+ if (this.working) return;
278
+ const name = this.name.trim();
279
+ this.working = true;
280
+ this.error = "";
281
+ cx.notify();
282
+ cx.spawn(async (cx) => {
283
+ let failed = null;
284
+ try {
285
+ const r = await this.entourage(["project", "new", name, ...this.repos]);
286
+ if (r.code !== 0) failed = said(r) || "entourage project new failed";
287
+ } catch (e) {
288
+ failed = `Could not run entourage: ${e?.message ?? e}`;
289
+ }
290
+ if (failed !== null) {
291
+ this.working = false;
292
+ this.error = failed;
293
+ cx.notify();
294
+ return;
295
+ }
296
+ // Tell the list. With no list showing there is nobody to tell, and that
297
+ // must not stop the space from opening.
298
+ try { run("projects.refresh"); } catch {}
299
+ // The project is made, so a space that will not open is not this
300
+ // dialog's to keep asking about: say so and leave it in the list.
301
+ let unopened = null;
302
+ try {
303
+ const r = await this.entourage(["project", "open", name]);
304
+ if (r.code !== 0) unopened = said(r);
305
+ } catch (e) {
306
+ unopened = String(e?.message ?? e);
307
+ }
308
+ if (unopened !== null) notify({ title: `Made ${name}, but could not open it`, body: unopened, level: "error" });
309
+ this.close();
310
+ });
311
+ }
312
+
313
+ form() {
314
+ const t = theme();
315
+ const label = (text) => div().pt(16).pb(7).text_size(11.5).text_color(t.dim).child(text);
316
+ const button = (id, text, primary, action) =>
317
+ h_flex().id(id).h(32).px(14).items_center().rounded(8)
318
+ .border_1().border_color(primary ? t.solid : t.input).bg(primary ? t.solid : t.raised)
319
+ .text_color(primary ? t.solid_foreground : t.foreground).text_size(12.5).font_medium()
320
+ .cursor_pointer().hover((s) => s.opacity(0.88)).on_click(action).child(text);
321
+ const repo = (path, i) =>
322
+ h_flex().h(ROW).flex_none().pl(10).pr(4).gap(10).items_center().rounded(8).bg(t.raised)
323
+ .child(div().flex_none().max_w(180).truncate().child(base(path)))
324
+ .child(div().flex_1().min_w(0).truncate().text_size(11.5).text_color(t.dim).child(tilde(path)))
325
+ .child(div().id(`project-new-drop-${i}`).size(22).flex_none().flex().items_center().justify_center()
326
+ .rounded(6).text_color(t.dim).tooltip("Leave this repo out")
327
+ .hover((s) => s.bg(t.hover).text_color(t.foreground))
328
+ .on_click((_e, cx) => { this.repos.splice(i, 1); this.error = ""; cx.notify(); })
329
+ .child("×"));
330
+ return v_flex().id("project-new-form").track_focus(this.handle)
331
+ .on_key_down((e, cx) => { if (e.key === "escape") { this.close(); cx.stop_propagation(); } })
332
+ .w_full().min_h(0).p(18).bg(t.popover).text_color(t.foreground).text_size(13)
333
+ .child(h_flex().items_center()
334
+ .child(div().flex_1().text_size(15).font_semibold().child("New project"))
335
+ .child(div().text_size(11).text_color(t.dim).child("Esc")))
336
+ .child(div().pt(6).text_size(12.8).text_color(t.muted)
337
+ .child("A project groups the repos that belong together and opens as one space."))
338
+ .child(label("Name"))
339
+ .child(Input.new(this.input).h(36).px(10).rounded(9).border_1()
340
+ .border_color(this.inputFocused ? t.accent : t.input).bg(t.background)
341
+ .text_size(12.8).text_color(t.foreground))
342
+ .child(label("Repos"))
343
+ .child(v_flex().id("project-new-repos").max_h(200).min_h(0).flex_shrink(1).gap(4)
344
+ .overflow_y_scroll().children(this.repos.map(repo)))
345
+ .child(h_flex().id("project-new-add").h(ROW).flex_none().mt(this.repos.length ? 4 : 0).px(10)
346
+ .items_center().rounded(8).text_color(t.muted).cursor_pointer()
347
+ .hover((s) => s.bg(t.hover).text_color(t.foreground))
348
+ .on_click((_e, cx) => this.addRepo(cx))
349
+ .child(this.repos.length ? "+ Add another repo…" : "+ Add a repo…"))
350
+ .when(Boolean(this.error), (el) =>
351
+ el.child(div().pt(12).text_size(12).text_color(t.blocked).child(this.error)))
352
+ .child(h_flex().pt(20).gap(8).justify_end()
353
+ .child(button("project-new-cancel", "Cancel", false, () => this.close()))
354
+ .child(button("project-new-create", this.working ? "Creating…" : "Create", true,
355
+ (_e, cx) => this.submit(cx))));
356
+ }
167
357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/entourage",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
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"
@@ -1,6 +1,6 @@
1
1
  Write up Linear card {card} so that it is ready to build. This session is in the entourage project `{project}`.
2
2
 
3
- Start with the sdlc-define skill. Each skill ends by writing a handoff block. Write each one before you start the next skill, even though you carry straight on: the blocks are how I see how each step ended. You are driving this run, so act on the block's `status`:
3
+ Start with the sdlc-define skill. Each skill ends by recording a hand-off with `entourage task handoff {project} {card}`, as the skill describes. Record each one before you start the next skill, even though you carry straight on: the hand-offs are how I see how each step ended. You are driving this run, so act on the `status` you recorded:
4
4
 
5
5
  - `done`: go straight on to the step in `next`, without waiting for me. `plan` is the sdlc-plan skill and `breakdown` is the sdlc-breakdown skill.
6
6
  - `needs-human`: wait for my answer, then carry on with the same skill.
@@ -98,13 +98,15 @@ Give them a summary they can answer from without opening Linear:
98
98
  - The approach, in a sentence or two.
99
99
  - Whether it is one piece or several, and why. If several, the slice names in order.
100
100
 
101
- Then ask them to approve or say what to change. The summary goes above the handoff block, and the block is the ask:
101
+ Then ask them to approve or say what to change. Record the ask as a hand-off with this block, then end your message with the summary and, below it, the block the command printed:
102
102
 
103
103
  ```
104
+ entourage task handoff <project> <card ID> <<'EOF'
104
105
  phase: breakdown
105
106
  status: needs-human
106
107
  question: Approve <card ID> as specified, planned and broken down?
107
108
  options: approve | change breakdown | change plan | change specification
109
+ EOF
108
110
  ```
109
111
 
110
112
  Wait for their answer.
@@ -138,11 +140,19 @@ Read the parent and each sub-issue back, then hand off.
138
140
 
139
141
  ## Hand off
140
142
 
141
- Breakdown is finished when the human has approved the card and, if it was sliced, its sub-issues exist. Then write the handoff block:
143
+ Breakdown is finished when the human has approved the card and, if it was sliced, its sub-issues exist. Then record the hand-off:
142
144
 
143
- - `phase: breakdown`, `status: done` and `next: setup`.
144
- - `summary`: that the card is approved, and whether it is one piece or sliced. If it was sliced, the sub-issues in order with their IDs, and which one is first.
145
- - `flags`: anything that didn't go to plan, such as a blocking relation that couldn't be set.
145
+ ```
146
+ entourage task handoff <project> <card ID> <<'EOF'
147
+ phase: breakdown
148
+ status: done
149
+ next: setup
150
+ summary: <that the card is approved, and whether it is one piece or sliced; if sliced, the sub-issues in order with their IDs, and which one is first>
151
+ flags: <anything that didn't go to plan, such as a blocking relation that couldn't be set>
152
+ EOF
153
+ ```
154
+
155
+ Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag.
146
156
 
147
157
  Setup is not a skill. It is the `entourage task start` command, which the human runs, so there is no step for you to go on to.
148
158
 
@@ -150,9 +160,10 @@ Setup is not a skill. It is the `entourage task start` command, which the human
150
160
 
151
161
  Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
152
162
 
153
- Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
163
+ Record a hand-off every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Record it even when you go straight on to another step, because the record is what shows this one ended. Run `entourage task handoff` with the block on stdin, one value per line:
154
164
 
155
165
  ```
166
+ entourage task handoff <project> <card ID> <<'EOF'
156
167
  phase: <this step>
157
168
  status: <done, needs-human or failed>
158
169
  next: <the step that follows>
@@ -161,9 +172,10 @@ flags: <what the human should know but wasn't asked>
161
172
  question: <one question>
162
173
  options: <the answers you expect, your recommendation first, separated by " | ">
163
174
  reason: <what went wrong, and what you already tried>
175
+ EOF
164
176
  ```
165
177
 
166
- Which lines you write depends on the status:
178
+ `<project>` is the entourage project this session is in. The words in angle brackets are hints: put your own in their place. The command checks the block, records it and prints it back. Which lines you write depends on the status:
167
179
 
168
180
  | Status | Use it when | Lines |
169
181
  |---|---|---|
@@ -171,11 +183,12 @@ Which lines you write depends on the status:
171
183
  | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
172
184
  | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
173
185
 
186
+ - **If the command refuses the block, fix what it names and run it again.** If it can't record at all, because the command is missing, you are not in an entourage project, or it says the hand-off was not recorded, write the block in your message instead and carry on. Don't make a project or install anything to get it to run.
187
+ - **When you stop for the human, end your message with the block the command printed.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
174
188
  - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
175
189
  - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
176
190
  - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
177
- - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
178
- - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
191
+ - **After `done`, this step is over.** Record the hand-off before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
179
192
  - **After `failed`, change nothing more.** Leave the card as it is for the human.
180
193
 
181
194
  ## If something goes wrong
@@ -102,19 +102,28 @@ After writing, read the card back. Check that the original description is unchan
102
102
 
103
103
  ## 5. Hand off
104
104
 
105
- When the Specification is on the card and you have read it back, write the handoff block. Define is not finished until it is written:
105
+ When the Specification is on the card and you have read it back, record the hand-off. Define is not finished until it is recorded:
106
106
 
107
- - `phase: define`, `status: done` and `next: plan`.
108
- - `summary`: the type you set, whether you replaced a label that was already there, and how many Done when items there are.
109
- - `flags`: anything you weren't sure about, and whether the card looks like more than one thing.
107
+ ```
108
+ entourage task handoff <project> <card ID> <<'EOF'
109
+ phase: define
110
+ status: done
111
+ next: plan
112
+ summary: <the type you set, whether you replaced a label that was already there, and how many Done when items there are>
113
+ flags: <anything you weren't sure about, and whether the card looks like more than one thing>
114
+ EOF
115
+ ```
116
+
117
+ Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag.
110
118
 
111
119
  ## The handoff block
112
120
 
113
121
  Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
114
122
 
115
- Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
123
+ Record a hand-off every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Record it even when you go straight on to another step, because the record is what shows this one ended. Run `entourage task handoff` with the block on stdin, one value per line:
116
124
 
117
125
  ```
126
+ entourage task handoff <project> <card ID> <<'EOF'
118
127
  phase: <this step>
119
128
  status: <done, needs-human or failed>
120
129
  next: <the step that follows>
@@ -123,9 +132,10 @@ flags: <what the human should know but wasn't asked>
123
132
  question: <one question>
124
133
  options: <the answers you expect, your recommendation first, separated by " | ">
125
134
  reason: <what went wrong, and what you already tried>
135
+ EOF
126
136
  ```
127
137
 
128
- Which lines you write depends on the status:
138
+ `<project>` is the entourage project this session is in. The words in angle brackets are hints: put your own in their place. The command checks the block, records it and prints it back. Which lines you write depends on the status:
129
139
 
130
140
  | Status | Use it when | Lines |
131
141
  |---|---|---|
@@ -133,11 +143,12 @@ Which lines you write depends on the status:
133
143
  | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
134
144
  | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
135
145
 
146
+ - **If the command refuses the block, fix what it names and run it again.** If it can't record at all, because the command is missing, you are not in an entourage project, or it says the hand-off was not recorded, write the block in your message instead and carry on. Don't make a project or install anything to get it to run.
147
+ - **When you stop for the human, end your message with the block the command printed.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
136
148
  - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
137
149
  - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
138
150
  - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
139
- - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
140
- - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
151
+ - **After `done`, this step is over.** Record the hand-off before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
141
152
  - **After `failed`, change nothing more.** Leave the card as it is for the human.
142
153
 
143
154
  ## If something goes wrong
@@ -98,19 +98,28 @@ After writing, read the card back. Check that the description and Specification
98
98
 
99
99
  ## 5. Hand off
100
100
 
101
- When the Plan is on the card and you have read it back, write the handoff block. Plan is not finished until it is written:
101
+ When the Plan is on the card and you have read it back, record the hand-off. Plan is not finished until it is recorded:
102
102
 
103
- - `phase: plan`, `status: done` and `next: breakdown`.
104
- - `summary`: the approach in one sentence, roughly how much it touches (how many files, in which apps or repos), and whether it looks like one pull request's worth or more. Breakdown decides, but your read is useful.
105
- - `flags`: anything you found that sits outside the Specification.
103
+ ```
104
+ entourage task handoff <project> <card ID> <<'EOF'
105
+ phase: plan
106
+ status: done
107
+ next: breakdown
108
+ summary: <the approach in one sentence, roughly how many files it touches and in which apps or repos, and whether it looks like one pull request's worth or more>
109
+ flags: <anything you found that sits outside the Specification>
110
+ EOF
111
+ ```
112
+
113
+ Put your own words in place of each hint in angle brackets, and leave the `flags` line out when there is nothing to flag. Breakdown decides whether it is one pull request or more, but your read is useful.
106
114
 
107
115
  ## The handoff block
108
116
 
109
117
  Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
110
118
 
111
- Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
119
+ Record a hand-off every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Record it even when you go straight on to another step, because the record is what shows this one ended. Run `entourage task handoff` with the block on stdin, one value per line:
112
120
 
113
121
  ```
122
+ entourage task handoff <project> <card ID> <<'EOF'
114
123
  phase: <this step>
115
124
  status: <done, needs-human or failed>
116
125
  next: <the step that follows>
@@ -119,9 +128,10 @@ flags: <what the human should know but wasn't asked>
119
128
  question: <one question>
120
129
  options: <the answers you expect, your recommendation first, separated by " | ">
121
130
  reason: <what went wrong, and what you already tried>
131
+ EOF
122
132
  ```
123
133
 
124
- Which lines you write depends on the status:
134
+ `<project>` is the entourage project this session is in. The words in angle brackets are hints: put your own in their place. The command checks the block, records it and prints it back. Which lines you write depends on the status:
125
135
 
126
136
  | Status | Use it when | Lines |
127
137
  |---|---|---|
@@ -129,11 +139,12 @@ Which lines you write depends on the status:
129
139
  | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
130
140
  | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
131
141
 
142
+ - **If the command refuses the block, fix what it names and run it again.** If it can't record at all, because the command is missing, you are not in an entourage project, or it says the hand-off was not recorded, write the block in your message instead and carry on. Don't make a project or install anything to get it to run.
143
+ - **When you stop for the human, end your message with the block the command printed.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
132
144
  - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
133
145
  - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
134
146
  - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
135
- - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
136
- - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
147
+ - **After `done`, this step is over.** Record the hand-off before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
137
148
  - **After `failed`, change nothing more.** Leave the card as it is for the human.
138
149
 
139
150
  ## If something goes wrong