@stellar_ai/mcp_fossil_scm 0.1.0 → 0.1.1
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 +34 -33
- package/dist/capabilities.d.ts +7 -8
- package/dist/capabilities.js +17 -18
- package/dist/capabilities.js.map +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +41 -33
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
MCP (Model Context Protocol) server for [Fossil SCM](https://fossil-scm.org/).
|
|
4
4
|
|
|
5
5
|
One binary, one list of capability letters: `--capability` decides which tool groups this process exposes,
|
|
6
|
-
so a client loads only what it needs.
|
|
6
|
+
so a client loads only what it needs. Each letter is the **initial** of its capability name.
|
|
7
7
|
|
|
8
8
|
| Letter | Capability | Tools | What it exposes |
|
|
9
9
|
| --- | --- | --- | --- |
|
|
10
|
-
| `a` |
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
10
|
+
| `a` | **A**dmin | 5 | Repository lifecycle: `init`, `open`, `close`, `clone`, `settings` |
|
|
11
|
+
| `v` | **V**CS | 20 | Version control: status, diff, history, add/commit, branch, merge, update, undo, … |
|
|
12
|
+
| `f` | **F**orum | 3 | Forum thread list, thread reading and text search (read-only) |
|
|
13
|
+
| `t` | **T**ickets | 3 | Ticket reports, creation, field updates |
|
|
14
|
+
| `w` | **W**iki | 3 | List, export and create/replace wiki pages |
|
|
15
|
+
| `c` | **C**hat | 4 | Chatroom URL, send, pull history, read locally stored messages |
|
|
16
16
|
|
|
17
|
-
The letters are
|
|
18
|
-
|
|
17
|
+
The letters are written **together in a single value**: `-c v` (20 tools), `-c avf` (28), `-c aftw` (14),
|
|
18
|
+
and a single capital `-c A` for everything (38, also the default). Commas, spaces, `all`/`All` and repeated
|
|
19
|
+
`-c` flags are rejected.
|
|
19
20
|
|
|
20
21
|
> Naming: the Fossil executable/command is `fossil`; this server is always called `fossil-scm`.
|
|
21
22
|
|
|
@@ -33,16 +34,16 @@ MCP TypeScript SDK v2 (`@modelcontextprotocol/server`).
|
|
|
33
34
|
pnpm install
|
|
34
35
|
pnpm build
|
|
35
36
|
|
|
36
|
-
node dist/index.js -c
|
|
37
|
-
node dist/index.js -c
|
|
38
|
-
node dist/index.js -c
|
|
39
|
-
node dist/index.js
|
|
37
|
+
node dist/index.js -c v --repository /path/to/workspace # version control only
|
|
38
|
+
node dist/index.js -c avf --repository /path/to/workspace # admin + VCS + forum
|
|
39
|
+
node dist/index.js -c aftw --repository /path/to/workspace # admin + forum + tickets + wiki
|
|
40
|
+
node dist/index.js -c A --repository /path/to/workspace # everything
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
After `npm link` / a global install the same binary is on `PATH` as `fossil-scm`:
|
|
43
44
|
|
|
44
45
|
```bash
|
|
45
|
-
fossil-scm -c
|
|
46
|
+
fossil-scm -c avf --repository /path/to/workspace
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
### Selective enabling from an MCP client
|
|
@@ -59,43 +60,43 @@ independent MCP server process with its own tool list:
|
|
|
59
60
|
},
|
|
60
61
|
"fossil-vcs": {
|
|
61
62
|
"command": "node",
|
|
62
|
-
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "
|
|
63
|
+
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "v", "--repository", "/path/to/workspace"]
|
|
63
64
|
},
|
|
64
65
|
"fossil-forum": {
|
|
65
66
|
"command": "node",
|
|
66
|
-
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "
|
|
67
|
+
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "f", "--repository", "/path/to/workspace"]
|
|
67
68
|
},
|
|
68
69
|
"fossil-tickets": {
|
|
69
70
|
"command": "node",
|
|
70
|
-
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "
|
|
71
|
+
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "t", "--repository", "/path/to/workspace"]
|
|
71
72
|
},
|
|
72
73
|
"fossil-wiki": {
|
|
73
74
|
"command": "node",
|
|
74
|
-
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "
|
|
75
|
+
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "w", "--repository", "/path/to/workspace"]
|
|
75
76
|
},
|
|
76
77
|
"fossil-chat": {
|
|
77
78
|
"command": "node",
|
|
78
|
-
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "
|
|
79
|
+
"args": ["/abs/path/fossil-scm/dist/index.js", "-c", "c", "--repository", "/path/to/workspace"]
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
```
|
|
83
84
|
|
|
84
|
-
The name reported during the handshake follows the selection: `fossil-scm-a`
|
|
85
|
-
group, plain `fossil-scm` when several are combined.
|
|
85
|
+
The name reported during the handshake follows the selection: `fossil-scm-a`, `fossil-scm-v`, `fossil-scm-f`,
|
|
86
|
+
`fossil-scm-t`, `fossil-scm-w`, `fossil-scm-c` for a single group, plain `fossil-scm` when several are combined.
|
|
86
87
|
|
|
87
88
|
## Configuration
|
|
88
89
|
|
|
89
90
|
| CLI flag | Meaning |
|
|
90
91
|
| --- | --- |
|
|
91
|
-
| `-c, --capability LIST` |
|
|
92
|
+
| `-c, --capability LIST` | One value with the capability initials together: `a` `v` `f` `t` `w` `c` → `-c avf`; a single capital `A` for everything. No separators, no repeated flag. Default: `FOSSIL_CAPABILITIES`, else all |
|
|
92
93
|
| `--repository DIR` (also `--workspace`, `--cwd`, `-R`) | Default workspace for tool calls that omit `cwd` |
|
|
93
94
|
| `--verbose`, `-v` | Diagnostics on stderr (stdout is reserved for the protocol) |
|
|
94
95
|
| `--help`, `-h` | Usage, capability table and examples |
|
|
95
96
|
|
|
96
97
|
| Environment variable | Default | Meaning |
|
|
97
98
|
| --- | --- | --- |
|
|
98
|
-
| `FOSSIL_CAPABILITIES` | all | Default capability letters (same syntax as `--capability`) |
|
|
99
|
+
| `FOSSIL_CAPABILITIES` | all | Default capability letters (same syntax as `--capability`, e.g. `avf` or `A`) |
|
|
99
100
|
| `FOSSIL_WORKSPACE` / `FOSSIL_CWD` | cwd | Default workspace |
|
|
100
101
|
| `FOSSIL_BIN` | `fossil` | Fossil executable (full path works too) |
|
|
101
102
|
| `FOSSIL_TIMEOUT_MS` | `30000` | Timeout for regular commands |
|
|
@@ -111,22 +112,22 @@ explicit path is passed to a tool.
|
|
|
111
112
|
|
|
112
113
|
**`a` Admin (5)** — `fossil_init`, `fossil_open`, `fossil_close`, `fossil_clone`, `fossil_settings`
|
|
113
114
|
|
|
114
|
-
**`
|
|
115
|
+
**`v` VCS (20)** — `fossil_status`, `fossil_diff`, `fossil_cat`, `fossil_finfo`, `fossil_revert`,
|
|
115
116
|
`fossil_stash`, `fossil_tag`, `fossil_addremove`, `fossil_commit`, `fossil_add`, `fossil_rm`, `fossil_mv`,
|
|
116
117
|
`fossil_extras`, `fossil_clean`, `fossil_timeline`, `fossil_info`, `fossil_branch`, `fossil_merge`,
|
|
117
118
|
`fossil_update`, `fossil_undo`
|
|
118
119
|
|
|
119
|
-
**`
|
|
120
|
+
**`f` Forum (3)** — `fossil_forum_list`, `fossil_forum_read`, `fossil_forum_search`
|
|
120
121
|
|
|
121
|
-
**`
|
|
122
|
+
**`t` Tickets (3)** — `fossil_ticket_list`, `fossil_ticket_create`, `fossil_ticket_update`
|
|
122
123
|
|
|
123
|
-
**`
|
|
124
|
+
**`w` Wiki (3)** — `fossil_wiki_ls`, `fossil_wiki_read`, `fossil_wiki_write`
|
|
124
125
|
|
|
125
|
-
**`
|
|
126
|
+
**`c` Chat (4)** — `fossil_chat_url`, `fossil_chat_send`, `fossil_chat_pull`, `fossil_chat_read`
|
|
126
127
|
|
|
127
128
|
`fossil_init` / `fossil_open` (capability `a`) apply the recommended settings automatically
|
|
128
129
|
(`crlf-glob='*'`, `dotfiles=1`, `ignore-glob`, `binary-glob`) and create + stage `.editorconfig` when it is
|
|
129
|
-
missing. VCS and the content capabilities (`
|
|
130
|
+
missing. VCS and the content capabilities (`v`, `f`, `t`, `w`, `c`) expect an already opened check-out.
|
|
130
131
|
|
|
131
132
|
### Capability notes
|
|
132
133
|
|
|
@@ -142,8 +143,8 @@ missing. VCS and the content capabilities (`c`–`f`) expect an already opened c
|
|
|
142
143
|
## What changed compared with the Python version
|
|
143
144
|
|
|
144
145
|
- **Selectable capabilities, one binary.** Tools are registered per capability (`src/capabilities.ts`) and
|
|
145
|
-
`--capability` takes
|
|
146
|
-
enable only the groups they want.
|
|
146
|
+
`--capability` takes the capability initials written together in one value (`avf`, `aftw`, single capital `A`
|
|
147
|
+
for all) or `FOSSIL_CAPABILITIES`, so clients can enable only the groups they want.
|
|
147
148
|
- **No interactive hangs.** `spawn` without a shell, stdin is always closed, `SIGTERM`→`SIGKILL` escalation,
|
|
148
149
|
and per-command timeouts. The commit flow still answers the "commit anyhow" prompt with `a`.
|
|
149
150
|
- **Fewer process spawns.** The four auto-config `fossil sql` calls collapse into one multi-statement
|
|
@@ -158,14 +159,14 @@ missing. VCS and the content capabilities (`c`–`f`) expect an already opened c
|
|
|
158
159
|
- **Bounded output.** Long command output is truncated head + tail, and per-stream capture is capped.
|
|
159
160
|
- **Structure + tests.** `src/config.ts` (env/flags), `src/core/*` (process runner, SQL, path resolution),
|
|
160
161
|
`src/tools/*` (tool groups), `src/capabilities.ts`, `src/server.ts`, `src/cli.ts`, `src/index.ts`.
|
|
161
|
-
`pnpm smoke` drives the real stdio interface for every capability
|
|
162
|
+
`pnpm smoke` drives the real stdio interface for every capability initial and combination.
|
|
162
163
|
|
|
163
164
|
## Development
|
|
164
165
|
|
|
165
166
|
```bash
|
|
166
167
|
pnpm build # compile src -> dist
|
|
167
168
|
pnpm typecheck # tsc --noEmit (tsconfig.build.json)
|
|
168
|
-
pnpm smoke # end-to-end stdio test (each
|
|
169
|
+
pnpm smoke # end-to-end stdio test (each initial, combinations, env selection, bad input)
|
|
169
170
|
pnpm test # typecheck + build + smoke
|
|
170
171
|
pnpm pack # build the publishable tarball
|
|
171
172
|
```
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
/**
|
|
3
3
|
* Every capability the package can expose, in display order.
|
|
4
|
-
*
|
|
4
|
+
* Each id is the initial of its capability: a=Admin, v=VCS, f=Forum,
|
|
5
|
+
* t=Tickets, w=Wiki, c=Chat.
|
|
5
6
|
*/
|
|
6
|
-
export declare const CAPABILITY_IDS: readonly ["a", "
|
|
7
|
+
export declare const CAPABILITY_IDS: readonly ["a", "v", "f", "t", "w", "c"];
|
|
7
8
|
export type CapabilityId = (typeof CAPABILITY_IDS)[number];
|
|
8
9
|
export interface Capability {
|
|
9
10
|
id: CapabilityId;
|
|
@@ -16,14 +17,12 @@ export interface Capability {
|
|
|
16
17
|
register(server: McpServer): void;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* The capability groups,
|
|
20
|
+
* The capability groups, keyed by the initial of the capability name:
|
|
20
21
|
*
|
|
21
|
-
* a = Admin
|
|
22
|
-
* c = Forum d = Tickets
|
|
23
|
-
* e = Wiki f = Chat
|
|
22
|
+
* a = Admin v = VCS f = Forum t = Tickets w = Wiki c = Chat
|
|
24
23
|
*
|
|
25
|
-
* `--capability
|
|
26
|
-
* a three-group server, and so on.
|
|
24
|
+
* `--capability v` exposes only the version-control tools, `--capability avf`
|
|
25
|
+
* is a three-group server, and so on.
|
|
27
26
|
*/
|
|
28
27
|
export declare const CAPABILITIES: Record<CapabilityId, Capability>;
|
|
29
28
|
export declare function isCapabilityId(value: string): value is CapabilityId;
|
package/dist/capabilities.js
CHANGED
|
@@ -6,18 +6,17 @@ import { registerVersionControlTools } from './tools/version-control.js';
|
|
|
6
6
|
import { registerWikiTools } from './tools/wiki.js';
|
|
7
7
|
/**
|
|
8
8
|
* Every capability the package can expose, in display order.
|
|
9
|
-
*
|
|
9
|
+
* Each id is the initial of its capability: a=Admin, v=VCS, f=Forum,
|
|
10
|
+
* t=Tickets, w=Wiki, c=Chat.
|
|
10
11
|
*/
|
|
11
|
-
export const CAPABILITY_IDS = ['a', '
|
|
12
|
+
export const CAPABILITY_IDS = ['a', 'v', 'f', 't', 'w', 'c'];
|
|
12
13
|
/**
|
|
13
|
-
* The capability groups,
|
|
14
|
+
* The capability groups, keyed by the initial of the capability name:
|
|
14
15
|
*
|
|
15
|
-
* a = Admin
|
|
16
|
-
* c = Forum d = Tickets
|
|
17
|
-
* e = Wiki f = Chat
|
|
16
|
+
* a = Admin v = VCS f = Forum t = Tickets w = Wiki c = Chat
|
|
18
17
|
*
|
|
19
|
-
* `--capability
|
|
20
|
-
* a three-group server, and so on.
|
|
18
|
+
* `--capability v` exposes only the version-control tools, `--capability avf`
|
|
19
|
+
* is a three-group server, and so on.
|
|
21
20
|
*/
|
|
22
21
|
export const CAPABILITIES = {
|
|
23
22
|
a: {
|
|
@@ -27,36 +26,36 @@ export const CAPABILITIES = {
|
|
|
27
26
|
toolCount: 5,
|
|
28
27
|
register: registerAdminTools,
|
|
29
28
|
},
|
|
30
|
-
|
|
31
|
-
id: '
|
|
29
|
+
v: {
|
|
30
|
+
id: 'v',
|
|
32
31
|
title: 'VCS',
|
|
33
32
|
description: 'All version-control commands',
|
|
34
33
|
toolCount: 20,
|
|
35
34
|
register: registerVersionControlTools,
|
|
36
35
|
},
|
|
37
|
-
|
|
38
|
-
id: '
|
|
36
|
+
f: {
|
|
37
|
+
id: 'f',
|
|
39
38
|
title: 'Forum',
|
|
40
39
|
description: 'Read-only forum threads, posts and full-text search',
|
|
41
40
|
toolCount: 3,
|
|
42
41
|
register: registerForumTools,
|
|
43
42
|
},
|
|
44
|
-
|
|
45
|
-
id: '
|
|
43
|
+
t: {
|
|
44
|
+
id: 't',
|
|
46
45
|
title: 'Tickets',
|
|
47
46
|
description: 'Ticket reports, creation and field updates',
|
|
48
47
|
toolCount: 3,
|
|
49
48
|
register: registerTicketTools,
|
|
50
49
|
},
|
|
51
|
-
|
|
52
|
-
id: '
|
|
50
|
+
w: {
|
|
51
|
+
id: 'w',
|
|
53
52
|
title: 'Wiki',
|
|
54
53
|
description: 'List, export and create/replace wiki pages',
|
|
55
54
|
toolCount: 3,
|
|
56
55
|
register: registerWikiTools,
|
|
57
56
|
},
|
|
58
|
-
|
|
59
|
-
id: '
|
|
57
|
+
c: {
|
|
58
|
+
id: 'c',
|
|
60
59
|
title: 'Chat',
|
|
61
60
|
description: 'Chatroom URL, sending messages, pulling and reading chat history',
|
|
62
61
|
toolCount: 4,
|
package/dist/capabilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAA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,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,cAAc,CAAC,CAAC;AAC7B,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,WAAW,CAAC,GAA4B;IACtD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export interface CliOptions {
|
|
|
11
11
|
/**
|
|
12
12
|
* Parses the command line.
|
|
13
13
|
*
|
|
14
|
-
* `--capability` takes capability
|
|
15
|
-
*
|
|
14
|
+
* `--capability` takes capability initials written together (`avf`, `twc`) or a
|
|
15
|
+
* single capital `A` for everything; when it is absent the list comes from
|
|
16
16
|
* `FOSSIL_CAPABILITIES` (or every capability).
|
|
17
17
|
* `--repository DIR` is consumed here so it can never reach the MCP transport.
|
|
18
18
|
*/
|
package/dist/cli.js
CHANGED
|
@@ -7,37 +7,39 @@ const CWD_FLAGS = new Set(['--repository', '--workspace', '--cwd', '-R']);
|
|
|
7
7
|
/** Thrown for invalid command lines; callers print the message plus the help. */
|
|
8
8
|
export class UsageError extends Error {
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Adds one `--capability` value.
|
|
12
|
+
*
|
|
13
|
+
* `A` (capital) selects every capability. Otherwise the value is a run of
|
|
14
|
+
* lowercase initials written together (`avf`, `twc`); separators are rejected.
|
|
15
|
+
*/
|
|
10
16
|
function addCapabilities(spec, selected) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
selected.add(token);
|
|
17
|
+
const value = spec.trim();
|
|
18
|
+
if (!value)
|
|
19
|
+
return;
|
|
20
|
+
if (value === 'A') {
|
|
21
|
+
for (const id of allCapabilities())
|
|
22
|
+
selected.add(id);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const unknown = [...value].filter((letter) => !isCapabilityId(letter));
|
|
26
|
+
if (unknown.length > 0) {
|
|
27
|
+
const hint = value.toLowerCase() === 'all'
|
|
28
|
+
? "Use capital 'A' for every capability."
|
|
29
|
+
: "Use the letters together, e.g. 'avf'.";
|
|
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 A for all.`);
|
|
32
|
+
}
|
|
33
|
+
for (const letter of value) {
|
|
34
|
+
if (isCapabilityId(letter))
|
|
35
|
+
selected.add(letter);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Parses the command line.
|
|
38
40
|
*
|
|
39
|
-
* `--capability` takes capability
|
|
40
|
-
*
|
|
41
|
+
* `--capability` takes capability initials written together (`avf`, `twc`) or a
|
|
42
|
+
* single capital `A` for everything; when it is absent the list comes from
|
|
41
43
|
* `FOSSIL_CAPABILITIES` (or every capability).
|
|
42
44
|
* `--repository DIR` is consumed here so it can never reach the MCP transport.
|
|
43
45
|
*/
|
|
@@ -74,16 +76,20 @@ export function parseArgs(argv, env = process.env) {
|
|
|
74
76
|
cwd = value;
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
79
|
+
// Exactly one value: all letters belong together, e.g. -c avf.
|
|
80
|
+
if (explicitCapabilities) {
|
|
81
|
+
throw new UsageError('give all capability letters in a single value, e.g. -c avf.');
|
|
82
|
+
}
|
|
77
83
|
explicitCapabilities = true;
|
|
78
84
|
addCapabilities(value, selected);
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
if (!explicitCapabilities) {
|
|
82
|
-
addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || '
|
|
88
|
+
addCapabilities(env.FOSSIL_CAPABILITIES?.trim() || 'A', selected);
|
|
83
89
|
}
|
|
84
90
|
const capabilities = [...selected];
|
|
85
91
|
if (capabilities.length === 0) {
|
|
86
|
-
throw new UsageError("no capability selected; use --capability (e.g. '
|
|
92
|
+
throw new UsageError("no capability selected; use --capability (e.g. 'avf') or FOSSIL_CAPABILITIES, or 'A'.");
|
|
87
93
|
}
|
|
88
94
|
return { cwd, capabilities, verbose, help };
|
|
89
95
|
}
|
|
@@ -98,9 +104,10 @@ export function helpText() {
|
|
|
98
104
|
`Usage: ${SERVER_NAME} [--capability LETTERS] [--repository DIR] [--verbose]`,
|
|
99
105
|
'',
|
|
100
106
|
'Options:',
|
|
101
|
-
' -c, --capability LIST Capability
|
|
102
|
-
|
|
103
|
-
'
|
|
107
|
+
' -c, --capability LIST Capability initials written together in one value:',
|
|
108
|
+
' a(Admin) v(VCS) f(Forum) t(Tickets) w(Wiki) c(Chat),',
|
|
109
|
+
' e.g. "-c avf". A capital A selects everything.',
|
|
110
|
+
' Default: FOSSIL_CAPABILITIES, else every capability.',
|
|
104
111
|
' Each selected group is served as its own MCP server instance.',
|
|
105
112
|
' --repository DIR Default workspace for every tool call',
|
|
106
113
|
' (aliases: --workspace, --cwd, -R)',
|
|
@@ -111,9 +118,10 @@ export function helpText() {
|
|
|
111
118
|
...rows,
|
|
112
119
|
'',
|
|
113
120
|
'Examples:',
|
|
114
|
-
` ${SERVER_NAME} -c
|
|
115
|
-
` ${SERVER_NAME} -c
|
|
116
|
-
` ${SERVER_NAME} -c
|
|
121
|
+
` ${SERVER_NAME} -c v # version control only (20 tools)`,
|
|
122
|
+
` ${SERVER_NAME} -c avf # admin + VCS + forum (28 tools)`,
|
|
123
|
+
` ${SERVER_NAME} -c aftw # admin + forum + tickets + wiki (14 tools)`,
|
|
124
|
+
` ${SERVER_NAME} -c A # everything (38 tools)`,
|
|
117
125
|
'',
|
|
118
126
|
'Environment: FOSSIL_CAPABILITIES, FOSSIL_WORKSPACE, FOSSIL_CWD, FOSSIL_BIN,',
|
|
119
127
|
' FOSSIL_TIMEOUT_MS, FOSSIL_NETWORK_TIMEOUT_MS, FOSSIL_MAX_OUTPUT_CHARS,',
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,GAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;AAClG,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAE1E,iFAAiF;AACjF,MAAM,OAAO,UAAW,SAAQ,KAAK;CAAG;AASxC,SAAS,eAAe,CAAC,IAAY,EAAE,QAA2B;IAChE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,GAEZ,MAAM,mBAAmB,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