@genobank/biofs 3.1.0 → 3.17.3

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 (452) hide show
  1. package/CHANGELOG.md +663 -462
  2. package/dist/abi/USDC.json +33 -0
  3. package/dist/abi/sequentia/BioAgentRegistry.json +20 -0
  4. package/dist/abi/sequentia/BioCIDRegistry.json +139 -0
  5. package/dist/abi/sequentia/BioPIL.json +130 -0
  6. package/dist/abi/sequentia/ConsentManager.json +620 -0
  7. package/dist/abi/sequentia/OpenCravatJobs.json +988 -0
  8. package/dist/abi/sequentia/PaymentRouter.json +638 -0
  9. package/dist/commands/agent/list-sequentia.d.ts +17 -0
  10. package/dist/commands/agent/list-sequentia.d.ts.map +1 -0
  11. package/dist/commands/agent/list-sequentia.js +87 -0
  12. package/dist/commands/agent/list-sequentia.js.map +1 -0
  13. package/dist/commands/agent/register-sequentia.d.ts +33 -0
  14. package/dist/commands/agent/register-sequentia.d.ts.map +1 -0
  15. package/dist/commands/agent/register-sequentia.js +145 -0
  16. package/dist/commands/agent/register-sequentia.js.map +1 -0
  17. package/dist/commands/align-shard/exec.d.ts +45 -0
  18. package/dist/commands/align-shard/exec.d.ts.map +1 -0
  19. package/dist/commands/align-shard/exec.js +549 -0
  20. package/dist/commands/align-shard/exec.js.map +1 -0
  21. package/dist/commands/align-shard/submit.d.ts +37 -0
  22. package/dist/commands/align-shard/submit.d.ts.map +1 -0
  23. package/dist/commands/align-shard/submit.js +117 -0
  24. package/dist/commands/align-shard/submit.js.map +1 -0
  25. package/dist/commands/ancestry/ingest.d.ts +34 -0
  26. package/dist/commands/ancestry/ingest.d.ts.map +1 -0
  27. package/dist/commands/ancestry/ingest.js +175 -0
  28. package/dist/commands/ancestry/ingest.js.map +1 -0
  29. package/dist/commands/ancestry/share.d.ts +33 -0
  30. package/dist/commands/ancestry/share.d.ts.map +1 -0
  31. package/dist/commands/ancestry/share.js +154 -0
  32. package/dist/commands/ancestry/share.js.map +1 -0
  33. package/dist/commands/ancestry/somos.d.ts +34 -0
  34. package/dist/commands/ancestry/somos.d.ts.map +1 -0
  35. package/dist/commands/ancestry/somos.js +151 -0
  36. package/dist/commands/ancestry/somos.js.map +1 -0
  37. package/dist/commands/ancestry/status.d.ts +14 -0
  38. package/dist/commands/ancestry/status.d.ts.map +1 -0
  39. package/dist/commands/ancestry/status.js +74 -0
  40. package/dist/commands/ancestry/status.js.map +1 -0
  41. package/dist/commands/annotate/status.d.ts +11 -4
  42. package/dist/commands/annotate/status.d.ts.map +1 -1
  43. package/dist/commands/annotate/status.js +66 -99
  44. package/dist/commands/annotate/status.js.map +1 -1
  45. package/dist/commands/annotate/submit.d.ts +15 -5
  46. package/dist/commands/annotate/submit.d.ts.map +1 -1
  47. package/dist/commands/annotate/submit.js +86 -266
  48. package/dist/commands/annotate/submit.js.map +1 -1
  49. package/dist/commands/benchmark.d.ts +50 -0
  50. package/dist/commands/benchmark.d.ts.map +1 -0
  51. package/dist/commands/benchmark.js +607 -0
  52. package/dist/commands/benchmark.js.map +1 -0
  53. package/dist/commands/biofiles.d.ts +1 -0
  54. package/dist/commands/biofiles.d.ts.map +1 -1
  55. package/dist/commands/biofiles.js +19 -6
  56. package/dist/commands/biofiles.js.map +1 -1
  57. package/dist/commands/biowallet/bind.d.ts +12 -0
  58. package/dist/commands/biowallet/bind.d.ts.map +1 -0
  59. package/dist/commands/biowallet/bind.js +85 -0
  60. package/dist/commands/biowallet/bind.js.map +1 -0
  61. package/dist/commands/biowallet/create.d.ts +40 -0
  62. package/dist/commands/biowallet/create.d.ts.map +1 -0
  63. package/dist/commands/biowallet/create.js +191 -0
  64. package/dist/commands/biowallet/create.js.map +1 -0
  65. package/dist/commands/biowallet/family.d.ts +48 -0
  66. package/dist/commands/biowallet/family.d.ts.map +1 -0
  67. package/dist/commands/biowallet/family.js +310 -0
  68. package/dist/commands/biowallet/family.js.map +1 -0
  69. package/dist/commands/biowallet/list.d.ts +15 -0
  70. package/dist/commands/biowallet/list.d.ts.map +1 -0
  71. package/dist/commands/biowallet/list.js +81 -0
  72. package/dist/commands/biowallet/list.js.map +1 -0
  73. package/dist/commands/bode.d.ts +34 -0
  74. package/dist/commands/bode.d.ts.map +1 -0
  75. package/dist/commands/bode.js +257 -0
  76. package/dist/commands/bode.js.map +1 -0
  77. package/dist/commands/claim.d.ts +32 -0
  78. package/dist/commands/claim.d.ts.map +1 -0
  79. package/dist/commands/claim.js +138 -0
  80. package/dist/commands/claim.js.map +1 -0
  81. package/dist/commands/clinical.d.ts +49 -0
  82. package/dist/commands/clinical.d.ts.map +1 -0
  83. package/dist/commands/clinical.js +273 -0
  84. package/dist/commands/clinical.js.map +1 -0
  85. package/dist/commands/cohort-acmg.d.ts +42 -0
  86. package/dist/commands/cohort-acmg.d.ts.map +1 -0
  87. package/dist/commands/cohort-acmg.js +319 -0
  88. package/dist/commands/cohort-acmg.js.map +1 -0
  89. package/dist/commands/cohort-fourier-score.d.ts +57 -0
  90. package/dist/commands/cohort-fourier-score.d.ts.map +1 -0
  91. package/dist/commands/cohort-fourier-score.js +390 -0
  92. package/dist/commands/cohort-fourier-score.js.map +1 -0
  93. package/dist/commands/cohort-pipeline.d.ts +49 -0
  94. package/dist/commands/cohort-pipeline.d.ts.map +1 -0
  95. package/dist/commands/cohort-pipeline.js +308 -0
  96. package/dist/commands/cohort-pipeline.js.map +1 -0
  97. package/dist/commands/cohort-train.d.ts +45 -0
  98. package/dist/commands/cohort-train.d.ts.map +1 -0
  99. package/dist/commands/cohort-train.js +308 -0
  100. package/dist/commands/cohort-train.js.map +1 -0
  101. package/dist/commands/comethyl/exec.d.ts +40 -0
  102. package/dist/commands/comethyl/exec.d.ts.map +1 -0
  103. package/dist/commands/comethyl/exec.js +493 -0
  104. package/dist/commands/comethyl/exec.js.map +1 -0
  105. package/dist/commands/comethyl/submit.d.ts +35 -0
  106. package/dist/commands/comethyl/submit.d.ts.map +1 -0
  107. package/dist/commands/comethyl/submit.js +98 -0
  108. package/dist/commands/comethyl/submit.js.map +1 -0
  109. package/dist/commands/dipcall/exec.d.ts +25 -0
  110. package/dist/commands/dipcall/exec.d.ts.map +1 -0
  111. package/dist/commands/dipcall/exec.js +207 -0
  112. package/dist/commands/dipcall/exec.js.map +1 -0
  113. package/dist/commands/dipcall/submit.d.ts +22 -0
  114. package/dist/commands/dipcall/submit.d.ts.map +1 -0
  115. package/dist/commands/dipcall/submit.js +81 -0
  116. package/dist/commands/dipcall/submit.js.map +1 -0
  117. package/dist/commands/download-with-consent.d.ts +1 -0
  118. package/dist/commands/download-with-consent.d.ts.map +1 -1
  119. package/dist/commands/download-with-consent.js +32 -0
  120. package/dist/commands/download-with-consent.js.map +1 -1
  121. package/dist/commands/download.d.ts +2 -0
  122. package/dist/commands/download.d.ts.map +1 -1
  123. package/dist/commands/download.js +31 -0
  124. package/dist/commands/download.js.map +1 -1
  125. package/dist/commands/duet.d.ts +39 -0
  126. package/dist/commands/duet.d.ts.map +1 -0
  127. package/dist/commands/duet.js +322 -0
  128. package/dist/commands/duet.js.map +1 -0
  129. package/dist/commands/erase.d.ts +29 -0
  130. package/dist/commands/erase.d.ts.map +1 -0
  131. package/dist/commands/erase.js +136 -0
  132. package/dist/commands/erase.js.map +1 -0
  133. package/dist/commands/family-status.d.ts +3 -0
  134. package/dist/commands/family-status.d.ts.map +1 -1
  135. package/dist/commands/family-status.js +279 -166
  136. package/dist/commands/family-status.js.map +1 -1
  137. package/dist/commands/fingerprint.d.ts +2 -0
  138. package/dist/commands/fingerprint.d.ts.map +1 -1
  139. package/dist/commands/fingerprint.js +4 -0
  140. package/dist/commands/fingerprint.js.map +1 -1
  141. package/dist/commands/fluency/index.d.ts +7 -0
  142. package/dist/commands/fluency/index.d.ts.map +1 -0
  143. package/dist/commands/fluency/index.js +122 -0
  144. package/dist/commands/fluency/index.js.map +1 -0
  145. package/dist/commands/fourier-score.d.ts +36 -0
  146. package/dist/commands/fourier-score.d.ts.map +1 -0
  147. package/dist/commands/fourier-score.js +713 -0
  148. package/dist/commands/fourier-score.js.map +1 -0
  149. package/dist/commands/hifi-align/exec.d.ts +23 -0
  150. package/dist/commands/hifi-align/exec.d.ts.map +1 -0
  151. package/dist/commands/hifi-align/exec.js +224 -0
  152. package/dist/commands/hifi-align/exec.js.map +1 -0
  153. package/dist/commands/hifi-align/submit.d.ts +22 -0
  154. package/dist/commands/hifi-align/submit.d.ts.map +1 -0
  155. package/dist/commands/hifi-align/submit.js +82 -0
  156. package/dist/commands/hifi-align/submit.js.map +1 -0
  157. package/dist/commands/hifi-deepvariant/exec.d.ts +29 -0
  158. package/dist/commands/hifi-deepvariant/exec.d.ts.map +1 -0
  159. package/dist/commands/hifi-deepvariant/exec.js +280 -0
  160. package/dist/commands/hifi-deepvariant/exec.js.map +1 -0
  161. package/dist/commands/hifi-deepvariant/submit.d.ts +23 -0
  162. package/dist/commands/hifi-deepvariant/submit.d.ts.map +1 -0
  163. package/dist/commands/hifi-deepvariant/submit.js +80 -0
  164. package/dist/commands/hifi-deepvariant/submit.js.map +1 -0
  165. package/dist/commands/hifi-methyl/exec.d.ts +25 -0
  166. package/dist/commands/hifi-methyl/exec.d.ts.map +1 -0
  167. package/dist/commands/hifi-methyl/exec.js +243 -0
  168. package/dist/commands/hifi-methyl/exec.js.map +1 -0
  169. package/dist/commands/hifi-methyl/submit.d.ts +22 -0
  170. package/dist/commands/hifi-methyl/submit.d.ts.map +1 -0
  171. package/dist/commands/hifi-methyl/submit.js +78 -0
  172. package/dist/commands/hifi-methyl/submit.js.map +1 -0
  173. package/dist/commands/imaging/attribute.d.ts +19 -0
  174. package/dist/commands/imaging/attribute.d.ts.map +1 -0
  175. package/dist/commands/imaging/attribute.js +102 -0
  176. package/dist/commands/imaging/attribute.js.map +1 -0
  177. package/dist/commands/imaging/characterize.d.ts +20 -0
  178. package/dist/commands/imaging/characterize.d.ts.map +1 -0
  179. package/dist/commands/imaging/characterize.js +105 -0
  180. package/dist/commands/imaging/characterize.js.map +1 -0
  181. package/dist/commands/imaging/compare.d.ts +33 -0
  182. package/dist/commands/imaging/compare.d.ts.map +1 -0
  183. package/dist/commands/imaging/compare.js +129 -0
  184. package/dist/commands/imaging/compare.js.map +1 -0
  185. package/dist/commands/imaging/enrich.d.ts +28 -0
  186. package/dist/commands/imaging/enrich.d.ts.map +1 -0
  187. package/dist/commands/imaging/enrich.js +130 -0
  188. package/dist/commands/imaging/enrich.js.map +1 -0
  189. package/dist/commands/imaging/findings.d.ts +21 -0
  190. package/dist/commands/imaging/findings.d.ts.map +1 -0
  191. package/dist/commands/imaging/findings.js +134 -0
  192. package/dist/commands/imaging/findings.js.map +1 -0
  193. package/dist/commands/imaging/lesions.d.ts +21 -0
  194. package/dist/commands/imaging/lesions.d.ts.map +1 -0
  195. package/dist/commands/imaging/lesions.js +131 -0
  196. package/dist/commands/imaging/lesions.js.map +1 -0
  197. package/dist/commands/imaging/submit.d.ts +32 -0
  198. package/dist/commands/imaging/submit.d.ts.map +1 -0
  199. package/dist/commands/imaging/submit.js +118 -0
  200. package/dist/commands/imaging/submit.js.map +1 -0
  201. package/dist/commands/imaging/trajectory.d.ts +23 -0
  202. package/dist/commands/imaging/trajectory.d.ts.map +1 -0
  203. package/dist/commands/imaging/trajectory.js +134 -0
  204. package/dist/commands/imaging/trajectory.js.map +1 -0
  205. package/dist/commands/imaging/twin.d.ts +32 -0
  206. package/dist/commands/imaging/twin.d.ts.map +1 -0
  207. package/dist/commands/imaging/twin.js +168 -0
  208. package/dist/commands/imaging/twin.js.map +1 -0
  209. package/dist/commands/ingest-rna-tpm.d.ts +33 -0
  210. package/dist/commands/ingest-rna-tpm.d.ts.map +1 -0
  211. package/dist/commands/ingest-rna-tpm.js +104 -0
  212. package/dist/commands/ingest-rna-tpm.js.map +1 -0
  213. package/dist/commands/interpret/status.d.ts +14 -0
  214. package/dist/commands/interpret/status.d.ts.map +1 -0
  215. package/dist/commands/interpret/status.js +83 -0
  216. package/dist/commands/interpret/status.js.map +1 -0
  217. package/dist/commands/interpret/submit.d.ts +22 -0
  218. package/dist/commands/interpret/submit.d.ts.map +1 -0
  219. package/dist/commands/interpret/submit.js +103 -0
  220. package/dist/commands/interpret/submit.js.map +1 -0
  221. package/dist/commands/inventory/cohort.d.ts +29 -0
  222. package/dist/commands/inventory/cohort.d.ts.map +1 -0
  223. package/dist/commands/inventory/cohort.js +136 -0
  224. package/dist/commands/inventory/cohort.js.map +1 -0
  225. package/dist/commands/inventory-register-sqlite.d.ts +36 -0
  226. package/dist/commands/inventory-register-sqlite.d.ts.map +1 -0
  227. package/dist/commands/inventory-register-sqlite.js +178 -0
  228. package/dist/commands/inventory-register-sqlite.js.map +1 -0
  229. package/dist/commands/job/recall.d.ts +6 -0
  230. package/dist/commands/job/recall.d.ts.map +1 -0
  231. package/dist/commands/job/recall.js +59 -0
  232. package/dist/commands/job/recall.js.map +1 -0
  233. package/dist/commands/job/reconcile.d.ts +19 -0
  234. package/dist/commands/job/reconcile.d.ts.map +1 -0
  235. package/dist/commands/job/reconcile.js +67 -0
  236. package/dist/commands/job/reconcile.js.map +1 -0
  237. package/dist/commands/lab/refreshCoverage.d.ts +53 -0
  238. package/dist/commands/lab/refreshCoverage.d.ts.map +1 -0
  239. package/dist/commands/lab/refreshCoverage.js +244 -0
  240. package/dist/commands/lab/refreshCoverage.js.map +1 -0
  241. package/dist/commands/liftover/exec.d.ts +27 -0
  242. package/dist/commands/liftover/exec.d.ts.map +1 -0
  243. package/dist/commands/liftover/exec.js +258 -0
  244. package/dist/commands/liftover/exec.js.map +1 -0
  245. package/dist/commands/liftover/submit.d.ts +22 -0
  246. package/dist/commands/liftover/submit.d.ts.map +1 -0
  247. package/dist/commands/liftover/submit.js +79 -0
  248. package/dist/commands/liftover/submit.js.map +1 -0
  249. package/dist/commands/lineage.d.ts +6 -0
  250. package/dist/commands/lineage.d.ts.map +1 -0
  251. package/dist/commands/lineage.js +126 -0
  252. package/dist/commands/lineage.js.map +1 -0
  253. package/dist/commands/methyl/exec.d.ts +47 -0
  254. package/dist/commands/methyl/exec.d.ts.map +1 -0
  255. package/dist/commands/methyl/exec.js +565 -0
  256. package/dist/commands/methyl/exec.js.map +1 -0
  257. package/dist/commands/methyl/submit.d.ts +25 -0
  258. package/dist/commands/methyl/submit.d.ts.map +1 -0
  259. package/dist/commands/methyl/submit.js +98 -0
  260. package/dist/commands/methyl/submit.js.map +1 -0
  261. package/dist/commands/mount.d.ts +17 -2
  262. package/dist/commands/mount.d.ts.map +1 -1
  263. package/dist/commands/mount.js +158 -6
  264. package/dist/commands/mount.js.map +1 -1
  265. package/dist/commands/myvariant.d.ts +60 -0
  266. package/dist/commands/myvariant.d.ts.map +1 -0
  267. package/dist/commands/myvariant.js +433 -0
  268. package/dist/commands/myvariant.js.map +1 -0
  269. package/dist/commands/ont-variants/exec.d.ts +24 -0
  270. package/dist/commands/ont-variants/exec.d.ts.map +1 -0
  271. package/dist/commands/ont-variants/exec.js +230 -0
  272. package/dist/commands/ont-variants/exec.js.map +1 -0
  273. package/dist/commands/ont-variants/submit.d.ts +22 -0
  274. package/dist/commands/ont-variants/submit.d.ts.map +1 -0
  275. package/dist/commands/ont-variants/submit.js +78 -0
  276. package/dist/commands/ont-variants/submit.js.map +1 -0
  277. package/dist/commands/pbsv/exec.d.ts +24 -0
  278. package/dist/commands/pbsv/exec.d.ts.map +1 -0
  279. package/dist/commands/pbsv/exec.js +231 -0
  280. package/dist/commands/pbsv/exec.js.map +1 -0
  281. package/dist/commands/pbsv/submit.d.ts +22 -0
  282. package/dist/commands/pbsv/submit.d.ts.map +1 -0
  283. package/dist/commands/pbsv/submit.js +78 -0
  284. package/dist/commands/pbsv/submit.js.map +1 -0
  285. package/dist/commands/phase/exec.d.ts +26 -0
  286. package/dist/commands/phase/exec.d.ts.map +1 -0
  287. package/dist/commands/phase/exec.js +246 -0
  288. package/dist/commands/phase/exec.js.map +1 -0
  289. package/dist/commands/phase/submit.d.ts +24 -0
  290. package/dist/commands/phase/submit.d.ts.map +1 -0
  291. package/dist/commands/phase/submit.js +83 -0
  292. package/dist/commands/phase/submit.js.map +1 -0
  293. package/dist/commands/pipeline/runWes.d.ts +28 -0
  294. package/dist/commands/pipeline/runWes.d.ts.map +1 -0
  295. package/dist/commands/pipeline/runWes.js +276 -0
  296. package/dist/commands/pipeline/runWes.js.map +1 -0
  297. package/dist/commands/psm-consensus.d.ts +72 -0
  298. package/dist/commands/psm-consensus.d.ts.map +1 -0
  299. package/dist/commands/psm-consensus.js +338 -0
  300. package/dist/commands/psm-consensus.js.map +1 -0
  301. package/dist/commands/qc/exec.d.ts +32 -0
  302. package/dist/commands/qc/exec.d.ts.map +1 -0
  303. package/dist/commands/qc/exec.js +350 -0
  304. package/dist/commands/qc/exec.js.map +1 -0
  305. package/dist/commands/qc/submit.d.ts +23 -0
  306. package/dist/commands/qc/submit.d.ts.map +1 -0
  307. package/dist/commands/qc/submit.js +88 -0
  308. package/dist/commands/qc/submit.js.map +1 -0
  309. package/dist/commands/query.d.ts +37 -0
  310. package/dist/commands/query.d.ts.map +1 -0
  311. package/dist/commands/query.js +170 -0
  312. package/dist/commands/query.js.map +1 -0
  313. package/dist/commands/repeat-genotype/exec.d.ts +26 -0
  314. package/dist/commands/repeat-genotype/exec.d.ts.map +1 -0
  315. package/dist/commands/repeat-genotype/exec.js +245 -0
  316. package/dist/commands/repeat-genotype/exec.js.map +1 -0
  317. package/dist/commands/repeat-genotype/submit.d.ts +23 -0
  318. package/dist/commands/repeat-genotype/submit.d.ts.map +1 -0
  319. package/dist/commands/repeat-genotype/submit.js +82 -0
  320. package/dist/commands/repeat-genotype/submit.js.map +1 -0
  321. package/dist/commands/researcher/register.d.ts +18 -0
  322. package/dist/commands/researcher/register.d.ts.map +1 -0
  323. package/dist/commands/researcher/register.js +275 -0
  324. package/dist/commands/researcher/register.js.map +1 -0
  325. package/dist/commands/researcher/status.d.ts +6 -0
  326. package/dist/commands/researcher/status.d.ts.map +1 -0
  327. package/dist/commands/researcher/status.js +111 -0
  328. package/dist/commands/researcher/status.js.map +1 -0
  329. package/dist/commands/route/anchor.d.ts +42 -0
  330. package/dist/commands/route/anchor.d.ts.map +1 -0
  331. package/dist/commands/route/anchor.js +213 -0
  332. package/dist/commands/route/anchor.js.map +1 -0
  333. package/dist/commands/route/index.d.ts +27 -0
  334. package/dist/commands/route/index.d.ts.map +1 -0
  335. package/dist/commands/route/index.js +82 -0
  336. package/dist/commands/route/index.js.map +1 -0
  337. package/dist/commands/rrm-consensus.d.ts +74 -0
  338. package/dist/commands/rrm-consensus.d.ts.map +1 -0
  339. package/dist/commands/rrm-consensus.js +334 -0
  340. package/dist/commands/rrm-consensus.js.map +1 -0
  341. package/dist/commands/rrm-distribution.d.ts +34 -0
  342. package/dist/commands/rrm-distribution.d.ts.map +1 -0
  343. package/dist/commands/rrm-distribution.js +743 -0
  344. package/dist/commands/rrm-distribution.js.map +1 -0
  345. package/dist/commands/rrm-train.d.ts +33 -0
  346. package/dist/commands/rrm-train.d.ts.map +1 -0
  347. package/dist/commands/rrm-train.js +549 -0
  348. package/dist/commands/rrm-train.js.map +1 -0
  349. package/dist/commands/samples.d.ts +25 -0
  350. package/dist/commands/samples.d.ts.map +1 -0
  351. package/dist/commands/samples.js +184 -0
  352. package/dist/commands/samples.js.map +1 -0
  353. package/dist/commands/score-protein.d.ts +13 -0
  354. package/dist/commands/score-protein.d.ts.map +1 -0
  355. package/dist/commands/score-protein.js +360 -0
  356. package/dist/commands/score-protein.js.map +1 -0
  357. package/dist/commands/sv-call/exec.d.ts +23 -0
  358. package/dist/commands/sv-call/exec.d.ts.map +1 -0
  359. package/dist/commands/sv-call/exec.js +233 -0
  360. package/dist/commands/sv-call/exec.js.map +1 -0
  361. package/dist/commands/sv-call/submit.d.ts +21 -0
  362. package/dist/commands/sv-call/submit.d.ts.map +1 -0
  363. package/dist/commands/sv-call/submit.js +77 -0
  364. package/dist/commands/sv-call/submit.js.map +1 -0
  365. package/dist/commands/tokenize-spectrum.d.ts +58 -0
  366. package/dist/commands/tokenize-spectrum.d.ts.map +1 -0
  367. package/dist/commands/tokenize-spectrum.js +297 -0
  368. package/dist/commands/tokenize-spectrum.js.map +1 -0
  369. package/dist/commands/umount.d.ts.map +1 -1
  370. package/dist/commands/umount.js +42 -1
  371. package/dist/commands/umount.js.map +1 -1
  372. package/dist/commands/variants.d.ts +42 -0
  373. package/dist/commands/variants.d.ts.map +1 -0
  374. package/dist/commands/variants.js +237 -0
  375. package/dist/commands/variants.js.map +1 -0
  376. package/dist/commands/verkko/exec.d.ts +27 -0
  377. package/dist/commands/verkko/exec.d.ts.map +1 -0
  378. package/dist/commands/verkko/exec.js +223 -0
  379. package/dist/commands/verkko/exec.js.map +1 -0
  380. package/dist/commands/verkko/submit.d.ts +24 -0
  381. package/dist/commands/verkko/submit.d.ts.map +1 -0
  382. package/dist/commands/verkko/submit.js +96 -0
  383. package/dist/commands/verkko/submit.js.map +1 -0
  384. package/dist/commands/wavelet-consensus.d.ts +69 -0
  385. package/dist/commands/wavelet-consensus.d.ts.map +1 -0
  386. package/dist/commands/wavelet-consensus.js +338 -0
  387. package/dist/commands/wavelet-consensus.js.map +1 -0
  388. package/dist/commands/workspace.d.ts +59 -0
  389. package/dist/commands/workspace.d.ts.map +1 -0
  390. package/dist/commands/workspace.js +419 -0
  391. package/dist/commands/workspace.js.map +1 -0
  392. package/dist/commands/x402/index.d.ts +8 -0
  393. package/dist/commands/x402/index.d.ts.map +1 -1
  394. package/dist/commands/x402/index.js +100 -2
  395. package/dist/commands/x402/index.js.map +1 -1
  396. package/dist/commands/x402/pipeline-cancer-twin.d.ts +119 -0
  397. package/dist/commands/x402/pipeline-cancer-twin.d.ts.map +1 -0
  398. package/dist/commands/x402/pipeline-cancer-twin.js +326 -0
  399. package/dist/commands/x402/pipeline-cancer-twin.js.map +1 -0
  400. package/dist/commands/x402/submit.d.ts +72 -0
  401. package/dist/commands/x402/submit.d.ts.map +1 -0
  402. package/dist/commands/x402/submit.js +227 -0
  403. package/dist/commands/x402/submit.js.map +1 -0
  404. package/dist/commands/x402/verify-payment.d.ts +24 -0
  405. package/dist/commands/x402/verify-payment.d.ts.map +1 -0
  406. package/dist/commands/x402/verify-payment.js +113 -0
  407. package/dist/commands/x402/verify-payment.js.map +1 -0
  408. package/dist/index.js +2158 -80
  409. package/dist/index.js.map +1 -1
  410. package/dist/lib/api/client.d.ts +1 -0
  411. package/dist/lib/api/client.d.ts.map +1 -1
  412. package/dist/lib/api/client.js +22 -0
  413. package/dist/lib/api/client.js.map +1 -1
  414. package/dist/lib/api/fuse-client.d.ts +281 -0
  415. package/dist/lib/api/fuse-client.d.ts.map +1 -1
  416. package/dist/lib/api/fuse-client.js +428 -0
  417. package/dist/lib/api/fuse-client.js.map +1 -1
  418. package/dist/lib/biofiles/resolver.d.ts +1 -1
  419. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  420. package/dist/lib/biofiles/resolver.js +173 -138
  421. package/dist/lib/biofiles/resolver.js.map +1 -1
  422. package/dist/lib/config/constants.d.ts +1 -0
  423. package/dist/lib/config/constants.d.ts.map +1 -1
  424. package/dist/lib/config/constants.js +1 -0
  425. package/dist/lib/config/constants.js.map +1 -1
  426. package/dist/lib/gene-map.d.ts +24 -0
  427. package/dist/lib/gene-map.d.ts.map +1 -0
  428. package/dist/lib/gene-map.js +114 -0
  429. package/dist/lib/gene-map.js.map +1 -0
  430. package/dist/lib/sequentia/BioAgentRegistry.d.ts +98 -0
  431. package/dist/lib/sequentia/BioAgentRegistry.d.ts.map +1 -0
  432. package/dist/lib/sequentia/BioAgentRegistry.js +209 -0
  433. package/dist/lib/sequentia/BioAgentRegistry.js.map +1 -0
  434. package/dist/lib/x402/cancer-twin-agents.d.ts +65 -0
  435. package/dist/lib/x402/cancer-twin-agents.d.ts.map +1 -0
  436. package/dist/lib/x402/cancer-twin-agents.js +114 -0
  437. package/dist/lib/x402/cancer-twin-agents.js.map +1 -0
  438. package/dist/lib/x402/sequentia-pay.d.ts +51 -0
  439. package/dist/lib/x402/sequentia-pay.d.ts.map +1 -0
  440. package/dist/lib/x402/sequentia-pay.js +186 -0
  441. package/dist/lib/x402/sequentia-pay.js.map +1 -0
  442. package/dist/types/biofiles.d.ts +1 -1
  443. package/dist/types/biofiles.d.ts.map +1 -1
  444. package/dist/utils/errorReporter.d.ts +1 -0
  445. package/dist/utils/errorReporter.d.ts.map +1 -1
  446. package/dist/utils/errorReporter.js +39 -1
  447. package/dist/utils/errorReporter.js.map +1 -1
  448. package/dist/version.d.ts +2 -0
  449. package/dist/version.d.ts.map +1 -0
  450. package/dist/version.js +20 -0
  451. package/dist/version.js.map +1 -0
  452. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -5,6 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const commander_1 = require("commander");
