@mcoda/core 0.1.16 → 0.1.18
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/services/backlog/TaskOrderingService.d.ts.map +1 -1
- package/dist/services/backlog/TaskOrderingService.js +26 -2
- package/dist/services/execution/WorkOnTasksService.d.ts.map +1 -1
- package/dist/services/execution/WorkOnTasksService.js +167 -5
- package/dist/services/planning/CreateTasksService.d.ts +18 -0
- package/dist/services/planning/CreateTasksService.d.ts.map +1 -1
- package/dist/services/planning/CreateTasksService.js +878 -8
- package/dist/services/planning/RefineTasksService.d.ts.map +1 -1
- package/dist/services/planning/RefineTasksService.js +17 -4
- package/dist/services/shared/ProjectGuidance.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefineTasksService.d.ts","sourceRoot":"","sources":["../../../src/services/planning/RefineTasksService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAA6C,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC7G,OAAO,EAIL,kBAAkB,EAClB,iBAAiB,EAKlB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAKrE,UAAU,kBAAmB,SAAQ,kBAAkB;IACrD,SAAS,EAAE,mBAAmB,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,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AO,CAAC,iBAAiB,CAAC;CAma3E"}
|
|
@@ -20,6 +20,7 @@ const normalizeCreateStatus = (status) => {
|
|
|
20
20
|
};
|
|
21
21
|
const DEFAULT_MAX_TASKS = 250;
|
|
22
22
|
const MAX_AGENT_OUTPUT_CHARS = 10000000;
|
|
23
|
+
const PLANNING_DOC_HINT_PATTERN = /(sds|pdr|rfp|requirements|architecture|openapi|swagger|design)/i;
|
|
23
24
|
const estimateTokens = (text) => Math.max(1, Math.ceil(text.length / 4));
|
|
24
25
|
const extractJson = (raw) => {
|
|
25
26
|
const fencedMatches = [...raw.matchAll(/```json([\s\S]*?)```/g)].map((match) => match[1]);
|
|
@@ -583,6 +584,7 @@ export class RefineTasksService {
|
|
|
583
584
|
"- Splits: children stay under same story; keep parent unless keepParent=false; child dependsOn must reference existing tasks or siblings.",
|
|
584
585
|
"- Merges: target and sources must be in same story; prefer cancelling redundant sources (status=cancelled) and preserve useful details in target updates.",
|
|
585
586
|
"- Dependencies: maintain DAG; do not introduce cycles or cross-story edges.",
|
|
587
|
+
"- Enrichment focus: strengthen task descriptions with concrete implementation scope, expected files/modules, and actionable validation details.",
|
|
586
588
|
"- Story points: non-negative, keep within typical agile range (0-13).",
|
|
587
589
|
"- Do not invent new epics/stories or change parentage.",
|
|
588
590
|
].join("\n");
|
|
@@ -608,20 +610,30 @@ export class RefineTasksService {
|
|
|
608
610
|
const warnings = [];
|
|
609
611
|
const startedAt = Date.now();
|
|
610
612
|
try {
|
|
611
|
-
const
|
|
613
|
+
const query = [epicKey, storyKey, "sds requirements architecture"].filter(Boolean).join(" ");
|
|
614
|
+
let docs = await this.docdex.search({
|
|
612
615
|
projectKey,
|
|
613
616
|
profile: "sds",
|
|
614
|
-
query
|
|
617
|
+
query,
|
|
615
618
|
});
|
|
619
|
+
if (!docs || docs.length === 0) {
|
|
620
|
+
docs = await this.docdex.search({
|
|
621
|
+
projectKey,
|
|
622
|
+
profile: "workspace-code",
|
|
623
|
+
query,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
616
626
|
if (!docs || docs.length === 0) {
|
|
617
627
|
return { summary: "(no relevant docdex entries)", warnings: [] };
|
|
618
628
|
}
|
|
619
629
|
const top = docs
|
|
620
630
|
.filter((doc) => {
|
|
621
631
|
const type = (doc.docType ?? "").toLowerCase();
|
|
622
|
-
|
|
632
|
+
const pathTitle = `${doc.path ?? ""} ${doc.title ?? ""}`.toLowerCase();
|
|
633
|
+
return type.includes("sds") || type.includes("pdr") || type.includes("rfp") || PLANNING_DOC_HINT_PATTERN.test(pathTitle);
|
|
623
634
|
})
|
|
624
635
|
.slice(0, 5);
|
|
636
|
+
const selected = top.length > 0 ? top : docs.slice(0, 5);
|
|
625
637
|
const summary = top
|
|
626
638
|
.map((doc) => {
|
|
627
639
|
const segments = (doc.segments ?? []).slice(0, 3);
|
|
@@ -635,6 +647,7 @@ export class RefineTasksService {
|
|
|
635
647
|
return [`- [${doc.docType}] ${doc.title ?? doc.path ?? doc.id}${head ? ` — ${head}` : ""}`, segText].filter(Boolean).join("\n");
|
|
636
648
|
})
|
|
637
649
|
.join("\n");
|
|
650
|
+
const finalSummary = (summary || (selected.length ? selected.map((doc) => `- ${doc.title ?? doc.path ?? doc.id}`).join("\n") : "")).trim();
|
|
638
651
|
const durationSeconds = (Date.now() - startedAt) / 1000;
|
|
639
652
|
await this.jobService.recordTokenUsage({
|
|
640
653
|
workspaceId: this.workspace.workspaceId,
|
|
@@ -649,7 +662,7 @@ export class RefineTasksService {
|
|
|
649
662
|
timestamp: new Date().toISOString(),
|
|
650
663
|
metadata: { command: "refine-tasks", action: "docdex_search", projectKey, epicKey, storyKey },
|
|
651
664
|
});
|
|
652
|
-
return { summary:
|
|
665
|
+
return { summary: finalSummary || "(no doc segments found)", warnings };
|
|
653
666
|
}
|
|
654
667
|
catch (error) {
|
|
655
668
|
warnings.push(`Docdex lookup failed: ${error.message}`);
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { PathHelper } from "@mcoda/shared";
|
|
4
4
|
const QA_DOC_PATTERN = /(^|[\\/])(qa|e2e)([-_/]|$)/i;
|
|
5
5
|
const MCODA_DOC_PATTERN = /(^|[\\/])\.mcoda([\\/]|$)/i;
|
|
6
|
-
const SDS_DOC_PATTERN = /(^|[\\/])docs[\\/]+sds([\\/]
|
|
6
|
+
const SDS_DOC_PATTERN = /(^|[\\/])docs[\\/]+sds([\\/]|\.|$)/i;
|
|
7
7
|
const FRONTMATTER_BLOCK = /^---[\s\S]*?\n---/;
|
|
8
8
|
const DEFAULT_PROJECT_GUIDANCE_TEMPLATE = [
|
|
9
9
|
"# Project Guidance",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcoda/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Core services and APIs for the mcoda CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
34
34
|
"yaml": "^2.4.2",
|
|
35
|
-
"@mcoda/db": "0.1.
|
|
36
|
-
"@mcoda/
|
|
37
|
-
"@mcoda/
|
|
38
|
-
"@mcoda/
|
|
39
|
-
"@mcoda/
|
|
35
|
+
"@mcoda/db": "0.1.18",
|
|
36
|
+
"@mcoda/agents": "0.1.18",
|
|
37
|
+
"@mcoda/integrations": "0.1.18",
|
|
38
|
+
"@mcoda/generators": "0.1.18",
|
|
39
|
+
"@mcoda/shared": "0.1.18"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsc -p tsconfig.json",
|