@genobank/biofs 3.0.0 → 3.0.1

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 (129) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +556 -201
  3. package/dist/commands/bionft/revoke.d.ts +6 -0
  4. package/dist/commands/bionft/revoke.d.ts.map +1 -0
  5. package/dist/commands/bionft/revoke.js +74 -0
  6. package/dist/commands/bionft/revoke.js.map +1 -0
  7. package/dist/commands/bionft/status.d.ts +2 -0
  8. package/dist/commands/bionft/status.d.ts.map +1 -0
  9. package/dist/commands/bionft/status.js +45 -0
  10. package/dist/commands/bionft/status.js.map +1 -0
  11. package/dist/commands/bionft/view.d.ts +5 -0
  12. package/dist/commands/bionft/view.d.ts.map +1 -0
  13. package/dist/commands/bionft/view.js +127 -0
  14. package/dist/commands/bionft/view.js.map +1 -0
  15. package/dist/commands/cred/issue.d.ts +12 -0
  16. package/dist/commands/cred/issue.d.ts.map +1 -0
  17. package/dist/commands/cred/issue.js +95 -0
  18. package/dist/commands/cred/issue.js.map +1 -0
  19. package/dist/commands/cred/lib.d.ts +23 -0
  20. package/dist/commands/cred/lib.d.ts.map +1 -0
  21. package/dist/commands/cred/lib.js +95 -0
  22. package/dist/commands/cred/lib.js.map +1 -0
  23. package/dist/commands/cred/list.d.ts +7 -0
  24. package/dist/commands/cred/list.d.ts.map +1 -0
  25. package/dist/commands/cred/list.js +65 -0
  26. package/dist/commands/cred/list.js.map +1 -0
  27. package/dist/commands/cred/revoke.d.ts +6 -0
  28. package/dist/commands/cred/revoke.d.ts.map +1 -0
  29. package/dist/commands/cred/revoke.js +60 -0
  30. package/dist/commands/cred/revoke.js.map +1 -0
  31. package/dist/commands/cred/status.d.ts +5 -0
  32. package/dist/commands/cred/status.d.ts.map +1 -0
  33. package/dist/commands/cred/status.js +41 -0
  34. package/dist/commands/cred/status.js.map +1 -0
  35. package/dist/commands/login.d.ts.map +1 -1
  36. package/dist/commands/login.js +15 -0
  37. package/dist/commands/login.js.map +1 -1
  38. package/dist/commands/upload-fastq.d.ts +10 -0
  39. package/dist/commands/upload-fastq.d.ts.map +1 -0
  40. package/dist/commands/upload-fastq.js +60 -0
  41. package/dist/commands/upload-fastq.js.map +1 -0
  42. package/dist/commands/vault/mount.d.ts +8 -0
  43. package/dist/commands/vault/mount.d.ts.map +1 -0
  44. package/dist/commands/vault/mount.js +136 -0
  45. package/dist/commands/vault/mount.js.map +1 -0
  46. package/dist/commands/vault/setup.d.ts +6 -0
  47. package/dist/commands/vault/setup.d.ts.map +1 -0
  48. package/dist/commands/vault/setup.js +160 -0
  49. package/dist/commands/vault/setup.js.map +1 -0
  50. package/dist/commands/vault/status.d.ts +4 -0
  51. package/dist/commands/vault/status.d.ts.map +1 -0
  52. package/dist/commands/vault/status.js +97 -0
  53. package/dist/commands/vault/status.js.map +1 -0
  54. package/dist/commands/vault/unmount.d.ts +6 -0
  55. package/dist/commands/vault/unmount.d.ts.map +1 -0
  56. package/dist/commands/vault/unmount.js +90 -0
  57. package/dist/commands/vault/unmount.js.map +1 -0
  58. package/dist/index.js +256 -89
  59. package/dist/index.js.map +1 -1
  60. package/dist/lib/auth/server.d.ts.map +1 -1
  61. package/dist/lib/auth/server.js +21 -2
  62. package/dist/lib/auth/server.js.map +1 -1
  63. package/dist/lib/bionft/BioAssetVault.abi.json +1104 -0
  64. package/dist/lib/bionft/BioNFTCredentials.abi.json +1235 -0
  65. package/dist/lib/bionft/client.d.ts +45 -0
  66. package/dist/lib/bionft/client.d.ts.map +1 -0
  67. package/dist/lib/bionft/client.js +219 -0
  68. package/dist/lib/bionft/client.js.map +1 -0
  69. package/dist/utils/errorReporter.d.ts +6 -0
  70. package/dist/utils/errorReporter.d.ts.map +1 -1
  71. package/dist/utils/errorReporter.js +53 -0
  72. package/dist/utils/errorReporter.js.map +1 -1
  73. package/package.json +5 -5
  74. package/dist/commands/access-sequentia.d.ts +0 -35
  75. package/dist/commands/access-sequentia.d.ts.map +0 -1
  76. package/dist/commands/access-sequentia.js +0 -256
  77. package/dist/commands/access-sequentia.js.map +0 -1
  78. package/dist/commands/ancestry/compare.d.ts +0 -9
  79. package/dist/commands/ancestry/compare.d.ts.map +0 -1
  80. package/dist/commands/ancestry/compare.js +0 -139
  81. package/dist/commands/ancestry/compare.js.map +0 -1
  82. package/dist/commands/ancestry/results.d.ts +0 -13
  83. package/dist/commands/ancestry/results.d.ts.map +0 -1
  84. package/dist/commands/ancestry/results.js +0 -123
  85. package/dist/commands/ancestry/results.js.map +0 -1
  86. package/dist/commands/ancestry/run.d.ts +0 -18
  87. package/dist/commands/ancestry/run.d.ts.map +0 -1
  88. package/dist/commands/ancestry/run.js +0 -171
  89. package/dist/commands/ancestry/run.js.map +0 -1
  90. package/dist/commands/ancestry/status.d.ts +0 -8
  91. package/dist/commands/ancestry/status.d.ts.map +0 -1
  92. package/dist/commands/ancestry/status.js +0 -59
  93. package/dist/commands/ancestry/status.js.map +0 -1
  94. package/dist/commands/biofiles-sequentia.d.ts +0 -21
  95. package/dist/commands/biofiles-sequentia.d.ts.map +0 -1
  96. package/dist/commands/biofiles-sequentia.js +0 -238
  97. package/dist/commands/biofiles-sequentia.js.map +0 -1
  98. package/dist/commands/download-sequentia.d.ts +0 -19
  99. package/dist/commands/download-sequentia.d.ts.map +0 -1
  100. package/dist/commands/download-sequentia.js +0 -159
  101. package/dist/commands/download-sequentia.js.map +0 -1
  102. package/dist/commands/researcher/register.d.ts +0 -24
  103. package/dist/commands/researcher/register.d.ts.map +0 -1
  104. package/dist/commands/researcher/register.js +0 -192
  105. package/dist/commands/researcher/register.js.map +0 -1
  106. package/dist/commands/researcher/status.d.ts +0 -24
  107. package/dist/commands/researcher/status.d.ts.map +0 -1
  108. package/dist/commands/researcher/status.js +0 -235
  109. package/dist/commands/researcher/status.js.map +0 -1
  110. package/dist/commands/researcher/verify.d.ts +0 -24
  111. package/dist/commands/researcher/verify.d.ts.map +0 -1
  112. package/dist/commands/researcher/verify.js +0 -167
  113. package/dist/commands/researcher/verify.js.map +0 -1
  114. package/dist/commands/share-sequentia.d.ts +0 -21
  115. package/dist/commands/share-sequentia.d.ts.map +0 -1
  116. package/dist/commands/share-sequentia.js +0 -161
  117. package/dist/commands/share-sequentia.js.map +0 -1
  118. package/dist/commands/tokenize-sequentia.d.ts +0 -21
  119. package/dist/commands/tokenize-sequentia.d.ts.map +0 -1
  120. package/dist/commands/tokenize-sequentia.js +0 -191
  121. package/dist/commands/tokenize-sequentia.js.map +0 -1
  122. package/dist/commands/verify-sequentia.d.ts +0 -18
  123. package/dist/commands/verify-sequentia.d.ts.map +0 -1
  124. package/dist/commands/verify-sequentia.js +0 -150
  125. package/dist/commands/verify-sequentia.js.map +0 -1
  126. package/dist/lib/ancestry/somos-client.d.ts +0 -64
  127. package/dist/lib/ancestry/somos-client.d.ts.map +0 -1
  128. package/dist/lib/ancestry/somos-client.js +0 -121
  129. package/dist/lib/ancestry/somos-client.js.map +0 -1
