@genobank/biofs 2.6.2 → 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 (133) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +556 -201
  3. package/dist/commands/alias.d.ts +9 -0
  4. package/dist/commands/alias.d.ts.map +1 -0
  5. package/dist/commands/alias.js +56 -0
  6. package/dist/commands/alias.js.map +1 -0
  7. package/dist/commands/bionft/revoke.d.ts +6 -0
  8. package/dist/commands/bionft/revoke.d.ts.map +1 -0
  9. package/dist/commands/bionft/revoke.js +74 -0
  10. package/dist/commands/bionft/revoke.js.map +1 -0
  11. package/dist/commands/bionft/status.d.ts +2 -0
  12. package/dist/commands/bionft/status.d.ts.map +1 -0
  13. package/dist/commands/bionft/status.js +45 -0
  14. package/dist/commands/bionft/status.js.map +1 -0
  15. package/dist/commands/bionft/view.d.ts +5 -0
  16. package/dist/commands/bionft/view.d.ts.map +1 -0
  17. package/dist/commands/bionft/view.js +127 -0
  18. package/dist/commands/bionft/view.js.map +1 -0
  19. package/dist/commands/cred/issue.d.ts +12 -0
  20. package/dist/commands/cred/issue.d.ts.map +1 -0
  21. package/dist/commands/cred/issue.js +95 -0
  22. package/dist/commands/cred/issue.js.map +1 -0
  23. package/dist/commands/cred/lib.d.ts +23 -0
  24. package/dist/commands/cred/lib.d.ts.map +1 -0
  25. package/dist/commands/cred/lib.js +95 -0
  26. package/dist/commands/cred/lib.js.map +1 -0
  27. package/dist/commands/cred/list.d.ts +7 -0
  28. package/dist/commands/cred/list.d.ts.map +1 -0
  29. package/dist/commands/cred/list.js +65 -0
  30. package/dist/commands/cred/list.js.map +1 -0
  31. package/dist/commands/cred/revoke.d.ts +6 -0
  32. package/dist/commands/cred/revoke.d.ts.map +1 -0
  33. package/dist/commands/cred/revoke.js +60 -0
  34. package/dist/commands/cred/revoke.js.map +1 -0
  35. package/dist/commands/cred/status.d.ts +5 -0
  36. package/dist/commands/cred/status.d.ts.map +1 -0
  37. package/dist/commands/cred/status.js +41 -0
  38. package/dist/commands/cred/status.js.map +1 -0
  39. package/dist/commands/htsget.d.ts +8 -0
  40. package/dist/commands/htsget.d.ts.map +1 -0
  41. package/dist/commands/htsget.js +43 -0
  42. package/dist/commands/htsget.js.map +1 -0
  43. package/dist/commands/login.d.ts.map +1 -1
  44. package/dist/commands/login.js +15 -0
  45. package/dist/commands/login.js.map +1 -1
  46. package/dist/commands/pipe.d.ts +8 -0
  47. package/dist/commands/pipe.d.ts.map +1 -0
  48. package/dist/commands/pipe.js +76 -0
  49. package/dist/commands/pipe.js.map +1 -0
  50. package/dist/commands/stream.d.ts +9 -0
  51. package/dist/commands/stream.d.ts.map +1 -0
  52. package/dist/commands/stream.js +58 -0
  53. package/dist/commands/stream.js.map +1 -0
  54. package/dist/commands/upload-fastq.d.ts +10 -0
  55. package/dist/commands/upload-fastq.d.ts.map +1 -0
  56. package/dist/commands/upload-fastq.js +60 -0
  57. package/dist/commands/upload-fastq.js.map +1 -0
  58. package/dist/commands/vault/mount.d.ts +8 -0
  59. package/dist/commands/vault/mount.d.ts.map +1 -0
  60. package/dist/commands/vault/mount.js +136 -0
  61. package/dist/commands/vault/mount.js.map +1 -0
  62. package/dist/commands/vault/setup.d.ts +6 -0
  63. package/dist/commands/vault/setup.d.ts.map +1 -0
  64. package/dist/commands/vault/setup.js +160 -0
  65. package/dist/commands/vault/setup.js.map +1 -0
  66. package/dist/commands/vault/status.d.ts +4 -0
  67. package/dist/commands/vault/status.d.ts.map +1 -0
  68. package/dist/commands/vault/status.js +97 -0
  69. package/dist/commands/vault/status.js.map +1 -0
  70. package/dist/commands/vault/unmount.d.ts +6 -0
  71. package/dist/commands/vault/unmount.d.ts.map +1 -0
  72. package/dist/commands/vault/unmount.js +90 -0
  73. package/dist/commands/vault/unmount.js.map +1 -0
  74. package/dist/index.js +354 -23
  75. package/dist/index.js.map +1 -1
  76. package/dist/lib/aliases/store.d.ts +7 -0
  77. package/dist/lib/aliases/store.d.ts.map +1 -0
  78. package/dist/lib/aliases/store.js +83 -0
  79. package/dist/lib/aliases/store.js.map +1 -0
  80. package/dist/lib/auth/server.d.ts.map +1 -1
  81. package/dist/lib/auth/server.js +21 -2
  82. package/dist/lib/auth/server.js.map +1 -1
  83. package/dist/lib/bionft/BioAssetVault.abi.json +1104 -0
  84. package/dist/lib/bionft/BioNFTCredentials.abi.json +1235 -0
  85. package/dist/lib/bionft/client.d.ts +45 -0
  86. package/dist/lib/bionft/client.d.ts.map +1 -0
  87. package/dist/lib/bionft/client.js +219 -0
  88. package/dist/lib/bionft/client.js.map +1 -0
  89. package/dist/lib/htsget/client.d.ts +54 -0
  90. package/dist/lib/htsget/client.d.ts.map +1 -0
  91. package/dist/lib/htsget/client.js +76 -0
  92. package/dist/lib/htsget/client.js.map +1 -0
  93. package/dist/utils/errorReporter.d.ts +6 -0
  94. package/dist/utils/errorReporter.d.ts.map +1 -1
  95. package/dist/utils/errorReporter.js +53 -0
  96. package/dist/utils/errorReporter.js.map +1 -1
  97. package/package.json +4 -4
  98. package/dist/commands/access-sequentia.d.ts +0 -35
  99. package/dist/commands/access-sequentia.d.ts.map +0 -1
  100. package/dist/commands/access-sequentia.js +0 -256
  101. package/dist/commands/access-sequentia.js.map +0 -1
  102. package/dist/commands/biofiles-sequentia.d.ts +0 -21
  103. package/dist/commands/biofiles-sequentia.d.ts.map +0 -1
  104. package/dist/commands/biofiles-sequentia.js +0 -238
  105. package/dist/commands/biofiles-sequentia.js.map +0 -1
  106. package/dist/commands/download-sequentia.d.ts +0 -19
  107. package/dist/commands/download-sequentia.d.ts.map +0 -1
  108. package/dist/commands/download-sequentia.js +0 -159
  109. package/dist/commands/download-sequentia.js.map +0 -1
  110. package/dist/commands/researcher/register.d.ts +0 -24
  111. package/dist/commands/researcher/register.d.ts.map +0 -1
  112. package/dist/commands/researcher/register.js +0 -192
  113. package/dist/commands/researcher/register.js.map +0 -1
  114. package/dist/commands/researcher/status.d.ts +0 -24
  115. package/dist/commands/researcher/status.d.ts.map +0 -1
  116. package/dist/commands/researcher/status.js +0 -235
  117. package/dist/commands/researcher/status.js.map +0 -1
  118. package/dist/commands/researcher/verify.d.ts +0 -24
  119. package/dist/commands/researcher/verify.d.ts.map +0 -1
  120. package/dist/commands/researcher/verify.js +0 -167
  121. package/dist/commands/researcher/verify.js.map +0 -1
  122. package/dist/commands/share-sequentia.d.ts +0 -21
  123. package/dist/commands/share-sequentia.d.ts.map +0 -1
  124. package/dist/commands/share-sequentia.js +0 -161
  125. package/dist/commands/share-sequentia.js.map +0 -1
  126. package/dist/commands/tokenize-sequentia.d.ts +0 -21
  127. package/dist/commands/tokenize-sequentia.d.ts.map +0 -1
  128. package/dist/commands/tokenize-sequentia.js +0 -191
  129. package/dist/commands/tokenize-sequentia.js.map +0 -1
  130. package/dist/commands/verify-sequentia.d.ts +0 -18
  131. package/dist/commands/verify-sequentia.d.ts.map +0 -1
  132. package/dist/commands/verify-sequentia.js +0 -150
  133. package/dist/commands/verify-sequentia.js.map +0 -1
