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