@erosolaraijs/cure 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +321 -26
  2. package/dist/bin/cure.js +114 -1
  3. package/dist/bin/cure.js.map +1 -1
  4. package/dist/capabilities/clinicalTrialMatchingModule.d.ts +150 -0
  5. package/dist/capabilities/clinicalTrialMatchingModule.d.ts.map +1 -0
  6. package/dist/capabilities/clinicalTrialMatchingModule.js +436 -0
  7. package/dist/capabilities/clinicalTrialMatchingModule.js.map +1 -0
  8. package/dist/capabilities/cureValidationFramework.d.ts +195 -0
  9. package/dist/capabilities/cureValidationFramework.d.ts.map +1 -0
  10. package/dist/capabilities/cureValidationFramework.js +577 -0
  11. package/dist/capabilities/cureValidationFramework.js.map +1 -0
  12. package/dist/capabilities/emergencyOncology.d.ts +97 -0
  13. package/dist/capabilities/emergencyOncology.d.ts.map +1 -0
  14. package/dist/capabilities/emergencyOncology.js +1824 -0
  15. package/dist/capabilities/emergencyOncology.js.map +1 -0
  16. package/dist/capabilities/index.d.ts +11 -0
  17. package/dist/capabilities/index.d.ts.map +1 -1
  18. package/dist/capabilities/index.js +22 -0
  19. package/dist/capabilities/index.js.map +1 -1
  20. package/dist/capabilities/multimodalOncologyModule.d.ts +149 -0
  21. package/dist/capabilities/multimodalOncologyModule.d.ts.map +1 -0
  22. package/dist/capabilities/multimodalOncologyModule.js +701 -0
  23. package/dist/capabilities/multimodalOncologyModule.js.map +1 -0
  24. package/dist/capabilities/palliativeCareModule.d.ts +216 -0
  25. package/dist/capabilities/palliativeCareModule.d.ts.map +1 -0
  26. package/dist/capabilities/palliativeCareModule.js +1160 -0
  27. package/dist/capabilities/palliativeCareModule.js.map +1 -0
  28. package/dist/capabilities/precisionMedicineModule.d.ts +151 -0
  29. package/dist/capabilities/precisionMedicineModule.d.ts.map +1 -0
  30. package/dist/capabilities/precisionMedicineModule.js +758 -0
  31. package/dist/capabilities/precisionMedicineModule.js.map +1 -0
  32. package/dist/capabilities/specialPopulationsModule.d.ts +126 -0
  33. package/dist/capabilities/specialPopulationsModule.d.ts.map +1 -0
  34. package/dist/capabilities/specialPopulationsModule.js +574 -0
  35. package/dist/capabilities/specialPopulationsModule.js.map +1 -0
  36. package/dist/capabilities/survivorshipManagement.d.ts +178 -0
  37. package/dist/capabilities/survivorshipManagement.d.ts.map +1 -0
  38. package/dist/capabilities/survivorshipManagement.js +983 -0
  39. package/dist/capabilities/survivorshipManagement.js.map +1 -0
  40. package/dist/capabilities/treatmentSequencing.d.ts +140 -0
  41. package/dist/capabilities/treatmentSequencing.d.ts.map +1 -0
  42. package/dist/capabilities/treatmentSequencing.js +1689 -0
  43. package/dist/capabilities/treatmentSequencing.js.map +1 -0
  44. package/dist/capabilities/universalHealthFramework.d.ts +108 -0
  45. package/dist/capabilities/universalHealthFramework.d.ts.map +1 -0
  46. package/dist/capabilities/universalHealthFramework.js +615 -0
  47. package/dist/capabilities/universalHealthFramework.js.map +1 -0
  48. package/dist/compliance/hipaa.d.ts.map +1 -1
  49. package/dist/compliance/hipaa.js +7 -16
  50. package/dist/compliance/hipaa.js.map +1 -1
  51. package/dist/tools/index.d.ts +31 -0
  52. package/dist/tools/index.d.ts.map +1 -0
  53. package/dist/tools/index.js +1373 -0
  54. package/dist/tools/index.js.map +1 -0
  55. package/package.json +3 -2
  56. package/src/bin/cure.ts +130 -1
  57. package/src/capabilities/clinicalTrialMatchingModule.ts +600 -0
  58. package/src/capabilities/emergencyOncology.ts +1945 -0
  59. package/src/capabilities/index.ts +181 -0
  60. package/src/capabilities/multimodalOncologyModule.ts +873 -0
  61. package/src/capabilities/palliativeCareModule.ts +1438 -0
  62. package/src/capabilities/precisionMedicineModule.ts +952 -0
  63. package/src/capabilities/specialPopulationsModule.ts +711 -0
  64. package/src/capabilities/survivorshipManagement.ts +1213 -0
  65. package/src/capabilities/treatmentSequencing.ts +1878 -0
  66. package/src/capabilities/universalHealthFramework.ts +739 -0
  67. package/src/compliance/hipaa.ts +7 -15
  68. package/src/tools/index.ts +1628 -0
