@kaddo/mcp 3.112.1 → 3.112.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 +38 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17319,6 +17319,25 @@ ${body}`);
|
|
|
17319
17319
|
${out.join("\n\n")}
|
|
17320
17320
|
`.replace(/\n{3,}/g, "\n\n");
|
|
17321
17321
|
}
|
|
17322
|
+
function importedBody(title, type, sourceBody) {
|
|
17323
|
+
const lines = sourceBody.split(/\r?\n/);
|
|
17324
|
+
let i = 0;
|
|
17325
|
+
while (i < lines.length && !lines[i].trim()) i++;
|
|
17326
|
+
if (i < lines.length && /^#\s+/.test(lines[i])) {
|
|
17327
|
+
i++;
|
|
17328
|
+
while (i < lines.length && !lines[i].trim()) i++;
|
|
17329
|
+
if (i < lines.length && /^>\s*Type:/i.test(lines[i])) i++;
|
|
17330
|
+
}
|
|
17331
|
+
const rest = lines.slice(i).join("\n").trim();
|
|
17332
|
+
const preamble = `# ${title}
|
|
17333
|
+
|
|
17334
|
+
> Type: ${type}`;
|
|
17335
|
+
return rest ? `${preamble}
|
|
17336
|
+
|
|
17337
|
+
${rest}
|
|
17338
|
+
` : `${preamble}
|
|
17339
|
+
`;
|
|
17340
|
+
}
|
|
17322
17341
|
function serialize(data, body) {
|
|
17323
17342
|
return matter82.stringify(`
|
|
17324
17343
|
${body.trim()}
|
|
@@ -17353,6 +17372,7 @@ function createWorkItem(dir, opts) {
|
|
|
17353
17372
|
if (!type) throw new WorkItemWriteError("INVALID_INPUT", `Unknown Work Item type "${opts.type}".`);
|
|
17354
17373
|
const id = nextWorkItemId(dir);
|
|
17355
17374
|
const title = intent.split(/\r?\n/)[0].trim().slice(0, 120);
|
|
17375
|
+
const summary = opts.summary?.trim() ? opts.summary.trim() : intent;
|
|
17356
17376
|
const today22 = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
17357
17377
|
const source = opts.source ? { ...opts.source, inferred: false } : { type: "manual", inferred: false };
|
|
17358
17378
|
const data = {
|
|
@@ -17365,12 +17385,12 @@ function createWorkItem(dir, opts) {
|
|
|
17365
17385
|
source,
|
|
17366
17386
|
generated_by: "kaddo-admin",
|
|
17367
17387
|
affected_modules: [],
|
|
17368
|
-
summary
|
|
17388
|
+
summary
|
|
17369
17389
|
};
|
|
17370
17390
|
if (opts.originalSnapshot) data.original_snapshot = opts.originalSnapshot;
|
|
17371
17391
|
const answers = opts.answers ?? {};
|
|
17372
17392
|
const hasAnswers = Object.values(answers).some((v) => v?.trim());
|
|
17373
|
-
const body = hasAnswers ? captureBody(title, type, answers) : freshBody({
|
|
17393
|
+
const body = opts.body?.trim() ? importedBody(title, type, opts.body) : hasAnswers ? captureBody(title, type, answers) : freshBody({
|
|
17374
17394
|
title,
|
|
17375
17395
|
type,
|
|
17376
17396
|
summary: intent,
|
|
@@ -18103,7 +18123,7 @@ function parseContent(raw) {
|
|
|
18103
18123
|
const title = extractTitle(frontmatterFields, bodyText);
|
|
18104
18124
|
const candidateType = extractType(frontmatterFields);
|
|
18105
18125
|
const sections = extractSections(bodyText);
|
|
18106
|
-
const summary = bodyText
|
|
18126
|
+
const summary = deriveSummary(bodyText, title);
|
|
18107
18127
|
return {
|
|
18108
18128
|
format,
|
|
18109
18129
|
title,
|
|
@@ -18123,6 +18143,16 @@ function extractTitle(fields, body) {
|
|
|
18123
18143
|
const firstLine = body.split(/\r?\n/).find((l2) => l2.trim());
|
|
18124
18144
|
return (firstLine?.trim() ?? "Untitled Work Item").slice(0, 120);
|
|
18125
18145
|
}
|
|
18146
|
+
function deriveSummary(body, title) {
|
|
18147
|
+
for (const line of body.split(/\r?\n/)) {
|
|
18148
|
+
const t = line.trim();
|
|
18149
|
+
if (!t) continue;
|
|
18150
|
+
if (/^#{1,6}\s/.test(t)) continue;
|
|
18151
|
+
if (/^>/.test(t)) continue;
|
|
18152
|
+
return t.slice(0, 280);
|
|
18153
|
+
}
|
|
18154
|
+
return title;
|
|
18155
|
+
}
|
|
18126
18156
|
function extractType(fields) {
|
|
18127
18157
|
const raw = typeof fields.work_type === "string" && fields.work_type.trim() ? fields.work_type.trim() : typeof fields.type === "string" && fields.type.trim() && fields.type !== "work-item" ? fields.type.trim() : void 0;
|
|
18128
18158
|
if (!raw) return void 0;
|
|
@@ -18160,6 +18190,7 @@ function normalizeImportFields(parsed, opts) {
|
|
|
18160
18190
|
const intent = parsed.body && parsed.body !== parsed.title ? `${parsed.title}
|
|
18161
18191
|
|
|
18162
18192
|
${parsed.body}` : parsed.title;
|
|
18193
|
+
const body = parsed.body && parsed.body.trim() !== parsed.title.trim() ? parsed.body : void 0;
|
|
18163
18194
|
const source = {
|
|
18164
18195
|
type: opts.importSource === "chat" ? "chat" : "external",
|
|
18165
18196
|
imported_at: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
|
|
@@ -18174,7 +18205,7 @@ ${parsed.body}` : parsed.title;
|
|
|
18174
18205
|
const labels = parsed.candidateFields.labels.filter((l2) => typeof l2 === "string");
|
|
18175
18206
|
if (labels.length > 0) snapshot.labels = labels;
|
|
18176
18207
|
}
|
|
18177
|
-
return { type, intent, source, snapshot, discardedFields };
|
|
18208
|
+
return { type, intent, summary: parsed.summary, body, source, snapshot, discardedFields };
|
|
18178
18209
|
}
|
|
18179
18210
|
function computeContentHash(raw) {
|
|
18180
18211
|
return crypto3.createHash("sha256").update(raw.trim(), "utf-8").digest("hex");
|
|
@@ -18261,7 +18292,9 @@ function importWorkItem(dir, opts) {
|
|
|
18261
18292
|
intent: normalized.intent,
|
|
18262
18293
|
type: normalized.type,
|
|
18263
18294
|
source: normalized.source,
|
|
18264
|
-
originalSnapshot: normalized.snapshot
|
|
18295
|
+
originalSnapshot: normalized.snapshot,
|
|
18296
|
+
summary: normalized.summary,
|
|
18297
|
+
body: normalized.body
|
|
18265
18298
|
});
|
|
18266
18299
|
let refinementHandoff;
|
|
18267
18300
|
try {
|
package/package.json
CHANGED