ceddcozum 0.2.1 → 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.
- package/dist/index.js +86 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11562,31 +11562,55 @@ var klinefelterDataset = {
|
|
|
11562
11562
|
// ../src/data/penileData.ts
|
|
11563
11563
|
var PENILE_LENGTH_STATS = [
|
|
11564
11564
|
{ age: 4e-3, mean: 3.64, sd: 0.36 },
|
|
11565
|
+
// 0–3 days
|
|
11565
11566
|
{ age: 0.5, mean: 4.44, sd: 0.69 },
|
|
11566
|
-
|
|
11567
|
-
{ age:
|
|
11568
|
-
|
|
11569
|
-
{ age:
|
|
11570
|
-
|
|
11571
|
-
{ age:
|
|
11572
|
-
|
|
11573
|
-
{ age:
|
|
11574
|
-
|
|
11575
|
-
{ age:
|
|
11567
|
+
// 0–1 years
|
|
11568
|
+
{ age: 1.5, mean: 5.42, sd: 0.62 },
|
|
11569
|
+
// (1–2] years
|
|
11570
|
+
{ age: 2.5, mean: 5.66, sd: 0.73 },
|
|
11571
|
+
// (2–3] years
|
|
11572
|
+
{ age: 3.5, mean: 5.87, sd: 0.79 },
|
|
11573
|
+
// (3–4] years
|
|
11574
|
+
{ age: 4.5, mean: 6.33, sd: 0.56 },
|
|
11575
|
+
// (4–5] years
|
|
11576
|
+
{ age: 5.5, mean: 6.3, sd: 0.74 },
|
|
11577
|
+
// (5–6] years
|
|
11578
|
+
{ age: 6.5, mean: 6.46, sd: 0.68 },
|
|
11579
|
+
// (6–7] years
|
|
11580
|
+
{ age: 7.5, mean: 6.63, sd: 0.68 },
|
|
11581
|
+
// (7–8] years
|
|
11582
|
+
{ age: 8.5, mean: 6.72, sd: 0.8 },
|
|
11583
|
+
// (8–9] years
|
|
11584
|
+
{ age: 9.5, mean: 6.79, sd: 0.66 },
|
|
11585
|
+
// (9–10] years
|
|
11586
|
+
{ age: 10.5, mean: 6.85, sd: 0.81 }
|
|
11587
|
+
// (10–11] years
|
|
11576
11588
|
];
|
|
11577
11589
|
var PENILE_CIRCUMFERENCE_STATS = [
|
|
11578
11590
|
{ age: 4e-3, mean: 3.5, sd: 0.34 },
|
|
11591
|
+
// 0–3 days
|
|
11579
11592
|
{ age: 0.5, mean: 4.34, sd: 0.55 },
|
|
11580
|
-
|
|
11581
|
-
{ age:
|
|
11582
|
-
|
|
11583
|
-
{ age:
|
|
11584
|
-
|
|
11585
|
-
{ age:
|
|
11586
|
-
|
|
11587
|
-
{ age:
|
|
11588
|
-
|
|
11589
|
-
{ age:
|
|
11593
|
+
// 0–1 years
|
|
11594
|
+
{ age: 1.5, mean: 4.41, sd: 0.69 },
|
|
11595
|
+
// (1–2] years
|
|
11596
|
+
{ age: 2.5, mean: 4.51, sd: 0.61 },
|
|
11597
|
+
// (2–3] years
|
|
11598
|
+
{ age: 3.5, mean: 4.58, sd: 0.5 },
|
|
11599
|
+
// (3–4] years
|
|
11600
|
+
{ age: 4.5, mean: 4.77, sd: 0.52 },
|
|
11601
|
+
// (4–5] years
|
|
11602
|
+
{ age: 5.5, mean: 4.9, sd: 0.59 },
|
|
11603
|
+
// (5–6] years
|
|
11604
|
+
{ age: 6.5, mean: 4.83, sd: 0.6 },
|
|
11605
|
+
// (6–7] years
|
|
11606
|
+
{ age: 7.5, mean: 4.95, sd: 0.57 },
|
|
11607
|
+
// (7–8] years
|
|
11608
|
+
{ age: 8.5, mean: 4.95, sd: 0.49 },
|
|
11609
|
+
// (8–9] years
|
|
11610
|
+
{ age: 9.5, mean: 5.02, sd: 0.55 },
|
|
11611
|
+
// (9–10] years
|
|
11612
|
+
{ age: 10.5, mean: 5.19, sd: 0.64 }
|
|
11613
|
+
// (10–11] years
|
|
11590
11614
|
];
|
|
11591
11615
|
|
|
11592
11616
|
// ../src/data/penileDataset.ts
|
|
@@ -15747,7 +15771,9 @@ function isAgeInRange(age, range) {
|
|
|
15747
15771
|
const components = range.split(/[–-]/).map((s) => s.trim());
|
|
15748
15772
|
const startAge = parseFloat(components[0]);
|
|
15749
15773
|
const endAge = components.length > 1 ? parseFloat(components[1]) : startAge + 1;
|
|
15750
|
-
|
|
15774
|
+
const endStr = components[1]?.trim() || "";
|
|
15775
|
+
const effectiveEnd = /\.\d$/.test(endStr) && endStr.endsWith("9") ? endAge + 0.1 : endAge;
|
|
15776
|
+
return age >= startAge && age < effectiveEnd;
|
|
15751
15777
|
}
|
|
15752
15778
|
function getSdsLabel(index) {
|
|
15753
15779
|
const labels = ["-2 SD", "-1 SD", "Mean", "+1 SD", "+2 SD"];
|
|
@@ -27405,7 +27431,7 @@ function formatHuman(toolName, results, schema) {
|
|
|
27405
27431
|
if (r.altToolName && r.altArgs) {
|
|
27406
27432
|
const kvParts = Object.entries(r.altArgs).map(([k, v]) => `${k}=${v}`).join(" ");
|
|
27407
27433
|
lines.push(` ${dim("tip:")} ${r.value}`);
|
|
27408
|
-
lines.push(` ${dim("
|
|
27434
|
+
lines.push(` ${dim(" childmetrics")} ${r.altToolName} ${kvParts}`);
|
|
27409
27435
|
} else {
|
|
27410
27436
|
lines.push(` ${dim("tip:")} ${r.value}`);
|
|
27411
27437
|
}
|
|
@@ -27427,7 +27453,8 @@ var cyan2 = (s) => useColor2 ? `\x1B[36m${s}\x1B[0m` : s;
|
|
|
27427
27453
|
var green = (s) => useColor2 ? `\x1B[32m${s}\x1B[0m` : s;
|
|
27428
27454
|
var yellow2 = (s) => useColor2 ? `\x1B[33m${s}\x1B[0m` : s;
|
|
27429
27455
|
var magenta = (s) => useColor2 ? `\x1B[35m${s}\x1B[0m` : s;
|
|
27430
|
-
var VERSION = true ? "0.2.
|
|
27456
|
+
var VERSION = true ? "0.2.2" : "0.0.0-dev";
|
|
27457
|
+
var BIN = process.argv[1]?.replace(/.*[\\/]/, "").replace(/\.\w+$/, "") === "childmetrics" ? "childmetrics" : "childmetrics";
|
|
27431
27458
|
var visibleSchemas = chatToolSchemas;
|
|
27432
27459
|
function findMeta(schemaId) {
|
|
27433
27460
|
const mappedId = chatFunctionToMetadataId(schemaId);
|
|
@@ -27487,6 +27514,17 @@ function suggestTool(input) {
|
|
|
27487
27514
|
}
|
|
27488
27515
|
return best;
|
|
27489
27516
|
}
|
|
27517
|
+
function toolExample(toolName, schema) {
|
|
27518
|
+
const required = schema.function.parameters.required ?? [];
|
|
27519
|
+
const props = schema.function.parameters.properties;
|
|
27520
|
+
const parts = [];
|
|
27521
|
+
const keys = required.length > 0 ? required : Object.keys(props).slice(0, 2);
|
|
27522
|
+
for (const key of keys) {
|
|
27523
|
+
const prop = props[key] ?? { type: "string" };
|
|
27524
|
+
parts.push(`${key}=${exampleValue(key, prop)}`);
|
|
27525
|
+
}
|
|
27526
|
+
return `${BIN} ${toolName} ${parts.join(" ")}`;
|
|
27527
|
+
}
|
|
27490
27528
|
function exampleValue(key, prop) {
|
|
27491
27529
|
if (prop.enum) return prop.enum[0];
|
|
27492
27530
|
if (prop.type === "boolean") return "true";
|
|
@@ -27505,15 +27543,15 @@ function exampleValue(key, prop) {
|
|
|
27505
27543
|
}
|
|
27506
27544
|
function printHelp() {
|
|
27507
27545
|
console.log(`
|
|
27508
|
-
${bold2(
|
|
27546
|
+
${bold2(BIN)} v${VERSION} ${dim2("\u2014 Pediatric clinical calculators")}
|
|
27509
27547
|
|
|
27510
27548
|
${bold2("USAGE")}
|
|
27511
|
-
${cyan2(
|
|
27512
|
-
${cyan2(
|
|
27513
|
-
${cyan2(
|
|
27514
|
-
${cyan2(
|
|
27515
|
-
${cyan2(
|
|
27516
|
-
${cyan2(
|
|
27549
|
+
${cyan2(BIN)} <tool> key=value ... ${dim2("Run a calculator")}
|
|
27550
|
+
${cyan2(BIN)} <tool> ${dim2("Show parameters for a tool")}
|
|
27551
|
+
${cyan2(BIN)} --list ${dim2("List all available tools")}
|
|
27552
|
+
${cyan2(BIN)} <tool> --args '{"key":"val"}' ${dim2("Run with JSON args (for LLM agents)")}
|
|
27553
|
+
${cyan2(BIN)} <tool> --schema ${dim2("Show tool schema (OpenAI format)")}
|
|
27554
|
+
${cyan2(BIN)} --schemas ${dim2("Dump all schemas (for LLM agents)")}
|
|
27517
27555
|
|
|
27518
27556
|
${bold2("OPTIONS")}
|
|
27519
27557
|
--format human|json ${dim2("Output format (default: human)")}
|
|
@@ -27522,9 +27560,9 @@ ${bold2("OPTIONS")}
|
|
|
27522
27560
|
--version ${dim2("Show version")}
|
|
27523
27561
|
|
|
27524
27562
|
${bold2("EXAMPLES")}
|
|
27525
|
-
${dim2("$")}
|
|
27526
|
-
${dim2("$")}
|
|
27527
|
-
${dim2("$")}
|
|
27563
|
+
${dim2("$")} ${BIN} auxology sex=male age=5.5 height=110 weight=19
|
|
27564
|
+
${dim2("$")} ${BIN} hba1c hba1cPercent=7.5
|
|
27565
|
+
${dim2("$")} ${BIN} auxology --args '{"sex":"male","age":5.5}' --format json
|
|
27528
27566
|
|
|
27529
27567
|
${dim2("All calculations run locally \u2014 no API keys, no network requests.")}
|
|
27530
27568
|
`);
|
|
@@ -27541,7 +27579,7 @@ function printList() {
|
|
|
27541
27579
|
byCategory.get(category).push({ id: name, subtitle });
|
|
27542
27580
|
}
|
|
27543
27581
|
console.log(`
|
|
27544
|
-
${bold2(
|
|
27582
|
+
${bold2(BIN)} v${VERSION} ${dim2("\u2014 Pediatric clinical calculators")}
|
|
27545
27583
|
${dim2("All calculations run locally \u2014 no API keys, no network requests.")}
|
|
27546
27584
|
|
|
27547
27585
|
${cyan2(String(visibleSchemas.length))} tools available:
|
|
@@ -27567,9 +27605,9 @@ ${cyan2(String(visibleSchemas.length))} tools available:
|
|
|
27567
27605
|
console.log();
|
|
27568
27606
|
}
|
|
27569
27607
|
console.log(dim2(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
27570
|
-
console.log(` ${dim2("Run")} ${cyan2(
|
|
27571
|
-
console.log(` ${dim2("Run")} ${cyan2(
|
|
27572
|
-
console.log(` ${dim2("Example:")} ${cyan2(
|
|
27608
|
+
console.log(` ${dim2("Run")} ${cyan2(`${BIN} <tool>`)} ${dim2("to see parameters")}`);
|
|
27609
|
+
console.log(` ${dim2("Run")} ${cyan2(`${BIN} <tool> key=value ...`)} ${dim2("to calculate")}`);
|
|
27610
|
+
console.log(` ${dim2("Example:")} ${cyan2(`${BIN} auxology sex=male age=5.5 height=110 weight=19`)}`);
|
|
27573
27611
|
console.log();
|
|
27574
27612
|
}
|
|
27575
27613
|
function extractUnit(description) {
|
|
@@ -27583,7 +27621,7 @@ function printToolInfo(name) {
|
|
|
27583
27621
|
const schema = getSchemaByName(name);
|
|
27584
27622
|
if (!schema) {
|
|
27585
27623
|
console.error(`${yellow2("!")} Unknown tool: ${bold2(name)}`);
|
|
27586
|
-
console.error(` Run ${cyan2(
|
|
27624
|
+
console.error(` Run ${cyan2(`'${BIN} --list'`)} to see available tools.`);
|
|
27587
27625
|
process.exit(1);
|
|
27588
27626
|
}
|
|
27589
27627
|
const params = schema.function.parameters;
|
|
@@ -27604,19 +27642,14 @@ ${bold2(name)} ${dim2("\u2014 " + schema.function.description)}
|
|
|
27604
27642
|
}
|
|
27605
27643
|
console.log(`
|
|
27606
27644
|
${bold2("EXAMPLE")}`);
|
|
27607
|
-
|
|
27608
|
-
for (const key of required) {
|
|
27609
|
-
const prop = params.properties[key];
|
|
27610
|
-
exParts.push(`${key}=${exampleValue(key, prop ?? { type: "string" })}`);
|
|
27611
|
-
}
|
|
27612
|
-
console.log(` ${dim2("$")} ceddcozum ${name} ${exParts.join(" ")}`);
|
|
27645
|
+
console.log(` ${dim2("$")} ${toolExample(name, schema)}`);
|
|
27613
27646
|
console.log();
|
|
27614
27647
|
}
|
|
27615
27648
|
function printSchema(name) {
|
|
27616
27649
|
const schema = getSchemaByName(name);
|
|
27617
27650
|
if (!schema) {
|
|
27618
27651
|
console.error(`${yellow2("!")} Unknown tool: ${bold2(name)}`);
|
|
27619
|
-
console.error(` Run ${cyan2(
|
|
27652
|
+
console.error(` Run ${cyan2(`'${BIN} --list'`)} to see available tools.`);
|
|
27620
27653
|
process.exit(1);
|
|
27621
27654
|
}
|
|
27622
27655
|
console.log(JSON.stringify(schema, null, 2));
|
|
@@ -27656,7 +27689,9 @@ function parseKeyValueArgs(pairs, schema) {
|
|
|
27656
27689
|
const eqIdx = pair.indexOf("=");
|
|
27657
27690
|
if (eqIdx === -1) {
|
|
27658
27691
|
console.error(`${yellow2("!")} Invalid argument: ${bold2(pair)}`);
|
|
27659
|
-
|
|
27692
|
+
const firstKey = Object.keys(props)[0];
|
|
27693
|
+
const firstProp = props[firstKey] ?? { type: "string" };
|
|
27694
|
+
console.error(` Use ${cyan2("key=value")} format, e.g. ${dim2(`${firstKey}=${exampleValue(firstKey, firstProp)}`)}`);
|
|
27660
27695
|
process.exit(1);
|
|
27661
27696
|
}
|
|
27662
27697
|
const rawKey = pair.slice(0, eqIdx);
|
|
@@ -27693,7 +27728,7 @@ function runToolWithArgs(name, args, format, pipe) {
|
|
|
27693
27728
|
${yellow2("!")} Validation errors for ${bold2(name)}:`);
|
|
27694
27729
|
for (const e of errors) console.error(` ${yellow2("\u2022")} ${e}`);
|
|
27695
27730
|
console.error(`
|
|
27696
|
-
Run ${cyan2(`'
|
|
27731
|
+
Run ${cyan2(`'${BIN} ${name}'`)} to see parameter details.
|
|
27697
27732
|
`);
|
|
27698
27733
|
process.exit(1);
|
|
27699
27734
|
}
|
|
@@ -27740,7 +27775,7 @@ function main() {
|
|
|
27740
27775
|
return;
|
|
27741
27776
|
}
|
|
27742
27777
|
if (values.version) {
|
|
27743
|
-
console.log(
|
|
27778
|
+
console.log(`${BIN} v${VERSION}
|
|
27744
27779
|
Apache-2.0 \xA9 \xC7EDD / TSPED`);
|
|
27745
27780
|
return;
|
|
27746
27781
|
}
|
|
@@ -27773,7 +27808,7 @@ Apache-2.0 \xA9 \xC7EDD / TSPED`);
|
|
|
27773
27808
|
if (suggestion) {
|
|
27774
27809
|
console.error(` Did you mean ${cyan2(suggestion)}?`);
|
|
27775
27810
|
} else {
|
|
27776
|
-
console.error(` Run ${cyan2(
|
|
27811
|
+
console.error(` Run ${cyan2(`'${BIN} --list'`)} to see available tools.`);
|
|
27777
27812
|
}
|
|
27778
27813
|
process.exit(1);
|
|
27779
27814
|
}
|
|
@@ -27785,8 +27820,8 @@ Apache-2.0 \xA9 \xC7EDD / TSPED`);
|
|
|
27785
27820
|
const nonKvArgs = positionals.slice(1).filter((p) => !p.includes("="));
|
|
27786
27821
|
if (nonKvArgs.length > 0 && !values.args) {
|
|
27787
27822
|
console.error(`${yellow2("!")} Unexpected arguments: ${bold2(nonKvArgs.join(" "))}`);
|
|
27788
|
-
console.error(` Use ${cyan2("key=value")} format: ${dim2(
|
|
27789
|
-
console.error(` Run ${cyan2(`'
|
|
27823
|
+
console.error(` Use ${cyan2("key=value")} format: ${dim2(toolExample(toolName, schema))}`);
|
|
27824
|
+
console.error(` Run ${cyan2(`'${BIN} ${toolName}'`)} to see parameter names.`);
|
|
27790
27825
|
process.exit(1);
|
|
27791
27826
|
}
|
|
27792
27827
|
if (values.args) {
|