@gavin-hu/my-pi-agent 0.21.0 → 0.22.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.
Files changed (254) hide show
  1. package/README.md +46 -31
  2. package/README.zh-CN.md +40 -26
  3. package/assets/screens/board.png +0 -0
  4. package/assets/screens/chrome.png +0 -0
  5. package/assets/screens/file-browse.png +0 -0
  6. package/assets/screens/plan-review.png +0 -0
  7. package/assets/screens/plan.png +0 -0
  8. package/docs/extensions/README.md +22 -24
  9. package/docs/extensions/board.md +361 -147
  10. package/docs/extensions/bytefly.md +152 -111
  11. package/docs/extensions/check.md +15 -17
  12. package/docs/extensions/context.md +35 -15
  13. package/docs/extensions/file-browse.md +30 -31
  14. package/docs/extensions/file-open.md +9 -11
  15. package/docs/extensions/file-read.md +12 -14
  16. package/docs/extensions/goal.md +15 -17
  17. package/docs/extensions/job.md +54 -42
  18. package/docs/extensions/memory.md +17 -19
  19. package/docs/extensions/plan.md +166 -126
  20. package/docs/extensions/question.md +16 -18
  21. package/docs/extensions/rewind.md +17 -19
  22. package/docs/extensions/serve.md +34 -18
  23. package/docs/extensions/session-bus.md +38 -16
  24. package/docs/extensions/subagent.md +23 -25
  25. package/docs/extensions/team.md +72 -33
  26. package/docs/extensions/todo.md +18 -18
  27. package/docs/extensions/watch.md +31 -31
  28. package/docs/extensions/web-access.md +2 -4
  29. package/docs/extensions/wechat.md +34 -35
  30. package/docs/extensions/worktree.md +56 -50
  31. package/extensions/board/commands.ts +56 -15
  32. package/extensions/board/format.ts +43 -24
  33. package/extensions/board/index.ts +5 -4
  34. package/extensions/board/input.ts +4 -9
  35. package/extensions/board/join.ts +4 -40
  36. package/extensions/board/lazy-page.ts +40 -0
  37. package/extensions/board/page.ts +13 -11
  38. package/extensions/board/result.ts +30 -16
  39. package/extensions/board/rows.ts +62 -25
  40. package/extensions/board/schema.ts +42 -10
  41. package/extensions/board/snapshot.ts +2 -1
  42. package/extensions/board/tone.ts +22 -0
  43. package/extensions/board/tools.ts +131 -44
  44. package/extensions/board/types.ts +36 -32
  45. package/extensions/board/view/card.ts +229 -0
  46. package/extensions/board/view/client.ts +33 -15
  47. package/extensions/board/view/dialog.ts +169 -6
  48. package/extensions/board/view/empty.ts +47 -0
  49. package/extensions/board/view/keys.ts +13 -2
  50. package/extensions/board/view/live.ts +89 -21
  51. package/extensions/board/view/names.ts +13 -4
  52. package/extensions/board/view/page.ts +23 -9
  53. package/extensions/board/view/render.ts +208 -271
  54. package/extensions/board/view/styles.ts +123 -31
  55. package/extensions/board/view/team.ts +297 -76
  56. package/extensions/bytefly/block/fallback.ts +1 -1
  57. package/extensions/bytefly/doctor/runtime.ts +5 -2
  58. package/extensions/bytefly/footer/collect/label.ts +60 -0
  59. package/extensions/bytefly/footer/collect/snapshot.ts +8 -1
  60. package/extensions/bytefly/footer/config.ts +4 -2
  61. package/extensions/bytefly/footer/register.ts +33 -4
  62. package/extensions/bytefly/footer/render/lines.ts +7 -4
  63. package/extensions/bytefly/footer/render/segments.ts +37 -10
  64. package/extensions/bytefly/footer/render/status.ts +0 -11
  65. package/extensions/bytefly/footer/types.ts +7 -0
  66. package/extensions/bytefly/header/config.ts +1 -1
  67. package/extensions/bytefly/index.ts +32 -6
  68. package/extensions/bytefly/mode/editor.ts +115 -0
  69. package/extensions/bytefly/panel/commands.ts +210 -120
  70. package/extensions/bytefly/panel/format.ts +4 -4
  71. package/extensions/bytefly/panel/settings.ts +73 -6
  72. package/extensions/bytefly/panel/tui/keys.ts +2 -6
  73. package/extensions/bytefly/update/cache.ts +1 -1
  74. package/extensions/bytefly/update/register.ts +4 -4
  75. package/extensions/bytefly/working/config.ts +5 -7
  76. package/extensions/bytefly/working/format.ts +10 -13
  77. package/extensions/bytefly/working/register.ts +22 -27
  78. package/extensions/check/commands.ts +3 -2
  79. package/extensions/check/{tui.ts → view/check-screens.ts} +14 -19
  80. package/extensions/context/commands.ts +2 -2
  81. package/extensions/context/{tui.ts → view/context-report.ts} +51 -19
  82. package/extensions/file-browse/index.ts +67 -36
  83. package/extensions/file-read/render.ts +4 -4
  84. package/extensions/goal/plan-route.ts +2 -2
  85. package/extensions/job/child.ts +527 -0
  86. package/extensions/job/clock.ts +142 -0
  87. package/extensions/job/commands.ts +4 -2
  88. package/extensions/job/config.ts +8 -1
  89. package/extensions/job/format.ts +22 -1
  90. package/extensions/job/log-writer.ts +13 -2
  91. package/extensions/job/registry.ts +63 -7
  92. package/extensions/job/render.ts +34 -0
  93. package/extensions/job/runtime.ts +296 -655
  94. package/extensions/job/session.ts +132 -19
  95. package/extensions/job/store.ts +7 -7
  96. package/extensions/job/tools.ts +3 -3
  97. package/extensions/job/types.ts +47 -0
  98. package/extensions/job/{tui.ts → view/jobs-screen.ts} +19 -73
  99. package/extensions/job/waiters.ts +44 -1
  100. package/extensions/memory/commands.ts +4 -2
  101. package/extensions/memory/{tui.ts → view/memory-picker.ts} +12 -12
  102. package/extensions/plan/commands.ts +12 -9
  103. package/extensions/plan/format.ts +8 -2
  104. package/extensions/plan/git-bash.ts +115 -16
  105. package/extensions/plan/index.ts +53 -52
  106. package/extensions/plan/plan-index.ts +4 -2
  107. package/extensions/plan/plans.ts +5 -54
  108. package/extensions/plan/policy.ts +8 -10
  109. package/extensions/plan/review-lazy.ts +85 -0
  110. package/extensions/plan/review.ts +2 -2
  111. package/extensions/plan/runtime.ts +49 -39
  112. package/extensions/plan/sections.ts +1 -1
  113. package/extensions/plan/steps.ts +3 -3
  114. package/extensions/plan/todos.ts +1 -1
  115. package/extensions/plan/tools/cancel.ts +27 -62
  116. package/extensions/plan/tools/enter.ts +55 -81
  117. package/extensions/plan/tools/exit.ts +221 -238
  118. package/extensions/plan/tools/refusal.ts +18 -0
  119. package/extensions/plan/tools/steps.ts +75 -92
  120. package/extensions/plan/tools/write.ts +77 -120
  121. package/extensions/plan/tools.ts +188 -30
  122. package/extensions/plan/tui.ts +5 -5
  123. package/extensions/plan/types.ts +48 -5
  124. package/extensions/plan/web-client.ts +3 -0
  125. package/extensions/plan/web-lazy.ts +53 -0
  126. package/extensions/plan/web-markdown.ts +9 -67
  127. package/extensions/plan/web-payload.ts +3 -3
  128. package/extensions/plan/web-router.ts +18 -9
  129. package/extensions/plan/web.ts +1 -12
  130. package/extensions/question/tools.ts +6 -2
  131. package/extensions/question/{tui.ts → view/question-screen.ts} +11 -11
  132. package/extensions/rewind/commands/commands.ts +6 -3
  133. package/extensions/rewind/state/runtime.ts +1 -1
  134. package/extensions/rewind/{view/status.ts → status.ts} +4 -4
  135. package/extensions/rewind/view/review-tui.ts +4 -4
  136. package/extensions/serve/config.ts +10 -8
  137. package/extensions/serve/index.ts +17 -3
  138. package/extensions/serve/registry.ts +26 -17
  139. package/extensions/session-bus/commands.ts +11 -6
  140. package/extensions/session-bus/join-request.ts +2 -1
  141. package/extensions/session-bus/mail-watch.ts +26 -17
  142. package/extensions/session-bus/protocol.ts +15 -3
  143. package/extensions/session-bus/resolve.ts +5 -7
  144. package/extensions/session-bus/runtime.ts +40 -12
  145. package/extensions/session-bus/store.ts +101 -19
  146. package/extensions/session-bus/types.ts +19 -0
  147. package/extensions/session-bus/{tui.ts → view/session-list.ts} +16 -16
  148. package/extensions/subagent/agents.ts +1 -1
  149. package/extensions/subagent/commands.ts +4 -2
  150. package/extensions/subagent/format.ts +15 -15
  151. package/extensions/subagent/index.ts +1 -1
  152. package/extensions/subagent/render.ts +3 -3
  153. package/extensions/subagent/{background-tui.ts → view/agents-board.ts} +11 -11
  154. package/extensions/team/commands.ts +24 -7
  155. package/extensions/team/dispatch.ts +18 -4
  156. package/extensions/team/format.ts +17 -2
  157. package/extensions/team/index.ts +9 -8
  158. package/extensions/team/schema.ts +6 -5
  159. package/extensions/team/tools.ts +107 -45
  160. package/extensions/team/types.ts +3 -2
  161. package/extensions/todo/commands.ts +4 -2
  162. package/extensions/todo/format.ts +11 -0
  163. package/extensions/todo/render.ts +57 -0
  164. package/extensions/todo/runtime.ts +1 -1
  165. package/extensions/todo/tools.ts +1 -1
  166. package/extensions/todo/view/todo-screen.ts +122 -0
  167. package/extensions/todo/widget.ts +47 -0
  168. package/extensions/watch/commands.ts +4 -2
  169. package/extensions/watch/format.ts +36 -7
  170. package/extensions/watch/render.ts +57 -0
  171. package/extensions/watch/runtime.ts +27 -22
  172. package/extensions/watch/tools.ts +4 -4
  173. package/extensions/watch/{tui.ts → view/watch-screen.ts} +18 -80
  174. package/extensions/web-access/fetch/tool.ts +12 -4
  175. package/extensions/wechat/commands/commands.ts +18 -14
  176. package/extensions/wechat/index.ts +72 -37
  177. package/extensions/wechat/state/credentials.ts +1 -1
  178. package/extensions/wechat/state/state.ts +1 -1
  179. package/extensions/wechat/text/status.ts +112 -0
  180. package/extensions/wechat/types.ts +2 -2
  181. package/extensions/wechat/view/status-screen.ts +4 -103
  182. package/extensions/worktree/commands.ts +11 -9
  183. package/extensions/worktree/enter.ts +2 -2
  184. package/extensions/worktree/exit.ts +2 -2
  185. package/extensions/worktree/index.ts +5 -5
  186. package/extensions/worktree/screen.ts +3 -3
  187. package/extensions/worktree/status.ts +2 -2
  188. package/extensions/worktree/tools.ts +113 -116
  189. package/lib/README.md +27 -13
  190. package/lib/board/actions.ts +111 -0
  191. package/lib/board/artifact.ts +149 -0
  192. package/lib/board/card.ts +163 -52
  193. package/lib/board/config.ts +58 -0
  194. package/lib/board/contract.ts +113 -0
  195. package/lib/board/join.ts +38 -0
  196. package/lib/board/lanes.ts +182 -0
  197. package/lib/board/lead.ts +130 -0
  198. package/lib/board/limits.ts +78 -0
  199. package/lib/board/links.ts +31 -10
  200. package/lib/board/page-pointer.ts +1 -1
  201. package/lib/board/read.ts +83 -0
  202. package/lib/board/reason.ts +102 -0
  203. package/lib/board/round-text.ts +68 -6
  204. package/lib/board/round.ts +31 -15
  205. package/lib/board/rules.ts +151 -307
  206. package/lib/board/seat.ts +35 -0
  207. package/lib/board/session.ts +136 -54
  208. package/lib/board/skipped.ts +22 -0
  209. package/lib/board/steps.ts +487 -0
  210. package/lib/board/store.ts +87 -30
  211. package/lib/board/tone.ts +92 -0
  212. package/lib/board/view.ts +70 -58
  213. package/{extensions/watch → lib}/child.ts +40 -21
  214. package/lib/env.ts +65 -7
  215. package/lib/format.ts +13 -0
  216. package/lib/http/index.ts +14 -12
  217. package/lib/http/port.ts +15 -10
  218. package/lib/lazy.ts +45 -0
  219. package/lib/plan-entry.ts +39 -10
  220. package/lib/plans/paths.ts +82 -0
  221. package/lib/policy.ts +9 -6
  222. package/lib/report.ts +3 -2
  223. package/lib/requirements.ts +8 -8
  224. package/lib/session-label.ts +111 -5
  225. package/lib/session-roster.ts +43 -1
  226. package/lib/session-tool.ts +5 -4
  227. package/lib/stray-fields.ts +7 -2
  228. package/lib/tool-names.ts +5 -10
  229. package/lib/tui/README.md +23 -8
  230. package/lib/tui/chrome.ts +16 -15
  231. package/lib/tui/cursor.ts +18 -3
  232. package/lib/tui/glyphs.ts +9 -7
  233. package/lib/tui/tokens.ts +33 -2
  234. package/lib/tui/tool.ts +3 -3
  235. package/lib/web/README.md +21 -0
  236. package/lib/web/components.ts +5 -1
  237. package/lib/web/index.ts +1 -0
  238. package/lib/web/markdown.ts +83 -0
  239. package/lib/web/markup.ts +2 -1
  240. package/lib/web/runtime.ts +9 -10
  241. package/package.json +6 -1
  242. package/skills/init/SKILL.md +5 -5
  243. package/skills/next/SKILL.md +3 -5
  244. package/extensions/board/seat.ts +0 -28
  245. package/extensions/todo/tui.ts +0 -212
  246. package/lib/tui/index.ts +0 -34
  247. package/skills/project-docs/SKILL.md +0 -133
  248. package/skills/project-docs/references/audit.md +0 -131
  249. package/skills/project-docs/references/changelog.md +0 -105
  250. package/skills/project-docs/references/discovery.md +0 -127
  251. package/skills/project-docs/references/readme.md +0 -80
  252. package/skills/project-docs/references/release.md +0 -84
  253. package/skills/project-docs/references/roadmap.md +0 -93
  254. package/skills/project-docs/scripts/state.ts +0 -316
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gavin-hu/my-pi-agent",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Personal Pi customizations, packaged as a Pi package: worktree isolation and rewind snapshots, question, todo, goal, plan, serve, subagent, job, watch, web-access, file-browse, file-open, file-read, check, memory, context, session-bus, board, team, wechat, and bytefly.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -84,6 +84,11 @@
84
84
  "lib/**",
