@thehammer/danx-dashboard-mcp 0.1.15 → 0.1.17
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/handlers.js +2 -0
- package/dist/index.js +24 -3
- package/package.json +1 -1
- package/dist/handlers.test.js +0 -51
package/dist/handlers.js
CHANGED
|
@@ -63,6 +63,8 @@ export async function issueCreate(client, args, defaultBoard) {
|
|
|
63
63
|
body.effort_level = args.effort_level;
|
|
64
64
|
if (args.list_id !== undefined)
|
|
65
65
|
body.list_id = args.list_id;
|
|
66
|
+
if (args.required_gates !== undefined)
|
|
67
|
+
body.required_gates = args.required_gates;
|
|
66
68
|
if (args.phase_children !== undefined)
|
|
67
69
|
body.phase_children = args.phase_children;
|
|
68
70
|
return client.request({ method: "POST", path: "", body, board });
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,13 @@ const EFFORT_VALUES = [
|
|
|
93
93
|
];
|
|
94
94
|
const ISSUE_TYPES = ["Epic", "Bug", "Feature", "Story", "Chore"];
|
|
95
95
|
const NON_EPIC_TYPES = ["Bug", "Feature", "Story", "Chore"];
|
|
96
|
+
// DX-1290 — the uniform 4-state checklist-item status. Terminal = passing|cancelled.
|
|
97
|
+
const CHECKLIST_ITEM_STATUSES = [
|
|
98
|
+
"incomplete",
|
|
99
|
+
"failing",
|
|
100
|
+
"passing",
|
|
101
|
+
"cancelled",
|
|
102
|
+
];
|
|
96
103
|
const TRANSITION_ACTIONS = [
|
|
97
104
|
"ready",
|
|
98
105
|
"pickup",
|
|
@@ -134,12 +141,12 @@ server.tool("issue_list", "List issues for the dispatch's board by default via G
|
|
|
134
141
|
...boardField,
|
|
135
142
|
}, async (args) => jsonResult(await issueList(client, args)));
|
|
136
143
|
// ---------------- issue_get ----------------
|
|
137
|
-
server.tool("issue_get", "Fetch a single hydrated issue via GET /api/issues/:id. Board-scoped; defaults to the dispatch's board. Issue ids are globally unique, so this resolves from any dispatch regardless of `board`. Returns the full card (every joined child collection: ac, comments, dependencies, requires_human steps, retro action items + commits, triage history, quality_gates — DX-1177: one row per registered quality gate {gate, required, status pending|pass|fail, completed_at, message}; a required PRE gate not yet `pass` pre-empts the work dispatch with the gate reviewer, and `issue_transition complete` refuses while a required POST gate row != pass) plus the ancestor chain walked via parent_id. 404 envelope on unknown id.", {
|
|
144
|
+
server.tool("issue_get", "Fetch a single hydrated issue via GET /api/issues/:id. Board-scoped; defaults to the dispatch's board. Issue ids are globally unique, so this resolves from any dispatch regardless of `board`. Returns the full card (every joined child collection: ac [the 2-state facade onto the default \"Acceptance Criteria\" checklist] + checklists [DX-1290: the full named-checklist model — each {name, items:[{label, detail, status: incomplete|failing|passing|cancelled}]}], comments, dependencies, requires_human steps, retro action items + commits, triage history, quality_gates — DX-1177: one row per registered quality gate {gate, required, status pending|pass|fail, completed_at, message}; a required PRE gate not yet `pass` pre-empts the work dispatch with the gate reviewer, and `issue_transition complete` refuses while a required POST gate row != pass) plus the ancestor chain walked via parent_id. 404 envelope on unknown id.", {
|
|
138
145
|
id: z.string().min(1),
|
|
139
146
|
...boardField,
|
|
140
147
|
}, async (args) => jsonResult(await issueGet(client, args)));
|
|
141
148
|
// ---------------- issue_create ----------------
|
|
142
|
-
server.tool("issue_create", "Create a fresh card via POST /api/issues. Board-scoped; defaults to the dispatch's board. Pass `board` (a qualified id `<repo>:<slug>`) to create the card on another board (forwarded into body.board + ?board=; unknown board → 404). INVARIANT: type=Epic REQUIRES non-empty phase_children[] (epic-with-phases atomicity per DX-575) and the route atomically inserts the epic + every phase in ONE transaction. Non-Epic types REFUSE phase_children[] with 400. Status defaults to Review (no lifecycle timestamps stamped on create). parent_id optional. ac items take {title}; phase children inherit the new epic's id as parent_id. Optional list_id PLACES the card directly into a column in ONE call. **Pass EITHER a board_lists id OR the list's display NAME (case-insensitive, emoji-tolerant — e.g. a queue name like \"⚙️ Fulfillment Queue\" or just \"Fulfillment Queue\") — the server resolves a name to its id.** The card lands DIRECTLY in that column with the matching lifecycle stamped automatically — a `ready`-type queue → ToDo, a `completed` list → Done, etc. **You do NOT need a separate issue_transition(ready) + issue_edit(list_id) afterward — just pass the queue name here and the card is created already in that column.** Omit list_id for the default (Review). NOT valid on type=Epic (Epic status derives from children) → 400. Unknown name/id → 400.", {
|
|
149
|
+
server.tool("issue_create", "Create a fresh card via POST /api/issues. Board-scoped; defaults to the dispatch's board. Pass `board` (a qualified id `<repo>:<slug>`) to create the card on another board (forwarded into body.board + ?board=; unknown board → 404). INVARIANT: type=Epic REQUIRES non-empty phase_children[] (epic-with-phases atomicity per DX-575) and the route atomically inserts the epic + every phase in ONE transaction. Non-Epic types REFUSE phase_children[] with 400. Status defaults to Review (no lifecycle timestamps stamped on create). parent_id optional. ac items take {title}; phase children inherit the new epic's id as parent_id. Optional list_id PLACES the card directly into a column in ONE call. **Pass EITHER a board_lists id OR the list's display NAME (case-insensitive, emoji-tolerant — e.g. a queue name like \"⚙️ Fulfillment Queue\" or just \"Fulfillment Queue\") — the server resolves a name to its id.** The card lands DIRECTLY in that column with the matching lifecycle stamped automatically — a `ready`-type queue → ToDo, a `completed` list → Done, etc. **You do NOT need a separate issue_transition(ready) + issue_edit(list_id) afterward — just pass the queue name here and the card is created already in that column.** Omit list_id for the default (Review). NOT valid on type=Epic (Epic status derives from children) → 400. Unknown name/id → 400. Optional required_gates[] flags which quality gates (dependency, architecture, tdd, code) are REQUIRED on this card so they run pre-dispatch (only when the board also has that gate enabled); unknown gate name → 400.", {
|
|
143
150
|
type: z.enum(ISSUE_TYPES),
|
|
144
151
|
title: z.string().min(1),
|
|
145
152
|
description: z.string(),
|
|
@@ -147,6 +154,10 @@ server.tool("issue_create", "Create a fresh card via POST /api/issues. Board-sco
|
|
|
147
154
|
ac: z.array(z.object({ title: z.string().min(1) })).optional(),
|
|
148
155
|
effort_level: z.enum(EFFORT_VALUES).nullable().optional(),
|
|
149
156
|
list_id: z.string().min(1).nullable().optional(),
|
|
157
|
+
required_gates: z
|
|
158
|
+
.array(z.string().min(1))
|
|
159
|
+
.optional()
|
|
160
|
+
.describe('Optional array of quality-gate names to mark REQUIRED on this card (e.g. ["architecture","tdd"]). A gate only actually runs if the board has that gate ENABLED (master switch) AND it is required on the card. Use this when you (the creating agent) judge the card needs that pre-dispatch review gate; omit for cards that don\'t. Known gates: dependency, architecture, tdd, code. The operator can also toggle these per-card later in the issue drawer.'),
|
|
150
161
|
phase_children: z
|
|
151
162
|
.array(z.object({
|
|
152
163
|
type: z.enum(NON_EPIC_TYPES),
|
|
@@ -159,7 +170,7 @@ server.tool("issue_create", "Create a fresh card via POST /api/issues. Board-sco
|
|
|
159
170
|
...boardField,
|
|
160
171
|
}, async (args) => jsonResult(await issueCreate(client, args, config.board)));
|
|
161
172
|
// ---------------- issue_edit ----------------
|
|
162
|
-
server.tool("issue_edit", "Patch prose fields only via PATCH /api/issues/:id/edit. ALLOWED keys: title, description, ac, effort_level, parent_id, list_id. ANY OTHER KEY (lifecycle timestamps, triage state, dependencies, retro, requires_human, blocked/dispatch gates) returns 400 with offending_keys[] and a pointer to the dedicated semantic handler — use issue_transition / issue_triage / issue_comment / issue_dependency / issue_requires_human / issue_retro instead.
|
|
173
|
+
server.tool("issue_edit", "Patch prose fields only via PATCH /api/issues/:id/edit. ALLOWED keys: title, description, ac, checklists, effort_level, parent_id, list_id. ANY OTHER KEY (lifecycle timestamps, triage state, dependencies, retro, requires_human, blocked/dispatch gates) returns 400 with offending_keys[] and a pointer to the dedicated semantic handler — use issue_transition / issue_triage / issue_comment / issue_dependency / issue_requires_human / issue_retro instead. CHECKLISTS (DX-1290): a card carries 0..N named checklists, each item ONE 4-state status `incomplete|failing|passing|cancelled` (terminal = passing|cancelled). `ac` is the 2-state CONVENIENCE onto the default \"Acceptance Criteria\" checklist (checked:true ↔ passing, false ↔ incomplete) — wholesale soft-delete + reinsert of that checklist's items. `checklists` is the GENERIC wholesale write path: it REPLACES every named checklist on the card with full 4-state control (each `{name, items:[{label, detail?, status}]}`) — use it to author named checklists like \"Feature Tests\". Send EITHER `ac` OR `checklists`, NOT both (400). list_id (DX-1192 / DX-1200) PINS the card to a specific board list. **Pass EITHER a board_lists id OR the list's display NAME (case-insensitive, e.g. a queue name like \"⚙️ Fulfillment Queue\") — the server resolves a name to its id.** Its type MUST match the card's CURRENT derived-status list-type (so to route a ToDo card into a `ready`-type queue, ready it first; mismatch / unknown name or id → 400); pass null to clear the pin (back to default-for-type).", {
|
|
163
174
|
id: z.string().min(1),
|
|
164
175
|
title: z.string().min(1).optional(),
|
|
165
176
|
description: z.string().optional(),
|
|
@@ -169,6 +180,16 @@ server.tool("issue_edit", "Patch prose fields only via PATCH /api/issues/:id/edi
|
|
|
169
180
|
checked: z.boolean().optional(),
|
|
170
181
|
}))
|
|
171
182
|
.optional(),
|
|
183
|
+
checklists: z
|
|
184
|
+
.array(z.object({
|
|
185
|
+
name: z.string().min(1),
|
|
186
|
+
items: z.array(z.object({
|
|
187
|
+
label: z.string().min(1),
|
|
188
|
+
detail: z.string().optional(),
|
|
189
|
+
status: z.enum(CHECKLIST_ITEM_STATUSES),
|
|
190
|
+
})),
|
|
191
|
+
}))
|
|
192
|
+
.optional(),
|
|
172
193
|
effort_level: z.enum(EFFORT_VALUES).nullable().optional(),
|
|
173
194
|
parent_id: z.string().nullable().optional(),
|
|
174
195
|
list_id: z.string().min(1).nullable().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thehammer/danx-dashboard-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Stdio MCP server wrapping danxbot's dashboard /api/issues/* normalized DB-backed HTTP routes for dispatched agents (DX-704 Phase 2).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/dist/handlers.test.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { DashboardHttpClient } from "./http-client.js";
|
|
3
|
-
import { issueList, issueTransition } from "./handlers.js";
|
|
4
|
-
/**
|
|
5
|
-
* `issue_list` query-param forwarding. A fake `fetch` captures the built
|
|
6
|
-
* URL so each filter is asserted at the wire, through the real client's
|
|
7
|
-
* URL builder (`?repo=` always stamped, extra query merged after).
|
|
8
|
-
*/
|
|
9
|
-
function clientCapturing() {
|
|
10
|
-
const urls = [];
|
|
11
|
-
const fetchImpl = (async (url) => {
|
|
12
|
-
urls.push(url);
|
|
13
|
-
return new Response(JSON.stringify({ issues: [] }), { status: 200 });
|
|
14
|
-
});
|
|
15
|
-
const client = new DashboardHttpClient({ baseUrl: "http://localhost:5555", repo: "danxbot", token: "t" }, fetchImpl);
|
|
16
|
-
return { client, urls };
|
|
17
|
-
}
|
|
18
|
-
describe("issueList — query forwarding", () => {
|
|
19
|
-
it("forwards q as the server-side search needle", async () => {
|
|
20
|
-
const { client, urls } = clientCapturing();
|
|
21
|
-
await issueList(client, { q: "retire" });
|
|
22
|
-
expect(urls[0]).toContain("q=retire");
|
|
23
|
-
});
|
|
24
|
-
it("omits q when not provided", async () => {
|
|
25
|
-
const { client, urls } = clientCapturing();
|
|
26
|
-
await issueList(client, { include_closed: true });
|
|
27
|
-
expect(urls[0]).not.toContain("q=");
|
|
28
|
-
expect(urls[0]).toContain("include_closed=true");
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
describe("issueTransition — body forwarding", () => {
|
|
32
|
-
function clientCapturingBody() {
|
|
33
|
-
const bodies = [];
|
|
34
|
-
const fetchImpl = (async (_url, init) => {
|
|
35
|
-
bodies.push(JSON.parse(String(init?.body ?? "{}")));
|
|
36
|
-
return new Response(JSON.stringify({ issue: {} }), { status: 200 });
|
|
37
|
-
});
|
|
38
|
-
const client = new DashboardHttpClient({ baseUrl: "http://localhost:5555", repo: "danxbot", token: "t" }, fetchImpl);
|
|
39
|
-
return { client, bodies };
|
|
40
|
-
}
|
|
41
|
-
it("forwards manual: true on pickup (DX-946 operator self-pickup)", async () => {
|
|
42
|
-
const { client, bodies } = clientCapturingBody();
|
|
43
|
-
await issueTransition(client, { id: "DX-1", action: "pickup", manual: true });
|
|
44
|
-
expect(bodies[0]).toEqual({ action: "pickup", manual: true });
|
|
45
|
-
});
|
|
46
|
-
it("omits manual when not provided", async () => {
|
|
47
|
-
const { client, bodies } = clientCapturingBody();
|
|
48
|
-
await issueTransition(client, { id: "DX-1", action: "pickup" });
|
|
49
|
-
expect(bodies[0]).toEqual({ action: "pickup" });
|
|
50
|
-
});
|
|
51
|
-
});
|