@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
package/README.md
CHANGED
|
@@ -14,12 +14,8 @@
|
|
|
14
14
|
| `w` | **W**iki | 3 | 列表、匯出與建立/覆寫 wiki 頁面 |
|
|
15
15
|
| `c` | **C**hat | 4 | 聊天室 URL、傳送、拉取歷史、讀取本地訊息 |
|
|
16
16
|
|
|
17
|
-
字母**寫在單一值裡**:`-c v`(40 個工具)、`-c avf`(54)、`-c aftw`(21
|
|
18
|
-
(65
|
|
19
|
-
|
|
20
|
-
> 命名:Fossil 的可執行檔/指令叫 `fossil`;本伺服器一律叫 `fossil-scm`。
|
|
21
|
-
|
|
22
|
-
以 TypeScript 重寫先前單檔的 Python 實作,建構在 MCP TypeScript SDK v2(`@modelcontextprotocol/server`)之上。
|
|
17
|
+
字母**寫在單一值裡**:`-c v`(40 個工具)、`-c avf`(54)、`-c aftw`(21),`-c All` 為全部
|
|
18
|
+
(65,也是預設)。
|
|
23
19
|
|
|
24
20
|
## 需求
|
|
25
21
|
|
|
@@ -42,7 +38,7 @@ pnpm build
|
|
|
42
38
|
node dist/index.js -c v --workspace /path/to/workspace # 只啟用版本控制
|
|
43
39
|
node dist/index.js -c avf --workspace /path/to/workspace # admin + VCS + forum
|
|
44
40
|
node dist/index.js -c aftw --workspace /path/to/workspace # admin + forum + tickets + wiki
|
|
45
|
-
node dist/index.js -c
|
|
41
|
+
node dist/index.js -c All --workspace /path/to/workspace # 全部
|
|
46
42
|
```
|
|
47
43
|
|
|
48
44
|
`npm link` 或全域安裝後,同一個執行檔以 `fossil-scm` 出現在 `PATH` 上:
|
|
@@ -93,14 +89,14 @@ fossil-scm -c avf --workspace /path/to/workspace
|
|
|
93
89
|
|
|
94
90
|
| 命令列旗標 | 意義 |
|
|
95
91
|
| --- | --- |
|
|
96
|
-
| `-c, --capability LIST` |
|
|
92
|
+
| `-c, --capability LIST` | 能力寫在同一個值裡:`a` `v` `f` `t` `w` `c` → `-c avf`;`-c All` 為全部。預設取 `FOSSIL_CAPABILITIES`,再無則 `All` |
|
|
97
93
|
| `--workspace DIR` | 工具呼叫省略 `workspace` 時的預設工作區;未給時用行程工作目錄 |
|
|
98
94
|
| `--verbose`, `-v` | 在 stderr 輸出診斷訊息(stdout 保留給協定) |
|
|
99
95
|
| `--help`, `-h` | 用法、能力表與範例 |
|
|
100
96
|
|
|
101
97
|
| 環境變數 | 預設 | 意義 |
|
|
102
98
|
| --- | --- | --- |
|
|
103
|
-
| `FOSSIL_CAPABILITIES` | `
|
|
99
|
+
| `FOSSIL_CAPABILITIES` | `All` | 預設能力(語法同 `--capability`,例如 `avf` 或 `All`) |
|
|
104
100
|
| `FOSSIL_WORKSPACE` | 行程 cwd | 預設工作區 |
|
|
105
101
|
| `FOSSIL_BIN` | `fossil` | Fossil 執行檔(也可給完整路徑) |
|
|
106
102
|
| `FOSSIL_TIMEOUT_MS` | `30000` | 一般命令的逾時 |
|
|
@@ -156,10 +152,10 @@ fossil-scm -c avf --workspace /path/to/workspace
|
|
|
156
152
|
[admin](./docs/admin.md)、[VCS](./docs/vcs.md)、[forum](./docs/forum.md)、[tickets](./docs/tickets.md)、
|
|
157
153
|
[wiki](./docs/wiki.md)、[chat](./docs/chat.md)、[prompts](./docs/prompts.md)。
|
|
158
154
|
|
|
159
|
-
##
|
|
155
|
+
## 設計重點
|
|
160
156
|
|
|
161
157
|
- **可選能力、單一執行檔。** 工具按能力組註冊(`src/capabilities.ts`:Admin、VCS、Forum、Tickets、Wiki、
|
|
162
|
-
Chat),`--capability` 取寫在同一值裡的首字母(`avf`、`aftw
|
|
158
|
+
Chat),`--capability` 取寫在同一值裡的首字母(`avf`、`aftw`、`All` 為全部)或 `FOSSIL_CAPABILITIES`,
|
|
163
159
|
客戶端只啟用需要的部分。
|
|
164
160
|
- **不會互動卡住。** 不經 shell 的 `spawn`、stdin 一律關閉、`SIGTERM`→`SIGKILL` 升級、逐命令逾時。
|
|
165
161
|
提交流程仍以 `a` 回答 "commit anyhow" 提示。
|
|
@@ -194,6 +190,12 @@ pnpm pack # prepack 重建 dist 後產出 tarball
|
|
|
194
190
|
宣告檔,`prebuild` / `prepack` 從零重建 `dist`)。tarball 是 `dist` 加上 `README.md` 與 `LICENSE`。
|
|
195
191
|
專案層的 `.npmrc`(registry token)已被忽略。
|
|
196
192
|
|
|
193
|
+
## 致謝
|
|
194
|
+
|
|
195
|
+
[fossil-scm-mcp](https://pypi.org/project/fossil-scm-mcp/)
|
|
196
|
+
|
|
197
197
|
## 授權
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
[LICENSE](./LICENSE): BSD 3-Clause
|
|
200
|
+
|
|
201
|
+
Copyright (c) 2026 ri-fumo.
|
package/dist/cli.js
CHANGED
|
@@ -10,14 +10,14 @@ export class UsageError extends Error {
|
|
|
10
10
|
/**
|
|
11
11
|
* Adds one `--capability` value.
|
|
12
12
|
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
13
|
+
* `All` selects every capability. Otherwise the value is a run of lowercase
|
|
14
|
+
* initials written together (`avf`, `twc`); separators are rejected.
|
|
15
15
|
*/
|
|
16
16
|
function addCapabilities(spec, selected) {
|
|
17
17
|
const value = spec.trim();
|
|
18
18
|
if (!value)
|
|
19
19
|
return;
|
|
20
|
-
if (value === '
|
|
20
|
+
if (value === 'All') {
|
|
21
21
|
for (const id of allCapabilities())
|
|
22
22
|
selected.add(id);
|
|
23
23
|
return;
|
|
@@ -25,10 +25,10 @@ function addCapabilities(spec, selected) {
|
|
|
25
25
|
const unknown = [...value].filter((letter) => !isCapabilityId(letter));
|
|
26
26
|
if (unknown.length > 0) {
|
|
27
27
|
const hint = value.toLowerCase() === 'all'
|
|
28
|
-
? "Use
|
|
28
|
+
? "Use 'All' for every capability."
|
|
29
29
|
: "Use the letters together, e.g. 'avf'.";
|
|
30
30
|
throw new UsageError(`unknown capability '${unknown[0]}'${value.length > 1 ? ` in '${value}'` : ''}. ${hint} ` +
|
|
31
|
-
`Valid letters: ${CAPABILITY_IDS.map((id) => `${id}=${CAPABILITIES[id].title}`).join(', ')}, or
|
|
31
|
+
`Valid letters: ${CAPABILITY_IDS.map((id) => `${id}=${CAPABILITIES[id].title}`).join(', ')}, or All for everything.`);
|
|
32
32
|
}
|
|
33
33
|
for (const letter of value) {
|
|
34
34
|
if (isCapabilityId(letter))
|
|
@@ -38,8 +38,8 @@ function addCapabilities(spec, selected) {
|
|
|
38
38
|
/**
|
|
39
39
|
* Parses the command line.
|
|
40
40
|
*
|
|
41
|
-
* `--capability` takes capability initials written together (`avf`, `twc`) or
|
|
42
|
-
*
|
|
41
|
+
* `--capability` takes capability initials written together (`avf`, `twc`) or
|
|
42
|
+
* the word `All` for everything; when it is absent the list comes from
|
|
43
43
|
* `FOSSIL_CAPABILITIES` (or every capability). `--workspace DIR` (or
|
|
44
44
|
* `FOSSIL_WORKSPACE`) sets the default workspace; otherwise tool calls fall
|
|
45
45
|
* back to the process working directory.
|
|
@@ -87,11 +87,11 @@ export function parseArgs(argv, env = process.env) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
if (!explicitCapabilities) {
|
|
90
|
-
addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || '
|
|
90
|
+
addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || 'All', selected);
|
|
91
91
|
}
|
|
92
92
|
const capabilities = [...selected];
|
|
93
93
|
if (capabilities.length === 0) {
|
|
94
|
-
throw new UsageError("no capability selected; use --capability (e.g. 'avf') or FOSSIL_CAPABILITIES, or '
|
|
94
|
+
throw new UsageError("no capability selected; use --capability (e.g. 'avf') or FOSSIL_CAPABILITIES, or 'All'.");
|
|
95
95
|
}
|
|
96
96
|
return { workspace, capabilities, verbose, help };
|
|
97
97
|
}
|
|
@@ -108,7 +108,7 @@ export function helpText() {
|
|
|
108
108
|
'Options:',
|
|
109
109
|
' -c, --capability LIST Capability initials written together in one value:',
|
|
110
110
|
' a(Admin) v(VCS) f(Forum) t(Tickets) w(Wiki) c(Chat),',
|
|
111
|
-
' e.g. "-c avf".
|
|
111
|
+
' e.g. "-c avf". "-c All" selects everything.',
|
|
112
112
|
' Default: FOSSIL_CAPABILITIES, else every capability.',
|
|
113
113
|
' Each selected group contributes its tools to this one server.',
|
|
114
114
|
' --workspace DIR Default workspace for every tool call.',
|
|
@@ -123,7 +123,7 @@ export function helpText() {
|
|
|
123
123
|
` ${SERVER_NAME} -c v # version control only (40 tools)`,
|
|
124
124
|
` ${SERVER_NAME} -c avf # admin + VCS + forum (54 tools)`,
|
|
125
125
|
` ${SERVER_NAME} -c aftw # admin + forum + tickets + wiki (21 tools)`,
|
|
126
|
-
` ${SERVER_NAME} -c
|
|
126
|
+
` ${SERVER_NAME} -c All # everything (65 tools)`,
|
|
127
127
|
'',
|
|
128
128
|
'Prompts: fossil-review-changes, fossil-commit-workflow, fossil-ignore-conversion,',
|
|
129
129
|
' fossil-trace-change, fossil-bisect-hunt, fossil-sync-remote,',
|
package/dist/config.js
CHANGED
|
@@ -9,7 +9,7 @@ function readPositiveInt(name, fallback) {
|
|
|
9
9
|
}
|
|
10
10
|
/** Server/product name. The fossil *binary* stays `fossil` (see FOSSIL_BIN). */
|
|
11
11
|
export const SERVER_NAME = 'fossil-scm';
|
|
12
|
-
export const SERVER_VERSION = '0.
|
|
12
|
+
export const SERVER_VERSION = '0.2.0';
|
|
13
13
|
/**
|
|
14
14
|
* The Fossil executable. The command is named `fossil`; only the server/product
|
|
15
15
|
* name is written `fossil-scm`. Override with FOSSIL_BIN (e.g. a full path on Windows).
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* fossil-scm -c a # admin only
|
|
6
6
|
* fossil-scm -c v # VCS only
|
|
7
7
|
* fossil-scm -c avf # admin + VCS + forum
|
|
8
|
-
* fossil-scm -c
|
|
8
|
+
* fossil-scm -c All # everything
|
|
9
9
|
* fossil-scm # FOSSIL_CAPABILITIES, else everything
|
|
10
10
|
*
|
|
11
11
|
* Run with `--help` for the per-capability tool counts.
|
package/dist/tools/admin.js
CHANGED
|
@@ -65,16 +65,33 @@ export function registerAdminTools(server) {
|
|
|
65
65
|
inputSchema: z.object({
|
|
66
66
|
repository: repoPathParam,
|
|
67
67
|
project_name: z.string().min(1).optional().describe('Project name stored in the repository. Defaults to the workspace folder name.'),
|
|
68
|
+
admin_user: z.string().min(1).optional().describe('Login to record as the repository administrator (-A).'),
|
|
69
|
+
template: z
|
|
70
|
+
.string()
|
|
71
|
+
.min(1)
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Repository file to copy settings from (--template).'),
|
|
74
|
+
project_desc: z.string().min(1).optional().describe('Project description stored in the repository (--project-desc).'),
|
|
75
|
+
date_override: z
|
|
76
|
+
.string()
|
|
77
|
+
.min(1)
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('Timestamp of the initial check-in (--date-override).'),
|
|
68
80
|
reveal_secrets: revealSecretsParam,
|
|
69
81
|
workspace: workspaceParam,
|
|
70
82
|
}),
|
|
71
|
-
}, async ({ repository, project_name, reveal_secrets, workspace }) => {
|
|
83
|
+
}, async ({ repository, project_name, admin_user, template, project_desc, date_override, reveal_secrets, workspace }) => {
|
|
72
84
|
const workspaceDir = resolveWorkspace(workspace);
|
|
73
85
|
const repoPath = resolveRepoPath(repository, workspaceDir);
|
|
74
86
|
const finalProjectName = clean(project_name) ?? (path.basename(workspaceDir) || 'project');
|
|
75
87
|
// fossil init cannot create the parent folder itself (SQLITE_CANTOPEN).
|
|
76
88
|
await mkdir(path.dirname(repoPath), { recursive: true });
|
|
77
|
-
const
|
|
89
|
+
const args = ['init', repoPath, '--project-name', finalProjectName];
|
|
90
|
+
pushOption(args, '-A', admin_user);
|
|
91
|
+
pushOption(args, '--template', template);
|
|
92
|
+
pushOption(args, '--project-desc', project_desc);
|
|
93
|
+
pushOption(args, '--date-override', date_override);
|
|
94
|
+
const init = await runFossil(args, { workspace: workspaceDir });
|
|
78
95
|
const rendered = renderOutcome(init, {
|
|
79
96
|
note: `Repository created at '${repoPath}' (project '${finalProjectName}').`,
|
|
80
97
|
});
|
|
@@ -88,6 +105,10 @@ export function registerAdminTools(server) {
|
|
|
88
105
|
force: flag('Use -f/--force to open into a directory that is not empty.'),
|
|
89
106
|
keep: flag('Use -k/--keep to keep existing local files untouched.'),
|
|
90
107
|
nested: flag('Allow opening a repository inside an already opened check-out (--nested).'),
|
|
108
|
+
empty: flag('Create the check-out without files, still connected to the repository (--empty).'),
|
|
109
|
+
no_sync: flag('Skip the automatic sync before opening (--nosync).'),
|
|
110
|
+
set_mtime: flag('Stamp every file with its check-in time (--setmtime).'),
|
|
111
|
+
force_missing: flag('Open even when content of one side is missing (--force-missing).'),
|
|
91
112
|
workdir: z
|
|
92
113
|
.string()
|
|
93
114
|
.min(1)
|
|
@@ -95,7 +116,7 @@ export function registerAdminTools(server) {
|
|
|
95
116
|
.describe('Check-out directory passed as --workdir DIR (relative paths resolve against the workspace).'),
|
|
96
117
|
workspace: workspaceParam,
|
|
97
118
|
}),
|
|
98
|
-
}, async ({ repository, force, keep, nested, workdir, workspace }) => {
|
|
119
|
+
}, async ({ repository, force, keep, nested, empty, no_sync, set_mtime, force_missing, workdir, workspace }) => {
|
|
99
120
|
const workspaceDir = resolveWorkspace(workspace);
|
|
100
121
|
const repoPath = resolveRepoPath(repository, workspaceDir);
|
|
101
122
|
const args = ['open', repoPath];
|
|
@@ -105,6 +126,14 @@ export function registerAdminTools(server) {
|
|
|
105
126
|
args.push('-k');
|
|
106
127
|
if (nested)
|
|
107
128
|
args.push('--nested');
|
|
129
|
+
if (empty)
|
|
130
|
+
args.push('--empty');
|
|
131
|
+
if (no_sync)
|
|
132
|
+
args.push('--nosync');
|
|
133
|
+
if (set_mtime)
|
|
134
|
+
args.push('--setmtime');
|
|
135
|
+
if (force_missing)
|
|
136
|
+
args.push('--force-missing');
|
|
108
137
|
const requestedWorkdir = clean(workdir);
|
|
109
138
|
const checkoutDir = requestedWorkdir ? path.resolve(workspaceDir, requestedWorkdir) : workspaceDir;
|
|
110
139
|
if (requestedWorkdir)
|
|
@@ -439,6 +468,9 @@ export function registerAdminTools(server) {
|
|
|
439
468
|
wal: flag('Switch the database to Write-Ahead-Log journalling (--wal).'),
|
|
440
469
|
force: flag('Finish even when errors are seen (--force).'),
|
|
441
470
|
quiet: flag('Print output only for errors (--quiet).'),
|
|
471
|
+
cluster: flag('Compute clusters for unclustered artifacts (--cluster).'),
|
|
472
|
+
deanalyze: flag('Remove the ANALYZE tables from the database (--deanalyze).'),
|
|
473
|
+
no_verify: flag('Skip verification of changes to the BLOB table (--noverify).'),
|
|
442
474
|
index: flag('Always rebuild the full-text search index (--index).'),
|
|
443
475
|
noindex: flag('Skip the full-text search index (--noindex).'),
|
|
444
476
|
pagesize: z.number().int().min(512).max(65536).optional().describe('Database page size (--pagesize).'),
|
|
@@ -465,6 +497,12 @@ export function registerAdminTools(server) {
|
|
|
465
497
|
args.push('--force');
|
|
466
498
|
if (input.quiet)
|
|
467
499
|
args.push('--quiet');
|
|
500
|
+
if (input.cluster)
|
|
501
|
+
args.push('--cluster');
|
|
502
|
+
if (input.deanalyze)
|
|
503
|
+
args.push('--deanalyze');
|
|
504
|
+
if (input.no_verify)
|
|
505
|
+
args.push('--noverify');
|
|
468
506
|
if (input.index)
|
|
469
507
|
args.push('--index');
|
|
470
508
|
if (input.noindex)
|