package/dist/index.js CHANGED
@@ -20,16 +20,28 @@ const tokenize_fastqs_1 = require("./commands/tokenize-fastqs");
20
20
  const tokenize_biosample_1 = require("./commands/tokenize-biosample");
21
21
  const link_clara_1 = require("./commands/link-clara");
22
22
  const family_status_1 = require("./commands/family-status");
23
+ const issue_1 = require("./commands/cred/issue");
24
+ const view_1 = require("./commands/bionft/view");
25
+ const revoke_1 = require("./commands/bionft/revoke");
26
+ const status_1 = require("./commands/bionft/status");
27
+ const setup_1 = require("./commands/vault/setup");
28
+ const mount_2 = require("./commands/vault/mount");
29
+ const status_2 = require("./commands/vault/status");
30
+ const unmount_1 = require("./commands/vault/unmount");
31
+ const status_3 = require("./commands/cred/status");
32
+ const list_1 = require("./commands/cred/list");
33
+ const revoke_2 = require("./commands/cred/revoke");
34
+ const upload_fastq_1 = require("./commands/upload-fastq");
23
35
  const request_1 = require("./commands/access/request");
24
36
  const grant_1 = require("./commands/access/grant");
25
- const revoke_1 = require("./commands/access/revoke");
26
- const list_1 = require("./commands/access/list");
37
+ const revoke_3 = require("./commands/access/revoke");
38
+ const list_2 = require("./commands/access/list");
27
39
  const check_1 = require("./commands/access/check");
