@galaxyproject/orbit 0.0.0 → 0.9.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 (451) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/LICENSE +21 -0
  3. package/README.md +760 -5
  4. package/bin/legacy-mcp-config.js +363 -0
  5. package/bin/orbit.js +810 -0
  6. package/bin/pi-extension-path.d.ts +4 -0
  7. package/bin/pi-extension-path.js +44 -0
  8. package/bin/provider-auth.d.ts +22 -0
  9. package/bin/provider-auth.js +77 -0
  10. package/bin/thinking-pref.js +38 -0
  11. package/bin/update-check.d.ts +15 -0
  12. package/bin/update-check.js +137 -0
  13. package/extensions/cli-update/index.ts +32 -0
  14. package/extensions/orbit/activity-hooks.ts +141 -0
  15. package/extensions/orbit/activity.ts +116 -0
  16. package/extensions/orbit/agent-dir.ts +11 -0
  17. package/extensions/orbit/auto-resume.ts +352 -0
  18. package/extensions/orbit/config.ts +3 -0
  19. package/extensions/orbit/confusables.ts +1 -0
  20. package/extensions/orbit/context.ts +957 -0
  21. package/extensions/orbit/dashboard-commands.ts +191 -0
  22. package/extensions/orbit/dashboard-store.ts +473 -0
  23. package/extensions/orbit/dashboard-tools.ts +1185 -0
  24. package/extensions/orbit/empty-completion.ts +99 -0
  25. package/extensions/orbit/evidence-gate.ts +1276 -0
  26. package/extensions/orbit/evidence-override-command.ts +294 -0
  27. package/extensions/orbit/exec-guard/bash-risk.ts +1408 -0
  28. package/extensions/orbit/exec-guard/gate.ts +181 -0
  29. package/extensions/orbit/exec-guard/guardian-config.ts +54 -0
  30. package/extensions/orbit/exec-guard/index.ts +1 -0
  31. package/extensions/orbit/exec-guard/model-tier.ts +36 -0
  32. package/extensions/orbit/exec-guard/path-jail.ts +54 -0
  33. package/extensions/orbit/exec-guard/policy.ts +342 -0
  34. package/extensions/orbit/exec-guard/runtime-state.ts +15 -0
  35. package/extensions/orbit/exec-guard/sensitive-read.ts +525 -0
  36. package/extensions/orbit/exec-guard/types.ts +42 -0
  37. package/extensions/orbit/execution-commands.ts +134 -0
  38. package/extensions/orbit/feedback-command.ts +81 -0
  39. package/extensions/orbit/feedback.ts +96 -0
  40. package/extensions/orbit/galaxy-api.test.ts +122 -0
  41. package/extensions/orbit/galaxy-api.ts +606 -0
  42. package/extensions/orbit/galaxy-artifact-link-guidance.ts +5 -0
  43. package/extensions/orbit/galaxy-destructive-gate.ts +113 -0
  44. package/extensions/orbit/galaxy-enrich.ts +1108 -0
  45. package/extensions/orbit/galaxy-failure.ts +101 -0
  46. package/extensions/orbit/galaxy-fixture.ts +126 -0
  47. package/extensions/orbit/galaxy-history-guard.ts +233 -0
  48. package/extensions/orbit/galaxy-job-block.ts +347 -0
  49. package/extensions/orbit/galaxy-job-ops.ts +288 -0
  50. package/extensions/orbit/galaxy-live-source.ts +929 -0
  51. package/extensions/orbit/galaxy-markdown-adapter.ts +248 -0
  52. package/extensions/orbit/galaxy-op-policy.ts +332 -0
  53. package/extensions/orbit/galaxy-ops-tools.ts +326 -0
  54. package/extensions/orbit/galaxy-output-store.ts +80 -0
  55. package/extensions/orbit/galaxy-output.ts +346 -0
  56. package/extensions/orbit/galaxy-page-binding.ts +222 -0
  57. package/extensions/orbit/galaxy-page-markdown-guidance.ts +15 -0
  58. package/extensions/orbit/galaxy-page-ops.ts +159 -0
  59. package/extensions/orbit/galaxy-page-sync.test.ts +417 -0
  60. package/extensions/orbit/galaxy-page-sync.ts +318 -0
  61. package/extensions/orbit/galaxy-pages-api.ts +203 -0
  62. package/extensions/orbit/galaxy-pages-sync.ts +409 -0
  63. package/extensions/orbit/galaxy-poll-guard.ts +189 -0
  64. package/extensions/orbit/galaxy-poller.ts +706 -0
  65. package/extensions/orbit/galaxy-provenance.ts +623 -0
  66. package/extensions/orbit/galaxy-reconcile.ts +956 -0
  67. package/extensions/orbit/galaxy-recovery.ts +176 -0
  68. package/extensions/orbit/galaxy-repeat-guard.ts +55 -0
  69. package/extensions/orbit/galaxy-submission-capture.ts +707 -0
  70. package/extensions/orbit/galaxy-submission.ts +502 -0
  71. package/extensions/orbit/galaxy-tool-source.ts +78 -0
  72. package/extensions/orbit/galaxy-tool-wrap.ts +234 -0
  73. package/extensions/orbit/galaxy-udt-block.ts +127 -0
  74. package/extensions/orbit/galaxy-upload-tus.ts +334 -0
  75. package/extensions/orbit/galaxy-upload.ts +300 -0
  76. package/extensions/orbit/galaxy-version-capture.ts +65 -0
  77. package/extensions/orbit/git.ts +173 -0
  78. package/extensions/orbit/harness-block-fields.ts +597 -0
  79. package/extensions/orbit/index.ts +593 -0
  80. package/extensions/orbit/init-gate.ts +284 -0
  81. package/extensions/orbit/instructions-command.ts +136 -0
  82. package/extensions/orbit/invocation-failure-hint.ts +57 -0
  83. package/extensions/orbit/iwc-plan-check.ts +94 -0
  84. package/extensions/orbit/lesson-command.ts +303 -0
  85. package/extensions/orbit/lesson-hint.ts +245 -0
  86. package/extensions/orbit/lesson-nudge.ts +106 -0
  87. package/extensions/orbit/lessons/compose.ts +177 -0
  88. package/extensions/orbit/lessons/counters.ts +120 -0
  89. package/extensions/orbit/lessons/enabled.ts +116 -0
  90. package/extensions/orbit/lessons/matcher.ts +346 -0
  91. package/extensions/orbit/lessons/paths.ts +286 -0
  92. package/extensions/orbit/lessons/pi-event-contract.ts +105 -0
  93. package/extensions/orbit/lessons/propose-replay.ts +103 -0
  94. package/extensions/orbit/lessons/propose-tool.ts +222 -0
  95. package/extensions/orbit/lessons/propose.ts +502 -0
  96. package/extensions/orbit/lessons/replay.ts +89 -0
  97. package/extensions/orbit/lessons/reproduction-index.ts +83 -0
  98. package/extensions/orbit/lessons/search-tool.ts +99 -0
  99. package/extensions/orbit/lessons/search.ts +136 -0
  100. package/extensions/orbit/lessons/store.ts +415 -0
  101. package/extensions/orbit/lessons/text.ts +36 -0
  102. package/extensions/orbit/lessons/types.ts +69 -0
  103. package/extensions/orbit/lessons/user-dir.ts +24 -0
  104. package/extensions/orbit/lessons/user-lesson.ts +88 -0
  105. package/extensions/orbit/lessons/wrapper.ts +61 -0
  106. package/extensions/orbit/lessons-command.ts +147 -0
  107. package/extensions/orbit/local-exec.ts +39 -0
  108. package/extensions/orbit/mcp-output.ts +179 -0
  109. package/extensions/orbit/mcp-servers.test.ts +24 -0
  110. package/extensions/orbit/mcp-servers.ts +25 -0
  111. package/extensions/orbit/model-script.ts +351 -0
  112. package/extensions/orbit/notebook-anchors.ts +342 -0
  113. package/extensions/orbit/notebook-writer.ts +863 -0
  114. package/extensions/orbit/observation-allowlists.ts +1109 -0
  115. package/extensions/orbit/observation-replay.ts +148 -0
  116. package/extensions/orbit/observation-triggers.ts +563 -0
  117. package/extensions/orbit/observation-ui.ts +175 -0
  118. package/extensions/orbit/observations-command.ts +421 -0
  119. package/extensions/orbit/observations-config.ts +200 -0
  120. package/extensions/orbit/observations.ts +1381 -0
  121. package/extensions/orbit/profiles.ts +270 -0
  122. package/extensions/orbit/progress-updates.ts +95 -0
  123. package/extensions/orbit/proposal-commands.ts +882 -0
  124. package/extensions/orbit/provenance-fs-file.ts +59 -0
  125. package/extensions/orbit/provenance-fs.ts +32 -0
  126. package/extensions/orbit/provenance-memory-fs.ts +59 -0
  127. package/extensions/orbit/record-store-file.ts +177 -0
  128. package/extensions/orbit/record-store-page.ts +77 -0
  129. package/extensions/orbit/record-store-seam.ts +47 -0
  130. package/extensions/orbit/record-store.ts +149 -0
  131. package/extensions/orbit/registry-carrier.ts +107 -0
  132. package/extensions/orbit/registry-eligibility.ts +95 -0
  133. package/extensions/orbit/registry-evaluation.ts +403 -0
  134. package/extensions/orbit/registry-evaluator.ts +519 -0
  135. package/extensions/orbit/registry-import.ts +91 -0
  136. package/extensions/orbit/registry-lock.ts +221 -0
  137. package/extensions/orbit/registry-memory-fs.ts +42 -0
  138. package/extensions/orbit/registry-page-carrier.ts +103 -0
  139. package/extensions/orbit/registry-proposal.ts +1348 -0
  140. package/extensions/orbit/registry-runtime.ts +234 -0
  141. package/extensions/orbit/registry-schema.ts +735 -0
  142. package/extensions/orbit/registry-submitter.ts +59 -0
  143. package/extensions/orbit/registry-templates.ts +346 -0
  144. package/extensions/orbit/registry.ts +476 -0
  145. package/extensions/orbit/sandbox/index.ts +120 -0
  146. package/extensions/orbit/sandbox/sandbox-bash.ts +93 -0
  147. package/extensions/orbit/sandbox/sandbox-config.ts +87 -0
  148. package/extensions/orbit/sandbox/sandbox-init-message.ts +28 -0
  149. package/extensions/orbit/secret-redaction.ts +247 -0
  150. package/extensions/orbit/session-index/cwd.ts +18 -0
  151. package/extensions/orbit/session-index/db.ts +56 -0
  152. package/extensions/orbit/session-index/indexer.ts +154 -0
  153. package/extensions/orbit/session-index/is-enabled.ts +17 -0
  154. package/extensions/orbit/session-index/parse.ts +254 -0
  155. package/extensions/orbit/session-index/query.ts +209 -0
  156. package/extensions/orbit/session-index/schema.ts +72 -0
  157. package/extensions/orbit/session-index/tools.ts +152 -0
  158. package/extensions/orbit/session-lifecycle.ts +321 -0
  159. package/extensions/orbit/skill-triggers.ts +159 -0
  160. package/extensions/orbit/skills-command.ts +48 -0
  161. package/extensions/orbit/skills-discovery.ts +435 -0
  162. package/extensions/orbit/skills.ts +84 -0
  163. package/extensions/orbit/sra-import-gate.ts +77 -0
  164. package/extensions/orbit/state.ts +265 -0
  165. package/extensions/orbit/submission-replay.ts +147 -0
  166. package/extensions/orbit/sync-command.ts +157 -0
  167. package/extensions/orbit/teams/critic-parser.ts +93 -0
  168. package/extensions/orbit/teams/dispatcher.ts +210 -0
  169. package/extensions/orbit/teams/is-enabled.ts +22 -0
  170. package/extensions/orbit/teams/tool.ts +187 -0
  171. package/extensions/orbit/teams/types.ts +57 -0
  172. package/extensions/orbit/teams/validate.ts +42 -0
  173. package/extensions/orbit/tester-id-command.ts +133 -0
  174. package/extensions/orbit/tools-sync.ts +279 -0
  175. package/extensions/orbit/tools.ts +1300 -0
  176. package/extensions/orbit/types.ts +41 -0
  177. package/extensions/orbit/ui-bridge.ts +55 -0
  178. package/extensions/orbit/ulid.ts +60 -0
  179. package/extensions/orbit/user-instructions.ts +388 -0
  180. package/extensions/orbit/vendor/skills/_catalog.json +68 -0
  181. package/extensions/orbit/vendor/skills/_manifest.json +1106 -0
  182. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/SKILL.md +112 -0
  183. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_provenance.json +218 -0
  184. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_required_tools.json +33 -0
  185. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/_verify.json +4 -0
  186. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/add.json +50 -0
  187. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-extract.json +51 -0
  188. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-next-step.json +42 -0
  189. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/draft-validate.json +140 -0
  190. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/cli/list.json +32 -0
  191. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/notes/galaxy-tool-job-failure-reference.md +137 -0
  192. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/notes/open-requirements-ledger.md +173 -0
  193. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/schemas/galaxy-tool-summary.schema.json +175 -0
  194. package/extensions/orbit/vendor/skills/advance-galaxy-draft-step/references/schemas/galaxy-workflow-draft.schema.json +2727 -0
  195. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/SKILL.md +82 -0
  196. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_provenance.json +133 -0
  197. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_required_tools.json +16 -0
  198. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/_verify.json +4 -0
  199. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/cli/draft-validate.json +140 -0
  200. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/notes/galaxy-workflow-draft-format.md +135 -0
  201. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/notes/open-requirements-ledger.md +173 -0
  202. package/extensions/orbit/vendor/skills/apply-galaxy-workflow-changeset/references/schemas/galaxy-workflow-draft.schema.json +2727 -0
  203. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/SKILL.md +84 -0
  204. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/_provenance.json +166 -0
  205. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/_verify.json +29 -0
  206. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/galaxy-workflow-testability-design.md +136 -0
  207. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  208. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/iwc-test-data-conventions.md +308 -0
  209. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/planemo-asserts-idioms.md +246 -0
  210. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/notes/planemo-workflow-test-architecture.md +151 -0
  211. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/galaxy-workflow-test-plan.schema.json +552 -0
  212. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  213. package/extensions/orbit/vendor/skills/changeset-to-galaxy-test-plan/references/schemas/tests-format.schema.json +7328 -0
  214. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/SKILL.md +127 -0
  215. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_provenance.json +198 -0
  216. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_required_tools.json +16 -0
  217. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/_verify.json +4 -0
  218. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/cli/convert.json +123 -0
  219. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/galaxy-data-flow-draft-contract.md +129 -0
  220. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  221. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/iwc-test-data-conventions.md +308 -0
  222. package/extensions/orbit/vendor/skills/compare-against-iwc-exemplar/references/notes/open-requirements-ledger.md +173 -0
  223. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/SKILL.md +73 -0
  224. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/_provenance.json +160 -0
  225. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/_verify.json +4 -0
  226. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-collection-semantics.md +43 -0
  227. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-collection-semantics.yml +1250 -0
  228. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-tool-job-failure-reference.md +137 -0
  229. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  230. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  231. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/nextflow-operators-to-galaxy-collection-recipes.md +98 -0
  232. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/planemo-asserts-idioms.md +246 -0
  233. package/extensions/orbit/vendor/skills/debug-galaxy-workflow-output/references/notes/planemo-workflow-test-architecture.md +151 -0
  234. package/extensions/orbit/vendor/skills/discover-shed-tool/SKILL.md +174 -0
  235. package/extensions/orbit/vendor/skills/discover-shed-tool/_provenance.json +130 -0
  236. package/extensions/orbit/vendor/skills/discover-shed-tool/_required_tools.json +18 -0
  237. package/extensions/orbit/vendor/skills/discover-shed-tool/_verify.json +17 -0
  238. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-revisions.json +48 -0
  239. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-search.json +95 -0
  240. package/extensions/orbit/vendor/skills/discover-shed-tool/references/cli/tool-versions.json +39 -0
  241. package/extensions/orbit/vendor/skills/discover-shed-tool/references/notes/component-tool-shed-search.md +230 -0
  242. package/extensions/orbit/vendor/skills/discover-shed-tool/references/schemas/galaxy-tool-discovery.schema.json +231 -0
  243. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/SKILL.md +93 -0
  244. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_provenance.json +201 -0
  245. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_required_tools.json +28 -0
  246. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/_verify.json +17 -0
  247. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/cli/planemo.md +44 -0
  248. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/cli/validate-tests.json +40 -0
  249. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/galaxy-workflow-testability-design.md +136 -0
  250. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/iwc-shortcuts-anti-patterns.md +357 -0
  251. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/iwc-test-data-conventions.md +308 -0
  252. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/planemo-asserts-idioms.md +246 -0
  253. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/notes/planemo-workflow-test-architecture.md +151 -0
  254. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/schemas/galaxy-workflow-test-plan.schema.json +552 -0
  255. package/extensions/orbit/vendor/skills/implement-galaxy-workflow-test/references/schemas/tests-format.schema.json +7328 -0
  256. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/SKILL.md +81 -0
  257. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/_provenance.json +93 -0
  258. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/_verify.json +17 -0
  259. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/references/notes/open-requirements-ledger.md +173 -0
  260. package/extensions/orbit/vendor/skills/interview-to-galaxy-workflow-changeset/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  261. package/extensions/orbit/vendor/skills/pipeline-update-interview-to-galaxy/SKILL.md +81 -0
  262. package/extensions/orbit/vendor/skills/pipeline-update-interview-to-galaxy/_assembly.json +23 -0
  263. package/extensions/orbit/vendor/skills/run-workflow-test/SKILL.md +79 -0
  264. package/extensions/orbit/vendor/skills/run-workflow-test/_provenance.json +125 -0
  265. package/extensions/orbit/vendor/skills/run-workflow-test/_required_tools.json +28 -0
  266. package/extensions/orbit/vendor/skills/run-workflow-test/_verify.json +4 -0
  267. package/extensions/orbit/vendor/skills/run-workflow-test/references/cli/planemo.md +44 -0
  268. package/extensions/orbit/vendor/skills/run-workflow-test/references/cli/validate-tests.json +40 -0
  269. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  270. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/planemo-asserts-idioms.md +246 -0
  271. package/extensions/orbit/vendor/skills/run-workflow-test/references/notes/planemo-workflow-test-architecture.md +151 -0
  272. package/extensions/orbit/vendor/skills/run-workflow-test/references/schemas/tests-format.schema.json +7328 -0
  273. package/extensions/orbit/vendor/skills/skills/LICENSE +21 -0
  274. package/extensions/orbit/vendor/skills/skills/collection-manipulation/README.md +39 -0
  275. package/extensions/orbit/vendor/skills/skills/collection-manipulation/SKILL.md +892 -0
  276. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/api-patterns.md +927 -0
  277. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/apply-rules.md +1482 -0
  278. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/test-patterns.md +996 -0
  279. package/extensions/orbit/vendor/skills/skills/collection-manipulation/references/tools.md +609 -0
  280. package/extensions/orbit/vendor/skills/skills/galaxy-data-libraries/SKILL.md +170 -0
  281. package/extensions/orbit/vendor/skills/skills/galaxy-integration/README.md +162 -0
  282. package/extensions/orbit/vendor/skills/skills/galaxy-integration/SKILL.md +99 -0
  283. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/README.md +119 -0
  284. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/tool-checking.md +419 -0
  285. package/extensions/orbit/vendor/skills/skills/galaxy-integration/examples/workflow-testing.md +617 -0
  286. package/extensions/orbit/vendor/skills/skills/galaxy-integration/galaxy-integration.md +614 -0
  287. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/SKILL.md +144 -0
  288. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/average_col3.ipynb +68 -0
  289. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/extract_sample_metadata.ipynb +190 -0
  290. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/variant_annotation.ipynb +816 -0
  291. package/extensions/orbit/vendor/skills/skills/galaxy-integration/jupyterlite/examples/vcp_variant_map.ipynb +443 -0
  292. package/extensions/orbit/vendor/skills/skills/galaxy-integration/scripts/README.md +165 -0
  293. package/extensions/orbit/vendor/skills/skills/galaxy-integration/scripts/galaxy_tool_checker.py +521 -0
  294. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/SKILL.md +128 -0
  295. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/gotchas.md +135 -0
  296. package/extensions/orbit/vendor/skills/skills/galaxy-mcp-reference/history-access.md +132 -0
  297. package/extensions/orbit/vendor/skills/skills/reproduciblify/SKILL.md +146 -0
  298. package/extensions/orbit/vendor/skills/skills/reproduciblify/references/directives.yml +496 -0
  299. package/extensions/orbit/vendor/skills/skills/udt-authoring/SKILL.md +245 -0
  300. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/01-minimal-echo.yml +27 -0
  301. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/02-single-data-in-out.yml +27 -0
  302. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/03-multiple-data-js.yml +28 -0
  303. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/04-select-integer-boolean.yml +41 -0
  304. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/05-resource-requirements.yml +25 -0
  305. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/06-biocontainer-tool.yml +38 -0
  306. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/07-inline-python-script.yml +56 -0
  307. package/extensions/orbit/vendor/skills/skills/udt-authoring/examples/08-configfile-script.yml +74 -0
  308. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/common-mistakes.md +76 -0
  309. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/schema-reference.md +155 -0
  310. package/extensions/orbit/vendor/skills/skills/udt-authoring/references/templating.md +196 -0
  311. package/extensions/orbit/vendor/skills/skills/udt-authoring/scripts/validate.py +109 -0
  312. package/extensions/orbit/vendor/skills/skills/workflow-reports/README.md +71 -0
  313. package/extensions/orbit/vendor/skills/skills/workflow-reports/SKILL.md +190 -0
  314. package/extensions/orbit/vendor/skills/skills/workflow-reports/examples/histology-staining.md +145 -0
  315. package/extensions/orbit/vendor/skills/skills/workflow-reports/examples/tissue-microarray-analysis.md +176 -0
  316. package/extensions/orbit/vendor/skills/skills/workflow-reports/references/directives.md +415 -0
  317. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/SKILL.md +98 -0
  318. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_provenance.json +93 -0
  319. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_required_tools.json +28 -0
  320. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/_verify.json +17 -0
  321. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/convert.json +123 -0
  322. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/foundry.md +25 -0
  323. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/cli/validate.json +142 -0
  324. package/extensions/orbit/vendor/skills/summarize-galaxy-workflow/references/schemas/summary-galaxy-workflow.schema.json +687 -0
  325. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/SKILL.md +74 -0
  326. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_provenance.json +71 -0
  327. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_required_tools.json +16 -0
  328. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/_verify.json +4 -0
  329. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/cli/validate.json +142 -0
  330. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/notes/galaxy-workflow-invocation-failure-reference.md +138 -0
  331. package/extensions/orbit/vendor/skills/validate-galaxy-workflow/references/notes/galaxy-workflow-testability-design.md +136 -0
  332. package/extensions/orbit/vendor-skills.ts +283 -0
  333. package/extensions/orbit/workspace-state-dir.ts +46 -0
  334. package/extensions/orbit-handoff/index.ts +73 -0
  335. package/extensions/orbit-handoff/orbit-launcher.ts +142 -0
  336. package/extensions/whats-new/index.ts +98 -0
  337. package/lessons/LICENSE +17 -0
  338. package/lessons/README.md +117 -0
  339. package/lessons/SCHEMA.md +187 -0
  340. package/lessons/build-snapshot.mjs +311 -0
  341. package/lessons/data/downloaded-file-is-not-what-its-extension-says.md +61 -0
  342. package/lessons/galaxy-api/403-history-is-a-hard-stop.md +57 -0
  343. package/lessons/galaxy-api/collection-into-single-dataset-input.md +61 -0
  344. package/lessons/galaxy-api/connectedvalue-in-command-line.md +62 -0
  345. package/lessons/galaxy-api/hid-is-not-an-id.md +59 -0
  346. package/lessons/galaxy-api/invoke-workflow-inputs-not-params.md +60 -0
  347. package/lessons/galaxy-api/repeat-param-pipe-keys.md +63 -0
  348. package/lessons/galaxy-api/run-tool-returns-on-submit.md +61 -0
  349. package/lessons/galaxy-tools/reference-index-not-on-server.md +62 -0
  350. package/lessons/log.md +42 -0
  351. package/lessons/reproduction/input-population-mismatch.md +59 -0
  352. package/lessons/reproduction/methods-text-vs-executed-parameters.md +62 -0
  353. package/lessons/snapshot.json +1004 -0
  354. package/lessons/stats/de-contrast-direction-and-sample-labels.md +63 -0
  355. package/lessons/stats/na-coerced-to-zero-in-filters.md +59 -0
  356. package/lessons/validate.mjs +1219 -0
  357. package/package.json +103 -5
  358. package/shared/agent-prompt.d.ts +8 -0
  359. package/shared/agent-prompt.js +15 -0
  360. package/shared/approval-prompt.d.ts +4 -0
  361. package/shared/approval-prompt.js +61 -0
  362. package/shared/brain-env.d.ts +14 -0
  363. package/shared/brain-env.js +108 -0
  364. package/shared/brain-exit.d.ts +20 -0
  365. package/shared/brain-exit.js +149 -0
  366. package/shared/capability-profile.d.ts +16 -0
  367. package/shared/capability-profile.js +75 -0
  368. package/shared/config-source.d.ts +13 -0
  369. package/shared/config-source.js +17 -0
  370. package/shared/confusables.d.ts +3 -0
  371. package/shared/confusables.js +93 -0
  372. package/shared/custom-provider.d.ts +45 -0
  373. package/shared/custom-provider.js +169 -0
  374. package/shared/dashboard-contract.d.ts +123 -0
  375. package/shared/dashboard-contract.js +560 -0
  376. package/shared/dashboard-layout-store.d.ts +44 -0
  377. package/shared/dashboard-layout-store.js +281 -0
  378. package/shared/feedback-contract.d.ts +61 -0
  379. package/shared/feedback-contract.js +146 -0
  380. package/shared/galaxy-artifact-links.d.ts +30 -0
  381. package/shared/galaxy-artifact-links.js +166 -0
  382. package/shared/galaxy-credentials.d.ts +26 -0
  383. package/shared/galaxy-credentials.js +71 -0
  384. package/shared/galaxy-destructive.d.ts +21 -0
  385. package/shared/galaxy-destructive.js +269 -0
  386. package/shared/galaxy-guidance.d.ts +2 -0
  387. package/shared/galaxy-guidance.js +53 -0
  388. package/shared/galaxy-live-contract.d.ts +92 -0
  389. package/shared/galaxy-live-contract.js +180 -0
  390. package/shared/galaxy-page-cells.d.ts +2 -0
  391. package/shared/galaxy-page-cells.js +22 -0
  392. package/shared/galaxy-tool-family.d.ts +5 -0
  393. package/shared/galaxy-tool-family.js +27 -0
  394. package/shared/galaxy-url.d.ts +1 -0
  395. package/shared/galaxy-url.js +48 -0
  396. package/shared/gtn.d.ts +31 -0
  397. package/shared/gtn.js +253 -0
  398. package/shared/handled-prompt.d.ts +3 -0
  399. package/shared/handled-prompt.js +26 -0
  400. package/shared/known-provider.d.ts +11 -0
  401. package/shared/known-provider.js +89 -0
  402. package/shared/lesson-hint-marker.d.ts +7 -0
  403. package/shared/lesson-hint-marker.js +32 -0
  404. package/shared/lesson-rules.d.ts +150 -0
  405. package/shared/lesson-rules.js +203 -0
  406. package/shared/malformed-object-ids.d.ts +1 -0
  407. package/shared/malformed-object-ids.js +37 -0
  408. package/shared/markdown-sections.d.ts +10 -0
  409. package/shared/markdown-sections.js +118 -0
  410. package/shared/notebook-fences.d.ts +12 -0
  411. package/shared/notebook-fences.js +53 -0
  412. package/shared/observation-contract.d.ts +91 -0
  413. package/shared/observation-contract.js +544 -0
  414. package/shared/orbit-config.d.ts +226 -0
  415. package/shared/orbit-config.js +189 -0
  416. package/shared/orbit-env.d.ts +13 -0
  417. package/shared/orbit-env.js +124 -0
  418. package/shared/orbit-shell-contract.d.ts +74 -0
  419. package/shared/orbit-shell-contract.js +30 -0
  420. package/shared/page-content-hash.d.ts +1 -0
  421. package/shared/page-content-hash.js +13 -0
  422. package/shared/pi-default-model.d.ts +7 -0
  423. package/shared/pi-default-model.js +41 -0
  424. package/shared/prompt-blocks.d.ts +87 -0
  425. package/shared/prompt-blocks.js +898 -0
  426. package/shared/provider-auth-caps.d.ts +22 -0
  427. package/shared/provider-auth-caps.js +57 -0
  428. package/shared/random.d.ts +2 -0
  429. package/shared/random.js +15 -0
  430. package/shared/record-excerpt.d.ts +4 -0
  431. package/shared/record-excerpt.js +16 -0
  432. package/shared/redirect-guard.d.ts +36 -0
  433. package/shared/redirect-guard.js +235 -0
  434. package/shared/skills-pin.d.ts +8 -0
  435. package/shared/skills-pin.js +9 -0
  436. package/shared/skills-router.d.ts +17 -0
  437. package/shared/skills-router.js +63 -0
  438. package/shared/sra-import.d.ts +34 -0
  439. package/shared/sra-import.js +206 -0
  440. package/shared/state-dir.d.ts +21 -0
  441. package/shared/state-dir.js +240 -0
  442. package/shared/team-dispatch-contract.d.ts +28 -0
  443. package/shared/team-dispatch-contract.js +1 -0
  444. package/shared/truncate-middle.d.ts +11 -0
  445. package/shared/truncate-middle.js +68 -0
  446. package/shared/version-compare.d.ts +10 -0
  447. package/shared/version-compare.js +74 -0
  448. package/shared/whats-new.d.ts +31 -0
  449. package/shared/whats-new.js +83 -0
  450. package/shared/wsl.d.ts +10 -0
  451. package/shared/wsl.js +24 -0
