@turri-dev/cli 0.4.3-next.8482fed → 0.4.3-next.853c640

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/README.md +26 -4
  2. package/dist/banner.js +259 -0
  3. package/dist/capture-cli.js +50 -68
  4. package/dist/chat-commands.js +6 -6
  5. package/dist/chat-models.js +17 -15
  6. package/dist/chat-tab-header.js +21 -9
  7. package/dist/chat-tabs.js +11 -7
  8. package/dist/chat-terminal.js +126 -64
  9. package/dist/chat-waiting.js +0 -20
  10. package/dist/cli-options.js +11 -7
  11. package/dist/cli-root.js +141 -0
  12. package/dist/cli.js +49 -55
  13. package/dist/conform-cli.js +4 -6
  14. package/dist/cultivate-cli.js +65 -97
  15. package/dist/doctor-cli.js +99 -0
  16. package/dist/drift-cli.js +2 -7
  17. package/dist/entry-renderers.js +107 -0
  18. package/dist/extension.js +14 -3344
  19. package/dist/init-config-cli.js +218 -0
  20. package/dist/launch-cli.js +55 -91
  21. package/dist/lineage-cli.js +2 -4
  22. package/dist/loop-cli.js +118 -237
  23. package/dist/panel-view.js +409 -0
  24. package/dist/parse-cli.js +5 -2
  25. package/dist/pi-launch.js +39 -13
  26. package/dist/pi-themes.js +21 -0
  27. package/dist/plain-code-blocks.js +1 -1
  28. package/dist/pointer-hover.js +4 -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 +2 -17
  34. package/dist/regenerate/side-panel.js +32 -5
  35. package/dist/regenerate/spec-map-view.js +3 -68
  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 +3 -3
  44. package/docs/capture.md +87 -152
  45. package/docs/chats.md +10 -7
  46. package/docs/claude-subscription.md +1 -1
  47. package/docs/config.md +8 -8
  48. package/docs/development.md +30 -64
  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/sandbox.md +2 -0
  54. package/docs/sentinel.md +13 -13
  55. package/docs/theming.md +2 -2
  56. package/docs/using.md +8 -8
  57. package/package.json +13 -31
  58. package/dist/ask.d.ts +0 -90
  59. package/dist/ask.js +0 -170
  60. package/dist/background-skills.d.ts +0 -56
  61. package/dist/background-skills.js +0 -129
  62. package/dist/bedrock-region.d.ts +0 -66
  63. package/dist/bedrock-region.js +0 -144
  64. package/dist/brand.d.ts +0 -13
  65. package/dist/btw.d.ts +0 -69
  66. package/dist/btw.js +0 -174
  67. package/dist/capture/agents.d.ts +0 -361
  68. package/dist/capture/agents.js +0 -332
  69. package/dist/capture/area.d.ts +0 -58
  70. package/dist/capture/area.js +0 -197
  71. package/dist/capture/assemble.d.ts +0 -122
  72. package/dist/capture/assemble.js +0 -452
  73. package/dist/capture/capture.d.ts +0 -116
  74. package/dist/capture/capture.js +0 -1228
  75. package/dist/capture/chat.d.ts +0 -29
  76. package/dist/capture/chat.js +0 -94
  77. package/dist/capture/checks.d.ts +0 -142
  78. package/dist/capture/checks.js +0 -643
  79. package/dist/capture/config.d.ts +0 -13
  80. package/dist/capture/config.js +0 -60
  81. package/dist/capture/interface.d.ts +0 -71
  82. package/dist/capture/interface.js +0 -199
  83. package/dist/capture/map.d.ts +0 -56
  84. package/dist/capture/map.js +0 -530
  85. package/dist/capture/progress.d.ts +0 -108
  86. package/dist/capture/progress.js +0 -234
  87. package/dist/capture/report.d.ts +0 -75
  88. package/dist/capture/report.js +0 -267
  89. package/dist/capture/scripts.d.ts +0 -26
  90. package/dist/capture/scripts.js +0 -33
  91. package/dist/capture/state.d.ts +0 -296
  92. package/dist/capture/state.js +0 -43
  93. package/dist/capture/trial.d.ts +0 -34
  94. package/dist/capture/trial.js +0 -89
  95. package/dist/capture-cli.d.ts +0 -1
  96. package/dist/chat-commands.d.ts +0 -17
  97. package/dist/chat-idle.d.ts +0 -7
  98. package/dist/chat-idle.js +0 -20
  99. package/dist/chat-models.d.ts +0 -22
  100. package/dist/chat-records.d.ts +0 -50
  101. package/dist/chat-records.js +0 -107
  102. package/dist/chat-scope.d.ts +0 -14
  103. package/dist/chat-scope.js +0 -15
  104. package/dist/chat-skills.d.ts +0 -17
  105. package/dist/chat-skills.js +0 -18
  106. package/dist/chat-tab-header.d.ts +0 -15
  107. package/dist/chat-tabs.d.ts +0 -20
  108. package/dist/chat-terminal.d.ts +0 -24
  109. package/dist/chat-ui.d.ts +0 -33
  110. package/dist/chat-waiting.d.ts +0 -67
  111. package/dist/chats.d.ts +0 -340
  112. package/dist/chats.js +0 -996
  113. package/dist/cli-options.d.ts +0 -24
  114. package/dist/cli.d.ts +0 -9
  115. package/dist/config-edit.d.ts +0 -83
  116. package/dist/config-edit.js +0 -391
  117. package/dist/config.d.ts +0 -428
  118. package/dist/config.js +0 -811
  119. package/dist/conform-cli.d.ts +0 -1
  120. package/dist/conformance-switch.d.ts +0 -25
  121. package/dist/conformance-switch.js +0 -86
  122. package/dist/cultivate-cli.d.ts +0 -1
  123. package/dist/doctor-tool.d.ts +0 -11
  124. package/dist/doctor-tool.js +0 -33
  125. package/dist/drift-cli.d.ts +0 -1
  126. package/dist/environment.d.ts +0 -37
  127. package/dist/environment.js +0 -109
  128. package/dist/extension.d.ts +0 -208
  129. package/dist/genome.d.ts +0 -77
  130. package/dist/genome.js +0 -288
  131. package/dist/graph.d.ts +0 -52
  132. package/dist/graph.js +0 -247
  133. package/dist/host-session.d.ts +0 -112
  134. package/dist/host-session.js +0 -103
  135. package/dist/host.d.ts +0 -40
  136. package/dist/host.js +0 -54
  137. package/dist/identity.d.ts +0 -7
  138. package/dist/identity.js +0 -75
  139. package/dist/init-config.d.ts +0 -169
  140. package/dist/init-config.js +0 -841
  141. package/dist/installed-providers.d.ts +0 -40
  142. package/dist/installed-providers.js +0 -98
  143. package/dist/jellyfish.d.ts +0 -40
  144. package/dist/judge.d.ts +0 -25
  145. package/dist/judge.js +0 -62
  146. package/dist/launch-agent.d.ts +0 -62
  147. package/dist/launch-agent.js +0 -339
  148. package/dist/launch-cli.d.ts +0 -1
  149. package/dist/launch-session.d.ts +0 -68
  150. package/dist/launch-session.js +0 -225
  151. package/dist/launch-tools.d.ts +0 -28
  152. package/dist/launch-tools.js +0 -72
  153. package/dist/launch-track.d.ts +0 -175
  154. package/dist/launch-track.js +0 -497
  155. package/dist/lineage-cli.d.ts +0 -1
  156. package/dist/loop-cli.d.ts +0 -35
  157. package/dist/loop-tools.d.ts +0 -103
  158. package/dist/loop-tools.js +0 -361
  159. package/dist/model-check.d.ts +0 -72
  160. package/dist/model-check.js +0 -162
  161. package/dist/module-report.d.ts +0 -9
  162. package/dist/new-project.d.ts +0 -10
  163. package/dist/new-project.js +0 -42
  164. package/dist/notice.d.ts +0 -115
  165. package/dist/notice.js +0 -61
  166. package/dist/parse-cli.d.ts +0 -1
  167. package/dist/parse-tool.d.ts +0 -9
  168. package/dist/parse-tool.js +0 -33
  169. package/dist/pi-launch.d.ts +0 -1
  170. package/dist/pi-settings.d.ts +0 -4
  171. package/dist/pi.d.ts +0 -248
  172. package/dist/pi.js +0 -889
  173. package/dist/picture-row.d.ts +0 -10
  174. package/dist/plain/check.d.ts +0 -63
  175. package/dist/plain/check.js +0 -236
  176. package/dist/plain/concepts.d.ts +0 -37
  177. package/dist/plain/concepts.js +0 -283
  178. package/dist/plain/cycles.d.ts +0 -21
  179. package/dist/plain/cycles.js +0 -190
  180. package/dist/plain/errors.d.ts +0 -26
  181. package/dist/plain/errors.js +0 -50
  182. package/dist/plain/files.d.ts +0 -47
  183. package/dist/plain/files.js +0 -161
  184. package/dist/plain/graph.d.ts +0 -107
  185. package/dist/plain/graph.js +0 -194
  186. package/dist/plain/highlight.d.ts +0 -43
  187. package/dist/plain/highlight.js +0 -196
  188. package/dist/plain/index.d.ts +0 -18
  189. package/dist/plain/index.js +0 -18
  190. package/dist/plain/liquid.d.ts +0 -22
  191. package/dist/plain/liquid.js +0 -124
  192. package/dist/plain/markdown.d.ts +0 -103
  193. package/dist/plain/markdown.js +0 -330
  194. package/dist/plain/module-concepts.d.ts +0 -32
  195. package/dist/plain/module-concepts.js +0 -80
  196. package/dist/plain/parser.d.ts +0 -163
  197. package/dist/plain/parser.js +0 -930
  198. package/dist/plain/plain.tmLanguage.json +0 -150
  199. package/dist/plain/project.d.ts +0 -48
  200. package/dist/plain/project.js +0 -155
  201. package/dist/plain/spec.d.ts +0 -152
  202. package/dist/plain/spec.js +0 -265
  203. package/dist/plain/stdlib.d.ts +0 -16
  204. package/dist/plain/stdlib.js +0 -48
  205. package/dist/plain/test-plain-file.d.ts +0 -59
  206. package/dist/plain/test-plain-file.js +0 -232
  207. package/dist/plain-code-blocks.d.ts +0 -14
  208. package/dist/plain-files.d.ts +0 -21
  209. package/dist/plain-files.js +0 -156
  210. package/dist/pointer-hover.d.ts +0 -12
  211. package/dist/question-dialog.d.ts +0 -55
  212. package/dist/questioning.d.ts +0 -55
  213. package/dist/questioning.js +0 -109
  214. package/dist/quiet.d.ts +0 -34
  215. package/dist/regenerate/activity.d.ts +0 -227
  216. package/dist/regenerate/activity.js +0 -250
  217. package/dist/regenerate/agent-env.d.ts +0 -51
  218. package/dist/regenerate/agent-env.js +0 -311
  219. package/dist/regenerate/agent-shell.d.ts +0 -54
  220. package/dist/regenerate/agent-shell.js +0 -121
  221. package/dist/regenerate/arbiter.d.ts +0 -68
  222. package/dist/regenerate/arbiter.js +0 -133
  223. package/dist/regenerate/audit.d.ts +0 -69
  224. package/dist/regenerate/audit.js +0 -212
  225. package/dist/regenerate/base-folder.d.ts +0 -70
  226. package/dist/regenerate/base-folder.js +0 -186
  227. package/dist/regenerate/cases.d.ts +0 -12
  228. package/dist/regenerate/cases.js +0 -149
  229. package/dist/regenerate/change-view.d.ts +0 -23
  230. package/dist/regenerate/change-view.js +0 -153
  231. package/dist/regenerate/chunk-plan.d.ts +0 -217
  232. package/dist/regenerate/chunk-plan.js +0 -937
  233. package/dist/regenerate/codebase.d.ts +0 -21
  234. package/dist/regenerate/codebase.js +0 -75
  235. package/dist/regenerate/command-check.d.ts +0 -66
  236. package/dist/regenerate/command-check.js +0 -577
  237. package/dist/regenerate/compaction.d.ts +0 -13
  238. package/dist/regenerate/compaction.js +0 -20
  239. package/dist/regenerate/confine.d.ts +0 -69
  240. package/dist/regenerate/confine.js +0 -311
  241. package/dist/regenerate/conform.d.ts +0 -66
  242. package/dist/regenerate/conform.js +0 -132
  243. package/dist/regenerate/conformance-agents.d.ts +0 -388
  244. package/dist/regenerate/conformance-agents.js +0 -1162
  245. package/dist/regenerate/conformance.d.ts +0 -191
  246. package/dist/regenerate/conformance.js +0 -1035
  247. package/dist/regenerate/conversation-writes.d.ts +0 -10
  248. package/dist/regenerate/conversation-writes.js +0 -100
  249. package/dist/regenerate/credentials.d.ts +0 -18
  250. package/dist/regenerate/credentials.js +0 -88
  251. package/dist/regenerate/debug-log.d.ts +0 -56
  252. package/dist/regenerate/debug-log.js +0 -236
  253. package/dist/regenerate/debugger.d.ts +0 -36
  254. package/dist/regenerate/debugger.js +0 -133
  255. package/dist/regenerate/delivery.d.ts +0 -2
  256. package/dist/regenerate/diagnose-job.d.ts +0 -2
  257. package/dist/regenerate/diagnose-job.js +0 -40
  258. package/dist/regenerate/diagnose.d.ts +0 -46
  259. package/dist/regenerate/diagnose.js +0 -92
  260. package/dist/regenerate/diff-view.d.ts +0 -64
  261. package/dist/regenerate/drift.d.ts +0 -120
  262. package/dist/regenerate/drift.js +0 -285
  263. package/dist/regenerate/environment-error.d.ts +0 -167
  264. package/dist/regenerate/environment-error.js +0 -342
  265. package/dist/regenerate/failure-reports.d.ts +0 -28
  266. package/dist/regenerate/failure-reports.js +0 -79
  267. package/dist/regenerate/job-log.d.ts +0 -30
  268. package/dist/regenerate/job-log.js +0 -105
  269. package/dist/regenerate/job-panel.d.ts +0 -122
  270. package/dist/regenerate/job-panel.js +0 -339
  271. package/dist/regenerate/jobs-tree.d.ts +0 -76
  272. package/dist/regenerate/jobs.d.ts +0 -231
  273. package/dist/regenerate/jobs.js +0 -522
  274. package/dist/regenerate/lanes.d.ts +0 -16
  275. package/dist/regenerate/lanes.js +0 -32
  276. package/dist/regenerate/launch.d.ts +0 -256
  277. package/dist/regenerate/launch.js +0 -689
  278. package/dist/regenerate/ledger-view.d.ts +0 -87
  279. package/dist/regenerate/ledger-view.js +0 -325
  280. package/dist/regenerate/ledger.d.ts +0 -368
  281. package/dist/regenerate/ledger.js +0 -357
  282. package/dist/regenerate/lineage.d.ts +0 -105
  283. package/dist/regenerate/lineage.js +0 -485
  284. package/dist/regenerate/list-arguments.d.ts +0 -21
  285. package/dist/regenerate/list-arguments.js +0 -121
  286. package/dist/regenerate/loop.d.ts +0 -423
  287. package/dist/regenerate/loop.js +0 -2087
  288. package/dist/regenerate/masking.d.ts +0 -19
  289. package/dist/regenerate/masking.js +0 -95
  290. package/dist/regenerate/model-names.d.ts +0 -33
  291. package/dist/regenerate/model-names.js +0 -92
  292. package/dist/regenerate/notes.d.ts +0 -159
  293. package/dist/regenerate/notes.js +0 -446
  294. package/dist/regenerate/os-sandbox.d.ts +0 -93
  295. package/dist/regenerate/os-sandbox.js +0 -283
  296. package/dist/regenerate/panel-dock.d.ts +0 -23
  297. package/dist/regenerate/paths.d.ts +0 -110
  298. package/dist/regenerate/paths.js +0 -190
  299. package/dist/regenerate/plain-palette.d.ts +0 -34
  300. package/dist/regenerate/prompt.d.ts +0 -230
  301. package/dist/regenerate/prompt.js +0 -741
  302. package/dist/regenerate/pulse-files.d.ts +0 -14
  303. package/dist/regenerate/pulse-files.js +0 -63
  304. package/dist/regenerate/records.d.ts +0 -132
  305. package/dist/regenerate/records.js +0 -327
  306. package/dist/regenerate/regenerate.d.ts +0 -106
  307. package/dist/regenerate/regenerate.js +0 -660
  308. package/dist/regenerate/regression.d.ts +0 -58
  309. package/dist/regenerate/regression.js +0 -188
  310. package/dist/regenerate/renames.d.ts +0 -42
  311. package/dist/regenerate/renames.js +0 -185
  312. package/dist/regenerate/requires.d.ts +0 -117
  313. package/dist/regenerate/requires.js +0 -377
  314. package/dist/regenerate/resources.d.ts +0 -57
  315. package/dist/regenerate/resources.js +0 -162
  316. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  317. package/dist/regenerate/scripts-being-written.js +0 -30
  318. package/dist/regenerate/self-check.d.ts +0 -29
  319. package/dist/regenerate/self-check.js +0 -119
  320. package/dist/regenerate/services.d.ts +0 -28
  321. package/dist/regenerate/services.js +0 -158
  322. package/dist/regenerate/shell.d.ts +0 -91
  323. package/dist/regenerate/shell.js +0 -320
  324. package/dist/regenerate/side-panel.d.ts +0 -62
  325. package/dist/regenerate/spec-map-view.d.ts +0 -147
  326. package/dist/regenerate/spec-map.d.ts +0 -160
  327. package/dist/regenerate/spec-map.js +0 -596
  328. package/dist/regenerate/spec-steps.d.ts +0 -180
  329. package/dist/regenerate/spec-steps.js +0 -729
  330. package/dist/regenerate/standing.d.ts +0 -28
  331. package/dist/regenerate/standing.js +0 -30
  332. package/dist/regenerate/state.d.ts +0 -21
  333. package/dist/regenerate/state.js +0 -10
  334. package/dist/regenerate/steering.d.ts +0 -56
  335. package/dist/regenerate/steering.js +0 -119
  336. package/dist/regenerate/stop-report.d.ts +0 -43
  337. package/dist/regenerate/stop-report.js +0 -160
  338. package/dist/regenerate/submit-work.d.ts +0 -44
  339. package/dist/regenerate/submit-work.js +0 -76
  340. package/dist/regenerate/test-kinds.d.ts +0 -85
  341. package/dist/regenerate/test-kinds.js +0 -171
  342. package/dist/regenerate/test-scripts.d.ts +0 -240
  343. package/dist/regenerate/test-scripts.js +0 -847
  344. package/dist/regenerate/testing-steps.d.ts +0 -52
  345. package/dist/regenerate/testing-steps.js +0 -129
  346. package/dist/regenerate/testing.d.ts +0 -150
  347. package/dist/regenerate/testing.js +0 -438
  348. package/dist/regenerate/transcript-view.d.ts +0 -21
  349. package/dist/regenerate/unit-gate.d.ts +0 -27
  350. package/dist/regenerate/unit-gate.js +0 -20
  351. package/dist/regenerate/unit-review.d.ts +0 -152
  352. package/dist/regenerate/unit-review.js +0 -361
  353. package/dist/regenerate/web.d.ts +0 -61
  354. package/dist/regenerate/web.js +0 -256
  355. package/dist/regenerate/workspace.d.ts +0 -12
  356. package/dist/regenerate/workspace.js +0 -99
  357. package/dist/regenerate-cli.d.ts +0 -1
  358. package/dist/reopen.d.ts +0 -29
  359. package/dist/reopen.js +0 -47
  360. package/dist/resume-line.d.ts +0 -5
  361. package/dist/review/live.d.ts +0 -72
  362. package/dist/review/live.js +0 -166
  363. package/dist/rules.d.ts +0 -20
  364. package/dist/rules.js +0 -47
  365. package/dist/run-report.d.ts +0 -88
  366. package/dist/run-report.js +0 -338
  367. package/dist/screen-padding.d.ts +0 -28
  368. package/dist/self-invocation.d.ts +0 -36
  369. package/dist/self-invocation.js +0 -137
  370. package/dist/sentinel-chat.d.ts +0 -19
  371. package/dist/sentinel-chat.js +0 -221
  372. package/dist/sentinel-check.d.ts +0 -36
  373. package/dist/sentinel-check.js +0 -78
  374. package/dist/sentinel.d.ts +0 -107
  375. package/dist/sentinel.js +0 -599
  376. package/dist/settings.d.ts +0 -45
  377. package/dist/settings.js +0 -378
  378. package/dist/setup.d.ts +0 -97
  379. package/dist/setup.js +0 -436
  380. package/dist/skill-progress.d.ts +0 -46
  381. package/dist/skill.d.ts +0 -102
  382. package/dist/skill.js +0 -147
  383. package/dist/skills.d.ts +0 -54
  384. package/dist/skills.js +0 -111
  385. package/dist/spawn-async.d.ts +0 -18
  386. package/dist/spawn-async.js +0 -35
  387. package/dist/stack.d.ts +0 -80
  388. package/dist/stack.js +0 -206
  389. package/dist/stdlib.d.ts +0 -43
  390. package/dist/stdlib.js +0 -118
  391. package/dist/surface.d.ts +0 -5
  392. package/dist/surface.js +0 -18
  393. package/dist/terminal-images.d.ts +0 -2
  394. package/dist/test-plain-files.d.ts +0 -41
  395. package/dist/test-plain-files.js +0 -172
  396. package/dist/tools.d.ts +0 -101
  397. package/dist/tools.js +0 -242
  398. package/dist/turri-versions.d.ts +0 -71
  399. package/genome/capture/capture.md +0 -26
  400. package/genome/capture/check-conventions.md +0 -5
  401. package/genome/capture/check-reference.md +0 -11
  402. package/genome/capture/concepts.md +0 -3
  403. package/genome/capture/divide.md +0 -9
  404. package/genome/capture/feature.md +0 -45
  405. package/genome/capture/interface.md +0 -9
  406. package/genome/capture/modules.md +0 -23
  407. package/genome/capture/outline.md +0 -11
  408. package/genome/capture/readability.md +0 -12
  409. package/genome/capture/reference.md +0 -10
  410. package/genome/capture/split.md +0 -9
  411. package/genome/capture/survey.md +0 -37
  412. package/genome/capture/trial.md +0 -18
  413. package/genome/capture/verify.md +0 -7
  414. package/genome/rules/bullet-continuation.md +0 -61
  415. package/genome/rules/concise-specs-examples.md +0 -460
  416. package/genome/rules/concise-specs-integration-examples.md +0 -281
  417. package/genome/rules/concise-specs.md +0 -80
  418. package/genome/rules/definitions.md +0 -107
  419. package/genome/rules/examples/integration-embedded-testing/run_conformance_tests_java.sh +0 -161
  420. package/genome/rules/examples/integration-embedded-testing/run_unittests_java.sh +0 -50
  421. package/genome/rules/exported-concepts.md +0 -39
  422. package/genome/rules/func-specs.md +0 -164
  423. package/genome/rules/impl-reqs.md +0 -68
  424. package/genome/rules/import-modules.md +0 -49
  425. package/genome/rules/integration-embedded-testing.md +0 -273
  426. package/genome/rules/integration-embedded.md +0 -171
  427. package/genome/rules/integration-standalone.md +0 -135
  428. package/genome/rules/integrations.md +0 -136
  429. package/genome/rules/linked-resources.md +0 -76
  430. package/genome/rules/module-structure.md +0 -112
  431. package/genome/rules/project-model.md +0 -69
  432. package/genome/rules/required-concepts.md +0 -44
  433. package/genome/rules/requires-modules.md +0 -81
  434. package/genome/rules/semantic-ids.md +0 -49
  435. package/genome/rules/stdlib.md +0 -37
  436. package/genome/rules/test-plain-files.md +0 -138
  437. package/genome/rules/test-reqs.md +0 -57
  438. package/genome/rules/turri-regeneration.md +0 -66
  439. package/genome/skills/analyze-2-func-specs/SKILL.md +0 -116
  440. package/genome/skills/analyze-func-specs/SKILL.md +0 -137
  441. package/genome/skills/break-down-func-spec/SKILL.md +0 -229
  442. package/genome/skills/consolidate-concepts/SKILL.md +0 -192
  443. package/genome/skills/convert-old-syntax/SKILL.md +0 -68
  444. package/genome/skills/convert-old-syntax/references/rubric.md +0 -11
  445. package/genome/skills/debug-specs/SKILL.md +0 -194
  446. package/genome/skills/implement-conformance-testing-script/SKILL.md +0 -247
  447. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_cypress.ps1 +0 -337
  448. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_golang.ps1 +0 -111
  449. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +0 -151
  450. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.ps1 +0 -103
  451. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +0 -146
  452. package/genome/skills/implement-unit-testing-script/SKILL.md +0 -171
  453. package/genome/skills/implement-unit-testing-script/assets/run_unittests_flutter.ps1 +0 -87
  454. package/genome/skills/implement-unit-testing-script/assets/run_unittests_golang.ps1 +0 -73
  455. package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +0 -82
  456. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.ps1 +0 -81
  457. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +0 -102
  458. package/genome/skills/implement-unit-testing-script/assets/run_unittests_react.ps1 +0 -87
  459. package/genome/skills/refactor-module/SKILL.md +0 -218
  460. package/genome/skills/resolve-section-ownership/SKILL.md +0 -64
  461. package/genome/skills/resolve-spec-conflict/SKILL.md +0 -102
  462. package/stdlib/backend/common.plain +0 -25
  463. package/stdlib/backend/conformance/common.plain +0 -12
  464. package/stdlib/backend/conformance/go-gin.plain +0 -9
  465. package/stdlib/backend/conformance/go-nethttp.plain +0 -9
  466. package/stdlib/backend/conformance/java-springboot.plain +0 -9
  467. package/stdlib/backend/conformance/python-django.plain +0 -9
  468. package/stdlib/backend/conformance/python-fastapi.plain +0 -9
  469. package/stdlib/backend/conformance/python-flask.plain +0 -9
  470. package/stdlib/backend/conformance/rust-axum.plain +0 -9
  471. package/stdlib/backend/conformance/typescript-express.plain +0 -9
  472. package/stdlib/backend/conformance/typescript-fastify.plain +0 -9
  473. package/stdlib/backend/conformance/typescript-nestjs.plain +0 -9
  474. package/stdlib/backend/go-gin.plain +0 -18
  475. package/stdlib/backend/go-nethttp.plain +0 -18
  476. package/stdlib/backend/java-springboot.plain +0 -19
  477. package/stdlib/backend/python-django.plain +0 -19
  478. package/stdlib/backend/python-fastapi.plain +0 -23
  479. package/stdlib/backend/python-flask.plain +0 -23
  480. package/stdlib/backend/rust-axum.plain +0 -17
  481. package/stdlib/backend/typescript-express.plain +0 -19
  482. package/stdlib/backend/typescript-fastify.plain +0 -19
  483. package/stdlib/backend/typescript-nestjs.plain +0 -19
  484. package/stdlib/cli/common.plain +0 -17
  485. package/stdlib/cli/conformance/common.plain +0 -11
  486. package/stdlib/cli/conformance/go-cobra.plain +0 -9
  487. package/stdlib/cli/conformance/go-flag.plain +0 -9
  488. package/stdlib/cli/conformance/java-picocli.plain +0 -9
  489. package/stdlib/cli/conformance/python-argparse.plain +0 -9
  490. package/stdlib/cli/conformance/python-click.plain +0 -9
  491. package/stdlib/cli/conformance/python-typer.plain +0 -9
  492. package/stdlib/cli/conformance/rust-clap.plain +0 -9
  493. package/stdlib/cli/conformance/typescript-commander.plain +0 -9
  494. package/stdlib/cli/go-cobra.plain +0 -14
  495. package/stdlib/cli/go-flag.plain +0 -14
  496. package/stdlib/cli/java-picocli.plain +0 -15
  497. package/stdlib/cli/python-argparse.plain +0 -18
  498. package/stdlib/cli/python-click.plain +0 -16
  499. package/stdlib/cli/python-typer.plain +0 -16
  500. package/stdlib/cli/rust-clap.plain +0 -14
  501. package/stdlib/cli/typescript-commander.plain +0 -17
  502. package/stdlib/frontend/angular.plain +0 -17
  503. package/stdlib/frontend/common.plain +0 -17
  504. package/stdlib/frontend/conformance/angular.plain +0 -5
  505. package/stdlib/frontend/conformance/common.plain +0 -11
  506. package/stdlib/frontend/conformance/react-vite.plain +0 -5
  507. package/stdlib/frontend/conformance/sveltekit-spa.plain +0 -5
  508. package/stdlib/frontend/conformance/vue-vite.plain +0 -5
  509. package/stdlib/frontend/react-vite.plain +0 -16
  510. package/stdlib/frontend/sveltekit-spa.plain +0 -16
  511. package/stdlib/frontend/vue-vite.plain +0 -16
  512. package/stdlib/lang/go.plain +0 -13
  513. package/stdlib/lang/java.plain +0 -12
  514. package/stdlib/lang/python.plain +0 -18
  515. package/stdlib/lang/rust.plain +0 -12
  516. package/stdlib/lang/typescript.plain +0 -13
  517. package/stdlib/library/common.plain +0 -15
  518. package/stdlib/library/conformance/common.plain +0 -9
  519. package/stdlib/library/conformance/go.plain +0 -9
  520. package/stdlib/library/conformance/java-gradle.plain +0 -9
  521. package/stdlib/library/conformance/java-maven.plain +0 -9
  522. package/stdlib/library/conformance/python.plain +0 -9
  523. package/stdlib/library/conformance/rust.plain +0 -9
  524. package/stdlib/library/conformance/typescript.plain +0 -9
  525. package/stdlib/library/go.plain +0 -12
  526. package/stdlib/library/java-gradle.plain +0 -13
  527. package/stdlib/library/java-maven.plain +0 -13
  528. package/stdlib/library/python.plain +0 -13
  529. package/stdlib/library/rust.plain +0 -12
  530. package/stdlib/library/typescript.plain +0 -15
