Compare commits

...

10 Commits

Author SHA1 Message Date
paoloricciuti
b56aeefec4 fix: lint 2025-10-17 17:29:31 +02:00
Paolo Ricciuti
e639e3ad5c chore: apply suggestions from code review
Co-authored-by: Willow (GHOST) <ghostdevbusiness@gmail.com>
2025-10-16 16:34:25 +02:00
Adam Tegen
d0bed3e8f0 Add GitHub Coding Agent setup instructions
Added instructions for configuring GitHub Coding Agent.
2025-10-14 18:30:27 -05:00
Paolo Ricciuti
4c98732f5f Merge pull request #69 from sveltejs/renovate/actions-setup-node-6.x 2025-10-14 10:05:27 +02:00
renovate[bot]
1f88817cf0 chore(deps): update actions/setup-node action to v6 2025-10-14 05:50:23 +00:00
paoloricciuti
87af64f4bc fix: prevent imported_runes suggestion from being added for libs that are not svelte 2025-10-13 23:54:01 +02:00
Paolo Ricciuti
c1678b2f36 Merge pull request #64 from sveltejs/changeset-release/main
Version Packages
2025-10-11 00:23:42 +02:00
github-actions[bot]
a8af3c72ca Version Packages 2025-10-10 22:22:02 +00:00
Paolo Ricciuti
534a72cae7 Merge pull request #66 from sveltejs/read-state-with-dollar
feat: `read_state_with_dollar` autofixer
2025-10-11 00:21:36 +02:00
paoloricciuti
3b301d7d9c fix: widen desired_svelte_version validation to accommodate some clients 2025-10-10 23:27:49 +02:00
15 changed files with 85 additions and 23 deletions

View File

@@ -0,0 +1,5 @@
---
'@sveltejs/mcp': patch
---
fix: prevent `imported_runes` suggestion from being added for libs that are not svelte

View File

@@ -1,5 +0,0 @@
---
'@sveltejs/mcp': patch
---
fix: minor tweaks to the prompt to allow for automatic sync

View File

@@ -1,5 +0,0 @@
---
'@sveltejs/mcp': patch
---
feat: `read_state_with_dollar` autofixer

View File

@@ -21,7 +21,7 @@ jobs:
version: 10.18.2
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'pnpm'

View File

@@ -21,7 +21,7 @@ jobs:
version: 10.18.2
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'pnpm'

View File

@@ -29,7 +29,7 @@ jobs:
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: actions/setup-node@v5
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
package-manager-cache: false # pnpm is not installed yet
@@ -39,7 +39,7 @@ jobs:
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- uses: actions/setup-node@v5
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
package-manager-cache: true # caches pnpm via packageManager field in package.json

View File

@@ -21,7 +21,7 @@ jobs:
version: 10.18.2
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'pnpm'

View File

@@ -24,7 +24,7 @@ jobs:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
@@ -37,7 +37,7 @@ jobs:
npm i -g pnpm@$PNPM_VER
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@v5
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json

View File

@@ -96,6 +96,27 @@ It will open a file with your MCP servers where you can add the following config
}
```
## GitHub Coding Agent
- Open your repository in GitHub
- Go to Settings
- Open Copilot > Coding agent
- Edit the MCP configuration
```json
{
"mcpServers" {
"svelte": {
"type": "http",
"url": "https://mcp.svelte.dev/mcp",
"tools": ["*"]
}
}
}
```
- Click _Save MCP configuration_
## Other clients
If we didn't include the MCP client you are using, refer to their documentation for `remote` servers and use `https://mcp.svelte.dev/mcp` as the URL.

View File

@@ -412,6 +412,19 @@ describe('add_autofixers_issues', () => {
});
},
);
describe.each(dollarless_runes)('importing $rune from external lib', ({ rune }) => {
it(`should not add suggestions when importing from packages that are not svelte`, () => {
const content = run_autofixers_on_code(`
<script>
import { ${rune} } from 'svelte-something-something';
</script>`);
expect(content.suggestions).not.toContain(
`You are importing "${rune}" from "svelte-something-something". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
);
});
});
});
describe('derived_with_function', () => {

View File

@@ -6,7 +6,7 @@ const dollarless_runes = base_runes.map((r) => r.replace('$', ''));
export const imported_runes: Autofixer = {
ImportDeclaration(node, { state, next }) {
const source = (node.source.value || node.source.raw?.slice(1, -1))?.toString();
if (source && source.startsWith('svelte')) {
if (source && (source === 'svelte' || source.startsWith('svelte/'))) {
for (const specifier of node.specifiers) {
const id =
specifier.type === 'ImportDefaultSpecifier'

View File

@@ -15,7 +15,7 @@ export function svelte_autofixer(server: SvelteMcp) {
schema: v.object({
code: v.string(),
desired_svelte_version: v.pipe(
v.union([v.literal(4), v.literal(5), v.literal('4'), v.literal('5')]),
v.union([v.string(), v.number()]),
v.description(
'The desired svelte version...if possible read this from the package.json of the user project, otherwise use some hint from the wording (if the user asks for runes it wants version 5). Default to 5 in case of doubt.',
),
@@ -39,7 +39,30 @@ export function svelte_autofixer(server: SvelteMcp) {
openWorldHint: false,
},
},
async ({ code, filename: filename_or_path, desired_svelte_version }) => {
async ({
code,
filename: filename_or_path,
desired_svelte_version: desired_svelte_version_unchecked,
}) => {
// we validate manually because some clients don't support union in the input schema (looking at you cursor)
const parsed_version = v.safeParse(
v.union([v.literal(4), v.literal(5), v.literal('4'), v.literal('5')]),
desired_svelte_version_unchecked,
);
if (parsed_version.success === false) {
return {
isError: true,
content: [
{
type: 'text',
text: `The desired_svelte_version MUST be either 4 or 5 but received "${desired_svelte_version_unchecked}"`,
},
],
};
}
const desired_svelte_version = parsed_version.output;
const content: {
issues: string[];
suggestions: string[];

View File

@@ -1,5 +1,15 @@
# @sveltejs/mcp
## 0.1.5
### Patch Changes
- fix: widen `desired_svelte_version` validation to accommodate some clients ([`3b301d7`](https://github.com/sveltejs/mcp/commit/3b301d7d9c2f49758023408f505bc4ca79caaff4))
- fix: minor tweaks to the prompt to allow for automatic sync ([#63](https://github.com/sveltejs/mcp/pull/63))
- feat: `read_state_with_dollar` autofixer ([#66](https://github.com/sveltejs/mcp/pull/66))
## 0.1.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@sveltejs/mcp",
"version": "0.1.4",
"version": "0.1.5",
"type": "module",
"license": "MIT",
"mcpName": "dev.svelte/mcp",

View File

@@ -8,13 +8,13 @@
"subfolder": "packages/mcp-stdio",
"source": "github"
},
"version": "0.1.4",
"version": "0.1.5",
"websiteUrl": "https://svelte.dev/docs/mcp/overview",
"packages": [
{
"registryType": "npm",
"identifier": "@sveltejs/mcp",
"version": "0.1.4",
"version": "0.1.5",
"runtimeHint": "npx",
"transport": {
"type": "stdio"