@stellar_ai/mcp_fossil_scm 0.1.1 → 0.1.3
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/LICENSE +28 -0
- package/README.md +140 -113
- package/dist/capabilities.js +6 -7
- package/dist/cli.js +28 -24
- package/dist/config.js +7 -32
- package/dist/core/fossil.js +67 -79
- package/dist/core/gitignore.js +136 -0
- package/dist/core/sql.js +3 -2
- package/dist/index.js +8 -7
- package/dist/prompts.js +167 -0
- package/dist/server.js +6 -5
- package/dist/tools/admin.js +454 -86
- package/dist/tools/chat.js +22 -26
- package/dist/tools/common.js +14 -5
- package/dist/tools/forum.js +37 -29
- package/dist/tools/tickets.js +32 -11
- package/dist/tools/version-control.js +880 -105
- package/dist/tools/wiki.js +17 -18
- package/docs/README.md +31 -0
- package/docs/admin.md +663 -0
- package/docs/chat.md +152 -0
- package/docs/forum.md +146 -0
- package/docs/prompts.md +39 -0
- package/docs/tickets.md +179 -0
- package/docs/vcs.md +1089 -0
- package/docs/wiki.md +140 -0
- package/package.json +11 -6
- package/dist/capabilities.d.ts +0 -32
- package/dist/capabilities.js.map +0 -1
- package/dist/cli.d.ts +0 -27
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -27
- package/dist/config.js.map +0 -1
- package/dist/core/fossil.d.ts +0 -104
- package/dist/core/fossil.js.map +0 -1
- package/dist/core/sql.d.ts +0 -29
- package/dist/core/sql.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js.map +0 -1
- package/dist/server.d.ts +0 -13
- package/dist/server.js.map +0 -1
- package/dist/tools/admin.d.ts +0 -3
- package/dist/tools/admin.js.map +0 -1
- package/dist/tools/chat.d.ts +0 -10
- package/dist/tools/chat.js.map +0 -1
- package/dist/tools/common.d.ts +0 -9
- package/dist/tools/common.js.map +0 -1
- package/dist/tools/forum.d.ts +0 -3
- package/dist/tools/forum.js.map +0 -1
- package/dist/tools/tickets.d.ts +0 -8
- package/dist/tools/tickets.js.map +0 -1
- package/dist/tools/version-control.d.ts +0 -3
- package/dist/tools/version-control.js.map +0 -1
- package/dist/tools/wiki.d.ts +0 -3
- package/dist/tools/wiki.js.map +0 -1
package/dist/tools/chat.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { NETWORK_TIMEOUT_MS } from '../config.js';
|
|
4
4
|
import { renderOutcome, resolveWorkspace, runFossil, truncateOutput } from '../core/fossil.js';
|
|
5
5
|
import { asNumber, asString, runSql } from '../core/sql.js';
|
|
6
|
-
import { clean,
|
|
6
|
+
import { clean, workspaceParam, flag, pushOption } from './common.js';
|
|
7
7
|
/** Formats the `mtime` column of the chat table (unix seconds). */
|
|
8
8
|
function formatTime(value) {
|
|
9
9
|
const seconds = asNumber(value, 0);
|
|
@@ -32,14 +32,13 @@ export function registerChatTools(server) {
|
|
|
32
32
|
description: 'Show the URL of the chatroom on the default remote (or on --remote).',
|
|
33
33
|
inputSchema: z.object({
|
|
34
34
|
remote: z.string().min(1).optional().describe('Use this remote URL instead of the default remote.'),
|
|
35
|
-
|
|
35
|
+
workspace: workspaceParam,
|
|
36
36
|
}),
|
|
37
37
|
annotations: { readOnlyHint: true },
|
|
38
|
-
}, async ({ remote,
|
|
38
|
+
}, async ({ remote, workspace }) => {
|
|
39
39
|
const args = ['chat', 'url'];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return renderOutcome(await runFossil(args, { cwd }));
|
|
40
|
+
pushOption(args, '--remote', remote);
|
|
41
|
+
return renderOutcome(await runFossil(args, { workspace }));
|
|
43
42
|
});
|
|
44
43
|
server.registerTool('fossil_chat_send', {
|
|
45
44
|
title: 'Send chat message',
|
|
@@ -54,10 +53,10 @@ export function registerChatTools(server) {
|
|
|
54
53
|
.optional()
|
|
55
54
|
.describe('Send the attachment under this name (--as). Requires file.'),
|
|
56
55
|
remote: z.string().min(1).optional().describe('Chat server URL to use instead of the default remote.'),
|
|
57
|
-
|
|
56
|
+
workspace: workspaceParam,
|
|
58
57
|
}),
|
|
59
|
-
}, async ({ message, file, attachment_name, remote,
|
|
60
|
-
const workspaceDir = resolveWorkspace(
|
|
58
|
+
}, async ({ message, file, attachment_name, remote, workspace }) => {
|
|
59
|
+
const workspaceDir = resolveWorkspace(workspace);
|
|
61
60
|
const attachment = clean(file);
|
|
62
61
|
if (attachment_name && !attachment) {
|
|
63
62
|
return { content: [{ type: 'text', text: "ERROR: 'attachment_name' requires 'file'." }], isError: true };
|
|
@@ -65,12 +64,10 @@ export function registerChatTools(server) {
|
|
|
65
64
|
const args = ['chat', 'send', '-m', message];
|
|
66
65
|
if (attachment) {
|
|
67
66
|
args.push('--file', path.resolve(workspaceDir, attachment));
|
|
68
|
-
|
|
69
|
-
args.push('--as', attachment_name.trim());
|
|
67
|
+
pushOption(args, '--as', attachment_name);
|
|
70
68
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return renderOutcome(await runFossil(args, { cwd, timeoutMs: NETWORK_TIMEOUT_MS }), {
|
|
69
|
+
pushOption(args, '--remote', remote);
|
|
70
|
+
return renderOutcome(await runFossil(args, { workspace, timeoutMs: NETWORK_TIMEOUT_MS }), {
|
|
74
71
|
note: 'Message sent to the chatroom.',
|
|
75
72
|
});
|
|
76
73
|
});
|
|
@@ -86,17 +83,17 @@ export function registerChatTools(server) {
|
|
|
86
83
|
.optional()
|
|
87
84
|
.describe('Store the CHAT table in this database file instead of the clone (--out, workspace relative).'),
|
|
88
85
|
remote: z.string().min(1).optional().describe('Chat server URL to use instead of the default remote.'),
|
|
89
|
-
|
|
86
|
+
workspace: workspaceParam,
|
|
90
87
|
}),
|
|
91
|
-
}, async ({ all, out, remote,
|
|
88
|
+
}, async ({ all, out, remote, workspace }) => {
|
|
92
89
|
const args = ['chat', 'pull'];
|
|
93
90
|
if (all)
|
|
94
91
|
args.push('--all');
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return renderOutcome(await runFossil(args, {
|
|
92
|
+
const archivePath = clean(out);
|
|
93
|
+
if (archivePath)
|
|
94
|
+
args.push('--out', path.resolve(resolveWorkspace(workspace), archivePath));
|
|
95
|
+
pushOption(args, '--remote', remote);
|
|
96
|
+
return renderOutcome(await runFossil(args, { workspace, timeoutMs: NETWORK_TIMEOUT_MS }), {
|
|
100
97
|
note: 'Chat history pulled into the local clone.',
|
|
101
98
|
});
|
|
102
99
|
});
|
|
@@ -111,15 +108,15 @@ export function registerChatTools(server) {
|
|
|
111
108
|
.min(1)
|
|
112
109
|
.optional()
|
|
113
110
|
.describe('Chat archive database file created by `fossil_chat_pull --out` (workspace relative).'),
|
|
114
|
-
|
|
111
|
+
workspace: workspaceParam,
|
|
115
112
|
}),
|
|
116
113
|
annotations: { readOnlyHint: true },
|
|
117
|
-
}, async ({ limit, database,
|
|
114
|
+
}, async ({ limit, database, workspace }) => {
|
|
118
115
|
const archive = clean(database);
|
|
119
116
|
const result = await runSql(`SELECT * FROM chat ORDER BY msgid DESC LIMIT ${limit ?? 50}`, {
|
|
120
|
-
|
|
117
|
+
workspace,
|
|
121
118
|
readonly: true,
|
|
122
|
-
database: archive ? path.resolve(resolveWorkspace(
|
|
119
|
+
database: archive ? path.resolve(resolveWorkspace(workspace), archive) : undefined,
|
|
123
120
|
});
|
|
124
121
|
if (!result.ok) {
|
|
125
122
|
if (/no such table/i.test(result.error)) {
|
|
@@ -147,4 +144,3 @@ export function registerChatTools(server) {
|
|
|
147
144
|
return { content: [{ type: 'text', text: truncateOutput(result.rows.map(formatChatRow).join('\n')) }] };
|
|
148
145
|
});
|
|
149
146
|
}
|
|
150
|
-
//# sourceMappingURL=chat.js.map
|
package/dist/tools/common.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/** Shared `
|
|
3
|
-
export const
|
|
2
|
+
/** Shared `workspace` parameter accepted by every tool. */
|
|
3
|
+
export const workspaceParam = z
|
|
4
4
|
.string()
|
|
5
5
|
.min(1)
|
|
6
6
|
.optional()
|
|
7
|
-
.describe('Directory the fossil command runs in (check-out or workspace). Defaults to the
|
|
7
|
+
.describe('Directory the fossil command runs in (check-out or workspace). Defaults to the --workspace value, ' +
|
|
8
|
+
'then to the process working directory.');
|
|
8
9
|
/** Shared list-of-paths parameter. */
|
|
9
10
|
export const filesParam = z
|
|
10
11
|
.array(z.string().min(1))
|
|
11
12
|
.optional()
|
|
12
13
|
.describe('Explicit list of files or directories. When omitted the command applies to the whole check-out.');
|
|
13
|
-
/**
|
|
14
|
+
/** Boolean option that defaults to `false`, so handlers can test it directly. */
|
|
14
15
|
export const flag = (description) => z.boolean().default(false).describe(description);
|
|
15
16
|
/** Trims a possibly empty/undefined string. */
|
|
16
17
|
export function clean(value) {
|
|
17
18
|
const trimmed = value?.trim();
|
|
18
19
|
return trimmed ? trimmed : undefined;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Appends `flag value` when the value is present, so handlers never need the
|
|
23
|
+
* `if (clean(x)) args.push('--flag', x!.trim())` dance.
|
|
24
|
+
*/
|
|
25
|
+
export function pushOption(args, flag, value) {
|
|
26
|
+
const trimmed = clean(value);
|
|
27
|
+
if (trimmed)
|
|
28
|
+
args.push(flag, trimmed);
|
|
29
|
+
}
|
package/dist/tools/forum.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { truncateOutput } from '../core/fossil.js';
|
|
2
|
+
import { escapeSqlLiteral, truncateOutput } from '../core/fossil.js';
|
|
3
3
|
import { asString, runSql } from '../core/sql.js';
|
|
4
|
-
import {
|
|
4
|
+
import { workspaceParam } from './common.js';
|
|
5
5
|
const FORUM_HASH = /^[0-9a-f]{40,64}$/i;
|
|
6
6
|
function forumEventsSql(limit, search) {
|
|
7
7
|
const where = [
|
|
8
8
|
"e.type = 'f'",
|
|
9
9
|
// instr() avoids LIKE wildcard surprises and needs no escaping of % or _.
|
|
10
|
-
search ? `instr(lower(content(b.uuid)), lower(${
|
|
10
|
+
search ? `instr(lower(content(b.uuid)), lower('${escapeSqlLiteral(search)}')) > 0` : undefined,
|
|
11
11
|
].filter((clause) => Boolean(clause));
|
|
12
12
|
return [
|
|
13
13
|
'SELECT b.uuid AS uuid,',
|
|
@@ -21,10 +21,6 @@ function forumEventsSql(limit, search) {
|
|
|
21
21
|
` LIMIT ${limit}`,
|
|
22
22
|
].join('\n');
|
|
23
23
|
}
|
|
24
|
-
/** Quotes a value as a SQL string literal. */
|
|
25
|
-
function sqlString(value) {
|
|
26
|
-
return `'${value.replace(/'/g, "''")}'`;
|
|
27
|
-
}
|
|
28
24
|
/**
|
|
29
25
|
* Parses a forum artifact. Artifacts start with `F <title>` for a new thread
|
|
30
26
|
* and `F <title> <parent-hash>` for a reply.
|
|
@@ -57,8 +53,8 @@ function parseForumPost(row) {
|
|
|
57
53
|
body,
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
|
-
async function fetchPosts(
|
|
61
|
-
const result = await runSql(forumEventsSql(limit, search), {
|
|
56
|
+
async function fetchPosts(workspace, limit, search) {
|
|
57
|
+
const result = await runSql(forumEventsSql(limit, search), { workspace, readonly: true });
|
|
62
58
|
if (!result.ok)
|
|
63
59
|
return { ok: false, error: result.error };
|
|
64
60
|
const posts = [];
|
|
@@ -72,6 +68,17 @@ async function fetchPosts(cwd, limit, search) {
|
|
|
72
68
|
function shortHash(uuid) {
|
|
73
69
|
return uuid.slice(0, 10);
|
|
74
70
|
}
|
|
71
|
+
/** Finds a post by full hash or hash prefix, inside the fetched window. */
|
|
72
|
+
function resolvePost(byUuid, hash) {
|
|
73
|
+
const exact = byUuid.get(hash);
|
|
74
|
+
if (exact)
|
|
75
|
+
return exact;
|
|
76
|
+
for (const post of byUuid.values()) {
|
|
77
|
+
if (post.uuid.startsWith(hash))
|
|
78
|
+
return post;
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
75
82
|
function renderPost(post, depth) {
|
|
76
83
|
const indent = ' '.repeat(depth);
|
|
77
84
|
const body = post.body.trim();
|
|
@@ -85,7 +92,7 @@ function findRoot(post, byUuid) {
|
|
|
85
92
|
let current = post;
|
|
86
93
|
const seen = new Set([current.uuid]);
|
|
87
94
|
while (current.parent) {
|
|
88
|
-
const parent =
|
|
95
|
+
const parent = resolvePost(byUuid, current.parent);
|
|
89
96
|
if (!parent || seen.has(parent.uuid))
|
|
90
97
|
return current;
|
|
91
98
|
seen.add(parent.uuid);
|
|
@@ -117,30 +124,33 @@ function countDescendants(root, posts) {
|
|
|
117
124
|
}
|
|
118
125
|
/** Forum tools (read-only). */
|
|
119
126
|
export function registerForumTools(server) {
|
|
120
|
-
const note = 'Forum access is read-only: Fossil 2.x has no CLI/API for creating forum posts (use the web UI).';
|
|
121
127
|
server.registerTool('fossil_forum_list', {
|
|
122
128
|
title: 'List forum threads',
|
|
123
|
-
description:
|
|
129
|
+
description: 'List the most recent forum posts, newest first, with their thread root, author and reply count.',
|
|
124
130
|
inputSchema: z.object({
|
|
125
131
|
limit: z.number().int().min(1).max(500).default(20).describe('How many forum events to scan.'),
|
|
126
|
-
|
|
132
|
+
workspace: workspaceParam,
|
|
127
133
|
}),
|
|
128
134
|
annotations: { readOnlyHint: true },
|
|
129
|
-
}, async ({ limit,
|
|
130
|
-
const fetched = await fetchPosts(
|
|
135
|
+
}, async ({ limit, workspace }) => {
|
|
136
|
+
const fetched = await fetchPosts(workspace, limit ?? 20);
|
|
131
137
|
if (!fetched.ok)
|
|
132
138
|
return { content: [{ type: 'text', text: fetched.error }], isError: true };
|
|
133
139
|
const { posts } = fetched;
|
|
134
140
|
if (posts.length === 0) {
|
|
135
141
|
return {
|
|
136
|
-
content: [{ type: 'text', text: `No forum posts found in the last ${limit ?? 20} forum events
|
|
142
|
+
content: [{ type: 'text', text: `No forum posts found in the last ${limit ?? 20} forum events.` }],
|
|
137
143
|
};
|
|
138
144
|
}
|
|
139
145
|
const byUuid = new Map(posts.map((post) => [post.uuid, post]));
|
|
140
146
|
const lines = posts.map((post) => {
|
|
141
147
|
const root = findRoot(post, byUuid);
|
|
142
148
|
const replies = root.uuid === post.uuid ? countDescendants(root, posts) : undefined;
|
|
143
|
-
const suffix = root.uuid === post.uuid
|
|
149
|
+
const suffix = root.uuid === post.uuid
|
|
150
|
+
? replies
|
|
151
|
+
? ` (${replies} ${replies === 1 ? 'reply' : 'replies'})`
|
|
152
|
+
: ' (thread)'
|
|
153
|
+
: ` ↳ reply in thread ${shortHash(root.uuid)}`;
|
|
144
154
|
return `${post.at} ${shortHash(post.uuid)} ${post.user || 'unknown'} ${post.title}${suffix}`;
|
|
145
155
|
});
|
|
146
156
|
return { content: [{ type: 'text', text: truncateOutput(lines.join('\n')) }] };
|
|
@@ -148,22 +158,21 @@ export function registerForumTools(server) {
|
|
|
148
158
|
server.registerTool('fossil_forum_read', {
|
|
149
159
|
title: 'Read forum thread',
|
|
150
160
|
description: `Print a forum thread (root post plus every reply found in the scanned window). ` +
|
|
151
|
-
|
|
161
|
+
'Accepts any post hash in the thread; abbreviations work.',
|
|
152
162
|
inputSchema: z.object({
|
|
153
163
|
thread: z.string().min(1).describe('Thread root hash, or the hash of any post in the thread (prefix allowed).'),
|
|
154
164
|
limit: z.number().int().min(1).max(2000).default(500).describe('How many forum events to scan for replies.'),
|
|
155
|
-
|
|
165
|
+
workspace: workspaceParam,
|
|
156
166
|
}),
|
|
157
167
|
annotations: { readOnlyHint: true },
|
|
158
|
-
}, async ({ thread, limit,
|
|
168
|
+
}, async ({ thread, limit, workspace }) => {
|
|
159
169
|
const scanLimit = limit ?? 500;
|
|
160
|
-
const fetched = await fetchPosts(
|
|
170
|
+
const fetched = await fetchPosts(workspace, scanLimit);
|
|
161
171
|
if (!fetched.ok)
|
|
162
172
|
return { content: [{ type: 'text', text: fetched.error }], isError: true };
|
|
163
173
|
const key = thread.trim().toLowerCase();
|
|
164
174
|
const byUuid = new Map(fetched.posts.map((post) => [post.uuid, post]));
|
|
165
|
-
const start = byUuid
|
|
166
|
-
fetched.posts.find((post) => post.uuid.startsWith(key));
|
|
175
|
+
const start = resolvePost(byUuid, key);
|
|
167
176
|
if (!start) {
|
|
168
177
|
return {
|
|
169
178
|
content: [
|
|
@@ -181,7 +190,7 @@ export function registerForumTools(server) {
|
|
|
181
190
|
for (const post of [...fetched.posts].reverse()) {
|
|
182
191
|
if (!post.parent)
|
|
183
192
|
continue;
|
|
184
|
-
const parent =
|
|
193
|
+
const parent = resolvePost(byUuid, post.parent);
|
|
185
194
|
if (!parent)
|
|
186
195
|
continue;
|
|
187
196
|
const bucket = children.get(parent.uuid) ?? [];
|
|
@@ -202,16 +211,16 @@ export function registerForumTools(server) {
|
|
|
202
211
|
});
|
|
203
212
|
server.registerTool('fossil_forum_search', {
|
|
204
213
|
title: 'Search forum',
|
|
205
|
-
description:
|
|
214
|
+
description: 'Case-insensitive substring search over forum post bodies and titles.',
|
|
206
215
|
inputSchema: z.object({
|
|
207
216
|
query: z.string().min(1).describe('Text to look for (substring, case-insensitive).'),
|
|
208
217
|
limit: z.number().int().min(1).max(200).default(20).describe('Maximum matches to return.'),
|
|
209
|
-
|
|
218
|
+
workspace: workspaceParam,
|
|
210
219
|
}),
|
|
211
220
|
annotations: { readOnlyHint: true },
|
|
212
|
-
}, async ({ query, limit,
|
|
221
|
+
}, async ({ query, limit, workspace }) => {
|
|
213
222
|
const searchLimit = limit ?? 20;
|
|
214
|
-
const fetched = await fetchPosts(
|
|
223
|
+
const fetched = await fetchPosts(workspace, searchLimit, query);
|
|
215
224
|
if (!fetched.ok)
|
|
216
225
|
return { content: [{ type: 'text', text: fetched.error }], isError: true };
|
|
217
226
|
if (fetched.posts.length === 0) {
|
|
@@ -224,4 +233,3 @@ export function registerForumTools(server) {
|
|
|
224
233
|
return { content: [{ type: 'text', text: truncateOutput(blocks.join('\n\n')) }] };
|
|
225
234
|
});
|
|
226
235
|
}
|
|
227
|
-
//# sourceMappingURL=forum.js.map
|
package/dist/tools/tickets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { renderOutcome, runFossil, truncateOutput } from '../core/fossil.js';
|
|
3
|
-
import {
|
|
3
|
+
import { flag, workspaceParam } from './common.js';
|
|
4
4
|
const TICKET_FALLBACK_SQL = 'SELECT substr(tkt_uuid, 1, 10) AS id, title, status FROM ticket ORDER BY tkt_mtime DESC';
|
|
5
5
|
/**
|
|
6
6
|
* Ticket tools.
|
|
@@ -14,14 +14,15 @@ export function registerTicketTools(server) {
|
|
|
14
14
|
description: 'Render a ticket report (default report 1). When the report is unavailable it falls back to a compact SQL listing.',
|
|
15
15
|
inputSchema: z.object({
|
|
16
16
|
report: z.string().min(1).default('1').describe('Ticket report number or name.'),
|
|
17
|
-
|
|
17
|
+
workspace: workspaceParam,
|
|
18
18
|
}),
|
|
19
19
|
annotations: { readOnlyHint: true },
|
|
20
|
-
}, async ({ report,
|
|
21
|
-
const primary = await runFossil(['ticket', 'show', report ?? '1'], {
|
|
20
|
+
}, async ({ report, workspace }) => {
|
|
21
|
+
const primary = await runFossil(['ticket', 'show', report ?? '1'], { workspace });
|
|
22
22
|
if (primary.ok)
|
|
23
23
|
return renderOutcome(primary, { emptyText: 'No tickets.' });
|
|
24
|
-
|
|
24
|
+
// Read-only: the fallback only ever reads the ticket table.
|
|
25
|
+
const fallback = await runFossil(['sql', '--readonly', '-header', '-column', TICKET_FALLBACK_SQL], { workspace });
|
|
25
26
|
if (fallback.ok && fallback.stdout.trim()) {
|
|
26
27
|
return {
|
|
27
28
|
content: [
|
|
@@ -35,6 +36,27 @@ export function registerTicketTools(server) {
|
|
|
35
36
|
// Neither path worked: the original failure is the more useful message.
|
|
36
37
|
return renderOutcome(primary);
|
|
37
38
|
});
|
|
39
|
+
server.registerTool('fossil_ticket_show', {
|
|
40
|
+
title: 'Show ticket report',
|
|
41
|
+
description: "Render one ticket report with an optional WHERE filter, e.g. filter: \"status = 'Open'\". Report 0 lists every ticket column.",
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
report: z.string().min(1).default('0').describe('Report number or title; 0 lists all ticket columns.'),
|
|
44
|
+
filter: z.string().min(1).optional().describe("Extra WHERE condition, e.g. \"status != 'open'\"."),
|
|
45
|
+
separator: z.string().min(1).optional().describe('Column separator (-l).'),
|
|
46
|
+
quote: flag('Encode special characters (--quote).'),
|
|
47
|
+
workspace: workspaceParam,
|
|
48
|
+
}),
|
|
49
|
+
annotations: { readOnlyHint: true },
|
|
50
|
+
}, async ({ report, filter, separator, quote, workspace }) => {
|
|
51
|
+
const args = ['ticket', 'show', report ?? '0'];
|
|
52
|
+
if (filter)
|
|
53
|
+
args.push(filter);
|
|
54
|
+
if (separator)
|
|
55
|
+
args.push('-l', separator);
|
|
56
|
+
if (quote)
|
|
57
|
+
args.push('-q');
|
|
58
|
+
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No tickets.' });
|
|
59
|
+
});
|
|
38
60
|
server.registerTool('fossil_ticket_create', {
|
|
39
61
|
title: 'Create ticket',
|
|
40
62
|
description: "Create a ticket. `additional_fields` is a flat list of field/value pairs, e.g. ['subsystem','UI','type','Bug'].",
|
|
@@ -45,9 +67,9 @@ export function registerTicketTools(server) {
|
|
|
45
67
|
.array(z.string())
|
|
46
68
|
.optional()
|
|
47
69
|
.describe("Flat field/value pairs, e.g. ['subsystem','UI','priority','High']."),
|
|
48
|
-
|
|
70
|
+
workspace: workspaceParam,
|
|
49
71
|
}),
|
|
50
|
-
}, async ({ title, status, additional_fields,
|
|
72
|
+
}, async ({ title, status, additional_fields, workspace }) => {
|
|
51
73
|
if (additional_fields && additional_fields.length % 2 !== 0) {
|
|
52
74
|
return {
|
|
53
75
|
content: [
|
|
@@ -62,7 +84,7 @@ export function registerTicketTools(server) {
|
|
|
62
84
|
const args = ['ticket', 'add', 'title', title, 'status', status ?? 'Open'];
|
|
63
85
|
if (additional_fields?.length)
|
|
64
86
|
args.push(...additional_fields);
|
|
65
|
-
return renderOutcome(await runFossil(args, {
|
|
87
|
+
return renderOutcome(await runFossil(args, { workspace }), { note: 'Ticket created.' });
|
|
66
88
|
});
|
|
67
89
|
server.registerTool('fossil_ticket_update', {
|
|
68
90
|
title: 'Update ticket',
|
|
@@ -71,11 +93,10 @@ export function registerTicketTools(server) {
|
|
|
71
93
|
ticket_id: z.string().min(1).describe('Ticket UUID or prefix shown by the ticket list.'),
|
|
72
94
|
field_name: z.string().min(1).describe('Field to change (status, subsystem, priority, comment, ...).'),
|
|
73
95
|
field_value: z.string().describe('New value for the field.'),
|
|
74
|
-
|
|
96
|
+
workspace: workspaceParam,
|
|
75
97
|
}),
|
|
76
98
|
annotations: { idempotentHint: true },
|
|
77
|
-
}, async ({ ticket_id, field_name, field_value,
|
|
99
|
+
}, async ({ ticket_id, field_name, field_value, workspace }) => renderOutcome(await runFossil(['ticket', 'set', ticket_id, field_name, field_value], { workspace }), {
|
|
78
100
|
note: `Ticket '${ticket_id}' updated: ${field_name} = '${field_value}'.`,
|
|
79
101
|
}));
|
|
80
102
|
}
|
|
81
|
-
//# sourceMappingURL=tickets.js.map
|