@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,892 @@
1
+ ---
2
+ name: collection-manipulation
3
+ description: Transform Galaxy dataset collections reproducibly using Galaxy's native tools. Use when asked to filter, sort, relabel, restructure, flatten, nest or merge a collection, build a list or paired collection, run a tool over every sample (map over a collection), or work with element identifiers.
4
+ metadata:
5
+ surfaces: [loom]
6
+ user_invocable: true
7
+ ---
8
+
9
+ # Galaxy Collection Manipulation
10
+
11
+ Transform Galaxy dataset collections reproducibly using Galaxy's native tools.
12
+
13
+ **CRITICAL PRINCIPLE:** All collection operations MUST use Galaxy's native tools to ensure reproducibility, workflow extractability, and alignment with Galaxy best practices. NEVER manipulate collections directly via API or create collections ad-hoc.
14
+
15
+ ## Common Pitfalls (READ FIRST)
16
+
17
+ These issues cause silent failures or empty results. **Memorize them.**
18
+
19
+ > For deep-dive reference on API patterns, Apply Rules DSL, tool catalog, and test examples, see `references/` in the `collection-manipulation` skill directory.
20
+
21
+ ### 1. Data Inputs Require `values` Wrapper
22
+
23
+ Many tools silently fail without this wrapper:
24
+
25
+ ```python
26
+ # WRONG - Tool runs with no input, produces empty collection
27
+ inputs = {
28
+ "input": {"src": "hdca", "id": collection_id}
29
+ }
30
+
31
+ # CORRECT - With values wrapper
32
+ inputs = {
33
+ "input": {
34
+ "values": [{"src": "hdca", "id": collection_id}]
35
+ }
36
+ }
37
+ ```
38
+
39
+ ### 2. Conditional Parameters Use Pipe Notation
40
+
41
+ ```python
42
+ # WRONG - Nested object ignored, defaults used
43
+ inputs = {
44
+ "how": {
45
+ "how_filter": "remove_if_absent",
46
+ "filter_source": {"src": "hda", "id": file_id}
47
+ }
48
+ }
49
+
50
+ # CORRECT - Pipe notation
51
+ inputs = {
52
+ "how|how_filter": "remove_if_absent",
53
+ "how|filter_source": {"src": "hda", "id": file_id}
54
+ }
55
+ ```
56
+
57
+ ### 3. Job Outputs Require `full=true`
58
+
59
+ ```python
60
+ # WRONG - Returns empty for collection operations
61
+ outputs = GET /api/jobs/{job_id}/outputs
62
+
63
+ # CORRECT - Use full=true to get output_collections
64
+ job = GET /api/jobs/{job_id}?full=true
65
+ collection_id = job["output_collections"][0]["id"]
66
+ ```
67
+
68
+ ### 4. Galaxy Fails Silently
69
+
70
+ Wrong input format → tool runs with defaults → empty/wrong output. **Always verify output contents**, not just job status.
71
+
72
+ ### 5. FILTER_FROM_FILE Correct Structure
73
+
74
+ This tool commonly fails due to format issues:
75
+
76
+ ```python
77
+ # CORRECT structure for __FILTER_FROM_FILE__
78
+ inputs = {
79
+ "input": {
80
+ "values": [{"src": "hdca", "id": collection_id}]
81
+ },
82
+ "how|how_filter": "remove_if_absent",
83
+ "how|filter_source": {
84
+ "values": [{"src": "hda", "id": identifier_file_id}]
85
+ }
86
+ }
87
+ ```
88
+
89
+ ### 6. Debugging with `/api/tools/{id}/build`
90
+
91
+ When inputs are ignored, use the build endpoint to discover correct format:
92
+
93
+ ```python
94
+ # Get expected input structure for any tool
95
+ GET /api/tools/__FILTER_FROM_FILE__/build?history_id={history_id}
96
+
97
+ # Response shows exact format expected:
98
+ {
99
+ "inputs": [
100
+ {
101
+ "name": "input",
102
+ "value": {"values": [{"id": "...", "src": "hdca"}]} # Note the wrapper!
103
+ },
104
+ {
105
+ "name": "how|filter_source", # Note pipe notation!
106
+ "value": {"values": [...]}
107
+ }
108
+ ]
109
+ }
110
+ ```
111
+
112
+ ### 7. Repeated Parameters Pattern
113
+
114
+ Tools with repeating sections (like `__BUILD_LIST__`) use indexed notation:
115
+
116
+ ```python
117
+ inputs = {
118
+ "datasets_0|input": {"src": "hda", "id": dataset1_id},
119
+ "datasets_1|input": {"src": "hda", "id": dataset2_id},
120
+ "datasets_2|input": {"src": "hda", "id": dataset3_id}
121
+ }
122
+ ```
123
+
124
+ ### 8. Tool Response Structure
125
+
126
+ Understand what comes back from tool execution:
127
+
128
+ ```python
129
+ response = POST /api/tools { tool_id, history_id, inputs }
130
+
131
+ # Response contains:
132
+ {
133
+ "outputs": [...], # Individual datasets created
134
+ "output_collections": [...], # Explicitly created collections
135
+ "implicit_collections": [...], # Collections from map-over operations
136
+ "jobs": [...] # Job IDs for polling
137
+ }
138
+ ```
139
+
140
+ - Use `outputs` for single dataset results
141
+ - Use `output_collections` for collection tool results
142
+ - Use `implicit_collections` when mapping a tool over a collection
143
+
144
+ ### 9. Inspecting Collections
145
+
146
+ Before transforming, inspect what you're working with:
147
+
148
+ ```python
149
+ # Get full collection structure
150
+ collection = GET /api/histories/{history_id}/contents/dataset_collections/{collection_id}
151
+
152
+ # Traverse elements
153
+ for element in collection["elements"]:
154
+ identifier = element["element_identifier"] # The name
155
+ elem_type = element["element_type"] # "hda" or "dataset_collection"
156
+
157
+ if elem_type == "hda":
158
+ dataset = element["object"]
159
+ dataset_id = dataset["id"]
160
+ elif elem_type == "dataset_collection":
161
+ nested = element["object"] # Recurse for nested collections
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Galaxy MCP Server (Preferred When Available)
167
+
168
+ If Galaxy MCP is configured, **prefer it over direct API calls**. MCP avoids all the pitfalls above.
169
+
170
+ **Repository:** https://github.com/galaxyproject/galaxy-mcp
171
+
172
+ ### MCP Advantages
173
+
174
+ - **No `values` wrapper needed** - MCP handles input format complexity internally
175
+ - **Simplified authentication** - Uses configured credentials
176
+ - **Built-in error handling** - Clearer error messages than silent API failures
177
+
178
+ ### MCP Tools Available
179
+
180
+ | MCP Tool | Purpose |
181
+ |----------|---------|
182
+ | `run_tool` | Execute Galaxy tools |
183
+ | `get_histories` | List user histories |
184
+ | `list_history_ids` | Get history IDs |
185
+ | `get_history_contents` | List history items |
186
+ | `get_job_details` | Check job status and outputs |
187
+
188
+ ### MCP Usage Examples
189
+
190
+ **Run a collection operation:**
191
+ ```python
192
+ # MCP - Simple, no wrapper needed
193
+ run_tool(
194
+ tool_id="__FILTER_FROM_FILE__",
195
+ inputs={
196
+ "input": {"src": "hdca", "id": collection_id},
197
+ "how|how_filter": "remove_if_absent",
198
+ "how|filter_source": {"src": "hda", "id": filter_file_id}
199
+ }
200
+ )
201
+ ```
202
+
203
+ **Check job and get outputs:**
204
+ ```python
205
+ job = get_job_details(job_id)
206
+ # output_collections included automatically
207
+ ```
208
+
209
+ ### When MCP Is Not Available
210
+
211
+ Fall back to direct API calls using the patterns in this document. The "Common Pitfalls" section above becomes critical - follow those patterns exactly.
212
+
213
+ ---
214
+
215
+ ## Decision Framework
216
+
217
+ ### Step 1: Assess Available Metadata
218
+
219
+ Before choosing a strategy, examine what metadata exists:
220
+
221
+ **In the collection itself:**
222
+ - Element identifiers (names)
223
+ - Nested structure (list, paired, list:paired, etc.)
224
+ - Element indices (positional)
225
+
226
+ **In dataset tags:**
227
+ - Simple tags (labels)
228
+ - Group tags (`group:category:value`)
229
+ - Name tags (`name:value` or `#value`)
230
+
231
+ **Embedded in identifiers:**
232
+ - Patterns extractable via regex (e.g., `sample_001_R1.fastq` contains sample ID and read direction)
233
+
234
+ ### Step 2: Choose Strategy (in order of preference)
235
+
236
+ #### Strategy A: Collection Operation Tools (PREFERRED)
237
+
238
+ Use when transformation maps directly to an existing tool's capability.
239
+
240
+ | Goal | Tool ID | When to Use |
241
+ |------|---------|-------------|
242
+ | Filter by identifier list | `__FILTER_FROM_FILE__` | Keep/remove specific elements |
243
+ | Remove empty elements | `__FILTER_EMPTY_DATASETS__` | Clean up after failures |
244
+ | Remove failed elements | `__FILTER_FAILED_DATASETS__` | Continue after partial failures |
245
+ | Remove null elements | `__FILTER_NULL__` | Clean conditional outputs |
246
+ | Keep only successful | `__KEEP_SUCCESS_DATASETS__` | Ensure only completed samples |
247
+ | Extract single element | `__EXTRACT_DATASET__` | Get specific dataset by name/index |
248
+ | Flatten nested → flat | `__FLATTEN__` | Convert list:paired to list |
249
+ | Add nesting level | `__NEST__` | Convert list to list:list |
250
+ | Create paired from two | `__ZIP_COLLECTION__` | Combine forward/reverse |
251
+ | Split paired to two | `__UNZIP_COLLECTION__` | Separate paired collection |
252
+ | Split paired/unpaired | `__SPLIT_PAIRED_AND_UNPAIRED__` | Handle mixed collections |
253
+ | Merge collections | `__MERGE_COLLECTION__` | Combine multiple collections |
254
+ | Match two collections | `__HARMONIZELISTS__` | Ensure same elements in same order |
255
+ | Rename elements | `__RELABEL_FROM_FILE__` | Change identifiers via mapping |
256
+ | Reorder elements | `__SORTLIST__` | Alphabetic, numeric, or custom order |
257
+ | Add tags | `__TAG_FROM_FILE__` | Apply metadata tags |
258
+ | Cross product (flat) | `__CROSS_PRODUCT_FLAT__` | All-vs-all comparisons |
259
+ | Cross product (nested) | `__CROSS_PRODUCT_NESTED__` | All-vs-all with hierarchy |
260
+ | Build list | `__BUILD_LIST__` | Combine datasets into collection |
261
+ | Duplicate to collection | `__DUPLICATE_FILE_TO_COLLECTION__` | Replicate dataset N times |
262
+
263
+ > For detailed tool documentation, see `references/tools.md`.
264
+
265
+ ---
266
+
267
+ #### Strategy B: Apply Rules (WHEN SIMPLE TOOLS INSUFFICIENT)
268
+
269
+ Use when you need:
270
+ - Complex identifier parsing via regex
271
+ - Tag-based restructuring
272
+ - Conditional filtering combined with restructuring
273
+ - Structure transformations beyond simple tools
274
+
275
+ **Core Concept:** Collection → Table → Transform → Collection
276
+
277
+ **Structure:**
278
+ ```yaml
279
+ rules:
280
+ rules:
281
+ - # List of rule operations (applied sequentially)
282
+ mapping:
283
+ - # List of mapping operations (define output structure)
284
+ ```
285
+
286
+ > For comprehensive Apply Rules DSL documentation, see `references/apply-rules.md`.
287
+
288
+ ##### Column Addition Rules
289
+
290
+ | Rule Type | Purpose | Parameters |
291
+ |-----------|---------|------------|
292
+ | `add_column_metadata` | Extract identifier/index/tags | `value`: `identifier0`, `identifier1`, `index0`, `index1`, `tags` |
293
+ | `add_column_group_tag_value` | Extract specific group tag | `value`: tag name, `default_value`: fallback |
294
+ | `add_column_regex` | Regex capture/replace | `target_column`, `expression`, `replacement`?, `group_count`?, `allow_unmatched`? |
295
+ | `add_column_substr` | Fixed substring | `target_column`, `substr_type`: keep_prefix/suffix or drop_prefix/suffix, `length` |
296
+ | `add_column_rownum` | Sequential numbers | `start`: 0 or 1 |
297
+ | `add_column_value` | Constant value | `value`: literal string |
298
+ | `add_column_concatenate` | Join two columns | `target_column_0`, `target_column_1` |
299
+ | `add_column_basename` | Extract filename from path | `target_column` |
300
+ | `add_column_from_sample_sheet_index` | Sample sheet column | `value`: column index |
301
+
302
+ ##### Filter Rules
303
+
304
+ | Rule Type | Purpose | Parameters |
305
+ |-----------|---------|------------|
306
+ | `add_filter_regex` | Keep/remove by pattern | `target_column`, `expression`, `invert` (false=keep matches, true=remove matches) |
307
+ | `add_filter_matches` | Exact value match | `target_column`, `value`, `invert` |
308
+ | `add_filter_count` | First/last N rows | `count`, `which`: first/last, `invert` |
309
+ | `add_filter_empty` | Remove empty cells | `target_column`, `invert` |
310
+ | `add_filter_compare` | Numeric comparison | `target_column`, `value`, `compare_type`: less_than/greater_than/etc. |
311
+
312
+ ##### Structural Rules
313
+
314
+ | Rule Type | Purpose | Parameters |
315
+ |-----------|---------|------------|
316
+ | `remove_columns` | Delete columns | `target_columns`: list of indices |
317
+ | `sort` | Order rows | `target_column`, `numeric`: true/false |
318
+ | `swap_columns` | Exchange positions | `target_column_0`, `target_column_1` |
319
+ | `split_columns` | Expand rows (Cartesian) | `target_columns_0`, `target_columns_1` |
320
+
321
+ ##### Mapping Operations (Final Step)
322
+
323
+ | Mapping Type | Purpose | Parameters |
324
+ |--------------|---------|------------|
325
+ | `list_identifiers` | Create list structure | `columns`: [0] = list, [0,1] = list:list, [0,1,2] = list:list:list |
326
+ | `paired_identifier` | Add paired level | `columns`: single column with forward/reverse/f/r/1/2/R1/R2 |
327
+ | `paired_or_unpaired_identifier` | Mixed paired | `columns`: single column |
328
+ | `tags` | Apply element tags | `columns`: list of tag value columns |
329
+ | `group_tags` | Apply group tags | `columns`: list of columns |
330
+
331
+ ##### Apply Rules Examples
332
+
333
+ **Example 1: Flatten list:paired with custom identifiers**
334
+ ```python
335
+ rules = {
336
+ "rules": [
337
+ {"type": "add_column_metadata", "value": "identifier0"},
338
+ {"type": "add_column_metadata", "value": "identifier1"},
339
+ {"type": "add_column_concatenate", "target_column_0": 0, "target_column_1": 1}
340
+ ],
341
+ "mapping": [
342
+ {"type": "list_identifiers", "columns": [2]}
343
+ ]
344
+ }
345
+ ```
346
+
347
+ **Example 2: Parse paired-end RNA-seq filenames**
348
+
349
+ Files: `sample1_R1.fastq.gz`, `sample1_R2.fastq.gz`
350
+
351
+ ```python
352
+ rules = {
353
+ "rules": [
354
+ {"type": "add_column_metadata", "value": "identifier0"},
355
+ {"type": "add_column_regex", "target_column": 0, "expression": "(.+)_R([12])\\.fastq\\.gz", "group_count": 2},
356
+ {"type": "add_column_regex", "target_column": 2, "expression": "1", "replacement": "forward", "allow_unmatched": True},
357
+ {"type": "add_column_regex", "target_column": 2, "expression": "2", "replacement": "reverse", "allow_unmatched": True},
358
+ {"type": "add_column_concatenate", "target_column_0": 3, "target_column_1": 4},
359
+ {"type": "sort", "target_column": 1, "numeric": False},
360
+ {"type": "remove_columns", "target_columns": [0, 2, 3, 4]}
361
+ ],
362
+ "mapping": [
363
+ {"type": "list_identifiers", "columns": [0]},
364
+ {"type": "paired_identifier", "columns": [1]}
365
+ ]
366
+ }
367
+ ```
368
+
369
+ **Example 3: Group by experimental condition (from tags)**
370
+ ```python
371
+ rules = {
372
+ "rules": [
373
+ {"type": "add_column_metadata", "value": "identifier0"},
374
+ {"type": "add_column_group_tag_value", "value": "condition", "default_value": "unassigned"}
375
+ ],
376
+ "mapping": [
377
+ {"type": "list_identifiers", "columns": [1, 0]}, # Group by condition, then sample
378
+ {"type": "group_tags", "columns": [1]}
379
+ ]
380
+ }
381
+ ```
382
+
383
+ **Example 4: Filter and sort**
384
+ ```python
385
+ rules = {
386
+ "rules": [
387
+ {"type": "add_column_metadata", "value": "identifier0"},
388
+ {"type": "add_filter_regex", "target_column": 0, "expression": "^control_", "invert": True},
389
+ {"type": "sort", "numeric": False, "target_column": 0}
390
+ ],
391
+ "mapping": [
392
+ {"type": "list_identifiers", "columns": [0]}
393
+ ]
394
+ }
395
+ ```
396
+
397
+ ---
398
+
399
+ #### Strategy C: Upload Metadata Table (WHEN METADATA MISSING)
400
+
401
+ Use when required metadata doesn't exist in collection/tags but can be expressed as a simple table.
402
+
403
+ **Process:**
404
+ 1. Create tabular file mapping element identifiers to metadata
405
+ 2. Upload via Fetch API to history
406
+ 3. Use with `__TAG_FROM_FILE__`, `__RELABEL_FROM_FILE__`, or `__APPLY_RULES__`
407
+
408
+ **Upload Pattern:**
409
+ ```python
410
+ payload = {
411
+ "history_id": history_id,
412
+ "targets": [{
413
+ "destination": {"type": "hdas"},
414
+ "elements": [{
415
+ "src": "pasted",
416
+ "paste_content": "sample1\ttreated\nsample2\tcontrol\nsample3\ttreated",
417
+ "name": "condition_mapping.tabular",
418
+ "ext": "tabular"
419
+ }]
420
+ }]
421
+ }
422
+ # POST to /api/tools/fetch
423
+ ```
424
+
425
+ **Then tag samples:**
426
+ ```python
427
+ tag_inputs = {
428
+ "input": {"values": [{"src": "hdca", "id": collection_id}]},
429
+ "tags": {"values": [{"src": "hda", "id": metadata_file_id}]},
430
+ "how": "add"
431
+ }
432
+ # Run __TAG_FROM_FILE__
433
+ ```
434
+
435
+ **IMPORTANT:** Inform the user:
436
+ > "I've created a metadata mapping file that captures [metadata type]. This mapping is now an input to the analysis. For full reproducibility, ensure this file is included if re-running or sharing the workflow."
437
+
438
+ ---
439
+
440
+ #### Strategy D: Create Mirror Collection with Tags (LAST RESORT)
441
+
442
+ Use when:
443
+ - Required metadata cannot be represented in a simple table
444
+ - Complex conditional metadata based on dataset properties
445
+ - Metadata requires the structure of multiple related columns
446
+
447
+ **IMPORTANT:** Inform the user:
448
+ > "The original collection lacked metadata required for this transformation. I've created a new collection with the same datasets but with metadata attached via tags. **For full reproducibility, the analysis should be re-run with this new collection as input** so the metadata association is captured from the start."
449
+
450
+ ---
451
+
452
+ ## API Reference
453
+
454
+ ### Basic Tool Invocation
455
+
456
+ ```python
457
+ POST /api/tools
458
+ {
459
+ "tool_id": "__TOOL_ID__",
460
+ "history_id": history_id,
461
+ "inputs": { ... }
462
+ }
463
+ ```
464
+
465
+ ### Input Format Patterns
466
+
467
+ **Simple collection input:**
468
+ ```python
469
+ {"src": "hdca", "id": collection_id}
470
+ ```
471
+
472
+ **Collection with values wrapper (REQUIRED for many tools):**
473
+ ```python
474
+ {"values": [{"src": "hdca", "id": collection_id}]}
475
+ ```
476
+
477
+ **Dataset input:**
478
+ ```python
479
+ {"src": "hda", "id": dataset_id}
480
+ ```
481
+
482
+ **Batch/map-over collection:**
483
+ ```python
484
+ {
485
+ "batch": True,
486
+ "values": [{"src": "hdca", "id": collection_id}]
487
+ }
488
+ ```
489
+
490
+ **Linked map-over (process corresponding elements):**
491
+ ```python
492
+ {
493
+ "batch": True,
494
+ "linked": True, # default
495
+ "values": [{"src": "hdca", "id": collection_id}]
496
+ }
497
+ ```
498
+
499
+ **Unlinked map-over (Cartesian product):**
500
+ ```python
501
+ {
502
+ "batch": True,
503
+ "linked": False,
504
+ "values": [{"src": "hdca", "id": collection_id}]
505
+ }
506
+ ```
507
+
508
+ **Nested collection mapping (map over inner level):**
509
+ ```python
510
+ {
511
+ "batch": True,
512
+ "values": [{
513
+ "src": "hdca",
514
+ "map_over_type": "paired", # Specify inner level
515
+ "id": list_paired_collection_id
516
+ }]
517
+ }
518
+ ```
519
+
520
+ > For complete API reference with all tool examples, see `references/api-patterns.md`.
521
+
522
+ ### Tool-Specific Examples
523
+
524
+ **FILTER_FROM_FILE:**
525
+ ```python
526
+ inputs = {
527
+ "input": {"values": [{"src": "hdca", "id": collection_id}]},
528
+ "how|how_filter": "remove_if_absent",
529
+ "how|filter_source": {"values": [{"src": "hda", "id": identifier_file_id}]}
530
+ }
531
+ ```
532
+
533
+ **APPLY_RULES:**
534
+ ```python
535
+ inputs = {
536
+ "input": {"src": "hdca", "id": collection_id},
537
+ "rules": {
538
+ "rules": [...],
539
+ "mapping": [...]
540
+ }
541
+ }
542
+ ```
543
+
544
+ **RELABEL_FROM_FILE:**
545
+ ```python
546
+ inputs = {
547
+ "input": {"src": "hdca", "id": collection_id},
548
+ "how|how_select": "tabular",
549
+ "how|labels": {"src": "hda", "id": mapping_file_id},
550
+ "how|strict": False
551
+ }
552
+ ```
553
+
554
+ **TAG_FROM_FILE:**
555
+ ```python
556
+ inputs = {
557
+ "input": {"values": [{"src": "hdca", "id": collection_id}]},
558
+ "tags": {"values": [{"src": "hda", "id": tag_file_id}]},
559
+ "how": "add"
560
+ }
561
+ ```
562
+
563
+ **SORTLIST:**
564
+ ```python
565
+ inputs = {
566
+ "input": {"src": "hdca", "id": collection_id},
567
+ "sort_type|sort_type": "alpha" # or "numeric" or "file"
568
+ }
569
+ ```
570
+
571
+ ### Job Completion and Output Retrieval
572
+
573
+ ```python
574
+ def wait_for_job_and_get_output(job_id):
575
+ while True:
576
+ # CRITICAL: Use full=true to get output_collections
577
+ job = GET /api/jobs/{job_id}?full=true
578
+ if job["state"] == "ok":
579
+ return job["output_collections"][0]["id"]
580
+ elif job["state"] == "error":
581
+ raise Exception(f"Job failed: {job.get('stderr', 'Unknown error')}")
582
+ time.sleep(2)
583
+ ```
584
+
585
+ ### Get Collection Details
586
+
587
+ ```python
588
+ collection = GET /api/histories/{history_id}/contents/dataset_collections/{collection_id}
589
+ # Returns: elements, collection_type, element_count, etc.
590
+ ```
591
+
592
+ ### Complete Pipeline Example
593
+
594
+ End-to-end example: Filter → Sort → Relabel a collection.
595
+
596
+ ```python
597
+ import requests
598
+ import time
599
+
600
+ GALAXY_URL = "https://usegalaxy.org"
601
+ API_KEY = "your_api_key"
602
+ HEADERS = {"x-api-key": API_KEY}
603
+
604
+ def run_tool(tool_id, history_id, inputs):
605
+ """Execute tool and wait for completion."""
606
+ payload = {"tool_id": tool_id, "history_id": history_id, "inputs": inputs}
607
+ response = requests.post(f"{GALAXY_URL}/api/tools", json=payload, headers=HEADERS)
608
+ result = response.json()
609
+
610
+ # Wait for all jobs to complete
611
+ for job in result.get("jobs", []):
612
+ wait_for_job(job["id"])
613
+
614
+ return result
615
+
616
+ def wait_for_job(job_id):
617
+ """Poll until terminal state."""
618
+ while True:
619
+ job = requests.get(f"{GALAXY_URL}/api/jobs/{job_id}?full=true", headers=HEADERS).json()
620
+ if job["state"] == "ok":
621
+ return job
622
+ elif job["state"] == "error":
623
+ raise Exception(f"Job failed: {job.get('stderr', '')}")
624
+ time.sleep(2)
625
+
626
+ # Pipeline: Filter failed → Sort → Relabel
627
+ history_id = "abc123"
628
+ collection_id = "original_collection"
629
+ relabel_file_id = "mapping_file"
630
+
631
+ # Step 1: Remove failed datasets
632
+ result1 = run_tool("__FILTER_FAILED_DATASETS__", history_id, {
633
+ "input": {"src": "hdca", "id": collection_id}
634
+ })
635
+ filtered_id = result1["output_collections"][0]["id"]
636
+
637
+ # Step 2: Sort alphabetically
638
+ result2 = run_tool("__SORTLIST__", history_id, {
639
+ "input": {"src": "hdca", "id": filtered_id},
640
+ "sort_type|sort_type": "alpha"
641
+ })
642
+ sorted_id = result2["output_collections"][0]["id"]
643
+
644
+ # Step 3: Relabel with mapping file
645
+ result3 = run_tool("__RELABEL_FROM_FILE__", history_id, {
646
+ "input": {"src": "hdca", "id": sorted_id},
647
+ "how|how_select": "tabular",
648
+ "how|labels": {"src": "hda", "id": relabel_file_id}
649
+ })
650
+ final_id = result3["output_collections"][0]["id"]
651
+
652
+ print(f"Pipeline complete: {final_id}")
653
+ ```
654
+
655
+ ---
656
+
657
+ ## Critical Rules
658
+
659
+ ### NEVER Do These
660
+
661
+ 1. **NEVER manipulate collection metadata directly via API**
662
+ ```python
663
+ # WRONG
664
+ collection = get_collection_details(collection_id)
665
+ filtered = [e for e in collection["elements"] if condition(e)]
666
+ create_new_collection(filtered)
667
+ ```
668
+
669
+ 2. **NEVER create collections ad-hoc without tools** (except Strategy D with explicit warning)
670
+
671
+ 3. **NEVER bypass Galaxy tools for "convenience"**
672
+
673
+ 4. **NEVER forget to explain reproducibility implications**
674
+
675
+ 5. **NEVER use Apply Rules when simple tools suffice**
676
+
677
+ ### ALWAYS Do These
678
+
679
+ 1. **ALWAYS use Galaxy's native tools** via `/api/tools`
680
+
681
+ 2. **ALWAYS use `values` wrapper** for filter/tag tools
682
+
683
+ 3. **ALWAYS use pipe notation** for conditional parameters
684
+
685
+ 4. **ALWAYS use `?full=true`** when getting job outputs for collections
686
+
687
+ 5. **ALWAYS verify output contents** (not just job status)
688
+
689
+ 6. **ALWAYS explain why** the tool-based approach ensures reproducibility
690
+
691
+ 7. **ALWAYS wait for job completion** before proceeding
692
+
693
+ 8. **ALWAYS chain operations through history** (output becomes next input)
694
+
695
+ ---
696
+
697
+ ## Response Template
698
+
699
+ When responding to a collection transformation request:
700
+
701
+ ### 1. Understanding Phase
702
+ "I understand you want to [describe transformation]. Let me assess what metadata is available..."
703
+
704
+ ### 2. Assessment Phase
705
+ "Looking at your collection:
706
+ - Structure: [list/paired/list:paired/etc.]
707
+ - Available metadata: [identifiers/tags/etc.]
708
+ - Missing metadata: [if any]"
709
+
710
+ ### 3. Approach Phase
711
+ "To accomplish this reproducibly, I'll use [tool name(s)] because [reason]. This ensures:
712
+ - All operations captured in Galaxy history
713
+ - Can be extracted to a workflow
714
+ - Reproducible for future analyses
715
+ - Aligns with Galaxy best practices"
716
+
717
+ ### 4. Implementation Phase
718
+ [Execute the tools with correct input formats]
719
+
720
+ ### 5. Verification Phase
721
+ "I've completed the transformation. To verify:
722
+ - Check output collection has [expected element count]
723
+ - Confirm element identifiers match [expected pattern]
724
+ - Review job details at /api/jobs/{job_id}?full=true"
725
+
726
+ ### 6. Reproducibility Note
727
+ - If Strategy A/B: "This operation is fully captured in Galaxy history and can be extracted to a workflow."
728
+ - If Strategy C: "A metadata mapping file was created. Include this in any shared workflows."
729
+ - If Strategy D: "A new source collection with metadata tags was created. For reproducibility, re-run the analysis with this as input."
730
+
731
+ ---
732
+
733
+ ## Example Interactions
734
+
735
+ ### Example 1: Simple Filtering
736
+
737
+ **User:** "Remove samples starting with 'control_' from my collection"
738
+
739
+ **Response:**
740
+
741
+ I understand you want to filter out control samples. Your collection identifiers contain all necessary metadata.
742
+
743
+ **Strategy:** Apply Rules (Strategy B) - regex filtering with restructuring
744
+
745
+ **Tool Invocation:**
746
+ ```python
747
+ inputs = {
748
+ "input": {"src": "hdca", "id": "YOUR_COLLECTION_ID"},
749
+ "rules": {
750
+ "rules": [
751
+ {"type": "add_column_metadata", "value": "identifier0"},
752
+ {"type": "add_filter_regex", "target_column": 0, "expression": "^control_", "invert": True}
753
+ ],
754
+ "mapping": [
755
+ {"type": "list_identifiers", "columns": [0]}
756
+ ]
757
+ }
758
+ }
759
+ # Run __APPLY_RULES__
760
+ ```
761
+
762
+ **Verification:** Output collection should contain only elements NOT starting with "control_".
763
+
764
+ **Reproducibility:** This operation is fully captured in Galaxy history and can be extracted to a workflow.
765
+
766
+ ---
767
+
768
+ ### Example 2: Filter by Sample List
769
+
770
+ **User:** "Keep only samples SRR123, SRR456, SRR789 from my collection"
771
+
772
+ **Response:**
773
+
774
+ I understand you want to filter to specific samples. I'll use the Filter Collection tool.
775
+
776
+ **Strategy:** Collection Operation Tool (Strategy A)
777
+
778
+ **Step 1: Upload identifier file**
779
+ ```python
780
+ upload_payload = {
781
+ "history_id": history_id,
782
+ "targets": [{
783
+ "destination": {"type": "hdas"},
784
+ "elements": [{
785
+ "src": "pasted",
786
+ "paste_content": "SRR123\nSRR456\nSRR789",
787
+ "name": "keep_samples.txt",
788
+ "ext": "txt"
789
+ }]
790
+ }]
791
+ }
792
+ # POST to /api/tools/fetch, wait for job, get file_id
793
+ ```
794
+
795
+ **Step 2: Run filter**
796
+ ```python
797
+ filter_inputs = {
798
+ "input": {"values": [{"src": "hdca", "id": collection_id}]},
799
+ "how|how_filter": "remove_if_absent",
800
+ "how|filter_source": {"values": [{"src": "hda", "id": file_id}]}
801
+ }
802
+ # Run __FILTER_FROM_FILE__
803
+ ```
804
+
805
+ **Verification:** Output collection should have exactly 3 elements.
806
+
807
+ **Reproducibility:** Both the identifier file and filter operation are captured in history.
808
+
809
+ ---
810
+
811
+ ### Example 3: Group by Treatment Condition
812
+
813
+ **User:** "Group my samples by treatment condition - I have a spreadsheet with sample → condition mapping"
814
+
815
+ **Response:**
816
+
817
+ I understand you want to group samples by condition. The metadata isn't in Galaxy yet.
818
+
819
+ **Strategy:** Upload Metadata Table (Strategy C) + Apply Rules (Strategy B)
820
+
821
+ **Step 1: Upload condition mapping**
822
+ ```python
823
+ upload_payload = {
824
+ "history_id": history_id,
825
+ "targets": [{
826
+ "destination": {"type": "hdas"},
827
+ "elements": [{
828
+ "src": "pasted",
829
+ "paste_content": "sample1\tgroup:condition:treated\nsample2\tgroup:condition:control",
830
+ "name": "condition_tags.tabular",
831
+ "ext": "tabular"
832
+ }]
833
+ }]
834
+ }
835
+ ```
836
+
837
+ **Step 2: Tag samples**
838
+ ```python
839
+ tag_inputs = {
840
+ "input": {"values": [{"src": "hdca", "id": collection_id}]},
841
+ "tags": {"values": [{"src": "hda", "id": tag_file_id}]},
842
+ "how": "add"
843
+ }
844
+ # Run __TAG_FROM_FILE__
845
+ ```
846
+
847
+ **Step 3: Reorganize by condition**
848
+ ```python
849
+ rules_inputs = {
850
+ "input": {"src": "hdca", "id": tagged_collection_id},
851
+ "rules": {
852
+ "rules": [
853
+ {"type": "add_column_metadata", "value": "identifier0"},
854
+ {"type": "add_column_group_tag_value", "value": "condition", "default_value": "unassigned"}
855
+ ],
856
+ "mapping": [
857
+ {"type": "list_identifiers", "columns": [1, 0]}, # Group by condition, then sample
858
+ {"type": "group_tags", "columns": [1]}
859
+ ]
860
+ }
861
+ }
862
+ # Run __APPLY_RULES__
863
+ ```
864
+
865
+ **Verification:** Output should be list:list grouped by condition.
866
+
867
+ **Reproducibility:** Keep the condition_tags.tabular file with your analysis. Anyone reproducing this needs both the original collection and this metadata file.
868
+
869
+ ---
870
+
871
+ ## Tool Selection Priority
872
+
873
+ 1. **First:** Try simple dedicated tools (faster, clearer intent)
874
+ 2. **Second:** Chain multiple simple tools (each step visible in history)
875
+ 3. **Third:** Use Apply Rules (most powerful, steeper learning curve)
876
+
877
+ > For real test patterns showing tool usage, see `references/test-patterns.md`.
878
+
879
+ ---
880
+
881
+ ## Working with Tags
882
+
883
+ Tags are powerful metadata carriers:
884
+ - **Simple tags:** For finding/organizing datasets
885
+ - **Name tags (`name:` or `#`):** Propagate through analysis
886
+ - **Group tags (`group:name:value`):** For grouping operations
887
+
888
+ Prefer using tags + Apply Rules over creating multiple collections.
889
+
890
+ ---
891
+
892
+ **Remember:** The goal is reproducible science. Every operation should be traceable, reusable, and workflow-compatible. Galaxy's tools make this possible - use them!