package/dist/index.js CHANGED
@@ -20,50 +20,89 @@ 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");
46
+ // v2.7.0: htsget + smart streaming + aliases
47
+ const stream_1 = require("./commands/stream");
48
+ const pipe_1 = require("./commands/pipe");
49
+ const alias_1 = require("./commands/alias");
50
+ const htsget_1 = require("./commands/htsget");
34
51
  const submit_clara_1 = require("./commands/job/submit-clara");
35
52
  const create_2 = require("./commands/context/create");
36
53
  const publish_1 = require("./commands/context/publish");
37
54
  const verify_1 = require("./commands/context/verify");
38
- const revoke_2 = require("./commands/context/revoke");
55
+ const revoke_4 = require("./commands/context/revoke");
39
56
  const health_1 = require("./commands/agent/health");
40
57
  const register_1 = require("./commands/agent/register");
41
- const list_3 = require("./commands/agent/list");
42
- const status_2 = require("./commands/agent/status");
43
- 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");
44
61
  const share_1 = require("./commands/share");
45
62
  const shares_1 = require("./commands/shares");
46
63
  const verify_2 = require("./commands/verify");
47
64
  const dissect_1 = require("./commands/dissect");
48
65
  const dissect_sequentia_1 = require("./commands/dissect-sequentia");