8
+ // FLUENCY_LINEAGE_VERBS_20260730
9
+ const fluency_1 = require("./commands/fluency");
10
+ const lineage_1 = require("./commands/lineage");
11
+ const version_1 = require("./version");
8
12
  const chalk_1 = __importDefault(require("chalk"));
9
13
  const login_1 = require("./commands/login");
10
14
  const logout_1 = require("./commands/logout");
@@ -49,6 +53,7 @@ const pipe_1 = require("./commands/pipe");
49
53
  const alias_1 = require("./commands/alias");
50
54
  const htsget_1 = require("./commands/htsget");
51
55
  const submit_clara_1 = require("./commands/job/submit-clara");
56
+ const recall_1 = require("./commands/job/recall");
52
57
  const create_2 = require("./commands/context/create");
53
58
  const publish_1 = require("./commands/context/publish");
54
59
  const verify_1 = require("./commands/context/verify");
@@ -68,21 +73,106 @@ const report_1 = require("./commands/report");
68
73
  const admin_1 = require("./commands/admin");
69
74
  const fuse_1 = require("./commands/fuse");
70
75
  const submit_1 = require("./commands/annotate/submit");
76
+ const submit_2 = require("./commands/imaging/submit");
77
+ const twin_1 = require("./commands/imaging/twin");
78
+ const attribute_1 = require("./commands/imaging/attribute");
79
+ const trajectory_1 = require("./commands/imaging/trajectory");
80
+ const lesions_1 = require("./commands/imaging/lesions");
81
+ const findings_1 = require("./commands/imaging/findings");
82
+ const characterize_1 = require("./commands/imaging/characterize");
83
+ const enrich_1 = require("./commands/imaging/enrich");
84
+ const compare_1 = require("./commands/imaging/compare");
85
+ const submit_3 = require("./commands/methyl/submit");
86
+ const exec_1 = require("./commands/methyl/exec");
87
+ const submit_4 = require("./commands/align-shard/submit");
88
+ const exec_2 = require("./commands/align-shard/exec");
89
+ const submit_5 = require("./commands/comethyl/submit");
90
+ const exec_3 = require("./commands/comethyl/exec");
91
+ const submit_6 = require("./commands/sv-call/submit");
92
+ const exec_4 = require("./commands/sv-call/exec");
93
+ const submit_7 = require("./commands/qc/submit");
94
+ const exec_5 = require("./commands/qc/exec");
95
+ const submit_8 = require("./commands/verkko/submit");
96
+ const exec_6 = require("./commands/verkko/exec");
97
+ const submit_9 = require("./commands/ont-variants/submit");
98
+ const exec_7 = require("./commands/ont-variants/exec");
99
+ const submit_10 = require("./commands/hifi-align/submit");
100
+ const exec_8 = require("./commands/hifi-align/exec");
101
+ const submit_11 = require("./commands/pbsv/submit");
102
+ const exec_9 = require("./commands/pbsv/exec");
103
+ const submit_12 = require("./commands/repeat-genotype/submit");
104
+ const exec_10 = require("./commands/repeat-genotype/exec");
105
+ const submit_13 = require("./commands/phase/submit");
106
+ const exec_11 = require("./commands/phase/exec");
107
+ const submit_14 = require("./commands/hifi-deepvariant/submit");
108
+ const exec_12 = require("./commands/hifi-deepvariant/exec");
109
+ const submit_15 = require("./commands/liftover/submit");
110
+ const exec_13 = require("./commands/liftover/exec");
111
+ const submit_16 = require("./commands/dipcall/submit");
112
+ const exec_14 = require("./commands/dipcall/exec");
113
+ const submit_17 = require("./commands/hifi-methyl/submit");
114
+ const exec_15 = require("./commands/hifi-methyl/exec");
115
+ const workspace_1 = require("./commands/workspace");
116
+ const duet_1 = require("./commands/duet");
117
+ const benchmark_1 = require("./commands/benchmark");
118
+ const runWes_1 = require("./commands/pipeline/runWes");
119
+ const route_1 = require("./commands/route");
120
+ const anchor_1 = require("./commands/route/anchor");
71
121
  const status_6 = require("./commands/annotate/status");
122
+ const x402_1 = require("./commands/x402");
123
+ const submit_18 = require("./commands/interpret/submit");
124
+ const status_7 = require("./commands/interpret/status");
125
+ const somos_1 = require("./commands/ancestry/somos");
126
+ const status_8 = require("./commands/ancestry/status");
127
+ const ingest_1 = require("./commands/ancestry/ingest");
128
+ const share_2 = require("./commands/ancestry/share");
129
+ const register_sequentia_1 = require("./commands/agent/register-sequentia");
130
+ const list_sequentia_1 = require("./commands/agent/list-sequentia");
72
131
  const balance_1 = require("./commands/payment/balance");
73
132
  const pricing_1 = require("./commands/payment/pricing");
74
133
  const setup_2 = require("./commands/payment/setup");
75
134
  const faucet_1 = require("./commands/payment/faucet");
76
135
  const history_1 = require("./commands/payment/history");
77
136
  const resolve_1 = require("./commands/resolve");
137
+ const variants_1 = require("./commands/variants");
138
+ const query_1 = require("./commands/query");
139
+ const erase_1 = require("./commands/erase");
140
+ const fourier_score_1 = require("./commands/fourier-score");
141
+ const rrm_consensus_1 = require("./commands/rrm-consensus");
142
+ const psm_consensus_1 = require("./commands/psm-consensus");
143
+ const bode_1 = require("./commands/bode");
144
+ const wavelet_consensus_1 = require("./commands/wavelet-consensus");
145
+ const tokenize_spectrum_1 = require("./commands/tokenize-spectrum");
146
+ const inventory_register_sqlite_1 = require("./commands/inventory-register-sqlite");
147
+ const ingest_rna_tpm_1 = require("./commands/ingest-rna-tpm");
148
+ const score_protein_1 = require("./commands/score-protein");
149
+ const rrm_distribution_1 = require("./commands/rrm-distribution");
150
+ const rrm_train_1 = require("./commands/rrm-train");
151
+ const cohort_train_1 = require("./commands/cohort-train");
152
+ const myvariant_1 = require("./commands/myvariant");
153
+ const cohort_acmg_1 = require("./commands/cohort-acmg");
154
+ const clinical_1 = require("./commands/clinical");
155
+ const cohort_fourier_score_1 = require("./commands/cohort-fourier-score");
156
+ const create_3 = require("./commands/biowallet/create");
157
+ const list_6 = require("./commands/biowallet/list");
158
+ const bind_1 = require("./commands/biowallet/bind");
159
+ const refreshCoverage_1 = require("./commands/lab/refreshCoverage");
160
+ const family_1 = require("./commands/biowallet/family");
78
161
  const match_1 = require("./commands/match");
79
162
  const ticket_1 = require("./commands/ticket");
80
163
  const scan_1 = require("./commands/scan");
81
164
  const inventory_1 = require("./commands/inventory");
165
+ const cohort_1 = require("./commands/inventory/cohort");
166
+ const reconcile_1 = require("./commands/job/reconcile");
167
+ const cohort_pipeline_1 = require("./commands/cohort-pipeline");
82
168
  const dedup_1 = require("./commands/dedup");
169
+ const claim_1 = require("./commands/claim");
83
170
  const fingerprint_1 = require("./commands/fingerprint");
84
- const logger_1 = require("./lib/utils/logger");
171
+ const register_2 = require("./commands/researcher/register");
172
+ const status_9 = require("./commands/researcher/status");
85
173
  const errorReporter_1 = require("./utils/errorReporter");
174
+ const logger_1 = require("./lib/utils/logger");
175
+ const errorReporter_2 = require("./utils/errorReporter");
86
176
  const credentials_1 = require("./lib/auth/credentials");
87
177
  const program = new commander_1.Command();
88
178
  // Global catch-all so uncaught errors in ANY command still reach telemetry.
@@ -92,24 +182,24 @@ async function reportAndExit(command, err, code) {
92
182
  try {
93
183
  const creds = await credentials_1.CredentialsManager.getInstance().loadCredentials().catch(() => null);
94
184
  const error = err instanceof Error ? err : new Error(String(err));
95
- await errorReporter_1.ErrorReporter.report(command, error, creds?.wallet_address, { argv: process.argv.slice(2) });
185
+ await errorReporter_2.ErrorReporter.report(command, error, creds?.wallet_address, { argv: (0, errorReporter_1.redactArgv)(process.argv.slice(2)) });
96
186
  }
97
187
  catch { /* telemetry failure must never block exit */ }
98
188
  process.exit(code);
99
189
  }
100
190
  process.on('uncaughtException', (err) => {
101
191
  logger_1.Logger.error(`Uncaught: ${err?.message || err}`);
102
- reportAndExit(process.argv.slice(2).join(' ') || 'unknown', err, 1);
192
+ reportAndExit((0, errorReporter_1.redactArgv)(process.argv.slice(2)).join(' ') || 'unknown', err, 1);
103
193
  });
104
194
  process.on('unhandledRejection', (reason) => {
105
195
  logger_1.Logger.error(`UnhandledRejection: ${reason?.message || reason}`);
106
- reportAndExit(process.argv.slice(2).join(' ') || 'unknown', reason, 1);
196
+ reportAndExit((0, errorReporter_1.redactArgv)(process.argv.slice(2)).join(' ') || 'unknown', reason, 1);
107
197
  });
108
198
  // Set up the CLI
109
199
  program
110
200
  .name('biofs')
111
201
  .description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
112
- .version('3.0.1')
202
+ .version(version_1.BIOFS_VERSION)
113
203
  .option('--debug', 'Enable debug output')
114
204
  .hook('preAction', (thisCommand) => {
115
205
  // Set global debug flag if --debug is passed
@@ -182,6 +272,8 @@ program
182
272
  });
183
273
  // Admin command group - Admin operations on Sequentia Network
184
274
  program.addCommand((0, admin_1.createAdminCommand)());
275
+ // x402 command group - Sequentia micropayments + agentic Cancer Digital Twin pipeline
276
+ program.addCommand((0, x402_1.createX402Command)());
185
277
  // BioFiles command - Comprehensive discovery across all GenoBank data sources
186
278
  program
187
279
  .command('biofiles')
@@ -189,7 +281,8 @@ program
189
281
  .alias('ls')
190
282
  .description('Discover all your BioFiles from GenoBank ecosystem (Story Protocol, Avalanche, S3, BioIP)')
191
283
  .option('--filter <type>', 'Filter by file type (vcf, fastq, bam, pdf, etc.)')
192
- .option('--source <source>', 'Filter by source (story, avalanche, s3, biofs)')
284
+ .option('--source <source>', 'Filter by source (story, avalanche, s3, biofs, biorouter)')
285
+ .option('--wallet <address>', "Admin: list another wallet's files (e.g. a custodian's). Bypasses cache.")
193
286
  .option('--json', 'Output as JSON')
194
287
  .option('--update', 'Force refresh from blockchain and S3')
195
288
  .option('--verbose', 'Show debug information')
@@ -212,6 +305,7 @@ program
212
305
  .option('--stream', 'Stream large files (>100MB)')
213
306
  .option('--quiet', 'No progress bar')
214
307
  .option('--skip-consent', 'Skip GDPR consent (for automation)')
308
+ .option('--gs-uri <uri>', 'Bypass BioFiles discovery and fetch directly from gs:// URI (for owner-only file inspection)')
215
309
  .action(async (biocidOrFilename, destination, options) => {
216
310
  try {
217
311
  await (0, download_with_consent_1.downloadCommandWithConsent)(biocidOrFilename, destination, options);
@@ -242,17 +336,30 @@ program
242
336
  });
243
337
  // Mount command (mount all granted BioFiles with GDPR consent)
244
338
  program
245
- .command('mount <mount_point>')
246
- .description('Mount BioFiles as filesystem (NFS or copy method)')
247
- .option('--method <type>', 'Mount method: nfs (true filesystem) or copy (download files)', 'copy')
248
- .option('--biocid <biocid>', 'Mount specific BioCID (biocid://OWNER/bioip/IP_ID)')
249
- .option('--port <number>', 'NFS server port (default: 2049)', parseInt)
339
+ .command('mount <target> [mount_point]')
340
+ .description('Mount a biosample as a consent-gated read-only filesystem')
341
+ .addHelpText('after', `
342
+ Examples:
343
+ biofs mount DNA_TN25-336147.vcf /mnt/study mount one biosample (FUSE)
344
+ biofs mount TN25-336147 /mnt/study the bare serial also resolves
345
+ biofs mount ./my-files legacy: copy granted files here
346
+
347
+ Every read is re-authorized server-side against the BioNFT consent grant on
348
+ Sequentia. If the owner revokes, reads on the already-mounted filesystem begin
349
+ failing with Permission denied, without unmounting.`)
350
+ .option('--method <type>', 'fuse (consent-gated filesystem, default), copy, or nfs (legacy)', 'fuse')
351
+ .option('--biocid <biocid>', 'Mount specific BioCID (copy method)')
352
+ .option('--port <number>', 'NFS server port (legacy nfs method)', parseInt)
353
+ .option('--api-url <url>', 'Gateway base URL (default: https://genobank.app)')
354
+ .option('--consent-ttl <seconds>', 'Seconds before the driver re-verifies consent', parseInt)
355
+ .option('--allow-other', 'Let other local users read the mount (needs user_allow_other)')
356
+ .option('--foreground', 'Run in the foreground and stream driver logs')
250
357
  .option('--read-only', 'Mount as read-only')
251
358
  .option('--quiet', 'Suppress output')
252
359
  .option('--skip-consent', 'Skip GDPR consent (for automation)')
253
- .action(async (mountPoint, options) => {
360
+ .action(async (target, mountPoint, options) => {
254
361
  try {
255
- await (0, mount_1.mountCommand)(mountPoint, options);
362
+ await (0, mount_1.mountCommand)(target, mountPoint, options);
256
363
  }
257
364
  catch (error) {
258
365
  logger_1.Logger.error(`Mount failed: ${error}`);
@@ -544,10 +651,13 @@ linkCmd
544
651
  program
545
652
  .command('family-status')
546
653
  .alias('family')
547
- .description('Show family genomic pipeline status (BioNFT → ClaraJobNFT → etc.)')
654
+ .description('Show family genomic pipeline status (BioNFT → ClaraJobNFT → bioroutes.inventory)')
548
655
  .argument('<biosample_serials...>', 'Biosample serial numbers')
549
656
  .option('--json', 'Output as JSON')
550
657
  .option('--verbose', 'Show detailed information')
658
+ .option('--no-inventory', 'Skip the bioroutes.inventory enrichment (chain-only mode)')
659
+ .option('--bionft-address <addr>', 'Override BioNFT contract (for legacy deployments)')
660
+ .option('--clara-address <addr>', 'Override ClaraJobNFT contract')
551
661
  .action(async (biosampleSerials, options) => {
552
662
  try {
553
663
  await (0, family_status_1.familyStatusCommand)(biosampleSerials, options);
@@ -558,7 +668,7 @@ program
558
668
  }
559
669
  });
560
670
  // Inventory command - Fast read-only summary of bioroutes.inventory (no GCS walk)
561
- program
671
+ const inventoryCmd = program
562
672
  .command('inventory')
563
673
  .alias('inv')
564
674
  .description('Show what is currently registered in bioroutes.inventory (admin/lab-custodian)')
@@ -574,6 +684,26 @@ program
574
684
  process.exit(1);
575
685
  }
576
686
  });
687
+ // inventory cohort sub-command: extract filtered cohort of biosample serials
688
+ inventoryCmd
689
+ .command('cohort')
690
+ .description('Extract a filtered cohort of biosample serials from bioroutes.inventory (the canonical "what should I process next?" query)')
691
+ .requiredOption('--originlab <name>', 'Lab name (e.g. augenomics, neochromosome, somos, tecbase, genobank)')
692
+ .option('--has <csv>', 'CSV of filetypes the serial MUST have (e.g. fastq)')
693
+ .option('--missing <csv>', 'CSV of filetypes the serial MUST NOT have (e.g. vcf,gvcf)')
694
+ .option('--paired', 'For FASTQ, require both R1 and R2 to exist')
695
+ .option('--limit <N>', 'Cap on returned serials')
696
+ .option('--output <file>', 'Write serials one-per-line to file (suitable for `biofs cohort-pipeline --serials`)')
697
+ .option('--json', 'Output full JSON response')
698
+ .action(async (options) => {
699
+ try {
700
+ await (0, cohort_1.inventoryCohortCommand)(options);
701
+ }
702
+ catch (error) {
703
+ logger_1.Logger.error(`inventory cohort failed: ${error}`);
704
+ process.exit(1);
705
+ }
706
+ });
577
707
  // Fingerprint command - Submit async fingerprint jobs (background worker uses gcsfuse)
578
708
  program
579
709
  .command('fingerprint')
@@ -582,6 +712,8 @@ program
582
712
  .option('--serial <id>', 'Single sample serial')
583
713
  .option('--serials <csv>', 'Comma-separated sample serials')
584
714
  .option('--filetypes <csv>', 'Filter to filetype list (e.g. vcf,gvcf)')
715
+ .option('--bucket <name>', 'Scope to a single GCS bucket')
716
+ .option('--prefix <path>', 'Scope to an object-name prefix (use with --bucket)')
585
717
  .option('--include-superseded', 'Also fingerprint SUPERSEDED rows')
586
718
  .option('--limit <n>', 'Max rows to process per job', '50')
587
719
  .option('--dry-run', 'Show eligible rows without submitting')
@@ -615,6 +747,25 @@ program
615
747
  process.exit(1);
616
748
  }
617
749
  });
