@cosyte/cli 0.0.2 → 0.0.3
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 +117 -0
- package/README.md +60 -38
- package/dist/bin/cosyte-mcp.cjs +18 -11
- package/dist/bin/cosyte-mcp.cjs.map +1 -1
- package/dist/bin/cosyte-mcp.mjs +18 -11
- package/dist/bin/cosyte-mcp.mjs.map +1 -1
- package/dist/bin/cosyte.cjs +22 -14
- package/dist/bin/cosyte.cjs.map +1 -1
- package/dist/bin/cosyte.mjs +22 -14
- package/dist/bin/cosyte.mjs.map +1 -1
- package/dist/index.cjs +20 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -6
- package/dist/index.d.ts +40 -6
- package/dist/index.mjs +20 -13
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.cjs +18 -11
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.mjs +18 -11
- package/dist/mcp.mjs.map +1 -1
- package/package.json +13 -13
package/dist/mcp.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ import 'node:stream';
|
|
|
20
20
|
/** The MCP server identity advertised to a client on connect. */
|
|
21
21
|
declare const SERVER_INFO: {
|
|
22
22
|
readonly name: "cosyte";
|
|
23
|
-
readonly version:
|
|
23
|
+
readonly version: string;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Build the cosyte MCP {@link Server} with its two request handlers wired to the shared tool surface:
|
package/dist/mcp.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import 'node:stream';
|
|
|
20
20
|
/** The MCP server identity advertised to a client on connect. */
|
|
21
21
|
declare const SERVER_INFO: {
|
|
22
22
|
readonly name: "cosyte";
|
|
23
|
-
readonly version:
|
|
23
|
+
readonly version: string;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Build the cosyte MCP {@link Server} with its two request handlers wired to the shared tool surface:
|
package/dist/mcp.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { parseArgs } from 'util';
|
|
|
6
6
|
// src/mcp/server.ts
|
|
7
7
|
|
|
8
8
|
// src/core/version.ts
|
|
9
|
-
var VERSION = "0.0.
|
|
9
|
+
var VERSION = "0.0.3";
|
|
10
10
|
|
|
11
11
|
// src/core/exit-codes.ts
|
|
12
12
|
var EXIT = {
|
|
@@ -227,19 +227,25 @@ function anyError(findings) {
|
|
|
227
227
|
return findings.some((f) => ERROR_SEVERITIES.has(f.severity));
|
|
228
228
|
}
|
|
229
229
|
async function loadOptional(format, load) {
|
|
230
|
+
return loadOptionalPackage(
|
|
231
|
+
`the @cosyte/${format} parser is not installed; install it to use this format (it is an optional dependency)`,
|
|
232
|
+
load
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
async function loadOptionalPackage(detail, load) {
|
|
230
236
|
try {
|
|
231
237
|
return await load();
|
|
232
238
|
} catch (e) {
|
|
233
239
|
if (isModuleNotFound(e)) {
|
|
234
|
-
throw new CliError(
|
|
235
|
-
CLI_CODES.CLI_PARSER_UNAVAILABLE,
|
|
236
|
-
EXIT.UNAVAILABLE,
|
|
237
|
-
`the @cosyte/${format} parser is not installed; install it to use this format (it is an optional dependency)`
|
|
238
|
-
);
|
|
240
|
+
throw new CliError(CLI_CODES.CLI_PARSER_UNAVAILABLE, EXIT.UNAVAILABLE, detail);
|
|
239
241
|
}
|
|
240
242
|
throw e;
|
|
241
243
|
}
|
|
242
244
|
}
|
|
245
|
+
var FHIR_UNAVAILABLE = "the @cosyte/fhir parser is not installed, and it is not currently on the npm registry, so it cannot be installed from there; FHIR support is unavailable in this install";
|
|
246
|
+
async function loadFhir() {
|
|
247
|
+
return loadOptionalPackage(FHIR_UNAVAILABLE, () => import('@cosyte/fhir'));
|
|
248
|
+
}
|
|
243
249
|
function isModuleNotFound(e) {
|
|
244
250
|
if (typeof e !== "object" || e === null) return false;
|
|
245
251
|
const code = "code" in e ? e.code : void 0;
|
|
@@ -258,7 +264,7 @@ async function parseFormat(format, bytes) {
|
|
|
258
264
|
};
|
|
259
265
|
}
|
|
260
266
|
case "fhir": {
|
|
261
|
-
const { parseResource, serializeResource } = await
|
|
267
|
+
const { parseResource, serializeResource } = await loadFhir();
|
|
262
268
|
const text = decode(bytes);
|
|
263
269
|
const { resource, issues } = parseResource(text);
|
|
264
270
|
const model = JSON.parse(serializeResource(resource));
|
|
@@ -319,7 +325,7 @@ async function inspectFormat(format, bytes) {
|
|
|
319
325
|
};
|
|
320
326
|
}
|
|
321
327
|
case "fhir": {
|
|
322
|
-
const { parseResource, resourceType, readBundle } = await
|
|
328
|
+
const { parseResource, resourceType, readBundle } = await loadFhir();
|
|
323
329
|
const { resource, issues } = parseResource(decode(bytes));
|
|
324
330
|
const rt = resourceType(resource) ?? null;
|
|
325
331
|
if (rt === "Bundle") {
|
|
@@ -424,7 +430,7 @@ async function inspectFormat(format, bytes) {
|
|
|
424
430
|
async function validateFormat(format, bytes) {
|
|
425
431
|
switch (format) {
|
|
426
432
|
case "fhir": {
|
|
427
|
-
const { parseResource, validateResource } = await
|
|
433
|
+
const { parseResource, validateResource } = await loadFhir();
|
|
428
434
|
const { resource, issues } = parseResource(decode(bytes));
|
|
429
435
|
const validation = validateResource(resource);
|
|
430
436
|
const findings = [
|
|
@@ -672,11 +678,12 @@ async function convertCommand(args, deps, posture = VALUE_FREE) {
|
|
|
672
678
|
return { stdout: `${conversion.bundleText}
|
|
673
679
|
`, stderr, exit };
|
|
674
680
|
}
|
|
681
|
+
var TRANSFORM_UNAVAILABLE = "the @cosyte/transform conversion library is not installed, so convert is unavailable; it requires @cosyte/fhir, which is not currently on the npm registry, so npm skips transform as an unresolvable optional dependency and installing it directly fails for the same reason";
|
|
675
682
|
async function runConvert(bytes, posture) {
|
|
676
683
|
const [{ parseHL7 }, { toFhir }, { serializeResource }] = await Promise.all([
|
|
677
684
|
import('@cosyte/hl7'),
|
|
678
|
-
import('@cosyte/transform'),
|
|
679
|
-
|
|
685
|
+
loadOptionalPackage(TRANSFORM_UNAVAILABLE, () => import('@cosyte/transform')),
|
|
686
|
+
loadFhir()
|
|
680
687
|
]);
|
|
681
688
|
let msg;
|
|
682
689
|
try {
|