@turri-dev/cli 0.4.3-next.7ada234 → 0.4.3-next.8c1b0fa

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 +22 -2
  2. package/dist/banner.js +248 -0
  3. package/dist/capture-cli.js +1 -1
  4. package/dist/capture-view.js +99 -0
  5. package/dist/chat-commands.js +6 -6
  6. package/dist/chat-models.js +17 -15
  7. package/dist/chat-tab-header.js +0 -1
  8. package/dist/chat-tabs.js +1 -1
  9. package/dist/chat-terminal.js +115 -73
  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 +20 -26
  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 -3379
  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 -237
  24. package/dist/panel-view.js +409 -0
  25. package/dist/parse-cli.js +5 -2
  26. package/dist/pi-launch.js +41 -13
  27. package/dist/pi-themes.js +2 -2
  28. package/dist/plain-code-blocks.js +1 -1
  29. package/dist/print-mode.js +20 -0
  30. package/dist/quiet.js +7 -106
  31. package/dist/regenerate/diff-view.js +6 -87
  32. package/dist/regenerate/jobs-tree.js +2 -17
  33. package/dist/regenerate/spec-map-view.js +3 -68
  34. package/dist/regenerate-cli.js +7 -11
  35. package/dist/reopen.js +40 -7
  36. package/dist/skill-progress.js +25 -0
  37. package/dist/skill-report.js +52 -0
  38. package/dist/terminal-marks.js +21 -0
  39. package/dist/terminal-notifications.js +74 -19
  40. package/dist/terminal-view.js +275 -0
  41. package/dist/turri-versions.js +64 -6
  42. package/docs/README.md +2 -2
  43. package/docs/chats.md +4 -4
  44. package/docs/claude-subscription.md +1 -1
  45. package/docs/config.md +5 -4
  46. package/docs/development.md +30 -64
  47. package/docs/headless.md +3 -1
  48. package/docs/hosting.md +3 -251
  49. package/docs/installation.md +4 -2
  50. package/docs/launch.md +1 -1
  51. package/docs/sentinel.md +3 -3
  52. package/docs/using.md +3 -3
  53. package/package.json +10 -28
  54. package/dist/ask.d.ts +0 -90
  55. package/dist/ask.js +0 -170
  56. package/dist/background-skills.d.ts +0 -56
  57. package/dist/background-skills.js +0 -129
  58. package/dist/bedrock-region.d.ts +0 -66
  59. package/dist/bedrock-region.js +0 -144
  60. package/dist/brand.d.ts +0 -13
  61. package/dist/btw.d.ts +0 -69
  62. package/dist/btw.js +0 -174
  63. package/dist/capture/agents.d.ts +0 -406
  64. package/dist/capture/agents.js +0 -379
  65. package/dist/capture/area.d.ts +0 -58
  66. package/dist/capture/area.js +0 -197
  67. package/dist/capture/assemble.d.ts +0 -112
  68. package/dist/capture/assemble.js +0 -453
  69. package/dist/capture/capture.d.ts +0 -116
  70. package/dist/capture/capture.js +0 -1315
  71. package/dist/capture/chat.d.ts +0 -29
  72. package/dist/capture/chat.js +0 -94
  73. package/dist/capture/checks.d.ts +0 -142
  74. package/dist/capture/checks.js +0 -649
  75. package/dist/capture/config.d.ts +0 -13
  76. package/dist/capture/config.js +0 -66
  77. package/dist/capture/interface.d.ts +0 -71
  78. package/dist/capture/interface.js +0 -199
  79. package/dist/capture/map.d.ts +0 -56
  80. package/dist/capture/map.js +0 -530
  81. package/dist/capture/models.d.ts +0 -4
  82. package/dist/capture/models.js +0 -16
  83. package/dist/capture/plan.d.ts +0 -7
  84. package/dist/capture/plan.js +0 -13
  85. package/dist/capture/progress.d.ts +0 -111
  86. package/dist/capture/progress.js +0 -266
  87. package/dist/capture/python-interface.d.ts +0 -3
  88. package/dist/capture/python-interface.js +0 -17
  89. package/dist/capture/report.d.ts +0 -75
  90. package/dist/capture/report.js +0 -268
  91. package/dist/capture/runners.d.ts +0 -6
  92. package/dist/capture/runners.js +0 -59
  93. package/dist/capture/scripts.d.ts +0 -26
  94. package/dist/capture/scripts.js +0 -38
  95. package/dist/capture/state.d.ts +0 -310
  96. package/dist/capture/state.js +0 -43
  97. package/dist/capture/trial.d.ts +0 -34
  98. package/dist/capture/trial.js +0 -89
  99. package/dist/capture-cli.d.ts +0 -1
  100. package/dist/chat-commands.d.ts +0 -17
  101. package/dist/chat-idle.d.ts +0 -7
  102. package/dist/chat-idle.js +0 -20
  103. package/dist/chat-models.d.ts +0 -22
  104. package/dist/chat-records.d.ts +0 -50
  105. package/dist/chat-records.js +0 -107
  106. package/dist/chat-scope.d.ts +0 -14
  107. package/dist/chat-scope.js +0 -15
  108. package/dist/chat-skills.d.ts +0 -17
  109. package/dist/chat-skills.js +0 -18
  110. package/dist/chat-tab-header.d.ts +0 -16
  111. package/dist/chat-tabs.d.ts +0 -26
  112. package/dist/chat-terminal.d.ts +0 -24
  113. package/dist/chat-ui.d.ts +0 -33
  114. package/dist/chat-waiting.d.ts +0 -67
  115. package/dist/chats.d.ts +0 -346
  116. package/dist/chats.js +0 -1022
  117. package/dist/cli-options.d.ts +0 -24
  118. package/dist/cli.d.ts +0 -9
  119. package/dist/config-edit.d.ts +0 -83
  120. package/dist/config-edit.js +0 -393
  121. package/dist/config.d.ts +0 -428
  122. package/dist/config.js +0 -816
  123. package/dist/conform-cli.d.ts +0 -1
  124. package/dist/conformance-switch.d.ts +0 -25
  125. package/dist/conformance-switch.js +0 -86
  126. package/dist/cultivate-cli.d.ts +0 -1
  127. package/dist/doctor-tool.d.ts +0 -11
  128. package/dist/doctor-tool.js +0 -33
  129. package/dist/drift-cli.d.ts +0 -1
  130. package/dist/environment.d.ts +0 -37
  131. package/dist/environment.js +0 -109
  132. package/dist/extension.d.ts +0 -209
  133. package/dist/genome.d.ts +0 -77
  134. package/dist/genome.js +0 -288
  135. package/dist/graph.d.ts +0 -52
  136. package/dist/graph.js +0 -247
  137. package/dist/host-session.d.ts +0 -112
  138. package/dist/host-session.js +0 -103
  139. package/dist/host.d.ts +0 -40
  140. package/dist/host.js +0 -54
  141. package/dist/identity.d.ts +0 -7
  142. package/dist/identity.js +0 -75
  143. package/dist/init-config.d.ts +0 -172
  144. package/dist/init-config.js +0 -867
  145. package/dist/installed-providers.d.ts +0 -40
  146. package/dist/installed-providers.js +0 -98
  147. package/dist/jellyfish.d.ts +0 -40
  148. package/dist/judge.d.ts +0 -25
  149. package/dist/judge.js +0 -62
  150. package/dist/launch-agent.d.ts +0 -62
  151. package/dist/launch-agent.js +0 -339
  152. package/dist/launch-cli.d.ts +0 -1
  153. package/dist/launch-session.d.ts +0 -68
  154. package/dist/launch-session.js +0 -225
  155. package/dist/launch-tools.d.ts +0 -28
  156. package/dist/launch-tools.js +0 -72
  157. package/dist/launch-track.d.ts +0 -175
  158. package/dist/launch-track.js +0 -497
  159. package/dist/lineage-cli.d.ts +0 -1
  160. package/dist/loop-cli.d.ts +0 -35
  161. package/dist/loop-tools.d.ts +0 -103
  162. package/dist/loop-tools.js +0 -361
  163. package/dist/model-check.d.ts +0 -72
  164. package/dist/model-check.js +0 -162
  165. package/dist/module-report.d.ts +0 -9
  166. package/dist/new-project.d.ts +0 -10
  167. package/dist/new-project.js +0 -42
  168. package/dist/notice.d.ts +0 -115
  169. package/dist/notice.js +0 -61
  170. package/dist/parse-cli.d.ts +0 -1
  171. package/dist/parse-tool.d.ts +0 -9
  172. package/dist/parse-tool.js +0 -33
  173. package/dist/pi-launch.d.ts +0 -1
  174. package/dist/pi-settings.d.ts +0 -4
  175. package/dist/pi-themes.d.ts +0 -3
  176. package/dist/pi.d.ts +0 -248
  177. package/dist/pi.js +0 -889
  178. package/dist/picture-row.d.ts +0 -10
  179. package/dist/plain/check.d.ts +0 -63
  180. package/dist/plain/check.js +0 -236
  181. package/dist/plain/concepts.d.ts +0 -37
  182. package/dist/plain/concepts.js +0 -283
  183. package/dist/plain/cycles.d.ts +0 -21
  184. package/dist/plain/cycles.js +0 -190
  185. package/dist/plain/errors.d.ts +0 -26
  186. package/dist/plain/errors.js +0 -50
  187. package/dist/plain/files.d.ts +0 -47
  188. package/dist/plain/files.js +0 -161
  189. package/dist/plain/graph.d.ts +0 -107
  190. package/dist/plain/graph.js +0 -194
  191. package/dist/plain/highlight.d.ts +0 -43
  192. package/dist/plain/highlight.js +0 -196
  193. package/dist/plain/index.d.ts +0 -18
  194. package/dist/plain/index.js +0 -18
  195. package/dist/plain/liquid.d.ts +0 -22
  196. package/dist/plain/liquid.js +0 -124
  197. package/dist/plain/markdown.d.ts +0 -103
  198. package/dist/plain/markdown.js +0 -330
  199. package/dist/plain/module-concepts.d.ts +0 -32
  200. package/dist/plain/module-concepts.js +0 -80
  201. package/dist/plain/parser.d.ts +0 -163
  202. package/dist/plain/parser.js +0 -930
  203. package/dist/plain/plain.tmLanguage.json +0 -150
  204. package/dist/plain/project.d.ts +0 -48
  205. package/dist/plain/project.js +0 -155
  206. package/dist/plain/spec.d.ts +0 -152
  207. package/dist/plain/spec.js +0 -265
  208. package/dist/plain/stdlib.d.ts +0 -16
  209. package/dist/plain/stdlib.js +0 -48
  210. package/dist/plain/test-plain-file.d.ts +0 -59
  211. package/dist/plain/test-plain-file.js +0 -232
  212. package/dist/plain-code-blocks.d.ts +0 -14
  213. package/dist/plain-files.d.ts +0 -21
  214. package/dist/plain-files.js +0 -156
  215. package/dist/pointer-hover.d.ts +0 -12
  216. package/dist/question-dialog.d.ts +0 -60
  217. package/dist/questioning.d.ts +0 -55
  218. package/dist/questioning.js +0 -109
  219. package/dist/quiet.d.ts +0 -34
  220. package/dist/regenerate/activity.d.ts +0 -227
  221. package/dist/regenerate/activity.js +0 -250
  222. package/dist/regenerate/agent-env.d.ts +0 -51
  223. package/dist/regenerate/agent-env.js +0 -315
  224. package/dist/regenerate/agent-shell.d.ts +0 -54
  225. package/dist/regenerate/agent-shell.js +0 -121
  226. package/dist/regenerate/arbiter.d.ts +0 -68
  227. package/dist/regenerate/arbiter.js +0 -133
  228. package/dist/regenerate/audit.d.ts +0 -69
  229. package/dist/regenerate/audit.js +0 -212
  230. package/dist/regenerate/base-folder.d.ts +0 -70
  231. package/dist/regenerate/base-folder.js +0 -186
  232. package/dist/regenerate/cases.d.ts +0 -12
  233. package/dist/regenerate/cases.js +0 -149
  234. package/dist/regenerate/change-view.d.ts +0 -23
  235. package/dist/regenerate/change-view.js +0 -153
  236. package/dist/regenerate/chunk-plan.d.ts +0 -217
  237. package/dist/regenerate/chunk-plan.js +0 -937
  238. package/dist/regenerate/codebase.d.ts +0 -21
  239. package/dist/regenerate/codebase.js +0 -75
  240. package/dist/regenerate/command-check.d.ts +0 -66
  241. package/dist/regenerate/command-check.js +0 -577
  242. package/dist/regenerate/compaction.d.ts +0 -13
  243. package/dist/regenerate/compaction.js +0 -20
  244. package/dist/regenerate/confine.d.ts +0 -69
  245. package/dist/regenerate/confine.js +0 -311
  246. package/dist/regenerate/conform.d.ts +0 -66
  247. package/dist/regenerate/conform.js +0 -132
  248. package/dist/regenerate/conformance-agents.d.ts +0 -388
  249. package/dist/regenerate/conformance-agents.js +0 -1162
  250. package/dist/regenerate/conformance.d.ts +0 -191
  251. package/dist/regenerate/conformance.js +0 -1035
  252. package/dist/regenerate/conversation-writes.d.ts +0 -10
  253. package/dist/regenerate/conversation-writes.js +0 -100
  254. package/dist/regenerate/credentials.d.ts +0 -18
  255. package/dist/regenerate/credentials.js +0 -88
  256. package/dist/regenerate/debug-log.d.ts +0 -56
  257. package/dist/regenerate/debug-log.js +0 -236
  258. package/dist/regenerate/debugger.d.ts +0 -36
  259. package/dist/regenerate/debugger.js +0 -133
  260. package/dist/regenerate/delivery.d.ts +0 -2
  261. package/dist/regenerate/diagnose-job.d.ts +0 -2
  262. package/dist/regenerate/diagnose-job.js +0 -40
  263. package/dist/regenerate/diagnose.d.ts +0 -46
  264. package/dist/regenerate/diagnose.js +0 -92
  265. package/dist/regenerate/diff-view.d.ts +0 -64
  266. package/dist/regenerate/drift.d.ts +0 -120
  267. package/dist/regenerate/drift.js +0 -285
  268. package/dist/regenerate/environment-error.d.ts +0 -167
  269. package/dist/regenerate/environment-error.js +0 -342
  270. package/dist/regenerate/failure-reports.d.ts +0 -28
  271. package/dist/regenerate/failure-reports.js +0 -79
  272. package/dist/regenerate/job-log.d.ts +0 -30
  273. package/dist/regenerate/job-log.js +0 -105
  274. package/dist/regenerate/job-panel.d.ts +0 -20
  275. package/dist/regenerate/job-panel.js +0 -54
  276. package/dist/regenerate/jobs-tree.d.ts +0 -76
  277. package/dist/regenerate/jobs.d.ts +0 -231
  278. package/dist/regenerate/jobs.js +0 -522
  279. package/dist/regenerate/lanes.d.ts +0 -16
  280. package/dist/regenerate/lanes.js +0 -32
  281. package/dist/regenerate/launch.d.ts +0 -256
  282. package/dist/regenerate/launch.js +0 -689
  283. package/dist/regenerate/ledger-view.d.ts +0 -87
  284. package/dist/regenerate/ledger-view.js +0 -325
  285. package/dist/regenerate/ledger.d.ts +0 -368
  286. package/dist/regenerate/ledger.js +0 -357
  287. package/dist/regenerate/lineage.d.ts +0 -105
  288. package/dist/regenerate/lineage.js +0 -485
  289. package/dist/regenerate/list-arguments.d.ts +0 -21
  290. package/dist/regenerate/list-arguments.js +0 -121
  291. package/dist/regenerate/loop.d.ts +0 -423
  292. package/dist/regenerate/loop.js +0 -2087
  293. package/dist/regenerate/masking.d.ts +0 -19
  294. package/dist/regenerate/masking.js +0 -95
  295. package/dist/regenerate/model-names.d.ts +0 -33
  296. package/dist/regenerate/model-names.js +0 -92
  297. package/dist/regenerate/notes.d.ts +0 -159
  298. package/dist/regenerate/notes.js +0 -446
  299. package/dist/regenerate/os-sandbox.d.ts +0 -93
  300. package/dist/regenerate/os-sandbox.js +0 -283
  301. package/dist/regenerate/panel-dock.d.ts +0 -23
  302. package/dist/regenerate/paths.d.ts +0 -110
  303. package/dist/regenerate/paths.js +0 -190
  304. package/dist/regenerate/plain-palette.d.ts +0 -34
  305. package/dist/regenerate/prompt.d.ts +0 -230
  306. package/dist/regenerate/prompt.js +0 -741
  307. package/dist/regenerate/pulse-files.d.ts +0 -14
  308. package/dist/regenerate/pulse-files.js +0 -63
  309. package/dist/regenerate/records.d.ts +0 -132
  310. package/dist/regenerate/records.js +0 -327
  311. package/dist/regenerate/regenerate.d.ts +0 -106
  312. package/dist/regenerate/regenerate.js +0 -660
  313. package/dist/regenerate/regression.d.ts +0 -58
  314. package/dist/regenerate/regression.js +0 -188
  315. package/dist/regenerate/renames.d.ts +0 -42
  316. package/dist/regenerate/renames.js +0 -185
  317. package/dist/regenerate/requires.d.ts +0 -117
  318. package/dist/regenerate/requires.js +0 -377
  319. package/dist/regenerate/resources.d.ts +0 -57
  320. package/dist/regenerate/resources.js +0 -162
  321. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  322. package/dist/regenerate/scripts-being-written.js +0 -30
  323. package/dist/regenerate/self-check.d.ts +0 -29
  324. package/dist/regenerate/self-check.js +0 -119
  325. package/dist/regenerate/services.d.ts +0 -28
  326. package/dist/regenerate/services.js +0 -158
  327. package/dist/regenerate/shell.d.ts +0 -91
  328. package/dist/regenerate/shell.js +0 -320
  329. package/dist/regenerate/side-panel.d.ts +0 -64
  330. package/dist/regenerate/spec-map-view.d.ts +0 -147
  331. package/dist/regenerate/spec-map.d.ts +0 -160
  332. package/dist/regenerate/spec-map.js +0 -596
  333. package/dist/regenerate/spec-steps.d.ts +0 -180
  334. package/dist/regenerate/spec-steps.js +0 -729
  335. package/dist/regenerate/standing.d.ts +0 -28
  336. package/dist/regenerate/standing.js +0 -30
  337. package/dist/regenerate/state.d.ts +0 -21
  338. package/dist/regenerate/state.js +0 -10
  339. package/dist/regenerate/steering.d.ts +0 -56
  340. package/dist/regenerate/steering.js +0 -119
  341. package/dist/regenerate/stop-report.d.ts +0 -43
  342. package/dist/regenerate/stop-report.js +0 -160
  343. package/dist/regenerate/submit-work.d.ts +0 -44
  344. package/dist/regenerate/submit-work.js +0 -76
  345. package/dist/regenerate/test-kinds.d.ts +0 -85
  346. package/dist/regenerate/test-kinds.js +0 -171
  347. package/dist/regenerate/test-scripts.d.ts +0 -240
  348. package/dist/regenerate/test-scripts.js +0 -847
  349. package/dist/regenerate/testing-steps.d.ts +0 -52
  350. package/dist/regenerate/testing-steps.js +0 -129
  351. package/dist/regenerate/testing.d.ts +0 -150
  352. package/dist/regenerate/testing.js +0 -438
  353. package/dist/regenerate/transcript-view.d.ts +0 -21
  354. package/dist/regenerate/unit-gate.d.ts +0 -27
  355. package/dist/regenerate/unit-gate.js +0 -20
  356. package/dist/regenerate/unit-review.d.ts +0 -152
  357. package/dist/regenerate/unit-review.js +0 -361
  358. package/dist/regenerate/web.d.ts +0 -61
  359. package/dist/regenerate/web.js +0 -256
  360. package/dist/regenerate/workspace.d.ts +0 -12
  361. package/dist/regenerate/workspace.js +0 -99
  362. package/dist/regenerate-cli.d.ts +0 -1
  363. package/dist/reopen.d.ts +0 -29
  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,867 +0,0 @@