28
40
  const revoke_consent_1 = require("./commands/access/revoke-consent");
29
41
  const create_1 = require("./commands/job/create");
30
- const status_1 = require("./commands/job/status");
42
+ const status_4 = require("./commands/job/status");
31
43
  const results_1 = require("./commands/job/results");
32
- const list_2 = require("./commands/job/list");
44
+ const list_3 = require("./commands/job/list");
33
45
  const pipelines_1 = require("./commands/job/pipelines");
34
46
  // v2.7.0: htsget + smart streaming + aliases
35
47
  const stream_1 = require("./commands/stream");
@@ -40,39 +52,57 @@ const submit_clara_1 = require("./commands/job/submit-clara");
40
52
  const create_2 = require("./commands/context/create");
41
53
  const publish_1 = require("./commands/context/publish");
42
54
  const verify_1 = require("./commands/context/verify");
43
- const revoke_2 = require("./commands/context/revoke");
44
- const run_1 = require("./commands/ancestry/run");
45
- const status_2 = require("./commands/ancestry/status");
46
- const results_2 = require("./commands/ancestry/results");
47
- const compare_1 = require("./commands/ancestry/compare");
55
+ const revoke_4 = require("./commands/context/revoke");
48
56
  const health_1 = require("./commands/agent/health");
49
57
  const register_1 = require("./commands/agent/register");
50
- const list_3 = require("./commands/agent/list");
51
- const status_3 = require("./commands/agent/status");
52
- const list_4 = require("./commands/labs/list");
58
+ const list_4 = require("./commands/agent/list");
59
+ const status_5 = require("./commands/agent/status");
60
+ const list_5 = require("./commands/labs/list");
53
61
  const share_1 = require("./commands/share");
54
62
  const shares_1 = require("./commands/shares");
55
63
  const verify_2 = require("./commands/verify");
56
64
  const dissect_1 = require("./commands/dissect");
57
65
  const dissect_sequentia_1 = require("./commands/dissect-sequentia");
58
- const view_1 = require("./commands/view");
66
+ const view_2 = require("./commands/view");
59
67
  const report_1 = require("./commands/report");
60
68
  const admin_1 = require("./commands/admin");
61
69
  const fuse_1 = require("./commands/fuse");
62
70
  const submit_1 = require("./commands/annotate/submit");
63
- const status_4 = require("./commands/annotate/status");
71
+ const status_6 = require("./commands/annotate/status");
64
72
  const balance_1 = require("./commands/payment/balance");