85
85
  "skills/**",
86
86
  "themes/**",
87
+ "assets/screens/board.png",
88
+ "assets/screens/chrome.png",
89
+ "assets/screens/file-browse.png",
90
+ "assets/screens/plan-review.png",
91
+ "assets/screens/plan.png",
87
92
  "!**/*.test.ts"
88
93
  ],
89
94
  "publishConfig": {
@@ -13,7 +13,7 @@ cannot show; the repository supplies every command, path, and convention that ca
13
13
  be verified. Plan mode is the review gate: no write happens before approval.
14
14
 
15
15
  `/skill:init` loads this skill. If plan mode is not active, call
16
- `enter_plan_mode` and wait for confirmation. Keep the interview and the plan
16
+ `plan` with action `enter` and wait for confirmation. Keep the interview and the plan
17
17
  review in that order; do not write the file early to save a step. A declined plan
18
18
  mode ends the skill: stop and explain, rather than writing directly.
19
19
 
@@ -29,7 +29,7 @@ mode ends the skill: stop and explain, rather than writing directly.
29
29
  └─> draft: new file, exact edits, or an honest no-op
30
30
  └─> quality gate
31
31
  └─> plan outline with ## Steps and ## Verification
32
- └─> write_plan ──> exit_plan_mode
32
+ └─> plan · write ──> plan · exit
33
33
  ├─ not approved ──> refine the same plan
34
34
  └─ approved ──────> write/edit the target
35
35
  └─ read back + quality gate
@@ -147,7 +147,7 @@ evidence, not as a replacement for reading the repository.
147
147
 
148
148
  ## 5. Plan and review
149
149
 
150
- - Save the proposal with `write_plan` in the documented outline. The plan must
150
+ - Save the proposal with `plan` action `write` in the documented outline. The plan must
151
151
  include:
152
152
  - `## Goal` — the outcome for the instruction file;
153
153
  - `## Context` — the sourced evidence sheet, the effective-file finding, and the
@@ -162,9 +162,9 @@ evidence, not as a replacement for reading the repository.
162
162
  - `## Verification` — the project's own check when it declares one (`run_check`,
163
163
  or the narrower docs or structure test that guards the instruction file), then
