toolmenu 0.25.1 → 0.25.2
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 +66 -8
- package/dist/cli.js +23 -10
- package/dist/help.js +5 -4
- package/dist/junit.d.ts +12 -0
- package/dist/junit.js +78 -0
- package/dist/mcp.js +10 -0
- package/dist/options.d.ts +3 -0
- package/dist/options.js +1 -0
- package/dist/sarif.d.ts +2 -0
- package/dist/sarif.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
|
|
13
13
|
[](https://www.npmjs.com/package/toolmenu)
|
|
14
|
-
[](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml)
|
|
15
|
-
[](https://github.com/niksa90/toolmenu/blob/main/LICENSE)
|
|
16
|
-
[](https://modelcontextprotocol.io)
|
|
17
|
-
[](https://github.com/niksa90/toolmenu)
|
|
18
|
-
[](https://glama.ai/mcp/servers/niksa90/toolmenu)
|
|
14
|
+
[](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml)
|
|
15
|
+
[](https://github.com/niksa90/toolmenu/blob/main/LICENSE)
|
|
16
|
+
[](https://modelcontextprotocol.io)
|
|
17
|
+
[](https://github.com/niksa90/toolmenu)
|
|
18
|
+
[](https://glama.ai/mcp/servers/niksa90/toolmenu)
|
|
19
|
+
[](https://mcprush.com/to/toolmenu-mcp?ref=badge)
|
|
20
|
+
[](https://mcpservers.org/servers/niksa90/toolmenu)
|
|
19
21
|
|
|
20
22
|
</p>
|
|
21
23
|
|
|
@@ -41,6 +43,7 @@ npx toolmenu init -- node dist/server.js # CI: a baseline, a workflow,
|
|
|
41
43
|
| **MCP Apps, Tasks, Server Cards** | It reads `ui://` resources as a host does and checks who may see each tool. It catches tasks sent to clients that can't poll them, and Server Cards that contradict the live server. |
|
|
42
44
|
| **Your client's view** | `--client claude-code \| claude-api-search \| openai` shows what each client loads, cuts, can find and refuses. |
|
|
43
45
|
| **What agents misread** | It flags vague `id`s, IDs no tool returns, instructions buried late in descriptions, and writes without annotations or marked read-only. |
|
|
46
|
+
| **Words routing to the wrong tool** | `routes.yml` pins which tool each keyword must (and must not) reach, the way a keyword or BM25 tool search sees the menu. A description edit that lets `get_audit_trail` win "audit" fails the check, with no model and no eval budget. [More](#snapshot-rules) |
|
|
44
47
|
| **Menus that drift** | It catches defaults built from the clock or a hash order, menus that differ per process, per connection or offline, and listings that depend on who asks. |
|
|
45
48
|
|
|
46
49
|
Every finding says what's wrong, where it is and what toolmenu saw, and ends with a `→ Next:` step.
|
|
@@ -200,6 +203,33 @@ Relative paths resolve from the folder `toolmenu mcp` runs in, or a call's `cwd`
|
|
|
200
203
|
clients ask before each tool call unless you allow it. toolmenu's own menu passes its
|
|
201
204
|
checks with no findings, on both protocols and in a session (the test suite checks).
|
|
202
205
|
|
|
206
|
+
## As a library
|
|
207
|
+
|
|
208
|
+
Everything the CLI does is exported from the `toolmenu` package, with types, for test
|
|
209
|
+
suites and scripts of your own:
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
import { snapshot, diffMenus, loadMenu, session, loadScenario } from 'toolmenu';
|
|
213
|
+
|
|
214
|
+
// The menu and its findings, as `toolmenu snapshot` gives them.
|
|
215
|
+
const { menu, findings } = await snapshot({ kind: 'stdio', command: 'node', args: ['dist/server.js'] });
|
|
216
|
+
// or { kind: 'http', url: 'https://example.com/mcp', headers: { Authorization: `Bearer ${token}` } }
|
|
217
|
+
|
|
218
|
+
// What changed since the committed baseline, and the version bump it needs.
|
|
219
|
+
const diff = diffMenus(await loadMenu('menu.json'), menu);
|
|
220
|
+
console.log(diff.suggestedBump, diff.tokens);
|
|
221
|
+
if (diff.findings.some((f) => f.severity === 'error')) process.exitCode = 1;
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
`snapshot`, `diffMenus`, `session` and `history` take the same options as their
|
|
225
|
+
commands (`SnapshotOptions`, `DiffOptions`, `SessionOptions`, `HistoryOptions`) and
|
|
226
|
+
return the findings the reports print: each `Finding` has its `rule`, `severity`,
|
|
227
|
+
`message`, `tool` and the `fix` shown as `→ Next:`. Lower down, `compareMenus(before,
|
|
228
|
+
after)` returns each tool's change (`ToolChange[]`) and `runRules` runs the menu rules
|
|
229
|
+
on a menu you built. The `menu.json` format is the `Menu` type (`toolmenu: 1`);
|
|
230
|
+
a later format will bump that number. Library functions don't print or exit: that's
|
|
231
|
+
the CLI's job.
|
|
232
|
+
|
|
203
233
|
## In CI: one PR comment
|
|
204
234
|
|
|
205
235
|
```yaml
|
|
@@ -216,7 +246,7 @@ jobs:
|
|
|
216
246
|
- uses: actions/setup-node@v7
|
|
217
247
|
with: { node-version: 22 }
|
|
218
248
|
- run: npm ci && npm run build
|
|
219
|
-
- uses: niksa90/toolmenu@v0.25.
|
|
249
|
+
- uses: niksa90/toolmenu@v0.25.2
|
|
220
250
|
with:
|
|
221
251
|
command: node dist/server.js
|
|
222
252
|
baseline: menu.json # your committed snapshot
|
|
@@ -264,7 +294,7 @@ permissions:
|
|
|
264
294
|
security-events: write # to upload SARIF
|
|
265
295
|
steps:
|
|
266
296
|
# … checkout, build, as above
|
|
267
|
-
- uses: niksa90/toolmenu@v0.25.
|
|
297
|
+
- uses: niksa90/toolmenu@v0.25.2
|
|
268
298
|
with:
|
|
269
299
|
command: node dist/server.js
|
|
270
300
|
sarif: toolmenu-sarif
|
|
@@ -278,6 +308,32 @@ Outside the Action: `toolmenu snapshot --sarif toolmenu.sarif -- node dist/serve
|
|
|
278
308
|
writes the file beside the usual report (`diff` and `session` take `--sarif` too), or
|
|
279
309
|
`--format sarif` prints it instead.
|
|
280
310
|
|
|
311
|
+
### Other CI systems: JUnit test reports
|
|
312
|
+
|
|
313
|
+
GitLab, Jenkins, Azure DevOps, CircleCI and Buildkite show JUnit XML as test results.
|
|
314
|
+
`--junit <path>` writes the findings of `snapshot`, `diff` or `session` as JUnit beside
|
|
315
|
+
the usual report (`--format junit` prints it instead). New in 0.25.2. Each finding is a test case named
|
|
316
|
+
after its tool, in a class named after its rule (`toolmenu.diff.diff/removed`), so the
|
|
317
|
+
CI system tracks it across runs. Findings at or above `--fail-on` are failures, the rest
|
|
318
|
+
pass with their text, so the test report agrees with the exit code. A clean run is one
|
|
319
|
+
passing case.
|
|
320
|
+
|
|
321
|
+
```yaml
|
|
322
|
+
# .gitlab-ci.yml
|
|
323
|
+
toolmenu:
|
|
324
|
+
image: node:22
|
|
325
|
+
script:
|
|
326
|
+
- npm ci && npm run build
|
|
327
|
+
# Exit 1 means findings: keep going so both reports are written, then fail.
|
|
328
|
+
- npx toolmenu snapshot --out new-menu.json --junit snapshot.xml -- node dist/server.js || code=$?
|
|
329
|
+
- npx toolmenu diff menu.json new-menu.json --junit diff.xml || code=$?
|
|
330
|
+
- exit ${code:-0}
|
|
331
|
+
artifacts:
|
|
332
|
+
when: always
|
|
333
|
+
reports:
|
|
334
|
+
junit: [snapshot.xml, diff.xml]
|
|
335
|
+
```
|
|
336
|
+
|
|
281
337
|
### A badge for your README
|
|
282
338
|
|
|
283
339
|
```sh
|
|
@@ -656,7 +712,9 @@ toolmenu sees what the server sends. Plenty of agent failures happen elsewhere:
|
|
|
656
712
|
--no-write don't write the menu file
|
|
657
713
|
--routes <path> routes.yml
|
|
658
714
|
--config <path> config file (default: toolmenu.config.json, if present)
|
|
659
|
-
--format <fmt> text (default), json, github (annotations)
|
|
715
|
+
--format <fmt> text (default), json, github (annotations), markdown, sarif
|
|
716
|
+
(code scanning) or junit (CI test reports)
|
|
717
|
+
--junit <path> snapshot, diff, session: also write the findings as JUnit XML
|
|
660
718
|
--fail-on <level> error (default), warn or info
|
|
661
719
|
--header <k: v> HTTP header, repeatable
|
|
662
720
|
--env <K=V> env var for a stdio server, repeatable (it only gets a
|
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ import { authDir, listLogins, login, logout } from './auth.js';
|
|
|
24
24
|
import { existingMessage, initReport, planInit, shellWord, writeInit } from './init.js';
|
|
25
25
|
import { SEVERITY_RANK } from './types.js';
|
|
26
26
|
import { toSarif } from './sarif.js';
|
|
27
|
+
import { toJunit } from './junit.js';
|
|
27
28
|
import { badge, badgeMarkdown } from './badge.js';
|
|
28
29
|
import { VERSION } from './version.js';
|
|
29
30
|
import { SECRET_ARGS_ENV } from './mcp-env.js';
|
|
@@ -81,24 +82,36 @@ export async function main(given) {
|
|
|
81
82
|
process.stderr.write(`toolmenu: ${sub} ignores ${stray.join(', ')}: ${one ? 'it is' : 'they are'} for other commands.\n → Next: Leave ${one ? 'it' : 'them'} out to silence this; toolmenu ${sub} --help lists the options ${sub} takes.\n`);
|
|
82
83
|
}
|
|
83
84
|
const asked = values.json ? 'json' : values.format ?? 'text';
|
|
84
|
-
if (!['text', 'json', 'github', 'markdown', 'sarif'].includes(asked))
|
|
85
|
-
throw new UsageError(`--format must be text, json, github, markdown or
|
|
86
|
-
// SARIF
|
|
87
|
-
// report, --sarif <path> writes it beside the report.
|
|
88
|
-
const
|
|
89
|
-
if ((asked === 'sarif' || values.sarif !== undefined || values['sarif-menu'] !== undefined) && !
|
|
85
|
+
if (!['text', 'json', 'github', 'markdown', 'sarif', 'junit'].includes(asked))
|
|
86
|
+
throw new UsageError(`--format must be text, json, github, markdown, sarif or junit`);
|
|
87
|
+
// SARIF and JUnit are findings files, for code scanning and CI test reports: --format
|
|
88
|
+
// sarif|junit prints one instead of the report, --sarif / --junit <path> writes it beside the report.
|
|
89
|
+
const fileCommands = ['snapshot', 'diff', 'session'];
|
|
90
|
+
if ((asked === 'sarif' || values.sarif !== undefined || values['sarif-menu'] !== undefined) && !fileCommands.includes(sub))
|
|
90
91
|
throw new UsageError(`SARIF output (--format sarif, --sarif, --sarif-menu) goes with snapshot, diff or session; ${sub} has none.`);
|
|
92
|
+
if ((asked === 'junit' || values.junit !== undefined) && !fileCommands.includes(sub))
|
|
93
|
+
throw new UsageError(`JUnit output (--format junit, --junit) goes with snapshot, diff or session; ${sub} has none.`);
|
|
91
94
|
if (sub === 'session' && (values.plan || values.init) && (asked === 'sarif' || values.sarif !== undefined))
|
|
92
95
|
throw new UsageError('SARIF needs findings: --plan and --init run nothing.');
|
|
96
|
+
if (sub === 'session' && (values.plan || values.init) && (asked === 'junit' || values.junit !== undefined))
|
|
97
|
+
throw new UsageError('JUnit needs findings: --plan and --init run nothing.');
|
|
93
98
|
const sarifToStdout = asked === 'sarif';
|
|
94
|
-
const
|
|
95
|
-
|
|
99
|
+
const junitToStdout = asked === 'junit';
|
|
100
|
+
const format = (sarifToStdout || junitToStdout ? 'text' : asked);
|
|
101
|
+
/** Print the report, or the SARIF / JUnit file with --format sarif|junit; write --sarif's and --junit's files too. */
|
|
96
102
|
const emit = async (report, findings, command, menuPath) => {
|
|
97
103
|
const menu = values['sarif-menu'] ?? menuPath;
|
|
104
|
+
const sarif = values.sarif !== undefined || sarifToStdout ? toSarif(findings, { command, menuPath: menu }) + '\n' : undefined;
|
|
105
|
+
// session's menuPath is where SARIF points, not what it checked (a live server): no target there.
|
|
106
|
+
const junit = values.junit !== undefined || junitToStdout ? toJunit(findings, { command, failOn, target: command === 'session' ? undefined : menuPath }) + '\n' : undefined;
|
|
98
107
|
if (values.sarif !== undefined)
|
|
99
|
-
await writeFile(values.sarif,
|
|
108
|
+
await writeFile(values.sarif, sarif);
|
|
109
|
+
if (values.junit !== undefined)
|
|
110
|
+
await writeFile(values.junit, junit);
|
|
100
111
|
if (sarifToStdout)
|
|
101
|
-
process.stdout.write(
|
|
112
|
+
process.stdout.write(sarif);
|
|
113
|
+
else if (junitToStdout)
|
|
114
|
+
process.stdout.write(junit);
|
|
102
115
|
else if (report)
|
|
103
116
|
process.stdout.write(show(report) + '\n');
|
|
104
117
|
};
|
package/dist/help.js
CHANGED
|
@@ -12,9 +12,10 @@ const OPTIONS = {
|
|
|
12
12
|
routes: ['--routes <path>', ['routes.yml: pin which words route to which tools']],
|
|
13
13
|
catalog: ['--catalog', ['also read the operations behind a search tool (search and execute:', 'discover, search_*_tools) or command routers (listed with learn: true,', 'never run) and keep them in the menu file for diff']],
|
|
14
14
|
config: ['--config <path>', ['config file (default: toolmenu.config.json, if present)']],
|
|
15
|
-
format: ['--format <fmt>', ['text (default), json, github (annotations), markdown (PR comments)', '
|
|
15
|
+
format: ['--format <fmt>', ['text (default), json, github (annotations), markdown (PR comments)', 'sarif (code scanning) or junit (CI test reports); sarif and junit: snapshot,', 'diff and session']],
|
|
16
16
|
badge: ['--badge <path>', ['also write a README badge there (a shields.io endpoint file: tools, tokens,', 'errors or warnings). Commit it with the menu file; it prints the README line']],
|
|
17
17
|
sarif: ['--sarif <path>', ['also write the findings as SARIF 2.1.0 to this file, for GitHub code', 'scanning (upload it with github/codeql-action/upload-sarif)']],
|
|
18
|
+
junit: ['--junit <path>', ['also write the findings as JUnit XML to this file, for CI test reports', '(GitLab, Jenkins, Azure DevOps, CircleCI): findings at --fail-on or above fail']],
|
|
18
19
|
'sarif-menu': ['--sarif-menu <path>', ['the committed menu file SARIF results point at, at each tool\'s line', '(default: the menu file this command wrote, or diff\'s newer one)']],
|
|
19
20
|
json: ['--json', ['same as --format json']],
|
|
20
21
|
'fail-on': ['--fail-on <level>', ['exit 1 on findings at this level or above: error (default), warn, info']],
|
|
@@ -88,7 +89,7 @@ const HELP = {
|
|
|
88
89
|
'reports what in the menu confuses agents or breaks prompt caches.',
|
|
89
90
|
SERVER_NOTE,
|
|
90
91
|
],
|
|
91
|
-
own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check', 'sarif', 'sarif-menu', 'badge'],
|
|
92
|
+
own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check', 'sarif', 'sarif-menu', 'junit', 'badge'],
|
|
92
93
|
shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
|
|
93
94
|
examples: [
|
|
94
95
|
'toolmenu snapshot -- npx -y @modelcontextprotocol/server-memory',
|
|
@@ -100,7 +101,7 @@ const HELP = {
|
|
|
100
101
|
summary: 'compare two menu files: breaking changes, token change, semver bump',
|
|
101
102
|
usage: ['toolmenu diff [options] <old.json> <new.json>'],
|
|
102
103
|
about: ['Compares two menus written by snapshot (or session --union-out). Starts no server.'],
|
|
103
|
-
own: ['release', 'server-version-is-release', 'sarif', 'sarif-menu'],
|
|
104
|
+
own: ['release', 'server-version-is-release', 'sarif', 'sarif-menu', 'junit'],
|
|
104
105
|
shared: ['config', 'format', 'json', 'fail-on'],
|
|
105
106
|
examples: ['toolmenu diff menu.json new-menu.json', 'toolmenu diff --release 1.4.0..1.5.0 --format markdown old.json new.json'],
|
|
106
107
|
exits: ['0 no findings at or above --fail-on', '1 findings at or above --fail-on', "2 a menu file can't be read, or bad usage"],
|
|
@@ -118,7 +119,7 @@ const HELP = {
|
|
|
118
119
|
'prompt cache, a different menu in a fresh process.',
|
|
119
120
|
SERVER_NOTE,
|
|
120
121
|
],
|
|
121
|
-
own: ['scenario', 'auto', 'init', 'plan', 'value', 'values-file', 'assume-read-only', 'open-world', 'create-handles', 'max-calls', 'max-calls-per-unlock', 'save-scenario', 'union-out', 'elicitation', 'sarif', 'sarif-menu'],
|
|
122
|
+
own: ['scenario', 'auto', 'init', 'plan', 'value', 'values-file', 'assume-read-only', 'open-world', 'create-handles', 'max-calls', 'max-calls-per-unlock', 'save-scenario', 'union-out', 'elicitation', 'sarif', 'sarif-menu', 'junit'],
|
|
122
123
|
shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
|
|
123
124
|
examples: [
|
|
124
125
|
'toolmenu session --auto -- node dist/index.js',
|
package/dist/junit.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Finding, type Severity } from './types.js';
|
|
2
|
+
export interface JunitOptions {
|
|
3
|
+
/** snapshot, diff or session: the suite's name. */
|
|
4
|
+
command: string;
|
|
5
|
+
/** Findings at or above this level fail (default: error, as --fail-on). */
|
|
6
|
+
failOn?: Severity;
|
|
7
|
+
/** The menu file or server checked, shown as the suite's property. */
|
|
8
|
+
target?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Text that is safe inside an XML attribute or element, control characters dropped. */
|
|
11
|
+
export declare function xml(text: string): string;
|
|
12
|
+
export declare function toJunit(findings: Finding[], options: JunitOptions): string;
|
package/dist/junit.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* JUnit XML output, for CI systems that show test results natively: GitLab merge
|
|
3
|
+
* requests, Jenkins, Azure DevOps, CircleCI, Buildkite and GitHub test-report actions.
|
|
4
|
+
*
|
|
5
|
+
* Each finding is one test case. Findings at or above --fail-on are <failure>s, so the
|
|
6
|
+
* test report agrees with the exit code; findings below it pass, with their text in
|
|
7
|
+
* <system-out>. A run with no findings is one passing case, so the CI system records
|
|
8
|
+
* that the check ran rather than finding an empty report.
|
|
9
|
+
*
|
|
10
|
+
* A case's name is the tool it's about (and which of that rule's findings on that
|
|
11
|
+
* tool), not the message: messages carry counts that change between runs, and CI
|
|
12
|
+
* systems track a test's history by its name.
|
|
13
|
+
*/
|
|
14
|
+
import { SEVERITY_RANK } from './types.js';
|
|
15
|
+
import { VERSION } from './version.js';
|
|
16
|
+
import { toolsOf } from './sarif.js';
|
|
17
|
+
/** Text that is safe inside an XML attribute or element, control characters dropped. */
|
|
18
|
+
export function xml(text) {
|
|
19
|
+
return text
|
|
20
|
+
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, '')
|
|
21
|
+
.replace(/&/g, '&')
|
|
22
|
+
.replace(/</g, '<')
|
|
23
|
+
.replace(/>/g, '>')
|
|
24
|
+
.replace(/"/g, '"');
|
|
25
|
+
}
|
|
26
|
+
function body(f) {
|
|
27
|
+
return [
|
|
28
|
+
f.message,
|
|
29
|
+
...(f.detail ?? []),
|
|
30
|
+
...(f.step !== undefined ? [`step: ${f.steps?.length ? f.steps.join(', ') : f.step}`] : []),
|
|
31
|
+
...(f.fix ? [`→ Next: ${f.fix}`] : []),
|
|
32
|
+
...(f.confidence === 'unsure' ? ['(unsure: a heuristic, from names and words)'] : []),
|
|
33
|
+
`toolmenu explain ${f.rule}`,
|
|
34
|
+
].join('\n');
|
|
35
|
+
}
|
|
36
|
+
export function toJunit(findings, options) {
|
|
37
|
+
const failOn = options.failOn ?? 'error';
|
|
38
|
+
const suite = `toolmenu ${options.command}`;
|
|
39
|
+
const seen = new Map();
|
|
40
|
+
const cases = [];
|
|
41
|
+
let failures = 0;
|
|
42
|
+
for (const f of findings) {
|
|
43
|
+
const tools = toolsOf(f);
|
|
44
|
+
// One case per tool, as SARIF has one result per tool.
|
|
45
|
+
for (const tool of tools.length ? tools : [undefined]) {
|
|
46
|
+
const key = `${f.rule}\u0000${tool ?? ''}`;
|
|
47
|
+
const nth = seen.get(key) ?? 0;
|
|
48
|
+
seen.set(key, nth + 1);
|
|
49
|
+
const name = `${tool ?? '(menu)'}${nth ? ` #${nth + 1}` : ''}`;
|
|
50
|
+
const open = ` <testcase classname="${xml(`toolmenu.${options.command}.${f.rule}`)}" name="${xml(name)}" time="0">`;
|
|
51
|
+
if (SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) {
|
|
52
|
+
failures++;
|
|
53
|
+
cases.push(`${open}\n <failure type="${f.severity}" message="${xml(f.message)}">${xml(body(f))}</failure>\n </testcase>`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
cases.push(`${open}\n <system-out>${xml(`${f.severity}: ${body(f)}`)}</system-out>\n </testcase>`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!cases.length)
|
|
61
|
+
cases.push(` <testcase classname="${xml(`toolmenu.${options.command}`)}" name="no findings" time="0"/>`);
|
|
62
|
+
const properties = [
|
|
63
|
+
` <property name="toolmenu.version" value="${xml(VERSION)}"/>`,
|
|
64
|
+
` <property name="fail-on" value="${failOn}"/>`,
|
|
65
|
+
...(options.target ? [` <property name="target" value="${xml(options.target)}"/>`] : []),
|
|
66
|
+
];
|
|
67
|
+
return [
|
|
68
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
69
|
+
`<testsuites name="toolmenu" tests="${cases.length}" failures="${failures}" errors="0" time="0">`,
|
|
70
|
+
` <testsuite name="${xml(suite)}" tests="${cases.length}" failures="${failures}" errors="0" skipped="0" time="0">`,
|
|
71
|
+
' <properties>',
|
|
72
|
+
...properties,
|
|
73
|
+
' </properties>',
|
|
74
|
+
...cases,
|
|
75
|
+
' </testsuite>',
|
|
76
|
+
'</testsuites>',
|
|
77
|
+
].join('\n');
|
|
78
|
+
}
|
package/dist/mcp.js
CHANGED
|
@@ -170,6 +170,16 @@ export function serverArgs(a) {
|
|
|
170
170
|
return { error: 'env goes with command: an HTTP server is already running. Use headers for credentials.' };
|
|
171
171
|
if (!/^https?:\/\//.test(a.url))
|
|
172
172
|
return { error: `url must be an http(s) URL; got "${a.url}". For a stdio server, give command.` };
|
|
173
|
+
let parsed;
|
|
174
|
+
try {
|
|
175
|
+
parsed = new URL(a.url);
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return { error: 'url is not a valid URL. Give a Streamable HTTP endpoint such as https://example.com/mcp.' };
|
|
179
|
+
}
|
|
180
|
+
// Arguments are visible to other local users (ps), so credentials can't ride in the URL.
|
|
181
|
+
if (parsed.username || parsed.password)
|
|
182
|
+
return { error: 'Credentials must be passed using headers, not embedded in the URL: drop the user:password@ part and give e.g. {"Authorization": "Basic ..."} in headers.' };
|
|
173
183
|
return { before: [a.url], secret: Object.entries(a.headers ?? {}).flatMap(([k, v]) => ['--header', `${k}: ${v}`]), after: [] };
|
|
174
184
|
}
|
|
175
185
|
if (a.headers && Object.keys(a.headers).length)
|
package/dist/options.d.ts
CHANGED
package/dist/options.js
CHANGED
package/dist/sarif.d.ts
CHANGED
|
@@ -11,4 +11,6 @@ export interface SarifOptions {
|
|
|
11
11
|
export declare function repoRoot(from?: string): string;
|
|
12
12
|
/** The line of each tool's "name" in a menu file written by toolmenu (1-based). */
|
|
13
13
|
export declare function toolLines(text: string): Map<string, number>;
|
|
14
|
+
/** The tools a finding is about: its tool, or each tool of a change found in several. JUnit uses it too. */
|
|
15
|
+
export declare function toolsOf(f: Finding): string[];
|
|
14
16
|
export declare function toSarif(findings: Finding[], options: SarifOptions): string;
|
package/dist/sarif.js
CHANGED
|
@@ -46,8 +46,8 @@ export function toolLines(text) {
|
|
|
46
46
|
}
|
|
47
47
|
return lines;
|
|
48
48
|
}
|
|
49
|
-
/** The tools a finding is about: its tool, or each tool of a change found in several. */
|
|
50
|
-
function toolsOf(f) {
|
|
49
|
+
/** The tools a finding is about: its tool, or each tool of a change found in several. JUnit uses it too. */
|
|
50
|
+
export function toolsOf(f) {
|
|
51
51
|
const several = f.tools;
|
|
52
52
|
if (Array.isArray(several))
|
|
53
53
|
return several.filter((t) => typeof t === 'string');
|
package/package.json
CHANGED