@stellar_ai/mcp_fossil_scm 0.1.3 → 0.2.0
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/README.md +14 -12
- package/dist/cli.js +11 -11
- package/dist/config.js +1 -1
- package/dist/index.js +1 -1
- package/dist/tools/admin.js +41 -3
- package/dist/tools/version-control.js +468 -90
- package/docs/README.md +2 -2
- package/docs/admin.md +28 -25
- package/docs/chat.md +1 -1
- package/docs/forum.md +1 -1
- package/docs/tickets.md +1 -1
- package/docs/vcs.md +161 -68
- package/docs/wiki.md +1 -1
- package/package.json +1 -1
|
@@ -18,22 +18,75 @@ export function registerVersionControlTools(server) {
|
|
|
18
18
|
description: 'Show the change set of the check-out (modified/added/deleted files) plus the list of untracked files. ' +
|
|
19
19
|
'Both queries run in parallel.',
|
|
20
20
|
inputSchema: z.object({
|
|
21
|
-
dotfiles: flag('Include dot-files in the untracked (
|
|
22
|
-
brief: flag('
|
|
23
|
-
ignore: z.string().min(1).optional().describe('Comma-separated glob patterns of extra files to ignore.'),
|
|
21
|
+
dotfiles: flag('Include dot-files in the change and untracked lists (--dotfiles).'),
|
|
22
|
+
brief: flag('List only the changed file names (fossil changes).'),
|
|
23
|
+
ignore: z.string().min(1).optional().describe('Comma-separated glob patterns of extra files to ignore (--ignore).'),
|
|
24
|
+
select: z
|
|
25
|
+
.array(z.enum([
|
|
26
|
+
'edited',
|
|
27
|
+
'updated',
|
|
28
|
+
'changed',
|
|
29
|
+
'missing',
|
|
30
|
+
'added',
|
|
31
|
+
'deleted',
|
|
32
|
+
'renamed',
|
|
33
|
+
'conflict',
|
|
34
|
+
'meta',
|
|
35
|
+
'unchanged',
|
|
36
|
+
'all',
|
|
37
|
+
'differ',
|
|
38
|
+
'extra',
|
|
39
|
+
]))
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('Report only these change groups, e.g. ["changed", "extra"] (--edited, --added, --all, --differ, …). ' +
|
|
42
|
+
'Omit to report the default change set plus untracked files.'),
|
|
43
|
+
classify: flag('Start each line with the change type; changes mode only (--classify).'),
|
|
44
|
+
hash: flag('Verify file status by hashing instead of size and mtime (--hash).'),
|
|
45
|
+
header: flag('Print the repository name above a non-empty report; changes mode only (--header).'),
|
|
46
|
+
verbose: flag('Print "(none)" when the report is empty; changes mode only (-v).'),
|
|
47
|
+
abs_paths: flag('Print absolute pathnames (--abs-paths).'),
|
|
48
|
+
rel_paths: flag('Print pathnames relative to the current directory (--rel-paths).'),
|
|
24
49
|
workspace: workspaceParam,
|
|
25
50
|
}),
|
|
26
51
|
annotations: { readOnlyHint: true },
|
|
27
|
-
}, async ({ dotfiles, brief, ignore, workspace }) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
}, async ({ dotfiles, brief, ignore, select, classify, hash, header, verbose, abs_paths, rel_paths, workspace, }) => {
|
|
53
|
+
const command = brief ? 'changes' : 'status';
|
|
54
|
+
const args = [command];
|
|
55
|
+
if (dotfiles)
|
|
56
|
+
args.push('--dotfiles');
|
|
57
|
+
pushOption(args, '--ignore', ignore);
|
|
58
|
+
for (const group of select ?? [])
|
|
59
|
+
args.push(`--${group}`);
|
|
60
|
+
if (command === 'changes') {
|
|
61
|
+
if (classify)
|
|
62
|
+
args.push('--classify');
|
|
63
|
+
if (header)
|
|
64
|
+
args.push('--header');
|
|
65
|
+
if (verbose)
|
|
66
|
+
args.push('-v');
|
|
67
|
+
}
|
|
68
|
+
if (hash)
|
|
69
|
+
args.push('--hash');
|
|
70
|
+
if (abs_paths)
|
|
71
|
+
args.push('--abs-paths');
|
|
72
|
+
if (rel_paths)
|
|
73
|
+
args.push('--rel-paths');
|
|
74
|
+
const includesExtra = (select ?? []).some((group) => group === 'extra' || group === 'differ');
|
|
75
|
+
if (select?.length && includesExtra) {
|
|
76
|
+
return renderSections([{ title: 'STATUS', outcome: await runFossil(args, { workspace }) }]);
|
|
77
|
+
}
|
|
31
78
|
const extraArgs = ['extra'];
|
|
32
79
|
if (dotfiles)
|
|
33
80
|
extraArgs.push('--dotfiles');
|
|
34
81
|
pushOption(extraArgs, '--ignore', ignore);
|
|
82
|
+
if (hash)
|
|
83
|
+
extraArgs.push('--hash');
|
|
84
|
+
if (abs_paths)
|
|
85
|
+
extraArgs.push('--abs-paths');
|
|
86
|
+
if (rel_paths)
|
|
87
|
+
extraArgs.push('--rel-paths');
|
|
35
88
|
const [status, extra] = await Promise.all([
|
|
36
|
-
runFossil(
|
|
89
|
+
runFossil(args, { workspace }),
|
|
37
90
|
runFossil(extraArgs, { workspace }),
|
|
38
91
|
]);
|
|
39
92
|
return renderSections([
|
|
@@ -57,10 +110,16 @@ export function registerVersionControlTools(server) {
|
|
|
57
110
|
verbose: flag('Print the complete text of added or deleted files (-v).'),
|
|
58
111
|
undo: flag('Diff against the undo buffer (--undo).'),
|
|
59
112
|
ignore_whitespace: flag('Ignore whitespace-only changes (-w).'),
|
|
113
|
+
ignore_trailing_space: flag('Ignore changes to end-of-line whitespace (-Z).'),
|
|
114
|
+
internal: flag('Use the internal diff logic (-i).'),
|
|
115
|
+
unified: flag('Print a unified diff (--unified).'),
|
|
116
|
+
versions_header: flag('Show the compared versions in the diff header (-h).'),
|
|
117
|
+
json: flag('Print the diff as JSON (--json).'),
|
|
118
|
+
width: z.number().int().min(20).optional().describe('Width of side-by-side lines (-W).'),
|
|
60
119
|
workspace: workspaceParam,
|
|
61
120
|
}),
|
|
62
121
|
annotations: { readOnlyHint: true },
|
|
63
|
-
}, async ({ from_version, to_version, files, branch, checkin, brief, stat, context: contextLines, side_by_side, verbose, undo, ignore_whitespace, workspace, }) => {
|
|
122
|
+
}, async ({ from_version, to_version, files, branch, checkin, brief, stat, context: contextLines, side_by_side, verbose, undo, ignore_whitespace, ignore_trailing_space, internal, unified, versions_header, json, width, workspace, }) => {
|
|
64
123
|
const args = ['diff'];
|
|
65
124
|
pushOption(args, '--from', from_version);
|
|
66
125
|
pushOption(args, '--to', to_version);
|
|
@@ -80,6 +139,18 @@ export function registerVersionControlTools(server) {
|
|
|
80
139
|
args.push('--undo');
|
|
81
140
|
if (ignore_whitespace)
|
|
82
141
|
args.push('-w');
|
|
142
|
+
if (ignore_trailing_space)
|
|
143
|
+
args.push('-Z');
|
|
144
|
+
if (internal)
|
|
145
|
+
args.push('-i');
|
|
146
|
+
if (unified)
|
|
147
|
+
args.push('--unified');
|
|
148
|
+
if (versions_header)
|
|
149
|
+
args.push('-h');
|
|
150
|
+
if (json)
|
|
151
|
+
args.push('--json');
|
|
152
|
+
if (width !== undefined)
|
|
153
|
+
args.push('-W', String(width));
|
|
83
154
|
if (files?.length)
|
|
84
155
|
args.push(...files);
|
|
85
156
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No differences found.' });
|
|
@@ -117,13 +188,20 @@ export function registerVersionControlTools(server) {
|
|
|
117
188
|
annotations: { readOnlyHint: true },
|
|
118
189
|
}, async ({ file, mode, brief, limit, offset, revision, verbose, workspace }) => {
|
|
119
190
|
const args = ['finfo'];
|
|
120
|
-
if (mode === 'id')
|
|
191
|
+
if (mode === 'id') {
|
|
121
192
|
args.push('-i');
|
|
122
|
-
|
|
193
|
+
pushOption(args, '-r', revision);
|
|
194
|
+
if (verbose)
|
|
195
|
+
args.push('-v');
|
|
196
|
+
}
|
|
197
|
+
else if (mode === 'status') {
|
|
123
198
|
args.push('-s');
|
|
124
|
-
|
|
199
|
+
}
|
|
200
|
+
else if (mode === 'print') {
|
|
125
201
|
args.push('-p');
|
|
126
|
-
|
|
202
|
+
pushOption(args, '-r', revision);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
127
205
|
if (brief)
|
|
128
206
|
args.push('-b');
|
|
129
207
|
if (limit !== undefined)
|
|
@@ -131,9 +209,6 @@ export function registerVersionControlTools(server) {
|
|
|
131
209
|
if (offset !== undefined)
|
|
132
210
|
args.push('--offset', String(offset));
|
|
133
211
|
}
|
|
134
|
-
pushOption(args, '-r', revision);
|
|
135
|
-
if (verbose)
|
|
136
|
-
args.push('-v');
|
|
137
212
|
args.push(file);
|
|
138
213
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
139
214
|
});
|
|
@@ -179,35 +254,88 @@ export function registerVersionControlTools(server) {
|
|
|
179
254
|
});
|
|
180
255
|
server.registerTool('fossil_tag', {
|
|
181
256
|
title: 'Tags',
|
|
182
|
-
description: 'List, add or cancel Fossil tags (symbolic labels attached to check-ins).',
|
|
257
|
+
description: 'List, find, add or cancel Fossil tags (symbolic labels attached to check-ins and other artifacts).',
|
|
183
258
|
inputSchema: z.object({
|
|
184
|
-
action: z.enum(['ls', 'add', 'cancel']).default('ls').describe('Tag sub-command.'),
|
|
185
|
-
tag_name: z.string().min(1).optional().describe('Tag name (required for add/cancel).'),
|
|
259
|
+
action: z.enum(['ls', 'find', 'add', 'cancel']).default('ls').describe('Tag sub-command.'),
|
|
260
|
+
tag_name: z.string().min(1).optional().describe('Tag name (required for find/add/cancel).'),
|
|
186
261
|
checkin: z
|
|
187
262
|
.string()
|
|
188
263
|
.min(1)
|
|
189
264
|
.optional()
|
|
190
|
-
.describe('Target check-in (required for add; defaults to tip for cancel).'),
|
|
265
|
+
.describe('Target check-in or artifact (required for add; defaults to tip for cancel, optional for list).'),
|
|
266
|
+
raw: flag('Use the raw tag name instead of a branch name (--raw).'),
|
|
267
|
+
propagate: flag('Propagate the tag to all descendants of the artifact; used with `add` (--propagate).'),
|
|
268
|
+
date_override: z
|
|
269
|
+
.string()
|
|
270
|
+
.min(1)
|
|
271
|
+
.optional()
|
|
272
|
+
.describe('Tag timestamp to store, e.g. "2026-11-17 12:00:00"; used with `add`/`cancel` (--date-override).'),
|
|
273
|
+
user_override: z
|
|
274
|
+
.string()
|
|
275
|
+
.min(1)
|
|
276
|
+
.optional()
|
|
277
|
+
.describe('Login to record as the tag author; used with `add`/`cancel` (--user-override).'),
|
|
278
|
+
dry_run: flag('Print the control artifact without writing it; used with `add`/`cancel` (-n).'),
|
|
279
|
+
type: z
|
|
280
|
+
.enum(['ci', 'w', 'e', 'f', 't'])
|
|
281
|
+
.optional()
|
|
282
|
+
.describe('Artifact type to match; used with `find` (-t).'),
|
|
283
|
+
limit: z.number().int().min(1).optional().describe('Maximum number of results; used with `find` (-n).'),
|
|
284
|
+
tagtype: z
|
|
285
|
+
.enum(['propagated', 'singleton', 'cancel'])
|
|
286
|
+
.optional()
|
|
287
|
+
.describe('List only tags of this type; used with `ls` (--tagtype).'),
|
|
288
|
+
inverse: flag('Invert the `tagtype` filter; used with `ls` (-v).'),
|
|
289
|
+
prefix: z.string().min(1).optional().describe('List only tags with this prefix; used with `ls` (--prefix).'),
|
|
191
290
|
workspace: workspaceParam,
|
|
192
291
|
}),
|
|
193
292
|
annotations: { idempotentHint: true },
|
|
194
|
-
}, async ({ action, tag_name, checkin, workspace }) => {
|
|
293
|
+
}, async ({ action, tag_name, checkin, raw, propagate, date_override, user_override, dry_run, type, limit, tagtype, inverse, prefix, workspace, }) => {
|
|
195
294
|
const name = clean(tag_name);
|
|
196
295
|
const target = clean(checkin);
|
|
197
|
-
|
|
296
|
+
const subcommand = action ?? 'ls';
|
|
297
|
+
if (subcommand === 'add' && (!name || !target)) {
|
|
198
298
|
return { content: [{ type: 'text', text: "ERROR: 'tag_name' and 'checkin' are required for action 'add'." }], isError: true };
|
|
199
299
|
}
|
|
200
|
-
if (
|
|
201
|
-
return {
|
|
300
|
+
if ((subcommand === 'cancel' || subcommand === 'find') && !name) {
|
|
301
|
+
return {
|
|
302
|
+
content: [{ type: 'text', text: `ERROR: 'tag_name' is required for action '${subcommand}'.` }],
|
|
303
|
+
isError: true,
|
|
304
|
+
};
|
|
202
305
|
}
|
|
203
|
-
const args = ['tag',
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
306
|
+
const args = ['tag', subcommand];
|
|
307
|
+
if (subcommand === 'ls') {
|
|
308
|
+
if (raw)
|
|
309
|
+
args.push('--raw');
|
|
310
|
+
pushOption(args, '--tagtype', tagtype);
|
|
311
|
+
if (inverse)
|
|
312
|
+
args.push('-v');
|
|
313
|
+
pushOption(args, '--prefix', prefix);
|
|
314
|
+
if (target)
|
|
315
|
+
args.push(target);
|
|
208
316
|
}
|
|
209
|
-
else if (
|
|
317
|
+
else if (subcommand === 'find') {
|
|
318
|
+
if (raw)
|
|
319
|
+
args.push('--raw');
|
|
320
|
+
pushOption(args, '-t', type);
|
|
321
|
+
if (limit !== undefined)
|
|
322
|
+
args.push('-n', String(limit));
|
|
210
323
|
if (name)
|
|
324
|
+
args.push(name);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
if (raw)
|
|
328
|
+
args.push('--raw');
|
|
329
|
+
if (subcommand === 'add' && propagate)
|
|
330
|
+
args.push('--propagate');
|
|
331
|
+
pushOption(args, '--date-override', date_override);
|
|
332
|
+
pushOption(args, '--user-override', user_override);
|
|
333
|
+
if (dry_run)
|
|
334
|
+
args.push('-n');
|
|
335
|
+
// `fossil tag cancel` always needs an artifact id; 'tip' is the sane default.
|
|
336
|
+
if (subcommand === 'add' && name && target)
|
|
337
|
+
args.push(name, target);
|
|
338
|
+
else if (subcommand === 'cancel' && name)
|
|
211
339
|
args.push(name, target ?? 'tip');
|
|
212
340
|
}
|
|
213
341
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No tags.' });
|
|
@@ -221,18 +349,27 @@ export function registerVersionControlTools(server) {
|
|
|
221
349
|
clean: z.string().min(1).optional().describe('Comma-separated glob patterns of clean files to ignore (--clean).'),
|
|
222
350
|
reset: flag('Reset the ADDED/DELETED state of the check-out instead (--reset).'),
|
|
223
351
|
dry_run: flag('Show what would be staged without changing anything (-n/--dry-run).'),
|
|
352
|
+
case_sensitive: z
|
|
353
|
+
.boolean()
|
|
354
|
+
.optional()
|
|
355
|
+
.describe('Override the case-sensitive setting (--case-sensitive).'),
|
|
356
|
+
verbose: flag('Report each file while resetting, with reset: true (-v).'),
|
|
224
357
|
workspace: workspaceParam,
|
|
225
358
|
}),
|
|
226
|
-
}, async ({ dotfiles, ignore, clean: cleanGlob, reset, dry_run, workspace }) => {
|
|
359
|
+
}, async ({ dotfiles, ignore, clean: cleanGlob, reset, dry_run, case_sensitive, verbose, workspace }) => {
|
|
227
360
|
const args = ['addremove'];
|
|
228
361
|
if (dry_run)
|
|
229
362
|
args.push('-n');
|
|
230
363
|
if (reset) {
|
|
231
364
|
args.push('--reset');
|
|
365
|
+
if (verbose)
|
|
366
|
+
args.push('-v');
|
|
232
367
|
}
|
|
233
368
|
else {
|
|
234
369
|
if (dotfiles)
|
|
235
370
|
args.push('--dotfiles');
|
|
371
|
+
if (case_sensitive !== undefined)
|
|
372
|
+
args.push('--case-sensitive', case_sensitive ? '1' : '0');
|
|
236
373
|
pushOption(args, '--ignore', ignore);
|
|
237
374
|
pushOption(args, '--clean', cleanGlob);
|
|
238
375
|
}
|
|
@@ -240,8 +377,8 @@ export function registerVersionControlTools(server) {
|
|
|
240
377
|
});
|
|
241
378
|
server.registerTool('fossil_commit', {
|
|
242
379
|
title: 'Commit',
|
|
243
|
-
description: 'Create a check-in from the staged/current changes. Answers the interactive "commit anyhow"
|
|
244
|
-
|
|
380
|
+
description: 'Create a check-in from the staged/current changes. Answers the interactive "continue" and "commit anyhow" ' +
|
|
381
|
+
'prompts automatically.',
|
|
245
382
|
inputSchema: z.object({
|
|
246
383
|
message: z.string().min(1).describe('Commit message.'),
|
|
247
384
|
files: filesParam.describe('Files to commit. Omit to commit everything that changed.'),
|
|
@@ -252,10 +389,14 @@ export function registerVersionControlTools(server) {
|
|
|
252
389
|
tags: z.array(z.string().min(1)).optional().describe('Tags to attach to the new check-in (--tag).'),
|
|
253
390
|
close: flag('Close the branch being committed (--close).'),
|
|
254
391
|
bgcolor: z.string().min(1).optional().describe('Background colour for this one check-in (--bgcolor).'),
|
|
255
|
-
|
|
392
|
+
date_override: z
|
|
393
|
+
.string()
|
|
394
|
+
.min(1)
|
|
395
|
+
.optional()
|
|
396
|
+
.describe('Check-in timestamp to store instead of now, e.g. "2026-11-17 12:00:00" (--date-override).'),
|
|
256
397
|
workspace: workspaceParam,
|
|
257
398
|
}),
|
|
258
|
-
}, async ({ message, files, branch, no_warnings, allow_empty, user_override, tags, close, bgcolor,
|
|
399
|
+
}, async ({ message, files, branch, no_warnings, allow_empty, user_override, tags, close, bgcolor, date_override, workspace }) => {
|
|
259
400
|
const args = ['commit', '-m', message];
|
|
260
401
|
pushOption(args, '--branch', branch);
|
|
261
402
|
if (no_warnings)
|
|
@@ -265,13 +406,16 @@ export function registerVersionControlTools(server) {
|
|
|
265
406
|
if (close)
|
|
266
407
|
args.push('--close');
|
|
267
408
|
pushOption(args, '--bgcolor', bgcolor);
|
|
268
|
-
pushOption(args, '--
|
|
409
|
+
pushOption(args, '--date-override', date_override);
|
|
269
410
|
for (const tag of tags ?? [])
|
|
270
411
|
args.push('--tag', tag);
|
|
271
412
|
pushOption(args, '--user-override', user_override);
|
|
272
413
|
if (files?.length)
|
|
273
414
|
args.push(...files);
|
|
274
|
-
|
|
415
|
+
// Fossil asks "continue (y/N)?" for unknown file arguments and
|
|
416
|
+
// "Commit anyhow (a=all/y/N)?" for warned files. "y" then "a" answers
|
|
417
|
+
// both, and a single prompt just consumes the first line.
|
|
418
|
+
return renderOutcome(await runFossil(args, { workspace, input: 'y\na\n' }));
|
|
275
419
|
});
|
|
276
420
|
server.registerTool('fossil_add', {
|
|
277
421
|
title: 'Add files',
|
|
@@ -285,10 +429,16 @@ export function registerVersionControlTools(server) {
|
|
|
285
429
|
force: z.boolean().default(true).describe('Add even when a file matches ignore-glob, without prompting (-f).'),
|
|
286
430
|
reset: flag('Reset the ADDED state instead of adding files (--reset).'),
|
|
287
431
|
ignore: z.string().min(1).optional().describe('Ignore unmanaged files matching these globs (--ignore).'),
|
|
432
|
+
clean: z.string().min(1).optional().describe('Also ignore files matching these globs (--clean).'),
|
|
433
|
+
case_sensitive: z
|
|
434
|
+
.boolean()
|
|
435
|
+
.optional()
|
|
436
|
+
.describe('Override the case-sensitive setting (--case-sensitive).'),
|
|
437
|
+
allow_reserved: flag('Add file names that Windows reserves, such as `CON` or `NUL` (--allow-reserved).'),
|
|
288
438
|
verbose: flag('Report each file while resetting, with reset: true (-v).'),
|
|
289
439
|
workspace: workspaceParam,
|
|
290
440
|
}),
|
|
291
|
-
}, async ({ files, dotfiles, force, reset, ignore, verbose, workspace }) => {
|
|
441
|
+
}, async ({ files, dotfiles, force, reset, ignore, clean: cleanGlob, case_sensitive, allow_reserved, verbose, workspace }) => {
|
|
292
442
|
const args = ['add'];
|
|
293
443
|
if (reset) {
|
|
294
444
|
args.push('--reset');
|
|
@@ -308,7 +458,12 @@ export function registerVersionControlTools(server) {
|
|
|
308
458
|
args.push('--dotfiles');
|
|
309
459
|
if (force !== false)
|
|
310
460
|
args.push('-f');
|
|
461
|
+
if (case_sensitive !== undefined)
|
|
462
|
+
args.push('--case-sensitive', case_sensitive ? '1' : '0');
|
|
463
|
+
if (allow_reserved)
|
|
464
|
+
args.push('--allow-reserved');
|
|
311
465
|
pushOption(args, '--ignore', ignore);
|
|
466
|
+
pushOption(args, '--clean', cleanGlob);
|
|
312
467
|
args.push(...files);
|
|
313
468
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
314
469
|
});
|
|
@@ -318,25 +473,39 @@ export function registerVersionControlTools(server) {
|
|
|
318
473
|
inputSchema: z.object({
|
|
319
474
|
files: z.array(z.string().min(1)).min(1).describe('Files or directories to remove.'),
|
|
320
475
|
force: flag('Also delete from disk (--hard).'),
|
|
321
|
-
keep: flag('Keep files on disk (--soft)
|
|
476
|
+
keep: flag('Keep files on disk (--soft); takes precedence over `force`.'),
|
|
322
477
|
dry_run: flag('Show what would be removed without changing anything (-n).'),
|
|
323
478
|
reset: flag('Reset the DELETED state instead of removing files (--reset).'),
|
|
324
|
-
verbose: flag('Report each file when resetting (--verbose)
|
|
479
|
+
verbose: flag('Report each file when resetting (--verbose); used with `reset`.'),
|
|
480
|
+
case_sensitive: z
|
|
481
|
+
.boolean()
|
|
482
|
+
.optional()
|
|
483
|
+
.describe('Override the case-sensitive setting (--case-sensitive).'),
|
|
325
484
|
workspace: workspaceParam,
|
|
326
485
|
}),
|
|
327
486
|
annotations: { destructiveHint: true },
|
|
328
|
-
}, async ({ files, force, keep, dry_run, reset, verbose, workspace }) => {
|
|
487
|
+
}, async ({ files, force, keep, dry_run, reset, verbose, case_sensitive, workspace }) => {
|
|
329
488
|
const args = ['rm'];
|
|
330
|
-
if (
|
|
331
|
-
args.push('--hard');
|
|
332
|
-
if (keep)
|
|
333
|
-
args.push('--soft');
|
|
334
|
-
if (reset)
|
|
489
|
+
if (reset) {
|
|
335
490
|
args.push('--reset');
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
491
|
+
if (verbose)
|
|
492
|
+
args.push('--verbose');
|
|
493
|
+
if (dry_run)
|
|
494
|
+
args.push('-n');
|
|
495
|
+
}
|
|
496
|
+
else if (keep) {
|
|
497
|
+
args.push('--soft');
|
|
498
|
+
if (dry_run)
|
|
499
|
+
args.push('-n');
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
if (force)
|
|
503
|
+
args.push('--hard');
|
|
504
|
+
if (dry_run)
|
|
505
|
+
args.push('-n');
|
|
506
|
+
}
|
|
507
|
+
if (case_sensitive !== undefined)
|
|
508
|
+
args.push('--case-sensitive', case_sensitive ? '1' : '0');
|
|
340
509
|
args.push(...files);
|
|
341
510
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
342
511
|
});
|
|
@@ -351,12 +520,15 @@ export function registerVersionControlTools(server) {
|
|
|
351
520
|
.boolean()
|
|
352
521
|
.optional()
|
|
353
522
|
.describe('Explicitly set the case-sensitive behaviour (--case-sensitive 1/0).'),
|
|
523
|
+
dry_run: flag('Print the RENAME event without changing anything (-n).'),
|
|
354
524
|
workspace: workspaceParam,
|
|
355
525
|
}),
|
|
356
|
-
}, async ({ old_name, new_name, hard, case_sensitive, workspace }) => {
|
|
526
|
+
}, async ({ old_name, new_name, hard, case_sensitive, dry_run, workspace }) => {
|
|
357
527
|
const args = ['mv', hard !== false ? '--hard' : '--soft'];
|
|
358
528
|
if (case_sensitive !== undefined)
|
|
359
529
|
args.push('--case-sensitive', case_sensitive ? '1' : '0');
|
|
530
|
+
if (dry_run)
|
|
531
|
+
args.push('-n');
|
|
360
532
|
args.push(old_name, new_name);
|
|
361
533
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
362
534
|
});
|
|
@@ -396,13 +568,41 @@ export function registerVersionControlTools(server) {
|
|
|
396
568
|
description: 'Delete untracked files from the workspace. Destructive: preview with dry_run first. ' +
|
|
397
569
|
'Without flags it runs non-interactively (--no-prompt).',
|
|
398
570
|
inputSchema: z.object({
|
|
399
|
-
all_files: flag('
|
|
571
|
+
all_files: flag('Delete every unmanaged file without confirmation (-f).'),
|
|
400
572
|
dry_run: flag('Only list what would be deleted (-n).'),
|
|
573
|
+
dotfiles: flag('Include files and directories whose name starts with a dot (--dotfiles).'),
|
|
574
|
+
ignore: z.string().min(1).optional().describe('Keep unmanaged files matching these globs (--ignore).'),
|
|
575
|
+
clean: z.string().min(1).optional().describe('Delete matching files without prompting (--clean).'),
|
|
576
|
+
verily: flag('Remove everything that is not managed, including dot-files and ignored files, without the undo buffer (-x).'),
|
|
577
|
+
temp: flag('Remove only Fossil-generated temporary files (--temp).'),
|
|
578
|
+
dirs_only: flag('Remove empty directories only, no files (--dirsonly).'),
|
|
579
|
+
empty_dirs: flag('Remove empty directories after deleting files (--emptydirs).'),
|
|
580
|
+
verbose: flag('Report each file as it is removed (-v).'),
|
|
401
581
|
workspace: workspaceParam,
|
|
402
582
|
}),
|
|
403
583
|
annotations: { destructiveHint: true },
|
|
404
|
-
}, async ({ all_files, dry_run, workspace }) => {
|
|
405
|
-
const args = ['clean'
|
|
584
|
+
}, async ({ all_files, dry_run, dotfiles, ignore, clean: cleanGlob, verily, temp, dirs_only, empty_dirs, verbose, workspace }) => {
|
|
585
|
+
const args = ['clean'];
|
|
586
|
+
if (dry_run)
|
|
587
|
+
args.push('-n');
|
|
588
|
+
else if (all_files)
|
|
589
|
+
args.push('-f');
|
|
590
|
+
else if (!verily)
|
|
591
|
+
args.push('--no-prompt');
|
|
592
|
+
if (dotfiles)
|
|
593
|
+
args.push('--dotfiles');
|
|
594
|
+
pushOption(args, '--ignore', ignore);
|
|
595
|
+
pushOption(args, '--clean', cleanGlob);
|
|
596
|
+
if (verily)
|
|
597
|
+
args.push('-x');
|
|
598
|
+
if (temp)
|
|
599
|
+
args.push('--temp');
|
|
600
|
+
if (dirs_only)
|
|
601
|
+
args.push('--dirsonly');
|
|
602
|
+
if (empty_dirs)
|
|
603
|
+
args.push('--emptydirs');
|
|
604
|
+
if (verbose)
|
|
605
|
+
args.push('-v');
|
|
406
606
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'Nothing to clean.' });
|
|
407
607
|
});
|
|
408
608
|
server.registerTool('fossil_timeline', {
|
|
@@ -429,10 +629,12 @@ export function registerVersionControlTools(server) {
|
|
|
429
629
|
.optional()
|
|
430
630
|
.describe("Entry format (-F), e.g. 'oneline' or '%h %d %c'."),
|
|
431
631
|
verbose: flag('List the files changed by each check-in (-v).'),
|
|
632
|
+
offset: z.number().int().min(0).optional().describe('Skip this many entries before reporting (--offset).'),
|
|
633
|
+
width: z.number().int().min(20).optional().describe('Width of the output lines (-W).'),
|
|
432
634
|
workspace: workspaceParam,
|
|
433
635
|
}),
|
|
434
636
|
annotations: { readOnlyHint: true },
|
|
435
|
-
}, async ({ limit, path: targetPath, type_filter, branch, current_branch, when, checkin, format, verbose, workspace }) => {
|
|
637
|
+
}, async ({ limit, path: targetPath, type_filter, branch, current_branch, when, checkin, format, verbose, offset, width, workspace, }) => {
|
|
436
638
|
const args = ['timeline', '-n', String(limit ?? 20)];
|
|
437
639
|
pushOption(args, '-p', targetPath);
|
|
438
640
|
pushOption(args, '-t', type_filter);
|
|
@@ -446,6 +648,10 @@ export function registerVersionControlTools(server) {
|
|
|
446
648
|
pushOption(args, '-F', format);
|
|
447
649
|
if (verbose)
|
|
448
650
|
args.push('-v');
|
|
651
|
+
if (offset !== undefined)
|
|
652
|
+
args.push('--offset', String(offset));
|
|
653
|
+
if (width !== undefined)
|
|
654
|
+
args.push('-W', String(width));
|
|
449
655
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No events.' });
|
|
450
656
|
});
|
|
451
657
|
server.registerTool('fossil_info', {
|
|
@@ -453,36 +659,98 @@ export function registerVersionControlTools(server) {
|
|
|
453
659
|
description: 'Repository/check-out metadata, or details about a specific file, check-in or branch.',
|
|
454
660
|
inputSchema: z.object({
|
|
455
661
|
target: z.string().optional().describe('File name, check-in hash or branch. Omit for general repository info.'),
|
|
662
|
+
verbose: flag('Show extra details, such as the SQLite version and repository size (-v).'),
|
|
456
663
|
workspace: workspaceParam,
|
|
457
664
|
}),
|
|
458
665
|
annotations: { readOnlyHint: true },
|
|
459
|
-
}, async ({ target, workspace }) => {
|
|
666
|
+
}, async ({ target, verbose, workspace }) => {
|
|
460
667
|
const targetValue = clean(target);
|
|
461
668
|
const args = targetValue ? ['info', targetValue] : ['info'];
|
|
669
|
+
if (verbose)
|
|
670
|
+
args.push('-v');
|
|
462
671
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
463
672
|
});
|
|
464
673
|
server.registerTool('fossil_branch', {
|
|
465
674
|
title: 'Branches',
|
|
466
|
-
description: 'List
|
|
675
|
+
description: 'List, inspect, create, close, reopen, hide or unhide branches.',
|
|
467
676
|
inputSchema: z.object({
|
|
468
|
-
action: z
|
|
469
|
-
|
|
677
|
+
action: z
|
|
678
|
+
.enum(['ls', 'new', 'info', 'current', 'close', 'reopen', 'hide', 'unhide'])
|
|
679
|
+
.default('ls')
|
|
680
|
+
.describe("Branch sub-command: 'ls' lists branches, 'new' creates one, 'info'/'current' report"),
|
|
681
|
+
branch_name: z
|
|
682
|
+
.string()
|
|
683
|
+
.min(1)
|
|
684
|
+
.optional()
|
|
685
|
+
.describe("Branch to act on (required for 'new', 'info', 'close', 'reopen', 'hide' and 'unhide')."),
|
|
470
686
|
basis: z
|
|
471
687
|
.string()
|
|
472
688
|
.min(1)
|
|
473
689
|
.optional()
|
|
474
690
|
.describe("Starting point for the new branch (check-in or branch). Defaults to 'current'."),
|
|
691
|
+
all: flag('List all branches, including closed ones (-a).'),
|
|
692
|
+
closed: flag('List only closed branches (-c).'),
|
|
693
|
+
private_branches: flag('List only private branches (-p).'),
|
|
694
|
+
reverse: flag('Reverse the sort order (-r).'),
|
|
695
|
+
time_order: flag('Show recently changed branches first (-t).'),
|
|
696
|
+
dry_run: flag('Print the control artifact without committing it; used with close/reopen/hide/unhide (-n).'),
|
|
697
|
+
verbose: flag('Report more detail; used with close/reopen (-v).'),
|
|
698
|
+
date_override: z
|
|
699
|
+
.string()
|
|
700
|
+
.min(1)
|
|
701
|
+
.optional()
|
|
702
|
+
.describe('Timestamp to store instead of now (--date-override).'),
|
|
703
|
+
user_override: z
|
|
704
|
+
.string()
|
|
705
|
+
.min(1)
|
|
706
|
+
.optional()
|
|
707
|
+
.describe('Login to record as the author (--user-override).'),
|
|
708
|
+
bgcolor: z.string().min(1).optional().describe('Background colour for the new branch (--bgcolor).'),
|
|
709
|
+
private_branch: flag('Keep the new branch local; used with `new` (--private).'),
|
|
475
710
|
workspace: workspaceParam,
|
|
476
711
|
}),
|
|
477
|
-
}, async ({ action, branch_name, basis, workspace }) => {
|
|
712
|
+
}, async ({ action, branch_name, basis, all, closed, private_branches, reverse, time_order, dry_run, verbose, date_override, user_override, bgcolor, private_branch, workspace, }) => {
|
|
478
713
|
const name = clean(branch_name);
|
|
479
|
-
|
|
480
|
-
|
|
714
|
+
const subcommand = action ?? 'ls';
|
|
715
|
+
if (['new', 'info', 'close', 'reopen', 'hide', 'unhide'].includes(subcommand) && !name) {
|
|
716
|
+
return {
|
|
717
|
+
content: [{ type: 'text', text: `ERROR: 'branch_name' is required for action '${subcommand}'.` }],
|
|
718
|
+
isError: true,
|
|
719
|
+
};
|
|
481
720
|
}
|
|
482
|
-
const args = ['branch',
|
|
483
|
-
|
|
484
|
-
|
|
721
|
+
const args = ['branch', subcommand];
|
|
722
|
+
if (subcommand === 'ls') {
|
|
723
|
+
if (all)
|
|
724
|
+
args.push('-a');
|
|
725
|
+
if (closed)
|
|
726
|
+
args.push('-c');
|
|
727
|
+
if (private_branches)
|
|
728
|
+
args.push('-p');
|
|
729
|
+
if (reverse)
|
|
730
|
+
args.push('-r');
|
|
731
|
+
if (time_order)
|
|
732
|
+
args.push('-t');
|
|
733
|
+
}
|
|
734
|
+
else if (subcommand === 'new' && name) {
|
|
735
|
+
// Fossil requires an explicit basis, 'current' means the checked-out branch.
|
|
485
736
|
args.push(name, clean(basis) ?? 'current');
|
|
737
|
+
if (private_branch)
|
|
738
|
+
args.push('--private');
|
|
739
|
+
pushOption(args, '--bgcolor', bgcolor);
|
|
740
|
+
}
|
|
741
|
+
else if (name) {
|
|
742
|
+
args.push(name);
|
|
743
|
+
if (['close', 'reopen', 'hide', 'unhide'].includes(subcommand)) {
|
|
744
|
+
if (dry_run)
|
|
745
|
+
args.push('-n');
|
|
746
|
+
if (verbose)
|
|
747
|
+
args.push('-v');
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (subcommand !== 'ls' && subcommand !== 'current') {
|
|
751
|
+
pushOption(args, '--date-override', date_override);
|
|
752
|
+
pushOption(args, '--user-override', user_override);
|
|
753
|
+
}
|
|
486
754
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
487
755
|
});
|
|
488
756
|
server.registerTool('fossil_merge', {
|
|
@@ -497,6 +765,7 @@ export function registerVersionControlTools(server) {
|
|
|
497
765
|
baseline: z.string().min(1).optional().describe('Use this version as the merge pivot (--baseline).'),
|
|
498
766
|
binary: z.string().min(1).optional().describe('Skip parallel changes of files matching this glob (--binary).'),
|
|
499
767
|
force: flag('Force the merge even if it would be a no-op (-f).'),
|
|
768
|
+
force_missing: flag('Merge even when content of one side is missing (--force-missing).'),
|
|
500
769
|
keep_merge_files: flag('Keep the temporary merge files on conflict (-K).'),
|
|
501
770
|
verbose: flag('Report each file as it is merged (-v).'),
|
|
502
771
|
workspace: workspaceParam,
|
|
@@ -533,11 +802,12 @@ export function registerVersionControlTools(server) {
|
|
|
533
802
|
no_sync: flag('Skip the automatic sync before updating (--nosync).'),
|
|
534
803
|
set_mtime: flag('Stamp every file with its last-check-in time (--setmtime).'),
|
|
535
804
|
keep_merge_files: flag('Keep the temporary merge files (-K).'),
|
|
805
|
+
force_missing: flag('Update even when content of one side is missing (--force-missing).'),
|
|
536
806
|
verbose: flag('Report the state of every file (-v).'),
|
|
537
807
|
workspace: workspaceParam,
|
|
538
808
|
}),
|
|
539
809
|
annotations: { destructiveHint: true },
|
|
540
|
-
}, async ({ target, latest, dry_run, no_sync, set_mtime, keep_merge_files, verbose, workspace }) => {
|
|
810
|
+
}, async ({ target, latest, dry_run, no_sync, set_mtime, keep_merge_files, force_missing, verbose, workspace }) => {
|
|
541
811
|
const args = ['update'];
|
|
542
812
|
if (latest)
|
|
543
813
|
args.push('--latest');
|
|
@@ -549,6 +819,8 @@ export function registerVersionControlTools(server) {
|
|
|
549
819
|
args.push('--setmtime');
|
|
550
820
|
if (keep_merge_files)
|
|
551
821
|
args.push('-K');
|
|
822
|
+
if (force_missing)
|
|
823
|
+
args.push('--force-missing');
|
|
552
824
|
if (verbose)
|
|
553
825
|
args.push('-v');
|
|
554
826
|
const targetValue = clean(target);
|
|
@@ -578,14 +850,24 @@ export function registerVersionControlTools(server) {
|
|
|
578
850
|
renamed: flag('Only renamed files (--renamed).'),
|
|
579
851
|
conflict: flag('Only files with merge conflicts (--conflict).'),
|
|
580
852
|
meta: flag('Only files with metadata changes (--meta).'),
|
|
853
|
+
changed: flag('Edited and updated files together (--changed).'),
|
|
854
|
+
missing: flag('Only missing files (--missing).'),
|
|
855
|
+
unchanged: flag('Only unchanged files (--unchanged).'),
|
|
856
|
+
extra: flag('Only unmanaged files (--extra).'),
|
|
857
|
+
differ: flag('All differences against the check-out, including unmanaged files (--differ).'),
|
|
858
|
+
all: flag('Every managed file, i.e. all change types (--all).'),
|
|
581
859
|
classify: flag('Start each line with the change type (--classify).'),
|
|
582
860
|
no_merge: flag('Hide merge contributors (--no-merge).'),
|
|
861
|
+
hash: flag('Verify file status by hashing instead of size and mtime (--hash).'),
|
|
862
|
+
header: flag('Print the repository name above a non-empty report (--header).'),
|
|
863
|
+
verbose: flag('Print "(none)" when the report is empty (-v).'),
|
|
583
864
|
dotfiles: flag('Include unmanaged files whose name starts with a dot (--dotfiles).'),
|
|
584
865
|
absolute_paths: flag('Print absolute pathnames (--abs-paths).'),
|
|
866
|
+
relative_paths: flag('Print pathnames relative to the current directory (--rel-paths).'),
|
|
585
867
|
workspace: workspaceParam,
|
|
586
868
|
}),
|
|
587
869
|
annotations: { readOnlyHint: true },
|
|
588
|
-
}, async ({ files, edited, updated, added, deleted, renamed, conflict, meta, classify, no_merge, dotfiles, absolute_paths, workspace, }) => {
|
|
870
|
+
}, async ({ files, edited, updated, added, deleted, renamed, conflict, meta, changed, missing, unchanged, extra, differ, all, classify, no_merge, hash, header, verbose, dotfiles, absolute_paths, relative_paths, workspace, }) => {
|
|
589
871
|
const args = ['changes'];
|
|
590
872
|
const filters = [
|
|
591
873
|
[edited, '--edited'],
|
|
@@ -595,6 +877,12 @@ export function registerVersionControlTools(server) {
|
|
|
595
877
|
[renamed, '--renamed'],
|
|
596
878
|
[conflict, '--conflict'],
|
|
597
879
|
[meta, '--meta'],
|
|
880
|
+
[changed, '--changed'],
|
|
881
|
+
[missing, '--missing'],
|
|
882
|
+
[unchanged, '--unchanged'],
|
|
883
|
+
[extra, '--extra'],
|
|
884
|
+
[differ, '--differ'],
|
|
885
|
+
[all, '--all'],
|
|
598
886
|
];
|
|
599
887
|
for (const [enabled, option] of filters)
|
|
600
888
|
if (enabled)
|
|
@@ -603,10 +891,18 @@ export function registerVersionControlTools(server) {
|
|
|
603
891
|
args.push('--classify');
|
|
604
892
|
if (no_merge)
|
|
605
893
|
args.push('--no-merge');
|
|
894
|
+
if (hash)
|
|
895
|
+
args.push('--hash');
|
|
896
|
+
if (header)
|
|
897
|
+
args.push('--header');
|
|
898
|
+
if (verbose)
|
|
899
|
+
args.push('-v');
|
|
606
900
|
if (dotfiles)
|
|
607
901
|
args.push('--dotfiles');
|
|
608
902
|
if (absolute_paths)
|
|
609
903
|
args.push('--abs-paths');
|
|
904
|
+
if (relative_paths)
|
|
905
|
+
args.push('--rel-paths');
|
|
610
906
|
if (files?.length)
|
|
611
907
|
args.push(...files);
|
|
612
908
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No changes.' });
|
|
@@ -846,7 +1142,7 @@ export function registerVersionControlTools(server) {
|
|
|
846
1142
|
age: flag('Show when each file was committed (--age).'),
|
|
847
1143
|
verbose: flag('Show extra information, including change status (--verbose).'),
|
|
848
1144
|
time_order: flag('Sort by time instead of name (-t).'),
|
|
849
|
-
hash: flag('Verify file status by hashing instead of size and mtime (--hash).'),
|
|
1145
|
+
hash: flag('Verify file status by hashing instead of size and mtime (--hash); adds --verbose.'),
|
|
850
1146
|
workspace: workspaceParam,
|
|
851
1147
|
}),
|
|
852
1148
|
annotations: { readOnlyHint: true },
|
|
@@ -855,7 +1151,7 @@ export function registerVersionControlTools(server) {
|
|
|
855
1151
|
pushOption(args, '-r', revision);
|
|
856
1152
|
if (age)
|
|
857
1153
|
args.push('--age');
|
|
858
|
-
if (verbose)
|
|
1154
|
+
if (verbose || hash)
|
|
859
1155
|
args.push('-v');
|
|
860
1156
|
if (time_order)
|
|
861
1157
|
args.push('-t');
|
|
@@ -961,29 +1257,58 @@ export function registerVersionControlTools(server) {
|
|
|
961
1257
|
});
|
|
962
1258
|
server.registerTool('fossil_unversioned', {
|
|
963
1259
|
title: 'Unversioned files',
|
|
964
|
-
description: 'List, print, add, remove or timestamp the unversioned files the repository keeps without history
|
|
1260
|
+
description: 'List, print, add, remove or timestamp the unversioned files the repository keeps without history, ' +
|
|
1261
|
+
'and sync or revert them against a remote.',
|
|
965
1262
|
inputSchema: z.object({
|
|
966
1263
|
action: z
|
|
967
|
-
.enum(['list', 'cat', 'add', 'remove', 'touch'])
|
|
1264
|
+
.enum(['list', 'cat', 'add', 'remove', 'touch', 'sync', 'revert'])
|
|
968
1265
|
.default('list')
|
|
969
|
-
.describe('list: show them; cat: print content; add/remove: change the set; touch: update timestamps
|
|
1266
|
+
.describe('list: show them; cat: print content; add/remove: change the set; touch: update timestamps; ' +
|
|
1267
|
+
'sync/revert: exchange them with a remote.'),
|
|
970
1268
|
files: filesParam.describe('Files the action applies to.'),
|
|
971
|
-
glob: z
|
|
972
|
-
|
|
1269
|
+
glob: z
|
|
1270
|
+
.string()
|
|
1271
|
+
.min(1)
|
|
1272
|
+
.optional()
|
|
1273
|
+
.describe('Match names by this glob, in `list` and `remove` (--glob).'),
|
|
1274
|
+
like: z
|
|
1275
|
+
.string()
|
|
1276
|
+
.min(1)
|
|
1277
|
+
.optional()
|
|
1278
|
+
.describe('Match names like this pattern, in `list` and `remove` (--like).'),
|
|
1279
|
+
url: z.string().min(1).optional().describe('Remote URL for `sync` and `revert`; defaults to the configured remote.'),
|
|
1280
|
+
mtime: z
|
|
1281
|
+
.string()
|
|
1282
|
+
.min(1)
|
|
1283
|
+
.optional()
|
|
1284
|
+
.describe('Timestamp to store instead of now, for add/remove/touch (--mtime).'),
|
|
1285
|
+
verbose: flag('Report extra diagnostics; used with `sync` and `revert` (-v).'),
|
|
1286
|
+
dry_run: flag('Show what would happen without changing anything; used with `sync` and `revert` (-n).'),
|
|
973
1287
|
workspace: workspaceParam,
|
|
974
1288
|
}),
|
|
975
1289
|
annotations: {},
|
|
976
|
-
}, async ({ action, files, glob, like, workspace }) => {
|
|
1290
|
+
}, async ({ action, files, glob, like, url, mtime, verbose, dry_run, workspace }) => {
|
|
977
1291
|
const args = ['unversioned', action];
|
|
978
|
-
|
|
979
|
-
|
|
1292
|
+
if (action === 'list' || action === 'remove') {
|
|
1293
|
+
pushOption(args, '--glob', glob);
|
|
1294
|
+
pushOption(args, '--like', like);
|
|
1295
|
+
}
|
|
1296
|
+
pushOption(args, '--mtime', mtime);
|
|
1297
|
+
if (action === 'sync' || action === 'revert') {
|
|
1298
|
+
if (verbose)
|
|
1299
|
+
args.push('-v');
|
|
1300
|
+
if (dry_run)
|
|
1301
|
+
args.push('-n');
|
|
1302
|
+
if (url)
|
|
1303
|
+
args.push(url);
|
|
1304
|
+
}
|
|
980
1305
|
if (files && files.length > 0)
|
|
981
1306
|
args.push(...files);
|
|
982
|
-
const needsFiles =
|
|
983
|
-
if (needsFiles) {
|
|
1307
|
+
const needsFiles = ['cat', 'add', 'touch'].includes(action);
|
|
1308
|
+
if (needsFiles && !(files && files.length > 0)) {
|
|
984
1309
|
return {
|
|
985
1310
|
isError: true,
|
|
986
|
-
content: [{ type: 'text', text: `ERROR: action '${action}' needs \`files
|
|
1311
|
+
content: [{ type: 'text', text: `ERROR: action '${action}' needs \`files\`.` }],
|
|
987
1312
|
};
|
|
988
1313
|
}
|
|
989
1314
|
return renderOutcome(await runFossil(args, { workspace }), { emptyText: 'No unversioned files.' });
|
|
@@ -997,15 +1322,36 @@ export function registerVersionControlTools(server) {
|
|
|
997
1322
|
.enum(['now', 'checkin', 'checkout'])
|
|
998
1323
|
.default('now')
|
|
999
1324
|
.describe('now: current time; checkin: last check-in that modified each file; checkout: the checked-out version.'),
|
|
1325
|
+
glob: z
|
|
1326
|
+
.string()
|
|
1327
|
+
.min(1)
|
|
1328
|
+
.optional()
|
|
1329
|
+
.describe('Comma-separated glob patterns, evaluated from the top of the source tree (-g).'),
|
|
1330
|
+
glob_file: z
|
|
1331
|
+
.string()
|
|
1332
|
+
.min(1)
|
|
1333
|
+
.optional()
|
|
1334
|
+
.describe('Fossil glob-list file to read patterns from (-G).'),
|
|
1335
|
+
verbose: flag('Report the globs and each file touched (-v).'),
|
|
1336
|
+
dry_run: flag('List the files that need touching without touching them (-n).'),
|
|
1337
|
+
quiet: flag('Suppress warnings about skipped unmanaged or out-of-tree files (-q).'),
|
|
1000
1338
|
workspace: workspaceParam,
|
|
1001
1339
|
}),
|
|
1002
1340
|
annotations: {},
|
|
1003
|
-
}, async ({ files, mode, workspace }) => {
|
|
1341
|
+
}, async ({ files, mode, glob, glob_file, verbose, dry_run, quiet, workspace }) => {
|
|
1004
1342
|
const args = ['touch'];
|
|
1005
1343
|
if (mode === 'checkin')
|
|
1006
1344
|
args.push('-c');
|
|
1007
1345
|
else if (mode === 'checkout')
|
|
1008
1346
|
args.push('-C');
|
|
1347
|
+
pushOption(args, '-g', glob);
|
|
1348
|
+
pushOption(args, '-G', glob_file);
|
|
1349
|
+
if (verbose)
|
|
1350
|
+
args.push('-v');
|
|
1351
|
+
if (dry_run)
|
|
1352
|
+
args.push('-n');
|
|
1353
|
+
if (quiet)
|
|
1354
|
+
args.push('-q');
|
|
1009
1355
|
if (files && files.length > 0)
|
|
1010
1356
|
args.push(...files);
|
|
1011
1357
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
@@ -1016,8 +1362,21 @@ export function registerVersionControlTools(server) {
|
|
|
1016
1362
|
inputSchema: z.object({
|
|
1017
1363
|
checkin: z.string().min(1).describe('Check-in to amend, such as tip or a hash.'),
|
|
1018
1364
|
comment: z.string().min(1).optional().describe('Replacement comment (-m).'),
|
|
1365
|
+
message_file: z
|
|
1366
|
+
.string()
|
|
1367
|
+
.min(1)
|
|
1368
|
+
.optional()
|
|
1369
|
+
.describe('File to read the replacement comment from, in the workspace (-M).'),
|
|
1019
1370
|
author: z.string().min(1).optional().describe('Replacement author (--author).'),
|
|
1020
1371
|
date: z.string().min(1).optional().describe('Replacement check-in time, or now (--date).'),
|
|
1372
|
+
bgcolor: z.string().min(1).optional().describe('Background colour for this check-in (--bgcolor).'),
|
|
1373
|
+
branchcolor: flag('Apply the colour to the whole branch (--branchcolor).'),
|
|
1374
|
+
date_override: z
|
|
1375
|
+
.string()
|
|
1376
|
+
.min(1)
|
|
1377
|
+
.optional()
|
|
1378
|
+
.describe('Change time of the control artifact (--date-override).'),
|
|
1379
|
+
user_override: z.string().min(1).optional().describe('Login recorded on the control artifact (--user-override).'),
|
|
1021
1380
|
tag: z.array(z.string().min(1)).optional().describe('Tags to add (--tag, repeatable).'),
|
|
1022
1381
|
cancel: z.array(z.string().min(1)).optional().describe('Tags to remove (--cancel, repeatable).'),
|
|
1023
1382
|
branch: z.string().min(1).optional().describe('Start a branch at this check-in (--branch).'),
|
|
@@ -1027,13 +1386,19 @@ export function registerVersionControlTools(server) {
|
|
|
1027
1386
|
workspace: workspaceParam,
|
|
1028
1387
|
}),
|
|
1029
1388
|
annotations: { destructiveHint: true },
|
|
1030
|
-
}, async ({ checkin, comment, author, date, tag, cancel, branch, hide, close, dry_run, workspace }) => {
|
|
1389
|
+
}, async ({ checkin, comment, message_file, author, date, bgcolor, branchcolor, date_override, user_override, tag, cancel, branch, hide, close, dry_run, workspace, }) => {
|
|
1031
1390
|
const args = ['amend', checkin];
|
|
1032
1391
|
if (dry_run)
|
|
1033
1392
|
args.push('-n');
|
|
1034
1393
|
pushOption(args, '-m', comment);
|
|
1394
|
+
pushOption(args, '-M', message_file);
|
|
1035
1395
|
pushOption(args, '--author', author);
|
|
1036
1396
|
pushOption(args, '--date', date);
|
|
1397
|
+
pushOption(args, '--bgcolor', bgcolor);
|
|
1398
|
+
if (branchcolor && bgcolor)
|
|
1399
|
+
args.push('--branchcolor', bgcolor);
|
|
1400
|
+
pushOption(args, '--date-override', date_override);
|
|
1401
|
+
pushOption(args, '--user-override', user_override);
|
|
1037
1402
|
for (const value of tag ?? [])
|
|
1038
1403
|
args.push('--tag', value);
|
|
1039
1404
|
for (const value of cancel ?? [])
|
|
@@ -1043,14 +1408,25 @@ export function registerVersionControlTools(server) {
|
|
|
1043
1408
|
args.push('--hide');
|
|
1044
1409
|
if (close)
|
|
1045
1410
|
args.push('--close');
|
|
1046
|
-
const changed = comment ||
|
|
1411
|
+
const changed = comment ||
|
|
1412
|
+
message_file ||
|
|
1413
|
+
author ||
|
|
1414
|
+
date ||
|
|
1415
|
+
bgcolor ||
|
|
1416
|
+
date_override ||
|
|
1417
|
+
user_override ||
|
|
1418
|
+
branch ||
|
|
1419
|
+
hide ||
|
|
1420
|
+
close ||
|
|
1421
|
+
(tag?.length ?? 0) > 0 ||
|
|
1422
|
+
(cancel?.length ?? 0) > 0;
|
|
1047
1423
|
if (!changed) {
|
|
1048
1424
|
return {
|
|
1049
1425
|
isError: true,
|
|
1050
1426
|
content: [
|
|
1051
1427
|
{
|
|
1052
1428
|
type: 'text',
|
|
1053
|
-
text: 'ERROR: pass at least one of `comment`, `author`, `date`, `tag`, `cancel`, `branch`, `hide` or `close`.',
|
|
1429
|
+
text: 'ERROR: pass at least one of `comment`, `message_file`, `author`, `date`, `tag`, `cancel`, `branch`, `hide` or `close`.',
|
|
1054
1430
|
},
|
|
1055
1431
|
],
|
|
1056
1432
|
};
|
|
@@ -1064,8 +1440,8 @@ export function registerVersionControlTools(server) {
|
|
|
1064
1440
|
action: z.enum(['create', 'apply', 'diff']).default('create').describe('create, apply or show the patch.'),
|
|
1065
1441
|
file: z.string().min(1).describe('Patch file path; relative paths resolve against the workspace.'),
|
|
1066
1442
|
force: flag('Overwrite an existing patch, or apply over unsaved changes (-f).'),
|
|
1067
|
-
dry_run: flag('Print what would
|
|
1068
|
-
verbose: flag('Explain what
|
|
1443
|
+
dry_run: flag('Print what `apply` would do without doing it (-n).'),
|
|
1444
|
+
verbose: flag('Explain what `apply` does (-v).'),
|
|
1069
1445
|
workspace: workspaceParam,
|
|
1070
1446
|
}),
|
|
1071
1447
|
annotations: { destructiveHint: true },
|
|
@@ -1073,10 +1449,12 @@ export function registerVersionControlTools(server) {
|
|
|
1073
1449
|
const args = ['patch', action];
|
|
1074
1450
|
if (force)
|
|
1075
1451
|
args.push('-f');
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1452
|
+
if (action === 'apply') {
|
|
1453
|
+
if (dry_run)
|
|
1454
|
+
args.push('-n');
|
|
1455
|
+
if (verbose)
|
|
1456
|
+
args.push('-v');
|
|
1457
|
+
}
|
|
1080
1458
|
args.push(file);
|
|
1081
1459
|
return renderOutcome(await runFossil(args, { workspace }));
|
|
1082
1460
|
});
|