65
73
  const pricing_1 = require("./commands/payment/pricing");
66
- const setup_1 = require("./commands/payment/setup");
74
+ const setup_2 = require("./commands/payment/setup");
67
75
  const faucet_1 = require("./commands/payment/faucet");
68
76
  const history_1 = require("./commands/payment/history");
69
77
  const logger_1 = require("./lib/utils/logger");
78
+ const errorReporter_1 = require("./utils/errorReporter");
79
+ const credentials_1 = require("./lib/auth/credentials");
70
80
  const program = new commander_1.Command();
81
+ // Global catch-all so uncaught errors in ANY command still reach telemetry.
82
+ // Individual commands continue to call ErrorReporter.report directly (e.g.
83
+ // mount/umount) for richer context — this is the safety net for the rest.
84
+ async function reportAndExit(command, err, code) {
85
+ try {
86
+ const creds = await credentials_1.CredentialsManager.getInstance().loadCredentials().catch(() => null);
87
+ const error = err instanceof Error ? err : new Error(String(err));
88
+ await errorReporter_1.ErrorReporter.report(command, error, creds?.wallet_address, { argv: process.argv.slice(2) });
89
+ }
90
+ catch { /* telemetry failure must never block exit */ }
91
+ process.exit(code);
92
+ }
93
+ process.on('uncaughtException', (err) => {
94
+ logger_1.Logger.error(`Uncaught: ${err?.message || err}`);
95
+ reportAndExit(process.argv.slice(2).join(' ') || 'unknown', err, 1);
96
+ });
97
+ process.on('unhandledRejection', (reason) => {
98
+ logger_1.Logger.error(`UnhandledRejection: ${reason?.message || reason}`);
99
+ reportAndExit(process.argv.slice(2).join(' ') || 'unknown', reason, 1);
100
+ });
71
101
  // Set up the CLI
72
102
  program
73
103
  .name('biofs')
74
- .description('BioFS by GenoBank.io - BioNFT-Gated GCS CLI for genomic data + ancestry + BioContext manifests')
75
- .version('3.0.0')
104
+ .description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
105
+ .version('3.0.1')
76
106
  .option('--debug', 'Enable debug output')