750
+ // Claim command - Reassign mis-owned inventory rows (lab/legacy custodian) to the patient owner
751
+ program
752
+ .command('claim')
753
+ .description('Reassign inventory rows under your biorouter path from a lab/legacy custodian to you (admin)')
754
+ .option('--owner <wallet>', 'Patient EIP-55 wallet to claim files TO (default: your wallet)')
755
+ .option('--from <csv>', 'Custodian/legacy wallets to claim FROM (default: known legacy+custodian)')
756
+ .option('--exclude <csv>', 'object_name substrings to skip (e.g. /dtc-genotype/,41221040804049)')
757
+ .option('--apply', 'Actually reassign ownership (default is dry-run)')
758
+ .option('--json', 'Output as JSON')
759
+ .option('--verbose', 'Show debug information')
760
+ .action(async (options) => {
761
+ try {
762
+ await (0, claim_1.claimCommand)(options);
763
+ }
764
+ catch (error) {
765
+ logger_1.Logger.error(`Claim failed: ${error}`);
766
+ process.exit(1);
767
+ }
768
+ });
618
769
  // Scan command - Walk GCS bucket(s) and register objects in bioroutes.inventory
619
770
  // Default scope: full canonical bucket fleet. Lab origin inferred per-file.
620
771
  program
@@ -645,8 +796,9 @@ annotateCmd
645
796
  .command('submit <biosample_serial>')
646
797
  .description('Submit VCF to OpenCRAVAT for annotation with all 146 annotators')
647
798
  .option('--vcf-path <path>', 'Manual VCF path override')
799
+ .option('--vcf-uri <uri>', 'GCS or S3 URI for a freshly-minted VCF (skips discovery; used by biofs pipeline)')
648
800
  .option('--annotators <list>', 'Custom annotators (comma-separated), defaults to all 146')
649
- .option('--package <package>', 'Analysis package (rare_coding, hereditary_cancer, splicing, drug_interaction, pathogenic)', 'rare_coding')
801
+ .option('--package <package>', 'Analysis package (rare_coding, hereditary_cancer, splicing, drug_interaction, pathogenic, wes_default, wgs_default)', 'rare_coding')
650
802
  .option('--phenotype <text>', 'Clinical phenotype description for AI analysis')
651
803
  .option('--assembly <genome>', 'Reference genome (hg38, hg19)', 'hg38')
652
804
  .option('--wait', 'Wait for job to complete')
@@ -676,6 +828,358 @@ annotateCmd
676
828
  process.exit(1);
677
829
  }
678
830
  });
831
+ // Imaging commands — pull UCSF eUnity DICOM studies into the patient vault via
832
+ // the biofs protocol (DICOM is biodata → biofs job dispatched through biofs-node).
833
+ const imagingCmd = program
834
+ .command('imaging')
835
+ .description('DICOM medical-imaging acquisition: pull hospital studies (UCSF eUnity) into the patient vault via biofs-node');
836
+ imagingCmd
837
+ .command('pull', { isDefault: true })
838
+ .description('Pull a UCSF eUnity DICOM study into the vault (resolve --eunity-url + --cookie + --study-uid with the web3-chrome MCP)')
839
+ .requiredOption('--eunity-url <url>', 'eUnity downloadDicomStudy URL (resolved browser-side by the MCP)')
840
+ .requiredOption('--cookie <header>', 'eUnity /e JSESSIONID Cookie header (resolved browser-side by the MCP)')
841
+ .option('--study-uid <uid>', 'DICOM StudyInstanceUID (enables vault dedupe)')
842
+ .option('--source <src>', 'Provenance label', 'eunity-mychart')
843
+ .option('--force', 'Re-pull even if the study is already in the vault (idempotent overwrite)')
844
+ .option('--wait', 'Wait for the server-side ingest to finish')
845
+ .option('--quiet', 'Suppress progress output')
846
+ .option('--json', 'Output as JSON')
847
+ .action(async (options) => {
848
+ try {
849
+ await (0, submit_2.imagingPullCommand)(options);
850
+ }
851
+ catch (error) {
852
+ logger_1.Logger.error(`imaging pull failed: ${error}`);
853
+ process.exit(1);
854
+ }
855
+ });
856
+ // imaging twin — the "3D Organ TimeMachine": longitudinal CT change map (register
857
+ // two timepoints, segment organs, per-organ/voxel deltas + Jacobian + meshes) as a
858
+ // biofs GPU job. Inputs are biocid-addressed (biofs-node resolves via biorouter).
859
+ imagingCmd
860
+ .command('twin')
861
+ .description('3D Organ TimeMachine: longitudinal CT change map across N timepoints of an anatomy (GPU job via biofs-node)')
862
+ .option('--baseline <ref>', 'baseline biocid (biocid://…/dicom/<studyUID>) or studyUID (2-timepoint mode)')
863
+ .option('--followup <ref>', 'follow-up biocid or studyUID (2-timepoint mode)')
864
+ .option('--timepoints <spec>', 'N-timepoint mode: JSON [{label,study,series}] (ordered, first=reference) or "label:study:series,..." — supersedes --baseline/--followup')
865
+ .option('--anatomy <name>', 'anatomy to register (abdomen | chest)', 'abdomen')
866
+ .option('--registration <mode>', 'deformable (SyNRA + Jacobian, default) or rigid (strict 6-DOF, spot-faithful organ meshes)', 'deformable')
867
+ .option('--baseline-series <uid>', 'override the baseline primary CT series UID')
868
+ .option('--followup-series <uid>', 'override the follow-up primary CT series UID')
869
+ .option('--wait', 'Wait for the GPU pipeline to finish')
870
+ .option('--quiet', 'Suppress progress output')
871
+ .option('--json', 'Output as JSON')
872
+ .action(async (options) => {
873
+ try {
874
+ await (0, twin_1.imagingTwinCommand)(options);
875
+ }
876
+ catch (error) {
877
+ logger_1.Logger.error(`imaging twin failed: ${error}`);
878
+ process.exit(1);
879
+ }
880
+ });
881
+ // imaging attribute — organ-attribution cross-join: segment a compare job's reference
882
+ // CT and label each focal change by the organ it sits in (feeds the radiology MCP).
883
+ imagingCmd
884
+ .command('attribute')
885
+ .description('Label each focal change in a compare job with its anatomic organ (GPU segmentation via biofs-node)')
886
+ .requiredOption('--compare <compare_job_id>', 'the compare_job_id from `biofs imaging compare`')
887
+ .option('--wait', 'Wait for the GPU job to finish')
888
+ .option('--quiet', 'Suppress progress output')
889
+ .option('--json', 'Output as JSON')
890
+ .action(async (options) => {
891
+ try {
892
+ await (0, attribute_1.imagingAttributeCommand)(options);
893
+ }
894
+ catch (error) {
895
+ logger_1.Logger.error(`imaging attribute failed: ${error}`);
896
+ process.exit(1);
897
+ }
898
+ });
899
+ // imaging trajectory — 3-timepoint per-voxel persistence classifier (persistent
900
+ // progression/regression vs transient motion). CPU via biofs-node; drop-in compare artifact.
901
+ imagingCmd
902
+ .command('trajectory')
903
+ .description('3-timepoint per-voxel trajectory classifier: persistent change vs transient motion (CPU via biofs-node)')
904
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=3; series auto-resolved if omitted)')
905
+ .option('--anatomy <name>', 'anatomy (chest | abdomen)', 'chest')
906
+ .option('--thr-hu <hu>', 'override the per-interval significance threshold (default adaptive max(55, 3·det_sigma))')
907
+ .option('--wait', 'Wait for the classifier to finish')
908
+ .option('--quiet', 'Suppress progress output')
909
+ .option('--json', 'Output as JSON')
910
+ .action(async (options) => {
911
+ try {
912
+ await (0, trajectory_1.imagingTrajectoryCommand)(options);
913
+ }
914
+ catch (error) {
915
+ logger_1.Logger.error(`imaging trajectory failed: ${error}`);
916
+ process.exit(1);
917
+ }
918
+ });
919
+ // imaging lesions — per-lesion volumetric tracking: independent VISTA-3D lesion seg per
920
+ // timepoint, cross-timepoint linking, RECIST 1.1 response (CR/PR/SD/PD, flagged candidate)
921
+ // + volume doubling time + iso-attenuating catch. GPU via biofs-node; drop-in artifact.
922
+ imagingCmd
923
+ .command('lesions')
924
+ .description('Per-lesion volumetric tracking: VISTA-3D per timepoint -> RECIST response + doubling time (GPU via biofs-node)')
925
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=2; series auto-resolved if omitted)')
926
+ .option('--anatomy <name>', 'anatomy (chest | abdomen)', 'chest')
927
+ .option('--treatment <ctx>', 'treatment context (naive | post_chemo | post_radiation | post_immunotherapy | post_surgery | unknown); non-naive forces human review', 'unknown')
928
+ .option('--wait', 'Wait for the GPU pipeline to finish')
929
+ .option('--quiet', 'Suppress progress output')
930
+ .option('--json', 'Output as JSON')
931
+ .action(async (options) => {
932
+ try {
933
+ await (0, lesions_1.imagingLesionsCommand)(options);
934
+ }
935
+ catch (error) {
936
+ logger_1.Logger.error(`imaging lesions failed: ${error}`);
937
+ process.exit(1);
938
+ }
939
+ });
940
+ // imaging findings — longitudinal CT pathogenic-findings read (no volumes): pairwise
941
+ // baseline-forward rigid lock -> VISTA-3D auto-detect -> LesionLocator track -> RECIST
942
+ // 1.1 on long-axis diameters. GPU via biofs-node. Decision-support, not a diagnosis.
943
+ imagingCmd
944
+ .command('findings')
945
+ .description('Longitudinal pathogenic-findings read: rigid pairwise lock -> VISTA-3D detect -> LesionLocator track -> RECIST 1.1 (no volumes; GPU via biofs-node)')
946
+ .requiredOption('--timepoints <spec>', 'oldest→newest: JSON [{label,study,series}] or "label:study[:series],..." (>=2; series auto-resolved if omitted)')
947
+ .option('--treatment <ctx>', 'treatment context (naive | post_chemo | post_radiation | post_immunotherapy | post_surgery | unknown); lowers RECIST confidence if not naive', 'unknown')
948
+ .option('--wait', 'Wait for the GPU pipeline to finish')
949
+ .option('--quiet', 'Suppress progress output')
950
+ .option('--json', 'Output as JSON')
951
+ .action(async (options) => {
952
+ try {
953
+ await (0, findings_1.imagingFindingsCommand)(options);
954
+ }
955
+ catch (error) {
956
+ logger_1.Logger.error(`imaging findings failed: ${error}`);
957
+ process.exit(1);
958
+ }
959
+ });
960
+ // imaging characterize — Tier 2: study each tracked candidate from a findings job with
961
+ // the Tier-2 method stack (PyRadiomics, CT-FM, Merlin, PASTA, MedGemma 1.5) -> per-candidate
962
+ // side-by-side + agreement. GPU via biofs-node. Decision-support, not a diagnosis.
963
+ imagingCmd
964
+ .command('characterize')
965
+ .description('Tier 2: study a findings job\'s candidates with the method stack -> per-candidate comparison (GPU via biofs-node)')
966
+ .requiredOption('--job <findings_job_id>', 'the findings_job_id from `biofs imaging findings`')
967
+ .option('--methods <csv>', 'methods to run (pyradiomics,ctfm,merlin,pasta,medgemma)', 'pyradiomics,ctfm,merlin,pasta,medgemma')
968
+ .option('--alpha <n>', 'conformal risk level (when the trained second-reader is available)', '0.1')
969
+ .option('--wait', 'Wait for the methods to finish')
970
+ .option('--quiet', 'Suppress progress output')
971
+ .option('--json', 'Output as JSON')
972
+ .action(async (options) => {
973
+ try {
974
+ await (0, characterize_1.imagingCharacterizeCommand)(options);
975
+ }
976
+ catch (error) {
977
+ logger_1.Logger.error(`imaging characterize failed: ${error}`);
978
+ process.exit(1);
979
+ }
980
+ });
981
+ // imaging enrich — Phase 3 foundation-model enrichment of a finished twin:
982
+ // merlin (whole-scan change score) | vista3d (resection-bed seg) | medgemma
983
+ // (draft impression). Each runs its own GPU container and writes a sidecar.
984
+ imagingCmd
985
+ .command('enrich')
986
+ .description('Enrich a finished imaging-twin with a foundation model (merlin | vista3d | medgemma) via biofs-node GPU')
987
+ .requiredOption('--job <twin_job_id>', 'the twin_job_id from `biofs imaging twin`')
988
+ .requiredOption('--model <name>', 'merlin (change score) | vista3d (resection-bed seg) | medgemma (draft impression)')
989
+ .option('--hf-token <token>', 'HuggingFace token for MedGemma (gated); transient, executor-only')
990
+ .option('--wait', 'Wait for the GPU job to finish')
991
+ .option('--quiet', 'Suppress progress output')
992
+ .option('--json', 'Output as JSON')
993
+ .action(async (options) => {
994
+ try {
995
+ await (0, enrich_1.imagingEnrichCommand)(options);
996
+ }
997
+ catch (error) {
998
+ logger_1.Logger.error(`imaging enrich failed: ${error}`);
999
+ process.exit(1);
1000
+ }
1001
+ });
1002
+ // imaging compare — the "Image Time Machine": rigid slice-by-slice comparator of two
1003
+ // CT timepoints (A=follow-up, B=baseline aligned into A, signed diff) for the 2D
1004
+ // blink/crossfade/diff viewer. CPU job via biofs-node. --region (+ --zlo/--zhi)
1005
+ // focuses the rigid alignment on one z-band (e.g. the pelvis), still spot-safe.
1006
+ imagingCmd
1007
+ .command('compare')
1008
+ .description('Image Time Machine: rigid slice-by-slice comparator of two CT timepoints (CPU job via biofs-node)')
1009
+ .requiredOption('--baseline <studyUID>', 'baseline (earlier) study UID')
1010
+ .requiredOption('--baseline-series <uid>', 'baseline primary CT series UID')
1011
+ .requiredOption('--followup <studyUID>', 'follow-up (later) study UID = the reference grid')
1012
+ .requiredOption('--followup-series <uid>', 'follow-up primary CT series UID')
1013
+ .option('--baseline-label <label>', 'short label for the baseline (e.g. jan9)')
1014
+ .option('--followup-label <label>', 'short label for the follow-up (e.g. mar3)')
1015
+ .option('--anatomy <name>', 'anatomy (abdomen | chest)', 'abdomen')
1016
+ .option('--region <label>', 'focus the rigid alignment on a z-band (needs --zlo/--zhi), e.g. pelvis')
1017
+ .option('--zlo <frac>', 'region z-fraction lower bound [0..1]')
1018
+ .option('--zhi <frac>', 'region z-fraction upper bound [0..1]')
1019
+ .option('--wait', 'Wait for the comparator to finish')
1020
+ .option('--quiet', 'Suppress progress output')
1021
+ .option('--json', 'Output as JSON')
1022
+ .action(async (options) => {
1023
+ try {
1024
+ await (0, compare_1.imagingCompareCommand)(options);
1025
+ }
1026
+ catch (error) {
1027
+ logger_1.Logger.error(`imaging compare failed: ${error}`);
1028
+ process.exit(1);
1029
+ }
1030
+ });
1031
+ // Workspace commands — the shared intra-LLM case workspace (append-only,
1032
+ // hash-chained log that Claude Code + Grok Build co-edit via biofs-node).
1033
+ const workspaceCmd = program
1034
+ .command('workspace')
1035
+ .alias('ws')
1036
+ .description('Shared intra-LLM case workspace: append-only, hash-chained, reproducible record');
1037
+ workspaceCmd
1038
+ .command('open <case_id>')
1039
+ .description('Open or create a case workspace; print header + turns')
1040
+ .option('--title <title>', 'Case title (on create)')
1041
+ .option('--biocid <biocid...>', 'Biocid(s) under discussion (on create)')
1042
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1043
+ .option('--json', 'Output as JSON')
1044
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceOpenCommand)(caseId, options); });
1045
+ workspaceCmd
1046
+ .command('read <case_id>')
1047
+ .description('Read turns with seq > since_seq (how each agent sees new turns)')
1048
+ .option('--since-seq <n>', 'Only turns after this seq', '0')
1049
+ .option('--limit <n>', 'Max turns', '500')
1050
+ .option('--node <url>', 'biofs-node base override')
1051
+ .option('--json', 'Output as JSON')
1052
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceReadCommand)(caseId, options); });
1053
+ workspaceCmd
1054
+ .command('append <case_id>')
1055
+ .description('Append one turn (append-only). Default agent_id "operator"; use --as')
1056
+ .option('--as <agent_id>', 'Author id (e.g. operator, claude-code, grok-build)', 'operator')
1057
+ .option('--role <role>', 'Turn role', 'message')
1058
+ .option('--content <text>', 'Turn content')
1059
+ .option('--ref <biocid:hash:kind...>', 'Data refs, each biocid:content_hash:kind')
1060
+ .option('--node <url>', 'biofs-node base override')
1061
+ .option('--json', 'Output as JSON')
1062
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceAppendCommand)(caseId, options); });
1063
+ workspaceCmd
1064
+ .command('case <case_id>')
1065
+ .description('Update the shared case header with optimistic CAS (needs --expected-version)')
1066
+ .option('--title <title>', 'New title')
1067
+ .option('--status <status>', 'New status')
1068
+ .option('--active-editor <agent_id>', 'Advisory active editor')
1069
+ .option('--biocid <biocid...>', 'Replace biocids')
1070
+ .option('--expected-version <n>', 'Expected current _version', '0')
1071
+ .option('--node <url>', 'biofs-node base override')
1072
+ .option('--json', 'Output as JSON')
1073
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceCaseCommand)(caseId, options); });
1074
+ workspaceCmd
1075
+ .command('lease <resource>')
1076
+ .description('Advisory turn-taking lease (claim by default; --release to release)')
1077
+ .option('--holder <agent_id>', 'Lease holder', 'operator')
1078
+ .option('--ttl <seconds>', 'Lease TTL seconds', '60')
1079
+ .option('--release', 'Release instead of claim')
1080
+ .option('--node <url>', 'biofs-node base override')
1081
+ .option('--json', 'Output as JSON')
1082
+ .action(async (resource, options) => { await (0, workspace_1.workspaceLeaseCommand)(resource, options); });
1083
+ workspaceCmd
1084
+ .command('replay <case_id>')
1085
+ .description('Print the ordered log and verify the hash chain (the audit record)')
1086
+ .option('--node <url>', 'biofs-node base override')
1087
+ .option('--json', 'Output as JSON')
1088
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceReplayCommand)(caseId, options); });
1089
+ workspaceCmd
1090
+ .command('anchor <case_id>')
1091
+ .description('Record a turn-log segment digest for on-chain anchoring (stage B)')
1092
+ .option('--up-to-seq <n>', 'Anchor up to this seq (default: all)')
1093
+ .option('--node <url>', 'biofs-node base override')
1094
+ .option('--json', 'Output as JSON')
1095
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceAnchorCommand)(caseId, options); });
1096
+ workspaceCmd
1097
+ .command('classify <case_id>')
1098
+ .description('Record a structured ACMG-style classification claim (for consensus)')
1099
+ .requiredOption('--subject <s>', 'What is classified (HGVS, gene:variant, or biocid)')
1100
+ .requiredOption('--classification <c>', 'Verdict (Pathogenic|Likely pathogenic|VUS|Likely benign|Benign)')
1101
+ .option('--criteria <list>', 'ACMG criteria, comma-separated (e.g. PVS1,PM2)')
1102
+ .option('--strength <s>', 'Combined-strength note')
1103
+ .option('--confidence <n>', 'Confidence 0-1')
1104
+ .option('--rationale <text>', 'Justification (turn content)')
1105
+ .option('--as <agent_id>', 'Author id', 'operator')
1106
+ .option('--ref <biocid:hash:kind...>', 'Data refs')
1107
+ .option('--node <url>', 'biofs-node base override')
1108
+ .option('--json', 'Output as JSON')
1109
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceClassifyCommand)(caseId, options); });
1110
+ workspaceCmd
1111
+ .command('consensus <case_id>')
1112
+ .description('Compute cross-agent consensus from classification claims (agreement, disagreements)')
1113
+ .option('--node <url>', 'biofs-node base override')
1114
+ .option('--json', 'Output as JSON')
1115
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceConsensusCommand)(caseId, options); });
1116
+ workspaceCmd
1117
+ .command('export <case_id>')
1118
+ .description('Export the chain-verified turn log as portable JSON (for the verifier / archival)')
1119
+ .option('--out <file>', 'Write to file (default: stdout)')
1120
+ .option('--node <url>', 'biofs-node base override')
1121
+ .option('--quiet', 'Suppress status line')
1122
+ .action(async (caseId, options) => { await (0, workspace_1.workspaceExportCommand)(caseId, options); });
1123
+ workspaceCmd
1124
+ .command('verify <file>')
1125
+ .description('Independently verify an exported turn log offline (zero-trust reproducibility check)')
1126
+ .option('--offline', 'Verify the hash chain locally without contacting any server (default behavior)')
1127
+ .option('--json', 'Output as JSON')
1128
+ .action(async (file, options) => { await (0, workspace_1.workspaceVerifyCommand)(file, options); });
1129
+ // Duet — conductor that drives Claude Code + Grok Build headless on subscriptions.
1130
+ program
1131
+ .command('duet <case_id>')
1132
+ .description('Orchestrate Claude Code + Grok Build (subscription CLIs, headless) on one case')
1133
+ .option('--task <text>', 'The shared goal/question for the two models')
1134
+ .option('--biocid <biocid>', 'The biocid (annotated VCF / data) under discussion')
1135
+ .option('--rounds <n>', 'Number of rounds', '3')
1136
+ .option('--mode <mode>', 'alternate | parallel | consensus', 'alternate')
1137
+ .option('--models <csv>', 'Models in order (claude,grok,gemini)', 'claude,grok')
1138
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1139
+ .option('--biorouter <url>', 'biorouter base for the biofs MCP')
1140
+ .option('--mcp-dist <path>', 'Path to mcp-bio-context dist/index.js')
1141
+ .option('--claude-bin <bin>', 'Claude Code binary', 'claude')
1142
+ .option('--grok-bin <bin>', 'Grok Build binary', 'grok')
1143
+ .option('--gemini-bin <bin>', 'Gemini CLI binary', 'gemini')
1144
+ .option('--gemini-model <model>', 'Gemini model id', 'gemini-3-flash-preview')
1145
+ .option('--mock', 'Do not spawn the CLIs; simulate each turn (test the loop)')
1146
+ .option('--referee <model>', 'After rounds, this model adjudicates disagreements into a final call')
1147
+ .option('--timeout <seconds>', 'Per-CLI-invocation timeout (grok startup is slow)', '300')
1148
+ .option('--dry-run', 'Preflight checks only, then exit')
1149
+ .option('--json', 'Output as JSON')
1150
+ .action(async (caseId, options) => { await (0, duet_1.duetCommand)(caseId, options); });
1151
+ // Benchmark — the ACMG evaluation harness (single vs same-model vs cross-vendor).
1152
+ program
1153
+ .command('benchmark <dataset>')
1154
+ .description('Run the ACMG benchmark: single-model vs same-model debate vs cross-vendor debate, scored vs truth')
1155
+ .option('--arms <csv>', 'Arms to run', 'single,same-model,cross-vendor')
1156
+ .option('--models <csv>', 'Model panel', 'claude,grok,gemini')
1157
+ .option('--rounds <n>', 'Debate rounds for debate arms', '2')
1158
+ .option('--same-model <model>', 'Model used for the same-model-debate arm')
1159
+ .option('--mock', 'Deterministic mock (validate the harness without spawning CLIs)')
1160
+ .option('--mock-error <pct>', 'Per-model error rate in mock mode', '22')
1161
+ .option('--limit <n>', 'Only the first N variants')
1162
+ .option('--out <dir>', 'Results output directory')
1163
+ .option('--node <url>', 'biofs-node base override (BIOFS_NODE_URL)')
1164
+ .option('--biorouter <url>', 'biorouter base for the biofs MCP')
1165
+ .option('--mcp-dist <path>', 'Path to mcp-bio-context dist/index.js')
1166
+ .option('--gemini-model <model>', 'Gemini model id', 'gemini-3-flash-preview')
1167
+ .option('--timeout <seconds>', 'Per-CLI-invocation timeout', '300')
1168
+ .option('--json', 'Output summary as JSON')
1169
+ .action(async (dataset, options) => { await (0, benchmark_1.benchmarkCommand)(dataset, options); });
1170
+ // benchmark-prepare — build the publication dataset from a ClinVar export.
1171
+ program
1172
+ .command('benchmark-prepare <clinvar_variant_summary>')
1173
+ .description('Build a stratified benchmark dataset from a ClinVar variant_summary.txt[.gz] export')
1174
+ .option('--out <file>', 'Output JSONL path', 'bench/clinvar.jsonl')
1175
+ .option('--min-stars <n>', 'Minimum ClinVar review stars (2 = multiple submitters, no conflicts)', '2')
1176
+ .option('--per-tier <n>', 'Max variants sampled per ACMG tier', '100')
1177
+ .option('--max <n>', 'Hard cap on total variants')
1178
+ .option('--tiers <csv>', 'Restrict to tiers (e.g. P,LP,VUS,LB,B)')
1179
+ .option('--genes <csv>', 'Restrict to genes')
1180
+ .option('--assembly <asm>', 'Genome assembly to keep', 'GRCh38')
1181
+ .option('--json', 'Output summary as JSON')
1182
+ .action(async (file, options) => { await (0, benchmark_1.benchmarkPrepareCommand)(file, options); });
679
1183
  // Payment commands (x402 Protocol - Avalanche C-Chain)
