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

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 (481) hide show
  1. package/README.md +26 -3
  2. package/dist/banner.js +259 -0
  3. package/dist/capture-cli.js +59 -0
  4. package/dist/chat-commands.js +9 -63
  5. package/dist/chat-models.js +17 -15
  6. package/dist/chat-tab-header.js +90 -0
  7. package/dist/chat-tabs.js +100 -0
  8. package/dist/chat-terminal.js +162 -54
  9. package/dist/chat-waiting.js +0 -20
  10. package/dist/cli-options.js +11 -7
  11. package/dist/cli-root.js +141 -0
  12. package/dist/cli.js +40 -28
  13. package/dist/conform-cli.js +4 -6
  14. package/dist/cultivate-cli.js +65 -97
  15. package/dist/doctor-cli.js +99 -0
  16. package/dist/drift-cli.js +2 -7
  17. package/dist/entry-renderers.js +107 -0
  18. package/dist/extension.js +14 -3211
  19. package/dist/init-config-cli.js +218 -0
  20. package/dist/launch-cli.js +55 -91
  21. package/dist/lineage-cli.js +2 -4
  22. package/dist/loop-cli.js +118 -233
  23. package/dist/panel-view.js +409 -0
  24. package/dist/parse-cli.js +5 -2
  25. package/dist/pi-launch.js +39 -13
  26. package/dist/pi-themes.js +21 -0
  27. package/dist/plain-code-blocks.js +56 -0
  28. package/dist/pointer-hover.js +48 -0
  29. package/dist/print-mode.js +20 -0
  30. package/dist/question-dialog.js +26 -3
  31. package/dist/quiet.js +7 -106
  32. package/dist/regenerate/diff-view.js +6 -87
  33. package/dist/regenerate/jobs-tree.js +7 -18
  34. package/dist/regenerate/side-panel.js +158 -22
  35. package/dist/regenerate/spec-map-view.js +25 -70
  36. package/dist/regenerate-cli.js +7 -11
  37. package/dist/skill-progress.js +25 -0
  38. package/dist/skill-report.js +52 -0
  39. package/dist/terminal-marks.js +21 -0
  40. package/dist/terminal-notifications.js +219 -0
  41. package/dist/terminal-view.js +239 -0
  42. package/dist/turri-versions.js +64 -6
  43. package/docs/README.md +4 -2
  44. package/docs/capture.md +126 -0
  45. package/docs/chats.md +14 -10
  46. package/docs/claude-subscription.md +1 -1
  47. package/docs/config.md +20 -8
  48. package/docs/development.md +30 -61
  49. package/docs/headless.md +3 -1
  50. package/docs/hosting.md +3 -251
  51. package/docs/installation.md +5 -3
  52. package/docs/launch.md +3 -3
  53. package/docs/regenerating.md +1 -1
  54. package/docs/sandbox.md +4 -2
  55. package/docs/sentinel.md +13 -13
  56. package/docs/theming.md +3 -3
  57. package/docs/using.md +14 -6
  58. package/package.json +13 -31
  59. package/dist/ask.d.ts +0 -90
  60. package/dist/ask.js +0 -170
  61. package/dist/background-skills.d.ts +0 -53
  62. package/dist/background-skills.js +0 -121
  63. package/dist/bedrock-region.d.ts +0 -66
  64. package/dist/bedrock-region.js +0 -144
  65. package/dist/brand.d.ts +0 -13
  66. package/dist/btw.d.ts +0 -69
  67. package/dist/btw.js +0 -174
  68. package/dist/chat-commands.d.ts +0 -25
  69. package/dist/chat-idle.d.ts +0 -7
  70. package/dist/chat-idle.js +0 -20
  71. package/dist/chat-models.d.ts +0 -22
  72. package/dist/chat-records.d.ts +0 -50
  73. package/dist/chat-records.js +0 -107
  74. package/dist/chat-scope.d.ts +0 -14
  75. package/dist/chat-scope.js +0 -15
  76. package/dist/chat-skills.d.ts +0 -17
  77. package/dist/chat-skills.js +0 -18
  78. package/dist/chat-terminal.d.ts +0 -24
  79. package/dist/chat-ui.d.ts +0 -33
  80. package/dist/chat-waiting.d.ts +0 -67
  81. package/dist/chats.d.ts +0 -338
  82. package/dist/chats.js +0 -996
  83. package/dist/cli-options.d.ts +0 -24
  84. package/dist/cli.d.ts +0 -9
  85. package/dist/config-edit.d.ts +0 -83
  86. package/dist/config-edit.js +0 -390
  87. package/dist/config.d.ts +0 -415
  88. package/dist/config.js +0 -757
  89. package/dist/conform-cli.d.ts +0 -1
  90. package/dist/conformance-switch.d.ts +0 -25
  91. package/dist/conformance-switch.js +0 -86
  92. package/dist/cultivate-cli.d.ts +0 -1
  93. package/dist/doctor-tool.d.ts +0 -11
  94. package/dist/doctor-tool.js +0 -33
  95. package/dist/drift-cli.d.ts +0 -1
  96. package/dist/environment.d.ts +0 -37
  97. package/dist/environment.js +0 -109
  98. package/dist/extension.d.ts +0 -208
  99. package/dist/genome.d.ts +0 -77
  100. package/dist/genome.js +0 -288
  101. package/dist/graph.d.ts +0 -52
  102. package/dist/graph.js +0 -247
  103. package/dist/host-session.d.ts +0 -112
  104. package/dist/host-session.js +0 -103
  105. package/dist/host.d.ts +0 -40
  106. package/dist/host.js +0 -54
  107. package/dist/identity.d.ts +0 -7
  108. package/dist/identity.js +0 -74
  109. package/dist/init-config.d.ts +0 -169
  110. package/dist/init-config.js +0 -840
  111. package/dist/installed-providers.d.ts +0 -40
  112. package/dist/installed-providers.js +0 -98
  113. package/dist/jellyfish.d.ts +0 -40
  114. package/dist/judge.d.ts +0 -25
  115. package/dist/judge.js +0 -62
  116. package/dist/launch-agent.d.ts +0 -62
  117. package/dist/launch-agent.js +0 -339
  118. package/dist/launch-cli.d.ts +0 -1
  119. package/dist/launch-session.d.ts +0 -68
  120. package/dist/launch-session.js +0 -225
  121. package/dist/launch-tools.d.ts +0 -28
  122. package/dist/launch-tools.js +0 -72
  123. package/dist/launch-track.d.ts +0 -175
  124. package/dist/launch-track.js +0 -497
  125. package/dist/lineage-cli.d.ts +0 -1
  126. package/dist/loop-cli.d.ts +0 -35
  127. package/dist/loop-tools.d.ts +0 -103
  128. package/dist/loop-tools.js +0 -357
  129. package/dist/model-check.d.ts +0 -72
  130. package/dist/model-check.js +0 -162
  131. package/dist/module-report.d.ts +0 -9
  132. package/dist/new-project.d.ts +0 -5
  133. package/dist/new-project.js +0 -31
  134. package/dist/notice.d.ts +0 -115
  135. package/dist/notice.js +0 -61
  136. package/dist/parse-cli.d.ts +0 -1
  137. package/dist/parse-tool.d.ts +0 -9
  138. package/dist/parse-tool.js +0 -33
  139. package/dist/pi-launch.d.ts +0 -1
  140. package/dist/pi-settings.d.ts +0 -4
  141. package/dist/pi.d.ts +0 -248
  142. package/dist/pi.js +0 -889
  143. package/dist/picture-row.d.ts +0 -10
  144. package/dist/plain/check.d.ts +0 -63
  145. package/dist/plain/check.js +0 -236
  146. package/dist/plain/concepts.d.ts +0 -37
  147. package/dist/plain/concepts.js +0 -283
  148. package/dist/plain/cycles.d.ts +0 -21
  149. package/dist/plain/cycles.js +0 -190
  150. package/dist/plain/errors.d.ts +0 -26
  151. package/dist/plain/errors.js +0 -50
  152. package/dist/plain/files.d.ts +0 -47
  153. package/dist/plain/files.js +0 -161
  154. package/dist/plain/graph.d.ts +0 -107
  155. package/dist/plain/graph.js +0 -194
  156. package/dist/plain/highlight.d.ts +0 -43
  157. package/dist/plain/highlight.js +0 -196
  158. package/dist/plain/index.d.ts +0 -18
  159. package/dist/plain/index.js +0 -18
  160. package/dist/plain/liquid.d.ts +0 -22
  161. package/dist/plain/liquid.js +0 -124
  162. package/dist/plain/markdown.d.ts +0 -103
  163. package/dist/plain/markdown.js +0 -330
  164. package/dist/plain/module-concepts.d.ts +0 -32
  165. package/dist/plain/module-concepts.js +0 -80
  166. package/dist/plain/parser.d.ts +0 -163
  167. package/dist/plain/parser.js +0 -930
  168. package/dist/plain/plain.tmLanguage.json +0 -150
  169. package/dist/plain/project.d.ts +0 -48
  170. package/dist/plain/project.js +0 -155
  171. package/dist/plain/spec.d.ts +0 -152
  172. package/dist/plain/spec.js +0 -265
  173. package/dist/plain/stdlib.d.ts +0 -16
  174. package/dist/plain/stdlib.js +0 -48
  175. package/dist/plain/test-plain-file.d.ts +0 -59
  176. package/dist/plain/test-plain-file.js +0 -232
  177. package/dist/plain-files.d.ts +0 -21
  178. package/dist/plain-files.js +0 -156
  179. package/dist/question-dialog.d.ts +0 -55
  180. package/dist/questioning.d.ts +0 -55
  181. package/dist/questioning.js +0 -109
  182. package/dist/quiet.d.ts +0 -34
  183. package/dist/regenerate/activity.d.ts +0 -227
  184. package/dist/regenerate/activity.js +0 -250
  185. package/dist/regenerate/agent-env.d.ts +0 -51
  186. package/dist/regenerate/agent-env.js +0 -311
  187. package/dist/regenerate/agent-shell.d.ts +0 -54
  188. package/dist/regenerate/agent-shell.js +0 -121
  189. package/dist/regenerate/arbiter.d.ts +0 -68
  190. package/dist/regenerate/arbiter.js +0 -133
  191. package/dist/regenerate/audit.d.ts +0 -69
  192. package/dist/regenerate/audit.js +0 -212
  193. package/dist/regenerate/base-folder.d.ts +0 -70
  194. package/dist/regenerate/base-folder.js +0 -186
  195. package/dist/regenerate/cases.d.ts +0 -12
  196. package/dist/regenerate/cases.js +0 -149
  197. package/dist/regenerate/change-view.d.ts +0 -23
  198. package/dist/regenerate/change-view.js +0 -153
  199. package/dist/regenerate/chunk-plan.d.ts +0 -217
  200. package/dist/regenerate/chunk-plan.js +0 -937
  201. package/dist/regenerate/codebase.d.ts +0 -21
  202. package/dist/regenerate/codebase.js +0 -75
  203. package/dist/regenerate/command-check.d.ts +0 -66
  204. package/dist/regenerate/command-check.js +0 -508
  205. package/dist/regenerate/compaction.d.ts +0 -13
  206. package/dist/regenerate/compaction.js +0 -20
  207. package/dist/regenerate/confine.d.ts +0 -69
  208. package/dist/regenerate/confine.js +0 -311
  209. package/dist/regenerate/conform.d.ts +0 -66
  210. package/dist/regenerate/conform.js +0 -132
  211. package/dist/regenerate/conformance-agents.d.ts +0 -388
  212. package/dist/regenerate/conformance-agents.js +0 -1162
  213. package/dist/regenerate/conformance.d.ts +0 -191
  214. package/dist/regenerate/conformance.js +0 -1035
  215. package/dist/regenerate/conversation-writes.d.ts +0 -10
  216. package/dist/regenerate/conversation-writes.js +0 -100
  217. package/dist/regenerate/credentials.d.ts +0 -18
  218. package/dist/regenerate/credentials.js +0 -88
  219. package/dist/regenerate/debug-log.d.ts +0 -56
  220. package/dist/regenerate/debug-log.js +0 -236
  221. package/dist/regenerate/debugger.d.ts +0 -36
  222. package/dist/regenerate/debugger.js +0 -133
  223. package/dist/regenerate/delivery.d.ts +0 -2
  224. package/dist/regenerate/diagnose-job.d.ts +0 -2
  225. package/dist/regenerate/diagnose-job.js +0 -40
  226. package/dist/regenerate/diagnose.d.ts +0 -46
  227. package/dist/regenerate/diagnose.js +0 -92
  228. package/dist/regenerate/diff-view.d.ts +0 -64
  229. package/dist/regenerate/drift.d.ts +0 -120
  230. package/dist/regenerate/drift.js +0 -285
  231. package/dist/regenerate/environment-error.d.ts +0 -167
  232. package/dist/regenerate/environment-error.js +0 -342
  233. package/dist/regenerate/failure-reports.d.ts +0 -28
  234. package/dist/regenerate/failure-reports.js +0 -79
  235. package/dist/regenerate/job-log.d.ts +0 -30
  236. package/dist/regenerate/job-log.js +0 -105
  237. package/dist/regenerate/job-panel.d.ts +0 -122
  238. package/dist/regenerate/job-panel.js +0 -339
  239. package/dist/regenerate/jobs-tree.d.ts +0 -75
  240. package/dist/regenerate/jobs.d.ts +0 -231
  241. package/dist/regenerate/jobs.js +0 -522
  242. package/dist/regenerate/lanes.d.ts +0 -16
  243. package/dist/regenerate/lanes.js +0 -32
  244. package/dist/regenerate/launch.d.ts +0 -256
  245. package/dist/regenerate/launch.js +0 -689
  246. package/dist/regenerate/ledger-view.d.ts +0 -87
  247. package/dist/regenerate/ledger-view.js +0 -325
  248. package/dist/regenerate/ledger.d.ts +0 -368
  249. package/dist/regenerate/ledger.js +0 -357
  250. package/dist/regenerate/lineage.d.ts +0 -105
  251. package/dist/regenerate/lineage.js +0 -485
  252. package/dist/regenerate/list-arguments.d.ts +0 -21
  253. package/dist/regenerate/list-arguments.js +0 -121
  254. package/dist/regenerate/loop.d.ts +0 -423
  255. package/dist/regenerate/loop.js +0 -2079
  256. package/dist/regenerate/masking.d.ts +0 -19
  257. package/dist/regenerate/masking.js +0 -95
  258. package/dist/regenerate/model-names.d.ts +0 -33
  259. package/dist/regenerate/model-names.js +0 -92
  260. package/dist/regenerate/notes.d.ts +0 -159
  261. package/dist/regenerate/notes.js +0 -446
  262. package/dist/regenerate/os-sandbox.d.ts +0 -93
  263. package/dist/regenerate/os-sandbox.js +0 -283
  264. package/dist/regenerate/panel-dock.d.ts +0 -23
  265. package/dist/regenerate/paths.d.ts +0 -110
  266. package/dist/regenerate/paths.js +0 -190
  267. package/dist/regenerate/plain-palette.d.ts +0 -34
  268. package/dist/regenerate/prompt.d.ts +0 -230
  269. package/dist/regenerate/prompt.js +0 -741
  270. package/dist/regenerate/pulse-files.d.ts +0 -14
  271. package/dist/regenerate/pulse-files.js +0 -63
  272. package/dist/regenerate/records.d.ts +0 -132
  273. package/dist/regenerate/records.js +0 -327
  274. package/dist/regenerate/regenerate.d.ts +0 -106
  275. package/dist/regenerate/regenerate.js +0 -660
  276. package/dist/regenerate/regression.d.ts +0 -58
  277. package/dist/regenerate/regression.js +0 -188
  278. package/dist/regenerate/renames.d.ts +0 -42
  279. package/dist/regenerate/renames.js +0 -185
  280. package/dist/regenerate/requires.d.ts +0 -117
  281. package/dist/regenerate/requires.js +0 -377
  282. package/dist/regenerate/resources.d.ts +0 -57
  283. package/dist/regenerate/resources.js +0 -162
  284. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  285. package/dist/regenerate/scripts-being-written.js +0 -30
  286. package/dist/regenerate/self-check.d.ts +0 -29
  287. package/dist/regenerate/self-check.js +0 -119
  288. package/dist/regenerate/services.d.ts +0 -28
  289. package/dist/regenerate/services.js +0 -158
  290. package/dist/regenerate/shell.d.ts +0 -91
  291. package/dist/regenerate/shell.js +0 -320
  292. package/dist/regenerate/side-panel.d.ts +0 -59
  293. package/dist/regenerate/spec-map-view.d.ts +0 -139
  294. package/dist/regenerate/spec-map.d.ts +0 -160
  295. package/dist/regenerate/spec-map.js +0 -596
  296. package/dist/regenerate/spec-steps.d.ts +0 -180
  297. package/dist/regenerate/spec-steps.js +0 -729
  298. package/dist/regenerate/standing.d.ts +0 -28
  299. package/dist/regenerate/standing.js +0 -30
  300. package/dist/regenerate/state.d.ts +0 -21
  301. package/dist/regenerate/state.js +0 -10
  302. package/dist/regenerate/steering.d.ts +0 -56
  303. package/dist/regenerate/steering.js +0 -119
  304. package/dist/regenerate/stop-report.d.ts +0 -43
  305. package/dist/regenerate/stop-report.js +0 -160
  306. package/dist/regenerate/submit-work.d.ts +0 -44
  307. package/dist/regenerate/submit-work.js +0 -76
  308. package/dist/regenerate/test-kinds.d.ts +0 -85
  309. package/dist/regenerate/test-kinds.js +0 -171
  310. package/dist/regenerate/test-scripts.d.ts +0 -235
  311. package/dist/regenerate/test-scripts.js +0 -843
  312. package/dist/regenerate/testing-steps.d.ts +0 -52
  313. package/dist/regenerate/testing-steps.js +0 -129
  314. package/dist/regenerate/testing.d.ts +0 -150
  315. package/dist/regenerate/testing.js +0 -438
  316. package/dist/regenerate/transcript-view.d.ts +0 -21
  317. package/dist/regenerate/unit-gate.d.ts +0 -27
  318. package/dist/regenerate/unit-gate.js +0 -20
  319. package/dist/regenerate/unit-review.d.ts +0 -152
  320. package/dist/regenerate/unit-review.js +0 -361
  321. package/dist/regenerate/web.d.ts +0 -61
  322. package/dist/regenerate/web.js +0 -256
  323. package/dist/regenerate/workspace.d.ts +0 -12
  324. package/dist/regenerate/workspace.js +0 -99
  325. package/dist/regenerate-cli.d.ts +0 -1
  326. package/dist/resume-line.d.ts +0 -5
  327. package/dist/review/live.d.ts +0 -72
  328. package/dist/review/live.js +0 -166
  329. package/dist/rules.d.ts +0 -20
  330. package/dist/rules.js +0 -47
  331. package/dist/run-report.d.ts +0 -88
  332. package/dist/run-report.js +0 -338
  333. package/dist/screen-padding.d.ts +0 -28
  334. package/dist/self-invocation.d.ts +0 -36
  335. package/dist/self-invocation.js +0 -137
  336. package/dist/sentinel-chat.d.ts +0 -19
  337. package/dist/sentinel-chat.js +0 -221
  338. package/dist/sentinel-check.d.ts +0 -36
  339. package/dist/sentinel-check.js +0 -78
  340. package/dist/sentinel.d.ts +0 -107
  341. package/dist/sentinel.js +0 -599
  342. package/dist/settings.d.ts +0 -45
  343. package/dist/settings.js +0 -378
  344. package/dist/setup.d.ts +0 -97
  345. package/dist/setup.js +0 -428
  346. package/dist/skill-progress.d.ts +0 -46
  347. package/dist/skill.d.ts +0 -102
  348. package/dist/skill.js +0 -147
  349. package/dist/skills.d.ts +0 -54
  350. package/dist/skills.js +0 -111
  351. package/dist/spawn-async.d.ts +0 -18
  352. package/dist/spawn-async.js +0 -35
  353. package/dist/stack.d.ts +0 -80
  354. package/dist/stack.js +0 -206
  355. package/dist/stdlib.d.ts +0 -43
  356. package/dist/stdlib.js +0 -118
  357. package/dist/surface.d.ts +0 -5
  358. package/dist/surface.js +0 -18
  359. package/dist/terminal-images.d.ts +0 -2
  360. package/dist/test-plain-files.d.ts +0 -41
  361. package/dist/test-plain-files.js +0 -172
  362. package/dist/tools.d.ts +0 -101
  363. package/dist/tools.js +0 -242
  364. package/dist/turri-versions.d.ts +0 -71
  365. package/genome/rules/bullet-continuation.md +0 -61
  366. package/genome/rules/concise-specs-examples.md +0 -460
  367. package/genome/rules/concise-specs-integration-examples.md +0 -281
  368. package/genome/rules/concise-specs.md +0 -80
  369. package/genome/rules/definitions.md +0 -107
  370. package/genome/rules/examples/integration-embedded-testing/run_conformance_tests_java.sh +0 -161
  371. package/genome/rules/examples/integration-embedded-testing/run_unittests_java.sh +0 -50
  372. package/genome/rules/exported-concepts.md +0 -39
  373. package/genome/rules/func-specs.md +0 -164
  374. package/genome/rules/impl-reqs.md +0 -68
  375. package/genome/rules/import-modules.md +0 -49
  376. package/genome/rules/integration-embedded-testing.md +0 -273
  377. package/genome/rules/integration-embedded.md +0 -171
  378. package/genome/rules/integration-standalone.md +0 -135
  379. package/genome/rules/integrations.md +0 -136
  380. package/genome/rules/linked-resources.md +0 -76
  381. package/genome/rules/module-structure.md +0 -112
  382. package/genome/rules/project-model.md +0 -69
  383. package/genome/rules/required-concepts.md +0 -44
  384. package/genome/rules/requires-modules.md +0 -81
  385. package/genome/rules/semantic-ids.md +0 -49
  386. package/genome/rules/stdlib.md +0 -37
  387. package/genome/rules/test-plain-files.md +0 -138
  388. package/genome/rules/test-reqs.md +0 -57
  389. package/genome/rules/turri-regeneration.md +0 -66
  390. package/genome/skills/analyze-2-func-specs/SKILL.md +0 -116
  391. package/genome/skills/analyze-func-specs/SKILL.md +0 -137
  392. package/genome/skills/break-down-func-spec/SKILL.md +0 -229
  393. package/genome/skills/consolidate-concepts/SKILL.md +0 -192
  394. package/genome/skills/convert-old-syntax/SKILL.md +0 -68
  395. package/genome/skills/convert-old-syntax/references/rubric.md +0 -11
  396. package/genome/skills/debug-specs/SKILL.md +0 -194
  397. package/genome/skills/implement-conformance-testing-script/SKILL.md +0 -247
  398. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_cypress.ps1 +0 -337
  399. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_golang.ps1 +0 -111
  400. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +0 -151
  401. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.ps1 +0 -103
  402. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +0 -146
  403. package/genome/skills/implement-unit-testing-script/SKILL.md +0 -171
  404. package/genome/skills/implement-unit-testing-script/assets/run_unittests_flutter.ps1 +0 -87
  405. package/genome/skills/implement-unit-testing-script/assets/run_unittests_golang.ps1 +0 -73
  406. package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +0 -82
  407. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.ps1 +0 -81
  408. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +0 -102
  409. package/genome/skills/implement-unit-testing-script/assets/run_unittests_react.ps1 +0 -87
  410. package/genome/skills/refactor-module/SKILL.md +0 -218
  411. package/genome/skills/resolve-section-ownership/SKILL.md +0 -64
  412. package/genome/skills/resolve-spec-conflict/SKILL.md +0 -102
  413. package/stdlib/backend/common.plain +0 -25
  414. package/stdlib/backend/conformance/common.plain +0 -12
  415. package/stdlib/backend/conformance/go-gin.plain +0 -9
  416. package/stdlib/backend/conformance/go-nethttp.plain +0 -9
  417. package/stdlib/backend/conformance/java-springboot.plain +0 -9
  418. package/stdlib/backend/conformance/python-django.plain +0 -9
  419. package/stdlib/backend/conformance/python-fastapi.plain +0 -9
  420. package/stdlib/backend/conformance/python-flask.plain +0 -9
  421. package/stdlib/backend/conformance/rust-axum.plain +0 -9
  422. package/stdlib/backend/conformance/typescript-express.plain +0 -9
  423. package/stdlib/backend/conformance/typescript-fastify.plain +0 -9
  424. package/stdlib/backend/conformance/typescript-nestjs.plain +0 -9
  425. package/stdlib/backend/go-gin.plain +0 -18
  426. package/stdlib/backend/go-nethttp.plain +0 -18
  427. package/stdlib/backend/java-springboot.plain +0 -19
  428. package/stdlib/backend/python-django.plain +0 -19
  429. package/stdlib/backend/python-fastapi.plain +0 -23
  430. package/stdlib/backend/python-flask.plain +0 -23
  431. package/stdlib/backend/rust-axum.plain +0 -17
  432. package/stdlib/backend/typescript-express.plain +0 -19
  433. package/stdlib/backend/typescript-fastify.plain +0 -19
  434. package/stdlib/backend/typescript-nestjs.plain +0 -19
  435. package/stdlib/cli/common.plain +0 -17
  436. package/stdlib/cli/conformance/common.plain +0 -11
  437. package/stdlib/cli/conformance/go-cobra.plain +0 -9
  438. package/stdlib/cli/conformance/go-flag.plain +0 -9
  439. package/stdlib/cli/conformance/java-picocli.plain +0 -9
  440. package/stdlib/cli/conformance/python-argparse.plain +0 -9
  441. package/stdlib/cli/conformance/python-click.plain +0 -9
  442. package/stdlib/cli/conformance/python-typer.plain +0 -9
  443. package/stdlib/cli/conformance/rust-clap.plain +0 -9
  444. package/stdlib/cli/conformance/typescript-commander.plain +0 -9
  445. package/stdlib/cli/go-cobra.plain +0 -14
  446. package/stdlib/cli/go-flag.plain +0 -14
  447. package/stdlib/cli/java-picocli.plain +0 -15
  448. package/stdlib/cli/python-argparse.plain +0 -18
  449. package/stdlib/cli/python-click.plain +0 -16
  450. package/stdlib/cli/python-typer.plain +0 -16
  451. package/stdlib/cli/rust-clap.plain +0 -14
  452. package/stdlib/cli/typescript-commander.plain +0 -17
  453. package/stdlib/frontend/angular.plain +0 -17
  454. package/stdlib/frontend/common.plain +0 -17
  455. package/stdlib/frontend/conformance/angular.plain +0 -5
  456. package/stdlib/frontend/conformance/common.plain +0 -11
  457. package/stdlib/frontend/conformance/react-vite.plain +0 -5
  458. package/stdlib/frontend/conformance/sveltekit-spa.plain +0 -5
  459. package/stdlib/frontend/conformance/vue-vite.plain +0 -5
  460. package/stdlib/frontend/react-vite.plain +0 -16
  461. package/stdlib/frontend/sveltekit-spa.plain +0 -16
  462. package/stdlib/frontend/vue-vite.plain +0 -16
  463. package/stdlib/lang/go.plain +0 -13
  464. package/stdlib/lang/java.plain +0 -12
  465. package/stdlib/lang/python.plain +0 -18
  466. package/stdlib/lang/rust.plain +0 -12
  467. package/stdlib/lang/typescript.plain +0 -13
  468. package/stdlib/library/common.plain +0 -15
  469. package/stdlib/library/conformance/common.plain +0 -9
  470. package/stdlib/library/conformance/go.plain +0 -9
  471. package/stdlib/library/conformance/java-gradle.plain +0 -9
  472. package/stdlib/library/conformance/java-maven.plain +0 -9
  473. package/stdlib/library/conformance/python.plain +0 -9
  474. package/stdlib/library/conformance/rust.plain +0 -9
  475. package/stdlib/library/conformance/typescript.plain +0 -9
  476. package/stdlib/library/go.plain +0 -12
  477. package/stdlib/library/java-gradle.plain +0 -13
  478. package/stdlib/library/java-maven.plain +0 -13
  479. package/stdlib/library/python.plain +0 -13
  480. package/stdlib/library/rust.plain +0 -12
  481. package/stdlib/library/typescript.plain +0 -15
