@johngaynor/entourage 0.4.1-next.22 → 0.4.1-next.26

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
@@ -22,6 +22,7 @@ the step that comes next. The agent records each block with
22
22
  `entourage task handoff`, and your answer when you reply to a question.
23
23
  `entourage task log` shows them for a card, with how long each step took, and
24
24
  the Steps panel in Herdr shows the same for the card whose tab is selected.
25
+ With no card, both list the project's cards and where each stands.
25
26
 
26
27
  ## Setting up a machine
27
28
 
@@ -96,6 +97,13 @@ waited for your answer:
96
97
  entourage task log my-project ABC-122
97
98
  ```
98
99
 
100
+ Leave the card out to see every card in the project that has hand-offs,
101
+ newest first, with where each stands, such as waiting on you:
102
+
103
+ ```sh
104
+ entourage task log my-project
105
+ ```
106
+
99
107
  `task start` starts the work. It makes a branch and a git worktree of it in
100
108
  every repo of the project, and opens a tab for it:
101
109
 
package/cli/entourage CHANGED
@@ -24,8 +24,9 @@ Usage:
24
24
  entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...]
25
25
  start the work: a worktree per repo, opened as a tab
26
26
  entourage task handoff <project> <card> record how a step ended: a handoff block on stdin
27
- entourage task log <project> <card> [--json]
28
- list a card's hand-offs and how long each step took
27
+ entourage task log <project> [<card>] [--json]
28
+ list a card's hand-offs and how long each step took,
29
+ or with no card the cards that have hand-offs and where each stands
29
30
  entourage linear key save your Linear API key, so entourage can read Linear
30
31
  entourage help
31
32
 
@@ -59,8 +60,10 @@ Join several groups with a comma: `app:athlete,coach`.
59
60
  when the human answers a question. It reads a handoff block on stdin (phase,
60
61
  status, next and so on, one per line), refuses one that breaks the rules, and
61
62
  records it. `task log` lists what was recorded for a card, with how long each
62
- step took and how long it waited on the human. With --json it prints the
63
- same view as one line, for programs: the Steps panel in Herdr draws it. Run
63
+ step took and how long it waited on the human. With no card it lists the
64
+ project's cards that have hand-offs, newest first, each with where it stands
65
+ and for how long. With --json it prints the same view as one line, for
66
+ programs: the Steps panel in Herdr draws it. Run
64
67
  `entourage task handoff <project> <card>` with no block to see the rules.
65
68
 
66
69
  Herdr's folder is ~/.config/herdr-app (HERDR_APP_HOME picks another).
@@ -194,8 +194,10 @@ task_handoff() {
194
194
  # --- the log ----------------------------------------------------------------
195
195
 
196
196
  # One query works out a card's view: each hand-off with its label, how long it
197
- # took and whether it is a wait. The plain log and the JSON both read it, so
198
- # they cannot disagree, and a Herdr mod that draws the JSON formats nothing.
197
+ # took, whether it is a wait, and where the card stood after it. The plain log
198
+ # and the JSON both read it, so they cannot disagree, and a Herdr mod that
199
+ # draws the JSON formats nothing. With no card it works out the view of every
200
+ # card in the project at once, and the list of cards is each one's latest row.
199
201
  #
200
202
  # Nothing about time is stored beyond each row's own. A step's time is from
201
203
  # the row before it to its own row. The time from a needs-human row to its
@@ -203,25 +205,29 @@ task_handoff() {
203
205
  # row with nothing after it is still waiting, measured to now. A `new` row
204
206
  # starts a run, so it has no time, however long ago the run before it ended.
205
207
 
206
- # SQL for a number of seconds as text: 50s, 1m 44s, 1h 02m.
208
+ # SQL for a number of seconds as text: 50s, 1m 44s, 1h 02m, 3d 04h. @ stands
209
+ # for the column that holds the seconds.
207
210
  sql_took() {
208
- local s=$1
209
- printf "case when %s < 60 then %s || 's'
210
- when %s < 3600 then (%s / 60) || 'm ' || printf('%%02d', %s %% 60) || 's'
211
- else (%s / 3600) || 'h ' || printf('%%02d', %s %% 3600 / 60) || 'm' end" \
212
- "$s" "$s" "$s" "$s" "$s" "$s" "$s"
211
+ local t="case when @ < 60 then @ || 's'
212
+ when @ < 3600 then (@ / 60) || 'm ' || printf('%02d', @ % 60) || 's'
213
+ when @ < 86400 then (@ / 3600) || 'h ' || printf('%02d', @ % 3600 / 60) || 'm'
214
+ else (@ / 86400) || 'd ' || printf('%02d', @ % 86400 / 3600) || 'h' end"
215
+ printf '%s' "${t//@/$1}"
213
216
  }
214
217
 
215
- # SQL that starts a query on one card's view, as the table `shown`.
216
- # log_view <project> <card> <answer column, or null in a store without one>
218
+ # SQL that starts a query on one card's view, or on every card's in the
219
+ # project, as the table `shown`. Each card's rows are worked out on their own.
220
+ # log_view <project> <card, or empty for all> <answer column, or null in a store without one>
217
221
  log_view() {
222
+ local cards=''
223
+ [ -z "$2" ] || cards="and card = $(sql_str "$2")"
218
224
  printf "with base as (
219
- select id, at, phase, status, next, summary, flags, question, options,
225
+ select id, at, card, phase, status, next, summary, flags, question, options,
220
226
  %s as answer, reason,
221
227
  lag(at) over w as prev_at, lag(status) over w as before, lead(id) over w as after,
222
228
  sum(case when phase = 'new' then 1 else 0 end) over w as run
223
- from handoffs where project = %s and card = %s
224
- window w as (order by id)),
229
+ from handoffs where project = %s %s
230
+ window w as (partition by card order by id)),
225
231
  timed as (
226
232
  select *,
227
233
  case when phase = 'new' or prev_at is null then null
@@ -229,7 +235,7 @@ log_view() {
229
235
  case when after is null and status = 'needs-human'
230
236
  then max(cast(strftime('%%s', 'now') - strftime('%%s', at) as integer), 0) end as open_seconds
231
237
  from base),
232
- shown as (
238
+ labeled as (
233
239
  select *,
234
240
  case when phase = 'new' then 'start'
235
241
  when status = 'answered' and before = 'needs-human' then 'wait'
@@ -248,16 +254,64 @@ log_view() {
248
254
  else (%s) end as took,
249
255
  case when open_seconds is null then ''
250
256
  else 'waiting on the human for ' || (%s) end as waiting
251
- from timed)" \
252
- "$3" "$(sql_str "$1")" "$(sql_str "$2")" \
257
+ from timed),
258
+ shown as (
259
+ select *,
260
+ case when status = 'needs-human' then 'waiting on the human'
261
+ when phase = 'new' then 'started'
262
+ else label || substr(what, length(status) + 1) end as state
263
+ from labeled)" \
264
+ "$3" "$(sql_str "$1")" "$cards" \
253
265
  "$(sql_took seconds)" "$(sql_took seconds)" "$(sql_took seconds)" "$(sql_took seconds)" \
254
266
  "$(sql_took open_seconds)"
255
267
  }
256
268
 
257
- LOG_USAGE='usage: entourage task log <project> <card> [--json]'
269
+ LOG_USAGE='usage: entourage task log <project> [<card>] [--json]'
270
+
271
+ # The project's cards that have hand-offs, newest first by their latest row:
272
+ # where each stands and how long it has stood there. With --json, the same as
273
+ # one line of JSON.
274
+ # log_cards <project> <json: 1 or 0> <view>
275
+ log_cards() {
276
+ local name=$1 json=$2 list
277
+ # Each card's latest row is the one with nothing after it.
278
+ list="$3, latest as (
279
+ select *, max(cast(strftime('%s', 'now') - strftime('%s', at) as integer), 0) as since
280
+ from shown where after is null)"
281
+ if [ "$json" = 1 ]; then
282
+ if [ ! -e "$STORE" ]; then
283
+ printf '{"project":"%s","cards":[]}\n' "$(json_str "$name")"
284
+ return
285
+ fi
286
+ store "$STORE" "$list
287
+ select json_object('project', $(sql_str "$name"),
288
+ 'cards', (select json_group_array(json(c)) from (
289
+ select json_object('card', card, 'at', at, 'state', state,
290
+ 'waiting', nullif(waiting, ''), 'for', $(sql_took since), 'seconds', since,
291
+ 'run', run, 'phase', phase, 'status', status, 'next', next) as c
292
+ from latest order by at desc, id desc)));" ||
293
+ die "could not read the hand-offs in $STORE. It may not be entourage's store."
294
+ return
295
+ fi
296
+
297
+ local sep=$'\x1f' found='' count=0 card state for
298
+ if [ -e "$STORE" ]; then
299
+ found=$(store -separator "$sep" "$STORE" "$list
300
+ select card, state, $(sql_took since) from latest order by at desc, id desc;") ||
301
+ die "could not read the hand-offs in $STORE. It may not be entourage's store."
302
+ fi
303
+ while IFS=$sep read -r card state for; do
304
+ [ -n "$card" ] || continue
305
+ [ "$count" -gt 0 ] || say "Cards in '$name' with hand-offs, newest first"
306
+ count=$((count + 1))
307
+ printf '%-10s %-28s for %s\n' "$card" "$state" "$for"
308
+ done <<< "$found"
309
+ [ "$count" -gt 0 ] || say "No hand-offs recorded in '$name'."
310
+ }
258
311
 
259
312
  # List a card's hand-offs, oldest first, with how long each step took. With
260
- # --json, the same view as one line of JSON.
313
+ # no card, list the project's cards instead. With --json, the same view as
314
+ # one line of JSON.
261
315
  task_log() {
262
316
  local json=0 a
263
317
  local args=()
@@ -272,17 +326,21 @@ task_log() {
272
326
  local name=${1:-} card=${2:-}
273
327
  [ -n "$name" ] || die "$LOG_USAGE"
274
328
  project_named "$name" || die "there is no entourage project called '$name'. See: entourage project ls"
275
- card=$(handoff_card "$name" "$card" log) || exit 1
276
329
  [ "$#" -le 2 ] || die "$LOG_USAGE"
330
+ [ -z "$card" ] || card=$(handoff_card "$name" "$card" log) || exit 1
277
331
  have_sqlite || die "$SQLITE is not installed, so no hand-offs have been recorded on this machine."
278
332
 
279
333
  # Reading never changes the store. An older one has no answer column, so it
280
334
  # is read without one.
281
- local answer_column=null view found=''
335
+ local answer_column=null view='' found=''
282
336
  if [ -e "$STORE" ]; then
283
337
  ! has_answer_column || answer_column=answer
284
338
  view=$(log_view "$name" "$card" "$answer_column")
285
339
  fi
340
+ if [ -z "$card" ]; then
341
+ log_cards "$name" "$json" "$view"
342
+ return
343
+ fi
286
344
 
287
345
  if [ "$json" = 1 ]; then
288
346
  if [ ! -e "$STORE" ]; then
@@ -294,9 +352,7 @@ task_log() {
294
352
  # cannot be read is an error, not an empty history.
295
353
  store "$STORE" "$view
296
354
  select json_object('project', $(sql_str "$name"), 'card', $(sql_str "$card"),
297
- 'state', (select case when status = 'needs-human' then 'waiting on the human'
298
- when phase = 'new' then 'started' else label || substr(what, length(status) + 1) end
299
- from shown order by id desc limit 1),
355
+ 'state', (select state from shown order by id desc limit 1),
300
356
  'waiting', (select nullif(waiting, '') from shown order by id desc limit 1),
301
357
  'run', (select max(run) from shown),
302
358
  'steps', (select json_group_array(json(step)) from (
package/cli/lib/task.sh CHANGED
@@ -355,6 +355,6 @@ cmd_task() {
355
355
  start) shift; task_start "$@" ;;
356
356
  handoff) shift; task_handoff "$@" ;;
357
357
  log) shift; task_log "$@" ;;
358
- *) die "usage: entourage task ls <project> [--json], or: 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> [--json] (see: entourage help)" ;;
358
+ *) die "usage: entourage task ls <project> [--json], or: 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>] [--json] (see: entourage help)" ;;
359
359
  esac
360
360
  }
package/herdr/README.md CHANGED
@@ -10,7 +10,7 @@ layouts (whole-window arrangements of mods).
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
12
  | `mods/projects/` | Every project in your config, open or not. Click one to show its space; `+` makes a new one. |
13
- | `mods/steps/` | The steps of the card whose tab is selected: what each did, how long it took, and how long it waited on you. |
13
+ | `mods/steps/` | The steps of the card whose tab is selected: what each did, how long it took, and how long it waited on you. With no card's tab selected, the project's cards and where each stands. |
14
14
  | `layouts/default.json` | Herdr's own layout, plus the layout dropdown. |
15
15
  | `layouts/test.json` | `default` with the projects list in place of spaces, plus the Steps panel and the CPU mod in the sidebar. |
16
16
  | `projects/template/` | The starting `PROJECT.md` for every new project. |
@@ -227,7 +227,7 @@ EOF
227
227
  ```