164
164
  reading the written file back against the checklist.
165
- - Call `exit_plan_mode` with the returned path.
165
+ - Call `plan` action `exit` with the returned path.
166
166
  - If the user refines or rejects the plan, stay in plan mode, rewrite the same
167
- plan file with `write_plan` (`plan_path`), and present it again.
167
+ plan file with `plan` action `write` (`plan_path`), and present it again.
168
168
  - No write to the target may happen before approval.
169
169
 
170
170
  ## 6. Apply and verify
@@ -15,11 +15,9 @@ project wins.
15
15
  The conversation decides where the candidates come from (section 3); the request
16
16
  decides only what to ask and where to look.
17
17
 
18
- Two sibling skills, where they are installed, own a narrower question: an audit
19
- of *where to refactor* is `refactor`, and *whether a document still tells the
20
- truth* — the changelog, the roadmap, the front door — is `project-docs`. When the
21
- request is already scoped to one of those, name the skill that answers it and
22
- hand over, instead of returning a generic list.
18
+ A sibling skill, where it is installed, owns a narrower question: an audit of
19
+ *where to refactor* is `refactor`. When the request is already scoped to it, name
20
+ that skill and hand over, instead of returning a generic list.
23
21
 
24
22
  A next-steps block that the host draws itself is not this skill's output: that is
