@skillcdn/console 0.5.0 → 0.5.2

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 (490) hide show
  1. package/README.md +87 -12
  2. package/SKILLCDN.md +3 -3
  3. package/dist/agent-page.d.ts.map +1 -1
  4. package/dist/agent-page.js +7 -6
  5. package/dist/agent-page.js.map +1 -1
  6. package/dist/api.d.ts +9 -7
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +8 -6
  9. package/dist/api.js.map +1 -1
  10. package/dist/charts.d.ts +103 -0
  11. package/dist/charts.d.ts.map +1 -0
  12. package/dist/charts.js +182 -0
  13. package/dist/charts.js.map +1 -0
  14. package/dist/cli/cli.d.ts +58 -2
  15. package/dist/cli/cli.d.ts.map +1 -1
  16. package/dist/cli/cli.js +1742 -472
  17. package/dist/cli/cli.js.map +1 -1
  18. package/dist/cli/command-words.d.ts +20 -0
  19. package/dist/cli/command-words.d.ts.map +1 -0
  20. package/dist/cli/command-words.js +51 -0
  21. package/dist/cli/command-words.js.map +1 -0
  22. package/dist/cli/credentials.d.ts +54 -5
  23. package/dist/cli/credentials.d.ts.map +1 -1
  24. package/dist/cli/credentials.js +126 -20
  25. package/dist/cli/credentials.js.map +1 -1
  26. package/dist/cli/directory.d.ts +19 -4
  27. package/dist/cli/directory.d.ts.map +1 -1
  28. package/dist/cli/directory.js +16 -8
  29. package/dist/cli/directory.js.map +1 -1
  30. package/dist/cli/format.d.ts +70 -9
  31. package/dist/cli/format.d.ts.map +1 -1
  32. package/dist/cli/format.js +267 -40
  33. package/dist/cli/format.js.map +1 -1
  34. package/dist/cli/help.d.ts +13 -4
  35. package/dist/cli/help.d.ts.map +1 -1
  36. package/dist/cli/help.js +101 -58
  37. package/dist/cli/help.js.map +1 -1
  38. package/dist/cli/machine-check.d.ts +36 -0
  39. package/dist/cli/machine-check.d.ts.map +1 -0
  40. package/dist/cli/machine-check.js +151 -0
  41. package/dist/cli/machine-check.js.map +1 -0
  42. package/dist/cli/main.js +76 -2
  43. package/dist/cli/main.js.map +1 -1
  44. package/dist/cli/pack.d.ts +69 -60
  45. package/dist/cli/pack.d.ts.map +1 -1
  46. package/dist/cli/pack.js +241 -270
  47. package/dist/cli/pack.js.map +1 -1
  48. package/dist/cli/plugin-check.d.ts +42 -0
  49. package/dist/cli/plugin-check.d.ts.map +1 -1
  50. package/dist/cli/plugin-check.js +221 -36
  51. package/dist/cli/plugin-check.js.map +1 -1
  52. package/dist/cli/plugin-cli.d.ts +6 -1
  53. package/dist/cli/plugin-cli.d.ts.map +1 -1
  54. package/dist/cli/plugin-cli.js +21 -4
  55. package/dist/cli/plugin-cli.js.map +1 -1
  56. package/dist/cli/plugin-main.js +1 -0
  57. package/dist/cli/plugin-main.js.map +1 -1
  58. package/dist/cli/runner-host.d.ts +7 -0
  59. package/dist/cli/runner-host.d.ts.map +1 -1
  60. package/dist/cli/runner-host.js +2 -0
  61. package/dist/cli/runner-host.js.map +1 -1
  62. package/dist/cli/secret-notes.d.ts +8 -0
  63. package/dist/cli/secret-notes.d.ts.map +1 -0
  64. package/dist/cli/secret-notes.js +48 -0
  65. package/dist/cli/secret-notes.js.map +1 -0
  66. package/dist/cli/serve.d.ts +33 -1
  67. package/dist/cli/serve.d.ts.map +1 -1
  68. package/dist/cli/serve.js +252 -3
  69. package/dist/cli/serve.js.map +1 -1
  70. package/dist/client.d.ts +54 -9
  71. package/dist/client.d.ts.map +1 -1
  72. package/dist/client.js +77 -80
  73. package/dist/client.js.map +1 -1
  74. package/dist/components/agent-page.d.ts +164 -8
  75. package/dist/components/agent-page.d.ts.map +1 -1
  76. package/dist/components/agent-page.js +588 -151
  77. package/dist/components/agent-page.js.map +1 -1
  78. package/dist/components/agents.d.ts.map +1 -1
  79. package/dist/components/agents.js +1 -1
  80. package/dist/components/agents.js.map +1 -1
  81. package/dist/components/board.d.ts.map +1 -1
  82. package/dist/components/board.js +3 -2
  83. package/dist/components/board.js.map +1 -1
  84. package/dist/components/categories.js +1 -1
  85. package/dist/components/categories.js.map +1 -1
  86. package/dist/components/charts.d.ts +157 -0
  87. package/dist/components/charts.d.ts.map +1 -0
  88. package/dist/components/charts.js +182 -0
  89. package/dist/components/charts.js.map +1 -0
  90. package/dist/components/decision-list.d.ts.map +1 -1
  91. package/dist/components/decision-list.js +1 -1
  92. package/dist/components/decision-list.js.map +1 -1
  93. package/dist/components/desk-records.d.ts +102 -0
  94. package/dist/components/desk-records.d.ts.map +1 -0
  95. package/dist/components/desk-records.js +221 -0
  96. package/dist/components/desk-records.js.map +1 -0
  97. package/dist/components/desk.d.ts +85 -0
  98. package/dist/components/desk.d.ts.map +1 -0
  99. package/dist/components/desk.js +135 -0
  100. package/dist/components/desk.js.map +1 -0
  101. package/dist/components/event-feed.d.ts.map +1 -1
  102. package/dist/components/event-feed.js +7 -3
  103. package/dist/components/event-feed.js.map +1 -1
  104. package/dist/components/goals.d.ts +2 -0
  105. package/dist/components/goals.d.ts.map +1 -1
  106. package/dist/components/goals.js +1 -1
  107. package/dist/components/goals.js.map +1 -1
  108. package/dist/components/home.d.ts.map +1 -1
  109. package/dist/components/home.js +14 -6
  110. package/dist/components/home.js.map +1 -1
  111. package/dist/components/icon.d.ts +31 -0
  112. package/dist/components/icon.d.ts.map +1 -0
  113. package/dist/components/icon.js +169 -0
  114. package/dist/components/icon.js.map +1 -0
  115. package/dist/components/markdown.d.ts +6 -0
  116. package/dist/components/markdown.d.ts.map +1 -1
  117. package/dist/components/markdown.js +10 -2
  118. package/dist/components/markdown.js.map +1 -1
  119. package/dist/components/people.js +1 -1
  120. package/dist/components/people.js.map +1 -1
  121. package/dist/components/plugin-frame.d.ts.map +1 -1
  122. package/dist/components/plugin-frame.js +7 -0
  123. package/dist/components/plugin-frame.js.map +1 -1
  124. package/dist/components/plugin-settings.d.ts.map +1 -1
  125. package/dist/components/plugin-settings.js +54 -3
  126. package/dist/components/plugin-settings.js.map +1 -1
  127. package/dist/components/projects.d.ts +17 -4
  128. package/dist/components/projects.d.ts.map +1 -1
  129. package/dist/components/projects.js +51 -12
  130. package/dist/components/projects.js.map +1 -1
  131. package/dist/components/rules.d.ts +8 -10
  132. package/dist/components/rules.d.ts.map +1 -1
  133. package/dist/components/rules.js +35 -13
  134. package/dist/components/rules.js.map +1 -1
  135. package/dist/components/sessions.d.ts.map +1 -1
  136. package/dist/components/sessions.js +3 -2
  137. package/dist/components/sessions.js.map +1 -1
  138. package/dist/components/setup.d.ts +9 -3
  139. package/dist/components/setup.d.ts.map +1 -1
  140. package/dist/components/setup.js +12 -6
  141. package/dist/components/setup.js.map +1 -1
  142. package/dist/components/shell.d.ts.map +1 -1
  143. package/dist/components/shell.js +3 -2
  144. package/dist/components/shell.js.map +1 -1
  145. package/dist/components/tokens.js +1 -1
  146. package/dist/components/tokens.js.map +1 -1
  147. package/dist/components/ui.d.ts +5 -2
  148. package/dist/components/ui.d.ts.map +1 -1
  149. package/dist/components/ui.js +10 -7
  150. package/dist/components/ui.js.map +1 -1
  151. package/dist/connect-page.js +1 -1
  152. package/dist/connect-page.js.map +1 -1
  153. package/dist/console.css +1172 -106
  154. package/dist/console.d.ts +5 -0
  155. package/dist/console.d.ts.map +1 -1
  156. package/dist/console.js +52 -39
  157. package/dist/console.js.map +1 -1
  158. package/dist/data.d.ts.map +1 -1
  159. package/dist/data.js +32 -33
  160. package/dist/data.js.map +1 -1
  161. package/dist/desk-page.d.ts +38 -0
  162. package/dist/desk-page.d.ts.map +1 -0
  163. package/dist/desk-page.js +184 -0
  164. package/dist/desk-page.js.map +1 -0
  165. package/dist/desk-records-page.d.ts +18 -0
  166. package/dist/desk-records-page.d.ts.map +1 -0
  167. package/dist/desk-records-page.js +130 -0
  168. package/dist/desk-records-page.js.map +1 -0
  169. package/dist/desk-records.d.ts +247 -0
  170. package/dist/desk-records.d.ts.map +1 -0
  171. package/dist/desk-records.js +543 -0
  172. package/dist/desk-records.js.map +1 -0
  173. package/dist/desk.d.ts +122 -0
  174. package/dist/desk.d.ts.map +1 -0
  175. package/dist/desk.js +211 -0
  176. package/dist/desk.js.map +1 -0
  177. package/dist/feed-stream.d.ts +39 -0
  178. package/dist/feed-stream.d.ts.map +1 -0
  179. package/dist/feed-stream.js +117 -0
  180. package/dist/feed-stream.js.map +1 -0
  181. package/dist/home-tiles.d.ts +19 -3
  182. package/dist/home-tiles.d.ts.map +1 -1
  183. package/dist/home-tiles.js +147 -42
  184. package/dist/home-tiles.js.map +1 -1
  185. package/dist/i18n/en.d.ts +228 -6
  186. package/dist/i18n/en.d.ts.map +1 -1
  187. package/dist/i18n/en.js +309 -9
  188. package/dist/i18n/en.js.map +1 -1
  189. package/dist/i18n/ko.d.ts.map +1 -1
  190. package/dist/i18n/ko.js +366 -85
  191. package/dist/i18n/ko.js.map +1 -1
  192. package/dist/i18n/particles.d.ts +7 -0
  193. package/dist/i18n/particles.d.ts.map +1 -0
  194. package/dist/i18n/particles.js +72 -0
  195. package/dist/i18n/particles.js.map +1 -0
  196. package/dist/icons/glyphs.d.ts +605 -0
  197. package/dist/icons/glyphs.d.ts.map +1 -0
  198. package/dist/icons/glyphs.js +104 -0
  199. package/dist/icons/glyphs.js.map +1 -0
  200. package/dist/icons/index.d.ts +59 -0
  201. package/dist/icons/index.d.ts.map +1 -0
  202. package/dist/icons/index.js +157 -0
  203. package/dist/icons/index.js.map +1 -0
  204. package/dist/index.d.ts +9 -0
  205. package/dist/index.d.ts.map +1 -1
  206. package/dist/index.js +9 -0
  207. package/dist/index.js.map +1 -1
  208. package/dist/limits.d.ts +20 -0
  209. package/dist/limits.d.ts.map +1 -1
  210. package/dist/limits.js +20 -0
  211. package/dist/limits.js.map +1 -1
  212. package/dist/marks.d.ts +9 -0
  213. package/dist/marks.d.ts.map +1 -1
  214. package/dist/marks.js +9 -0
  215. package/dist/marks.js.map +1 -1
  216. package/dist/onboarding.d.ts +6 -0
  217. package/dist/onboarding.d.ts.map +1 -1
  218. package/dist/onboarding.js +5 -5
  219. package/dist/onboarding.js.map +1 -1
  220. package/dist/plugin/context.d.ts +42 -11
  221. package/dist/plugin/context.d.ts.map +1 -1
  222. package/dist/plugin/limits.d.ts +2 -0
  223. package/dist/plugin/limits.d.ts.map +1 -1
  224. package/dist/plugin/limits.js +2 -0
  225. package/dist/plugin/limits.js.map +1 -1
  226. package/dist/plugin/manifest.d.ts +13 -0
  227. package/dist/plugin/manifest.d.ts.map +1 -1
  228. package/dist/plugin/manifest.js +30 -3
  229. package/dist/plugin/manifest.js.map +1 -1
  230. package/dist/plugin/rest-schemas.d.ts +55 -0
  231. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  232. package/dist/plugin/rest-schemas.js +37 -0
  233. package/dist/plugin/rest-schemas.js.map +1 -1
  234. package/dist/plugin/sandbox.d.ts.map +1 -1
  235. package/dist/plugin/sandbox.js +4 -1
  236. package/dist/plugin/sandbox.js.map +1 -1
  237. package/dist/plugin/testing.d.ts +6 -2
  238. package/dist/plugin/testing.d.ts.map +1 -1
  239. package/dist/plugin/testing.js +52 -10
  240. package/dist/plugin/testing.js.map +1 -1
  241. package/dist/plugin/web.d.ts +3 -0
  242. package/dist/plugin/web.d.ts.map +1 -1
  243. package/dist/plugin/web.js +5 -1
  244. package/dist/plugin/web.js.map +1 -1
  245. package/dist/plugin.d.ts +1 -1
  246. package/dist/plugin.d.ts.map +1 -1
  247. package/dist/plugin.js +1 -1
  248. package/dist/plugin.js.map +1 -1
  249. package/dist/records.d.ts +283 -0
  250. package/dist/records.d.ts.map +1 -0
  251. package/dist/records.js +543 -0
  252. package/dist/records.js.map +1 -0
  253. package/dist/routes.d.ts +3 -1
  254. package/dist/routes.d.ts.map +1 -1
  255. package/dist/routes.js +3 -1
  256. package/dist/routes.js.map +1 -1
  257. package/dist/rules.d.ts +30 -11
  258. package/dist/rules.d.ts.map +1 -1
  259. package/dist/rules.js +98 -45
  260. package/dist/rules.js.map +1 -1
  261. package/dist/runner/acp.d.ts +1 -1
  262. package/dist/runner/acp.d.ts.map +1 -1
  263. package/dist/runner/acp.js +32 -21
  264. package/dist/runner/acp.js.map +1 -1
  265. package/dist/runner/awake.d.ts +35 -0
  266. package/dist/runner/awake.d.ts.map +1 -0
  267. package/dist/runner/awake.js +95 -0
  268. package/dist/runner/awake.js.map +1 -0
  269. package/dist/runner/claude.d.ts +1 -1
  270. package/dist/runner/claude.d.ts.map +1 -1
  271. package/dist/runner/claude.js +100 -18
  272. package/dist/runner/claude.js.map +1 -1
  273. package/dist/runner/codex.d.ts +1 -1
  274. package/dist/runner/codex.d.ts.map +1 -1
  275. package/dist/runner/codex.js +20 -17
  276. package/dist/runner/codex.js.map +1 -1
  277. package/dist/runner/config.d.ts +5 -0
  278. package/dist/runner/config.d.ts.map +1 -1
  279. package/dist/runner/config.js +9 -0
  280. package/dist/runner/config.js.map +1 -1
  281. package/dist/runner/desk.d.ts +43 -2
  282. package/dist/runner/desk.d.ts.map +1 -1
  283. package/dist/runner/desk.js +168 -13
  284. package/dist/runner/desk.js.map +1 -1
  285. package/dist/runner/process.d.ts.map +1 -1
  286. package/dist/runner/process.js +11 -4
  287. package/dist/runner/process.js.map +1 -1
  288. package/dist/runner/redact.d.ts +39 -4
  289. package/dist/runner/redact.d.ts.map +1 -1
  290. package/dist/runner/redact.js +81 -5
  291. package/dist/runner/redact.js.map +1 -1
  292. package/dist/runner/runner.d.ts +28 -3
  293. package/dist/runner/runner.d.ts.map +1 -1
  294. package/dist/runner/runner.js +371 -54
  295. package/dist/runner/runner.js.map +1 -1
  296. package/dist/runner/slack.d.ts.map +1 -1
  297. package/dist/runner/slack.js +10 -4
  298. package/dist/runner/slack.js.map +1 -1
  299. package/dist/runner/task-scheduler.d.ts +20 -0
  300. package/dist/runner/task-scheduler.d.ts.map +1 -1
  301. package/dist/runner/task-scheduler.js +34 -4
  302. package/dist/runner/task-scheduler.js.map +1 -1
  303. package/dist/runner/types.d.ts +51 -1
  304. package/dist/runner/types.d.ts.map +1 -1
  305. package/dist/runner/types.js +26 -0
  306. package/dist/runner/types.js.map +1 -1
  307. package/dist/runner.d.ts +6 -6
  308. package/dist/runner.d.ts.map +1 -1
  309. package/dist/runner.js +5 -5
  310. package/dist/runner.js.map +1 -1
  311. package/dist/schemas.d.ts +603 -6
  312. package/dist/schemas.d.ts.map +1 -1
  313. package/dist/schemas.js +156 -20
  314. package/dist/schemas.js.map +1 -1
  315. package/dist/services.d.ts +22 -5
  316. package/dist/services.d.ts.map +1 -1
  317. package/dist/services.js +41 -17
  318. package/dist/services.js.map +1 -1
  319. package/dist/setup-guide.d.ts +17 -4
  320. package/dist/setup-guide.d.ts.map +1 -1
  321. package/dist/setup-guide.js +48 -41
  322. package/dist/setup-guide.js.map +1 -1
  323. package/dist/tokens.d.ts.map +1 -1
  324. package/dist/tokens.js +5 -1
  325. package/dist/tokens.js.map +1 -1
  326. package/dist/vocabulary.d.ts +21 -3
  327. package/dist/vocabulary.d.ts.map +1 -1
  328. package/dist/vocabulary.js +19 -3
  329. package/dist/vocabulary.js.map +1 -1
  330. package/docs/specs/cli.md +73 -44
  331. package/docs/specs/plugins.md +40 -22
  332. package/docs/specs/records.md +113 -0
  333. package/docs/specs/rest.md +30 -21
  334. package/docs/specs/runner.md +46 -22
  335. package/package.json +11 -2
  336. package/skills/building-a-console/SKILL.md +4 -4
  337. package/skills/building-a-plugin/SKILL.md +6 -6
  338. package/skills/deploying-a-console/SKILL.md +4 -4
  339. package/skills/deploying-a-console/references/resources.md +41 -4
  340. package/skills/deploying-a-console/references/running-it-again.md +3 -2
  341. package/skills/keeping-a-desk/SKILL.md +133 -0
  342. package/skills/keeping-a-desk/collections.md +96 -0
  343. package/skills/planning-the-board/SKILL.md +14 -18
  344. package/skills/planning-the-board/references/a-task.md +2 -2
  345. package/skills/planning-the-board/references/project-rules.md +13 -14
  346. package/skills/planning-the-board/references/setting-up.md +15 -13
  347. package/skills/running-an-agent/SKILL.md +47 -56
  348. package/skills/working-the-board/SKILL.md +63 -44
  349. package/skills/working-the-board/references/terms.md +9 -5
  350. package/skills/working-the-board/references/the-pack.md +12 -10
  351. package/skills/working-the-board/references/the-sentence.md +2 -2
  352. package/src/agent-page.tsx +16 -2
  353. package/src/api.ts +109 -3
  354. package/src/charts.ts +250 -0
  355. package/src/cli/cli.ts +2226 -580
  356. package/src/cli/command-words.ts +56 -0
  357. package/src/cli/credentials.ts +181 -20
  358. package/src/cli/directory.ts +28 -10
  359. package/src/cli/format.ts +332 -49
  360. package/src/cli/help.ts +113 -57
  361. package/src/cli/machine-check.ts +223 -0
  362. package/src/cli/main.ts +72 -2
  363. package/src/cli/pack.ts +333 -372
  364. package/src/cli/plugin-check.ts +275 -34
  365. package/src/cli/plugin-cli.ts +28 -4
  366. package/src/cli/plugin-main.ts +1 -0
  367. package/src/cli/runner-host.ts +8 -0
  368. package/src/cli/secret-notes.ts +63 -0
  369. package/src/cli/serve.ts +295 -2
  370. package/src/client.ts +215 -177
  371. package/src/components/agent-page.tsx +1044 -281
  372. package/src/components/agents.tsx +9 -5
  373. package/src/components/board.tsx +3 -15
  374. package/src/components/categories.tsx +2 -2
  375. package/src/components/charts.tsx +680 -0
  376. package/src/components/decision-list.tsx +11 -7
  377. package/src/components/desk-records.tsx +724 -0
  378. package/src/components/desk.tsx +471 -0
  379. package/src/components/event-feed.tsx +12 -3
  380. package/src/components/goals.tsx +33 -25
  381. package/src/components/home.tsx +42 -6
  382. package/src/components/icon.tsx +337 -0
  383. package/src/components/markdown.tsx +22 -2
  384. package/src/components/people.tsx +1 -1
  385. package/src/components/plugin-frame.tsx +7 -0
  386. package/src/components/plugin-settings.tsx +171 -12
  387. package/src/components/projects.tsx +68 -17
  388. package/src/components/rules.tsx +94 -34
  389. package/src/components/sessions.tsx +2 -13
  390. package/src/components/setup.tsx +20 -5
  391. package/src/components/shell.tsx +3 -20
  392. package/src/components/tokens.tsx +1 -1
  393. package/src/components/ui.tsx +16 -8
  394. package/src/connect-page.tsx +1 -1
  395. package/src/console.tsx +104 -62
  396. package/src/data.ts +37 -34
  397. package/src/desk-page.tsx +332 -0
  398. package/src/desk-records-page.tsx +256 -0
  399. package/src/desk-records.ts +808 -0
  400. package/src/desk.ts +329 -0
  401. package/src/feed-stream.ts +144 -0
  402. package/src/home-tiles.ts +170 -46
  403. package/src/i18n/en.ts +323 -11
  404. package/src/i18n/ko.ts +378 -87
  405. package/src/i18n/particles.ts +79 -0
  406. package/src/icons/glyphs.ts +112 -0
  407. package/src/icons/index.ts +195 -0
  408. package/src/index.ts +125 -0
  409. package/src/limits.ts +20 -0
  410. package/src/marks.ts +12 -0
  411. package/src/onboarding.ts +14 -6
  412. package/src/plugin/context.ts +55 -12
  413. package/src/plugin/limits.ts +2 -0
  414. package/src/plugin/manifest.ts +38 -2
  415. package/src/plugin/rest-schemas.ts +41 -0
  416. package/src/plugin/sandbox.ts +4 -1
  417. package/src/plugin/testing.ts +63 -12
  418. package/src/plugin/web.ts +9 -2
  419. package/src/plugin.ts +2 -0
  420. package/src/records.ts +702 -0
  421. package/src/routes.ts +3 -1
  422. package/src/rules.ts +108 -47
  423. package/src/runner/acp.ts +49 -30
  424. package/src/runner/awake.ts +135 -0
  425. package/src/runner/claude.ts +131 -26
  426. package/src/runner/codex.ts +37 -26
  427. package/src/runner/config.ts +9 -0
  428. package/src/runner/desk.ts +200 -15
  429. package/src/runner/process.ts +11 -4
  430. package/src/runner/redact.ts +92 -6
  431. package/src/runner/runner.ts +457 -56
  432. package/src/runner/slack.ts +10 -4
  433. package/src/runner/task-scheduler.ts +36 -4
  434. package/src/runner/types.ts +67 -1
  435. package/src/runner.ts +27 -2
  436. package/src/schemas.ts +177 -18
  437. package/src/services.ts +55 -16
  438. package/src/setup-guide.ts +49 -40
  439. package/src/styles/README.md +16 -5
  440. package/src/styles/base.css +17 -0
  441. package/src/styles/console.css +10 -0
  442. package/src/styles/drawn-by-pages.json +1 -1
  443. package/src/styles/pages/agents.css +103 -1
  444. package/src/styles/pages/board.css +0 -10
  445. package/src/styles/pages/calendar.css +1 -1
  446. package/src/styles/pages/connect.css +0 -10
  447. package/src/styles/pages/decisions.css +3 -1
  448. package/src/styles/pages/desk.css +126 -0
  449. package/src/styles/pages/documents.css +5 -0
  450. package/src/styles/pages/feed.css +5 -2
  451. package/src/styles/pages/home.css +5 -0
  452. package/src/styles/pages/roadmap.css +2 -2
  453. package/src/styles/pages/settings.css +11 -0
  454. package/src/styles/pages/task.css +0 -20
  455. package/src/styles/pages/thread.css +1 -1
  456. package/src/styles/parts/bars.css +80 -0
  457. package/src/styles/parts/calendar.css +1 -1
  458. package/src/styles/parts/callout.css +1 -0
  459. package/src/styles/parts/chart.css +173 -0
  460. package/src/styles/parts/detail.css +22 -0
  461. package/src/styles/parts/empty.css +2 -0
  462. package/src/styles/parts/eyebrow.css +1 -1
  463. package/src/styles/parts/facts.css +1 -1
  464. package/src/styles/parts/figures.css +65 -0
  465. package/src/styles/parts/form.css +2 -1
  466. package/src/styles/parts/icon.css +191 -0
  467. package/src/styles/parts/input.css +14 -4
  468. package/src/styles/parts/legend.css +48 -0
  469. package/src/styles/parts/mark.css +36 -0
  470. package/src/styles/parts/menu.css +1 -7
  471. package/src/styles/parts/page.css +1 -1
  472. package/src/styles/parts/panel.css +10 -0
  473. package/src/styles/parts/person.css +5 -2
  474. package/src/styles/parts/progress.css +5 -2
  475. package/src/styles/parts/rows.css +1 -0
  476. package/src/styles/parts/series.css +32 -0
  477. package/src/styles/parts/settings.css +5 -0
  478. package/src/styles/parts/share.css +25 -0
  479. package/src/styles/parts/spark.css +23 -0
  480. package/src/styles/parts/stat.css +69 -0
  481. package/src/styles/tokens.css +31 -10
  482. package/src/tokens.ts +5 -1
  483. package/src/vocabulary.ts +25 -3
  484. package/template/desk-web/README.md +8 -0
  485. package/template/desk-web/index.html +13 -0
  486. package/template/desk-web/package.json +25 -0
  487. package/template/desk-web/src/main.tsx +24 -0
  488. package/template/desk-web/src/page.tsx +51 -0
  489. package/template/desk-web/tsconfig.json +16 -0
  490. package/template/desk-web/vite.config.ts +15 -0