680
1184
  const paymentCmd = program
681
1185
  .command('payment')
@@ -820,6 +1324,178 @@ agentCmd
820
1324
  process.exit(1);
821
1325
  }
822
1326
  });
1327
+ // agent register-sequentia - Register ERC-8004 agents on Sequentia BioAgentRegistry
1328
+ agentCmd
1329
+ .command('register-sequentia')
1330
+ .description('Register Cancer Digital Twin agents on the Sequentia BioAgentRegistry (ERC-8004)')
1331
+ .option('--all', 'Register all three canonical agents (clara, opencravat, genoclaw)')
1332
+ .option('--agent <name>', 'Register a single canonical agent: clara | opencravat | genoclaw')
1333
+ .option('--name <name>', 'Ad-hoc agent name (requires --uri)')
1334
+ .option('--uri <url>', 'Ad-hoc agent registration file (agentURI)')
1335
+ .option('--formats <list>', 'Ad-hoc supported formats (comma-separated)', 'vcf')
1336
+ .option('--private-key <key>', 'Ad-hoc agent private key (defaults to derived)')
1337
+ .option('--no-x402', 'Register with x402 disabled')
1338
+ .option('--dry-run', 'Plan the registration without broadcasting (no key/gas needed)')
1339
+ .option('--json', 'Emit JSON')
1340
+ .action(async (options) => {
1341
+ try {
1342
+ await (0, register_sequentia_1.agentRegisterSequentiaCommand)(options);
1343
+ }
1344
+ catch (error) {
1345
+ logger_1.Logger.error(`Sequentia agent registration failed: ${error}`);
1346
+ process.exit(1);
1347
+ }
1348
+ });
1349
+ // agent list-sequentia - Query on-chain ERC-8004 agent status
1350
+ agentCmd
1351
+ .command('list-sequentia')
1352
+ .description('Query on-chain ERC-8004 status of the Cancer Twin agents (or any wallet/agentId)')
1353
+ .option('--wallet <address>', 'Look up an arbitrary agent wallet')
1354
+ .option('--agent-id <id>', 'Look up an arbitrary agentId')
1355
+ .option('--json', 'Emit JSON')
1356
+ .action(async (options) => {
1357
+ try {
1358
+ await (0, list_sequentia_1.agentListSequentiaCommand)(options);
1359
+ }
1360
+ catch (error) {
1361
+ logger_1.Logger.error(`Sequentia agent list failed: ${error}`);
1362
+ process.exit(1);
1363
+ }
1364
+ });
1365
+ // Interpret command group - Agent 3: GenoClaw clinical interpreter (SQLite + context → report)
1366
+ const interpretCmd = program
1367
+ .command('interpret')
1368
+ .description('GenoClaw clinical interpreter — Cancer Digital Twin report from annotated context');
1369
+ interpretCmd
1370
+ .command('submit <biosample_serial>')
1371
+ .description('Submit annotated context to the GenoClaw interpreter agent (produces a Cancer Digital Twin report)')
1372
+ .option('--package <pkg>', 'Interpretation package: cancer_twin | rare_disease | pharmgx', 'cancer_twin')
1373
+ .option('--sqlite-biocid <biocid>', 'Explicit annotated-sqlite BioCID override')
1374
+ .option('--context-biocids <list>', 'Extra context BioCIDs (comma-separated)')
1375
+ .option('--wait', 'Wait for the interpretation to complete')
1376
+ .option('--quiet', 'Suppress progress output')
1377
+ .option('--json', 'Emit JSON')
1378
+ .action(async (biosampleSerial, options) => {
1379
+ try {
1380
+ await (0, submit_18.interpretSubmitCommand)(biosampleSerial, options);
1381
+ }
1382
+ catch (error) {
1383
+ logger_1.Logger.error(`Interpretation submission failed: ${error}`);
1384
+ process.exit(1);
1385
+ }
1386
+ });
1387
+ interpretCmd
1388
+ .command('status <interpret_job_id>')
1389
+ .description('Check GenoClaw interpretation job status')
1390
+ .option('--watch', 'Watch mode (poll until done)')
1391
+ .option('--wait', 'Block until the job completes')
1392
+ .option('--max-wait-min <minutes>', 'Max minutes to wait', '30')
1393
+ .option('--json', 'Emit JSON')
1394
+ .action(async (jobId, options) => {
1395
+ try {
1396
+ await (0, status_7.interpretStatusCommand)(jobId, options);
1397
+ }
1398
+ catch (error) {
1399
+ logger_1.Logger.error(`Interpretation status check failed: ${error}`);
1400
+ process.exit(1);
1401
+ }
1402
+ });
1403
+ // Ancestry command group - SOMOS 24-population admixture (privacy-preserving)
1404
+ const ancestryCmd = program
1405
+ .command('ancestry')
1406
+ .description('SOMOS 24-population ancestry — supervised-ADMIXTURE projection, optionally encrypted (genome never decrypted)');
1407
+ ancestryCmd
1408
+ .command('ingest <file>')
1409
+ .description('Ingest a DTC genotype into the SOMOS vault and register it, yielding a biosample serial')
1410
+ .option('--biowallet <address>', 'Data owner (custodial biowallet). Defaults to your own wallet.')
1411
+ .option('--wait', 'Wait for registration to complete and print the serial')
1412
+ .option('--quiet', 'Suppress progress output')
1413
+ .option('--json', 'Emit JSON')
1414
+ .action(async (file, options) => {
1415
+ try {
1416
+ await (0, ingest_1.ancestryIngestCommand)(file, options);
1417
+ }
1418
+ catch (error) {
1419
+ logger_1.Logger.error(`Ancestry ingest failed: ${error}`);
1420
+ process.exit(1);
1421
+ }
1422
+ });
1423
+ ancestryCmd
1424
+ .command('somos <biosample_serial>')
1425
+ .description('Compute SOMOS admixture for a genotype in the vault (default: exact projection; --encrypted: blind CKKS)')
1426
+ .option('--encrypted', 'Tier-1 BlindDot: CKKS-encrypt the genome; server projects blind (raw genome never decrypted)')
1427
+ .option('--fully-blind', 'Tier-2 (optional): also hide the 24-pop result from the server (bootstrapping backend)')
1428
+ .option('--biowallet <address>', 'Data owner: file the result under this wallet, not the operator\'s')
1429
+ .option('--wait', 'Wait for the computation to complete')
1430
+ .option('--quiet', 'Suppress progress output')
1431
+ .option('--json', 'Emit JSON')
1432
+ .action(async (biosampleSerial, options) => {
1433
+ try {
1434
+ await (0, somos_1.ancestrySomosCommand)(biosampleSerial, options);
1435
+ }
1436
+ catch (error) {
1437
+ logger_1.Logger.error(`Ancestry submission failed: ${error}`);
1438
+ process.exit(1);
1439
+ }
1440
+ });
1441
+ ancestryCmd
1442
+ .command('share <biosample_serial>')
1443
+ .description('Mint a BioCID-gated, revocable, expiring report link (no storage URL is ever created)')
1444
+ .option('--days <n>', 'Days until the link expires (max 30)', '7')
1445
+ .option('--quiet', 'Suppress progress output')
1446
+ .option('--json', 'Emit JSON')
1447
+ .action(async (serial, options) => {
1448
+ try {
1449
+ await (0, share_2.ancestryShareCommand)(serial, options);
1450
+ }
1451
+ catch (error) {
1452
+ logger_1.Logger.error(`Ancestry share failed: ${error}`);
1453
+ process.exit(1);
1454
+ }
1455
+ });
1456
+ ancestryCmd
1457
+ .command('shares')
1458
+ .description('List BioCID-gated report shares you created or own')
1459
+ .option('--serial <biosample_serial>', 'Filter by biosample serial')
1460
+ .option('--json', 'Emit JSON')
1461
+ .action(async (options) => {
1462
+ try {
1463
+ await (0, share_2.ancestrySharesCommand)(options);
1464
+ }
1465
+ catch (error) {
1466
+ logger_1.Logger.error(`Ancestry shares failed: ${error}`);
1467
+ process.exit(1);
1468
+ }
1469
+ });
1470
+ ancestryCmd
1471
+ .command('revoke <share_id>')
1472
+ .description('Revoke a report share immediately (the link dies on the next view)')
1473
+ .option('--json', 'Emit JSON')
1474
+ .action(async (shareId, options) => {
1475
+ try {
1476
+ await (0, share_2.ancestryRevokeCommand)(shareId, options);
1477
+ }
1478
+ catch (error) {
1479
+ logger_1.Logger.error(`Ancestry revoke failed: ${error}`);
1480
+ process.exit(1);
1481
+ }
1482
+ });
1483
+ ancestryCmd
1484
+ .command('status <ancestry_job_id>')
1485
+ .description('Check a SOMOS ancestry job status / fetch the 24-population result')
1486
+ .option('--watch', 'Watch mode (poll until done)')
1487
+ .option('--wait', 'Block until the job completes')
1488
+ .option('--max-wait-min <minutes>', 'Max minutes to wait', '40')
1489
+ .option('--json', 'Emit JSON')
1490
+ .action(async (jobId, options) => {
1491
+ try {
1492
+ await (0, status_8.ancestryStatusCommand)(jobId, options);
1493
+ }
1494
+ catch (error) {
1495
+ logger_1.Logger.error(`Ancestry status check failed: ${error}`);
1496
+ process.exit(1);
1497
+ }
1498
+ });
823
1499
  // Access control commands (v1.2.0)
824
1500
  const accessCmd = program
825
1501
  .command('access')
@@ -1176,105 +1852,735 @@ contextCmd
1176
1852
  }
1177
1853
  });
1178
1854
  // Job management commands (BioOS)
1179
- const jobCmd = program
1180
- .command('job')
1181
- .description('Manage research jobs (BioOS)');
1182
- // job create
1183
- jobCmd
1184
- .command('create <prompt> <file>')
1185
- .description('Create a research job from natural language prompt')
1186
- .option('--pipeline <template>', 'Use predefined pipeline template')
1855
+ // Methyl command group — Oxford Nanopore 5mCG/5hmCG methylation pipeline
1856
+ const methylCmd = program
1857
+ .command('methyl')
1858
+ .description('Oxford Nanopore 5mCG/5hmCG methylation: submit (client) + exec (VM runner)');
1859
+ // methyl submit (DEFAULT) — `biofs methyl <serial>` and `biofs methyl submit <serial>`
1860
+ methylCmd
1861
+ .command('submit <serial>', { isDefault: true })
1862
+ .description('Submit an ONT methylation job to biofs-node (modkit 5mCG/5hmCG bedMethyl)')
1863
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT Dorado BAM URIs (carry MM/ML tags)')
1864
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1865
+ .option('--parent-ip-id <id>', 'Parent BioIP / IP asset id')
1187
1866
  .option('--json', 'Output as JSON')