@@ -1,283 +0,0 @@
1
- import { spawnSync } from "node:child_process";
2
- import { existsSync, realpathSync } from "node:fs";
3
- import { basename, dirname, join, resolve, sep } from "node:path";
4
- import { spawnAsync } from "../spawn-async.js";
5
- /** The caps set inside the sandbox before the command runs: processes, and file size in 1024-byte blocks (8 GiB). */
6
- export const PROCESS_CAP = 4096;
7
- export const FILE_SIZE_CAP_BLOCKS = 8 * 1024 * 1024;
8
- /** A folder as the kernel sees it - symlinks resolved as far as it exists - since that is what both sandboxes check. */
9
- function real(path) {
10
- // Neither sandbox runs on Windows: the paths are kept as they are, so what is generated is the same everywhere.
11
- if (process.platform === "win32")
12
- return path;
13
- let head = resolve(path);
14
- const tail = [];
15
- for (;;) {
16
- if (existsSync(head))
17
- return join(realpathSync(head), ...tail.reverse());
18
- const parent = dirname(head);
19
- if (parent === head)
20
- return resolve(path);
21
- tail.push(basename(head));
22
- head = parent;
23
- }
24
- }
25
- /** What of macOS a command needs to read beyond the toolchains, besides `/usr`, `/bin`, `/System`: the loader's caches, the time zone, the developer tools. */
26
- export const MACOS_MACHINE = [
27
- "/usr",
28
- "/bin",
29
- "/sbin",
30
- "/System",
31
- "/Library/Apple",
32
- "/Library/Developer",
33
- "/Library/Java",
34
- "/Library/Frameworks",
35
- "/Library/Preferences",
36
- "/private/etc",
37
- "/private/var/db/timezone",
38
- "/private/var/db/dyld",
39
- "/private/var/select",
40
- "/opt/homebrew",
41
- "/opt/local",
42
- "/Applications/Xcode.app",
43
- "/dev",
44
- ];
45
- /** What of Linux a command needs to read beyond the toolchains. */
46
- export const LINUX_MACHINE = ["/usr", "/bin", "/sbin", "/lib", "/lib32", "/lib64", "/libx32", "/etc", "/opt", "/nix", "/snap", "/run/systemd/resolve"];
47
- /**
48
- * What of the machine a command reads, from the environment it runs in: the system's folders, every folder on its PATH,
49
- * the folders its toolchain variables point at, and the project's `toolchains:`. Only the PATH folders themselves, not
50
- * their parents - `~/.cargo/bin`, not `~/.cargo`, which holds a registry's credentials - but for a version manager's
51
- * install: a `bin` whose parent is a version, `…/installs/node/24.16.0/bin`, links its tools into the install beside it
52
- * (`npm` into `lib/node_modules`), and an install holds the toolchain, never a credential.
53
- */
54
- export function machineFor(env, toolchainVariables, extra = [], platform = process.platform) {
55
- const base = platform === "darwin" ? MACOS_MACHINE : platform === "linux" ? LINUX_MACHINE : [];
56
- const onPath = (env.PATH ?? "").split(platform === "win32" ? ";" : ":").filter((dir) => dir.startsWith("/"));
57
- const installs = onPath.flatMap((dir) => {
58
- const install = /^(.*\/v?\d+\.\d+(?:\.\d+)?[^/]*)\/bin\/?$/.exec(dir)?.[1];
59
- return install !== undefined ? [install] : [];
60
- });
61
- const located = toolchainVariables.map((name) => env[name]).filter((dir) => dir !== undefined && dir.startsWith("/"));
62
- return [...new Set([...base, ...onPath, ...installs, ...located, ...extra])];
63
- }
64
- function sbplString(path) {
65
- return `"${path.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
66
- }
67
- /**
68
- * The Seatbelt profile for a fence. Everything is allowed but what it names - reading file contents outside the
69
- * allow-list, writing outside the writable folders, the code record, Unix sockets outside the folders, signals and
70
- * process information beyond the sandbox - later rules winning over earlier ones. File metadata stays readable, as
71
- * resolving a path needs.
72
- */
73
- export function seatbeltProfile(fence, userDirs = darwinUserDirs()) {
74
- // The machine's folders as given - they are the system's own spelling; the fence's with their symlinks resolved.
75
- const subpaths = (paths, resolveLinks = true) => paths.map((path) => ` (subpath ${sbplString(resolveLinks ? real(path) : path)})`).join("\n");
76
- const readable = [...fence.read, ...fence.write, ...fence.writable];
77
- const writable = [...fence.write, ...fence.writable];
78
- return [
79
- "(version 1)",
80
- "(allow default)",
81
- ";; Reading: the machine's allow-list and the fence, nothing else.",
82
- "(deny file-read-data file-read-xattr)",
83
- "(allow file-read-data file-read-xattr",
84
- ' (literal "/")',
85
- ' (literal "/etc") (literal "/var") (literal "/tmp") (literal "/private/var/run/resolv.conf")',
86
- subpaths(fence.machine, false),
87
- subpaths(readable),
88
- ")",
89
- ";; Writing: its own folders, the module's home, TMPDIR and caches, the devices.",
90
- "(deny file-write*)",
91
- "(allow file-write*",
92
- subpaths(writable),
93
- ' (literal "/dev/null") (literal "/dev/zero") (literal "/dev/tty") (literal "/dev/dtracehelper")',
94
- ' (regex #"^/dev/fd/")',
95
- ")",
96
- ...darwinToolCaches(userDirs),
97
- ";; The code record is the harness's. (A wildcard deny does not override an allow of one operation: each is named.)",
98
- ...(fence.deny.length > 0 ? [`(deny file-read-data file-read-xattr file-write*${fence.deny.map((path) => ` (literal ${sbplString(real(path))})`).join("")})`] : []),
99
- ";; No Unix socket outside its folders: the Docker daemon, an SSH agent, the person's services.",
100
- "(deny network-outbound (remote unix-socket))",
101
- `(allow network-outbound (remote unix-socket (path-literal "/private/var/run/mDNSResponder")) (remote unix-socket (subpath ${sbplString(real(fence.cwd))}))${writable.map((path) => ` (remote unix-socket (subpath ${sbplString(real(path))}))`).join("")})`,
102
- ";; Signals and process information: only within this sandbox.",
103
- "(deny signal)",
104
- "(allow signal (target same-sandbox))",
105
- "(deny process-info*)",
106
- "(allow process-info* (target same-sandbox))",
107
- "(allow process-info-pidinfo process-info-setcontrol (target self))",
108
- "",
109
- ].join("\n");
110
- }
111
- /** macOS's per-user temporary and cache folders, as `getconf` gives them - asked once. */
112
- let darwinDirs;
113
- export function darwinUserDirs() {
114
- if (darwinDirs !== undefined)
115
- return darwinDirs;
116
- const ask = (name) => {
117
- if (process.platform !== "darwin")
118
- return undefined;
119
- const run = spawnSync("getconf", [name], { encoding: "utf8", timeout: 5000 });
120
- const dir = run.status === 0 ? run.stdout.trim().replace(/\/$/, "") : "";
121
- return dir !== "" ? real(dir) : undefined;
122
- };
123
- darwinDirs = { temp: ask("DARWIN_USER_TEMP_DIR"), cache: ask("DARWIN_USER_CACHE_DIR") };
124
- return darwinDirs;
125
- }
126
- /**
127
- * The developer tools' own scratch files on macOS: `xcrun` (behind `/usr/bin/git`, `clang`, `make`) keeps a database in
128
- * the per-user temporary folder, and clang its module cache in the per-user cache folder - whatever TMPDIR says.
129
- */
130
- function darwinToolCaches({ temp, cache }) {
131
- const rules = [];
132
- const regex = (path) => path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
133
- if (temp !== undefined)
134
- rules.push(`(allow file-read-data file-write* (regex #"^${regex(temp)}/xcrun_db"))`);
135
- if (cache !== undefined)
136
- rules.push(`(allow file-read-data file-write* (subpath ${sbplString(join(cache, "clang"))}) (subpath ${sbplString(join(cache, "com.apple.dt.xcrun"))}))`);
137
- return rules.length > 0 ? [";; The developer tools' own scratch files.", ...rules] : [];
138
- }
139
- /** The bubblewrap arguments for a fence, up to the command. `proc: "bind"` binds the host's /proc where mounting one is refused. */
140
- export function bubblewrapArgs(fence, options = { proc: "mount" }) {
141
- const args = ["--die-with-parent", "--unshare-pid", "--unshare-ipc", "--unshare-uts", "--unshare-cgroup-try"];
142
- for (const path of fence.machine)
143
- args.push("--ro-bind-try", path, path);
144
- args.push(...(options.proc === "mount" ? ["--proc", "/proc"] : ["--ro-bind", "/proc", "/proc"]));
145
- args.push("--dev", "/dev", "--tmpfs", "/tmp");
146
- for (const path of fence.read)
147
- args.push("--ro-bind", real(path), real(path));
148
- for (const path of [...fence.write, ...fence.writable])
149
- args.push("--bind", real(path), real(path));
150
- // The record: covered by an empty file, unreadable and unwritable.
151
- for (const path of fence.deny)
152
- if (existsSync(path))
153
- args.push("--ro-bind", "/dev/null", real(path));
154
- args.push("--chdir", real(fence.cwd));
155
- return args;
156
- }
157
- /** The caps, set inside the sandbox, then the command itself. */
158
- function capped(argv) {
159
- const caps = `ulimit -S -u ${PROCESS_CAP} 2>/dev/null; ulimit -S -f ${FILE_SIZE_CAP_BLOCKS} 2>/dev/null; exec "$@"`;
160
- return ["/bin/bash", "-c", caps, "turri", ...argv];
161
- }
162
- /** How a command is run behind the wall that is up: for the host runner's `wrap`. Where none is, it runs as it is. */
163
- export function sandboxWrap(wall, fence) {
164
- if (wall.kind === "seatbelt")
165
- return (argv) => ["/usr/bin/sandbox-exec", "-p", seatbeltProfile(fence), ...capped(argv)];
166
- if (wall.kind === "bubblewrap")
167
- return (argv) => ["bwrap", ...bubblewrapArgs(fence, { proc: wall.proc }), "--", ...capped(argv)];
168
- return (argv) => argv;
169
- }
170
- /** What bubblewrap's refusal to start says is missing, and how to give it - each failure has a message of its own. */
171
- export function whyBubblewrapFailed(output) {
172
- if (/ENOENT|not found|No such file or directory: 'bwrap'|spawnSync bwrap/i.test(output) && !/Can't mount/.test(output)) {
173
- return { why: "bubblewrap is not installed", fix: "install it: `apt install bubblewrap` (or your distribution's package)" };
174
- }
175
- if (/Creating new namespace failed: Operation not permitted|No permissions to create a new namespace/.test(output)) {
176
- return {
177
- why: "this machine does not let an unprivileged process create a user namespace",
178
- fix: "in Docker, run the container as a user that is not root (`--user`), with `--security-opt seccomp=unconfined`; on the host, `sysctl -w kernel.unprivileged_userns_clone=1`",
179
- };
180
- }
181
- if (/setting up uid map: Permission denied|Failed to make \/ slave: Permission denied/.test(output)) {
182
- return {
183
- why: "AppArmor keeps bubblewrap from setting up its namespace",
184
- fix: "in Docker, add `--security-opt apparmor=unconfined`; on Ubuntu 24.04, `sysctl -w kernel.apparmor_restrict_unprivileged_userns=0` or an AppArmor profile for bwrap",
185
- };
186
- }
187
- if (/Can't mount proc on (\/newroot)?\/proc/.test(output)) {
188
- return { why: "the container masks /proc", fix: "in Docker, add `--security-opt systempaths=unconfined`" };
189
- }
190
- return { why: `bubblewrap did not start: ${output.trim().split("\n")[0] ?? "no reason given"}` };
191
- }
192
- let probed;
193
- /** For tests: forget what was found, or say what to find. */
194
- export function setSandboxForTests(wall) {
195
- probed = wall;
196
- }
197
- /**
198
- * Which wall is up on this machine - tried once, by starting a sandbox that runs `true` - and, when none starts, why
199
- * and how to give it one.
200
- */
201
- export function sandboxAvailable() {
202
- if (probed !== undefined)
203
- return probed;
204
- probed = probe();
205
- return probed;
206
- }
207
- /** Which wall would be up with `env`'s PATH - doctor's for a host whose engine runs with another PATH; tried each time. */
208
- export function sandboxWith(env) {
209
- return env === process.env ? sandboxAvailable() : probe(env);
210
- }
211
- /** Which wall would be up with `env`'s PATH, as `sandboxWith` finds - its probes run without holding the thread up. */
212
- export async function sandboxWithAsync(env = process.env) {
213
- if (env === process.env && probed !== undefined)
214
- return probed;
215
- const settled = noProbe();
216
- let wall;
217
- if (settled !== undefined)
218
- wall = settled;
219
- else if (process.platform === "darwin")
220
- wall = seatbeltWall(await spawnAsync(SEATBELT_PROBE[0], SEATBELT_PROBE.slice(1), { timeout: 10_000 }));
221
- else {
222
- const mounted = await spawnAsync("bwrap", bubblewrapProbe("mount"), { timeout: 10_000, env });
223
- wall = bubblewrapWall(mounted, needsBind(mounted) ? await spawnAsync("bwrap", bubblewrapProbe("bind"), { timeout: 10_000, env }) : undefined);
224
- }
225
- if (env === process.env)
226
- probed = wall;
227
- return wall;
228
- }
229
- function probe(env = process.env) {
230
- const settled = noProbe();
231
- if (settled !== undefined)
232
- return settled;
233
- if (process.platform === "darwin")
234
- return seatbeltWall(spawnSync(SEATBELT_PROBE[0], SEATBELT_PROBE.slice(1), { encoding: "utf8", timeout: 10_000 }));
235
- const tryProc = (proc) => spawnSync("bwrap", bubblewrapProbe(proc), { encoding: "utf8", timeout: 10_000, env });
236
- const mounted = tryProc("mount");
237
- return bubblewrapWall(mounted, needsBind(mounted) ? tryProc("bind") : undefined);
238
- }
239
- /** The wall where nothing need be run to tell: no Seatbelt to try, or a platform turri drives none on. */
240
- function noProbe() {
241
- if (process.platform === "darwin")
242
- return existsSync("/usr/bin/sandbox-exec") ? undefined : { kind: "none", why: "this macOS has no sandbox-exec (Seatbelt)" };
243
- if (process.platform === "linux")
244
- return undefined;
245
- if (process.platform === "win32")
246
- return { kind: "none", why: "Windows has no OS sandbox turri drives: the command check and the audit hold alone" };
247
- return { kind: "none", why: `${process.platform} has no OS sandbox turri drives` };
248
- }
249
- /** A sandbox that runs `true`, on macOS. */
250
- const SEATBELT_PROBE = ["/usr/bin/sandbox-exec", "-p", "(version 1)(allow default)", "/usr/bin/true"];
251
- function seatbeltWall(run) {
252
- return run.status === 0 ? { kind: "seatbelt" } : { kind: "none", why: `Seatbelt did not start: ${(run.stderr || String(run.error ?? "")).trim()}` };
253
- }
254
- /** bubblewrap's arguments for a sandbox that runs `true`, its /proc mounted or bound. */
255
- function bubblewrapProbe(proc) {
256
- return ["--ro-bind", "/", "/", ...(proc === "mount" ? ["--proc", "/proc"] : ["--ro-bind", "/proc", "/proc"]), "--dev", "/dev", "--unshare-pid", "--", "true"];
257
- }
258
- const probeOutput = (run) => `${run.stderr ?? ""}${run.error !== undefined ? String(run.error) : ""}`;
259
- /** Whether bubblewrap failed only to mount a /proc - tried again binding the host's. */
260
- function needsBind(mounted) {
261
- return mounted.status !== 0 && /Can't mount proc on (\/newroot)?\/proc/.test(probeOutput(mounted));
262
- }
263
- function bubblewrapWall(mounted, bound) {
264
- if (mounted.status === 0)
265
- return { kind: "bubblewrap", proc: "mount" };
266
- if (bound?.status === 0)
267
- return { kind: "bubblewrap", proc: "bind" };
268
- return { kind: "none", ...whyBubblewrapFailed(probeOutput(mounted)) };
269
- }
270
- /** Whether `path` is one of the fence's roots or under one - for the tests and the audit. */
271
- export function underAny(path, roots) {
272
- const target = real(path);
273
- return roots.some((root) => {
274
- const base = real(root);
275
- return target === base || target.startsWith(base + sep);
276
- });
277
- }
278
- /** Where the agents' commands run, in one line for the person: which walls are up, or that only the shared ones are. */
279
- export function sandboxSummary(wall = sandboxAvailable()) {
280
- if (wall.kind === "none")
281
- return { level: "limited", text: `agents' commands run on this machine behind the command check and the audit - no OS sandbox: ${wall.why} (turri doctor)` };
282
- return { level: "ok", text: `agents' commands run on this machine behind the command check, ${wall.kind === "seatbelt" ? "Seatbelt" : "bubblewrap"} and the audit` };
283
- }
@@ -1,23 +0,0 @@
1
- /** The columns the panel takes beside the chat: half of what they share, the rule between them in the middle - 0 when that is too narrow to share. */
2
- export declare function dockedWidth(columns: number): number;
3
- /**
4
- * The chat narrowed by `panelWidth()` columns, read at each frame - 0 gives it the whole width. Returns what gives it the
5
- * whole width back for good.
6
- */
7
- export declare function narrowChat(tui: object, panelWidth: () => number): () => void;
8
- /**
9
- * A press of a mouse button, as pi's full screen takes it - `side` told whether it was in the chat, left of `chatWidth()`
10
- * columns, or in the panel - before the press goes on as it would have. Motion and the wheel are not presses. pi's
11
- * regular screen reads no mouse: nothing is done there. Returns what takes the watch off.
12
- */
13
- export declare function clickToFocus(tui: object, chatWidth: () => number, side: (side: "chat" | "panel") => void): () => void;
14
- /**
15
- * A line drawn faint - the side that does not have the keys, in the shade. Faint (SGR 2) holds through a line's colours;
16
- * only a reset - SGR 0, or 22 - ends it, so it is set again after each one. A line holding an image is left as it is.
17
- */
18
- export declare function shade(line: string): string;
19
- /**
20
- * The chat in the shade while `shaded()`: each of its rows drawn faint as the screen lays the overlays over it - the
21
- * docked panel the last of them, which covers its own columns. Returns what takes the shade off.
22
- */
23
- export declare function shadeChat(tui: object, shaded: () => boolean): () => void;
@@ -1,110 +0,0 @@
1
- /** A module's code record and its tests' - `code/.turri.json`, `tests/.turri.json` (records.ts). */
2
- export declare const RECORD_FILE = ".turri.json";
3
- /** What a codebase started from, when it started from a base folder (base-folder.ts): beside the code record, never code. */
4
- export declare const BASE_RECORD_FILE = ".turri-base.json";
5
- /**
6
- * The ***plain standard library: import modules for generic pieces of software that ship with turri,
7
- * imported as `stdlib/backend/python-fastapi` - a reserved name (see plain/stdlib.ts).
8
- */
9
- export declare const STDLIB_DIR: string;
10
- /**
11
- * Where a module's generated code and tests live.
12
- *
13
- * Everything a module produces sits under `plain_modules/<module>/`, next to the specs it
14
- * came from and inside the project's own repository: `code/` holds the implementation and
15
- * its unit tests, `tests/` the black-box conformance tests - of every functionality built so
16
- * far, the required modules' included, organised however suits them.
17
- * The build state is written into `code/`, so what a codebase contains travels with that
18
- * codebase instead of living in a scratch directory that can be cleared without anyone
19
- * noticing the specs and the code have drifted apart.
20
- */
21
- /**
22
- * Whether `path` is `root` or inside it, in this machine's paths: on Windows a path is not under `C:\x` by starting
23
- * with `C:\x/`, and one on another drive is outside whatever its text.
24
- */
25
- export declare function isWithin(path: string, root: string): boolean;
26
- /**
27
- * A path written with `/` on every machine. A relative one is a name, as git and ***plain write one: shown, compared or
28
- * put in a diff - a file of a codebase, a .plain file from the project. An absolute one is a path handed to bash, which
29
- * on Windows is Git Bash, whose tools may read a backslash as an escape: Windows and Git Bash both take `C:/Users`.
30
- * Opening a file in turri still goes through `join`.
31
- */
32
- export declare function slashed(path: string): string;
33
- export declare const MODULES_DIR = "plain_modules";
34
- export declare function moduleDir(moduleName: string, cwd?: string): string;
35
- /** Implementation and unit tests: `plain_modules/<module>/code`. */
36
- export declare function defaultBuildDir(moduleName: string, cwd?: string): string;
37
- /**
38
- * The directory every module's output hangs off, `plain_modules` by default.
39
- *
40
- * Callers override this to build somewhere else - a sandbox, a test fixture - and the
41
- * layout underneath it stays the same.
42
- */
43
- /**
44
- * The project a spec belongs to: the nearest folder, from the spec's own up, that holds a
45
- * `config.turri.yaml`, a module's `config.turri.<module>.yaml`, the `config.yaml` turri read before it had a file of
46
- * its own, or a `plain_modules` - where its code is built, its config read, its testing scripts found. Without any, the
47
- * spec's own folder. So `plain/hubspot.plain`, beside `plain/config.turri.yaml` and `plain/plain_modules`, is built there,
48
- * wherever turri was started;
49
- * specs at the root of their project are built where they always were.
50
- */
51
- export declare function projectDirOf(plainFile: string): string;
52
- /** Whether a folder says it is a project: it holds a config file or `plain_modules/`. */
53
- export declare function isProjectDir(dir: string): boolean;
54
- export declare function modulesRoot(cwd?: string): string;
55
- export declare function buildDirUnder(root: string, moduleName: string): string;
56
- export declare function testsDirUnder(root: string, moduleName: string): string;
57
- /**
58
- * The `plain_modules` a directory sits in: what holds every module's code and tests. A
59
- * directory outside one - a sandbox, an explicit `--build-dir` - is its own root, so this
60
- * never silently widens to a whole disk.
61
- */
62
- export declare function modulesRootOf(dir: string): string;
63
- /**
64
- * `.turri` inside the modules root: what turri keeps beside the code - the package
65
- * caches, the modules' homes and temporary folders, the copies test runs happen in, the
66
- * outputs kept for read_output. Ignored by the project's history.
67
- */
68
- export declare function modulesScratchDir(dir: string): string;
69
- /** Make `path` inside the modules' scratch, which ignores itself. Returns `path`. */
70
- export declare function ensureInModulesScratch(dir: string, path: string): string;
71
- /** Where the project keeps what a launch puts out: `dist/`, beside `plain_modules`. */
72
- export declare const DIST_DIR = "dist";
73
- /**
74
- * Where a person tries a module: `<project>/dist/<module>`, the module's code as its last commit has
75
- * it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every launch.
76
- */
77
- export declare function distDirFor(projectDir: string, moduleName: string): string;
78
- /**
79
- * The project a directory belongs to: the one `plain_modules` sits in, when the directory is
80
- * inside it; otherwise the directory's parent for a build folder, or the directory itself.
81
- */
82
- export declare function projectRootOf(dir: string): string;
83
- /**
84
- * `.turri` in the project: the harness's own scratch space - copies to try things in,
85
- * saved agent sessions. Never part of the project's history, so it ignores itself - but for `skills/`, the
86
- * project's own skills.
87
- */
88
- export declare function scratchDir(dir: string): string;
89
- /**
90
- * Where a skill run keeps its state - the manifest an interrupted run resumes from, the evidence
91
- * each phase's gate is judged on: `.turri/runs/<skill>` in the project, beside the rest of
92
- * turri's scratch, ignored by the project's history like it.
93
- */
94
- export declare function skillRunDir(cwd: string, skillName: string): string;
95
- /**
96
- * What the scratch dir's .gitignore says: everything in it is ignored but `skills/` - the project's own skills
97
- * (skills.ts), which are written by hand and kept in its history.
98
- */
99
- export declare const SCRATCH_IGNORE = "*\n!skills/\n!skills/**\n";
100
- /** Make `path`, inside a scratch dir, and see that the scratch dir ignores itself, its skills apart. Returns `path`. */
101
- export declare function ensureInScratch(scratch: string, path: string): string;
102
- /** Where agent sessions are saved, so what an agent did can be read - and resumed - later. */
103
- export declare function sessionsDir(project: string): string;
104
- /**
105
- * Template search order, matching file_utils.get_template_directories: the plain file's
106
- * own directory first, then a sibling `template/` directory if there is one (where a
107
- * project keeps its import modules), then anything passed in, then PLAIN_TEMPLATE_DIRS.
108
- * A `stdlib/...` import is not looked for in them: it is turri's (see plain/stdlib.ts).
109
- */
110
- export declare function resolveTemplateDirs(plainFile: string, extra?: string[]): string[];
@@ -1,190 +0,0 @@
1
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- /** A module's code record and its tests' - `code/.turri.json`, `tests/.turri.json` (records.ts). */
5
- export const RECORD_FILE = ".turri.json";
6
- /** What a codebase started from, when it started from a base folder (base-folder.ts): beside the code record, never code. */
7
- export const BASE_RECORD_FILE = ".turri-base.json";
8
- /**
9
- * The ***plain standard library: import modules for generic pieces of software that ship with turri,
10
- * imported as `stdlib/backend/python-fastapi` - a reserved name (see plain/stdlib.ts).
11
- */
12
- export const STDLIB_DIR = join(dirname(dirname(dirname(fileURLToPath(import.meta.url)))), "stdlib");
13
- /**
14
- * Where a module's generated code and tests live.
15
- *
16
- * Everything a module produces sits under `plain_modules/<module>/`, next to the specs it
17
- * came from and inside the project's own repository: `code/` holds the implementation and
18
- * its unit tests, `tests/` the black-box conformance tests - of every functionality built so
19
- * far, the required modules' included, organised however suits them.
20
- * The build state is written into `code/`, so what a codebase contains travels with that
21
- * codebase instead of living in a scratch directory that can be cleared without anyone
22
- * noticing the specs and the code have drifted apart.
23
- */
24
- /**
25
- * Whether `path` is `root` or inside it, in this machine's paths: on Windows a path is not under `C:\x` by starting
26
- * with `C:\x/`, and one on another drive is outside whatever its text.
27
- */
28
- export function isWithin(path, root) {
29
- const from = relative(root, path);
30
- return from === "" || (from !== ".." && !from.startsWith(`..${sep}`) && !isAbsolute(from));
31
- }
32
- /**
33
- * A path written with `/` on every machine. A relative one is a name, as git and ***plain write one: shown, compared or
34
- * put in a diff - a file of a codebase, a .plain file from the project. An absolute one is a path handed to bash, which
35
- * on Windows is Git Bash, whose tools may read a backslash as an escape: Windows and Git Bash both take `C:/Users`.
36
- * Opening a file in turri still goes through `join`.
37
- */
38
- export function slashed(path) {
39
- return sep === "/" ? path : path.split(sep).join("/");
40
- }
41
- export const MODULES_DIR = "plain_modules";
42
- export function moduleDir(moduleName, cwd = process.cwd()) {
43
- return join(cwd, MODULES_DIR, moduleName);
44
- }
45
- /** Implementation and unit tests: `plain_modules/<module>/code`. */
46
- export function defaultBuildDir(moduleName, cwd = process.cwd()) {
47
- return join(moduleDir(moduleName, cwd), "code");
48
- }
49
- /**
50
- * The directory every module's output hangs off, `plain_modules` by default.
51
- *
52
- * Callers override this to build somewhere else - a sandbox, a test fixture - and the
53
- * layout underneath it stays the same.
54
- */
55
- /**
56
- * The project a spec belongs to: the nearest folder, from the spec's own up, that holds a
57
- * `config.turri.yaml`, a module's `config.turri.<module>.yaml`, the `config.yaml` turri read before it had a file of
58
- * its own, or a `plain_modules` - where its code is built, its config read, its testing scripts found. Without any, the
59
- * spec's own folder. So `plain/hubspot.plain`, beside `plain/config.turri.yaml` and `plain/plain_modules`, is built there,
60
- * wherever turri was started;
61
- * specs at the root of their project are built where they always were.
62
- */
63
- export function projectDirOf(plainFile) {
64
- const start = dirname(resolve(plainFile));
65
- for (let dir = start;; dir = dirname(dir)) {
66
- if (isProjectDir(dir))
67
- return dir;
68
- if (dirname(dir) === dir)
69
- return start;
70
- }
71
- }
72
- /** Whether a folder says it is a project: it holds a config file or `plain_modules/`. */
73
- export function isProjectDir(dir) {
74
- return existsSync(join(dir, "config.yaml")) || existsSync(join(dir, MODULES_DIR)) || hasModuleConfig(dir);
75
- }
76
- /** Whether a folder holds a config file - config.turri.yaml, a module's config.turri.<module>.yaml, or one in the old naming - which makes it a project too. */
77
- function hasModuleConfig(dir) {
78
- try {
79
- return readdirSync(dir).some((name) => /^config\..+\.yaml$/.test(name));
80
- }
81
- catch {
82
- return false;
83
- }
84
- }
85
- export function modulesRoot(cwd = process.cwd()) {
86
- return join(cwd, MODULES_DIR);
87
- }
88
- export function buildDirUnder(root, moduleName) {
89
- return join(root, moduleName, "code");
90
- }
91
- export function testsDirUnder(root, moduleName) {
92
- return join(root, moduleName, "tests");
93
- }
94
- /**
95
- * The `plain_modules` a directory sits in: what holds every module's code and tests. A
96
- * directory outside one - a sandbox, an explicit `--build-dir` - is its own root, so this
97
- * never silently widens to a whole disk.
98
- */
99
- export function modulesRootOf(dir) {
100
- const parts = resolve(dir).split(sep);
101
- const index = parts.lastIndexOf(MODULES_DIR);
102
- return index === -1 ? resolve(dir) : parts.slice(0, index + 1).join(sep);
103
- }
104
- /**
105
- * `.turri` inside the modules root: what turri keeps beside the code - the package
106
- * caches, the modules' homes and temporary folders, the copies test runs happen in, the
107
- * outputs kept for read_output. Ignored by the project's history.
108
- */
109
- export function modulesScratchDir(dir) {
110
- return join(modulesRootOf(dir), ".turri");
111
- }
112
- /** Make `path` inside the modules' scratch, which ignores itself. Returns `path`. */
113
- export function ensureInModulesScratch(dir, path) {
114
- return ensureInScratch(modulesScratchDir(dir), path);
115
- }
116
- /** Where the project keeps what a launch puts out: `dist/`, beside `plain_modules`. */
117
- export const DIST_DIR = "dist";
118
- /**
119
- * Where a person tries a module: `<project>/dist/<module>`, the module's code as its last commit has
120
- * it. Outside `plain_modules`, so no agent can reach it, and replaced whole by every launch.
121
- */
122
- export function distDirFor(projectDir, moduleName) {
123
- return join(projectDir, DIST_DIR, moduleName);
124
- }
125
- /**
126
- * The project a directory belongs to: the one `plain_modules` sits in, when the directory is
127
- * inside it; otherwise the directory's parent for a build folder, or the directory itself.
128
- */
129
- export function projectRootOf(dir) {
130
- const parts = resolve(dir).split(sep);
131
- const index = parts.lastIndexOf(MODULES_DIR);
132
- return index === -1 ? resolve(dir) : parts.slice(0, index).join(sep);
133
- }
134
- /**
135
- * `.turri` in the project: the harness's own scratch space - copies to try things in,
136
- * saved agent sessions. Never part of the project's history, so it ignores itself - but for `skills/`, the
137
- * project's own skills.
138
- */
139
- export function scratchDir(dir) {
140
- const parts = resolve(dir).split(sep);
141
- const index = parts.lastIndexOf(MODULES_DIR);
142
- const project = index === -1 ? dirname(resolve(dir)) : parts.slice(0, index).join(sep);
143
- return join(project, ".turri");
144
- }
145
- /**
146
- * Where a skill run keeps its state - the manifest an interrupted run resumes from, the evidence
147
- * each phase's gate is judged on: `.turri/runs/<skill>` in the project, beside the rest of
148
- * turri's scratch, ignored by the project's history like it.
149
- */
150
- export function skillRunDir(cwd, skillName) {
151
- const scratch = join(resolve(cwd), ".turri");
152
- return ensureInScratch(scratch, join(scratch, "runs", skillName));
153
- }
154
- /**
155
- * What the scratch dir's .gitignore says: everything in it is ignored but `skills/` - the project's own skills
156
- * (skills.ts), which are written by hand and kept in its history.
157
- */
158
- export const SCRATCH_IGNORE = "*\n!skills/\n!skills/**\n";
159
- /** Make `path`, inside a scratch dir, and see that the scratch dir ignores itself, its skills apart. Returns `path`. */
160
- export function ensureInScratch(scratch, path) {
161
- mkdirSync(path, { recursive: true });
162
- const ignore = join(scratch, ".gitignore");
163
- // One written before skills were kept here ignored them too: it is brought up to date.
164
- if (!existsSync(ignore) || readFileSync(ignore, "utf8") === "*\n")
165
- writeFileSync(ignore, SCRATCH_IGNORE);
166
- return path;
167
- }
168
- /** Where agent sessions are saved, so what an agent did can be read - and resumed - later. */
169
- export function sessionsDir(project) {
170
- const scratch = scratchDir(join(project, MODULES_DIR));
171
- return ensureInScratch(scratch, join(scratch, "sessions"));
172
- }
173
- /**
174
- * Template search order, matching file_utils.get_template_directories: the plain file's
175
- * own directory first, then a sibling `template/` directory if there is one (where a
176
- * project keeps its import modules), then anything passed in, then PLAIN_TEMPLATE_DIRS.
177
- * A `stdlib/...` import is not looked for in them: it is turri's (see plain/stdlib.ts).
178
- */
179
- export function resolveTemplateDirs(plainFile, extra = []) {
180
- const own = dirname(resolve(plainFile));
181
- const dirs = [own];
182
- const sibling = join(own, "template");
183
- if (existsSync(sibling))
184
- dirs.push(sibling);
185
- dirs.push(...extra.map((dir) => resolve(dir)));
186
- const fromEnv = process.env.PLAIN_TEMPLATE_DIRS;
187
- if (fromEnv)
188
- dirs.push(...fromEnv.split(delimiter).filter(Boolean).map((dir) => resolve(dir)));
189
- return [...new Set(dirs)];
190
- }
@@ -1,34 +0,0 @@
1
- import type { DiffPaint } from "./diff-view.ts";
2
- /** A colour's SGR parameters: 24-bit, or the nearest of the 256 where the terminal has no more. */
3
- export declare function sgr(hex: string, background: boolean, truecolor: boolean): string;
4
- /**
5
- * Neon, for what is shown to do what its spec says - regen's ◆: the design system's colour for what can be followed,
6
- * 12.2:1 on abyss. On a light surface, where neon is illegible (1.6:1 on white), blue whale, 12.9:1 on white.
7
- */
8
- export declare const BRAND_NEON: {
9
- light: string;
10
- dark: string;
11
- };
12
- /**
13
- * Pink, the one pink thing in a view - the banner's wordmark: 6.54:1 on abyss. On a light surface, where pink is
14
- * too pale (2.9:1 on white), eggplant, 9.9:1 on white.
15
- */
16
- export declare const BRAND_PINK: {
17
- light: string;
18
- dark: string;
19
- };
20
- /** Text in neon on a theme - blue whale on a light one - in as many colours as the terminal has. */
21
- export declare const brandNeon: (theme: {
22
- appearance?: "dark" | "light";
23
- getColorMode?(): string;
24
- }) => ((text: string) => string);
25
- /** Text in pink on a theme - eggplant on a light one - in as many colours as the terminal has. */
26
- export declare const brandPink: (theme: {
27
- appearance?: "dark" | "light";
28
- getColorMode?(): string;
29
- }) => ((text: string) => string);
30
- /** How a spec diff is painted on a theme: its palette by whether the theme is dark or light, in as many colours as the terminal has. */
31
- export declare function plainPaint(theme: {
32
- appearance?: "dark" | "light";
33
- getColorMode?(): string;
34
- }): DiffPaint;