@warren-dean/code-kit 0.26.1 → 0.27.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.
@@ -93,6 +93,18 @@ export function leadDecides(name, config, actor) {
93
93
  return (rules.protected ?? []).includes(name);
94
94
  }
95
95
 
96
+ /**
97
+ * WHO-1: whether the lead needs an approval in force to change a file protected by `name` itself. Where
98
+ * the person merges, they review the lead's change in the pull request, so it needs none. Where merges
99
+ * are delegated to the lead nobody else sees it, so what the person keeps (not delegated to the lead)
100
+ * needs the person's approval, as it would from a lane. The kit is the lead's to change either way: the
101
+ * person approved the setup, and code-kit writes most of it.
102
+ */
103
+ export const leadNeedsApproval = (name, config) =>
104
+ name !== 'kit' &&
105
+ Boolean(config?.approvals?.delegate?.merge) &&
106
+ !leadDecides(name, config, { kind: 'lead' });
107
+
96
108
  /** HELM-2: whose decision approvals `names` are: the lead's when it may grant every one, else the person's. */
97
109
  export const decidedBy = (names, config, actor) =>
98
110
  [names].flat().every((n) => leadDecides(n, config, actor)) ? 'lead' : 'person';
@@ -186,6 +198,25 @@ function noteGiven(root, entries) {
186
198
  }
187
199
  }
188
200
 
201
+ /**
202
+ * Why an approval for `name` given to `actor` lately isn't in force any more: used up by an earlier
203
+ * commit, or out of time. A sentence for a refusal, or '' when none was given lately.
204
+ */
205
+ export function approvalEnded(root, name, actor, now = Date.now()) {
206
+ const lane = actor?.kind === 'lane' ? actor.lane : null;
207
+ const last = approvalsGiven(root)
208
+ .filter((e) => e.name === name && (!e.lane || e.lane === lane))
209
+ .at(-1);
210
+ if (!last?.at) return '';
211
+ const at = (t) => new Date(t).toTimeString().slice(0, 5);
212
+ const given = Date.parse(last.at);
213
+ if (now - given > 24 * 3600_000) return '';
214
+ if (last.usedAt)
215
+ return ` The ${name} approval given at ${at(given)} was used up at ${at(last.usedAt)} by an earlier commit${last.usedBy ? ` (${last.usedBy})` : ''}, so another is needed.`;
216
+ const ends = given + approvalMinutes(name) * 60_000;
217
+ return now >= ends ? ` The ${name} approval given at ${at(given)} ran out at ${at(ends)}.` : '';
218
+ }
219
+
189
220
  /** The approvals given through code-kit (and those used up), oldest first. */
190
221
  export function approvalsGiven(root) {
191
222
  try {
@@ -353,6 +384,7 @@ export function useApproval(root, name, actor) {
353
384
  ...(file !== join(dir, name) ? { lane: actor.lane } : {}),
354
385
  reason: a.reason,
355
386
  usedAt: new Date().toISOString(),
387
+ ...(actor?.label ? { usedBy: actor.label } : {}),
356
388
  },
357
389
  ]);
358
390
  return rmSync(file, { force: true });
@@ -438,6 +470,9 @@ export function recordRequest(root, actor, names, what, why, now = Date.now(), e
438
470
  why: String(why).slice(0, 300),
439
471
  ...extra,
440
472
  };
473
+ // The file's commits already made in the second it's asked, which don't answer it.
474
+ const before = commitsFrom(root, request.what, request.at);
475
+ if (before?.length) request.before = before;
441
476
  if (openRequests(root, now).some((r) => sameRequest(r, request))) return;
442
477
  const file = requestsFile(root);
443
478
  mkdirSync(dirname(file), { recursive: true });
@@ -528,32 +563,38 @@ function installedSince(root, r) {
528
563
  });
529
564
  }
530
565
 