package/README.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Cure
2
2
 
3
- AI-powered cancer treatment framework for precision oncology research and clinical decision support.
3
+ AI-powered precision oncology platform for cancer treatment, clinical decision support, and research.
4
+
5
+ ```
6
+ ██████╗██╗ ██╗██████╗ ███████╗
7
+ ██╔════╝██║ ██║██╔══██╗██╔════╝
8
+ ██║ ██║ ██║██████╔╝█████╗
9
+ ██║ ██║ ██║██╔══██╗██╔══╝
10
+ ╚██████╗╚██████╔╝██║ ██║███████╗
11
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
12
+ ```
4
13
 
5
14
  ## Installation
6
15
 
@@ -8,61 +17,342 @@ AI-powered cancer treatment framework for precision oncology research and clinic
8
17
  npm install -g @erosolaraijs/cure
9
18
  ```
10
19
 
11
- ## Usage
20
+ ## Quick Start
12
21
 
13
22
  ```bash
23
+ # Launch interactive AI oncologist
14
24
  cure
25
+
26
+ # Set your AI provider (xAI or OpenAI)
27
+ /model openai
28
+ /key YOUR_API_KEY
29
+
30
+ # Generate a cure protocol
31
+ /cure NSCLC IV KRAS_G12C
15
32
  ```
16
33
 
17
34
  ## Features
18
35
 
19
- ### Patient Analysis
36
+ ### Interactive AI Oncologist
37
+
38
+ Chat with an AI-powered oncology assistant for:
39
+ - Treatment recommendations based on cancer type, stage, and biomarkers
40
+ - Drug mechanism explanations
41
+ - Clinical trial guidance
42
+ - Biomarker interpretation
43
+
44
+ **Multi-Provider Support:**
45
+ - **xAI Grok** (`grok-4-1-fast-reasoning`) - Default
46
+ - **OpenAI GPT-5.1** (`gpt-5.1`) - Alternative
47
+
48
+ Switch providers at runtime with `/model xai` or `/model openai`.
49
+
50
+ ### Comprehensive Cancer Coverage
51
+
52
+ | Category | Coverage |
53
+ |----------|----------|
54
+ | Cancer Types | 200+ types and histological subtypes |
55
+ | Biomarkers | 500+ actionable targets |
56
+ | Protocols | 100+ (NCCN, ESMO, ASCO, FDA) |
57
+ | Patient Populations | Pediatric, AYA, adult, elderly, frail |
58
+ | Special Circumstances | Pregnancy, transplant, autoimmune, HIV |
59
+ | Stages | Localized, locally advanced, metastatic, recurrent |
60
+
61
+ ### Core Capabilities
62
+
63
+ #### Patient Analysis (`/analyze`)
20
64
  - Genomic profiling and biomarker assessment
21
65
  - Risk stratification and survival prediction
22
66
  - Treatment response modeling
67
+ - MSI/TMB/HRD status analysis
23
68
 
24
- ### Treatment Planning
69
+ #### Treatment Planning (`/plan`)
25
70
  - NCCN, ESMO, ASCO protocol integration
26
71
  - Personalized treatment recommendations
72
+ - Multi-modality planning (surgery, radiation, systemic)
27
73
  - Timeline and monitoring schedules
28
74
 
29
- ### Drug Discovery
75
+ #### Cure Protocol Generation (`/cure`)
76
+ - Comprehensive cure strategies by cancer type and stage
77
+ - Drug target prioritization with evidence levels
78
+ - Immunotherapy protocol matching
79
+ - Projected outcomes (response rate, 5-year survival, cure confidence)
80
+
81
+ #### Drug Target Discovery (`/discover`)
30
82
  - AI-driven target identification
31
- - Evidence-based prioritization
32
- - Research pathway planning
83
+ - Evidence-based prioritization (FDA-approved, clinical trials, preclinical)
84
+ - Pathway analysis
85
+ - Approved drug matching
86
+
87
+ #### Clinical Trial Matching (`/trials`)
88
+ - ClinicalTrials.gov integration
89
+ - Biomarker-based eligibility matching
90
+ - Location-aware search
91
+ - Phase and status filtering
92
+
93
+ #### Drug Safety (`/safety`)
94
+ - Drug-drug interaction checking
95
+ - Black box warning alerts
96
+ - QT prolongation risk assessment
97
+ - Pharmacogenomic considerations (DPYD, UGT1A1, TPMT/NUDT15)
98
+
99
+ #### ML Outcome Prediction (`/predict`)
100
+ - Response prediction (CR, PR, SD, PD)
101
+ - Survival estimates (PFS, OS with confidence intervals)
102
+ - Toxicity risk assessment
103
+ - Resistance prediction
104
+
105
+ ### EHR Integration
106
+
107
+ Connect to hospital systems via HL7 FHIR R4:
108
+
109
+ ```bash
110
+ /ehr connect epic
111
+ /ehr connect cerner
112
+ ```
113
+
114
+ **Supported Systems:**
115
+ - Epic
116
+ - Cerner
117
+
118
+ **Data Exchange:**
119
+ - Patient demographics
120
+ - Cancer diagnoses (ICD-10)
121
+ - Biomarker results
122
+ - Treatment history
123
+ - Medication records
124
+
125
+ ### Genomic Platform Integration
126
+
127
+ ```bash
128
+ /genomics platforms
129
+ ```
130
+
131
+ **Supported Platforms:**
132
+ - **Foundation Medicine** (FoundationOne CDx)
133
+ - **Guardant Health** (Guardant360, GuardantOMNI)
134
+ - **Tempus** (xT, xF, xR)
135
+
136
+ **Analysis Types:**
137
+ - Somatic variant detection
138
+ - Copy number alterations
139
+ - Gene fusions
140
+ - MSI/TMB analysis
141
+ - Therapy matching
142
+
143
+ ### HIPAA Compliance
33
144
 
34
- ### Clinical Trials
35
- - Patient eligibility matching
36
- - Protocol design support
37
- - Outcome tracking
145
+ - End-to-end encryption
146
+ - PHI masking and de-identification
147
+ - Audit logging with 7-year retention
148
+ - Role-based access control
149
+ - Consent management
38
150
 
39
- ### Integrations
40
- - **FHIR**: Electronic health record interoperability
41
- - **ClinicalTrials.gov**: Trial matching and enrollment
42
- - **Genomic Platforms**: Foundation Medicine, Tempus, Guardant integration
151
+ ## CLI Commands
43
152
 
44
- ### Compliance
45
- - HIPAA-compliant data handling
46
- - Audit logging and access controls
47
- - PHI masking and encryption
153
+ ### AI Chat Commands
154
+ | Command | Description |
155
+ |---------|-------------|
156
+ | `/key [provider] [key]` | Set API key (xai or openai) |
157
+ | `/model [xai\|openai]` | Show/switch AI provider |
158
+ | `/clear` | Clear conversation history |
48
159
 
49
- ## API
160
+ ### Clinical Commands
161
+ | Command | Description |
162
+ |---------|-------------|
163
+ | `/analyze [patient]` | Analyze patient data |
164
+ | `/plan [patient]` | Design treatment plan |
165
+ | `/cure [cancer] [stage] [mutations...]` | Generate cure protocol |
166
+ | `/discover [gene] [cancer]` | Drug target discovery |
167
+ | `/trials [cancer] [biomarkers...]` | Find clinical trials |
168
+ | `/safety [drug1] [drug2...]` | Check drug interactions |
169
+ | `/predict [patient]` | ML outcome predictions |
170
+
171
+ ### System Commands
172
+ | Command | Description |
173
+ |---------|-------------|
174
+ | `/status` | System health check |
175
+ | `/ehr [connect\|status]` | EHR integration |
176
+ | `/genomics [platforms]` | Genomic platforms status |
177
+ | `/demo` | Run framework demonstration |
178
+ | `/version` | Show version |
179
+ | `/update` | Check for updates |
180
+
181
+ ### Tool Commands
182
+ | Command | Description |
183
+ |---------|-------------|
184
+ | `/tools` | List diagnostic tools |
185
+ | `/tool <id>` | Run a tool (see `/tools`) |
186
+ | `/tool all` | Run all tools |
187
+
188
+ ## Programmatic API
50
189
 
51
190
  ```typescript