@@ -1,9 +1,10 @@
1
1
  // `console-plugin check` (docs/specs/plugins.md, "Authoring"): reads a plugin's package as the
2
2
  // console would and names everything a console, or a store, would refuse it for: the manifest,
3
3
  // the package's own manifest, the server module under the host's hardening and against the
4
- // manifest, the web bundle's self-containment and its classes, the skills, the migrations.
4
+ // manifest, the web bundle's self-containment and its classes, held to the console's parts, the
5
+ // skills, the migrations.
5
6
  import { readdir, readFile, stat } from "node:fs/promises";
6
- import { join, posix } from "node:path";
7
+ import { join, posix, relative, sep } from "node:path";
7
8
  import { descriptionProblems, type PluginDescription } from "../plugin/define.js";
8
9
  import type { ServerLoad } from "../plugin/load.js";
9
10
  import {
@@ -81,14 +82,96 @@ export function coveredByFiles(files: readonly string[], path: string): boolean
81
82
  });
82
83
  }
83
84
 
85
+ /**
86
+ * The most the check reads of one file of a plugin's package, in bytes: 4 MiB. A file is read
87
+ * whole, into memory and through every reader here, and a plugin's files are a fraction of
88
+ * that: the example's server module, with everything it bundles, is under 1 MiB, the script of
89
+ * its pages a few dozen KiB. One beyond the bound is refused by its size and not read. The
90
+ * readers themselves take a time that grows with a file's size, whatever it holds: a bound on
91
+ * the size bounds nothing where a reader tries again from every place it could have begun.
92
+ */
93
+ export const MAX_CHECKED_FILE_BYTES = 4 * 1024 * 1024;
94
+
95
+ /** What is said of a file beyond the bound, in the words of a problem. */
96
+ const tooLarge = (file: string, bytes: number): string =>
97
+ `${file} is ${bytes} bytes: the check reads a file of up to ${MAX_CHECKED_FILE_BYTES / (1024 * 1024)} MiB (${MAX_CHECKED_FILE_BYTES} bytes) whole, and did not read this one`;
98
+
99
+ /** A file of the package as text; or nothing of one that is not there, and its size of one too large to read whole. */
100
+ async function readWhole(
101
+ path: string,
102
+ ): Promise<{ readonly text: string } | { readonly bytes: number } | null> {
103
+ try {
104
+ const found = await stat(path);
105
+ if (!found.isFile()) {
106
+ return null;
107
+ }
108
+ if (found.size > MAX_CHECKED_FILE_BYTES) {
109
+ return { bytes: found.size };
110
+ }
111
+ return { text: await readFile(path, "utf8") };
112
+ } catch {
113
+ return null;
114
+ }
115
+ }
116
+
117
+ /** A file of the package as one check reads it: its text, or that it is not there, or that it was refused by its size. */
118
+ type PackageFile = { readonly text: string } | "missing" | "refused";
119
+
120
+ /**
121
+ * The reader of one check: a file of the package by its path under the root, as the manifest
122
+ * writes it and a problem names it. A file beyond the bound is a problem said once, however
123
+ * often the check comes to it, and is not read.
124
+ */
125
+ function packageReader(root: string, errors: string[]): (file: string) => Promise<PackageFile> {
126
+ const refused = new Set<string>();
127
+ return async (file) => {
128
+ const read = await readWhole(join(root, file));
129
+ if (read === null) {
130
+ return "missing";
131
+ }
132
+ if ("bytes" in read) {
133
+ if (!refused.has(file)) {
134
+ refused.add(file);
135
+ errors.push(tooLarge(file, read.bytes));
136
+ }
137
+ return "refused";
138
+ }
139
+ return read;
140
+ };
141
+ }
142
+
84
143
  /** A class selector: a dot not after a digit or another dot (0.5em is a number), then a name. */