25
23
  the reply's suggested follow-up, a turn-level hint. This skill inspects state, so
@@ -1,28 +0,0 @@
1
- /**
2
- * The seat: the name the page serves as, and the actor it is shown as.
3
- *
4
- * A page outlives the session that opened it — a `/resume`, a rename, or a fresh
5
- * session taking the page over would otherwise change who the page says it is. So the
6
- * page is a *seat* rather than a session: one fixed name, one fixed id derived from it,
7
- * and the same identity however many sessions have served it.
8
- *
9
- * The page writes nothing, so the id decides no ownership: it is what the page's own
10
- * roster and the `you` chip are read against, and it keeps a page's reads the same
11
- * across a handover. The board's tools write as the session — which is why the label is
12
- * shared with the session serving the page and the ids are not.
13
- */
14
-
15
- import type { Actor } from "../../lib/board/rules.ts";
16
- import { normalizeLabel } from "../../lib/session-label.ts";
17
-
18
- /** The name a repository's page always serves under, so the lead is a role and not a session. */
19
- export const DEFAULT_SEAT = "team-lead";
20
-
21
- /** The prefix of a page's actor id, so one is never mistaken for a session id. */
22
- export const SEAT_ID_PREFIX = "board:";
23
-
24
- /** The actor a page reads as: the seat, and an id derived from it. */
25
- export function pageActor(label: string = DEFAULT_SEAT): Actor {
26
- const seat = normalizeLabel(label, DEFAULT_SEAT);
27
- return { id: `${SEAT_ID_PREFIX}${seat.toLowerCase()}`, label: seat };
28
- }
@@ -1,212 +0,0 @@
1
- /**
2
- * Terminal rendering for the todo list.
3
- *
4
- * `todoRow` is the shared item layout used by the persistent widget and the
5
- * `/todos` screen. Two tiny components wrap it: a non-interactive widget for
6
- * `ctx.ui.setWidget()`, and a scrollable, dismissible list for `ctx.ui.custom()`.
7
- */
8
-
9
- import type { Theme } from "@earendil-works/pi-coding-agent";
10
- import { truncateToWidth, type Component, type TuiMouseEvent, type TuiMouseEventResult } from "@earendil-works/pi-tui";
11
- import { clampScroll, fitRows, formatRange, isCloseKey, navigateScroll, wheelDelta } from "../../lib/tui/cursor.ts";
12
- import { dockListFrame, screenHint, type ViewportRowsSource } from "../../lib/tui/chrome.ts";
13
- import { clip } from "../../lib/tui/columns.ts";
14
- import { emptyState, listRow } from "../../lib/tui/rows.ts";
15
- import { SEPARATORS } from "../../lib/tui/glyphs.ts";
16
- import { RenderCache } from "../../lib/tui/render-cache.ts";
17
- import { titleRule } from "../../lib/tui/rules.ts";
18
- import { paint } from "../../lib/tui/tokens.ts";
19
- import {
20
- progressCount,
21
- progressSummary,
22
- todoGlyphChar,
23
- todoGlyphRole,
24
- todoLabel,
25
- todoLabelRole,
26
- todoLabelText,
27
- todoRailLines,
28
- type TodoRailInput,
29
- } from "./format.ts";
30
- import { currentTodo } from "./state.ts";
31
- import type { Todo } from "./types.ts";
32
-
33
- /** Widget key used with `ctx.ui.setWidget()`. */
34
- export const WIDGET_KEY = "todo-widget";
35
-
36
- /** Items the `/todos` screen shows when the terminal height is unknown. */
37
- const SCREEN_DEFAULT_ITEMS = 12;
38
-
39
- /** One indented item line, clipped to `width`. */
40
- function todoRow(todo: Todo, theme: Theme, width: number): string {
41
- return listRow(theme, width, {
42
- glyph: todoGlyphChar(todo),
43
- glyphRole: todoGlyphRole(todo),
44
- label: todoLabelText(todo),
45
- labelRole: todoLabelRole(todo),
46
- });
47
- }
48
-
49
- /**
50
- * One-line widget summary: progress plus the current item, or a completion note
51
- * when nothing is open. Label-first and glyph-free, matching the `goal` and
52
- * `jobs` widgets. Callers clip it to the available width.
53
- */
54
- function todoLine(todos: Todo[], theme: Theme): string {
55
- const head = `${paint(theme, "accent", "Todos")}${paint(theme, "faint", SEPARATORS.item)}${paint(theme, "faint", progressCount(todos))}`;
56
- const current = currentTodo(todos);
57
- if (!current) return `${head} ${paint(theme, "faint", "completed")}`;
58
- return `${head}${paint(theme, "faint", SEPARATORS.item)}${todoLabel(current, theme)}`;
59
- }
60
-
61
- /**
62
- * Transcript result block: the indented glyph rail, wrapping at the render width.
63
- *
64
- * `render` runs on every frame Pi draws, for every block in the transcript, so the
65
- * rail is memoized on the width (`RenderCache`) and rebuilt only when
66
- * `setInput` hands over a new list or `invalidate` says the theme moved. The
67
- * caller must go through `setInput`: mutating a list in place would leave the
68
- * block showing what it drew last.
69
- */
70
- export class TodoResult implements Component {
71
- private input: TodoRailInput;
72
- private theme: Theme;
73
- private readonly cache = new RenderCache();
74
-
75
- constructor(input: TodoRailInput, theme: Theme) {
76
- this.input = input;
77
- this.theme = theme;
78
- }
79
-
80
- /** Update in place so the transcript can reuse this component across renders. */
81
- setInput(input: TodoRailInput, theme: Theme): void {
82
- this.input = input;
83
- this.theme = theme;
84
- this.cache.invalidate();
85
- }
86
-
87
- invalidate(): void {
88
- this.cache.invalidate();
89
- }
90
-
91
- render(width: number): string[] {
92
- const w = Math.max(1, width);
93
- return this.cache.lines(w, undefined, () => this.build(w));
94
- }
95
-
96
- private build(w: number): string[] {
97
- // The leading blank line separates the rail from the call header, matching
98
- // the built-ins' header/output gap.
99
- return ["", ...todoRailLines(this.input, this.theme, w)];
100
- }
101
- }
102
-
103
- /** Persistent one-line widget shown above the editor while the list has work. */
104
- export class TodoWidget implements Component {
105
- constructor(
106
- private readonly todos: Todo[],
107
- private readonly theme: Theme,
108
- ) {}
109
-
110
- invalidate(): void {}
111
-
112
- render(width: number): string[] {
113
- if (this.todos.length === 0) return [];
114
- return [truncateToWidth(todoLine(this.todos, this.theme), Math.max(1, width), "…")];
115
- }
116
- }
117
-
118
- /** Dismissible, scrollable list opened by `/todos`; reads the live list on each render. */
119
- export class TodoListComponent implements Component {
120
- private scrollTop = 0;
121
- /** Rows shown at once; recomputed from the terminal height on every render. */
122
- private visible = SCREEN_DEFAULT_ITEMS;
123
-
124
- constructor(
125
- private readonly getTodos: () => Todo[],
126
- private readonly theme: Theme,
127
- private readonly onClose: () => void,
128
- private readonly requestRender: () => void,
129
- private readonly viewportRowsSource?: ViewportRowsSource,
130
- ) {}
131
-
132
- /** The live list; re-read on each render so an open screen follows changes. */
133
- private get todos(): Todo[] {
134
- return this.getTodos();
135
- }
136
-
137
- private get maxScroll(): number {
138
- return Math.max(0, this.todos.length - this.visible);
139
- }
140
-
141
- private setScroll(next: number): void {
142
- const clamped = clampScroll(next, this.todos.length, this.visible);
143
- if (clamped === this.scrollTop) return;
144
- this.scrollTop = clamped;
145
- this.requestRender();
146
- }
147
-
148
- handleInput(data: string): void {
149
- if (isCloseKey(data)) {
150
- this.onClose();
151
- return;
152
- }
153
- // `g`/`G` jump to the ends, matching the `/jobs` and plan screens.
154
- if (data === "g") {
155
- this.setScroll(0);
156
- return;
157
- }
158
- if (data === "G") {
159
- this.setScroll(this.maxScroll);
160
- return;
161
- }
162
- const next = navigateScroll(data, this.scrollTop, this.todos.length, this.visible);
163
- if (next !== undefined) this.setScroll(next);
164
- }
165
-
166
- /** Wheel scrolling moves the list, matching the other list screens. */
167
- handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined {
168
- const delta = wheelDelta(event);
169
- if (delta === undefined) return undefined;
170
- this.setScroll(this.scrollTop + delta);
171
- return { handled: true };
172
- }
173
-
174
- invalidate(): void {}
175
-
176
- render(width: number): string[] {
177
- const w = Math.max(1, width);
178
- const header = titleRule(this.theme, w, "Todos");
179
-
180
- if (this.todos.length === 0) {
181
- return dockListFrame({
182
- theme: this.theme,
183
- width: w,
184
- header,
185
- body: emptyState(this.theme, w, { label: "No todos yet. Ask the agent to plan some work." }),
186
- hint: screenHint(this.theme, w, ["Esc close"]),
187
- });
188
- }
189
-
190
- // header, summary, blank, blank-after-list, hint, closing rule
191
- const chrome = 6;
192
- this.visible = fitRows(this.viewportRowsSource, this.todos.length, chrome, SCREEN_DEFAULT_ITEMS);
193
- this.scrollTop = clampScroll(this.scrollTop, this.todos.length, this.visible);
194
-
195
- const end = Math.min(this.todos.length, this.scrollTop + this.visible);
196
- const body: string[] = [];
197
- for (let i = this.scrollTop; i < end; i++) body.push(todoRow(this.todos[i], this.theme, w));
198
-
199
- return dockListFrame({
200
- theme: this.theme,
201
- width: w,
202
- header,
203
- summary: clip(` ${paint(this.theme, "meta", progressSummary(this.todos))}`, w),
204
- body,
205
- range:
206
- this.scrollTop > 0 || end < this.todos.length
207
- ? formatRange(this.theme, w, { start: this.scrollTop, end, total: this.todos.length })
208
- : undefined,
209
- hint: screenHint(this.theme, w, ["Esc close", "↑/↓ or k/j scroll", "PgUp/PgDn", "g/G or Home/End"]),
210
- });
211
- }
212
- }
package/lib/tui/index.ts DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * The Bytefly terminal design system: one kit for every interactive surface.
3
- *
4
- * Import from `lib/tui/index.ts` rather than a leaf module so the surface reads
5
- * as one system. The leaves: `tokens.ts` (semantic role -> theme token),
6
- * `glyphs.ts` (the shared glyph, separator, and status-key vocabulary),
7
- * `chrome.ts` (screen frame, hints, viewport, overlay), `cursor.ts` (list
8
- * scroll and navigation), `columns.ts` (width math), `rules.ts` (the rule
9
- * grammar), `rows.ts` (list rows, checkboxes, chips, empty states), `gauge.ts`
10
- * (the context gauge), `indent.ts` (the transcript block indent), and
11
- * `line-pane.ts` (the scrollable log/match pane), and
12
- * (the shared tool-transcript kit: call title, width-safe call line,
13
- * sanitized error, and the running timer), and `render-cache.ts` (the
14
- * per-instance line memo a derived component renders through).
15
- *
16
- * Value-only, like every `lib/` module: pure functions, constants, and classes,
17
- * with no module-level state.
18
- */
19
-
20
- export * from "./chrome.ts";
21
- export * from "./columns.ts";
22
- export * from "./confirm.ts";
23
- export * from "./cursor.ts";
24
- export * from "./dock-screen.ts";
25
- export * from "./gauge.ts";
26
- export * from "./glyphs.ts";
27
- export * from "./line-pane.ts";
28
- export * from "./indent.ts";
29
- export * from "./render-cache.ts";
30
- export * from "./rows.ts";
31
- export * from "./rules.ts";
32
- export * from "./status-controller.ts";
33
- export * from "./tokens.ts";
34
- export * from "./tool.ts";
@@ -1,133 +0,0 @@
1
- ---
2
- name: project-docs
3
- description: "Keep a project's documents true to its tree: a read-only audit of the front door, the roadmap, the contributor path, and the changelog against the code and against each other, then one mode per act that writes — record a changelog bullet in the same commit as the change, curate a release section from the project's own rules, delete a shipped roadmap item and renumber, and sync the README front door. Use when a doc claim looks stale, before a release, or when a change lands owing an entry; prioritisation stays with `next` and structure with `refactor`."
4
- compatibility: "Bun for scripts/state.ts; git for the roadmap and the audit."
5
- ---
6
-
7
- # Keep the docs true to the tree
8
-
9
- Goal: the documents a reader trusts — the front door, the plan of record, the record
10
- of what shipped, and the contributor path — so a claim the tree no longer meets is
11
- found, and each act that needs writing has one owner. This is a procedure, not a
12
- second policy: the project's instructions and release document win, and where they
13
- are silent this file says ask.
14
-
15
- A bare `/skill:project-docs` reads and reports. Nothing is written until a mode is
16
- named.
17
-
18
- ## Pick the mode
19
-
20
- | The words after `/skill:project-docs` | Mode | Owns | Writes | Follow |
21
- |---|---|---|---|---|
22
- | nothing | audit | every document, read-only | no | [`references/audit.md`](./references/audit.md) |
23
- | `changelog` | changelog | the unreleased window of the changelog | yes | [`references/changelog.md`](./references/changelog.md) |
24
- | `release <version>` | release | one version's section and link refs | yes | [`references/release.md`](./references/release.md) |
25
- | `roadmap` | roadmap | items, ids, and buckets | yes | [`references/roadmap.md`](./references/roadmap.md) |
26
- | `readme` | readme | the front door and its mirror | yes | [`references/readme.md`](./references/readme.md) |
27
- | anything else | refuse, and name the five | — | no | — |
28
-
29
- Audit is the default because the skill spans four documents: a bare invocation that
30
- writes would edit a document nobody asked about.
31
-
32
- ## Start here
33
-
34
- Read [`references/discovery.md`](./references/discovery.md) first, in every mode. It
35
- finds the project's documents, the version's single source, the changelog's local
36
- conventions, the roadmap's rules, the check command, and the guards by name. State
37
- that profile in one paragraph before writing anything; it is how a misread is caught
38
- in a line instead of in a diff.
39
-
40
- For the changelog's mechanical half, run the state script, resolved against this
41
- skill's own directory:
42
-
43
- ```bash
44
- bun <skill>/scripts/state.ts <project-root>
45
- ```
46
-
47
- It prints the changelog file it found, the last tag and the commits since it, the
48
- `[Unreleased]` categories with counts and line numbers, the empty and duplicate
49
- headings, the scope prefixes in use, and the link refs. That is the state; read the
50
- diffs for judgement, not for counting. When it finds no changelog, no repository, or no
51
- Bun to run it with, say so and fall back to discovery by hand. The git commands these
52
- references give are git's; use the project's VCS where it differs.
53
-
54
- ## Non-negotiables
55
-
56
- 1. **Discover, don't impose.** The project's document set, category spelling, scope
57
- prefix, bullet shape, item ids, bucket caps, and release procedure are the rules.
58
- State the profile in one paragraph, and ask when two sources disagree.
59
- 2. **One bullet per user-visible outcome**, in the same commit as the change. A
60
- feature and the bug it fixed before release are one bullet; two observable
61
- changes are two.
62
- 3. **A shipped item is deleted here, with its reason, never ticked.** A roadmap that
63
- keeps what already landed describes a tree that no longer exists.
64
- 4. **One id per thing, across every document.** A README row, a roadmap item, and a
65
- changelog entry that name the same feature use the same name. A mismatch is
66
- reported, never renamed.
67
- 5. **A judgement is not a finding.** Positioning, priority, dates, non-goals, and
68
- contribution policy are the maintainer's: list them and ask.
69
- 6. **One owner per artefact.** The changelog belongs here; what to do next belongs to
70
- the `next` skill; structure belongs to `refactor`.
71
-
72
- ## Modes
73
-
74
- - **Audit** — read-only, five faces: the tree against the docs, the docs against each
75
- other, the changelog's commit window, the roadmap's own ids and caps, and the front
76
- door's examples. Every finding names the mode that fixes it.
77
- - **Changelog** — one bullet under the project's category for one user-visible
78
- outcome, re-reading the file first. It never decides whether something has already
79
- shipped.
80
- - **Release** — only for a version the user named, and only after the project's
81
- release document has been read; everything after moving the entries follows it.
82
- - **Roadmap** — re-derived from the commits since the last tag rather than from the
83
- last tag: shipped items deleted, ids renumbered, every citation and link fixed.
84
- - **Readme** — the front door's catalog rows, counts, examples, and mirror, kept equal
85
- to the tree; deep detail stays in the project's own guides.
86
-
87
- ## Handover
88
-
89
- - **A changelog entry, an audit, or a release** is this skill: do not look for
90
- another one.
91
- - **What to do next** is `next`, where it is installed: it triages loose work and
92
- broken promises across the project, and its candidates are not a doc audit's findings.
93
- - **A structural change to the docs or the code** is `refactor`, where it is installed.
94
- - **Who may contribute, and how** is a decision for the maintainer: ask, and edit
95
- nothing until it is answered.
96
-
97
- ## Report
98
-
99
- Open with the profile in one paragraph, then:
100
-
101
- - **Stale** — the claim, `path:line`, the evidence in the tree, and the mode that
102
- fixes it.
103
- - **Missing** — a document, a row, an entry, or an item the project's own rules call
104
- for and the tree does not have.
105
- - **Suggested edit** — the diff or the exact replacement, for the mechanical items
106
- only, and never applied until the user says so.
107
- - **Needs a decision** — one line each: the question, and what it changes.
108
-
109
- Nothing found is a valid result, and the whole report may be empty. Say what was
110
- checked and stop; an audit that invents four entries to look thorough is worse than
111
- one that finds nothing.
112
-
113
- ## Quality gate
114
-
115
- - The project's own check passes, including any guard on the release window, the
116
- documentation's parity, or the roadmap's ids.
117
- - Every edit names the document and the line, and every bullet names a scope in the
118
- project's spelling and a user outcome.
119
- - No judgement is smuggled into a diff, and the changelog entry is in the change's
120
- own commit.
121
-
122
- ## Stop conditions
123
-
124
- - The project has only a README, no roadmap, and no changelog: say so. Whether to
125
- adopt one is the maintainer's decision, not an edit.
126
- - The changelog is generated — by `semantic-release`, `changesets`, `git-cliff`, or a
127
- step in the release workflow: the entry lands upstream, in the commit message, a
128
- changeset fragment, or the generator's config. Never hand-edit the file.
129
- - Two sources disagree — two changelogs, a version in two places, a roadmap item the
130
- changelog contradicts: ask instead of averaging them.
131
- - The change would reverse a documented non-goal: it is a decision, and the item is
132
- listed rather than written.
133
- - The request is really triage or a refactor: name the sibling skill and stop.
@@ -1,131 +0,0 @@
1
- # Audit
2
-
3
- Read-only. The audit answers one question per claim: is this still true, and if not,
4
- which mode fixes it? It never edits — not even a typo, not even "while we are here".
5
- If the user asks for the fixes, finish the report first, then enter the mode it names.
6
-
7
- Read [`discovery.md`](./discovery.md) first and open the report with the profile. The
8
- five faces below are a reading order, not a checklist: a face with no evidence
9
- produces no findings.
10
-
11
- ## 1. The tree against the docs
12
-
13
- The claims a reader acts on: a catalog row, a limit stated in a package README, a
14
- default in a configuration table, a roadmap item, a non-goal, a "supported format"
15
- list. For each, find the code that does it — the registration, the branch, the config
16
- default — and name where it disagrees.
17
-
18
- | Where the claim lives | What falsifies it |
19
- |---|---|
20
- | A catalog row or feature bullet | The tool, command, flag, or route no longer registers |
21
- | A limitations section | The gap was closed, or widened, and the text did not move |
22
- | A configuration default | The loader's default differs from the table |
23
- | A roadmap item | The tree already does it (see face 4) |
24
- | A non-goal | The changelog records the thing being shipped anyway |
25
-
26
- ## 2. The docs against each other
27
-
28
- - **Counts** — a number a doc states about the code (modules, tools, extensions,
29
- screens) belongs to the tree. A project that derives it in a test has the count; one
30
- that does not is a finding, and the fix is a guard, not a number.
31
- - **Catalog rows** — every row names a thing that exists; every existing thing the
32
- catalog claims to cover has a row. Both directions.
33
- - **Cross-reference ids** — the same feature named in a front-door row, a roadmap item,
34
- and a changelog entry. Report a mismatch; never rename one side to match.
35
- - **The version** — the source of truth, the newest dated changelog heading, the tag,
36
- and any badge, badge-adjacent prose, or install instruction that repeats it.
37
- - **The mirror** — a translated README carries the original's sections, table rows, and
38
- links. A row that exists in one and not the other is a finding even when the prose is
39
- deliberately translated.
40
- - **The contributor path** — the commands `CONTRIBUTING.md` tells a newcomer to run,
41
- against the manifest's `scripts` and the CI workflow's steps. A command the docs promise
42
- and the manifest does not define is the one stale claim a new contributor hits first,
43
- and a step CI runs that the docs never mention is the one they skip.
44
-
45
- ## 3. The changelog's commit window
46
-
47
- Run `scripts/state.ts` (see the skill's *Start here*). It gives the file, the last tag,
48
- the commits since it, the `[Unreleased]` categories, and the scopes in use.
49
-
50
- When discovery says a tool generates the file, the window's entries live in that tool's
51
- input — the changeset queue, the commit-message convention — so audit those, and report
52
- a missing fragment rather than a missing bullet.
53
-
54
- Read every commit it lists: `git show <sha>` for the diff, or the pull request when the
55
- repository squashes. A subject line is not enough — `fix bug` and `wip` hide
56
- user-visible changes, and `feat: rewrite the config loader` is often invisible to users.
57
- For each commit, decide whether a user can observe it, which bullet covers it, whether
58
- that bullet's scope is right, and whether a reader of the bullet alone would know what
59
- changed for them.
60
-
61
- | Commit | User-visible | Evidence | Existing entry | Action |
62
- |---|---|---|---|---|
63
- | `3f19a02` | yes | `src/load.ts:42` now rejects an unknown key | — | add |
64
- | `b81c4de` | no | test-only | — | leave |
65
- | `0ad9f12` | yes | retry limit 3 → 5 | `Changed`: "`api`: retries are now bounded" | update: the bullet never names the limit |
66
- | `77e0a1e` | unclear | touches the public `--json` shape | — | ask |
67
-
68
- `Action` is one of **add** (user-visible, no bullet), **update** (a bullet exists and is
69
- wrong, unscopeable, or too vague to act on), **leave** (covered, internal, or recorded
70
- under an older release), or **ask** (the outcome depends on intent the diff cannot show).
71
-
72
- Report separately:
73
-
74
- - Duplicate `##` or `###` headings — some tools render the second as its own section,
75
- and a reader sees half the entries.
76
- - An empty category heading, or a heading a release guard rejects.
77
- - An `[Unreleased]` section that is missing or empty while the window contains
78
- user-visible changes.
79
- - An entry for something already shipped under a dated heading: the same outcome twice,
80
- which reads as a second change.
81
- - A stale link reference pointing at an older tag than the newest dated heading — where
82
- the file uses link references at all. A generated or non-Keep-a-Changelog file may have
83
- none, and the state script reports that absence as a missing reference without it being
84
- a defect.
85
-
86
- ## 4. The roadmap's own ids and caps
87
-
88
- Re-derive the window before judging an item: `git log --oneline <last-tag>..HEAD` plus
89
- the changelog's newest dated heading. A roadmap describes the tree, so work that landed
90
- but has not shipped is already part of what it should describe.
91
-
92
- - An item the tree already does is a deletion, with its reason recorded where the item
93
- was.
94
- - An id used twice, skipped in a sequence, or cited from nowhere the file defines.
95
- - A bucket over the cap the file states; a bucket that keeps growing stops being a
96
- priority.
97
- - A ledger row whose items all closed, or an open item with no ledger row.
98
- - A relative link or a `path:line` citation that no longer resolves.
99
-
100
- ## 5. The front door's examples
101
-
102
- - The quickstart command, run as written. A command that no longer exists is a stale
103
- promise, and it is the most expensive one because it is the reader's first step.
104
- - An example that imports, configures, or calls something the code no longer accepts.
105
- - A screenshot or a recording that shows a surface that has since changed.
106
- - A link to a guide that moved, a section anchor that was renamed, or a badge whose
107
- target is gone.
108
-
109
- ## Report
110
-
111
- Open with the profile, then the four sections from the skill: **Stale**, **Missing**,
112
- **Suggested edit**, **Needs a decision**. Every stale finding carries the document,
113
- `path:line`, the evidence in the tree, and the mode that fixes it. Group by the mode
114
- when there are more than a handful, so the user can act one mode at a time.
115
-
116
- Nothing found is a valid result for the whole audit or for any face. Say what was
117
- checked — the files read, the commands run, the commits examined — and stop. An audit
118
- that invents findings to look thorough is worse than one that reports none.
119
-
120
- ## What the audit cannot see
121
-
122
- Name these in a closing line instead of guessing:
123
-
124
- - Whether a change is user-visible to someone the diff does not show — a default that
125
- only matters on one platform, a behavior the docs promised and the tests never
126
- covered.
127
- - Whether a commit message describes what the code does; only the diff does.
128
- - Whether an item shipped: a merged change to a document is not a release, and only the
129
- maintainer knows whether the front door's promise is meant to hold today or next
130
- version.
131
- - Whether a roadmap priority is still right, and whether a non-goal still stands.