531
- /** Whether the file a request named has been committed, on any branch, since it was asked. */
532
- function committedSince(root, r) {
533
- const path = String(r.what);
534
- if (/\s/.test(path) || (!path.includes('/') && !path.includes('.'))) return false;
566
+ /** The commits of `path`, on any branch, in or after the second `at` falls in; null when it isn't a path. */
567
+ function commitsFrom(root, path, at) {
568
+ if (/\s/.test(path) || (!path.includes('/') && !path.includes('.'))) return null;
535
569
  try {
536
- const out = execFileSync(
570
+ return execFileSync(
537
571
  'git',
538
572
  [
539
- '-C',
540
- root,
541
- 'log',
542
- '--all',
543
- '-1',
544
- '--format=%ct',
545
- `--since=@${Math.floor(Date.parse(r.at) / 1000)}`,
546
- '--',
547
- path,
573
+ ...['-C', root, 'log', '--all', '--format=%H'],
574
+ `--since=@${Math.floor(Date.parse(at) / 1000)}`,
575
+ ...['--', path],
548
576
  ],
549
577
  { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] },
550
- );
551
- return Boolean(out.trim());
578
+ )
579
+ .split('\n')
580
+ .filter(Boolean);
552
581
  } catch {
553
- return false;
582
+ return [];
554
583
  }
555
584
  }
556
585
 
586
+ /**
587
+ * Whether the file a request named has been committed, on any branch, since it was asked. Git dates are
588
+ * whole seconds, so the commits already there in the second it was asked (the one before the refused
589
+ * commit) are the request's `before`, and don't answer it.
590
+ */
591
+ function committedSince(root, r) {
592
+ const commits = commitsFrom(root, String(r.what), r.at);
593
+ if (!commits) return false;
594
+ const before = new Set(r.before ?? []);
595
+ return commits.some((c) => !before.has(c));
596
+ }
597
+
557
598
  /**
558
599
  * CARD-6: every approval given, newest first: { at, name, lane, reason, by, files, branches, used,
559
600
  * expired }. From the approvals given through code-kit, the approvals on disk (a person's own `!` echo
@@ -766,9 +807,11 @@ export function writeProblem(actor, rel, root, config) {
766
807
  const guarded = protectedEntry(rel, config);
767
808
  if (actor.kind === 'readonly' && (guarded || !matchesAny(rel, config.anyActor)))
768
809
  return readonlyProblem(actor, rel);
769
- // The lead writes protected files without an approval: the person reviews them in the pull request,
770
- // and every committed change is in the audit log. Anyone else needs a person's approval as well.
771
- if (guarded && actor.kind !== 'lead' && !approval(root, guarded.approval, actor)) {
810
+ // The lead writes protected files without an approval where the person merges: they review them in
811
+ // the pull request, and every committed change is in the audit log. Where the lead merges, what the
812
+ // person keeps needs their approval (WHO-1). Anyone else needs an approval as well.
813
+ const leadFree = actor.kind === 'lead' && !leadNeedsApproval(guarded?.approval, config);
814
+ if (guarded && !leadFree && !approval(root, guarded.approval, actor)) {
772
815
  recordRequest(root, actor, guarded.approval, rel, guarded.why);
773
816
  const who =
774
817
  decidedBy(guarded.approval, config, actor) === 'lead'
@@ -202,12 +202,19 @@ export function teamProvider(root, team) {
202
202
  ? { ...g, fallback: r?.why ?? "The team provider can't be reached." }
203
203
  : g;
204
204
  };
205
+ // A claim taken while the provider was down lives only on GitHub; one the provider doesn't know is
206
+ // released there too, so it can't outlive its story (a merged story's claim, stuck and going stale).
207
+ const eitherRelease = (story, opts) => {
208
+ const r = either('release')(story, opts);
209
+ if (!r?.ok || r.released) return r;
210
+ const g = github.release(story, opts);
211
+ return g?.ok && g.released ? g : r;
212
+ };
205
213
  return {
206
214
  ...Object.fromEntries(
207
215
  [
208
216
  'whoami',
209
217
  'claim',
210
- 'release',
211
218
  'state',
212
219
  'intend',
213
220
  'settle',
@@ -218,6 +225,7 @@ export function teamProvider(root, team) {
218
225
  'standards',
219
226
  ].map((op) => [op, either(op)]),
220
227
  ),
228
+ release: eitherRelease,
221
229
  forget: () => (command.forget(), github.forget()),
222
230
  };
223
231
  }
@@ -790,6 +798,24 @@ function commandProvider(root, team, command) {
790
798
  }
791
799
 
792
800
  /** The team's state as last read, for the hooks and the mod between polls. */
