@the-cascade-protocol/cli 0.2.0 → 0.2.2

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 (50) hide show
  1. package/dist/commands/pod/helpers.d.ts +1 -1
  2. package/dist/commands/pod/helpers.d.ts.map +1 -1
  3. package/dist/commands/pod/helpers.js +5 -20
  4. package/dist/commands/pod/helpers.js.map +1 -1
  5. package/package.json +18 -6
  6. package/.dockerignore +0 -7
  7. package/.eslintrc.json +0 -23
  8. package/.prettierrc +0 -7
  9. package/Dockerfile +0 -18
  10. package/src/commands/capabilities.ts +0 -235
  11. package/src/commands/conformance.ts +0 -447
  12. package/src/commands/convert.ts +0 -164
  13. package/src/commands/pod/export.ts +0 -85
  14. package/src/commands/pod/helpers.ts +0 -449
  15. package/src/commands/pod/index.ts +0 -32
  16. package/src/commands/pod/info.ts +0 -239
  17. package/src/commands/pod/init.ts +0 -273
  18. package/src/commands/pod/query.ts +0 -224
  19. package/src/commands/serve.ts +0 -92
  20. package/src/commands/validate.ts +0 -303
  21. package/src/index.ts +0 -58
  22. package/src/lib/fhir-converter/cascade-to-fhir.ts +0 -369
  23. package/src/lib/fhir-converter/converters-clinical.ts +0 -446
  24. package/src/lib/fhir-converter/converters-demographics.ts +0 -270
  25. package/src/lib/fhir-converter/fhir-to-cascade.ts +0 -82
  26. package/src/lib/fhir-converter/index.ts +0 -215
  27. package/src/lib/fhir-converter/types.ts +0 -318
  28. package/src/lib/mcp/audit.ts +0 -107
  29. package/src/lib/mcp/server.ts +0 -192
  30. package/src/lib/mcp/tools.ts +0 -668
  31. package/src/lib/output.ts +0 -76
  32. package/src/lib/shacl-validator.ts +0 -314
  33. package/src/lib/turtle-parser.ts +0 -277
  34. package/src/shapes/checkup.shapes.ttl +0 -1459
  35. package/src/shapes/clinical.shapes.ttl +0 -1350
  36. package/src/shapes/clinical.ttl +0 -1369
  37. package/src/shapes/core.shapes.ttl +0 -450
  38. package/src/shapes/core.ttl +0 -603
  39. package/src/shapes/coverage.shapes.ttl +0 -214
  40. package/src/shapes/coverage.ttl +0 -182
  41. package/src/shapes/health.shapes.ttl +0 -697
  42. package/src/shapes/health.ttl +0 -859
  43. package/src/shapes/pots.shapes.ttl +0 -481
  44. package/test-fixtures/fhir-bundle-example.json +0 -216
  45. package/test-fixtures/fhir-medication-example.json +0 -18
  46. package/tests/cli.test.ts +0 -126
  47. package/tests/fhir-converter.test.ts +0 -874
  48. package/tests/mcp-server.test.ts +0 -396
  49. package/tests/pod.test.ts +0 -400
  50. package/tsconfig.json +0 -24