52
- import { CancerTreatmentCapability } from '@erosolaraijs/cure';
191
+ import {
192
+ CancerTreatmentCapabilityModule,
193
+ createOncologyPlatform,
194
+ FHIRClient,
195
+ ClinicalTrialsGovClient,
196
+ OutcomePredictorService,
197
+ DrugSafetyService,
198
+ HIPAAComplianceService
199
+ } from '@erosolaraijs/cure';
200
+
201
+ // Quick start with full platform
202
+ const platform = await createOncologyPlatform({
203
+ ehr: {
204
+ enabled: true,
205
+ vendor: 'epic',
206
+ baseUrl: 'https://epic.hospital.org/fhir',
207
+ clientId: 'your-client-id'
208
+ },
209
+ genomics: {
210
+ enabled: true,
211
+ platforms: ['foundation', 'guardant', 'tempus']
212
+ },
213
+ clinicalTrials: {
214
+ enabled: true,
215
+ maxDistance: 100
216
+ },
217
+ ml: {
218
+ enabled: true,
219
+ modelVersion: '1.0.0'
220
+ },
221
+ safety: {
222
+ enabled: true,
223
+ strictMode: true
224
+ },
225
+ compliance: {
226
+ enabled: true,
227
+ auditRetentionDays: 2555
228
+ }
229
+ });
53
230
 