85
144
  const CLASS_SELECTOR = /(?<![\d.])\.(-?[A-Za-z_][\w-]*)/g;
86
145
 
146
+ /**
147
+ * A stylesheet without its comments, read from one end to the other once: a comment opened and
148
+ * never closed takes the rest of the sheet with it, as a browser reads it. An expression that
149
+ * looks for the closing of each would look to the end of the sheet again for every one opened.
150
+ */
151
+ function withoutComments(css: string): string {
152
+ const kept: string[] = [];
153
+ let at = 0;
154
+ for (;;) {
155
+ const open = css.indexOf("/*", at);
156
+ if (open < 0) {
157
+ kept.push(css.slice(at));
158
+ break;
159
+ }
160
+ kept.push(css.slice(at, open));
161
+ const close = css.indexOf("*/", open + 2);
162
+ if (close < 0) {
163
+ break;
164
+ }
165
+ at = close + 2;
166
+ }
167
+ return kept.join("");
168
+ }
169
+
87
170
  /** The classes a stylesheet styles, each once; comments and quoted strings are not read. */
88
171
  export function classesIn(css: string): string[] {
89
- const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/"[^"]*"|'[^']*'/g, '""');
172
+ const bare = withoutComments(css).replace(/"[^"]*"|'[^']*'/g, '""');
90
173
  const found = new Set<string>();