1188
- .action(async (prompt, fileRef, options) => {
1867
+ .action(async (serial, options) => {
1189
1868
  try {
1190
- await (0, create_1.jobCreateCommand)(prompt, fileRef, options);
1869
+ await (0, submit_3.methylSubmitCommand)(serial, options);
1191
1870
  }
1192
1871
  catch (error) {
1193
- logger_1.Logger.error(`Job creation failed: ${error}`);
1872
+ logger_1.Logger.error(`Methyl submit failed: ${error}`);
1194
1873
  process.exit(1);
1195
1874
  }
1196
1875
  });
1197
- // job status
1198
- jobCmd
1199
- .command('status <job_id>')
1200
- .description('Check job execution status')
1201
- .option('--json', 'Output as JSON')
1202
- .option('--watch', 'Watch mode (refresh every 5 seconds)')
1203
- .action(async (jobId, options) => {
1876
+ // methyl exec — the VM-side executor (biofs-node spawns: biofs methyl exec --flags)
1877
+ methylCmd
1878
+ .command('exec')
1879
+ .description('VM-side executor: minimap2 align + samtools merge + modkit pileup, stream bedMethyl to GCS')
1880
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
1881
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT BAM URIs')
1882
+ .option('--ref <build>', 'Reference build', 'auto')
1883
+ .option('--job-id <id>', 'Job id (for OUT/LOG GCS pathing)')
1884
+ .option('--batch-id <id>', 'Batch id')
1885
+ .option('--creator <wallet>', 'Creator wallet (lowercased for LOG_GCS path)')
1886
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
1887
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1888
+ .action(async (options) => {
1204
1889
  try {
1205
- await (0, status_4.jobStatusCommand)(jobId, options);
1890
+ await (0, exec_1.methylExecCommand)(options);
1206
1891
  }
1207
1892
  catch (error) {
1208
- logger_1.Logger.error(`Status check failed: ${error}`);
1893
+ logger_1.Logger.error(`Methyl exec failed: ${error}`);
1209
1894
  process.exit(1);
1210
1895
  }
1211
1896
  });
1212
- // job results
1213
- jobCmd
1214
- .command('results <job_id>')
1215
- .description('Get job results with download URLs')
1897
+ // Align-shard command group — sharded ONT long-read alignment (dorado, MM/ML-native)
1898
+ const alignShardCmd = program
1899
+ .command('align-shard')
1900
+ .description('Sharded ONT long-read alignment (dorado aligner, MM/ML preserved): submit (client) + exec (VM runner)');
1901
+ // align-shard submit (DEFAULT) — `biofs align-shard <serial>` and `biofs align-shard submit <serial>`
1902
+ alignShardCmd
1903
+ .command('submit <serial>', { isDefault: true })
1904
+ .description('Submit a sharded ONT alignment job to biofs-node (dorado aligner, persists merged aligned modBAM)')
1905
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT Dorado modBAM URIs (carry MM/ML tags)')
1906
+ .option('--shards <n>', 'Concurrent aligner workers (default: auto from nproc)')
1907
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1908
+ .option('--modkit', 'Also produce the 5mCG/5hmCG bedMethyl pileup (with QC gates)')
1909
+ .option('--parent-ip-id <id>', 'Parent BioIP / IP asset id')
1216
1910
  .option('--json', 'Output as JSON')
1217
- .option('--step <number>', 'Download specific step only', parseInt)
1218
- .action(async (jobId, options) => {
1911
+ .action(async (serial, options) => {
1219
1912
  try {
1220
- await (0, results_1.jobResultsCommand)(jobId, options);
1913
+ await (0, submit_4.alignShardSubmitCommand)(serial, options);
1221
1914
  }
1222
1915
  catch (error) {
1223
- logger_1.Logger.error(`Failed to get results: ${error}`);
1916
+ logger_1.Logger.error(`Align-shard submit failed: ${error}`);
1224
1917
  process.exit(1);
1225
1918
  }
1226
1919
  });
1227
- // job list
1228
- jobCmd
1229
- .command('list')
1230
- .description('List all your research jobs')
1231
- .option('--json', 'Output as JSON')
1232
- .option('--status <status>', 'Filter by status (pending, running, completed, failed)')
1233
- .option('--limit <number>', 'Limit number of results', parseInt)
1920
+ // align-shard exec — the VM-side executor (biofs-node spawns: biofs align-shard exec --flags)
1921
+ alignShardCmd
1922
+ .command('exec')
1923
+ .description('VM-side executor: W concurrent dorado aligner workers + merge, persist aligned modBAM to GCS')
1924
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
1925
+ .requiredOption('--bams <csv>', 'CSV of gs:// ONT modBAM URIs')
1926
+ .option('--ref <build>', 'Reference build', 'auto')
1927
+ .option('--workers <n>', 'Concurrent aligner workers (default: auto from nproc)')
1928
+ .option('--modkit', 'Also run modkit pileup (5mCG/5hmCG bedMethyl) with QC gates')
1929
+ .option('--job-id <id>', 'Job id (for OUT/LOG GCS pathing)')
1930
+ .option('--batch-id <id>', 'Batch id')
1931
+ .option('--creator <wallet>', 'Creator wallet (lowercased for LOG_GCS path)')
1932
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
1933
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1234
1934
  .action(async (options) => {
1235
1935
  try {
1236
- await (0, list_3.jobListCommand)(options);
1936
+ await (0, exec_2.alignShardExecCommand)(options);
1237
1937
  }
1238
1938
  catch (error) {
1239
- logger_1.Logger.error(`Failed to list jobs: ${error}`);
1939
+ logger_1.Logger.error(`Align-shard exec failed: ${error}`);
1240
1940
  process.exit(1);
1241
1941
  }
1242
1942
  });
1243
- // job pipelines
1244
- jobCmd
1245
- .command('pipelines')
1246
- .alias('templates')
1247
- .description('List available pipeline templates')
1943
+ // Comethyl command group — single-molecule co-methylation analysis (gated, pre-registered)
1944
+ const comethylCmd = program
1945
+ .command('comethyl')
1946
+ .description('Single-molecule co-methylation analysis (imprinting floor, lambda, nulls): submit (client) + exec (VM runner)');
1947
+ comethylCmd
1948
+ .command('submit <serial>', { isDefault: true })
1949
+ .description('Submit a comethyl analysis job to biofs-node (gate=floor: imprinting/ASM allele-split)')
1950
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (MM/ML), the comethyl input')
1951
+ .requiredOption('--hifi-vcf <gs>', 'gs:// HiFi het-SNP VCF (phased on the VM if unphased)')
1952
+ .requiredOption('--hifi-bam <csv>', 'CSV of gs:// HiFi BAM URIs (for whatshap phase)')
1953
+ .option('--gate <g>', 'floor | lambda | null-a', 'floor')
1954
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1248
1955
  .option('--json', 'Output as JSON')
1956
+ .action(async (serial, options) => {
1957
+ try {
1958
+ await (0, submit_5.comethylSubmitCommand)(serial, options);
1959
+ }
1960
+ catch (error) {
1961
+ logger_1.Logger.error(`Comethyl submit failed: ${error}`);
1962
+ process.exit(1);
1963
+ }
1964
+ });
1965
+ comethylCmd
1966
+ .command('exec')
1967
+ .description('VM-side executor: phase ONT reads by HiFi het SNPs + per-haplotype modkit at imprinted DMRs')
1968
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
1969
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
1970
+ .requiredOption('--hifi-vcf <gs>', 'gs:// HiFi het-SNP VCF')
1971
+ .requiredOption('--hifi-bams <csv>', 'CSV of gs:// HiFi BAM URIs')
1972
+ .option('--gate <g>', 'floor', 'floor')
1973
+ .option('--ref <build>', 'Reference build', 'auto')
1974
+ .option('--job-id <id>', 'Job id')
1975
+ .option('--batch-id <id>', 'Batch id')
1976
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
1977
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
1978
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
1249
1979
  .action(async (options) => {
1250
1980
  try {
1251
- await (0, pipelines_1.pipelinesCommand)(options);
1981
+ await (0, exec_3.comethylExecCommand)(options);
1252
1982
  }
1253
1983
  catch (error) {
1254
- logger_1.Logger.error(`Failed to list pipelines: ${error}`);
1984
+ logger_1.Logger.error(`Comethyl exec failed: ${error}`);
1255
1985
  process.exit(1);
1256
1986
  }
1257
1987
  });
1258
- // job submit-clara - Submit Clara Parabricks FASTQ→VCF job
1259
- jobCmd
1260
- .command('submit-clara <biosample_id> [fastq_r1] [fastq_r2]')
1261
- .description('Submit Clara Parabricks GPU variant calling job (FASTQ → VCF)\nAuto-discovers FASTQ files from consent if not specified')
1262
- .option('--job-id <id>', 'Custom job ID (default: auto-generated UUID)')
1263
- .option('--reference <genome>', 'Reference genome (default: hg38)')
1264
- .option('--capture-kit <kit>', 'Capture kit name (default: agilent_v8)')
1265
- .option('--sequencing-type <type>', 'Sequencing type: WES or WGS (default: WES)')
1266
- .option('--interval-file <path>', 'BED file path for targeted sequencing')
1988
+ // SV-call command group — ONT structural-variant calling (Sniffles2)
1989
+ const svCallCmd = program
1990
+ .command('sv-call')
1991
+ .description('ONT structural-variant calling (Sniffles2): submit (client) + exec (VM runner)');
1992
+ svCallCmd
1993
+ .command('submit <serial>', { isDefault: true })
1994
+ .description('Submit an ONT SV-calling job to biofs-node (Sniffles2 over the aligned modBAM)')
1995
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (the SV-calling input)')
1996
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
1267
1997
  .option('--json', 'Output as JSON')
1268
- .action(async (biosampleId, fastqR1, fastqR2, options) => {
1998
+ .action(async (serial, options) => {
1269
1999
  try {
1270
- await (0, submit_clara_1.submitClaraCommand)(biosampleId, fastqR1, fastqR2, options);
2000
+ await (0, submit_6.svCallSubmitCommand)(serial, options);
1271
2001
  }
1272
2002
  catch (error) {
1273
- logger_1.Logger.error(`Clara job submission failed: ${error}`);
2003
+ logger_1.Logger.error(`sv-call submit failed: ${error}`);
1274
2004
  process.exit(1);
1275
2005
  }
1276
2006
  });
1277
- // Agent Health - Check processing agent readiness
2007
+ svCallCmd
2008
+ .command('exec')
2009
+ .description('VM-side executor: Sniffles2 over the gcsfuse-mounted modBAM, persist SV VCF to GCS')
2010
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2011
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
2012
+ .option('--ref <build>', 'Reference build', 'auto')
2013
+ .option('--job-id <id>', 'Job id')
2014
+ .option('--batch-id <id>', 'Batch id')
2015
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2016
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2017
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2018
+ .action(async (options) => {
2019
+ try {
2020
+ await (0, exec_4.svCallExecCommand)(options);
2021
+ }
2022
+ catch (error) {
2023
+ logger_1.Logger.error(`sv-call exec failed: ${error}`);
2024
+ process.exit(1);
2025
+ }
2026
+ });
2027
+ // QC command group — long-read read-quality + coverage (verkko-readiness)
2028
+ const qcCmd = program
2029
+ .command('qc')
2030
+ .description('Long-read QC (read quality + coverage, verkko-readiness): submit (client) + exec (VM runner)');
2031
+ qcCmd
2032
+ .command('submit <serial>', { isDefault: true })
2033
+ .description('Submit a long-read QC job to biofs-node (cramino + seqkit + HiFi rq-tag QV over gcsfuse-RO)')
2034
+ .requiredOption('--inputs <gs>', 'CSV of gs:// inputs (BAM/CRAM and/or FASTA/FASTQ.gz)')
2035
+ .option('--genome-size <bp>', 'Haploid genome size for coverage', '3100000000')
2036
+ .option('--json', 'Output as JSON')
2037
+ .action(async (serial, options) => {
2038
+ try {
2039
+ await (0, submit_7.qcSubmitCommand)(serial, options);
2040
+ }
2041
+ catch (error) {
2042
+ logger_1.Logger.error(`qc submit failed: ${error}`);
2043
+ process.exit(1);
2044
+ }
2045
+ });
2046
+ qcCmd
2047
+ .command('exec')
2048
+ .description('VM-side executor: cramino/seqkit/rq over gcsfuse-mounted inputs, persist QC manifest to GCS')
2049
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2050
+ .requiredOption('--inputs <gs>', 'CSV of gs:// inputs (BAM/CRAM and/or FASTA/FASTQ.gz)')
2051
+ .option('--genome-size <bp>', 'Haploid genome size for coverage', '3100000000')
2052
+ .option('--job-id <id>', 'Job id')
2053
+ .option('--batch-id <id>', 'Batch id')
2054
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2055
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2056
+ .action(async (options) => {
2057
+ try {
2058
+ await (0, exec_5.qcExecCommand)(options);
2059
+ }
2060
+ catch (error) {
2061
+ logger_1.Logger.error(`qc exec failed: ${error}`);
2062
+ process.exit(1);
2063
+ }
2064
+ });
2065
+ // Verkko command group — telomere-to-telomere assembly (verkko 2.3.2), biocid-gated
2066
+ const verkkoCmd = program
2067
+ .command('verkko')
2068
+ .description('Verkko T2T assembly (HiFi + ONT-ultralong): submit (client, biocids) + exec (VM runner)');
2069
+ verkkoCmd
2070
+ .command('submit <serial>', { isDefault: true })
2071
+ .description('Submit a verkko T2T assembly job to biofs-node (inputs are biorouter biocids, NOT gs://)')
2072
+ .requiredOption('--hifi <biocids>', 'CSV of biocid:// HiFi reads (from biorouter)')
2073
+ .requiredOption('--nano <biocids>', 'CSV of biocid:// ONT reads (from biorouter)')
2074
+ .option('--hifi-prop <p>', 'Downsample HiFi to this proportion of reads', '1.0')
2075
+ .option('--ont-minlen <bp>', 'Keep ONT reads >= this length (ultralong)', '100000')
2076
+ .option('--local-memory <gb>', 'verkko --local-memory (GB)', '320')
2077
+ .option('--local-cpus <n>', 'verkko --local-cpus', '80')
2078
+ .option('--json', 'Output as JSON')
2079
+ .action(async (serial, options) => {
2080
+ try {
2081
+ await (0, submit_8.verkkoSubmitCommand)(serial, options);
2082
+ }
2083
+ catch (error) {
2084
+ logger_1.Logger.error(`verkko submit failed: ${error}`);
2085
+ process.exit(1);
2086
+ }
2087
+ });
2088
+ verkkoCmd
2089
+ .command('exec')
2090
+ .description('VM-side executor: verkko 2.3.2 over front-resolved gated gs:// inputs, persist assembly to GCS')
2091
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2092
+ .requiredOption('--hifi <gs>', 'CSV of resolved gs:// HiFi reads (gated by biofs-node)')
2093
+ .requiredOption('--nano <gs>', 'CSV of resolved gs:// ONT reads (gated by biofs-node)')
2094
+ .option('--hifi-prop <p>', 'Downsample HiFi proportion', '1.0')
2095
+ .option('--ont-minlen <bp>', 'ONT min length', '100000')
2096
+ .option('--local-memory <gb>', 'verkko --local-memory (GB)', '320')
2097
+ .option('--local-cpus <n>', 'verkko --local-cpus', '80')
2098
+ .option('--ref <build>', 'ignored (appended by the generic biofs-node spawner)')
2099
+ .option('--job-id <id>', 'Job id')
2100
+ .option('--batch-id <id>', 'Batch id')
2101
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2102
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2103
+ .option('--ref-bucket <name>', 'ignored (appended by the generic biofs-node spawner)')
2104
+ .action(async (options) => {
2105
+ try {
2106
+ await (0, exec_6.verkkoExecCommand)(options);
2107
+ }
2108
+ catch (error) {
2109
+ logger_1.Logger.error(`verkko exec failed: ${error}`);
2110
+ process.exit(1);
2111
+ }
2112
+ });
2113
+ // ONT-variants command group — ONT small-variant calling (Clair3)
2114
+ const ontVariantsCmd = program
2115
+ .command('ont-variants')
2116
+ .description('ONT small-variant calling (Clair3, R10.4.1 sup): submit (client) + exec (VM runner)');
2117
+ ontVariantsCmd
2118
+ .command('submit <serial>', { isDefault: true })
2119
+ .description('Submit an ONT SNV/indel job to biofs-node (Clair3 over the aligned modBAM)')
2120
+ .requiredOption('--modbam <gs>', 'gs:// merged aligned ONT modBAM (the SNV/indel-calling input)')
2121
+ .option('--model <name>', 'Clair3 model name (default: auto-pick R10.4.1 sup from the image)')
2122
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2123
+ .option('--json', 'Output as JSON')
2124
+ .action(async (serial, options) => {
2125
+ try {
2126
+ await (0, submit_9.ontVariantsSubmitCommand)(serial, options);
2127
+ }
2128
+ catch (error) {
2129
+ logger_1.Logger.error(`ont-variants submit failed: ${error}`);
2130
+ process.exit(1);
2131
+ }
2132
+ });
2133
+ ontVariantsCmd
2134
+ .command('exec')
2135
+ .description('VM-side executor: Clair3 (ONT) over the gcsfuse-mounted modBAM, persist SNV/indel VCF to GCS')
2136
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2137
+ .requiredOption('--modbam <gs>', 'gs:// merged ONT modBAM')
2138
+ .option('--model <name>', 'Clair3 model name (auto-picked if empty)')
2139
+ .option('--ref <build>', 'Reference build', 'auto')
2140
+ .option('--job-id <id>', 'Job id')
2141
+ .option('--batch-id <id>', 'Batch id')
2142
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2143
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2144
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2145
+ .action(async (options) => {
2146
+ try {
2147
+ await (0, exec_7.ontVariantsExecCommand)(options);
2148
+ }
2149
+ catch (error) {
2150
+ logger_1.Logger.error(`ont-variants exec failed: ${error}`);
2151
+ process.exit(1);
2152
+ }
2153
+ });
2154
+ // hifi-deepvariant command group — HiFi small-variant calling (Parabricks DeepVariant, GPU)
2155
+ const hifiDvCmd = program
2156
+ .command('hifi-deepvariant')
2157
+ .description('HiFi small-variant calling (Parabricks DeepVariant --mode pacbio, GPU): submit (client) + exec (GPU runner)');
2158
+ hifiDvCmd
2159
+ .command('submit <serial>', { isDefault: true })
2160
+ .description('Submit a HiFi DeepVariant job to biofs-node (pbrun deepvariant over the aligned HiFi BAM)')
2161
+ .requiredOption('--bam <gs>', 'gs:// CHM13-aligned HiFi BAM (output of hifi-align --ref CHM13)')
2162
+ .option('--ref <build>', 'Reference: CHM13 | GRCh38 | auto', 'auto')
2163
+ .option('--gvcf', 'Also emit a gVCF (second pbrun pass)')
2164
+ .option('--json', 'Output as JSON')
2165
+ .action(async (serial, options) => {
2166
+ try {
2167
+ await (0, submit_14.hifiDeepvariantSubmitCommand)(serial, options);
2168
+ }
2169
+ catch (error) {
2170
+ logger_1.Logger.error(`hifi-deepvariant submit failed: ${error}`);
2171
+ process.exit(1);
2172
+ }
2173
+ });
2174
+ hifiDvCmd
2175
+ .command('exec')
2176
+ .description('GPU-side executor: pbrun deepvariant (--mode pacbio) over the gcsfuse-mounted HiFi BAM, persist VCF to GCS')
2177
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2178
+ .requiredOption('--bam <gs>', 'gs:// CHM13-aligned HiFi BAM')
2179
+ .option('--ref <build>', 'Reference build', 'auto')
2180
+ .option('--gvcf', 'Also emit a gVCF')
2181
+ .option('--job-id <id>', 'Job id')
2182
+ .option('--batch-id <id>', 'Batch id')
2183
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2184
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2185
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2186
+ .action(async (options) => {
2187
+ try {
2188
+ await (0, exec_12.hifiDeepvariantExecCommand)(options);
2189
+ }
2190
+ catch (error) {
2191
+ logger_1.Logger.error(`hifi-deepvariant exec failed: ${error}`);
2192
+ process.exit(1);
2193
+ }
2194
+ });
2195
+ // liftover command group — cross-reference VCF liftover (CrossMap, CHM13 -> GRCh38)
2196
+ const liftoverCmd = program
2197
+ .command('liftover')
2198
+ .description('Cross-reference VCF liftover (CrossMap, CHM13 -> GRCh38): submit (client) + exec (VM runner)');
2199
+ liftoverCmd
2200
+ .command('submit <serial>', { isDefault: true })
2201
+ .description('Submit a liftover job to biofs-node (CrossMap a CHM13 VCF to GRCh38 for ClinVar annotation)')
2202
+ .requiredOption('--vcf <gs>', 'gs:// CHM13-coordinate VCF to lift')
2203
+ .option('--to <build>', 'Target assembly', 'GRCh38')
2204
+ .option('--json', 'Output as JSON')
2205
+ .action(async (serial, options) => {
2206
+ try {
2207
+ await (0, submit_15.liftoverSubmitCommand)(serial, options);
2208
+ }
2209
+ catch (error) {
2210
+ logger_1.Logger.error(`liftover submit failed: ${error}`);
2211
+ process.exit(1);
2212
+ }
2213
+ });
2214
+ liftoverCmd
2215
+ .command('exec')
2216
+ .description('VM-side executor: CrossMap CHM13->GRCh38 over the gcsfuse-mounted VCF, persist lifted VCF + reject to GCS')
2217
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2218
+ .requiredOption('--vcf <gs>', 'gs:// CHM13-coordinate VCF')
2219
+ .option('--to <build>', 'Target assembly', 'GRCh38')
2220
+ .option('--ref-from <build>', 'Source assembly', 'CHM13')
2221
+ .option('--ref <build>', 'Reference build (accepted+ignored; liftover uses --to + chain)', 'auto')
2222
+ .option('--tool <engine>', 'Liftover engine: crossmap (default) | gatk (swap-aware, recovers ref-discordant)', 'crossmap')
2223
+ .option('--job-id <id>', 'Job id')
2224
+ .option('--batch-id <id>', 'Batch id')
2225
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2226
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2227
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2228
+ .action(async (options) => {
2229
+ try {
2230
+ await (0, exec_13.liftoverExecCommand)(options);
2231
+ }
2232
+ catch (error) {
2233
+ logger_1.Logger.error(`liftover exec failed: ${error}`);
2234
+ process.exit(1);
2235
+ }
2236
+ });
2237
+ // Dipcall command group — assembly-based variant calling (dipcall) for Study 2
2238
+ const dipcallCmd = program.command('dipcall').description('Assembly-based variant calling (dipcall, phased diploid assembly -> reference): submit (client) + exec (VM runner)');
2239
+ dipcallCmd.command('submit <serial>', { isDefault: true })
2240
+ .description('Submit an assembly-based dipcall job to biofs-node (two haplotype FASTAs -> dip VCF + confident BED)')
2241
+ .requiredOption('--hap1 <gs>', 'gs:// haplotype-1 assembly FASTA')
2242
+ .requiredOption('--hap2 <gs>', 'gs:// haplotype-2 assembly FASTA')
2243
+ .option('--ref <build>', 'Reference: CHM13 | GRCh38 | auto', 'auto')
2244
+ .option('--json', 'Output as JSON')
2245
+ .action(async (serial, options) => {
2246
+ try {
2247
+ await (0, submit_16.dipcallSubmitCommand)(serial, options);
2248
+ }
2249
+ catch (error) {
2250
+ logger_1.Logger.error(`dipcall submit failed: ${error}`);
2251
+ process.exit(1);
2252
+ }
2253
+ });
2254
+ dipcallCmd.command('exec')
2255
+ .description('VM-side executor: dipcall over the staged diploid assembly + reference, persist dip VCF + confident BED to GCS')
2256
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2257
+ .requiredOption('--hap1 <gs>', 'gs:// haplotype-1 assembly FASTA')
2258
+ .requiredOption('--hap2 <gs>', 'gs:// haplotype-2 assembly FASTA')
2259
+ .option('--ref <build>', 'Reference build', 'auto')
2260
+ .option('--job-id <id>', 'Job id')
2261
+ .option('--batch-id <id>', 'Batch id')
2262
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2263
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2264
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2265
+ .action(async (options) => {
2266
+ try {
2267
+ await (0, exec_14.dipcallExecCommand)(options);
2268
+ }
2269
+ catch (error) {
2270
+ logger_1.Logger.error(`dipcall exec failed: ${error}`);
2271
+ process.exit(1);
2272
+ }
2273
+ });
2274
+ // HiFi-align command group — PacBio HiFi read alignment (pbmm2, MM/ML preserved) — the keystone
2275
+ const hifiAlignCmd = program
2276
+ .command('hifi-align')
2277
+ .description('PacBio HiFi read alignment (pbmm2 HIFI, 5mC tags preserved): submit (client) + exec (VM runner)');
2278
+ hifiAlignCmd
2279
+ .command('submit <serial>', { isDefault: true })
2280
+ .description('Submit a HiFi alignment job to biofs-node (pbmm2 per-cell + merge, persist aligned BAM)')
2281
+ .requiredOption('--bams <csv>', 'CSV of gs:// unaligned HiFi BAM URIs (carry MM/ML 5mC tags)')
2282
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2283
+ .option('--json', 'Output as JSON')
2284
+ .action(async (serial, options) => {
2285
+ try {
2286
+ await (0, submit_10.hifiAlignSubmitCommand)(serial, options);
2287
+ }
2288
+ catch (error) {
2289
+ logger_1.Logger.error(`hifi-align submit failed: ${error}`);
2290
+ process.exit(1);
2291
+ }
2292
+ });
2293
+ hifiAlignCmd
2294
+ .command('exec')
2295
+ .description('VM-side executor: pbmm2 align each HiFi cell (HIFI preset) + merge, persist aligned BAM to GCS')
2296
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2297
+ .requiredOption('--bams <csv>', 'CSV of gs:// unaligned HiFi BAM URIs')
2298
+ .option('--ref <build>', 'Reference build', 'auto')
2299
+ .option('--job-id <id>', 'Job id')
2300
+ .option('--batch-id <id>', 'Batch id')
2301
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2302
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2303
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2304
+ .action(async (options) => {
2305
+ try {
2306
+ await (0, exec_8.hifiAlignExecCommand)(options);
2307
+ }
2308
+ catch (error) {
2309
+ logger_1.Logger.error(`hifi-align exec failed: ${error}`);
2310
+ process.exit(1);
2311
+ }
2312
+ });
2313
+ // ---- downstream verbs the hifi-align keystone unblocks (M3/M4/M5/M9) ----
2314
+ // pbsv — HiFi read-based structural variants
2315
+ const pbsvCmd = program.command('pbsv').description('HiFi read-based structural-variant calling (pbsv): submit (client) + exec (VM runner)');
2316
+ pbsvCmd.command('submit <serial>', { isDefault: true })
2317
+ .description('Submit a HiFi pbsv SV-calling job to biofs-node (pbsv over the aligned HiFi BAM)')
2318
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM (the pbsv-calling input)')
2319
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2320
+ .option('--json', 'Output as JSON')
2321
+ .action(async (serial, options) => {
2322
+ try {
2323
+ await (0, submit_11.pbsvSubmitCommand)(serial, options);
2324
+ }
2325
+ catch (error) {
2326
+ logger_1.Logger.error(`pbsv submit failed: ${error}`);
2327
+ process.exit(1);
2328
+ }
2329
+ });
2330
+ pbsvCmd.command('exec')
2331
+ .description('VM-side executor: pbsv discover+call over the gcsfuse-mounted HiFi BAM, persist SV VCF to GCS')
2332
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2333
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2334
+ .option('--ref <build>', 'Reference build', 'auto')
2335
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2336
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2337
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2338
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2339
+ .action(async (options) => {
2340
+ try {
2341
+ await (0, exec_9.pbsvExecCommand)(options);
2342
+ }
2343
+ catch (error) {
2344
+ logger_1.Logger.error(`pbsv exec failed: ${error}`);
2345
+ process.exit(1);
2346
+ }
2347
+ });
2348
+ // repeat-genotype — tandem-repeat / repeat-expansion genotyping (TRGT)
2349
+ const repeatCmd = program.command('repeat-genotype').description('Tandem-repeat / repeat-expansion genotyping (TRGT): submit (client) + exec (VM runner)');
2350
+ repeatCmd.command('submit <serial>', { isDefault: true })
2351
+ .description('Submit a TRGT repeat-genotyping job to biofs-node (aligned HiFi BAM + repeat catalog)')
2352
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM (the genotyping input)')
2353
+ .requiredOption('--catalog <gs>', 'gs:// repeat catalog BED (repeat definitions)')
2354
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2355
+ .option('--json', 'Output as JSON')
2356
+ .action(async (serial, options) => {
2357
+ try {
2358
+ await (0, submit_12.repeatGenotypeSubmitCommand)(serial, options);
2359
+ }
2360
+ catch (error) {
2361
+ logger_1.Logger.error(`repeat-genotype submit failed: ${error}`);
2362
+ process.exit(1);
2363
+ }
2364
+ });
2365
+ repeatCmd.command('exec')
2366
+ .description('VM-side executor: TRGT genotype over the gcsfuse-mounted HiFi BAM + catalog, persist repeat VCF')
2367
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2368
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2369
+ .requiredOption('--catalog <gs>', 'gs:// repeat catalog BED')
2370
+ .option('--ref <build>', 'Reference build', 'auto')
2371
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2372
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2373
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2374
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2375
+ .action(async (options) => {
2376
+ try {
2377
+ await (0, exec_10.repeatGenotypeExecCommand)(options);
2378
+ }
2379
+ catch (error) {
2380
+ logger_1.Logger.error(`repeat-genotype exec failed: ${error}`);
2381
+ process.exit(1);
2382
+ }
2383
+ });
2384
+ // phase — genome-wide read-backed phasing (HiPhase)
2385
+ const phaseCmd = program.command('phase').description('Genome-wide read-backed phasing (HiPhase): submit (client) + exec (VM runner)');
2386
+ phaseCmd.command('submit <serial>', { isDefault: true })
2387
+ .description('Submit a HiPhase phasing job to biofs-node (aligned HiFi BAM + small-variant VCF)')
2388
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2389
+ .requiredOption('--vcf <gs>', 'gs:// small-variant VCF to phase')
2390
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2391
+ .option('--json', 'Output as JSON')
2392
+ .action(async (serial, options) => {
2393
+ try {
2394
+ await (0, submit_13.phaseSubmitCommand)(serial, options);
2395
+ }
2396
+ catch (error) {
2397
+ logger_1.Logger.error(`phase submit failed: ${error}`);
2398
+ process.exit(1);
2399
+ }
2400
+ });
2401
+ phaseCmd.command('exec')
2402
+ .description('VM-side executor: HiPhase over the gcsfuse-mounted HiFi BAM + VCF, persist phased VCF + haplotagged BAM')
2403
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2404
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2405
+ .requiredOption('--vcf <gs>', 'gs:// small-variant VCF')
2406
+ .option('--ref <build>', 'Reference build', 'auto')
2407
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2408
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2409
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2410
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2411
+ .action(async (options) => {
2412
+ try {
2413
+ await (0, exec_11.phaseExecCommand)(options);
2414
+ }
2415
+ catch (error) {
2416
+ logger_1.Logger.error(`phase exec failed: ${error}`);
2417
+ process.exit(1);
2418
+ }
2419
+ });
2420
+ // hifi-methyl — orthogonal HiFi 5mC methylome (pb-CpG-tools)
2421
+ const hifiMethylCmd = program.command('hifi-methyl').description('Orthogonal HiFi 5mC methylome (pb-CpG-tools): submit (client) + exec (VM runner)');
2422
+ hifiMethylCmd.command('submit <serial>', { isDefault: true })
2423
+ .description('Submit a pb-CpG-tools HiFi methylome job to biofs-node (aligned HiFi BAM with MM/ML tags)')
2424
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM carrying MM/ML 5mC tags')
2425
+ .option('--ref <build>', 'Reference: GRCh38 | auto', 'auto')
2426
+ .option('--json', 'Output as JSON')
2427
+ .action(async (serial, options) => {
2428
+ try {
2429
+ await (0, submit_17.hifiMethylSubmitCommand)(serial, options);
2430
+ }
2431
+ catch (error) {
2432
+ logger_1.Logger.error(`hifi-methyl submit failed: ${error}`);
2433
+ process.exit(1);
2434
+ }
2435
+ });
2436
+ hifiMethylCmd.command('exec')
2437
+ .description('VM-side executor: pb-CpG-tools over the gcsfuse-mounted HiFi BAM, persist 5mCG bedMethyl')
2438
+ .requiredOption('--sample <serial>', 'Biosample serial / SAMPLE')
2439
+ .requiredOption('--bam <gs>', 'gs:// aligned HiFi BAM')
2440
+ .option('--ref <build>', 'Reference build', 'auto')
2441
+ .option('--job-id <id>', 'Job id').option('--batch-id <id>', 'Batch id')
2442
+ .option('--creator <wallet>', 'Creator wallet (lowercased for GCS path)')
2443
+ .option('--out-bucket <name>', 'Output bucket', 'genobank-parabricks-output')
2444
+ .option('--ref-bucket <name>', 'Reference bucket', 'genobank-references')
2445
+ .action(async (options) => {
2446
+ try {
2447
+ await (0, exec_15.hifiMethylExecCommand)(options);
2448
+ }
2449
+ catch (error) {
2450
+ logger_1.Logger.error(`hifi-methyl exec failed: ${error}`);
2451
+ process.exit(1);
2452
+ }
2453
+ });
2454
+ const jobCmd = program
2455
+ .command('job')
2456
+ .description('Manage research jobs (BioOS)');
2457
+ // job create
2458
+ jobCmd
2459
+ .command('create <prompt> <file>')
2460
+ .description('Create a research job from natural language prompt')
2461
+ .option('--pipeline <template>', 'Use predefined pipeline template')
2462
+ .option('--json', 'Output as JSON')
2463
+ .action(async (prompt, fileRef, options) => {
2464
+ try {
2465
+ await (0, create_1.jobCreateCommand)(prompt, fileRef, options);
2466
+ }
2467
+ catch (error) {
2468
+ logger_1.Logger.error(`Job creation failed: ${error}`);
2469
+ process.exit(1);
2470
+ }
2471
+ });
2472
+ // job status
2473
+ jobCmd
2474
+ .command('status <job_id>')
2475
+ .description('Check job execution status')
2476
+ .option('--json', 'Output as JSON')
2477
+ .option('--watch', 'Watch mode (refresh every 5 seconds)')
2478
+ .action(async (jobId, options) => {
2479
+ try {
2480
+ await (0, status_4.jobStatusCommand)(jobId, options);
2481
+ }
2482
+ catch (error) {
2483
+ logger_1.Logger.error(`Status check failed: ${error}`);
2484
+ process.exit(1);
2485
+ }
2486
+ });
2487
+ // job results
2488
+ jobCmd
2489
+ .command('results <job_id>')
2490
+ .description('Get job results with download URLs')
2491
+ .option('--json', 'Output as JSON')
2492
+ .option('--step <number>', 'Download specific step only', parseInt)
2493
+ .action(async (jobId, options) => {
2494
+ try {
2495
+ await (0, results_1.jobResultsCommand)(jobId, options);
2496
+ }
2497
+ catch (error) {
2498
+ logger_1.Logger.error(`Failed to get results: ${error}`);
2499
+ process.exit(1);
2500
+ }
2501
+ });
2502
+ // job list
2503
+ jobCmd
2504
+ .command('list')
2505
+ .description('List all your research jobs')
2506
+ .option('--json', 'Output as JSON')
2507
+ .option('--status <status>', 'Filter by status (pending, running, completed, failed)')
2508
+ .option('--limit <number>', 'Limit number of results', parseInt)
2509
+ .action(async (options) => {
2510
+ try {
2511
+ await (0, list_3.jobListCommand)(options);
2512
+ }
2513
+ catch (error) {
2514
+ logger_1.Logger.error(`Failed to list jobs: ${error}`);
2515
+ process.exit(1);
2516
+ }
2517
+ });
2518
+ // job pipelines
2519
+ jobCmd
2520
+ .command('pipelines')
2521
+ .alias('templates')
2522
+ .description('List available pipeline templates')
2523
+ .option('--json', 'Output as JSON')
2524
+ .action(async (options) => {
2525
+ try {
2526
+ await (0, pipelines_1.pipelinesCommand)(options);
2527
+ }
2528
+ catch (error) {
2529
+ logger_1.Logger.error(`Failed to list pipelines: ${error}`);
2530
+ process.exit(1);
2531
+ }
2532
+ });
2533
+ // job submit-clara - Submit Clara Parabricks FASTQ→VCF job
2534
+ jobCmd
2535
+ .command('submit-clara <biosample_id> [fastq_r1] [fastq_r2]')
2536
+ .description('Submit Clara Parabricks GPU variant calling job (FASTQ → VCF)\nAuto-discovers FASTQ files from consent if not specified')
2537
+ .option('--job-id <id>', 'Custom job ID (default: auto-generated UUID)')
2538
+ .option('--reference <genome>', 'Reference genome (default: hg38)')
2539
+ .option('--capture-kit <kit>', 'Capture kit name (default: agilent_v8)')
2540
+ .option('--sequencing-type <type>', 'Sequencing type: WES or WGS (default: WES)')
2541
+ .option('--interval-file <path>', 'BED file path for targeted sequencing')
2542
+ .option('--json', 'Output as JSON')
2543
+ .action(async (biosampleId, fastqR1, fastqR2, options) => {
2544
+ try {
2545
+ await (0, submit_clara_1.submitClaraCommand)(biosampleId, fastqR1, fastqR2, options);
2546
+ }
2547
+ catch (error) {
2548
+ logger_1.Logger.error(`Clara job submission failed: ${error}`);
2549
+ process.exit(1);
2550
+ }
2551
+ });
2552
+ // job recall - Naive DeepVariant from pre-aligned BAM (no kit restriction)
2553
+ jobCmd
2554
+ .command('recall <sample_id>')
2555
+ .description('Run naive (no-kit) DeepVariant from a BAM already on the GPU VM')
2556
+ .requiredOption('--bam <vm_path>', 'BAM path on GPU VM (host path, e.g. /home/ubuntu/data/output/A014/A014.bam)')
2557
+ .option('--json', 'Output as JSON')
2558
+ .action(async (sampleId, options) => {
2559
+ try {
2560
+ await (0, recall_1.recallCommand)(sampleId, options);
2561
+ }
2562
+ catch (error) {
2563
+ logger_1.Logger.error(`Recall failed: ${error}`);
2564
+ process.exit(1);
2565
+ }
2566
+ });
2567
+ // job reconcile - Mark stale clara_jobs (processing/queued) as failed
2568
+ jobCmd
2569
+ .command('reconcile')
2570
+ .description('Mark stale clara_jobs (processing/queued past N hours) as failed — admin only. Required cleanup after GPU spot preemption before launching a fresh cohort-pipeline.')
2571
+ .option('--older-than <hours>', 'Threshold in hours (default 12)', '12')
2572
+ .option('--statuses <csv>', 'Comma-separated statuses to reconcile (default processing,queued)', 'processing,queued')
2573
+ .option('--json', 'Output as JSON')
2574
+ .action(async (options) => {
2575
+ try {
2576
+ await (0, reconcile_1.jobReconcileCommand)(options);
2577
+ }
2578
+ catch (error) {
2579
+ logger_1.Logger.error(`job reconcile failed: ${error}`);
2580
+ process.exit(1);
2581
+ }
2582
+ });
2583
+ // Agent Health - Check processing agent readiness
1278
2584
  program
1279
2585
  .command('agent-health')
1280
2586
  .alias('health')
@@ -1290,6 +2596,40 @@ program
1290
2596
  process.exit(1);
1291
2597
  }
1292
2598
  });
2599
+ // Researcher registration and identity (multi-provider social + MetaMask)
2600
+ const researcherCmd = program
2601
+ .command('researcher')
2602
+ .description('Researcher identity — register via ORCID, Google, LinkedIn, Twitter, Apple, or MetaMask');
2603
+ researcherCmd
2604
+ .command('register')
2605
+ .description('Register as a researcher (opens browser for social or MetaMask sign-in)')
2606
+ .option('--port <number>', 'Callback server port', parseInt)
2607
+ .option('--no-browser', "Don't auto-open browser (headless mode)")
2608
+ .option('--timeout <seconds>', 'Auth timeout in seconds', parseInt)
2609
+ .option('--provider <provider>', 'Force a specific provider (orcid, google, linkedin, twitter, apple, metamask)')
2610
+ .action(async (options) => {
2611
+ try {
2612
+ await (0, register_2.researcherRegisterCommand)(options);
2613
+ }
2614
+ catch (error) {
2615
+ logger_1.Logger.error(`Researcher registration failed: ${error}`);
2616
+ process.exit(1);
2617
+ }
2618
+ });
2619
+ researcherCmd
2620
+ .command('status')
2621
+ .description('Show your researcher profile and credentials')
2622
+ .option('--json', 'Output as JSON')
2623
+ .option('--refresh', 'Refresh profile from server')
2624
+ .action(async (options) => {
2625
+ try {
2626
+ await (0, status_9.researcherStatusCommand)(options);
2627
+ }
2628
+ catch (error) {
2629
+ logger_1.Logger.error(`Researcher status failed: ${error}`);
2630
+ process.exit(1);
2631
+ }
2632
+ });
1293
2633
  // Lab Registry - List approved research labs
1294
2634
  program
1295
2635
  .command('labnfts')
@@ -1308,6 +2648,47 @@ program
1308
2648
  process.exit(1);
1309
2649
  }
1310
2650
  });
2651
+ // Lab — single-lab operations (refresh-coverage, future: backfill, audit)
2652
+ // Distinct from the read-only `labnfts` (plural) registry-listing command above.
2653
+ const labCmd = program
2654
+ .command('lab')
2655
+ .description('Single-lab operations (refresh-coverage, audit, backfill)');
2656
+ labCmd
2657
+ .command('refresh-coverage')
2658
+ .description('Stream higher-coverage FASTQ replacements from a lab S3 origin into the GCS mirror, supersede stale inventory rows, optionally invalidate downstream pipeline outputs')
2659
+ .requiredOption('--lab <name>', 'Lab name (e.g. augenomics, tecbase)')
2660
+ .requiredOption('--source <s3_uri>', 'S3 source prefix (e.g. s3://genobank/Demux/20240412_ExomeGB_ExtraReadsCombined)')
2661
+ .option('--aws-profile <profile>', 'AWS profile name for the source bucket (server-side)', 'augenomics')
2662
+ .option('--serials <csv>', 'Comma-separated biosample serials to upgrade (with or without lab FR prefix)')
2663
+ .option('--serials-file <path>', 'Newline-separated serials file (alternative to --serials)')
2664
+ .option('--invalidate-downstream', 'Mark prior BAM/VCF/sqlite as SUPERSEDED so the pipeline re-runs with the deeper FASTQs')
2665
+ .option('--re-run-pipeline', 'After refresh, queue `biofs pipeline run-wes` for each upgraded serial')
2666
+ .option('--dry-run', 'Print plan + byte deltas, do not stream')
2667
+ .option('--wait', 'Poll until job terminal (done|failed); 90-min ceiling')
2668
+ .option('--quiet', 'Suppress progress output')
2669
+ .option('--json', 'JSON output')
2670
+ .action(async (options) => {
2671
+ try {
2672
+ await (0, refreshCoverage_1.labRefreshCoverageCommand)(options);
2673
+ }
2674
+ catch (error) {
2675
+ logger_1.Logger.error(`refresh-coverage failed: ${error}`);
2676
+ process.exit(1);
2677
+ }
2678
+ });
2679
+ labCmd
2680
+ .command('refresh-coverage-status <job_id>')
2681
+ .description('Show progress of a refresh-coverage job')
2682
+ .option('--json', 'JSON output')
2683
+ .action(async (jobId, options) => {
2684
+ try {
2685
+ await (0, refreshCoverage_1.labRefreshCoverageStatusCommand)(jobId, options);
2686
+ }
2687
+ catch (error) {
2688
+ logger_1.Logger.error(`status failed: ${error}`);
2689
+ process.exit(1);
2690
+ }
2691
+ });
1311
2692
  // Share - GDPR-compliant sharing with dual NFT minting
1312
2693
  program
1313
2694
  .command('share <biocid_or_filename>')
@@ -1356,6 +2737,590 @@ program
1356
2737
  process.exit(1);
1357
2738
  }
1358
2739
  });
