@pschroee/redmine-mcp 0.5.11 → 0.5.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/formatters/issue.js +32 -3
- package/package.json +1 -1
package/dist/formatters/issue.js
CHANGED
|
@@ -144,9 +144,23 @@ export function formatIssueList(response) {
|
|
|
144
144
|
lines.push("No issues found.");
|
|
145
145
|
return lines.join("\n");
|
|
146
146
|
}
|
|
147
|
+
// Collect all unique custom field names (preserving order by ID)
|
|
148
|
+
const customFieldMap = new Map(); // id -> name
|
|
149
|
+
for (const issue of issues) {
|
|
150
|
+
if (issue.custom_fields) {
|
|
151
|
+
for (const cf of issue.custom_fields) {
|
|
152
|
+
if (!customFieldMap.has(cf.id)) {
|
|
153
|
+
customFieldMap.set(cf.id, cf.name);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const customFieldIds = Array.from(customFieldMap.keys()).sort((a, b) => a - b);
|
|
159
|
+
const customFieldNames = customFieldIds.map(id => customFieldMap.get(id));
|
|
147
160
|
// Table header
|
|
148
|
-
|
|
149
|
-
lines.push("
|
|
161
|
+
const headerCols = ["ID", "Subject", "Status", "Priority", "Assigned", "Version", "Created", "Updated", ...customFieldNames];
|
|
162
|
+
lines.push("| " + headerCols.join(" | ") + " |");
|
|
163
|
+
lines.push("|" + headerCols.map(() => "---").join("|") + "|");
|
|
150
164
|
// Table rows
|
|
151
165
|
for (const issue of issues) {
|
|
152
166
|
const id = `#${issue.id}`;
|
|
@@ -154,8 +168,23 @@ export function formatIssueList(response) {
|
|
|
154
168
|
const status = issue.status.name;
|
|
155
169
|
const priority = issue.priority.name;
|
|
156
170
|
const assigned = issue.assigned_to?.name ?? "_(unassigned)_";
|
|
171
|
+
const version = issue.fixed_version?.name ?? "";
|
|
172
|
+
const created = formatDateShort(issue.created_on);
|
|
157
173
|
const updated = formatDateShort(issue.updated_on);
|
|
158
|
-
|
|
174
|
+
// Build custom field values in order
|
|
175
|
+
const cfValues = [];
|
|
176
|
+
for (const cfId of customFieldIds) {
|
|
177
|
+
const cf = issue.custom_fields?.find(f => f.id === cfId);
|
|
178
|
+
if (cf) {
|
|
179
|
+
const value = Array.isArray(cf.value) ? cf.value.join(", ") : cf.value;
|
|
180
|
+
cfValues.push(value || "");
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
cfValues.push("");
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const cols = [id, subject, status, priority, assigned, version, created, updated, ...cfValues];
|
|
187
|
+
lines.push("| " + cols.join(" | ") + " |");
|
|
159
188
|
}
|
|
160
189
|
return lines.join("\n");
|
|
161
190
|
}
|