@yaks/cli 0.0.0-stage → 0.2.36

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 (331) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +1059 -2
  3. package/_dist/account-forward.d.ts +12 -0
  4. package/_dist/account-forward.d.ts.map +1 -0
  5. package/_dist/accounts.d.ts +23 -0
  6. package/_dist/accounts.d.ts.map +1 -0
  7. package/_dist/answer.d.ts +88 -0
  8. package/_dist/answer.d.ts.map +1 -0
  9. package/_dist/apply.d.ts +17 -0
  10. package/_dist/apply.d.ts.map +1 -0
  11. package/_dist/args.d.ts +86 -0
  12. package/_dist/args.d.ts.map +1 -0
  13. package/_dist/commands.d.ts +15 -0
  14. package/_dist/commands.d.ts.map +1 -0
  15. package/_dist/complete.d.ts +15 -0
  16. package/_dist/complete.d.ts.map +1 -0
  17. package/_dist/config.d.ts +37 -0
  18. package/_dist/config.d.ts.map +1 -0
  19. package/_dist/dependencies.d.ts +6 -0
  20. package/_dist/dependencies.d.ts.map +1 -0
  21. package/_dist/facets.d.ts +71 -0
  22. package/_dist/facets.d.ts.map +1 -0
  23. package/_dist/grammar.d.ts +5 -0
  24. package/_dist/grammar.d.ts.map +1 -0
  25. package/_dist/host.d.ts +164 -0
  26. package/_dist/host.d.ts.map +1 -0
  27. package/_dist/install.d.ts +43 -0
  28. package/_dist/install.d.ts.map +1 -0
  29. package/_dist/main.d.ts +16 -0
  30. package/_dist/main.d.ts.map +1 -0
  31. package/_dist/memo.d.ts +60 -0
  32. package/_dist/memo.d.ts.map +1 -0
  33. package/_dist/mod.d.ts +46 -0
  34. package/_dist/mod.d.ts.map +1 -0
  35. package/_dist/page.d.ts +73 -0
  36. package/_dist/page.d.ts.map +1 -0
  37. package/_dist/platform.d.ts +27 -0
  38. package/_dist/platform.d.ts.map +1 -0
  39. package/_dist/reader.d.ts +10 -0
  40. package/_dist/reader.d.ts.map +1 -0
  41. package/_dist/release.d.ts +48 -0
  42. package/_dist/release.d.ts.map +1 -0
  43. package/_dist/remote.d.ts +13 -0
  44. package/_dist/remote.d.ts.map +1 -0
  45. package/_dist/reported.d.ts +11 -0
  46. package/_dist/reported.d.ts.map +1 -0
  47. package/_dist/roles.d.ts +2 -0
  48. package/_dist/roles.d.ts.map +1 -0
  49. package/_dist/roster.d.ts +41 -0
  50. package/_dist/roster.d.ts.map +1 -0
  51. package/_dist/rpc.d.ts +29 -0
  52. package/_dist/rpc.d.ts.map +1 -0
  53. package/_dist/run.d.ts +164 -0
  54. package/_dist/run.d.ts.map +1 -0
  55. package/_dist/runtime.d.ts +4 -0
  56. package/_dist/runtime.d.ts.map +1 -0
  57. package/_dist/searching.d.ts +7 -0
  58. package/_dist/searching.d.ts.map +1 -0
  59. package/_dist/show.d.ts +22 -0
  60. package/_dist/show.d.ts.map +1 -0
  61. package/_dist/store.d.ts +25 -0
  62. package/_dist/store.d.ts.map +1 -0
  63. package/_dist/terminal.d.ts +17 -0
  64. package/_dist/terminal.d.ts.map +1 -0
  65. package/_dist/tool.d.ts +55 -0
  66. package/_dist/tool.d.ts.map +1 -0
  67. package/_dist/tty.d.ts +3 -0
  68. package/_dist/tty.d.ts.map +1 -0
  69. package/_dist/vault.d.ts +9 -0
  70. package/_dist/vault.d.ts.map +1 -0
  71. package/_dist/words.d.ts +11 -0
  72. package/_dist/words.d.ts.map +1 -0
  73. package/_dist/yak.d.ts +10 -0
  74. package/_dist/yak.d.ts.map +1 -0
  75. package/account-forward.js +40 -0
  76. package/account-forward.js.map +1 -0
  77. package/account-forward.ts +50 -0
  78. package/accounts.js +162 -0
  79. package/accounts.js.map +1 -0
  80. package/accounts.ts +228 -0
  81. package/answer.js +394 -0
  82. package/answer.js.map +1 -0
  83. package/answer.ts +569 -0
  84. package/apply.js +49 -0
  85. package/apply.js.map +1 -0
  86. package/apply.ts +54 -0
  87. package/args.js +420 -0
  88. package/args.js.map +1 -0
  89. package/args.ts +494 -0
  90. package/code.js +209 -0
  91. package/code.js.map +1 -0
  92. package/code.ts +227 -0
  93. package/commands.js +131 -0
  94. package/commands.js.map +1 -0
  95. package/commands.ts +142 -0
  96. package/complete.js +104 -0
  97. package/complete.js.map +1 -0
  98. package/complete.ts +152 -0
  99. package/config.js +125 -0
  100. package/config.js.map +1 -0
  101. package/config.ts +180 -0
  102. package/declarations.js +67 -0
  103. package/declarations.js.map +1 -0
  104. package/declarations.ts +84 -0
  105. package/deno.json +1 -0
  106. package/dependencies.js +126 -0
  107. package/dependencies.js.map +1 -0
  108. package/dependencies.ts +141 -0
  109. package/derive.js +102 -0
  110. package/derive.js.map +1 -0
  111. package/derive.ts +125 -0
  112. package/drain.js +83 -0
  113. package/drain.js.map +1 -0
  114. package/drain.ts +115 -0
  115. package/duties.ts +17 -0
  116. package/exports.json +1486 -0
  117. package/external.js +373 -0
  118. package/external.js.map +1 -0
  119. package/external.ts +435 -0
  120. package/facets.js +214 -0
  121. package/facets.js.map +1 -0
  122. package/facets.ts +232 -0
  123. package/feedback.js +54 -0
  124. package/feedback.js.map +1 -0
  125. package/feedback.ts +57 -0
  126. package/files.js +84 -0
  127. package/files.js.map +1 -0
  128. package/files.ts +112 -0
  129. package/get_starts.js +31 -0
  130. package/get_starts.js.map +1 -0
  131. package/get_starts.ts +34 -0
  132. package/git-credential.js +79 -0
  133. package/git-credential.js.map +1 -0
  134. package/git-credential.ts +77 -0
  135. package/grammar.js +4 -0
  136. package/grammar.js.map +1 -0
  137. package/grammar.ts +5 -0
  138. package/held.js +51 -0
  139. package/held.js.map +1 -0
  140. package/held.ts +66 -0
  141. package/host.js +1174 -0
  142. package/host.js.map +1 -0
  143. package/host.ts +1343 -0
  144. package/init.js +138 -0
  145. package/init.js.map +1 -0
  146. package/init.ts +139 -0
  147. package/install.js +216 -0
  148. package/install.js.map +1 -0
  149. package/install.ts +223 -0
  150. package/lifetime.js +56 -0
  151. package/lifetime.js.map +1 -0
  152. package/lifetime.ts +66 -0
  153. package/local-page.ts +114 -0
  154. package/local.js +417 -0
  155. package/local.js.map +1 -0
  156. package/local.ts +537 -0
  157. package/lockfile.js +20 -0
  158. package/lockfile.js.map +1 -0
  159. package/lockfile.ts +32 -0
  160. package/machines.js +33 -0
  161. package/machines.js.map +1 -0
  162. package/machines.ts +51 -0
  163. package/made/4f855610bdabcd736100d34e4e467ea5.json +1 -0
  164. package/main.js +534 -0
  165. package/main.js.map +1 -0
  166. package/main.ts +547 -0
  167. package/mcp.js +108 -0
  168. package/mcp.js.map +1 -0
  169. package/mcp.ts +113 -0
  170. package/member.js +103 -0
  171. package/member.js.map +1 -0
  172. package/member.ts +133 -0
  173. package/memo.js +503 -0
  174. package/memo.js.map +1 -0
  175. package/memo.ts +634 -0
  176. package/mod.js +46 -0
  177. package/mod.js.map +1 -0
  178. package/mod.ts +99 -0
  179. package/operations.js +53 -0
  180. package/operations.js.map +1 -0
  181. package/operations.ts +68 -0
  182. package/package.json +115 -4
  183. package/page.js +211 -0
  184. package/page.js.map +1 -0
  185. package/page.ts +308 -0
  186. package/parser.js +45 -0
  187. package/parser.js.map +1 -0
  188. package/parser.ts +77 -0
  189. package/people-search.js +112 -0
  190. package/people-search.js.map +1 -0
  191. package/people-search.ts +162 -0
  192. package/platform.js +184 -0
  193. package/platform.js.map +1 -0
  194. package/platform.ts +224 -0
  195. package/platform_effects.js +5 -0
  196. package/platform_effects.js.map +1 -0
  197. package/platform_effects.ts +13 -0
  198. package/prepare.js +40 -0
  199. package/prepare.js.map +1 -0
  200. package/prepare.ts +46 -0
  201. package/read_activity.js +54 -0
  202. package/read_activity.js.map +1 -0
  203. package/read_activity.ts +61 -0
  204. package/read_thread.js +387 -0
  205. package/read_thread.js.map +1 -0
  206. package/read_thread.ts +506 -0
  207. package/read_worker.ts +164 -0
  208. package/reader.js +48 -0
  209. package/reader.js.map +1 -0
  210. package/reader.ts +57 -0
  211. package/release.js +82 -0
  212. package/release.js.map +1 -0
  213. package/release.json +127 -0
  214. package/release.ts +98 -0
  215. package/remote-page.ts +70 -0
  216. package/remote.js +96 -0
  217. package/remote.js.map +1 -0
  218. package/remote.ts +153 -0
  219. package/report.js +83 -0
  220. package/report.js.map +1 -0
  221. package/report.ts +101 -0
  222. package/reported.js +32 -0
  223. package/reported.js.map +1 -0
  224. package/reported.ts +38 -0
  225. package/restart.js +349 -0
  226. package/restart.js.map +1 -0
  227. package/restart.ts +478 -0
  228. package/restore.js +32 -0
  229. package/restore.js.map +1 -0
  230. package/restore.ts +38 -0
  231. package/roles.js +32 -0
  232. package/roles.js.map +1 -0
  233. package/roles.ts +49 -0
  234. package/roster.js +65 -0
  235. package/roster.js.map +1 -0
  236. package/roster.ts +84 -0
  237. package/rpc.js +113 -0
  238. package/rpc.js.map +1 -0
  239. package/rpc.ts +159 -0
  240. package/run.js +533 -0
  241. package/run.js.map +1 -0
  242. package/run.ts +741 -0
  243. package/runtime.js +381 -0
  244. package/runtime.js.map +1 -0
  245. package/runtime.ts +433 -0
  246. package/sandboxes.js +26 -0
  247. package/sandboxes.js.map +1 -0
  248. package/sandboxes.ts +30 -0
  249. package/searching.js +33 -0
  250. package/searching.js.map +1 -0
  251. package/searching.ts +50 -0
  252. package/show.js +109 -0
  253. package/show.js.map +1 -0
  254. package/show.ts +144 -0
  255. package/shown.js +13 -0
  256. package/shown.js.map +1 -0
  257. package/shown.ts +44 -0
  258. package/stall.js +90 -0
  259. package/stall.js.map +1 -0
  260. package/stall.ts +156 -0
  261. package/stall_profile.js +113 -0
  262. package/stall_profile.js.map +1 -0
  263. package/stall_profile.ts +142 -0
  264. package/stall_wait.js +183 -0
  265. package/stall_wait.js.map +1 -0
  266. package/stall_wait.ts +249 -0
  267. package/stall_wait_worker.ts +11 -0
  268. package/start.js +349 -0
  269. package/start.js.map +1 -0
  270. package/start.ts +343 -0
  271. package/starvation.js +147 -0
  272. package/starvation.js.map +1 -0
  273. package/starvation.ts +224 -0
  274. package/store.js +118 -0
  275. package/store.js.map +1 -0
  276. package/store.ts +193 -0
  277. package/subcommands.js +62 -0
  278. package/subcommands.js.map +1 -0
  279. package/subcommands.ts +77 -0
  280. package/terminal.js +93 -0
  281. package/terminal.js.map +1 -0
  282. package/terminal.ts +128 -0
  283. package/text.js +20 -0
  284. package/text.js.map +1 -0
  285. package/text.ts +37 -0
  286. package/tool.js +76 -0
  287. package/tool.js.map +1 -0
  288. package/tool.ts +157 -0
  289. package/trace_control.js +231 -0
  290. package/trace_control.js.map +1 -0
  291. package/trace_control.ts +233 -0
  292. package/traces.js +138 -0
  293. package/traces.js.map +1 -0
  294. package/traces.ts +160 -0
  295. package/tracker.js +22 -0
  296. package/tracker.js.map +1 -0
  297. package/tracker.ts +27 -0
  298. package/tty.js +82 -0
  299. package/tty.js.map +1 -0
  300. package/tty.ts +142 -0
  301. package/unit_failure.js +178 -0
  302. package/unit_failure.js.map +1 -0
  303. package/unit_failure.ts +191 -0
  304. package/upkeep_thread.js +32 -0
  305. package/upkeep_thread.js.map +1 -0
  306. package/upkeep_thread.ts +35 -0
  307. package/upkeep_worker.ts +27 -0
  308. package/vault.js +186 -0
  309. package/vault.js.map +1 -0
  310. package/vault.ts +220 -0
  311. package/vocab-ids.js +63 -0
  312. package/vocab-ids.js.map +1 -0
  313. package/vocab-ids.ts +62 -0
  314. package/vocab.json +35 -0
  315. package/warm.js +138 -0
  316. package/warm.js.map +1 -0
  317. package/warm.ts +171 -0
  318. package/watch_revision.js +25 -0
  319. package/watch_revision.js.map +1 -0
  320. package/watch_revision.ts +30 -0
  321. package/words.js +29 -0
  322. package/words.js.map +1 -0
  323. package/words.ts +41 -0
  324. package/workspaces.js +40 -0
  325. package/workspaces.js.map +1 -0
  326. package/workspaces.ts +58 -0
  327. package/yak-unit-failure.conf +6 -0
  328. package/yak-unit-handoff.conf +2 -0
  329. package/yak.js +123 -0
  330. package/yak.js.map +1 -0
  331. package/yak.ts +136 -0