2740
+ // RRM-consensus — pre-compute Cosic characteristic frequency f_c from a
2741
+ // gene's functional family for downstream f_c-based variant scoring.
2742
+ program
2743
+ .command('rrm-consensus <gene>')
2744
+ .description('Compute Cosic-RRM characteristic frequency f_c via cross-spectrum of a gene\'s functional family')
2745
+ .option('--source <family|orthologs>', 'Sequence source: Pfam family (default) or same-name orthologs', 'family')
2746
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
2747
+ .option('--no-reviewed', 'Include TrEMBL entries (default: Swiss-Prot reviewed only)')
2748
+ .option('--max <N>', 'Max sequences to pull (default 100)', '100')
2749
+ .option('--uniprot <acc>', 'Override UniProt accession (for novel genes)')
2750
+ .option('--pfam <id>', 'Override Pfam family (for novel genes)')
2751
+ .option('--refresh', 'Re-fetch and recompute even if cached')
2752
+ .option('--plot <path>', 'Render consensus spectrum to PNG with f_c annotated')
2753
+ .option('--quiet', 'Suppress progress output')
2754
+ .action(async (gene, options) => {
2755
+ try {
2756
+ await (0, rrm_consensus_1.rrmConsensusCommand)(gene, options);
2757
+ }
2758
+ catch (error) {
2759
+ logger_1.Logger.error(`RRM consensus failed: ${error}`);
2760
+ process.exit(1);
2761
+ }
2762
+ });
2763
+ // PSM-consensus — Piezoelectric Signal Model: same cross-spectrum maths as
2764
+ // rrm-consensus, but with side-chain dipole moment (Debye) replacing EIIP.
2765
+ // Tests the hypothesis that the piezoelectric encoding picks up
2766
+ // electromechanical resonances that the electron-donor EIIP table misses,
2767
+ // especially in ion channels, transporters, and force sensors.
2768
+ program
2769
+ .command('psm-consensus <gene>')
2770
+ .description('Piezoelectric Signal Model: characteristic frequency f_c via side-chain-dipole cross-spectrum')
2771
+ .option('--source <family|orthologs>', 'Sequence source: Pfam family (default) or same-name orthologs', 'family')
2772
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
2773
+ .option('--no-reviewed', 'Include TrEMBL entries (default: Swiss-Prot reviewed only)')
2774
+ .option('--max <N>', 'Max sequences to pull (default 100)', '100')
2775
+ .option('--uniprot <acc>', 'Override UniProt accession (for novel genes)')
2776
+ .option('--pfam <id>', 'Override Pfam family (for novel genes)')
2777
+ .option('--refresh', 'Re-fetch and recompute even if cached')
2778
+ .option('--plot <path>', 'Render PSM spectrum to PNG with f_c annotated')
2779
+ .option('--quiet', 'Suppress progress output')
2780
+ .action(async (gene, options) => {
2781
+ try {
2782
+ await (0, psm_consensus_1.psmConsensusCommand)(gene, options);
2783
+ }
2784
+ catch (error) {
2785
+ logger_1.Logger.error(`PSM consensus failed: ${error}`);
2786
+ process.exit(1);
2787
+ }
2788
+ });
2789
+ // Wavelet-consensus — 2-D (position by scale) Morlet CWT consensus map for a
2790
+ // gene's functional family. Spatial-spectral generalization of rrm-consensus.
2791
+ // Addresses the v1 paper auditor's third upgrade point: localize variants at
2792
+ // position and scale jointly rather than at a single fixed window size.
2793
+ program
2794
+ .command('wavelet-consensus <gene>')
2795
+ .description('Morlet continuous wavelet transform consensus map (position by scale) for a gene family')
2796
+ .option('--source <family|orthologs>', 'Sequence source (default orthologs)', 'orthologs')
2797
+ .option('--taxonomy <id>', 'NCBI taxonomy id', '7742')
2798
+ .option('--no-reviewed', 'Include TrEMBL (default Swiss-Prot only)')
2799
+ .option('--max <N>', 'Max sequences', '100')
2800
+ .option('--uniprot <acc>', 'Override UniProt accession')
2801
+ .option('--pfam <id>', 'Override Pfam family')
2802
+ .option('--encoding <eiip|piezo>', 'Per-residue index (default eiip)', 'eiip')
2803
+ .option('--scales <list>', 'Comma scales in aa (default 2,3,4,6,8,12,16,24,32,48,64,96)')
2804
+ .option('--refresh', 'Re-fetch + recompute')
2805
+ .option('--quiet', 'Suppress progress')
2806
+ .action(async (gene, options) => {
2807
+ try {
2808
+ await (0, wavelet_consensus_1.waveletConsensusCommand)(gene, options);
2809
+ }
2810
+ catch (error) {
2811
+ logger_1.Logger.error(`wavelet-consensus failed: ${error?.message || error}`);
2812
+ process.exit(1);
2813
+ }
2814
+ });
2815
+ // Score-protein — the Super-SCDS Phase A.2 canonical scoring verb. For one
2816
+ // UniProt accession, fetch FASTA, load cached RRM/PSM consensuses, compute
2817
+ // the SCDS family per missense variant, upsert into MongoDB collections
2818
+ // scds_consensuses + scds_variants via /api_scds/upsert_protein on prod.
2819
+ program
2820
+ .command('score-protein <uniprot>')
2821
+ .description('Super-SCDS Phase A.2: score one UniProt protein and upsert into scds_consensuses + scds_variants')
2822
+ .option('--gene-symbol <symbol>', 'Gene symbol (e.g., BRCA1) used as a fallback consensus-cache key')
2823
+ .option('--source <family|orthologs|trembl>', 'Family source for consensus (default: family)', 'family')
2824
+ .option('--taxonomy <id>', 'NCBI taxonomy id (default 7742 = Vertebrata)', '7742')
2825
+ .option('--pfam <id>', 'Override Pfam family')
2826
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
2827
+ .option('--dry-run', 'Compute and emit the payload, do not POST')
2828
+ .option('--skip-mongo-upsert', 'Compute the full payload but skip the API call (alias for --dry-run + no stdout)')
2829
+ .option('--output <path>', 'Write the payload to a JSON file')
2830
+ .option('--quiet', 'Suppress progress')
2831
+ .action(async (uniprot, options) => {
2832
+ try {
2833
+ await (0, score_protein_1.scoreProteinCommand)(uniprot, options);
2834
+ }
2835
+ catch (error) {
2836
+ logger_1.Logger.error(`score-protein failed: ${error?.message || error}`);
2837
+ process.exit(1);
2838
+ }
2839
+ });
2840
+ // Inventory subcommand: register-sqlite (closes v2 audit gap §5 item 2).
2841
+ program
2842
+ .command('inventory-register-sqlite <sqlite-path>')
2843
+ .description('Register an externally-produced OpenCRAVAT annotation sqlite into bioroutes.inventory (v3.8.0 endpoint)')
2844
+ .requiredOption('--sample-serial <serial>', 'Biosample serial identifier (14-digit or lab-case-id form)')
2845
+ .option('--owner-wallet <addr>', 'Override owner biowallet (default: from `biofs login`)')
2846
+ .option('--case-id <id>', 'Optional lab case identifier (e.g., TN25-336147)')
2847
+ .option('--gcs-uri <uri>', 'Optional GCS URI if the sqlite is also stored in GCS')
2848
+ .option('--originlab <name>', 'Source lab name (e.g., caris, augenomics, genobank)', 'genobank')
2849
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
2850
+ .option('--dry-run', 'Compute and print the registration payload without calling the API')
2851
+ .option('--output <path>', 'Write the registration payload to a JSON file')
2852
+ .option('--quiet', 'Suppress progress')
2853
+ .action(async (sqlitePath, options) => {
2854
+ try {
2855
+ await (0, inventory_register_sqlite_1.inventoryRegisterSqliteCommand)(sqlitePath, options);
2856
+ }
2857
+ catch (error) {
2858
+ logger_1.Logger.error(`inventory-register-sqlite failed: ${error?.message || error}`);
2859
+ process.exit(1);
2860
+ }
2861
+ });
2862
+ // Ingest rna-tpm — canonical wrapper for RNA TPM CSV ingestion (closes v2 audit
2863
+ // gap §5 item 4).
2864
+ program
2865
+ .command('ingest-rna-tpm <case-id>')
2866
+ .description('Ingest a gene-level RNA TPM CSV into the caris_rna_tpm MongoDB collection (v3.8.0 endpoint)')
2867
+ .option('--biocid <id>', 'BioRouter biocid pointing to the RNA TPM CSV')
2868
+ .option('--gcs-path <uri>', 'GCS URI of the RNA TPM CSV (if biocid is not yet registered)')
2869
+ .option('--owner-wallet <addr>', 'Override owner biowallet (default: from `biofs login`)')
2870
+ .option('--source-lab <name>', 'Source lab (e.g., caris, augenomics)', 'unknown')
2871
+ .option('--data-category <type>', 'Data category tag (default rna)', 'rna')
2872
+ .option('--expected-columns <list>', 'CSV column names', 'Gene,TPM,NumReads')
2873
+ .option('--no-drop-zero-tpm', 'Keep zero-TPM rows (default drops them)')
2874
+ .option('--api-base <url>', 'GenoBank API base (default https://genobank.app)')
2875
+ .option('--dry-run', 'Compute and print the ingest payload without calling the API')
2876
+ .option('--quiet', 'Suppress progress')
2877
+ .action(async (caseId, options) => {
2878
+ try {
2879
+ await (0, ingest_rna_tpm_1.ingestRnaTpmCommand)(caseId, options);
2880
+ }
2881
+ catch (error) {
2882
+ logger_1.Logger.error(`ingest-rna-tpm failed: ${error?.message || error}`);
2883
+ process.exit(1);
2884
+ }
2885
+ });
2886
+ // Tokenize-spectrum — emit LLM-friendly POS_NNNN__FREQ_F.FF__E_BINxx__P_BINxx
2887
+ // tokens from a cached wavelet consensus (v3.8.0 roadmap item P2). Designed
2888
+ // for autonomous-agent consumption on Claude / GPT / Llama. Reversibility via
2889
+ // regex r"POS_(\d+)" on any flagged token.
2890
+ program
2891
+ .command('tokenize-spectrum <gene>')
2892
+ .description('Emit LLM-friendly discrete spectral tokens for a gene with optional variant context')
2893
+ .option('--variant <hgvs>', 'Center the position window on this HGVS variant (e.g. p.Gly12Asp)')
2894
+ .option('--position-window <N>', 'Residues on each side of the variant', '10')
2895
+ .option('--encoding <eiip|piezo>', 'Primary encoding to load (both are included if cached)', 'eiip')
2896
+ .option('--vocab-bins <list>', 'Comma dB cutoffs for the BIN00-BIN06 vocabulary', '0,3,6,10,15,20')
2897
+ .option('--scale-binning <mode>', 'top5 (default), all, or characteristic', 'top5')
2898
+ .option('--format <type>', 'tokens (default plain string) or json', 'tokens')
2899
+ .option('--output <path>', 'Write to file instead of stdout')
2900
+ .option('--quiet', 'Suppress progress')
2901
+ .action(async (gene, options) => {
2902
+ try {
2903
+ await (0, tokenize_spectrum_1.tokenizeSpectrumCommand)(gene, options);
2904
+ }
2905
+ catch (error) {
2906
+ logger_1.Logger.error(`tokenize-spectrum failed: ${error?.message || error}`);
2907
+ process.exit(1);
2908
+ }
2909
+ });
2910
+ // Bode — render log-log |H(jω)| transfer function plots from cached rrm-consensus
2911
+ // and psm-consensus spectra. Single-gene mode (bode <gene>) or panel mode
2912
+ // (bode --panel <list>) for paper figures.
2913
+ program
2914
+ .command('bode [gene]')
2915
+ .description('Log-log Bode plot of protein-family transfer function |H(jω)| from rrm-consensus / psm-consensus caches')
2916
+ .option('--panel <list>', 'Comma gene symbols for multi-gene panel grid')
2917
+ .option('--output <path>', 'Output file path (default ~/.biofs/cache/bode/<gene-or-hash>.png)')
2918
+ .option('--pdf', 'Emit PDF instead of PNG')
2919
+ .option('--rna-tpm <case_id>', 'Pull Caris RNA TPM for the case_id and annotate each gene')
2920
+ .option('--api-base <url>', 'GenoBank API base for RNA TPM lookups (default https://genobank.app)')
2921
+ .option('--no-rrm', 'Suppress RRM (EIIP) curve')
2922
+ .option('--no-psm', 'Suppress PSM (piezo) curve')
2923
+ .option('--cols <N>', 'Panel grid column count (default 3)')
2924
+ .option('--quiet', 'Suppress progress (still prints output path)')
2925
+ .action(async (gene, options) => {
2926
+ try {
2927
+ await (0, bode_1.bodeCommand)(gene, options);
2928
+ }
2929
+ catch (error) {
2930
+ logger_1.Logger.error(`bode failed: ${error?.message || error}`);
2931
+ process.exit(1);
2932
+ }
2933
+ });
2934
+ // Biowallet — mint and manage de-novo EIP-55 custodial biowallets for patients
2935
+ const biowalletCmd = program
2936
+ .command('biowallet')
2937
+ .description('Mint and manage de-novo EIP-55 custodial biowallets that patients can later claim');
2938
+ biowalletCmd
2939
+ .command('create')
2940
+ .description('Mint a fresh EIP-55 biowallet (random keypair, BIP-39 mnemonic, encrypted keystore)')
2941
+ .option('--bind-biosample <serials>', 'Comma-separated biosample serials to bind to the new biowallet')
2942
+ .option('--label <text>', 'Human-readable label (stored locally only, not on-chain)')
2943
+ .option('--password <pw>', 'Keystore password; if omitted, a random one is generated and printed once')
2944
+ .option('--out-dir <path>', 'Alternative output directory (default ~/.biofs/biowallets/)')
2945
+ .option('--no-mnemonic-file', "Don't persist the mnemonic to disk (operator must transcribe at creation)")
2946
+ .option('--json', 'Output as JSON (DANGER: includes secrets)')
2947
+ .option('--quiet', 'Suppress progress output')
2948
+ .action(async (options) => {
2949
+ try {
2950
+ await (0, create_3.biowalletCreateCommand)(options);
2951
+ }
2952
+ catch (error) {
2953
+ logger_1.Logger.error(`Biowallet create failed: ${error}`);
2954
+ process.exit(1);
2955
+ }
2956
+ });
2957
+ biowalletCmd
2958
+ .command('list')
2959
+ .description('List all local biowallets and their bound biosamples')
2960
+ .option('--operator <wallet>', 'Filter by operator wallet address')
2961
+ .option('--status <s>', 'Filter by status (operator-custodial | patient-claimed)')
2962
+ .option('--biosample <serial>', 'Filter to wallets bound to a specific biosample')
2963
+ .option('--short', 'Print addresses only, one per line')
2964
+ .option('--json', 'Output as JSON')
2965
+ .action(async (options) => {
2966
+ try {
2967
+ await (0, list_6.biowalletListCommand)(options);
2968
+ }
2969
+ catch (error) {
2970
+ logger_1.Logger.error(`Biowallet list failed: ${error}`);
2971
+ process.exit(1);
2972
+ }
2973
+ });
2974
+ biowalletCmd
2975
+ .command('bind <address> <biosample>')
2976
+ .description('Bind an existing local biowallet to a biosample serial')
2977
+ .option('--json', 'Output as JSON')
2978
+ .option('--quiet', 'Suppress progress output')
2979
+ .action(async (address, biosample, options) => {
2980
+ try {
2981
+ await (0, bind_1.biowalletBindCommand)(address, biosample, options);
2982
+ }
2983
+ catch (error) {
2984
+ logger_1.Logger.error(`Biowallet bind failed: ${error}`);
2985
+ process.exit(1);
2986
+ }
2987
+ });
2988
+ // Family vault — BIP-32 HD wallet, one mnemonic deriving N child biowallets
2989
+ const familyCmd = biowalletCmd
2990
+ .command('family')
2991
+ .description('Family Vault: one BIP-32 master mnemonic deriving N child biowallets (m/44\'/60\'/0\'/0/index)');
2992
+ familyCmd
2993
+ .command('create')
2994
+ .description('Create a new family vault with optional initial members')
2995
+ .option('--label <text>', 'Human-readable label for the family')
2996
+ .option('--password <pw>', 'Keystore password (random if omitted)')
2997
+ .option('--members <list>', 'Comma-separated initial members in "role:biosample[:label]" format (e.g. mother:56102007614179,father:56102007614180,child:56102007614196,child:56102007614194)')
2998
+ .option('--no-mnemonic-file', "Don't persist the master mnemonic to disk")
2999
+ .option('--json', 'Output as JSON (DANGER: includes master mnemonic)')
3000
+ .option('--quiet', 'Suppress progress output')
3001
+ .action(async (options) => {
3002
+ try {
3003
+ await (0, family_1.familyCreateCommand)(options);
3004
+ }
3005
+ catch (error) {
3006
+ logger_1.Logger.error(`Family create failed: ${error}`);
3007
+ process.exit(1);
3008
+ }
3009
+ });
3010
+ familyCmd
3011
+ .command('derive <family_id> <index>')
3012
+ .description('Derive an additional member at a specific index in an existing family vault')
3013
+ .option('--role <text>', 'Role label (mother, father, child_1, etc.)')
3014
+ .option('--bind-biosample <serials>', 'Comma-separated biosample serials to bind')
3015
+ .option('--label <text>', 'Human-readable label')
3016
+ .option('--json', 'Output as JSON')
3017
+ .option('--quiet', 'Suppress progress output')
3018
+ .action(async (familyId, index, options) => {
3019
+ try {
3020
+ await (0, family_1.familyDeriveCommand)(familyId, index, options);
3021
+ }
3022
+ catch (error) {
3023
+ logger_1.Logger.error(`Family derive failed: ${error}`);
3024
+ process.exit(1);
3025
+ }
3026
+ });
3027
+ familyCmd
3028
+ .command('list [family_id]')
3029
+ .description('List family vaults (and members if a family_id is given)')
3030
+ .option('--json', 'Output as JSON')
3031
+ .action(async (familyId, options) => {
3032
+ try {
3033
+ await (0, family_1.familyListCommand)(familyId, options);
3034
+ }
3035
+ catch (error) {
3036
+ logger_1.Logger.error(`Family list failed: ${error}`);
3037
+ process.exit(1);
3038
+ }
3039
+ });
3040
+ // RRM-distribution — pull ClinVar classified missense for a gene and rank
3041
+ // patient variants against the empirical distribution.
3042
+ program
3043
+ .command('rrm-distribution <gene>')
3044
+ .description('Pull ClinVar classified missense for a gene and compute Cosic-RRM features for each, with optional patient-variant highlight and optional gnomAD pseudo-benign synthesis')
3045
+ .option('--highlight <variants>', 'Comma-separated HGVS protein changes to mark on the distribution (e.g. ITGA2B:p.Val779Ala,ITGA2B:p.Leu225Arg)')
3046
+ .option('--retmax <N>', 'Max ClinVar IDs to pull (default 10000; ClinVar VUS / Conflicting are excluded server-side)', '10000')
3047
+ .option('--gnomad-benigns <N>', 'Synthesize N pseudo-benign control variants from gnomAD common missense (e.g. 40 for rare-disease genes whose ClinVar B+LB is empty)')
3048
+ .option('--gnomad-min-af <af>', 'gnomAD AF threshold for pseudo-benign eligibility (default 0.01)', '0.01')
3049
+ .option('--plot <path>', 'Render 4-panel distribution figure to PNG')
3050
+ .option('--refresh', 'Re-fetch and recompute even if cached')
3051
+ .option('--quiet', 'Suppress progress output')
3052
+ .action(async (gene, options) => {
3053
+ try {
3054
+ await (0, rrm_distribution_1.rrmDistributionCommand)(gene, options);
3055
+ }
3056
+ catch (error) {
3057
+ logger_1.Logger.error(`RRM distribution failed: ${error}`);
3058
+ process.exit(1);
3059
+ }
3060
+ });
3061
+ // Clinical — phenotype-driven multi-exome ACMG classifier for a single proband
3062
+ // (n-of-1 or joint-N exomes from the same individual). Complements `cohort-acmg`
3063
+ // which is batch-mode across many probands but only emits ClinVar P/LP.
3064
+ program
3065
+ .command('clinical <biosample_serial>')
3066
+ .description('Phenotype-driven, multi-exome ACMG/AMP 2015 + ClinGen-SVI 2024 classifier. Provide a primary biosample serial, optional --serials list (joint-N exomes), and phenotype context (--phenotype words OR --hpo codes; --photo optional). Returns P/LP/VUS/LB/B with per-variant evidence stacks. Server-side, NFT-gated, no genomic bytes on laptop.')
3067
+ .option('--serials <list>', 'Comma-separated additional biosample serials for joint analysis (all assumed same individual)')
3068
+ .option('--hpo <codes>', 'Comma-separated HPO codes, e.g. HP:0000924,HP:0002659')
3069
+ .option('--phenotype <text>', 'Free-text phenotype description (mapped to HPO via local HPOA annotations)')
3070
+ .option('--photo <path>', 'Patient photo for Face2Gene-style syndrome prediction (graceful fallback if server lacks API key)')
3071
+ .option('--panel <name>', 'Gene panel name: skeletal_dysplasia (default), or none for HPO-only', 'skeletal_dysplasia')
3072
+ .option('--max-af <af>', 'gnomAD AF ceiling (default 0.01)', '0.01')
3073
+ .option('--output <dir>', 'Output directory (default ./clinical_reports/)')
3074
+ .option('--case-label <label>', 'Privacy-safe label for the case (no proper names per CLAUDE.md). Default proband-<wallet-prefix>.')
3075
+ .option('--format <fmt>', 'json | html | both (default both)', 'both')
3076
+ .option('--quiet', 'Suppress progress output')
3077
+ .option('--debug', 'Print full server response on error')
3078
+ .action(async (biosample, options) => {
3079
+ try {
3080
+ await (0, clinical_1.clinicalCommand)(biosample, options);
3081
+ }
3082
+ catch (error) {
3083
+ logger_1.Logger.error(`clinical failed: ${error}`);
3084
+ process.exit(1);
3085
+ }
3086
+ });
3087
+ // Cohort-pipeline — batch FASTQ→VCF→sqlite→fhir.variant→Digital-Twin via
3088
+ // the canonical biofs-cli + biofs-node + BioRouter + Sequentia protocol.
3089
+ // Each per-serial run is `biofs pipeline run-wes <serial>`; this verb just
3090
+ // fans them out with concurrency control + auto-mints custodial biowallets.
3091
+ program
3092
+ .command('cohort-pipeline')
3093
+ .description('Batch end-to-end pipeline (FASTQ → Clara → CRAVAT → Vault → Digital Twin) across a cohort of biosample serials. Internally fans out `biofs pipeline run-wes <serial>`; auto-mints custodial biowallets for unbound serials via `biofs biowallet create --bind-biosample`. Resume-aware (skips serials already PHASE_RANGE_DONE in bioroutes.pipeline_runs).')
3094
+ .requiredOption('--serials <file>', 'File with one biosample serial per line. Use `biofs inventory cohort` to generate.')
3095
+ .option('--concurrency <N>', 'Number of parallel per-serial pipelines (default 1; max 2 for 2× A100 GPU)', '1')
3096
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3097
+ .option('--output <dir>', 'Output directory for per-serial result JSONs + cohort summary (default ./cohort_pipeline_runs/<timestamp>/)')
3098
+ .option('--no-skip-existing', 'Re-run serials even if they already have a PHASE_RANGE_DONE pipeline_run')
3099
+ .option('--no-auto-mint-wallets', 'Skip the biowallet pre-mint step (assumes wallets already bound)')
3100
+ .option('--mode <WES|WGS>', 'Override auto-detection of WES vs WGS for the whole cohort')
3101
+ .option('--phase <range>', 'Run a subset of phases per serial (e.g. "1-4", "5-10", "all")')
3102
+ .option('--exclude <csv>', 'Comma-separated serials to skip (e.g. operator\'s own genome, already-ingested samples)')
3103
+ .option('--stop-on-failure <mode>', 'When to halt cohort: "first" (default), "never", or integer N for N consecutive failures', 'first')
3104
+ .option('--dry-run', 'Print what would happen but don\'t execute side-effecting phases')
3105
+ .option('--quiet', 'Suppress per-serial progress')
3106
+ .option('--json', 'Emit machine-readable JSON summary')
3107
+ .action(async (options) => {
3108
+ try {
3109
+ await (0, cohort_pipeline_1.cohortPipelineCommand)(options);
3110
+ }
3111
+ catch (error) {
3112
+ logger_1.Logger.error(`cohort-pipeline failed: ${error}`);
3113
+ process.exit(1);
3114
+ }
3115
+ });
3116
+ // Cohort-acmg — batch ACMG/SVI-compliant processor for an n-of-many cohort
3117
+ program
3118
+ .command('cohort-acmg')
3119
+ .description('Batch process a cohort of biosample serials: mint biowallets (idempotent), extract ClinVar P+LP, apply ACMG-SVI evidence stacks per Section 2.7 of the biofs-rrm paper. Output keyed on biowallet (operator-private serial mapping preserved).')
3120
+ .option('--serials <file>', 'File with one biosample serial per line (required)')
3121
+ .option('--output <dir>', 'Output directory for per-biowallet JSON reports (default ./cohort_acmg_reports/)')
3122
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3123
+ .option('--skip-existing', 'Skip serials whose per-biowallet report already exists')
3124
+ .option('--quiet', 'Suppress per-proband progress spinners')
3125
+ .action(async (options) => {
3126
+ try {
3127
+ await (0, cohort_acmg_1.cohortAcmgCommand)(options);
3128
+ }
3129
+ catch (error) {
3130
+ logger_1.Logger.error(`cohort-acmg failed: ${error}`);
3131
+ process.exit(1);
3132
+ }
3133
+ });
3134
+ // Cohort-fourier-score — per-patient × per-variant Cosic-RRM spectral scoring,
3135
+ // the missing rung between single-variant `biofs fourier-score` and the
3136
+ // per-gene ClinVar `biofs cohort-train`. Section 14.4 of the biofs-rrm paper
3137
+ // proposes this verb explicitly. Server-side, NFT-gated, gcsfuse-mounted.
3138
+ program
3139
+ .command('cohort-fourier-score')
3140
+ .description('Cohort-scale Cosic-RRM (EIIP + DFT) spectral scoring: for each biosample serial, extract rare missense variants, compute the five Cosic metrics (windowed Σ|ΔF|, windowed ΔE%, full-spectrum L1, f_c ratio, weighted aggregate ΔE%) against the cached family characteristic frequency, return per-biowallet score matrices. Server-side, NFT-gated, zero genomic bytes on laptop.')
3141
+ .option('--serials <file>', 'File with one biosample serial per line (mutually exclusive with --from-acmg)')
3142
+ .option('--from-acmg <path>', 'Recover serials from a prior `biofs cohort-acmg` cohort_summary.json via the operator-private biowallet index (recommended path)')
3143
+ .option('--output <dir>', 'Output directory for per-biowallet JSON reports (default ./cohort_fourier_reports/)')
3144
+ .option('--limit <N>', 'Process at most N serials (0 = all)', '0')
3145
+ .option('--max-af <af>', 'gnomAD AF ceiling for rare-missense filter (default 0.01)', '0.01')
3146
+ .option('--am-threshold <s>', 'AlphaMissense threshold for the --include-high-am rule (default 0.5)', '0.5')
3147
+ .option('--include-vus', 'Also score ClinVar VUS variants (otherwise ClinVar P/LP only)')
3148
+ .option('--include-high-am', 'Also score variants with AlphaMissense ≥ --am-threshold even if absent from ClinVar')
3149
+ .option('--window <N>', 'Window size (residues) for the centered Σ|ΔF| (default 31)')
3150
+ .option('--window-tm <N>', 'Window size for variants in transmembrane regions (default 51)')
3151
+ .option('--skip-existing', 'Skip serials whose per-biowallet report already exists')
3152
+ .option('--quiet', 'Suppress per-proband progress spinners')
3153
+ .action(async (options) => {
3154
+ try {
3155
+ await (0, cohort_fourier_score_1.cohortFourierScoreCommand)(options);
3156
+ }
3157
+ catch (error) {
3158
+ logger_1.Logger.error(`cohort-fourier-score failed: ${error}`);
3159
+ process.exit(1);
3160
+ }
3161
+ });
3162
+ // MyVariant — standalone interface to MyVariant.info v1 API
3163
+ program
3164
+ .command('myvariant [id_or_query]')
3165
+ .description('Query MyVariant.info v1: single variant, batch from file, gene-wide, or raw /query expression')
3166
+ .option('--batch <file>', 'Batch lookup from a file with one ID (HGVS or rsID) per line')
3167
+ .option('--gene <symbol>', 'Fetch variants in a gene via /query (uses dbnsfp/clinvar/snpeff gene_name)')
3168
+ .option('--query', 'Treat the positional argument as a raw /query expression')
3169
+ .option('--fields <list>', 'Comma-separated MyVariant.info field paths (overrides presets)')
3170
+ .option('--predictors', 'Shortcut for AM/REVEL/PrimateAI/EVE/ESM1b/CADD/MetaRNN/BayesDel/ClinPred')
3171
+ .option('--clinical', 'Shortcut for ClinVar/COSMIC/gnomAD/1000G/ExAC/EMV')
3172
+ .option('--basic', 'Shortcut for dbSNP rsID/HGVS/VCF/SnpEff annotations')
3173
+ .option('--all', 'Predictors + clinical + basic')
3174
+ .option('--assembly <hg19|hg38>', 'Assembly for HGVS-coordinate queries (informational)', 'hg38')
3175
+ .option('--limit <N>', 'Max records for /gene or /query mode (default 500 gene, 200 query)')
3176
+ .option('--json', 'Output raw JSON')
3177
+ .option('--csv', 'Output as CSV')
3178
+ .option('--tsv', 'Output as TSV')
3179
+ .option('--out-file <path>', 'Write output to file instead of stdout')
3180
+ .option('--quiet', 'Suppress progress spinner')
3181
+ .action(async (idArg, options) => {
3182
+ try {
3183
+ await (0, myvariant_1.myvariantCommand)(idArg, options);
3184
+ }
3185
+ catch (error) {
3186
+ logger_1.Logger.error(`MyVariant query failed: ${error}`);
3187
+ process.exit(1);
3188
+ }
3189
+ });
3190
+ // Cohort-train — apply the rrm-consensus + rrm-distribution + rrm-train pipeline
3191
+ // across a cohort of disease genes to characterize Cosic-RRM's applicability domain
3192
+ program
3193
+ .command('cohort-train')
3194
+ .description('Multi-gene benchmark: run rrm-consensus + rrm-distribution + rrm-train across a cohort and report per-gene AUC deltas')
3195
+ .option('--genes <list>', 'Comma-separated gene symbols')
3196
+ .option('--gene-file <path>', 'File with one gene symbol per line (lines starting with # are comments)')
3197
+ .option('--min-train <N>', 'Skip genes with fewer than N labeled training variants (default 8)', '8')
3198
+ .option('--ortholog-source <s>', 'rrm-consensus --source value (default "orthologs")', 'orthologs')
3199
+ .option('--refresh-consensus', 'Re-fetch UniProt orthologs and recompute consensus even if cached')
3200
+ .option('--refresh-distribution', 'Re-fetch ClinVar variants and recompute distribution even if cached')
3201
+ .option('--gnomad-benigns <N>', 'Synthesize N pseudo-benign control variants per gene from gnomAD common missense (unlocks AUC benchmarking on rare-disease genes whose ClinVar B+LB is empty)')
3202
+ .option('--gnomad-min-af <af>', 'gnomAD AF threshold for pseudo-benign eligibility (default 0.01)', '0.01')
3203
+ .option('--output <path>', 'JSON manifest output path (default ~/.biofs/cache/rrm/cohort_<hash>.json)')
3204
+ .option('--plot <path>', 'Render 3-panel cohort benchmark figure to PNG')
3205
+ .option('--quiet', 'Suppress per-gene progress output')
3206
+ .action(async (options) => {
3207
+ try {
3208
+ await (0, cohort_train_1.cohortTrainCommand)(options);
3209
+ }
3210
+ catch (error) {
3211
+ logger_1.Logger.error(`Cohort training failed: ${error}`);
3212
+ process.exit(1);
3213
+ }
3214
+ });
3215
+ // RRM-train — XGBoost ensemble combining Cosic-RRM with deep-learning predictors
3216
+ program
3217
+ .command('rrm-train <gene>')
3218
+ .description('Train XGBoost ensemble combining Cosic-RRM features with AlphaMissense/REVEL/PrimateAI for variant pathogenicity prediction')
3219
+ .option('--predict <variants>', 'Comma-separated HGVS protein changes to predict (e.g. ITGA2B:p.Val779Ala,ITGA2B:p.Leu225Arg)')
3220
+ .option('--folds <N>', 'Stratified CV folds (default 5)', '5')
3221
+ .option('--plot <path>', 'Render ROC curves + feature importance to PNG')
3222
+ .option('--refresh', 'Re-fetch MyVariant.info scores even if cached')
3223
+ .option('--include-predictions', 'Persist per-variant CV predictions for downstream stacking analysis')
3224
+ .option('--quiet', 'Suppress progress output')
3225
+ .action(async (gene, options) => {
3226
+ try {
3227
+ await (0, rrm_train_1.rrmTrainCommand)(gene, options);
3228
+ }
3229
+ catch (error) {
3230
+ logger_1.Logger.error(`RRM training failed: ${error}`);
3231
+ process.exit(1);
3232
+ }
3233
+ });
3234
+ // Fourier-score — Cosic RRM EIIP+DFT biophysical scoring of missense variants
3235
+ program
3236
+ .command('fourier-score <variants>')
3237
+ .description('Cosic-RRM EIIP+DFT biophysical scoring of missense variants (returns Σ|ΔF|, max|ΔF| as biophysical complement to REVEL/AlphaMissense)')
3238
+ .option('--window <N>', 'Window size for non-TM residues (default: 31, must be odd)')
3239
+ .option('--window-tm <N>', 'Window size for TM-residue variants (default: 51, must be odd)')
3240
+ .option('--uniprot <accession>', 'Override UniProt accession (for single variant or unknown gene)')
3241
+ .option('--format <type>', 'Output format: table | tsv | json (default: table)', 'table')
3242
+ .option('--output <path>', 'Write output to file instead of stdout')
3243
+ .option('--plot <path>', 'Render |ΔF| windowed spectrum to PNG (one panel per variant)')
3244
+ .option('--consensus-fc', 'Also score full-protein DFT at family characteristic frequency f_c (requires `biofs rrm-consensus <gene>` first)')
3245
+ .option('--plot-full <path>', 'Render full-protein |X(k)| spectrum to PNG with f_c annotated (requires --consensus-fc)')
3246
+ .option('--quiet', 'Suppress progress output')
3247
+ .action(async (variants, options) => {
3248
+ try {
3249
+ await (0, fourier_score_1.fourierScoreCommand)(variants, options);
3250
+ }
3251
+ catch (error) {
3252
+ logger_1.Logger.error(`Fourier scoring failed: ${error}`);
3253
+ process.exit(1);
3254
+ }
3255
+ });
3256
+ // Query — the consented query surface over QUERYABLE biodata (Phase-1 flagship).
3257
+ // Run a read-only SELECT server-side against an NFT-gated OpenCRAVAT sqlite,
3258
+ // addressed by biocid or biosample. Opaque biodata (FASTQ/BAM) is NOT queryable
3259
+ // and is served by `biofs mount`/`stream` instead.
3260
+ program
3261
+ .command('erase [biosample]')
3262
+ .description('GDPR Art.17 erasure — destroy a biosample\'s bytes, registry rows and derived copies (DRY RUN by default)')
3263
+ .option('--execute', 'Actually perform the erasure (irreversible; prompts for confirmation)')
3264
+ .option('--resume <erasure_id>', 'Resume an interrupted erasure saga')
3265
+ .option('--yes', 'Skip the interactive confirmation prompt (use with care)')
3266
+ .option('--json', 'JSON output for the dry-run plan')
3267
+ .action(async (biosample, options) => {
3268
+ try {
3269
+ await (0, erase_1.eraseCommand)(biosample, options);
3270
+ }
3271
+ catch (error) {
3272
+ logger_1.Logger.error(`Erase failed: ${error}`);
3273
+ process.exit(1);
3274
+ }
3275
+ });
3276
+ program
3277
+ .command('query <target> [sql]')
3278
+ .description('Consent-gated read-only SQL over a queryable-biodata sqlite (biocid or biosample); the sqlite never leaves prod, only rows transit')
3279
+ .option('--schema', 'List the tables in the annotated sqlite instead of running a query')
3280
+ .option('--format <type>', 'Output format: table | tsv | csv | json (default: table)', 'table')
3281
+ .option('--output <path>', 'Write output to a file instead of stdout')
3282
+ .option('--row-cap <n>', 'Cap rows returned by the server (default 10000, max 100000)')
3283
+ .option('--timeout-ms <n>', 'Server-side query time budget in ms (default 30000)')
3284
+ .option('--job-id <timestamp>', 'Pick a specific OC job timestamp when multiple sqlites exist')
3285
+ .option('--async', 'Run as a background job (submit-then-poll) for heavy full-table scans that exceed the 60s sync limit')
3286
+ .option('--quiet', 'Suppress progress output')
3287
+ .action(async (target, sql, options) => {
3288
+ try {
3289
+ await (0, query_1.queryCommand)(target, sql, options);
3290
+ }
3291
+ catch (error) {
3292
+ logger_1.Logger.error(`Query failed: ${error}`);
3293
+ process.exit(1);
3294
+ }
3295
+ });
3296
+ // Variants — query annotated variants from the latest OpenCRAVAT sqlite
3297
+ program
3298
+ .command('variants <biosample_serial>')
3299
+ .description('Query annotated variants from the latest OpenCRAVAT sqlite for a biosample (gene/region/SO/AF/ClinVar filters)')
3300
+ .option('--gene <symbols>', 'Comma-separated HUGO gene symbols (e.g. ITGA2B,ITGB3)')
3301
+ .option('--region <chr:start-end>', 'Genomic region (e.g. chr17:44372210-44511666)')
3302
+ .option('--so <terms>', 'Sequence-ontology terms or "all" (default: missense+LoF+canonical splice)')
3303
+ .option('--max-af <number>', 'Population AF cap across gnomAD3/4 + AllOfUs (default: 0.01)')
3304
+ .option('--clinvar <class>', 'ClinVar significance filter: patho|likely|vus|benign|all (default: all)')
3305
+ .option('--columns <names>', 'Comma-separated annotator columns to display (default panel)')
3306
+ .option('--format <type>', 'Output format: table | tsv | json (default: table)', 'table')
3307
+ .option('--output <path>', 'Write output to file instead of stdout')
3308
+ .option('--refresh', 'No-op (kept for back-compat; variants now runs server-side, no local cache)')
3309
+ .option('--sqlite-uri <gsuri>', 'Deprecated: no longer supported (server-side runs against bioroutes inventory only)')
3310
+ .option('--job-id <timestamp>', 'Pick a specific OC job timestamp (e.g. 260411-053533) when multiple sqlites exist')
3311
+ .option('--with-acmg', 'Attach ACMG-SVI evidence stack per Section 2.7 to each row (single-tool PP3 + PVS1 + PM2)')
3312
+ .option('--limit <n>', 'Cap rows returned by the server (handy for fast probes of a large sqlite)')
3313
+ .option('--quiet', 'Suppress progress output')
3314
+ .option('--debug', 'Show server resolution debug info')
3315
+ .action(async (biosampleSerial, options) => {
3316
+ try {
3317
+ await (0, variants_1.variantsCommand)(biosampleSerial, options);
3318
+ }
3319
+ catch (error) {
3320
+ logger_1.Logger.error(`Variant query failed: ${error}`);
3321
+ process.exit(1);
3322
+ }
3323
+ });
1359
3324
  // Resolve - BioRoutes on-chain route resolution (Phase G.2)