49
- const view_1 = require("./commands/view");
66
+ const view_2 = require("./commands/view");
50
67
  const report_1 = require("./commands/report");
51
68
  const admin_1 = require("./commands/admin");
52
69
  const fuse_1 = require("./commands/fuse");
53
70
  const submit_1 = require("./commands/annotate/submit");
54
- const status_3 = require("./commands/annotate/status");
71
+ const status_6 = require("./commands/annotate/status");
55
72
  const balance_1 = require("./commands/payment/balance");
56
73
  const pricing_1 = require("./commands/payment/pricing");
57
- const setup_1 = require("./commands/payment/setup");
74
+ const setup_2 = require("./commands/payment/setup");
58
75
  const faucet_1 = require("./commands/payment/faucet");
59
76
  const history_1 = require("./commands/payment/history");
60
77
  const logger_1 = require("./lib/utils/logger");
78
+ const errorReporter_1 = require("./utils/errorReporter");
79
+ const credentials_1 = require("./lib/auth/credentials");
61
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
+ });
62
101
  // Set up the CLI
63
102
  program
64
103
  .name('biofs')
65
104
  .description('BioFS by GenoBank.io - BioNFT-Gated S3 CLI for genomic data')
66
- .version('2.6.2')
105
+ .version('3.0.1')
67
106
  .option('--debug', 'Enable debug output')
68
107
  .hook('preAction', (thisCommand) => {
69
108
  // Set global debug flag if --debug is passed
@@ -319,6 +358,101 @@ program
319
358
  process.exit(1);
320
359
  }
321
360
  });
