netlify 27.18.0 → 27.19.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.
@@ -20,6 +20,7 @@ import { handleOptionError, isOptionError } from '../utils/command-error-handler
20
20
  import { EXIT_CODES } from '../utils/exit-codes.js';
21
21
  import { getFrameworksAPIPaths } from '../utils/frameworks-api.js';
22
22
  import { getSiteByName } from '../utils/get-site.js';
23
+ import { showAgentSkillsRefreshNotice, startAgentSkillsRefresh } from '../utils/init/agent-skills-refresh.js';
23
24
  import { getLocalApiTestOpts } from '../utils/local-api-test-opts.js';
24
25
  import { buildAuthorizeUrl } from '../utils/login-url.js';
25
26
  import openBrowser from '../utils/open-browser.js';
@@ -54,6 +55,25 @@ const COMMANDS_WITHOUT_WORKSPACE_OPTIONS = new Set([
54
55
  * A list of commands where we need to fetch featureflags for config resolution
55
56
  */
56
57
  const COMMANDS_WITH_FEATURE_FLAGS = new Set(['build', 'dev', 'deploy']);
58
+ /**
59
+ * Commands that skip the background refresh of Netlify skills. `init` syncs them itself.
60
+ */
61
+ const COMMANDS_WITHOUT_SKILLS_REFRESH = new Set(['init', 'completion']);
62
+ const refreshAgentSkillsInBackground = async (command) => {
63
+ const { repositoryRoot } = command.netlify;
64
+ if (!repositoryRoot || COMMANDS_WITHOUT_SKILLS_REFRESH.has(command.name())) {
65
+ return;
66
+ }
67
+ try {
68
+ if (!process.argv.includes('--silent')) {
69
+ await showAgentSkillsRefreshNotice({ repositoryRoot });
70
+ }
71
+ await startAgentSkillsRefresh({ repositoryRoot });
72
+ }
73
+ catch (error) {
74
+ debug(`${command.name()}:skills`)(error);
75
+ }
76
+ };
57
77
  /**
58
78
  * Names of options whose values should be scrubbed
59
79
  */
@@ -189,6 +209,7 @@ export default class BaseCommand extends Command {
189
209
  debug(`${commandName}:preAction`)('start');
190
210
  this.analytics.startTime = process.hrtime.bigint();
191
211
  await this.init(actionCommand);
212
+ await refreshAgentSkillsInBackground(actionCommand);
192
213
  debug(`${commandName}:preAction`)('end');
193
214
  });
194
215
  // Wrap the command's action() to set exitOverride when action is registered.
@@ -1,14 +1,24 @@
1
+ import { Option } from 'commander';
1
2
  import terminalLink from 'terminal-link';
3
+ import { AUTO_UPDATE_ENV } from '../../utils/init/agent-skills-refresh.js';
2
4
  export const createInitCommand = (program) => program
3
5
  .command('init')
4
6
  .description('Configure continuous deployment for a new or existing project. To create a new project without continuous deployment, use `netlify sites:create`')
5
7
  .option('-m, --manual', 'Manually configure a git remote for CI')
6
8
  .option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
7
- .option('--skip-agent-setup', 'Skip installing Netlify skills for AI coding agents into the project')
9
+ .option('--skip-agent-setup', 'Skip installing Netlify skills and adding the Netlify MCP server for AI coding agents')
10
+ .option('--skip-mcp-setup', 'Skip adding the Netlify MCP server to your AI coding agents')
11
+ .addOption(new Option('--mcp-scope <scope>', 'Add the Netlify MCP server for this project only, or for your user across all projects')
12
+ .choices(['project', 'user'])
13
+ .default('project'))
14
+ .option('--reset-mcp-setup', 'Forget your saved Netlify MCP server choices and ask which AI coding agents to set up')
8
15
  .option('--reset-context', 'Replace locally edited Netlify skills with the latest release, and migrate or delete edited copies under renamed or deprecated names')
9
16
  .addHelpText('after', () => {
10
17
  const docsUrl = 'https://docs.netlify.com/cli/get-started/';
11
18
  return `
19
+ Other commands keep the installed Netlify skills up to date in the background, checking at most once an hour.
20
+ Set ${AUTO_UPDATE_ENV}=false to turn that off.
21
+
12
22
  For more information about getting started with Netlify CLI, see ${terminalLink(docsUrl, docsUrl, { fallback: false })}
13
23
  `;
14
24
  })
@@ -16,6 +26,9 @@ For more information about getting started with Netlify CLI, see ${terminalLink(
16
26
  const { init } = await import('./init.js');
17
27
  await init(options, command, {
18
28
  setupAgentSkills: !options.skipAgentSetup,
29
+ setupAgentMcp: !options.skipAgentSetup && !options.skipMcpSetup,
30
+ resetMcpSetup: Boolean(options.resetMcpSetup),
31
+ mcpScope: options.mcpScope === 'user' ? 'user' : 'project',
19
32
  resetContext: Boolean(options.resetContext),
20
33
  });
21
34
  });
@@ -1,14 +1,18 @@
1
1
  import { OptionValues } from 'commander';
2
2
  import type BaseCommand from '../base-command.js';
3
3
  import type { SiteInfo } from '../../utils/types.js';
4
+ import { type McpScope } from '../../utils/init/agent-mcp.js';
4
5
  import { type InitExitCode } from './constants.js';
5
6
  type InitExitMessageCustomizer = (code: InitExitCode, defaultMessage: string) => string | undefined;
6
7
  type InitExtraOptions = {
7
8
  customizeExitMessage?: InitExitMessageCustomizer | undefined;
8
9
  exitAfterConfiguringRepo?: boolean | undefined;
9
10
  setupAgentSkills?: boolean | undefined;
11
+ setupAgentMcp?: boolean | undefined;
10
12
  resetContext?: boolean | undefined;
13
+ resetMcpSetup?: boolean | undefined;
14
+ mcpScope?: McpScope | undefined;
11
15
  };
12
- export declare const init: (options: OptionValues, command: BaseCommand, { customizeExitMessage, exitAfterConfiguringRepo, setupAgentSkills: shouldSetupAgentSkills, resetContext, }?: InitExtraOptions) => Promise<SiteInfo>;
16
+ export declare const init: (options: OptionValues, command: BaseCommand, { customizeExitMessage, exitAfterConfiguringRepo, setupAgentSkills: shouldSetupAgentSkills, setupAgentMcp: shouldSetupAgentMcp, resetContext, resetMcpSetup, mcpScope, }?: InitExtraOptions) => Promise<SiteInfo>;
13
17
  export {};
14
18
  //# sourceMappingURL=init.d.ts.map
@@ -7,6 +7,8 @@ import { configureRepo } from '../../utils/init/config.js';
7
7
  import { track } from '../../utils/telemetry/index.js';
8
8
  import { link } from '../link/link.js';
9
9
  import { sitesCreate } from '../sites/sites-create.js';
10
+ import { findProjectSetupBlocker } from '../../utils/init/agent-location.js';
11
+ import { setupAgentMcp } from '../../utils/init/agent-mcp.js';
10
12
  import { setupAgentSkills } from '../../utils/init/agent-skills.js';
11
13
  import { getBuildSettings, saveNetlifyToml } from '../../utils/init/utils.js';
12
14
  import { LINKED_EXISTING_SITE_EXIT_CODE, LINKED_NEW_SITE_EXIT_CODE } from './constants.js';
@@ -213,9 +215,8 @@ const logExistingRepoSetupAndExit = ({ repoUrl, siteName, customizeExitMessage,
213
215
  // TODO add support for changing GitHub repo in site:config command
214
216
  exit();
215
217
  };
216
- const installAgentSkills = async (command, reset) => {
217
- log();
218
- const result = await setupAgentSkills({ workingDir: command.netlify.repositoryRoot, reset });
218
+ const installAgentSkills = async (workingDir, reset) => {
219
+ const result = await setupAgentSkills({ workingDir, reset });
219
220
  await track('sites_agentSkillsSetup', {
220
221
  installed: result.installed,
221
222
  directories: result.directories,
@@ -224,21 +225,62 @@ const installAgentSkills = async (command, reset) => {
224
225
  ...result.summary,
225
226
  });
226
227
  };
227
- export const init = async (options, command, { customizeExitMessage, exitAfterConfiguringRepo = false, setupAgentSkills: shouldSetupAgentSkills = false, resetContext = false, } = {}) => {
228
+ const addAgentMcp = async (command, reset, scope) => {
229
+ const { repositoryRoot, state } = command.netlify;
230
+ const { selection, agents, failed = false, } = await setupAgentMcp({
231
+ workingDir: repositoryRoot,
232
+ store: state,
233
+ scope,
234
+ reset,
235
+ });
236
+ await track('sites_agentMcpSetup', { selection, agents, failed, scope, resetMcpSetup: reset });
237
+ };
238
+ const setUpAgents = async (command, { skills, mcp, reset, resetMcp, mcpScope, }) => {
239
+ if (!skills && !mcp) {
240
+ return;
241
+ }
242
+ const { repositoryRoot } = command.netlify;
243
+ log();
244
+ const blocker = await findProjectSetupBlocker(repositoryRoot);
245
+ const skillsBlocked = skills && blocker !== undefined;
246
+ const mcpBlocked = mcp && blocker !== undefined && (blocker.place === 'root' || mcpScope === 'project');
247
+ if (blocker && (skillsBlocked || mcpBlocked)) {
248
+ const skipped = [skillsBlocked && 'Netlify skills', mcpBlocked && 'the Netlify MCP server']
249
+ .filter(Boolean)
250
+ .join(' and ');
251
+ log(`Skipped setting up ${skipped}: ${blocker.reason}.`);
252
+ log(` Run ${chalk.cyanBright.bold(`${netlifyCommand()} init`)} from your project folder to set up ${skipped} there.`);
253
+ await track('sites_agentSetupSkipped', { skills: skillsBlocked, mcp: mcpBlocked });
254
+ }
255
+ if (skills && !skillsBlocked) {
256
+ await installAgentSkills(repositoryRoot, reset);
257
+ }
258
+ if (mcp && !mcpBlocked) {
259
+ await addAgentMcp(command, resetMcp, mcpScope);
260
+ }
261
+ };
262
+ export const init = async (options, command, { customizeExitMessage, exitAfterConfiguringRepo = false, setupAgentSkills: shouldSetupAgentSkills = false, setupAgentMcp: shouldSetupAgentMcp = false, resetContext = false, resetMcpSetup = false, mcpScope = 'project', } = {}) => {
228
263
  command.setAnalyticsPayload({
229
264
  manual: options.manual,
230
265
  force: options.force,
231
266
  skipAgentSetup: options.skipAgentSetup,
267
+ skipMcpSetup: options.skipMcpSetup,
232
268
  resetContext: options.resetContext,
269
+ resetMcpSetup: options.resetMcpSetup,
270
+ mcpScope,
233
271
  });
234
272
  const { repositoryRoot, state } = command.netlify;
235
273
  // Check logged in status
236
274
  await command.authenticate();
237
275
  // Add .netlify to .gitignore file
238
276
  await ensureNetlifyIgnore(repositoryRoot);
239
- if (shouldSetupAgentSkills) {
240
- await installAgentSkills(command, resetContext);
241
- }
277
+ await setUpAgents(command, {
278
+ skills: shouldSetupAgentSkills,
279
+ mcp: shouldSetupAgentMcp,
280
+ reset: resetContext,
281
+ resetMcp: resetMcpSetup,
282
+ mcpScope,
283
+ });
242
284
  const linkedSiteInfo = await getLinkedSiteInfo(command);
243
285
  if (linkedSiteInfo && getRepoUrl(linkedSiteInfo) && !options.force) {
244
286
  logExistingAndExit({ siteInfo: linkedSiteInfo });
@@ -1,5 +1,5 @@
1
1
  // Only markers an agent product sets on its own count as a signal; never infer from process names, terminals, or the process tree.
2
- // The result is untrusted attribution from the environment, for telemetry and labeling only, never for authorization.
2
+ // The result is untrusted attribution from the environment. It may label telemetry or pick which agent's config to write, never authorize an action.
3
3
  export const CANONICAL_AGENT_NAMES = [
4
4
  'claude',
5
5
  'codex',
@@ -0,0 +1,6 @@
1
+ export interface ProjectSetupBlocker {
2
+ place: 'home' | 'root';
3
+ reason: string;
4
+ }
5
+ export declare const findProjectSetupBlocker: (root: string, home?: string) => Promise<ProjectSetupBlocker | undefined>;
6
+ //# sourceMappingURL=agent-location.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import path from 'node:path';
4
+ const realpathOrSelf = async (target) => {
5
+ try {
6
+ return await fs.realpath(target);
7
+ }
8
+ catch {
9
+ return path.resolve(target);
10
+ }
11
+ };
12
+ export const findProjectSetupBlocker = async (root, home = homedir()) => {
13
+ const resolvedRoot = await realpathOrSelf(root);
14
+ if (resolvedRoot === (await realpathOrSelf(home))) {
15
+ return { place: 'home', reason: 'this is your home directory, where they would apply to every project' };
16
+ }
17
+ if (resolvedRoot === path.parse(resolvedRoot).root) {
18
+ return { place: 'root', reason: 'this is the root of the file system' };
19
+ }
20
+ return undefined;
21
+ };
22
+ //# sourceMappingURL=agent-location.js.map
@@ -0,0 +1,30 @@
1
+ export type ConfigFormat = 'json' | 'toml';
2
+ export interface ProjectConfigFile {
3
+ path: string;
4
+ alternatives?: string[];
5
+ format: ConfigFormat;
6
+ key: string;
7
+ entry: Record<string, string | boolean>;
8
+ note?: string;
9
+ }
10
+ export interface ConfigServer {
11
+ name: string;
12
+ target: string;
13
+ disabled: boolean;
14
+ }
15
+ export type ConfigRead = {
16
+ readable: true;
17
+ path: string;
18
+ content: string;
19
+ servers: ConfigServer[];
20
+ } | {
21
+ readable: false;
22
+ path: string;
23
+ reason: string;
24
+ };
25
+ export declare const readProjectConfig: (workingDir: string, file: ProjectConfigFile) => Promise<ConfigRead>;
26
+ export declare const addToProjectConfig: (workingDir: string, file: ProjectConfigFile, name: string, { path: resolved, content }: {
27
+ path: string;
28
+ content: string;
29
+ }) => Promise<boolean>;
30
+ //# sourceMappingURL=agent-mcp-config.d.ts.map
@@ -0,0 +1,206 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { findNodeAtLocation, parse, parseTree } from 'jsonc-parser';
4
+ import toml from 'toml';
5
+ import writeFileAtomic from 'write-file-atomic';
6
+ import { fileExistsAsync } from '../../lib/fs.js';
7
+ const SERVER_FIELDS = new Set(['url', 'httpUrl', 'serverUrl', 'command']);
8
+ const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
9
+ const looksLikeServer = (value) => isObject(value) && Object.keys(value).some((field) => SERVER_FIELDS.has(field));
10
+ const stringLeaves = (value) => {
11
+ if (typeof value === 'string') {
12
+ return [value];
13
+ }
14
+ if (Array.isArray(value)) {
15
+ return value.flatMap(stringLeaves);
16
+ }
17
+ if (isObject(value)) {
18
+ return Object.values(value).flatMap(stringLeaves);
19
+ }
20
+ return [];
21
+ };
22
+ const serversIn = (map) => isObject(map)
23
+ ? Object.entries(map).map(([name, value]) => ({
24
+ name,
25
+ target: stringLeaves(value).join(' '),
26
+ disabled: isObject(value) && (value.enabled === false || value.disabled === true),
27
+ }))
28
+ : [];
29
+ const readFileOrEmpty = async (file) => {
30
+ try {
31
+ return await fs.readFile(file, 'utf8');
32
+ }
33
+ catch (error) {
34
+ if (error.code === 'ENOENT') {
35
+ return '';
36
+ }
37
+ return undefined;
38
+ }
39
+ };
40
+ const detectEol = (content) => (content.includes('\r\n') ? '\r\n' : '\n');
41
+ const detectIndent = (content) => /^([ \t]+)"/m.exec(content)?.[1] ?? ' ';
42
+ const parseJson = (content) => {
43
+ const errors = [];
44
+ const parsed = parse(content, errors, { allowTrailingComma: true });
45
+ return errors.length === 0 && isObject(parsed) ? parsed : undefined;
46
+ };
47
+ const readJson = (file, content, key) => {
48
+ if (content.trim() === '') {
49
+ return { readable: true, path: file, content, servers: [] };
50
+ }
51
+ const parsed = parseJson(content);
52
+ if (parsed === undefined) {
53
+ return { readable: false, path: file, reason: 'it is not valid JSON' };
54
+ }
55
+ const bare = !(key in parsed) && Object.values(parsed).some(looksLikeServer);
56
+ if (bare) {
57
+ return { readable: false, path: file, reason: `its servers are not under ${JSON.stringify(key)}` };
58
+ }
59
+ if (key in parsed && !isObject(parsed[key])) {
60
+ return { readable: false, path: file, reason: `its ${JSON.stringify(key)} is not an object` };
61
+ }
62
+ return { readable: true, path: file, content, servers: serversIn(parsed[key]) };
63
+ };
64
+ const parseToml = (content) => {
65
+ try {
66
+ const parsed = toml.parse(content);
67
+ return isObject(parsed) ? parsed : undefined;
68
+ }
69
+ catch {
70
+ return undefined;
71
+ }
72
+ };
73
+ const readToml = (file, content, key) => {
74
+ const parsed = parseToml(content);
75
+ if (parsed === undefined) {
76
+ return { readable: false, path: file, reason: 'it is not valid TOML' };
77
+ }
78
+ return { readable: true, path: file, content, servers: serversIn(parsed[key]) };
79
+ };
80
+ const existingCandidates = async (workingDir, file) => {
81
+ const present = [];
82
+ for (const candidate of [file.path, ...(file.alternatives ?? [])]) {
83
+ if (await fileExistsAsync(path.join(workingDir, candidate))) {
84
+ present.push(candidate);
85
+ }
86
+ }
87
+ return present;
88
+ };
89
+ const realpathOrSelf = async (target) => {
90
+ try {
91
+ return await fs.realpath(target);
92
+ }
93
+ catch {
94
+ return target;
95
+ }
96
+ };
97
+ const realpathThroughMissing = async (target) => {
98
+ const missing = [];
99
+ let existing = target;
100
+ while (!(await fileExistsAsync(existing))) {
101
+ const parent = path.dirname(existing);
102
+ if (parent === existing) {
103
+ break;
104
+ }
105
+ missing.unshift(path.basename(existing));
106
+ existing = parent;
107
+ }
108
+ return path.join(await realpathOrSelf(existing), ...missing);
109
+ };
110
+ const insideProject = async (workingDir, file) => {
111
+ const root = await realpathOrSelf(workingDir);
112
+ const resolved = await realpathThroughMissing(path.join(workingDir, file));
113
+ return resolved.startsWith(`${root}${path.sep}`);
114
+ };
115
+ const readOne = (file, resolved, content) => file.format === 'toml' ? readToml(resolved, content, file.key) : readJson(resolved, content, file.key);
116
+ export const readProjectConfig = async (workingDir, file) => {
117
+ const present = await existingCandidates(workingDir, file);
118
+ const target = present[0] ?? file.path;
119
+ if (!(await insideProject(workingDir, target))) {
120
+ return { readable: false, path: target, reason: 'it points outside this project' };
121
+ }
122
+ const servers = [];
123
+ let first;
124
+ for (const candidate of present.length > 0 ? present : [target]) {
125
+ const content = await readFileOrEmpty(path.join(workingDir, candidate));
126
+ if (content === undefined) {
127
+ return { readable: false, path: candidate, reason: 'it could not be read' };
128
+ }
129
+ const read = readOne(file, candidate, content);
130
+ if (!read.readable) {
131
+ return read;
132
+ }
133
+ servers.push(...read.servers);
134
+ first ??= read.content;
135
+ }
136
+ return { readable: true, path: target, content: first ?? '', servers };
137
+ };
138
+ const tomlValue = (value) => typeof value === 'string' ? JSON.stringify(value) : String(value);
139
+ const objectDepth = (node) => {
140
+ let depth = 0;
141
+ for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
142
+ if (ancestor.type === 'object') {
143
+ depth += 1;
144
+ }
145
+ }
146
+ return depth;
147
+ };
148
+ const insertProperty = (content, object, name, value, eol, indent) => {
149
+ const depth = objectDepth(object) + 1;
150
+ const last = object.children?.at(-1);
151
+ const siblingPad = last === undefined ? undefined : /(?:^|\n|\r)([ \t]*)$/.exec(content.slice(0, last.offset))?.[1];
152
+ const pad = siblingPad ?? indent.repeat(depth);
153
+ const closing = object.offset + object.length - 1;
154
+ const property = `${JSON.stringify(name)}: ${JSON.stringify(value, null, indent).split('\n').join(`${eol}${pad}`)}`;
155
+ if (last === undefined) {
156
+ if (content.slice(object.offset + 1, closing).trim() !== '') {
157
+ return undefined;
158
+ }
159
+ return `${content.slice(0, object.offset + 1)}${eol}${pad}${property}${eol}${indent.repeat(depth - 1)}${content.slice(closing)}`;
160
+ }
161
+ const lastEnd = last.offset + last.length;
162
+ const lineEnd = content.indexOf(eol, lastEnd);
163
+ if (lineEnd === -1 || lineEnd > closing) {
164
+ return `${content.slice(0, lastEnd)}, ${JSON.stringify(name)}: ${JSON.stringify(value)}${content.slice(lastEnd)}`;
165
+ }
166
+ const trailingComma = /^\s*,/.test(content.slice(lastEnd, lineEnd));
167
+ const comma = trailingComma ? '' : ',';
168
+ return `${content.slice(0, lastEnd)}${comma}${content.slice(lastEnd, lineEnd)}${eol}${pad}${property}${trailingComma ? ',' : ''}${content.slice(lineEnd)}`;
169
+ };
170
+ const withJsonEntry = (content, { key, entry }, name) => {
171
+ if (content.trim() === '') {
172
+ return `${JSON.stringify({ [key]: { [name]: entry } }, null, 2)}\n`;
173
+ }
174
+ const root = parseTree(content, [], { allowTrailingComma: true });
175
+ if (root?.type !== 'object') {
176
+ return undefined;
177
+ }
178
+ const eol = detectEol(content);
179
+ const indent = detectIndent(content);
180
+ const servers = findNodeAtLocation(root, [key]);
181
+ return servers === undefined
182
+ ? insertProperty(content, root, key, { [name]: entry }, eol, indent)
183
+ : insertProperty(content, servers, name, entry, eol, indent);
184
+ };
185
+ const withTomlEntry = (content, { key, entry }, name) => {
186
+ const eol = detectEol(content);
187
+ const lines = Object.entries(entry).map(([field, value]) => `${field} = ${tomlValue(value)}`);
188
+ const table = [`[${key}.${name}]`, ...lines].join(eol);
189
+ const separator = content === '' ? '' : content.endsWith(eol) ? eol : `${eol}${eol}`;
190
+ return `${content}${separator}${table}${eol}`;
191
+ };
192
+ const holdsEntry = (content, { format, key }, name) => {
193
+ const parsed = format === 'toml' ? parseToml(content) : parseJson(content);
194
+ return isObject(parsed?.[key]) && name in parsed[key];
195
+ };
196
+ export const addToProjectConfig = async (workingDir, file, name, { path: resolved, content }) => {
197
+ const updated = file.format === 'toml' ? withTomlEntry(content, file, name) : withJsonEntry(content, file, name);
198
+ if (updated === undefined || !holdsEntry(updated, file, name)) {
199
+ return false;
200
+ }
201
+ const target = path.join(workingDir, resolved);
202
+ await fs.mkdir(path.dirname(target), { recursive: true });
203
+ await writeFileAtomic(target, updated, 'utf8');
204
+ return true;
205
+ };
206
+ //# sourceMappingURL=agent-mcp-config.js.map
@@ -0,0 +1,57 @@
1
+ import { type CanonicalAgentName } from '../agent-detection.js';
2
+ import { type ProjectConfigFile } from './agent-mcp-config.js';
3
+ export declare const NETLIFY_MCP_URL = "https://mcp.netlify.com/mcp";
4
+ export declare const NETLIFY_MCP_SERVER_NAME = "netlify";
5
+ export declare const MCP_SCOPES: readonly ['project', 'user'];
6
+ export type McpScope = (typeof MCP_SCOPES)[number];
7
+ type LookupKind = 'list' | 'list-json';
8
+ interface NativeCommands {
9
+ add: string[];
10
+ remove?: string[];
11
+ savedIn?: string;
12
+ }
13
+ interface NativeSetup {
14
+ lookup?: LookupKind;
15
+ scopes: Partial<Record<McpScope, NativeCommands>>;
16
+ }
17
+ export interface McpAgent {
18
+ id: string;
19
+ label: string;
20
+ binary?: string;
21
+ drivenBy?: CanonicalAgentName[];
22
+ projectMarkers?: string[];
23
+ projectFile?: ProjectConfigFile;
24
+ inTerminal?: (env: NodeJS.ProcessEnv) => boolean;
25
+ native?: NativeSetup;
26
+ }
27
+ export declare const MCP_AGENTS: McpAgent[];
28
+ export type AgentMcpStatus = 'added' | 'present' | 'kept' | 'printed' | 'unsupported' | 'declined' | 'failed';
29
+ export type AgentSelection = 'driving' | 'prompt' | 'saved' | 'none';
30
+ export interface AgentMcpSetupSummary {
31
+ scope: McpScope;
32
+ selection: AgentSelection;
33
+ agents: Record<string, AgentMcpStatus>;
34
+ failed?: boolean;
35
+ }
36
+ export interface AgentCandidate {
37
+ agent: McpAgent;
38
+ detected: boolean;
39
+ }
40
+ export type ChooseAgents = (candidates: AgentCandidate[]) => Promise<McpAgent[]>;
41
+ export declare const findCandidates: (workingDir: string, env: NodeJS.ProcessEnv, scope?: McpScope) => Promise<AgentCandidate[]>;
42
+ export interface McpChoiceStore {
43
+ get(key: string): unknown;
44
+ set(key: string, value: unknown): void;
45
+ delete(key: string): void;
46
+ }
47
+ export declare const setupAgentMcp: ({ workingDir, store, scope, env, interactive, choose, reset, }: {
48
+ workingDir: string;
49
+ store: McpChoiceStore;
50
+ scope?: McpScope;
51
+ env?: NodeJS.ProcessEnv;
52
+ interactive?: boolean;
53
+ choose?: ChooseAgents;
54
+ reset?: boolean;
55
+ }) => Promise<AgentMcpSetupSummary>;
56
+ export {};
57
+ //# sourceMappingURL=agent-mcp.d.ts.map