54
- const capability = new CancerTreatmentCapability();
231
+ // Generate comprehensive treatment plan
232
+ const plan = await platform.generateComprehensivePlan(patient, 'DR001');
233
+ ```
234
+
235
+ ### Core Module Usage
236
+
237
+ ```typescript
238
+ // Cancer treatment capability
239
+ const capability = new CancerTreatmentCapabilityModule();
55
240
 
56
241
  // Analyze patient
57
- const analysis = await capability.analyzePatient(patientData);
242
+ const analysis = await capability.analyzePatient('P001', true);
58
243
 
59
- // Generate treatment plan
60
- const plan = await capability.generateTreatmentPlan(patientId, options);
244
+ // Generate cure protocol
245
+ const cure = await capability.cureCancer('P001', 'Lung', 'IV', {
246
+ mutations: ['EGFR', 'TP53'],
247
+ biomarkers: ['PD-L1'],
248
+ msiStatus: 'MSS',
249
+ tmbLevel: 'High'
250
+ });
61
251
 
62
252
  // Discover drug targets
63
- const targets = await capability.discoverDrugTargets(cancerType, genomicData);
253
+ const targets = await capability.discoverDrugTargets('Melanoma', 'BRAF');
64
254
  ```
65
255
 
256
+ ### Individual Services
257
+
258
+ ```typescript
259
+ // EHR Integration
260
+ const fhir = new FHIRClient(config);
261
+ const patient = await fhir.getPatient('12345');
262
+ const conditions = await fhir.getConditions('12345');
263
+
264
+ // Clinical Trials
265
+ const trials = new ClinicalTrialsGovClient();
266
+ const matches = await trials.searchTrials({
267
+ condition: 'Non-Small Cell Lung Cancer',
268
+ intervention: 'pembrolizumab',
269
+ status: 'RECRUITING'
270
+ });
271
+
272
+ // ML Predictions
273
+ const predictor = new OutcomePredictorService();
274
+ const response = await predictor.predictResponse(patientFeatures, treatmentFeatures);
275
+
276
+ // Drug Safety
277
+ const safety = new DrugSafetyService();
278
+ const interactions = await safety.checkInteractions(['pembrolizumab', 'ipilimumab']);
279
+
280
+ // HIPAA Compliance
281
+ const hipaa = new HIPAAComplianceService();
282
+ await hipaa.logAccess(userId, patientId, 'VIEW', 'Clinical review');
283
+ ```
284
+
285
+ ## Environment Variables
286
+
287
+ | Variable | Description |
288
+ |----------|-------------|
289
+ | `AI_PROVIDER` | AI provider: `xai` or `openai` (default: xai) |
290
+ | `XAI_API_KEY` | xAI API key |
291
+ | `OPENAI_API_KEY` | OpenAI API key |
292
+ | `FHIR_BASE_URL` | FHIR server URL |
293
+ | `FHIR_CLIENT_ID` | FHIR OAuth client ID |
294
+ | `FHIR_CLIENT_SECRET` | FHIR OAuth client secret |
295
+
296
+ ## Supported Cancer Types
297
+
298
+ <details>
299
+ <summary>Click to expand full list</summary>
300
+
301
+ **Solid Tumors:**
302
+ - Lung (NSCLC, SCLC, mesothelioma)
303
+ - Breast (HR+, HER2+, TNBC)
304
+ - Colorectal
305
+ - Prostate
306
+ - Melanoma
307
+ - Pancreatic
308
+ - Hepatocellular
309
+ - Gastric/Esophageal
310
+ - Ovarian
311
+ - Endometrial
312
+ - Cervical
313
+ - Bladder/Urothelial
314
+ - Renal Cell
315
+ - Head and Neck
316
+ - Thyroid
317
+ - Sarcomas
318
+ - Brain (GBM, meningioma)
319
+ - And 150+ more subtypes
320
+
321
+ **Hematologic Malignancies:**
322
+ - Acute Myeloid Leukemia (AML)
323
+ - Acute Lymphoblastic Leukemia (ALL)
324
+ - Chronic Myeloid Leukemia (CML)
325
+ - Chronic Lymphocytic Leukemia (CLL)
326
+ - Diffuse Large B-Cell Lymphoma
327
+ - Follicular Lymphoma
328
+ - Hodgkin Lymphoma
329
+ - Multiple Myeloma
330
+ - Myelodysplastic Syndromes
331
+ - Myeloproliferative Neoplasms
332
+
333
+ **Rare Cancers:**
334
+ - Cholangiocarcinoma
335
+ - Neuroendocrine Tumors
336
+ - GIST
337
+ - Adrenocortical Carcinoma
338
+ - Thymoma
339
+ - And more
340
+
341
+ </details>
342
+
343
+ ## Emerging Therapeutics
344
+
345
+ The platform includes cutting-edge treatment modalities:
346
+
347
+ - **Antibody-Drug Conjugates (ADCs):** T-DXd, sacituzumab govitecan
348
+ - **Bispecific Antibodies:** teclistamab, glofitamab
349
+ - **CAR-T Therapies:** axi-cel, liso-cel, ide-cel
350
+ - **Tumor-Infiltrating Lymphocytes (TILs):** lifileucel
351
+ - **KRAS Inhibitors:** sotorasib, adagrasib
352
+ - **Protein Degraders:** PROTACs, molecular glues
353
+ - **Radiopharmaceuticals:** Lu-177 PSMA, I-131 MIBG
354
+ - **Cancer Vaccines:** mRNA-4157, personalized neoantigen vaccines
355
+
66
356
  ## Requirements
67
357
 
68
358
  - Node.js >= 18.0.0
@@ -70,3 +360,8 @@ const targets = await capability.discoverDrugTargets(cancerType, genomicData);
70
360
  ## License
71
361
 
72
362
  MIT
363
+
364
+ ## Links
365
+
366
+ - [npm Package](https://www.npmjs.com/package/@erosolaraijs/cure)
367
+ - [Report Issues](https://github.com/anthropics/claude-code/issues)
package/dist/bin/cure.js CHANGED
@@ -19,7 +19,8 @@ import * as path from 'path';
19
19
  import * as os from 'os';
20
20
  import { CancerTreatmentCapabilityModule } from '../capabilities/cancerTreatmentCapability.js';
21
21
  import { createRealWorldOncologyService } from '../orchestrator/realWorldOncology.js';
22
- const VERSION = '2.3.0';
22
+ import { getCliTool, listCliTools } from '../tools/index.js';
23
+ const VERSION = '2.4.0';
23
24
  const PACKAGE_NAME = '@erosolaraijs/cure';
24
25
  const UPDATE_CHECK_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours
25
26
  let currentProvider = process.env.AI_PROVIDER || 'xai';
@@ -498,6 +499,23 @@ async function processInput(input) {
498
499
  case 'predict':
499
500
  await predictOutcomes(args[0] || 'P001');
500
501
  return;
502
+ case 'tools':
503
+ printToolList();
504
+ return;
505
+ case 'tool':
506
+ if (!args[0]) {
507
+ console.log(`\n${colors.yellow}Usage: /tool <selftest|validate>${colors.reset}`);
508
+ printToolList();
509
+ return;
510
+ }
511
+ await runTool(args[0], args.slice(1));
512
+ return;
513
+ case 'selftest':
514
+ await runTool('selftest', args);
515
+ return;
516
+ case 'validate':
517
+ await runTool('validate', args);
518
+ return;
501
519
  case 'status':
502
520
  await showSystemStatus();
503
521
  return;
@@ -966,6 +984,69 @@ async function manageGenomics(args) {
966
984
  break;
967
985
  }
968
986
  }
987
+ function printToolList() {
988
+ const tools = listCliTools();
989
+ console.log(`\n${colors.bold}Tools${colors.reset}`);
990
+ console.log(`${colors.dim}─────────────────────────────${colors.reset}`);
991
+ tools.forEach(tool => {
992
+ console.log(` ${colors.cyan}${tool.id}${colors.reset} ${tool.description}`);
993
+ });
994
+ console.log(` ${colors.cyan}all${colors.reset} Run all tools`);
995
+ console.log(`${colors.dim}Use /tool <id> to run a tool.${colors.reset}`);
996
+ }
997
+ async function runTool(toolId, args) {
998
+ if (toolId === 'all') {
999
+ await runAllTools(args);
1000
+ return;
1001
+ }
1002
+ const tool = getCliTool(toolId);
1003
+ if (!tool) {
1004
+ console.log(`\n${colors.red}Unknown tool: ${toolId}${colors.reset}`);
1005
+ printToolList();
1006
+ return;
1007
+ }
1008
+ console.log(`\n${colors.cyan}Running tool: ${tool.id}${colors.reset}`);
1009
+ const context = { cancerTreatment, oncologyService, serviceConfig };
1010
+ const report = await tool.run(context, args);
1011
+ printToolReport(report);
1012
+ }
1013
+ async function runAllTools(args) {
1014
+ const tools = listCliTools();
1015
+ const context = { cancerTreatment, oncologyService, serviceConfig };
1016
+ const results = [];
1017
+ for (const tool of tools) {
1018
+ console.log(`\n${colors.cyan}Running tool: ${tool.id}${colors.reset}`);
1019
+ const report = await tool.run(context, args);
1020
+ results.push(report);
1021
+ printToolReport(report);
1022
+ }
1023
+ const failures = results.filter(result => !result.ok).length;
1024
+ const statusColor = failures === 0 ? colors.green : colors.yellow;
1025
+ console.log(`\n${statusColor}All tools complete: ${results.length} run, ${failures} failed.${colors.reset}`);
1026
+ }
1027
+ function printToolReport(report) {
1028
+ const statusLabel = report.ok ? `${colors.green}OK${colors.reset}` : `${colors.red}FAIL${colors.reset}`;
1029
+ console.log(`\n${colors.bold}Tool Report${colors.reset}`);
1030
+ console.log(`${colors.dim}─────────────────────────────${colors.reset}`);
1031
+ console.log(` Tool: ${report.toolId}`);
1032
+ console.log(` Status: ${statusLabel}`);
1033
+ console.log(` Summary: ${report.summary}`);
1034
+ console.log(` Duration: ${report.durationMs}ms`);
1035
+ if (report.checks && report.checks.length > 0) {
1036
+ console.log(`\n${colors.bold}Checks${colors.reset}`);
1037
+ report.checks.forEach(check => {
1038
+ const icon = check.ok ? `${colors.green}✓${colors.reset}` : `${colors.red}✗${colors.reset}`;
1039
+ const detail = check.detail ? ` ${colors.dim}${check.detail}${colors.reset}` : '';
1040
+ console.log(` ${icon} ${check.name}${detail}`);
1041
+ });
1042
+ }
1043
+ if (report.metrics && Object.keys(report.metrics).length > 0) {
1044
+ console.log(`\n${colors.bold}Metrics${colors.reset}`);
1045
+ Object.entries(report.metrics).forEach(([key, value]) => {
1046
+ console.log(` ${colors.cyan}${key}${colors.reset}: ${value}`);
1047
+ });
1048
+ }
1049
+ }
969
1050
  async function runDemo() {
970
1051
  console.log(`\n${colors.cyan}Running framework demo...${colors.reset}\n`);
971
1052
  try {
@@ -1013,6 +1094,23 @@ async function handleCommand(args) {
1013
1094
  else if (args.includes('--status')) {
1014
1095
  await showSystemStatus();
1015
1096
  }
1097
+ else if (args.includes('--tools')) {
1098
+ printToolList();
1099
+ }
1100
+ else if (args.some(arg => arg.startsWith('--tool='))) {
1101
+ const toolId = args.find(arg => arg.startsWith('--tool='))?.split('=')[1];
1102
+ if (!toolId) {
1103
+ console.log(`${colors.red}Missing tool id.${colors.reset} Use --tool=<id>.`);
1104
+ process.exit(1);
1105
+ }
1106
+ await runTool(toolId, []);
1107
+ }
1108
+ else if (args.includes('--selftest')) {
1109
+ await runTool('selftest', []);
1110
+ }
1111
+ else if (args.includes('--validate')) {
1112
+ await runTool('validate', []);
1113
+ }
1016
1114
  else if (args.includes('--demo')) {
1017
1115
  await runDemo();
1018
1116
  }
@@ -1054,6 +1152,14 @@ ${colors.dim}──────────────────────
1054
1152
  ${colors.cyan}/predict${colors.reset} [patient] ML outcome predictions
1055
1153
  ${colors.cyan}/status${colors.reset} System health check
1056
1154
 
1155
+ ${colors.bold}Tools${colors.reset}
1156
+ ${colors.dim}─────────────────────────────────────${colors.reset}
1157
+ ${colors.cyan}/tools${colors.reset} List diagnostic tools
1158
+ ${colors.cyan}/tool${colors.reset} <id> Run a tool (see /tools)
1159
+ ${colors.cyan}/tool${colors.reset} all Run all tools
1160
+ ${colors.cyan}/selftest${colors.reset} Run core capability checks
1161
+ ${colors.cyan}/validate${colors.reset} Run retrospective validation
1162
+
1057
1163
  ${colors.bold}Integrations${colors.reset}
1058
1164
  ${colors.dim}─────────────────────────────────────${colors.reset}
1059
1165
  ${colors.cyan}/ehr${colors.reset} [connect|status] EHR integration (Epic/Cerner)
@@ -1113,6 +1219,10 @@ ${colors.bold}Commands:${colors.reset}
1113
1219
  --safety Check drug interactions
1114
1220
  --predict ML outcome predictions
1115
1221
  --status System health check
1222
+ --tools List diagnostic tools
1223
+ --tool=<id> Run a tool (use --tools to list, or --tool=all)
1224
+ --selftest Run core capability checks
1225
+ --validate Run retrospective validation
1116
1226
  --demo Run framework demo
1117
1227
  --help, -h Show this help
1118
1228
  --version, -v Show version
@@ -1127,6 +1237,7 @@ ${colors.bold}Options:${colors.reset}
1127
1237
  --mutations=<list> Comma-separated mutations
1128
1238
  --biomarkers=<list> Comma-separated biomarkers
1129
1239
  --drugs=<list> Comma-separated drug names
1240
+ --tool=<id> Tool ID (use --tool=all to run all tools)
1130
1241
 
1131
1242
  ${colors.bold}Environment:${colors.reset}
1132
1243
  AI_PROVIDER AI provider: 'xai' or 'openai' (default: xai)
@@ -1143,6 +1254,8 @@ ${colors.bold}Examples:${colors.reset}
1143
1254
  cure --safety --drugs=pembrolizumab,ipilimumab
1144
1255
  cure --analyze-patient --patient=P001 --genomics
1145
1256
  cure --drug-discovery --target=BRAF --cancer=Melanoma
1257
+ cure --selftest
1258
+ cure --tool=all
1146
1259
 
1147
1260
  ${colors.bold}Integrated Systems:${colors.reset}
1148
1261
  • EHR: Epic, Cerner (HL7 FHIR R4)