@turri-dev/cli 0.4.3-next.7ada234 → 0.4.3-next.853c640

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 (538) hide show
  1. package/README.md +26 -4
  2. package/dist/banner.js +259 -0
  3. package/dist/capture-cli.js +50 -68
  4. package/dist/chat-commands.js +6 -6
  5. package/dist/chat-models.js +17 -15
  6. package/dist/chat-tab-header.js +0 -1
  7. package/dist/chat-tabs.js +1 -1
  8. package/dist/chat-terminal.js +114 -73
  9. package/dist/chat-waiting.js +0 -20
  10. package/dist/cli-options.js +11 -7
  11. package/dist/cli-root.js +141 -0
  12. package/dist/cli.js +49 -55
  13. package/dist/conform-cli.js +4 -6
  14. package/dist/cultivate-cli.js +65 -97
  15. package/dist/doctor-cli.js +99 -0
  16. package/dist/drift-cli.js +2 -7
  17. package/dist/entry-renderers.js +107 -0
  18. package/dist/extension.js +14 -3379
  19. package/dist/init-config-cli.js +218 -0
  20. package/dist/launch-cli.js +55 -91
  21. package/dist/lineage-cli.js +2 -4
  22. package/dist/loop-cli.js +118 -237
  23. package/dist/panel-view.js +409 -0
  24. package/dist/parse-cli.js +5 -2
  25. package/dist/pi-launch.js +37 -13
  26. package/dist/pi-themes.js +2 -2
  27. package/dist/plain-code-blocks.js +1 -1
  28. package/dist/print-mode.js +20 -0
  29. package/dist/quiet.js +7 -106
  30. package/dist/regenerate/diff-view.js +6 -87
  31. package/dist/regenerate/jobs-tree.js +2 -17
  32. package/dist/regenerate/spec-map-view.js +3 -68
  33. package/dist/regenerate-cli.js +7 -11
  34. package/dist/skill-progress.js +25 -0
  35. package/dist/skill-report.js +52 -0
  36. package/dist/terminal-marks.js +21 -0
  37. package/dist/terminal-notifications.js +74 -19
  38. package/dist/terminal-view.js +239 -0
  39. package/dist/turri-versions.js +64 -6
  40. package/docs/README.md +3 -3
  41. package/docs/capture.md +79 -180
  42. package/docs/chats.md +4 -4
  43. package/docs/claude-subscription.md +1 -1
  44. package/docs/config.md +7 -9
  45. package/docs/development.md +30 -64
  46. package/docs/headless.md +3 -1
  47. package/docs/hosting.md +3 -251
  48. package/docs/installation.md +5 -3
  49. package/docs/launch.md +1 -1
  50. package/docs/sentinel.md +3 -3
  51. package/docs/using.md +6 -6
  52. package/package.json +13 -31
  53. package/dist/ask.d.ts +0 -90
  54. package/dist/ask.js +0 -170
  55. package/dist/background-skills.d.ts +0 -56
  56. package/dist/background-skills.js +0 -129
  57. package/dist/bedrock-region.d.ts +0 -66
  58. package/dist/bedrock-region.js +0 -144
  59. package/dist/brand.d.ts +0 -13
  60. package/dist/btw.d.ts +0 -69
  61. package/dist/btw.js +0 -174
  62. package/dist/capture/agents.d.ts +0 -406
  63. package/dist/capture/agents.js +0 -379
  64. package/dist/capture/area.d.ts +0 -58
  65. package/dist/capture/area.js +0 -197
  66. package/dist/capture/assemble.d.ts +0 -112
  67. package/dist/capture/assemble.js +0 -453
  68. package/dist/capture/capture.d.ts +0 -116
  69. package/dist/capture/capture.js +0 -1315
  70. package/dist/capture/chat.d.ts +0 -29
  71. package/dist/capture/chat.js +0 -94
  72. package/dist/capture/checks.d.ts +0 -142
  73. package/dist/capture/checks.js +0 -649
  74. package/dist/capture/config.d.ts +0 -13
  75. package/dist/capture/config.js +0 -66
  76. package/dist/capture/interface.d.ts +0 -71
  77. package/dist/capture/interface.js +0 -199
  78. package/dist/capture/map.d.ts +0 -56
  79. package/dist/capture/map.js +0 -530
  80. package/dist/capture/models.d.ts +0 -4
  81. package/dist/capture/models.js +0 -16
  82. package/dist/capture/plan.d.ts +0 -7
  83. package/dist/capture/plan.js +0 -13
  84. package/dist/capture/progress.d.ts +0 -111
  85. package/dist/capture/progress.js +0 -266
  86. package/dist/capture/python-interface.d.ts +0 -3
  87. package/dist/capture/python-interface.js +0 -17
  88. package/dist/capture/report.d.ts +0 -75
  89. package/dist/capture/report.js +0 -268
  90. package/dist/capture/runners.d.ts +0 -6
  91. package/dist/capture/runners.js +0 -59
  92. package/dist/capture/scripts.d.ts +0 -26
  93. package/dist/capture/scripts.js +0 -38
  94. package/dist/capture/state.d.ts +0 -310
  95. package/dist/capture/state.js +0 -43
  96. package/dist/capture/trial.d.ts +0 -34
  97. package/dist/capture/trial.js +0 -89
  98. package/dist/capture-cli.d.ts +0 -1
  99. package/dist/chat-commands.d.ts +0 -17
  100. package/dist/chat-idle.d.ts +0 -7
  101. package/dist/chat-idle.js +0 -20
  102. package/dist/chat-models.d.ts +0 -22
  103. package/dist/chat-records.d.ts +0 -50
  104. package/dist/chat-records.js +0 -107
  105. package/dist/chat-scope.d.ts +0 -14
  106. package/dist/chat-scope.js +0 -15
  107. package/dist/chat-skills.d.ts +0 -17
  108. package/dist/chat-skills.js +0 -18
  109. package/dist/chat-tab-header.d.ts +0 -16
  110. package/dist/chat-tabs.d.ts +0 -26
  111. package/dist/chat-terminal.d.ts +0 -24
  112. package/dist/chat-ui.d.ts +0 -33
  113. package/dist/chat-waiting.d.ts +0 -67
  114. package/dist/chats.d.ts +0 -346
  115. package/dist/chats.js +0 -1022
  116. package/dist/cli-options.d.ts +0 -24
  117. package/dist/cli.d.ts +0 -9
  118. package/dist/config-edit.d.ts +0 -83
  119. package/dist/config-edit.js +0 -393
  120. package/dist/config.d.ts +0 -428
  121. package/dist/config.js +0 -816
  122. package/dist/conform-cli.d.ts +0 -1
  123. package/dist/conformance-switch.d.ts +0 -25
  124. package/dist/conformance-switch.js +0 -86
  125. package/dist/cultivate-cli.d.ts +0 -1
  126. package/dist/doctor-tool.d.ts +0 -11
  127. package/dist/doctor-tool.js +0 -33
  128. package/dist/drift-cli.d.ts +0 -1
  129. package/dist/environment.d.ts +0 -37
  130. package/dist/environment.js +0 -109
  131. package/dist/extension.d.ts +0 -209
  132. package/dist/genome.d.ts +0 -77
  133. package/dist/genome.js +0 -288
  134. package/dist/graph.d.ts +0 -52
  135. package/dist/graph.js +0 -247
  136. package/dist/host-session.d.ts +0 -112
  137. package/dist/host-session.js +0 -103
  138. package/dist/host.d.ts +0 -40
  139. package/dist/host.js +0 -54
  140. package/dist/identity.d.ts +0 -7
  141. package/dist/identity.js +0 -75
  142. package/dist/init-config.d.ts +0 -172
  143. package/dist/init-config.js +0 -867
  144. package/dist/installed-providers.d.ts +0 -40
  145. package/dist/installed-providers.js +0 -98
  146. package/dist/jellyfish.d.ts +0 -40
  147. package/dist/judge.d.ts +0 -25
  148. package/dist/judge.js +0 -62
  149. package/dist/launch-agent.d.ts +0 -62
  150. package/dist/launch-agent.js +0 -339
  151. package/dist/launch-cli.d.ts +0 -1
  152. package/dist/launch-session.d.ts +0 -68
  153. package/dist/launch-session.js +0 -225
  154. package/dist/launch-tools.d.ts +0 -28
  155. package/dist/launch-tools.js +0 -72
  156. package/dist/launch-track.d.ts +0 -175
  157. package/dist/launch-track.js +0 -497
  158. package/dist/lineage-cli.d.ts +0 -1
  159. package/dist/loop-cli.d.ts +0 -35
  160. package/dist/loop-tools.d.ts +0 -103
  161. package/dist/loop-tools.js +0 -361
  162. package/dist/model-check.d.ts +0 -72
  163. package/dist/model-check.js +0 -162
  164. package/dist/module-report.d.ts +0 -9
  165. package/dist/new-project.d.ts +0 -10
  166. package/dist/new-project.js +0 -42
  167. package/dist/notice.d.ts +0 -115
  168. package/dist/notice.js +0 -61
  169. package/dist/parse-cli.d.ts +0 -1
  170. package/dist/parse-tool.d.ts +0 -9
  171. package/dist/parse-tool.js +0 -33
  172. package/dist/pi-launch.d.ts +0 -1
  173. package/dist/pi-settings.d.ts +0 -4
  174. package/dist/pi-themes.d.ts +0 -3
  175. package/dist/pi.d.ts +0 -248
  176. package/dist/pi.js +0 -889
  177. package/dist/picture-row.d.ts +0 -10
  178. package/dist/plain/check.d.ts +0 -63
  179. package/dist/plain/check.js +0 -236
  180. package/dist/plain/concepts.d.ts +0 -37
  181. package/dist/plain/concepts.js +0 -283
  182. package/dist/plain/cycles.d.ts +0 -21
  183. package/dist/plain/cycles.js +0 -190
  184. package/dist/plain/errors.d.ts +0 -26
  185. package/dist/plain/errors.js +0 -50
  186. package/dist/plain/files.d.ts +0 -47
  187. package/dist/plain/files.js +0 -161
  188. package/dist/plain/graph.d.ts +0 -107
  189. package/dist/plain/graph.js +0 -194
  190. package/dist/plain/highlight.d.ts +0 -43
  191. package/dist/plain/highlight.js +0 -196
  192. package/dist/plain/index.d.ts +0 -18
  193. package/dist/plain/index.js +0 -18
  194. package/dist/plain/liquid.d.ts +0 -22
  195. package/dist/plain/liquid.js +0 -124
  196. package/dist/plain/markdown.d.ts +0 -103
  197. package/dist/plain/markdown.js +0 -330
  198. package/dist/plain/module-concepts.d.ts +0 -32
  199. package/dist/plain/module-concepts.js +0 -80
  200. package/dist/plain/parser.d.ts +0 -163
  201. package/dist/plain/parser.js +0 -930
  202. package/dist/plain/plain.tmLanguage.json +0 -150
  203. package/dist/plain/project.d.ts +0 -48
  204. package/dist/plain/project.js +0 -155
  205. package/dist/plain/spec.d.ts +0 -152
  206. package/dist/plain/spec.js +0 -265
  207. package/dist/plain/stdlib.d.ts +0 -16
  208. package/dist/plain/stdlib.js +0 -48
  209. package/dist/plain/test-plain-file.d.ts +0 -59
  210. package/dist/plain/test-plain-file.js +0 -232
  211. package/dist/plain-code-blocks.d.ts +0 -14
  212. package/dist/plain-files.d.ts +0 -21
  213. package/dist/plain-files.js +0 -156
  214. package/dist/pointer-hover.d.ts +0 -12
  215. package/dist/question-dialog.d.ts +0 -60
  216. package/dist/questioning.d.ts +0 -55
  217. package/dist/questioning.js +0 -109
  218. package/dist/quiet.d.ts +0 -34
  219. package/dist/regenerate/activity.d.ts +0 -227
  220. package/dist/regenerate/activity.js +0 -250
  221. package/dist/regenerate/agent-env.d.ts +0 -51
  222. package/dist/regenerate/agent-env.js +0 -315
  223. package/dist/regenerate/agent-shell.d.ts +0 -54
  224. package/dist/regenerate/agent-shell.js +0 -121
  225. package/dist/regenerate/arbiter.d.ts +0 -68
  226. package/dist/regenerate/arbiter.js +0 -133
  227. package/dist/regenerate/audit.d.ts +0 -69
  228. package/dist/regenerate/audit.js +0 -212
  229. package/dist/regenerate/base-folder.d.ts +0 -70
  230. package/dist/regenerate/base-folder.js +0 -186
  231. package/dist/regenerate/cases.d.ts +0 -12
  232. package/dist/regenerate/cases.js +0 -149
  233. package/dist/regenerate/change-view.d.ts +0 -23
  234. package/dist/regenerate/change-view.js +0 -153
  235. package/dist/regenerate/chunk-plan.d.ts +0 -217
  236. package/dist/regenerate/chunk-plan.js +0 -937
  237. package/dist/regenerate/codebase.d.ts +0 -21
  238. package/dist/regenerate/codebase.js +0 -75
  239. package/dist/regenerate/command-check.d.ts +0 -66
  240. package/dist/regenerate/command-check.js +0 -577
  241. package/dist/regenerate/compaction.d.ts +0 -13
  242. package/dist/regenerate/compaction.js +0 -20
  243. package/dist/regenerate/confine.d.ts +0 -69
  244. package/dist/regenerate/confine.js +0 -311
  245. package/dist/regenerate/conform.d.ts +0 -66
  246. package/dist/regenerate/conform.js +0 -132
  247. package/dist/regenerate/conformance-agents.d.ts +0 -388
  248. package/dist/regenerate/conformance-agents.js +0 -1162
  249. package/dist/regenerate/conformance.d.ts +0 -191
  250. package/dist/regenerate/conformance.js +0 -1035
  251. package/dist/regenerate/conversation-writes.d.ts +0 -10
  252. package/dist/regenerate/conversation-writes.js +0 -100
  253. package/dist/regenerate/credentials.d.ts +0 -18
  254. package/dist/regenerate/credentials.js +0 -88
  255. package/dist/regenerate/debug-log.d.ts +0 -56
  256. package/dist/regenerate/debug-log.js +0 -236
  257. package/dist/regenerate/debugger.d.ts +0 -36
  258. package/dist/regenerate/debugger.js +0 -133
  259. package/dist/regenerate/delivery.d.ts +0 -2
  260. package/dist/regenerate/diagnose-job.d.ts +0 -2
  261. package/dist/regenerate/diagnose-job.js +0 -40
  262. package/dist/regenerate/diagnose.d.ts +0 -46
  263. package/dist/regenerate/diagnose.js +0 -92
  264. package/dist/regenerate/diff-view.d.ts +0 -64
  265. package/dist/regenerate/drift.d.ts +0 -120
  266. package/dist/regenerate/drift.js +0 -285
  267. package/dist/regenerate/environment-error.d.ts +0 -167
  268. package/dist/regenerate/environment-error.js +0 -342
  269. package/dist/regenerate/failure-reports.d.ts +0 -28
  270. package/dist/regenerate/failure-reports.js +0 -79
  271. package/dist/regenerate/job-log.d.ts +0 -30
  272. package/dist/regenerate/job-log.js +0 -105
  273. package/dist/regenerate/job-panel.d.ts +0 -20
  274. package/dist/regenerate/job-panel.js +0 -54
  275. package/dist/regenerate/jobs-tree.d.ts +0 -76
  276. package/dist/regenerate/jobs.d.ts +0 -231
  277. package/dist/regenerate/jobs.js +0 -522
  278. package/dist/regenerate/lanes.d.ts +0 -16
  279. package/dist/regenerate/lanes.js +0 -32
  280. package/dist/regenerate/launch.d.ts +0 -256
  281. package/dist/regenerate/launch.js +0 -689
  282. package/dist/regenerate/ledger-view.d.ts +0 -87
  283. package/dist/regenerate/ledger-view.js +0 -325
  284. package/dist/regenerate/ledger.d.ts +0 -368
  285. package/dist/regenerate/ledger.js +0 -357
  286. package/dist/regenerate/lineage.d.ts +0 -105
  287. package/dist/regenerate/lineage.js +0 -485
  288. package/dist/regenerate/list-arguments.d.ts +0 -21
  289. package/dist/regenerate/list-arguments.js +0 -121
  290. package/dist/regenerate/loop.d.ts +0 -423
  291. package/dist/regenerate/loop.js +0 -2087
  292. package/dist/regenerate/masking.d.ts +0 -19
  293. package/dist/regenerate/masking.js +0 -95
  294. package/dist/regenerate/model-names.d.ts +0 -33
  295. package/dist/regenerate/model-names.js +0 -92
  296. package/dist/regenerate/notes.d.ts +0 -159
  297. package/dist/regenerate/notes.js +0 -446
  298. package/dist/regenerate/os-sandbox.d.ts +0 -93
  299. package/dist/regenerate/os-sandbox.js +0 -283
  300. package/dist/regenerate/panel-dock.d.ts +0 -23
  301. package/dist/regenerate/paths.d.ts +0 -110
  302. package/dist/regenerate/paths.js +0 -190
  303. package/dist/regenerate/plain-palette.d.ts +0 -34
  304. package/dist/regenerate/prompt.d.ts +0 -230
  305. package/dist/regenerate/prompt.js +0 -741
  306. package/dist/regenerate/pulse-files.d.ts +0 -14
  307. package/dist/regenerate/pulse-files.js +0 -63
  308. package/dist/regenerate/records.d.ts +0 -132
  309. package/dist/regenerate/records.js +0 -327
  310. package/dist/regenerate/regenerate.d.ts +0 -106
  311. package/dist/regenerate/regenerate.js +0 -660
  312. package/dist/regenerate/regression.d.ts +0 -58
  313. package/dist/regenerate/regression.js +0 -188
  314. package/dist/regenerate/renames.d.ts +0 -42
  315. package/dist/regenerate/renames.js +0 -185
  316. package/dist/regenerate/requires.d.ts +0 -117
  317. package/dist/regenerate/requires.js +0 -377
  318. package/dist/regenerate/resources.d.ts +0 -57
  319. package/dist/regenerate/resources.js +0 -162
  320. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  321. package/dist/regenerate/scripts-being-written.js +0 -30
  322. package/dist/regenerate/self-check.d.ts +0 -29
  323. package/dist/regenerate/self-check.js +0 -119
  324. package/dist/regenerate/services.d.ts +0 -28
  325. package/dist/regenerate/services.js +0 -158
  326. package/dist/regenerate/shell.d.ts +0 -91
  327. package/dist/regenerate/shell.js +0 -320
  328. package/dist/regenerate/side-panel.d.ts +0 -64
  329. package/dist/regenerate/spec-map-view.d.ts +0 -147
  330. package/dist/regenerate/spec-map.d.ts +0 -160
  331. package/dist/regenerate/spec-map.js +0 -596
  332. package/dist/regenerate/spec-steps.d.ts +0 -180
  333. package/dist/regenerate/spec-steps.js +0 -729
  334. package/dist/regenerate/standing.d.ts +0 -28
  335. package/dist/regenerate/standing.js +0 -30
  336. package/dist/regenerate/state.d.ts +0 -21
  337. package/dist/regenerate/state.js +0 -10
  338. package/dist/regenerate/steering.d.ts +0 -56
  339. package/dist/regenerate/steering.js +0 -119
  340. package/dist/regenerate/stop-report.d.ts +0 -43
  341. package/dist/regenerate/stop-report.js +0 -160
  342. package/dist/regenerate/submit-work.d.ts +0 -44
  343. package/dist/regenerate/submit-work.js +0 -76
  344. package/dist/regenerate/test-kinds.d.ts +0 -85
  345. package/dist/regenerate/test-kinds.js +0 -171
  346. package/dist/regenerate/test-scripts.d.ts +0 -240
  347. package/dist/regenerate/test-scripts.js +0 -847
  348. package/dist/regenerate/testing-steps.d.ts +0 -52
  349. package/dist/regenerate/testing-steps.js +0 -129
  350. package/dist/regenerate/testing.d.ts +0 -150
  351. package/dist/regenerate/testing.js +0 -438
  352. package/dist/regenerate/transcript-view.d.ts +0 -21
  353. package/dist/regenerate/unit-gate.d.ts +0 -27
  354. package/dist/regenerate/unit-gate.js +0 -20
  355. package/dist/regenerate/unit-review.d.ts +0 -152
  356. package/dist/regenerate/unit-review.js +0 -361
  357. package/dist/regenerate/web.d.ts +0 -61
  358. package/dist/regenerate/web.js +0 -256
  359. package/dist/regenerate/workspace.d.ts +0 -12
  360. package/dist/regenerate/workspace.js +0 -99
  361. package/dist/regenerate-cli.d.ts +0 -1
  362. package/dist/reopen.d.ts +0 -29
  363. package/dist/reopen.js +0 -47
  364. package/dist/resume-line.d.ts +0 -5
  365. package/dist/review/live.d.ts +0 -72
  366. package/dist/review/live.js +0 -166
  367. package/dist/rules.d.ts +0 -20
  368. package/dist/rules.js +0 -47
  369. package/dist/run-report.d.ts +0 -88
  370. package/dist/run-report.js +0 -338
  371. package/dist/screen-padding.d.ts +0 -28
  372. package/dist/self-invocation.d.ts +0 -36
  373. package/dist/self-invocation.js +0 -137
  374. package/dist/sentinel-chat.d.ts +0 -19
  375. package/dist/sentinel-chat.js +0 -226
  376. package/dist/sentinel-check.d.ts +0 -36
  377. package/dist/sentinel-check.js +0 -78
  378. package/dist/sentinel.d.ts +0 -107
  379. package/dist/sentinel.js +0 -601
  380. package/dist/settings.d.ts +0 -45
  381. package/dist/settings.js +0 -378
  382. package/dist/setup.d.ts +0 -97
  383. package/dist/setup.js +0 -436
  384. package/dist/skill-progress.d.ts +0 -46
  385. package/dist/skill.d.ts +0 -102
  386. package/dist/skill.js +0 -147
  387. package/dist/skills.d.ts +0 -54
  388. package/dist/skills.js +0 -111
  389. package/dist/spawn-async.d.ts +0 -18
  390. package/dist/spawn-async.js +0 -35
  391. package/dist/stack.d.ts +0 -80
  392. package/dist/stack.js +0 -206
  393. package/dist/stdlib.d.ts +0 -43
  394. package/dist/stdlib.js +0 -118
  395. package/dist/surface.d.ts +0 -5
  396. package/dist/surface.js +0 -18
  397. package/dist/terminal-images.d.ts +0 -2
  398. package/dist/terminal-notifications.d.ts +0 -37
  399. package/dist/test-plain-files.d.ts +0 -41
  400. package/dist/test-plain-files.js +0 -172
  401. package/dist/tools.d.ts +0 -101
  402. package/dist/tools.js +0 -242
  403. package/dist/turri-versions.d.ts +0 -71
  404. package/genome/capture/capture.md +0 -26
  405. package/genome/capture/check-conventions.md +0 -5
  406. package/genome/capture/check-reference.md +0 -12
  407. package/genome/capture/compact.md +0 -7
  408. package/genome/capture/concepts.md +0 -3
  409. package/genome/capture/divide.md +0 -9
  410. package/genome/capture/feature.md +0 -45
  411. package/genome/capture/interface.md +0 -9
  412. package/genome/capture/modules.md +0 -25
  413. package/genome/capture/outline.md +0 -11
  414. package/genome/capture/python-interface.py +0 -111
  415. package/genome/capture/readability.md +0 -12
  416. package/genome/capture/reference.md +0 -10
  417. package/genome/capture/runners/python-requirements.sh +0 -67
  418. package/genome/capture/split.md +0 -9
  419. package/genome/capture/survey.md +0 -39
  420. package/genome/capture/trial.md +0 -18
  421. package/genome/capture/verify.md +0 -7
  422. package/genome/rules/bullet-continuation.md +0 -61
  423. package/genome/rules/concise-specs-examples.md +0 -460
  424. package/genome/rules/concise-specs-integration-examples.md +0 -281
  425. package/genome/rules/concise-specs.md +0 -80
  426. package/genome/rules/definitions.md +0 -107
  427. package/genome/rules/examples/integration-embedded-testing/run_conformance_tests_java.sh +0 -161
  428. package/genome/rules/examples/integration-embedded-testing/run_unittests_java.sh +0 -50
  429. package/genome/rules/exported-concepts.md +0 -39
  430. package/genome/rules/func-specs.md +0 -164
  431. package/genome/rules/impl-reqs.md +0 -68
  432. package/genome/rules/import-modules.md +0 -49
  433. package/genome/rules/integration-embedded-testing.md +0 -273
  434. package/genome/rules/integration-embedded.md +0 -171
  435. package/genome/rules/integration-standalone.md +0 -135
  436. package/genome/rules/integrations.md +0 -136
  437. package/genome/rules/linked-resources.md +0 -76
  438. package/genome/rules/module-structure.md +0 -112
  439. package/genome/rules/project-model.md +0 -69
  440. package/genome/rules/required-concepts.md +0 -44
  441. package/genome/rules/requires-modules.md +0 -81
  442. package/genome/rules/semantic-ids.md +0 -49
  443. package/genome/rules/stdlib.md +0 -37
  444. package/genome/rules/test-plain-files.md +0 -138
  445. package/genome/rules/test-reqs.md +0 -57
  446. package/genome/rules/turri-regeneration.md +0 -66
  447. package/genome/skills/analyze-2-func-specs/SKILL.md +0 -116
  448. package/genome/skills/analyze-func-specs/SKILL.md +0 -137
  449. package/genome/skills/break-down-func-spec/SKILL.md +0 -229
  450. package/genome/skills/consolidate-concepts/SKILL.md +0 -192
  451. package/genome/skills/convert-old-syntax/SKILL.md +0 -68
  452. package/genome/skills/convert-old-syntax/references/rubric.md +0 -11
  453. package/genome/skills/debug-specs/SKILL.md +0 -194
  454. package/genome/skills/implement-conformance-testing-script/SKILL.md +0 -247
  455. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_cypress.ps1 +0 -337
  456. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_golang.ps1 +0 -111
  457. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +0 -151
  458. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.ps1 +0 -103
  459. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +0 -146
  460. package/genome/skills/implement-unit-testing-script/SKILL.md +0 -171
  461. package/genome/skills/implement-unit-testing-script/assets/run_unittests_flutter.ps1 +0 -87
  462. package/genome/skills/implement-unit-testing-script/assets/run_unittests_golang.ps1 +0 -73
  463. package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +0 -82
  464. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.ps1 +0 -81
  465. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +0 -102
  466. package/genome/skills/implement-unit-testing-script/assets/run_unittests_react.ps1 +0 -87
  467. package/genome/skills/refactor-module/SKILL.md +0 -218
  468. package/genome/skills/resolve-section-ownership/SKILL.md +0 -64
  469. package/genome/skills/resolve-spec-conflict/SKILL.md +0 -102
  470. package/stdlib/backend/common.plain +0 -25
  471. package/stdlib/backend/conformance/common.plain +0 -12
  472. package/stdlib/backend/conformance/go-gin.plain +0 -9
  473. package/stdlib/backend/conformance/go-nethttp.plain +0 -9
  474. package/stdlib/backend/conformance/java-springboot.plain +0 -9
  475. package/stdlib/backend/conformance/python-django.plain +0 -9
  476. package/stdlib/backend/conformance/python-fastapi.plain +0 -9
  477. package/stdlib/backend/conformance/python-flask.plain +0 -9
  478. package/stdlib/backend/conformance/rust-axum.plain +0 -9
  479. package/stdlib/backend/conformance/typescript-express.plain +0 -9
  480. package/stdlib/backend/conformance/typescript-fastify.plain +0 -9
  481. package/stdlib/backend/conformance/typescript-nestjs.plain +0 -9
  482. package/stdlib/backend/go-gin.plain +0 -18
  483. package/stdlib/backend/go-nethttp.plain +0 -18
  484. package/stdlib/backend/java-springboot.plain +0 -19
  485. package/stdlib/backend/python-django.plain +0 -19
  486. package/stdlib/backend/python-fastapi.plain +0 -23
  487. package/stdlib/backend/python-flask.plain +0 -23
  488. package/stdlib/backend/rust-axum.plain +0 -17
  489. package/stdlib/backend/typescript-express.plain +0 -19
  490. package/stdlib/backend/typescript-fastify.plain +0 -19
  491. package/stdlib/backend/typescript-nestjs.plain +0 -19
  492. package/stdlib/cli/common.plain +0 -17
  493. package/stdlib/cli/conformance/common.plain +0 -11
  494. package/stdlib/cli/conformance/go-cobra.plain +0 -9
  495. package/stdlib/cli/conformance/go-flag.plain +0 -9
  496. package/stdlib/cli/conformance/java-picocli.plain +0 -9
  497. package/stdlib/cli/conformance/python-argparse.plain +0 -9
  498. package/stdlib/cli/conformance/python-click.plain +0 -9
  499. package/stdlib/cli/conformance/python-typer.plain +0 -9
  500. package/stdlib/cli/conformance/rust-clap.plain +0 -9
  501. package/stdlib/cli/conformance/typescript-commander.plain +0 -9
  502. package/stdlib/cli/go-cobra.plain +0 -14
  503. package/stdlib/cli/go-flag.plain +0 -14
  504. package/stdlib/cli/java-picocli.plain +0 -15
  505. package/stdlib/cli/python-argparse.plain +0 -18
  506. package/stdlib/cli/python-click.plain +0 -16
  507. package/stdlib/cli/python-typer.plain +0 -16
  508. package/stdlib/cli/rust-clap.plain +0 -14
  509. package/stdlib/cli/typescript-commander.plain +0 -17
  510. package/stdlib/frontend/angular.plain +0 -17
  511. package/stdlib/frontend/common.plain +0 -17
  512. package/stdlib/frontend/conformance/angular.plain +0 -5
  513. package/stdlib/frontend/conformance/common.plain +0 -11
  514. package/stdlib/frontend/conformance/react-vite.plain +0 -5
  515. package/stdlib/frontend/conformance/sveltekit-spa.plain +0 -5
  516. package/stdlib/frontend/conformance/vue-vite.plain +0 -5
  517. package/stdlib/frontend/react-vite.plain +0 -16
  518. package/stdlib/frontend/sveltekit-spa.plain +0 -16
  519. package/stdlib/frontend/vue-vite.plain +0 -16
  520. package/stdlib/lang/go.plain +0 -13
  521. package/stdlib/lang/java.plain +0 -12
  522. package/stdlib/lang/python.plain +0 -18
  523. package/stdlib/lang/rust.plain +0 -12
  524. package/stdlib/lang/typescript.plain +0 -13
  525. package/stdlib/library/common.plain +0 -15
  526. package/stdlib/library/conformance/common.plain +0 -9
  527. package/stdlib/library/conformance/go.plain +0 -9
  528. package/stdlib/library/conformance/java-gradle.plain +0 -9
  529. package/stdlib/library/conformance/java-maven.plain +0 -9
  530. package/stdlib/library/conformance/python.plain +0 -9
  531. package/stdlib/library/conformance/rust.plain +0 -9
  532. package/stdlib/library/conformance/typescript.plain +0 -9
  533. package/stdlib/library/go.plain +0 -12
  534. package/stdlib/library/java-gradle.plain +0 -13
  535. package/stdlib/library/java-maven.plain +0 -13
  536. package/stdlib/library/python.plain +0 -13
  537. package/stdlib/library/rust.plain +0 -12
  538. package/stdlib/library/typescript.plain +0 -15