361
+ // ========================================================================
362
+ // v2.7.0 — htsget + smart streaming + aliases (Sprint 6)
363
+ // ========================================================================
364
+ // Mac researchers stream BioNFT-gated VCFs/BAMs through the tools they
365
+ // already use (bcftools, samtools, pysam, IGV) with zero FUSE, zero kext.
366
+ // `stream` / `view` are the day-to-day commands; `htsget` is for debugging.
367
+ // stream - htsget stream to stdout (pipes into any bioinformatics tool)
368
+ program
369
+ .command('stream <id>')
370
+ .description('Stream a BioNFT-gated VCF/BAM to stdout via htsget (pipe into bcftools/samtools/pysam)')
371
+ .option('--kind <variants|reads>', 'force datatype (default: auto-detect from filename)')
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')
374
+ .option('-q, --quiet', 'suppress info messages')
375
+ .action(async (id, options) => {
376
+ try {
377
+ await (0, stream_1.streamCommand)(id, options);
378
+ }
379
+ catch (error) {
380
+ logger_1.Logger.error(`stream failed: ${error?.message || error}`);
381
+ process.exit(6);
382
+ }
383
+ });
384
+ // pipe - auto-pipe htsget stream into bcftools/samtools view
385
+ // (distinct from the existing `view` command, which prints file content)
386
+ program
387
+ .command('pipe <id>')
388
+ .description('Pipe a BioIP stream into bcftools view (VCF) or samtools view (BAM) automatically')
389
+ .option('--tool <bcftools|samtools>', 'force tool (default: auto-detect from filename)')
390
+ .option('--htsget-url <url>', 'override htsget endpoint')
391
+ .option('-q, --quiet', 'suppress info messages')
392
+ .allowUnknownOption(true)
393
+ .action(async (id, options, cmd) => {
394
+ try {
395
+ // Everything after `--` is passed through to bcftools/samtools view
396
+ const extra = cmd.args.slice(cmd.args.indexOf(id) + 1);
397
+ await (0, pipe_1.pipeCommand)(id, { ...options, extra });
398
+ }
399
+ catch (error) {
400
+ logger_1.Logger.error(`pipe failed: ${error?.message || error}`);
401
+ process.exit(6);
402
+ }
403
+ });
404
+ // alias - manage local shortcuts for ip_ids / BioCIDs
405
+ program
406
+ .command('alias [name] [target]')
407
+ .description('Manage local aliases for ip_ids (e.g. `biofs alias my-wes 0xCCe14315…`)')
408
+ .option('--list', 'list all aliases (default when no args)')
409
+ .option('--remove <name>', 'remove alias by name')
410
+ .option('--json', 'emit JSON')
411
+ .action(async (name, target, options) => {
412
+ try {
413
+ await (0, alias_1.aliasCommand)({ ...options, name, target });
414
+ }
415
+ catch (error) {
416
+ logger_1.Logger.error(`alias failed: ${error?.message || error}`);
417
+ process.exit(1);
418
+ }
419
+ });
420
+ // htsget - low-level GA4GH htsget operations (service-info, ticket)
421
+ const htsgetCmd = program
422
+ .command('htsget')
423
+ .description('Low-level GA4GH htsget operations (see `biofs stream`/`view` for day-to-day use)');
424
+ htsgetCmd
425
+ .command('service-info')
426
+ .description('Show htsget endpoint metadata (GA4GH service-info)')
427
+ .option('--json', 'emit JSON')
428
+ .action(async (options) => {
429
+ try {
430
+ await (0, htsget_1.htsgetServiceInfoCommand)(options);
431
+ }
432
+ catch (error) {
433
+ logger_1.Logger.error(`service-info failed: ${error?.message || error}`);
434
+ process.exit(6);
435
+ }
436
+ });
437
+ htsgetCmd
438
+ .command('ticket <kind> <id>')
439
+ .description('Fetch a raw htsget ticket for debugging (kind = variants | reads)')
440
+ .action(async (kind, id) => {
441
+ try {
442
+ if (kind !== 'variants' && kind !== 'reads') {
443
+ logger_1.Logger.error(`kind must be 'variants' or 'reads' (got '${kind}')`);
444
+ process.exit(2);
445
+ }
446
+ await (0, htsget_1.htsgetTicketCommand)(kind, id);
447
+ }
448
+ catch (error) {
449
+ logger_1.Logger.error(`ticket failed: ${error?.message || error}`);
450
+ process.exit(6);
451
+ }
452
+ });
453
+ // ========================================================================
454
+ // (end v2.7.0 block)
455
+ // ========================================================================
322
456
  // Tokenize command group - BioNFT minting on Sequentia
323
457
  const tokenizeCmd = program
324
458
  .command('tokenize')
@@ -449,7 +583,7 @@ annotateCmd
449
583
  .option('--json', 'Output as JSON')