package/mod.ts ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The `yak` command line, as a library.
3
+ *
4
+ * The command itself is the other export — `./yak`, which `./install` puts on
5
+ * PATH — and this module is what it is assembled from, for anybody building
6
+ * the same thing: the tools of the graph a config file names, or the ones an
7
+ * MCP server lists, read at run time, every tool a subcommand, and the command
8
+ * line parsed through each tool's own input schema.
9
+ *
10
+ * ```ts ignore
11
+ * import { argsFor, doorUrl, rpc } from '@yaks/cli'
12
+ *
13
+ * let ask = rpc({ url: doorUrl('yaks.app'), token: '…' })
14
+ * let { tools } = await ask('tools/list') as { tools: [] }
15
+ * ```
16
+ *
17
+ * A program with subcommands of its own passes them in and runs the same
18
+ * program: `exit(await main(args, commands))`, with `args` and `exit` from
19
+ * `@yaks/process/system` and `main` from
20
+ * `@yaks/cli/main`.
21
+ *
22
+ * A program that is not `yak` at all calls `cli(commands, opts)` — its
23
+ * subcommands, and the name it goes by. One whose commands run tools on a
24
+ * graph it opened itself draws each answer the way `yak` does: `registry` of
25
+ * the plugins' views, and `show`.
26
+ *
27
+ * @module
28
+ */
29
+
30
+ export {
31
+ appGrammar,
32
+ argsFor,
33
+ type Grammar,
34
+ inflate,
35
+ type Reads,
36
+ type Said,
37
+ saidIn,
38
+ Usage,
39
+ valueOf,
40
+ } from './args.js'
41
+ export { bundlesIn, CHUNK, chunks } from './apply.js'
42
+ export { registry, type Source, type Views } from './answer.js'
43
+ export { show } from './tty.js'
44
+ export { complete, type Lookup } from './complete.js'
45
+ export {
46
+ type Door,
47
+ doorUrl,
48
+ initialize,
49
+ PROTOCOL,
50
+ Refused,
51
+ type Rpc,
52
+ rpc,
53
+ Unauthorized,
54
+ } from './rpc.js'
55
+ export { type Result, rosterAfter, saidBy, STALE, versionIn } from './roster.js'
56
+ export { lineOf, safe, sketch, toolHelp, toolLines, wrap } from './show.js'
57
+ export {
58
+ cached,
59
+ configDir,
60
+ forget,
61
+ remember,
62
+ type Roster,
63
+ stateDir,
64
+ tokenFor,
65
+ } from './store.js'
66
+ export {
67
+ commandOf,
68
+ type Listed,
69
+ type Prop,
70
+ type Schema,
71
+ titleOf,
72
+ typeOf,
73
+ } from './tool.js'
74
+ export {
75
+ aimed,
76
+ cli,
77
+ type Command,
78
+ commandFor,
79
+ type Ctx,
80
+ globals,
81
+ helpTool,
82
+ type Opts,
83
+ unique,
84
+ usage,
85
+ } from './run.js'
86
+ export { type Config, configPath, read } from './config.js'
87
+ export { runtimeSource } from './runtime.js'
88
+ export { fileVault, vaultOf } from './vault.js'
89
+ export { listed, printed, rosterOf } from './platform.js'
90
+ export { appStray, appTools, toolCall } from './commands.js'
91
+ export { readJson } from './remote.js'
92
+
93
+ export {
94
+ accountHost,
95
+ type AccountOptions,
96
+ closeAccounts,
97
+ personal,
98
+ personalPath,
99
+ } from './accounts.js'
package/operations.js ADDED
@@ -0,0 +1,53 @@
1
+ import * as system from "@yaks/process/system";
2
+ import { argsOf } from "@yaks/graph/call";
3
+ import { CallError } from "@yaks/tools/errors";
4
+ import { said } from "@yaks/tools/result";
5
+ import { toolsIn } from "@yaks/vocab/tools";
6
+ import doc from './vocab.json' with {
7
+ type: 'json'
8
+ };
9
+ import { toolHelp } from "./show.js";
10
+ import { commandFor } from "./run.js";
11
+ import { queue } from "./restart.js";
12
+ export let definitions = toolsIn([
13
+ doc
14
+ ]);
15
+ export let operations = (host, options = {})=>definitions.map((tool)=>({
16
+ ...tool,
17
+ name: tool.name,
18
+ run: async (call)=>{
19
+ if (tool.name == 'restart') {
20
+ let runtimeDir = options.runtimeDir ?? system.env.get('XDG_RUNTIME_DIR');
21
+ if (!runtimeDir) {
22
+ throw new CallError('config', 'restart needs $XDG_RUNTIME_DIR');
23
+ }
24
+ return [
25
+ said(call, await queue(runtimeDir, {
26
+ config: options.config,
27
+ replace: argsOf(call).replace
28
+ }, options.run))
29
+ ];
30
+ }
31
+ let words = argsOf(call).words ?? [];
32
+ let tools = host.tools;
33
+ if (!words.length) {
34
+ return [
35
+ said(call, tools.map((t)=>t.name).join('\n'))
36
+ ];
37
+ }
38
+ let found = commandFor(tools, words);
39
+ if (!found) {
40
+ let group = tools.filter((t)=>words.length == 1 && t.noun == words[0]);
41
+ if (group.length) {
42
+ return [
43
+ said(call, group.map((t)=>t.name).join('\n'))
44
+ ];
45
+ }
46
+ throw new CallError('arguments', `No tool named ${words.join(' ')}`);
47
+ }
48
+ return [
49
+ said(call, toolHelp(found.verb))
50
+ ];
51
+ }
52
+ }));
53
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sources":["./operations.ts"],"names":[],"mappings":"AAAA,YAAY,wCAA6C;AAIzD,SAAS,MAAM,gCAAqC;AAEpD,SAAS,SAAS,kCAAuC;AACzD,SAAS,IAAI,kCAAuC;AACpD,SAAS,OAAO,iCAAsC;AACtD,OAAO,SAAS,oBAAoB;EAAE,MAAM;AAAO,EAAC;AACpD,SAAS,QAAQ,oBAAmB;AACpC,SAAS,UAAU,mBAAkB;AACrC,SAAS,KAAK,uBAA2C;AAEzD,OAAO,IAAI,cAAc,QAAQ;EAAC;CAAI,EAAC;AAUvC,OAAO,IAAI,aAAa,CACtB,MACA,UAAqB,CAAC,CAAC,GAEvB,YAAY,GAAG,CAAC,CAAC,OAAS,CAAC;MACzB,GAAG,IAAI;MACP,MAAM,KAAK,IAAI;MACf,KAAK,OAAO;QACV,IAAI,KAAK,IAAI,IAAI,WAAW;UAC1B,IAAI,aAAa,QAAQ,UAAU,IACjC,OAAO,GAAG,CAAC,GAAG,CAAC;UACjB,IAAI,CAAC,YAAY;YACf,MAAM,IAAI,UACR,UACA;UAEJ;UACA,OAAO;YAAC,KACN,MACA,MAAM,MAAM,YAAY;cACtB,QAAQ,QAAQ,MAAM;cACtB,SAAS,OAAO,MAAM,OAAO;YAC/B,GAAG,QAAQ,GAAG;WACd;QACJ;QACA,IAAI,QAAS,OAAO,MAAM,KAAK,IAAI,EAAE;QACrC,IAAI,QAAQ,KAAK,KAAK;QACtB,IAAI,CAAC,MAAM,MAAM,EAAE;UACjB,OAAO;YAAC,KAAK,MAAM,MAAM,GAAG,CAAC,CAAC,IAAM,EAAE,IAAI,EAAE,IAAI,CAAC;WAAO;QAC1D;QACA,IAAI,QAAQ,WAAW,OAAO;QAC9B,IAAI,CAAC,OAAO;UACV,IAAI,QAAQ,MAAM,MAAM,CAAC,CAAC,IAAM,MAAM,MAAM,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC,EAAE;UACvE,IAAI,MAAM,MAAM,EAAE;YAChB,OAAO;cAAC,KAAK,MAAM,MAAM,GAAG,CAAC,CAAC,IAAM,EAAE,IAAI,EAAE,IAAI,CAAC;aAAO;UAC1D;UACA,MAAM,IAAI,UACR,aACA,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC,MAAM;QAEtC;QACA,OAAO;UAAC,KAAK,MAAM,SAAS,MAAM,IAAI;SAAG;MAC3C;IACF,CAAC,GAAE"}
package/operations.ts ADDED
@@ -0,0 +1,68 @@
1
+ import * as system from '@yaks/process/system'
2
+ // The concrete host's operations are tools beside its plugins' tools, without
3
+ // making a config load its own CLI as a plugin.
4
+ import type { NamedTool } from 'jsr:@yaks/graph@0.2.36'
5
+ import { argsOf } from '@yaks/graph/call'
6
+ import type { Host } from 'jsr:@yaks/host@0.2.36'
7
+ import { CallError } from '@yaks/tools/errors'
8
+ import { said } from '@yaks/tools/result'
9
+ import { toolsIn } from '@yaks/vocab/tools'
10
+ import doc from './vocab.json' with { type: 'json' }
11
+ import { toolHelp } from './show.js'
12
+ import { commandFor } from './run.js'
13
+ import { queue, type RestartOptions } from './restart.js'
14
+
15
+ export let definitions = toolsIn([doc])
16
+
17
+ /** What a restart is queued with: the config the host was read from, and the
18
+ * command boundary it queues through. */
19
+ export type Operating = {
20
+ config?: string
21
+ runtimeDir?: string
22
+ run?: RestartOptions['run']
23
+ }
24
+
25
+ export let operations = (
26
+ host: Pick<Host, 'tools'>,
27
+ options: Operating = {},
28
+ ): NamedTool[] =>
29
+ definitions.map((tool) => ({
30
+ ...tool,
31
+ name: tool.name!,
32
+ run: async (call) => {
33
+ if (tool.name == 'restart') {
34
+ let runtimeDir = options.runtimeDir ??
35
+ system.env.get('XDG_RUNTIME_DIR')
36
+ if (!runtimeDir) {
37
+ throw new CallError(
38
+ 'config',
39
+ 'restart needs $XDG_RUNTIME_DIR',
40
+ )
41
+ }
42
+ return [said(
43
+ call,
44
+ await queue(runtimeDir, {
45
+ config: options.config,
46
+ replace: argsOf(call).replace as string[] | undefined,
47
+ }, options.run),
48
+ )]
49
+ }
50
+ let words = (argsOf(call).words ?? []) as string[]
51
+ let tools = host.tools
52
+ if (!words.length) {
53
+ return [said(call, tools.map((t) => t.name).join('\n'))]
54
+ }
55
+ let found = commandFor(tools, words)
56
+ if (!found) {
57
+ let group = tools.filter((t) => words.length == 1 && t.noun == words[0])
58
+ if (group.length) {
59
+ return [said(call, group.map((t) => t.name).join('\n'))]
60
+ }
61
+ throw new CallError(
62
+ 'arguments',
63
+ `No tool named ${words.join(' ')}`,
64
+ )
65
+ }
66
+ return [said(call, toolHelp(found.verb))]
67
+ },
68
+ }))
package/package.json CHANGED
@@ -1,6 +1,117 @@
1
1
  {
2
2
  "name": "@yaks/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.36",
4
+ "homepage": "https://jsr.io/@yaks/cli",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./_dist/mod.d.ts",
9
+ "default": "./mod.js"
10
+ },
11
+ "./yak": {
12
+ "types": "./_dist/yak.d.ts",
13
+ "default": "./yak.js"
14
+ },
15
+ "./main": {
16
+ "types": "./_dist/main.d.ts",
17
+ "default": "./main.js"
18
+ },
19
+ "./config": {
20
+ "types": "./_dist/config.d.ts",
21
+ "default": "./config.js"
22
+ },
23
+ "./facets": {
24
+ "types": "./_dist/facets.d.ts",
25
+ "default": "./facets.js"
26
+ },
27
+ "./account-forward": {
28
+ "types": "./_dist/account-forward.d.ts",
29
+ "default": "./account-forward.js"
30
+ },
31
+ "./host": {
32
+ "types": "./_dist/host.d.ts",
33
+ "default": "./host.js"
34
+ },
35
+ "./install": {
36
+ "types": "./_dist/install.d.ts",
37
+ "default": "./install.js"
38
+ },
39
+ "./page": {
40
+ "types": "./_dist/page.d.ts",
41
+ "default": "./page.js"
42
+ },
43
+ "./memo": {
44
+ "types": "./_dist/memo.d.ts",
45
+ "default": "./memo.js"
46
+ },
47
+ "./release": {
48
+ "types": "./_dist/release.d.ts",
49
+ "default": "./release.js"
50
+ },
51
+ "./grammar": {
52
+ "types": "./_dist/grammar.d.ts",
53
+ "default": "./grammar.js"
54
+ },
55
+ "./answer": {
56
+ "types": "./_dist/answer.d.ts",
57
+ "default": "./answer.js"
58
+ },
59
+ "./terminal": {
60
+ "types": "./_dist/terminal.d.ts",
61
+ "default": "./terminal.js"
62
+ },
63
+ "./dependencies": {
64
+ "types": "./_dist/dependencies.d.ts",
65
+ "default": "./dependencies.js"
66
+ },
67
+ "./vault": {
68
+ "types": "./_dist/vault.d.ts",
69
+ "default": "./vault.js"
70
+ }
71
+ },
72
+ "license": "Apache-2.0",
73
+ "dependencies": {
74
+ "@yaks/alias": "0.2.36",
75
+ "@yaks/api": "0.2.36",
76
+ "@yaks/blob": "0.2.36",
77
+ "@yaks/code": "0.2.36",
78
+ "@yaks/edge": "0.2.36",
79
+ "@yaks/effects": "0.2.36",
80
+ "@yaks/feedback": "0.2.36",
81
+ "@yaks/file": "0.2.36",
82
+ "@yaks/fp": "0.2.36",
83
+ "@yaks/fts": "0.2.36",
84
+ "@yaks/git": "0.2.36",
85
+ "@yaks/graph": "0.2.36",
86
+ "@yaks/host": "0.2.36",
87
+ "@yaks/id": "0.2.36",
88
+ "@yaks/machine": "0.2.36",
89
+ "@yaks/process": "0.2.36",
90
+ "@yaks/query": "0.2.36",
91
+ "@yaks/reach": "0.2.36",
92
+ "@yaks/react": "0.2.36",
93
+ "@yaks/render": "0.2.36",
94
+ "@yaks/sandbox": "0.2.36",
95
+ "@yaks/secrets": "0.2.36",
96
+ "@yaks/spawn": "0.2.36",
97
+ "@yaks/sql": "0.2.36",
98
+ "@yaks/sqlite": "0.2.36",
99
+ "@yaks/sync": "0.2.36",
100
+ "@yaks/text": "0.2.36",
101
+ "@yaks/threads": "0.2.36",
102
+ "@yaks/timing": "0.2.36",
103
+ "@yaks/tools": "0.2.36",
104
+ "@yaks/trace": "0.2.36",
105
+ "@yaks/tracker": "0.2.36",
106
+ "@yaks/tui": "0.2.36",
107
+ "@yaks/ui": "0.2.36",
108
+ "@yaks/vocab": "0.2.36",
109
+ "@types/react": "19.3.0",
110
+ "es-module-lexer": "2.3.2",
111
+ "esbuild": "0.28.1",
112
+ "react": "19.3.0",
113
+ "typescript": "6.0.3"
114
+ },
115
+ "description": "The yak command line: it opens the graph a config file names, or connects to an MCP server, and turns every tool it finds there into a subcommand parsed through that tool's own input schema.",
116
+ "repository": "https://github.com/yak-sh/yak.git"
117
+ }
package/page.js ADDED
@@ -0,0 +1,211 @@
1
+ /**
2
+ * A page a plugin serves, exported as `@yaks/cli/page`: what a plugin's
3
+ * routes answer with besides the graph's doors, in the process that serves
4
+ * them. `kept` answers an address with a body made once and kept for the life
5
+ * of the process (a stylesheet, a document); `bundle` makes one such body, a
6
+ * page's script and everything it imports as one browser module. @yaks/web's
7
+ * app and @yaks/inspect's page are each one.
8
+ *
9
+ * Making a body is bounded: one that has not settled within the limit is
10
+ * aborted, cancelling the work it owns, and counts as a failure. A failure
11
+ * is never kept: it is reported once, where it happened, and the next request
12
+ * makes the body again. So a build that hangs heals on its own, without
13
+ * anybody restarting the host. A make still going when its host closes is
14
+ * aborted too, so nothing it spawned outlives the host.
15
+ *
16
+ * A release makes some bodies ahead: what a fresh install serves, made from
17
+ * the release's own checkout as it publishes (bin/publish.ts) and shipped in
18
+ * `./made/`, each under the hash of a key naming what it was made of. `ahead`
19
+ * finds one, so a host composed the same way answers with it instead of making
20
+ * it on the person's machine. A checkout ships none, and makes every body.
21
+ *
22
+ * @module
23
+ */ import { fault } from "@yaks/api/refuse";
24
+ import * as disk from "@yaks/file/io";
25
+ import { importing } from "@yaks/fp/imports";
26
+ import { settling } from "./held.js";
27
+ /** How long a body may take to make before it is given up on. A bundle from a
28
+ * checkout takes a few seconds, one from JSR far longer (./remote-page.ts),
29
+ * which is why a release makes a fresh install's ahead; a hung one never
30
+ * finishes (T-38240). */ export let LIMIT = 60_000;
31
+ let sha = async (body)=>[
32
+ ...new Uint8Array(await crypto.subtle.digest('SHA-256', typeof body == 'string' ? new TextEncoder().encode(body) : body))
33
+ ].map((b)=>b.toString(16).padStart(2, '0')).join('').slice(0, 32);
34
+ /** Where a release keeps the bodies it made ahead. */ export let MADE = new URL('./made/', import.meta.url);
35
+ let made = async (key, at)=>new URL(`${await sha(key)}.json`, at);
36
+ /** The body made ahead for `key`, or undefined where none was. */ export let ahead = async (key, at = MADE)=>{
37
+ try {
38
+ let { default: { body } } = await import((await made(key, at)).href, {
39
+ with: {
40
+ type: 'json'
41
+ }
42
+ });
43
+ return body;
44
+ } catch (e) {
45
+ if (e.code == 'ERR_MODULE_NOT_FOUND') return;
46
+ throw e;
47
+ }
48
+ };
49
+ /** Keep `body` in `dir` (a release's `./made/`) where `ahead(key)` finds it. */ export let keep = async (dir, key, body)=>{
50
+ await disk.mkdir(dir, {
51
+ recursive: true
52
+ });
53
+ await disk.writeTextFile(await made(key, dir), JSON.stringify({
54
+ body
55
+ }));
56
+ };
57
+ let tagged = (request, { body, tag }, type)=>{
58
+ let headers = {
59
+ 'content-type': type,
60
+ 'cache-control': 'no-cache',
61
+ etag: tag
62
+ };
63
+ return request.headers.get('if-none-match') == tag ? new Response(null, {
64
+ status: 304,
65
+ headers
66
+ }) : new Response(body, {
67
+ headers
68
+ });
69
+ };
70
+ /** `make(signal)`, given up on (and `signal` aborted) after `limit` ms, or
71
+ * once `closing` aborts. */ export let within = (limit, make, closing)=>new Promise((resolve, reject)=>{
72
+ let stop = new AbortController();
73
+ let made;
74
+ // Answered at once when given up on, and let finish what it spawned
75
+ // before the process ends (./held.ts). Only a make it stopped: one still
76
+ // going is its own host's, not a closing process's to wait on.
77
+ let quit = (why)=>{
78
+ stop.abort();
79
+ if (made) settling.add(made);
80
+ reject(new Error(why));
81
+ };
82
+ if (closing?.aborted) return quit('the host is closing');
83
+ let timer = setTimeout(()=>quit(`not made within ${limit / 1000}s`), limit);
84
+ let close = ()=>quit('the host is closing');
85
+ closing?.addEventListener('abort', close, {
86
+ once: true
87
+ });
88
+ made = make(stop.signal).then(resolve, reject).finally(()=>{
89
+ clearTimeout(timer);
90
+ closing?.removeEventListener('abort', close);
91
+ settling.delete(made);
92
+ });
93
+ });
94
+ /** The handler that answers `where` with the body `make` makes. `early` is
95
+ * handed its making, to start ahead of the first request (@yaks/host
96
+ * `Host.early`), which then finds it made; `closing` is the host's own signal,
97
+ * which ends a make still going. Its `tag()` is the etag of the body made,
98
+ * undefined until one is. */ export let kept = (where, type, make, { early, limit = LIMIT, closing } = {})=>{
99
+ let made;
100
+ let tag;
101
+ let attempt = ()=>{
102
+ let now = within(limit, make, closing).then(async (value)=>{
103
+ let body = typeof value == 'string' ? value : new Uint8Array(value);
104
+ tag = `"${await sha(body)}"`;
105
+ return {
106
+ body,
107
+ tag
108
+ };
109
+ });
110
+ made = now;
111
+ now.catch((e)=>{
112
+ if (made == now) made = undefined;
113
+ if (!closing?.aborted) fault(e, `GET ${where}`);
114
+ });
115
+ return now;
116
+ };
117
+ early?.(()=>made ?? attempt());
118
+ let handle = async (request)=>{
119
+ try {
120
+ return await tagged(request, await (made ?? attempt()), type);
121
+ } catch (e) {
122
+ return new Response(String(e.message ?? e), {
123
+ status: 500
124
+ });
125
+ }
126
+ };
127
+ return Object.assign(handle, {
128
+ tag: ()=>tag
129
+ });
130
+ };
131
+ /** Finish or cancel one build, always releasing its context: what it
132
+ * made. */ export let finished = async (build, signal)=>{
133
+ let cancel = ()=>{
134
+ void build.cancel();
135
+ };
136
+ signal?.addEventListener('abort', cancel, {
137
+ once: true
138
+ });
139
+ try {
140
+ if (signal?.aborted) throw new Error('browser bundle was stopped');
141
+ let result = await build.rebuild();
142
+ if (signal?.aborted) throw new Error('browser bundle was stopped');
143
+ return result;
144
+ } finally{
145
+ signal?.removeEventListener('abort', cancel);
146
+ await build.dispose();
147
+ }
148
+ };
149
+ /** Finish or cancel one build of one module, always releasing its context:
150
+ * the module it made. */ export let compiled = async (build, signal, done = ()=>{})=>{
151
+ let result = await finished(build, signal);
152
+ done(result);
153
+ return result.outputFiles[0].text;
154
+ };
155
+ /** Import maps name exact specifiers. An external root does not cover its subpaths. */ export let pageExternals = (specifiers = [])=>{
156
+ let exact = specifiers.map((specifier)=>specifier.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
157
+ return {
158
+ name: 'page-externals',
159
+ setup (build) {
160
+ if (!exact.length) return;
161
+ build.onResolve({
162
+ filter: new RegExp(`^(${exact.join('|')})$`)
163
+ }, (args)=>args.kind == 'entry-point' ? undefined : {
164
+ path: args.path,
165
+ external: true
166
+ });
167
+ }
168
+ };
169
+ };
170
+ // Deno fetches every import it can read in a module's source with the module
171
+ // graph, a dynamic one that never runs included, so the bundlers are imported
172
+ // by a computed address: a host serving only bodies made ahead downloads no
173
+ // esbuild.
174
+ let bundlers = {
175
+ local: new URL('./local-page.ts', import.meta.url),
176
+ remote: new URL('./remote-page.ts', import.meta.url)
177
+ };
178
+ /** One browser module: from a checkout, resolved through the npm workspace
179
+ * (./local-page.ts); from JSR, through Deno's resolver (./remote-page.ts).
180
+ * Every build owns its cancellation and cleanup, so concurrent builds stay
181
+ * independent. */ export let bundle = async (entry, signal, opts = {})=>{
182
+ if (signal?.aborted) throw new Error('browser bundle was stopped');
183
+ let at = entry instanceof URL ? entry : entry.at;
184
+ let from = at.protocol == 'file:' ? bundlers.local : bundlers.remote;
185
+ let bundler = await importing(from.href);
186
+ return bundler.bundle(entry, signal, opts);
187
+ };
188
+ /** Browser modules bundled together, from a checkout: each entry's module by
189
+ * its name, and the modules two or more of them import once, in chunks named
190
+ * by their bytes (`chunks`, by path), which every entry imports from the
191
+ * site's `/${CHUNKS}/`. A page loading several of them runs each shared
192
+ * module once, and a browser keeps the chunks for good. */ export let split = async (entries, signal, opts = {})=>{
193
+ if (signal?.aborted) throw new Error('browser bundle was stopped');
194
+ if (Object.values(entries).some((at)=>at.protocol != 'file:')) {
195
+ throw new Error('only modules in a checkout are bundled together');
196
+ }
197
+ let bundler = await importing(bundlers.local.href);
198
+ return bundler.split(entries, signal, opts);
199
+ };
200
+ /** Where split bundles keep their shared chunks, below the site's root. */ export let CHUNKS = '_yak';
201
+ export let CHUNK = `${CHUNKS}/chunk`;
202
+ /** The chunks a split module imports, by path from the site's root.
203
+ *
204
+ * ```ts
205
+ * import { assertEquals } from '@std/assert'
206
+ * assertEquals(imports('import{a}from"/_yak/chunk.A.js";import"/_yak/chunk.B.js"'), ['_yak/chunk.A.js', '_yak/chunk.B.js'])
207
+ * ```
208
+ */ export let imports = (code)=>[
209
+ ...code.matchAll(new RegExp(`["']/(${CHUNK}\\.[\\w-]+\\.js)["']`, 'g'))
210
+ ].map(([, chunk])=>chunk);
211
+ //# sourceMappingURL=page.js.map
package/page.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sources":["./page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,SAAS,KAAK,gCAAqC;AACnD,YAAY,+BAAoC;AAChD,SAAS,SAAS,gCAAqC;AACvD,SAAS,QAAQ,oBAAmB;AAKpC;;;uBAGuB,GACvB,OAAO,IAAI,QAAQ,OAAM;AAEzB,IAAI,MAAM,OAAO,OACf;OACK,IAAI,WACL,MAAM,OAAO,MAAM,CAAC,MAAM,CACxB,WACA,OAAO,QAAQ,WAAW,IAAI,cAAc,MAAM,CAAC,QAAQ;GAGhE,CACE,GAAG,CAAC,CAAC,IAAM,EAAE,QAAQ,CAAC,IAAI,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG;AAEnE,oDAAoD,GACpD,OAAO,I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