228
228
 
229
229
  ```sh
230
- entourage task log <project> <card>
230
+ entourage task log <project> [<card>]
231
231
  ```
232
232
 
233
233
  - **The command holds the rules.** It refuses a block with a missing line, an
@@ -245,6 +245,11 @@ entourage task log <project> <card>
245
245
  waited on you as a line of its own, counted in no step. A question with no
246
246
  answer yet shows how long it has been waiting. A step that followed a
247
247
  question with no recorded answer is marked as including the wait.
248
+ - **With no card, it lists the project's cards.** `task log <project>` shows
249
+ every card in the project that has hand-offs, newest first by its latest
250
+ one, with where it stands (waiting on you, failed, or the step it finished
251
+ and the one that comes next) and for how long. A card with no hand-offs is
252
+ not listed: `task ls` lists the cards in Linear.
248
253
  - **They are kept in `~/.config/entourage/entourage.db`,** a SQLite file
249
254
  beside your projects, on this machine only. It needs `sqlite3`, which macOS
250
255
  ships; `ENTOURAGE_SQLITE` picks another command. Without it `task new`
@@ -256,8 +261,11 @@ entourage task log <project> <card>
256
261
  new` opened, and the panel lists that card's steps: the time of day, what
257
262
  the step did, how long it took, and its summary. A wait on you stands out,
258
263
  and so does a question still waiting. It shows the latest run of a card
259
- written up more than once. The panel draws what
260
- `entourage task log <project> <card> --json` prints and works nothing out
264
+ written up more than once. With no card's tab selected, it lists the
265
+ project's cards instead, and a card waiting on you stands out. Click a card
266
+ to see its steps, even when its tab is closed, and "All cards" to go back;
267
+ selecting another tab goes back too. The panel draws what
268
+ `entourage task log <project> [<card>] --json` prints and works nothing out
261
269
  itself, so the two always agree.
262
270
 
263
271
  ### Starting the work
@@ -1,8 +1,11 @@
1
1
  // The steps of the card whose tab is selected: what each step of its write-up
2
- // did, how long it took, and how long it waited on the human.
2
+ // did, how long it took, and how long it waited on the human. With no card's
3
+ // tab selected, the project's cards that have hand-offs, newest first, with
4
+ // where each stands. A click on a card shows its steps, even when its tab is
5
+ // closed.
3
6
  //
4
- // All of that is worked out by `entourage task log <project> <card> --json`.
5
- // This mod draws the view that command returns and holds no rules about
7
+ // All of that is worked out by `entourage task log <project> [<card>] --json`.
8
+ // This mod draws the views that command returns and holds no rules about
6
9
  // hand-offs: every label and every length of time arrives as text.
7
10
  //
8
11
  // A step is one line. A click on it opens what the step said.
@@ -11,7 +14,7 @@ import { v_flex, h_flex } from "gpui-base";
11
14
  import { exec, spaces, theme, layout, window, checking, appHome } from "herdr";
12
15
 
13
16
  const LOOK_MS = 2000; // how often to see whether another card is selected
14
- const REREAD_MS = 6000; // how often to read the selected card's steps again
17
+ const REREAD_MS = 6000; // how often to read what is shown again
15
18
  const PROJECTS_MS = 60000; // projects change rarely
16
19
  const TIMEOUT_MS = 10000;
17
20
  // How this mod's own link into the repo that ships it ends.
@@ -21,7 +24,15 @@ const CARD = /^[A-Za-z][A-Za-z0-9]*-[0-9]+$/;
21
24
 
22
25
  // `herdr-app check` draws the mod once, with no card selected, which would
23
26
  // show one line of text and none of the rows. It is given these to draw, all
24
- // of them open, so a mistake in a row fails the check.
27
+ // of them open, so a mistake in a row fails the check: a list of cards and a
28
+ // card's steps, with the way back from one to the other.
29
+ const SAMPLE_CARDS = {
30
+ project: "demo",
31
+ cards: [
32
+ { card: "ABC-3", state: "waiting on the human", waiting: "waiting on the human for 2m 05s", for: "2m 05s" },
33
+ { card: "ABC-1", state: "plan done, then breakdown", waiting: null, for: "3d 04h" },
34
+ ],
35
+ };
25
36
  const SAMPLE = {
26
37
  run: 1,
27
38
  state: "waiting on the human",
@@ -58,20 +69,21 @@ function parse(text) {
58
69
  // What a failed command said, without the name it starts its errors with.
59
70
  const said = (r) => (r.stderr || r.stdout).trim().replace(/^entourage: /, "");
60
71
 
61
- const OLD_CLI = "This entourage cannot give a card's steps as JSON. Run: entourage update";
62
- // An entourage from before --json answers with its usage line, not JSON.
72
+ const OLD_CLI = "This entourage is too old for the Steps panel. Run: entourage update";
73
+ // An entourage from before --json answers with its usage line, not JSON, and
74
+ // one from before the list of cards asks which card.
63
75
  const failure = (r, what) => {
64
76
  const text = said(r);
65
- return text.startsWith("usage:") ? OLD_CLI : text || `${what} failed`;
77
+ return text.startsWith("usage:") || text.startsWith("which card?") ? OLD_CLI : text || `${what} failed`;
66
78
  };
67
79
 
68
- // What is selected on this computer: the shown space's folder, and the card
69
- // its shown tab is for, if it is a card's tab.
80
+ // What is selected on this computer: the shown space's folder, the card its
81
+ // shown tab is for, if it is a card's tab, and which tab that is.
70
82
  function selected() {
71
83
  const space = spaces().find((s) => s.active && !s.machine) ?? null;
72
84
  const tab = space?.tabs.find((t) => t.active) ?? null;
73
85
  const card = tab && CARD.test(tab.name) ? tab.name.toUpperCase() : null;
74
- return { folder: space?.folder ?? null, card, key: `${space?.folder ?? ""}\n${card ?? ""}` };
86
+ return { folder: space?.folder ?? null, card, tab: `${space?.id ?? ""}\n${tab?.id ?? ""}` };
75
87
  }
76
88
 
77
89
  export default class Steps extends View {
@@ -81,7 +93,8 @@ export default class Steps extends View {
81
93
  this.projectsAt = 0;
82
94
  this.key = null; // what the view on hand was read for
83
95
  this.project = null; // the entourage project of the shown space, or null
84
- this.view = null;
96
+ this.picked = null; // a card chosen from the list, and the tab it was chosen in
97
+ this.view = null; // a card's steps, or the list of cards
85
98
  this.error = null;
86
99
  this.busy = false;
87
100
  this.readAt = 0;
@@ -108,13 +121,32 @@ export default class Steps extends View {
108
121
  }
109
122
  }
110
123
 
111
- // Read again when another card is selected, or the one on hand is stale.
112
- // Nothing is read while nobody can see the panel, and a tab that is not a
113
- // card's has nothing to read again.
124
+ // What the panel shows: the card of the selected tab; else the card chosen
125
+ // from the list; else the list. A card chosen from the list is let go as
126
+ // soon as another tab is seen selected, so coming back to that tab shows
127
+ // the list. The panel is drawn again whenever a tab is selected.
128
+ shown() {
129
+ const now = selected();
130
+ if (this.picked && (now.card || this.picked.tab !== now.tab)) this.picked = null;
131
+ const card = now.card ?? this.picked?.card ?? null;
132
+ return { folder: now.folder, card, picked: Boolean(this.picked), key: `${now.folder ?? ""}\n${card ?? ""}` };
133
+ }
134
+
135
+ // Show a card chosen from the list, or the list again with null.
136
+ pick(card, cx) {
137
+ this.picked = card ? { card, tab: selected().tab } : null;
138
+ this.open = null;
139
+ cx.notify();
140
+ this.look(cx);
141
+ }
142
+
143
+ // Read again when something else is to be shown, or what is on hand is
144
+ // stale. Nothing is read while nobody can see the panel, and a space that
145
+ // is not an entourage project has nothing to read again.
114
146
  look(cx) {
115
147
  if (this.busy || window()?.visible === false || narrow()) return;
116
- const now = selected();
117
- const stale = Boolean(now.card) && Date.now() - this.readAt >= REREAD_MS;
148
+ const now = this.shown();
149
+ const stale = Boolean(this.project) && Date.now() - this.readAt >= REREAD_MS;
118
150
  if (now.key === this.key && !stale) return;
119
151
  this.busy = true;
120
152
  cx.spawn(async (cx) => {
@@ -133,10 +165,11 @@ export default class Steps extends View {
133
165
  }
134
166
  }
135
167
  project = (this.projects ?? []).find((p) => p.folder === now.folder)?.name ?? null;
136
- if (!error && project && now.card) {
137
- const r = await this.entourage(["task", "log", project, now.card, "--json"]);
168
+ if (!error && project) {
169
+ const card = now.card ? [now.card] : [];
170
+ const r = await this.entourage(["task", "log", project, ...card, "--json"]);
138
171
  const got = r.code === 0 ? parse(r.stdout) : null;
139
- if (got && Array.isArray(got.steps)) view = got;
172
+ if (got && Array.isArray(now.card ? got.steps : got.cards)) view = got;
140
173
  else error = r.code === 0 ? OLD_CLI : failure(r, "entourage task log");
141
174
  }
142
175
  } catch (e) {
@@ -149,15 +182,43 @@ export default class Steps extends View {
149
182
  this.readAt = Date.now();
150
183
  this.busy = false;
151
184
  // A redraw of a mod redraws the whole window, so only when what it
152
- // shows has changed.
153
- const drawn = JSON.stringify([now.key, project, view, error]);
185
+ // shows has changed. A card's seconds change at every read, and only
186
+ // the time drawn from them counts.
187
+ const cards = view?.cards?.map(({ seconds, ...c }) => c);
188
+ const drawn = JSON.stringify([now.key, project, cards ? { ...view, cards } : view, error]);
154
189
  if (drawn !== this.drawn) {
155
190
  this.drawn = drawn;
156
191
  cx.notify();
157
192
  }
193
+ // A card chosen while this was being read is read now, not at the
194
+ // next look.
195
+ if (this.shown().key !== now.key) this.look(cx);
158
196
  });
159
197
  }
160
198
 
199
+ // One card of the list: its ID and how long it has stood where it is,
200
+ // then where that is. A card waiting on the human stands out. A click shows
201
+ // its steps.
202
+ card(c, i, t) {
203
+ const color = c.waiting ? t.blocked : t.dim;
204
+ return v_flex().id(`card-${i}`).flex_none().px(8).py(4).gap(1).rounded(8)
205
+ .hover((el) => el.bg(t.hover))
206
+ .on_click((_e, cx) => this.pick(c.card, cx))
207
+ .child(h_flex().gap(8).items_center()
208
+ .child(div().flex_1().min_w(0).truncate().text_color(t.foreground).child(c.card ?? ""))
209
+ .child(div().flex_none().text_size(11.5).text_color(color).child(c.for ?? "")))
210
+ .child(div().text_size(11.5).text_color(c.waiting ? t.blocked : t.muted).whitespace_normal()
211
+ .child(c.state ?? ""));
212
+ }
213
+
214
+ // The way from a card chosen from the list back to the list.
215
+ back(t) {
216
+ return div().id("back").flex_none().px(8).py(4).rounded(8).text_size(11.5).text_color(t.dim)
217
+ .hover((el) => el.bg(t.hover))
218
+ .on_click((_e, cx) => this.pick(null, cx))
219
+ .child("‹ All cards");
220
+ }
221
+
161
222
  // One hand-off, on one line: its clock, its label and the time alone. A
162
223
  // click opens the rest of what the view says about it. `s` is a step of the
163
224
  // view, and its kind says whether it is a wait.
@@ -189,32 +250,42 @@ export default class Steps extends View {
189
250
 
190
251
  render() {
191
252
  const t = theme();
253
+ const now = this.shown();
192
254
  if (narrow()) return v_flex().size_full().bg(t.chrome);
193
255
  const sample = checking();
194
- const now = selected();
256
+ const read = now.key === this.key;
195
257
  const view = sample ? SAMPLE : this.view;
258
+ const list = sample ? SAMPLE_CARDS : this.view;
196
259
  const note = (text, color) =>
197
260
  div().px(8).py(6).text_size(12).text_color(color).whitespace_normal().child(text);
198
261
  const items = [];
199
262
  // The latest run only: a card written up twice keeps both in its log.
200
263
  const steps = (view?.steps ?? []).filter((s) => s.run === view.run);
264
+ const cards = list?.cards ?? [];
201
265
  const rows = () => {
202
266
  // Where the card stands, as the view words it.
203
267
  if (view.state) items.push(note(view.state, view.waiting ? t.blocked : t.dim));
204
268
  steps.forEach((s, i) => items.push(this.row(s, i, t, sample || this.open === s.at)));
205
269
  };
206
- if (sample) rows();
207
- else if (!now.card) items.push(note("Select a card's tab to see its steps.", t.dim));
208
- else if (now.key !== this.key) items.push(note("Loading…", t.dim));
270
+ // A card chosen from the list always has the way back, even while it
271
+ // loads or when it could not be read.
272
+ if (sample || now.picked) items.push(this.back(t));
273
+ if (sample) {
274
+ cards.forEach((c, i) => items.push(this.card(c, i, t)));
275
+ rows();
276
+ } else if (!read) items.push(note("Loading…", t.dim));
209
277
  else if (this.error) items.push(note(this.error, t.blocked));
210
278
  else if (!this.project) items.push(note("This space is not an entourage project.", t.dim));
211
- else if (steps.length === 0) items.push(note(`No hand-offs recorded for ${now.card} yet.`, t.dim));
212
- else rows();
279
+ else if (now.card) {
280
+ if (steps.length === 0) items.push(note(`No hand-offs recorded for ${now.card} yet.`, t.dim));
281
+ else rows();
282
+ } else if (cards.length === 0) items.push(note("No hand-offs recorded in this project yet.", t.dim));
283
+ else cards.forEach((c, i) => items.push(this.card(c, i, t)));
213
284
  return v_flex().size_full().min_h(0).bg(t.chrome).text_size(13)
214
285
  .child(h_flex().h(31).flex_none().pl(16).pr(14).items_center().justify_between()
215
286
  .text_size(11.5).text_color(t.dim)
216
287
  .child("Steps")
217
- .child(div().child(now.card ?? "")))
288
+ .child(div().child(now.card ?? (read ? this.project : null) ?? "")))
218
289
  .child(v_flex().id("step-list").flex_1().min_h(0).px(8).pb(14)
219
290
  .overflow_y_scrollbar().mode("always").children(items));
220
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/entourage",
3
- "version": "0.4.1-next.22",
3
+ "version": "0.4.1-next.26",
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"