1360
3325
  program
1361
3326
  .command('resolve <biocid_or_fingerprint>')
@@ -1456,6 +3421,67 @@ program
1456
3421
  process.exit(1);
1457
3422
  }
1458
3423
  });
3424
+ // Pipeline command group — end-to-end FASTQ → Digital Twin orchestration
3425
+ const pipelineCmd = program
3426
+ .command('pipeline')
3427
+ .description('End-to-end agentic pipeline (FASTQ → Clara → CRAVAT → Vault → Digital Twin)');
3428
+ pipelineCmd
3429
+ .command('run-wes <biosample_serial>')
3430
+ .description('Run the full WES/WGS pipeline on a biosample, producing a Digital Twin URL')
3431
+ .option('--mode <WES|WGS>', 'Override auto-detection (WES or WGS)')
3432
+ .option('--bed <path>', 'Override interval BED path (forces WES)')
3433
+ .option('--phase <range>', 'Run a subset of phases (e.g. "1-4", "5-10", or "all")')
3434
+ .option('--run-id <id>', 'Resume an existing pipeline run by id')
3435
+ .option('--watch', 'Stream Parabricks pipeline log live')
3436
+ .option('--dry-run', 'Print what would happen but don\'t execute side-effecting phases')
3437
+ .option('--skip-twin', 'Skip phase 9 (Digital Twin HTML render)')
3438
+ .option('--remote', 'Force SSH-to-prod execution even if local orchestrator exists')
3439
+ .option('--mongo-uri <uri>', 'MongoDB connection string (default: localhost:27017 on the executor)')
3440
+ .option('--json', 'Emit raw JSON-line events instead of pretty output')
3441
+ .action(async (biosampleSerial, options) => {
3442
+ try {
3443
+ const rc = await (0, runWes_1.pipelineRunWesCommand)(biosampleSerial, options);
3444
+ process.exit(rc);
3445
+ }
3446
+ catch (error) {
3447
+ logger_1.Logger.error(`pipeline run-wes failed: ${error}`);
3448
+ process.exit(1);
3449
+ }
3450
+ });
3451
+ // BioRouter route resolver — diagnose and heal gcsfuse mounts on compute nodes
3452
+ const routeCmd = program
3453
+ .command('route')
3454
+ .description('BioRouter route resolver — lint & heal gcsfuse mounts for biosamples');
3455
+ routeCmd
3456
+ .command('check <biosample_serial...>')
3457
+ .description('Resolve every route for the given biosample(s) and report mount status')
3458
+ .option('--json', 'Emit raw JSON output instead of pretty table')
3459
+ .action(async (serials, options) => {
3460
+ await (0, route_1.routeCheckCommand)(serials, options);
3461
+ });
3462
+ routeCmd
3463
+ .command('heal <biosample_serial...>')
3464
+ .description('Mount every bucket required by the biosamples on a compute node')
3465
+ .option('--node <user@host>', 'Target node (default: parabricks-gpu-spot@10.128.0.7)')
3466
+ .option('--json', 'Emit raw JSON output')
3467
+ .action(async (serials, options) => {
3468
+ await (0, route_1.routeHealCommand)(serials, options);
3469
+ });
3470
+ routeCmd
3471
+ .command('anchor')
3472
+ .description('Instantiate pending bioroutes.inventory rows on Sequentia (BioRoutes registerRoute). Default scope: John.')
3473
+ .option('--wallet <address>', 'Owner wallet to anchor (default: John 0x88110B7e…). Admin only for other wallets.')
3474
+ .option('--serial <serial>', 'Biosample serial / fingerprint scope')
3475
+ .option('--all', 'Anchor every pending row across all wallets (admin)')
3476
+ .option('--writes <csv>', 'On-chain writes: route[,bioasset]', 'route')
3477
+ .option('--filetypes <csv>', 'Limit to these filetypes (e.g. vcf,bam)')
3478
+ .option('--batch <n>', 'Rows registered per request (1-100)', '25')
3479
+ .option('--limit <n>', 'Cap total rows this run (0 = no cap)')
3480
+ .option('--dry-run', 'Preview eligible rows; no chain writes')
3481
+ .option('--json', 'Emit raw JSON output')
3482
+ .action(async (options) => {
3483
+ await (0, anchor_1.routeAnchorCommand)(options);
3484
+ });
1459
3485
  // Help command
