@cosyte/cli 0.0.6 → 0.1.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.
- package/CHANGELOG.md +322 -0
- package/README.md +111 -45
- package/dist/bin/cosyte-mcp.cjs +461 -106
- package/dist/bin/cosyte-mcp.cjs.map +1 -1
- package/dist/bin/cosyte-mcp.mjs +461 -106
- package/dist/bin/cosyte-mcp.mjs.map +1 -1
- package/dist/bin/cosyte.cjs +824 -140
- package/dist/bin/cosyte.cjs.map +1 -1
- package/dist/bin/cosyte.mjs +825 -141
- package/dist/bin/cosyte.mjs.map +1 -1
- package/dist/index.cjs +592 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +515 -281
- package/dist/index.d.ts +515 -281
- package/dist/index.mjs +574 -104
- package/dist/index.mjs.map +1 -1
- package/dist/io-C9bSG2zF.d.cts +381 -0
- package/dist/io-C9bSG2zF.d.ts +381 -0
- package/dist/mcp.cjs +435 -103
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +70 -9
- package/dist/mcp.d.ts +70 -9
- package/dist/mcp.mjs +435 -103
- package/dist/mcp.mjs.map +1 -1
- package/package.json +61 -37
- package/dist/io-B2EobRzC.d.cts +0 -57
- package/dist/io-B2EobRzC.d.ts +0 -57
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosyte/cli",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "The cosyte CLI: a PHI-safe developer front door over the @cosyte/* healthcare parsers. Parse HL7 v2 / FHIR from a file or stdin to typed JSON, with a documented exit-code contract.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
|
+
"command-line",
|
|
7
8
|
"healthcare",
|
|
8
9
|
"hl7",
|
|
10
|
+
"hl7v2",
|
|
9
11
|
"fhir",
|
|
12
|
+
"x12",
|
|
13
|
+
"ncpdp",
|
|
14
|
+
"astm",
|
|
15
|
+
"c-cda",
|
|
16
|
+
"dicom",
|
|
17
|
+
"mllp",
|
|
18
|
+
"mcp",
|
|
10
19
|
"interoperability",
|
|
11
20
|
"typescript"
|
|
12
21
|
],
|
|
@@ -14,7 +23,7 @@
|
|
|
14
23
|
"cosyte": "./dist/bin/cosyte.mjs",
|
|
15
24
|
"cosyte-mcp": "./dist/bin/cosyte-mcp.mjs"
|
|
16
25
|
},
|
|
17
|
-
"homepage": "https://
|
|
26
|
+
"homepage": "https://docs.cosyte.com/cli",
|
|
18
27
|
"bugs": {
|
|
19
28
|
"url": "https://github.com/cosyte/cli/issues"
|
|
20
29
|
},
|
|
@@ -26,8 +35,9 @@
|
|
|
26
35
|
"author": "Cosyte <hello@cosyte.com> (https://cosyte.com)",
|
|
27
36
|
"type": "module",
|
|
28
37
|
"engines": {
|
|
29
|
-
"node": ">=22.0.0"
|
|
38
|
+
"node": ">=22.0.0 <26.0.0"
|
|
30
39
|
},
|
|
40
|
+
"packageManager": "pnpm@10.34.5",
|
|
31
41
|
"main": "./dist/index.cjs",
|
|
32
42
|
"module": "./dist/index.mjs",
|
|
33
43
|
"types": "./dist/index.d.ts",
|
|
@@ -66,14 +76,50 @@
|
|
|
66
76
|
"provenance": true
|
|
67
77
|
},
|
|
68
78
|
"prettier": "@cosyte/prettier-config",
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "tsup",
|
|
81
|
+
"changeset": "changeset",
|
|
82
|
+
"typecheck": "tsc --noEmit",
|
|
83
|
+
"phi-scan": "tsx scripts/phi-scan.ts",
|
|
84
|
+
"check:agent-notes": "tsx scripts/check-agent-notes.ts",
|
|
85
|
+
"check:no-emdash": "bash scripts/check-no-emdash.sh",
|
|
86
|
+
"check:no-internal-refs": "bash scripts/check-no-internal-refs.sh",
|
|
87
|
+
"lint": "eslint \"src/**/*.ts\" \"scripts/**/*.ts\" \"test/**/*.ts\" --max-warnings=0 --no-error-on-unmatched-pattern",
|
|
88
|
+
"lint:fix": "eslint \"src/**/*.ts\" \"scripts/**/*.ts\" \"test/**/*.ts\" --fix --no-error-on-unmatched-pattern",
|
|
89
|
+
"format": "prettier --write \"src/**/*.{ts,md}\" \"test/**/*.ts\" \"scripts/**/*.{ts,mjs}\" \"examples/**/*.{ts,js,json,md}\" \"*.{json,md,yml}\"",
|
|
90
|
+
"format:check": "prettier --check \"src/**/*.{ts,md}\" \"test/**/*.ts\" \"scripts/**/*.{ts,mjs}\" \"examples/**/*.{ts,js,json,md}\" \"*.{json,md,yml}\"",
|
|
91
|
+
"test": "vitest run",
|
|
92
|
+
"test:watch": "vitest",
|
|
93
|
+
"test:coverage": "vitest run --coverage",
|
|
94
|
+
"test:fuzz": "vitest run test/fuzz.property.test.ts",
|
|
95
|
+
"smoke": "node scripts/smoke.mjs",
|
|
96
|
+
"examples": "tsx scripts/run-examples.ts",
|
|
97
|
+
"typecheck:examples": "tsc -p examples/tsconfig.json",
|
|
98
|
+
"lint:examples": "eslint examples --max-warnings=0",
|
|
99
|
+
"phi-scan:examples": "tsx scripts/phi-scan.ts examples/*.ts",
|
|
100
|
+
"clean": "rm -rf dist coverage",
|
|
101
|
+
"vendor:refresh": "bash scripts/vendor-refresh.sh",
|
|
102
|
+
"pack:docs": "bash scripts/build-docs-artifacts.sh",
|
|
103
|
+
"attw": "node scripts/attw.mjs --profile node16",
|
|
104
|
+
"version": "changeset version && node scripts/sync-version.mjs && prettier --write package.json CHANGELOG.md src/core/version.ts",
|
|
105
|
+
"release": "changeset publish",
|
|
106
|
+
"prepublishOnly": "pnpm clean && pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm attw",
|
|
107
|
+
"prepare": "command -v simple-git-hooks >/dev/null 2>&1 && simple-git-hooks || true"
|
|
108
|
+
},
|
|
69
109
|
"simple-git-hooks": {
|
|
70
110
|
"pre-commit": "pnpm phi-scan --staged"
|
|
71
111
|
},
|
|
112
|
+
"pnpm": {
|
|
113
|
+
"overrides": {
|
|
114
|
+
"esbuild@>=0.27.3 <0.28.1": "0.28.1",
|
|
115
|
+
"js-yaml@>=4.0.0 <4.3.0": "4.3.0"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
72
118
|
"devDependencies": {
|
|
73
119
|
"@arethetypeswrong/cli": "0.18.4",
|
|
74
120
|
"@changesets/cli": "2.31.0",
|
|
75
121
|
"@cosyte/eslint-config": "^0.0.4",
|
|
76
|
-
"@cosyte/fhir": "
|
|
122
|
+
"@cosyte/fhir": "^0.1.0",
|
|
77
123
|
"@cosyte/prettier-config": "^0.0.2",
|
|
78
124
|
"@cosyte/test-utils": "^0.0.1",
|
|
79
125
|
"@cosyte/tsconfig": "^0.0.2",
|
|
@@ -92,40 +138,18 @@
|
|
|
92
138
|
"vitest": "4.1.4"
|
|
93
139
|
},
|
|
94
140
|
"dependencies": {
|
|
95
|
-
"@cosyte/hl7": "^0.0
|
|
96
|
-
"@cosyte/terminology": "^0.0
|
|
141
|
+
"@cosyte/hl7": "^0.1.0",
|
|
142
|
+
"@cosyte/terminology": "^0.1.0"
|
|
97
143
|
},
|
|
98
144
|
"optionalDependencies": {
|
|
99
|
-
"@cosyte/astm": "^0.0
|
|
100
|
-
"@cosyte/ccda": "^0.0
|
|
101
|
-
"@cosyte/
|
|
102
|
-
"@cosyte/
|
|
103
|
-
"@cosyte/
|
|
104
|
-
"@cosyte/
|
|
105
|
-
"@cosyte/
|
|
145
|
+
"@cosyte/astm": "^0.1.0",
|
|
146
|
+
"@cosyte/ccda": "^0.1.0",
|
|
147
|
+
"@cosyte/deid": "^0.1.0",
|
|
148
|
+
"@cosyte/dicom": "^0.1.0",
|
|
149
|
+
"@cosyte/mllp": "^0.1.0",
|
|
150
|
+
"@cosyte/ncpdp": "^0.1.0",
|
|
151
|
+
"@cosyte/transform": "^0.1.0",
|
|
152
|
+
"@cosyte/x12": "^0.1.0",
|
|
106
153
|
"@modelcontextprotocol/sdk": "1.29.0"
|
|
107
|
-
},
|
|
108
|
-
"scripts": {
|
|
109
|
-
"build": "tsup",
|
|
110
|
-
"changeset": "changeset",
|
|
111
|
-
"typecheck": "tsc --noEmit",
|
|
112
|
-
"phi-scan": "tsx scripts/phi-scan.ts",
|
|
113
|
-
"check:no-emdash": "bash scripts/check-no-emdash.sh",
|
|
114
|
-
"check:no-internal-refs": "bash scripts/check-no-internal-refs.sh",
|
|
115
|
-
"lint": "eslint \"src/**/*.ts\" \"scripts/**/*.ts\" \"test/**/*.ts\" --max-warnings=0 --no-error-on-unmatched-pattern",
|
|
116
|
-
"lint:fix": "eslint \"src/**/*.ts\" \"scripts/**/*.ts\" \"test/**/*.ts\" --fix --no-error-on-unmatched-pattern",
|
|
117
|
-
"format": "prettier --write \"src/**/*.{ts,md}\" \"test/**/*.ts\" \"scripts/**/*.{ts,mjs}\" \"*.{json,md,yml}\"",
|
|
118
|
-
"format:check": "prettier --check \"src/**/*.{ts,md}\" \"test/**/*.ts\" \"scripts/**/*.{ts,mjs}\" \"*.{json,md,yml}\"",
|
|
119
|
-
"test": "vitest run",
|
|
120
|
-
"test:watch": "vitest",
|
|
121
|
-
"test:coverage": "vitest run --coverage",
|
|
122
|
-
"test:fuzz": "vitest run test/fuzz.property.test.ts",
|
|
123
|
-
"smoke": "node scripts/smoke.mjs",
|
|
124
|
-
"clean": "rm -rf dist coverage",
|
|
125
|
-
"vendor:refresh": "bash scripts/vendor-refresh.sh",
|
|
126
|
-
"pack:docs": "bash scripts/build-docs-artifacts.sh",
|
|
127
|
-
"attw": "node scripts/attw.mjs --profile node16",
|
|
128
|
-
"version": "changeset version && node scripts/sync-version.mjs && prettier --write package.json CHANGELOG.md src/core/version.ts",
|
|
129
|
-
"release": "changeset publish"
|
|
130
154
|
}
|
|
131
|
-
}
|
|
155
|
+
}
|
package/dist/io-B2EobRzC.d.cts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Input I/O for the CLI: read the bytes to operate on from a **file argument** or from **stdin**
|
|
5
|
-
* (`-`), with a value-free failure mode. The CLI never writes a temp file and never logs to a file;
|
|
6
|
-
* this module only *reads*.
|
|
7
|
-
*
|
|
8
|
-
* The reader functions are injected into the command layer as {@link RunDeps} so the whole dispatch
|
|
9
|
-
* path is testable without touching `process`: the real `process.stdin` wiring lives in the thin
|
|
10
|
-
* `bin` entry.
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The injectable input side-effects the dispatcher needs. Kept tiny and pure-ish so tests drive the
|
|
17
|
-
* CLI end to end with in-memory fakes and no real filesystem or stdin.
|
|
18
|
-
*/
|
|
19
|
-
interface RunDeps {
|
|
20
|
-
/** Read a file's bytes, or raise a `CLI_NO_INPUT` {@link CliError} if it cannot be read. */
|
|
21
|
-
readonly readFile: (path: string) => Promise<Uint8Array>;
|
|
22
|
-
/** Read all of stdin's bytes. */
|
|
23
|
-
readonly readStdin: () => Promise<Uint8Array>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Read a file into bytes, mapping any read failure to a **value-free** `CLI_NO_INPUT` /
|
|
27
|
-
* {@link EXIT.NOINPUT} error. The path is structural context (the user supplied it), so it may appear
|
|
28
|
-
* in the message; the file *contents* never do.
|
|
29
|
-
*
|
|
30
|
-
* @param path - The file path to read.
|
|
31
|
-
* @returns The file bytes.
|
|
32
|
-
* @throws {CliError} `CLI_NO_INPUT` (exit `66`) when the file is missing, a directory, or unreadable.
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts throws
|
|
35
|
-
* import { readFileBytes } from "@cosyte/cli";
|
|
36
|
-
*
|
|
37
|
-
* await readFileBytes("/no/such/file"); // throws CliError CLI_NO_INPUT
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
declare function readFileBytes(path: string): Promise<Uint8Array>;
|
|
41
|
-
/**
|
|
42
|
-
* Drain a readable stream (e.g. `process.stdin`) into a single byte buffer.
|
|
43
|
-
*
|
|
44
|
-
* @param stream - The readable stream to drain.
|
|
45
|
-
* @returns The concatenated bytes.
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* import { Readable } from "node:stream";
|
|
49
|
-
* import { readStreamBytes } from "@cosyte/cli";
|
|
50
|
-
*
|
|
51
|
-
* const bytes = await readStreamBytes(Readable.from([Buffer.from("MSH|")]));
|
|
52
|
-
* bytes.length; // => 4
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
declare function readStreamBytes(stream: Readable): Promise<Uint8Array>;
|
|
56
|
-
|
|
57
|
-
export { type RunDeps as R, readStreamBytes as a, readFileBytes as r };
|
package/dist/io-B2EobRzC.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Input I/O for the CLI: read the bytes to operate on from a **file argument** or from **stdin**
|
|
5
|
-
* (`-`), with a value-free failure mode. The CLI never writes a temp file and never logs to a file;
|
|
6
|
-
* this module only *reads*.
|
|
7
|
-
*
|
|
8
|
-
* The reader functions are injected into the command layer as {@link RunDeps} so the whole dispatch
|
|
9
|
-
* path is testable without touching `process`: the real `process.stdin` wiring lives in the thin
|
|
10
|
-
* `bin` entry.
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The injectable input side-effects the dispatcher needs. Kept tiny and pure-ish so tests drive the
|
|
17
|
-
* CLI end to end with in-memory fakes and no real filesystem or stdin.
|
|
18
|
-
*/
|
|
19
|
-
interface RunDeps {
|
|
20
|
-
/** Read a file's bytes, or raise a `CLI_NO_INPUT` {@link CliError} if it cannot be read. */
|
|
21
|
-
readonly readFile: (path: string) => Promise<Uint8Array>;
|
|
22
|
-
/** Read all of stdin's bytes. */
|
|
23
|
-
readonly readStdin: () => Promise<Uint8Array>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Read a file into bytes, mapping any read failure to a **value-free** `CLI_NO_INPUT` /
|
|
27
|
-
* {@link EXIT.NOINPUT} error. The path is structural context (the user supplied it), so it may appear
|
|
28
|
-
* in the message; the file *contents* never do.
|
|
29
|
-
*
|
|
30
|
-
* @param path - The file path to read.
|
|
31
|
-
* @returns The file bytes.
|
|
32
|
-
* @throws {CliError} `CLI_NO_INPUT` (exit `66`) when the file is missing, a directory, or unreadable.
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts throws
|
|
35
|
-
* import { readFileBytes } from "@cosyte/cli";
|
|
36
|
-
*
|
|
37
|
-
* await readFileBytes("/no/such/file"); // throws CliError CLI_NO_INPUT
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
declare function readFileBytes(path: string): Promise<Uint8Array>;
|
|
41
|
-
/**
|
|
42
|
-
* Drain a readable stream (e.g. `process.stdin`) into a single byte buffer.
|
|
43
|
-
*
|
|
44
|
-
* @param stream - The readable stream to drain.
|
|
45
|
-
* @returns The concatenated bytes.
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* import { Readable } from "node:stream";
|
|
49
|
-
* import { readStreamBytes } from "@cosyte/cli";
|
|
50
|
-
*
|
|
51
|
-
* const bytes = await readStreamBytes(Readable.from([Buffer.from("MSH|")]));
|
|
52
|
-
* bytes.length; // => 4
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
declare function readStreamBytes(stream: Readable): Promise<Uint8Array>;
|
|
56
|
-
|
|
57
|
-
export { type RunDeps as R, readStreamBytes as a, readFileBytes as r };
|