launch-doctor 0.2.1 → 0.3.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.
@@ -0,0 +1,80 @@
1
+ import type { Finding, Report } from './types.js';
2
+ /** Marks our one summary comment on a pull request, so later runs edit it instead of adding another. */
3
+ export declare const SUMMARY_MARKER = "<!-- launch-doctor:summary -->";
4
+ /** At most this many inline comments per run, so a big pull request isn't buried. */
5
+ export declare const MAX_INLINE = 20;
6
+ export interface PrContext {
7
+ apiUrl: string;
8
+ serverUrl: string;
9
+ /** "owner/name" */
10
+ repo: string;
11
+ number: number;
12
+ headSha: string;
13
+ token: string;
14
+ /** Where the scanned folder sits inside the repository ("" for the repository root, "web" for ./web). */
15
+ prefix: string;
16
+ }
17
+ /**
18
+ * Work out which pull request we're running for from the GitHub Actions environment.
19
+ * Returns a reason string instead when there's nothing to comment on.
20
+ */
21
+ export declare function prContextFromEnv(root: string, env?: NodeJS.ProcessEnv): PrContext | string;
22
+ /** Line numbers (in the new version of the file) that a unified diff patch adds. */
23
+ export declare function addedLines(patch: string): Set<number>;
24
+ /** What a pull request changed in one file: the added lines, or 'all' for a new file GitHub sent no patch for. */
25
+ export type ChangedLines = Set<number> | 'all';
26
+ export interface PrFile {
27
+ filename: string;
28
+ status: string;
29
+ patch?: string;
30
+ }
31
+ export declare function changedFiles(files: PrFile[]): Map<string, ChangedLines>;
32
+ export interface InlineFinding {
33
+ finding: Finding;
34
+ /** Path from the repository root. */
35
+ path: string;
36
+ line: number;
37
+ key: string;
38
+ }
39
+ export interface Placement {
40
+ /** Findings on lines this pull request adds. These get inline comments. */
41
+ inPr: InlineFinding[];
42
+ /** Everything else: older code, files the pull request didn't touch, project-wide findings. */
43
+ elsewhere: Finding[];
44
+ /** Findings left out because they're in .launchdoctor-baseline.json. */
45
+ baseline: number;
46
+ }
47
+ export declare function repoPath(prefix: string, file: string): string;
48
+ /** Split the report's findings into "added by this pull request" and "already there". */
49
+ export declare function placeFindings(report: Report, changed: Map<string, ChangedLines>, prefix: string): Placement;
50
+ /** The body of one inline review comment: what's wrong, why, the fix prompt, and how to silence it. */
51
+ export declare function renderInlineComment(item: InlineFinding): string;
52
+ /** The one summary comment on the pull request, edited in place on every run. */
53
+ export declare function renderPrComment(report: Report, placement: Placement, ctx: PrContext): string;
54
+ export declare class GitHubError extends Error {
55
+ readonly status: number;
56
+ constructor(status: number, message: string);
57
+ }
58
+ type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
59
+ export interface PrResult {
60
+ inPr: number;
61
+ elsewhere: number;
62
+ /** New inline comments posted this run. */
63
+ posted: number;
64
+ /** Inline comments left out: already posted on an earlier run. */
65
+ alreadyPosted: number;
66
+ /** Inline comments left out because of MAX_INLINE. */
67
+ overLimit: number;
68
+ /** Why the inline comments couldn't be posted, when they couldn't. */
69
+ inlineError?: string;
70
+ summary: 'created' | 'updated';
71
+ summaryUrl?: string;
72
+ }
73
+ /**
74
+ * Post Launch Doctor's results to a pull request:
75
+ * one summary comment (edited on later runs) and an inline review comment on each new finding.
76
+ */
77
+ export declare function postPrFeedback(report: Report, ctx: PrContext, fetchImpl?: FetchLike): Promise<PrResult>;
78
+ /** Explain a failed GitHub call in plain words. */
79
+ export declare function explainGitHubError(err: unknown): string;
80
+ export {};
@@ -0,0 +1,288 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { isAbsolute, relative } from 'node:path';
3
+ import { categoryTable, escapeCell } from './summary.js';
4
+ /** Marks our one summary comment on a pull request, so later runs edit it instead of adding another. */
5
+ export const SUMMARY_MARKER = '<!-- launch-doctor:summary -->';
6
+ const FINDING_MARKER = /<!-- launch-doctor:finding (\S+) -->/;
7
+ /** At most this many inline comments per run, so a big pull request isn't buried. */
8
+ export const MAX_INLINE = 20;
9
+ /** At most this many findings per list in the summary comment (GitHub caps a comment at 65,536 characters). */
10
+ const MAX_LISTED = 50;
11
+ /**
12
+ * Work out which pull request we're running for from the GitHub Actions environment.
13
+ * Returns a reason string instead when there's nothing to comment on.
14
+ */
15
+ export function prContextFromEnv(root, env = process.env) {
16
+ if (env.GITHUB_ACTIONS !== 'true')
17
+ return 'not running on GitHub Actions';
18
+ const event = env.GITHUB_EVENT_NAME ?? '';
19
+ if (event !== 'pull_request' && event !== 'pull_request_target') {
20
+ return `this run was started by "${event || 'unknown'}", not by a pull request`;
21
+ }
22
+ const token = env.GITHUB_TOKEN || env.GH_TOKEN;
23
+ if (!token)
24
+ return 'GITHUB_TOKEN is not set (give the step the workflow token as a GITHUB_TOKEN environment variable)';
25
+ const repo = env.GITHUB_REPOSITORY;
26
+ if (!repo || !env.GITHUB_EVENT_PATH)
27
+ return 'GITHUB_REPOSITORY or GITHUB_EVENT_PATH is missing';
28
+ let payload;
29
+ try {
30
+ payload = JSON.parse(readFileSync(env.GITHUB_EVENT_PATH, 'utf8'));
31
+ }
32
+ catch (err) {
33
+ return `couldn't read the event file: ${err.message}`;
34
+ }
35
+ const number = payload.pull_request?.number;
36
+ const headSha = payload.pull_request?.head?.sha;
37
+ if (typeof number !== 'number' || typeof headSha !== 'string')
38
+ return 'the event has no pull request in it';
39
+ const workspace = env.GITHUB_WORKSPACE || process.cwd();
40
+ const rel = relative(workspace, root).replace(/\\/g, '/');
41
+ const prefix = rel === '' || rel.startsWith('..') || isAbsolute(rel) ? '' : rel;
42
+ return {
43
+ apiUrl: (env.GITHUB_API_URL || 'https://api.github.com').replace(/\/$/, ''),
44
+ serverUrl: (env.GITHUB_SERVER_URL || 'https://github.com').replace(/\/$/, ''),
45
+ repo,
46
+ number,
47
+ headSha,
48
+ token,
49
+ prefix,
50
+ };
51
+ }
52
+ /** Line numbers (in the new version of the file) that a unified diff patch adds. */
53
+ export function addedLines(patch) {
54
+ const out = new Set();
55
+ let line = 0;
56
+ for (const row of patch.split('\n')) {
57
+ const hunk = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(row);
58
+ if (hunk) {
59
+ line = Number(hunk[1]);
60
+ continue;
61
+ }
62
+ if (line === 0 || row.startsWith('-') || row.startsWith('\\'))
63
+ continue;
64
+ if (row.startsWith('+'))
65
+ out.add(line);
66
+ line++;
67
+ }
68
+ return out;
69
+ }
70
+ export function changedFiles(files) {
71
+ const out = new Map();
72
+ for (const f of files) {
73
+ if (f.status === 'removed')
74
+ continue;
75
+ if (f.patch !== undefined)
76
+ out.set(f.filename, addedLines(f.patch));
77
+ else if (f.status === 'added')
78
+ out.set(f.filename, 'all');
79
+ else
80
+ out.set(f.filename, new Set());
81
+ }
82
+ return out;
83
+ }
84
+ export function repoPath(prefix, file) {
85
+ return prefix ? `${prefix}/${file}` : file;
86
+ }
87
+ /** Split the report's findings into "added by this pull request" and "already there". */
88
+ export function placeFindings(report, changed, prefix) {
89
+ const placement = { inPr: [], elsewhere: [], baseline: 0 };
90
+ const order = (f) => (f.severity === 'critical' ? 0 : 1);
91
+ const all = report.categories.flatMap((c) => c.findings).sort((a, b) => order(a) - order(b));
92
+ for (const f of all) {
93
+ if (f.baseline) {
94
+ placement.baseline++;
95
+ continue;
96
+ }
97
+ const loc = f.location;
98
+ const lines = loc ? changed.get(repoPath(prefix, loc.file)) : undefined;
99
+ if (loc?.line && lines && (lines === 'all' || lines.has(loc.line))) {
100
+ const path = repoPath(prefix, loc.file);
101
+ placement.inPr.push({ finding: f, path, line: loc.line, key: f.fingerprint ?? `${f.id}:${path}:${loc.line}` });
102
+ }
103
+ else {
104
+ placement.elsewhere.push(f);
105
+ }
106
+ }
107
+ return placement;
108
+ }
109
+ const label = (f) => (f.severity === 'critical' ? '[CRITICAL]' : '[WARN]');
110
+ /** The body of one inline review comment: what's wrong, why, the fix prompt, and how to silence it. */
111
+ export function renderInlineComment(item) {
112
+ const f = item.finding;
113
+ return [
114
+ `<!-- launch-doctor:finding ${item.key} -->`,
115
+ `**${label(f)} ${f.title}**`,
116
+ '',
117
+ f.why,
118
+ '',
119
+ '<details><summary>Fix prompt (paste into Claude Code, Cursor, Lovable or Bolt)</summary>',
120
+ '',
121
+ fence(f.fixPrompt),
122
+ '',
123
+ '</details>',
124
+ '',
125
+ `<sub>Not a problem here? Add a \`launch-doctor-ignore ${f.id}\` comment on this line or the line above.</sub>`,
126
+ ].join('\n');
127
+ }
128
+ /** A code fence that can't be closed early by backticks inside the text. */
129
+ function fence(text) {
130
+ const longest = Math.max(2, ...[...text.matchAll(/`+/g)].map((m) => m[0].length));
131
+ const ticks = '`'.repeat(longest + 1);
132
+ return `${ticks}text\n${text}\n${ticks}`;
133
+ }
134
+ function listItems(items, line) {
135
+ const out = items.slice(0, MAX_LISTED).map(line);
136
+ if (items.length > MAX_LISTED)
137
+ out.push(`- ...and ${items.length - MAX_LISTED} more`);
138
+ return out;
139
+ }
140
+ function countText(findings) {
141
+ const crit = findings.filter((f) => f.severity === 'critical').length;
142
+ const warn = findings.length - crit;
143
+ const parts = [];
144
+ if (crit)
145
+ parts.push(`${crit} critical`);
146
+ if (warn)
147
+ parts.push(`${warn} warning${warn === 1 ? '' : 's'}`);
148
+ return parts.join(', ');
149
+ }
150
+ /** The one summary comment on the pull request, edited in place on every run. */
151
+ export function renderPrComment(report, placement, ctx) {
152
+ const link = (path, line) => `${ctx.serverUrl}/${ctx.repo}/blob/${ctx.headSha}/${path.split('/').map(encodeURIComponent).join('/')}${line ? `#L${line}` : ''}`;
153
+ const where = (path, line) => `[\`${line ? `${path}:${line}` : path}\`](${link(path, line)})`;
154
+ const out = [
155
+ SUMMARY_MARKER,
156
+ `## Launch Doctor: grade ${report.grade}`,
157
+ '',
158
+ `**${escapeCell(report.verdict)}** · ${report.filesScanned} files checked`,
159
+ '',
160
+ '### This pull request',
161
+ '',
162
+ ];
163
+ if (placement.inPr.length) {
164
+ out.push(`${countText(placement.inPr.map((i) => i.finding))} on lines this pull request adds. Each one has an inline comment with a fix prompt.`, '', ...listItems(placement.inPr, (i) => `- ${label(i.finding)} ${escapeCell(i.finding.title)} (${where(i.path, i.line)})`));
165
+ }
166
+ else {
167
+ out.push('No problems in the lines this pull request adds.');
168
+ }
169
+ out.push('');
170
+ if (placement.elsewhere.length) {
171
+ out.push(`<details><summary>Already in the project: ${countText(placement.elsewhere)}</summary>`, '', ...listItems(placement.elsewhere, (f) => {
172
+ const loc = f.location ? ` (${where(repoPath(ctx.prefix, f.location.file), f.location.line)})` : '';
173
+ return `- ${label(f)} ${escapeCell(f.title)}${loc}`;
174
+ }), '', '</details>', '');
175
+ }
176
+ out.push('<details><summary>Scorecard</summary>', '', ...categoryTable(report), '', '</details>', '');
177
+ const notes = [];
178
+ if (placement.baseline) {
179
+ notes.push(`${placement.baseline} known finding${placement.baseline === 1 ? ' is' : 's are'} in .launchdoctor-baseline.json and not shown.`);
180
+ }
181
+ if (report.counts.manual) {
182
+ notes.push(`${report.counts.manual} thing${report.counts.manual === 1 ? '' : 's'} to check by hand before launch.`);
183
+ }
184
+ notes.push(`Run \`npx launch-doctor\` locally for every fix prompt in LAUNCH_FIXES.md. Updated for ${ctx.headSha.slice(0, 7)}.`);
185
+ out.push(`<sub>${notes.join(' ')}</sub>`);
186
+ return out.join('\n');
187
+ }
188
+ export class GitHubError extends Error {
189
+ status;
190
+ constructor(status, message) {
191
+ super(message);
192
+ this.status = status;
193
+ }
194
+ }
195
+ class GitHub {
196
+ ctx;
197
+ fetchImpl;
198
+ constructor(ctx, fetchImpl) {
199
+ this.ctx = ctx;
200
+ this.fetchImpl = fetchImpl;
201
+ }
202
+ async request(method, path, body) {
203
+ const res = await this.fetchImpl(`${this.ctx.apiUrl}${path}`, {
204
+ method,
205
+ headers: {
206
+ accept: 'application/vnd.github+json',
207
+ authorization: `Bearer ${this.ctx.token}`,
208
+ 'user-agent': 'launch-doctor',
209
+ 'x-github-api-version': '2022-11-28',
210
+ ...(body === undefined ? {} : { 'content-type': 'application/json' }),
211
+ },
212
+ body: body === undefined ? undefined : JSON.stringify(body),
213
+ });
214
+ if (!res.ok) {
215
+ const text = await res.text().catch(() => '');
216
+ throw new GitHubError(res.status, `${method} ${path} returned ${res.status}${text ? `: ${text.slice(0, 300)}` : ''}`);
217
+ }
218
+ return (res.status === 204 ? null : await res.json());
219
+ }
220
+ /** Read every page of a list endpoint (up to 3,000 items). */
221
+ async list(path) {
222
+ const out = [];
223
+ for (let page = 1; page <= 30; page++) {
224
+ const items = await this.request('GET', `${path}?per_page=100&page=${page}`);
225
+ out.push(...items);
226
+ if (items.length < 100)
227
+ break;
228
+ }
229
+ return out;
230
+ }
231
+ }
232
+ /**
233
+ * Post Launch Doctor's results to a pull request:
234
+ * one summary comment (edited on later runs) and an inline review comment on each new finding.
235
+ */
236
+ export async function postPrFeedback(report, ctx, fetchImpl = globalThis.fetch) {
237
+ const gh = new GitHub(ctx, fetchImpl);
238
+ const base = `/repos/${ctx.repo}`;
239
+ const files = await gh.list(`${base}/pulls/${ctx.number}/files`);
240
+ const placement = placeFindings(report, changedFiles(files), ctx.prefix);
241
+ // Inline comments: skip findings we already commented on in an earlier run.
242
+ const reviewComments = await gh.list(`${base}/pulls/${ctx.number}/comments`);
243
+ const seen = new Set(reviewComments.map((c) => FINDING_MARKER.exec(c.body ?? '')?.[1]).filter(Boolean));
244
+ const fresh = placement.inPr.filter((i) => !seen.has(i.key));
245
+ const toPost = fresh.slice(0, MAX_INLINE);
246
+ let inlineError;
247
+ if (toPost.length) {
248
+ // Best effort: if the review is rejected (say the commit moved on), still post the summary.
249
+ try {
250
+ await gh.request('POST', `${base}/pulls/${ctx.number}/reviews`, {
251
+ commit_id: ctx.headSha,
252
+ event: 'COMMENT',
253
+ body: `Launch Doctor found ${countText(toPost.map((i) => i.finding))} in this change.`,
254
+ comments: toPost.map((i) => ({ path: i.path, line: i.line, side: 'RIGHT', body: renderInlineComment(i) })),
255
+ });
256
+ }
257
+ catch (err) {
258
+ inlineError = explainGitHubError(err);
259
+ }
260
+ }
261
+ // The summary comment: edit ours if it's there, otherwise add it.
262
+ const body = renderPrComment(report, placement, ctx);
263
+ const issueComments = await gh.list(`${base}/issues/${ctx.number}/comments`);
264
+ const mine = issueComments.find((c) => (c.body ?? '').startsWith(SUMMARY_MARKER));
265
+ const saved = mine
266
+ ? await gh.request('PATCH', `${base}/issues/comments/${mine.id}`, { body })
267
+ : await gh.request('POST', `${base}/issues/${ctx.number}/comments`, { body });
268
+ return {
269
+ inPr: placement.inPr.length,
270
+ elsewhere: placement.elsewhere.length,
271
+ posted: inlineError ? 0 : toPost.length,
272
+ inlineError,
273
+ alreadyPosted: placement.inPr.length - fresh.length,
274
+ overLimit: fresh.length - toPost.length,
275
+ summary: mine ? 'updated' : 'created',
276
+ summaryUrl: saved?.html_url,
277
+ };
278
+ }
279
+ /** Explain a failed GitHub call in plain words. */
280
+ export function explainGitHubError(err) {
281
+ if (err instanceof GitHubError && (err.status === 403 || err.status === 404)) {
282
+ return `GitHub refused the comment (${err.status}). The workflow needs "permissions: pull-requests: write". Pull requests from forks only get a read-only token, so they can't be commented on; the job summary still has the results.`;
283
+ }
284
+ if (err instanceof GitHubError && err.status === 422) {
285
+ return `GitHub rejected the comment (422). ${err.message}`;
286
+ }
287
+ return `Couldn't comment on the pull request: ${err.message}`;
288
+ }
@@ -7,6 +7,7 @@ export declare function isInlineIgnored(ctx: ProjectContext, f: Finding): boolea
7
7
  export declare const CATEGORY_IDS: () => string[];
8
8
  export declare function runDoctor(root: string, options?: Options): Promise<Report>;
9
9
  export { renderFixes } from './fixes.js';
10
+ export { postPrFeedback, prContextFromEnv, renderPrComment } from './github.js';
10
11
  export { ProjectContext } from './project.js';
11
12
  export { renderReport } from './report.js';
12
13
  export type * from './types.js';
package/dist/src/index.js CHANGED
@@ -131,6 +131,7 @@ export async function runDoctor(root, options = {}) {
131
131
  truncated: ctx.truncated,
132
132
  ignored,
133
133
  unknownIgnoreIds,
134
+ ...(ctx.nestedRepos.length ? { nestedRepos: ctx.nestedRepos } : {}),
134
135
  ...summary,
135
136
  categories,
136
137
  generatedAt: new Date().toISOString(),
@@ -143,5 +144,6 @@ export async function runDoctor(root, options = {}) {
143
144
  return report;
144
145
  }
145
146
  export { renderFixes } from './fixes.js';
147
+ export { postPrFeedback, prContextFromEnv, renderPrComment } from './github.js';
146
148
  export { ProjectContext } from './project.js';
147
149
  export { renderReport } from './report.js';
@@ -1,5 +1,5 @@
1
1
  /** The same workflow as the README's "CI integration" example. */
2
- export declare const WORKFLOW_TEMPLATE = "name: Launch Doctor\non: [pull_request]\njobs:\n check:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v5\n - uses: actions/setup-node@v5\n with:\n node-version: 22\n - run: npx launch-doctor --ci\n";
2
+ export declare const WORKFLOW_TEMPLATE = "name: Launch Doctor\non: [pull_request]\njobs:\n check:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v7\n - uses: actions/setup-node@v7\n with:\n node-version: 22\n - run: npx launch-doctor --ci\n";
3
3
  export declare const IGNORE_TEMPLATE = "# .launchdoctorignore: things Launch Doctor should leave alone.\n# One entry per line. Lines starting with # are comments.\n\n# Finding ids (each fix in LAUNCH_FIXES.md shows its id). For example:\n# no-error-tracking\n# no-account-deletion\n\n# Folders or files to skip (anything with / * or . is a path):\n# legacy/\n# scripts/seed.ts\n# **/*.fixture.ts\n\n# To silence one finding in one place, add a comment on that line or the line above:\n# // launch-doctor-ignore stripe-test-key\n";
4
4
  export interface InitResult {
5
5
  created: string[];
package/dist/src/init.js CHANGED
@@ -7,8 +7,8 @@ jobs:
7
7
  check:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
- - uses: actions/checkout@v5
11
- - uses: actions/setup-node@v5
10
+ - uses: actions/checkout@v7
11
+ - uses: actions/setup-node@v7
12
12
  with:
13
13
  node-version: 22
14
14
  - run: npx launch-doctor --ci
@@ -0,0 +1,140 @@
1
+ import type { Readable, Writable } from 'node:stream';
2
+ import type { Report } from './types.js';
3
+ /**
4
+ * A Model Context Protocol server over stdio, so AI coding tools (Claude Code, Cursor, ...)
5
+ * can run Launch Doctor themselves. One JSON-RPC 2.0 message per line on stdin and stdout.
6
+ * Nothing else may be written to stdout: it is the protocol channel.
7
+ */
8
+ /** Protocol versions this server speaks, newest first. */
9
+ export declare const PROTOCOL_VERSIONS: string[];
10
+ interface ToolResult {
11
+ content: {
12
+ type: 'text';
13
+ text: string;
14
+ }[];
15
+ structuredContent?: Record<string, unknown>;
16
+ isError?: boolean;
17
+ }
18
+ /** The tools this server offers, with JSON Schemas for their arguments. */
19
+ export declare function mcpTools(): ({
20
+ name: string;
21
+ title: string;
22
+ description: string;
23
+ inputSchema: {
24
+ type: string;
25
+ properties: {
26
+ path: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ only: {
31
+ type: string;
32
+ items: {
33
+ type: string;
34
+ enum: string[];
35
+ };
36
+ description: string;
37
+ };
38
+ skip: {
39
+ type: string;
40
+ items: {
41
+ type: string;
42
+ enum: string[];
43
+ };
44
+ description: string;
45
+ };
46
+ offline: {
47
+ type: string;
48
+ description: string;
49
+ };
50
+ domain: {
51
+ type: string;
52
+ description: string;
53
+ };
54
+ history: {
55
+ type: string;
56
+ description: string;
57
+ };
58
+ includeBaseline: {
59
+ type: string;
60
+ description: string;
61
+ };
62
+ url?: undefined;
63
+ skipDatabase?: undefined;
64
+ };
65
+ additionalProperties: boolean;
66
+ required?: undefined;
67
+ };
68
+ annotations: {
69
+ readOnlyHint: boolean;
70
+ idempotentHint: boolean;
71
+ openWorldHint: boolean;
72
+ };
73
+ } | {
74
+ name: string;
75
+ title: string;
76
+ description: string;
77
+ inputSchema: {
78
+ type: string;
79
+ properties: {
80
+ path?: undefined;
81
+ only?: undefined;
82
+ skip?: undefined;
83
+ offline?: undefined;
84
+ domain?: undefined;
85
+ history?: undefined;
86
+ includeBaseline?: undefined;
87
+ url: {
88
+ type: string;
89
+ description: string;
90
+ };
91
+ skipDatabase: {
92
+ type: string;
93
+ description: string;
94
+ };
95
+ };
96
+ required: string[];
97
+ additionalProperties: boolean;
98
+ };
99
+ annotations: {
100
+ readOnlyHint: boolean;
101
+ idempotentHint: boolean;
102
+ openWorldHint: boolean;
103
+ };
104
+ } | {
105
+ name: string;
106
+ title: string;
107
+ description: string;
108
+ inputSchema: {
109
+ required?: undefined;
110
+ type: string;
111
+ properties: {
112
+ path?: undefined;
113
+ only?: undefined;
114
+ skip?: undefined;
115
+ offline?: undefined;
116
+ domain?: undefined;
117
+ history?: undefined;
118
+ includeBaseline?: undefined;
119
+ url?: undefined;
120
+ skipDatabase?: undefined;
121
+ };
122
+ additionalProperties: boolean;
123
+ };
124
+ annotations: {
125
+ readOnlyHint: boolean;
126
+ idempotentHint: boolean;
127
+ openWorldHint: boolean;
128
+ };
129
+ })[];
130
+ /** Plain-text summary of a report, written for an AI assistant that will act on it. */
131
+ export declare function reportText(report: Report, includeBaseline?: boolean): string;
132
+ /** The same report as data, for clients that read structured tool output. */
133
+ export declare function reportData(report: Report, includeBaseline?: boolean): Record<string, unknown>;
134
+ /** Run one tool. Unknown tool names are a protocol error; bad arguments are a tool error the model can fix. */
135
+ export declare function callTool(name: unknown, args: unknown, cwd?: string): Promise<ToolResult>;
136
+ /** Handle one parsed message (or a batch). Returns what to send back, or null for nothing. */
137
+ export declare function handleMessage(msg: unknown, cwd?: string): Promise<object | null>;
138
+ /** Serve MCP on stdin/stdout until stdin closes. */
139
+ export declare function runMcpServer(input?: Readable, output?: Writable, cwd?: string): Promise<void>;
140
+ export {};