77
107
  .hook('preAction', (thisCommand) => {
78
108
  // Set global debug flag if --debug is passed
@@ -340,6 +370,7 @@ program
340
370
  .description('Stream a BioNFT-gated VCF/BAM to stdout via htsget (pipe into bcftools/samtools/pysam)')
341
371
  .option('--kind <variants|reads>', 'force datatype (default: auto-detect from filename)')
342
372
  .option('--htsget-url <url>', 'override htsget endpoint (default: https://htsget.genobank.app)')
373
+ .option('--annotated', 'stream the OpenCRAVAT-annotated VCF sibling (Phase D) instead of raw')
343
374
  .option('-q, --quiet', 'suppress info messages')
344
375
  .action(async (id, options) => {
345
376
  try {
@@ -552,7 +583,7 @@ annotateCmd
552
583
  .option('--json', 'Output as JSON')
553
584
  .action(async (jobId, options) => {
554
585
  try {
555
- await (0, status_4.annotateStatusCommand)(jobId, options);
586
+ await (0, status_6.annotateStatusCommand)(jobId, options);
556
587
  }
557
588
  catch (error) {
558
589
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -604,7 +635,7 @@ paymentCmd
604
635
  .option('--json', 'Output as JSON')
605
636
  .action(async (options) => {
606
637
  try {
607
- await (0, setup_1.paymentSetupCommand)(options);
638
+ await (0, setup_2.paymentSetupCommand)(options);
608
639
  }
609
640
  catch (error) {
610
641
  logger_1.Logger.error(`Setup failed: ${error}`);
@@ -679,7 +710,7 @@ agentCmd
679
710
  .option('--json', 'Output as JSON')
680
711
  .action(async (options) => {
681
712
  try {
682
- await (0, list_3.agentListCommand)(options);
713
+ await (0, list_4.agentListCommand)(options);
683
714
  }
684
715
  catch (error) {
685
716
  logger_1.Logger.error(`Agent list failed: ${error}`);
@@ -696,7 +727,7 @@ agentCmd
696
727
  .option('--json', 'Output as JSON')
697
728
  .action(async (options) => {
698
729
  try {
699
- await (0, status_3.agentStatusCommand)(options);
730
+ await (0, status_5.agentStatusCommand)(options);
700
731
  }
701
732
  catch (error) {
702
733
  logger_1.Logger.error(`Agent status check failed: ${error}`);
@@ -742,7 +773,7 @@ accessCmd
742
773
  .option('--yes', 'Skip confirmation prompt')
743
774
  .action(async (biocidOrIpId, walletAddress, options) => {
744
775
  try {
745
- await (0, revoke_1.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
776
+ await (0, revoke_3.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
746
777
  }
747
778
  catch (error) {
748
779
  logger_1.Logger.error(`Access revocation failed: ${error}`);
@@ -758,7 +789,7 @@ accessCmd
758
789
  .option('--json', 'Output as JSON')
759
790
  .action(async (biocidOrIpId, options) => {
760
791
  try {
761
- await (0, list_1.accessListCommand)(biocidOrIpId, options);
792
+ await (0, list_2.accessListCommand)(biocidOrIpId, options);
762
793
  }
763
794
  catch (error) {
764
795
  logger_1.Logger.error(`List failed: ${error}`);
@@ -793,6 +824,203 @@ accessCmd
793
824
  process.exit(1);
794
825
  }
795
826
  });
827
+ // ~/genobank/vault commands (v2.9.0 · biovault Phase B)
828
+ // Portable vault: scaffolds ~/genobank/vault/ with a per-BioNFT subdirectory
829
+ // per owned token, then `biofs vault mount` downloads the annotated VCFs via
830
+ // htsget. Works on macOS + Linux without macFUSE kernel signing.
831
+ const vaultCmd = program
832
+ .command('vault')
833
+ .description('Local ~/genobank/vault — your owned BioNFTs as a real directory tree');
834
+ vaultCmd
835
+ .command('setup')
836
+ .description('Scan Sequentia for BioNFTs owned by your wallet and scaffold ~/genobank/vault/')
837
+ .option('--path <dir>', 'override vault path (default: ~/genobank/vault)')
838
+ .option('--force', 're-scaffold even if directory already exists')
839
+ .action(async (options) => {
840
+ try {
841
+ await (0, setup_1.vaultSetupCommand)(options);
842
+ }
843
+ catch (error) {
844
+ logger_1.Logger.error(`vault setup failed: ${error}`);
845
+ process.exit(1);
846
+ }
847
+ });
848
+ vaultCmd
849
+ .command('mount')
850
+ .description('Download BioNFT-gated data (raw + annotated VCFs) into the vault')
851
+ .option('--path <dir>', 'override vault path (default: ~/genobank/vault)')
852
+ .option('--refresh', 'force re-download of existing files')
853
+ .option('--skip-annotated', 'download only raw VCFs, skip OpenCRAVAT annotations')
854
+ .option('--categories <csv>', 'comma-separated BioNFT categories to mount', 'DATA_FILE_CHILD')
855
+ .action(async (options) => {
856
+ try {
857
+ await (0, mount_2.vaultMountCommand)(options);
858
+ }
859
+ catch (error) {
860
+ logger_1.Logger.error(`vault mount failed: ${error}`);
861
+ process.exit(1);
862
+ }
863
+ });
864
+ vaultCmd
865
+ .command('status')
866
+ .description('Show vault state: wallet, BioNFT inventory, per-token file sizes')
867
+ .option('--path <dir>', 'override vault path')
868
+ .action(async (options) => {
869
+ try {
870
+ await (0, status_2.vaultStatusCommand)(options);
871
+ }
872
+ catch (error) {
873
+ logger_1.Logger.error(`vault status failed: ${error}`);
874
+ process.exit(1);
875
+ }
876
+ });
877
+ vaultCmd
878
+ .command('unmount')
879
+ .description('Remove local cache. Manifest preserved unless --purge.')
880
+ .option('--path <dir>', 'override vault path')
881
+ .option('--purge', 'delete the whole vault dir (manifest + all files)')
882
+ .option('--force', 'skip confirmation prompt')
883
+ .action(async (options) => {
884
+ try {
885
+ await (0, unmount_1.vaultUnmountCommand)(options);
886
+ }
887
+ catch (error) {
888
+ logger_1.Logger.error(`vault unmount failed: ${error}`);
889
+ process.exit(1);
890
+ }
891
+ });
892
+ // BioNFT on-chain commands (v2.9.0 · biovault Phase F)
893
+ // Read/revoke any BioNFT (BIOSAMPLE_PARENT, DATA_FILE_CHILD, RENT_AGREEMENT,
894
+ // INGEST_TICKET) directly from Sequentia. No REST hop — ethers talks to the
895
+ // deployed contracts. This replaces `biofs cred revoke` for on-chain credentials
896
+ // and fixes the CherryPy DELETE-body bug we hit in Phase A.7.
897
+ const bionftCmd = program
898
+ .command('bionft')
899
+ .description('View and revoke BioNFTs directly on Sequentia (biovault Phase F)');
900
+ bionftCmd
901
+ .command('view <tokenId>')
902
+ .description('Show on-chain state + metadata for any BioNFT tokenId')
903
+ .option('--json', 'Output as JSON')
904
+ .action(async (tokenId, options) => {
905
+ try {
906
+ await (0, view_1.bionftViewCommand)(tokenId, options);
907
+ }
908
+ catch (error) {
909
+ logger_1.Logger.error(`bionft view failed: ${error}`);
910
+ process.exit(1);
911
+ }
912
+ });
913
+ bionftCmd
914
+ .command('status <tokenId>')
915
+ .description('One-line on-chain status of a BioNFT')
916
+ .action(async (tokenId) => {
917
+ try {
918
+ await (0, status_1.bionftStatusCommand)(tokenId);
919
+ }
920
+ catch (error) {
921
+ logger_1.Logger.error(`bionft status failed: ${error}`);
922
+ process.exit(1);
923
+ }
924
+ });
925
+ bionftCmd
926
+ .command('revoke <tokenId>')
927
+ .description('Patient-signed on-chain revoke. RENT_AGREEMENT or INGEST_TICKET only. Requires GENOBANK_OWNER_PRIVATE_KEY.')
928
+ .option('--reason <text>', 'Why you are revoking', 'user_cli')
929
+ .option('--force', 'Skip confirmation prompt')
930
+ .action(async (tokenId, options) => {
931
+ try {
932
+ await (0, revoke_1.bionftRevokeCommand)(tokenId, options);
933
+ }
934
+ catch (error) {
935
+ logger_1.Logger.error(`bionft revoke failed: ${error}`);
936
+ process.exit(1);
937
+ }
938
+ });
939
+ // Scoped write-only credential commands (v2.8.0 · biovault Phase A)
940
+ const credCmd = program
941
+ .command('cred')
942
+ .description('Scoped write-only FASTQ/BAM/VCF upload credentials (biovault)');
943
+ credCmd
944
+ .command('issue')
945
+ .description('Issue a single-use write credential for a biosample (requires BIOFS_LAB_PRIVATE_KEY)')
946
+ .requiredOption('--biosample <serial>', 'Biosample serial (e.g. 55052008714049)')
947
+ .requiredOption('--kind <kind>', 'FASTQ | FASTQ_R1 | FASTQ_R2 | BAM | VCF | GVCF', 'FASTQ_R1')
948
+ .option('--lab-id <id>', 'Laboratory ID (or $GENOBANK_LABORATORY_ID)', (v) => parseInt(v, 10))
949
+ .option('--source-file <path>', 'Compute size + sha256 from this file (required unless --size/--sha256 given)')
950
+ .option('--size <bytes>', 'Estimated upload size in bytes', (v) => parseInt(v, 10))
951
+ .option('--sha256 <hex>', 'Claimed SHA256 hash (64 hex chars)')
952
+ .option('--filename <name>', 'Logical filename to record server-side')
953
+ .option('--json', 'Output as JSON')
954
+ .action(async (options) => {
955
+ try {
956
+ await (0, issue_1.credIssueCommand)(options);
957
+ }
958
+ catch (error) {
959
+ logger_1.Logger.error(`cred issue failed: ${error}`);
960
+ process.exit(1);
961
+ }
962
+ });
963
+ credCmd
964
+ .command('status <cred_id>')
965
+ .description('Show the current state of a credential')
966
+ .option('--json', 'Output as JSON')
967
+ .action(async (credId, options) => {
968
+ try {
969
+ await (0, status_3.credStatusCommand)(credId, options);
970
+ }
971
+ catch (error) {
972
+ logger_1.Logger.error(`cred status failed: ${error}`);
973
+ process.exit(1);
974
+ }
975
+ });
976
+ credCmd
977
+ .command('list')
978
+ .description('List credentials for a biosample')
979
+ .option('--biosample <serial>', 'Biosample serial')
980
+ .option('--status <status>', 'Filter by status (issued|consumed|quarantined|burned)')
981
+ .option('--json', 'Output as JSON')
982
+ .action(async (options) => {
983
+ try {
984
+ await (0, list_1.credListCommand)(options);
985
+ }
986
+ catch (error) {
987
+ logger_1.Logger.error(`cred list failed: ${error}`);
988
+ process.exit(1);
989
+ }
990
+ });
991
+ credCmd
992
+ .command('revoke <cred_id>')
993
+ .description('Owner-signed burn of an unused credential (requires GENOBANK_OWNER_PRIVATE_KEY)')
994
+ .option('--reason <text>', 'Why you are burning this credential', 'user_cli')
995
+ .option('--force', 'Skip confirmation prompt')
996
+ .action(async (credId, options) => {
997
+ try {
998
+ await (0, revoke_2.credRevokeCommand)(credId, options);
999
+ }
1000
+ catch (error) {
1001
+ logger_1.Logger.error(`cred revoke failed: ${error}`);
1002
+ process.exit(1);
1003
+ }
1004
+ });
1005
+ // upload-fastq: thin wrapper around the Python genobank-upload CLI (resumable + resume buffer)
1006
+ program
1007
+ .command('upload-fastq <file>')
1008
+ .description('Upload a FASTQ/BAM/VCF via scoped credential + GCS resumable (wraps genobank-upload)')
1009
+ .requiredOption('--biosample <serial>', 'Biosample serial')
1010
+ .option('--kind <kind>', 'FASTQ | FASTQ_R1 | FASTQ_R2 | BAM | VCF | GVCF', 'FASTQ_R1')
1011
+ .option('--lab-id <id>', 'Laboratory ID (or $GENOBANK_LABORATORY_ID)', (v) => parseInt(v, 10))
1012
+ .option('--api-base <url>', 'Override API base URL')
1013
+ .option('--quiet', 'Suppress progress output')
1014
+ .option('--json', 'Output as JSON on completion')
1015
+ .action(async (file, options) => {
1016
+ try {
1017
+ await (0, upload_fastq_1.uploadFastqCommand)(file, options);
1018
+ }
1019
+ catch (error) {
1020
+ logger_1.Logger.error(`upload-fastq failed: ${error}`);
1021
+ process.exit(1);
1022
+ }
1023
+ });
796
1024
  // BioContext manifest commands (v2.6.0)
797
1025
  const contextCmd = program
798
1026
  .command('context')
@@ -854,74 +1082,13 @@ contextCmd
854
1082
  .option('--reason <string>', 'Revocation reason')
855
1083
  .action(async (key, options) => {
856
1084
  try {
857
- await (0, revoke_2.contextRevokeCommand)(key, options);
1085
+ await (0, revoke_4.contextRevokeCommand)(key, options);
858
1086
  }
859
1087
  catch (error) {
860
1088
  logger_1.Logger.error(`context revoke failed: ${error}`);
861
1089
  process.exit(1);
862
1090
  }
863
1091
  });
864
- // Somos Ancestry commands (v3.0.0 — K=24 ADMIXTURE supervised on Sequentia GCS)
865
- const ancestryCmd = program
866
- .command('ancestry')
867
- .description('Run Somos K=24 ancestry pipeline (PLINK + ADMIXTURE supervised, 781 refs, 24 pops)');
868
- ancestryCmd
869
- .command('run <dtc_file>')
870
- .description('Upload a DTC genotype file and trigger ancestry analysis')
871
- .option('--user-id <id>', 'User identifier (defaults to wallet from biofs login)')
872
- .option('--wait', 'Poll until done, then print results')
873
- .option('--poll-seconds <n>', 'Polling interval (default 30)', '30')
874
- .option('--callback-url <url>', 'Webhook to POST results to when complete')
875
- .option('--json', 'Emit JSON when --wait finishes')
876
- .action(async (dtcFile, opts) => {
877
- try {
878
- await (0, run_1.ancestryRunCommand)(dtcFile, opts);
879
- }
880
- catch (e) {
881
- logger_1.Logger.error(`ancestry run failed: ${e}`);
882
- process.exit(1);
883
- }
884
- });
885
- ancestryCmd
886
- .command('status <task_id>')
887
- .description('Check pipeline status for a task')
888
- .option('--json', 'Output as JSON')
889
- .action(async (taskId, opts) => {
890
- try {
891
- await (0, status_2.ancestryStatusCommand)(taskId, opts);
892
- }
893
- catch (e) {
894
- logger_1.Logger.error(`ancestry status failed: ${e}`);
895
- process.exit(1);
896
- }
897
- });
898
- ancestryCmd
899
- .command('results <task_id>')
900
- .description('Fetch and pretty-print ancestry results (24 populations + 5-region rollup)')
901
- .option('--download <dir>', 'Download all artifacts (CSV, JSON, summary) to <dir>')
902
- .option('--summary', 'Only print the 5-region rollup')
903
- .option('--json', 'Output as JSON')
904
- .action(async (taskId, opts) => {
905
- try {
906
- await (0, results_2.ancestryResultsCommand)(taskId, opts);
907
- }
908
- catch (e) {
909
- logger_1.Logger.error(`ancestry results failed: ${e}`);
910
- process.exit(1);
911
- }
912
- });
913
- ancestryCmd
914
- .command('compare <task_id> <reference_csv>')
915
- .description('Compare this task\'s result against a baseline CSV (e.g. LANGEBIO K=36 regrouped)')
916
- .action(async (taskId, referenceCsv) => {
917
- try {
918
- await (0, compare_1.ancestryCompareCommand)(taskId, referenceCsv);
919
- }
920
- catch (e) {
921
- logger_1.Logger.error(`ancestry compare failed: ${e}`);
922
- process.exit(1);
923
- }
924
- });
925
1092
  // Job management commands (BioOS)
926
1093
  const jobCmd = program
927
1094
  .command('job')
@@ -949,7 +1116,7 @@ jobCmd
949
1116
  .option('--watch', 'Watch mode (refresh every 5 seconds)')
950
1117
  .action(async (jobId, options) => {
951
1118
  try {
952
- await (0, status_1.jobStatusCommand)(jobId, options);
1119
+ await (0, status_4.jobStatusCommand)(jobId, options);
953
1120
  }
954
1121
  catch (error) {
955
1122
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -980,7 +1147,7 @@ jobCmd
980
1147
  .option('--limit <number>', 'Limit number of results', parseInt)
981
1148
  .action(async (options) => {
982
1149
  try {
983
- await (0, list_2.jobListCommand)(options);
1150
+ await (0, list_3.jobListCommand)(options);
984
1151
  }
985
1152
  catch (error) {
986
1153
  logger_1.Logger.error(`Failed to list jobs: ${error}`);
@@ -1048,7 +1215,7 @@ program
1048
1215
  .option('--verbose', 'Show detailed lab information')
1049
1216
  .action(async (options) => {
1050
1217
  try {
1051
- await (0, list_4.labNFTsCommand)(options);
1218
+ await (0, list_5.labNFTsCommand)(options);
1052
1219
  }
1053
1220
  catch (error) {
1054
1221
  logger_1.Logger.error(`Failed to fetch labs: ${error}`);
@@ -1143,7 +1310,7 @@ program
1143
1310
  .option('--debug', 'Show debug information')
1144
1311
  .action(async (biocidOrFilename, options) => {
1145
1312
  try {
1146
- await (0, view_1.viewCommand)(biocidOrFilename, options);
1313
+ await (0, view_2.viewCommand)(biocidOrFilename, options);
1147
1314
  }
1148
1315
  catch (error) {
1149
1316
  logger_1.Logger.error(`View failed: ${error}`);