@turri-dev/cli 0.4.3-next.aea3ca1 → 0.4.3-next.fd01774

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 (483) hide show
  1. package/README.md +24 -3
  2. package/dist/banner.js +248 -0
  3. package/dist/capture-cli.js +77 -0
  4. package/dist/capture-view.js +99 -0
  5. package/dist/chat-commands.js +9 -63
  6. package/dist/chat-models.js +17 -15
  7. package/dist/chat-tab-header.js +90 -0
  8. package/dist/chat-tabs.js +100 -0
  9. package/dist/chat-terminal.js +163 -54
  10. package/dist/chat-waiting.js +0 -20
  11. package/dist/cli-options.js +11 -7
  12. package/dist/cli-root.js +101 -0
  13. package/dist/cli.js +48 -36
  14. package/dist/conform-cli.js +4 -6
  15. package/dist/cultivate-cli.js +65 -97
  16. package/dist/doctor-cli.js +99 -0
  17. package/dist/drift-cli.js +2 -7
  18. package/dist/entry-renderers.js +107 -0
  19. package/dist/extension.js +14 -3211
  20. package/dist/init-config-cli.js +209 -0
  21. package/dist/launch-cli.js +55 -91
  22. package/dist/lineage-cli.js +2 -4
  23. package/dist/loop-cli.js +118 -233
  24. package/dist/panel-view.js +409 -0
  25. package/dist/parse-cli.js +5 -2
  26. package/dist/pi-launch.js +43 -13
  27. package/dist/pi-themes.js +21 -0
  28. package/dist/plain-code-blocks.js +56 -0
  29. package/dist/pointer-hover.js +48 -0
  30. package/dist/print-mode.js +20 -0
  31. package/dist/question-dialog.js +26 -3
  32. package/dist/quiet.js +7 -106
  33. package/dist/regenerate/diff-view.js +6 -87
  34. package/dist/regenerate/jobs-tree.js +7 -18
  35. package/dist/regenerate/side-panel.js +158 -22
  36. package/dist/regenerate/spec-map-view.js +25 -70
  37. package/dist/regenerate-cli.js +7 -11
  38. package/dist/reopen.js +80 -0
  39. package/dist/skill-progress.js +25 -0
  40. package/dist/skill-report.js +52 -0
  41. package/dist/terminal-marks.js +21 -0
  42. package/dist/terminal-notifications.js +219 -0
  43. package/dist/terminal-view.js +275 -0
  44. package/dist/turri-versions.js +64 -6
  45. package/docs/README.md +4 -2
  46. package/docs/capture.md +227 -0
  47. package/docs/chats.md +14 -10
  48. package/docs/claude-subscription.md +1 -1
  49. package/docs/config.md +23 -8
  50. package/docs/development.md +30 -61
  51. package/docs/headless.md +3 -1
  52. package/docs/hosting.md +3 -251
  53. package/docs/installation.md +5 -3
  54. package/docs/launch.md +3 -3
  55. package/docs/regenerating.md +1 -1
  56. package/docs/sandbox.md +4 -2
  57. package/docs/sentinel.md +13 -13
  58. package/docs/theming.md +3 -3
  59. package/docs/using.md +13 -5
  60. package/package.json +13 -31
  61. package/dist/ask.d.ts +0 -90
  62. package/dist/ask.js +0 -170
  63. package/dist/background-skills.d.ts +0 -53
  64. package/dist/background-skills.js +0 -121
  65. package/dist/bedrock-region.d.ts +0 -66
  66. package/dist/bedrock-region.js +0 -144
  67. package/dist/brand.d.ts +0 -13
  68. package/dist/btw.d.ts +0 -69
  69. package/dist/btw.js +0 -174
  70. package/dist/chat-commands.d.ts +0 -25
  71. package/dist/chat-idle.d.ts +0 -7
  72. package/dist/chat-idle.js +0 -20
  73. package/dist/chat-models.d.ts +0 -22
  74. package/dist/chat-records.d.ts +0 -50
  75. package/dist/chat-records.js +0 -107
  76. package/dist/chat-scope.d.ts +0 -14
  77. package/dist/chat-scope.js +0 -15
  78. package/dist/chat-skills.d.ts +0 -17
  79. package/dist/chat-skills.js +0 -18
  80. package/dist/chat-terminal.d.ts +0 -24
  81. package/dist/chat-ui.d.ts +0 -33
  82. package/dist/chat-waiting.d.ts +0 -67
  83. package/dist/chats.d.ts +0 -338
  84. package/dist/chats.js +0 -996
  85. package/dist/cli-options.d.ts +0 -24
  86. package/dist/cli.d.ts +0 -9
  87. package/dist/config-edit.d.ts +0 -83
  88. package/dist/config-edit.js +0 -390
  89. package/dist/config.d.ts +0 -415
  90. package/dist/config.js +0 -757
  91. package/dist/conform-cli.d.ts +0 -1
  92. package/dist/conformance-switch.d.ts +0 -25
  93. package/dist/conformance-switch.js +0 -86
  94. package/dist/cultivate-cli.d.ts +0 -1
  95. package/dist/doctor-tool.d.ts +0 -11
  96. package/dist/doctor-tool.js +0 -33
  97. package/dist/drift-cli.d.ts +0 -1
  98. package/dist/environment.d.ts +0 -37
  99. package/dist/environment.js +0 -109
  100. package/dist/extension.d.ts +0 -208
  101. package/dist/genome.d.ts +0 -77
  102. package/dist/genome.js +0 -288
  103. package/dist/graph.d.ts +0 -52
  104. package/dist/graph.js +0 -247
  105. package/dist/host-session.d.ts +0 -112
  106. package/dist/host-session.js +0 -103
  107. package/dist/host.d.ts +0 -40
  108. package/dist/host.js +0 -54
  109. package/dist/identity.d.ts +0 -7
  110. package/dist/identity.js +0 -74
  111. package/dist/init-config.d.ts +0 -169
  112. package/dist/init-config.js +0 -840
  113. package/dist/installed-providers.d.ts +0 -40
  114. package/dist/installed-providers.js +0 -98
  115. package/dist/jellyfish.d.ts +0 -40
  116. package/dist/judge.d.ts +0 -25
  117. package/dist/judge.js +0 -62
  118. package/dist/launch-agent.d.ts +0 -62
  119. package/dist/launch-agent.js +0 -339
  120. package/dist/launch-cli.d.ts +0 -1
  121. package/dist/launch-session.d.ts +0 -68
  122. package/dist/launch-session.js +0 -225
  123. package/dist/launch-tools.d.ts +0 -28
  124. package/dist/launch-tools.js +0 -72
  125. package/dist/launch-track.d.ts +0 -175
  126. package/dist/launch-track.js +0 -497
  127. package/dist/lineage-cli.d.ts +0 -1
  128. package/dist/loop-cli.d.ts +0 -35
  129. package/dist/loop-tools.d.ts +0 -103
  130. package/dist/loop-tools.js +0 -357
  131. package/dist/model-check.d.ts +0 -72
  132. package/dist/model-check.js +0 -162
  133. package/dist/module-report.d.ts +0 -9
  134. package/dist/new-project.d.ts +0 -5
  135. package/dist/new-project.js +0 -31
  136. package/dist/notice.d.ts +0 -115
  137. package/dist/notice.js +0 -61
  138. package/dist/parse-cli.d.ts +0 -1
  139. package/dist/parse-tool.d.ts +0 -9
  140. package/dist/parse-tool.js +0 -33
  141. package/dist/pi-launch.d.ts +0 -1
  142. package/dist/pi-settings.d.ts +0 -4
  143. package/dist/pi.d.ts +0 -248
  144. package/dist/pi.js +0 -889
  145. package/dist/picture-row.d.ts +0 -10
  146. package/dist/plain/check.d.ts +0 -63
  147. package/dist/plain/check.js +0 -236
  148. package/dist/plain/concepts.d.ts +0 -37
  149. package/dist/plain/concepts.js +0 -283
  150. package/dist/plain/cycles.d.ts +0 -21
  151. package/dist/plain/cycles.js +0 -190
  152. package/dist/plain/errors.d.ts +0 -26
  153. package/dist/plain/errors.js +0 -50
  154. package/dist/plain/files.d.ts +0 -47
  155. package/dist/plain/files.js +0 -161
  156. package/dist/plain/graph.d.ts +0 -107
  157. package/dist/plain/graph.js +0 -194
  158. package/dist/plain/highlight.d.ts +0 -43
  159. package/dist/plain/highlight.js +0 -196
  160. package/dist/plain/index.d.ts +0 -18
  161. package/dist/plain/index.js +0 -18
  162. package/dist/plain/liquid.d.ts +0 -22
  163. package/dist/plain/liquid.js +0 -124
  164. package/dist/plain/markdown.d.ts +0 -103
  165. package/dist/plain/markdown.js +0 -330
  166. package/dist/plain/module-concepts.d.ts +0 -32
  167. package/dist/plain/module-concepts.js +0 -80
  168. package/dist/plain/parser.d.ts +0 -163
  169. package/dist/plain/parser.js +0 -930
  170. package/dist/plain/plain.tmLanguage.json +0 -150
  171. package/dist/plain/project.d.ts +0 -48
  172. package/dist/plain/project.js +0 -155
  173. package/dist/plain/spec.d.ts +0 -152
  174. package/dist/plain/spec.js +0 -265
  175. package/dist/plain/stdlib.d.ts +0 -16
  176. package/dist/plain/stdlib.js +0 -48
  177. package/dist/plain/test-plain-file.d.ts +0 -59
  178. package/dist/plain/test-plain-file.js +0 -232
  179. package/dist/plain-files.d.ts +0 -21
  180. package/dist/plain-files.js +0 -156
  181. package/dist/question-dialog.d.ts +0 -55
  182. package/dist/questioning.d.ts +0 -55
  183. package/dist/questioning.js +0 -109
  184. package/dist/quiet.d.ts +0 -34
  185. package/dist/regenerate/activity.d.ts +0 -227
  186. package/dist/regenerate/activity.js +0 -250
  187. package/dist/regenerate/agent-env.d.ts +0 -51
  188. package/dist/regenerate/agent-env.js +0 -311
  189. package/dist/regenerate/agent-shell.d.ts +0 -54
  190. package/dist/regenerate/agent-shell.js +0 -121
  191. package/dist/regenerate/arbiter.d.ts +0 -68
  192. package/dist/regenerate/arbiter.js +0 -133
  193. package/dist/regenerate/audit.d.ts +0 -69
  194. package/dist/regenerate/audit.js +0 -212
  195. package/dist/regenerate/base-folder.d.ts +0 -70
  196. package/dist/regenerate/base-folder.js +0 -186
  197. package/dist/regenerate/cases.d.ts +0 -12
  198. package/dist/regenerate/cases.js +0 -149
  199. package/dist/regenerate/change-view.d.ts +0 -23
  200. package/dist/regenerate/change-view.js +0 -153
  201. package/dist/regenerate/chunk-plan.d.ts +0 -217
  202. package/dist/regenerate/chunk-plan.js +0 -937
  203. package/dist/regenerate/codebase.d.ts +0 -21
  204. package/dist/regenerate/codebase.js +0 -75
  205. package/dist/regenerate/command-check.d.ts +0 -66
  206. package/dist/regenerate/command-check.js +0 -508
  207. package/dist/regenerate/compaction.d.ts +0 -13
  208. package/dist/regenerate/compaction.js +0 -20
  209. package/dist/regenerate/confine.d.ts +0 -69
  210. package/dist/regenerate/confine.js +0 -311
  211. package/dist/regenerate/conform.d.ts +0 -66
  212. package/dist/regenerate/conform.js +0 -132
  213. package/dist/regenerate/conformance-agents.d.ts +0 -388
  214. package/dist/regenerate/conformance-agents.js +0 -1162
  215. package/dist/regenerate/conformance.d.ts +0 -191
  216. package/dist/regenerate/conformance.js +0 -1035
  217. package/dist/regenerate/conversation-writes.d.ts +0 -10
  218. package/dist/regenerate/conversation-writes.js +0 -100
  219. package/dist/regenerate/credentials.d.ts +0 -18
  220. package/dist/regenerate/credentials.js +0 -88
  221. package/dist/regenerate/debug-log.d.ts +0 -56
  222. package/dist/regenerate/debug-log.js +0 -236
  223. package/dist/regenerate/debugger.d.ts +0 -36
  224. package/dist/regenerate/debugger.js +0 -133
  225. package/dist/regenerate/delivery.d.ts +0 -2
  226. package/dist/regenerate/diagnose-job.d.ts +0 -2
  227. package/dist/regenerate/diagnose-job.js +0 -40
  228. package/dist/regenerate/diagnose.d.ts +0 -46
  229. package/dist/regenerate/diagnose.js +0 -92
  230. package/dist/regenerate/diff-view.d.ts +0 -64
  231. package/dist/regenerate/drift.d.ts +0 -120
  232. package/dist/regenerate/drift.js +0 -285
  233. package/dist/regenerate/environment-error.d.ts +0 -167
  234. package/dist/regenerate/environment-error.js +0 -342
  235. package/dist/regenerate/failure-reports.d.ts +0 -28
  236. package/dist/regenerate/failure-reports.js +0 -79
  237. package/dist/regenerate/job-log.d.ts +0 -30
  238. package/dist/regenerate/job-log.js +0 -105
  239. package/dist/regenerate/job-panel.d.ts +0 -122
  240. package/dist/regenerate/job-panel.js +0 -339
  241. package/dist/regenerate/jobs-tree.d.ts +0 -75
  242. package/dist/regenerate/jobs.d.ts +0 -231
  243. package/dist/regenerate/jobs.js +0 -522
  244. package/dist/regenerate/lanes.d.ts +0 -16
  245. package/dist/regenerate/lanes.js +0 -32
  246. package/dist/regenerate/launch.d.ts +0 -256
  247. package/dist/regenerate/launch.js +0 -689
  248. package/dist/regenerate/ledger-view.d.ts +0 -87
  249. package/dist/regenerate/ledger-view.js +0 -325
  250. package/dist/regenerate/ledger.d.ts +0 -368
  251. package/dist/regenerate/ledger.js +0 -357
  252. package/dist/regenerate/lineage.d.ts +0 -105
  253. package/dist/regenerate/lineage.js +0 -485
  254. package/dist/regenerate/list-arguments.d.ts +0 -21
  255. package/dist/regenerate/list-arguments.js +0 -121
  256. package/dist/regenerate/loop.d.ts +0 -423
  257. package/dist/regenerate/loop.js +0 -2079
  258. package/dist/regenerate/masking.d.ts +0 -19
  259. package/dist/regenerate/masking.js +0 -95
  260. package/dist/regenerate/model-names.d.ts +0 -33
  261. package/dist/regenerate/model-names.js +0 -92
  262. package/dist/regenerate/notes.d.ts +0 -159
  263. package/dist/regenerate/notes.js +0 -446
  264. package/dist/regenerate/os-sandbox.d.ts +0 -93
  265. package/dist/regenerate/os-sandbox.js +0 -283
  266. package/dist/regenerate/panel-dock.d.ts +0 -23
  267. package/dist/regenerate/paths.d.ts +0 -110
  268. package/dist/regenerate/paths.js +0 -190
  269. package/dist/regenerate/plain-palette.d.ts +0 -34
  270. package/dist/regenerate/prompt.d.ts +0 -230
  271. package/dist/regenerate/prompt.js +0 -741
  272. package/dist/regenerate/pulse-files.d.ts +0 -14
  273. package/dist/regenerate/pulse-files.js +0 -63
  274. package/dist/regenerate/records.d.ts +0 -132
  275. package/dist/regenerate/records.js +0 -327
  276. package/dist/regenerate/regenerate.d.ts +0 -106
  277. package/dist/regenerate/regenerate.js +0 -660
  278. package/dist/regenerate/regression.d.ts +0 -58
  279. package/dist/regenerate/regression.js +0 -188
  280. package/dist/regenerate/renames.d.ts +0 -42
  281. package/dist/regenerate/renames.js +0 -185
  282. package/dist/regenerate/requires.d.ts +0 -117
  283. package/dist/regenerate/requires.js +0 -377
  284. package/dist/regenerate/resources.d.ts +0 -57
  285. package/dist/regenerate/resources.js +0 -162
  286. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  287. package/dist/regenerate/scripts-being-written.js +0 -30
  288. package/dist/regenerate/self-check.d.ts +0 -29
  289. package/dist/regenerate/self-check.js +0 -119
  290. package/dist/regenerate/services.d.ts +0 -28
  291. package/dist/regenerate/services.js +0 -158
  292. package/dist/regenerate/shell.d.ts +0 -91
  293. package/dist/regenerate/shell.js +0 -320
  294. package/dist/regenerate/side-panel.d.ts +0 -59
  295. package/dist/regenerate/spec-map-view.d.ts +0 -139
  296. package/dist/regenerate/spec-map.d.ts +0 -160
  297. package/dist/regenerate/spec-map.js +0 -596
  298. package/dist/regenerate/spec-steps.d.ts +0 -180
  299. package/dist/regenerate/spec-steps.js +0 -729
  300. package/dist/regenerate/standing.d.ts +0 -28
  301. package/dist/regenerate/standing.js +0 -30
  302. package/dist/regenerate/state.d.ts +0 -21
  303. package/dist/regenerate/state.js +0 -10
  304. package/dist/regenerate/steering.d.ts +0 -56
  305. package/dist/regenerate/steering.js +0 -119
  306. package/dist/regenerate/stop-report.d.ts +0 -43
  307. package/dist/regenerate/stop-report.js +0 -160
  308. package/dist/regenerate/submit-work.d.ts +0 -44
  309. package/dist/regenerate/submit-work.js +0 -76
  310. package/dist/regenerate/test-kinds.d.ts +0 -85
  311. package/dist/regenerate/test-kinds.js +0 -171
  312. package/dist/regenerate/test-scripts.d.ts +0 -235
  313. package/dist/regenerate/test-scripts.js +0 -843
  314. package/dist/regenerate/testing-steps.d.ts +0 -52
  315. package/dist/regenerate/testing-steps.js +0 -129
  316. package/dist/regenerate/testing.d.ts +0 -150
  317. package/dist/regenerate/testing.js +0 -438
  318. package/dist/regenerate/transcript-view.d.ts +0 -21
  319. package/dist/regenerate/unit-gate.d.ts +0 -27
  320. package/dist/regenerate/unit-gate.js +0 -20
  321. package/dist/regenerate/unit-review.d.ts +0 -152
  322. package/dist/regenerate/unit-review.js +0 -361
  323. package/dist/regenerate/web.d.ts +0 -61
  324. package/dist/regenerate/web.js +0 -256
  325. package/dist/regenerate/workspace.d.ts +0 -12
  326. package/dist/regenerate/workspace.js +0 -99
  327. package/dist/regenerate-cli.d.ts +0 -1
  328. package/dist/resume-line.d.ts +0 -5
  329. package/dist/review/live.d.ts +0 -72
  330. package/dist/review/live.js +0 -166
  331. package/dist/rules.d.ts +0 -20
  332. package/dist/rules.js +0 -47
  333. package/dist/run-report.d.ts +0 -88
  334. package/dist/run-report.js +0 -338
  335. package/dist/screen-padding.d.ts +0 -28
  336. package/dist/self-invocation.d.ts +0 -36
  337. package/dist/self-invocation.js +0 -137
  338. package/dist/sentinel-chat.d.ts +0 -19
  339. package/dist/sentinel-chat.js +0 -221
  340. package/dist/sentinel-check.d.ts +0 -36
  341. package/dist/sentinel-check.js +0 -78
  342. package/dist/sentinel.d.ts +0 -107
  343. package/dist/sentinel.js +0 -599
  344. package/dist/settings.d.ts +0 -45
  345. package/dist/settings.js +0 -378
  346. package/dist/setup.d.ts +0 -97
  347. package/dist/setup.js +0 -428
  348. package/dist/skill-progress.d.ts +0 -46
  349. package/dist/skill.d.ts +0 -102
  350. package/dist/skill.js +0 -147
  351. package/dist/skills.d.ts +0 -54
  352. package/dist/skills.js +0 -111
  353. package/dist/spawn-async.d.ts +0 -18
  354. package/dist/spawn-async.js +0 -35
  355. package/dist/stack.d.ts +0 -80
  356. package/dist/stack.js +0 -206
  357. package/dist/stdlib.d.ts +0 -43
  358. package/dist/stdlib.js +0 -118
  359. package/dist/surface.d.ts +0 -5
  360. package/dist/surface.js +0 -18
  361. package/dist/terminal-images.d.ts +0 -2
  362. package/dist/test-plain-files.d.ts +0 -41
  363. package/dist/test-plain-files.js +0 -172
  364. package/dist/tools.d.ts +0 -101
  365. package/dist/tools.js +0 -242
  366. package/dist/turri-versions.d.ts +0 -71
  367. package/genome/rules/bullet-continuation.md +0 -61
  368. package/genome/rules/concise-specs-examples.md +0 -460
  369. package/genome/rules/concise-specs-integration-examples.md +0 -281
  370. package/genome/rules/concise-specs.md +0 -80
  371. package/genome/rules/definitions.md +0 -107
  372. package/genome/rules/examples/integration-embedded-testing/run_conformance_tests_java.sh +0 -161
  373. package/genome/rules/examples/integration-embedded-testing/run_unittests_java.sh +0 -50
  374. package/genome/rules/exported-concepts.md +0 -39
  375. package/genome/rules/func-specs.md +0 -164
  376. package/genome/rules/impl-reqs.md +0 -68
  377. package/genome/rules/import-modules.md +0 -49
  378. package/genome/rules/integration-embedded-testing.md +0 -273
  379. package/genome/rules/integration-embedded.md +0 -171
  380. package/genome/rules/integration-standalone.md +0 -135
  381. package/genome/rules/integrations.md +0 -136
  382. package/genome/rules/linked-resources.md +0 -76
  383. package/genome/rules/module-structure.md +0 -112
  384. package/genome/rules/project-model.md +0 -69
  385. package/genome/rules/required-concepts.md +0 -44
  386. package/genome/rules/requires-modules.md +0 -81
  387. package/genome/rules/semantic-ids.md +0 -49
  388. package/genome/rules/stdlib.md +0 -37
  389. package/genome/rules/test-plain-files.md +0 -138
  390. package/genome/rules/test-reqs.md +0 -57
  391. package/genome/rules/turri-regeneration.md +0 -66
  392. package/genome/skills/analyze-2-func-specs/SKILL.md +0 -116
  393. package/genome/skills/analyze-func-specs/SKILL.md +0 -137
  394. package/genome/skills/break-down-func-spec/SKILL.md +0 -229
  395. package/genome/skills/consolidate-concepts/SKILL.md +0 -192
  396. package/genome/skills/convert-old-syntax/SKILL.md +0 -68
  397. package/genome/skills/convert-old-syntax/references/rubric.md +0 -11
  398. package/genome/skills/debug-specs/SKILL.md +0 -194
  399. package/genome/skills/implement-conformance-testing-script/SKILL.md +0 -247
  400. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_cypress.ps1 +0 -337
  401. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_golang.ps1 +0 -111
  402. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +0 -151
  403. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.ps1 +0 -103
  404. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +0 -146
  405. package/genome/skills/implement-unit-testing-script/SKILL.md +0 -171
  406. package/genome/skills/implement-unit-testing-script/assets/run_unittests_flutter.ps1 +0 -87
  407. package/genome/skills/implement-unit-testing-script/assets/run_unittests_golang.ps1 +0 -73
  408. package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +0 -82
  409. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.ps1 +0 -81
  410. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +0 -102
  411. package/genome/skills/implement-unit-testing-script/assets/run_unittests_react.ps1 +0 -87
  412. package/genome/skills/refactor-module/SKILL.md +0 -218
  413. package/genome/skills/resolve-section-ownership/SKILL.md +0 -64
  414. package/genome/skills/resolve-spec-conflict/SKILL.md +0 -102
  415. package/stdlib/backend/common.plain +0 -25
  416. package/stdlib/backend/conformance/common.plain +0 -12
  417. package/stdlib/backend/conformance/go-gin.plain +0 -9
  418. package/stdlib/backend/conformance/go-nethttp.plain +0 -9
  419. package/stdlib/backend/conformance/java-springboot.plain +0 -9
  420. package/stdlib/backend/conformance/python-django.plain +0 -9
  421. package/stdlib/backend/conformance/python-fastapi.plain +0 -9
  422. package/stdlib/backend/conformance/python-flask.plain +0 -9
  423. package/stdlib/backend/conformance/rust-axum.plain +0 -9
  424. package/stdlib/backend/conformance/typescript-express.plain +0 -9
  425. package/stdlib/backend/conformance/typescript-fastify.plain +0 -9
  426. package/stdlib/backend/conformance/typescript-nestjs.plain +0 -9
  427. package/stdlib/backend/go-gin.plain +0 -18
  428. package/stdlib/backend/go-nethttp.plain +0 -18
  429. package/stdlib/backend/java-springboot.plain +0 -19
  430. package/stdlib/backend/python-django.plain +0 -19
  431. package/stdlib/backend/python-fastapi.plain +0 -23
  432. package/stdlib/backend/python-flask.plain +0 -23
  433. package/stdlib/backend/rust-axum.plain +0 -17
  434. package/stdlib/backend/typescript-express.plain +0 -19
  435. package/stdlib/backend/typescript-fastify.plain +0 -19
  436. package/stdlib/backend/typescript-nestjs.plain +0 -19
  437. package/stdlib/cli/common.plain +0 -17
  438. package/stdlib/cli/conformance/common.plain +0 -11
  439. package/stdlib/cli/conformance/go-cobra.plain +0 -9
  440. package/stdlib/cli/conformance/go-flag.plain +0 -9
  441. package/stdlib/cli/conformance/java-picocli.plain +0 -9
  442. package/stdlib/cli/conformance/python-argparse.plain +0 -9
  443. package/stdlib/cli/conformance/python-click.plain +0 -9
  444. package/stdlib/cli/conformance/python-typer.plain +0 -9
  445. package/stdlib/cli/conformance/rust-clap.plain +0 -9
  446. package/stdlib/cli/conformance/typescript-commander.plain +0 -9
  447. package/stdlib/cli/go-cobra.plain +0 -14
  448. package/stdlib/cli/go-flag.plain +0 -14
  449. package/stdlib/cli/java-picocli.plain +0 -15
  450. package/stdlib/cli/python-argparse.plain +0 -18
  451. package/stdlib/cli/python-click.plain +0 -16
  452. package/stdlib/cli/python-typer.plain +0 -16
  453. package/stdlib/cli/rust-clap.plain +0 -14
  454. package/stdlib/cli/typescript-commander.plain +0 -17
  455. package/stdlib/frontend/angular.plain +0 -17
  456. package/stdlib/frontend/common.plain +0 -17
  457. package/stdlib/frontend/conformance/angular.plain +0 -5
  458. package/stdlib/frontend/conformance/common.plain +0 -11
  459. package/stdlib/frontend/conformance/react-vite.plain +0 -5
  460. package/stdlib/frontend/conformance/sveltekit-spa.plain +0 -5
  461. package/stdlib/frontend/conformance/vue-vite.plain +0 -5
  462. package/stdlib/frontend/react-vite.plain +0 -16
  463. package/stdlib/frontend/sveltekit-spa.plain +0 -16
  464. package/stdlib/frontend/vue-vite.plain +0 -16
  465. package/stdlib/lang/go.plain +0 -13
  466. package/stdlib/lang/java.plain +0 -12
  467. package/stdlib/lang/python.plain +0 -18
  468. package/stdlib/lang/rust.plain +0 -12
  469. package/stdlib/lang/typescript.plain +0 -13
  470. package/stdlib/library/common.plain +0 -15
  471. package/stdlib/library/conformance/common.plain +0 -9
  472. package/stdlib/library/conformance/go.plain +0 -9
  473. package/stdlib/library/conformance/java-gradle.plain +0 -9
  474. package/stdlib/library/conformance/java-maven.plain +0 -9
  475. package/stdlib/library/conformance/python.plain +0 -9
  476. package/stdlib/library/conformance/rust.plain +0 -9
  477. package/stdlib/library/conformance/typescript.plain +0 -9
  478. package/stdlib/library/go.plain +0 -12
  479. package/stdlib/library/java-gradle.plain +0 -13
  480. package/stdlib/library/java-maven.plain +0 -13
  481. package/stdlib/library/python.plain +0 -13
  482. package/stdlib/library/rust.plain +0 -12
  483. package/stdlib/library/typescript.plain +0 -15
