ai-dev-requirements 0.1.12 → 0.1.13
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.cjs +221 -48
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +215 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -11
package/dist/index.cjs
CHANGED
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,16 +20,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
let node_fs = require("node:fs");
|
|
30
25
|
let node_path = require("node:path");
|
|
31
26
|
let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
32
27
|
let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
33
28
|
let node_crypto = require("node:crypto");
|
|
34
|
-
node_crypto = __toESM(node_crypto);
|
|
29
|
+
node_crypto = __toESM(node_crypto, 1);
|
|
35
30
|
let zod_v4 = require("zod/v4");
|
|
36
|
-
|
|
37
31
|
//#region src/utils/map-status.ts
|
|
38
32
|
const ONES_STATUS_MAP = {
|
|
39
33
|
to_do: "open",
|
|
@@ -69,7 +63,6 @@ function mapOnesPriority(priority) {
|
|
|
69
63
|
function mapOnesType(type) {
|
|
70
64
|
return ONES_TYPE_MAP[type.toLowerCase()] ?? "task";
|
|
71
65
|
}
|
|
72
|
-
|
|
73
66
|
//#endregion
|
|
74
67
|
//#region src/adapters/base.ts
|
|
75
68
|
/**
|
|
@@ -86,7 +79,6 @@ var BaseAdapter = class {
|
|
|
86
79
|
this.resolvedAuth = resolvedAuth;
|
|
87
80
|
}
|
|
88
81
|
};
|
|
89
|
-
|
|
90
82
|
//#endregion
|
|
91
83
|
//#region src/adapters/ones.ts
|
|
92
84
|
const TASK_DETAIL_QUERY = `
|
|
@@ -120,6 +112,26 @@ const TASK_DETAIL_QUERY = `
|
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
`;
|
|
115
|
+
const RELATED_ACTIVITIES_QUERY = `
|
|
116
|
+
query Task($key: Key) {
|
|
117
|
+
task(key: $key) {
|
|
118
|
+
key
|
|
119
|
+
...RelatedActivities_task1
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
fragment RelatedActivities_task1 on Task {
|
|
124
|
+
relatedActivities {
|
|
125
|
+
uuid
|
|
126
|
+
name
|
|
127
|
+
projectUUID
|
|
128
|
+
project_uuid: projectUUID
|
|
129
|
+
relatedChild
|
|
130
|
+
related_child_uuid: relatedChild
|
|
131
|
+
}
|
|
132
|
+
relatedActivitiesCount
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
123
135
|
const SEARCH_TASKS_QUERY = `
|
|
124
136
|
query GROUP_TASK_DATA($groupBy: GroupBy, $groupOrderBy: OrderBy, $orderBy: OrderBy, $filterGroup: [Filter!], $search: Search, $pagination: Pagination, $limit: Int) {
|
|
125
137
|
buckets(groupBy: $groupBy, orderBy: $groupOrderBy, pagination: $pagination, filter: $search) {
|
|
@@ -352,7 +364,7 @@ function extractWikiPageUuidsFromText(text) {
|
|
|
352
364
|
return [...uuids];
|
|
353
365
|
}
|
|
354
366
|
function parseOnesWikiPageRoute(input) {
|
|
355
|
-
if (!input
|
|
367
|
+
if (!isOnesWikiUrlInput(input)) return null;
|
|
356
368
|
const match = (() => {
|
|
357
369
|
try {
|
|
358
370
|
const parsed = new URL(input);
|
|
@@ -360,7 +372,7 @@ function parseOnesWikiPageRoute(input) {
|
|
|
360
372
|
} catch {
|
|
361
373
|
return input;
|
|
362
374
|
}
|
|
363
|
-
})().match(/\/team\/([^/?#]+)\/space\/[^/?#]+\/page\/([^/?#]+)/);
|
|
375
|
+
})().match(/\/team\/([^/?#]+)\/(?:space\/[^/?#]+\/)?page\/([^/?#]+)/);
|
|
364
376
|
if (!match?.[1] || !match[2]) return null;
|
|
365
377
|
return {
|
|
366
378
|
teamUuid: decodeURIComponent(match[1]),
|
|
@@ -368,7 +380,7 @@ function parseOnesWikiPageRoute(input) {
|
|
|
368
380
|
};
|
|
369
381
|
}
|
|
370
382
|
function isOnesWikiUrlInput(input) {
|
|
371
|
-
return
|
|
383
|
+
return /\/wiki(?:\/|(?=[#?]|$))/.test(input);
|
|
372
384
|
}
|
|
373
385
|
function parseAuthorizeRequestId(location) {
|
|
374
386
|
try {
|
|
@@ -492,22 +504,126 @@ function renderWikiEmbed(block, context) {
|
|
|
492
504
|
function escapeWikiTableCell(value) {
|
|
493
505
|
return value.replace(/\|/g, "\\|").replace(/[ \t]*\n+[ \t]*/g, " ").trim();
|
|
494
506
|
}
|
|
507
|
+
function escapeWikiHtml(value) {
|
|
508
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
509
|
+
}
|
|
510
|
+
function parseWikiTableSpan(value) {
|
|
511
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return 1;
|
|
512
|
+
return Math.max(Math.trunc(value), 1);
|
|
513
|
+
}
|
|
514
|
+
function buildWikiTableLayout(block) {
|
|
515
|
+
const columnCount = typeof block.cols === "number" && block.cols > 0 ? Math.trunc(block.cols) : 0;
|
|
516
|
+
const children = Array.isArray(block.children) ? block.children.filter((child) => typeof child === "string") : [];
|
|
517
|
+
if (!columnCount || !children.length) return null;
|
|
518
|
+
const hasDeclaredRows = typeof block.rows === "number" && block.rows > 0;
|
|
519
|
+
const initialRowCount = hasDeclaredRows ? Math.trunc(block.rows) : Math.max(Math.ceil(children.length / columnCount), 1);
|
|
520
|
+
const occupied = [];
|
|
521
|
+
const rows = [];
|
|
522
|
+
const ensureRowCount = (count) => {
|
|
523
|
+
while (occupied.length < count) {
|
|
524
|
+
occupied.push(Array.from({ length: columnCount }).fill(false));
|
|
525
|
+
rows.push([]);
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
ensureRowCount(initialRowCount);
|
|
529
|
+
let cursor = 0;
|
|
530
|
+
let hasMergedCells = false;
|
|
531
|
+
for (const childId of children) {
|
|
532
|
+
while (true) {
|
|
533
|
+
const row = Math.floor(cursor / columnCount);
|
|
534
|
+
const column = cursor % columnCount;
|
|
535
|
+
ensureRowCount(row + 1);
|
|
536
|
+
if (!occupied[row][column]) break;
|
|
537
|
+
cursor += 1;
|
|
538
|
+
}
|
|
539
|
+
const row = Math.floor(cursor / columnCount);
|
|
540
|
+
const column = cursor % columnCount;
|
|
541
|
+
const requestedRowSpan = parseWikiTableSpan(block[`${childId}_rowSpan`]);
|
|
542
|
+
if (!hasDeclaredRows) ensureRowCount(row + requestedRowSpan);
|
|
543
|
+
const rowSpan = Math.min(requestedRowSpan, occupied.length - row);
|
|
544
|
+
const colSpan = Math.min(parseWikiTableSpan(block[`${childId}_colSpan`]), columnCount - column);
|
|
545
|
+
hasMergedCells ||= rowSpan > 1 || colSpan > 1;
|
|
546
|
+
rows[row].push({
|
|
547
|
+
childId,
|
|
548
|
+
row,
|
|
549
|
+
column,
|
|
550
|
+
rowSpan,
|
|
551
|
+
colSpan
|
|
552
|
+
});
|
|
553
|
+
for (let rowOffset = 0; rowOffset < rowSpan; rowOffset += 1) for (let columnOffset = 0; columnOffset < colSpan; columnOffset += 1) occupied[row + rowOffset][column + columnOffset] = true;
|
|
554
|
+
cursor += 1;
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
columnCount,
|
|
558
|
+
rows,
|
|
559
|
+
hasMergedCells
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function wikiCellContainsTable(value) {
|
|
563
|
+
return asWikiBlocks(value).some((block) => block.type === "table");
|
|
564
|
+
}
|
|
565
|
+
function renderWikiTextRunsHtml(value) {
|
|
566
|
+
if (!Array.isArray(value)) return "";
|
|
567
|
+
return value.map((run) => {
|
|
568
|
+
if (!isRecord(run)) return "";
|
|
569
|
+
const attributes = isRecord(run.attributes) ? run.attributes : {};
|
|
570
|
+
let content = escapeWikiHtml(typeof run.insert === "string" ? run.insert.replace(/\u00A0/g, " ") : "").replace(/\n/g, "<br>");
|
|
571
|
+
if (attributes.code) content = `<code>${content}</code>`;
|
|
572
|
+
if (attributes.bold) content = `<strong>${content}</strong>`;
|
|
573
|
+
if (attributes.italic) content = `<em>${content}</em>`;
|
|
574
|
+
if (attributes.underline) content = `<u>${content}</u>`;
|
|
575
|
+
if (attributes.strike) content = `<s>${content}</s>`;
|
|
576
|
+
const link = typeof attributes.link === "string" ? attributes.link : "";
|
|
577
|
+
return link ? `<a href="${escapeWikiHtml(link)}">${content}</a>` : content;
|
|
578
|
+
}).join("");
|
|
579
|
+
}
|
|
580
|
+
function renderWikiCellHtml(value, document, context) {
|
|
581
|
+
return asWikiBlocks(value).map((block) => renderWikiBlockHtml(block, document, context)).filter(Boolean).join("");
|
|
582
|
+
}
|
|
583
|
+
function renderWikiBlockHtml(block, document, context) {
|
|
584
|
+
if (block.type === "table") {
|
|
585
|
+
const layout = buildWikiTableLayout(block);
|
|
586
|
+
return layout ? renderWikiTableHtml(layout, document, context) : "";
|
|
587
|
+
}
|
|
588
|
+
if (block.type === "embed") return `<p>${escapeWikiHtml(renderWikiEmbed(block, context))}</p>`;
|
|
589
|
+
const text = renderWikiTextRunsHtml(block.text);
|
|
590
|
+
if (!text) return "";
|
|
591
|
+
if (block.type === "list") {
|
|
592
|
+
const tag = block.ordered ? "ol" : "ul";
|
|
593
|
+
return `<${tag}><li>${text}</li></${tag}>`;
|
|
594
|
+
}
|
|
595
|
+
if (block.heading) {
|
|
596
|
+
const level = Math.min(Math.max(Math.trunc(block.heading), 1), 6);
|
|
597
|
+
return `<h${level}>${text}</h${level}>`;
|
|
598
|
+
}
|
|
599
|
+
return `<p>${text}</p>`;
|
|
600
|
+
}
|
|
601
|
+
function renderWikiTableHtml(layout, document, context) {
|
|
602
|
+
return `<table>\n<tbody>\n${layout.rows.map((row) => {
|
|
603
|
+
return `<tr>\n${row.map((cell) => {
|
|
604
|
+
const attributes = [cell.rowSpan > 1 ? `rowspan="${cell.rowSpan}"` : "", cell.colSpan > 1 ? `colspan="${cell.colSpan}"` : ""].filter(Boolean);
|
|
605
|
+
const content = renderWikiCellHtml(document[cell.childId], document, context);
|
|
606
|
+
return `<td${attributes.length ? ` ${attributes.join(" ")}` : ""}>${content}</td>`;
|
|
607
|
+
}).join("\n")}\n</tr>`;
|
|
608
|
+
}).join("\n")}\n</tbody>\n</table>`;
|
|
609
|
+
}
|
|
495
610
|
function renderWikiCell(value, document, context) {
|
|
496
611
|
const blocks = asWikiBlocks(value);
|
|
497
612
|
if (!blocks.length) return "";
|
|
498
613
|
return blocks.map((block) => renderWikiBlock(block, document, context)).filter(Boolean).join(" ").replace(/[ \t]*\n+[ \t]*/g, " ").trim();
|
|
499
614
|
}
|
|
500
615
|
function renderWikiTable(block, document, context) {
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
616
|
+
const layout = buildWikiTableLayout(block);
|
|
617
|
+
if (!layout) return "";
|
|
618
|
+
const hasNestedTable = layout.rows.some((row) => row.some((cell) => wikiCellContainsTable(document[cell.childId])));
|
|
619
|
+
if (layout.hasMergedCells || hasNestedTable) return renderWikiTableHtml(layout, document, context);
|
|
504
620
|
const rows = [];
|
|
505
|
-
for (
|
|
506
|
-
const cells =
|
|
507
|
-
|
|
621
|
+
for (const row of layout.rows) {
|
|
622
|
+
const cells = Array.from({ length: layout.columnCount }).fill("");
|
|
623
|
+
for (const cell of row) cells[cell.column] = escapeWikiTableCell(renderWikiCell(document[cell.childId], document, context));
|
|
508
624
|
rows.push(`| ${cells.join(" | ")} |`);
|
|
509
625
|
}
|
|
510
|
-
if (rows.length > 1) rows.splice(1, 0, `| ${Array.from({ length:
|
|
626
|
+
if (rows.length > 1) rows.splice(1, 0, `| ${Array.from({ length: layout.columnCount }).fill("---").join(" | ")} |`);
|
|
511
627
|
return rows.join("\n");
|
|
512
628
|
}
|
|
513
629
|
function renderWikiBlock(block, document, context) {
|
|
@@ -730,6 +846,34 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
730
846
|
}
|
|
731
847
|
return response.json();
|
|
732
848
|
}
|
|
849
|
+
async onesql(query, variables, workItemType) {
|
|
850
|
+
const session = await this.login();
|
|
851
|
+
const url = `${this.config.apiBase}/project/api/ones-project/team/${session.teamUuid}/workitems/onesql`;
|
|
852
|
+
const response = await fetch(url, {
|
|
853
|
+
method: "POST",
|
|
854
|
+
headers: {
|
|
855
|
+
"Authorization": `Bearer ${session.accessToken}`,
|
|
856
|
+
"Content-Type": "application/json"
|
|
857
|
+
},
|
|
858
|
+
body: JSON.stringify({
|
|
859
|
+
query,
|
|
860
|
+
variables: [
|
|
861
|
+
variables,
|
|
862
|
+
workItemType,
|
|
863
|
+
null,
|
|
864
|
+
null
|
|
865
|
+
]
|
|
866
|
+
})
|
|
867
|
+
});
|
|
868
|
+
if (!response.ok) {
|
|
869
|
+
const text = await response.text().catch(() => "");
|
|
870
|
+
throw new Error(`ONES OneSQL error: ${response.status} ${text}`);
|
|
871
|
+
}
|
|
872
|
+
return response.json();
|
|
873
|
+
}
|
|
874
|
+
async fetchRelatedActivities(taskKey) {
|
|
875
|
+
return (await this.onesql(RELATED_ACTIVITIES_QUERY, { key: taskKey }, "Task")).data?.task?.relatedActivities ?? [];
|
|
876
|
+
}
|
|
733
877
|
async searchTaskByNumber(taskNumber) {
|
|
734
878
|
const session = await this.login();
|
|
735
879
|
const url = `${this.config.apiBase}/project/api/project/team/${session.teamUuid}/search?q=${encodeURIComponent(String(taskNumber))}&start=0&limit=10&types=task`;
|
|
@@ -759,7 +903,8 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
759
903
|
}
|
|
760
904
|
async fetchIssueTypes() {
|
|
761
905
|
if (this.issueTypesCache) return this.issueTypesCache;
|
|
762
|
-
|
|
906
|
+
const data = await this.graphql(ISSUE_TYPES_QUERY, { orderBy: { namePinyin: "ASC" } }, "issueTypes");
|
|
907
|
+
this.issueTypesCache = data.data?.issueTypes ?? [];
|
|
763
908
|
return this.issueTypesCache;
|
|
764
909
|
}
|
|
765
910
|
async fetchProjects() {
|
|
@@ -1020,8 +1165,10 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
1020
1165
|
}
|
|
1021
1166
|
if (isOnesWikiUrlInput(params.id)) throw new Error("ONES: Unsupported wiki page URL. Expected /wiki/#/team/{teamUuid}/space/{spaceUuid}/page/{wikiUuid}");
|
|
1022
1167
|
const taskRef = await this.resolveTaskRef(params.id);
|
|
1168
|
+
const shouldFetchRelatedActivities = parseDisplayId(params.id.trim()) !== null;
|
|
1023
1169
|
const task = (await this.graphql(TASK_DETAIL_QUERY, { key: taskRef.key }, "Task")).data?.task;
|
|
1024
1170
|
if (!task) throw new Error(`ONES: Task "${params.id}" not found`);
|
|
1171
|
+
const relatedActivities = shouldFetchRelatedActivities ? await this.fetchRelatedActivities(taskRef.key) : [];
|
|
1025
1172
|
const wikiRefs = /* @__PURE__ */ new Map();
|
|
1026
1173
|
for (const wiki of task.relatedWikiPages ?? []) if (!wiki.errorMessage) wikiRefs.set(wiki.uuid, {
|
|
1027
1174
|
title: wiki.title,
|
|
@@ -1062,6 +1209,18 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
1062
1209
|
parts.push(`- #${related.number} ${related.name} [${related.issueType?.name}] (${related.status?.name}) — ${assignee}`);
|
|
1063
1210
|
}
|
|
1064
1211
|
}
|
|
1212
|
+
if (relatedActivities.length) {
|
|
1213
|
+
parts.push("");
|
|
1214
|
+
parts.push("## Related Work Items");
|
|
1215
|
+
for (const activity of relatedActivities) {
|
|
1216
|
+
const details = [
|
|
1217
|
+
`UUID: ${activity.uuid}`,
|
|
1218
|
+
activity.projectUUID ? `Project: ${activity.projectUUID}` : null,
|
|
1219
|
+
activity.relatedChild ? `Relation: ${activity.relatedChild}` : null
|
|
1220
|
+
].filter(Boolean);
|
|
1221
|
+
parts.push(`- ${activity.name} (${details.join(", ")})`);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1065
1224
|
if (task.parent?.uuid) {
|
|
1066
1225
|
parts.push("");
|
|
1067
1226
|
parts.push("## Parent Task");
|
|
@@ -1092,7 +1251,12 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
1092
1251
|
parts.push(detailText);
|
|
1093
1252
|
}
|
|
1094
1253
|
const wikiAttachments = wikiContents.flatMap((wiki) => wiki.attachments);
|
|
1095
|
-
|
|
1254
|
+
const req = toRequirement(task, parts.join("\n"), wikiAttachments);
|
|
1255
|
+
req.raw = {
|
|
1256
|
+
...req.raw,
|
|
1257
|
+
relatedActivities
|
|
1258
|
+
};
|
|
1259
|
+
return req;
|
|
1096
1260
|
}
|
|
1097
1261
|
/**
|
|
1098
1262
|
* Search tasks assigned to current user via GraphQL.
|
|
@@ -1395,7 +1559,6 @@ var OnesAdapter = class extends BaseAdapter {
|
|
|
1395
1559
|
};
|
|
1396
1560
|
}
|
|
1397
1561
|
};
|
|
1398
|
-
|
|
1399
1562
|
//#endregion
|
|
1400
1563
|
//#region src/adapters/index.ts
|
|
1401
1564
|
const ADAPTER_MAP = { ones: OnesAdapter };
|
|
@@ -1407,7 +1570,6 @@ function createAdapter(sourceType, config, resolvedAuth) {
|
|
|
1407
1570
|
if (!AdapterClass) throw new Error(`Unsupported source type: "${sourceType}". Supported: ${Object.keys(ADAPTER_MAP).join(", ")}`);
|
|
1408
1571
|
return new AdapterClass(sourceType, config, resolvedAuth);
|
|
1409
1572
|
}
|
|
1410
|
-
|
|
1411
1573
|
//#endregion
|
|
1412
1574
|
//#region src/config/loader.ts
|
|
1413
1575
|
const AuthSchema = zod_v4.z.discriminatedUnion("type", [
|
|
@@ -1565,7 +1727,6 @@ function loadConfig(startDir) {
|
|
|
1565
1727
|
configPath
|
|
1566
1728
|
};
|
|
1567
1729
|
}
|
|
1568
|
-
|
|
1569
1730
|
//#endregion
|
|
1570
1731
|
//#region src/tools/add-manhour.ts
|
|
1571
1732
|
const AddManhourSchema = zod_v4.z.object({
|
|
@@ -1601,7 +1762,6 @@ function formatAddManhourResult(result) {
|
|
|
1601
1762
|
`- **Description**: ${result.description}`
|
|
1602
1763
|
].join("\n");
|
|
1603
1764
|
}
|
|
1604
|
-
|
|
1605
1765
|
//#endregion
|
|
1606
1766
|
//#region src/tools/get-issue-detail.ts
|
|
1607
1767
|
const GetIssueDetailSchema = zod_v4.z.object({
|
|
@@ -1676,7 +1836,6 @@ function formatIssueDetail(detail) {
|
|
|
1676
1836
|
else lines.push("_No description_");
|
|
1677
1837
|
return lines.join("\n");
|
|
1678
1838
|
}
|
|
1679
|
-
|
|
1680
1839
|
//#endregion
|
|
1681
1840
|
//#region src/tools/get-related-issues.ts
|
|
1682
1841
|
const GetRelatedIssuesSchema = zod_v4.z.object({
|
|
@@ -1717,7 +1876,6 @@ function formatRelatedIssues(issues) {
|
|
|
1717
1876
|
}
|
|
1718
1877
|
return lines.join("\n");
|
|
1719
1878
|
}
|
|
1720
|
-
|
|
1721
1879
|
//#endregion
|
|
1722
1880
|
//#region src/tools/get-requirement.ts
|
|
1723
1881
|
const GetRequirementSchema = zod_v4.z.object({
|
|
@@ -1796,7 +1954,6 @@ function formatRequirement(req) {
|
|
|
1796
1954
|
}
|
|
1797
1955
|
return lines.join("\n");
|
|
1798
1956
|
}
|
|
1799
|
-
|
|
1800
1957
|
//#endregion
|
|
1801
1958
|
//#region src/tools/get-testcases.ts
|
|
1802
1959
|
const GetTestcasesSchema = zod_v4.z.object({
|
|
@@ -1848,7 +2005,6 @@ function formatTestcases(result) {
|
|
|
1848
2005
|
}
|
|
1849
2006
|
return lines.join("\n");
|
|
1850
2007
|
}
|
|
1851
|
-
|
|
1852
2008
|
//#endregion
|
|
1853
2009
|
//#region src/tools/list-sources.ts
|
|
1854
2010
|
async function handleListSources(adapters, config) {
|
|
@@ -1874,7 +2030,6 @@ async function handleListSources(adapters, config) {
|
|
|
1874
2030
|
text: lines.join("\n")
|
|
1875
2031
|
}] };
|
|
1876
2032
|
}
|
|
1877
|
-
|
|
1878
2033
|
//#endregion
|
|
1879
2034
|
//#region src/tools/search-requirements.ts
|
|
1880
2035
|
const SearchRequirementsSchema = zod_v4.z.object({
|
|
@@ -1915,7 +2070,6 @@ async function handleSearchRequirements(input, adapters, defaultSource) {
|
|
|
1915
2070
|
text: lines.join("\n")
|
|
1916
2071
|
}] };
|
|
1917
2072
|
}
|
|
1918
|
-
|
|
1919
2073
|
//#endregion
|
|
1920
2074
|
//#region src/tools/update-task-plan-dates.ts
|
|
1921
2075
|
const DateSchema = zod_v4.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Expected YYYY-MM-DD");
|
|
@@ -1949,7 +2103,6 @@ function formatUpdateTaskPlanDatesResult(result) {
|
|
|
1949
2103
|
if (result.planEndDate) lines.push(`- **Plan End Date**: ${result.planEndDate}`);
|
|
1950
2104
|
return lines.join("\n");
|
|
1951
2105
|
}
|
|
1952
|
-
|
|
1953
2106
|
//#endregion
|
|
1954
2107
|
//#region src/index.ts
|
|
1955
2108
|
/**
|
|
@@ -1997,7 +2150,10 @@ async function main() {
|
|
|
1997
2150
|
name: "ai-dev-requirements",
|
|
1998
2151
|
version: "0.1.0"
|
|
1999
2152
|
});
|
|
2000
|
-
server.
|
|
2153
|
+
server.registerTool("get_requirement", {
|
|
2154
|
+
description: "Fetch a single requirement/issue by its ID from a configured source (ONES)",
|
|
2155
|
+
inputSchema: GetRequirementSchema.shape
|
|
2156
|
+
}, async (params) => {
|
|
2001
2157
|
try {
|
|
2002
2158
|
return await handleGetRequirement(params, adapters, config.config.defaultSource);
|
|
2003
2159
|
} catch (err) {
|
|
@@ -2010,7 +2166,10 @@ async function main() {
|
|
|
2010
2166
|
};
|
|
2011
2167
|
}
|
|
2012
2168
|
});
|
|
2013
|
-
server.
|
|
2169
|
+
server.registerTool("search_requirements", {
|
|
2170
|
+
description: "Search for requirements/issues by keywords across a configured source",
|
|
2171
|
+
inputSchema: SearchRequirementsSchema.shape
|
|
2172
|
+
}, async (params) => {
|
|
2014
2173
|
try {
|
|
2015
2174
|
return await handleSearchRequirements(params, adapters, config.config.defaultSource);
|
|
2016
2175
|
} catch (err) {
|
|
@@ -2023,7 +2182,7 @@ async function main() {
|
|
|
2023
2182
|
};
|
|
2024
2183
|
}
|
|
2025
2184
|
});
|
|
2026
|
-
server.
|
|
2185
|
+
server.registerTool("list_sources", { description: "List all configured requirement sources and their status" }, async () => {
|
|
2027
2186
|
try {
|
|
2028
2187
|
return await handleListSources(adapters, config.config);
|
|
2029
2188
|
} catch (err) {
|
|
@@ -2036,7 +2195,10 @@ async function main() {
|
|
|
2036
2195
|
};
|
|
2037
2196
|
}
|
|
2038
2197
|
});
|
|
2039
|
-
server.
|
|
2198
|
+
server.registerTool("get_related_issues", {
|
|
2199
|
+
description: "Get pending defect issues (bugs) related to a requirement task. Returns all pending defects grouped by assignee (current user first).",
|
|
2200
|
+
inputSchema: GetRelatedIssuesSchema.shape
|
|
2201
|
+
}, async (params) => {
|
|
2040
2202
|
try {
|
|
2041
2203
|
return await handleGetRelatedIssues(params, adapters, config.config.defaultSource);
|
|
2042
2204
|
} catch (err) {
|
|
@@ -2049,7 +2211,10 @@ async function main() {
|
|
|
2049
2211
|
};
|
|
2050
2212
|
}
|
|
2051
2213
|
});
|
|
2052
|
-
server.
|
|
2214
|
+
server.registerTool("get_issue_detail", {
|
|
2215
|
+
description: "Get detailed information about a specific issue/defect including description, rich text, and images",
|
|
2216
|
+
inputSchema: GetIssueDetailSchema.shape
|
|
2217
|
+
}, async (params) => {
|
|
2053
2218
|
try {
|
|
2054
2219
|
return await handleGetIssueDetail(params, adapters, config.config.defaultSource);
|
|
2055
2220
|
} catch (err) {
|
|
@@ -2062,7 +2227,10 @@ async function main() {
|
|
|
2062
2227
|
};
|
|
2063
2228
|
}
|
|
2064
2229
|
});
|
|
2065
|
-
server.
|
|
2230
|
+
server.registerTool("get_testcases", {
|
|
2231
|
+
description: "Get all test cases for a task by its number (e.g. 302). Searches the testcase library for a matching module and returns all cases with steps.",
|
|
2232
|
+
inputSchema: GetTestcasesSchema.shape
|
|
2233
|
+
}, async (params) => {
|
|
2066
2234
|
try {
|
|
2067
2235
|
return await handleGetTestcases(params, adapters, config.config.defaultSource);
|
|
2068
2236
|
} catch (err) {
|
|
@@ -2075,7 +2243,10 @@ async function main() {
|
|
|
2075
2243
|
};
|
|
2076
2244
|
}
|
|
2077
2245
|
});
|
|
2078
|
-
server.
|
|
2246
|
+
server.registerTool("add_manhour", {
|
|
2247
|
+
description: "Add a work-hour record to a ONES task, bug, or requirement. Supports task key, uuid, number, or displayId.",
|
|
2248
|
+
inputSchema: AddManhourSchema.shape
|
|
2249
|
+
}, async (params) => {
|
|
2079
2250
|
try {
|
|
2080
2251
|
return await handleAddManhour(params, adapters, config.config.defaultSource);
|
|
2081
2252
|
} catch (err) {
|
|
@@ -2088,7 +2259,10 @@ async function main() {
|
|
|
2088
2259
|
};
|
|
2089
2260
|
}
|
|
2090
2261
|
});
|
|
2091
|
-
server.
|
|
2262
|
+
server.registerTool("update_task_plan_dates", {
|
|
2263
|
+
description: "Update plan start and/or plan end dates for a ONES task, bug, or requirement. Supports task key, uuid, number, or displayId.",
|
|
2264
|
+
inputSchema: UpdateTaskPlanDatesSchema.shape
|
|
2265
|
+
}, async (params) => {
|
|
2092
2266
|
try {
|
|
2093
2267
|
return await handleUpdateTaskPlanDates(params, adapters, config.config.defaultSource);
|
|
2094
2268
|
} catch (err) {
|
|
@@ -2108,5 +2282,4 @@ main().catch((err) => {
|
|
|
2108
2282
|
console.error("[requirements-mcp] Fatal error:", err);
|
|
2109
2283
|
process.exit(1);
|
|
2110
2284
|
});
|
|
2111
|
-
|
|
2112
|
-
//#endregion
|
|
2285
|
+
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export {}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export {}
|