@@ -1,273 +0,0 @@
1
- ---
2
- description: Rules for authoring the two test scripts that an embedded ***plain integration ships
3
- ---
4
-
5
- # Rules for embedded-integration test scripts
6
-
7
- When an embedded integration ships its two `test_scripts/` (unit, conformance), these rules apply on top of the contracts in the corresponding `implement-*-testing-script` skills. `project-model.md` covers the regenerating and testing workflow.
8
-
9
- ## Staging model (read this first)
10
-
11
- A module's code and unit tests live in `plain_modules/<module>/code`; its conformance tests live in one folder, `plain_modules/<module>/tests` — the module's whole conformance suite. turri runs both scripts on the person's machine, once per check: `bash run_unittests_<lang>.sh <build_folder>` decides whether the unit tests pass, and `bash run_conformance_tests_<lang>.sh <build_folder> <conformance_tests_folder>` (absolute paths) runs the whole conformance suite at once and decides whether the conformance tests pass. There is no prepare-environment script, so each script is self-contained.
12
-
13
- Embedded integrations need a runnable host project, so both scripts stage the generated code **inside the host codebase itself**. The conformance script additionally builds / installs the host and then runs the conformance suite from a scratch folder in the system temp directory (`/tmp/<lang>_conformance/`), because the conformance suite lives in a separate project.
14
-
15
- | Script | Where it operates | What it does to the host source tree |
16
- |--------|-------------------|---------------------------------------|
17
- | `run_unittests_<lang>` | Inside the host codebase | Copies `$1` into the module's package path under the host's source tree, then runs the module's unit tests + lint inside the host |
18
- | `run_conformance_tests_<lang>` | Inside the host codebase, then `/tmp/<lang>_conformance/` (system temp) | Same copy as above, then cleans and builds / installs the host project; copies `$2` (the conformance-tests folder) into the scratch directory, builds the conformance project, and runs the whole suite there against the host build it just installed |
19
-
20
- This deliberately writes into the host's `src/main/...` and `src/test/...` (or the language equivalent). Two consequences flow from that:
21
-
22
- - **The host codebase root must come from a configured env var** (`HOST_CODEBASE_ROOT` is the conventional name; declare it in the integration's configuration concept). Scripts never hardcode it
23
- - **The destructive-op scoping rule below becomes critical.** `rm -rf` must target only the module's own package path under the host's source tree, never the host's `src/main/`, `target/`, `node_modules/`, or `build/` at the project root
24
-
25
- This rule covers the **mechanics each script must obey** regardless of language: argument handling, exit codes, idempotency, path resolution, output parsing, and the "what NOT to put here" guard rails. The language-specific install / test commands come from the skills; the contract below is invariant.
26
-
27
- ## What the `.plain` file must declare
28
-
29
- The two scripts are generated from facts in the integration's spec. For an embedded integration, those facts cannot be inferred — they have to be **declared explicitly** in the right section, partitioned by which predefined concept they describe:
30
-
31
- - **Everything about `:UnitTests:`** — paths, approach, packages, framework, conventions, fixtures, mocking policy — lives in `***implementation reqs***`. Unit tests are part of the generated codebase, so requirements that shape them are implementation reqs (see [`impl-reqs.md`](impl-reqs.md))
32
- - **Everything about `:ConformanceTests:`** — paths, approach, packages, framework, execution command, pass criteria, mocking policy — lives in `***test reqs***`. Conformance tests are external to the generated codebase, so requirements that shape them are test reqs (see [`test-reqs.md`](test-reqs.md))
33
-
34
- The first group follows `impl-reqs.md`, the second `test-reqs.md`. The two groups are parallel — each predefined concept owns a complete authoring story in its own section.
35
-
36
- ### In `***implementation reqs***` — everything about `:UnitTests:`
37
-
38
- These reqs feed `run_unittests_<lang>`, and the copy step that `run_conformance_tests_<lang>` shares with it. At minimum, declare:
39
-
40
- 1. **Integration source path inside the host** — where `$1/<source>/*` gets copied to. Example: `src/main/java/com/example/integrations/foo`
41
- 2. **`:UnitTests:` source path inside the host** — where `$1/<tests>/*` gets copied to, and where the test runner discovers unit tests. Example: `src/test/java/com/example/integrations/foo`
42
- 3. **Fully qualified `:UnitTests:` package** — the package the test runner uses to scope discovery via its filter argument. Example: `com.example.integrations.foo`
43
- 4. **`:UnitTests:` framework and conventions** — JUnit / pytest / Jest / Go's `testing` / etc., plus naming conventions (`*Test`, `test_*`, `*.test.ts`, …), fixture / mock / assertion style, file layout inside the test package
44
- 5. **Quality gates that run alongside `:UnitTests:`** — Checkstyle / ESLint / Pylint / Ruff / `go vet` / `cargo clippy` — whatever the host project requires
45
-
46
- Author the location facts as one tight group, phrased in terms of `:UnitTests:`:
47
-
48
- ```plain
49
- - :UnitTests: of :Implementation: live in `src/test/java/com/example/integrations/foo` inside the host codebase.
50
- - The corresponding integration source code lives in `src/main/java/com/example/integrations/foo`.
51
- - The fully qualified package used for :UnitTests: discovery is `com.example.integrations.foo`.
52
- - :UnitTests: use JUnit 5 with the host's Checkstyle profile applied via `mvn checkstyle:check`.
53
- ```
54
-
55
- These facts feed directly into the unit-test script body, and into the staging step of the conformance script:
56
-
57
- ```bash
58
- # clean existing code from the host
59
- rm -rf $MAIN_PROJECT_FOLDER/<integration source path>/*
60
- rm -rf $MAIN_PROJECT_FOLDER/<:UnitTests: source path>/*
61
-
62
- # create destinations and copy generated code into the host
63
- mkdir -p $MAIN_PROJECT_FOLDER/<integration source path>
64
- mkdir -p $MAIN_PROJECT_FOLDER/<:UnitTests: source path>
65
- cp -R $1/<integration source path>/* $MAIN_PROJECT_FOLDER/<integration source path>
66
- cp -R $1/<:UnitTests: source path>/* $MAIN_PROJECT_FOLDER/<:UnitTests: source path>
67
-
68
- # run :UnitTests: scoped to the integration's package
69
- mvn test -Dtest='<:UnitTests: package>.**.*Test' checkstyle:check
70
- ```
71
-
72
- ### In `***test reqs***` — everything about `:ConformanceTests:`
73
-
74
- These reqs feed `run_conformance_tests_<lang>`. At minimum, declare:
75
-
76
- 1. **`:ConformanceTests:` source location** — the generated suite lives in one folder, `plain_modules/<module>/tests/`, which holds the module's whole conformance suite; turri passes its absolute path as `$2`
77
- 2. **`:ConformanceTests:` framework and execution command** — `mvn test --no-transfer-progress`, `pytest`, `npm test`, `go test ./...`, etc., with any flags / profiles the project requires
78
- 3. **Fully qualified `:ConformanceTests:` package** (or path / pattern) used to scope discovery, if the runner needs one
79
- 4. **`:ConformanceTests:` network and secrets policy** — by default the suite runs against the **live provider** (see [`integrations.md`](integrations.md) → *`:ConformanceTests:` always run against the live integration*). Declare the env-var names the script reads (e.g. `<PROVIDER>_API_KEY`), whether the script loads a `.env` file before running, and any specific endpoints that are mocked because they can't be exercised live safely (429, forced 5xx)
80
- 5. **`:ConformanceTests:` pass criteria** — the strict criteria from [*Pass criteria (strict)*](#pass-criteria-strict): at least one test ran AND zero failures / errors / skipped. Reaffirm this in the ***plain so the script's author knows the runner must parse the test tool's stdout
81
- 6. **`:ConformanceTests:` build / install needs** — anything the conformance project needs before `mvn test` (or equivalent) will work: the host build / install command the script runs first, dependencies, fixtures, schema files, generated stubs
82
-
83
- Author the conformance facts as one or more entries, phrased in terms of `:ConformanceTests:`:
84
-
85
- ```plain
86
- - :ConformanceTests: of :Implementation: live in `plain_modules/foo/tests/` and are implemented with JUnit 5 + Maven.
87
- - The fully qualified package used for :ConformanceTests: discovery is `com.example.integrations.foo.conformance`.
88
- - :ConformanceTests: are run via `mvn test --no-transfer-progress`; the host's Surefire plugin must be installed.
89
- - :ConformanceTests: run against the live :ProviderName: sandbox — no mocking of provider calls.
90
- - The conformance script reads `<PROVIDER>_API_KEY` (and any additional secrets) from the shell or from a `.env` file at the project root and fails fast (exit `69`) if any required var is missing after the optional `.env` load.
91
- - The 429 (rate-limit) and forced-5xx paths use a local mock for that specific endpoint; every other path is live.
92
- - :ConformanceTests: pass only when the Surefire summary line shows at least one test ran with zero failures, zero errors, and zero skipped.
93
- ```
94
-
95
- These facts feed directly into the conformance script body:
96
-
97
- ```bash
98
- # stage $1 into the host (same copy as run_unittests), then build / install the host
99
- rm -rf ./target
100
- mvn clean install -DskipTests
101
-
102
- # stage :ConformanceTests: source into the scratch directory
103
- find "$DIR" -mindepth 1 -exec rm -rf {} +
104
- cp -R $2/* $DIR
105
- cd $DIR
106
-
107
- # build the conformance project, then run :ConformanceTests:
108
- mvn clean install -DskipTests
109
- output=$(mvn test --no-transfer-progress 2>&1)
110
-
111
- # parse Surefire summary against the declared pass criteria, then exit accordingly
112
- ```
113
-
114
- ### Rules common to both sections
115
-
116
- - **The paths must agree across reqs.** The `:UnitTests:` source path, the `:UnitTests:` package, and the integration source path describe the same module from three angles. Same for the `:ConformanceTests:` location and its package. A mismatch (e.g. test path `src/test/java/com/example/foo` but test package `com.example.bar`) silently produces a green build with stale or zero tests
117
- - **Paths are host-relative**, not absolute. `MAIN_PROJECT_FOLDER` comes from `HOST_CODEBASE_ROOT` (declared in the configuration concept); the paths above join onto it
118
- - **The coding agent's output folder `$1` mirrors the same layout.** `$1/<integration source path>/*` exists because the coding agent emits the generated code into the same package directories it'll be copied into — the `cp -R` is a straight overlay, not a path translation
119
- - **Each fact lives in one place.** If two `***implementation reqs***` entries declare slightly different `:UnitTests:` paths (or two `***test reqs***` entries declare slightly different `:ConformanceTests:` packages), the coding agent can't tell which to use. Author each group as a tight cluster (one bullet with sub-bullets) so a future reviewer sees them together
120
- - **Never duplicate a fact across sections.** `:UnitTests:` facts belong **only** in `***implementation reqs***`; `:ConformanceTests:` facts belong **only** in `***test reqs***`. The two groups never overlap — the agents read each from its own section
121
- - **For non-Java languages**, the facts have language-specific equivalents — Python: `src/foo/`, `tests/foo/`, `tests.foo`; Node: `src/foo/`, `test/foo/`, `test/foo/**/*.test.ts`. The `implement-*-testing-script` skills know the mapping per language, but the ***plain still has to declare the host-relative paths and packages so the skill knows what to put in the script bodies
122
-
123
- ## Common contract (both scripts)
124
-
125
- Both scripts are invoked by turri with positional arguments, on the person's machine. They MUST:
126
-
127
- 1. **Be Bash (`.sh`) on every OS.** turri runs only `.sh` scripts, with the `bash` on the person's PATH - macOS's own bash 3.2, Linux's, Git Bash on Windows - so the script keeps to what all three have (the testing-script skills' *Bash specifics* list it). A PowerShell (`.ps1`) copy is only for a person running it by hand. Executable, idempotent — re-running with the same inputs produces the same result
128
- 2. **Validate every positional argument up front.** Exit with a clear `Usage:` line on bad args. Conventional exit codes (consistent with the shared testing-script rules):
129
- - `1` — bad arguments / usage error (and "no tests discovered" for the conformance runner)
130
- - `2` — missing or inaccessible input folder
131
- - `69` — unrecoverable environment failure (missing toolchain, cannot enter working folder, install failed)
132
- - Any other non-zero code — propagated verbatim from the underlying build / test tool
133
-
134
- turri passes `$1` (and `$2` for the conformance runner) as **absolute paths** (older harnesses passed relative ones). Never build a derived path by concatenating a raw argument (`.tmp/$1`, `<lang>_$1`, `$current_dir/$2`) — with an absolute argument that produces a doubled path (`/project//abs/path/...`). Use the argument as-is where a path is needed, take its `basename` when naming a scratch folder, and resolve `$2` to absolute with `$(cd "$2" && pwd)` before any `cd` - never by testing for a leading `/`, as on Windows turri passes `C:/Users/...`. Quote every path: a Windows home has spaces in it
135
- 3. **Echo the toolchain home at the top** — the first thing a developer checks when CI breaks. For Java: `JAVA_HOME`. For Python: the active interpreter (`python --version` / `command -v python`). For Node: `node --version`. For Go: `go env GOROOT`. Pick the variable whose value most often explains "why does it work locally but not on the CI runner?"
136
- 4. **Respect `VERBOSE=1`.** Gate chatty diagnostic prints behind `if [ "${VERBOSE:-}" = "1" ]` (and the PowerShell equivalent). Errors and key step markers print unconditionally
137
- 5. **Resolve paths relative to the script, not `$PWD`.** Use `"$(cd "$(dirname "$0")/<relative-path-to-anchor>" && pwd)"`. Hard-coded `../../` chains break the moment turri's `cwd` changes
138
- 6. **Create destination directories before copying.** `mkdir -p` before any `cp -R` / `rsync` / `robocopy` — most copy commands do not create intermediate directories and fail silently in some shells
139
- 7. **Scope destructive operations narrowly.** Any `rm -rf` (or `Remove-Item -Recurse -Force`) targets only the module's own package path inside the working folder — never the host's `src/`, `target/`, `node_modules/`, `build/`, or `dist/` at the project root. The conformance script cleans the host's build-output directory (e.g. `./target`) only as part of its own build / install step, and removes its system-temp scratch folder on exit
140
- 8. **Print where you are before you `cd`.** `echo "Moving to: $DIR"` saves an hour of debugging when paths are wrong. PowerShell: `Write-Host "Moving to: $DIR"`
141
-
142
- ## 1. `run_unittests_<lang>` — copy into the host, then run unit tests there
143
-
144
- Receives one positional argument: the build output folder (`plain_modules/<module>/code/`, absolute).
145
-
146
- Purpose: stage the generated code **into the host codebase at the module's package path** and run the module's unit tests + language-appropriate quality gates against the host project from inside the host root.
147
-
148
- Required steps:
149
-
150
- 1. Validate `$1`
151
- 2. Resolve the host codebase root from the configured env var
152
- 3. `rm -rf` the module's main + test package directories under the host's source tree — both, because stale tests in the target package cause confusing failures
153
- 4. `mkdir -p` the destination directories and copy `$1/src/...` (or the language-equivalent layout) into the host's source tree at the module's package path
154
- 5. `cd` into the host codebase root, verify with an explicit exit-code check (`if [ $? -ne 0 ]` / `if (! $?) { ... }`)
155
- 6. Run the test command **scoped to the module's package only**:
156
- - Maven: `mvn test -Dtest='<fully.qualified.package>.**.*Test' <lint-check>:check`
157
- - pytest: `pytest tests/<module>/` (or whatever path matches the module)
158
- - Jest: `npm test -- --testPathPattern '<module>/'`
159
- - Go: `go test ./<module>/...`
160
- 7. Always include the host's lint / static-analysis gate in the same invocation when the build system has one (Checkstyle, ESLint, Pylint / Ruff, `go vet`, `cargo clippy`, …). Running tests without the lint gate produces a false-green when style violations would otherwise block the build
161
-
162
- Hard rules:
163
-
164
- - **Self-contained.** The script stages `$1` itself on every run; it never relies on another script having run first
165
- - **Never run the full test suite** when scoping is possible. A per-module script that runs the entire host's tests wastes minutes on every regeneration
166
-
167
- ## 2. `run_conformance_tests_<lang>` — copy into the host, build it, then run the external suite
168
-
169
- Receives two positional arguments: the build output folder (`$1`, `plain_modules/<module>/code/`) and the conformance-tests folder (`$2`, `plain_modules/<module>/tests/` — the module's whole conformance suite), both absolute.
170
-
171
- Purpose: stage the generated code into the host, build / install the host, and run the whole conformance suite in `$2` against that build. The conformance suite is a separate project that consumes the integration as a dependency from a local cache (`~/.m2`, `node_modules`, the language equivalent), so the script installs the host itself first — otherwise the suite links against whatever was last built, which may not be the most recent regenerated code. turri runs it once per check, and its exit code decides whether the conformance tests pass.
172
-
173
- Required steps:
174
-
175
- 1. Validate `$1` and `$2`. Resolve `$2` to an absolute path if it isn't one already (turri passes it absolute; older harnesses passed it relative to the invocation directory)
176
- 2. Resolve the host codebase root from the configured env var, `rm -rf` the module's main + test package directories under the host's source tree, `mkdir -p` the destination directories, and copy `$1/src/...` into the host's source tree at the module's package path — **the same staging as `run_unittests`**
177
- 3. `cd` into the host codebase root, verify with an explicit exit-code check
178
- 4. Clean the host's build-output directory before compiling — stale class / object files from a previous build cause confusing link-time mismatches when the contract has changed. Maven: `rm -rf ./target`. Cargo: `cargo clean -p <pkg>`. Go: `go clean -cache` (usually unnecessary, but mention if applicable). For npm projects with incremental builds disabled, wipe the relevant `dist/` / `build/` folder
179
- 5. Run the host's standard install / build command so the conformance project can resolve the integration — **skip the fat-artifact and skip tests** when the build system supports it, because the tests run afterwards. Exit `69` if it fails:
180
- - Maven: `mvn clean install -DskipTests` (plus any host-specific repackage-skip flag)
181
- - npm / pnpm / yarn: `npm ci` (no test script; dependency install only)
182
- - Python: `pip install -e .` (then any extra integration dependencies)
183
- - Go: `go mod tidy && go build ./...`
184
- - Cargo: `cargo fetch && cargo build --tests --no-run`
185
- 6. Stage `$2/*` into a scratch directory in the system temp directory (`/tmp/<lang>_conformance/` in Bash, the `GetTempPath()` equivalent in PowerShell). Wipe it first if it exists, and remove it again on exit (`trap 'rm -rf "$DIR"' EXIT` / `finally`). Use a deletion form that handles hidden files and odd shells safely:
186
- - Bash: `find "$DIR" -mindepth 1 -exec rm -rf {} +` (safer than `rm -rf "$DIR"/*`)
187
- - PowerShell: `Remove-Item -Recurse -Force "$DIR\*"` after confirming the path exists
188
- 7. `cd` into the scratch directory
189
- 8. Compile / set up the conformance project — exit early if this fails:
190
- - Maven: `mvn clean install -DskipTests`
191
- - npm: `npm ci`
192
- - Python: `pip install -r requirements.txt`
193
- - Go / Cargo: standard build
194
- 9. Run the whole conformance suite and **capture stdout to a variable**:
195
- - Bash: `output=$(mvn test --no-transfer-progress 2>&1)` (or the language equivalent)
196
- - PowerShell: `$output = & <cmd> 2>&1 | Out-String`
197
- 10. **Parse the captured output strictly** (see *Pass criteria* below) — don't trust the test tool's exit code alone
198
- 11. On the failure path: print the captured output unconditionally so turri (and the user) can see what failed
199
- 12. On the success path: print the output only if `VERBOSE=1`
200
-
201
- ### Secrets and `.env` handling
202
-
203
- `:ConformanceTests:` run against the live provider (per [`integrations.md`](integrations.md) → *`:ConformanceTests:` always run against the live integration*), so the conformance script needs the user's credentials at runtime.
204
-
205
- - **Credentials are read from environment variables** named in `***test reqs***` and the auth concept. Never from a literal, never from a file checked into the repo
206
- - **The script may optionally load a `.env` file** before running the suite. Typical pattern in Bash:
207
-
208
- ```bash
209
- ENV_FILE="${ENV_FILE:-$MAIN_PROJECT_FOLDER/.env}"
210
- if [ -f "$ENV_FILE" ]; then
211
- echo "Loading env from $ENV_FILE"
212
- set -a; . "$ENV_FILE"; set +a
213
- fi
214
- ```
215
-
216
- PowerShell uses the equivalent `Get-Content` + `Set-Item Env:` loop. Absence of `.env` is **not** an error — CI provides the same vars directly through the shell
217
- - **Verify required env vars exist after the optional `.env` load** and fail fast if any are missing:
218
-
219
- ```bash
220
- for var in PROVIDER_API_KEY PROVIDER_ACCOUNT_ID; do
221
- if [ -z "${!var:-}" ]; then
222
- printf "Error: %s is required for :ConformanceTests:\n" "$var" >&2
223
- exit 69
224
- fi
225
- done
226
- ```
227
-
228
- - **Export the resolved vars** (already in scope thanks to `set -a`) so child processes started by the test runner inherit them — Maven, pytest, npm, Go all read env vars from their parent process
229
- - **Never log credential values.** Echo the env-var **name** when reporting "loaded", not its value. Redact in any error path that dumps captured output
230
- - **Document the secret names twice** — once in the auth concept (for the runtime), once in `***test reqs***` for `:ConformanceTests:` (for the script). They must be the same names; a divergence means the script reads different credentials than the runtime does, and conformance silently tests the wrong account
231
-
232
- ### Pass criteria (strict)
233
-
234
- These are the **only** valid pass criteria. Anything outside this list is a failure:
235
-
236
- - At least one test ran AND zero failures AND zero errors AND zero skipped. Maven example: `Tests run: [1-9][0-9]*, Failures: 0, Errors: 0, Skipped: 0`. Each language's test runner has an equivalent summary line — match it with a regex, not by substring
237
- - Exit with the test tool's exit code on the success path (almost always `0`)
238
-
239
- Failure cases — each must be detected explicitly:
240
-
241
- - `Tests run: 0` (or the language equivalent) → **failure**. turri must never be told "green" when nothing ran. Exit `1` per the shared testing-script rules (the "no tests discovered" exit code)
242
- - Any non-zero `Failures:`, `Errors:`, or `Skipped:` count → **failure**. Dump the captured output and propagate the test tool's exit code
243
- - The test tool exited non-zero but the summary line shows `Tests run: 0` → still a `1` (no-tests-discovered), not the tool's own exit code
244
-
245
- **Why parse stdout instead of trusting the test tool's exit code.** Every major test runner returns `0` when zero test classes match a filter. Maven Surefire, pytest with no collected tests, `go test ./pkg/that/has/no/_test.go/files`, Jest with an empty pattern — all green-by-default. turri's contract is "tests must run AND must pass" — the exit code alone cannot express that.
246
-
247
- ## Cross-cutting rules
248
-
249
- - **No secrets in scripts.** Read credentials from env vars turri (or the user's shell) already sets. If a required env var is missing, fail fast with a clear `Error: $FOO is required for ...` and exit `69`. Never hardcode an API key, never read from a checked-in file
250
- - **Mirror the package / module path exactly.** A typo in the package segment (e.g. one wrong directory in `com/example/foo/...` or `host_pkg/foo/bar/...`) makes `rm -rf` silently do nothing and the subsequent copy put files in the wrong place. Both produce a **green** build with stale code. Derive the package path from the `host-codebase` concept; never retype it inline
251
- - **Don't add cleverness to the script that belongs in the build.** If you're tempted to `grep` the test output for more than the pass/fail summary, change the test or the test-runner config instead. The script is a thin contract — keep it that way
252
- - **Don't use shortcut profiles that skip quality gates.** Maven's `-Pfast`, Gradle's `-x check`, npm's `--ignore-scripts`, pytest's `--no-cov`, `-DskipTests` anywhere except the conformance script's two build / install steps (the host install and the conformance project's compile, where the tests run right after) — all defeat the purpose of these scripts. The build's full quality gate (tests + lint + coverage thresholds) must run for unit and conformance
253
- - **Failure messages are for humans.** `printf "Error: <what failed> at <where>\n"` then exit with the right code. No silent failures, no `|| true` to paper over errors, no `2>/dev/null` on commands whose stderr matters
254
- - **Use existing scripts as templates.** When you add a new embedded integration, copy from a known-good module, then search-and-replace only the package path and the test-filter argument. Resist the urge to "improve" structure mid-port — pattern-matching across many modules is a feature, not a bug
255
-
256
- ## Reference implementation (Java + Maven)
257
-
258
- A working two-script set for a Java / Maven embedded integration lives under [`examples/integration-embedded-testing/`](examples/integration-embedded-testing/) next to this file:
259
-
260
- - [`run_unittests_java.sh`](examples/integration-embedded-testing/run_unittests_java.sh) — stages `$1` into the host and runs `mvn test -Dtest='<module-pkg>.**.*Test' checkstyle:check`
261
- - [`run_conformance_tests_java.sh`](examples/integration-embedded-testing/run_conformance_tests_java.sh) — stages `$1` into the host the same way, cleans `target/`, runs `mvn clean install -DskipTests` in the host, then copies `$2` into `/tmp/java_conformance/` (system temp, removed again on exit), builds the conformance project, runs the suite, and parses the Surefire summary line per the strict pass criteria above
262
-
263
- Use them as a template when adding a new embedded integration in Java / Maven — copy, search-and-replace only the package segment and the `-Dtest` filter, then put them in the project's `test_scripts/`. For other languages (Python, Node.js, Go, Rust, …), the `implement-*-testing-script` skills generate the equivalent two-script set following the same contract.
264
-
265
- ## Adding a script for a new module
266
-
267
- 1. Copy the two scripts from a working embedded-integration module into the project's `test_scripts/`
268
- 2. Search-and-replace the package segment everywhere it appears — including the test-filter argument (the most commonly missed spot)
269
- 3. `chmod +x` both (Git Bash on Windows needs nothing; verify ACLs only for `.ps1` copies)
270
- 4. Do not link them from the ***plain: turri finds them in the project root - `config.turri.yaml` (`unittests-script:`, `conformance-tests-script:`), else the one of each kind in the root, else in `test_scripts/` - and shows them to the agents itself. If `test_scripts/` ends up with two scripts of one kind, name the one to use in `config.turri.yaml`.
271
- 5. Smoke-test by running each script manually with the build output folder as `$1` (and the conformance-tests folder as `$2` for the conformance runner). Confirm exit codes match what turri expects
272
-
273
- For non-Java languages, the skills [`implement-unit-testing-script`](../skills/implement-unit-testing-script/SKILL.md), and [`implement-conformance-testing-script`](../skills/implement-conformance-testing-script/SKILL.md) adapt the contract above to Python, Node.js, Go, Rust, Flutter, and others. Always route script creation through these skills so the cross-cutting rules above are applied uniformly.
@@ -1,171 +0,0 @@
1
- ---
2
- description: Rules for authoring ***plain for REST API integrations embedded into an existing host codebase
3
- ---
4
-
5
- # Rules for **embedded** integrations in ***plain
6
-
7
- When an integration `.plain` module is **embedded** — meaning the generated code in `plain_modules/` is consumed in-process by an existing host codebase as a library / module — these rules apply on top of the shared rules in [`integrations.md`](integrations.md). If anything below contradicts a guess made from memory, the rules here win.
8
-
9
- Embedded means: the host codebase already exists, has its own language / framework / dependency manager / packaging layout, and the integration must conform to all of that without negotiation.
10
-
11
- > **For test-script authoring**, also follow [`integration-embedded-testing.md`](integration-embedded-testing.md). It defines the per-script contract (`run_unittests_<lang>`, `run_conformance_tests_<lang>`) — staging into the host and the system temp directory, arg validation, exit codes, output parsing, the `***implementation reqs***` and `***test reqs***` entries the ***plain must declare so the scripts can be generated. This file (`integration-embedded.md`) only summarizes the test-script wiring; the testing rule is the source of truth.
12
-
13
- ## The host codebase dictates the tech stack (hard rule)
14
-
15
- - Language, framework, dependency manager, packaging layout, coding standards, error model, logging library, and architecture are **inherited** from the host — they are **never chosen** by the integration's ***plain
16
- - Do not re-ask the user about any of these in any phase — they are facts to be discovered from the host's manifest files (`pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, `pom.xml`, …) and other integrations.
17
- - If a stack question seems to push back on a host rule, treat the host as ground truth and rewrite the question
18
- - Implementation reqs added in the stack phase are **transcribed** from the host stack verbatim — host language and exact version, host framework + version, dependency manager and manifest path, packaging layout, host conventions the contract must follow, and every host-package version the contract pins
19
-
20
- ## Project layout — the integration lives under `plain/` at the host root
21
-
22
- The embedded integration's `.plain` files (and the rest of the ***plain project — `template/`, `resources/`, `test_scripts/`, generated `plain_modules/`) live in a single top-level `plain/` folder at the host repository root, alongside the host's own source tree:
23
-
24
- ```
25
- <host repo>/
26
- ├── docs/
27
- ├── plain/ # ← the embedded ***plain integration lives here
28
- │ ├── <module>.plain
29
- │ ├── template/
30
- │ ├── resources/
31
- │ ├── test_scripts/
32
- │ ├── plain_modules/ # generated; gitignored
33
- │ │ └── <module>/
34
- │ │ ├── code/ # implementation + unit tests
35
- │ │ └── tests/ # conformance tests: the module's whole suite
36
- └── src/ # host source tree (Java, Python, etc.)
37
- ```
38
-
39
- This keeps the integration self-contained in one directory the user can `cd` into to regenerate, while leaving the host's own source layout untouched.
40
-
41
- - If the host **already** has a `plain/` directory, adopt it verbatim — see step 1 of *Discover before you ask* below
42
- - If the host does **not** yet have one, create `plain/` at the repo root; do not invent a different name (`specs/`, `plain_specs/`, …)
43
- - The two test scripts still `cd` into `$HOST_CODEBASE_ROOT` (the host repo root) to compile and run tests against the host project; the `plain/` folder is the integration's **authoring** root, not its **runtime** root
44
-
45
- ## Discover before you ask
46
-
47
- Run host discovery **before** the first interview question. Treat the results as ground truth for everything that follows.
48
-
49
- 1. **Locate the host's `.plain` setup (if any).** Look for an existing `.plain` file or directory, a `plain_modules/`, a `resources/`, and a `test_scripts/`. If the host already has a `.plain` setup, **adopt it verbatim**: the new integration module lands inside the existing `plain_source_dir` and `requires` the relevant base module (following `requires-modules.md`). Do not create a parallel layout.
50
- 2. **Read every existing integration in the host.** For each one, extract: intent and scope, host base class / interface / protocol the integration subclasses or implements, package path and naming convention, configuration pattern (env vars, settings module, secret manager), error / exception hierarchy, logging / metrics / tracing conventions, testing pattern (live vs recorded vs mocked, fixture location, conformance-test layout). The new integration must follow the same patterns unless the user explicitly opts out.
51
- 3. **Capture findings in the `host-codebase` concept.** Cite the existing integration by file path so the reasoning is auditable. The concept holds, as facts:
52
- - Host codebase root (absolute or project-relative path)
53
- - Host language and exact version (from the manifest file)
54
- - Dependency manager and manifest file path (pip + `requirements.txt`, Poetry, uv, npm, pnpm, yarn, Go modules, Cargo, Maven, Gradle, …)
55
- - Package / module path inside the host where the integration will be consumed
56
- - Fully qualified import path of any host class / interface / struct / protocol the integration must conform to (e.g. `host_project.integrations.base.IntegrationContract`)
57
- - Host conventions (custom base classes, Pydantic major version, sync vs. async style, exception hierarchy, dependency-injection seams, logging library)
58
- - Target generated-class fully qualified name under `plain_modules/` (e.g. `plain_modules.integrations.<provider>.Client`) and the host base class it should subclass
59
- 4. **Only ask the user what the codebase cannot tell you.** The user's time goes into the third-party API itself (provider, docs, endpoints, edge cases, webhooks) and authentication / credentials. Everything else is a deduction. If a deduction is ambiguous (two existing integrations subclass two different base classes), surface the ambiguity with a single `ask_user` question that quotes both code locations — the question is about resolving a conflict the host already contains, not about asking the user to design the integration.
60
-
61
- ## Reference host symbols by fully qualified import path
62
-
63
- - Every host class, interface, struct, exception, or type alias that appears in the ***plain must be written with its full dotted / slashed import path (e.g. `host_project.integrations.base.IntegrationContract`, `@host/integrations#Contract`) and tagged in the ***plain's text as **"imported from the host codebase; do not redefine"**
64
- - The coding agent is allowed to redefine **only** symbols the host does not provide and the contract schema does not capture
65
- - Naming the symbol by FQN is not optional decoration — it tells the coding agent where the type comes from, which prevents a duplicate definition under `plain_modules/`
66
-
67
- ## Link host files at their original path — never copy them into `resources/`
68
-
69
- The integration's `.plain` module lives **inside the host codebase** (per the "adopt the host's `.plain` setup verbatim" step). That means host source files are already reachable as linked resources via their host-relative paths. The integration's ***plain references them **in place**; it never duplicates them under `resources/host/`.
70
-
71
- - Every host file the integration touches (base classes, configuration modules, registries, exception classes, lifecycle hooks) is referenced from the relevant ***plain using `***linked resource***` syntax with the **path as it exists in the host codebase** — e.g. `[base.py](host_project/integrations/base.py)` if the `.plain` module sits next to `host_project/`
72
- - **Do NOT copy host files into `resources/host/`.** A copy creates a second source of truth that drifts the moment the host file is edited; the regenerated code will then disagree with whatever the host actually ships
73
- - **Do NOT copy host files into `resources/`** when that would duplicate them — link the existing host path directly
74
- - **Never inline a host file's contents** into the ***plain
75
- - **Never describe a host symbol's shape from memory** — the coding agent reads the linked file's bytes at its host path and that is the source of truth
76
- - This still obeys the broader [`linked-resources.md`](linked-resources.md) rules: a directory is not a valid link, a URL is not a valid link, a binary is not a valid link. Only the *location* changes — host files live where the host put them, not under `resources/`
77
-
78
- ### What still belongs under `resources/`
79
-
80
- This rule applies to **host source code only**. Other artifacts still live under `resources/` exactly like in a non-embedded project:
81
-
82
- - **Contract schemas authored by the integration** — `resources/contract/<entry-point>.schema.json`
83
- - **Configuration schema** — `resources/config.schema.json`
84
- - **Static lookup tables** the integration owns — `resources/error-map.yaml`, `resources/retry-policy.yaml`, etc.
85
-
86
- The rule of thumb: if the host wrote it and ships it, link it where the host put it. If the integration is authoring it for the first time, it goes under `resources/`.
87
-
88
- ## The contract's ***plain declares inheritance, not duplication
89
-
90
- - The entry-point class / interface / struct in the contract's ***plain must `subclass` / `implements` / `embeds` the host symbol by its full import path
91
- - The ***plain describes only the **integration-specific additions and overrides** — never restates the parent's fields or methods
92
- - The additions and overrides are themselves expressed in the linked schema under `resources/contract/` (JSON Schema or OpenAPI), with `allOf` / `$ref` extending the host's schema rather than duplicating fields
93
- - If a host base class adds fields the integration shouldn't redeclare, the contract schema's `allOf` chain captures that explicitly
94
-
95
- ## Coding-agent directives go in the ***plain, shapes go in the schema
96
-
97
- The contract's ***plain carries the language-specific glue that the schema can't express:
98
-
99
- - Target generated-class fully qualified name (e.g. `plain_modules.integrations.<provider>.Client`)
100
- - Target file path under `plain_modules/`
101
- - Host base class import path to subclass / implement
102
- - Host-package version pins (e.g. `pydantic ~= 2.5`, `fastapi ^0.110`)
103
- - Framework-specific decorators or metaclasses (`model_config`, `@Depends`, …)
104
-
105
- The coding agent reads the directives from the ***plain and the shapes from the linked schema, then emits the host-language class. The ***plain must **not** also contain a class body or a field list — that creates two sources of truth and they will drift.
106
-
107
- ## Single source of truth for the host root
108
-
109
- - The `host-codebase` concept holds the host root path as a **fact**
110
- - Test scripts, configuration-loading functional specs, and any other ***plain that needs the host location reads it from **that one fact** (via the env var declared in the configuration concept)
111
- - Never hardcode the host path in any ***plain, script, or runtime config
112
-
113
- ## No host-overlapping reqs
114
-
115
- - Implementation reqs added in any phase must not contradict the host codebase — same language, same dependency manager, same packaging layout, same error hierarchy, same logging library
116
- - If two reqs are in tension (one from the host, one newly authored), the host wins; rewrite or drop the newly authored req
117
- - Do not author a req that re-declares something the host already enforces — that's a maintenance burden with no benefit
118
-
119
- ## Test-script wiring — copy into the host, run tests there
120
-
121
- Embedded integrations are tested **inside the host codebase itself**. A module's code and unit tests live in `plain_modules/<module>/code`; its conformance tests live in one folder, `plain_modules/<module>/tests` — the module's whole conformance suite. turri runs two self-contained scripts on the person's machine, once per check: `run_unittests_<lang>.sh <build_folder>` decides the unit tests, and `run_conformance_tests_<lang>.sh <build_folder> <conformance_tests_folder>` (absolute paths) runs the whole conformance suite at once and its exit code decides the conformance tests. There is no prepare-environment script.
122
-
123
- Both scripts copy the coding agent's output (`$1`, i.e. `plain_modules/<module>/code/`) into the host's source tree at the module's package path, then compile / test the host project in place. The conformance script also uses a scratch folder in the system temp directory (`/tmp/<lang>_conformance/`), because the conformance suite is a separate project that consumes the host build as a dependency.
124
-
125
- This matters because the integration's generated code references host symbols by their full import path (e.g. `from host_project.integrations.base import IntegrationContract`). Those imports only resolve cleanly when the test process is rooted in the host's package layout — anything else creates path edge cases that bite later in conformance failures.
126
-
127
- See [`integration-embedded-testing.md`](integration-embedded-testing.md) for the full per-script contract (arg validation, exit codes, idempotency, output parsing, pass criteria, cross-cutting rules). The summary that belongs in *this* file:
128
-
129
- - **`run_unittests_<lang>`** copies `$1` into the host's source tree at the module's package path, then runs the module's unit tests + lint scoped to the module's package
130
- - **`run_conformance_tests_<lang>`** makes the same copy of `$1` into the host, cleans the host's build-output directory, and runs the host's install / build (e.g. `mvn clean install -DskipTests`) so the conformance project resolves this build from the local dependency cache; then it copies `$2` (the conformance-tests folder) into `/tmp/<lang>_conformance/` (system temp), `cd`s in, builds the conformance project, and runs the whole suite
131
-
132
- ### Invariants the scripts must enforce
133
-
134
- - **Host root is a parameter, not a literal.** No script may hardcode an absolute host path. Read the host root from an env var (e.g. `HOST_CODEBASE_ROOT`) with a sensible default matching the user's layout (e.g. `../host_project`). Surface the env var in each script's `--help` / usage banner. Capture this env var in the integration's configuration concept so it has exactly one declared name across the ***plain, scripts, and runtime
135
- - **Everything about `:UnitTests:` is declared in `***implementation reqs***`** — paths, approach, packages, framework, conventions. Both scripts derive their copy destinations from these reqs, and the unit-test script its test-filter argument. See [`integration-embedded-testing.md`](integration-embedded-testing.md) for the exact reqs the ***plain must author (phrased in terms of `:UnitTests:`)
136
- - **Everything about `:ConformanceTests:` is declared in `***test reqs***`** — paths, approach, packages, framework, execution command, pass criteria, mocking policy. The conformance script derives its build and run steps from these reqs. See [`integration-embedded-testing.md`](integration-embedded-testing.md) for the exact reqs (phrased in terms of `:ConformanceTests:`)
137
- - **The two groups never overlap.** `:UnitTests:` facts belong only in `***implementation reqs***`; `:ConformanceTests:` facts belong only in `***test reqs***`. Neither lives in the `host-codebase` concept
138
- - **Destructive ops are scoped to the module's own package path** under the host's source tree. `rm -rf` never touches the host's `src/main/`, `target/`, `node_modules/`, `build/`, or `dist/` at the project root. Only the module-specific package directories are wiped
139
- - **Each script is idempotent.** Re-running the same script with the same `$1` yields the same result
140
-
141
- ## Embedded-specific completion checklist
142
-
143
- Before declaring an embedded integration done, in addition to the shared checklist in [`integrations.md`](integrations.md):
144
-
145
- - [ ] `host-codebase` concept records host root path, host language + version, host dependency manager + manifest, target package path, host base class import path, target generated-class FQN, and the host conventions the contract follows
146
- - [ ] The contract's ***plain carries coding-agent directives (target language, target file path, target class name, host base class to subclass, host-package pins) and **links** to the contract schema; no class body is inlined
147
- - [ ] Every host symbol referenced anywhere in the ***plain uses its fully qualified import path and is tagged "imported from the host codebase; do not redefine"
148
- - [ ] Every host file the integration touches is linked at its **original host-relative path** — no host file has been copied into `resources/host/` or anywhere else, and no host file contents are inlined in the ***plain
149
- - [ ] The stack decisions are transcribed verbatim from the host (no independent stack choices)
150
- - [ ] Host-package version pins are copied into `***implementation reqs***`
151
- - [ ] `run_unittests` copies `$1` into the host's source tree at the module's package path and invokes the host's test runner scoped to the module's package
152
- - [ ] `run_conformance_tests` makes the same copy of `$1` into the host, cleans the host's build-output directory, runs the host's install / build so the conformance suite resolves the integration from the local dependency cache, then copies `$2` into `/tmp/<lang>_conformance/` (system temp), `cd`s in, builds the conformance project, and runs the whole suite
153
- - [ ] There is no `prepare_environment_<lang>` script; each test script is self-contained
154
- - [ ] Host codebase root is read from a named env var (default value documented in each script's usage) — never hardcoded; the env var name is captured in the integration's configuration concept
155
- - [ ] `***implementation reqs***` declares **everything about `:UnitTests:`** — integration source path, `:UnitTests:` source path, `:UnitTests:` package, framework + conventions, lint / static-analysis gate — per [`integration-embedded-testing.md`](integration-embedded-testing.md)
156
- - [ ] `***test reqs***` declares **everything about `:ConformanceTests:`** — source location, framework + execution command, package, mocking / network policy, pass criteria, build / install needs — per [`integration-embedded-testing.md`](integration-embedded-testing.md)
157
- - [ ] Neither group is duplicated across sections: `:UnitTests:` facts never appear in `***test reqs***`, `:ConformanceTests:` facts never appear in `***implementation reqs***`, and neither lives in the `host-codebase` concept
158
- - [ ] Every `rm -rf` in the scripts is scoped to the module's own package directory under the host's source tree — never targets the host's `src/main/`, `target/`, `node_modules/`, `build/`, or `dist/` at the project root
159
-
160
- ## Anti-patterns specific to embedded integrations
161
-
162
- - **Choosing a different language, framework, or dependency manager than the host.** The host stack is inherited; cross-stack `requires` chains are forbidden by [`requires-modules.md`](requires-modules.md)
163
- - **Redefining a host class under `plain_modules/`.** Reference the host symbol by FQN; let the coding agent import it
164
- - **Inlining a host base class body into the contract spec.** Reference the host file as a linked resource **at its original host-relative path** — do not inline its contents and do not copy it into `resources/`
165
- - **Copying host source files into `resources/host/` (or anywhere under `resources/`).** That creates a second source of truth that silently drifts from the host. Link the host file in place; the integration `.plain` module already lives inside the host codebase, so the path resolves naturally
166
- - **Hardcoding the host codebase path in any ***plain or script.** Read it from the env var declared in the configuration concept
167
- - **Asking the user to design the integration's tech stack.** Read it from the host's manifest files
168
- - **Authoring an integration's ***plain that contradicts an existing integration in the same host** without first surfacing the conflict and getting explicit user confirmation
169
- - **Wiring tests with `PYTHONPATH` / `NODE_PATH` / Go `replace` directives instead of physically copying `$1` into the host's package tree.** The import-stitching approach is forbidden — every test script starts by copying the generated module into the host's source tree at the module's package path
170
- - **Letting an `rm -rf` in a test script reach the host's `src/main/`, `target/`, `node_modules/`, `build/`, or `dist/` at the project root.** Destructive ops are scoped strictly to the module's own package directory. A wrong package path in the script silently does nothing and copies files in the wrong place — both produce a green build with stale code
171
- - **Running conformance tests against a stale local dependency cache.** The conformance script must stage `$1` and build / install the host itself before it runs the suite, so the conformance project resolves this build from `~/.m2` (or the language equivalent). Without that step the suite tests whichever build last hit the cache — the wrong code
@@ -1,135 +0,0 @@
1
- ---
2
- description: Rules for authoring ***plain for REST API integrations deployed standalone
3
- ---
4
-
5
- # Rules for **standalone** integrations in ***plain
6
-
7
- When an integration `.plain` module is **standalone** — meaning the generated code in `plain_modules/` is the deployable artifact itself (a service, daemon, CLI, scheduled job, container, or library published to a registry) — these rules apply on top of the shared rules in [`integrations.md`](integrations.md). If anything below contradicts a guess made from memory, the rules here win.
8
-
9
- Standalone means: the integration is a complete application in its own right, picks its own tech stack, owns its own lifecycle, and exposes its own contract surface to external consumers.
10
-
11
- ## The integration owns its tech stack
12
-
13
- Unlike embedded integrations, a standalone integration has no host to inherit from. Every stack decision is **explicit**, settled when the stack is chosen, and recorded in `***implementation reqs***`:
14
-
15
- - **Implementation language** and its exact version
16
- - **HTTP client library** (e.g. `httpx`, `requests`, `node-fetch`, `axios`, `go-resty`, `reqwest`) — pinned, with the auth/retry/timeout features the integration uses called out
17
- - **Application framework** (Flask, FastAPI, Express, Fiber, Gin, Spring Boot, …) when the integration exposes HTTP; **CLI framework** (Click, argparse, `cobra`, `clap`) when it exposes a CLI
18
- - **Data storage** (when needed): idempotency-key persistence, webhook deduplication store, OAuth token cache, response cache — pick the storage primitive (SQLite, Postgres, Redis, on-disk file, in-memory with LRU bounds) and pin it
19
- - **Architecture and layering** — which patterns the codebase follows (clean architecture, hexagonal, simple flat package, …)
20
- - **Packaging artifact** — published Python wheel / sdist, npm package, Go binary, container image, OS package, …; one or more, named explicitly
21
-
22
- Standalone integrations may freely import any third-party library that isn't constrained by an existing host. Choose the smallest set that solves the problem.
23
-
24
- ## The contract schema is the public artifact
25
-
26
- In an embedded integration, the schema feeds the coding agent's code generation; the host codebase consumes the *generated class*. In a standalone integration, the schema is **shipped** to external consumers and the generated implementation is internal to `plain_modules/`.
27
-
28
- - **Pick the publication surface and write it into the spec.** Examples (one functional spec per surface):
29
- - HTTP service: "served at `/openapi.json` (and a Swagger UI at `/docs`)"
30
- - npm-published library: "published as `<package>` to npm; `package.json` exports the schema as `./schema.json`"
31
- - PyPI-published library: "published as `<package>` to PyPI; bundle ships `schema.json` as a package data file"
32
- - CLI: "emitted as `--help` and as `<cli> schema` (JSON-on-stdout)"
33
- - Queue worker: "published as a JSON Schema in the team's schema registry under `<topic>.v<version>.json`"
34
- - Scheduled job: "published as JSON Schema in `resources/contract/job-config.schema.json` and linked from the runbook"
35
- - **Schema versioning is part of the contract.** Pin the version in the schema's `$id` / OpenAPI `info.version` and follow semver. Backwards-incompatible changes ship under a new file path, never as mutations to the published version
36
- - **The coding agent ships the schema verbatim** — the ***plain must not restate fields from the schema, and the generated implementation must consume the same file as the published artifact (so the two cannot drift)
37
-
38
- ## All lifecycle stages must be explicit
39
-
40
- A standalone integration has no host lifecycle to delegate to. Every stage that an embedded integration could skip is mandatory here, each one captured as its own functional spec:
41
-
42
- - **Initialization** — one-time setup at startup. Read configuration, validate credentials proactively (eager) or defer to first call (lazy) — pick one and write the ***plain accordingly. Open connection pools, register webhook handlers, initialize observability
43
- - **Credential refresh** — proactive (background timer / pre-expiry refresh) vs. reactive (refresh-on-401). Use a refresh lock to prevent thundering herd. Specify the lock primitive (in-process mutex, distributed lock in Redis, …) when the integration runs as more than one replica
44
- - **Graceful shutdown** — drain in-flight requests with a deadline; what happens to retries still queued (abandoned, persisted, returned to caller as a specific error); what signals trigger shutdown (`SIGTERM`, container-stop hook, …)
45
- - **Health checks** — define what "healthy" means for **this** integration: last successful provider call within a window, valid credentials, provider's own `/health` returning 2xx, dependent storage reachable. State the response shape (status code, body) for the health endpoint when one is exposed
46
- - **Background loops** — cron jobs, polling workers, queue consumers: each gets its own functional spec covering trigger, interval, leader-election (if applicable), failure handling, and observability
47
-
48
- ## Entry-point types — pick deliberately, enumerate fully
49
-
50
- A standalone integration exposes one or more **entry points** to its consumers. Mixing entry-point types (e.g. HTTP + queue worker + CLI) is allowed, but every entry point must be enumerated up front and gets at least one functional spec.
51
-
52
- | Entry-point type | Public surface | Contract format |
53
- |------------------|----------------|-----------------|
54
- | HTTP service | One or more routes (path + method) | OpenAPI 3.1 (`resources/contract/<integration>.openapi.yaml`) |
55
- | CLI | Command + subcommands + flags | JSON Schema for config + `--help` text seeded from the schema |
56
- | Queue worker | Topic / partition + message envelope | JSON Schema per message type (`resources/contract/<topic>.schema.json`) |
57
- | Scheduled job | Job name + cron expression + config schema | JSON Schema for config |
58
- | Library | Public package surface (functions, classes) | JSON Schema for I/O + published-package manifest |
59
- | Webhook receiver | Provider-driven inbound HTTP | JSON Schema per event type under `resources/webhooks/` (shared with embedded — see [`integrations.md`](integrations.md)) |
60
-
61
- Each entry point gets its own functional spec describing what calling it does end-to-end (which earlier functional specs it composes — auth, the endpoint call, the retry policy, the error handling).
62
-
63
- ## Side effects are first-class — spell them out
64
-
65
- A standalone integration usually mutates state outside the provider call itself. Each side effect is captured as a functional spec describing:
66
-
67
- - **What** gets mutated — local DB writes, file writes, cache updates, emitted domain events, metrics, log lines
68
- - **When** the mutation happens — before or after the provider call
69
- - **Is the mutation transactional with the provider call** — atomic, eventually consistent, fire-and-forget
70
- - **What happens on partial failure** — provider call succeeded but the side effect failed (and vice versa); rollback / compensation / retry strategy
71
-
72
- ## Concurrency and backpressure
73
-
74
- Standalone integrations face concurrent load that an embedded library doesn't. The ***plain must pin:
75
-
76
- - **Sync vs. async** in the host-language sense (`async def`, `Promise`, goroutines, threads)
77
- - **Expected peak throughput** (RPS) the consumer will issue
78
- - **Connection pool size**
79
- - **Request queue depth**
80
- - **Backpressure behavior** when the provider's rate limit and the consumer's demand collide — drop, queue, block with timeout, or 429 the consumer
81
- - **Concurrency limits on mutating operations** — when the provider has its own per-resource serialization constraints
82
-
83
- Capture all of this as a concurrency concept and one functional spec for "apply backpressure when local demand exceeds rate-limit budget".
84
-
85
- ## Configuration surface
86
-
87
- - Every config knob the consumer can set lives in `resources/config.schema.json` (JSON Schema): env var names, config file keys, secrets, feature flags, regional selectors, timeouts, retry counts, base URL overrides
88
- - The configuration concept enumerates every key by name (type, default, required vs optional, validation, where it is read — startup vs per-call)
89
- - Secrets are referenced by env var name only; never written into the schema as default values
90
- - One functional spec covers "load and validate configuration on startup" — fail-fast on missing required values
91
-
92
- ## Versioning of the integration itself
93
-
94
- Separate from the provider's API version (which lives in the provider OpenAPI file), the **integration's own contract** is versioned independently:
95
-
96
- - Semver of the published library / OpenAPI `info.version` / schema `$id` URL / CLI `--version`
97
- - Backwards-compatibility policy stated explicitly (e.g. "minor and patch are wire-compatible; breaking changes only on major")
98
- - New major versions ship at a new schema path; never mutate a published version in place
99
-
100
- Capture as a contract-version concept; pin the version in every published schema.
101
-
102
- ## Testing — live conformance, secrets from env, webhooks
103
-
104
- `:ConformanceTests:` for a standalone integration **run against the live provider** (see [`integrations.md`](integrations.md) → *`:ConformanceTests:` always run against the live integration*). The testing strategy is captured as `***test reqs***` entries (`test-reqs.md`):
105
-
106
- - **Conformance is live by default.** No VCR cassettes, no prerecorded responses for the calls under test, no mock servers. A green conformance run that never touched the provider proves nothing. Recorded responses may back unit tests — never conformance
107
- - **Secrets come from environment variables.** Pin every credential as an env-var name (e.g. `<PROVIDER>_API_KEY`, `<PROVIDER>_CLIENT_ID` + `<PROVIDER>_CLIENT_SECRET`) in `***test reqs***` and in the auth concept. Use the names the provider's docs use so users don't have to translate
108
- - **The user supplies values via `.env` or the shell.** The project ships `.env.example` (gitignored `.env` for real values). CI provides the same env-var names from its secret store. The conformance script may optionally `source` a `.env` from the project root if one exists; it must verify every required var is set after that optional load and fail fast (exit `69`) on missing vars
109
- - **Sandbox credentials in CI.** Name where credentials come from (CI secret store, dedicated test tenant), the rotation / leak-response policy, and the env-var names CI must set
110
- - **Webhook tests** (if webhooks are in scope) must cover signature verification end-to-end — including invalid signatures and replay attempts. Signing keys are env vars, like every other secret
111
- - **Rate-limit (429) tests.** The 429 path must **not** exhaust the live API's quota — use a local mock for that specific endpoint, document the exception in `***test reqs***`. Every other path remains live
112
- - **Idempotency tests.** Run the same mutating call twice (with the same idempotency key) against the live sandbox and assert the same response
113
-
114
- ## Standalone-specific completion checklist
115
-
116
- Before declaring a standalone integration done, in addition to the shared checklist in [`integrations.md`](integrations.md):
117
-
118
- - [ ] Tech stack decisions are recorded in `***implementation reqs***` — language and version, HTTP client library and version, framework (HTTP / CLI / worker as applicable), data storage choice(s), architecture/layering
119
- - [ ] Publication surface(s) for the contract schema are enumerated in functional specs (one per surface)
120
- - [ ] Schema versioning strategy is captured — `$id` / `info.version` / package version pinned, backwards-compatibility policy stated
121
- - [ ] Every entry point is enumerated and has at least one functional spec (HTTP routes, CLI commands, queue topics, scheduled jobs, library APIs)
122
- - [ ] Every lifecycle stage has a functional spec — initialization, credential refresh, graceful shutdown, health check
123
- - [ ] Side effects are each captured as a functional spec with ordering, transactionality, and partial-failure handling
124
- - [ ] Concurrency model is captured (sync vs async, pool size, queue depth, backpressure strategy)
125
- - [ ] Configuration surface lives in `resources/config.schema.json` and is linked from the configuration concept
126
- - [ ] Testing strategy is recorded in `***test reqs***` — live vs recorded, sandbox credential source, webhook signature coverage, rate-limit-test isolation
127
-
128
- ## Anti-patterns specific to standalone integrations
129
-
130
- - **Skipping any lifecycle stage** because it "feels small". Standalone integrations have no host to fall back on; an implicit shutdown is an undefined shutdown
131
- - **Inlining fields from `resources/contract/<entry-point>.schema.json` into a functional spec.** The schema is the source of truth and is **published** — duplicating fields in ***plain guarantees drift
132
- - **Mutating a published schema's `$id` / version path** instead of shipping a new file. Consumers may already be pinning the old version
133
- - **Treating configuration as "whatever env vars seem useful at runtime".** Every key lives in `resources/config.schema.json` with type, default, and validation; the loader fails fast on missing required values
134
- - **Picking a tech stack incrementally while writing functional specs.** Decide it once, when the stack is chosen, and transcribe into `***implementation reqs***`; don't accrete a stack across several functional specs
135
- - **Hitting the live provider in rate-limit (429) or destructive-error (500) tests.** Use a local mock; live calls are for the happy path and for sandbox-safe error paths