@@ -0,0 +1,996 @@
1
+ # Galaxy Collection Operation Tests Research
2
+
3
+ ## Context
4
+
5
+ This document analyzes real test examples from Galaxy's test suite to demonstrate collection operation patterns, best practices, and real-world usage. These tests show how Galaxy's native tools should be used for reproducible, workflow-compatible collection operations.
6
+
7
+ **Source:** `lib/galaxy_test/api/test_tools.py`, `lib/galaxy_test/api/test_workflows.py`, `lib/galaxy_test/base/rules_test_data.py`
8
+
9
+ ## Test-Based Usage Patterns
10
+
11
+ ### 1. Building Collections for Testing
12
+
13
+ #### Creating Paired Collections
14
+
15
+ ```python
16
+ def _build_pair(history_id, contents):
17
+ """Create a paired collection from content list"""
18
+ create_response = dataset_collection_populator.create_pair_in_history(
19
+ history_id,
20
+ contents=contents, # e.g., ["123", "456"]
21
+ direct_upload=True,
22
+ wait=True
23
+ )
24
+ hdca_id = create_response.json()["outputs"][0]["id"]
25
+ return hdca_id
26
+
27
+ # Usage
28
+ hdca_id = _build_pair(history_id, ["123\n", "456\n"])
29
+ ```
30
+
31
+ **Result:** Creates paired collection with `forward` and `reverse` elements.
32
+
33
+ ---
34
+
35
+ #### Creating List Collections
36
+
37
+ ```python
38
+ create_response = dataset_collection_populator.create_list_in_history(
39
+ history_id,
40
+ contents=["a\nb\nc\nd", "e\nf\ng\nh"],
41
+ wait=True
42
+ )
43
+ hdca_id = create_response.json()["outputs"][0]["id"]
44
+ ```
45
+
46
+ ---
47
+
48
+ #### Creating Nested List (list:paired)
49
+
50
+ ```python
51
+ hdca_list_id = dataset_collection_populator.example_list_of_pairs(history_id)
52
+ ```
53
+
54
+ **Structure:**
55
+ ```
56
+ list:paired
57
+ ├── element1 (paired)
58
+ │ ├── forward
59
+ │ └── reverse
60
+ └── element2 (paired)
61
+ ├── forward
62
+ └── reverse
63
+ ```
64
+
65
+ ---
66
+
67
+ ### 2. Collection Operation Tool Tests
68
+
69
+ #### Test: Unzip Collection
70
+
71
+ **Purpose:** Split paired collection into two separate lists
72
+
73
+ ```python
74
+ def test_unzip_collection():
75
+ # Create paired collection
76
+ hdca_id = _build_pair(history_id, ["123", "456"])
77
+
78
+ # Unzip it
79
+ inputs = {
80
+ "input": {"src": "hdca", "id": hdca_id}
81
+ }
82
+ response = _run("__UNZIP_COLLECTION__", history_id, inputs, assert_ok=True)
83
+
84
+ # Verify outputs
85
+ outputs = response["outputs"]
86
+ assert len(outputs) == 2
87
+ output_forward = outputs[0]
88
+ output_reverse = outputs[1]
89
+
90
+ # Check content
91
+ forward_content = get_history_dataset_content(history_id, dataset=output_forward)
92
+ reverse_content = get_history_dataset_content(history_id, dataset=output_reverse)
93
+ assert forward_content.strip() == "123"
94
+ assert reverse_content.strip() == "456"
95
+ ```
96
+
97
+ **Key Insights:**
98
+ - Unzip produces 2 dataset outputs (not collections)
99
+ - Each output is a separate list collection
100
+ - Content preserved from original paired elements
101
+
102
+ ---
103
+
104
+ #### Test: Zip Collections
105
+
106
+ **Purpose:** Combine two datasets/collections into paired structure
107
+
108
+ ```python
109
+ def test_zip_inputs():
110
+ # Create two datasets
111
+ hda1 = dataset_to_param(new_dataset(history_id, content="1\t2\t3"))
112
+ hda2 = dataset_to_param(new_dataset(history_id, content="4\t5\t6"))
113
+
114
+ # Zip them
115
+ inputs = {
116
+ "input_forward": hda1,
117
+ "input_reverse": hda2
118
+ }
119
+ response = _run("__ZIP_COLLECTION__", history_id, inputs, assert_ok=True)
120
+
121
+ # Verify output
122
+ output_collections = response["output_collections"]
123
+ assert len(output_collections) == 1
124
+
125
+ zipped_hdca = get_history_collection_details(
126
+ history_id,
127
+ hid=output_collections[0]["hid"]
128
+ )
129
+ assert zipped_hdca["collection_type"] == "paired"
130
+ ```
131
+
132
+ **Key Insights:**
133
+ - Zip creates a single paired collection output
134
+ - Can zip datasets or collections
135
+ - Result has `collection_type == "paired"`
136
+
137
+ ---
138
+
139
+ #### Test: Filter Collection from File
140
+
141
+ **Purpose:** Filter collection elements using identifier list
142
+
143
+ ```python
144
+ def test_filter_from_file():
145
+ # Setup: Collection [A, B, X] and filter file [A, B, Z]
146
+ collection_id = create_list_collection(["A", "B", "X"])
147
+ filter_file_id = upload_text_file("A\nB\nZ")
148
+
149
+ inputs = {
150
+ "input": {"src": "hdca", "id": collection_id},
151
+ "how": {
152
+ "how_filter": "remove_if_absent",
153
+ "filter_source": {"src": "hda", "id": filter_file_id}
154
+ }
155
+ }
156
+ response = _run("__FILTER_FROM_FILE__", history_id, inputs)
157
+
158
+ # Result: TWO output collections
159
+ output_collections = response["output_collections"]
160
+ filtered = output_collections[0] # Contains A, B
161
+ discarded = output_collections[1] # Contains X
162
+ ```
163
+
164
+ **Key Insights:**
165
+ - Filter produces TWO collections (filtered + discarded)
166
+ - Identifiers in file not matching collection are ignored (Z)
167
+ - `remove_if_absent`: keep only items IN file
168
+ - `remove_if_present`: keep only items NOT IN file
169
+
170
+ ---
171
+
172
+ ### 3. Map-Over Patterns (Batch Processing)
173
+
174
+ #### Test: Simple Map-Over
175
+
176
+ **Purpose:** Run tool on each collection element
177
+
178
+ ```python
179
+ def test_collection_parameter():
180
+ hdca_id = _build_pair(history_id, ["123\n", "456\n"])
181
+
182
+ inputs = {
183
+ "input1": {
184
+ "batch": True,
185
+ "values": [{"src": "hdca", "id": hdca_id}]
186
+ }
187
+ }
188
+ output = _run("some_tool", history_id, inputs, assert_ok=True)
189
+
190
+ # Results
191
+ assert len(output["jobs"]) == 2 # One job per element
192
+ assert len(output["implicit_collections"]) == 1 # Output collection created
193
+ ```
194
+
195
+ **Key Insights:**
196
+ - `"batch": True` enables map-over
197
+ - Creates one job per collection element
198
+ - Automatically creates output collection
199
+ - `implicit_collections` contains results
200
+
201
+ ---
202
+
203
+ #### Test: Map-Over Two Collections (Linked)
204
+
205
+ **Purpose:** Process two collections element-by-element in parallel
206
+
207
+ ```python
208
+ def test_map_over_two_collections():
209
+ hdca1_id = _build_pair(history_id, ["123\n", "456\n"])
210
+ hdca2_id = _build_pair(history_id, ["789\n", "0ab\n"])
211
+
212
+ inputs = {
213
+ "input1": {
214
+ "batch": True,
215
+ "values": [{"src": "hdca", "id": hdca1_id}]
216
+ },
217
+ "queries_0|input2": {
218
+ "batch": True,
219
+ "values": [{"src": "hdca", "id": hdca2_id}]
220
+ }
221
+ }
222
+ response = _run("cat1", history_id, inputs)
223
+
224
+ outputs = response["outputs"]
225
+ assert len(outputs) == 2
226
+ # Output1: forward1 + forward2 (123\n789)
227
+ # Output2: reverse1 + reverse2 (456\n0ab)
228
+ ```
229
+
230
+ **Key Insights:**
231
+ - Both inputs have `"batch": True`
232
+ - Default is **linked** mapping
233
+ - Matching identifiers processed together
234
+ - forward[0] with forward[0], reverse[0] with reverse[0]
235
+
236
+ ---
237
+
238
+ #### Test: Map-Over Two Collections (Unlinked)
239
+
240
+ **Purpose:** Process all combinations (Cartesian product)
241
+
242
+ ```python
243
+ def test_map_over_two_collections_unlinked():
244
+ hdca1_id = _build_pair(history_id, ["123\n", "456\n"])
245
+ hdca2_id = _build_pair(history_id, ["789\n", "0ab\n"])
246
+
247
+ inputs = {
248
+ "input1": {
249
+ "batch": True,
250
+ "linked": False, # KEY DIFFERENCE
251
+ "values": [{"src": "hdca", "id": hdca1_id}]
252
+ },
253
+ "queries_0|input2": {
254
+ "batch": True,
255
+ "linked": False, # KEY DIFFERENCE
256
+ "values": [{"src": "hdca", "id": hdca2_id}]
257
+ }
258
+ }
259
+ response = _run("cat1", history_id, inputs)
260
+
261
+ outputs = response["outputs"]
262
+ assert len(outputs) == 4 # 2 x 2 = 4 combinations
263
+
264
+ implicit_collection = response["implicit_collections"][0]
265
+ assert implicit_collection["collection_type"] == "paired:paired"
266
+ ```
267
+
268
+ **Key Insights:**
269
+ - `"linked": False` creates Cartesian product
270
+ - 2-element collections = 4 jobs (2x2)
271
+ - Output structure: `paired:paired`
272
+ - All combinations processed
273
+
274
+ **Alternative:** Use `__CROSS_PRODUCT_FLAT__` tool explicitly.
275
+
276
+ ---
277
+
278
+ #### Test: Map-Over Nested Collections
279
+
280
+ **Purpose:** Process specific nesting level
281
+
282
+ ```python
283
+ def test_unzip_nested():
284
+ # Create list:paired collection
285
+ response = upload_collection(
286
+ history_id,
287
+ "list:paired",
288
+ elements=[{
289
+ "name": "test0",
290
+ "elements": [
291
+ {"src": "pasted", "paste_content": "123\n",
292
+ "name": "forward", "ext": "txt"},
293
+ {"src": "pasted", "paste_content": "456\n",
294
+ "name": "reverse", "ext": "txt"}
295
+ ]
296
+ }]
297
+ )
298
+ hdca_id = response.json()["outputs"][0]["id"]
299
+
300
+ inputs = {
301
+ "input": {
302
+ "batch": True,
303
+ "values": [{
304
+ "src": "hdca",
305
+ "map_over_type": "paired", # SPECIFY LEVEL
306
+ "id": hdca_id
307
+ }]
308
+ }
309
+ }
310
+ response = _run("__UNZIP_COLLECTION__", history_id, inputs)
311
+
312
+ implicit_collections = response["implicit_collections"]
313
+ assert len(implicit_collections) == 2 # Forward and reverse collections
314
+ ```
315
+
316
+ **Key Insights:**
317
+ - `"map_over_type": "paired"` specifies which level to map over
318
+ - For `list:paired`, maps over the `paired` level
319
+ - Creates appropriate nested output structure
320
+
321
+ ---
322
+
323
+ #### Test: Subcollection Mapping
324
+
325
+ **Purpose:** Map over inner collection level
326
+
327
+ ```python
328
+ def test_subcollection_mapping():
329
+ hdca_list_id = __build_nested_list(history_id) # list:paired
330
+
331
+ inputs = {
332
+ "f1": {
333
+ "batch": True,
334
+ "values": [{
335
+ "src": "hdca",
336
+ "map_over_type": "paired",
337
+ "id": hdca_list_id
338
+ }]
339
+ }
340
+ }
341
+ outputs = _run_and_get_outputs("collection_paired_test", history_id, inputs)
342
+
343
+ # Tool processes each paired sub-collection
344
+ assert len(outputs) == 2 # One output per list element
345
+ ```
346
+
347
+ **Key Insights:**
348
+ - Subcollection mapping processes inner collections as units
349
+ - `map_over_type` determines processing level
350
+ - Useful for hierarchical data structures
351
+
352
+ ---
353
+
354
+ ### 4. Apply Rules Examples
355
+
356
+ #### Example 1: Simple List Preservation
357
+
358
+ **Purpose:** Maintain list structure (identity operation)
359
+
360
+ ```python
361
+ rules = {
362
+ "rules": [
363
+ {
364
+ "type": "add_column_metadata",
365
+ "value": "identifier0" # Add identifier column
366
+ }
367
+ ],
368
+ "mapping": [
369
+ {
370
+ "type": "list_identifiers",
371
+ "columns": [0] # Use column 0 for identifiers
372
+ }
373
+ ]
374
+ }
375
+
376
+ inputs = {
377
+ "input": {"src": "hdca", "id": collection_id},
378
+ "rules": rules
379
+ }
380
+ ```
381
+
382
+ **Input:** `list [i1, i2]`
383
+ **Output:** `list [i1, i2]` (same structure)
384
+
385
+ **Rule Explanation:**
386
+ - `add_column_metadata` with `identifier0`: Add column containing element identifiers
387
+ - `list_identifiers` with `columns: [0]`: Create list using values from column 0
388
+
389
+ ---
390
+
391
+ #### Example 2: Nest List -> List:List
392
+
393
+ **Purpose:** Add nesting level to collection
394
+
395
+ ```python
396
+ rules = {
397
+ "rules": [
398
+ {
399
+ "type": "add_column_metadata",
400
+ "value": "identifier0"
401
+ },
402
+ {
403
+ "type": "add_column_metadata",
404
+ "value": "identifier0" # Duplicate for nesting
405
+ }
406
+ ],
407
+ "mapping": [
408
+ {
409
+ "type": "list_identifiers",
410
+ "columns": [0, 1] # TWO columns = nested structure
411
+ }
412
+ ]
413
+ }
414
+ ```
415
+
416
+ **Input:** `list [i1, i2]`
417
+ **Output:** `list:list [[i1], [i2]]`
418
+
419
+ **Rule Explanation:**
420
+ - Two `add_column_metadata` calls create two identifier columns
421
+ - `list_identifiers` with `columns: [0, 1]` creates two-level nesting
422
+ - Column 0 = outer identifier, Column 1 = inner identifier
423
+
424
+ ---
425
+
426
+ #### Example 3: Flatten List:Paired -> List
427
+
428
+ **Purpose:** Flatten nested collection with custom identifiers
429
+
430
+ ```python
431
+ rules = {
432
+ "rules": [
433
+ {
434
+ "type": "add_column_metadata",
435
+ "value": "identifier0" # Outer identifier (test0)
436
+ },
437
+ {
438
+ "type": "add_column_metadata",
439
+ "value": "identifier1" # Inner identifier (forward/reverse)
440
+ },
441
+ {
442
+ "type": "add_column_concatenate",
443
+ "target_column_0": 0,
444
+ "target_column_1": 1 # Concatenate: "test0" + "forward"
445
+ }
446
+ ],
447
+ "mapping": [
448
+ {
449
+ "type": "list_identifiers",
450
+ "columns": [2] # Use concatenated column
451
+ }
452
+ ]
453
+ }
454
+ ```
455
+
456
+ **Input:** `list:paired [test0 -> {forward, reverse}]`
457
+ **Output:** `list [test0forward, test0reverse]`
458
+
459
+ **Rule Explanation:**
460
+ - Get outer and inner identifiers
461
+ - Concatenate them (column 2 = column 0 + column 1)
462
+ - Create flat list using concatenated identifiers
463
+
464
+ ---
465
+
466
+ #### Example 4: Nest with Group Tags
467
+
468
+ **Purpose:** Group elements by tag metadata
469
+
470
+ ```python
471
+ rules = {
472
+ "rules": [
473
+ {
474
+ "type": "add_column_metadata",
475
+ "value": "identifier0"
476
+ },
477
+ {
478
+ "type": "add_column_group_tag_value",
479
+ "value": "type", # Extract "type" from "group:type:X"
480
+ "default_value": "unused"
481
+ }
482
+ ],
483
+ "mapping": [
484
+ {
485
+ "type": "list_identifiers",
486
+ "columns": [1, 0] # Group by tag value, then identifier
487
+ }
488
+ ]
489
+ }
490
+ ```
491
+
492
+ **Input:**
493
+ ```
494
+ list [
495
+ i1 (tags: ["group:type:single"]),
496
+ i2 (tags: ["group:type:paired"]),
497
+ i3 (tags: ["group:type:paired"])
498
+ ]
499
+ ```
500
+
501
+ **Output:**
502
+ ```
503
+ list:list [
504
+ single -> [i1],
505
+ paired -> [i2, i3]
506
+ ]
507
+ ```
508
+
509
+ **Rule Explanation:**
510
+ - Extract group tag value from metadata
511
+ - Use tag value as outer identifier
512
+ - Original identifiers become inner identifiers
513
+ - Groups elements by tag
514
+
515
+ ---
516
+
517
+ #### Example 5: Extract and Apply Tags
518
+
519
+ **Purpose:** Extract tags from metadata and apply to reorganized collection
520
+
521
+ ```python
522
+ rules = {
523
+ "rules": [
524
+ {
525
+ "type": "add_column_metadata",
526
+ "value": "identifier0"
527
+ },
528
+ {
529
+ "type": "add_column_group_tag_value",
530
+ "value": "type",
531
+ "default_value": "unused"
532
+ }
533
+ ],
534
+ "mapping": [
535
+ {
536
+ "type": "list_identifiers",
537
+ "columns": [1, 0]
538
+ },
539
+ {
540
+ "type": "group_tags",
541
+ "columns": [1] # Apply group tags from column 1
542
+ },
543
+ {
544
+ "type": "tags",
545
+ "columns": [0] # Apply regular tags from column 0
546
+ }
547
+ ]
548
+ }
549
+ ```
550
+
551
+ **Input:** Same as Example 4
552
+ **Output:** Same structure, but with tags applied to elements
553
+
554
+ **Rule Explanation:**
555
+ - Reorganize by tags (like Example 4)
556
+ - `group_tags` mapping: Apply group tags to elements
557
+ - `tags` mapping: Apply element-level tags
558
+ - Tags preserved through reorganization
559
+
560
+ ---
561
+
562
+ #### Example 6: Preserve Existing Tags
563
+
564
+ **Purpose:** Maintain tags while restructuring
565
+
566
+ ```python
567
+ rules = {
568
+ "rules": [
569
+ {
570
+ "type": "add_column_metadata",
571
+ "value": "identifier0"
572
+ },
573
+ {
574
+ "type": "add_column_metadata",
575
+ "value": "tags" # Get all tags
576
+ }
577
+ ],
578
+ "mapping": [
579
+ {
580
+ "type": "list_identifiers",
581
+ "columns": [0]
582
+ },
583
+ {
584
+ "type": "tags",
585
+ "columns": [1] # Reapply tags
586
+ }
587
+ ]
588
+ }
589
+ ```
590
+
591
+ **Input:** List with tagged elements
592
+ **Output:** Same list with all tags preserved
593
+
594
+ **Rule Explanation:**
595
+ - Extract tags to column
596
+ - Recreate same structure
597
+ - Reapply tags from column
598
+ - Ensures tags not lost during operations
599
+
600
+ ---
601
+
602
+ #### Example 7: Flatten Using Indices
603
+
604
+ **Purpose:** Create identifiers from positional indices
605
+
606
+ ```python
607
+ rules = {
608
+ "rules": [
609
+ {
610
+ "type": "add_column_metadata",
611
+ "value": "index0" # Outer index (0)
612
+ },
613
+ {
614
+ "type": "add_column_value",
615
+ "value": "_" # Separator
616
+ },
617
+ {
618
+ "type": "add_column_metadata",
619
+ "value": "index1" # Inner index (0, 1)
620
+ },
621
+ {
622
+ "type": "add_column_concatenate",
623
+ "target_column_0": 0,
624
+ "target_column_1": 1 # "0" + "_"
625
+ },
626
+ {
627
+ "type": "add_column_concatenate",
628
+ "target_column_0": 3,
629
+ "target_column_1": 2 # "0_" + "0" = "0_0"
630
+ }
631
+ ],
632
+ "mapping": [
633
+ {
634
+ "type": "list_identifiers",
635
+ "columns": [4]
636
+ }
637
+ ]
638
+ }
639
+ ```
640
+
641
+ **Input:** `list:paired [test0 -> {forward, reverse}]`
642
+ **Output:** `list [0_0, 0_1]`
643
+
644
+ **Rule Explanation:**
645
+ - Use positional indices instead of names
646
+ - Concatenate with custom separator
647
+ - Useful for purely numerical identifiers
648
+
649
+ ---
650
+
651
+ ### 5. Common Rule Operations
652
+
653
+ #### Rule Types Reference
654
+
655
+ **Metadata Operations:**
656
+ ```python
657
+ # Extract identifier at level N
658
+ {"type": "add_column_metadata", "value": "identifier0"} # Level 0 (outermost)
659
+ {"type": "add_column_metadata", "value": "identifier1"} # Level 1
660
+ {"type": "add_column_metadata", "value": "identifier2"} # Level 2
661
+
662
+ # Extract index at level N
663
+ {"type": "add_column_metadata", "value": "index0"}
664
+ {"type": "add_column_metadata", "value": "index1"}
665
+
666
+ # Extract tags
667
+ {"type": "add_column_metadata", "value": "tags"}
668
+
669
+ # Extract group tag value
670
+ {"type": "add_column_group_tag_value", "value": "tag_name", "default_value": "default"}
671
+ ```
672
+
673
+ **Column Operations:**
674
+ ```python
675
+ # Add literal value
676
+ {"type": "add_column_value", "value": "literal_string"}
677
+
678
+ # Concatenate columns
679
+ {"type": "add_column_concatenate", "target_column_0": 0, "target_column_1": 1}
680
+
681
+ # Split column with regex
682
+ {"type": "add_column_regex", "expression": "pattern", "target_column": 0}
683
+ ```
684
+
685
+ **Mapping Types:**
686
+ ```python
687
+ # Create list structure
688
+ {"type": "list_identifiers", "columns": [0]} # Simple list
689
+ {"type": "list_identifiers", "columns": [0, 1]} # Nested list:list
690
+ {"type": "list_identifiers", "columns": [0, 1, 2]} # list:list:list
691
+
692
+ # Apply tags
693
+ {"type": "tags", "columns": [0]}
694
+ {"type": "group_tags", "columns": [0]}
695
+ ```
696
+
697
+ ---
698
+
699
+ ### 6. Workflow Integration Tests
700
+
701
+ #### Test: Apply Rules in Workflow
702
+
703
+ ```python
704
+ workflow = """
705
+ class: GalaxyWorkflow
706
+ inputs:
707
+ input_c: collection
708
+ steps:
709
+ apply:
710
+ tool_id: __APPLY_RULES__
711
+ state:
712
+ input:
713
+ $link: input_c
714
+ rules:
715
+ rules:
716
+ - type: add_column_metadata
717
+ value: identifier0
718
+ - type: add_column_metadata
719
+ value: identifier0
720
+ mapping:
721
+ - type: list_identifiers
722
+ columns: [0, 1]
723
+ random_lines:
724
+ tool_id: random_lines1
725
+ state:
726
+ num_lines: 1
727
+ input:
728
+ $link: apply/output
729
+ """
730
+
731
+ test_data = """
732
+ input_c:
733
+ collection_type: list
734
+ elements:
735
+ - identifier: i1
736
+ content: "0"
737
+ - identifier: i2
738
+ content: "1"
739
+ """
740
+ ```
741
+
742
+ **Key Insights:**
743
+ - Apply Rules seamlessly integrates into workflows
744
+ - Rules defined in workflow YAML
745
+ - Output used by downstream tools
746
+ - Fully reproducible pipeline
747
+
748
+ ---
749
+
750
+ #### Test: Filter Failed in Workflow
751
+
752
+ ```python
753
+ workflow = """
754
+ class: GalaxyWorkflow
755
+ inputs:
756
+ input_c: collection
757
+
758
+ steps:
759
+ mixed_collection:
760
+ tool_id: exit_code_from_file
761
+ state:
762
+ input:
763
+ $link: input_c
764
+
765
+ filtered_collection:
766
+ tool_id: "__FILTER_FAILED_DATASETS__"
767
+ state:
768
+ input:
769
+ $link: mixed_collection/out_file1
770
+
771
+ cat:
772
+ tool_id: cat1
773
+ state:
774
+ input1:
775
+ $link: filtered_collection
776
+ """
777
+ ```
778
+
779
+ **Key Insights:**
780
+ - Filter Failed removes error datasets
781
+ - Allows pipeline to continue despite failures
782
+ - Downstream tools receive only successful data
783
+ - Common pattern for robust pipelines
784
+
785
+ ---
786
+
787
+ ### 7. Edge Cases and Best Practices
788
+
789
+ #### Edge Case: Incompatible Collection Types
790
+
791
+ ```python
792
+ def test_cannot_map_over_incompatible_collections():
793
+ hdca1_id = _build_pair(history_id, ["123\n", "456\n"]) # Paired
794
+ hdca2_id = create_list_in_history(history_id) # List
795
+
796
+ inputs = {
797
+ "input1": {"batch": True, "values": [{"src": "hdca", "id": hdca1_id}]},
798
+ "input2": {"batch": True, "values": [{"src": "hdca", "id": hdca2_id}]}
799
+ }
800
+ run_response = _run("cat1", history_id, inputs)
801
+ assert run_response.status_code >= 400 # ERROR
802
+ ```
803
+
804
+ **Lesson:** Cannot map over collections with different structures (paired vs list).
805
+
806
+ ---
807
+
808
+ #### Best Practice: Wait for History
809
+
810
+ ```python
811
+ # Always wait for history before operations
812
+ dataset_populator.wait_for_history(history_id, assert_ok=True)
813
+
814
+ # Then run tool
815
+ response = _run("tool_id", history_id, inputs)
816
+ ```
817
+
818
+ **Lesson:** Ensure datasets are ready before processing.
819
+
820
+ ---
821
+
822
+ #### Best Practice: Wait for Jobs
823
+
824
+ ```python
825
+ result = _run("tool_id", history_id, inputs)
826
+
827
+ # Wait for all jobs to complete
828
+ for job in result["jobs"]:
829
+ dataset_populator.wait_for_job(job["id"], assert_ok=True)
830
+
831
+ # Then access outputs
832
+ outputs = result["outputs"]
833
+ ```
834
+
835
+ **Lesson:** Jobs execute asynchronously. Wait before accessing results.
836
+
837
+ ---
838
+
839
+ #### Best Practice: Check Implicit Collections
840
+
841
+ ```python
842
+ response = _run("tool_id", history_id, inputs)
843
+
844
+ implicit_collections = response["implicit_collections"]
845
+ assert implicit_collections # Verify created
846
+
847
+ for implicit_collection in implicit_collections:
848
+ assert implicit_collection["populated_state"] == "ok"
849
+ ```
850
+
851
+ **Lesson:** Map-over creates implicit collections. Verify they populated correctly.
852
+
853
+ ---
854
+
855
+ ### 8. Testing Patterns Summary
856
+
857
+ #### Pattern 1: Simple Tool Test
858
+
859
+ ```python
860
+ 1. Create test collection
861
+ 2. Prepare inputs with proper structure
862
+ 3. Execute tool via _run()
863
+ 4. Verify outputs/collections
864
+ 5. Check content if needed
865
+ ```
866
+
867
+ #### Pattern 2: Map-Over Test
868
+
869
+ ```python
870
+ 1. Create collection(s)
871
+ 2. Set "batch": True in inputs
872
+ 3. Execute tool
873
+ 4. Verify job count (one per element)
874
+ 5. Verify implicit_collections created
875
+ 6. Check output structure and content
876
+ ```
877
+
878
+ #### Pattern 3: Workflow Test
879
+
880
+ ```python
881
+ 1. Define workflow YAML with collection operations
882
+ 2. Prepare test_data
883
+ 3. Run workflow with test data
884
+ 4. Verify outputs at specific HIDs
885
+ 5. Check collection structure and content
886
+ ```
887
+
888
+ #### Pattern 4: Apply Rules Test
889
+
890
+ ```python
891
+ 1. Define rules structure (rules + mapping)
892
+ 2. Create test collection
893
+ 3. Execute __APPLY_RULES__ with rules
894
+ 4. Verify output collection type
895
+ 5. Verify element structure
896
+ 6. Check identifier values
897
+ 7. Verify tags if applicable
898
+ ```
899
+
900
+ ---
901
+
902
+ ## Key Takeaways from Tests
903
+
904
+ ### 1. Collection References
905
+
906
+ Always use proper src/id structure:
907
+ ```python
908
+ {"src": "hdca", "id": "collection_id"} # Collections
909
+ {"src": "hda", "id": "dataset_id"} # Datasets
910
+ ```
911
+
912
+ ### 2. Batch Processing
913
+
914
+ Enable with `"batch": True`:
915
+ ```python
916
+ {"batch": True, "values": [{"src": "hdca", "id": "..."}]}
917
+ ```
918
+
919
+ Control linking:
920
+ ```python
921
+ {"batch": True, "linked": False, "values": [...]} # Cartesian product
922
+ ```
923
+
924
+ ### 3. Nested Collections
925
+
926
+ Specify map-over level:
927
+ ```python
928
+ {"batch": True, "values": [{"src": "hdca", "map_over_type": "paired", "id": "..."}]}
929
+ ```
930
+
931
+ ### 4. Apply Rules Structure
932
+
933
+ **Basic structure:**
934
+ ```python
935
+ {
936
+ "rules": {
937
+ "rules": [
938
+ # List of rule operations
939
+ ],
940
+ "mapping": [
941
+ # List of mapping operations
942
+ ]
943
+ }
944
+ }
945
+ ```
946
+
947
+ **Common pattern:**
948
+ 1. Add columns (metadata, values, etc.)
949
+ 2. Transform columns (concatenate, regex, etc.)
950
+ 3. Map to collection structure
951
+
952
+ ### 5. Output Types
953
+
954
+ - `outputs`: Individual datasets
955
+ - `output_collections`: Explicitly created collections
956
+ - `implicit_collections`: Created by map-over operations
957
+ - `jobs`: Job records for tracking
958
+
959
+ ### 6. Asynchronous Operations
960
+
961
+ - Jobs execute asynchronously
962
+ - Always wait for completion before accessing outputs
963
+ - Check `populated_state` for implicit collections
964
+
965
+ ### 7. Tool-Based Operations Win
966
+
967
+ Tests consistently demonstrate:
968
+ - Using Galaxy's native tools
969
+ - Proper input/output structures
970
+ - Reproducible operations
971
+ - Workflow compatibility
972
+
973
+ **No tests show direct API manipulation of collection metadata.**
974
+
975
+ ---
976
+
977
+ ## Summary: Testing Philosophy
978
+
979
+ Galaxy's tests demonstrate that "all collection operations should use native tools", even programmatically via API. This ensures:
980
+
981
+ 1. **Reproducibility**: Operations captured in history
982
+ 2. **Testability**: Consistent behavior across versions
983
+ 3. **Workflow compatibility**: Operations extractable to workflows
984
+ 4. **Proper error handling**: Tools handle edge cases
985
+ 5. **Community alignment**: Standard patterns everyone uses
986
+
987
+ When writing collection manipulation code, **always follow the patterns shown in Galaxy's own tests**: use tools, not direct manipulation.
988
+
989
+ ---
990
+
991
+ ## Additional Resources
992
+
993
+ - **Tool Catalog:** See `references/tools.md` for complete tool list
994
+ - **API Guide:** See `references/api-patterns.md` for API usage patterns
995
+ - **Apply Rules DSL:** See `references/apply-rules.md` for rule builder syntax
996
+ - **Test Source:** `lib/galaxy_test/api/test_tools.py` for more examples