91
- for (const match of withoutComments.matchAll(CLASS_SELECTOR)) {
174
+ for (const match of bare.matchAll(CLASS_SELECTOR)) {
92
175
  if (match[1] !== undefined && !/^\d/.test(match[1])) {
93
176
  found.add(match[1]);
94
177
  }
@@ -96,7 +179,116 @@ export function classesIn(css: string): string[] {
96
179
  return [...found];
97
180
  }
98
181
 
99
- const WEB_IMPORT = /(?:\bfrom\s*|\bimport\s*\(?\s*|\bexport\s+\*\s+from\s*)["'`]([^"'`]+)["'`]/g;
182
+ /**
183
+ * The classes of the console's stylesheet, as the package ships its sources (ADR-0106): the
184
+ * parts, which a plugin's pages are built from as the console's own are, and the classes of the
185
+ * console's own pages, which lay one page out and are that page's alone. The list is the
186
+ * catalogue itself, `src/styles/README.md` of the package, and the pages' files beside it:
187
+ * nothing is copied, so that a part added to the catalogue is one a plugin may use at once.
188
+ */
189
+ export interface ConsoleClasses {
190
+ /** Whether a row of the catalogue names the class: `sc-button*` is `sc-button` and every `sc-button-...`. */
191
+ isPart(name: string): boolean;
192
+ /** Whether a part's class begins so, for a name a bundle finishes itself: `sc-badge-` and a tone. */
193
+ beginsPart(stem: string): boolean;
194
+ /** Whether the class is one of the console's own pages', which no part is. */
195
+ isPagesOwn(name: string): boolean;
196
+ }
197
+
198
+ /** Reads the catalogue's rows and the pages' stylesheets into the classes a plugin is held to. */
199
+ export function consoleClassesOf(catalogue: string, pageSheets: readonly string[]): ConsoleClasses {
200
+ const exact = new Set<string>();
201
+ const stems: string[] = [];
202
+ const lines = catalogue.split(/\r?\n/);
203
+ const from = lines.findIndex((line) => line.trim() === "## The catalogue");
204
+ const after = lines.findIndex((line, index) => index > from && line.startsWith("## "));
205
+ for (const line of from < 0 ? [] : lines.slice(from + 1, after < 0 ? undefined : after)) {
206
+ // A row of the table: the part, its classes, what renders it, what it is for.
207
+ const cells = line.startsWith("|") ? line.split("|") : [];
208
+ for (const match of (cells[2] ?? "").matchAll(/`(sc-[a-z0-9-]+)(\*?)`/g)) {
209
+ if (match[2] === "*") {
210
+ stems.push(match[1] ?? "");
211
+ } else {
212
+ exact.add(match[1] ?? "");
213
+ }
214
+ }
215
+ }
216
+ const isPart = (name: string): boolean =>
217
+ exact.has(name) || stems.some((stem) => name === stem || name.startsWith(`${stem}-`));
218
+ const ofPages = new Set(pageSheets.flatMap((css) => classesIn(css)));
219
+ return {
220
+ isPart,
221
+ beginsPart: (stem) =>
222
+ [...exact].some((name) => name.startsWith(stem)) ||
223
+ stems.some((part) => `${part}-`.startsWith(stem) || stem.startsWith(`${part}-`)),
224
+ isPagesOwn: (name) => ofPages.has(name) && !isPart(name),
225
+ };
226
+ }
227
+
228
+ /** The catalogue and the pages' files of the package whose styles are in `stylesDir`. */
229
+ export async function readConsoleClasses(stylesDir: string): Promise<ConsoleClasses> {
230
+ const catalogue = await readFile(join(stylesDir, "README.md"), "utf8");
231
+ const pages = (await readdir(join(stylesDir, "pages"))).filter((name) => name.endsWith(".css"));
232
+ return consoleClassesOf(
233
+ catalogue,
234
+ await Promise.all(pages.map((name) => readFile(join(stylesDir, "pages", name), "utf8"))),
235
+ );
236
+ }
237
+
238
+ /**
239
+ * A name in the console's own prefix, as a script holds one: `sc-` not inside a longer word nor
240
+ * a custom property (`--sc-color-text` is a token), then the name, with the hyphen it ends on
241
+ * where the script finishes it itself (`sc-badge-` and a tone). The expression takes the run of
242
+ * letters, digits and hyphens whole, and the name ends in it at the first hyphen doubled: an
243
+ * expression that takes it a word and a hyphen at a time keeps a place for each, and a name of
244
+ * some megabytes was more places than it has.
245
+ */
246
+ const CONSOLE_NAME = /(?<![\w-])sc-[a-z][a-z0-9-]*/g;
247
+
248
+ /** The names in the console's prefix a script holds, each once. */
249
+ export function consoleNamesIn(script: string): string[] {
250
+ const found = new Set<string>();
251
+ for (const [run] of script.matchAll(CONSOLE_NAME)) {
252
+ const doubled = run.indexOf("--");
253
+ found.add(doubled < 0 ? run : run.slice(0, doubled + 1));
254
+ }
255
+ return [...found];
256
+ }
257
+
258
+ /**
259
+ * What a file of a web bundle uses of the console's classes that is not a part (ADR-0106): a
260
+ * class of one of the console's own pages, which is that page's layout and changes with it, is
261
+ * an error; a name nothing of the console styles is said, since it draws nothing. A stylesheet
262
+ * is read by its selectors, a script by the names it holds.
263
+ */
264
+ export function strayConsoleClasses(
265
+ file: string,
266
+ text: string,
267
+ classes: ConsoleClasses,
268
+ ): { readonly pagesOwn: string[]; readonly unknown: string[] } {
269
+ const names = file.endsWith(".css")
270
+ ? classesIn(text).filter((name) => name.startsWith("sc-"))
271
+ : consoleNamesIn(text);
272
+ const pagesOwn: string[] = [];
273
+ const unknown: string[] = [];
274
+ for (const name of names) {
275
+ if (name.endsWith("-") ? classes.beginsPart(name) : classes.isPart(name)) {
276
+ continue;
277
+ }
278
+ (classes.isPagesOwn(name) ? pagesOwn : unknown).push(name);
279
+ }
280
+ return { pagesOwn: pagesOwn.sort(), unknown: unknown.sort() };
281
+ }
282
+
283
+ /** A few of a list, in a line, with a word where there are more. */
284
+ const some = (names: readonly string[], most = 8): string =>
285
+ `${names.slice(0, most).join(", ")}${names.length > most ? `, and ${names.length - most} more` : ""}`;
286
+
287
+ // The blanks around an import's bracket are taken in one way only, `\s*(?:\(\s*)?`: written as
288
+ // `\s*\(?\s*`, a run of blanks with no bracket in it is divided between the two in every way
289
+ // before the expression gives up, which is the square of its length.
290
+ const WEB_IMPORT =
291
+ /(?:\bfrom\s*|\bimport\s*(?:\(\s*)?|\bexport\s+\*\s+from\s*)["'`]([^"'`]+)["'`]/g;
100
292
  const WEB_FORBIDDEN =
101
293
  /\b(fetch|XMLHttpRequest|WebSocket|EventSource|importScripts|sendBeacon)\s*\(|document\.cookie|\bnavigator\.serviceWorker\b/g;
102
294
 
@@ -130,18 +322,23 @@ async function exists(path: string): Promise<"file" | "directory" | null> {
130
322
  }
131
323
  }
132
324
 
133
- async function readJson(path: string): Promise<{ value: unknown } | { problem: string }> {
134
- let text: string;
135
- try {
136
- text = await readFile(path, "utf8");
137
- } catch {
138
- return { problem: `${posix.basename(path)} is missing` };
325
+ /** A JSON file at the package's root, by its name, which is what a problem with it is said by. */
326
+ async function readJson(
327
+ root: string,
328
+ name: string,
329
+ ): Promise<{ value: unknown } | { problem: string }> {
330
+ const read = await readWhole(join(root, name));
331
+ if (read === null) {
332
+ return { problem: `${name} is missing` };
333
+ }
334
+ if ("bytes" in read) {
335
+ return { problem: tooLarge(name, read.bytes) };
139
336
  }
140
337
  try {
141
- return { value: JSON.parse(text) as unknown };
338
+ return { value: JSON.parse(read.text) as unknown };
142
339
  } catch (error) {
143
340
  return {
144
- problem: `${posix.basename(path)} is not JSON: ${error instanceof Error ? error.message : String(error)}`,
341
+ problem: `${name} is not JSON: ${error instanceof Error ? error.message : String(error)}`,
145
342
  };
146
343
  }
147
344
  }
@@ -171,15 +368,15 @@ async function checkSkills(
171
368
  skillsDir: string,
172
369
  errors: string[],
173
370
  warnings: string[],
371
+ read: (file: string) => Promise<PackageFile>,
174
372
  ): Promise<number> {
175
- const manifestPath = join(root, "SKILLCDN.md");
176
- const manifestText = await readFile(manifestPath, "utf8").catch(() => null);
177
- if (manifestText === null) {
373
+ const manifest = await read("SKILLCDN.md");
374
+ if (manifest === "missing") {
178
375
  errors.push(
179
376
  "SKILLCDN.md is missing at the package root: a plugin with skills has their manifest there",
180
377
  );
181
- } else {
182
- const matter = frontMatter(manifestText);
378
+ } else if (manifest !== "refused") {
379
+ const matter = frontMatter(manifest.text);
183
380
  if (matter === null || !matter.scalars.name || !matter.scalars.description) {
184
381
  errors.push("SKILLCDN.md has no front-matter with name and description");
185
382
  }
@@ -195,13 +392,16 @@ async function checkSkills(
195
392
  continue;
196
393
  }
197
394
  const file = posix.join(skillsDir, entry.name, "SKILL.md");
198
- const text = await readFile(join(root, file), "utf8").catch(() => null);
199
- if (text === null) {
395
+ const skill = await read(file);
396
+ if (skill === "missing") {
200
397
  errors.push(`${file} is missing: a skill directory holds a SKILL.md`);
201
398
  continue;
202
399
  }
203
400
  count += 1;
204
- const matter = frontMatter(text);
401
+ if (skill === "refused") {
402
+ continue;
403
+ }
404
+ const matter = frontMatter(skill.text);
205
405
  if (matter === null) {
206
406
  errors.push(`${file} has no front-matter`);
207
407
  continue;
@@ -251,28 +451,40 @@ async function checkMigrations(
251
451
  }
252
452
  }
253
453
 
454
+ /** The scripts and stylesheets of a bundle, by their paths under it: its entry, its chunks, its styles. */
455
+ async function bundleFiles(dir: string): Promise<string[]> {
456
+ const entries = await readdir(dir, { withFileTypes: true, recursive: true });
457
+ return entries
458
+ .filter((entry) => entry.isFile() && /\.(?:js|mjs|css)$/.test(entry.name))
459
+ .map((entry) => posix.join(relative(dir, entry.parentPath).split(sep).join("/"), entry.name))
460
+ .sort();
461
+ }
462
+
254
463
  async function checkWeb(
255
464
  root: string,
256
465
  manifest: PluginManifest,
257
466
  webDir: string,
258
467
  errors: string[],
259
468
  warnings: string[],
469
+ classes: ConsoleClasses | undefined,
470
+ read: (file: string) => Promise<PackageFile>,
260
471
  ): Promise<void> {
261
472
  const dir = join(root, webDir);
262
473
  if ((await exists(dir)) !== "directory") {
263
474
  errors.push(`web names ${webDir}, which is not a directory: build the bundle first`);
264
475
  return;
265
476
  }
266
- const script = await readFile(join(dir, "index.js"), "utf8").catch(() => null);
267
- if (script === null) {
477
+ const script = await read(`${webDir}/index.js`);
478
+ if (script === "missing") {
268
479
  errors.push(`${webDir}/index.js is missing: the frame loads the bundle from there`);
269
- } else {
270
- for (const problem of webBundleProblems(script)) {
480
+ } else if (script !== "refused") {
481
+ for (const problem of webBundleProblems(script.text)) {
271
482
  errors.push(`${webDir}/index.js ${problem}`);
272
483
  }
273
484
  }
274
- const css = await readFile(join(dir, "index.css"), "utf8").catch(() => null);
275
- if (css !== null) {
485
+ const sheet = await read(`${webDir}/index.css`);
486
+ if (sheet !== "missing" && sheet !== "refused") {
487
+ const css = sheet.text;
276
488
  if (
277
489
  /@import\s+(?:url\()?["']?(?:https?:)?\/\//.test(css) ||
278
490
  /url\(\s*["']?(?:https?:)?\/\//.test(css)
@@ -289,6 +501,30 @@ async function checkWeb(
289
501
  );
290
502
  }
291
503
  }
504
+ if (classes === undefined) {
505
+ return;
506
+ }
507
+ // A plugin's pages are built from the console's parts, as the console's own are (ADR-0106):
508
+ // every file of the bundle is read for the classes of the console it uses.
509
+ for (const file of await bundleFiles(dir)) {
510
+ const found = await read(`${webDir}/${file}`);
511
+ if (found === "missing" || found === "refused") {
512
+ continue;
513
+ }
514
+ const stray = strayConsoleClasses(file, found.text, classes);
515
+ if (stray.pagesOwn.length > 0) {
516
+ const one = stray.pagesOwn.length === 1;
517
+ errors.push(
518
+ `${webDir}/${file} uses ${some(stray.pagesOwn)}: ${one ? "a class" : "classes"} of the console's own pages, not ${one ? "a part" : "parts"}; a plugin's page is built from the parts, which src/styles/README.md of @skillcdn/console lists`,
519
+ );
520
+ }
521
+ if (stray.unknown.length > 0) {
522
+ const one = stray.unknown.length === 1;
523
+ warnings.push(
524
+ `${webDir}/${file} names ${some(stray.unknown)}: no part of the console has ${one ? "that class" : "those classes"}, and nothing styles ${one ? "it" : "them"}; a plugin's own classes begin with pl-${manifest.key}-`,
525
+ );
526
+ }
527
+ }
292
528
  }
293
529
 
294
530
  function describeCounts(manifest: PluginManifest, description: PluginDescription | null): string {
@@ -335,6 +571,8 @@ export function sameAsEnglish(value: unknown, at = ""): string[] {
335
571
  export interface CheckOptions {
336
572
  /** The version of the console this command belongs to, held against the manifest's `console`; left out, not compared. */
337
573
  readonly consoleVersion?: string | undefined;
574
+ /** The classes of the console this command belongs to, which the web bundle's are held to; left out, not held. */
575
+ readonly consoleClasses?: ConsoleClasses | undefined;
338
576
  }
339
577
 
340
578
  /** Reads the plugin at `root` as a console would, and says what it would refuse. */
@@ -349,7 +587,7 @@ export async function checkPlugin(
349
587
  return { ok: false, errors: [`${root} is not a directory`], warnings, summary: null };
350
588
  }
351
589
 
352
- const manifestRead = await readJson(join(root, "console-plugin.json"));
590
+ const manifestRead = await readJson(root, "console-plugin.json");
353
591
  if ("problem" in manifestRead) {
354
592
  return { ok: false, errors: [manifestRead.problem], warnings, summary: null };
355
593
  }
@@ -383,7 +621,7 @@ export async function checkPlugin(
383
621
  );
384
622
  }
385
623
 
386
- const packageRead = await readJson(join(root, "package.json"));
624
+ const packageRead = await readJson(root, "package.json");
387
625
  let version = "0.0.0";
388
626
  if ("problem" in packageRead) {
389
627
  errors.push(packageRead.problem);
@@ -461,12 +699,15 @@ export async function checkPlugin(
461
699
  }
462
700
  }
463
701
 
702
+ const read = packageReader(root, errors);
464
703
  let description: PluginDescription | null = null;
465
704
  const serverPath = join(root, manifest.server);
466
- if ((await exists(serverPath)) !== "file") {
705
+ const server = await read(manifest.server);
706
+ if (server === "missing") {
467
707
  errors.push(`server names ${manifest.server}, which is missing: build the server module first`);
468
- } else {
469
- const source = await readFile(serverPath, "utf8");
708
+ } else if (server !== "refused") {
709
+ // A module beyond the bound is neither read nor loaded: what it is was not looked at.
710
+ const source = server.text;
470
711
  for (const specifier of forbiddenImportsIn(source)) {
471
712
  errors.push(`${manifest.server} imports ${specifier}, which the host refuses`);
472
713
  }
@@ -511,11 +752,11 @@ export async function checkPlugin(
511
752
  }
512
753
 
513
754
  if (manifest.web !== undefined) {
514
- await checkWeb(root, manifest, manifest.web, errors, warnings);
755
+ await checkWeb(root, manifest, manifest.web, errors, warnings, options.consoleClasses, read);
515
756
  }
516
757
  let skills = 0;
517
758
  if (manifest.skills !== undefined) {
518
- skills = await checkSkills(root, manifest.skills, errors, warnings);
759
+ skills = await checkSkills(root, manifest.skills, errors, warnings, read);
519
760
  } else {
520
761
  warnings.push(
521
762
  "console-plugin.json: names no skills; an agent learns the plugin from its command's help alone",
@@ -6,7 +6,8 @@ import { parseArgs } from "node:util";
6
6
  import type { ServerLoad } from "../plugin/load.js";
7
7
  import { isPluginKey, RESERVED_PLUGIN_KEYS } from "../plugin/manifest.js";
8
8
  import { lineRangeFrom, versionOfDependency } from "../plugin/semver.js";
9
- import { checkPlugin } from "./plugin-check.js";
9
+ import { commandWord, NO_LINE_TO_RUN } from "./command-words.js";
10
+ import { checkPlugin, MAX_CHECKED_FILE_BYTES, readConsoleClasses } from "./plugin-check.js";
10
11
  import { LANGUAGE_TAG, nameFromKey, PACKAGE_NAME, writePluginFromTemplate } from "./plugin-init.js";
11
12
 
12
13
  export interface PluginCliIo {
@@ -18,6 +19,11 @@ export interface PluginCliIo {
18
19
  readonly version: string | undefined;
19
20
  /** Loads a server module in a hardened thread and describes it. */
20
21
  loadServer(file: string): Promise<ServerLoad>;
22
+ /**
23
+ * The sources of the console's stylesheet the package ships, `src/styles` beside `dist/`: the
24
+ * catalogue of the parts a plugin's web bundle is held to (ADR-0106). Left out, not held.
25
+ */
26
+ readonly stylesDir?: string | undefined;
21
27
  }
22
28
 
23
29
  /** The exit codes: done; refused or failed; not understood. */
@@ -46,6 +52,7 @@ export const PLUGIN_USAGE = `console-plugin: writes and checks a plugin of the S
46
52
  the manifest, package.json (a permissive license, no install scripts, files that ship
47
53
  what runs), the server module loaded under the host's hardening and held to the manifest,
48
54
  the web bundle self-contained and its classes prefixed, the skills, the migrations.
55
+ A file is read whole, up to ${MAX_CHECKED_FILE_BYTES / (1024 * 1024)} MiB: a larger one is a problem, and is not read.
49
56
  Exits 0 with a summary, 1 with every problem found.
50
57
 
51
58
  console-plugin help | --version
@@ -197,8 +204,11 @@ async function init(args: readonly string[], io: PluginCliIo): Promise<number> {
197
204
  languages,
198
205
  });
199
206
  io.stdout(`Wrote the plugin ${key} into ${target}: ${written.length} files.\n`);
207
+ // The folder as bash and PowerShell both take it whole; where it has no such spelling, it is
208
+ // named above, and no line is printed to run.
209
+ const into = commandWord(dir);
200
210
  io.stdout(
201
- `Next: cd ${dir}, install the dependencies (npm install), build (npm run build), run the tests (npm test), and check it as a console would (npm run check). The contract is docs/specs/plugins.md in node_modules/@skillcdn/console/.\n`,
211
+ `Next: ${into === undefined ? "go into that folder" : `cd ${into}`}, install the dependencies (npm install), build (npm run build), run the tests (npm test), and check it as a console would (npm run check). The contract is docs/specs/plugins.md in node_modules/@skillcdn/console/.${into === undefined ? ` ${NO_LINE_TO_RUN}` : ""}\n`,
202
212
  );
203
213
  return PLUGIN_EXIT.ok;
204
214
  } catch (error) {
@@ -227,15 +237,29 @@ async function check(args: readonly string[], io: PluginCliIo): Promise<number>
227
237
  return PLUGIN_EXIT.usage;
228
238
  }
229
239
  const root = resolve(io.cwd, dir ?? ".");
240
+ // The catalogue of the parts, read from the package this command is of. A package without
241
+ // it is not this one as it is published: said, and the classes are then not held.
242
+ const classes =
243
+ io.stylesDir === undefined
244
+ ? undefined
245
+ : await readConsoleClasses(io.stylesDir).catch(() => null);
230
246
  const report = await checkPlugin(root, (file) => io.loadServer(file), {
231
247
  consoleVersion: io.version,
248
+ consoleClasses: classes ?? undefined,
232
249
  });
233
250
  io.stdout(`console-plugin check ${root}\n`);
251
+ const warnings =
252
+ classes === null
253
+ ? [
254
+ ...report.warnings,
255
+ `the catalogue of the console's parts was not found in ${io.stylesDir}: the web bundle's classes were not held to it`,
256
+ ]
257
+ : report.warnings;
234
258
  io.stdout(wordsOf(report.errors, "error"));
235
- io.stdout(wordsOf(report.warnings, "warning"));
259
+ io.stdout(wordsOf(warnings, "warning"));
236
260
  if (report.ok) {
237
261
  io.stdout(
238
- `ok: ${report.summary ?? "a plugin"}${report.warnings.length > 0 ? `; ${report.warnings.length} warning${report.warnings.length === 1 ? "" : "s"}` : ""}\n`,
262
+ `ok: ${report.summary ?? "a plugin"}${warnings.length > 0 ? `; ${warnings.length} warning${warnings.length === 1 ? "" : "s"}` : ""}\n`,
239
263
  );
240
264
  return PLUGIN_EXIT.ok;
241
265
  }
@@ -25,6 +25,7 @@ process.exitCode = await runPluginCli(process.argv.slice(2), {
25
25
  },
26
26
  cwd: process.cwd(),
27
27
  templateDir: join(packageDir, "template", "plugin"),
28
+ stylesDir: join(packageDir, "src", "styles"),
28
29
  version: manifest.success ? manifest.data.version : undefined,
29
30
  loadServer: (file) => loadServerModule(file),
30
31
  });
@@ -3,6 +3,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
3
3
  import { type as osType, release, userInfo } from "node:os";
4
4
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
5
  import process from "node:process";
6
+ import { type Awake, holdAwake } from "../runner/awake.js";
6
7
  import { createSpawn } from "../runner/process.js";
7
8
  import { KEEPER_VARIABLE, type Spawn, type WakeSocket } from "../runner/types.js";
8
9
 
@@ -32,6 +33,12 @@ export interface RunnerHost {
32
33
  * stopping by itself.
33
34
  */
34
35
  untilStopped(): Promise<void>;
36
+ /**
37
+ * Holds the machine awake for as long as this process runs, where the system has a way that
38
+ * needs no administrator (ADR-0140), and answers what holds it, or why nothing does. Left out
39
+ * by a host that touches no machine.
40
+ */
41
+ keepAwake?(): Promise<Awake>;
35
42
  readonly random: () => number;
36
43
  }
37
44
 
@@ -178,6 +185,7 @@ export function createRunnerHost(
178
185
  timer.unref();
179
186
  }
180
187
  }),
188
+ keepAwake: () => holdAwake(process.platform, process.pid, env),
181
189
  // A session's mark is made of these: not to be guessed from outside the machine.
182
190
  random: () => randomInt(0, 2 ** 31) / 2 ** 31,
183
191
  };
@@ -0,0 +1,63 @@
1
+ // What the command says of a secret's value as it is kept (ADR-0140): a value that does not look
2
+ // like what its name says is kept all the same, since the console knows no service's tokens for
3
+ // sure, and said so at once, where whoever keeps it can still put it right. A token copied half,
4
+ // or another value pasted in its place, is otherwise found out when a push fails. Nothing of the
5
+ // value is said: what a note names is its shape.
6
+
7
+ /** What a secret's name says of its value's shape, for the names the package itself reads. */
8
+ const SHAPES: readonly {
9
+ readonly name: string;
10
+ /** The kind of git host the shape holds for, where it is one host's own. */
11
+ readonly host?: string;
12
+ readonly shape: RegExp;
13
+ readonly says: string;
14
+ }[] = [
15
+ {
16
+ name: "slack.app_token",
17
+ shape: /^xapp-/,
18
+ says: "an app-level token of Slack begins with xapp-",
19
+ },
20
+ {
21
+ name: "git.token",
22
+ host: "github",
23
+ shape: /^(gh[pousr]_|github_pat_)/,
24
+ says: "a token of GitHub begins with ghp_ or github_pat_",
25
+ },
26
+ {
27
+ name: "git.token",
28
+ host: "gitlab",
29
+ shape: /^gl[a-z]{2,6}-/,
30
+ says: "a token of GitLab begins with glpat- or the like",
31
+ },
32
+ ];
33
+
34
+ /**
35
+ * What to say of a value kept under a name, a line each, or nothing: that it holds a space or a
36
+ * line break, which a token copied from a page seldom does on purpose, and that it is not of
37
+ * the shape its name says. `gitHost` is the kind of git host the workspace names, where it
38
+ * names one.
39
+ */
40
+ export function secretNotes(
41
+ name: string,
42
+ value: string,
43
+ gitHost?: string | undefined,
44
+ ): readonly string[] {
45
+ const notes: string[] = [];
46
+ // A token by its name. A key is not asked this: one of several lines is a key all the same.
47
+ const token = /(?:^|[._])token$/.test(name);
48
+ if (token && /\s/.test(value)) {
49
+ notes.push(
50
+ "The value holds a space or a line break, which a token does not: check that it was copied whole and alone.",
51
+ );
52
+ }
53
+ for (const one of SHAPES) {
54
+ if (one.name === name && (one.host === undefined || one.host === gitHost)) {
55
+ if (!one.shape.test(value.trim())) {
56
+ notes.push(
57
+ `The value does not look like what ${name} holds: ${one.says}. It is kept as it is; set it again if another value was pasted.`,
58
+ );
59
+ }
60
+ }
61
+ }
62
+ return notes;
63
+ }