450
584
  .action(async (jobId, options) => {
451
585
  try {
452
- await (0, status_3.annotateStatusCommand)(jobId, options);
586
+ await (0, status_6.annotateStatusCommand)(jobId, options);
453
587
  }
454
588
  catch (error) {
455
589
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -501,7 +635,7 @@ paymentCmd
501
635
  .option('--json', 'Output as JSON')
502
636
  .action(async (options) => {
503
637
  try {
504
- await (0, setup_1.paymentSetupCommand)(options);
638
+ await (0, setup_2.paymentSetupCommand)(options);
505
639
  }
506
640
  catch (error) {
507
641
  logger_1.Logger.error(`Setup failed: ${error}`);
@@ -576,7 +710,7 @@ agentCmd
576
710
  .option('--json', 'Output as JSON')
577
711
  .action(async (options) => {
578
712
  try {
579
- await (0, list_3.agentListCommand)(options);
713
+ await (0, list_4.agentListCommand)(options);
580
714
  }
581
715
  catch (error) {
582
716
  logger_1.Logger.error(`Agent list failed: ${error}`);
@@ -593,7 +727,7 @@ agentCmd
593
727
  .option('--json', 'Output as JSON')
594
728
  .action(async (options) => {
595
729
  try {
596
- await (0, status_2.agentStatusCommand)(options);
730
+ await (0, status_5.agentStatusCommand)(options);
597
731
  }
598
732
  catch (error) {
599
733
  logger_1.Logger.error(`Agent status check failed: ${error}`);
@@ -639,7 +773,7 @@ accessCmd
639
773
  .option('--yes', 'Skip confirmation prompt')
640
774
  .action(async (biocidOrIpId, walletAddress, options) => {
641
775
  try {
642
- await (0, revoke_1.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
776
+ await (0, revoke_3.accessRevokeCommand)(biocidOrIpId, walletAddress, options);
643
777
  }
644
778
  catch (error) {
645
779
  logger_1.Logger.error(`Access revocation failed: ${error}`);
@@ -655,7 +789,7 @@ accessCmd
655
789
  .option('--json', 'Output as JSON')
656
790
  .action(async (biocidOrIpId, options) => {
657
791
  try {
658
- await (0, list_1.accessListCommand)(biocidOrIpId, options);
792
+ await (0, list_2.accessListCommand)(biocidOrIpId, options);
659
793
  }
660
794
  catch (error) {
661
795
  logger_1.Logger.error(`List failed: ${error}`);
@@ -690,6 +824,203 @@ accessCmd
690
824
  process.exit(1);
691
825
  }
692
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
+ });
693
1024
  // BioContext manifest commands (v2.6.0)
694
1025
  const contextCmd = program
695
1026
  .command('context')
@@ -751,7 +1082,7 @@ contextCmd
751
1082
  .option('--reason <string>', 'Revocation reason')
752
1083
  .action(async (key, options) => {
753
1084
  try {
754
- await (0, revoke_2.contextRevokeCommand)(key, options);
1085
+ await (0, revoke_4.contextRevokeCommand)(key, options);
755
1086
  }
756
1087
  catch (error) {
757
1088
  logger_1.Logger.error(`context revoke failed: ${error}`);
@@ -785,7 +1116,7 @@ jobCmd
785
1116
  .option('--watch', 'Watch mode (refresh every 5 seconds)')
786
1117
  .action(async (jobId, options) => {
787
1118
  try {
788
- await (0, status_1.jobStatusCommand)(jobId, options);
1119
+ await (0, status_4.jobStatusCommand)(jobId, options);
789
1120
  }
790
1121
  catch (error) {
791
1122
  logger_1.Logger.error(`Status check failed: ${error}`);
@@ -816,7 +1147,7 @@ jobCmd
816
1147
  .option('--limit <number>', 'Limit number of results', parseInt)
817
1148
  .action(async (options) => {
818
1149
  try {
819
- await (0, list_2.jobListCommand)(options);
1150
+ await (0, list_3.jobListCommand)(options);
820
1151
  }
821
1152
  catch (error) {
822
1153
  logger_1.Logger.error(`Failed to list jobs: ${error}`);
@@ -884,7 +1215,7 @@ program
884
1215
  .option('--verbose', 'Show detailed lab information')
885
1216
  .action(async (options) => {
886
1217
  try {
887
- await (0, list_4.labNFTsCommand)(options);
1218
+ await (0, list_5.labNFTsCommand)(options);
888
1219
  }
889
1220
  catch (error) {
890
1221
  logger_1.Logger.error(`Failed to fetch labs: ${error}`);
@@ -979,7 +1310,7 @@ program
979
1310
  .option('--debug', 'Show debug information')
980
1311
  .action(async (biocidOrFilename, options) => {
981
1312
  try {
982
- await (0, view_1.viewCommand)(biocidOrFilename, options);
1313
+ await (0, view_2.viewCommand)(biocidOrFilename, options);
983
1314
  }
984
1315
  catch (error) {
985
1316
  logger_1.Logger.error(`View failed: ${error}`);