@webiny/mcp 6.3.0 → 6.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/claude.js +23 -34
- package/agents/claude.js.map +1 -1
- package/agents/cline.js +17 -30
- package/agents/cline.js.map +1 -1
- package/agents/copilot.js +49 -63
- package/agents/copilot.js.map +1 -1
- package/agents/cursor.js +23 -34
- package/agents/cursor.js.map +1 -1
- package/agents/discover.js +17 -20
- package/agents/discover.js.map +1 -1
- package/agents/instructions.js +81 -20
- package/agents/instructions.js.map +1 -1
- package/agents/kiro.js +23 -34
- package/agents/kiro.js.map +1 -1
- package/agents/opencode.js +53 -76
- package/agents/opencode.js.map +1 -1
- package/agents/shared.js +62 -113
- package/agents/shared.js.map +1 -1
- package/agents/types.js +0 -3
- package/agents/windsurf.js +23 -34
- package/agents/windsurf.js.map +1 -1
- package/bin.js +0 -2
- package/cli/ConfigureMcp.js +31 -38
- package/cli/ConfigureMcp.js.map +1 -1
- package/cli/McpServer.js +145 -184
- package/cli/McpServer.js.map +1 -1
- package/cli.js +51 -50
- package/cli.js.map +1 -1
- package/index.js +0 -7
- package/package.json +4 -4
- package/skills/generated/api/SKILL.md +6 -1
- package/skills/generated/api/cms/SKILL.md +19 -1
- package/ui.js +20 -28
- package/ui.js.map +1 -1
- package/agents/types.js.map +0 -1
- package/bin.js.map +0 -1
- package/index.js.map +0 -1
package/agents/kiro.js
CHANGED
|
@@ -1,39 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent adapter: Kiro
|
|
3
|
-
*
|
|
4
|
-
* MCP config : .kiro/settings/mcp.json (project-level, checked into git)
|
|
5
|
-
* Hint file : AGENTS.md (Claude Code reads this automatically each session)
|
|
6
|
-
*
|
|
7
|
-
* Docs: https://docs.anthropic.com/en/docs/claude-code/mcp
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
import { join } from "path";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { printDone, webinyHintBlock, writeHintFile, writeMcpConfig } from "./shared.js";
|
|
3
|
+
const preset = {
|
|
4
|
+
slug: "kiro",
|
|
5
|
+
displayName: "Kiro",
|
|
6
|
+
configFile: ".kiro/settings/mcp.json",
|
|
7
|
+
hintFile: "AGENTS.md"
|
|
17
8
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
printDone({
|
|
35
|
-
ui
|
|
36
|
-
});
|
|
9
|
+
async function init({ ui, cwd }) {
|
|
10
|
+
ui.info("Setting up for Kiro...");
|
|
11
|
+
writeMcpConfig({
|
|
12
|
+
ui,
|
|
13
|
+
configPath: join(cwd, ".kiro/settings/mcp.json")
|
|
14
|
+
});
|
|
15
|
+
writeHintFile({
|
|
16
|
+
ui,
|
|
17
|
+
hintPath: join(cwd, "AGENTS.md"),
|
|
18
|
+
content: webinyHintBlock({
|
|
19
|
+
heading: "## Webiny"
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
printDone({
|
|
23
|
+
ui
|
|
24
|
+
});
|
|
37
25
|
}
|
|
26
|
+
export { init, preset };
|
|
38
27
|
|
|
39
28
|
//# sourceMappingURL=kiro.js.map
|
package/agents/kiro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"agents/kiro.js","sources":["../../src/agents/kiro.ts"],"sourcesContent":["/**\n * Agent adapter: Kiro\n *\n * MCP config : .kiro/settings/mcp.json (project-level, checked into git)\n * Hint file : AGENTS.md (Claude Code reads this automatically each session)\n *\n * Docs: https://docs.anthropic.com/en/docs/claude-code/mcp\n */\n\nimport { join } from \"path\";\nimport type { IUi } from \"../ui.js\";\nimport type { AgentPreset } from \"./types.js\";\nimport { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\nexport const preset: AgentPreset = {\n slug: \"kiro\",\n displayName: \"Kiro\",\n configFile: \".kiro/settings/mcp.json\",\n hintFile: \"AGENTS.md\"\n};\n\ninterface InitParams {\n ui: IUi;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Kiro...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".kiro/settings/mcp.json\")\n });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \"AGENTS.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"names":["preset","init","ui","cwd","writeMcpConfig","join","writeHintFile","webinyHintBlock","printDone"],"mappings":";;AAcO,MAAMA,SAAsB;IAC/B,MAAM;IACN,aAAa;IACb,YAAY;IACZ,UAAU;AACd;AAOO,eAAeC,KAAK,EAAEC,EAAE,EAAEC,GAAG,EAAc;IAC9CD,GAAG,IAAI,CAAC;IAERE,eAAe;QACXF;QACA,YAAYG,KAAKF,KAAK;IAC1B;IAEAG,cAAc;QACVJ;QACA,UAAUG,KAAKF,KAAK;QACpB,SAASI,gBAAgB;YAAE,SAAS;QAAY;IACpD;IAEAC,UAAU;QAAEN;IAAG;AACnB"}
|
package/agents/opencode.js
CHANGED
|
@@ -1,83 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent adapter: OpenCode
|
|
3
|
-
*
|
|
4
|
-
* MCP config : opencode.json (project root)
|
|
5
|
-
* Hint file : AGENTS.md (OpenCode reads this automatically each session)
|
|
6
|
-
*
|
|
7
|
-
* OpenCode uses a different MCP config shape than other agents:
|
|
8
|
-
* {
|
|
9
|
-
* "mcp": {
|
|
10
|
-
* "webiny": { "type": "local", "command": ["npx", "webiny", "mcp-server"], "enabled": true }
|
|
11
|
-
* }
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* Docs: https://opencode.ai/docs/mcp-servers/
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
18
2
|
import { join } from "path";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
import { printDone, webinyHintBlock, writeHintFile } from "./shared.js";
|
|
4
|
+
const preset = {
|
|
5
|
+
slug: "opencode",
|
|
6
|
+
displayName: "OpenCode",
|
|
7
|
+
configFile: "opencode.json",
|
|
8
|
+
configNote: "uses 'mcp' not 'mcpServers'",
|
|
9
|
+
hintFile: "AGENTS.md"
|
|
26
10
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
printDone({
|
|
44
|
-
ui
|
|
45
|
-
});
|
|
11
|
+
async function init({ ui, cwd }) {
|
|
12
|
+
ui.info("Setting up for OpenCode...");
|
|
13
|
+
writeOpenCodeMcpConfig({
|
|
14
|
+
ui,
|
|
15
|
+
configPath: join(cwd, "opencode.json")
|
|
16
|
+
});
|
|
17
|
+
writeHintFile({
|
|
18
|
+
ui,
|
|
19
|
+
hintPath: join(cwd, "AGENTS.md"),
|
|
20
|
+
content: webinyHintBlock({
|
|
21
|
+
heading: "## Webiny"
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
printDone({
|
|
25
|
+
ui
|
|
26
|
+
});
|
|
46
27
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
28
|
+
function writeOpenCodeMcpConfig({ ui, configPath }) {
|
|
29
|
+
const entry = {
|
|
30
|
+
type: "local",
|
|
31
|
+
command: [
|
|
32
|
+
"npx",
|
|
33
|
+
"webiny-mcp",
|
|
34
|
+
"serve",
|
|
35
|
+
"--additional-skills=./my-skills"
|
|
36
|
+
],
|
|
37
|
+
enabled: true
|
|
38
|
+
};
|
|
39
|
+
let config = {
|
|
40
|
+
$schema: "https://opencode.ai/config.json",
|
|
41
|
+
mcp: {}
|
|
42
|
+
};
|
|
43
|
+
if (existsSync(configPath)) try {
|
|
44
|
+
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
45
|
+
config.mcp ??= {};
|
|
46
|
+
} catch {
|
|
47
|
+
ui.warning("Could not parse %s — will overwrite.", configPath);
|
|
48
|
+
}
|
|
49
|
+
if (config.mcp.webiny) {
|
|
50
|
+
ui.info("%s already has a %s entry — skipping.", configPath, "webiny");
|
|
51
|
+
return false;
|
|
71
52
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
ui.
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
config.mcp.webiny = entry;
|
|
78
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
79
|
-
ui.success(`Registered Webiny MCP server in %s`, configPath);
|
|
80
|
-
return true;
|
|
53
|
+
config.mcp.webiny = entry;
|
|
54
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
55
|
+
ui.success("Registered Webiny MCP server in %s", configPath);
|
|
56
|
+
return true;
|
|
81
57
|
}
|
|
58
|
+
export { init, preset };
|
|
82
59
|
|
|
83
60
|
//# sourceMappingURL=opencode.js.map
|
package/agents/opencode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"agents/opencode.js","sources":["../../src/agents/opencode.ts"],"sourcesContent":["/**\n * Agent adapter: OpenCode\n *\n * MCP config : opencode.json (project root)\n * Hint file : AGENTS.md (OpenCode reads this automatically each session)\n *\n * OpenCode uses a different MCP config shape than other agents:\n * {\n * \"mcp\": {\n * \"webiny\": { \"type\": \"local\", \"command\": [\"npx\", \"webiny\", \"mcp-server\"], \"enabled\": true }\n * }\n * }\n *\n * Docs: https://opencode.ai/docs/mcp-servers/\n */\n\nimport { readFileSync, writeFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport type { IUi } from \"../ui.js\";\nimport type { AgentPreset } from \"./types.js\";\nimport { writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\nexport const preset: AgentPreset = {\n slug: \"opencode\",\n displayName: \"OpenCode\",\n configFile: \"opencode.json\",\n configNote: \"uses 'mcp' not 'mcpServers'\",\n hintFile: \"AGENTS.md\"\n};\n\ninterface InitParams {\n ui: IUi;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for OpenCode...\");\n\n writeOpenCodeMcpConfig({ ui, configPath: join(cwd, \"opencode.json\") });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \"AGENTS.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n\n// ---------------------------------------------------------------------------\n// OpenCode-specific MCP config writer\n// ---------------------------------------------------------------------------\n\ninterface WriteOpenCodeMcpConfigParams {\n ui: IUi;\n configPath: string;\n}\n\nfunction writeOpenCodeMcpConfig({ ui, configPath }: WriteOpenCodeMcpConfigParams): boolean {\n const entry = {\n type: \"local\",\n command: [\"npx\", \"webiny-mcp\", \"serve\", \"--additional-skills=./my-skills\"],\n enabled: true\n };\n\n let config: { $schema?: string; mcp: Record<string, unknown> } = {\n $schema: \"https://opencode.ai/config.json\",\n mcp: {}\n };\n\n if (existsSync(configPath)) {\n try {\n config = JSON.parse(readFileSync(configPath, \"utf8\"));\n config.mcp ??= {};\n } catch {\n ui.warning(`Could not parse %s — will overwrite.`, configPath);\n }\n }\n\n if (config.mcp.webiny) {\n ui.info(`%s already has a %s entry — skipping.`, configPath, \"webiny\");\n return false;\n }\n\n config.mcp.webiny = entry;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n ui.success(`Registered Webiny MCP server in %s`, configPath);\n return true;\n}\n"],"names":["preset","init","ui","cwd","writeOpenCodeMcpConfig","join","writeHintFile","webinyHintBlock","printDone","configPath","entry","config","existsSync","JSON","readFileSync","writeFileSync"],"mappings":";;;AAsBO,MAAMA,SAAsB;IAC/B,MAAM;IACN,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,UAAU;AACd;AAOO,eAAeC,KAAK,EAAEC,EAAE,EAAEC,GAAG,EAAc;IAC9CD,GAAG,IAAI,CAAC;IAERE,uBAAuB;QAAEF;QAAI,YAAYG,KAAKF,KAAK;IAAiB;IAEpEG,cAAc;QACVJ;QACA,UAAUG,KAAKF,KAAK;QACpB,SAASI,gBAAgB;YAAE,SAAS;QAAY;IACpD;IAEAC,UAAU;QAAEN;IAAG;AACnB;AAWA,SAASE,uBAAuB,EAAEF,EAAE,EAAEO,UAAU,EAAgC;IAC5E,MAAMC,QAAQ;QACV,MAAM;QACN,SAAS;YAAC;YAAO;YAAc;YAAS;SAAkC;QAC1E,SAAS;IACb;IAEA,IAAIC,SAA6D;QAC7D,SAAS;QACT,KAAK,CAAC;IACV;IAEA,IAAIC,WAAWH,aACX,IAAI;QACAE,SAASE,KAAK,KAAK,CAACC,aAAaL,YAAY;QAC7CE,OAAO,GAAG,KAAK,CAAC;IACpB,EAAE,OAAM;QACJT,GAAG,OAAO,CAAC,wCAAwCO;IACvD;IAGJ,IAAIE,OAAO,GAAG,CAAC,MAAM,EAAE;QACnBT,GAAG,IAAI,CAAC,yCAAyCO,YAAY;QAC7D,OAAO;IACX;IAEAE,OAAO,GAAG,CAAC,MAAM,GAAGD;IACpBK,cAAcN,YAAYI,KAAK,SAAS,CAACF,QAAQ,MAAM,KAAK;IAC5DT,GAAG,OAAO,CAAC,sCAAsCO;IACjD,OAAO;AACX"}
|
package/agents/shared.js
CHANGED
|
@@ -1,124 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
* Shared helpers for agent adapters.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
6
2
|
import { dirname } from "path";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}) {
|
|
26
|
-
ensureDir(configPath);
|
|
27
|
-
const entry = {
|
|
28
|
-
command: "npx",
|
|
29
|
-
args: ["webiny-mcp", "serve", "--additional-skills=./my-skills"]
|
|
30
|
-
};
|
|
31
|
-
let config = {
|
|
32
|
-
mcpServers: {}
|
|
33
|
-
};
|
|
34
|
-
if (existsSync(configPath)) {
|
|
35
|
-
try {
|
|
36
|
-
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
37
|
-
config.mcpServers ??= {};
|
|
38
|
-
} catch {
|
|
39
|
-
ui.warning(`Could not parse %s — will overwrite.`, configPath);
|
|
3
|
+
function writeMcpConfig({ ui, configPath }) {
|
|
4
|
+
ensureDir(configPath);
|
|
5
|
+
const entry = {
|
|
6
|
+
command: "npx",
|
|
7
|
+
args: [
|
|
8
|
+
"webiny-mcp",
|
|
9
|
+
"serve",
|
|
10
|
+
"--additional-skills=./my-skills"
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
let config = {
|
|
14
|
+
mcpServers: {}
|
|
15
|
+
};
|
|
16
|
+
if (existsSync(configPath)) try {
|
|
17
|
+
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
18
|
+
config.mcpServers ??= {};
|
|
19
|
+
} catch {
|
|
20
|
+
ui.warning("Could not parse %s — will overwrite.", configPath);
|
|
40
21
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
config.mcpServers.webiny = entry;
|
|
47
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
48
|
-
ui.success(`Registered Webiny MCP server in %s`, configPath);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
// Hint file helpers
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Append Webiny instructions to a markdown hint file (CLAUDE.md,
|
|
58
|
-
* copilot-instructions.md, etc.) if not already present.
|
|
59
|
-
*/
|
|
60
|
-
export function writeHintFile({
|
|
61
|
-
ui,
|
|
62
|
-
hintPath,
|
|
63
|
-
content,
|
|
64
|
-
marker = "list_webiny_skills"
|
|
65
|
-
}) {
|
|
66
|
-
ensureDir(hintPath);
|
|
67
|
-
if (existsSync(hintPath)) {
|
|
68
|
-
const existing = readFileSync(hintPath, "utf8");
|
|
69
|
-
if (existing.includes(marker)) {
|
|
70
|
-
ui.info(`%s already contains Webiny instructions — skipping.`, hintPath);
|
|
71
|
-
return false;
|
|
22
|
+
if (config.mcpServers.webiny) {
|
|
23
|
+
ui.info("%s already has a %s entry — skipping.", configPath, "webiny");
|
|
24
|
+
return false;
|
|
72
25
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
ui.success(`Wrote Webiny instructions to ${hintPath}`);
|
|
78
|
-
return true;
|
|
26
|
+
config.mcpServers.webiny = entry;
|
|
27
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
28
|
+
ui.success("Registered Webiny MCP server in %s", configPath);
|
|
29
|
+
return true;
|
|
79
30
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
31
|
+
function writeHintFile({ ui, hintPath, content, marker = "list_webiny_skills" }) {
|
|
32
|
+
ensureDir(hintPath);
|
|
33
|
+
if (existsSync(hintPath)) {
|
|
34
|
+
const existing = readFileSync(hintPath, "utf8");
|
|
35
|
+
if (existing.includes(marker)) {
|
|
36
|
+
ui.info("%s already contains Webiny instructions — skipping.", hintPath);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
writeFileSync(hintPath, existing.trimEnd() + "\n\n" + content.trim() + "\n");
|
|
40
|
+
} else writeFileSync(hintPath, content.trim() + "\n");
|
|
41
|
+
ui.success(`Wrote Webiny instructions to ${hintPath}`);
|
|
42
|
+
return true;
|
|
90
43
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
44
|
+
function webinyHintBlock({ heading = "## Webiny", prefix = "" } = {}) {
|
|
45
|
+
return [
|
|
46
|
+
heading,
|
|
47
|
+
"",
|
|
48
|
+
`${prefix}This project uses the Webiny framework.`,
|
|
49
|
+
`${prefix}A \`webiny\` MCP server is available.`,
|
|
50
|
+
`${prefix}When helping with Webiny-related tasks:`,
|
|
51
|
+
`${prefix}1. Call \`list_webiny_skills\` to see available skills.`,
|
|
52
|
+
`${prefix}2. Call \`get_webiny_skill\` with the relevant topic before writing code.`,
|
|
53
|
+
""
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
function printDone({ ui, extra }) {
|
|
57
|
+
ui.emptyLine();
|
|
58
|
+
if (extra) ui.warning(extra);
|
|
59
|
+
ui.info("Restart your agent/editor session if it is already running.");
|
|
60
|
+
ui.emptyLine();
|
|
61
|
+
ui.info("To test the MCP server directly:");
|
|
62
|
+
ui.info(" %s", "npx @modelcontextprotocol/inspector npx webiny-mcp serve");
|
|
63
|
+
ui.emptyLine();
|
|
109
64
|
}
|
|
110
|
-
|
|
111
|
-
// ---------------------------------------------------------------------------
|
|
112
|
-
// Internal
|
|
113
|
-
// ---------------------------------------------------------------------------
|
|
114
|
-
|
|
115
65
|
function ensureDir(filePath) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
recursive: true
|
|
66
|
+
const dir = dirname(filePath);
|
|
67
|
+
if (!existsSync(dir)) mkdirSync(dir, {
|
|
68
|
+
recursive: true
|
|
120
69
|
});
|
|
121
|
-
}
|
|
122
70
|
}
|
|
71
|
+
export { printDone, webinyHintBlock, writeHintFile, writeMcpConfig };
|
|
123
72
|
|
|
124
73
|
//# sourceMappingURL=shared.js.map
|
package/agents/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"agents/shared.js","sources":["../../src/agents/shared.ts"],"sourcesContent":["/**\n * Shared helpers for agent adapters.\n */\n\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport { dirname } from \"path\";\nimport type { IUi } from \"../ui.js\";\n\n// ---------------------------------------------------------------------------\n// MCP config helpers\n// ---------------------------------------------------------------------------\n\ninterface WriteMcpConfigParams {\n ui: IUi;\n configPath: string;\n}\n\n/**\n * Write (or patch) an MCP server registration into a JSON config file.\n *\n * All agents use the same JSON shape — only the file path differs:\n * {\n * \"mcpServers\": {\n * \"webiny\": { \"command\": \"npx\", \"args\": [\"webiny-mcp\", \"serve\"] }\n * }\n * }\n */\nexport function writeMcpConfig({ ui, configPath }: WriteMcpConfigParams): boolean {\n ensureDir(configPath);\n\n const entry = {\n command: \"npx\",\n args: [\"webiny-mcp\", \"serve\", \"--additional-skills=./my-skills\"]\n };\n let config: { mcpServers: Record<string, unknown> } = { mcpServers: {} };\n\n if (existsSync(configPath)) {\n try {\n config = JSON.parse(readFileSync(configPath, \"utf8\"));\n config.mcpServers ??= {};\n } catch {\n ui.warning(`Could not parse %s — will overwrite.`, configPath);\n }\n }\n\n if (config.mcpServers.webiny) {\n ui.info(`%s already has a %s entry — skipping.`, configPath, \"webiny\");\n return false;\n }\n\n config.mcpServers.webiny = entry;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n ui.success(`Registered Webiny MCP server in %s`, configPath);\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Hint file helpers\n// ---------------------------------------------------------------------------\n\ninterface WriteHintFileParams {\n ui: IUi;\n hintPath: string;\n content: string;\n marker?: string;\n}\n\n/**\n * Append Webiny instructions to a markdown hint file (CLAUDE.md,\n * copilot-instructions.md, etc.) if not already present.\n */\nexport function writeHintFile({\n ui,\n hintPath,\n content,\n marker = \"list_webiny_skills\"\n}: WriteHintFileParams): boolean {\n ensureDir(hintPath);\n\n if (existsSync(hintPath)) {\n const existing = readFileSync(hintPath, \"utf8\");\n if (existing.includes(marker)) {\n ui.info(`%s already contains Webiny instructions — skipping.`, hintPath);\n return false;\n }\n writeFileSync(hintPath, existing.trimEnd() + \"\\n\\n\" + content.trim() + \"\\n\");\n } else {\n writeFileSync(hintPath, content.trim() + \"\\n\");\n }\n\n ui.success(`Wrote Webiny instructions to ${hintPath}`);\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Common hint block (same concept across all agents, slightly different wrapping)\n// ---------------------------------------------------------------------------\n\ninterface WebinyHintBlockParams {\n heading?: string;\n prefix?: string;\n}\n\nexport function webinyHintBlock({\n heading = \"## Webiny\",\n prefix = \"\"\n}: WebinyHintBlockParams = {}): string {\n return [\n heading,\n \"\",\n `${prefix}This project uses the Webiny framework.`,\n `${prefix}A \\`webiny\\` MCP server is available.`,\n `${prefix}When helping with Webiny-related tasks:`,\n `${prefix}1. Call \\`list_webiny_skills\\` to see available skills.`,\n `${prefix}2. Call \\`get_webiny_skill\\` with the relevant topic before writing code.`,\n \"\"\n ].join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Done message\n// ---------------------------------------------------------------------------\n\ninterface PrintDoneParams {\n ui: IUi;\n extra?: string;\n}\n\nexport function printDone({ ui, extra }: PrintDoneParams): void {\n ui.emptyLine();\n if (extra) {\n ui.warning(extra);\n }\n ui.info(\"Restart your agent/editor session if it is already running.\");\n ui.emptyLine();\n ui.info(\"To test the MCP server directly:\");\n ui.info(\" %s\", \"npx @modelcontextprotocol/inspector npx webiny-mcp serve\");\n ui.emptyLine();\n}\n\n// ---------------------------------------------------------------------------\n// Internal\n// ---------------------------------------------------------------------------\n\nfunction ensureDir(filePath: string): void {\n const dir = dirname(filePath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n"],"names":["writeMcpConfig","ui","configPath","ensureDir","entry","config","existsSync","JSON","readFileSync","writeFileSync","writeHintFile","hintPath","content","marker","existing","webinyHintBlock","heading","prefix","printDone","extra","filePath","dir","dirname","mkdirSync"],"mappings":";;AA2BO,SAASA,eAAe,EAAEC,EAAE,EAAEC,UAAU,EAAwB;IACnEC,UAAUD;IAEV,MAAME,QAAQ;QACV,SAAS;QACT,MAAM;YAAC;YAAc;YAAS;SAAkC;IACpE;IACA,IAAIC,SAAkD;QAAE,YAAY,CAAC;IAAE;IAEvE,IAAIC,WAAWJ,aACX,IAAI;QACAG,SAASE,KAAK,KAAK,CAACC,aAAaN,YAAY;QAC7CG,OAAO,UAAU,KAAK,CAAC;IAC3B,EAAE,OAAM;QACJJ,GAAG,OAAO,CAAC,wCAAwCC;IACvD;IAGJ,IAAIG,OAAO,UAAU,CAAC,MAAM,EAAE;QAC1BJ,GAAG,IAAI,CAAC,yCAAyCC,YAAY;QAC7D,OAAO;IACX;IAEAG,OAAO,UAAU,CAAC,MAAM,GAAGD;IAC3BK,cAAcP,YAAYK,KAAK,SAAS,CAACF,QAAQ,MAAM,KAAK;IAC5DJ,GAAG,OAAO,CAAC,sCAAsCC;IACjD,OAAO;AACX;AAiBO,SAASQ,cAAc,EAC1BT,EAAE,EACFU,QAAQ,EACRC,OAAO,EACPC,SAAS,oBAAoB,EACX;IAClBV,UAAUQ;IAEV,IAAIL,WAAWK,WAAW;QACtB,MAAMG,WAAWN,aAAaG,UAAU;QACxC,IAAIG,SAAS,QAAQ,CAACD,SAAS;YAC3BZ,GAAG,IAAI,CAAC,uDAAuDU;YAC/D,OAAO;QACX;QACAF,cAAcE,UAAUG,SAAS,OAAO,KAAK,SAASF,QAAQ,IAAI,KAAK;IAC3E,OACIH,cAAcE,UAAUC,QAAQ,IAAI,KAAK;IAG7CX,GAAG,OAAO,CAAC,CAAC,6BAA6B,EAAEU,UAAU;IACrD,OAAO;AACX;AAWO,SAASI,gBAAgB,EAC5BC,UAAU,WAAW,EACrBC,SAAS,EAAE,EACS,GAAG,CAAC,CAAC;IACzB,OAAO;QACHD;QACA;QACA,GAAGC,OAAO,uCAAuC,CAAC;QAClD,GAAGA,OAAO,qCAAqC,CAAC;QAChD,GAAGA,OAAO,uCAAuC,CAAC;QAClD,GAAGA,OAAO,uDAAuD,CAAC;QAClE,GAAGA,OAAO,yEAAyE,CAAC;QACpF;KACH,CAAC,IAAI,CAAC;AACX;AAWO,SAASC,UAAU,EAAEjB,EAAE,EAAEkB,KAAK,EAAmB;IACpDlB,GAAG,SAAS;IACZ,IAAIkB,OACAlB,GAAG,OAAO,CAACkB;IAEflB,GAAG,IAAI,CAAC;IACRA,GAAG,SAAS;IACZA,GAAG,IAAI,CAAC;IACRA,GAAG,IAAI,CAAC,QAAQ;IAChBA,GAAG,SAAS;AAChB;AAMA,SAASE,UAAUiB,QAAgB;IAC/B,MAAMC,MAAMC,QAAQF;IACpB,IAAI,CAACd,WAAWe,MACZE,UAAUF,KAAK;QAAE,WAAW;IAAK;AAEzC"}
|
package/agents/types.js
CHANGED
package/agents/windsurf.js
CHANGED
|
@@ -1,39 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent adapter: Windsurf (Codeium)
|
|
3
|
-
*
|
|
4
|
-
* MCP config : .windsurf/mcp.json (project-level)
|
|
5
|
-
* Hint file : .windsurf/rules/webiny.md
|
|
6
|
-
*
|
|
7
|
-
* Docs: https://docs.codeium.com/windsurf/mcp
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
import { join } from "path";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { printDone, webinyHintBlock, writeHintFile, writeMcpConfig } from "./shared.js";
|
|
3
|
+
const preset = {
|
|
4
|
+
slug: "windsurf",
|
|
5
|
+
displayName: "Windsurf",
|
|
6
|
+
configFile: ".windsurf/mcp.json",
|
|
7
|
+
hintFile: ".windsurf/rules/*.md"
|
|
17
8
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
printDone({
|
|
35
|
-
ui
|
|
36
|
-
});
|
|
9
|
+
async function init({ ui, cwd }) {
|
|
10
|
+
ui.info("Setting up for Windsurf...");
|
|
11
|
+
writeMcpConfig({
|
|
12
|
+
ui,
|
|
13
|
+
configPath: join(cwd, ".windsurf", "mcp.json")
|
|
14
|
+
});
|
|
15
|
+
writeHintFile({
|
|
16
|
+
ui,
|
|
17
|
+
hintPath: join(cwd, ".windsurf", "rules", "webiny.md"),
|
|
18
|
+
content: webinyHintBlock({
|
|
19
|
+
heading: "## Webiny"
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
printDone({
|
|
23
|
+
ui
|
|
24
|
+
});
|
|
37
25
|
}
|
|
26
|
+
export { init, preset };
|
|
38
27
|
|
|
39
28
|
//# sourceMappingURL=windsurf.js.map
|
package/agents/windsurf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"agents/windsurf.js","sources":["../../src/agents/windsurf.ts"],"sourcesContent":["/**\n * Agent adapter: Windsurf (Codeium)\n *\n * MCP config : .windsurf/mcp.json (project-level)\n * Hint file : .windsurf/rules/webiny.md\n *\n * Docs: https://docs.codeium.com/windsurf/mcp\n */\n\nimport { join } from \"path\";\nimport type { IUi } from \"../ui.js\";\nimport type { AgentPreset } from \"./types.js\";\nimport { writeMcpConfig, writeHintFile, webinyHintBlock, printDone } from \"./shared.js\";\n\nexport const preset: AgentPreset = {\n slug: \"windsurf\",\n displayName: \"Windsurf\",\n configFile: \".windsurf/mcp.json\",\n hintFile: \".windsurf/rules/*.md\"\n};\n\ninterface InitParams {\n ui: IUi;\n cwd: string;\n}\n\nexport async function init({ ui, cwd }: InitParams): Promise<void> {\n ui.info(\"Setting up for Windsurf...\");\n\n writeMcpConfig({\n ui,\n configPath: join(cwd, \".windsurf\", \"mcp.json\")\n });\n\n writeHintFile({\n ui,\n hintPath: join(cwd, \".windsurf\", \"rules\", \"webiny.md\"),\n content: webinyHintBlock({ heading: \"## Webiny\" })\n });\n\n printDone({ ui });\n}\n"],"names":["preset","init","ui","cwd","writeMcpConfig","join","writeHintFile","webinyHintBlock","printDone"],"mappings":";;AAcO,MAAMA,SAAsB;IAC/B,MAAM;IACN,aAAa;IACb,YAAY;IACZ,UAAU;AACd;AAOO,eAAeC,KAAK,EAAEC,EAAE,EAAEC,GAAG,EAAc;IAC9CD,GAAG,IAAI,CAAC;IAERE,eAAe;QACXF;QACA,YAAYG,KAAKF,KAAK,aAAa;IACvC;IAEAG,cAAc;QACVJ;QACA,UAAUG,KAAKF,KAAK,aAAa,SAAS;QAC1C,SAASI,gBAAgB;YAAE,SAAS;QAAY;IACpD;IAEAC,UAAU;QAAEN;IAAG;AACnB"}
|
package/bin.js
CHANGED