1
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
- import { availableParallelism } from "node:os";
3
- import { basename, join, resolve } from "node:path";
4
- import { createInterface } from "node:readline/promises";
5
- import { load as loadYaml } from "js-yaml";
6
- import { adoptLegacyConfig, CONFIG_FILE, CONFIG_KEYS, LEGACY_CONFIG_FILE, ROLE_THINKING } from "./config.js";
7
- import { currentValue, withSetting, withTopLevelValue } from "./config-edit.js";
8
- import { brand } from "./brand.js";
9
- import { closestModels, piModelCatalogue } from "./model-check.js";
10
- import { EXTENSION_PROVIDERS } from "./installed-providers.js";
11
- import { captureDefaults } from "./capture/models.js";
12
- /** The geographies turri's own pair for each maker is served in - the first the default. Every other: bedrockMakers. */
13
- export const BEDROCK_REGIONS = {
14
- anthropic: ["global", "us", "eu", "jp", "au"],
15
- openai: ["global", "us"],
16
- };
17
- /** The geographies an inference profile's id starts with, in the order they are offered. */
18
- export const BEDROCK_GEOGRAPHIES = ["global", "us", "eu", "jp", "au", "apac", "in", "ca", "us-gov"];
19
- /** A Bedrock model whose id names no geography: served in the AWS region it is called in. */
20
- export const BEDROCK_IN_REGION = "in-region";
21
- /** An AWS region in each geography, for AWS_REGION: pi calls Bedrock there - us-east-1 when nothing names another. */
22
- const AWS_REGION_IN = {
23
- global: "us-east-1",
24
- us: "us-east-1",
25
- eu: "eu-central-1",
26
- jp: "ap-northeast-1",
27
- au: "ap-southeast-2",
28
- apac: "ap-southeast-1",
29
- in: "ap-south-1",
30
- ca: "ca-central-1",
31
- "us-gov": "us-gov-west-1",
32
- };
33
- /** The AWS region to call a geography's models in - AWS_REGION's value. */
34
- export function bedrockAwsRegion(geography) {
35
- return AWS_REGION_IN[geography] ?? "us-east-1";
36
- }
37
- /**
38
- * Whether a geography's models need AWS_REGION set: every one but global, us and in-region, which pi's us-east-1 serves.
39
- * pi calls Bedrock in AWS_REGION, else - with an AWS_PROFILE - the profile's region, else us-east-1. It pins eu's
40
- * endpoint itself only with neither AWS_REGION nor AWS_PROFILE set, so eu needs it too.
41
- */
42
- export function bedrockNeedsAwsRegion(geography) {
43
- return !["global", "us", BEDROCK_IN_REGION].includes(geography);
44
- }
45
- /** Where a Bedrock model is served and whose it is, from its id or spec: `global.xai.grok-4.7` - global, xai; `meta.llama4` - in-region, meta. */
46
- export function bedrockPlaceOf(model) {
47
- const [first = "", second = ""] = model.replace(/^amazon-bedrock\//, "").split(".");
48
- return BEDROCK_GEOGRAPHIES.includes(first) ? { geography: first, maker: second } : { geography: BEDROCK_IN_REGION, maker: first };
49
- }
50
- /** A maker's name, as the messages and questions say it. */
51
- const MAKER_LABELS = {
52
- anthropic: "Anthropic",
53
- openai: "OpenAI",
54
- google: "Google",
55
- xai: "xAI",
56
- meta: "Meta",
57
- mistral: "Mistral",
58
- qwen: "Qwen",
59
- deepseek: "DeepSeek",
60
- amazon: "Amazon",
61
- moonshot: "Moonshot",
62
- moonshotai: "Moonshot AI",
63
- zai: "Z.ai",
64
- minimax: "MiniMax",
65
- nvidia: "NVIDIA",
66
- writer: "Writer",
67
- };
68
- /** A maker's - or a provider's - name, as the messages say it: xAI for xai; its id when turri has no name for it. */
69
- export function makerLabel(maker) {
70
- return MAKER_LABELS[maker] ?? maker;
71
- }
72
- /** Bedrock's chat models in pi's catalogue. */
73
- const bedrockChat = (catalogue) => catalogue.models("amazon-bedrock").filter((model) => model.type === "chat");
74
- /** Every maker pi's catalogue serves on Bedrock - Anthropic and OpenAI first, the rest by name - with their geographies. */
75
- export function bedrockMakers(catalogue) {
76
- const regions = new Map();
77
- for (const model of bedrockChat(catalogue)) {
78
- const { geography, maker } = bedrockPlaceOf(model.id);
79
- if (maker === "")
80
- continue;
81
- regions.set(maker, (regions.get(maker) ?? new Set()).add(geography));
82
- }
83
- const order = [...BEDROCK_GEOGRAPHIES, BEDROCK_IN_REGION];
84
- const first = (maker) => (maker === "anthropic" ? 0 : maker === "openai" ? 1 : 2);
85
- return [...regions]
86
- .map(([maker, served]) => ({ maker, label: makerLabel(maker), regions: order.filter((region) => served.has(region)) }))
87
- .sort((a, b) => first(a.maker) - first(b.maker) || a.label.localeCompare(b.label));
88
- }
89
- /** A maker's chat models in a geography, as pi's catalogue has them on Bedrock. */
90
- export function bedrockModelsIn(catalogue, choice) {
91
- return bedrockChat(catalogue).filter((model) => {
92
- const place = bedrockPlaceOf(model.id);
93
- return place.maker === choice.maker && place.geography === choice.region;
94
- });
95
- }
96
- /** Whether turri's own pair for the maker is served in the geography. */
97
- function hasPreset(choice) {
98
- const maker = choice.maker ?? BEDROCK_DEFAULT.maker;
99
- return (maker === "anthropic" || maker === "openai") && BEDROCK_REGIONS[maker].includes(choice.region);
100
- }
101
- /** turri's own pair on Bedrock for a maker in a geography: Opus 5.5 and Haiku 5.5, or GPT-6 Astra and Luna. */
102
- export function bedrockModels(choice) {
103
- const at = (id) => `amazon-bedrock/${choice.region}.${id}`;
104
- return (choice.maker ?? "anthropic") === "anthropic"
105
- ? { harness: at("anthropic.claude-opus-5-5"), coding: at("anthropic.claude-haiku-5-5"), strong: at("anthropic.claude-opus-5-5") }
106
- : { harness: at("openai.gpt-6-astra"), coding: at("openai.gpt-6-luna"), strong: at("openai.gpt-6.1-sol") };
107
- }
108
- /**
109
- * The pair to offer for a maker in a geography: turri's own where it has one; else, from pi's catalogue, the strongest
110
- * that reasons to talk to - price standing in for strength - and the cheapest costing at least a fifth of it to code,
111
- * ties to the newest. Undefined when the catalogue has none of the maker's models there.
112
- */
113
- export function bedrockDefaultModels(catalogue, choice) {
114
- if (hasPreset(choice))
115
- return bedrockModels(choice);
116
- const models = bedrockModelsIn(catalogue, { maker: choice.maker ?? BEDROCK_DEFAULT.maker, region: choice.region });
117
- if (models.length === 0)
118
- return undefined;
119
- const price = (model) => model.cost.input + model.cost.output;
120
- const newest = (a, b) => b.id.localeCompare(a.id, undefined, { numeric: true });
121
- const reasoning = models.some((model) => model.reasoning) ? models.filter((model) => model.reasoning) : models;
122
- const talk = [...reasoning].sort((a, b) => price(b) - price(a) || newest(a, b))[0];
123
- const code = models.filter((model) => price(model) >= price(talk) / 5).sort((a, b) => price(a) - price(b) || newest(a, b))[0];
124
- const spec = (model) => `amazon-bedrock/${model.id}`;
125
- return { harness: spec(talk), coding: spec(code), strong: spec(talk) };
126
- }
127
- /** Bedrock's default: Anthropic's models, anywhere. */
128
- export const BEDROCK_DEFAULT = { maker: "anthropic", region: "global" };
129
- export const VENDORS = {
130
- anthropic: {
131
- label: "Anthropic",
132
- harness: "anthropic/claude-opus-5-5",
133
- coding: "anthropic/claude-haiku-5-5",
134
- strong: "anthropic/claude-sonnet-5-5",
135
- keys: [{ vendor: "Anthropic", variable: "ANTHROPIC_API_KEY" }],
136
- },
137
- openai: {
138
- label: "OpenAI",
139
- harness: "openai/gpt-6-astra",
140
- coding: "openai/gpt-6-luna",
141
- strong: "openai/gpt-6.1-sol",
142
- keys: [{ vendor: "OpenAI", variable: "OPENAI_API_KEY" }],
143
- },
144
- google: {
145
- label: "Google",
146
- harness: "google/gemini-3.1-pro-preview",
147
- coding: "google/gemini-3.1-flash-lite",
148
- strong: "google/gemini-3.1-pro-preview",
149
- keys: [{ vendor: "Google", variable: "GEMINI_API_KEY" }],
150
- },
151
- // Any maker's models on AWS - whose, where and which, is asked: this is the default, Anthropic's anywhere.
152
- "amazon-bedrock": {
153
- label: "Amazon Bedrock",
154
- ...bedrockModels({ maker: "anthropic", region: BEDROCK_DEFAULT.region }),
155
- keys: [{ vendor: "AWS", variable: "AWS_PROFILE" }],
156
- },
157
- // A Claude Pro or Max subscription, through Claude Code: its pi extension's provider (installed-providers.ts), no key.
158
- "claude-code": {
159
- label: "Claude subscription",
160
- harness: "claude-code/claude-opus-5-5",
161
- coding: "claude-code/claude-sonnet-5",
162
- strong: "claude-code/claude-opus-5-5",
163
- keys: [],
164
- },
165
- // A mix - the strongest to talk to, a cheap one to code - and the starting point for any other provider pi supports.
166
- other: {
167
- label: "Other",
168
- harness: "anthropic/claude-opus-5-5",
169
- coding: "google/gemini-3.1-flash-lite",
170
- strong: "google/gemini-3.1-pro-preview",
171
- keys: [
172
- { vendor: "Anthropic", variable: "ANTHROPIC_API_KEY" },
173
- { vendor: "Google", variable: "GEMINI_API_KEY" },
174
- ],
175
- },
176
- };
177
- /** A config line's text, padded to where its comment starts - at least one space before it. */
178
- const column = (text, width) => (text.length >= width ? `${text} ` : text.padEnd(width));
179
- /** How hard the model you talk to thinks, as written: the conversation, the planner and the rest of its side. */
180
- const HARNESS_THINKING = "medium";
181
- /** A role's commented-out entry: its model, and the thinking it has unless one is named - as turri runs it unset. */
182
- function role(name, model, comment) {
183
- const fields = [...(model !== undefined ? [`model: ${model}`] : []), `thinking: ${ROLE_THINKING[name]}`].join(", ");
184
- return `${column(`# ${name}: { ${fields} }`, 72)}# ${comment}`;
185
- }
186
- /** A vendor's three models - for Bedrock, turri's own pair for the maker and geography chosen. */
187
- function modelsOf(vendor, bedrock) {
188
- if (vendor !== "amazon-bedrock")
189
- return VENDORS[vendor];
190
- const choice = bedrock ?? BEDROCK_DEFAULT;
191
- if (!hasPreset(choice))
192
- throw new Error(`turri has no pair of its own for ${choice.maker ?? BEDROCK_DEFAULT.maker}'s models on Bedrock (${choice.region}): name the two models`);
193
- return bedrockModels(choice);
194
- }
195
- /** The two model lines: the one you talk to thinking medium, the coding one low - their comments in one column. */
196
- function modelLines(harness, coding) {
197
- const width = Math.max(46, `harness-model: ${harness}:${HARNESS_THINKING}`.length + 2, `coding-model: ${coding}:${ROLE_THINKING.coding}`.length + 2);
198
- return [
199
- `${column(`harness-model: ${harness}:${HARNESS_THINKING}`, width)}# you talk to it: it writes the specs and plans the work`,
200
- `${column(`coding-model: ${coding}:${ROLE_THINKING.coding}`, width)}# it writes the code`,
201
- ];
202
- }
203
- /**
204
- * A config.turri.yaml with its two models set to these lines, and nothing else changed: each key's line - and the lines
205
- * indented under it, when it is written as a block - replaced where it is, or put at the top when it is not there.
206
- */
207
- export function withModels(text, lines) {
208
- let out = text.split("\n");
209
- const missing = [];
210
- for (const [key, line] of [["harness-model", lines[0]], ["coding-model", lines[1]]]) {
211
- const at = out.findIndex((entry) => entry.startsWith(`${key}:`));
212
- if (at === -1) {
213
- missing.push(line);
214
- continue;
215
- }
216
- let end = at + 1;
217
- while (end < out.length && /^\s+\S/.test(out[end]))
218
- end += 1;
219
- out = [...out.slice(0, at), line, ...out.slice(end)];
220
- }
221
- return [...missing, ...out].join("\n");
222
- }
223
- /**
224
- * What turri does with each setting the config leaves out, written into the quick start config so it says so. They
225
- * must stay what the code falls back to - tests/init-config.test.ts holds them to the constants they mirror.
226
- */
227
- export const DEFAULTS = {
228
- review: false,
229
- mutationTesting: true,
230
- allowToStopJobs: true,
231
- launchAfterPulse: true,
232
- sentinel: "ask",
233
- testingScriptsRunOn: "in-place",
234
- turnLimit: 120,
235
- compactAt: 100000,
236
- maxSpecsPerPulse: 3,
237
- maxLinesPerPulse: 120,
238
- ledgerKeep: 100,
239
- debug: false,
240
- cacheKeep: 4096,
241
- };
242
- /** How many pulses run at once without a setting: half this machine's cores, one to four - as regenerate/jobs.ts has it. */
243
- export function defaultParallel(cores = availableParallelism()) {
244
- return Math.min(4, Math.max(1, Math.floor(cores / 2)));
245
- }
246
- /** The quick start config.turri.yaml for a vendor's models - for Bedrock, the maker and geography chosen - or the models given. */
247
- export function quickStartConfig(vendor = "other", bedrock, models) {
248
- const { harness, coding, strong } = models ?? modelsOf(vendor, bedrock);
249
- return [
250
- "# Any model pi supports works (https://pi.dev): a capable one to talk to, a smaller, cheaper one for the coding.",
251
- ...modelLines(harness, coding),
252
- "# The :level is how hard each thinks - off, minimal, low, medium, high, xhigh or max. The reviews and judges run on the",
253
- "# coding model but think medium, as models: below shows.",
254
- "",
255
- "# Every other setting is written out below with the value turri uses for it, so the file says how the project is",
256
- "# built: change one to change it. The optional ones, which have no value of their own, are commented out - uncomment",
257
- "# one to use it. docs/config.md has them all.",
258
- "",
259
- "# Whether functional specs are conformance tested: black-box tests of the built software against the scenarios of",
260
- "# their test plain files, run with the whole suite as more lands. They make each change take about twice as long.",
261
- "# false: none - no scenarios written or tested. /conform in the chat turns them on, or true here.",
262
- "conformance-tests: false",
263
- "",
264
- "# Whether the code and its tests are reviewed once they pass - two reviews at most, the second weighed by the arbiter.",
265
- `review: ${DEFAULTS.review}`,
266
- "",
267
- "# Whether the coding agent and the reviewer can put a bug in the code for one run of the unit tests (can_it_fail),",
268
- "# to see that a test catches it - on a copy of the code, or in place and put back after.",
269
- `mutation-testing: ${DEFAULTS.mutationTesting}`,
270
- "",
271
- "# Whether turri stops a running pulse the spec has moved on from. false: it lands, the change regenerated on top.",
272
- `allow-to-stop-jobs: ${DEFAULTS.allowToStopJobs}`,
273
- "",
274
- "# Whether every pulse that lands code is launched, in the background, as the project's launch guidance says.",
275
- `launch-after-pulse: ${DEFAULTS.launchAfterPulse}`,
276
- "",
277
- "# Whether a chat of its own, the sentinel, checks every pulse that finishes - and, with launch-after-pulse, tests what",
278
- "# was launched - and tells you in the chat you are in when something needs you. ask: you are asked, with what it does,",
279
- "# before it first opens in a session; true: it opens without asking; false: none.",
280
- `sentinel: ${DEFAULTS.sentinel}`,
281
- "",
282
- "# What the testing scripts run on: in-place - the code itself; copy - a fresh copy of it.",
283
- `testing-scripts-run-on: ${DEFAULTS.testingScriptsRunOn}`,
284
- "",
285
- "# Seconds each agent turn has, for every role without its own; 0 for none.",
286
- `turn-limit: ${DEFAULTS.turnLimit}`,
287
- "",
288
- "# How many pulses run at once, on modules that share nothing - half this machine's cores, one to four.",
289
- `parallel-jobs: ${defaultParallel()}`,
290
- "",
291
- "# Tokens of work an agent holds before it is compacted between turns; at least 1000.",
292
- `compact-at: ${DEFAULTS.compactAt}`,
293
- "",
294
- "# How big a pulse may be: the most functional specs the planner groups into one, and the most lines of spec - its",
295
- "# functional specs with the definitions they bring - before a group is split again.",
296
- `max-specs-per-pulse: ${DEFAULTS.maxSpecsPerPulse}`,
297
- `max-lines-per-pulse: ${DEFAULTS.maxLinesPerPulse}`,
298
- "",
299
- "# Rules left out of the spec-writing agents' prompts - the files of genome/rules/, without .md. The integration rules",
300
- "# are left out to start with: take one out of this list when this project writes an integration against a REST API.",
301
- "rules-off: [integration-embedded, integration-embedded-testing, integration-standalone]",
302
- "",
303
- "# Credentials the agents' commands need while they work: dotenv files by path, and variables from turri's",
304
- "# environment by name - files: [.env], vars: [MY_SERVICE_API_KEY]. Their values are masked in everything an agent is shown.",
305
- "agent-env:",
306
- " files: []",
307
- " vars: []",
308
- "",
309
- "# Folders of this machine an agent's commands may read beside the usual ones - a toolchain somewhere unusual: [/srv/zig].",
310
- "toolchains: []",
311
- "",
312
- "# Megabytes of the ledger - what turri did, as facts, in .turri/ledger, never committed - the project keeps; past it,",
313
- "# the oldest runs' are pruned. 0 keeps none.",
314
- `ledger-keep: ${DEFAULTS.ledgerKeep}`,
315
- "",
316
- "# Megabytes of package caches - npm's, pip's, Maven's... in plain_modules/.turri/cache - the project keeps; past it,",
317
- "# the least recently written are removed. 0 keeps none.",
318
- `cache-keep: ${DEFAULTS.cacheKeep}`,
319
- "",
320
- "# Whether turri keeps what it writes for debugging it: every agent's whole log and session, each pulse's log, the",
321
- "# test runs' outputs, the agents' temporary files. Off, only what turri reads to work is kept. TURRI_DEBUG=1 for one run.",
322
- `debug: ${DEFAULTS.debug}`,
323
- "",
324
- "# The testing scripts, by path from the project root - written here by the skill that writes them. One not named is",
325
- "# looked for at the root, then in test_scripts/. Each runs the static checks of what it tests - the formatter, the",
326
- "# linter, the type checker - with the tests, exiting 80 when the tests pass and only the checks do not. The prepare",
327
- "# script, optional, runs on the build before every conformance testing script run.",
328
- "# unittests-script: test_scripts/run_unittests_python.sh",
329
- "# conformance-tests-script: test_scripts/run_conformance_tests_python.sh",
330
- "# prepare-environment-script: test_scripts/prepare_environment_python.sh",
331
- "",
332
- "# Optional: the .plain file turri regenerate builds when none is named.",
333
- "# module: app.plain",
334
- "",
335
- "# Optional: the folder of the test plain files - a functional spec's conformance and acceptance scenarios - a folder",
336
- "# per module in it: tests/<module>/<func-id>.plain. Without it, tests.",
337
- "# test-dir: tests",
338
- "",
339
- "# Optional: a folder the code starts from - an existing codebase to build on, or files to use, such as images. It is",
340
- "# copied in once, before the first pulse, and never written to; the ***plain can refer to it, and link into it.",
341
- "# base-folder: existing-app",
342
- "",
343
- "# Optional: the judge and test review of a conformance run, when not on coding-model. A model is provider/id,",
344
- "# provider/id:thinking, or { model, thinking } - thinking is off, minimal, low, medium, high, xhigh or max.",
345
- `# judge-model: ${strong}:high`,
346
- "",
347
- "# Optional: each agent role's own model, thinking and turn limit. Without it, every role runs on coding-model and the",
348
- "# conversation's side on harness-model, each thinking as written here. What an entry leaves out it takes from default.",
349
- "# Capture uses three tiers: gather facts, analyse evidence, then reason and write.",
350
- "models:",
351
- ...Object.entries(captureDefaults(harness, coding)).map(([name, choice]) => ` ${name}: ${choice.model}:${choice.thinking}`),
352
- `# default: ${coding}`,
353
- `${column(`# chat: ${harness}`, 72)}# the conversation - as harness-model, which it wins over`,
354
- `${column(`# sentinel: ${harness}`, 72)}# the sentinel: checks every finished pulse and tests what is launched`,
355
- role("planner", harness, "cuts the work into pulses"),
356
- role("diagnosis", harness, "looks into a pulse that failed for good"),
357
- role("launch", coding, "the launch agent: turri launch's, the chat's and launch-after-pulse's"),
358
- `${column(`# coding: { model: ${coding}, thinking: ${ROLE_THINKING.coding}, turn-limit: 180 }`, 72)}# as coding-model, which it wins over`,
359
- role("conformance", coding, "writes the conformance tests"),
360
- role("explorer", coding, "explores the code for a conformance run"),
361
- role("reviewer", undefined, "reviews the code and its unit tests"),
362
- role("test-reviewer", strong, "reviews the conformance tests"),
363
- role("judge", strong, "judges a failing conformance run - as judge-model, which it wins over"),
364
- role("arbiter", strong, "weighs a second review"),
365
- role("debugger", strong, "a fresh look at unit tests that keep failing the same way"),
366
- "",
367
- ].join("\n");
368
- }
369
- /** The quick start config for the mix of vendors: what turri wrote before it asked. */
370
- export const QUICK_START_CONFIG = quickStartConfig("other");
371
- /** A capture without a config starts with init-config's settings. Resolve an omitted model from the vendor's pair,
372
- * including the maker and geography on Bedrock, just as the wizard does. */
373
- export async function quickStartForCapture(harness, coding) {
374
- if (harness && coding)
375
- return quickStartConfig("other", undefined, { harness, coding, strong: harness });
376
- const spec = harness ?? coding;
377
- const provider = spec?.split("/")[0] ?? (process.env.AWS_BEARER_TOKEN_BEDROCK || process.env.AWS_PROFILE || process.env.CLAUDE_CODE_USE_BEDROCK === "1" ? "amazon-bedrock" : "other");
378
- // A custom provider has no default pair. Stay on its named model rather than switching providers.
379
- if (!Object.hasOwn(VENDORS, provider) && spec)
380
- return quickStartConfig("other", undefined, { harness: spec, coding: spec, strong: spec });
381
- const vendor = provider;
382
- const place = vendor === "amazon-bedrock" && spec ? bedrockPlaceOf(spec) : undefined;
383
- const chosen = await chosenModels({ vendor, ...(place ? { bedrock: { maker: place.maker, region: place.geography } } : {}) });
384
- if ("problem" in chosen)
385
- throw new Error(chosen.problem);
386
- const models = chosen.models;
387
- return quickStartConfig(vendor, chosen.bedrock, { ...models, harness: harness ?? models.harness, coding: coding ?? models.coding });
388
- }
389
- /** A vendor from what was typed: its number in the list, or its name. */
390
- export function vendorOf(answer) {
391
- const typed = answer.trim().toLowerCase();
392
- const names = Object.keys(VENDORS);
393
- const byNumber = /^\d+$/.test(typed) ? names[Number(typed) - 1] : undefined;
394
- if (typed === "bedrock" || typed === "aws")
395
- return "amazon-bedrock";
396
- if (typed === "claude" || typed === "subscription" || typed === "claude code")
397
- return "claude-code";
398
- return byNumber ?? names.find((name) => name === typed || VENDORS[name].label.toLowerCase() === typed);
399
- }
400
- /** The makers offered, as numbered: pi's catalogue's, or without it turri's two. */
401
- function makersOffered(catalogue) {
402
- return catalogue !== undefined
403
- ? bedrockMakers(catalogue)
404
- : Object.keys(BEDROCK_REGIONS).map((maker) => ({ maker, label: makerLabel(maker), regions: BEDROCK_REGIONS[maker] }));
405
- }
406
- /** Bedrock's maker from what was typed: its number in the list - with no catalogue, 1 Anthropic, 2 OpenAI - or its name. */
407
- export function bedrockMakerOf(answer, catalogue) {
408
- const typed = answer.trim().toLowerCase();
409
- const offered = makersOffered(catalogue);
410
- const byNumber = /^\d+$/.test(typed) ? offered[Number(typed) - 1] : undefined;
411
- return (byNumber ?? offered.find((offer) => offer.maker === typed || offer.label.toLowerCase() === typed))?.maker;
412
- }
413
- /** A geography the maker's models are served in, from what was typed: its number in the list, or its name - pi's catalogue's, or without it turri's pair's. */
414
- export function bedrockRegionOf(maker, answer, catalogue) {
415
- const typed = answer.trim().toLowerCase();
416
- const regions = makersOffered(catalogue).find((offer) => offer.maker === maker)?.regions ?? [];
417
- return (/^\d+$/.test(typed) ? regions[Number(typed) - 1] : undefined) ?? regions.find((region) => region === typed);
418
- }
419
- /** The shell profile an exported key is kept in, for the shell this person uses. */
420
- function shellProfile() {
421
- const shell = basename(process.env.SHELL ?? "");
422
- if (shell === "zsh")
423
- return "~/.zshrc";
424
- if (shell === "fish")
425
- return "~/.config/fish/config.fish";
426
- return "~/.bashrc";
427
- }
428
- /** How to sign in to the vendor's models, as pi takes them: a key in the environment, or /login - a few lines. */
429
- function signInText(vendor, bedrock, models) {
430
- // Models given on another vendor's terms - other's, a provider of their own: the keys of the providers they name.
431
- const providers = models !== undefined && vendor === "other" ? [...new Set([models.harness, models.coding].map((model) => model.split("/")[0]))] : [];
432
- // A provider a pi extension brings - a Claude subscription through Claude Code: no key, its extension and its own sign-in.
433
- const extensions = (vendor === "other" ? providers : [vendor]).flatMap((provider) => (EXTENSION_PROVIDERS[provider] !== undefined ? [EXTENSION_PROVIDERS[provider]] : []));
434
- if (extensions.length > 0 && (vendor !== "other" || extensions.length === providers.length)) {
435
- return extensions.flatMap((extension) => [
436
- brand.bold(`Set up ${extension.label}`),
437
- ` ${brand.accent(extension.install)} ${brand.muted("its pi extension: turri finds what pi has installed")}`,
438
- ` ${brand.muted(extension.signIn)}`,
439
- ]);
440
- }
441
- const keys = providers.length > 0
442
- ? providers.flatMap((provider) => (provider in VENDORS && provider !== "other" && provider !== "amazon-bedrock" ? VENDORS[provider].keys : [{ vendor: makerLabel(provider), variable: "" }]))
443
- : VENDORS[vendor].keys;
444
- const windows = process.platform === "win32";
445
- const set = (variable, value = "...") => brand.accent(windows ? `setx ${variable} "${value}"` : `export ${variable}=${value}`);
446
- // Bedrock's are several; a vendor's own key is one, or the mix's two.
447
- const several = vendor === "amazon-bedrock" || keys.length > 1;
448
- const keep = windows
449
- ? `setx keeps ${several ? "them" : "it"} for new terminals - open one before you run turri.`
450
- : `Add ${several ? "them" : "it"} to ${shellProfile()} to keep ${several ? "them" : "it"}.`;
451
- if (vendor === "amazon-bedrock") {
452
- const geography = (bedrock ?? BEDROCK_DEFAULT).region;
453
- const region = bedrockAwsRegion(geography);
454
- return [
455
- brand.bold("Sign in to AWS"),
456
- ` ${set("AWS_PROFILE")} ${brand.muted("your profile (aws configure, or aws sso login)")}`,
457
- ` ${brand.muted("or, instead of a profile, a Bedrock API key:")} ${set("AWS_BEARER_TOKEN_BEDROCK")}`,
458
- "",
459
- brand.muted(keep),
460
- // The region is turri's to set (bedrock-region.ts): said, not asked for.
461
- ...(bedrockNeedsAwsRegion(geography)
462
- ? [brand.muted(`turri calls ${geography}'s models in ${region}. AWS_REGION, set, overrides it - and so does your AWS profile's region, when it is in ${geography}.`)]
463
- : []),
464
- brand.muted("Your AWS account needs access to the models: Bedrock console, model access."),
465
- ];
466
- }
467
- return [
468
- brand.bold(`Sign in to ${keys.map((key) => key.vendor).join(" and ")}`),
469
- ...keys.map((key) => (key.variable !== "" ? ` ${set(key.variable)}` : ` ${brand.muted(`the key pi reads for ${key.vendor} - https://pi.dev`)}`)),
470
- "",
471
- brand.muted(`${keep} Or start turri and type /login.`),
472
- ...(vendor === "other" && models === undefined ? [brand.muted("Another provider: change the two models to any pi supports, and set its key - https://pi.dev.")] : []),
473
- ];
474
- }
475
- /** Names joined as a sentence says them: "a", "a and b", "a, b and c". */
476
- const and = (names) => (names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`);
477
- /**
478
- * Whose models these are, in the message - from the models written: "OpenAI's models", "a mix of models", "xAI's models
479
- * on Amazon Bedrock (global)", "Anthropic's and OpenAI's models" for a pair of two providers given.
480
- */
481
- function whose(vendor, models, given) {
482
- const pair = [models.harness, models.coding];
483
- if (vendor === "amazon-bedrock") {
484
- const places = pair.map(bedrockPlaceOf);
485
- const makers = [...new Set(places.map((place) => `${makerLabel(place.maker)}'s`))];
486
- return `${and(makers)} models on Amazon Bedrock (${[...new Set(places.map((place) => place.geography))].join(", ")})`;
487
- }
488
- if (vendor === "claude-code")
489
- return "your Claude subscription's models, through Claude Code";
490
- if (vendor !== "other")
491
- return `${VENDORS[vendor].label}'s models`;
492
- if (!given)
493
- return "a mix of models";
494
- return `${and([...new Set(pair.map((model) => `${makerLabel(model.split("/")[0])}'s`))])} models`;
495
- }
496
- /** The thinking levels a spec may end with - not part of a model given to init-config. */
497
- const THINKING = /:(off|minimal|low|medium|high|xhigh|max)$/;
498
- /** Why a model given cannot be written - or undefined when pi's catalogue has it as a chat model. */
499
- function notInCatalogue(spec, catalogue) {
500
- const slash = spec.indexOf("/");
501
- if (slash <= 0)
502
- return `${spec} is not provider/model-id - amazon-bedrock/global.xai.grok-4.7, say.`;
503
- const [provider, id] = [spec.slice(0, slash), spec.slice(slash + 1)];
504
- const known = catalogue.models(provider);
505
- const model = known.find((entry) => entry.id === id);
506
- if (model === undefined) {
507
- if (THINKING.test(id) && known.some((entry) => entry.id === id.replace(THINKING, "")))
508
- return `${spec} names a thinking level: give the model alone, ${spec.replace(THINKING, "")} - turri writes how hard each thinks.`;
509
- if (known.length === 0) {
510
- const extension = EXTENSION_PROVIDERS[provider];
511
- return extension !== undefined
512
- ? `${spec} is not in pi's model catalogue: ${provider} - ${extension.label} - comes with a pi extension that is not installed: ${extension.install}`
513
- : `${spec} is not in pi's model catalogue: pi knows no provider ${provider}.`;
514
- }
515
- const close = closestModels(id, known.filter((entry) => entry.type === "chat").map((entry) => entry.id));
516
- return `${spec} is not in pi's model catalogue${close.length > 0 ? ` - did you mean ${close.map((other) => `${provider}/${other}`).join(", ")}?` : "."}`;
517
- }
518
- if (model.type !== "chat")
519
- return `${spec} is pi's ${model.type} model, not a chat model: turri's agents need one to talk to.`;
520
- return undefined;
521
- }
522
- /** Whose models a vendor's are: the provider its specs start with. */
523
- const providerOf = (vendor) => (vendor === "other" ? undefined : vendor);
524
- /**
525
- * The models to write, and the vendor and Bedrock choice they are written for - or what is wrong with what was given:
526
- * models given, checked against pi's catalogue; a Bedrock maker or geography turri has no pair of its own for, the
527
- * catalogue's default pair; otherwise the vendor's own, as before, no catalogue read.
528
- */
529
- async function chosenModels(options) {
530
- const catalogue = async () => options.catalogue ?? (await piModelCatalogue());
531
- if (options.models !== undefined) {
532
- const { harness, coding } = options.models;
533
- const models = { harness, coding, strong: options.models.strong ?? harness };
534
- const known = await catalogue();
535
- const problems = [...new Set([models.harness, models.coding, models.strong])].map((spec) => notInCatalogue(spec, known)).filter((problem) => problem !== undefined);
536
- if (problems.length > 0)
537
- return { problem: problems.join("\n") };
538
- const providers = [...new Set(Object.values(models).map((spec) => spec.split("/")[0]))];
539
- const vendor = options.vendor ?? (providers.length === 1 && providers[0] in VENDORS ? providers[0] : "other");
540
- const wrong = [...new Set(Object.values(models))].filter((spec) => providerOf(vendor) !== undefined && spec.split("/")[0] !== providerOf(vendor));
541
- if (wrong.length > 0)
542
- return { problem: `${wrong.join(", ")} ${wrong.length === 1 ? "is not" : "are not"} ${VENDORS[vendor].label}'s: with vendor ${vendor}, every model is ${vendor}/... - or leave the vendor out.` };
543
- if (vendor !== "amazon-bedrock")
544
- return { vendor, models, given: true };
545
- const places = [models.harness, models.coding].map(bedrockPlaceOf);
546
- const region = options.bedrock?.region ?? places[0].geography;
547
- if (!places.some((place) => place.geography === region))
548
- return { problem: `Neither model is served in ${region} on Bedrock: ${models.harness} and ${models.coding} are ${and([...new Set(places.map((place) => place.geography))])}'s.` };
549
- const maker = options.bedrock?.maker ?? places[0].maker;
550
- if (!places.some((place) => place.maker === maker))
551
- return { problem: `Neither model is ${makerLabel(maker)}'s: ${models.harness} and ${models.coding}.` };
552
- return { vendor, bedrock: { maker, region }, models, given: true };
553
- }
554
- const vendor = options.vendor ?? "other";
555
- if (vendor !== "amazon-bedrock")
556
- return { vendor, models: modelsOf(vendor), given: false };
557
- const bedrock = { maker: options.bedrock?.maker ?? BEDROCK_DEFAULT.maker, region: options.bedrock?.region ?? BEDROCK_DEFAULT.region };
558
- if (hasPreset(bedrock))
559
- return { vendor, bedrock, models: bedrockModels(bedrock), given: false };
560
- const known = await catalogue();
561
- const offer = bedrockMakers(known).find((entry) => entry.maker === bedrock.maker);
562
- if (offer === undefined)
563
- return { problem: `pi's catalogue has no models of ${makerLabel(bedrock.maker)}'s on Amazon Bedrock.` };
564
- const models = bedrockDefaultModels(known, bedrock);
565
- if (models === undefined)
566
- return { problem: `Amazon Bedrock serves ${offer.label}'s models in ${and(offer.regions)}, not ${bedrock.region}.` };
567
- return { vendor, bedrock, models, given: false };
568
- }
569
- /**
570
- * What a config.yaml in `folder` says that turri reads too - another tool's testing scripts, say - by turri's names
571
- * (`template_dir` read as `template-dir`), in the file's order; and the keys it leaves, turri reading none of them. The
572
- * two models are the vendor's, so they are not taken.
573
- */
574
- export function sharedWithLegacy(folder) {
575
- const path = join(folder, LEGACY_CONFIG_FILE);
576
- if (!existsSync(path))
577
- return { carried: [], left: [] };
578
- let raw;
579
- try {
580
- raw = loadYaml(readFileSync(path, "utf8"));
581
- }
582
- catch {
583
- return { carried: [], left: [] };
584
- }
585
- if (raw === null || typeof raw !== "object" || Array.isArray(raw))
586
- return { carried: [], left: [] };
587
- const known = new Set(Object.values(CONFIG_KEYS));
588
- const models = new Set([CONFIG_KEYS.harnessModel, CONFIG_KEYS.codingModel, "model"]);
589
- const carried = [];
590
- const left = [];
591
- for (const [written, value] of Object.entries(raw)) {
592
- const key = written.replace(/_/g, "-");
593
- if (models.has(key) || value === null || value === undefined)
594
- continue;
595
- if (known.has(key))
596
- carried.push([key, value]);
597
- else
598
- left.push(written);
599
- }
600
- return { carried, left };
601
- }
602
- /**
603
- * Write the quick start config.turri.yaml in `dir`, with what a config.yaml beside it says that turri reads too. One already
604
- * there keeps everything but its two models, which are set to the vendor's - or the ones given - and `force` writes the
605
- * whole of it again. Says what it did; a model pi's catalogue does not have writes nothing and says so.
606
- */
607
- export async function initConfig(dir, options = {}) {
608
- const chosen = await chosenModels(options);
609
- if ("problem" in chosen)
610
- return { written: false, message: chosen.problem };
611
- const { vendor, bedrock, models, given } = chosen;
612
- const folder = resolve(dir);
613
- // The modules' old files, config.<module>.yaml, copied to their new names; config.turri.yaml is written below.
614
- adoptLegacyConfig(folder, { projectFile: false });
615
- const path = join(folder, CONFIG_FILE);
616
- const existing = existsSync(path) && options.force !== true;
617
- const { harness, coding } = models;
618
- const lines = modelLines(harness, coding);
619
- // A new file takes what a config.yaml beside it - another tool's, say - says that turri reads too: its testing scripts, say.
620
- const shared = existing ? { carried: [], left: [] } : sharedWithLegacy(folder);
621
- let config = existing
622
- ? withModels(readFileSync(path, "utf8"), lines)
623
- : shared.carried.reduce((text, [key, value]) => withTopLevelValue(text, key, value), quickStartConfig(vendor, bedrock, models));
624
- for (const [role, choice] of Object.entries(captureDefaults(harness, coding))) {
625
- const key = `models.${role}`;
626
- if (currentValue(config, key) === undefined)
627
- config = withSetting(config, key, `${choice.model}:${choice.thinking}`);
628
- }
629
- writeFileSync(path, config);
630
- const here = resolve(process.cwd()) === folder;
631
- const [talk, code] = [harness, coding].map((model, at) => `${model}:${at === 0 ? HARNESS_THINKING : ROLE_THINKING.coding}`);
632
- return {
633
- written: true,
634
- message: [
635
- "",
636
- `${brand.success("✓")} ${existing ? `Set the two models in ${brand.bold(path)}` : `Wrote ${brand.bold(path)}`}`,
637
- ` ${brand.muted(`with ${whose(vendor, models, given)}${existing ? " - missing capture tiers filled in, everything else in it left as it was (--force writes it all again)" : ""}`)}`,
638
- "",
639
- ` ${brand.muted("you talk to")} ${talk}`,
640
- ` ${brand.muted("it codes")} ${code}`,
641
- ...["capture-exploration", "capture-analysis", "capture"].map(role => ` ${brand.muted(role)} ${currentValue(config, `models.${role}`)}`),
642
- ...(shared.carried.length > 0
643
- ? [
644
- "",
645
- brand.muted(`Took from ${LEGACY_CONFIG_FILE} what turri reads too - ${shared.carried.map(([key]) => key).join(", ")}.` +
646
- (shared.left.length > 0 ? ` Not taken, turri does not read them: ${shared.left.join(", ")}.` : "")),
647
- ]
648
- : []),
649
- "",
650
- ...signInText(vendor, bedrock, given ? models : undefined),
651
- "",
652
- brand.bold("Then"),
653
- ...(here ? [] : [` ${brand.accent(`cd ${folder}`)}`]),
654
- ` ${brand.accent("turri doctor")} ${brand.muted("validates your login, and checks everything else turri needs")}`,
655
- ` ${brand.accent("turri")}`,
656
- "",
657
- brand.muted(`turri reads this config when it starts in ${here ? "this folder" : folder} or one below it.`),
658
- brand.muted(`Every other setting is in the file at its default - docs/config.md has them all.`),
659
- "",
660
- ].join("\n"),
661
- };
662
- }
663
- const USAGE = [
664
- "usage: turri init-config [--vendor anthropic|openai|google|amazon-bedrock|other] [--maker <maker>] [--region <geography>]",
665
- " [--harness-model <spec> --coding-model <spec> [--judge-model <spec>]] [--force] [folder]",
666
- "",
667
- "Write a quick start config.turri.yaml in the folder, the current one by default: the model you talk to and the one that",
668
- "writes the code, from the vendor you use. Asked when --vendor is not given and this is a terminal; otherwise other -",
669
- "a mix of Anthropic and Google, the starting point for any provider pi supports. On amazon-bedrock, --maker and",
670
- "--region say whose models and where - any maker and geography pi's catalogue has there (anthropic, openai, xai, meta,",
671
- "...; global, us, eu, jp, au, apac, in, ca, us-gov, or in-region) - asked when not given, then which two, turri's own",
672
- "pair or the catalogue's offered first. --harness-model and --coding-model name the two instead, as provider/model-id",
673
- "without a thinking level - amazon-bedrock/global.xai.grok-4.7 - any pi's catalogue has; --judge-model the strong one",
674
- "the judging examples name, the harness model unless given. The vendor, maker and region are read from them.",
675
- "A config.turri.yaml already there keeps everything but its two models; --force writes the whole of it again. A new",
676
- "one takes from a config.yaml beside it - another tool's, say - the keys turri reads too, its testing scripts say, and leaves",
677
- "config.yaml as it is.",
678
- ].join("\n");
679
- /** Ask until the answer is one `read` takes. */
680
- async function askUntil(rl, prompt, read, again) {
681
- for (;;) {
682
- const chosen = read(await rl.question(prompt));
683
- if (chosen !== undefined)
684
- return chosen;
685
- console.log(again);
686
- }
687
- }
688
- /** A model's price, as the list of models shows it: dollars a million tokens in and out. */
689
- const priced = (model) => `$${model.cost.input}/$${model.cost.output} a million tokens in/out${model.reasoning ? "" : ", no reasoning"}`;
690
- /**
691
- * Ask which vendor's models to use - a number or a name - and, for Amazon Bedrock, whose and where, from pi's catalogue,
692
- * then which two: the pair offered taken with Enter, or chosen from the maker's models there. What is given is not asked.
693
- */
694
- async function askVendor(given, catalogue) {
695
- const names = Object.keys(VENDORS);
696
- const rl = createInterface({ input: process.stdin, output: process.stdout });
697
- /** A question: a blank line before it, its choices numbered, each with what it is. */
698
- const ask = (question, choices) => {
699
- console.log(`\n${brand.bold(brand.accent(question))}`);
700
- const width = Math.max(...choices.map(([label]) => label.length)) + 3;
701
- choices.forEach(([label, what], index) => console.log(` ${brand.accent(`${String(index + 1).padStart(String(choices.length).length)}`)} ${label.padEnd(width)}${brand.muted(what)}`));
702
- };
703
- const choose = (count) => `\n${brand.muted(`Choose 1-${count}:`)} `;
704
- try {
705
- let vendor = given.vendor;
706
- if (vendor === undefined) {
707
- ask("Which vendor's models do you use?", names.map((name) => {
708
- const { label, harness, coding } = VENDORS[name];
709
- const what = name === "amazon-bedrock"
710
- ? "Anthropic's, OpenAI's, xAI's, Meta's... models on AWS"
711
- : name === "claude-code"
712
- ? `your Claude Pro or Max, through Claude Code - ${harness.split("/")[1]} to talk to, ${coding.split("/")[1]} to code`
713
- : `${name === "other" ? "a mix - " : ""}${harness.split("/")[1]} to talk to, ${coding.split("/")[1]} to code`;
714
- return [label, what];
715
- }));
716
- vendor = await askUntil(rl, choose(names.length), vendorOf, `Type a number from 1 to ${names.length}, or a vendor's name.`);
717
- }
718
- if (vendor !== "amazon-bedrock")
719
- return { vendor };
720
- const known = await catalogue();
721
- const makers = bedrockMakers(known);
722
- let maker = given.maker;
723
- if (maker === undefined) {
724
- ask("Whose models, on Amazon Bedrock?", makers.map((offer) => {
725
- const own = offer.maker === "anthropic" || offer.maker === "openai" ? bedrockModels({ maker: offer.maker, region: "global" }) : undefined;
726
- return [offer.label, own !== undefined ? `${own.harness.split(".").slice(2).join(".")} to talk to, ${own.coding.split(".").slice(2).join(".")} to code` : offer.regions.join(", ")];
727
- }));
728
- maker = await askUntil(rl, choose(makers.length), (answer) => bedrockMakerOf(answer, known), `Type a number from 1 to ${makers.length}, or a maker's name.`);
729
- }
730
- const regions = makers.find((offer) => offer.maker === maker)?.regions ?? [];
731
- let region = given.region !== undefined ? bedrockRegionOf(maker, given.region, known) : undefined;
732
- if (region === undefined) {
733
- ask("Which region?", regions.map((entry) => [entry, entry === "global" ? "wherever Bedrock has room" : entry === BEDROCK_IN_REGION ? "the AWS region it is called in" : ""]));
734
- region = await askUntil(rl, choose(regions.length), (answer) => bedrockRegionOf(maker, answer, known), `Type a number from 1 to ${regions.length}, or one of ${regions.join(", ")}.`);
735
- }
736
- const bedrock = { maker, region };
737
- const offered = bedrockDefaultModels(known, bedrock);
738
- const models = bedrockModelsIn(known, bedrock);
739
- if (offered === undefined || models.length < 2)
740
- return { vendor, bedrock };
741
- const bare = (spec) => spec.replace(/^amazon-bedrock\//, "");
742
- console.log(`\n${brand.bold(brand.accent("Which models?"))}`);
743
- console.log(` ${bare(offered.harness)} ${brand.muted("to talk to,")} ${bare(offered.coding)} ${brand.muted("to code")}`);
744
- const keep = (await rl.question(`\n${brand.muted("Enter takes them; c chooses others:")} `)).trim().toLowerCase();
745
- if (keep !== "c")
746
- return { vendor, bedrock };
747
- ask("The model you talk to - it writes the specs and plans the work", models.map((model) => [model.id, priced(model)]));
748
- const pick = (fallback) => (answer) => {
749
- const typed = answer.trim();
750
- if (typed === "")
751
- return fallback;
752
- const model = (/^\d+$/.test(typed) ? models[Number(typed) - 1] : undefined) ?? models.find((entry) => entry.id === typed);
753
- return model !== undefined ? `amazon-bedrock/${model.id}` : undefined;
754
- };
755
- const atOf = (spec) => models.findIndex((model) => `amazon-bedrock/${model.id}` === spec) + 1;
756
- const again = `Type a number from 1 to ${models.length}, or Enter for the one offered.`;
757
- const harness = await askUntil(rl, `\n${brand.muted(`Choose 1-${models.length}, Enter for ${atOf(offered.harness)}:`)} `, pick(offered.harness), again);
758
- ask("The model that writes the code - a smaller, cheaper one", models.map((model) => [model.id, priced(model)]));
759
- const coding = await askUntil(rl, `\n${brand.muted(`Choose 1-${models.length}, Enter for ${atOf(offered.coding)}:`)} `, pick(offered.coding), again);
760
- return { vendor, bedrock, models: { harness, coding, ...(harness === offered.harness ? { strong: offered.strong } : {}) } };
761
- }
762
- finally {
763
- rl.close();
764
- }
765
- }
766
- /** A flag's value: `--name value` or `--name=value`, and where the value was, to leave it out of the folder. */
767
- function flagOf(args, name) {
768
- const index = args.findIndex((arg) => arg === `--${name}` || arg.startsWith(`--${name}=`));
769
- if (index === -1)
770
- return { at: [] };
771
- return args[index].includes("=") ? { value: args[index].slice(args[index].indexOf("=") + 1), at: [index] } : { value: args[index + 1], at: [index, index + 1] };
772
- }
773
- /** `turri init-config [--vendor <vendor>] [--maker <maker>] [--region <geography>] [--harness-model <spec> --coding-model <spec>] [--force] [folder]`. */
774
- export async function main(args) {
775
- if (args.includes("-h") || args.includes("--help")) {
776
- console.log(USAGE);
777
- return 0;
778
- }
779
- const flags = {
780
- vendor: flagOf(args, "vendor"),
781
- maker: flagOf(args, "maker"),
782
- region: flagOf(args, "region"),
783
- harness: flagOf(args, "harness-model"),
784
- coding: flagOf(args, "coding-model"),
785
- judge: flagOf(args, "judge-model"),
786
- };
787
- const taken = new Set(Object.values(flags).flatMap((flag) => flag.at));
788
- const rest = args.filter((arg, index) => !arg.startsWith("-") && !taken.has(index));
789
- const folder = rest[0] ?? process.cwd();
790
- if (!existsSync(folder)) {
791
- console.error(`${folder} does not exist.`);
792
- return 1;
793
- }
794
- let vendor;
795
- if (flags.vendor.value !== undefined) {
796
- vendor = vendorOf(flags.vendor.value);
797
- if (vendor === undefined) {
798
- console.error(`Not a vendor: ${flags.vendor.value}. One of ${Object.keys(VENDORS).join(", ")}.\n\n${USAGE}`);
799
- return 1;
800
- }
801
- }
802
- // pi's catalogue, read once and only when it is needed: models named, or a maker or region beyond turri's own pair.
803
- let read;
804
- const catalogue = async () => (read ??= await piModelCatalogue());
805
- const [harness, coding, judge] = [flags.harness.value, flags.coding.value, flags.judge.value];
806
- if ((harness === undefined) !== (coding === undefined) || (judge !== undefined && harness === undefined)) {
807
- console.error(`Name both models - --harness-model and --coding-model - or neither.\n\n${USAGE}`);
808
- return 1;
809
- }
810
- const named = harness !== undefined && coding !== undefined ? { harness, coding, ...(judge !== undefined ? { strong: judge } : {}) } : undefined;
811
- let maker;
812
- if (flags.maker.value !== undefined) {
813
- const typed = flags.maker.value.trim().toLowerCase();
814
- maker = bedrockMakerOf(typed, ["anthropic", "openai"].includes(typed) ? undefined : await catalogue());
815
- if (maker === undefined) {
816
- console.error(`Not a maker pi's catalogue has on Amazon Bedrock: ${flags.maker.value}. One of ${bedrockMakers(await catalogue()).map((offer) => offer.maker).join(", ")}.\n\n${USAGE}`);
817
- return 1;
818
- }
819
- }
820
- const region = flags.region.value?.trim().toLowerCase();
821
- if (region !== undefined && named === undefined) {
822
- const of = maker ?? BEDROCK_DEFAULT.maker;
823
- if (!hasPreset({ maker: of, region }) && bedrockRegionOf(of, region, await catalogue()) === undefined) {
824
- const regions = bedrockMakers(await catalogue()).find((offer) => offer.maker === of)?.regions ?? [];
825
- console.error(`Not a region ${makerLabel(of)}'s models run in on Bedrock: ${region}. One of ${regions.join(", ")}.`);
826
- return 1;
827
- }
828
- }
829
- const force = args.includes("--force");
830
- const asking = process.stdin.isTTY && process.stdout.isTTY && named === undefined;
831
- let chosen;
832
- try {
833
- chosen = await chooseVendor();
834
- }
835
- catch (error) {
836
- // Ctrl+C or Ctrl+D at a question: stopped, nothing written - not a crash.
837
- if (error.code === "ABORT_ERR") {
838
- console.log(`\n${brand.muted("Stopped - nothing written.")}`);
839
- return 1;
840
- }
841
- throw error;
842
- }
843
- async function chooseVendor() {
844
- if (named !== undefined) {
845
- return {
846
- ...(vendor !== undefined ? { vendor } : {}),
847
- ...(maker !== undefined || region !== undefined ? { bedrock: { ...(maker !== undefined ? { maker } : {}), region: region ?? bedrockPlaceOf(named.harness).geography } } : {}),
848
- models: named,
849
- };
850
- }
851
- return asking && (vendor === undefined || (vendor === "amazon-bedrock" && (maker === undefined || region === undefined)))
852
- ? await askVendor({ ...(vendor !== undefined ? { vendor } : {}), ...(maker !== undefined ? { maker } : {}), ...(region !== undefined ? { region } : {}) }, catalogue)
853
- : {
854
- vendor: vendor ?? "other",
855
- ...(vendor === "amazon-bedrock" ? { bedrock: { maker: maker ?? BEDROCK_DEFAULT.maker, region: region ?? BEDROCK_DEFAULT.region } } : {}),
856
- };
857
- }
858
- const result = await initConfig(folder, {
859
- force,
860
- ...(chosen.vendor !== undefined ? { vendor: chosen.vendor } : {}),
861
- ...(chosen.bedrock !== undefined ? { bedrock: chosen.bedrock } : {}),
862
- ...(chosen.models !== undefined ? { models: chosen.models } : {}),
863
- ...(read !== undefined ? { catalogue: read } : {}),
864
- });
865
- (result.written ? console.log : console.error)(result.message);
866
- return result.written ? 0 : 1;
867
- }