@@ -1,18 +0,0 @@
1
- {
2
- "resourceType": "MedicationStatement",
3
- "id": "example-med",
4
- "status": "active",
5
- "medicationCodeableConcept": {
6
- "coding": [
7
- {
8
- "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
9
- "code": "860975",
10
- "display": "Metformin 500mg"
11
- }
12
- ],
13
- "text": "Metformin HCl 500mg"
14
- },
15
- "subject": { "reference": "Patient/example" },
16
- "effectivePeriod": { "start": "2024-01-15" },
17
- "dosage": [{ "text": "500mg twice daily" }]
18
- }
package/tests/cli.test.ts DELETED
@@ -1,126 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { execSync } from 'child_process';
3
- import { resolve } from 'path';
4
-
5
- const CLI_PATH = resolve(__dirname, '../dist/index.js');
6
-
7
- function runCli(args: string): string {
8
- try {
9
- return execSync(`node ${CLI_PATH} ${args}`, {
10
- encoding: 'utf-8',
11
- timeout: 10000,
12
- }).trim();
13
- } catch (error: unknown) {
14
- const execError = error as { stdout?: string; stderr?: string; status?: number };
15
- // Commands that exit with non-zero still produce output
16
- return (execError.stdout ?? '').trim() + (execError.stderr ?? '').trim();
17
- }
18
- }
19
-
20
- describe('cascade CLI', () => {
21
- describe('--version', () => {
22
- it('should print the version number', () => {
23
- const output = runCli('--version');
24
- expect(output).toBe('0.2.0');
25
- });
26
- });
27
-
28
- describe('--help', () => {
29
- it('should print help text', () => {
30
- const output = runCli('--help');
31
- expect(output).toContain('Cascade Protocol CLI');
32
- expect(output).toContain('validate');
33
- expect(output).toContain('convert');
34
- expect(output).toContain('pod');
35
- expect(output).toContain('conformance');
36
- expect(output).toContain('serve');
37
- expect(output).toContain('capabilities');
38
- });
39
-
40
- it('should include examples in help output', () => {
41
- const output = runCli('--help');
42
- expect(output).toContain('Examples:');
43
- expect(output).toContain('cascade validate record.ttl');
44
- });
45
- });
46
-
47
- describe('capabilities', () => {
48
- it('should output valid JSON', () => {
49
- const output = runCli('capabilities');
50
- const parsed = JSON.parse(output);
51
- expect(parsed).toBeDefined();
52
- expect(parsed.name).toBe('@the-cascade-protocol/cli');
53
- expect(parsed.version).toBe('0.2.0');
54
- });
55
-
56
- it('should list all tools', () => {
57
- const output = runCli('capabilities');
58
- const parsed = JSON.parse(output);
59
- expect(parsed.tools).toBeInstanceOf(Array);
60
- expect(parsed.tools.length).toBeGreaterThan(0);
61
-
62
- const toolNames = parsed.tools.map((t: { name: string }) => t.name);
63
- expect(toolNames).toContain('validate');
64
- expect(toolNames).toContain('convert');
65
- expect(toolNames).toContain('pod init');
66
- expect(toolNames).toContain('serve');
67
- expect(toolNames).toContain('capabilities');
68
- });
69
-
70
- it('should mark capabilities as implemented', () => {
71
- const output = runCli('capabilities');
72
- const parsed = JSON.parse(output);
73
- const capTool = parsed.tools.find((t: { name: string }) => t.name === 'capabilities');
74
- expect(capTool.status).toBe('implemented');
75
- });
76
-
77
- it('should include protocol URL', () => {
78
- const output = runCli('capabilities');
79
- const parsed = JSON.parse(output);
80
- expect(parsed.protocol).toBe('https://cascadeprotocol.org');
81
- });
82
- });
83
-
84
- describe('validate', () => {
85
- it('should report error for non-existent file', () => {
86
- const output = runCli('validate nonexistent.ttl');
87
- expect(output).toContain('Path not found');
88
- });
89
-
90
- it('should validate a valid Turtle file', () => {
91
- const podPath = resolve(__dirname, '../../reference-patient-pod/clinical/medications.ttl');
92
- const output = runCli(`validate ${podPath}`);
93
- expect(output).toContain('PASS');
94
- });
95
-
96
- it('should output JSON when --json flag is used', () => {
97
- const podPath = resolve(__dirname, '../../reference-patient-pod/clinical/medications.ttl');
98
- const output = runCli(`--json validate ${podPath}`);
99
- const parsed = JSON.parse(output);
100
- expect(parsed).toBeInstanceOf(Array);
101
- expect(parsed[0].valid).toBe(true);
102
- expect(parsed[0].quadCount).toBeGreaterThan(0);
103
- });
104
-
105
- it('should validate a directory of Turtle files', () => {
106
- const podPath = resolve(__dirname, '../../reference-patient-pod/clinical');
107
- const output = runCli(`validate ${podPath}`);
108
- expect(output).toContain('PASS');
109
- expect(output).toContain('Validation Summary');
110
- });
111
- });
112
-
113
- describe('global options', () => {
114
- it('should accept --json flag', () => {
115
- const output = runCli('--json capabilities');
116
- const parsed = JSON.parse(output);
117
- expect(parsed.name).toBe('@the-cascade-protocol/cli');
118
- });
119
-
120
- it('should accept --verbose flag', () => {
121
- // --verbose should not cause an error
122
- const output = runCli('--verbose capabilities');
123
- expect(output).toBeTruthy();
124
- });
125
- });
126
- });