801
+ /**
802
+ * TEAM-1: the claimed stories whose branch has merged into `base`, by the merge commits' subjects
803
+ * ("Merge web/st-12 into main", "Merge pull request #4 from owner/web/st-12"): their claims outlived their merge and end now. A commit that only
804
+ * mentions a story doesn't end its claim.
805
+ */
806
+ export function mergedClaims(root, claims, base) {
807
+ if (!claims?.length) return [];
808
+ const log = spawnSync('git', ['-C', root, 'log', base, '--merges', '--format=%s'], {
809
+ encoding: 'utf8',
810
+ maxBuffer: 64 * 1024 * 1024,
811
+ });
812
+ if (log.status !== 0) return [];
813
+ const merged = new Set(
814
+ [...log.stdout.matchAll(/[\w.-]+\/(st-\d+)(?![\w-])/gi)].map((m) => m[1].toUpperCase()),
815
+ );
816
+ return claims.map((c) => c.story).filter((story) => merged.has(String(story).toUpperCase()));
817
+ }
818
+
793
819
  export function readCache(root) {
794
820
  try {
795
821
  const s = JSON.parse(readFileSync(join(root, TEAM_STATE), 'utf8'));
@@ -2,8 +2,7 @@
2
2
  // records: when its branch was made, its commits, its merge into the base, its send-backs and the
3
3
  // approvals its commits logged. The mod draws these as a bar per lane on a shared time axis.
4
4
  import { execFileSync } from 'node:child_process';
5
- import { readFileSync } from 'node:fs';
6
- import { isAbsolute, join } from 'node:path';
5
+ import { branchMaking } from './plan.mjs';
7
6
  import { APPROVAL_LOG } from './rules.mjs';
8
7
  import { sendBacks } from './reviews.mjs';
9
8
 
@@ -69,28 +68,12 @@ export function storyTimes(root, stories, base) {
69
68
  root,
70
69
  shown.filter((s) => s.branchExists).map((s) => `${refOf(s)}:${APPROVAL_LOG}`),
71
70
  );
72
- const common = git('rev-parse', '--git-common-dir');
73
- const reflogs = common ? (isAbsolute(common) ? common : join(root, common)) : null;
74
- // When a branch was made: its reflog's oldest entry, read from the file git keeps it in (or from git,
75
- // where the file isn't there), in milliseconds; null once the reflog is gone.
76
- const madeAt = (b) => {
77
- let first = null;
78
- try {
79
- first = readFileSync(join(reflogs, 'logs/refs/heads', b), 'utf8').split('\n')[0];
80
- } catch {
81
- const at = lines(git('reflog', 'show', '--date=unix', '--format=%gd', `refs/heads/${b}`))
82
- .at(-1)
83
- ?.match(/@\{(\d+)\}$/)?.[1];
84
- return at ? Number(at) * 1000 : null;
85
- }
86
- const at = first?.split('\t')[0].match(/> (\d+) [+-]\d{4}$/)?.[1];
87
- return at ? Number(at) * 1000 : null;
88
- };
71
+ const making = branchMaking(root);
89
72
  return shown.map((s) => {
90
73
  const b = s.branch;
91
74
  // A branch only on origin has no reflog here.
92
75
  const local = s.branchExists && refOf(s).startsWith('refs/heads/');
93
- const made = local && reflogs ? madeAt(b) : null;
76
+ const made = local ? (making(b)?.at ?? null) : null;
94
77
  // Only a branch ahead of the base has commits of its own.
95
78
  const commits =
96
79
  s.branchExists && s.ahead !== 0
@@ -8,6 +8,7 @@ import { BASELINE_FILE, loadBaseline, newProblems } from './baseline.mjs';
8
8
  import { runChecks } from './checks.mjs';
9
9
  import { CONFIG_FILE } from './config.mjs';
10
10
  import { isDependencyFile } from './dependencies.mjs';
11
+ import { entryProblems, readRegister } from './designs.mjs';
11
12
  import { matchesAny } from './glob.mjs';
12
13
  import { layerProblems } from './layers.mjs';
13
14
  import { STANDARDS_APPROVAL, standardsFile, standardsWeakenings } from './standards.mjs';
@@ -19,6 +20,7 @@ import {
19
20
  ownerOf,
20
21
  owns,
21
22
  protectedEntry,
23
+ leadNeedsApproval,
22
24
  screenProblem,
23
25
  } from './rules.mjs';
24
26
 
@@ -65,11 +67,16 @@ function directChanges(root, from) {
65
67
  return new Set(out.split('\n').filter(Boolean));
66
68
  }
67
69
 
68
- /** Files changed on this branch since it left `base`. */
70
+ /**
71
+ * Files changed on this branch since it left `base`, and still different from `base` as it is now. A
72
+ * branch with two merge bases (it merged the base, and something it holds later reached the base too)
73
+ * can show a file from an older one as changed; one it holds exactly as the base does isn't its change.
74
+ */
69
75
  export function branchChanges(root, base) {
70
- return git(root, 'diff', '--name-only', '--no-renames', `${base}...HEAD`)
71
- .split('\n')
72
- .filter(Boolean);
76
+ const names = (range) =>
77
+ git(root, 'diff', '--name-only', '--no-renames', range).split('\n').filter(Boolean);
78
+ const differs = new Set(names(`${base}..HEAD`));
79
+ return names(`${base}...HEAD`).filter((f) => differs.has(f));
73
80
  }
74
81
 
75
82
  /**
@@ -232,6 +239,18 @@ export function verifyBranch({
232
239
  found.protected.push(
233
240
  `${f} is ${guarded.why}, but no approval-log entry records this change. Protected files are committed through Claude Code with code-kit, which logs them.`,
234
241
  );
242
+ // WHO-1: where the lead merges, its own change to what the person keeps needs the person's approval,
243
+ // unless the base already holds it as the branch does (the setup's rules, put onto the base first).
244
+ else if (
245
+ guarded &&
246
+ logged.get(f)?.approval === 'lead' &&
247
+ !signed &&
248
+ leadNeedsApproval(guarded.approval, config) &&
249
+ showAt(root, base, f) !== showAt(root, 'HEAD', f)
250
+ )
251
+ found.protected.push(
252
+ `${f} is ${guarded.why}, and the lead changed it without the person's ${guarded.approval} approval. The lead merges here, so nobody else reviews it: ask the person, and commit it again once their approval is in force.`,
253
+ );
235
254
  if (matchesAny(f, config.anyActor)) continue;
236
255
  if (lane === 'lead') {
237
256
  // The lead's branch is held to the lead's paths for what it changes itself; lane work reaches it
@@ -274,6 +293,20 @@ export function verifyBranch({
274
293
  if (screen) found.design.push(screen.split('\n')[0]);
275
294
  }
276
295
 
296
+ // HAND-2: each register entry the branch adds or changes, and each approved design whose files it
297
+ // changed, names the approved files with their hashes, every state the spec lists.
298
+ const register = config.designGate?.register;
299
+ if (register) {
300
+ const old = readRegister(root, config, showAt(root, from, register) ?? '{}').entries;
301
+ const touched = new Set(changed);
302
+ for (const e of readRegister(root, config).entries) {
303
+ const fresh = !old.some((o) => JSON.stringify(o) === JSON.stringify(e));
304
+ const files = (e.states ?? []).flatMap((st) => [st?.image, st?.code]).filter(Boolean);
305
+ if (fresh || files.some((f) => touched.has(f)))
306
+ found.design.push(...entryProblems(root, e, config.docs?.specs));
307
+ }
308
+ }
309
+
277
310
  // The baseline only shrinks once the kit is adopted (the adopting change may record it).
278
311
  if (showAt(root, from, CONFIG_FILE) !== null) {
279
312
  let before = {};
@@ -19,7 +19,7 @@ import {
19
19
  } from 'node:fs';
20
20
  import { tmpdir } from 'node:os';
21
21
  import { basename, dirname, join } from 'node:path';
22
- import { pruneLogs } from './events.mjs';
22
+ import { pruneLogs, readEvents } from './events.mjs';
23
23
  import { laneClaims } from './laneclaims.mjs';
24
24
  import { storyOfBranch } from './teamfacts.mjs';
25
25
 
@@ -144,6 +144,23 @@ export function worktrees(root, config, now = Date.now()) {
144
144
  });
145
145
  }
146
146
 
147
+ /** LEAN-6: how recently a lane agent's act counts as it still being at work on a story. */
148
+ export const BUSY_MS = 3 * 60_000;
149
+
150
+ /**
151
+ * LEAN-6: whether a lane agent is still at work on a worktree's story, by the story's event log (spec
152
+ * 26): its lane's last act is still open, or came within BUSY_MS, with no hand-back or stop after it. Releasing
153
+ * a worktree under a running agent takes its git away mid-step.
154
+ */
155
+ export function agentBusy(root, w, now = Date.now()) {
156
+ if (!w.story) return false;
157
+ const last = readEvents(root, w.story)
158
+ .filter((e) => e.actor && e.actor !== 'lead' && e.agent)
159
+ .at(-1);
160
+ if (!last || ['handback', 'stopped'].includes(last.kind)) return false;
161
+ return last.phase === 'start' || now - Date.parse(last.at) < BUSY_MS;
162
+ }
163
+
147
164
  /** Whether a worktree holds nothing uncommitted, read now where worktrees() didn't. */
148
165
  export function cleanOf(w) {
149
166
  if (w.clean !== null) return w.clean;
@@ -3,7 +3,7 @@
3
3
  // built right?), Queue and Log, each with a status line first and no room taken when it has nothing to
4
4
  // say; the full views opened from a story or a command; three layouts. Pure functions from what the
5
5
  // mod already holds to elements, so they're tested with node at every width (UI-13).
6
- import { charactersOf, characterFrame, characterSvg, POSES, workOf } from './characters.mjs';
6
+ import { SIZE, charactersOf, characterFrame, characterSvg, POSES, workOf } from './characters.mjs';
7
7
  import { BAR, rasterCells, runs, timelineSvg } from './art.mjs';
8
8
  import { goalOf } from './mission.mjs';
9
9
  import { CELL, cellOf, laneActions, laneStories, storyToOpen } from './panes.mjs';
@@ -48,6 +48,7 @@ export const STATE = {
48
48
  quiet: { word: 'quiet', color: 'yellow', glyph: '…' },
49
49
  ready: { word: 'ready', color: 'green', glyph: '○' },
50
50
  todo: { word: 'to do', color: undefined, glyph: '○' },
51
+ dropped: { word: 'dropped', color: undefined, glyph: '·' },
51
52
  idle: { word: 'resting', color: undefined, glyph: '·' },
52
53
  dispatched: { word: 'started', color: 'blue', glyph: '→' },
53
54
  };
@@ -195,6 +196,8 @@ export function buildWords(progress) {
195
196
  /** The Build panel's state in a word or two, from the loop and whether anything is at work. */
196
197
  export function buildState(loop, { atWork = 0, leadBusy = false } = {}) {
197
198
  if (loop?.state === 'paused') return 'paused';
199
+ // LOOP-14: nothing moves until Claude's usage limit resets.
200
+ if (loop?.limited) return 'usage limit';
198
201
  if (loop?.state === 'done' || loop?.state === 'stopped') return 'milestone done';
199
202
  if (loop?.state === 'elsewhere') return 'led elsewhere';
200
203
  if (loop?.state === 'unled') return 'no lead';
@@ -208,6 +211,7 @@ export function buildState(loop, { atWork = 0, leadBusy = false } = {}) {
208
211
  /** How urgent each kind of line is (UI-3): a held call first, notes last. */
209
212
  const URGENCY = [
210
213
  'notice',
214
+ 'limited',
211
215
  'held',
212
216
  'question',
213
217
  'waiting',
@@ -227,6 +231,7 @@ const NOTES = new Set(['usage', 'paused', 'finish', 'done', 'teamDown', 'elsewhe
227
231
  /** What a line is, in a word or two, for the Needs you panel. */
228
232
  const NEED_WORD = {
229
233
  notice: 'failed',
234
+ limited: 'usage limit',
230
235
  held: 'held call',
231
236
  question: 'question',
232
237
  waiting: 'the lead waits',
@@ -370,8 +375,8 @@ export function poseFor(lane, { live = null, waiting = false, stalled = false, q
370
375
  export const layoutOf = (placement, columns) =>
371
376
  placement === 'inline' ? 'inline' : columns >= 110 ? 'wide' : 'docked';
372
377
 
373
- /** The rows a lane card takes: a character's six, and its border. */
374
- export const CARD_ROWS = 8;
378
+ /** The rows a lane card takes: its five lines of words (the character's four beside them), and its border. */
379
+ export const CARD_ROWS = 7;
375
380
  /** The columns a lane card takes where cards sit side by side: its character, its words, its frame. */
376
381
  export const CARD_COLUMNS = 44;
377
382
  /** The fewest columns a card is drawn in. */
@@ -473,7 +478,10 @@ export function keysFor(sel, { acts = [], view = null, loop = null, story = fals
473
478
  ...(view === 'trail' ? [{ key: '←→', label: 'requirement' }] : []),
474
479
  { key: 'esc', label: 'back' },
475
480
  ];
476
- const keys = [{ key: 'j/k', label: 'move' }];
481
+ const keys = [
482
+ { key: 'j', label: 'down' },
483
+ { key: 'k', label: 'up' },
484
+ ];
477
485
  if (sel) keys.push({ key: '⏎', label: 'open' });
478
486
  if (sel?.kind === 'lane' && story) {
479
487
  keys.push({ key: 't', label: 'trail' }, { key: 'c', label: 'map' });
@@ -547,14 +555,19 @@ export function board(view, els, on) {
547
555
  const still = (name, pose) => {
548
556
  const grid = characterFrame(pose, 0, looks[name], { motion: 'off' });
549
557
  if (surface === 'terminal' && els.Raster)
550
- return els.Raster({ key: `char-${name}`, columns: 12, rows: 6, cells: rasterCells(grid) });
558
+ return els.Raster({
559
+ key: `char-${name}`,
560
+ columns: SIZE,
561
+ rows: SIZE / 2,
562
+ cells: rasterCells(grid),
563
+ });
551
564
  if (els.Svg)
552
565
  return els.Svg({
553
566
  key: `char-${name}`,
554
567
  source: characterSvg(pose, looks[name], { motion: 'off' }),
555
568
  alt: `${name}: ${POSES[pose]?.words ?? pose}`,
556
- width: 36,
557
- height: 36,
569
+ width: SIZE * 3,
570
+ height: SIZE * 3,
558
571
  });
559
572
  return text(POSES[pose]?.glyph ?? '·');
560
573
  };
@@ -566,16 +579,16 @@ export function board(view, els, on) {
566
579
  key: `char-${name}`,
567
580
  module: './surface/character.mjs',
568
581
  props: { look: looks[name], pose, move, motion },
569
- width: 12,
570
- height: 6,
582
+ width: SIZE,
583
+ height: SIZE / 2,
571
584
  });
572
585
  if (surface === 'desktop' && els.Svg && motion !== 'off' && !faulted)
573
586
  return els.Svg({
574
587
  key: `char-${name}-${move?.key ?? pose}`,
575
588
  source: characterSvg(move ? move.kind : pose, looks[name]),
576
589
  alt: `${name}: ${POSES[move?.kind ?? pose]?.words ?? pose}`,
577
- width: 36,
578
- height: 36,
590
+ width: SIZE * 3,
591
+ height: SIZE * 3,
579
592
  });
580
593
  return still(name, pose);
581
594
  };
@@ -639,7 +652,11 @@ export function board(view, els, on) {
639
652
  'Build',
640
653
  loopWord,
641
654
  progress ? `${progress.tested}/${progress.total}` : null,
642
- loopWord === 'moving' ? 'green' : loopWord === 'paused' ? 'yellow' : undefined,
655
+ loopWord === 'moving'
656
+ ? 'green'
657
+ : ['paused', 'usage limit'].includes(loopWord)
658
+ ? 'yellow'
659
+ : undefined,
643
660
  ),
644
661
  ...(progress
645
662
  ? [
@@ -832,7 +849,7 @@ export function board(view, els, on) {
832
849
  : []),
833
850
  ];
834
851
  };
835
- const cardRoom = Math.max(4, (layout === 'docked' ? columns : CARD_COLUMNS) - 19);
852
+ const cardRoom = Math.max(4, (layout === 'docked' ? columns : CARD_COLUMNS) - (SIZE + 7));
836
853
  const chips = (l, story) =>
837
854
  mapChips(view.maps?.[story?.id], view.trouble?.[l.name]).map((c, i) =>
838
855
  text(c.layer, {
@@ -1036,7 +1053,8 @@ export function board(view, els, on) {
1036
1053
  ...acts.map((a) =>
1037
1054
  Button({
1038
1055
  key: `act-${a.id}`,
1039
- label: `${a.label} ${ACT_KEY[a.id] ?? ''}`.trim(),
1056
+ // Drawn as "w: Watch": the hotkey shows once, before the word.
1057
+ label: a.label,
1040
1058
  ...(ACT_KEY[a.id] ? { hotkey: ACT_KEY[a.id] } : {}),
1041
1059
  plain: true,
1042
1060
  onPress: () => on.onLane(a.id, l),
@@ -1335,54 +1353,31 @@ export function board(view, els, on) {
1335
1353
  loop,
1336
1354
  story: Boolean(selectedLane && storyOf(selectedLane)),
1337
1355
  });
1356
+ // A key the pane answers itself is a Button, drawn as its hotkey and word; the rest are words alike.
1357
+ const bound = {
1358
+ j: ['move-next', () => on.onMove(1)],
1359
+ k: ['move-prev', () => on.onMove(-1)],
1360
+ f: ['filter-focus', () => on.onFocusSearch()],
1361
+ l: ['open-journal', () => on.onView('journal')],
1362
+ };
1338
1363
  const keysLine = Box({
1339
1364
  key: 'keys',
1340
1365
  flexDirection: 'row',
1341
1366
  columnGap: 1,
1342
1367
  flexWrap: 'wrap',
1343
- children: [
1344
- Button({
1345
- key: 'move-next',
1346
- label: 'j',
1347
- hotkey: 'j',
1348
- plain: true,
1349
- dimColor: true,
1350
- onPress: () => on.onMove(1),
1351
- }),
1352
- Button({
1353
- key: 'move-prev',
1354
- label: 'k',
1355
- hotkey: 'k',
1356
- plain: true,
1357
- dimColor: true,
1358
- onPress: () => on.onMove(-1),
1359
- }),
1360
- Button({
1361
- key: 'filter-focus',
1362
- label: 'f',
1363
- hotkey: 'f',
1364
- plain: true,
1365
- dimColor: true,
1366
- onPress: () => on.onFocusSearch(),
1367
- }),
1368
- Button({
1369
- key: 'open-journal',
1370
- label: 'l',
1371
- hotkey: 'l',
1372
- plain: true,
1373
- dimColor: true,
1374
- onPress: () => on.onView('journal'),
1375
- }),
1376
- Box({
1377
- flexShrink: 1,
1378
- children: [
1379
- text(keys.map((k) => `${k.key} ${k.label}`).join(' · '), {
1368
+ children: keys.flatMap((k, i) => [
1369
+ ...(i ? [text('·', { key: `keys-dot-${i}`, dimColor: true })] : []),
1370
+ bound[k.key]
1371
+ ? Button({
1372
+ key: bound[k.key][0],
1373
+ label: k.label,
1374
+ hotkey: k.key,
1375
+ plain: true,
1380
1376
  dimColor: true,
1381
- wrap: 'truncate-end',
1382
- }),
1383
- ],
1384
- }),
1385
- ],
1377
+ onPress: bound[k.key][1],
1378
+ })
1379
+ : text(`${k.key}: ${k.label}`, { key: `keys-${k.key}`, dimColor: true }),
1380
+ ]),
1386
1381
  });
1387
1382
 
1388
1383
  // --- the layouts (UI-10) ---
@@ -1666,8 +1661,8 @@ export function sheetView(lanes, els, { surface = 'terminal', motion = 'while-ac
1666
1661
  key: `sheet-${name}-${pose}`,
1667
1662
  source: characterSvg(pose, looks[name], { motion }),
1668
1663
  alt: `${name}: ${POSES[pose].words}`,
1669
- width: 36,
1670
- height: 36,
1664
+ width: SIZE * 3,
1665
+ height: SIZE * 3,
1671
1666
  });
1672
1667
  return text(POSES[pose].glyph);
1673
1668
  };
@@ -1724,7 +1719,7 @@ export function viewFrame(
1724
1719
  children: [
1725
1720
  ...(head ? [viewHead(title, els, on)] : []),
1726
1721
  ...(Array.isArray(body) ? body : [body]),
1727
- text(keys.map((k) => `${k.key} ${k.label}`).join(' · '), { dimColor: true }),
1722
+ text(keys.map((k) => `${k.key}: ${k.label}`).join(' · '), { dimColor: true }),
1728
1723
  ],
1729
1724
  });
1730
1725
  }