@bigmistqke/workpad 0.0.0-stage → 0.18.1

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 (277) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +781 -2
  3. package/bin/workpad.ts +1526 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
  5. package/dist/bin/workpad.js +1202 -0
  6. package/dist/client/runtime.js +1194 -0
  7. package/dist/define.js +27 -0
  8. package/dist/plugins/alert/README.md +18 -0
  9. package/dist/plugins/alert/index.js +40 -0
  10. package/dist/plugins/alert/public/style.css +40 -0
  11. package/dist/plugins/ansi/README.md +36 -0
  12. package/dist/plugins/ansi/index.js +63 -0
  13. package/dist/plugins/ansi/public/style.css +28 -0
  14. package/dist/plugins/badge/README.md +32 -0
  15. package/dist/plugins/badge/index.js +28 -0
  16. package/dist/plugins/badge/public/style.css +30 -0
  17. package/dist/plugins/chat/README.md +81 -0
  18. package/dist/plugins/chat/index.js +96 -0
  19. package/dist/plugins/chat/public/client.js +3 -0
  20. package/dist/plugins/chat/public/style.css +143 -0
  21. package/dist/plugins/claude/README.md +116 -0
  22. package/dist/plugins/claude/channel.js +130 -0
  23. package/dist/plugins/claude/doctor.js +316 -0
  24. package/dist/plugins/claude/index.js +199 -0
  25. package/dist/plugins/claude/session.js +68 -0
  26. package/dist/plugins/code/README.md +54 -0
  27. package/dist/plugins/code/diff.js +75 -0
  28. package/dist/plugins/code/index.js +105 -0
  29. package/dist/plugins/code/public/client.js +1 -0
  30. package/dist/plugins/code/public/style.css +99 -0
  31. package/dist/plugins/comments/README.md +30 -0
  32. package/dist/plugins/comments/index.js +39 -0
  33. package/dist/plugins/comments/public/client.js +24 -0
  34. package/dist/plugins/comments/public/style.css +224 -0
  35. package/dist/plugins/details/README.md +24 -0
  36. package/dist/plugins/details/index.js +28 -0
  37. package/dist/plugins/details/public/style.css +7 -0
  38. package/dist/plugins/draft/README.md +14 -0
  39. package/dist/plugins/draft/index.js +27 -0
  40. package/dist/plugins/draft/public/style.css +21 -0
  41. package/dist/plugins/forge/README.md +22 -0
  42. package/dist/plugins/forge/index.js +83 -0
  43. package/dist/plugins/form/README.md +126 -0
  44. package/dist/plugins/form/index.js +179 -0
  45. package/dist/plugins/form/public/style.css +172 -0
  46. package/dist/plugins/grid/README.md +45 -0
  47. package/dist/plugins/grid/index.js +35 -0
  48. package/dist/plugins/grid/public/style.css +98 -0
  49. package/dist/plugins/iframe/README.md +18 -0
  50. package/dist/plugins/iframe/index.js +49 -0
  51. package/dist/plugins/iframe/public/style.css +28 -0
  52. package/dist/plugins/index.js +44 -0
  53. package/dist/plugins/lightbox/README.md +24 -0
  54. package/dist/plugins/lightbox/index.js +20 -0
  55. package/dist/plugins/lightbox/public/client.js +4 -0
  56. package/dist/plugins/lightbox/public/style.css +66 -0
  57. package/dist/plugins/mermaid/README.md +21 -0
  58. package/dist/plugins/mermaid/index.js +42 -0
  59. package/dist/plugins/mermaid/public/style.css +21 -0
  60. package/dist/plugins/opencode/README.md +48 -0
  61. package/dist/plugins/opencode/channel.js +92 -0
  62. package/dist/plugins/opencode/index.js +64 -0
  63. package/dist/plugins/opencode/shim.js +150 -0
  64. package/dist/plugins/quiet/README.md +26 -0
  65. package/dist/plugins/quiet/index.js +23 -0
  66. package/dist/plugins/tabs/README.md +44 -0
  67. package/dist/plugins/tabs/index.js +75 -0
  68. package/dist/plugins/tabs/public/client.js +1 -0
  69. package/dist/plugins/tabs/public/style.css +98 -0
  70. package/dist/plugins/terminal/README.md +63 -0
  71. package/dist/plugins/terminal/host.js +338 -0
  72. package/dist/plugins/terminal/index.js +170 -0
  73. package/dist/plugins/terminal/modes.js +32 -0
  74. package/dist/plugins/terminal/public/client.js +41 -0
  75. package/dist/plugins/terminal/public/style.css +511 -0
  76. package/dist/plugins/terminal/server.js +256 -0
  77. package/dist/plugins/terminal/sizes.js +58 -0
  78. package/dist/plugins/timeline/README.md +48 -0
  79. package/dist/plugins/timeline/index.js +83 -0
  80. package/dist/plugins/timeline/public/style.css +138 -0
  81. package/dist/plugins/toc/README.md +40 -0
  82. package/dist/plugins/toc/index.js +29 -0
  83. package/dist/plugins/toc/public/client.js +1 -0
  84. package/dist/plugins/toc/public/style.css +117 -0
  85. package/dist/plugins/window/README.md +51 -0
  86. package/dist/plugins/window/index.js +91 -0
  87. package/dist/solid/index.js +41 -0
  88. package/dist/src/agents.js +81 -0
  89. package/dist/src/anchors.js +52 -0
  90. package/dist/src/api.js +282 -0
  91. package/dist/src/archive.js +49 -0
  92. package/dist/src/auth.js +67 -0
  93. package/dist/src/build.js +159 -0
  94. package/dist/src/client/page/base.css +1762 -0
  95. package/dist/src/client/page/main.js +2121 -0
  96. package/dist/src/config.js +76 -0
  97. package/dist/src/document.js +93 -0
  98. package/dist/src/entries.js +264 -0
  99. package/dist/src/events.js +322 -0
  100. package/dist/src/files.js +47 -0
  101. package/dist/src/formstate.js +65 -0
  102. package/dist/src/help.js +213 -0
  103. package/dist/src/html.js +34 -0
  104. package/dist/src/hub.js +348 -0
  105. package/dist/src/icons.js +6 -0
  106. package/dist/src/listen.js +132 -0
  107. package/dist/src/listeners.js +64 -0
  108. package/dist/src/load.js +81 -0
  109. package/dist/src/loader.js +179 -0
  110. package/dist/src/migrate.js +314 -0
  111. package/dist/src/package.js +52 -0
  112. package/dist/src/pages/blocks.js +67 -0
  113. package/dist/src/pages/board.js +59 -0
  114. package/dist/src/pages/index.js +27 -0
  115. package/dist/src/pages/markdown.js +863 -0
  116. package/dist/src/pages/render.js +761 -0
  117. package/dist/src/pages/window.js +29 -0
  118. package/dist/src/plugins.js +283 -0
  119. package/dist/src/public.js +24 -0
  120. package/dist/src/rename.js +130 -0
  121. package/dist/src/running.js +146 -0
  122. package/dist/src/serve.js +188 -0
  123. package/dist/src/server.js +1105 -0
  124. package/dist/src/site.js +179 -0
  125. package/dist/src/state.js +155 -0
  126. package/dist/src/status.js +323 -0
  127. package/dist/src/thread.js +68 -0
  128. package/dist/src/watchdog.js +38 -0
  129. package/dist/src/ws.js +128 -0
  130. package/package.json +154 -4
  131. package/plugins/README.md +304 -0
  132. package/plugins/alert/README.md +18 -0
  133. package/plugins/alert/index.ts +50 -0
  134. package/plugins/alert/public/style.css +40 -0
  135. package/plugins/ansi/README.md +36 -0
  136. package/plugins/ansi/index.ts +95 -0
  137. package/plugins/ansi/public/style.css +28 -0
  138. package/plugins/badge/README.md +32 -0
  139. package/plugins/badge/index.ts +36 -0
  140. package/plugins/badge/public/style.css +30 -0
  141. package/plugins/chat/README.md +81 -0
  142. package/plugins/chat/autosize.ts +139 -0
  143. package/plugins/chat/client.tsx +187 -0
  144. package/plugins/chat/index.ts +146 -0
  145. package/plugins/chat/public/style.css +143 -0
  146. package/plugins/claude/README.md +116 -0
  147. package/plugins/claude/channel.ts +136 -0
  148. package/plugins/claude/doctor.ts +274 -0
  149. package/plugins/claude/index.ts +248 -0
  150. package/plugins/claude/session.ts +70 -0
  151. package/plugins/code/README.md +54 -0
  152. package/plugins/code/client.ts +73 -0
  153. package/plugins/code/diff.ts +96 -0
  154. package/plugins/code/index.ts +136 -0
  155. package/plugins/code/public/style.css +99 -0
  156. package/plugins/comments/README.md +30 -0
  157. package/plugins/comments/client.ts +723 -0
  158. package/plugins/comments/index.ts +48 -0
  159. package/plugins/comments/public/style.css +224 -0
  160. package/plugins/details/README.md +24 -0
  161. package/plugins/details/index.ts +30 -0
  162. package/plugins/details/public/style.css +7 -0
  163. package/plugins/draft/README.md +14 -0
  164. package/plugins/draft/index.ts +23 -0
  165. package/plugins/draft/public/style.css +21 -0
  166. package/plugins/forge/README.md +22 -0
  167. package/plugins/forge/index.ts +84 -0
  168. package/plugins/form/README.md +126 -0
  169. package/plugins/form/index.ts +199 -0
  170. package/plugins/form/public/style.css +172 -0
  171. package/plugins/grid/README.md +45 -0
  172. package/plugins/grid/index.ts +41 -0
  173. package/plugins/grid/public/style.css +98 -0
  174. package/plugins/iframe/README.md +18 -0
  175. package/plugins/iframe/index.ts +53 -0
  176. package/plugins/iframe/public/style.css +28 -0
  177. package/plugins/index.ts +49 -0
  178. package/plugins/lightbox/README.md +24 -0
  179. package/plugins/lightbox/client.ts +109 -0
  180. package/plugins/lightbox/index.ts +25 -0
  181. package/plugins/lightbox/public/style.css +66 -0
  182. package/plugins/mermaid/README.md +21 -0
  183. package/plugins/mermaid/index.ts +46 -0
  184. package/plugins/mermaid/public/style.css +21 -0
  185. package/plugins/opencode/README.md +48 -0
  186. package/plugins/opencode/channel.ts +112 -0
  187. package/plugins/opencode/index.ts +91 -0
  188. package/plugins/opencode/shim.ts +166 -0
  189. package/plugins/quiet/README.md +26 -0
  190. package/plugins/quiet/index.ts +28 -0
  191. package/plugins/tabs/README.md +44 -0
  192. package/plugins/tabs/client.ts +96 -0
  193. package/plugins/tabs/index.ts +103 -0
  194. package/plugins/tabs/public/style.css +98 -0
  195. package/plugins/terminal/README.md +63 -0
  196. package/plugins/terminal/client.ts +391 -0
  197. package/plugins/terminal/host.ts +434 -0
  198. package/plugins/terminal/index.ts +199 -0
  199. package/plugins/terminal/modes.ts +30 -0
  200. package/plugins/terminal/public/style.css +225 -0
  201. package/plugins/terminal/server.ts +266 -0
  202. package/plugins/terminal/sizes.ts +72 -0
  203. package/plugins/timeline/README.md +48 -0
  204. package/plugins/timeline/index.ts +82 -0
  205. package/plugins/timeline/public/style.css +138 -0
  206. package/plugins/toc/README.md +40 -0
  207. package/plugins/toc/client.ts +236 -0
  208. package/plugins/toc/index.ts +55 -0
  209. package/plugins/toc/public/style.css +117 -0
  210. package/plugins/window/README.md +51 -0
  211. package/plugins/window/index.ts +92 -0
  212. package/skills/workpad/SKILL.md +592 -0
  213. package/solid/index.tsx +80 -0
  214. package/src/agents.ts +134 -0
  215. package/src/anchors.ts +85 -0
  216. package/src/api.ts +444 -0
  217. package/src/archive.ts +75 -0
  218. package/src/auth.ts +99 -0
  219. package/src/build.ts +213 -0
  220. package/src/client/base.ts +19 -0
  221. package/src/client/forms.ts +420 -0
  222. package/src/client/markdown.ts +147 -0
  223. package/src/client/page/base.css +1762 -0
  224. package/src/client/page/board.ts +166 -0
  225. package/src/client/page/elsewhere.ts +153 -0
  226. package/src/client/page/fresh.ts +343 -0
  227. package/src/client/page/heading-link.ts +32 -0
  228. package/src/client/page/live.ts +134 -0
  229. package/src/client/page/main.ts +398 -0
  230. package/src/client/page/orphans.ts +64 -0
  231. package/src/client/page/place.ts +260 -0
  232. package/src/client/page/sort.ts +49 -0
  233. package/src/client/page/sticky.ts +58 -0
  234. package/src/client/page/theme.ts +36 -0
  235. package/src/client/page/view.ts +9 -0
  236. package/src/client/page/waiting.ts +278 -0
  237. package/src/client/page/window.ts +40 -0
  238. package/src/client/reactive.ts +19 -0
  239. package/src/client/read.ts +111 -0
  240. package/src/client/runtime.ts +499 -0
  241. package/src/client/scroll.ts +90 -0
  242. package/src/client/toast.ts +99 -0
  243. package/src/config.ts +111 -0
  244. package/src/define.ts +997 -0
  245. package/src/document.ts +191 -0
  246. package/src/entries.ts +352 -0
  247. package/src/events.ts +463 -0
  248. package/src/files.ts +74 -0
  249. package/src/formstate.ts +72 -0
  250. package/src/help.ts +240 -0
  251. package/src/html.ts +44 -0
  252. package/src/hub.ts +435 -0
  253. package/src/icons.ts +18 -0
  254. package/src/listen.ts +171 -0
  255. package/src/listeners.ts +89 -0
  256. package/src/load.ts +113 -0
  257. package/src/loader.ts +227 -0
  258. package/src/migrate.ts +352 -0
  259. package/src/package.ts +62 -0
  260. package/src/pages/blocks.ts +106 -0
  261. package/src/pages/board.ts +89 -0
  262. package/src/pages/index.ts +79 -0
  263. package/src/pages/markdown.ts +976 -0
  264. package/src/pages/render.ts +845 -0
  265. package/src/pages/window.ts +69 -0
  266. package/src/plugins.ts +319 -0
  267. package/src/public.ts +39 -0
  268. package/src/rename.ts +147 -0
  269. package/src/running.ts +171 -0
  270. package/src/serve.ts +221 -0
  271. package/src/server.ts +1385 -0
  272. package/src/site.ts +170 -0
  273. package/src/state.ts +327 -0
  274. package/src/status.ts +466 -0
  275. package/src/thread.ts +98 -0
  276. package/src/watchdog.ts +53 -0
  277. package/src/ws.ts +155 -0
