@grainulation/mill 1.0.3 → 1.0.4
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/lib/serve-mcp.js +33 -0
- package/package.json +1 -1
package/lib/serve-mcp.js
CHANGED
|
@@ -130,6 +130,39 @@ async function toolConvert(dir, args) {
|
|
|
130
130
|
data.meta = data.sprint_meta;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// Merge claim content from claims.json when compilation.json lacks it.
|
|
134
|
+
// Older compilation.json files omitted the content field from resolved_claims.
|
|
135
|
+
const claimsNeedContent =
|
|
136
|
+
data.claims &&
|
|
137
|
+
data.claims.length > 0 &&
|
|
138
|
+
data.claims.some((c) => !c.content && !c.text);
|
|
139
|
+
if (claimsNeedContent) {
|
|
140
|
+
const claimsFile = path.join(dir, "claims.json");
|
|
141
|
+
if (fs.existsSync(claimsFile)) {
|
|
142
|
+
try {
|
|
143
|
+
const raw = JSON.parse(fs.readFileSync(claimsFile, "utf8"));
|
|
144
|
+
const fullClaims = raw.claims || [];
|
|
145
|
+
const contentMap = {};
|
|
146
|
+
for (const fc of fullClaims) {
|
|
147
|
+
if (fc.id && fc.content) contentMap[fc.id] = fc;
|
|
148
|
+
}
|
|
149
|
+
for (const claim of data.claims) {
|
|
150
|
+
if (!claim.content && !claim.text && contentMap[claim.id]) {
|
|
151
|
+
claim.content = contentMap[claim.id].content;
|
|
152
|
+
if (
|
|
153
|
+
contentMap[claim.id].confidence != null &&
|
|
154
|
+
claim.confidence == null
|
|
155
|
+
) {
|
|
156
|
+
claim.confidence = contentMap[claim.id].confidence;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch {
|
|
161
|
+
// Best-effort merge — if claims.json is unreadable, continue without content
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
133
166
|
// Run conversion
|
|
134
167
|
let result;
|
|
135
168
|
try {
|