clef-mcp 0.1.0 → 0.1.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/README.md +1 -1
- package/dist/cli.js +21 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ Ready-made snippets live in [`examples/`](examples/).
|
|
|
104
104
|
|
|
105
105
|
| Type | Criteria | Meaning |
|
|
106
106
|
|------|----------|---------|
|
|
107
|
-
| `choice` | map of `option id → description
|
|
107
|
+
| `choice` | map of `option id → description`, or a plain list of options (ids = the strings) | Pick among named options |
|
|
108
108
|
| `score` | ordered list of descriptions | Ordered scale (index = score) |
|
|
109
109
|
| `noul` | optional `{"true": "...", "false": "..."}` | Yes/no question |
|
|
110
110
|
|
package/dist/cli.js
CHANGED
|
@@ -74,7 +74,9 @@ function toSystemOneRequest(input, defaultModel) {
|
|
|
74
74
|
const questions = {};
|
|
75
75
|
for (const [qid, q] of Object.entries(input.questions)) {
|
|
76
76
|
const question = { type: q.type, instructions: q.instructions };
|
|
77
|
-
if (q.criteria !== void 0)
|
|
77
|
+
if (q.criteria !== void 0) {
|
|
78
|
+
question.criteria = q.type === "choice" && Array.isArray(q.criteria) ? Object.fromEntries(q.criteria.map((c) => [c, c])) : q.criteria;
|
|
79
|
+
}
|
|
78
80
|
questions[qid] = question;
|
|
79
81
|
}
|
|
80
82
|
return {
|
|
@@ -804,14 +806,23 @@ import { z } from "zod";
|
|
|
804
806
|
function criteriaDescription(limits) {
|
|
805
807
|
return z.string().min(1).max(limits.maxCriteriaDescChars);
|
|
806
808
|
}
|
|
809
|
+
function countIssues(count, limits) {
|
|
810
|
+
if (count === 0) return "criteria must not be empty";
|
|
811
|
+
if (count > limits.maxCriteriaPerQuestion) return `too many criteria (max ${limits.maxCriteriaPerQuestion})`;
|
|
812
|
+
return void 0;
|
|
813
|
+
}
|
|
807
814
|
function choiceCriteria(limits) {
|
|
808
|
-
return z.
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
ctx.issues.push({ code: "custom", message:
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
+
return z.union([
|
|
816
|
+
// Plain list: option ids equal to the strings themselves.
|
|
817
|
+
z.array(criteriaDescription(limits)).check((ctx) => {
|
|
818
|
+
const problem = countIssues(ctx.value.length, limits);
|
|
819
|
+
if (problem) ctx.issues.push({ code: "custom", message: problem, input: ctx.value });
|
|
820
|
+
}),
|
|
821
|
+
z.record(z.string().min(1).max(limits.maxCriteriaDescChars), criteriaDescription(limits)).check((ctx) => {
|
|
822
|
+
const problem = countIssues(Object.keys(ctx.value).length, limits);
|
|
823
|
+
if (problem) ctx.issues.push({ code: "custom", message: problem, input: ctx.value });
|
|
824
|
+
})
|
|
825
|
+
]);
|
|
815
826
|
}
|
|
816
827
|
function scoreCriteria(limits) {
|
|
817
828
|
return z.array(criteriaDescription(limits)).check((ctx) => {
|
|
@@ -832,7 +843,7 @@ function questionSchema(limits) {
|
|
|
832
843
|
if (!parsed.success) {
|
|
833
844
|
ctx.addIssue({
|
|
834
845
|
code: "custom",
|
|
835
|
-
message: `"choice" questions require non-empty criteria as a map of option id -> description (${parsed.error.issues[0]?.message ?? "invalid criteria"})`
|
|
846
|
+
message: `"choice" questions require non-empty criteria as a map of option id -> description, or a plain list of options (${parsed.error.issues[0]?.message ?? "invalid criteria"})`
|
|
836
847
|
});
|
|
837
848
|
}
|
|
838
849
|
} else if (q.type === "score") {
|
|
@@ -1736,7 +1747,7 @@ async function confirm(question, yes) {
|
|
|
1736
1747
|
}
|
|
1737
1748
|
|
|
1738
1749
|
// src/version.ts
|
|
1739
|
-
var VERSION = "0.1.
|
|
1750
|
+
var VERSION = "0.1.2";
|
|
1740
1751
|
|
|
1741
1752
|
// src/cli/install.ts
|
|
1742
1753
|
var OS_NAMES = {
|