1460
3486
  program
1461
3487
  .command('help [command]')
@@ -1474,11 +3500,58 @@ program
1474
3500
  program.outputHelp();
1475
3501
  }
1476
3502
  });
3503
+ // FLUENCY_LINEAGE_VERBS_20260730: make a genomics store AI-conversable, and report the metamorphosis.
3504
+ // Registered with the other groups, BEFORE the welcome banner and program.parse().
3505
+ const fluencyCmd = program
3506
+ .command('fluency')
3507
+ .description('Make a genomics store AI-conversable: precompute per-contig coverage + per-gene rollups (dispatched through biofs-node)');
3508
+ fluencyCmd
3509
+ .command('build <biocid>')
3510
+ .description('Build (or adopt) the fluency artifact. Idempotent; the derivative is registered to the data owner with parent lineage')
3511
+ .option('--json', 'Emit JSON')
3512
+ .option('--quiet', 'Suppress progress')
3513
+ .action(async (biocid, options) => {
3514
+ try {
3515
+ await (0, fluency_1.fluencyBuildCommand)(biocid, options);
3516
+ }
3517
+ catch (error) {
3518
+ logger_1.Logger.error(`fluency build failed: ${error}`);
3519
+ process.exit(1);
3520
+ }
3521
+ });
3522
+ fluencyCmd
3523
+ .command('state <biocid>')
3524
+ .description('Report whether a store is fluent (fresh / building / absent) and what it covers')
3525
+ .option('--json', 'Emit JSON')
3526
+ .option('--quiet', 'Suppress progress')
3527
+ .action(async (biocid, options) => {
3528
+ try {
3529
+ await (0, fluency_1.fluencyStateCommand)(biocid, options);
3530
+ }
3531
+ catch (error) {
3532
+ logger_1.Logger.error(`fluency state failed: ${error}`);
3533
+ process.exit(1);
3534
+ }
3535
+ });
3536
+ program
3537
+ .command('lineage <biocid>')
3538
+ .description('Report the biodata metamorphosis: what this was derived from, what came from it, who owns each piece, and what erases with what')
3539
+ .option('--json', 'Emit JSON')
3540
+ .option('--quiet', 'Suppress progress')
3541
+ .action(async (biocid, options) => {
3542
+ try {
3543
+ await (0, lineage_1.lineageCommand)(biocid, options);
3544
+ }
3545
+ catch (error) {
3546
+ logger_1.Logger.error(`lineage failed: ${error}`);
3547
+ process.exit(1);
3548
+ }
3549
+ });
1477
3550
  // Show welcome message if no command
1478
3551
  if (process.argv.length === 2) {
1479
3552
  console.log(chalk_1.default.cyan('\n╔═════════════════════════════════════════════╗'));
1480
- console.log(chalk_1.default.cyan('║ BioFS CLI v2.4.0 ║'));
1481
- console.log(chalk_1.default.cyan('║ BioNFT-Gated S3 + x402 Pay + Kite AI ║'));
3553
+ console.log(chalk_1.default.cyan('║ BioFS CLI v3.2.0 ║'));
3554
+ console.log(chalk_1.default.cyan('║ BioNFT-Gated Genomics + Researcher ID ║'));
1482
3555
  console.log(chalk_1.default.cyan('╚═════════════════════════════════════════════╝\n'));
1483
3556
  console.log('Available commands:');
1484
3557
  console.log(` ${chalk_1.default.green('login')} - Authenticate with Web3 wallet`);
@@ -1489,9 +3562,12 @@ if (process.argv.length === 2) {
1489
3562
  console.log(` ${chalk_1.default.green('biofiles')} - List your BioFiles (all sources)`);
1490
3563
  console.log(` ${chalk_1.default.green('download')} - Download files (GDPR consent)`);
1491
3564
  console.log(` ${chalk_1.default.green('mount')} - Mount all files (GDPR consent)`);
3565
+ console.log(` ${chalk_1.default.green('fluency')} - Make a store AI-conversable (coverage + per-gene rollups)`);
3566
+ console.log(` ${chalk_1.default.green('lineage')} - Biodata metamorphosis: parents, derivatives, owners`);
1492
3567
  console.log(` ${chalk_1.default.green('mount-remote')} - Mount biosample on agent`);
1493
3568
  console.log(` ${chalk_1.default.green('upload')} - Upload files`);
1494
3569
  console.log(` ${chalk_1.default.green('tokenize')} - Tokenize genomic data as BioNFT`);
3570
+ console.log(` ${chalk_1.default.green('researcher')} - Register & manage researcher identity`);
1495
3571
  console.log(` ${chalk_1.default.green('labnfts')} - List approved research labs`);
1496
3572
  console.log(` ${chalk_1.default.green('share')} - Share with lab (dual NFT)`);
1497
3573
  console.log(` ${chalk_1.default.green('shares')} - View permission graph`);
@@ -1518,6 +3594,9 @@ if (process.argv.length === 2) {
1518
3594
  console.log(` ${chalk_1.default.cyan('payment setup')} - Configure payment wallet`);
1519
3595
  console.log(` ${chalk_1.default.cyan('payment faucet')} - Get testnet tokens`);
1520
3596
  console.log(` ${chalk_1.default.cyan('payment history')} - View transaction history\n`);
3597
+ console.log('Researcher subcommands:');
3598
+ console.log(` ${chalk_1.default.cyan('researcher register')} - Register via ORCID, Google, LinkedIn, MetaMask, etc.`);
3599
+ console.log(` ${chalk_1.default.cyan('researcher status')} - View your researcher profile\n`);
1521
3600
  console.log('Kite AI Agent subcommands:');
1522
3601
  console.log(` ${chalk_1.default.cyan('agent register')} --all - Register BioFS agents on Kite`);
1523
3602
  console.log(` ${chalk_1.default.cyan('agent list')} - List registered agents`);
@@ -1541,11 +3620,10 @@ else {
1541
3620
  // Parse command line arguments
1542
3621
  program.parse(process.argv);
1543
3622
  }
1544
- // Handle uncaught errors
1545
- process.on('unhandledRejection', (error) => {
1546
- logger_1.Logger.error(`Unexpected error: ${error}`);
1547
- process.exit(1);
1548
- });
3623
+ // Note: the authoritative unhandledRejection/uncaughtException handlers are
3624
+ // registered once near the top of this file (they route through reportAndExit
3625
+ // for a crash report). A second unhandledRejection listener here would also fire
3626
+ // and could process.exit(1) before that async report is sent, so it was removed.
1549
3627
  process.on('SIGINT', () => {
1550
3628
  console.log('\n\nInterrupted. Goodbye!');
1551
3629
  process.exit(0);