@@ -1,379 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { defineTool } from "@earendil-works/pi-coding-agent";
4
- import { Type } from "typebox";
5
- import { readProjectConfig, roleTurnLimitMs } from "../config.js";
6
- import { PACKAGE_ROOT } from "../environment.js";
7
- import { ask, BEGIN, createExecutor, timeTurns } from "../pi.js";
8
- import { withActivity } from "../regenerate/activity.js";
9
- import { confinedTools } from "../regenerate/confine.js";
10
- import { STDLIB_DIR } from "../regenerate/paths.js";
11
- /**
12
- * Capture's agents, each fresh, each with one thing to hand over through a submit tool of its own: the survey, its
13
- * conventions checked, a split, an outline, a part's features divided, a feature, the interface no feature captured, a
14
- * part's features gathered into modules, concepts reconciled, a module's readability pass, its interface checked against the code,
15
- * its scenarios tried on the original. The harness checks what each hands over and sends it back with what is wrong, a
16
- * few times at most; what still does not hold is the harness's to deal with - a feature left uncaptured, the report
17
- * saying so - never a stop of the whole capture.
18
- */
19
- /** How many times an answer that does not hold is sent back. */
20
- export const RETRIES = 2;
21
- /** How long one turn of a capture agent may take, unless the config says: exploring takes a while. */
22
- export const CAPTURE_TURN_LIMIT_MS = 10 * 60 * 1000;
23
- /** Part of the first response, so explaining the work costs no separate model call. */
24
- export const CAPTURE_PLAN_NOTE = "Before your first tool call, write one short line beginning 'Plan: ' for the person watching. Say what you will inspect, write or test for this assignment. Then do it in the same turn. Say the plan only once.";
25
- const PROMPTS_DIR = join(PACKAGE_ROOT, "genome", "capture");
26
- // These reviewers can only return edits to existing text. Keep the rules for that text and the full source/reference
27
- // evidence; they have no modules, stacks, integrations, testing scripts or regeneration workflow to design.
28
- const REVIEW_TEXT_RULES = ["concise-specs", "concise-specs-examples", "func-specs", "test-plain-files", "definitions", "linked-resources", "bullet-continuation", "semantic-ids"];
29
- /** One of capture's prompts, from genome/capture. */
30
- export function capturePrompt(name) {
31
- return readFileSync(join(PROMPTS_DIR, `${name}.md`), "utf8").trim();
32
- }
33
- /** What the agent's session reports, handed to its watch - and the capture's stop, which ends its turn. */
34
- function watchedBy(watch, signal) {
35
- let opening = "";
36
- let announced = false;
37
- // Only the explicitly labelled opening line is public. Reasoning, later prose and tool results never enter this trace.
38
- const announce = () => {
39
- if (announced)
40
- return;
41
- announced = true;
42
- watch?.plan(/^\s*Plan:[ \t]*([^\r\n]+)/i.exec(opening)?.[1]?.trim());
43
- };
44
- return {
45
- stage: () => { },
46
- activity: (line) => watch?.did(line),
47
- now: (label) => {
48
- if (label === "preparing a tool call")
49
- announce();
50
- watch?.now(label);
51
- },
52
- usage: (usage) => watch?.spent(usage.cost),
53
- transcript: (entry) => {
54
- if (announced)
55
- return;
56
- if (entry.kind === "text") {
57
- opening += entry.text.slice(0, 320 - opening.length);
58
- if (opening.trimStart().includes("\n") || opening.length === 320)
59
- announce();
60
- }
61
- else if (entry.kind === "tool")
62
- announce();
63
- },
64
- ...(signal !== undefined ? { signal } : {}),
65
- };
66
- }
67
- /** Ask an agent for one answer, sending it back with what is wrong until it holds. Undefined, with the last problems, when it never did. */
68
- export async function askAgent(options, tool, check) {
69
- return watched(options.watch, options.signal, () => answerOf(options, tool, check));
70
- }
71
- /** Work of agents its watch sees from start to end - each tool call, each answer's cost - and the capture's stop ends. */
72
- export async function watched(watch, signal, work) {
73
- watch?.started();
74
- try {
75
- return await withActivity(watchedBy(watch, signal), work);
76
- }
77
- finally {
78
- watch?.ended();
79
- }
80
- }
81
- async function answerOf(options, tool, check) {
82
- let answer;
83
- let finding = "";
84
- const submit = defineTool({
85
- name: tool.name,
86
- label: tool.label,
87
- description: tool.description,
88
- parameters: Type.Object({ ...tool.parameters.properties, finding: Type.String({ description: "For the person watching: one short sentence naming the most useful behaviour you found, corrected or could not verify. Give a concrete example rather than a count or a list of actions." }) }),
89
- async execute(_id, params) {
90
- const { finding: report, ...work } = params;
91
- answer = tool.convert(work);
92
- finding = text(report);
93
- return { content: [{ type: "text", text: "Recorded." }], details: {}, terminate: true };
94
- },
95
- });
96
- const fence = options.shell !== undefined
97
- ? confinedTools({ workdir: options.shell.workdir, read: [options.shell.workdir], write: [options.shell.workdir], shellHome: options.shell.home })
98
- : options.reads
99
- ? confinedTools({ workdir: options.root, read: [options.root, STDLIB_DIR], write: [], noBash: true })
100
- : undefined;
101
- const session = await createExecutor({
102
- cwd: options.plainDir,
103
- customTools: [submit, ...(fence?.tools ?? [])],
104
- tools: [...(fence?.names ?? []), submit.name],
105
- model: options.model,
106
- rules: options.rules && (options.prompt === "verify" || options.prompt === "readability") ? REVIEW_TEXT_RULES : options.rules,
107
- label: options.label,
108
- role: options.role,
109
- ...(fence !== undefined ? { system: fence.note } : {}),
110
- task: [capturePrompt("capture"), ...[options.prompt].flat().map(capturePrompt), options.context, CAPTURE_PLAN_NOTE].join("\n\n"),
111
- budget: { calls: options.calls, finish: [submit.name] },
112
- });
113
- const limit = turnLimit(options.plainDir, options.role);
114
- timeTurns(session, limit === 0 ? 0 : Math.max(limit, options.turnAtLeastMs ?? 0));
115
- let problems = [];
116
- try {
117
- await ask(session, BEGIN);
118
- for (let again = 0;; again += 1) {
119
- problems = answer === undefined ? [`You did not call ${submit.name}.`] : check(answer);
120
- if (problems.length === 0) {
121
- if (finding)
122
- options.watch?.finding(finding);
123
- return { answer, problems };
124
- }
125
- if (again >= RETRIES)
126
- return { problems };
127
- answer = undefined;
128
- await ask(session, `That does not hold:\n- ${problems.join("\n- ")}\n\nCall ${submit.name} again, with it fixed.`);
129
- }
130
- }
131
- finally {
132
- session.dispose();
133
- }
134
- }
135
- function turnLimit(plainDir, role) {
136
- try {
137
- return roleTurnLimitMs(readProjectConfig(plainDir), role) ?? CAPTURE_TURN_LIMIT_MS;
138
- }
139
- catch {
140
- return CAPTURE_TURN_LIMIT_MS;
141
- }
142
- }
143
- const Strings = (description) => Type.Array(Type.String(), { description });
144
- const Definitions = Type.Array(Type.Object({
145
- concept: Type.String({ description: "The concept, between colons: :Note:." }),
146
- text: Type.String({ description: "One plain sentence that starts with the concept: \":Note: is a short text a :User: keeps.\"" }),
147
- }));
148
- const LeftOutSchema = Type.Array(Type.Object({ path: Type.String(), why: Type.String() }), { description: "What is not captured, by path, with why." });
149
- /** A list of strings an agent handed over, its blanks dropped. */
150
- export function strings(value) {
151
- return Array.isArray(value) ? value.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item !== "") : [];
152
- }
153
- function records(value) {
154
- return Array.isArray(value) ? value.filter((item) => item !== null && typeof item === "object") : [];
155
- }
156
- function text(value) {
157
- return typeof value === "string" ? value.trim() : "";
158
- }
159
- export function definitionsOf(value) {
160
- return records(value).map((item) => ({ concept: text(item.concept), text: text(item.text) }));
161
- }
162
- export function leftOutOf(value) {
163
- return records(value).map((item) => ({ path: text(item.path).replace(/\/+$/, "") || ".", why: text(item.why) }));
164
- }
165
- const ConventionSchema = Type.Object({
166
- text: Type.String({ description: "One fact every feature follows, exact - the stream, the text, the code - without the leading - ." }),
167
- where: Strings("The files whose code decides it, relative to the codebase."),
168
- });
169
- export const CONVENTIONS_TOOL = {
170
- name: "submit_capture_conventions",
171
- label: "Submit the conventions",
172
- description: "Every convention as the code has it - those that hold word for word, those corrected, and any the code shows that was missed - and what you changed.",
173
- parameters: Type.Object({
174
- conventions: Type.Array(ConventionSchema),
175
- changes: Strings("What you changed, a line each, with why - citing the code. None when every convention held."),
176
- }),
177
- };
178
- export const SURVEY_TOOL = {
179
- name: "submit_capture_survey",
180
- label: "Submit the survey",
181
- description: "The codebase's parts, each with its stack, its implementation and test reqs and its core concepts; what is left out; what you assumed.",
182
- parameters: Type.Object({
183
- parts: Type.Array(Type.Object({
184
- name: Type.String({ description: "Short kebab-case." }),
185
- about: Type.String({ description: "What the part is, in a line." }),
186
- paths: Strings("Its folders and files, relative to the codebase - . for the whole of it."),
187
- stdlib_stack: Type.Optional(Type.String({ description: "A standard library stack it imports, stdlib/<kind>/<stack> - only one the original agrees with." })),
188
- stdlib_conformance: Type.Optional(Type.Boolean({ description: "Import that stack's conformance template too." })),
189
- implementation_reqs: Strings("How it is built, one fact each, without the leading - ."),
190
- conventions: Type.Optional(Type.Array(ConventionSchema, {
191
- description: "What every feature does the same way and a user or a script relies on: how errors are written, the exit code or status of each kind of failure, how input and output act when not a terminal, and what reaches the other side of every call it makes or answers - the headers it adds, how bodies and headers are encoded, when a body is read.",
192
- })),
193
- test_reqs: Strings("How its conformance tests run, one fact each, and what each sets up so the software acts the same on every run and machine - empty when the conformance template says it all."),
194
- definitions: Definitions,
195
- runners: Type.Object({
196
- unit: Type.Union([Type.Literal("pytest"), Type.Literal("custom")]),
197
- conformance: Type.Union([Type.Literal("pytest"), Type.Literal("bats"), Type.Literal("custom")]),
198
- build_dir_env: Type.Optional(Type.String({ description: "Build-folder variable used by external tests, if any. Omit rather than an empty string." })),
199
- python_env: Type.Optional(Type.String({ description: "Interpreter variable used by external tests, if any. Omit rather than an empty string." })),
200
- }, { description: "Select each runner explicitly. pytest: ordinary pytest for a root requirements.txt project, or an installable pyproject.toml package (pip install . creates its console scripts; external tests can use a src layout). bats: bats-core with a root requirements.txt build, including --separate-stderr and env -C. Choose custom when the suite needs other services, plugins, checkers, environment or setup." }),
201
- })),
202
- left_out: LeftOutSchema,
203
- assumptions: Strings("What you decided where the codebase left it open, a line each."),
204
- separate_concerns: Type.Optional(Type.String({ description: "Only for a single part whose behaviour demonstrably needs separate writers: name distinct independently useful concerns that cannot fit one readable module of eight functional specs. Omit when one compact writer can capture it." })),
205
- }),
206
- };
207
- export const REFERENCE_TOOL = {
208
- name: "submit_capture_reference",
209
- label: "Submit the interface reference",
210
- description: "Every piece of the interface the files you were given define - each command, argument, option, route and environment variable - exactly as the code has it, each with where it is defined; and what the map found there that is not the software's interface, with why.",
211
- parameters: Type.Object({
212
- entries: Type.Array(Type.Object({
213
- kind: Type.Union([Type.Literal("command"), Type.Literal("argument"), Type.Literal("option"), Type.Literal("route"), Type.Literal("env"), Type.Literal("other")]),
214
- name: Type.String({ description: "Exactly as the code has it: --proxy, http, httpie plugins install, GET /notes/<int:id> (the code's own parameter syntax), HTTPIE_CONFIG_DIR." }),
215
- aliases: Strings("Every other name it has, as the code has each: -x."),
216
- command: Type.Optional(Type.String({ description: "For an argument or option: one actual command, as typed. Repeat a shared option's entry for each command accepting it; never join commands into a made-up command name." })),
217
- takes: Type.Optional(Type.String({ description: "What it takes: its value's form or type, as the code names it - its metavar, its type, a body." })),
218
- choices: Strings("The values it accepts when the code lists them, each exactly as the code has it."),
219
- default: Type.Optional(Type.String({ description: "Its default, exactly as the code has it. Left out when it has none." })),
220
- repeatable: Type.Optional(Type.Boolean()),
221
- required: Type.Optional(Type.Boolean()),
222
- hidden: Type.Optional(Type.Boolean({ description: "True when it is left out of its help." })),
223
- help: Type.Optional(Type.String({ description: "Its help text, word for word as the code has it, placeholders and all - never a summary." })),
224
- details: Strings("A route's parameters, fields and answers, a line each: query page: int, 1 by default; 201: the note created."),
225
- where: Type.String({ description: "path:line - the file it is defined in, relative to the codebase, and the line." }),
226
- also: Strings("Other files its literals come from: where a default or its choices are worked out."),
227
- })),
228
- excluded: Type.Array(Type.Object({ name: Type.String(), path: Type.String(), why: Type.String() }), { description: "What the map found in your files that is not the software's interface - an option of a development script, say - by name, with why. None when none." }),
229
- }),
230
- };
231
- export const REFERENCE_CHECKED_TOOL = {
232
- name: "submit_capture_reference_checked",
233
- label: "Submit the checked reference",
234
- description: "Every entry of the interface reference as the code has it - those that hold word for word, those corrected, those missed - every exclusion, and what you changed.",
235
- parameters: Type.Object({
236
- ...REFERENCE_TOOL.parameters.properties,
237
- changes: Strings("What you changed, a line each, with why - the file, and what its code does. None when every entry held."),
238
- }),
239
- };
240
- export const AREAS_TOOL = {
241
- name: "submit_capture_areas",
242
- label: "Submit the areas",
243
- description: "Your area split into smaller areas, in build order, every file in one of them or left out.",
244
- parameters: Type.Object({
245
- areas: Type.Array(Type.Object({
246
- name: Type.String({ description: "Short kebab-case, from what the area does." }),
247
- about: Type.String({ description: "What it does, in a line." }),
248
- paths: Strings("Its folders and files, relative to the codebase."),
249
- })),
250
- left_out: LeftOutSchema,
251
- }),
252
- };
253
- export const FEATURES_TOOL = {
254
- name: "submit_capture_features",
255
- label: "Submit the features",
256
- description: "Your area's features, in build order, each with the folders and files where it is built.",
257
- parameters: Type.Object({
258
- features: Type.Array(Type.Object({
259
- name: Type.String({ description: "Short kebab-case." }),
260
- title: Type.String({ description: "A few words." }),
261
- about: Type.String({ description: "What it lets someone do, in a line." }),
262
- paths: Strings("Where it is built, relative to the codebase."),
263
- })),
264
- left_out: LeftOutSchema,
265
- }),
266
- };
267
- export const OWNERS_TOOL = {
268
- name: "submit_capture_owners",
269
- label: "Submit the owners",
270
- description: "Each behaviour given to one feature: what every feature that stays owns, and the features merged into others.",
271
- parameters: Type.Object({
272
- features: Type.Array(Type.Object({
273
- feature: Type.String({ description: "The feature's key, as listed: <area>#<feature>." }),
274
- owns: Type.String({ description: "What it alone captures, in a line: its options, commands, messages and behaviour." }),
275
- }), { description: "Every feature that stays." }),
276
- merged: Type.Array(Type.Object({
277
- feature: Type.String({ description: "The key of the feature merged." }),
278
- into: Strings("The keys of the features that take its behaviour."),
279
- why: Type.String({ description: "Why, in a line." }),
280
- }), { description: "Features whose behaviour others own whole - none when none." }),
281
- }),
282
- };
283
- const ScenarioSchema = Type.Array(Type.Object({ scenario_id: Type.String(), text: Type.String() }));
284
- export const FEATURE_TOOL = {
285
- name: "submit_capture_feature",
286
- label: "Submit the feature",
287
- description: "The feature's functional specs in build order, each with its scenarios when it needs them; the new concepts they use; what you assumed, are unsure of and dropped.",
288
- parameters: Type.Object({
289
- functional_specs: Type.Array(Type.Object({
290
- func_id: Type.String({ description: "Short kebab-case, unique in the feature." }),
291
- text: Type.String({ description: "What the software does, as ***plain: its first line the behaviour, then its detail." }),
292
- conformance: Type.Optional(ScenarioSchema),
293
- acceptance: Type.Optional(ScenarioSchema),
294
- })),
295
- definitions: Definitions,
296
- assumptions: Strings("What you decided where the code left it open."),
297
- uncertain: Strings("What you captured without being sure of it."),
298
- dropped: Strings("Behaviour judged incidental and left out."),
299
- }),
300
- };
301
- export const INTERFACE_TOOL = {
302
- name: "submit_capture_interface",
303
- label: "Submit the interface",
304
- description: "The interface no feature captured, as a feature of its own: its title, its functional specs with their scenarios, the new concepts they use; what you assumed and are unsure of; and each surface dropped as not the software's interface, by name, with why.",
305
- parameters: Type.Object({
306
- title: Type.String({ description: "A few words for what they are, as a feature of the module: Proxies and network options." }),
307
- ...FEATURE_TOOL.parameters.properties,
308
- dropped: Strings("Each surface that is not the software's interface - a development script's option, a variable only its tests read - by its name, with why."),
309
- }),
310
- };
311
- export const COMPACT_TOOL = {
312
- name: "submit_capture_compact",
313
- label: "Submit the compact capture",
314
- description: "The whole small part as one feature, or why it needs separate writers. Give exactly one.",
315
- parameters: Type.Object({ feature: Type.Optional(FEATURE_TOOL.parameters), expand: Type.Optional(Type.String()) }),
316
- };
317
- export const CORRECTIONS_TOOL = {
318
- name: "submit_capture_corrections",
319
- label: "Submit the corrections",
320
- description: "Each interface fact the ***plain gets wrong or leaves out, corrected: the functional spec's func-id, a scenario's id when it is the scenario, its whole new text, and why from the code. None when everything holds.",
321
- parameters: Type.Object({
322
- corrections: Type.Array(Type.Object({
323
- func_id: Type.String(),
324
- scenario_id: Type.Optional(Type.String({ description: "Only when the correction is to this scenario of the functional spec." })),
325
- text: Type.String({ description: "The whole new text of the functional spec, or of the scenario." }),
326
- why: Type.String({ description: "What was wrong or missing, citing the code: file and what it does." }),
327
- })),
328
- }),
329
- };
330
- export const MODULES_TOOL = {
331
- name: "submit_capture_modules",
332
- label: "Submit the modules",
333
- description: "The part's features gathered into modules by concern, in the order the modules are built - each with its name, what it is, its features and the modules before it that it needs; and the scenarios rewritten to need only the modules before their own.",
334
- parameters: Type.Object({
335
- modules: Type.Array(Type.Object({
336
- name: Type.String({ description: "Short kebab-case, the concern: output-formatting, sessions." }),
337
- about: Type.String({ description: "What it is, in a line." }),
338
- features: Strings("Its features, by key as listed, in the order its functional specs are written."),
339
- needs: Strings("The modules before it whose behaviour its functional specs build on and its scenarios run, by name - none for the first."),
340
- }), { description: "Every module, in the order they are built: every feature in one of them." }),
341
- rewrites: Type.Array(Type.Object({
342
- feature: Type.String({ description: "The feature's key, as listed." }),
343
- func_id: Type.String(),
344
- scenario_id: Type.String(),
345
- text: Type.String({ description: "The scenario's whole new text." }),
346
- why: Type.String({ description: "The later module it needed, and how it now checks the same without it." }),
347
- }), { description: "Scenarios that would need a module after their own whatever the order, rewritten - none when none." }),
348
- }),
349
- };
350
- export const TRIAL_TOOL = {
351
- name: "submit_capture_trial",
352
- label: "Submit the trial",
353
- description: "What the original did with each scenario you were given - held, corrected to what it does, removed as nothing outside can check it, or untried with why - the functional specs it contradicts, corrected, and what its conformance tests must set up.",
354
- parameters: Type.Object({
355
- scenarios: Type.Array(Type.Object({
356
- func_id: Type.String(),
357
- scenario_id: Type.String(),
358
- outcome: Type.Union([Type.Literal("held"), Type.Literal("corrected"), Type.Literal("removed"), Type.Literal("untried")]),
359
- ran: Type.String({ description: "What you ran against the original - the command or the request - and what it answered, in a line." }),
360
- text: Type.Optional(Type.String({ description: "A corrected scenario's whole new text - with the setup only it needs, which is never a test req." })),
361
- why: Type.Optional(Type.String({ description: "Why it was corrected, removed or not tried." })),
362
- }), { description: "Every scenario you were given, each once." }),
363
- functional_specs: Type.Array(Type.Object({ func_id: Type.String(), text: Type.String({ description: "Its whole new text." }), why: Type.String({ description: "What the original does, and what you ran that shows it." }) }), { description: "Functional specs whose text the original contradicts, corrected - none when none." }),
364
- test_reqs: Strings("What every conformance test of the part must set up for the original to act as the scenarios say, one fact each with :ConformanceTests: as the subject - none when the test reqs say it all. What only some scenarios need goes in their own text, corrected; a test req names no scenario or functional spec."),
365
- }),
366
- };
367
- export const CONCEPTS_TOOL = {
368
- name: "submit_capture_concepts",
369
- label: "Submit the concepts",
370
- description: "One definition for each concept, serving every use of it.",
371
- parameters: Type.Object({ definitions: Definitions }),
372
- };
373
- export const EDITS_TOOL = {
374
- name: "submit_capture_edits",
375
- label: "Submit the edits",
376
- description: "The new text of each functional spec you rewrote, by its func-id - none when none needs it.",
377
- parameters: Type.Object({ edits: Type.Array(Type.Object({ func_id: Type.String(), text: Type.String() })) }),
378
- };
379
- export { records, text };
@@ -1,58 +0,0 @@
1
- import type { CodeMap, MapFile } from "./map.ts";
2
- /**
3
- * An area of the codebase: some of its folders and files, named. Capture splits the codebase into areas until each fits
4
- * one agent's budget (capture.ts); an area that fits is outlined into features. What an agent is shown of an area is
5
- * its part of the map, folded to fit a budget of characters - never the code.
6
- */
7
- export interface Area {
8
- /** Unique in the run: the names from the part down, joined by `/`. */
9
- id: string;
10
- /** Short kebab-case, from what the area does. */
11
- name: string;
12
- /** What it does, in a line. */
13
- about: string;
14
- /** Its folders and files, relative to the codebase with `/` - `.` for the whole of it. */
15
- paths: string[];
16
- }
17
- /** Whether a file is in a folder or is the file a path names. */
18
- export declare function covers(path: string, file: string): boolean;
19
- /** The files of an area. */
20
- export declare function filesOf(map: CodeMap, paths: string[]): MapFile[];
21
- /** How many lines an area's files hold - its size, as far as capture is concerned. Assets count for nothing. */
22
- export declare function linesOf(files: MapFile[]): number;
23
- /** A test file of the original, as evidence of what it does: its lines and the tests the map named in it. */
24
- export interface TestEvidence {
25
- path: string;
26
- lines: number;
27
- tests: string[];
28
- }
29
- /** The original's tests among some paths: the test files holding at least one test the map found, largest first. */
30
- export declare function testEvidence(map: CodeMap, paths: string[]): TestEvidence[];
31
- /** One of the folders and files an area divides into. */
32
- export interface Entry {
33
- path: string;
34
- dir: boolean;
35
- files: MapFile[];
36
- }
37
- /**
38
- * What an area divides into, for an agent to split it: a single folder's folders and files - going down through a
39
- * folder that holds a single folder and nothing else - or the area's own paths, when it has several.
40
- */
41
- export declare function entriesOf(map: CodeMap, paths: string[]): Entry[];
42
- /**
43
- * An area's part of the map as text, folded to fit `budget` characters: as deep and with as many surface names as fit -
44
- * down to its entries with counts alone, and past that only the first entries, the rest counted.
45
- */
46
- export declare function renderArea(map: CodeMap, paths: string[], budget: number): string;
47
- /**
48
- * Areas in build order: an area whose files import another's comes after it - a topological order of the folders'
49
- * import graph - with the order they were given kept where nothing says otherwise. A cycle is broken where the given
50
- * order puts its first area.
51
- */
52
- export declare function buildOrder<T extends {
53
- paths: string[];
54
- }>(map: CodeMap, areas: T[]): T[];
55
- /** A name for a path, as an area would be named: its last part, kebab-case. */
56
- export declare function nameOfPath(path: string): string;
57
- /** Text as kebab-case: lowercase letters, digits and single hyphens. */
58
- export declare function kebab(text: string): string;
@@ -1,197 +0,0 @@
1
- import { posix } from "node:path";
2
- /** Whether a file is in a folder or is the file a path names. */
3
- export function covers(path, file) {
4
- return path === "." || path === "" || file === path || file.startsWith(`${path}/`);
5
- }
6
- /** The files of an area. */
7
- export function filesOf(map, paths) {
8
- return map.files.filter((file) => paths.some((path) => covers(path, file.path)));
9
- }
10
- /** How many lines an area's files hold - its size, as far as capture is concerned. Assets count for nothing. */
11
- export function linesOf(files) {
12
- return files.reduce((sum, file) => sum + file.lines, 0);
13
- }
14
- /** The original's tests among some paths: the test files holding at least one test the map found, largest first. */
15
- export function testEvidence(map, paths) {
16
- return filesOf(map, paths)
17
- .filter((file) => file.kind === "test")
18
- .map((file) => ({ path: file.path, lines: file.lines, tests: file.surfaces.filter((surface) => surface.kind === "test").map((surface) => surface.name) }))
19
- .filter((file) => file.tests.length > 0)
20
- .sort((a, b) => b.lines - a.lines);
21
- }
22
- /**
23
- * What an area divides into, for an agent to split it: a single folder's folders and files - going down through a
24
- * folder that holds a single folder and nothing else - or the area's own paths, when it has several.
25
- */
26
- export function entriesOf(map, paths) {
27
- const files = filesOf(map, paths);
28
- const isDir = (path) => path === "." || files.some((file) => file.path.startsWith(`${path === "." ? "" : `${path}/`}`) && file.path !== path);
29
- if (paths.length === 1 && isDir(paths[0])) {
30
- let dir = paths[0];
31
- for (;;) {
32
- const children = childrenOf(files, dir);
33
- if (children.length === 1 && children[0].dir) {
34
- dir = children[0].path;
35
- continue;
36
- }
37
- return children;
38
- }
39
- }
40
- return paths.map((path) => ({ path, dir: isDir(path), files: filesOf(map, [path]) }));
41
- }
42
- function childrenOf(files, dir) {
43
- const prefix = dir === "." || dir === "" ? "" : `${dir}/`;
44
- const byChild = new Map();
45
- for (const file of files) {
46
- if (!file.path.startsWith(prefix))
47
- continue;
48
- const rest = file.path.slice(prefix.length);
49
- const slash = rest.indexOf("/");
50
- const path = slash === -1 ? file.path : `${prefix}${rest.slice(0, slash)}`;
51
- const entry = byChild.get(path) ?? { path, dir: slash !== -1, files: [] };
52
- entry.files.push(file);
53
- byChild.set(path, entry);
54
- }
55
- return [...byChild.values()].sort((a, b) => (a.dir === b.dir ? a.path.localeCompare(b.path) : a.dir ? -1 : 1));
56
- }
57
- const SURFACE_LABELS = [
58
- ["route", "routes"],
59
- ["command", "commands"],
60
- ["option", "options"],
61
- ["screen", "screens"],
62
- ["env", "environment variables"],
63
- ["table", "tables"],
64
- ["test", "tests"],
65
- ["export", "exports"],
66
- ];
67
- const KIND_LABELS = [
68
- ["source", "source"],
69
- ["test", "test"],
70
- ["contract", "contract"],
71
- ["doc", "doc"],
72
- ["manifest", "manifest"],
73
- ["asset", "asset"],
74
- ["other", "other"],
75
- ];
76
- /** A line of surfaces: each kind with as many names as `sample` allows and how many more there are. */
77
- function surfaceLine(surfaces, sample) {
78
- const parts = [];
79
- for (const [kind, label] of SURFACE_LABELS) {
80
- const names = [...new Set(surfaces.filter((surface) => surface.kind === kind).map((surface) => surface.name))];
81
- if (names.length === 0)
82
- continue;
83
- if (sample === 0) {
84
- parts.push(`${names.length} ${label}`);
85
- continue;
86
- }
87
- const shown = names.slice(0, sample).join(", ");
88
- parts.push(`${label}: ${shown}${names.length > sample ? ` (+${names.length - sample})` : ""}`);
89
- }
90
- return parts.join("; ");
91
- }
92
- function kindCounts(files) {
93
- return KIND_LABELS.map(([kind, label]) => [files.filter((file) => file.kind === kind).length, label])
94
- .filter(([count]) => count > 0)
95
- .map(([count, label]) => `${count} ${label}`)
96
- .join(", ");
97
- }
98
- function entryLine(entry, sample, indent) {
99
- const surfaces = surfaceLine(entry.files.flatMap((file) => file.surfaces), sample);
100
- if (entry.dir) {
101
- return `${indent}${entry.path}/ - ${entry.files.length} files (${kindCounts(entry.files)}), ${linesOf(entry.files)} lines${surfaces !== "" ? ` - ${surfaces}` : ""}`;
102
- }
103
- const file = entry.files[0];
104
- return `${indent}${entry.path} - ${file?.kind ?? "file"}, ${file?.lines ?? 0} lines${surfaces !== "" ? ` - ${surfaces}` : ""}`;
105
- }
106
- /**
107
- * An area's part of the map as text, folded to fit `budget` characters: as deep and with as many surface names as fit -
108
- * down to its entries with counts alone, and past that only the first entries, the rest counted.
109
- */
110
- export function renderArea(map, paths, budget) {
111
- const files = filesOf(map, paths);
112
- const header = `${paths.map((path) => (path === "." ? "the whole codebase" : path)).join(", ")} - ${files.length} files (${kindCounts(files)}), ${linesOf(files)} lines`;
113
- const entries = entriesOf(map, paths);
114
- const attempts = [
115
- { depth: 3, sample: 12 },
116
- { depth: 2, sample: 12 },
117
- { depth: 2, sample: 6 },
118
- { depth: 1, sample: 8 },
119
- { depth: 1, sample: 3 },
120
- { depth: 1, sample: 0 },
121
- ];
122
- for (const { depth, sample } of attempts) {
123
- const text = [header, "", ...renderEntries(map, entries, depth, sample, "")].join("\n");
124
- if (text.length <= budget)
125
- return text;
126
- }
127
- // Too many entries even counted: the first that fit, and the rest summed up.
128
- const lines = [header, ""];
129
- let used = lines.join("\n").length;
130
- let shown = 0;
131
- for (const entry of entries) {
132
- const line = entryLine(entry, 0, "");
133
- if (used + line.length + 1 > budget - 120)
134
- break;
135
- lines.push(line);
136
- used += line.length + 1;
137
- shown += 1;
138
- }
139
- const rest = entries.slice(shown);
140
- if (rest.length > 0)
141
- lines.push(`... and ${rest.length} more entries - ${rest.reduce((sum, entry) => sum + entry.files.length, 0)} files, ${linesOf(rest.flatMap((entry) => entry.files))} lines`);
142
- return lines.join("\n");
143
- }
144
- function renderEntries(map, entries, depth, sample, indent) {
145
- return entries.flatMap((entry) => {
146
- const line = entryLine(entry, sample, indent);
147
- if (!entry.dir || depth <= 1)
148
- return [line];
149
- return [line, ...renderEntries(map, childrenOf(entry.files, entry.path), depth - 1, sample, `${indent} `)];
150
- });
151
- }
152
- /**
153
- * Areas in build order: an area whose files import another's comes after it - a topological order of the folders'
154
- * import graph - with the order they were given kept where nothing says otherwise. A cycle is broken where the given
155
- * order puts its first area.
156
- */
157
- export function buildOrder(map, areas) {
158
- const owner = new Map();
159
- areas.forEach((area, index) => {
160
- for (const file of filesOf(map, area.paths))
161
- if (!owner.has(file.path))
162
- owner.set(file.path, index);
163
- });
164
- const dependsOn = areas.map(() => new Set());
165
- for (const file of map.files) {
166
- const from = owner.get(file.path);
167
- if (from === undefined)
168
- continue;
169
- for (const target of file.imports) {
170
- const to = owner.get(target);
171
- if (to !== undefined && to !== from)
172
- dependsOn[from].add(to);
173
- }
174
- }
175
- const placed = [];
176
- const done = new Set();
177
- while (placed.length < areas.length) {
178
- const ready = areas.findIndex((_, index) => !done.has(index) && [...dependsOn[index]].every((dep) => done.has(dep)));
179
- const next = ready !== -1 ? ready : areas.findIndex((_, index) => !done.has(index));
180
- placed.push(next);
181
- done.add(next);
182
- }
183
- return placed.map((index) => areas[index]);
184
- }
185
- /** A name for a path, as an area would be named: its last part, kebab-case. */
186
- export function nameOfPath(path) {
187
- const base = path === "." || path === "" ? "app" : posix.basename(path).replace(/\.[^.]+$/, "");
188
- return kebab(base) || "app";
189
- }
190
- /** Text as kebab-case: lowercase letters, digits and single hyphens. */
191
- export function kebab(text) {
192
- return text
193
- .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
194
- .toLowerCase()
195
- .replace(/[^a-z0-9]+/g, "-")
196
- .replace(/^-+|-+$/g, "");
197
- }