@@ -1,843 +0,0 @@
1
- import { fixMethod } from "./prompt.js";
2
- import { randomUUID } from "node:crypto";
3
- import { accessSync, constants, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
- import { basename, delimiter, dirname, join, posix, relative, resolve, sep } from "node:path";
5
- import { CONFIG_FILE, CONFIG_KEYS, configModuleFor, configModuleOf, configModulePinned, moduleConfigFile, moduleConfigFileIn, moduleConfigsOf, projectConfigFile, readProjectConfig } from "../config.js";
6
- import { reportActivity, reportLogNote, reportNote } from "./activity.js";
7
- import { record, signatureHash } from "./ledger.js";
8
- import { ensureInModulesScratch, isWithin, modulesScratchDir, slashed } from "./paths.js";
9
- import { defineTool } from "@earendil-works/pi-coding-agent";
10
- import { Type } from "typebox";
11
- import { keepTestOutput, listFiles, shownTestOutput } from "./testing.js";
12
- import { digestFiles } from "./codebase.js";
13
- import { NOTES_FILE } from "./notes.js";
14
- import { COMMAND_TIMEOUT_MS, runCommand } from "./shell.js";
15
- /**
16
- * The scripts, with the conformance testing script set aside because conformance was turned
17
- * off: no conformance tests are written or run - not even those already in the codebase - and
18
- * no agent is shown it.
19
- */
20
- export function withoutConformance(scripts) {
21
- const { conformance: _ignored, prepare: _alsoIgnored, ...rest } = scripts;
22
- return { ...rest, conformanceOff: true };
23
- }
24
- /** The names the skills give each script. Only a file by one of these names is ever run. */
25
- const NAMES = {
26
- unit: /^run_unit_?tests[^/]*\.sh$/i,
27
- conformance: /^run_conformance_?tests[^/]*\.sh$/i,
28
- };
29
- export function scriptKind(name) {
30
- return Object.keys(NAMES).find((kind) => NAMES[kind].test(basename(name)));
31
- }
32
- /** The name the prepare script has: `prepare_environment_<lang>.sh`. */
33
- export const PREPARE_NAME = /^prepare_environment[^/]*\.sh$/i;
34
- function isFile(path) {
35
- try {
36
- return statSync(path).isFile();
37
- }
38
- catch {
39
- return false;
40
- }
41
- }
42
- /** The key in the project's config.turri.yaml that names each script. */
43
- const SCRIPT_KEYS = {
44
- unit: CONFIG_KEYS.unittestsScript,
45
- conformance: CONFIG_KEYS.conformanceTestsScript,
46
- };
47
- export const SCRIPTS_DIR = "test_scripts";
48
- /**
49
- * The project a build belongs to: the folder that holds its plain_modules. A build folder
50
- * elsewhere belongs to the folder of its spec.
51
- */
52
- export function projectRootFor(plainFile, buildDir) {
53
- const parts = resolve(buildDir).split(sep);
54
- const index = parts.lastIndexOf("plain_modules");
55
- return index > 0 ? parts.slice(0, index).join(sep) : dirname(resolve(plainFile));
56
- }
57
- /**
58
- * The one script of a kind in a folder, by the names the skills give them; two or more say which. What `claimed` holds -
59
- * the scripts other modules' own files name - is never one of them.
60
- */
61
- function onlyScriptIn(dir, kind, claimed = new Set()) {
62
- if (!existsSync(dir))
63
- return {};
64
- const candidates = readdirSync(dir)
65
- .filter((name) => (kind === "prepare" ? PREPARE_NAME.test(name) : scriptKind(name) === kind) && isFile(join(dir, name)) && !claimed.has(resolve(dir, name)))
66
- .sort();
67
- if (candidates.length === 1)
68
- return { path: join(dir, candidates[0]) };
69
- return candidates.length > 1 ? { several: candidates } : {};
70
- }
71
- /**
72
- * The project's testing scripts, looked for in this order:
73
- *
74
- * 1. `config.turri.yaml` at the project root, with the module's own `config.turri.<module>.yaml` over it - or the one of a
75
- * module it requires (`configModuleFor`) -
76
- * `unittests-script:` and `conformance-tests-script:`, paths from the root;
77
- * 2. the project root itself - the one `run_unittests*.sh` / `run_conformance_tests*.sh` there;
78
- * 3. `test_scripts/` - the one of each there.
79
- *
80
- * The prepare script - `prepare-environment-script:`, else the one `prepare_environment*.sh` - is looked for the same
81
- * way, and is optional: without one, the conformance testing script runs alone.
82
- *
83
- * A folder holding two of a kind does not say which is meant: it is skipped, and noted, so the
84
- * error that stops the build can say to name one in config.turri.yaml.
85
- *
86
- * Where modules have config files of their own and none applies to this one, a script one of those files names is that
87
- * module's - of its stack - and never found in a folder for this one: a frontend is not tested with the backend's script.
88
- */
89
- export function findTestScripts(root, plainFile, buildDir) {
90
- const found = {};
91
- const notes = {};
92
- // The module's own file over the project's - the one pinned, else the one of the module asked about: its scripts.
93
- const own = configModulePinned() ? configModuleOf(root) : plainFile !== undefined ? moduleOfSpec(plainFile) : undefined;
94
- const config = readProjectConfig(root, own);
95
- const file = own !== undefined ? `${moduleConfigFileIn(root, own)} (over ${projectConfigFile(root)})` : projectConfigFile(root);
96
- // Modules with files of their own, none of them this one's: its scripts are likely named in theirs.
97
- const others = own === undefined ? moduleConfigsOf(root) : [];
98
- // What their files name is theirs: never this module's, found in a folder.
99
- const claimed = new Set(others.flatMap((each) => {
100
- const theirs = readProjectConfig(root, each);
101
- return [theirs.unittestsScript, theirs.conformanceTestsScript, theirs.prepareEnvironmentScript].flatMap((named) => (named !== undefined ? [resolve(root, named.trim())] : []));
102
- }));
103
- // Where a script is named: the module's own file - or, where modules have their own, the one of the module that builds it.
104
- const nameIn = own !== undefined
105
- ? moduleConfigFileIn(root, own)
106
- : others.length > 0
107
- ? "the module's own config.turri.<module>.yaml"
108
- : `${CONFIG_FILE} - or the module's own config.turri.<module>.yaml`;
109
- if (config.testingScriptsRunOn !== undefined)
110
- found.runOn = config.testingScriptsRunOn;
111
- for (const kind of Object.keys(SCRIPT_KEYS)) {
112
- const named = kind === "unit" ? config.unittestsScript : config.conformanceTestsScript;
113
- if (named !== undefined) {
114
- const path = resolve(root, named.trim());
115
- // Agents write in plain_modules: a script there could be changed by the work it judges.
116
- if (path.split(sep).includes("plain_modules")) {
117
- notes[kind] = `${file} names ${named.trim()} as the ${SCRIPT_KEYS[kind]}, inside plain_modules - where agents write, so it is not used.`;
118
- }
119
- else if (isFile(path)) {
120
- found[kind] = path;
121
- continue;
122
- }
123
- else {
124
- notes[kind] = `${file} names ${named.trim()} as the ${SCRIPT_KEYS[kind]}, and there is no such file.`;
125
- }
126
- }
127
- for (const dir of [root, join(root, SCRIPTS_DIR)]) {
128
- const { path, several } = onlyScriptIn(dir, kind, claimed);
129
- if (path !== undefined) {
130
- found[kind] = path;
131
- break;
132
- }
133
- if (several !== undefined && notes[kind] === undefined) {
134
- notes[kind] = `${dir === root ? "The project root" : `${SCRIPTS_DIR}/`} holds ${several.join(", ")} - name the one to use in ${nameIn}.`;
135
- }
136
- }
137
- }
138
- // Optional: found the same way, and nothing is missing without it.
139
- const prepareNamed = config.prepareEnvironmentScript;
140
- const preparePath = prepareNamed !== undefined ? resolve(root, prepareNamed.trim()) : undefined;
141
- if (preparePath !== undefined && preparePath.split(sep).includes("plain_modules")) {
142
- notes.prepare = `${file} names ${prepareNamed.trim()} as the ${CONFIG_KEYS.prepareEnvironmentScript}, inside plain_modules - where agents write, so it is not used.`;
143
- }
144
- else if (preparePath !== undefined && isFile(preparePath)) {
145
- found.prepare = preparePath;
146
- }
147
- else {
148
- if (preparePath !== undefined)
149
- notes.prepare = `${file} names ${prepareNamed.trim()} as the ${CONFIG_KEYS.prepareEnvironmentScript}, and there is no such file.`;
150
- for (const dir of [root, join(root, SCRIPTS_DIR)]) {
151
- const { path, several } = onlyScriptIn(dir, "prepare", claimed);
152
- if (path !== undefined) {
153
- found.prepare = path;
154
- break;
155
- }
156
- if (several !== undefined && notes.prepare === undefined) {
157
- notes.prepare = `${dir === root ? "The project root" : `${SCRIPTS_DIR}/`} holds ${several.join(", ")} - name the one to use in ${nameIn}, as ${CONFIG_KEYS.prepareEnvironmentScript}:.`;
158
- }
159
- }
160
- }
161
- // Modules with files of their own, none of them this one's: the note says which name a script, and where its own goes.
162
- if (others.length > 0) {
163
- for (const kind of Object.keys(SCRIPT_KEYS)) {
164
- if (found[kind] !== undefined)
165
- continue;
166
- const named = others.flatMap((each) => {
167
- const script = kind === "unit" ? readProjectConfig(root, each).unittestsScript : readProjectConfig(root, each).conformanceTestsScript;
168
- return script !== undefined ? [`${moduleConfigFile(each)} names ${script.trim()}`] : [];
169
- });
170
- notes[kind] = [
171
- ...(notes[kind] !== undefined ? [notes[kind]] : []),
172
- `No module config file applies here, so ${CONFIG_FILE} alone is read - the modules' own are ${others.map(moduleConfigFile).join(", ")}${named.length > 0 ? `, and ${named.join("; ")}` : ""}. ` +
173
- "A module takes its own config.turri.<module>.yaml, else the one of a module it requires: name its scripts in its own file - in the chat, the settings tool with module.",
174
- ].join(" ");
175
- }
176
- }
177
- if (Object.keys(notes).length > 0)
178
- found.notes = notes;
179
- return found;
180
- }
181
- /**
182
- * The exit code a testing script ends with when the tests passed and only its static checks - the formatter in check
183
- * mode, the linter, the type checker - did not. Every other failure is the script's own exit code. The harness tells the
184
- * two apart: a unit run says it was the static checks, and a conformance run sends its tests' findings straight to the
185
- * conformance agent, with no judge asked whether the code or the tests are wrong.
186
- */
187
- export const STATIC_CHECKS_FAILED = 80;
188
- /** Whether a failed run of a testing script failed on its static checks alone: the tests passed. */
189
- export function staticChecksOnly(run) {
190
- return run.exitCode === STATIC_CHECKS_FAILED && run.timedOut !== true;
191
- }
192
- const SKILL = {
193
- unit: { skill: "implement-unit-testing-script", file: "run_unittests", what: "unit testing script" },
194
- conformance: { skill: "implement-conformance-testing-script", file: "run_conformance_tests", what: "conformance testing script" },
195
- };
196
- /** The kind of testing script a skill writes, by its name - one that writes none, undefined. */
197
- export function scriptKindOfSkill(skill) {
198
- return Object.keys(SKILL).find((kind) => SKILL[kind].skill === skill);
199
- }
200
- /** Raised before a build starts when the script that would decide it is done is missing. */
201
- export class MissingTestScriptError extends Error {
202
- // Declared fields, not parameter properties: node's own type stripping cannot run those.
203
- moduleName;
204
- kind;
205
- constructor(moduleName, kind, note) {
206
- const { skill, file, what } = SKILL[kind];
207
- super([
208
- `Stopped before building ${moduleName}: it has no ${what}, so nothing can decide when its ${kind === "unit" ? "unit" : "conformance"} tests pass.`,
209
- ...(note !== undefined ? ["", note] : []),
210
- "",
211
- "What to change in the project:",
212
- `- Add one with the \`${skill}\` skill: it writes \`${SCRIPTS_DIR}/${file}_<language>.sh\`.`,
213
- `- It is looked for in \`${CONFIG_FILE}\` at the project root (\`${SCRIPT_KEYS[kind]}: <path>\`) - or the module's own`,
214
- ` \`config.turri.<module>.yaml\` beside it, or the one of a module it requires - then in the root,`,
215
- ` then in \`${SCRIPTS_DIR}/\` - one ${file}*.sh in either folder is used.`,
216
- "",
217
- "Then build again.",
218
- ].join("\n"));
219
- this.name = "MissingTestScriptError";
220
- this.moduleName = moduleName;
221
- this.kind = kind;
222
- }
223
- }
224
- /** The scripts a build needs, or the error that stops it before it starts. */
225
- export function requireTestScripts(moduleName, scripts, needs) {
226
- if (scripts.unit === undefined)
227
- throw new MissingTestScriptError(moduleName, "unit", scripts.notes?.unit);
228
- if (needs.conformance && scripts.conformance === undefined) {
229
- throw new MissingTestScriptError(moduleName, "conformance", scripts.notes?.conformance);
230
- }
231
- }
232
- /**
233
- * The scripts that decide an agent's work, in its prompt - only those that will be run on it: a
234
- * conformance testing script an agent's work is never judged by is left out. The whole script,
235
- * read from the project as it is now.
236
- */
237
- export function withTestingScripts(prompt, scripts, kinds, root) {
238
- const used = kinds.filter((kind) => scripts[kind] !== undefined);
239
- if (used.length === 0)
240
- return prompt;
241
- const named = (path) => (path.startsWith(`${root}${sep}`) ? path.slice(root.length + 1) : basename(path));
242
- const script = (kind, path) => `<script kind="${kind}" path="${named(path)}">\n${readFileSync(path, "utf8").trimEnd()}\n</script>`;
243
- // The prepare script runs before the conformance testing script: shown with it, before it.
244
- const prepare = used.includes("conformance") ? scripts.prepare : undefined;
245
- const rendered = used.flatMap((kind) => [
246
- ...(kind === "conformance" && prepare !== undefined ? [script("prepare environment", prepare)] : []),
247
- script(kind === "unit" ? "unit tests" : "conformance tests", scripts[kind]),
248
- ]);
249
- const tools = used.map((kind) => (kind === "unit" ? "run_unit_tests" : "run_conformance_tests")).join(" and ");
250
- const inPlace = (scripts.runOn ?? readProjectConfig(root).testingScriptsRunOn) !== "copy";
251
- return [
252
- "<testing scripts>",
253
- rendered.join("\n\n"),
254
- "</testing scripts>",
255
- "",
256
- `The harness decides whether your work is done by running ${used.length === 1 ? "this script" : "these scripts"} itself, ` +
257
- (inPlace
258
- ? "on this machine, in place, against the host codebase it merges your code into: "
259
- : "on this machine, on a fresh copy of your work: ") +
260
- used
261
- .map((kind) => kind === "unit"
262
- ? "the unit testing script as `<script> <build folder>`"
263
- : `${prepare !== undefined ? "the prepare script as `<script> <build folder>` and, once it passes, " : ""}the conformance testing script as \`<script> <build folder> <whole conformance suite folder>\``)
264
- .join(", ") +
265
- ". Make the tests pass the way the script runs them.",
266
- `A testing script may run static checks before its tests - the formatter in check mode, the linter, the type checker, ` +
267
- `on what it tests: the code for the unit testing script, the tests for the conformance one. They count as the tests ` +
268
- `do, and exit ${STATIC_CHECKS_FAILED} means the tests passed and only the checks did not. Formatting is yours: run the ` +
269
- "formatter the script checks with on the files you change, in your shell, before the final run.",
270
- `${used.length === 1 ? "It is" : "They are"} shown so you know what runs your tests - not to be run by you. ${used.length === 1 ? "It is" : "They are"} not in your ` +
271
- `workspace, and the path above is the project's, not one you can reach. Never copy, recreate or adapt ${used.length === 1 ? "it" : "them"} in the ` +
272
- `codebase, and never write a test runner of your own: call ${tools}, which run ${used.length === 1 ? "it" : "them"} exactly as the harness does - ` +
273
- "that run is the one that counts. Run a single test or file with bash while you work, as you like.",
274
- "They run in the person's own environment, with this machine's toolchains - the ones your shell has too. A toolchain " +
275
- "or system library the script needs and this machine lacks is not yours to install: say what is missing, and the " +
276
- "person installs it. What the code needs to be built and run belongs in the code (its dependency manifest), so " +
277
- `${inPlace ? "it builds where the script puts it" : "a fresh copy of it builds"}.`,
278
- "",
279
- prompt,
280
- ].join("\n");
281
- }
282
- /**
283
- * Where one script run is staged - in the project's scratch, and new for every run: the scripts
284
- * work in /tmp/<lang>_<basename of the build>, so the build is named for the module and this run
285
- * too, and no two runs - two modules testing at once - share that folder.
286
- */
287
- function stagingFor(buildDir) {
288
- const key = randomUUID().slice(0, 12);
289
- const root = join(modulesScratchDir(buildDir), "scripts", key);
290
- return { root, build: join(root, `${basename(dirname(resolve(buildDir)))}-${key}`), tests: join(root, "tests") };
291
- }
292
- /** The code, copied for a run; how many files. */
293
- function stageBuild(buildDir, target) {
294
- // There even when the build is empty: the scripts cd into it.
295
- mkdirSync(target, { recursive: true });
296
- const files = listFiles(buildDir);
297
- for (const file of files) {
298
- mkdirSync(dirname(join(target, file)), { recursive: true });
299
- copyFileSync(join(buildDir, file), join(target, file));
300
- }
301
- return files.length;
302
- }
303
- /** Every functionality's tests in one folder. A name already taken is renamed, never overwritten. */
304
- function stageTests(testsDirs, target) {
305
- mkdirSync(target, { recursive: true });
306
- const taken = new Set();
307
- testsDirs.forEach((dir, index) => {
308
- if (!existsSync(dir))
309
- return;
310
- for (const file of listFiles(dir)) {
311
- let name = file;
312
- if (taken.has(name)) {
313
- const renamed = `${index + 1}_${basename(file)}`;
314
- name = posix.dirname(file) === "." ? renamed : posix.join(posix.dirname(file), renamed);
315
- }
316
- taken.add(name);
317
- mkdirSync(dirname(join(target, name)), { recursive: true });
318
- copyFileSync(join(dir, file), join(target, name));
319
- }
320
- });
321
- return taken.size;
322
- }
323
- /** What the project calls a script: its path from the spec's folder when it is under it. */
324
- function shown(script) {
325
- const parent = dirname(dirname(script));
326
- return isWithin(script, parent) ? relative(parent, script) : basename(script);
327
- }
328
- /** How long a test run may take: the command time limit. Over it, the run counts as failed. */
329
- let scriptTimeoutMs = COMMAND_TIMEOUT_MS;
330
- /** For tests: a shorter limit than two minutes. */
331
- export function setScriptTimeoutForTests(ms) {
332
- scriptTimeoutMs = ms ?? COMMAND_TIMEOUT_MS;
333
- }
334
- /**
335
- * The project a build belongs to - the folder above its `plain_modules`, where the testing scripts'
336
- * own paths start - and whether they run on the code in place (the default), rather than on a fresh copy
337
- * (`testing-scripts-run-on: copy`).
338
- */
339
- /** Whether the testing scripts run on the code in `buildDir` itself, not on a copy of it. */
340
- export function scriptsRunInPlace(buildDir) {
341
- return projectOfBuild(buildDir).inPlace;
342
- }
343
- function projectOfBuild(buildDir) {
344
- const parts = resolve(buildDir).split(sep);
345
- const index = parts.lastIndexOf("plain_modules");
346
- const root = index > 0 ? parts.slice(0, index).join(sep) : dirname(resolve(buildDir));
347
- // The module's own file decides, when it says.
348
- return { root, inPlace: readProjectConfig(root, configModuleOf(root)).testingScriptsRunOn !== "copy" };
349
- }
350
- /** The model providers' keys, kept out of what runs on this machine: the tests are agents' code. */
351
- const PROVIDER_KEY = /^(ANTHROPIC|OPENAI|AZURE_OPENAI|GEMINI|GOOGLE|GOOGLE_GENERATIVE_AI|MISTRAL|GROQ|XAI|OPENROUTER|DEEPSEEK|CEREBRAS|TOGETHER|FIREWORKS)_API_KEY$|^AWS_BEARER_TOKEN_BEDROCK$/;
352
- /** The environment a testing script runs in: the person's own, but for turri's model providers' keys. */
353
- function scriptEnv() {
354
- return Object.fromEntries(Object.entries(process.env).filter(([key]) => !PROVIDER_KEY.test(key)));
355
- }
356
- /**
357
- * A testing script run on this machine - `bash <script> <args>` from `cwd`, through the host runner: a process group of
358
- * its own, so the time limit and a stopped job end it and all it started. `named`: the path the script names itself by
359
- * in its output, shown as the project's script.
360
- */
361
- async function runScript(cwd, script, args, logDir, options = {}) {
362
- const timeoutMs = options.limitMs ?? scriptTimeoutMs;
363
- const started = Date.now();
364
- // Where and how it runs, for the log: how it ended is what the activity says.
365
- reportLogNote(` ▶ ${shown(script)} on this machine, ${options.named !== undefined ? "on a fresh copy of the code" : `in place, from ${cwd}`} (limit ${Math.round(timeoutMs / 1000)}s)`);
366
- const { exitCode, output, timedOut } = await runCommand(scriptCommand(options.named ?? script, args), {
367
- cwd,
368
- env: scriptEnv(),
369
- timeoutMs,
370
- timeoutNote: (ms) => `\n[stopped after ${Math.round(ms / 1000)}s, the time limit for a test run: counted as failed]`,
371
- });
372
- const took = ((Date.now() - started) / 1000).toFixed(1);
373
- reportActivity(timedOut === true
374
- ? ` ✗ ${shown(script)} did not finish in ${Math.round(timeoutMs / 1000)}s - stopped, counted as failed`
375
- : ` ${exitCode === 0 ? "✓" : "✗"} ${shown(script)} exited ${exitCode} after ${took}s`);
376
- // The copy's path, where the script names itself, reads as the project's script.
377
- const text = options.named !== undefined ? output.split(options.named).join(shown(script)) : output;
378
- const noted = withScriptLineNote(text, script);
379
- // Its failures, counts and end are what the agent is shown; the whole is kept, a read_output away.
380
- const log = keepTestOutput(logDir, basename(script), noted);
381
- const run = {
382
- command: shown(script),
383
- exitCode: timedOut === true ? 124 : exitCode,
384
- output: shownTestOutput(noted, log),
385
- timedOut: timedOut === true,
386
- timeoutMs,
387
- elapsedMs: Date.now() - started,
388
- ...(log !== undefined ? { log } : {}),
389
- };
390
- record({
391
- kind: "script.run",
392
- script: basename(script),
393
- exit: run.exitCode,
394
- ms: run.elapsedMs,
395
- timedOut: run.timedOut === true,
396
- inPlace: options.named === undefined,
397
- // On code changed for the run - can_it_fail's bug: failing is what it is for.
398
- ...(options.mutated === true ? { mutated: true } : {}),
399
- ...(run.exitCode !== 0 ? { signature: signatureHash(failureSignature(run)) } : {}),
400
- });
401
- return run;
402
- }
403
- /** What bash says when a line of the script itself cannot run: a command or file that is not there, or not runnable. */
404
- const OWN_LINE_FAILURE = /: (No such file or directory|command not found|Permission denied)$/;
405
- /** The script lines already told to the person, by script, line and error - once each, in this process. */
406
- const toldScriptLines = new Set();
407
- /**
408
- * A run's output, with a note at its top when a line of the script itself fails where it runs - a macOS-only
409
- * `/usr/libexec/java_home` in a Linux sandbox. The agent is told it is the person's script, not its code, so it does not
410
- * go looking for what the line names; the person is told once, in the job's log.
411
- */
412
- function withScriptLineNote(output, script) {
413
- const name = basename(script);
414
- const prefix = new RegExp(`^(?:.*[/\\\\])?${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}: line (\\d+): (.+)$`);
415
- const failures = output
416
- .split("\n")
417
- .map((line) => prefix.exec(line))
418
- .filter((found) => found !== null && OWN_LINE_FAILURE.test(found[2]));
419
- if (failures.length === 0)
420
- return output;
421
- const notes = failures.map(([, line, error]) => {
422
- const key = `${script}\n${line}\n${error}`;
423
- if (!toldScriptLines.has(key)) {
424
- toldScriptLines.add(key);
425
- reportNote(` ⚠ line ${line} of ${name} fails where it runs - \`${error}\`: the script is yours to fix; the agents are told it is not theirs`);
426
- }
427
- return (`[turri: line ${line} of the project's testing script, ${name}, fails where it runs - \`${error}\`. That is the person's ` +
428
- "script, not your code: they have been told. Do not go looking for what it names; judge the run by what the tests " +
429
- "themselves report.]");
430
- });
431
- return `${[...new Set(notes)].join("\n")}\n\n${output}`;
432
- }
433
- /**
434
- * The command a testing script runs by: `bash <script> <args>`, every path quoted and written with `/`. On Windows bash is
435
- * Git Bash, whose tools may read a backslash as an escape - GNU tar reads the `\a` of `C:\Users\anton` as a bell - while
436
- * Windows and Git Bash both take `C:/Users/anton`.
437
- */
438
- export function scriptCommand(script, args) {
439
- return `bash ${[script, ...args].map((path) => quote(slashed(path))).join(" ")}`;
440
- }
441
- /** A path, quoted for bash. */
442
- function quote(path) {
443
- return `'${path.replace(/'/g, "'\\''")}'`;
444
- }
445
- /** A testing script run on a fresh copy of the code: the project's script copied fresh into the staging folder, beside it. */
446
- async function runOnCopy(stagingRoot, script, args, logDir, limitMs, mutated) {
447
- const copy = join(stagingRoot, basename(script));
448
- writeFileSync(copy, readFileSync(script));
449
- return runScript(stagingRoot, script, args, logDir, { named: copy, ...(limitMs !== undefined ? { limitMs } : {}), ...(mutated === true ? { mutated } : {}) });
450
- }
451
- /**
452
- * The harness's run of the unit testing script on the code as it is now - and run_unit_tests'.
453
- *
454
- * On this machine, on the code in place, or - `testing-scripts-run-on: copy` - on a fresh copy of the code
455
- * (see the top of this file). This and runConformanceScript are the only ways the testing
456
- * scripts are ever run.
457
- */
458
- export async function runUnitScript(buildDir, script) {
459
- return runOnCode(buildDir, script, "unit testing script");
460
- }
461
- /** How long the last passing run of a script on a codebase took, by codebase and script. */
462
- const lastPassing = new Map();
463
- /** How long the last passing run of `script` on the code in `buildDir` took, in this process - undefined before one has. */
464
- export function lastPassingMs(buildDir, script) {
465
- return lastPassing.get(`${resolve(buildDir)}\n${script}`);
466
- }
467
- /** Files changed in place for a run under way, and what each held: put back however the run ends - the process exiting too. */
468
- const changedInPlace = new Map();
469
- let restoreOnExit = false;
470
- function putBack(path) {
471
- const original = changedInPlace.get(path);
472
- if (original === undefined)
473
- return;
474
- writeFileSync(path, original);
475
- changedInPlace.delete(path);
476
- }
477
- /**
478
- * `run` with `change` made to the code itself, and undone once it ends - passed, failed, timed out, thrown, or the process
479
- * exiting. Killed outright, the change is left: the next unit of work starts from the last commit (lineage.ts startWork).
480
- */
481
- async function withChangeInPlace(buildDir, change, run) {
482
- const path = resolve(buildDir, change.file);
483
- if (changedInPlace.has(path))
484
- throw new Error(`${change.file} is being changed for another run already.`);
485
- if (!restoreOnExit) {
486
- restoreOnExit = true;
487
- process.once("exit", () => {
488
- for (const changed of [...changedInPlace.keys()])
489
- putBack(changed);
490
- });
491
- }
492
- changedInPlace.set(path, readFileSync(path));
493
- try {
494
- writeFileSync(path, change.text);
495
- return await run();
496
- }
497
- finally {
498
- putBack(path);
499
- }
500
- }
501
- /**
502
- * A script that takes the code folder - the unit testing script - run where the testing scripts run. `change`: one file
503
- * as it is for this run - made to the fresh copy, or, in place, to the code itself and undone once the run ends.
504
- */
505
- export async function runOnCode(buildDir, script, what, change,
506
- /** A time limit of its own, in place of a test run's. */
507
- limitMs) {
508
- const project = projectOfBuild(buildDir);
509
- const passed = (run, started) => {
510
- if (change === undefined && run.exitCode === 0)
511
- lastPassing.set(`${resolve(buildDir)}\n${script}`, Date.now() - started);
512
- return run;
513
- };
514
- if (project.inPlace) {
515
- const inPlace = () => runScript(project.root, script, [resolve(buildDir)], buildDir, { ...(limitMs !== undefined ? { limitMs } : {}), ...(change !== undefined ? { mutated: true } : {}) });
516
- const started = Date.now();
517
- if (change === undefined)
518
- return passed(await inPlace(), started);
519
- reportActivity(` changing ${change.file} in place for the ${what} - put back once it has run`);
520
- return withChangeInPlace(buildDir, change, inPlace);
521
- }
522
- const staging = stagingFor(buildDir);
523
- rmSync(staging.root, { recursive: true, force: true });
524
- ensureInModulesScratch(buildDir, staging.root);
525
- try {
526
- reportActivity(` copying ${stageBuild(buildDir, staging.build)} files of the code for the ${what}`);
527
- if (change !== undefined)
528
- writeFileSync(join(staging.build, change.file), change.text);
529
- const started = Date.now();
530
- return passed(await runOnCopy(staging.root, script, [staging.build], buildDir, limitMs, change !== undefined), started);
531
- }
532
- finally {
533
- rmSync(staging.root, { recursive: true, force: true });
534
- }
535
- }
536
- /**
537
- * The harness's run of the conformance testing script - and run_conformance_tests': the code, and
538
- * the codebase's whole conformance suite - every functionality's tests, and those carried up from
539
- * the modules below - in one folder, run at once. As runUnitScript runs: on a copy of the code staged beside the tests,
540
- * or in place.
541
- */
542
- export async function runConformanceScript(buildDir, testsDirs, scripts) {
543
- if (scripts.conformance === undefined)
544
- throw new Error("No conformance testing script to run.");
545
- const project = projectOfBuild(buildDir);
546
- const staging = stagingFor(buildDir);
547
- rmSync(staging.root, { recursive: true, force: true });
548
- ensureInModulesScratch(buildDir, staging.root);
549
- try {
550
- let build;
551
- let tests;
552
- if (project.inPlace) {
553
- // The real folders: the real tests folder when there is one; several merged into one, first.
554
- build = resolve(buildDir);
555
- if (testsDirs.length === 1)
556
- tests = resolve(testsDirs[0]);
557
- else {
558
- stageTests(testsDirs, staging.tests);
559
- tests = staging.tests;
560
- }
561
- }
562
- else {
563
- const code = stageBuild(buildDir, staging.build);
564
- const count = stageTests(testsDirs, staging.tests);
565
- reportActivity(` copying ${code} files of the code and the whole conformance suite (${count} files) for the conformance testing script`);
566
- const prepared = scripts.prepare !== undefined ? await runOnCopy(staging.root, scripts.prepare, [staging.build], buildDir) : undefined;
567
- if (prepared !== undefined && prepared.exitCode !== 0)
568
- return preparationFailed(prepared, scripts.conformance);
569
- return withPrepared(await runOnCopy(staging.root, scripts.conformance, [staging.build, staging.tests], buildDir), prepared);
570
- }
571
- // The environment first, on the same build the conformance tests get: the conformance testing script runs only once it passes.
572
- const prepared = scripts.prepare !== undefined ? await runScript(project.root, scripts.prepare, [build], buildDir) : undefined;
573
- if (prepared !== undefined && prepared.exitCode !== 0)
574
- return preparationFailed(prepared, scripts.conformance);
575
- return withPrepared(await runScript(project.root, scripts.conformance, [build, tests], buildDir), prepared);
576
- }
577
- finally {
578
- rmSync(staging.root, { recursive: true, force: true });
579
- }
580
- }
581
- /** A prepare script that failed: the run, said to be the preparation's - the conformance tests were not run. */
582
- function preparationFailed(prepared, conformance) {
583
- return {
584
- ...prepared,
585
- output: `${prepared.command} - the project's prepare script, run on the build before ${shown(conformance)} - exited ${prepared.exitCode}, so the conformance tests were not run.\n\n${prepared.output}`,
586
- };
587
- }
588
- /** A conformance run, with a line at its top saying the prepare script ran first and passed. */
589
- function withPrepared(run, prepared) {
590
- return prepared === undefined ? run : { ...run, output: `${prepared.command} prepared the build first, and passed.\n\n${run.output}` };
591
- }
592
- /**
593
- * `run_unit_tests` / `run_conformance_tests`: the agent's final check before it finishes - the
594
- * project's testing script, run exactly as the harness will run it to decide whether the work is
595
- * done. It takes no command. Everything else - one test, one file, another configuration, while
596
- * the agent works - is what bash is for.
597
- */
598
- export function createScriptTool(options) {
599
- const unit = options.kind === "unit";
600
- const name = unit ? "run_unit_tests" : "run_conformance_tests";
601
- const script = options.script !== undefined ? basename(options.script) : "the project's script";
602
- return defineTool({
603
- name,
604
- label: unit ? "Run unit tests" : "Run conformance tests",
605
- description: unit
606
- ? `Final check before you finish: run the project's unit testing script, ${script}, ` +
607
- "on the code as it is now - exactly as the harness runs it to decide whether this is done. It takes no command. To " +
608
- "run one test, one file, or the tests any other way while you work, use bash."
609
- : `Run the project's conformance testing script, ${script}, on a fresh copy of the code with the whole conformance ` +
610
- "suite - exactly as the harness runs it to decide whether this is done. It takes no command. Your shell holds " +
611
- "only the tests, not the code, so this is how you run them against the code: while you work, and as the final " +
612
- "check before you finish.",
613
- promptSnippet: `${name}: the final check - the project's ${unit ? "unit" : "conformance"} testing script, as the harness runs it`,
614
- parameters: Type.Object({}),
615
- async execute() {
616
- const run = await options.run();
617
- options.runs.push({ command: run.command, exitCode: run.exitCode });
618
- options.onRun?.(run.command, run.exitCode);
619
- const text = run.timedOut === true
620
- ? timedOutFailure(run, unit ? "unit testing" : "conformance testing").replace("The harness ran", "You ran")
621
- : `${run.command} exited ${run.exitCode}\n\n${run.output}`;
622
- const loop = options.watch?.see(run);
623
- return {
624
- content: [{ type: "text", text: loop === undefined ? text : `${text}\n\n${loopNotice(loop)}` }],
625
- details: { command: run.command, exitCode: run.exitCode, ...(loop !== undefined ? { loop } : {}) },
626
- // Going round in circles a second time: its turn ends here, and the harness takes it from there.
627
- ...(loop === "stop" ? { terminate: true } : {}),
628
- };
629
- },
630
- });
631
- }
632
- /** How many of the agent's own runs failing the same way, one after another, are a loop. */
633
- export const LOOP_RUNS = 6;
634
- export function createLoopWatch(dir) {
635
- /** The code folder at each failing run, as a digest of its files. */
636
- const failedStates = new Set();
637
- let strikes = 0;
638
- let stuck = false;
639
- let failing = 0;
640
- let last;
641
- let streak = 0;
642
- const stateOf = () => [...digestFiles(dir)]
643
- .filter(([file]) => file !== NOTES_FILE && !file.endsWith(`/${NOTES_FILE}`))
644
- .sort(([a], [b]) => a.localeCompare(b))
645
- .map(([file, digest]) => `${file} ${digest}`)
646
- .join("\n");
647
- return {
648
- see(run) {
649
- if (run.exitCode === 0 && run.timedOut !== true) {
650
- failedStates.clear();
651
- strikes = 0;
652
- stuck = false;
653
- failing = 0;
654
- last = undefined;
655
- streak = 0;
656
- return undefined;
657
- }
658
- failing += 1;
659
- const state = stateOf();
660
- const signature = failureSignature(run);
661
- streak = signature === last ? streak + 1 : 1;
662
- last = signature;
663
- const revisited = failedStates.has(state);
664
- failedStates.add(state);
665
- if (!revisited && streak < LOOP_RUNS)
666
- return undefined;
667
- streak = 0;
668
- strikes += 1;
669
- if (strikes === 1)
670
- return "warn";
671
- stuck = true;
672
- return "stop";
673
- },
674
- get stuck() {
675
- return stuck;
676
- },
677
- get failing() {
678
- return failing;
679
- },
680
- reset() {
681
- strikes = 0;
682
- stuck = false;
683
- streak = 0;
684
- last = undefined;
685
- },
686
- };
687
- }
688
- /** What the agent is told with a run when it is going round in circles. */
689
- function loopNotice(loop) {
690
- if (loop === "warn") {
691
- return [
692
- "You are going round in circles: the code is back exactly as it was at an earlier failing run, or the tests have",
693
- "failed the same way run after run. Another variation on what you have tried will not fix it. Stop editing and",
694
- "find the cause first: read the code under test where the failure points - how it calls what the test replaces,",
695
- "with which arguments - and the test, line by line, against it. Then make the one change that the cause calls for.",
696
- ].join("\n");
697
- }
698
- return [
699
- "You are still going round in circles, so your turn ends here. Change nothing more now: a debugger will look at",
700
- "the failure with fresh eyes, and you will be given what it finds.",
701
- ].join("\n");
702
- }
703
- /**
704
- * How long a run took against its time limit, in a line: for whoever judges it or works out its cause - so a run that
705
- * ended on its own is never taken for one the limit stopped, nor the other way.
706
- */
707
- export function runTiming(run) {
708
- const seconds = (ms) => `${(ms / 1000).toFixed(1)}s`;
709
- const limit = seconds(run.timeoutMs);
710
- if (run.timedOut === true) {
711
- return `The time limit stopped this run: it had run ${seconds(run.elapsedMs ?? run.timeoutMs)} of the ${limit} a test run may take, and had not finished.`;
712
- }
713
- const took = run.elapsedMs !== undefined ? `after ${seconds(run.elapsedMs)} of the ${limit} a test run may take` : `well within the ${limit} a test run may take`;
714
- return `This run ended on its own - exit ${run.exitCode}, ${took}. The time limit did not stop it and played no part in how it ended.`;
715
- }
716
- /** A run the time limit stopped: failed, and what most often keeps a test run from ending. */
717
- function timedOutFailure(run, what) {
718
- const limit = Math.round(run.timeoutMs / 1000);
719
- return [
720
- `The harness ran the project's ${what} script, \`${run.command}\`, and it had not finished after ${limit} seconds - the`,
721
- "time limit for a test run - so it was stopped, and counts as failed. This is what it had printed by then:",
722
- "",
723
- run.output.trimEnd(),
724
- "",
725
- "The output ends where it was stopped: the test running then, or the step after the last one it printed, is the one",
726
- "that does not finish. Most often a test waits for something that never comes:",
727
- "- a server or a watcher started in the foreground, instead of in the background and stopped afterwards;",
728
- "- a prompt waiting for input, or a command that pages its output;",
729
- "- a network call that never answers - a service on localhost that is not running, a host that is down;",
730
- "- a lock, a queue or a thread nothing releases, or a loop that never ends.",
731
- "Find it - run the tests on their own with bash, under `timeout`, a file or a case at a time - and fix what is wrong,",
732
- `in the test or in the code, against the specification. If the tests are only slow, make them faster: every run has`,
733
- `the same ${limit} seconds, and a skipped or deleted test does not count as a fix.`,
734
- ].join("\n");
735
- }
736
- /** A command `timeout` could not start, or a shell could not find - on a line of its own. */
737
- const COULD_NOT_RUN = /^(?:[^:]*: )?failed to run command [‘'`"]?([\w.+-]+)[’'`"]?: No such file or directory$/;
738
- const NOT_FOUND = /^(?:[^:]*: )?(?:line \d+: )?([\w.+-]+): command not found$/;
739
- /**
740
- * What a failed run says is not installed where it ran - the command, when its output names it - or undefined when
741
- * the run failed for another reason. A missing command is the cause only on evidence that it ended the run: exit 69,
742
- * the testing scripts' own way to say a toolchain is missing, or 127, what a shell or `timeout` gives for a command it
743
- * could not find - else a command not found on the last line the run printed, nothing having run after it. Earlier in
744
- * the output it is a warning, not the failure: a shell profile's, an optional tool probed for, a fallback taken - and a
745
- * run that failed for its own reasons is the agent's to fix, not a stop for the person.
746
- */
747
- export function missingToolchain(run) {
748
- if (run.exitCode === 0)
749
- return undefined;
750
- const lines = run.output.split("\n").map((line) => line.trim()).filter((line) => line !== "");
751
- const named = (line) => COULD_NOT_RUN.exec(line)?.[1] ?? NOT_FOUND.exec(line)?.[1];
752
- if (run.exitCode === 69 || run.exitCode === 127) {
753
- // The command is the last one named: the one the run stopped on.
754
- for (let at = lines.length - 1; at >= 0; at -= 1) {
755
- const command = named(lines[at]);
756
- if (command !== undefined)
757
- return { command };
758
- }
759
- return {};
760
- }
761
- const last = lines.at(-1);
762
- const command = last !== undefined ? named(last) : undefined;
763
- return command !== undefined ? { command } : undefined;
764
- }
765
- /** Where `command` is on this machine's PATH - `env`'s, by default turri's own - or undefined when it is not there. */
766
- export function onThisMachine(command, env = process.env) {
767
- for (const dir of (env.PATH ?? "").split(delimiter)) {
768
- if (dir === "")
769
- continue;
770
- const path = join(dir, command);
771
- try {
772
- accessSync(path, constants.X_OK);
773
- return path;
774
- }
775
- catch {
776
- /* not here */
777
- }
778
- }
779
- return undefined;
780
- }
781
- /** What a failed script run means, for the agent that has to fix it. */
782
- export function scriptFailure(run, what) {
783
- if (run.timedOut === true)
784
- return timedOutFailure(run, what);
785
- const missing = missingToolchain(run);
786
- const needs = missing?.command !== undefined ? `\`${missing.command}\`` : "the toolchain it needs";
787
- const cause = missing !== undefined
788
- ? `It could not run: ${needs} is not installed on this machine, where the testing scripts run. That is the person's ` +
789
- "to install, not yours: do not work around it, and do not change the code or the tests for it. Call " +
790
- "report_environment_error with exactly what is missing."
791
- : [
792
- ...fixMethod({
793
- what: what === "unit testing" ? "unit tests" : "conformance tests",
794
- fixes: what === "unit testing" ? "code" : "tests",
795
- runTool: what === "unit testing" ? "run_unit_tests" : "run_conformance_tests",
796
- }),
797
- ].join("\n");
798
- return [
799
- `The harness ran the project's ${what} script, \`${run.command}\`, and it failed (exit ${run.exitCode}).`,
800
- ...(missing === undefined && staticChecksOnly(run)
801
- ? [
802
- `Exit ${STATIC_CHECKS_FAILED}: the tests pass, and the script's static checks - the formatter, the linter, the type checker - ` +
803
- "do not. Fix each finding at its cause; never silence one (a type-ignore or lint-disable comment, a rule " +
804
- "turned off in the checker's configuration). A formatting finding goes by running the formatter.",
805
- ]
806
- : []),
807
- "",
808
- run.output.trimEnd(),
809
- "",
810
- cause,
811
- ].join("\n");
812
- }
813
- /** How many rounds running the same failure, taken the same way, is nothing changing. */
814
- export const STUCK_ROUNDS = 3;
815
- /**
816
- * A failing run, as a fingerprint: the lines that say what went wrong, without what changes from run
817
- * to run - numbers, times, paths, ids. Two runs failing the same way have the same one.
818
- */
819
- export function failureSignature(run) {
820
- if (run.timedOut === true)
821
- return "the run did not finish in the time limit";
822
- const lines = run.output.split("\n").map((line) => line.trim()).filter((line) => line !== "");
823
- const telling = lines.filter((line) => /error|exception|fail|refused|timed out|cannot|unable|not found|denied/i.test(line));
824
- const normal = (line) => line
825
- // Colour codes, and ids a service makes up for each response - a request's UUID, a correlation id in hex.
826
- .replace(/\x1B\[[0-9;]*m/g, "")
827
- .replace(/\/[^\s:'"]+/g, "<path>")
828
- .replace(/\b[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\b/gi, "<id>")
829
- .replace(/\b(?=[0-9a-f]*\d)(?=[0-9a-f]*[a-f])[0-9a-f]{4,}\b/gi, "<id>")
830
- .replace(/\b[0-9a-f]{8,}\b/gi, "<id>")
831
- .replace(/\d+(\.\d+)?/g, "<n>")
832
- .replace(/\s+/g, " ");
833
- return [...new Set((telling.length > 0 ? telling : lines.slice(-20)).map(normal))].slice(0, 30).join("\n");
834
- }
835
- /** The module whose config file builds a module, for finding its scripts - none when it cannot be told: the parse says why. */
836
- function moduleOfSpec(plainFile) {
837
- try {
838
- return configModuleFor(plainFile);
839
- }
840
- catch {
841
- return undefined;
842
- }
843
- }