@@ -0,0 +1,143 @@
1
+ /* A chat: the reader's messages on the right, the agent's on the left; never part of an answer. */
2
+ .wp-chat {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--space-lg);
6
+ font: var(--ui-text)/var(--ui-line-height) var(--sans);
7
+ }
8
+ /* under a form: set off from the question by a dashed rule */
9
+ .wp-chat[data-under-form] {
10
+ margin-top: var(--space-xs);
11
+ padding-top: var(--space-xl);
12
+ border-top: var(--hairline) dashed var(--border);
13
+ }
14
+ .wp-chat-message {
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: var(--space-2xs);
18
+ max-width: 85%;
19
+ align-self: flex-start;
20
+ align-items: flex-start;
21
+ }
22
+ /* an agent's message holding blocks (a form, a details, a diagram: Api.message) takes the whole width a
23
+ message may, so they are laid out as on the page, not squeezed to its text */
24
+ .wp-chat-message:has(> .wp-chat-bubble > :is(form, details, figure, section, .wp-window, [data-block])) {
25
+ width: 85%;
26
+ }
27
+ .wp-chat-message:has(> .wp-chat-bubble > :is(form, details, figure, section, .wp-window, [data-block]))
28
+ > .wp-chat-bubble {
29
+ align-self: stretch;
30
+ }
31
+ /* a form in a message: its ring inside the bubble, not out past it */
32
+ .wp-chat-bubble form.wp-form {
33
+ --wp-ring-at: 6px;
34
+ margin-inline: 6px;
35
+ }
36
+ /* one that starts or ends the message: as far in from the bubble's edge there as from its sides
37
+ (the bubble is padded less above and below than beside) */
38
+ .wp-chat-bubble[data-md] > form.wp-form:first-child {
39
+ margin-top: calc(var(--space-xl) - var(--space-md) + 6px);
40
+ }
41
+ .wp-chat-bubble[data-md] > form.wp-form:last-child {
42
+ margin-bottom: calc(var(--space-xl) - var(--space-md) + 6px);
43
+ }
44
+ /* inside the form, its last line (the buttons) as close to its ring as its sides are: the bubble's
45
+ paragraph spacing stops before it, as the bubble's own last child's does */
46
+ .wp-chat-bubble[data-md] form.wp-form > :last-child {
47
+ margin-bottom: 0;
48
+ }
49
+ .wp-chat-message[data-from='you'] {
50
+ align-self: flex-end;
51
+ align-items: flex-end;
52
+ }
53
+ /* shown at once, grey until the server has it */
54
+ .wp-chat-message[data-from='you'][data-sending] .wp-chat-bubble {
55
+ background: var(--wp-sending, #9a9fa7);
56
+ border-color: var(--wp-sending, #9a9fa7);
57
+ color: var(--bg);
58
+ transition:
59
+ background-color 0.2s,
60
+ border-color 0.2s;
61
+ }
62
+ .wp-chat-who {
63
+ font: var(--weight-strong) var(--ui-tiny)/1.3 var(--sans);
64
+ letter-spacing: var(--caps-spacing);
65
+ text-transform: uppercase;
66
+ color: var(--muted);
67
+ padding: 0 var(--space-xs);
68
+ }
69
+ .wp-chat-message[data-from='agent'] .wp-chat-who {
70
+ color: var(--accent);
71
+ }
72
+ .wp-chat-bubble {
73
+ max-width: 100%;
74
+ min-width: 0;
75
+ box-sizing: border-box;
76
+ white-space: pre-wrap;
77
+ padding: var(--space-md) var(--space-xl);
78
+ border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
79
+ background: var(--tint);
80
+ border: var(--hairline) solid var(--border);
81
+ }
82
+ /* rendered from markdown: its paragraphs and code carry the spacing */
83
+ .wp-chat-bubble[data-md] {
84
+ white-space: normal;
85
+ overflow-wrap: anywhere;
86
+ }
87
+ .wp-chat-bubble[data-md] > :first-child {
88
+ margin-top: 0;
89
+ }
90
+ .wp-chat-bubble[data-md] > :last-child {
91
+ margin-bottom: 0;
92
+ }
93
+ .wp-chat-bubble[data-md] :is(p, ul, ol, pre, blockquote, table) {
94
+ margin: 0 0 0.5em;
95
+ }
96
+ /* a table's cells wrap between words, not inside them (the bubble's own wrapping anywhere would
97
+ squeeze its columns down to a letter); one too wide for the bubble scrolls sideways */
98
+ .wp-chat-bubble[data-md] table {
99
+ overflow-wrap: normal;
100
+ }
101
+ /* code keeps its lines whole and scrolls sideways, as on a page (code/style.css: {wrap} wraps it) */
102
+ .wp-chat-bubble[data-md] pre {
103
+ font-size: var(--ui-small);
104
+ padding: var(--space-md) var(--space-lg);
105
+ border-radius: var(--radius-sm);
106
+ }
107
+ .wp-chat-message[data-from='you'] .wp-chat-bubble[data-md] a {
108
+ color: inherit;
109
+ }
110
+ .wp-chat-message[data-from='you'] .wp-chat-bubble {
111
+ border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
112
+ background: var(--accent);
113
+ border-color: var(--accent);
114
+ color: var(--accent-text);
115
+ }
116
+ .wp-chat-new {
117
+ display: flex;
118
+ gap: var(--space-md);
119
+ align-items: flex-start;
120
+ }
121
+ .wp-chat-new textarea {
122
+ flex: 1;
123
+ resize: none;
124
+ font: inherit;
125
+ }
126
+
127
+ /* :::chat on its own: set off from the article like a form, hairlines above and below */
128
+ .wp-chat-block {
129
+ margin: var(--gap-block) 0;
130
+ padding: 1.6em 0 1.7em;
131
+ border-top: var(--hairline) solid var(--border);
132
+ border-bottom: var(--hairline) solid var(--border);
133
+ display: grid;
134
+ /* one column, as wide as the block: wide content (a code block) scrolls inside it, not past it */
135
+ grid-template-columns: minmax(0, 1fr);
136
+ gap: var(--space-2xl);
137
+ }
138
+ .wp-chat-block > :first-child {
139
+ margin-top: 0;
140
+ }
141
+ .wp-chat-block > :is(p, ul, ol) {
142
+ margin: 0;
143
+ }
@@ -0,0 +1,116 @@
1
+ # Claude Code
2
+
3
+ The Claude Code plugin brings your answers to an agent session without the
4
+ agent having to wait for them, and tells it what is open on its pages:
5
+
6
+ ```ts
7
+ import claude from '@bigmistqke/workpad/claude'
8
+
9
+ export default defineConfig({
10
+ plugins: [claude()],
11
+ })
12
+ ```
13
+
14
+ With it, the Claude Code session is who runs workpad's commands (unless
15
+ `WORKPAD_AGENT` names it otherwise): `workpad new` subscribes it to the
16
+ page it makes, and `workpad status` marks that session's pages.
17
+ `workpad claude install` sets it up for the project: the channel, which
18
+ pushes your answers into the session, and the turn-end check, which sends a
19
+ turn on once when it ends with something left on its pages. `uninstall`
20
+ takes them out again, leaving other servers, hooks and settings as they
21
+ are. What they write runs the project's own copy of workpad when it
22
+ depends on one, so the files can be committed for everyone who works on it.
23
+
24
+ ## Setting it up, in order
25
+
26
+ In a project where an agent should get your answers without waiting for
27
+ them:
28
+
29
+ 1. `workpad init`, then add `claude()` to the plugins in
30
+ `.workpad/config.ts` (example above).
31
+ 2. `workpad claude install`: the channel in `.mcp.json`, the hooks in
32
+ `.claude/settings.json`.
33
+ 3. Start Claude Code with the channel:
34
+ `claude --dangerously-load-development-channels server:workpad`. A
35
+ session started before step 2 has no channel to load: start it again.
36
+ At "New MCP server found", choose to use it; Esc disables it.
37
+ 4. In the session, the agent runs `workpad agent ping`, and confirms the
38
+ pong with `workpad agent ping <code>`.
39
+ 5. The channel then follows the session's pages: those it makes with
40
+ `workpad new`, also later ones. `workpad claude doctor` says what
41
+ is missing when answers don't arrive.
42
+
43
+ ## The channel
44
+
45
+ An MCP server, `workpad claude channel`, that Claude Code starts
46
+ with each session. Once the agent has checked that it works (below), it
47
+ listens on the pages that session is subscribed to (also ones it subscribes
48
+ to later), as a `listen` does, and pushes each answer you give there into the session, as a
49
+ message:
50
+
51
+ ```text
52
+ <channel source="workpad" page="plan" id="mwv…" type="scope">plan: form scope: "Smaller" (id mwv…; …)</channel>
53
+ ```
54
+
55
+ No `listen` needs to run for the agent, and it gets your answer while it
56
+ works; the answer counts as received once it is sent, and the form folds.
57
+ The session's pages are those it made or listened on; `workpad listen
58
+ --channel` makes more its own (every page without `--page`, also later
59
+ ones) and exits at once.
60
+
61
+ Claude Code starts the server also when the session was started without
62
+ the channel (without the flag below, with `-p`, or when an organisation's
63
+ policy turns channels off), and then drops what it sends without a word.
64
+ So the channel listens on nothing until the agent has run `workpad
65
+ ping`: the channel pushes a pong into the session, with a code, and the
66
+ agent confirms it with `workpad agent ping <code>`. Until then your pages say
67
+ nobody listens.
68
+
69
+ Channels are a research preview of Claude Code: a session loads one only
70
+ when started with
71
+
72
+ ```sh
73
+ claude --dangerously-load-development-channels server:workpad
74
+ ```
75
+
76
+ (an alias saves typing it). It works with Claude Code only: the push is
77
+ Claude Code's own extension of MCP. With many projects under one shared
78
+ server, registering it once for your user covers them all:
79
+ `claude mcp add --scope user workpad -- workpad claude channel`.
80
+ Problems (a hand-out that failed, say) are written to
81
+ `.workpad/claude/channel.log`.
82
+
83
+ It is two parts: the server in the project's `.mcp.json`, and a silent
84
+ SessionStart hook in its `.claude/settings.json` that tells it which
85
+ session it serves (on a resume, Claude Code starts it with an id the
86
+ conversation then leaves).
87
+
88
+ ### When answers don't arrive
89
+
90
+ ```sh
91
+ workpad claude doctor
92
+ ```
93
+
94
+ checks, in the session, everything the channel needs, a line each with
95
+ what to do about one that fails: the channel in `.mcp.json` and that its
96
+ command answers; the server approved and disabled in no settings file
97
+ (`.claude/settings.json`, `settings.local.json`, `~/.claude/settings.json`,
98
+ the project in `~/.claude.json`, and in a git worktree without its own
99
+ `settings.local.json`, the main checkout's, where Claude Code writes an Esc
100
+ on "New MCP server found"); the session started with the flag above, in
101
+ the project's folder; the server up at the project's version; a channel
102
+ for this session; and its ping confirmed. `/mcp` doesn't list a disabled
103
+ server at all, so this is where to look. It changes nothing, and exits 1
104
+ when something is to fix.
105
+
106
+ ## The turn-end check
107
+
108
+ A Stop hook in the project's `.claude/settings.json`: when a turn ends with
109
+ something left on the session's pages (a question nobody listens for, an
110
+ answer the agent didn't handle, a chat waiting for its reply), the turn
111
+ goes on once, telling the agent what to do about it (agents forget). A turn
112
+ the hook already continued ends, and you see what is open. It is the safety
113
+ net for a session started without the channel, and for an answer the agent
114
+ received and then forgot. An answer the channel sent that hasn't reached
115
+ the conversation yet (Claude Code holds a channel's message until the turn
116
+ ends) doesn't count: it comes as a turn of its own.
@@ -0,0 +1,136 @@
1
+ // Workpad as a Claude Code channel: an MCP server (stdio) that Claude Code starts with each
2
+ // session, `workpad claude channel`. It pushes the reader's answers on the session's own
3
+ // pages into the session (`notifications/claude/channel`), so the agent needs no wait. Channels are
4
+ // a research preview: a session loads it only when started with
5
+ //
6
+ // claude --dangerously-load-development-channels server:workpad
7
+ //
8
+ // and the server registered in `.mcp.json` (`workpad claude install`) or for the user
9
+ // (`claude mcp add --scope user workpad -- workpad claude channel`).
10
+ //
11
+ // Claude Code starts the server without the flag too, and then drops what it sends without a word,
12
+ // so the channel is a channel of the core's (`ctx.channel`): it listens on nothing until the agent
13
+ // ran `workpad agent ping` and confirmed the pong it pushed. From then on its pages are those the
14
+ // session is subscribed to (`workpad new`, `listen --page`), also later ones; for each it holds
15
+ // a listener at the server, as a `listen` does, and hands out the reader's answers there, as
16
+ // received.
17
+ //
18
+ // The session is the one the hooks last recorded for this claude process (session.ts), else
19
+ // `CLAUDE_CODE_SESSION_ID`, read again every round: a resume switches it after start. Problems (a
20
+ // page another wait holds, a hand-out that failed) go to `.workpad/claude/channel.log`;
21
+ // normal work leaves no trace.
22
+ import fs from 'node:fs'
23
+ import path from 'node:path'
24
+ import readline from 'node:readline'
25
+ import type { CommandContext, WpEvent } from '../../src/define.ts'
26
+ import { ANSWERS_NOTE, answerLine, identity, pong } from '../../src/agents.ts'
27
+ import { channelSince, read } from '../../src/events.ts'
28
+ import { claudeProcess, recordedSession } from './session.ts'
29
+
30
+ const INSTRUCTIONS = [
31
+ 'Messages from workpad arrive as <channel source="workpad">: a pong for `workpad agent ping`, which says how to confirm it, and once confirmed the reader\'s answers on your workpad pages (a form, a chat message, a comment), received already.',
32
+ ANSWERS_NOTE,
33
+ ].join(' ')
34
+
35
+ export async function channel(ctx: CommandContext) {
36
+ const problem = (what: string, data?: unknown) => {
37
+ fs.mkdirSync(ctx.dataDir, { recursive: true })
38
+ fs.appendFileSync(
39
+ path.join(ctx.dataDir, 'channel.log'),
40
+ `${new Date().toISOString()} ${what}${data === undefined ? '' : ' ' + JSON.stringify(data)}\n`,
41
+ )
42
+ }
43
+ const send = (msg: object) => process.stdout.write(JSON.stringify({ jsonrpc: '2.0', ...msg }) + '\n')
44
+
45
+ const claude = claudeProcess()
46
+ const started = process.env.CLAUDE_CODE_SESSION_ID || null
47
+ let session: string | null = null
48
+ /** The conversation now, and a line in the log when it changed after start (a resume). */
49
+ const current = () => {
50
+ const now = identity(recordedSession(ctx.dataDir, claude) ?? started)
51
+ if (now !== session) {
52
+ if (!now) problem('no CLAUDE_CODE_SESSION_ID: no pages to follow')
53
+ else if (now !== started || session) problem('following another session than at start', { started, now })
54
+ session = now
55
+ }
56
+ return session
57
+ }
58
+
59
+ // what came before Claude Code said it is ready waits for it
60
+ let ready = false
61
+ const queue: object[] = []
62
+ const notify = (content: string, meta: Record<string, string>) => {
63
+ const msg = { method: 'notifications/claude/channel', params: { content, meta } }
64
+ if (!ready) return void queue.push(msg)
65
+ send(msg)
66
+ }
67
+
68
+ // the line to the server, for `workpad agent ping`; the pages are followed once the agent confirmed
69
+ let confirmed = false
70
+ let line: { move(session: string): void } | null = null
71
+ const hold = (session: string | null) => {
72
+ if (!session) return
73
+ if (line) return line.move(session)
74
+ line = ctx.channel(session, {
75
+ onPing: code => notify(pong(code), { type: 'pong' }),
76
+ onConfirmed: () => {
77
+ confirmed = true
78
+ void round()
79
+ },
80
+ })
81
+ }
82
+
83
+ // Each page followed on its own, so another session's answers are never handed out here.
84
+ const followed = new Set<string>()
85
+ const follow = async () => {
86
+ const session = current()
87
+ hold(session)
88
+ if (!confirmed || !session) return
89
+ const pages = (await ctx.status()).filter(p => p.subscribers.includes(session)).map(p => p.page)
90
+ for (const page of pages) {
91
+ if (followed.has(page)) continue
92
+ followed.add(page)
93
+ await ctx.listen(page, { agent: session })
94
+ // received as it is sent: the agent confirmed that what this sends reaches it
95
+ const push = (e: WpEvent, again: boolean) => notify(answerLine(e, again), { page: e.page, id: e.id, type: e.type })
96
+ // a page taken on through the channel: what is new, not the past someone already received
97
+ const since = channelSince(read(ctx.eventsFile).events, session, page) ?? undefined
98
+ void ctx
99
+ .handOut({ page, exact: true }, push, { agent: session, skipReceivedBefore: since })
100
+ .catch(err => problem('handing out failed', { page, err: String(err) }))
101
+ }
102
+ }
103
+
104
+ const rl = readline.createInterface({ input: process.stdin })
105
+ rl.on('line', line => {
106
+ let msg: { id?: number | string; method?: string; params?: Record<string, unknown> }
107
+ try {
108
+ msg = JSON.parse(line)
109
+ } catch {
110
+ return
111
+ }
112
+ if (msg.method === 'initialize')
113
+ send({
114
+ id: msg.id,
115
+ result: {
116
+ protocolVersion: (msg.params?.protocolVersion as string) ?? '2025-06-18',
117
+ capabilities: { experimental: { 'claude/channel': {} } },
118
+ serverInfo: { name: 'workpad', version: '1' },
119
+ instructions: INSTRUCTIONS,
120
+ },
121
+ })
122
+ else if (msg.method === 'notifications/initialized') {
123
+ ready = true
124
+ for (const m of queue.splice(0)) send(m)
125
+ } else if (msg.method === 'ping') send({ id: msg.id, result: {} })
126
+ // anything else asked (Claude Code probes with methods of its own): not offered here
127
+ else if (msg.id !== undefined) send({ id: msg.id, error: { code: -32601, message: `no method ${msg.method}` } })
128
+ })
129
+ // the session ended
130
+ rl.on('close', () => process.exit(0))
131
+
132
+ const round = () => follow().catch(err => problem('finding the session’s pages failed', String(err)))
133
+ await round()
134
+ setInterval(() => void round(), 5000)
135
+ await new Promise(() => {})
136
+ }
@@ -0,0 +1,274 @@
1
+ // `workpad claude doctor`: everything the channel needs to push the reader's answers into this
2
+ // session, checked one by one, with what to do about each that fails. Each of these broke a channel
3
+ // without a word once: Claude Code drops a server's messages when the session wasn't started with the
4
+ // channels flag, a session started from another folder never sees the project's .mcp.json, and an Esc
5
+ // on "New MCP server found" disables the server in a settings file `/mcp` then doesn't list at all
6
+ // (in a git worktree without its own settings.local.json, in the main checkout's).
7
+ //
8
+ // It reads, and changes nothing: the files, the claude process it runs under (its command line and
9
+ // folder, with ps and lsof), and what the project's server says (never started for it). The
10
+ // channel's command is started once, asked to initialize, and stopped.
11
+ import fs from 'node:fs'
12
+ import os from 'node:os'
13
+ import path from 'node:path'
14
+ import { spawn, spawnSync } from 'node:child_process'
15
+ import type { CommandContext } from '../../src/define.ts'
16
+ import { claudePid, claudeProcess, recordedSession } from './session.ts'
17
+
18
+ const SERVER = 'workpad'
19
+ const FLAG = '--dangerously-load-development-channels'
20
+
21
+ type Mark = 'ok' | 'fail' | 'skip'
22
+ interface Line {
23
+ mark: Mark
24
+ text: string
25
+ /** what to do about it, for a fail */
26
+ fix?: string
27
+ }
28
+
29
+ /** A JSON file, null when it isn't there, `undefined` when it can't be read or parsed (said in `why`). */
30
+ function readJson(file: string): { value: any; why?: string } | null {
31
+ if (!fs.existsSync(file)) return null
32
+ try {
33
+ return { value: JSON.parse(fs.readFileSync(file, 'utf8')) }
34
+ } catch (err) {
35
+ return { value: undefined, why: (err as NodeJS.ErrnoException).code ?? 'not valid JSON' }
36
+ }
37
+ }
38
+
39
+ /** `$VAR` and `${VAR}` in a command as Claude Code expands them; CLAUDE_PROJECT_DIR is the project. */
40
+ export function expand(s: string, env: Record<string, string | undefined>): string {
41
+ return s.replace(/\$\{(\w+)\}|\$(\w+)/g, (_, a, b) => env[a ?? b] ?? '')
42
+ }
43
+
44
+ /** Start the channel's command, ask it to initialize, and stop it: whether it answered, or why not. */
45
+ function probe(command: string, args: string[], cwd: string, env: NodeJS.ProcessEnv): Promise<string | null> {
46
+ return new Promise(resolve => {
47
+ let out = ''
48
+ let err = ''
49
+ const child = spawn(command, args, { cwd, env, stdio: ['pipe', 'pipe', 'pipe'] })
50
+ const done = (why: string | null) => {
51
+ clearTimeout(timer)
52
+ child.kill()
53
+ resolve(why)
54
+ }
55
+ const timer = setTimeout(() => done(`no answer to initialize within 15s${err ? `: ${err.trim().split('\n').at(-1)}` : ''}`), 15000)
56
+ child.on('error', e => done(`it doesn't start: ${e.message}`))
57
+ child.on('exit', code => done(`it exited (${code}) before answering${err ? `: ${err.trim().split('\n').at(-1)}` : ''}`))
58
+ child.stderr.on('data', d => (err += d))
59
+ child.stdout.on('data', d => {
60
+ out += d
61
+ for (const line of out.split('\n'))
62
+ try {
63
+ if (JSON.parse(line)?.result?.serverInfo?.name === SERVER) return done(null)
64
+ } catch {}
65
+ })
66
+ child.stdin.write(
67
+ JSON.stringify({
68
+ jsonrpc: '2.0',
69
+ id: 1,
70
+ method: 'initialize',
71
+ params: { protocolVersion: '2025-06-18', capabilities: {}, clientInfo: { name: 'workpad-doctor', version: '1' } },
72
+ }) + '\n',
73
+ )
74
+ })
75
+ }
76
+
77
+ /** The main checkout of a git worktree, or null when `dir` is no worktree (or no repository). */
78
+ export function mainCheckout(dir: string): string | null {
79
+ const git = (...args: string[]) => spawnSync('git', ['-C', dir, ...args], { encoding: 'utf8' })
80
+ const common = git('rev-parse', '--path-format=absolute', '--git-common-dir')
81
+ const own = git('rev-parse', '--path-format=absolute', '--git-dir')
82
+ if (common.status !== 0 || own.status !== 0) return null
83
+ if (common.stdout.trim() === own.stdout.trim()) return null
84
+ return path.dirname(common.stdout.trim())
85
+ }
86
+
87
+ /** Where Claude Code is told to use or not use the project's .mcp.json servers, and what each says of ours. */
88
+ export function approvals(dir: string, home = os.homedir()): Line[] {
89
+ const files: { file: string; read: (v: any) => any }[] = [
90
+ { file: path.join(dir, '.claude', 'settings.json'), read: v => v },
91
+ { file: path.join(dir, '.claude', 'settings.local.json'), read: v => v },
92
+ ]
93
+ const main = mainCheckout(dir)
94
+ if (main && !fs.existsSync(path.join(dir, '.claude', 'settings.local.json')))
95
+ files.push({ file: path.join(main, '.claude', 'settings.local.json'), read: v => v })
96
+ files.push({ file: path.join(home, '.claude', 'settings.json'), read: v => v })
97
+ files.push({ file: path.join(home, '.claude.json'), read: v => v?.projects?.[dir] })
98
+
99
+ const lines: Line[] = []
100
+ let enabled: string | null = null
101
+ const unreadable: string[] = []
102
+ for (const { file, read } of files) {
103
+ const json = readJson(file)
104
+ if (!json) continue
105
+ if (json.value === undefined) {
106
+ unreadable.push(`${file} (${json.why})`)
107
+ continue
108
+ }
109
+ const scope = read(json.value)
110
+ if (!scope) continue
111
+ if (Array.isArray(scope.disabledMcpjsonServers) && scope.disabledMcpjsonServers.includes(SERVER))
112
+ lines.push({
113
+ mark: 'fail',
114
+ text: `the server is disabled in ${file} (disabledMcpjsonServers)`,
115
+ fix: `remove "${SERVER}" from disabledMcpjsonServers there, then restart the session`,
116
+ })
117
+ if (
118
+ !enabled &&
119
+ (scope.enableAllProjectMcpServers === true ||
120
+ (Array.isArray(scope.enabledMcpjsonServers) && scope.enabledMcpjsonServers.includes(SERVER)))
121
+ )
122
+ enabled = file
123
+ }
124
+ for (const file of unreadable)
125
+ lines.push({ mark: 'skip', text: `couldn't read ${file}: a setting there isn't checked` })
126
+ if (!lines.some(l => l.mark === 'fail'))
127
+ lines.push(
128
+ enabled
129
+ ? { mark: 'ok', text: `the server is enabled (${enabled}) and disabled nowhere` }
130
+ : {
131
+ mark: 'fail',
132
+ text: 'the server is approved nowhere: Claude Code asks "New MCP server found" at the next start, and an Esc there disables it',
133
+ fix: `answer "Use this MCP server", or add "enabledMcpjsonServers": ["${SERVER}"] to ${path.join(dir, '.claude', 'settings.local.json')}`,
134
+ },
135
+ )
136
+ return lines
137
+ }
138
+
139
+ /** The claude process's command line and folder. */
140
+ function claudeLaunch(pid: number): { args: string | null; cwd: string | null } {
141
+ const ps = spawnSync('ps', ['-o', 'args=', '-p', String(pid)], { encoding: 'utf8' })
142
+ const lsof = spawnSync('lsof', ['-a', '-p', String(pid), '-d', 'cwd', '-Fn'], { encoding: 'utf8' })
143
+ const cwd = lsof.status === 0 ? (lsof.stdout.split('\n').find(l => l.startsWith('n'))?.slice(1) ?? null) : null
144
+ return { args: ps.status === 0 ? ps.stdout.trim() : null, cwd }
145
+ }
146
+
147
+ /** The workpad version a project pins (its package.json), and the one installed there, when it has them. */
148
+ function pinned(dir: string): { pin: string | null; installed: string | null } {
149
+ const pkg = readJson(path.join(dir, 'package.json'))?.value
150
+ const pin = pkg?.dependencies?.['@bigmistqke/workpad'] ?? pkg?.devDependencies?.['@bigmistqke/workpad'] ?? null
151
+ const installed = readJson(path.join(dir, 'node_modules', '@bigmistqke', 'workpad', 'package.json'))?.value?.version ?? null
152
+ return { pin, installed }
153
+ }
154
+
155
+ export async function doctor(ctx: CommandContext) {
156
+ const dir = ctx.project.dir
157
+ const lines: Line[] = []
158
+
159
+ // 1. the channel in .mcp.json, and its command starts
160
+ const mcpFile = path.join(dir, '.mcp.json')
161
+ const mcp = readJson(mcpFile)
162
+ const entry = mcp?.value?.mcpServers?.[SERVER]
163
+ if (!mcp) lines.push({ mark: 'fail', text: `no ${mcpFile}`, fix: 'workpad claude install' })
164
+ else if (mcp.value === undefined) lines.push({ mark: 'fail', text: `${mcpFile}: ${mcp.why}`, fix: 'fix the file' })
165
+ else if (!entry?.command)
166
+ lines.push({ mark: 'fail', text: `${mcpFile} has no "${SERVER}" server`, fix: 'workpad claude install' })
167
+ else {
168
+ const env = { ...process.env, CLAUDE_PROJECT_DIR: process.env.CLAUDE_PROJECT_DIR ?? dir, ...(entry.env ?? {}) }
169
+ const command = expand(entry.command, env)
170
+ const args = ((entry.args ?? []) as string[]).map(a => expand(a, env))
171
+ const why = await probe(command, args, dir, env)
172
+ const shown = [entry.command, ...(entry.args ?? [])].join(' ')
173
+ lines.push(
174
+ why
175
+ ? { mark: 'fail', text: `the channel's command in ${mcpFile} doesn't answer: ${why}`, fix: `run it by hand to see why: ${shown}` }
176
+ : { mark: 'ok', text: `${mcpFile} has the channel, and its command answers (${shown})` },
177
+ )
178
+ }
179
+
180
+ // 2. enabled, and disabled in no settings scope
181
+ lines.push(...approvals(dir))
182
+
183
+ // 3. the session: started with the flag, from the project's folder
184
+ const pid = claudePid()
185
+ const envSession = process.env.CLAUDE_CODE_SESSION_ID || null
186
+ if (!pid)
187
+ lines.push({
188
+ mark: 'skip',
189
+ text: envSession
190
+ ? "couldn't find the claude process (is ps permitted here?): its launch flag and folder are not checked"
191
+ : 'not run from a Claude Code session: its launch and channel are not checked',
192
+ })
193
+ else {
194
+ const { args, cwd } = claudeLaunch(pid)
195
+ if (args == null) lines.push({ mark: 'skip', text: `couldn't read the command line of claude (pid ${pid})` })
196
+ else if (new RegExp(`${FLAG}(=|\\s+)\\S*server:${SERVER}\\b`).test(args))
197
+ lines.push({ mark: 'ok', text: `the session was started with ${FLAG} server:${SERVER}` })
198
+ else
199
+ lines.push({
200
+ mark: 'fail',
201
+ text: `the session was started without ${FLAG} server:${SERVER}: Claude Code drops what the channel sends`,
202
+ fix: `restart it with: claude ${FLAG} server:${SERVER} (a resume or a restore keeps no flag it wasn't given)`,
203
+ })
204
+ if (cwd == null) lines.push({ mark: 'skip', text: `couldn't read the folder claude (pid ${pid}) runs in` })
205
+ else if (path.resolve(cwd) === dir) lines.push({ mark: 'ok', text: `the session runs in the project's folder` })
206
+ else
207
+ lines.push({
208
+ mark: 'fail',
209
+ text: `the session runs in ${cwd}, not the project's folder: it doesn't see ${mcpFile}`,
210
+ fix: `start claude in ${dir}`,
211
+ })
212
+ }
213
+
214
+ // 4. the server, its version, and a channel for this session; 5. its ping confirmed
215
+ // a server that accepts connections but doesn't answer is said as stuck, not as not running
216
+ let stuckWhy: string | null = null
217
+ const server = await ctx.running().catch(err => ((stuckWhy = (err as Error).message), null))
218
+ const { pin, installed } = pinned(dir)
219
+ if (stuckWhy) lines.push({ mark: 'fail', text: stuckWhy, fix: 'restart the server' })
220
+ else if (!server) lines.push({ mark: 'fail', text: "the project's server isn't running", fix: 'workpad show <page> starts it; a shared server is started outside the sandboxes (workpad serve)' })
221
+ else {
222
+ const expected = installed ?? ctx.version
223
+ lines.push(
224
+ server.version === expected
225
+ ? { mark: 'ok', text: `the server runs at ${server.base}, ${server.version}${pin ? ` (pinned ${pin})` : ''}` }
226
+ : {
227
+ mark: 'fail',
228
+ text: `the server runs ${server.version}, the project ${installed ? `has ${installed} installed` : `runs ${ctx.version}`}${pin ? ` (pinned ${pin})` : ''}`,
229
+ fix: 'restart the server so it runs the installed version',
230
+ },
231
+ )
232
+ // the session as the channel follows it: what the hooks recorded for this claude process, else the environment's
233
+ const session = pid ? (recordedSession(ctx.dataDir, claudeProcess()) ?? envSession) : envSession
234
+ if (pid && !session) lines.push({ mark: 'fail', text: 'no session id: the hooks recorded none and CLAUDE_CODE_SESSION_ID is empty', fix: 'workpad claude install, then restart the session' })
235
+ else if (session) {
236
+ const channels: { session: string; confirmed: boolean }[] | null = await fetch(`${server.base}/api/channels`, {
237
+ headers: { 'x-workpad-token': ctx.token },
238
+ signal: AbortSignal.timeout(5000),
239
+ })
240
+ .then(r => (r.ok ? r.json() : null))
241
+ .catch(() => null)
242
+ const mine = channels?.filter(c => c.session === session) ?? []
243
+ if (!channels) lines.push({ mark: 'skip', text: `the server doesn't list its channels (older than ${ctx.version}?)` })
244
+ else if (!mine.length)
245
+ lines.push({
246
+ mark: 'fail',
247
+ text: `no channel holds a line for this session (${session}) at the server`,
248
+ fix: 'restart the session with the flag; when it has one already, see .workpad/claude/channel.log',
249
+ })
250
+ else {
251
+ lines.push({ mark: 'ok', text: `a channel holds a line for this session (${session})` })
252
+ lines.push(
253
+ mine.some(c => c.confirmed)
254
+ ? { mark: 'ok', text: 'its ping was confirmed: what it pushes reaches the session' }
255
+ : { mark: 'fail', text: 'its ping was never confirmed: it listens on no page yet', fix: 'workpad agent ping, and confirm the pong it pushes' },
256
+ )
257
+ // it follows the pages the session is subscribed to, and no other: say which, so none isn't taken for all
258
+ const pages = (await ctx.status().catch(() => [])).filter(p => p.subscribers.includes(session)).map(p => p.page)
259
+ lines.push({
260
+ mark: 'skip',
261
+ text: pages.length
262
+ ? `it follows ${pages.length} page${pages.length > 1 ? 's' : ''}, those this session is subscribed to: ${pages.join(', ')}`
263
+ : 'it follows no page: only those this session made (workpad new) or listened on by name (listen --page) are its own',
264
+ })
265
+ }
266
+ }
267
+ }
268
+
269
+ const sign: Record<Mark, string> = { ok: '✓', fail: '✗', skip: '–' }
270
+ for (const l of lines) console.log(`${sign[l.mark]} ${l.text}${l.fix ? `\n → ${l.fix}` : ''}`)
271
+ const failed = lines.filter(l => l.mark === 'fail').length
272
+ console.log(failed ? `\n${failed} to fix.` : '\nThe channel has what it needs.')
273
+ if (failed) process.exitCode = 1
274
+ }