Compare commits

...

460 Commits

Author SHA1 Message Date
github-actions[bot]
04c52f2b72 Version Packages (#197)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-13 20:51:10 +02:00
Paolo Ricciuti
0ea2a617ef docs: overhaul docs focus on all ai tools (#188)
Co-authored-by: jyc.dev <jycouet@gmail.com>
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
2026-05-13 20:50:40 +02:00
Paolo Ricciuti
484453e5f8 feat: allow stdio mcp to read the content of the file directly (#198) 2026-05-13 20:26:18 +02:00
Paolo Ricciuti
841af5b3a4 fix: handle non call expressions passed to is_rune (#201)
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 17:12:58 +02:00
Paolo Ricciuti
1ce957ac72 chore: add LICENSE 2026-04-28 14:48:50 +02:00
Paolo Ricciuti
e429cd7839 chore: remove db requirement (#196) 2026-04-20 12:50:45 +02:00
github-actions[bot]
2ded13539a Version Packages (#192)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-10 18:39:19 +02:00
paoloricciuti
96c50acae2 fix: add server export to opencode plugin 2026-04-10 18:37:49 +02:00
github-actions[bot]
4920088e5c Version Packages (#191)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-10 16:57:38 +02:00
Paolo Ricciuti
8557f0af6f fix: import ts files directly (#190) 2026-04-10 16:56:23 +02:00
renovate[bot]
972d0f0bb2 chore(deps): update dependency @vercel/analytics to v2 (#177)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-27 10:15:32 +01:00
renovate[bot]
7bf364a9d5 chore(deps): update pnpm/action-setup action to v5 (#186)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-27 10:14:49 +01:00
Paolo Ricciuti
d06d758b81 chore: sync agents with the opencode plugin too (#187) 2026-03-25 09:43:52 +01:00
github-actions[bot]
e5ce7437c4 Version Packages (#179)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-13 23:07:32 +01:00
Paolo Ricciuti
2f422ee190 fix: broaden checks for imported runes because LLMs are unhinged (#185) 2026-03-13 22:59:52 +01:00
paoloricciuti
14f087cd7a chore: simplify sync script/action 2026-03-13 22:22:19 +01:00
Chris Tsongas
1ef5ddf605 fix: update svelte-file-editor agent to use proper name (#183)
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
2026-03-13 10:37:43 +01:00
github-actions[bot]
0e55ee792d chore: sync skills from svelte.dev (#178)
Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2026-03-12 18:32:21 +01:00
paoloricciuti
84ec24b6f6 fix: don't format code blocks in references 2026-03-12 18:19:43 +01:00
paoloricciuti
710cebe539 docs: opencode config link 2026-03-12 17:59:32 +01:00
paoloricciuti
b2a380c4ce docs: fix markdown blocks 2026-03-12 17:57:45 +01:00
paoloricciuti
eef0a9b4d9 docs: update opencode docs 2026-03-11 21:31:43 +01:00
Paolo Ricciuti
260b36e8af chore: undo rename for publish to registry check 2026-03-11 14:11:15 +01:00
github-actions[bot]
6df3ebe568 Version Packages (#173)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-11 13:08:21 +01:00
Momcilo Miladinovic
27a2fc5653 fix: merge user-configured svelte-file-editor agent settings (#176)
Co-authored-by: Momochiro <x@Mac.sweet.opnsense>
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2026-03-11 12:59:01 +01:00
Paolo Ricciuti
5cd99d8234 feat: allow enabling a specific skill in opencode plugin (#174) 2026-03-10 17:38:04 +01:00
Paolo Ricciuti
e9f19199cb feat: add sync skill docs (#172) 2026-03-09 17:49:18 +01:00
Willow (GHOST)
480b46df0a feat(opencode): mcp enabled option is passed to opencode (#171)
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2026-03-07 12:38:45 +01:00
jyc.dev
5f5fb27977 feat: display similar result & error at the end (#161) 2026-03-07 12:20:18 +01:00
Paolo Ricciuti
29cfa77c39 chore: restructure repo to have single source of truth for tools (#170) 2026-03-03 21:43:34 +01:00
github-actions[bot]
249923b1e5 Version Packages (#169)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 22:24:34 +01:00
Paolo Ricciuti
8c67cae90f feat: svelte-core-bestpractices skill (#162) 2026-02-27 22:19:11 +01:00
Paolo Ricciuti
4aad2e0cfe fix: rename repos in file (#168) 2026-02-27 20:01:15 +01:00
github-actions[bot]
02935b00a6 Version Packages (#164)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-22 15:05:33 +01:00
Paolo Ricciuti
1ea98adacd feat: cursor plugin (#166) 2026-02-22 15:02:31 +01:00
Paolo Ricciuti
494409cc42 fix: better subagent instructions to use MCP or skill (#163) 2026-02-11 22:57:09 +01:00
Paolo Ricciuti
46d8f6cce8 fix: only run "Publish to MCP registry" when MCP is published (#160) 2026-02-07 22:50:08 +01:00
github-actions[bot]
8dc63dca08 chore: sync skills and update documentation (#158)
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2026-02-06 18:41:18 +01:00
paoloricciuti
19fedcd35f docs: add instructions to default schema` 2026-02-06 18:40:55 +01:00
István Pató
b4eb5cc960 Update description for svelte-code-writer skill (#149) 2026-02-06 18:37:40 +01:00
paoloricciuti
6676fd8116 docs: add local opencode configuration 2026-02-06 18:37:03 +01:00
github-actions[bot]
a755a33a5f Version Packages (#157)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-06 17:30:56 +01:00
Paolo Ricciuti
556f96cfaf feat: allow for local opencode config (#156) 2026-02-06 17:25:33 +01:00
github-actions[bot]
77a3340c2f chore: sync AGENTS.md to opencode package and documentation (#155)
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2026-02-06 17:11:38 +01:00
Paolo Ricciuti
9ac8fd51e7 chore: sync AGENTS.md with opencode and docs (#154)
Co-authored-by: jyc.dev <jycouet@gmail.com>
2026-02-06 17:10:42 +01:00
paoloricciuti
c764308d79 fix: update version of claude plugin 2026-01-31 10:02:31 +01:00
paoloricciuti
01a7e6a8d3 fix: correct command for svelte language server 2026-01-31 09:52:57 +01:00
Paolo Ricciuti
d8ed686e3a chore: use @include in docs (#152) 2026-01-30 16:30:52 -05:00
github-actions[bot]
6f0390d0a9 Version Packages (#153)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-30 16:23:09 +01:00
paoloricciuti
c2c1b3e5e7 fix: actually push skills to right config path 2026-01-30 16:20:36 +01:00
github-actions[bot]
cdfbb907b6 Version Packages (#147)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-30 16:03:12 +01:00
Paolo Ricciuti
2eb2b18008 feat: distribute skills through opencode plugin (#151) 2026-01-30 15:52:35 +01:00
renovate[bot]
e8554f3d8f chore(deps): update all non-major dependencies (#137)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
2026-01-27 22:19:34 +01:00
Christopher Harrison
0213bd951f Add Copilot CLI setup instructions (#148) 2026-01-27 22:05:30 +01:00
paoloricciuti
2245cb2dc9 fix: turn off no-inspect in eslint for mcp 2026-01-27 16:25:30 +01:00
renovate[bot]
2a5f7d6314 chore(deps): update dependency @mcp-ui/server to v6 (#146)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
2026-01-27 16:11:09 +01:00
paoloricciuti
8518e627d3 chore: remove logs 2026-01-23 18:41:14 +01:00
paoloricciuti
9e824da9e2 chore: better debug logs 2026-01-23 18:32:54 +01:00
paoloricciuti
b38f2c11da fix: debug log 2026-01-23 18:28:37 +01:00
paoloricciuti
ea37c7120c chore: use new disableSee option in tmcp 2026-01-23 07:58:36 +01:00
paoloricciuti
099e939f79 fix: remove log duh 2026-01-22 23:50:37 +01:00
paoloricciuti
69b36eefdc fix: return 405 for SSE stream instead of closing immediately 2026-01-22 23:47:59 +01:00
github-actions[bot]
15ad554f53 Version Packages (#145)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-19 15:56:05 +01:00
paoloricciuti
74477448ce chore: update svelte 2026-01-19 15:52:46 +01:00
github-actions[bot]
6f538265d1 Version Packages (#144)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-17 15:21:24 +01:00
paoloricciuti
71295bc11f chore: add README to opencode plugin 2026-01-17 15:20:11 +01:00
Rich Harris
b5040ff5cf docs: tweak Claude Code documentation (#143)
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2026-01-17 01:04:32 +01:00
github-actions[bot]
45c961417f Version Packages (#141)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-16 19:26:42 +01:00
paoloricciuti
57e2d1def1 fix: show toast after a few seconds to avoid race condition 2026-01-16 19:21:42 +01:00
Paolo Ricciuti
398a703580 feat: opencode plugin (#142)
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2026-01-16 12:41:02 -05:00
Paolo Ricciuti
75c802a115 feat: add lsp config for claude plugin (#140) 2026-01-15 15:00:38 +01:00
Paolo Ricciuti
53a634cdb0 feat: expose playground link as MCP App (#138) 2026-01-15 14:59:46 +01:00
paoloricciuti
bcdc33e7a5 fix: automatically accept edits in the svelte file editor agent 2026-01-05 22:18:46 +01:00
github-actions[bot]
825ae33427 Version Packages (#136)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-05 09:43:10 +01:00
Paolo Ricciuti
ccf940cc45 feat: claude skill + marketplace (#110)
Co-authored-by: Stanislav Khromov <stanislav.khromov+github@gmail.com>
2026-01-04 23:00:03 +01:00
Paolo Ricciuti
b2f195fb7b fix: add suggestion for snippets declared in script tag (#132) 2026-01-04 12:00:33 +01:00
renovate[bot]
d8e4b18bff chore(deps): update pnpm to v10.27.0 (#133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-03 15:40:19 +01:00
renovate[bot]
6a2198b433 chore(deps): update dependency globals to v17 (#134)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-03 15:40:10 +01:00
renovate[bot]
2ce60c6110 chore(deps): update pnpm to v10.26.2 (#131)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-30 14:26:52 +01:00
github-actions[bot]
0f8987fdcf Version Packages (#130)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-22 00:18:38 +01:00
Paolo Ricciuti
42911e2631 feat: expose tools as JS api + cli (#128) 2025-12-22 00:16:36 +01:00
paoloricciuti
655eb85eba fix: use pnpm pack for pkg.pr.new publish 2025-12-19 18:26:45 +01:00
renovate[bot]
89403a7d0c chore(deps): update pnpm to v10.26.1 (#129)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-19 17:23:59 +01:00
paoloricciuti
3747623d55 chore: setup pkg.pr.new 2025-12-18 20:00:30 +01:00
github-actions[bot]
c1f230455f Version Packages (#127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-17 19:48:37 +01:00
paoloricciuti
9dfb4dedb4 fix: server.json version + update publisher 2025-12-17 19:46:59 +01:00
github-actions[bot]
b891e4860b Version Packages (#126)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-17 18:36:08 +01:00
Paolo Ricciuti
c9e8508dd9 fix: changesets 2025-12-17 18:31:39 +01:00
github-actions[bot]
9896406aff docs: update prompt documentation (#125)
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2025-12-17 18:29:54 +01:00
Paolo Ricciuti
b01ae9069b fix: typo again 2025-12-17 18:27:20 +01:00
Paolo Ricciuti
b6db495242 fix: changesets 2025-12-17 18:19:08 +01:00
Paolo Ricciuti
3926310107 fix: typo in documentation tool name in svelte_task 2025-12-17 18:17:30 +01:00
Paolo Ricciuti
848627549f fix: improve prompt to reduce token usage (#124)
Co-authored-by: Stanislav Khromov <stanislav.khromov+github@gmail.com>
2025-12-17 18:13:07 +01:00
renovate[bot]
283164ca7e chore(deps): update peter-evans/create-pull-request action to v8 (#121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 16:48:55 +01:00
renovate[bot]
c6ee414f62 chore(deps): update all non-major dependencies (#119)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 16:48:38 +01:00
Matheus Ferraz
ea5bdf66dc chore(docs): fix tool name typo (#120) 2025-12-13 01:32:19 +01:00
paoloricciuti
7d707202d1 fix: update tmcp 2025-12-06 10:44:04 +01:00
renovate[bot]
f0daadfbd0 chore(deps): update all non-major dependencies (#117)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-05 23:52:14 +01:00
github-actions[bot]
15a7774da7 Version Packages (#118)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-05 22:34:53 +01:00
paoloricciuti
98efa1e09e fix: revert name change and add title 2025-12-05 22:26:33 +01:00
github-actions[bot]
e20cf2974d Version Packages (#100)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-03 10:37:26 +01:00
paoloricciuti
b2ee968a3f chore: update publisher 2025-12-03 10:36:46 +01:00
paoloricciuti
60297b3c49 fix: update server name on mcp registry 2025-12-03 10:34:39 +01:00
renovate[bot]
39076da8ce chore(deps): update dependency @eslint/compat to v2 (#111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-03 10:34:15 +01:00
renovate[bot]
fba733646a chore(deps): update all non-major dependencies (#112)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 10:02:16 +01:00
renovate[bot]
7fcd4705a5 chore(deps): update actions/checkout action to v6 (#114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 10:02:00 +01:00
renovate[bot]
af7d341ba5 chore(deps): update pnpm to v10.22.0 (#107)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-13 15:29:04 +01:00
Lucas Terracino
52546551ff Update valid scope options in remote setup documentation for Gemini CLI (#108) 2025-11-12 23:01:54 +01:00
renovate[bot]
1f0a5f1519 chore(deps): update all non-major dependencies (#98)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
2025-11-11 12:39:11 +01:00
Scott Wu
0bf04bad2e docs: add reference to GEMINI.md and CLI change (#106) 2025-11-11 12:19:12 +01:00
Paolo Ricciuti
f001918925 chore: add initialize analytics event (#104) 2025-11-04 11:21:49 +01:00
paoloricciuti
67487c324a fix: remove log 2025-11-04 11:03:23 +01:00
jyc.dev
5beeef5543 moving to pnpm catalogs (#101) 2025-11-01 00:10:54 +01:00
Willow (GHOST)
e1a03fdb85 docs: update zed docs to use svelte-mcp extension (#102) 2025-10-31 17:11:46 +01:00
Paolo Ricciuti
384c1fd209 chore: update tmcp (#99) 2025-10-30 09:34:03 +01:00
renovate[bot]
b3027fd815 chore(deps): update dependency @anthropic-ai/sdk to ^0.68.0 (#97)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-29 08:27:08 +01:00
renovate[bot]
849bf2ad49 chore(deps): update dependency node to v24 (#95)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 19:11:08 +01:00
renovate[bot]
314538c8e7 chore(deps): update pnpm to v10.20.0 (#96)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-28 19:05:19 +01:00
github-actions[bot]
a9994310c0 Version Packages (#92)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-25 17:07:07 +02:00
Paolo Ricciuti
9fb1a403b7 fix: add async parameter to svelte-autofixer (#94) 2025-10-25 17:04:15 +02:00
github-actions[bot]
3c7b5033a4 docs: update prompt documentation (#93)
Co-authored-by: paoloricciuti <26281609+paoloricciuti@users.noreply.github.com>
2025-10-24 23:12:06 +02:00
Paolo Ricciuti
b911a00bb7 feat: analytics (#88) 2025-10-24 23:06:58 +02:00
paoloricciuti
f6ce89ff34 fix: install latest eslint svelte packages to support $state.eager 2025-10-24 21:02:25 +02:00
github-actions[bot]
846514858e Version Packages (#86)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-24 10:42:04 +02:00
Yuichiro Yamashita
b69ea052bd feat: support: $state.eager (#90)
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-10-24 10:34:00 +02:00
Tee Ming
e56159dda6 chore: add FUNDING.yml (#89) 2025-10-24 16:37:32 +09:00
paoloricciuti
1e83c35faa fix: update transport and cancel request only after sending it 2025-10-23 19:10:34 +02:00
Paolo Ricciuti
31edfe1b5f Merge pull request #85 from sveltejs/renovate/major-vitest-monorepo 2025-10-23 10:07:20 +02:00
paoloricciuti
3fabcc0f9b fix: add preferred-frame-size to UI resource 2025-10-23 09:57:51 +02:00
renovate[bot]
deb5f2670c chore(deps): update dependency vitest to v4 2025-10-22 19:36:46 +00:00
paoloricciuti
02c951baa8 fix: add icons to server.json 2025-10-22 21:35:01 +02:00
Paolo Ricciuti
41ceb83838 Merge pull request #79 from sveltejs/changeset-release/main 2025-10-22 17:23:40 +02:00
github-actions[bot]
3c3a26f031 Version Packages 2025-10-22 15:22:27 +00:00
Paolo Ricciuti
6589c7e250 Merge pull request #83 from sveltejs/renovate/all-minor-patch 2025-10-22 17:21:52 +02:00
Paolo Ricciuti
e09b8cd0b9 Merge pull request #84 from sveltejs/mcp-ui-playground 2025-10-22 17:21:33 +02:00
paoloricciuti
7f52a2b1be fix: use embed for mcp-ui embed 2025-10-22 14:56:24 +02:00
paoloricciuti
4eecd75759 chore: changesets 2025-10-22 09:59:39 +02:00
paoloricciuti
9015753f77 feat: return mcp ui resource for playground 2025-10-22 09:47:57 +02:00
renovate[bot]
4d6a9cb333 chore(deps): update pnpm to v10.19.0 2025-10-21 23:14:53 +00:00
Paolo Ricciuti
60aa30397f Merge pull request #80 from UltimateStarCoder/patch-1 2025-10-19 11:11:12 +02:00
paoloricciuti
17ed3a3e23 fix: lint 2025-10-19 11:08:57 +02:00
Paolo Ricciuti
f49bd06fbd chore: revert spacing 2025-10-19 11:05:50 +02:00
UltimateStarCoder
b98c042ae3 Correct JSON structure in remote setup documentation
Fixed JSON syntax for mcpServers configuration.
2025-10-18 17:43:58 -06:00
paoloricciuti
917a93d3fd fix: update deps and add path 2025-10-18 16:20:25 +02:00
Paolo Ricciuti
371e96befc Merge pull request #72 from adamtegen/patch-2 2025-10-17 18:58:29 +02:00
Paolo Ricciuti
bdfd5a109f fix: lint 2025-10-17 17:31:09 +02:00
Paolo Ricciuti
1c6c0a9fa7 Merge pull request #78 from sveltejs/invalid-css-autofixer
feat: suggest against js variables in css
2025-10-17 16:33:44 +02:00
paoloricciuti
a321244543 feat: suggest against js variables in css 2025-10-17 15:31:35 +02:00
paoloricciuti
ed25933466 fix: use right url + add manual triggering 2025-10-17 08:24:31 +02:00
Paolo Ricciuti
72f91dfb7b Merge pull request #77 from sveltejs/changeset-release/main 2025-10-17 08:12:59 +02:00
github-actions[bot]
d36855c447 Version Packages 2025-10-17 06:12:43 +00:00
paoloricciuti
5fa2baa270 fix: upgrade registry publisher cli 2025-10-17 08:12:09 +02:00
Paolo Ricciuti
6543150a5b Merge pull request #76 from sveltejs/changeset-release/main 2025-10-17 08:00:47 +02:00
github-actions[bot]
4c7f7feeba Version Packages 2025-10-17 05:59:44 +00:00
paoloricciuti
579be877fa fix: use correct server schema version 2025-10-17 07:59:10 +02:00
Paolo Ricciuti
0d55c0f61a Merge pull request #68 from sveltejs/changeset-release/main 2025-10-17 07:56:24 +02:00
github-actions[bot]
7d7b08610d Version Packages 2025-10-17 05:56:00 +00:00
Paolo Ricciuti
c08d8d4df7 Merge pull request #74 from sveltejs/renovate/all-minor-patch 2025-10-17 07:55:28 +02:00
paoloricciuti
12dd3c16ac fix: update deps 2025-10-17 01:26:35 +02:00
paoloricciuti
ca17a18677 fix: remove sizes 2025-10-17 00:42:47 +02:00
paoloricciuti
cf62286912 fix: use data: uri for local icon & add icons to tools + resources + prompts 2025-10-17 00:31:23 +02:00
Paolo Ricciuti
a4dfaab1c6 Merge pull request #75 from sveltejs/icon
feat: add svelte icon for mcp server
2025-10-16 23:32:18 +02:00
paoloricciuti
7b396ad63f fix: we need to serve them from the same domain 2025-10-16 23:24:52 +02:00
paoloricciuti
a9653f9c74 fix: svg is not supported, add also png 2025-10-16 23:21:19 +02:00
paoloricciuti
cabf1fd96a feat: add website url 2025-10-16 23:14:58 +02:00
renovate[bot]
2d50ffd38c chore(deps): update dependency @anthropic-ai/sdk to ^0.67.0 2025-10-16 21:14:38 +00:00
paoloricciuti
66c9056e0f feat: add svelte icon for mcp server 2025-10-16 23:13:34 +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
Paolo Ricciuti
322f416c3d Merge pull request #71 from sveltejs/renovate/all-minor-patch 2025-10-16 16:32:49 +02:00
Paolo Ricciuti
c40a3fcb5c Merge pull request #73 from sveltejs/renovate/sveltejs-adapter-vercel-6.x 2025-10-16 16:31:58 +02:00
renovate[bot]
a282623cc7 chore(deps): update dependency @sveltejs/adapter-vercel to v6 2025-10-15 17:39:29 +00:00
renovate[bot]
8f6abc6192 chore(deps): update all non-major dependencies 2025-10-15 17:39:12 +00: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
paoloricciuti
33a0e17ee1 fix: remove .only duh 2025-10-10 16:06:05 +02:00
paoloricciuti
bf5f31c867 feat: read_state_with_dollar autofixer 2025-10-10 16:00:19 +02:00
paoloricciuti
62abaacbd3 chore: fix autofixer snippet 2025-10-10 15:59:52 +02:00
paoloricciuti
87fab2d884 chore: exclude packages from changesets config 2025-10-10 15:59:39 +02:00
paoloricciuti
9cf50c9b62 chore: config no-unused-vars 2025-10-10 15:59:18 +02:00
Paolo Ricciuti
9a43aaf100 Merge pull request #62 from sveltejs/renovate/all-minor-patch 2025-10-10 13:03:57 +02:00
Paolo Ricciuti
c0477385b8 Merge pull request #65 from sveltejs/docs/update-prompt-docs 2025-10-10 13:02:45 +02:00
paoloricciuti
db283da593 docs: update prompts documentation 2025-10-10 10:39:22 +00:00
Paolo Ricciuti
7d7547f6e2 Merge pull request #63 from sveltejs/automatic-prompt-sync-with-docs 2025-10-10 12:31:16 +02:00
paoloricciuti
0360d00955 chore: remove changes to test action 2025-10-10 12:30:14 +02:00
paoloricciuti
65d403af1e feat: automatic prompt sync with docs 2025-10-10 10:38:41 +02:00
renovate[bot]
d794d6bec3 chore(deps): update pnpm to v10.18.2 2025-10-10 01:58:24 +00:00
Paolo Ricciuti
ec9c5b3415 Merge pull request #61 from sveltejs/changeset-release/main 2025-10-09 22:43:36 +02:00
github-actions[bot]
b508a4ea49 Version Packages 2025-10-09 20:42:32 +00:00
paoloricciuti
044f0988b9 fix: pass secrets in action and update mcpName 2025-10-09 22:41:56 +02:00
Paolo Ricciuti
c5c6ba6580 Merge pull request #60 from sveltejs/changeset-release/main 2025-10-09 22:31:24 +02:00
github-actions[bot]
fb2240d60c Version Packages 2025-10-09 20:30:38 +00:00
Paolo Ricciuti
469b2071e7 Merge pull request #59 from sveltejs/use-dns-mcp-publish 2025-10-09 22:30:06 +02:00
paoloricciuti
fc39b44859 fix: use DNS to publish MCP 2025-10-09 21:53:39 +02:00
Paolo Ricciuti
e12a0c90ab Merge pull request #58 from sveltejs/changeset-release/main 2025-10-09 18:44:05 +02:00
github-actions[bot]
7234e64967 Version Packages 2025-10-09 16:43:04 +00:00
paoloricciuti
ef5241cbc2 fix: publish to MCP registry (I really hope this time for real) 2025-10-09 18:42:26 +02:00
Paolo Ricciuti
9a74df198d Merge pull request #57 from sveltejs/changeset-release/main 2025-10-09 18:34:54 +02:00
github-actions[bot]
f1280b9876 Version Packages 2025-10-09 16:33:34 +00:00
paoloricciuti
132943db3b feat: publish mcp to registry (maybe for real this time) 2025-10-09 18:30:21 +02:00
paoloricciuti
5ed1454e2c fix: use right curl param 2025-10-09 18:27:21 +02:00
Paolo Ricciuti
bd072bd324 Merge pull request #54 from sveltejs/changeset-release/main 2025-10-09 18:24:56 +02:00
github-actions[bot]
c35be898da Version Packages 2025-10-09 16:23:57 +00:00
paoloricciuti
b960301ced fix: add id-token: write permission to release.yml 2025-10-09 18:23:26 +02:00
Paolo Ricciuti
43408f5504 Merge pull request #45 from sveltejs/publish-to-registry 2025-10-09 18:18:26 +02:00
Paolo Ricciuti
bf4dcda7e1 Merge pull request #55 from mquandalle/fix-claude-code-command-docs
docs: fix CLI command syntax for Claude Code and Gemini CLI
2025-10-09 08:25:22 +02:00
Paolo Ricciuti
35691c464b docs: fix gemini 2025-10-09 08:10:38 +02:00
Paolo Ricciuti
a5decb4cf3 Merge pull request #56 from sveltejs/link-to-docs 2025-10-08 17:36:30 +02:00
paoloricciuti
cb9764c234 docs: add link to CLAUDE.md and AGENTS.md docs 2025-10-08 17:22:15 +02:00
paoloricciuti
3fbc786383 fix: verify checksum 2025-10-08 17:20:16 +02:00
Maxime Quandalle
3b680232a0 Fix CLI command syntax for Claude Code and Gemini CLI
Add missing `--` separator between CLI options and npx command.
Without this separator, the `-y` option is incorrectly parsed as a
CLI option instead of being passed to npx.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 10:22:01 +02:00
paoloricciuti
c5c08ccd13 fix: lint 2025-10-08 00:09:23 +02:00
paoloricciuti
4ac35bf258 chore: separate workflows 2025-10-08 00:06:12 +02:00
paoloricciuti
ecbbf70d98 fix: call changeset version in script 2025-10-07 23:50:10 +02:00
paoloricciuti
aaac49cdef chore: update version of server.json on release 2025-10-07 23:49:28 +02:00
paoloricciuti
558d964919 Merge branch 'main' into publish-to-registry 2025-10-07 23:35:45 +02:00
paoloricciuti
73d7625b3c chore: changesets 2025-10-07 21:34:19 +02:00
Paolo Ricciuti
c7060c8bdb Merge pull request #20 from sveltejs/attachments-autofixer 2025-10-07 21:31:50 +02:00
Paolo Ricciuti
ef2d569934 Merge pull request #26 from sveltejs/function-call-in-effect 2025-10-07 21:31:21 +02:00
Paolo Ricciuti
7ba57b45ae Merge pull request #52 from theetherGit/zed-config 2025-10-07 12:04:00 +02:00
Paolo Ricciuti
fe393bf480 docs: remove command shortcut 2025-10-07 11:59:21 +02:00
theetherGit
a63deba99d chore: Lint 2025-10-07 15:05:36 +05:30
Paolo Ricciuti
668a2e4481 Merge pull request #51 from sveltejs/renovate/all-minor-patch 2025-10-07 10:23:08 +02:00
Shivam Meena
04c82875f3 Add MCP to zed guide 2025-10-07 12:12:05 +05:30
renovate[bot]
84601f9ab0 chore(deps): update pnpm to v10.18.1 2025-10-06 14:34:35 +00:00
Paolo Ricciuti
e01a050017 Merge pull request #50 from sveltejs/changeset-release/main 2025-10-06 12:36:23 +02:00
github-actions[bot]
5920f7482f Version Packages 2025-10-06 10:30:53 +00:00
Paolo Ricciuti
fa90a2be8d Merge pull request #49 from sveltejs/allow-ts-modules 2025-10-06 12:30:23 +02:00
paoloricciuti
73bf0c3782 fix: allow TS .svelte.ts modules 2025-10-06 12:13:22 +02:00
paoloricciuti
11cd2447fc feat: publish to registry 2025-10-05 12:13:34 +02:00
Paolo Ricciuti
8785ad224c Merge pull request #40 from sveltejs/changeset-release/main 2025-10-05 11:24:27 +02:00
github-actions[bot]
75e676d928 Version Packages 2025-10-04 22:54:37 +00:00
Paolo Ricciuti
5b16bdd80b Merge pull request #41 from 43081j/effect-pre-assign
fix: check effect.pre in assign-in-effect
2025-10-05 00:54:12 +02:00
James Garbutt
f3ee4ed59c chore: run format 2025-10-04 20:12:47 +01:00
paoloricciuti
725f785766 chore: changeset 2025-10-04 16:50:04 +02:00
paoloricciuti
485e60e245 fix: change title names to allow claude code to invoke the prompt 2025-10-04 16:49:23 +02:00
Paolo Ricciuti
480bfca557 Merge pull request #38 from sveltejs/renovate/actions-setup-node-5.x 2025-10-04 16:40:42 +02:00
renovate[bot]
06f9fc6d63 chore(deps): update actions/setup-node action to v5 2025-10-04 14:39:44 +00:00
Paolo Ricciuti
f1f85d2445 Merge pull request #33 from sveltejs/renovate/actions-checkout-5.x 2025-10-04 16:39:20 +02:00
renovate[bot]
b9c0a011e2 chore(deps): update actions/checkout action to v5 2025-10-04 14:37:40 +00:00
Paolo Ricciuti
b92dd95dee Merge pull request #32 from sveltejs/renovate/all-minor-patch 2025-10-04 16:37:15 +02:00
Paolo Ricciuti
99537cfa25 chore: add changesets 2025-10-04 16:34:43 +02:00
James Garbutt
f93a6cee60 fix: check effect.pre in assign-in-effect
It seems like the intention here was to check `$effect` _and_
`$effect.pre`, but the condition (`in_effect`) was filtering those out.
The `is_rune` helper already does the same checks, so we can just remove
the ones here and delegate to that.
2025-10-04 12:18:08 +01:00
renovate[bot]
e8989db548 chore(deps): update all non-major dependencies 2025-10-04 07:55:47 +00:00
paoloricciuti
cb316c5b3e fix: enable doc tools 2025-10-04 09:54:14 +02:00
Paolo Ricciuti
7c762109b6 Merge pull request #39 from sveltejs/llms-txt 2025-10-04 01:58:09 +02:00
paoloricciuti
e3dbb5c098 fix: lint 2025-10-04 01:57:09 +02:00
paoloricciuti
03ce6c50c0 fix: package.json and lock 2025-10-04 01:55:42 +02:00
Paolo Ricciuti
273c78092d Merge branch 'main' into llms-txt 2025-10-04 01:53:03 +02:00
Paolo Ricciuti
891fae8127 Merge pull request #29 from sveltejs/llms-txt-plus-use-cases
Generate use_cases documentation metadata
2025-10-04 01:46:05 +02:00
Paolo Ricciuti
fa969feb28 fix: update package name 2025-10-04 01:32:13 +02:00
Paolo Ricciuti
1dbd93a1ce Update use_cases documentation metadata format 2025-10-04 01:30:58 +02:00
paoloricciuti
3bb71f3963 chore: infer when possible, move schemas, add tsconfig to scripts 2025-10-04 01:27:27 +02:00
Stanislav Khromov
a881cb5938 move to devdeps 2025-10-04 01:19:48 +02:00
Stanislav Khromov
03859141ed rewrite to valibot 2025-10-04 01:07:15 +02:00
Stanislav Khromov
f747c4ac65 remove tsx 2025-10-04 00:55:11 +02:00
Stanislav Khromov
1916c410e6 use --experimental-strip-types 2025-10-04 00:53:37 +02:00
Stanislav Khromov
1e7ebeaf5b Merge branch 'llms-txt-plus-use-cases' of https://github.com/sveltejs/mcp into llms-txt-plus-use-cases 2025-10-04 00:48:43 +02:00
Stanislav Khromov
f82ceac79d validate sections 2025-10-04 00:48:41 +02:00
Stanislav Khromov
cde6d700e6 Update packages/mcp-server/src/mcp/utils.ts
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-10-04 00:46:23 +02:00
Stanislav Khromov
522fae6017 Update packages/mcp-server/src/mcp/utils.ts
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-10-04 00:39:44 +02:00
Stanislav Khromov
1f94d33dc9 Update packages/mcp-server/src/mcp/utils.ts
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-10-04 00:39:26 +02:00
Paolo Ricciuti
7ada706deb Merge pull request #37 from sveltejs/minor-text-fixes 2025-10-03 23:32:30 +02:00
Stanislav Khromov
796c38ee23 doc nits 2025-10-03 23:25:02 +02:00
Paolo Ricciuti
1f296e5277 Merge pull request #35 from sveltejs/changeset-release/main 2025-10-03 22:42:11 +02:00
github-actions[bot]
121395e98e Version Packages 2025-10-03 20:38:35 +00:00
paoloricciuti
8e7c881838 fix: just build we can figure out later if we want to avoid it 2025-10-03 22:38:08 +02:00
Paolo Ricciuti
91c396e675 Merge pull request #25 from sveltejs/setup-changesets 2025-10-03 22:35:50 +02:00
paoloricciuti
baad760634 chore: add changeset to trigger release 2025-10-03 22:34:55 +02:00
paoloricciuti
b2275587ee fix: remove package manager from inner packages 2025-10-03 22:33:56 +02:00
Paolo Ricciuti
4964303100 chore: apply suggestions from code review
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
2025-10-03 22:31:46 +02:00
paoloricciuti
81901b2564 fix: small configs 2025-10-03 22:03:59 +02:00
paoloricciuti
5aa1aa401a Merge branch 'main' into setup-changesets 2025-10-03 21:52:45 +02:00
Rich Harris
4201627f53 Merge pull request #31 from sveltejs/docs
docs: add documentation for svelte.dev
2025-10-03 15:22:59 -04:00
paoloricciuti
9a70fbe3aa feat: redirect to docs in case someone visits via browser 2025-10-03 21:12:42 +02:00
Paolo Ricciuti
dc16a42c65 chore: apply suggestions from code review
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2025-10-03 19:11:14 +02:00
Paolo Ricciuti
3b50014b09 chore: apply suggestions from code review
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2025-10-03 18:43:56 +02:00
Paolo Ricciuti
e9214bc470 chore: apply suggestions from code review
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2025-10-03 18:33:31 +02:00
Paolo Ricciuti
3106305902 chore: apply suggestions from code review
Co-authored-by: Rich Harris <hello@rich-harris.dev>
2025-10-03 18:24:35 +02:00
paoloricciuti
3c14872068 fix: LLM -> model 2025-10-03 17:20:38 +02:00
paoloricciuti
216a470bd2 docs: add documentation for svelte.dev 2025-10-03 16:49:43 +02:00
paoloricciuti
b5a88c454d fix: small typos 2025-10-03 16:49:24 +02:00
Stanislav Khromov
937216e1de use format function 2025-10-02 23:44:38 +02:00
Stanislav Khromov
6a23b9c87f use slug for path 2025-10-02 23:44:27 +02:00
Stanislav Khromov
8064a4f5cf remove docs/ prefix 2025-10-02 23:42:19 +02:00
Stanislav Khromov
005b9d45bd Prioritize use_cases from metadata, fallback to JSON, then empty string
Updated get_sections() to use a three-tier priority system for use_cases:
1. section.metadata.use_cases (from API)
2. summaries[section.slug] (from use_cases.json)
3. '' (empty string fallback)

This ensures we always have the most up-to-date use cases from the API
while maintaining local fallbacks for sections that haven't been updated yet.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 23:04:32 +02:00
Stanislav Khromov
12a80515a0 Update utils.ts 2025-10-02 23:03:02 +02:00
Stanislav Khromov
7acbaad478 Merge main into llms-txt-plus-use-cases
Resolved conflicts by adopting main's dynamic documentation fetching approach:
- utils.ts: Use dynamic fetch from svelte.dev instead of hardcoded sections
- utils.ts: Read use_cases from metadata instead of hardcoded JSON
- svelte-task.ts: Keep format_sections_list() for formatted output
- Added new schemas/index.ts from main

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 23:01:57 +02:00
Stanislav Khromov
55f9009a77 wip 2025-10-02 22:56:17 +02:00
Stanislav Khromov
02042daa02 Update svelte-task.ts 2025-10-02 22:53:34 +02:00
Stanislav Khromov
eb5444e3b6 format 2025-10-02 22:43:27 +02:00
Stanislav Khromov
c3134bdfde Update prompts.ts 2025-10-02 22:40:00 +02:00
Stanislav Khromov
334f9330e7 Update list-sections.ts 2025-10-02 22:38:52 +02:00
Stanislav Khromov
b16448b6df wip 2025-10-02 22:35:17 +02:00
Stanislav Khromov
b0888d6ac3 format, delete readme 2025-10-02 22:28:34 +02:00
Stanislav Khromov
6fc0419fc5 wip 2025-10-02 22:24:32 +02:00
Stanislav Khromov
d138349c46 fixes 2025-10-02 22:07:03 +02:00
Stanislav Khromov
e1a1cb1d84 Update anthropic.ts 2025-10-02 22:04:43 +02:00
Stanislav Khromov
e723198db0 Update utils.ts 2025-10-02 22:01:43 +02:00
Paolo Ricciuti
7b5bea6549 Merge pull request #28 from sveltejs/llms-txt
feat: simplified documentation listing
2025-10-02 11:46:33 +02:00
paoloricciuti
a36d0d17a8 fix: validate response and default use_cases 2025-10-02 11:29:35 +02:00
paoloricciuti
70f14bddca feat: use endpoint to get sections 2025-10-02 08:03:03 +02:00
Stanislav Khromov
7dedb277be fix paths 2025-10-02 01:28:42 +02:00
Stanislav Khromov
de45c1b015 Update generate-summaries.ts 2025-10-02 01:24:05 +02:00
Stanislav Khromov
94f12964cb fix path 2025-10-02 01:23:51 +02:00
Stanislav Khromov
7366dad0e9 wip 2025-10-02 01:18:32 +02:00
Stanislav Khromov
22aaad43f3 wip 2025-10-02 01:16:43 +02:00
Stanislav Khromov
1332513847 Update utils.ts 2025-10-02 01:14:20 +02:00
Stanislav Khromov
988da97816 add example summaries 2025-10-02 01:10:08 +02:00
Stanislav Khromov
b086e634fe wip 2025-10-02 01:01:09 +02:00
Stanislav Khromov
fd72afc2a3 Update generate-summaries.ts 2025-10-02 00:58:53 +02:00
Stanislav Khromov
5736e853e6 Update generate-summaries.ts 2025-10-02 00:55:41 +02:00
Stanislav Khromov
0f2747423b refactor 2025-10-02 00:53:28 +02:00
Stanislav Khromov
a49773f0ff wip 2025-10-02 00:47:33 +02:00
Stanislav Khromov
56b47f1108 wip 2025-10-02 00:46:48 +02:00
Stanislav Khromov
207d1f80bf Create README.md 2025-10-02 00:43:28 +02:00
Stanislav Khromov
0cda036ab6 add initial 2025-10-02 00:43:24 +02:00
paoloricciuti
a281ef4b66 fix: use server.template with list and complete for docs resources 2025-09-28 12:19:43 +02:00
paoloricciuti
5bc812e4db fix: enable list-sections tool 2025-09-28 12:19:21 +02:00
paoloricciuti
82319661dd feat: add sections to prompt 2025-09-28 12:19:03 +02:00
paoloricciuti
ce0861c1ca chore: use mocked current version of sections 2025-09-28 12:18:52 +02:00
Stanislav Khromov
5dd83d151e Update utils.ts 2025-09-27 00:14:00 +02:00
Stanislav Khromov
76a35f5dc8 format 2025-09-27 00:13:37 +02:00
Stanislav Khromov
54763e0f55 Update packages/mcp-server/src/mcp/utils.ts
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-09-27 00:07:18 +02:00
Stanislav Khromov
01d5803b5d reduce duplication 2025-09-27 00:06:37 +02:00
Stanislav Khromov
0366bc785b Merge branch 'llms-txt' of https://github.com/sveltejs/mcp into llms-txt 2025-09-27 00:03:49 +02:00
Stanislav Khromov
6a6417d3a5 Use Promise.allSettled() 2025-09-27 00:03:40 +02:00
Stanislav Khromov
77af7ebcc6 Update packages/mcp-server/src/mcp/handlers/tools/get-documentation.ts
Co-authored-by: Paolo Ricciuti <ricciutipaolo@gmail.com>
2025-09-27 00:01:50 +02:00
Stanislav Khromov
b1a196497d Update list-sections.ts 2025-09-27 00:00:15 +02:00
Stanislav Khromov
fb2d19fd07 Update list-sections.ts 2025-09-26 23:59:18 +02:00
Stanislav Khromov
8328a3572b eslint 2025-09-26 23:51:58 +02:00
Stanislav Khromov
c05b6c257a eslint 2025-09-26 23:51:48 +02:00
Stanislav Khromov
7f9ea742d8 don't lint .claude dir 2025-09-26 23:48:15 +02:00
Stanislav Khromov
bf477a6ccf Update get-documentation.ts 2025-09-26 23:46:07 +02:00
Stanislav Khromov
0f5482477a Update get-documentation.ts 2025-09-26 22:44:28 +02:00
Stanislav Khromov
b774b463fe Update get-documentation.ts 2025-09-26 22:42:42 +02:00
Stanislav Khromov
c49b24d36a wip 2025-09-26 22:39:52 +02:00
Stanislav Khromov
6cb97ac11d Update get-documentation.ts 2025-09-26 22:36:30 +02:00
Stanislav Khromov
d33a374417 Update get-documentation.ts 2025-09-26 21:56:38 +02:00
Stanislav Khromov
1bb171cea7 cleanup 2025-09-26 20:44:41 +02:00
Stanislav Khromov
e314ab57b2 Update list-sections.ts 2025-09-26 20:43:04 +02:00
Stanislav Khromov
19cacf7ed9 refactor 2025-09-26 20:39:22 +02:00
Stanislav Khromov
68cf69a117 wip 2025-09-26 20:38:17 +02:00
Stanislav Khromov
917fdf63b1 enable 2025-09-26 20:34:57 +02:00
Stanislav Khromov
972cadc410 Update package.json 2025-09-26 20:30:16 +02:00
Stanislav Khromov
dc6c87ce37 Merge branch 'main' into llms-txt 2025-09-26 20:30:11 +02:00
Stanislav Khromov
e7431e9024 Update README.md 2025-09-26 20:29:55 +02:00
Stanislav Khromov
07737a8edd Add Claude Code .mcp.json config 2025-09-26 20:22:50 +02:00
Stanislav Khromov
fdb7689992 fix stdio path 2025-09-26 20:21:43 +02:00
paoloricciuti
8483bd672d feat: add autofixer to tell the LLM to check if some function called in effect is assigning state 2025-09-26 13:04:11 +02:00
paoloricciuti
47fa0a4382 fix: add $derived and $derived.by to wrong-property-access-state 2025-09-26 12:39:40 +02:00
paoloricciuti
4c6232a44f fix: add $derived and $derived.by to the reassignment list 2025-09-26 12:33:33 +02:00
paoloricciuti
8edbf2f36b fix: disable todos tools 2025-09-26 12:15:11 +02:00
paoloricciuti
6e54719f88 chore: update deps to fix tmcp issue 2025-09-26 10:01:45 +02:00
paoloricciuti
1a283f60bc chore: disable unimplemented tools/resources 2025-09-24 22:11:21 +02:00
paoloricciuti
bb16ccca3a fix: pnpm versions and package.json 2025-09-24 16:06:32 +02:00
paoloricciuti
23ddaf9495 fix: update pnpm version 2025-09-24 15:59:34 +02:00
paoloricciuti
4228302ed0 fix: package.json's 2025-09-24 15:57:17 +02:00
Paolo Ricciuti
0bc4d75e13 chore: use the right repo name 🤦
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
2025-09-24 15:53:12 +02:00
paoloricciuti
4679549401 chore: setup changesets 2025-09-24 15:43:42 +02:00
paoloricciuti
6b15eb0790 feat: add .$ property access autofixer 2025-09-24 15:07:00 +02:00
Paolo Ricciuti
a7041a4c5e Merge pull request #23 from sveltejs/setup-cli-project 2025-09-24 15:04:08 +02:00
paoloricciuti
023bea317f Merge branch 'main' into setup-cli-project 2025-09-24 10:45:48 +02:00
paoloricciuti
7a6cba8772 fix: add suggestion for $state variable_name 2025-09-24 10:45:15 +02:00
paoloricciuti
fd32b67442 fix: lint and check 2025-09-24 10:44:41 +02:00
paoloricciuti
0e3b1ba22f fix: right replacement for __filename 2025-09-24 10:13:19 +02:00
paoloricciuti
0aad39d076 fix: package.json setup and tsdown config 2025-09-24 10:09:42 +02:00
paoloricciuti
2fec290d54 fix: lint and check 2025-09-24 10:05:24 +02:00
paoloricciuti
4e59ef751a fix: rename project 2025-09-24 10:05:15 +02:00
paoloricciuti
c87c9e0715 feat: setup cli project 2025-09-24 09:43:06 +02:00
paoloricciuti
8414ffbcc8 fix: move attachments fixer 2025-09-23 23:05:53 +02:00
paoloricciuti
5798b50ceb Merge branch 'main' into attachments-autofixer 2025-09-23 23:04:38 +02:00
paoloricciuti
e560932211 Merge branch 'main' into attachments-autofixer 2025-09-23 23:03:13 +02:00
Paolo Ricciuti
12f8d84852 Merge pull request #22 from sveltejs/great-monorepo-restructure 2025-09-23 23:02:37 +02:00
paoloricciuti
bde37da5d5 chore: add .editorconfig, .gitattributes and renovate.json 2025-09-23 23:01:26 +02:00
paoloricciuti
a50844e388 fix: remove double gitignore 2025-09-23 22:57:14 +02:00
paoloricciuti
6a71229d56 fix: remove ts.config 2025-09-23 18:17:26 +02:00
paoloricciuti
92d8532c8a chore: add DATABASE_TOKEN 2025-09-23 18:10:35 +02:00
paoloricciuti
c8300bc62e fix: lint and typecheck 2025-09-23 18:02:10 +02:00
paoloricciuti
de78f7663f chore: add check recursive script 2025-09-23 16:56:45 +02:00
paoloricciuti
e57b76324f chore: add build script 2025-09-23 16:51:38 +02:00
paoloricciuti
09331e2c2b chore: add eslint locally 2025-09-23 16:50:58 +02:00
paoloricciuti
f1aef9ca2f chore: great monorepo restructuring 2025-09-23 16:45:05 +02:00
paoloricciuti
6c072534ea fix: use installed inspector and remove DANGEROUSLY_OMIT_AUTH 2025-09-23 11:22:26 +02:00
paoloricciuti
2f8165f1d7 chore: add issue templates 2025-09-23 09:28:36 +02:00
paoloricciuti
9504e6bac9 feat: autofixer action -> attachment 2025-09-23 00:49:09 +02:00
paoloricciuti
7086e8e55f feat: add bind:this -> attachment autofixer 2025-09-23 00:17:36 +02:00
Paolo Ricciuti
d93d3a3507 Merge pull request #17 from sveltejs/playground-link-tool 2025-09-22 23:54:41 +02:00
paoloricciuti
039718f1a5 fix: ask the user to generate instead of generate by default 2025-09-22 23:48:24 +02:00
paoloricciuti
ac287a2c83 feat: playground-link tool 2025-09-22 15:57:59 +02:00
paoloricciuti
224d630a32 chore: add explicit extensions eslint rule 2025-09-22 15:11:38 +02:00
Paolo Ricciuti
4a9afb5ee1 Merge pull request #16 from sveltejs/restructure 2025-09-22 10:46:42 +02:00
Paolo Ricciuti
e68067e995 Merge pull request #15 from sveltejs/no-lib-eslint-rul 2025-09-22 10:35:04 +02:00
paoloricciuti
8258a1c9ba fix: lint 2025-09-22 10:33:35 +02:00
paoloricciuti
5aa2827c91 chore: add eslint to prevent importing with $lib inthe lib folder 2025-09-22 10:00:37 +02:00
paoloricciuti
a35d72cc6b fix: update deps 2025-09-22 09:44:18 +02:00
paoloricciuti
0c35883074 Merge branch 'main' into init-docs 2025-09-21 16:22:26 +02:00
paoloricciuti
d82c20acd6 fix: update to latest transport 2025-09-21 16:22:06 +02:00
paoloricciuti
cc3ea75c7f fix: lint 2025-09-21 14:52:11 +02:00
paoloricciuti
68724731c7 chore: add snippets to create autofixers and stup functions 2025-09-21 14:50:01 +02:00
paoloricciuti
bf1a4178bf fix: move handler in their own folder while keeping TS 2025-09-21 14:49:44 +02:00
paoloricciuti
050e588709 Merge branch 'main' into init-docs 2025-09-21 13:54:14 +02:00
Paolo Ricciuti
731b4f6548 Merge pull request #14 from sveltejs/close-sse-stream 2025-09-21 13:50:22 +02:00
paoloricciuti
582e0e1dea fix: close SSE stream immediately 2025-09-20 23:53:42 +02:00
Paolo Ricciuti
bb9a6e07ea Merge pull request #13 from sveltejs/import-stores-autofixer
feat: add use runes instead of stores autofixer
2025-09-20 09:19:36 +02:00
Stanislav Khromov
0d17b81948 Merge pull request #12 from sveltejs/eslint-conventions
chore: add eslint rules for naming convention and function declaration
2025-09-20 02:18:16 +02:00
paoloricciuti
81640c9a16 fix: describe filename and accept string version 2025-09-20 01:39:17 +02:00
paoloricciuti
8587bc8625 fix: wat? 2025-09-20 01:22:48 +02:00
paoloricciuti
0475e3b0f9 fix: us ts parser in svelte parser 2025-09-19 22:47:36 +02:00
paoloricciuti
4e1a42ab52 fix: remove from recommended 2025-09-19 22:21:10 +02:00
paoloricciuti
862f614afc fix: duh 2025-09-19 22:09:59 +02:00
paoloricciuti
a92ae954bd fix: nuke rules completely 2025-09-19 22:08:11 +02:00
paoloricciuti
e3b5188c6d fix: maybe this? 2025-09-19 22:02:13 +02:00
paoloricciuti
6b5f2092b5 fix: again 2025-09-19 21:56:32 +02:00
paoloricciuti
089e690f3e fix: what about this? 2025-09-19 21:53:04 +02:00
paoloricciuti
1c60e350a6 fix: what about this? 2025-09-19 20:38:30 +02:00
paoloricciuti
a93a6554b5 fix: is this the issue? 2025-09-19 20:37:07 +02:00
paoloricciuti
94f7d65db3 fix: latest plugin svelte? 2025-09-19 19:48:56 +02:00
paoloricciuti
d7492bb1cb fix: more stuff to deps? 2025-09-19 19:43:30 +02:00
paoloricciuti
e1e2bf68ae fix: move typescript eslint to the dependencies? 2025-09-19 19:39:41 +02:00
paoloricciuti
0ff628f5b4 fix: latest eslint maybe? 2025-09-19 19:32:40 +02:00
paoloricciuti
ea35d600e4 fix: lock 2025-09-19 19:18:49 +02:00
paoloricciuti
dcbcd5b690 fix: move eslint deps to dependencies 2025-09-19 19:16:38 +02:00
paoloricciuti
9f580a36ef feat: add use runes instead of stores autofixer 2025-09-19 16:28:23 +02:00
paoloricciuti
d81d6a3d95 chore: add eslint rules for naming convention and function declaration 2025-09-19 12:30:44 +02:00
paoloricciuti
f04cb139e3 chore: change setup to allow for hosted turso version 2025-09-19 12:21:47 +02:00
Stanislav Khromov
dedfd0b3b7 Move auto fixer handler 2025-09-19 01:20:04 +02:00
Stanislav Khromov
5d50518c3c types 2025-09-19 01:17:02 +02:00
Stanislav Khromov
74d2fb8f0e Update getDocumentationHandler.ts 2025-09-19 01:15:58 +02:00
Stanislav Khromov
86675ea1d7 Update index.ts 2025-09-19 01:08:03 +02:00
Stanislav Khromov
830fd73ab1 move handlers to separate directory 2025-09-19 01:06:53 +02:00
Stanislav Khromov
da995bdc69 Update index.ts 2025-09-19 01:05:19 +02:00
Stanislav Khromov
26b3986740 wip 2025-09-19 01:01:46 +02:00
Stanislav Khromov
8d53f56151 add tmcp docs 2025-09-19 00:55:36 +02:00
Paolo Ricciuti
fd355e872d Merge pull request #9 from sveltejs/task-prompt
feat: add Svelte task prompt
2025-09-19 00:38:49 +02:00
Paolo Ricciuti
d4edef1d82 Merge pull request #8 from sveltejs/set-update-autofixer
feat: add `set` or `update` stateful variables autofixer & imported runes autofixer
2025-09-19 00:38:29 +02:00
paoloricciuti
26d30c73c7 feat: add Svelte task prompt 2025-09-18 19:48:51 +02:00
paoloricciuti
13719d0646 feat: add derived with functions suggestions 2025-09-18 17:45:51 +02:00
paoloricciuti
4c8cadd585 feat: add imported runes autofixer 2025-09-18 17:07:31 +02:00
paoloricciuti
72e89af60f feat: add set or update stateful variables autofixer 2025-09-18 16:32:25 +02:00
Paolo Ricciuti
13c4832d1b Merge pull request #7 from sveltejs/autofixer-folders-and-tests 2025-09-18 15:42:33 +02:00
paoloricciuti
7c7a1f939f fix: restructure autofixer folders and add tests 2025-09-18 14:54:41 +02:00
Paolo Ricciuti
5becaf3b5e Merge pull request #1 from sveltejs/copy-tables-from-current-mcp 2025-09-17 23:06:36 +02:00
Stanislav Khromov
7f858929ad Merge branch 'main' into copy-tables-from-current-mcp 2025-09-17 22:34:56 +02:00
Stanislav Khromov
6b5588c2f9 Merge pull request #6 from sveltejs/add-devtools
Dev tools docs
2025-09-17 22:34:43 +02:00
Stanislav Khromov
684d7effef wip 2025-09-17 22:33:50 +02:00
Paolo Ricciuti
a0f8abb632 Merge pull request #5 from sveltejs/eslint-versions 2025-09-17 16:25:16 +02:00
paoloricciuti
f85e4612ac fix: use compiler to get warnings, enable more rules 2025-09-17 16:25:04 +02:00
paoloricciuti
11aceaf047 fix: use snake case and lazily create eslint instances 2025-09-17 15:05:12 +02:00
baseballyama
e515b9eaf9 wip 2025-09-17 21:00:58 +09:00
paoloricciuti
ffafb8a492 fix: lint 2025-09-17 01:35:56 +02:00
paoloricciuti
cba6ab8f4b feat: run eslint on code to get basic rules 2025-09-17 01:30:15 +02:00
paoloricciuti
052331a80e feat: labeled statement autofixer 2025-09-17 01:30:15 +02:00
paoloricciuti
887137e794 feat: setup stdio server build 2025-09-17 01:30:15 +02:00
paoloricciuti
b4259dd117 chore: copy tables from current mcp 2025-09-11 23:05:09 +02:00
213 changed files with 18887 additions and 2110 deletions

8
.changeset/README.md Normal file
View File

@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": ["@svitejs/changesets-changelog-github-compact", { "repo": "sveltejs/ai-tools" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["!@sveltejs/mcp", "!@sveltejs/opencode"]
}

View File

@@ -0,0 +1,22 @@
{
"name": "svelte",
"owner": {
"name": "Svelte"
},
"plugins": [
{
"name": "svelte",
"source": "./plugins/claude/svelte",
"description": "A plugin for all things Svelte development, MCP, skills, and more.",
"lspServers": {
"svelte": {
"command": "svelteserver",
"args": ["--stdio"],
"extensionToLanguage": {
".svelte": "svelte"
}
}
}
}
]
}

3
.cocoignore Normal file
View File

@@ -0,0 +1,3 @@
.claude
.github
.vscode

1
.cocominify Normal file
View File

@@ -0,0 +1 @@
packages/mcp-server/src/use_cases.json

View File

@@ -0,0 +1,13 @@
{
"name": "svelte",
"owner": {
"name": "Svelte"
},
"plugins": [
{
"name": "svelte",
"source": "./plugins/cursor/svelte",
"description": "A plugin for all things Svelte development, MCP, skills, and more."
}
]
}

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto eol=lf
/packages/**/test/** -linguist-detectable
/packages/**/fixtures/** -linguist-detectable

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
open_collective: svelte

View File

@@ -0,0 +1,36 @@
name: 'Autofixer Request'
description: Request a new Autofixer for the MCP
title: '[Autofixer Request] '
labels: [enhancement, autofixer]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to request A new autofixer!
- type: textarea
id: problem
attributes:
label: Describe the problematic code
description: Please provide a clear and concise description the problem. Is much better if you can provide a code snippet the AI constantly get's wrong.
placeholder: The AI keeps messing with...
validations:
required: true
- type: textarea
id: suggestion
attributes:
label: Describe what the autofixer should suggest
description: If you were looking at this code, what would you suggest to the AI for it to fix it?
placeholder: You should never do this, instead do that...
validations:
required: true
- type: dropdown
id: importance
attributes:
label: Importance
description: How important is this feature to you?
options:
- nice to have
- would make my life easier
- the MCP is useless to me without it
validations:
required: true

52
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: "\U0001F41E Bug report"
description: Report an issue with Svelte
title: '[Bug] '
labels: ['triage: bug']
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
placeholder: Bug description
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Please provide a link to a repo or REPL that can reproduce the problem you ran into. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided within a reasonable time-frame, the issue will be closed.
placeholder: Reproduction
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: 'Please provide some logs or screenshot of the agentic workflow failing.'
render: shell
- type: input
id: mcp-client
attributes:
label: MCP Client
description: Which MCP client are you using?
render: shell
placeholder: claude-code, codex, opencode
validations:
required: true
- type: dropdown
id: severity
attributes:
label: Severity
description: Select the severity of this issue
options:
- annoyance
- minor functionality loss
- major functionality loss
- blocking all usage of the mcp
validations:
required: true

View File

@@ -0,0 +1,36 @@
name: 'Feature Request'
description: Request a new MCP feature
title: '[Feature Request] '
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to request this feature! If your feature request is complex or substantial enough to warrant in-depth discussion, maintainers may close the issue and ask you to open an [RFC](https://github.com/sveltejs/rfcs).
- type: textarea
id: problem
attributes:
label: Describe the problem
description: Please provide a clear and concise description the problem this feature would solve. The more information you can provide here, the better.
placeholder: I'm always frustrated when...
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the proposed solution
description: Please provide a clear and concise description of what you would like to happen.
placeholder: I would like to see...
validations:
required: true
- type: dropdown
id: importance
attributes:
label: Importance
description: How important is this feature to you?
options:
- nice to have
- would make my life easier
- the MCP is useless to me without it
validations:
required: true

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 10
version: 10.28.2
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies
@@ -32,5 +32,4 @@ jobs:
- name: Run type check
run: pnpm run check
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 10
version: 10.28.2
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies
@@ -32,5 +32,4 @@ jobs:
- name: Run linting
run: pnpm run lint
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key

View File

@@ -0,0 +1,26 @@
name: Publish Any Commit
on: [push, pull_request]
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- run: corepack enable
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
# Opencode doesn't have a build step
- name: Build Stdio
run: pnpm --filter @sveltejs/mcp run build
- run: pnpm dlx pkg-pr-new publish --compact './packages/mcp-stdio' './packages/opencode' --pnpm

41
.github/workflows/publish-mcp.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Publish to MCP Registry
on:
workflow_call:
secrets:
MCP_KEY:
required: true
workflow_dispatch:
jobs:
publish-mcp:
name: Publish to MCP Registry
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
- name: Publish to MCP Registry
working-directory: packages/mcp-stdio
env:
MCP_KEY: ${{ secrets.MCP_KEY }}
run: |
NAME=mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz
# Download MCP Publisher pinned to v1.4.0 using latest https for security and save it to a file named mcp-publisher.tar.gz
curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fL "https://github.com/modelcontextprotocol/registry/releases/download/v1.4.0/$NAME" -O
# Verify the SHA256 checksum of the downloaded file
sha256sum --ignore-missing -c ./checksums/registry_1.4.0_checksums.txt
# Extract the tarball
mkdir tmp
tar -xzf $NAME --no-same-owner --no-same-permissions -C tmp
# Install the MCP Publisher binary
install -m 0755 tmp/mcp-publisher .
# Login using DNS
./mcp-publisher login dns --domain svelte.dev --private-key "${MCP_KEY}"
# Publish to MCP Registry
./mcp-publisher publish

View File

@@ -0,0 +1,66 @@
name: Release Svelte Skills
on:
push:
branches:
- main
paths:
- 'tools/skills/**'
workflow_dispatch:
permissions: {}
jobs:
detect-skills:
permissions:
contents: read
if: github.repository == 'sveltejs/ai-tools'
name: Detect changed skills
runs-on: ubuntu-latest
outputs:
skills: ${{ steps.find-skills.outputs.skills }}
steps:
- name: checkout
uses: actions/checkout@v6
- name: Find all skills
id: find-skills
run: |
skills=$(ls -d tools/skills/*/ | xargs -I {} basename {} | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "skills=$skills" >> $GITHUB_OUTPUT
release:
needs: detect-skills
if: needs.detect-skills.outputs.skills != '[]'
permissions:
contents: write
name: Release ${{ matrix.skill }}
runs-on: ubuntu-latest
strategy:
matrix:
skill: ${{ fromJson(needs.detect-skills.outputs.skills) }}
steps:
- name: checkout
uses: actions/checkout@v6
- name: Get version from date
id: version
run: echo "version=$(date +'%Y.%m.%d-%H%M%S')" >> $GITHUB_OUTPUT
- name: Create zip
run: |
cd tools/skills
zip -r ${{ matrix.skill }}.zip ${{ matrix.skill }}/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ matrix.skill }}-v${{ steps.version.outputs.version }}
name: ${{ matrix.skill }} v${{ steps.version.outputs.version }}
body: |
Automated release of the ${{ matrix.skill }} skill.
This release was triggered by changes to the `tools/skills/${{ matrix.skill }}/` directory.
files: tools/skills/${{ matrix.skill }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

70
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: Release
on:
push:
branches:
- main
permissions: {}
jobs:
release:
permissions:
contents: write # to create release (changesets/action)
id-token: write # OpenID Connect token needed for provenance
pull-requests: write # to create pull request (changesets/action)
# prevents this action from running on forks
if: github.repository == 'sveltejs/ai-tools'
name: Release
runs-on: ${{ matrix.os }}
outputs:
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
node: [24]
os: [ubuntu-latest]
steps:
- name: checkout
uses: actions/checkout@v6
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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.node }}
package-manager-cache: false # pnpm is not installed yet
- name: install pnpm
shell: bash
run: |
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@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.node }}
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: install
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: build
run: pnpm run --filter ./packages/mcp-stdio/ build
- name: Create Release Pull Request or Publish to npm
id: changesets
# pinned for security, always review third party action code before updating
uses: changesets/action@c48e67d110a68bc90ccf1098e9646092baacaa87 # v1.6.0
with:
# This expects you to have a script called changeset:version version that calls changeset version and updated what it needs to be updated
version: pnpm changeset:version
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
publish-mcp:
needs: release
if: contains(needs.release.outputs.publishedPackages, '"@sveltejs/mcp"')
uses: ./.github/workflows/publish-mcp.yml
secrets:
MCP_KEY: ${{ secrets.MCP_KEY }}

116
.github/workflows/sync-docs-skills.yml vendored Normal file
View File

@@ -0,0 +1,116 @@
name: Sync Skills
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
actions: write
jobs:
sync-skills:
if: github.repository == 'sveltejs/ai-tools'
name: Sync skills from svelte.dev
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
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"
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Clone svelte.dev
run: git clone --depth 2 https://github.com/sveltejs/svelte.dev.git "${{ runner.temp }}/svelte.dev"
- name: Discover changed skill files
id: discover
env:
SVELTE_DEV_ROOT: ${{ runner.temp }}/svelte.dev
run: |
skill_files=$(git -C "$SVELTE_DEV_ROOT" diff --name-only --diff-filter=ACMR HEAD~1 HEAD | grep '^apps/svelte.dev/content/docs/.*\.md$' | xargs -I{} grep -l '^skill: *true' "$SVELTE_DEV_ROOT/{}" || true)
echo "skill_files=$skill_files" >> "$GITHUB_OUTPUT"
- name: Sync skills
if: steps.discover.outputs.skill_files != ''
env:
SVELTE_DEV_ROOT: ${{ runner.temp }}/svelte.dev
DOCS_PREFIX: apps/svelte.dev/content/docs/
run: |
for full_path in ${{ steps.discover.outputs.skill_files }}; do
file="${full_path#$SVELTE_DEV_ROOT/}"
name=$(grep '^name: ' "$full_path" | head -1 | sed 's/^name: *//')
repo="${file#$DOCS_PREFIX}"
repo="${repo#/}"
repo="${repo%%/*}"
output_dir="tools/skills/$name"
rm -rf "$output_dir"
mkdir -p "$output_dir"
pnpm resolve-references --file "$full_path" --repo "$repo" --output "$output_dir"
done
- name: Sync plugins
if: steps.discover.outputs.skill_files != ''
run: |
pnpm sync-claude-plugin
pnpm sync-cursor-plugin
pnpm sync-opencode-plugin
pnpm generate-skill-docs
pnpm bump-plugin-versions
- name: Check for changes
id: git-check
run: |
git diff --exit-code -- tools/skills/ plugins/ packages/opencode/ documentation/docs/ || echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: sync skills from svelte.dev'
branch: chore/sync-skills
delete-branch: true
title: 'chore: sync skills from svelte.dev'
body: |
## Summary
Automatically synced skill markdown from `sveltejs/svelte.dev` into `tools/skills/`.
## Changes
- Cloned `sveltejs/svelte.dev`
- Filtered markdown files with `skill: true` frontmatter
- Rebuilt synced skill folders with `scripts/resolve-references.ts`
- Synced `plugins/claude/svelte/` (skills, agents)
- Synced `plugins/cursor/svelte/` (skills, agents, rules)
- Synced `packages/opencode/` (skills, instructions)
- Updated documentation
## Generated by
GitHub Action: Sync Skills
labels: |
chore
automated

95
.github/workflows/sync-plugins.yml vendored Normal file
View File

@@ -0,0 +1,95 @@
name: Sync Plugins
on:
push:
branches:
- main
paths:
- 'tools/**'
permissions:
contents: write
pull-requests: write
jobs:
sync-plugins:
# prevents this action from running on forks
if: github.repository == 'sveltejs/ai-tools'
name: Sync Plugins from tools/
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
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
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Sync plugins
run: pnpm sync-plugins
- name: Generate skills documentation
run: pnpm generate-skill-docs
- name: Generate subagent documentation
run: pnpm generate-subagent-docs
- name: Check for changes
id: git-check
run: |
git diff --exit-code \
plugins/claude/svelte/ \
plugins/cursor/svelte/ \
packages/opencode/skills/ \
packages/opencode/instructions/ \
packages/opencode/schema.json \
documentation/docs/ \
|| echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: sync plugins from tools/'
branch: chore/sync-plugins
delete-branch: true
title: 'chore: sync plugins from tools/'
body: |
## Summary
Automatically synced all plugins from the `tools/` source of truth.
This PR was triggered by changes to `tools/**`.
## Changes
- Synced `plugins/claude/svelte/` (skills, agents with `permissionMode`)
- Synced `plugins/cursor/svelte/` (skills, agents, rules)
- Synced `packages/opencode/` (skills, instructions, schema)
- Updated documentation
## Generated by
GitHub Action: Sync Plugins
labels: |
chore
automated

View File

@@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
uses: pnpm/action-setup@v5
with:
version: 10
version: 10.28.2
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
node-version: '24'
cache: 'pnpm'
- name: Install dependencies
@@ -32,11 +32,9 @@ jobs:
- name: Build project
run: pnpm run build
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key
- name: Run tests
run: pnpm run test
env:
DATABASE_URL: file:test.db
VOYAGE_API_KEY: dummy-key

View File

@@ -0,0 +1,78 @@
name: Update OpenCode JSON Schema
on:
push:
branches:
- main
paths:
- 'packages/opencode/config.ts'
permissions:
contents: write
pull-requests: write
jobs:
update-docs:
# prevents this action from running on forks
if: github.repository == 'sveltejs/ai-tools'
name: Update OpenCode JSON Schema
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
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
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Generate opencode JSON schema
run: pnpm generate-opencode-jsonschema
- name: Check for changes
id: git-check
run: |
git diff --exit-code packages/opencode/schema.json || echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: update opencode JSON schema'
branch: docs/update-opencode-jsonschema
delete-branch: true
title: 'docs: update opencode JSON schema'
body: |
## Summary
Automatically generated update for OpenCode JSON schema.
This PR was triggered by changes to the OpenCode configuration file `packages/opencode/config.ts`.
## Changes
- Updated `packages/opencode/schema.json` with latest JSON schema
## Generated by
GitHub Action: Update OpenCode JSON Schema
labels: |
automated

View File

@@ -0,0 +1,79 @@
name: Update Prompt Documentation
on:
push:
branches:
- main
paths:
- 'packages/mcp-server/src/mcp/handlers/prompts/**'
permissions:
contents: write
pull-requests: write
jobs:
update-docs:
# prevents this action from running on forks
if: github.repository == 'sveltejs/ai-tools'
name: Update Prompt Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
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
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Generate prompt documentation
run: pnpm generate-prompt-docs
- name: Check for changes
id: git-check
run: |
git diff --exit-code documentation/docs/30-capabilities/30-prompts.md || echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'docs: update prompts documentation'
branch: docs/update-prompt-docs
delete-branch: true
title: 'docs: update prompt documentation'
body: |
## Summary
Automatically generated documentation update for MCP prompts.
This PR was triggered by changes to the prompts folder in `packages/mcp-server/src/mcp/handlers/prompts/`.
## Changes
- Updated `documentation/docs/30-capabilities/30-prompts.md` with latest prompt definitions
## Generated by
GitHub Action: Update Prompt Documentation
labels: |
documentation
automated

28
.gitignore vendored
View File

@@ -1,12 +1,16 @@
node_modules
/apps/**/node_modules
/packages/**/node_modules
# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build
/apps/**/.output
/apps/**/.vercel
/apps/**/.netlify
/apps/**/.wrangler
/**/.svelte-kit
/apps/**/build
/apps/**/dist
/packages/**/dist
# OS
.DS_Store
@@ -14,13 +18,25 @@ Thumbs.db
# Env
.env
/apps/**/.env
/packages/**/.env
.env.*
/apps/**/.env.*
/packages/**/.env.*
!.env.example
/apps/**/!.env.example
/packages/**/!.env.example
!.env.test
/apps/**/!.env.test
/packages/**/!.env.test
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/apps/**/vite.config.js.timestamp-*
/apps/**/vite.config.ts.timestamp-*
# SQLite
*.db
/apps/**/*.db
/packages/**/*.db

View File

@@ -1,8 +1,9 @@
{
"mcpServers": {
"svelte-llm": {
"type": "http",
"url": "https://svelte-llm.stanislav.garden/mcp/mcp"
"svelte": {
"type": "stdio",
"command": "node",
"args": ["packages/mcp-stdio/dist/index.js"]
}
}
}

View File

@@ -8,3 +8,10 @@ bun.lockb
# Miscellaneous
/static/
/drizzle/
/**/.svelte-kit/*
# Claude Code
.claude/
.changeset/
/packages/opencode/schema.json

View File

@@ -10,6 +10,12 @@
"options": {
"parser": "svelte"
}
},
{
"files": "**/references/*.md",
"options": {
"embeddedLanguageFormatting": "off"
}
}
]
}

94
.vscode/mcp-snippets.code-snippets vendored Normal file
View File

@@ -0,0 +1,94 @@
{
// Place your svelte-mcp workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Setup Function": {
"scope": "javascript,typescript",
"prefix": "!setup-mcp",
"body": [
"import type { SvelteMcp } from '../../index.js';",
"import * as v from 'valibot';",
"import { icons } from '../../icons/index.js';",
"",
"export function ${1:function_name}(server: SvelteMcp) {",
"\t$0",
"}",
],
"description": "Create a setup function for a tool/resource/prompt handler",
},
"Autofixer": {
"scope": "javascript,typescript",
"prefix": "!autofixer",
"body": [
"import type { Autofixer } from './index.js';",
"export const ${1:autofixer_name}: Autofixer = {",
"\t$0",
"};",
],
"description": "Create a setup export for an autofixer",
},
"Prompt Generator": {
"scope": "javascript,typescript",
"prefix": "!prompt",
"body": [
"import type { SvelteMcp } from '../../index.js';",
"import { icons } from '../../icons/index.js';",
"",
"/**",
" * Function that actually generates the prompt string. You can use this in the MCP server handler to generate the prompt, it can accept arguments",
" * if needed (it will always be invoked manually so it's up to you to provide the arguments).",
" */",
"function ${1:prompt_name}() {",
"\treturn `$0`;",
"}",
"",
"/**",
" * This function is used to generate the prompt to update the docs in the script `/scripts/update-docs-prompts.ts` it should use the default export",
" * function and pass in the arguments. Since it will be included in the documentation if it's an argument that the MCP will expose it should",
" * be in the format [NAME_OF_THE_ARGUMENT] to signal the user that it can substitute it.",
" * ",
" * The name NEEDS to be `generate_for_docs`.",
" */",
"export async function generate_for_docs() {",
"\treturn ${1:prompt_name}();",
"}",
"",
"/**",
" * Human readable description of what the prompt does. It will be included in the documentation.",
" * ",
" * The name NEEDS to be `docs_description`.",
" */",
"export const docs_description = '';",
"",
"export function setup_${1:prompt_name}(server: SvelteMcp) {",
"\tserver.prompt(",
"\t\t{",
"\t\t\tname: '${1:prompt_name}',",
"\t\t\ttitle: '${2:title}',",
"\t\t\tdescription:",
"\t\t\t\t'${3:llm_description}',",
"\t\t\ticons,",
"\t\t},",
"\t\tasync () => {",
"\t\t\treturn {",
"\t\t\t\tmessages: [",
"\t\t\t\t\t{",
"\t\t\t\t\t\trole: 'assistant',",
"\t\t\t\t\t\tcontent: {",
"\t\t\t\t\t\t\ttype: 'text',",
"\t\t\t\t\t\t\ttext: ${1:prompt_name}(),",
"\t\t\t\t\t\t},",
"\t\t\t\t\t},",
"\t\t\t\t],",
"\t\t\t};",
"\t\t},",
"\t);",
"}",
],
"description": "Create a setup export for a prompt generator",
},
}

10
.vscode/mcp.json vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"servers": {
"Svelte MCP": {
"type": "stdio",
"command": "node",
"args": ["packages/mcp-stdio/dist/index.js"]
}
},
"inputs": []
}

View File

@@ -83,19 +83,18 @@ Located in `src/lib/server/analyze/`:
Required environment variables:
- `DATABASE_URL`: SQLite database path (default: `file:test.db`)
- `VOYAGE_API_KEY`: API key for embeddings support (optional)
When connected to the svelte-llm MCP server, you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available MCP Tools:
### 1. list_sections
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get_documentation
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list_sections tool, you MUST analyze the returned documentation sections and then use the get_documentation tool to fetch ALL documentation sections that are relevant for the users task.
After calling the list-sections tool, you MUST analyze the returned documentation sections and then use the get_documentation tool to fetch ALL documentation sections that are relevant for the users task.

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 [Svelte Contributors](https://github.com/sveltejs/ai-tools/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -6,8 +6,32 @@ Repo for the official Svelte MCP server.
```
pnpm i
cp .env.example .env
cp apps/mcp-remote/.env.example apps/mcp-remote/.env
pnpm dev
```
1. Set the VOYAGE_API_KEY for embeddings support
> [!NOTE]
> Currently to prevent having a bunch of Timeout logs on vercel we shut down the SSE channel immediately. This means that we can't use `server.log` and we are not sending `list-changed` notifications. We can use elicitation and sampling since those are sent on the same stream of the POST request
### Local dev tools
#### MCP inspector
```
pnpm run inspect
```
Then visit http://localhost:6274/
- Transport type: `Streamable HTTP`
- http://localhost:5173/mcp
#### Database inspector
```
pnpm run db:studio
```
https://local.drizzle.studio/

View File

@@ -1,2 +1 @@
DATABASE_URL=file:test.db
VOYAGE_API_KEY=your_actual_api_key_here

View File

@@ -0,0 +1,63 @@
{
"name": "@sveltejs/mcp-remote",
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"main": "src/index.js",
"bin": {
"svelte-mcp": "./dist/lib/stdio.js"
},
"scripts": {
"start": "node src/index.js",
"dev": "vite dev",
"build": "vite build",
"build:mcp": "tsc --project tsconfig.build.json",
"prepublishOnly": "pnpm build:mcp",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "prettier --write . && eslint . --fix",
"test:unit": "vitest",
"test": "npm run test:unit -- --run",
"test:watch": "npm run test:unit -- --watch",
"inspect": "pnpm mcp-inspector"
},
"keywords": [
"svelte",
"tmcp",
"mcp",
"server"
],
"private": true,
"devDependencies": {
"@eslint/compat": "catalog:lint",
"@eslint/js": "catalog:lint",
"@modelcontextprotocol/inspector": "catalog:ai",
"@sveltejs/adapter-vercel": "catalog:svelte",
"@sveltejs/kit": "catalog:svelte",
"@sveltejs/vite-plugin-svelte": "catalog:svelte",
"@types/node": "catalog:tooling",
"@typescript-eslint/parser": "catalog:lint",
"eslint-config-prettier": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"globals": "catalog:lint",
"prettier": "catalog:lint",
"prettier-plugin-svelte": "catalog:lint",
"svelte": "catalog:svelte",
"svelte-check": "catalog:svelte",
"svelte-eslint-parser": "catalog:lint",
"typescript": "catalog:tooling",
"vite": "catalog:tooling",
"vite-plugin-devtools-json": "catalog:tooling",
"vitest": "catalog:tooling"
},
"dependencies": {
"@sveltejs/mcp-server": "workspace:^",
"@tmcp/transport-http": "catalog:tmcp",
"@vercel/analytics": "catalog:tooling",
"tmcp": "catalog:tmcp"
}
}

View File

@@ -0,0 +1,27 @@
import { dev } from '$app/environment';
import { http_transport } from '$lib/mcp/index.js';
import { redirect } from '@sveltejs/kit';
import { track } from '@vercel/analytics/server';
export async function handle({ event, resolve }) {
if (event.request.method === 'GET') {
const accept = event.request.headers.get('accept');
if (accept) {
const accepts = accept.split(',');
if (!accepts.includes('text/event-stream')) {
// the request it's a browser request, not an MCP client request
// it means someone probably opened it from the docs...we should redirect to the docs
redirect(302, 'https://svelte.dev/docs/mcp/overview');
}
}
}
const mcp_response = await http_transport.respond(event.request, {
// only add analytics in production
track: dev
? undefined
: async (session_id, event, extra) => {
await track(event, { session_id, ...(extra ? { extra } : {}) });
},
});
return mcp_response ?? resolve(event);
}

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

View File

@@ -0,0 +1,12 @@
import { server } from '@sveltejs/mcp-server';
import { HttpTransport } from '@tmcp/transport-http';
export const http_transport = new HttpTransport(server, {
cors: true,
path: '/mcp',
// we are deploying on vercel the SSE connection will timeout after 5 minutes...for
// the moment we are not sending back any notifications (logs, or list changed notifications)
// so it's a waste of resources to keep a connection open that will error
// after 5 minutes making the logs dirty.
disableSse: true,
});

View File

@@ -0,0 +1 @@
<h1>Official Svelte MCP</h1>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M416.9 93.1c-41.1-58.9-122.4-76.3-181.2-38.9L132.5 120c-28.2 17.7-47.6 46.5-53.5 79.3-4.9 27.3-.6 55.5 12.3 80-8.8 13.4-14.9 28.5-17.7 44.2-5.9 33.4 1.8 67.8 21.6 95.4 41.2 58.9 122.4 76.3 181.2 38.9L379.6 392c28.2-17.7 47.6-46.5 53.5-79.3 4.9-27.3.6-55.5-12.3-80 8.8-13.4 14.9-28.4 17.7-44.2 5.8-33.4-1.9-67.8-21.6-95.4" style="fill:#ff3e00"/><path d="M225.6 424.5c-33.3 8.6-68.4-4.4-88-32.6-11.9-16.6-16.5-37.3-13-57.4.6-3.3 1.4-6.5 2.5-9.6l1.9-5.9 5.3 3.9c12.2 9 25.9 15.8 40.4 20.2l3.8 1.2-.4 3.8c-.5 5.4 1 10.9 4.2 15.3 5.9 8.5 16.5 12.4 26.5 9.8 2.2-.6 4.4-1.5 6.3-2.8l103.2-65.8c5.1-3.2 8.6-8.4 9.7-14.4 1.1-6.1-.3-12.3-3.9-17.3-5.9-8.5-16.5-12.4-26.5-9.8-2.2.6-4.4 1.5-6.3 2.8L252 291c-6.5 4.1-13.5 7.2-21 9.2-33.3 8.6-68.4-4.4-88-32.6-11.9-16.6-16.5-37.3-13-57.4 3.5-19.7 15.2-37 32.2-47.7l103.2-65.8c6.5-4.1 13.5-7.2 21-9.2 33.3-8.6 68.4 4.4 88 32.6 11.9 16.6 16.5 37.3 13 57.4-.6 3.3-1.4 6.5-2.5 9.6L383 193l-5.3-3.9c-12.2-9-25.9-15.8-40.4-20.2l-3.8-1.2.4-3.8c.5-5.4-1-10.9-4.2-15.3-5.9-8.5-16.5-12.4-26.5-9.8-2.2.6-4.4 1.5-6.3 2.8l-103.2 65.8c-5.1 3.2-8.6 8.4-9.7 14.4-1.1 6.1.3 12.3 3.9 17.3 5.9 8.5 16.5 12.4 26.5 9.8 2.2-.6 4.4-1.5 6.3-2.8L260 221c6.5-4.1 13.5-7.2 21-9.2 33.3-8.6 68.4 4.4 88 32.6 11.9 16.6 16.5 37.3 13 57.4-3.5 19.7-15.2 37-32.2 47.7l-103.2 65.8c-6.5 4.1-13.6 7.2-21 9.2" style="fill:#fff"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// To make changes to top-level options such as include and exclude, we recommend extending
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
}

View File

@@ -0,0 +1,22 @@
import devtoolsJson from 'vite-plugin-devtools-json';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit(), devtoolsJson()],
// we don't have tests yet so we just comment this out for now
// test: {
// expect: { requireAssertions: true },
// projects: [
// {
// extends: './vite.config.ts',
// test: {
// name: 'server',
// environment: 'node',
// include: ['src/**/*.{test,spec}.{js,ts}'],
// exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'],
// },
// },
// ],
// },
});

320
docs/tmcp.md Normal file
View File

@@ -0,0 +1,320 @@
> [!WARNING]
> Unfortunately i published the 1.0 by mistake...this package is currently under heavy development so there will be breaking changes in minors...threat this `1.x` as the `0.x` of any other package. Sorry for the disservice, every breaking will be properly labeled in the PR name.
# tmcp
A lightweight, schema-agnostic Model Context Protocol (MCP) server implementation with unified API design.
## Why tmcp?
tmcp offers significant advantages over the official MCP SDK:
- **🔄 Schema Agnostic**: Works with any validation library through adapters
- **📦 No Weird Dependencies**: Minimal footprint with only essential dependencies (looking at you `express`)
- **🎯 Unified API**: Consistent, intuitive interface across all MCP capabilities
- **🔌 Extensible**: Easy to add support for new schema libraries
- **⚡ Lightweight**: No bloat, just what you need
## Supported Schema Libraries
tmcp works with all major schema validation libraries through its adapter system:
- **Zod** - `@tmcp/adapter-zod`
- **Valibot** - `@tmcp/adapter-valibot`
- **ArkType** - `@tmcp/adapter-arktype`
- **Effect Schema** - `@tmcp/adapter-effect`
- **Zod v3** - `@tmcp/adapter-zod-v3`
## Installation
```bash
pnpm install tmcp
# Choose your preferred schema library adapter
pnpm install @tmcp/adapter-zod zod
# Choose your preferred transport
pnpm install @tmcp/transport-stdio # For CLI/desktop apps
pnpm install @tmcp/transport-http # For web-based clients
```
## Quick Start
### Standard I/O Transport (CLI/Desktop)
```javascript
import { McpServer } from 'tmcp';
import { ZodJsonSchemaAdapter } from '@tmcp/adapter-zod';
import { StdioTransport } from '@tmcp/transport-stdio';
import { z } from 'zod';
const adapter = new ZodJsonSchemaAdapter();
const server = new McpServer(
{
name: 'my-server',
version: '1.0.0',
description: 'My awesome MCP server',
},
{
adapter,
capabilities: {
tools: { listChanged: true },
prompts: { listChanged: true },
resources: { listChanged: true },
},
},
);
// Define a tool with type-safe schema
server.tool(
{
name: 'calculate',
description: 'Perform mathematical calculations',
schema: z.object({
operation: z.enum(['add', 'subtract', 'multiply', 'divide']),
a: z.number(),
b: z.number(),
}),
},
async ({ operation, a, b }) => {
switch (operation) {
case 'add':
return a + b;
case 'subtract':
return a - b;
case 'multiply':
return a * b;
case 'divide':
return a / b;
}
},
);
// Start the server with stdio transport
const transport = new StdioTransport(server);
transport.listen();
```
### HTTP Transport (Web-based)
```javascript
import { McpServer } from 'tmcp';
import { ZodJsonSchemaAdapter } from '@tmcp/adapter-zod';
import { HttpTransport } from '@tmcp/transport-http';
import { z } from 'zod';
const adapter = new ZodJsonSchemaAdapter();
const server = new McpServer(/* ... same server config ... */);
// Add tools as above...
// Create HTTP transport
const transport = new HttpTransport(server);
// Use with your preferred HTTP server (Bun example)
Bun.serve({
port: 3000,
async fetch(req) {
const response = await transport.respond(req);
if (response === null) {
return new Response('Not Found', { status: 404 });
}
return response;
},
});
```
## API Reference
### McpServer
The main server class that handles MCP protocol communications.
#### Constructor
```javascript
new McpServer(serverInfo, options);
```
- `serverInfo`: Server metadata (name, version, description)
- `options`: Configuration object with adapter and capabilities
#### Methods
##### `tool(definition, handler)`
Register a tool with optional schema validation.
```javascript
server.tool(
{
name: 'tool-name',
description: 'Tool description',
schema: yourSchema, // optional
},
async (input) => {
// Tool implementation
return result;
},
);
```
##### `prompt(definition, handler)`
Register a prompt template with optional schema validation.
```javascript
server.prompt(
{
name: 'prompt-name',
description: 'Prompt description',
schema: yourSchema, // optional
complete: (arg, context) => ['completion1', 'completion2'] // optional
},
async (input) => {
// Prompt implementation
return { messages: [...] };
}
);
```
##### `resource(definition, handler)`
Register a static resource.
```javascript
server.resource(
{
name: 'resource-name',
description: 'Resource description',
uri: 'file://path/to/resource'
},
async (uri, params) => {
// Resource implementation
return { contents: [...] };
}
);
```
##### `template(definition, handler)`
Register a URI template for dynamic resources.
```javascript
server.template(
{
name: 'template-name',
description: 'Template description',
uri: 'file://path/{id}/resource',
complete: (arg, context) => ['id1', 'id2'] // optional
},
async (uri, params) => {
// Template implementation using params.id
return { contents: [...] };
}
);
```
##### `receive(request)`
Process an incoming MCP request.
```javascript
const response = server.receive(jsonRpcRequest);
```
## Advanced Examples
### Multiple Schema Libraries
```javascript
// Use different schemas for different tools
import { z } from 'zod';
import * as v from 'valibot';
server.tool(
{
name: 'zod-tool',
schema: z.object({ name: z.string() }),
},
async ({ name }) => `Hello ${name}`,
);
server.tool(
{
name: 'valibot-tool',
schema: v.object({ age: v.number() }),
},
async ({ age }) => `Age: ${age}`,
);
```
### Resource Templates with Completion
```javascript
server.template(
{
name: 'user-profile',
description: 'Get user profile by ID',
uri: 'users/{userId}/profile',
complete: (arg, context) => {
// Provide completions for userId parameter
return ['user1', 'user2', 'user3'];
},
},
async (uri, params) => {
const user = await getUserById(params.userId);
return {
contents: [
{
uri,
mimeType: 'application/json',
text: JSON.stringify(user),
},
],
};
},
);
```
### Complex Validation
```javascript
const complexSchema = z.object({
user: z.object({
name: z.string().min(1),
email: z.string().email(),
age: z.number().min(18).max(120),
}),
preferences: z
.object({
theme: z.enum(['light', 'dark']),
notifications: z.boolean(),
})
.optional(),
tags: z.array(z.string()).default([]),
});
server.tool(
{
name: 'create-user',
description: 'Create a new user with preferences',
schema: complexSchema,
},
async (input) => {
// Input is fully typed and validated
const { user, preferences, tags } = input;
return await createUser(user, preferences, tags);
},
);
```
## Contributing
Contributions are welcome! Please see our [contributing guidelines](../../CONTRIBUTING.md) for details.
## Acknowledgments
Huge thanks to Sean O'Bannon that provided us with the `@tmcp` scope on npm.
## License
MIT © Paolo Ricciuti

View File

@@ -0,0 +1,12 @@
---
title: Overview
---
The following pages will help you set up and use the AI tools officially maintained by the Svelte team.
There are four tools, designed to help your agent write correct, robust Svelte code. They are designed to work together, but each can be used individually:
- [Instructions](instructions): small prompt always injected into your session to make your agent more aware of the available tools
- [MCP Server](mcp): with tools, prompts and resources to give your agent more context, by pulling directly from the official Svelte documentation and using static analysis to correct common generative AI pitfalls
- [Skills](skills): lazy-loaded descriptions that teach your agent Svelte best practices, and how to use the [`@sveltejs/mcp` cli](cli)
- [Subagents](subagent): focused agents that can be invoked in parallel to execute atomic operations in a separate context window

View File

@@ -0,0 +1,3 @@
---
title: Introduction
---

View File

@@ -0,0 +1,23 @@
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available Svelte MCP Tools:
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
### 3. svelte-autofixer
Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
### 4. playground-link
Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

View File

@@ -0,0 +1,13 @@
---
title: AGENTS.md
---
To get the most out of the [MCP server](mcp) and [skills](skills) we recommend including the following prompt in your [`AGENTS.md`](https://agents.md) (or [`CLAUDE.md`](https://docs.claude.com/en/docs/claude-code/memory#claude-md-imports) or [`GEMINI.md`](https://geminicli.com/docs/cli/gemini-md/), if using Claude Code or Gemini). This will tell your agent which tools are available and when it is appropriate to use them.
> [!NOTE] This is already setup for you when using `npx sv add mcp`
<!-- prettier-ignore-start -->
````markdown
@include .generated/agents.md
````
<!-- prettier-ignore-end -->

View File

@@ -0,0 +1,3 @@
---
title: Instructions
---

View File

@@ -0,0 +1,213 @@
## svelte-task
This prompt should be used whenever you are asking the model to work on a Svelte-related task. It will instruct the LLM which documentation sections are available, which tools to invoke, when to invoke them, and how to interpret the results.
<details>
<summary>Copy the prompt</summary>
<!-- prettier-ignore-start -->
````markdown
You are a Svelte expert tasked to build components and utilities for Svelte developers. If you need documentation for anything related to Svelte you can invoke the tool `get-documentation` with one of the following paths. However: before invoking the `get-documentation` tool, try to answer the users query using your own knowledge and the `svelte-autofixer` tool. Be mindful of how many section you request, since it is token-intensive!
<available-docs>
- title: Overview, use_cases: use title and path to estimate use case, path: ai/overview
- title: Local setup, use_cases: use title and path to estimate use case, path: ai/local-setup
- title: Remote setup, use_cases: use title and path to estimate use case, path: ai/remote-setup
- title: Tools, use_cases: use title and path to estimate use case, path: ai/tools
- title: Resources, use_cases: use title and path to estimate use case, path: ai/resources
- title: Prompts, use_cases: use title and path to estimate use case, path: ai/prompts
- title: Overview, use_cases: use title and path to estimate use case, path: ai/plugin
- title: Subagent, use_cases: use title and path to estimate use case, path: ai/subagent
- title: Overview, use_cases: use title and path to estimate use case, path: ai/opencode-plugin
- title: Subagent, use_cases: use title and path to estimate use case, path: ai/opencode-subagent
- title: Overview, use_cases: use title and path to estimate use case, path: ai/skills
- title: Overview, use_cases: project setup, creating new svelte apps, scaffolding, cli tools, initializing projects, path: cli/overview
- title: Frequently asked questions, use_cases: project setup, initializing new svelte projects, troubleshooting cli installation, package manager configuration, path: cli/faq
- title: sv create, use_cases: project setup, starting new sveltekit app, initializing project, creating from playground, choosing project template, path: cli/sv-create
- title: sv add, use_cases: project setup, adding features to existing projects, integrating tools, testing setup, styling setup, authentication, database setup, deployment adapters, path: cli/sv-add
- title: sv check, use_cases: code quality, ci/cd pipelines, error checking, typescript projects, pre-commit hooks, finding unused css, accessibility auditing, production builds, path: cli/sv-check
- title: sv migrate, use_cases: migration, upgrading svelte versions, upgrading sveltekit versions, modernizing codebase, svelte 3 to 4, svelte 4 to 5, sveltekit 1 to 2, adopting runes, refactoring deprecated apis, path: cli/sv-migrate
- title: devtools-json, use_cases: development setup, chrome devtools integration, browser-based editing, local development workflow, debugging setup, path: cli/devtools-json
- title: drizzle, use_cases: database setup, sql queries, orm integration, data modeling, postgresql, mysql, sqlite, server-side data access, database migrations, type-safe queries, path: cli/drizzle
- title: eslint, use_cases: code quality, linting, error detection, project setup, code standards, team collaboration, typescript projects, path: cli/eslint
- title: better-auth, use_cases: use title and path to estimate use case, path: cli/better-auth
- title: mcp, use_cases: use title and path to estimate use case, path: cli/mcp
- title: mdsvex, use_cases: blog, content sites, markdown rendering, documentation sites, technical writing, cms integration, article pages, path: cli/mdsvex
- title: paraglide, use_cases: internationalization, multi-language sites, i18n, translation, localization, language switching, global apps, multilingual content, path: cli/paraglide
- title: playwright, use_cases: browser testing, e2e testing, integration testing, test automation, quality assurance, ci/cd pipelines, testing user flows, path: cli/playwright
- title: prettier, use_cases: code formatting, project setup, code style consistency, team collaboration, linting configuration, path: cli/prettier
- title: storybook, use_cases: component development, design systems, ui library, isolated component testing, documentation, visual testing, component showcase, path: cli/storybook
- title: sveltekit-adapter, use_cases: deployment, production builds, hosting setup, choosing deployment platform, configuring adapters, static site generation, node server, vercel, cloudflare, netlify, path: cli/sveltekit-adapter
- title: tailwindcss, use_cases: project setup, styling, css framework, rapid prototyping, utility-first css, design systems, responsive design, adding tailwind to svelte, path: cli/tailwind
- title: vitest, use_cases: testing, unit tests, component testing, test setup, quality assurance, ci/cd pipelines, test-driven development, path: cli/vitest
- title: add-on, use_cases: use title and path to estimate use case, path: cli/add-on
- title: sv-utils, use_cases: use title and path to estimate use case, path: cli/sv-utils
- title: Introduction, use_cases: learning sveltekit, project setup, understanding framework basics, choosing between svelte and sveltekit, getting started with full-stack apps, path: kit/introduction
- title: Creating a project, use_cases: project setup, starting new sveltekit app, initial development environment, first-time sveltekit users, scaffolding projects, path: kit/creating-a-project
- title: Project types, use_cases: deployment, project setup, choosing adapters, ssg, spa, ssr, serverless, mobile apps, desktop apps, pwa, offline apps, browser extensions, separate backend, docker containers, path: kit/project-types
- title: Project structure, use_cases: project setup, understanding file structure, organizing code, starting new project, learning sveltekit basics, path: kit/project-structure
- title: Web standards, use_cases: always, any sveltekit project, data fetching, forms, api routes, server-side rendering, deployment to various platforms, path: kit/web-standards
- title: Routing, use_cases: routing, navigation, multi-page apps, project setup, file structure, api endpoints, data loading, layouts, error pages, always, path: kit/routing
- title: Loading data, use_cases: data fetching, api calls, database queries, dynamic routes, page initialization, loading states, authentication checks, ssr data, form data, content rendering, path: kit/load
- title: Form actions, use_cases: forms, user input, data submission, authentication, login systems, user registration, progressive enhancement, validation errors, path: kit/form-actions
- title: Page options, use_cases: prerendering static sites, ssr configuration, spa setup, client-side rendering control, url trailing slash handling, adapter deployment config, build optimization, path: kit/page-options
- title: State management, use_cases: sveltekit, server-side rendering, ssr, state management, authentication, data persistence, load functions, context api, navigation, component lifecycle, path: kit/state-management
- title: Remote functions, use_cases: data fetching, server-side logic, database queries, type-safe client-server communication, forms, user input, mutations, authentication, crud operations, optimistic updates, path: kit/remote-functions
- title: Building your app, use_cases: production builds, deployment preparation, build process optimization, adapter configuration, preview before deployment, path: kit/building-your-app
- title: Adapters, use_cases: deployment, production builds, hosting setup, choosing deployment platform, configuring adapters, path: kit/adapters
- title: Zero-config deployments, use_cases: deployment, production builds, hosting setup, choosing deployment platform, ci/cd configuration, path: kit/adapter-auto
- title: Node servers, use_cases: deployment, production builds, node.js hosting, custom server setup, environment configuration, reverse proxy setup, docker deployment, systemd services, path: kit/adapter-node
- title: Static site generation, use_cases: static site generation, ssg, prerendering, deployment, github pages, spa mode, blogs, documentation sites, marketing sites, path: kit/adapter-static
- title: Single-page apps, use_cases: spa mode, single-page apps, client-only rendering, static hosting, mobile app wrappers, no server-side logic, adapter-static setup, fallback pages, path: kit/single-page-apps
- title: Cloudflare, use_cases: deployment, cloudflare workers, cloudflare pages, hosting setup, production builds, serverless deployment, edge computing, path: kit/adapter-cloudflare
- title: Cloudflare Workers, use_cases: deploying to cloudflare workers, cloudflare workers sites deployment, legacy cloudflare adapter, wrangler configuration, cloudflare platform bindings, path: kit/adapter-cloudflare-workers
- title: Netlify, use_cases: deployment, netlify hosting, production builds, serverless functions, edge functions, static site hosting, path: kit/adapter-netlify
- title: Vercel, use_cases: deployment, vercel hosting, production builds, serverless functions, edge functions, isr, image optimization, environment variables, path: kit/adapter-vercel
- title: Writing adapters, use_cases: custom deployment, building adapters, unsupported platforms, adapter development, custom hosting environments, path: kit/writing-adapters
- title: Advanced routing, use_cases: advanced routing, dynamic routes, file viewers, nested paths, custom 404 pages, url validation, route parameters, multi-level navigation, path: kit/advanced-routing
- title: Hooks, use_cases: authentication, logging, error tracking, request interception, api proxying, custom routing, internationalization, database initialization, middleware logic, session management, path: kit/hooks
- title: Errors, use_cases: error handling, custom error pages, 404 pages, api error responses, production error logging, error tracking, type-safe errors, path: kit/errors
- title: Link options, use_cases: routing, navigation, multi-page apps, performance optimization, link preloading, forms with get method, search functionality, focus management, scroll behavior, path: kit/link-options
- title: Service workers, use_cases: offline support, pwa, caching strategies, performance optimization, precaching assets, network resilience, progressive web apps, path: kit/service-workers
- title: Server-only modules, use_cases: api keys, environment variables, sensitive data protection, backend security, preventing data leaks, server-side code isolation, path: kit/server-only-modules
- title: Snapshots, use_cases: forms, user input, preserving form data, multi-step forms, navigation state, preventing data loss, textarea content, input fields, comment systems, surveys, path: kit/snapshots
- title: Shallow routing, use_cases: modals, dialogs, image galleries, overlays, history-driven ui, mobile-friendly navigation, photo viewers, lightboxes, drawer menus, path: kit/shallow-routing
- title: Observability, use_cases: performance monitoring, debugging, observability, tracing requests, production diagnostics, analyzing slow requests, finding bottlenecks, monitoring server-side operations, path: kit/observability
- title: Packaging, use_cases: building component libraries, publishing npm packages, creating reusable svelte components, library development, package distribution, path: kit/packaging
- title: Auth, use_cases: authentication, login systems, user management, session handling, jwt tokens, protected routes, user credentials, authorization checks, path: kit/auth
- title: Performance, use_cases: performance optimization, slow loading pages, production deployment, debugging performance issues, reducing bundle size, improving load times, path: kit/performance
- title: Icons, use_cases: icons, ui components, styling, css frameworks, tailwind, unocss, performance optimization, dependency management, path: kit/icons
- title: Images, use_cases: image optimization, responsive images, performance, hero images, product photos, galleries, cms integration, cdn setup, asset management, path: kit/images
- title: Accessibility, use_cases: always, any sveltekit project, screen reader support, keyboard navigation, multi-page apps, client-side routing, internationalization, multilingual sites, path: kit/accessibility
- title: SEO, use_cases: seo optimization, search engine ranking, content sites, blogs, marketing sites, public-facing apps, sitemaps, amp pages, meta tags, performance optimization, path: kit/seo
- title: Frequently asked questions, use_cases: troubleshooting package imports, library compatibility issues, client-side code execution, external api integration, middleware setup, database configuration, view transitions, yarn configuration, path: kit/faq
- title: Integrations, use_cases: project setup, css preprocessors, postcss, scss, sass, less, stylus, typescript setup, adding integrations, tailwind, testing, auth, linting, formatting, path: kit/integrations
- title: Breakpoint Debugging, use_cases: debugging, breakpoints, development workflow, troubleshooting issues, vscode setup, ide configuration, inspecting code execution, path: kit/debugging
- title: Migrating to SvelteKit v2, use_cases: migration, upgrading from sveltekit 1 to 2, breaking changes, version updates, path: kit/migrating-to-sveltekit-2
- title: Migrating from Sapper, use_cases: migrating from sapper, upgrading legacy projects, sapper to sveltekit conversion, project modernization, path: kit/migrating
- title: Additional resources, use_cases: troubleshooting, getting help, finding examples, learning sveltekit, project templates, common issues, community support, path: kit/additional-resources
- title: Glossary, use_cases: rendering strategies, performance optimization, deployment configuration, seo requirements, static sites, spas, server-side rendering, prerendering, edge deployment, pwa development, path: kit/glossary
- title: @sveltejs/kit, use_cases: forms, form actions, server-side validation, form submission, error handling, redirects, json responses, http errors, server utilities, path: kit/@sveltejs-kit
- title: @sveltejs/kit/hooks, use_cases: middleware, request processing, authentication chains, logging, multiple hooks, request/response transformation, path: kit/@sveltejs-kit-hooks
- title: @sveltejs/kit/node/polyfills, use_cases: node.js environments, custom servers, non-standard runtimes, ssr setup, web api compatibility, polyfill requirements, path: kit/@sveltejs-kit-node-polyfills
- title: @sveltejs/kit/node, use_cases: node.js adapter, custom server setup, http integration, streaming files, node deployment, server-side rendering with node, path: kit/@sveltejs-kit-node
- title: @sveltejs/kit/vite, use_cases: project setup, vite configuration, initial sveltekit setup, build tooling, path: kit/@sveltejs-kit-vite
- title: $app/environment, use_cases: always, conditional logic, client-side code, server-side code, build-time logic, prerendering, development vs production, environment detection, path: kit/$app-environment
- title: $app/forms, use_cases: forms, user input, data submission, progressive enhancement, custom form handling, form validation, path: kit/$app-forms
- title: $app/navigation, use_cases: routing, navigation, multi-page apps, programmatic navigation, data reloading, preloading, shallow routing, navigation lifecycle, scroll handling, view transitions, path: kit/$app-navigation
- title: $app/paths, use_cases: static assets, images, fonts, public files, base path configuration, subdirectory deployment, cdn setup, asset urls, links, navigation, path: kit/$app-paths
- title: $app/server, use_cases: remote functions, server-side logic, data fetching, form handling, api endpoints, client-server communication, prerendering, file reading, batch queries, path: kit/$app-server
- title: $app/state, use_cases: routing, navigation, multi-page apps, loading states, url parameters, form handling, error states, version updates, page metadata, shallow routing, path: kit/$app-state
- title: $app/stores, use_cases: legacy projects, sveltekit pre-2.12, migration from stores to runes, maintaining older codebases, accessing page data, navigation state, app version updates, path: kit/$app-stores
- title: $app/types, use_cases: routing, navigation, type safety, route parameters, dynamic routes, link generation, pathname validation, multi-page apps, path: kit/$app-types
- title: $env/dynamic/private, use_cases: api keys, secrets management, server-side config, environment variables, backend logic, deployment-specific settings, private data handling, path: kit/$env-dynamic-private
- title: $env/dynamic/public, use_cases: environment variables, client-side config, runtime configuration, public api keys, deployment-specific settings, multi-environment apps, path: kit/$env-dynamic-public
- title: $env/static/private, use_cases: server-side api keys, backend secrets, database credentials, private configuration, build-time optimization, server endpoints, authentication tokens, path: kit/$env-static-private
- title: $env/static/public, use_cases: environment variables, public config, client-side data, api endpoints, build-time configuration, public constants, path: kit/$env-static-public
- title: $lib, use_cases: project setup, component organization, importing shared components, reusable ui elements, code structure, path: kit/$lib
- title: $service-worker, use_cases: offline support, pwa, service workers, caching strategies, progressive web apps, offline-first apps, path: kit/$service-worker
- title: Configuration, use_cases: project setup, configuration, adapters, deployment, build settings, environment variables, routing customization, prerendering, csp security, csrf protection, path configuration, typescript setup, path: kit/configuration
- title: Command Line Interface, use_cases: project setup, typescript configuration, generated types, ./$types imports, initial project configuration, path: kit/cli
- title: Types, use_cases: typescript, type safety, route parameters, api endpoints, load functions, form actions, generated types, jsconfig setup, path: kit/types
- title: Overview, use_cases: always, any svelte project, getting started, learning svelte, introduction, project setup, understanding framework basics, path: svelte/overview
- title: Getting started, use_cases: project setup, starting new svelte project, initial installation, choosing between sveltekit and vite, editor configuration, path: svelte/getting-started
- title: .svelte files, use_cases: always, any svelte project, component creation, project setup, learning svelte basics, path: svelte/svelte-files
- title: .svelte.js and .svelte.ts files, use_cases: shared reactive state, reusable reactive logic, state management across components, global stores, custom reactive utilities, path: svelte/svelte-js-files
- title: What are runes?, use_cases: always, any svelte 5 project, understanding core syntax, learning svelte 5, migration from svelte 4, path: svelte/what-are-runes
- title: $state, use_cases: always, any svelte project, core reactivity, state management, counters, forms, todo apps, interactive ui, data updates, class-based components, path: svelte/$state
- title: $derived, use_cases: always, any svelte project, computed values, reactive calculations, derived data, transforming state, dependent values, path: svelte/$derived
- title: $effect, use_cases: canvas drawing, third-party library integration, dom manipulation, side effects, intervals, timers, network requests, analytics tracking, path: svelte/$effect
- title: $props, use_cases: always, any svelte project, passing data to components, component communication, reusable components, component props, path: svelte/$props
- title: $bindable, use_cases: forms, user input, two-way data binding, custom input components, parent-child communication, reusable form fields, path: svelte/$bindable
- title: $inspect, use_cases: debugging, development, tracking state changes, reactive state monitoring, troubleshooting reactivity issues, path: svelte/$inspect
- title: $host, use_cases: custom elements, web components, dispatching custom events, component library, framework-agnostic components, path: svelte/$host
- title: Basic markup, use_cases: always, any svelte project, basic markup, html templating, component structure, attributes, events, props, text rendering, path: svelte/basic-markup
- title: {#if ...}, use_cases: always, conditional rendering, showing/hiding content, dynamic ui, user permissions, loading states, error handling, form validation, path: svelte/if
- title: {#each ...}, use_cases: always, lists, arrays, iteration, product listings, todos, tables, grids, dynamic content, shopping carts, user lists, comments, feeds, path: svelte/each
- title: {#key ...}, use_cases: animations, transitions, component reinitialization, forcing component remount, value-based ui updates, resetting component state, path: svelte/key
- title: {#await ...}, use_cases: async data fetching, api calls, loading states, promises, error handling, lazy loading components, dynamic imports, path: svelte/await
- title: {#snippet ...}, use_cases: reusable markup, component composition, passing content to components, table rows, list items, conditional rendering, reducing duplication, path: svelte/snippet
- title: {@render ...}, use_cases: reusable ui patterns, component composition, conditional rendering, fallback content, layout components, slot alternatives, template reuse, path: svelte/@render
- title: {@html ...}, use_cases: rendering html strings, cms content, rich text editors, markdown to html, blog posts, wysiwyg output, sanitized html injection, dynamic html content, path: svelte/@html
- title: {@attach ...}, use_cases: tooltips, popovers, dom manipulation, third-party libraries, canvas drawing, element lifecycle, interactive ui, custom directives, wrapper components, path: svelte/@attach
- title: {@const ...}, use_cases: computed values in loops, derived calculations in blocks, local variables in each iterations, complex list rendering, path: svelte/@const
- title: {@debug ...}, use_cases: debugging, development, troubleshooting, tracking state changes, monitoring variables, reactive data inspection, path: svelte/@debug
- title: bind:, use_cases: forms, user input, two-way data binding, interactive ui, media players, file uploads, checkboxes, radio buttons, select dropdowns, contenteditable, dimension tracking, path: svelte/bind
- title: use:, use_cases: custom directives, dom manipulation, third-party library integration, tooltips, click outside, gestures, focus management, element lifecycle hooks, path: svelte/use
- title: transition:, use_cases: animations, interactive ui, modals, dropdowns, notifications, conditional content, show/hide elements, smooth state changes, path: svelte/transition
- title: in: and out:, use_cases: animation, transitions, interactive ui, conditional rendering, independent enter/exit effects, modals, tooltips, notifications, path: svelte/in-and-out
- title: animate:, use_cases: sortable lists, drag and drop, reorderable items, todo lists, kanban boards, playlist editors, priority queues, animated list reordering, path: svelte/animate
- title: style:, use_cases: dynamic styling, conditional styles, theming, dark mode, responsive design, interactive ui, component styling, path: svelte/style
- title: class, use_cases: always, conditional styling, dynamic classes, tailwind css, component styling, reusable components, responsive design, path: svelte/class
- title: await, use_cases: async data fetching, loading states, server-side rendering, awaiting promises in components, async validation, concurrent data loading, path: svelte/await-expressions
- title: Scoped styles, use_cases: always, styling components, scoped css, component-specific styles, preventing style conflicts, animations, keyframes, path: svelte/scoped-styles
- title: Global styles, use_cases: global styles, third-party libraries, css resets, animations, styling body/html, overriding component styles, shared keyframes, base styles, path: svelte/global-styles
- title: Custom properties, use_cases: theming, custom styling, reusable components, design systems, dynamic colors, component libraries, ui customization, path: svelte/custom-properties
- title: Nested <style> elements, use_cases: component styling, scoped styles, dynamic styles, conditional styling, nested style tags, custom styling logic, path: svelte/nested-style-elements
- title: <svelte:boundary>, use_cases: error handling, async data loading, loading states, error recovery, flaky components, error reporting, resilient ui, path: svelte/svelte-boundary
- title: <svelte:window>, use_cases: keyboard shortcuts, scroll tracking, window resize handling, responsive layouts, online/offline detection, viewport dimensions, global event listeners, path: svelte/svelte-window
- title: <svelte:document>, use_cases: document events, visibility tracking, fullscreen detection, pointer lock, focus management, document-level interactions, path: svelte/svelte-document
- title: <svelte:body>, use_cases: mouse tracking, hover effects, cursor interactions, global body events, drag and drop, custom cursors, interactive backgrounds, body-level actions, path: svelte/svelte-body
- title: <svelte:head>, use_cases: seo optimization, page titles, meta tags, social media sharing, dynamic head content, multi-page apps, blog posts, product pages, path: svelte/svelte-head
- title: <svelte:element>, use_cases: dynamic content, cms integration, user-generated content, configurable ui, runtime element selection, flexible components, path: svelte/svelte-element
- title: <svelte:options>, use_cases: migration, custom elements, web components, legacy mode compatibility, runes mode setup, svg components, mathml components, css injection control, path: svelte/svelte-options
- title: Stores, use_cases: shared state, cross-component data, reactive values, async data streams, manual control over updates, rxjs integration, extracting logic, path: svelte/stores
- title: Context, use_cases: shared state, avoiding prop drilling, component communication, theme providers, user context, authentication state, configuration sharing, deeply nested components, path: svelte/context
- title: Lifecycle hooks, use_cases: component initialization, cleanup tasks, timers, subscriptions, dom measurements, chat windows, autoscroll features, migration from svelte 4, path: svelte/lifecycle-hooks
- title: Imperative component API, use_cases: project setup, client-side rendering, server-side rendering, ssr, hydration, testing, programmatic component creation, tooltips, dynamic mounting, path: svelte/imperative-component-api
- title: Hydratable data, use_cases: use title and path to estimate use case, path: svelte/hydratable
- title: Best practices, use_cases: use title and path to estimate use case, path: svelte/best-practices
- title: Testing, use_cases: testing, quality assurance, unit tests, integration tests, component tests, e2e tests, vitest setup, playwright setup, test automation, path: svelte/testing
- title: TypeScript, use_cases: typescript setup, type safety, component props typing, generic components, wrapper components, dom type augmentation, project configuration, path: svelte/typescript
- title: Custom elements, use_cases: web components, custom elements, component library, design system, framework-agnostic components, embedding svelte in non-svelte apps, shadow dom, path: svelte/custom-elements
- title: Svelte 4 migration guide, use_cases: upgrading svelte 3 to 4, version migration, updating dependencies, breaking changes, legacy project maintenance, path: svelte/v4-migration-guide
- title: Svelte 5 migration guide, use_cases: migrating from svelte 4 to 5, upgrading projects, learning svelte 5 syntax changes, runes migration, event handler updates, path: svelte/v5-migration-guide
- title: Frequently asked questions, use_cases: getting started, learning svelte, beginner setup, project initialization, vs code setup, formatting, testing, routing, mobile apps, troubleshooting, community support, path: svelte/faq
- title: svelte, use_cases: migration from svelte 4 to 5, upgrading legacy code, component lifecycle hooks, context api, mounting components, event dispatchers, typescript component types, path: svelte/svelte
- title: svelte/action, use_cases: typescript types, actions, use directive, dom manipulation, element lifecycle, custom behaviors, third-party library integration, path: svelte/svelte-action
- title: svelte/animate, use_cases: animated lists, sortable items, drag and drop, reordering elements, todo lists, kanban boards, playlist management, smooth position transitions, path: svelte/svelte-animate
- title: svelte/attachments, use_cases: library development, component libraries, programmatic element manipulation, migrating from actions to attachments, spreading props onto elements, path: svelte/svelte-attachments
- title: svelte/compiler, use_cases: build tools, custom compilers, ast manipulation, preprocessors, code transformation, migration scripts, syntax analysis, bundler plugins, dev tools, path: svelte/svelte-compiler
- title: svelte/easing, use_cases: animations, transitions, custom easing, smooth motion, interactive ui, modals, dropdowns, carousels, page transitions, scroll effects, path: svelte/svelte-easing
- title: svelte/events, use_cases: window events, document events, global event listeners, event delegation, programmatic event handling, cleanup functions, media queries, path: svelte/svelte-events
- title: svelte/legacy, use_cases: migration from svelte 4 to svelte 5, upgrading legacy code, event modifiers, class components, imperative component instantiation, path: svelte/svelte-legacy
- title: svelte/motion, use_cases: animation, smooth transitions, interactive ui, sliders, counters, physics-based motion, drag gestures, accessibility, reduced motion, path: svelte/svelte-motion
- title: svelte/reactivity/window, use_cases: responsive design, viewport tracking, scroll effects, window resize handling, online/offline detection, zoom level tracking, path: svelte/svelte-reactivity-window
- title: svelte/reactivity, use_cases: reactive data structures, state management with maps/sets, game boards, selection tracking, url manipulation, query params, real-time clocks, media queries, responsive design, path: svelte/svelte-reactivity
- title: svelte/server, use_cases: server-side rendering, ssr, static site generation, seo optimization, initial page load, pre-rendering, node.js server, custom server setup, path: svelte/svelte-server
- title: svelte/store, use_cases: state management, shared data, reactive stores, cross-component communication, global state, computed values, data synchronization, legacy svelte projects, path: svelte/svelte-store
- title: svelte/transition, use_cases: animations, transitions, interactive ui, modals, dropdowns, tooltips, notifications, svg animations, list animations, page transitions, path: svelte/svelte-transition
- title: Compiler errors, use_cases: animation, transitions, keyed each blocks, list animations, path: svelte/compiler-errors
- title: Compiler warnings, use_cases: accessibility, a11y compliance, wcag standards, screen readers, keyboard navigation, aria attributes, semantic html, interactive elements, path: svelte/compiler-warnings
- title: Runtime errors, use_cases: debugging errors, error handling, troubleshooting runtime issues, migration to svelte 5, component binding, effects and reactivity, path: svelte/runtime-errors
- title: Runtime warnings, use_cases: debugging state proxies, console logging reactive values, inspecting state changes, development troubleshooting, path: svelte/runtime-warnings
- title: Overview, use_cases: migrating from svelte 3/4 to svelte 5, maintaining legacy components, understanding deprecated features, gradual upgrade process, path: svelte/legacy-overview
- title: Reactive let/var declarations, use_cases: migration, legacy svelte projects, upgrading from svelte 4, understanding old reactivity, maintaining existing code, learning runes differences, path: svelte/legacy-let
- title: Reactive $: statements, use_cases: legacy mode, migration from svelte 4, reactive statements, computed values, derived state, side effects, path: svelte/legacy-reactive-assignments
- title: export let, use_cases: legacy mode, migration from svelte 4, maintaining older projects, component props without runes, exporting component methods, renaming reserved word props, path: svelte/legacy-export-let
- title: $$props and $$restProps, use_cases: legacy mode migration, component wrappers, prop forwarding, button components, reusable ui components, spreading props to child elements, path: svelte/legacy-$$props-and-$$restProps
- title: on:, use_cases: legacy mode, event handling, button clicks, forms, user interactions, component communication, event forwarding, event modifiers, path: svelte/legacy-on
- title: <slot>, use_cases: legacy mode, migrating from svelte 4, component composition, reusable components, passing content to components, modals, layouts, wrappers, path: svelte/legacy-slots
- title: $$slots, use_cases: legacy mode, conditional slot rendering, optional content sections, checking if slots provided, migrating from legacy to runes, path: svelte/legacy-$$slots
- title: <svelte:fragment>, use_cases: named slots, component composition, layout systems, avoiding wrapper divs, legacy svelte projects, slot content organization, path: svelte/legacy-svelte-fragment
- title: <svelte:component>, use_cases: dynamic components, component switching, conditional rendering, legacy mode migration, tabbed interfaces, multi-step forms, path: svelte/legacy-svelte-component
- title: <svelte:self>, use_cases: recursive components, tree structures, nested menus, file explorers, comment threads, hierarchical data, path: svelte/legacy-svelte-self
- title: Imperative component API, use_cases: migration from svelte 3/4 to 5, legacy component api, maintaining old projects, understanding deprecated patterns, path: svelte/legacy-component-api
</available-docs>
These are the available documentation sections that `list-sections` will return, you do not need to call it again.
Every time you write a Svelte component or a Svelte module you MUST invoke the `svelte-autofixer` tool providing the code. The tool will return a list of issues or suggestions. If there are any issues or suggestions you MUST fix them and call the tool again with the updated code. You MUST keep doing this until the tool returns no issues or suggestions. Only then you can return the code to the user.
This is the task you will work on:
<task>
[YOUR TASK HERE]
</task>
If you are not writing the code into a file, once you have the final version of the code ask the user if it wants to generate a playground link to quickly check the code in it and if it answer yes call the `playground-link` tool and return the url to the user nicely formatted. The playground link MUST be generated only once you have the final version of the code and you are ready to share it, it MUST include an entry point file called `App.svelte` where the main component should live. If you have multiple files to include in the playground link you can include them all at the root.
````
<!-- prettier-ignore-end -->
</details>

View File

@@ -0,0 +1,16 @@
---
title: Overview
---
The Svelte MCP ([Model Context Protocol](https://modelcontextprotocol.io/docs/getting-started/intro)) server can help your agent write better Svelte code. It works by providing relevant documentation, and statically analysing generated code so that it can suggest fixes and best practices.
## Setup
The setup varies based on the version of the MCP you prefer — remote or local — and your chosen MCP client (e.g. Claude Code, Codex CLI or GitHub Copilot):
- [local setup](local-setup) using `@sveltejs/mcp`
- [remote setup](remote-setup) using `https://mcp.svelte.dev/mcp`
## Usage
If your MCP client supports it, we also recommend using the [svelte-task](prompts#svelte-task) prompt to instruct the LLM on the best way to use the MCP server.

View File

@@ -0,0 +1,163 @@
---
title: Local setup
---
The local (or stdio) version of the MCP server is available via the [`@sveltejs/mcp`](https://www.npmjs.com/package/@sveltejs/mcp) npm package. You can either install it globally and then reference it in your configuration or run it with `npx`:
```bash
npx -y @sveltejs/mcp
```
Here's how to set it up in some common MCP clients:
## Claude Code
To include the local MCP version in Claude Code, simply run the following command:
```bash
claude mcp add -t stdio -s [scope] svelte -- npx -y @sveltejs/mcp
```
The `[scope]` must be `user`, `project` or `local`.
## Claude Desktop
In the Settings > Developer section, click on Edit Config. It will open the folder with a `claude_desktop_config.json` file in it. Edit the file to include the following configuration:
```json
{
"mcpServers": {
"svelte": {
"command": "npx",
"args": ["-y", "@sveltejs/mcp"]
}
}
}
```
## Codex CLI
Add the following to your `config.toml` (which defaults to `~/.codex/config.toml`, but refer to [the configuration documentation](https://github.com/openai/codex/blob/main/docs/config.md) for more advanced setups):
```toml
[mcp_servers.svelte]
command = "npx"
args = ["-y", "@sveltejs/mcp"]
```
## Copilot CLI
Use the Copilot CLI to interactively add the MCP server:
```bash
/mcp add
```
Alternatively, create or edit `~/.copilot/mcp-config.json` and add the following configuration:
```json
{
"mcpServers": {
"svelte": {
"command": "npx",
"args": ["-y", "@sveltejs/mcp"]
}
}
}
```
## Gemini CLI
To include the local MCP version in Gemini CLI, simply run the following command:
```bash
gemini mcp add -t stdio -s [scope] svelte npx -y @sveltejs/mcp
```
The `[scope]` must be `user`, `project` or `local`.
## OpenCode
You can automatically configure the MCP server using the [OpenCode plugin](opencode-plugin) (recommended). If you prefer to configure the MCP server manually, run:
```bash
opencode mcp add
```
and follow the instructions, selecting 'Local' under the 'Select MCP server type' prompt:
```bash
opencode mcp add
┌ Add MCP server
◇ Enter MCP server name
│ svelte
◇ Select MCP server type
│ Local
◆ Enter command to run
│ npx -y @sveltejs/mcp
```
## VS Code
- Open the command palette
- Select "MCP: Add Server..."
- Select "Command (stdio)"
- Insert `npx -y @sveltejs/mcp` in the input and press `Enter`
- When prompted for a name, insert `svelte`
- Select if you want to add it as a `Global` or `Workspace` MCP server
## Cursor
You can automatically configure the MCP server using the [Cursor plugin](cursor-plugin) (recommended). If you prefer to configure the MCP server manually you can:
- Open the command palette
- Select "View: Open MCP Settings"
- Click on "Add custom MCP"
It will open a file with your MCP servers where you can add the following configuration:
```json
{
"mcpServers": {
"svelte": {
"command": "npx",
"args": ["-y", "@sveltejs/mcp"]
}
}
}
```
## Zed
Install the [Svelte MCP Server extension](https://zed.dev/extensions/svelte-mcp).
<details>
<summary>Configure Manually</summary>
- Open the command palette
- Search and select "agent:open settings"
- In settings panel look for `Model Context Protocol (MCP) Servers`
- Click on "Add Server"
- Select: "Add Custom Server"
It will open a popup with MCP server config where you can add the following configuration:
```json
{
"svelte": {
"command": "npx",
"args": ["-y", "@sveltejs/mcp"]
}
}
```
</details>
## Other clients
If we didn't include the MCP client you are using, refer to their documentation for `stdio` servers and use `npx` as the command and `-y @sveltejs/mcp` as the arguments.

View File

@@ -0,0 +1,146 @@
---
title: Remote setup
---
The remote version of the MCP server is available at `https://mcp.svelte.dev/mcp`.
Here's how to set it up in some common MCP clients:
## Claude Code
To include the remote MCP version in Claude Code, simply run the following command:
```bash
claude mcp add -t http -s [scope] svelte https://mcp.svelte.dev/mcp
```
You can choose your preferred `scope` (it must be `user`, `project` or `local`) and `name`.
If you prefer you can also install the `svelte` plugin in [the Svelte Claude Code Marketplace](claude-plugin) that will give you both the remote server and useful [skills](skills).
## Claude Desktop
- Open Settings > Connectors
- Click on Add Custom Connector
- When prompted for a name, enter `svelte`
- Under the Remote MCP server URL input, use `https://mcp.svelte.dev/mcp`
- Click Add
## Codex CLI
Add the following to your `config.toml` (which defaults to `~/.codex/config.toml`, but refer to [the configuration documentation](https://github.com/openai/codex/blob/main/docs/config.md) for more advanced setups):
```toml
experimental_use_rmcp_client = true
[mcp_servers.svelte]
url = "https://mcp.svelte.dev/mcp"
```
## Copilot CLI
Use the Copilot CLI to interactively add the MCP server:
```bash
/mcp add
```
Alternatively, create or edit `~/.copilot/mcp-config.json` and add the following configuration:
```json
{
"mcpServers": {
"svelte": {
"url": "https://mcp.svelte.dev/mcp"
}
}
}
```
## Gemini CLI
To use the remote MCP server with Gemini CLI, simply run the following command:
```bash
gemini mcp add -t http -s [scope] svelte https://mcp.svelte.dev/mcp
```
The `[scope]` must be `user` or `project`.
## OpenCode
You can automatically configure the MCP server using the [OpenCode plugin](opencode-plugin) (recommended). If you prefer to configure the MCP server manually, run:
```bash
opencode mcp add
```
and follow the instructions, selecting 'Remote' under the 'Select MCP server type' prompt:
```bash
opencode mcp add
┌ Add MCP server
◇ Enter MCP server name
│ svelte
◇ Select MCP server type
│ Remote
◇ Enter MCP server URL
│ https://mcp.svelte.dev/mcp
```
## VS Code
- Open the command palette
- Select "MCP: Add Server..."
- Select "HTTP (HTTP or Server-Sent-Events)"
- Insert `https://mcp.svelte.dev/mcp` in the input and press `Enter`
- Insert your preferred name
- Select if you want to add it as a `Global` or `Workspace` MCP server
## Cursor
You can automatically configure the MCP server using the [Cursor plugin](cursor-plugin) (recommended). If you prefer to configure the MCP server manually you can:
- Open the command palette
- Select "View: Open MCP Settings"
- Click on "Add custom MCP"
It will open a file with your MCP servers where you can add the following configuration:
```json
{
"mcpServers": {
"svelte": {
"url": "https://mcp.svelte.dev/mcp"
}
}
}
```
## 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

@@ -0,0 +1,21 @@
---
title: Tools
---
The following tools are provided by the MCP server to the model you are using, which can decide to call one or more of them during a session:
## list-sections
Provides a list of all the available documentation sections.
## get-documentation
Allows the model to get the full (and up-to-date) documentation for the requested sections directly from [svelte.dev/docs](/docs).
## svelte-autofixer
Uses static analysis to provide suggestions for code that your LLM generates. It can be invoked in an agentic loop by your model until all issues and suggestions are resolved.
## playground-link
Generates an ephemeral playground link with the generated code. It's useful when the generated code is not written to a file in your project and you want to quickly test the generated solution. The code is not stored anywhere except the URL itself (which will often, as a consequence, be quite large).

View File

@@ -0,0 +1,9 @@
---
title: Resources
---
This is the list of available resources provided by the MCP server. Resources are included by the user (not by the LLM) and are useful if you want to include specific knowledge in your session. For example, if you know that the component will need to use transitions you can include the transition documentation directly without asking the LLM to do it for you.
## doc-section
This dynamic resource allows you to add every section of the Svelte documentation as a resource. The URI looks like this `svelte://slug-of-the-docs.md` and the returned resource will contain the `llms.txt` version of the specific page you selected.

View File

@@ -0,0 +1,7 @@
---
title: Prompts
---
This is the list of available prompts provided by the MCP server. Prompts are selected by the user and are sent as a user message. They can be useful to write repetitive instructions for the LLM on how to properly use the MCP server.
@include .generated/prompts.md

View File

@@ -0,0 +1,78 @@
---
title: CLI
---
The `@sveltejs/mcp` npm package normally launches the local `stdio` MCP server:
```bash
npx -y @sveltejs/mcp
```
If you invoke it with a subcommand, it behaves like a regular CLI and prints the result directly in your terminal instead. This is useful for agents, scripts and quick manual checks.
## Usage
```bash
npx -y @sveltejs/mcp <command> [options]
```
Available commands:
- `list-sections`
- `get-documentation <sections>`
- `svelte-autofixer <code_or_path>`
You can learn more about the commands with
```bash
npx -y @sveltejs/mcp --help
npx -y @sveltejs/mcp <command> --help
npx -y @sveltejs/mcp --version
```
## `list-sections`
Lists all available Svelte and SvelteKit documentation sections.
```bash
npx -y @sveltejs/mcp list-sections
```
The output is a structured text list of sections, including each section's title, `use_cases`, and documentation path. This is the same catalog the MCP tool uses before calling `get-documentation`.
## `get-documentation`
Fetches the full documentation for one or more sections.
```bash
npx -y @sveltejs/mcp get-documentation 'svelte/$state'
# or
npx -y @sveltejs/mcp get-documentation 'svelte/$state,svelte/await-expressions'
```
Each section can be matched by title or by documentation path. If a section cannot be found, the CLI returns an error plus similar matches when available.
## `svelte-autofixer`
Runs the Svelte autofixer against either inline code or a file path:
```bash
npx -y @sveltejs/mcp svelte-autofixer 'src/routes/+page.svelte'
```
If the argument is an existing path, the CLI reads the file automatically. Otherwise it treats the argument as raw Svelte code.
Because most shells expand `$`, inline code should be quoted or escaped correctly. In practice, passing a file path is usually easier than passing source directly.
Available options:
- `--svelte-version <4|5>` - choose which Svelte version to validate against (defaults to `5`)
- `--async` - enable async Svelte analysis for Svelte 5 projects
The command prints an object with:
- `issues`
- `suggestions`
- `require_another_tool_call_after_fixing`
This makes it easy to use in an agentic loop: run the autofixer, apply fixes, then run it again until it reports no remaining issues or suggestions.

View File

@@ -0,0 +1,3 @@
---
title: MCP server
---

View File

@@ -0,0 +1,263 @@
## `svelte-code-writer`
CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
<a href="https://github.com/sveltejs/ai-tools/releases?q=svelte-code-writer" target="_blank" rel="noopener noreferrer">Open Releases page</a>
<details>
<summary>View skill content</summary>
<!-- prettier-ignore-start -->
````markdown
# Svelte 5 Code Writer
## CLI Tools
You have access to `@sveltejs/mcp` CLI for Svelte-specific assistance. Use these commands via `npx`:
### List Documentation Sections
```bash
npx @sveltejs/mcp list-sections
```
Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths.
### Get Documentation
```bash
npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."
```
Retrieves full documentation for specified sections. Use after `list-sections` to fetch relevant docs.
**Example:**
```bash
npx @sveltejs/mcp get-documentation "$state,$derived,$effect"
```
### Svelte Autofixer
```bash
npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]
```
Analyzes Svelte code and suggests fixes for common issues.
**Options:**
- `--async` - Enable async Svelte mode (default: false)
- `--svelte-version` - Target version: 4 or 5 (default: 5)
**Examples:**
```bash
# Analyze inline code (escape $ as \$)
npx @sveltejs/mcp svelte-autofixer '<script>let count = \$state(0);</script>'
# Analyze a file
npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
# Target Svelte 4
npx @sveltejs/mcp svelte-autofixer ./Component.svelte --svelte-version 4
```
**Important:** When passing code with runes (`$state`, `$derived`, etc.) via the terminal, escape the `$` character as `\$` to prevent shell variable substitution.
## Workflow
1. **Uncertain about syntax?** Run `list-sections` then `get-documentation` for relevant topics
2. **Reviewing/debugging?** Run `svelte-autofixer` on the code to detect issues
3. **Always validate** - Run `svelte-autofixer` before finalizing any Svelte component
````
<!-- prettier-ignore-end -->
</details>
## `svelte-core-bestpractices`
Guidance on writing fast, robust, modern Svelte code. Load this skill whenever in a Svelte project and asked to write/edit or analyze a Svelte component or module. Covers reactivity, event handling, styling, integration with libraries and more.
<a href="https://github.com/sveltejs/ai-tools/releases?q=svelte-core-bestpractices" target="_blank" rel="noopener noreferrer">Open Releases page</a>
<details>
<summary>View skill content</summary>
<!-- prettier-ignore-start -->
````markdown
## `$state`
Only use the `$state` rune for variables that should be _reactive_ — in other words, variables that cause an `$effect`, `$derived` or template expression to update. Everything else can be a normal variable.
Objects and arrays (`$state({...})` or `$state([...])`) are made deeply reactive, meaning mutation will trigger updates. This has a trade-off: in exchange for fine-grained reactivity, the objects must be proxied, which has performance overhead. In cases where you're dealing with large objects that are only ever reassigned (rather than mutated), use `$state.raw` instead. This is often the case with API responses, for example.
## `$derived`
To compute something from state, use `$derived` rather than `$effect`:
```js
// do this
let square = $derived(num * num);
// don't do this
let square;
$effect(() => {
square = num * num;
});
```
> [!NOTE] `$derived` is given an expression, _not_ a function. If you need to use a function (because the expression is complex, for example) use `$derived.by`.
Deriveds are writable — you can assign to them, just like `$state`, except that they will re-evaluate when their expression changes.
If the derived expression is an object or array, it will be returned as-is — it is _not_ made deeply reactive. You can, however, use `$state` inside `$derived.by` in the rare cases that you need this.
## `$effect`
Effects are an escape hatch and should mostly be avoided. In particular, avoid updating state inside effects.
- If you need to sync state to an external library such as D3, it is often neater to use [`{@attach ...}`](references/@attach.md)
- If you need to run some code in response to user interaction, put the code directly in an event handler or use a [function binding](references/bind.md) as appropriate
- If you need to log values for debugging purposes, use [`$inspect`](references/$inspect.md)
- If you need to observe something external to Svelte, use [`createSubscriber`](references/svelte-reactivity.md)
Never wrap the contents of an effect in `if (browser) {...}` or similar — effects do not run on the server.
## `$props`
Treat props as though they will change. For example, values that depend on props should usually use `$derived`:
```js
// @errors: 2451
let { type } = $props();
// do this
let color = $derived(type === 'danger' ? 'red' : 'green');
// don't do this — `color` will not update if `type` changes
let color = type === 'danger' ? 'red' : 'green';
```
## `$inspect.trace`
`$inspect.trace` is a debugging tool for reactivity. If something is not updating properly or running more than it should you can add `$inspect.trace(label)` as the first line of an `$effect` or `$derived.by` (or any function they call) to trace their dependencies and discover which one triggered an update.
## Events
Any element attribute starting with `on` is treated as an event listener:
```svelte
<button onclick={() => {...}}>click me</button>
<!-- attribute shorthand also works -->
<button {onclick}>...</button>
<!-- so do spread attributes -->
<button {...props}>...</button>
```
If you need to attach listeners to `window` or `document` you can use `<svelte:window>` and `<svelte:document>`:
```svelte
<svelte:window onkeydown={...} />
<svelte:document onvisibilitychange={...} />
```
Avoid using `onMount` or `$effect` for this.
## Snippets
[Snippets](references/snippet.md) are a way to define reusable chunks of markup that can be instantiated with the [`{@render ...}`](references/@render.md) tag, or passed to components as props. They must be declared within the template.
```svelte
{#snippet greeting(name)}
<p>hello {name}!</p>
{/snippet}
{@render greeting('world')}
```
> [!NOTE] Snippets declared at the top level of a component (i.e. not inside elements or blocks) can be referenced inside `<script>`. A snippet that doesn't reference component state is also available in a `<script module>`, in which case it can be exported for use by other components.
## Each blocks
Prefer to use [keyed each blocks](references/each.md) — this improves performance by allowing Svelte to surgically insert or remove items rather than updating the DOM belonging to existing items.
> [!NOTE] The key _must_ uniquely identify the object. Do not use the index as a key.
Avoid destructuring if you need to mutate the item (with something like `bind:value={item.count}`, for example).
## Using JavaScript variables in CSS
If you have a JS variable that you want to use inside CSS you can set a CSS custom property with the `style:` directive.
```svelte
<div style:--columns={columns}>...</div>
```
You can then reference `var(--columns)` inside the component's `<style>`.
## Styling child components
The CSS in a component's `<style>` is scoped to that component. If a parent component needs to control the child's styles, the preferred way is to use CSS custom properties:
```svelte
<!-- Parent.svelte -->
<Child --color="red" />
<!-- Child.svelte -->
<h1>Hello</h1>
<style>
h1 {
color: var(--color);
}
</style>
```
If this is impossible (for example, the child component comes from a library) you can use `:global` to override styles:
```svelte
<div>
<Child />
</div>
<style>
div :global {
h1 {
color: red;
}
}
</style>
```
## Context
Consider using context instead of declaring state in a shared module. This will scope the state to the part of the app that needs it, and eliminate the possibility of it leaking between users when server-side rendering.
Use `createContext` rather than `setContext` and `getContext`, as it provides type safety.
## Async Svelte
If using version 5.36 or higher, you can use [await expressions](references/await-expressions.md) and [hydratable](references/hydratable.md) to use promises directly inside components. Note that these require the `experimental.async` option to be enabled in `svelte.config.js` as they are not yet considered fully stable.
## Avoid legacy features
Always use runes mode for new code, and avoid features that have more modern replacements:
- use `$state` instead of implicit reactivity (e.g. `let count = 0; count += 1`)
- use `$derived` and `$effect` instead of `$:` assignments and statements (but only use effects when there is no better solution)
- use `$props` instead of `export let`, `$$props` and `$$restProps`
- use `onclick={...}` instead of `on:click={...}`
- use `{#snippet ...}` and `{@render ...}` instead of `<slot>` and `$$slots` and `<svelte:fragment>`
- use `<DynamicComponent>` instead of `<svelte:component this={DynamicComponent}>`
- use `import Self from './ThisComponent.svelte'` and `<Self>` instead of `<svelte:self>`
- use classes with `$state` fields to share reactivity between components, instead of using stores
- use `{@attach ...}` instead of `use:action`
- use clsx-style arrays and objects in `class` attributes, instead of the `class:` directive
````
<!-- prettier-ignore-end -->
</details>

View File

@@ -0,0 +1,11 @@
---
title: Overview
---
This is the list of available skills provided by the Svelte MCP package. Skills are sets of instructions that AI agents can load on-demand to help with specific tasks.
Skills are available in both the Claude Code plugin (installed via the marketplace) and the OpenCode plugin (`@sveltejs/opencode`). They can also be manually installed in your `.claude/skills` or `.opencode/skills` folder.
You can download the latest skills from the [releases page](https://github.com/sveltejs/ai-tools/releases) of the repo, or find them in the [`plugins/svelte/skills`](https://github.com/sveltejs/ai-tools/tree/main/plugins/svelte/skills) folder.
@include .generated/skills.md

View File

@@ -0,0 +1,3 @@
---
title: Skills
---

View File

@@ -0,0 +1,67 @@
---
name: svelte-file-editor
description: Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server or the `svelte-file-editor` skill if they are available. Fetches relevant documentation and validates code using the Svelte MCP server tools.
---
You are a Svelte 5 expert responsible for writing, editing, and validating Svelte components and modules. You have access to the Svelte MCP server which provides documentation and code analysis tools. Always use the tools from the svelte MCP server to fetch documentation with `get_documentation` and validating the code with `svelte_autofixer`. If the autofixer returns any issue or suggestions try to solve them.
If the MCP tools are not available you can use the `svelte-code-writer` skill to learn how to use the `@sveltejs/mcp` cli to access the same tools.
If the skill is not available you can run `npx @sveltejs/mcp@latest -y --help` to learn how to use it.
## Available MCP Tools
### 1. list-sections
Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths. Use this first to discover what documentation is available.
### 2. get-documentation
Retrieves full documentation for specified sections. Accepts a single section name or an array of section names. Use after `list-sections` to fetch relevant docs for the task at hand.
**Example sections:** `$state`, `$derived`, `$effect`, `$props`, `$bindable`, `snippets`, `routing`, `load functions`
### 3. svelte-autofixer
Analyzes Svelte code and returns suggestions to fix issues. Pass the component code directly to this tool. It will detect common mistakes like:
- Using `$effect` instead of `$derived` for computations
- Missing cleanup in effects
- Svelte 4 syntax (`on:click`, `export let`, `<slot>`)
- Missing keys in `{#each}` blocks
- And more
## Workflow
When invoked to work on a Svelte file:
### 1. Gather Context (if needed)
If you're uncertain about Svelte 5 syntax or patterns, use the MCP tools:
1. Call `list-sections` to see available documentation
2. Call `get-documentation` with relevant section names
### 2. Read the Target File
Read the file to understand the current implementation.
### 3. Make Changes
Apply edits following Svelte 5 best practices:
### 4. Validate Changes
After editing, ALWAYS call `svelte-autofixer` with the updated code to check for issues.
### 5. Fix Any Issues
If the autofixer reports problems, fix them and re-validate until no issues remain.
## Output Format
After completing your work, provide:
1. Summary of changes made
2. Any issues found and fixed by the autofixer
3. Recommendations for further improvements (if any)

View File

@@ -0,0 +1,20 @@
---
title: Overview
---
Since creating, editing or analyzing a Svelte file is an atomic operation we recommend creating a subagent that your main agent can invoke whenever it needs to interact with a Svelte component. Subagents use a separate context window, allowing them to fetch documentation, iterate with [`svelte-autofixer`](tools#svelte-autofixer) and write to the filesystem without wasting context in the main agent.
Delegation should happen automatically when appropriate, but you can also explicitly request the subagent be used for Svelte-related tasks.
You can write your own or take inspiration from the one available in the [`sveltejs/ai-tools`](https://github.com/sveltejs/ai-tools/tree/main/tools/agents) repository: a specialized subagent called `svelte-file-editor` designed for creating, editing, and reviewing Svelte files.
<details>
<summary>View subagent definition</summary>
<!-- prettier-ignore-start -->
````markdown
@include .generated/subagent.md
````
<!-- prettier-ignore-end -->
</details>

View File

@@ -0,0 +1,3 @@
---
title: Subagents
---

View File

@@ -0,0 +1,23 @@
---
title: Claude Code
---
The open source [repository](https://github.com/sveltejs/ai-tools) containing the code for the MCP server is also a Claude Code [plugin marketplace](https://code.claude.com/docs/en/discover-plugins).
The marketplace allows you to install the `svelte` plugin which will give you the remote MCP server, [skills](skills) to instruct the LLM on how to properly write Svelte 5 code, and a specialized agent for editing Svelte files.
If possible, we recommend that you instruct the LLM to execute MCP calls with the agent (you can explicitly mention an agent in your message to delegate work to it) when creating or editing `.svelte` files or `.svelte.ts`/`.svelte.js` modules — this will help save context by handling Svelte-specific tasks more efficiently.
## Installation
To add the repository as a marketplace, launch Claude Code and type the following:
```bash
/plugin marketplace add sveltejs/ai-tools
```
Then, install the Svelte plugin:
```bash
/plugin install svelte
```

View File

@@ -0,0 +1,54 @@
---
title: OpenCode
---
OpenCode has a [plugin system](https://opencode.ai/docs/plugins/) that allows developers to add MCP servers, agents and commands programmatically. Svelte has an OpenCode plugin published under `@sveltejs/opencode`.
## Installation
To install the plugin you can edit your [OpenCode config](https://opencode.ai/docs/config/) (either the global or the local one), adding `@sveltejs/opencode` to the list of plugins.
```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@sveltejs/opencode"]
}
```
That's it! You now have the Svelte [MCP server](mcp), [skills](skills), and the `svelte-file-editor` [subagent](subagent) configured for you.
## Configuration
By default, everything is enabled, but you can configure the plugin by adding a configuration file:
- locally, in `.opencode/svelte.json`
- globally, in `~/.config/opencode/svelte.json` (or, if you have specified the environment variable, in `$OPENCODE_CONFIG_DIR/svelte.json`)
```json
{
"$schema": "https://svelte.dev/opencode/schema.json",
"mcp": {
"type": "remote", // or "local" — defaults to remote
"enabled": true
},
"subagent": {
"enabled": true,
"agents": {
"svelte-file-editor": {
"model": "<other-model>", // defaults to the same as main agent
"temperature": 1, // defaults to unset
"top_p": 0.7, // defaults to unset
"maxSteps": 20 // defaults to unlimited
}
}
},
"skills": {
// this can be `true`, or an array of skills to enable
// e.g. ["svelte-core-bestpractices"]
"enabled": true
},
"instructions": {
"enabled": true
}
}
```

View File

@@ -0,0 +1,25 @@
---
title: Cursor
---
Cursor has a [plugin system](https://cursor.com/docs/plugins) that can bundle rules, skills, agents, commands, MCP servers, and hooks.
The Svelte plugin gives you the remote Svelte MCP server, Cursor [skills](skills), an always-on rule that tells the model how to use the Svelte MCP tools correctly, and the `svelte-file-editor` subagent for working on `.svelte` files and `.svelte.ts`/`.svelte.js` modules. The source is available in the [`sveltejs/ai-tools`](https://github.com/sveltejs/ai-tools/tree/main/plugins/cursor/svelte) repo.
## Installation
Install the plugin from the [Cursor Marketplace](https://cursor.com/marketplace/svelte) with the following command:
```
/add-plugin svelte
```
Plugins can be installed either for the current project or at user level.
Once installed, Cursor will discover the plugin components automatically:
- the Svelte MCP server is added from the plugin's `.mcp.json`
- rules and skills appear in Cursor's rules UI
- the `svelte-file-editor` agent becomes available in chat
> [!NOTE] The Cursor CLI does not support plugins yet. Plugin support in [Cloud Agents](https://cursor.com/docs/cloud-agent) is limited to MCP servers.

View File

@@ -0,0 +1,3 @@
---
title: Plugins
---

View File

@@ -0,0 +1,3 @@
---
title: AI
---

View File

@@ -1,11 +0,0 @@
import { defineConfig } from 'drizzle-kit';
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
export default defineConfig({
schema: './src/lib/server/db/schema.ts',
dialect: 'sqlite',
dbCredentials: { url: process.env.DATABASE_URL },
verbose: true,
strict: true,
});

View File

@@ -5,15 +5,27 @@ import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';
import svelteConfig from './apps/mcp-remote/svelte.config.js';
import eslint_plugin_import from 'eslint-plugin-import';
import { configs as pnpm } from 'eslint-plugin-pnpm';
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
const gitignore_path = fileURLToPath(new URL('./.gitignore', import.meta.url));
export default ts.config(
includeIgnoreFile(gitignorePath),
export default /** @type {import("eslint").Linter.Config} */ ([
includeIgnoreFile(gitignore_path),
{
ignores: [
'.claude/**/*',
'.changeset/*',
'.github/**/*.yml',
'.github/**/*.yaml',
'**/pnpm-lock.yaml',
],
},
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
eslint_plugin_import.flatConfigs.recommended,
prettier,
...svelte.configs.prettier,
{
@@ -24,6 +36,38 @@ export default ts.config(
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
'no-undef': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variableLike'],
format: ['snake_case', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'func-style': ['error', 'declaration', { allowTypeAnnotation: true }],
'import/no-unresolved': 'off', // this doesn't work well with typescript path mapping
'import/extensions': [
'error',
{
ignorePackages: true,
pattern: {
js: 'always',
mjs: 'always',
cjs: 'always',
ts: 'always',
svelte: 'always',
svg: 'always',
json: 'always',
},
},
],
},
},
{
@@ -37,4 +81,16 @@ export default ts.config(
},
},
},
);
{
name: 'pnpm/exclude-some-rules',
files: ['**/*.json', '**/*.yaml', '**/*.yml', 'pnpm-workspace.yaml'],
rules: {
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'func-style': 'off',
},
},
...pnpm.json,
...pnpm.yaml,
]);

View File

@@ -1,27 +1,39 @@
{
"name": "@sveltejs/mcp",
"name": "@sveltejs/mcp-mono",
"version": "0.0.1",
"description": "The official Svelte MCP server implementation",
"type": "module",
"main": "src/index.js",
"packageManager": "pnpm@10.28.2",
"scripts": {
"start": "node src/index.js",
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"build": "pnpm -r run build",
"dev": "pnpm --filter @sveltejs/mcp-remote run dev",
"check": "pnpm -r run check",
"check:publint": "pnpm -r run check:publint",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "prettier --write . && eslint . --fix",
"lint:inspect": "pnpm dlx @eslint/config-inspector",
"node:inspect": "pnpm dlx node-modules-inspector",
"test:unit": "vitest",
"test": "npm run test:unit -- --run",
"test:watch": "npm run test:unit -- --watch",
"db:push": "drizzle-kit push",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:studio": "drizzle-kit studio"
"inspect": "pnpm mcp-inspector",
"generate-opencode-jsonschema": "pnpm --filter @sveltejs/opencode run generate-schema",
"generate-summaries": "pnpm --filter @sveltejs/mcp-server run generate-summaries",
"generate-prompt-docs": "node --import node-resolve-ts/register scripts/update-docs-prompts.ts",
"generate-skill-docs": "node --import node-resolve-ts/register scripts/update-docs-skills.ts",
"generate-subagent-docs": "cp ./tools/agents/svelte-file-editor.md ./documentation/docs/50-subagents/.generated/subagent.md",
"debug:generate-summaries": "pnpm --filter @sveltejs/mcp-server run debug:generate-summaries",
"release": "pnpm --filter @sveltejs/mcp run build && changeset publish",
"changeset:version": "changeset version && pnpm --filter @sveltejs/mcp run update:version && git add --all",
"sync-plugins": "pnpm sync-claude-plugin && pnpm sync-cursor-plugin && pnpm sync-opencode-plugin && pnpm bump-plugin-versions",
"sync-claude-plugin": "node scripts/sync-claude-plugin.ts",
"sync-cursor-plugin": "node scripts/sync-cursor-plugin.ts",
"sync-opencode-plugin": "node scripts/sync-opencode-plugin.ts && pnpm generate-opencode-jsonschema",
"bump-plugin-versions": "node scripts/bump-plugin-versions.ts",
"postbump-plugin-versions": "pnpm format",
"resolve-references": "node scripts/resolve-references.ts",
"postresolve-references": "pnpm format"
},
"keywords": [
"svelte",
@@ -31,45 +43,24 @@
],
"private": true,
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@libsql/client": "^0.14.0",
"@sveltejs/adapter-vercel": "^5.6.3",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@types/eslint-scope": "^8.3.2",
"@types/estree": "^1.0.8",
"@types/node": "^24.3.1",
"@typescript-eslint/types": "^8.43.0",
"drizzle-kit": "^0.30.2",
"drizzle-orm": "^0.40.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0",
"globals": "^16.0.0",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"typescript-eslint": "^8.20.0",
"vite": "^7.0.4",
"vite-plugin-devtools-json": "^1.0.0",
"vitest": "^3.2.3"
},
"dependencies": {
"@tmcp/adapter-valibot": "^0.1.4",
"@tmcp/transport-http": "^0.6.0",
"@tmcp/transport-stdio": "^0.1.3",
"@typescript-eslint/parser": "^8.43.0",
"svelte-eslint-parser": "^1.3.2",
"tmcp": "^1.12.2",
"valibot": "^1.1.0",
"zimmerframe": "^1.1.4"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
"@changesets/cli": "catalog:tooling",
"@eslint/compat": "catalog:lint",
"@eslint/js": "catalog:lint",
"@modelcontextprotocol/inspector": "catalog:ai",
"@sveltejs/adapter-vercel": "catalog:svelte",
"@svitejs/changesets-changelog-github-compact": "catalog:tooling",
"eslint": "catalog:lint",
"eslint-config-prettier": "catalog:lint",
"eslint-plugin-import": "catalog:lint",
"eslint-plugin-pnpm": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"globals": "catalog:lint",
"node-resolve-ts": "catalog:tooling",
"prettier": "catalog:lint",
"prettier-plugin-svelte": "catalog:lint",
"publint": "catalog:tooling",
"typescript": "catalog:tooling",
"typescript-eslint": "catalog:lint",
"vitest": "catalog:tooling"
}
}

View File

@@ -0,0 +1,2 @@
# Anthropic API Key from: https://console.anthropic.com/
ANTHROPIC_API_KEY=your_api_key_here

View File

@@ -0,0 +1,44 @@
{
"name": "@sveltejs/mcp-server",
"version": "0.0.1",
"private": true,
"description": "",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"scripts": {
"test": "vitest",
"generate-summaries": "node scripts/generate-summaries.ts --experimental-strip-types",
"debug:generate-summaries": "DEBUG_MODE=1 node scripts/generate-summaries.ts --experimental-strip-types"
},
"exports": {
".": "./src/index.ts",
"./handlers": "./src/mcp/handlers/tools/handlers.ts"
},
"dependencies": {
"@mcp-ui/server": "catalog:ai",
"@tmcp/adapter-valibot": "catalog:tmcp",
"@tmcp/transport-in-memory": "catalog:tmcp",
"@typescript-eslint/parser": "catalog:lint",
"eslint": "catalog:lint",
"eslint-plugin-svelte": "catalog:lint",
"svelte": "catalog:svelte",
"svelte-eslint-parser": "catalog:lint",
"tmcp": "catalog:tmcp",
"ts-blank-space": "catalog:tooling",
"typescript-eslint": "catalog:lint",
"valibot": "catalog:tooling",
"vitest": "catalog:tooling",
"zimmerframe": "catalog:tooling"
},
"devDependencies": {
"@anthropic-ai/sdk": "catalog:ai",
"@sveltejs/kit": "catalog:svelte",
"@types/eslint-scope": "catalog:lint",
"@types/estree": "catalog:tooling",
"@typescript-eslint/types": "catalog:lint",
"dotenv": "catalog:tooling"
}
}

View File

@@ -0,0 +1,244 @@
#!/usr/bin/env node
import 'dotenv/config';
import { writeFile, mkdir } from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
import { get_sections } from '../src/mcp/utils.ts';
import { AnthropicProvider } from '../src/lib/anthropic.ts';
import { type AnthropicBatchRequest, type SummaryData } from '../src/lib/schemas.ts';
const current_filename = fileURLToPath(import.meta.url);
const current_dirname = path.dirname(current_filename);
const USE_CASES_PROMPT = `
You are tasked with analyzing Svelte 5 and SvelteKit documentation pages to identify when they would be useful.
Your task:
1. Read the documentation page content provided
2. Identify the main use cases, scenarios, or queries where this documentation would be relevant
3. Create a VERY SHORT, comma-separated list of use cases (maximum 200 characters total)
4. Think about what a developer might be trying to build or accomplish when they need this documentation
Guidelines:
- Focus on WHEN this documentation would be needed, not WHAT it contains
- Consider specific project types (e.g., "e-commerce site", "blog", "dashboard", "social media app")
- Consider specific features (e.g., "authentication", "forms", "data fetching", "animations")
- Consider specific components (e.g., "slider", "modal", "dropdown", "card")
- Consider development stages (e.g., "project setup", "deployment", "testing", "migration")
- Use "always" for fundamental concepts that apply to virtually all Svelte projects
- Be concise but specific
- Use lowercase
- Separate multiple use cases with commas
Examples of good use_cases:
- "always, any svelte project, core reactivity"
- "authentication, login systems, user management"
- "e-commerce, product listings, shopping carts"
- "forms, user input, data submission"
- "deployment, production builds, hosting setup"
- "animation, transitions, interactive ui"
- "routing, navigation, multi-page apps"
- "blog, content sites, markdown rendering"
Requirements:
- Maximum 200 characters (including spaces and commas)
- Lowercase only
- Comma-separated list of use cases
- Focus on WHEN/WHY someone would need this, not what it is
- Be specific about project types, features, or components when applicable
- Use "always" sparingly, only for truly universal concepts
- Do not include quotes or special formatting in your response
- Respond with ONLY the use cases text, no additional text
Here is the documentation page content to analyze:
`;
async function fetch_section_content(url: string) {
const response = await fetch(url, { signal: AbortSignal.timeout(30000) });
if (!response.ok) {
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
}
return await response.text();
}
async function main() {
console.log('🚀 Starting use cases generation...');
// Check for API key
const api_key = process.env.ANTHROPIC_API_KEY;
if (!api_key) {
console.error('❌ Error: ANTHROPIC_API_KEY environment variable is required');
console.error('Please set it in packages/mcp-server/.env file or export it:');
console.error('export ANTHROPIC_API_KEY=your_api_key_here');
process.exit(1);
}
// Get all sections
console.log('📚 Fetching documentation sections...');
let sections = await get_sections();
console.log(`Found ${sections.length} sections`);
// Debug mode: limit to 2 sections
const debug_mode = process.env.DEBUG_MODE === '1';
if (debug_mode) {
console.log('🐛 DEBUG_MODE enabled - processing only 2 sections');
sections = sections.slice(0, 2);
}
// Fetch content for each section
console.log('📥 Downloading section content...');
const sections_with_content: Array<{
section: (typeof sections)[number];
content: string;
index: number;
}> = [];
const download_errors: Array<{ section: string; error: string }> = [];
for (let i = 0; i < sections.length; i++) {
const section = sections[i]!;
try {
console.log(`Fetching ${i + 1}/${sections.length}: ${section.title}`);
const content = await fetch_section_content(section.url);
sections_with_content.push({
section,
content,
index: i,
});
} catch (error) {
const error_msg = error instanceof Error ? error.message : String(error);
console.error(`⚠️ Failed to fetch ${section.title}:`, error_msg);
download_errors.push({ section: section.title, error: error_msg });
}
}
console.log(`✅ Successfully downloaded ${sections_with_content.length} sections`);
if (sections_with_content.length === 0) {
console.error('❌ No sections were successfully downloaded');
process.exit(1);
}
// Initialize Anthropic client
console.log('🤖 Initializing Anthropic API...');
const anthropic = new AnthropicProvider('claude-sonnet-4-5-20250929', api_key);
// Prepare batch requests
console.log('📦 Preparing batch requests...');
const batch_requests: AnthropicBatchRequest[] = sections_with_content.map(
({ content, index }) => ({
custom_id: `section-${index}`,
params: {
model: anthropic.get_model_identifier(),
max_tokens: 250,
messages: [
{
role: 'user',
content: USE_CASES_PROMPT + content,
},
],
temperature: 0,
},
}),
);
// Create and process batch
console.log('🚀 Creating batch job...');
const batch_response = await anthropic.create_batch(batch_requests);
console.log(`✅ Batch created with ID: ${batch_response.id}`);
// Poll for completion
console.log('⏳ Waiting for batch to complete...');
let batch_status = await anthropic.get_batch_status(batch_response.id);
while (batch_status.processing_status === 'in_progress') {
const { succeeded, processing, errored } = batch_status.request_counts;
console.log(` Progress: ${succeeded} succeeded, ${processing} processing, ${errored} errored`);
await new Promise((resolve) => setTimeout(resolve, 5000));
batch_status = await anthropic.get_batch_status(batch_response.id);
}
console.log('✅ Batch processing completed!');
// Get results
if (!batch_status.results_url) {
throw new Error('Batch completed but no results URL available');
}
console.log('📥 Downloading results...');
const results = await anthropic.get_batch_results(batch_status.results_url);
// Process results
console.log('📊 Processing results...');
const summaries: Record<string, string> = {};
const errors: Array<{ section: string; error: string }> = [];
for (const result of results) {
const index = parseInt(result.custom_id.split('-')[1] ?? '0');
const section_data = sections_with_content.find((s) => s.index === index);
if (!section_data) {
console.warn(`⚠️ Could not find section for index ${index}`);
continue;
}
const { section } = section_data;
if (result.result.type !== 'succeeded' || !result.result.message) {
const error_msg = result.result.error?.message || 'Failed or no message';
console.error(`${section.title}: ${error_msg}`);
errors.push({ section: section.title, error: error_msg });
continue;
}
const output_content = result.result.message.content[0]?.text;
if (output_content) {
summaries[section.slug] = output_content.trim();
console.log(`${section.title}`);
}
}
// Write output to JSON file
console.log('💾 Writing results to file...');
const output_path = path.join(current_dirname, '../src/use_cases.json');
const output_dir = path.dirname(output_path);
await mkdir(output_dir, { recursive: true });
const summary_data: SummaryData = {
generated_at: new Date().toISOString(),
model: anthropic.get_model_identifier(),
total_sections: sections.length,
successful_summaries: Object.keys(summaries).length,
failed_summaries: errors.length,
summaries,
errors: errors.length > 0 ? errors : undefined,
download_errors: download_errors.length > 0 ? download_errors : undefined,
};
await writeFile(output_path, JSON.stringify(summary_data, null, 2), 'utf-8');
// Print summary
console.log('\n📊 Summary:');
console.log(` Total sections: ${sections.length}`);
console.log(` Successfully downloaded: ${sections_with_content.length}`);
console.log(` Download failures: ${download_errors.length}`);
console.log(` Successfully analyzed: ${Object.keys(summaries).length}`);
console.log(` Analysis failures: ${errors.length}`);
console.log(`\n✅ Results written to: ${output_path}`);
if (download_errors.length > 0) {
console.log('\n⚠ Some sections failed to download:');
download_errors.forEach((e) => console.log(` - ${e.section}: ${e.error}`));
}
if (errors.length > 0) {
console.log('\n⚠ Some sections failed to analyze:');
errors.forEach((e) => console.log(` - ${e.section}: ${e.error}`));
}
}
main().catch((error) => {
console.error('❌ Fatal error:', error);
process.exit(1);
});

View File

@@ -0,0 +1,6 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": true
}
}

View File

@@ -0,0 +1,24 @@
export const base_runes = [
'$state',
'$effect',
'$derived',
'$inspect',
'$props',
'$bindable',
'$host',
] as const;
export const nested_runes = [
'$state.raw',
'$state.snapshot',
'$state.eager',
'$effect.pre',
'$effect.tracking',
'$effect.pending',
'$effect.root',
'$derived.by',
'$inspect.trace',
'$props.id',
] as const;
export const runes = [...base_runes, ...nested_runes] as const;

View File

@@ -0,0 +1 @@
export { server, type SvelteMcp } from './mcp/index.js';

View File

@@ -0,0 +1,172 @@
import { Anthropic } from '@anthropic-ai/sdk';
import type { Model } from '@anthropic-ai/sdk/resources/messages/messages.js';
import * as v from 'valibot';
import {
anthropic_batch_response_schema,
anthropic_batch_result_schema,
type AnthropicBatchRequest,
} from './schemas.js';
export class AnthropicProvider {
private client: Anthropic;
private modelId: Model;
private baseUrl: string;
private apiKey: string;
name = 'Anthropic';
constructor(model_id: Model, api_key: string) {
if (!api_key) {
throw new Error('ANTHROPIC_API_KEY is required');
}
this.apiKey = api_key;
this.client = new Anthropic({ apiKey: api_key, timeout: 1800000 });
this.modelId = model_id;
this.baseUrl = 'https://api.anthropic.com/v1';
}
get_client(): Anthropic {
return this.client;
}
get_model_identifier(): Model {
return this.modelId;
}
async create_batch(requests: AnthropicBatchRequest[]) {
try {
const response = await fetch(`${this.baseUrl}/messages/batches`, {
method: 'POST',
headers: {
'x-api-key': this.apiKey,
'anthropic-version': '2023-06-01',
'content-type': 'application/json',
},
body: JSON.stringify({ requests }),
});
if (!response.ok) {
const error_text = await response.text();
throw new Error(
`Failed to create batch: ${response.status} ${response.statusText} - ${error_text}`,
);
}
const json_data = await response.json();
const validated_response = v.safeParse(anthropic_batch_response_schema, json_data);
if (!validated_response.success) {
throw new Error(
`Invalid batch response from Anthropic API: ${JSON.stringify(validated_response.issues)}`,
);
}
return validated_response.output;
} catch (error) {
console.error('Error creating batch with Anthropic:', error);
throw new Error(
`Failed to create batch: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
async get_batch_status(batch_id: string, max_retries = 10, retry_delay = 30000) {
let retry_count = 0;
while (retry_count <= max_retries) {
try {
const response = await fetch(`${this.baseUrl}/messages/batches/${batch_id}`, {
method: 'GET',
headers: {
'x-api-key': this.apiKey,
'anthropic-version': '2023-06-01',
},
});
if (!response.ok) {
const error_text = await response.text();
throw new Error(
`Failed to get batch status: ${response.status} ${response.statusText} - ${error_text}`,
);
}
const json_data = await response.json();
const validated_response = v.safeParse(anthropic_batch_response_schema, json_data);
if (!validated_response.success) {
throw new Error(
`Invalid batch status response from Anthropic API: ${JSON.stringify(validated_response.issues)}`,
);
}
return validated_response.output;
} catch (error) {
retry_count++;
if (retry_count > max_retries) {
console.error(
`Error getting batch status for ${batch_id} after ${max_retries} retries:`,
error,
);
throw new Error(
`Failed to get batch status after ${max_retries} retries: ${
error instanceof Error ? error.message : String(error)
}`,
);
}
console.warn(
`Error getting batch status for ${batch_id} (attempt ${retry_count}/${max_retries}):`,
error,
);
console.log(`Retrying in ${retry_delay / 1000} seconds...`);
await new Promise((resolve) => setTimeout(resolve, retry_delay));
}
}
// This should never be reached due to the throw in the catch block, but TypeScript needs a return
throw new Error(`Failed to get batch status for ${batch_id} after ${max_retries} retries`);
}
async get_batch_results(results_url: string) {
try {
const response = await fetch(results_url, {
method: 'GET',
headers: {
'x-api-key': this.apiKey,
'anthropic-version': '2023-06-01',
},
});
if (!response.ok) {
const error_text = await response.text();
throw new Error(
`Failed to get batch results: ${response.status} ${response.statusText} - ${error_text}`,
);
}
const text = await response.text();
// Parse JSONL format (one JSON object per line)
const parsed_results = text
.split('\n')
.filter((line) => line.trim())
.map((line) => JSON.parse(line));
// Validate all results
const validated_results = v.safeParse(v.array(anthropic_batch_result_schema), parsed_results);
if (!validated_results.success) {
throw new Error(
`Invalid batch results from Anthropic API: ${JSON.stringify(validated_results.issues)}`,
);
}
return validated_results.output;
} catch (error) {
console.error(`Error getting batch results:`, error);
throw new Error(
`Failed to get batch results: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
}

View File

@@ -0,0 +1,122 @@
import * as v from 'valibot';
export const documentation_sections_schema = v.record(
v.string(),
v.object({
metadata: v.object({
title: v.string(),
use_cases: v.optional(v.string()),
}),
slug: v.string(),
}),
);
// Valibot schemas for Batch API
export const summary_data_schema = v.object({
generated_at: v.string(),
model: v.string(),
total_sections: v.number(),
successful_summaries: v.number(),
failed_summaries: v.number(),
summaries: v.record(v.string(), v.string()),
errors: v.optional(
v.array(
v.object({
section: v.string(),
error: v.string(),
}),
),
),
download_errors: v.optional(
v.array(
v.object({
section: v.string(),
error: v.string(),
}),
),
),
});
export const anthropic_batch_request_schema = v.object({
custom_id: v.string(),
params: v.object({
model: v.string(),
max_tokens: v.number(),
messages: v.array(
v.object({
role: v.union([v.literal('user'), v.literal('assistant')]),
content: v.union([
v.string(),
v.array(
v.object({
type: v.string(),
text: v.string(),
}),
),
]),
}),
),
}),
});
export const anthropic_batch_response_schema = v.object({
id: v.string(),
type: v.string(),
processing_status: v.union([v.literal('in_progress'), v.literal('ended')]),
request_counts: v.object({
processing: v.number(),
succeeded: v.number(),
errored: v.number(),
canceled: v.number(),
expired: v.number(),
}),
ended_at: v.nullable(v.string()),
created_at: v.string(),
expires_at: v.string(),
cancel_initiated_at: v.nullable(v.string()),
results_url: v.nullable(v.string()),
});
export const anthropic_batch_result_schema = v.object({
custom_id: v.string(),
result: v.object({
type: v.union([
v.literal('succeeded'),
v.literal('errored'),
v.literal('canceled'),
v.literal('expired'),
]),
message: v.optional(
v.object({
id: v.string(),
type: v.string(),
role: v.string(),
model: v.string(),
content: v.array(
v.object({
type: v.string(),
text: v.string(),
}),
),
stop_reason: v.string(),
stop_sequence: v.nullable(v.string()),
usage: v.object({
input_tokens: v.number(),
output_tokens: v.number(),
}),
}),
),
error: v.optional(
v.object({
type: v.string(),
message: v.string(),
}),
),
}),
});
// Export inferred types
export type SummaryData = v.InferOutput<typeof summary_data_schema>;
export type AnthropicBatchRequest = v.InferOutput<typeof anthropic_batch_request_schema>;
export type AnthropicBatchResponse = v.InferOutput<typeof anthropic_batch_response_schema>;
export type AnthropicBatchResult = v.InferOutput<typeof anthropic_batch_result_schema>;

View File

@@ -0,0 +1,790 @@
import { describe, expect, it } from 'vitest';
import { add_autofixers_issues } from './add-autofixers-issues.js';
import { base_runes } from '../../constants.js';
const dollarless_runes = base_runes.map((r) => ({ rune: r.replace('$', '') }));
function run_autofixers_on_code(code: string, desired_svelte_version = 5) {
const content = { issues: [], suggestions: [] };
add_autofixers_issues(content, code, desired_svelte_version);
return content;
}
function with_possible_inits(title: string, fn: (args: { init: string }) => void) {
describe.each([
{ init: '$state' },
{ init: '$state.raw' },
{ init: '$derived' },
{ init: '$derived.by' },
])(title, fn);
}
describe('add_autofixers_issues', () => {
describe('assign_in_effect', () => {
with_possible_inits('($init)', ({ init }) => {
it(`should add suggestions when assigning to a stateful variable inside an effect`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(0);
$effect(() => {
count = 43;
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it(`should add a suggestion for each variable assigned within an effect`, () => {
const content = run_autofixers_on_code(`
<script>
const count = $state(0);
const count2 = $state(0);
$effect(() => {
count = 43;
count2 = 44;
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(2);
expect(content.suggestions).toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
expect(content.suggestions).toContain(
'The stateful variable "count2" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it(`should not add a suggestion for variables that are not assigned within an effect`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(0);
</script>
<button onclick={() => count = 43}>Increment</button>
`);
expect(content.suggestions).not.toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it("should not add a suggestions for variables that are assigned within an effect but aren't stateful", () => {
const content = run_autofixers_on_code(`
<script>
const count = 0;
$effect(() => {
count = 43;
});
</script>`);
expect(content.suggestions).not.toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it(`should add a suggestion for variables that are assigned within an effect with an update`, () => {
const content = run_autofixers_on_code(`
<script>
let count = ${init}(0);
$effect(() => {
count++;
});
</script>
`);
expect(content.suggestions).toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it(`should add a suggestion for variables that are mutated within an effect`, () => {
const content = run_autofixers_on_code(`
<script>
let count = ${init}({ value: 0 });
$effect(() => {
count.value = 42;
});
</script>
`);
expect(content.suggestions).toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
it(`should add a suggestion for variables that are mutated within an effect.pre`, () => {
const content = run_autofixers_on_code(`
<script>
let count = ${init}({ value: 0 });
$effect.pre(() => {
count.value = 42;
});
</script>
`);
expect(content.suggestions).toContain(
'The stateful variable "count" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.',
);
});
});
it('should add a suggestion when calling a function inside an effect', () => {
const content = run_autofixers_on_code(`
<script>
import { fetch_data } from './data.js';
$effect(() => {
fetch_data();
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are calling the function \`fetch_data\` inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
it('should add a suggestion when calling a function inside an effect (with non identifier callee)', () => {
const content = run_autofixers_on_code(`
<script>
import { fetch_data } from './data.js';
$effect(() => {
fetch_data.fetch();
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are calling a function inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
});
with_possible_inits('($init)', ({ init }) => {
describe.each([{ method: 'set' }, { method: 'update' }])(
'wrong_property_access_state ($method)',
({ method }) => {
it(`should add suggestions when using .${method}() on a stateful variable with a literal init`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(0);
function update_count() {
count.${method}(43);
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them.`,
);
});
it(`should add suggestions when using .${method}() on a stateful variable with an array init`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}([0]);
function update_count() {
count.${method}([1]);
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them.`,
);
});
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable (${init}({}))`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}({ value: 0 });
function update_count() {
count.${method}({ value: 43 });
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
);
});
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable (${init}(new Class()))`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(new Class());
function update_count() {
count.${method}(new Class());
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
);
});
it(`should add suggestions when using .${method}() on a stateful variable with conditional if it's not sure if the method could actually be present on the variable (${init}(variable_name))`, () => {
const content = run_autofixers_on_code(`
<script>
const { init } = $props();
const count = ${init}(init);
function update_count() {
count.${method}(43);
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
);
});
it(`should not add suggestions when using .${method} on a stateful variable if it's not a method call`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}({});
function update_count() {
console.log(count.${method});
}
</script>`);
expect(content.suggestions).not.toContain(
`You are trying to update the stateful variable "count" using "${method}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them. However I can't verify if "count" is a state variable of an object or a class with a "${method}" method on it. Please verify that before updating the code to use a normal assignment`,
);
});
},
);
describe.each([{ property: '$' }])(
'wrong_property_access_state property ($property)',
async ({ property }) => {
it(`should add suggestions when reading .${property} on a stateful variable with a literal init`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(0);
function read_count() {
count.${property};
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to read the stateful variable "count" using "${property}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them.`,
);
});
it(`should add suggestions when reading .${property} on a stateful variable with an array init`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}([1]);
function read_count() {
count.${property};
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to read the stateful variable "count" using "${property}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them.`,
);
});
it(`should add suggestions when reading .${property} on a stateful variable with conditional if it's not sure if the property could actually be present on the variable (${init}({}))`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}({ value: 0 });
function read_count() {
count.${property};
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to read the stateful variable "count" using "${property}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them. However I can't verify if "count" is a state variable of an object or a class with a "${property}" property on it. Please verify that before updating the code to use a normal access`,
);
});
it(`should add suggestions when reading .${property} on a stateful variable with conditional if it's not sure if the property could actually be present on the variable (${init}(new Class()))`, () => {
const content = run_autofixers_on_code(`
<script>
const count = ${init}(new Class());
function read_count() {
count.${property};
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to read the stateful variable "count" using "${property}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them. However I can't verify if "count" is a state variable of an object or a class with a "${property}" property on it. Please verify that before updating the code to use a normal access`,
);
});
it(`should add suggestions when reading .${property} on a stateful variable with conditional if it's not sure if the property could actually be present on the variable (${init}(variable_name))`, () => {
const content = run_autofixers_on_code(`
<script>
const { init } = $props();
const count = ${init}(init);
function read_count() {
count.${property};
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are trying to read the stateful variable "count" using "${property}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them. However I can't verify if "count" is a state variable of an object or a class with a "${property}" property on it. Please verify that before updating the code to use a normal access`,
);
});
},
);
});
describe('imported_runes', () => {
describe.each([
{ source: 'svelte' },
{ source: 'svelte/runes' },
{ source: '@sveltejs/runes' },
{ source: '@sveltejs/vite-plugin-svelte' },
])('from "$source"', ({ source }) => {
describe.each(dollarless_runes)('single import ($rune)', ({ rune }) => {
it(`should add suggestions when importing '${rune}' from '${source}'`, () => {
const content = run_autofixers_on_code(`
<script>
import { ${rune} } from '${source}';
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
);
});
it(`should add suggestions when importing "${rune}" as the default export from '${source}'`, () => {
const content = run_autofixers_on_code(`
<script>
import ${rune} from '${source}';
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
);
});
it(`should add suggestions when importing '${rune}' as the namespace export from '${source}'`, () => {
const content = run_autofixers_on_code(`
<script>
import * as ${rune} from '${source}';
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are importing "${rune}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
);
});
});
it(`should add suggestions when importing multiple runes from '${source}'`, () => {
const content = run_autofixers_on_code(`
<script>
import { onMount, state, effect } from '${source}';
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(2);
expect(content.suggestions).toContain(
`You are importing "state" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$state" directly.`,
);
expect(content.suggestions).toContain(
`You are importing "effect" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$effect" directly.`,
);
});
it(`should not add suggestions when importing other identifiers from '${source}'`, () => {
const content = run_autofixers_on_code(`
<script>
import { onMount } from '${source}';
</script>`);
expect(content.suggestions).not.toContain(
`You are importing "onMount" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$onMount" directly.`,
);
});
});
describe.each(dollarless_runes)('importing $rune from external lib', ({ rune }) => {
it(`should not add suggestions when importing from packages whose name doesn't contain svelte`, () => {
const content = run_autofixers_on_code(`
<script>
import { ${rune} } from 'something-something';
</script>`);
expect(content.suggestions).not.toContain(
`You are importing "${rune}" from "something-something". This is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly.`,
);
});
it(`should add suggestions with a different hint when importing from packages whose name contains svelte but it's not official`, () => {
const content = run_autofixers_on_code(`
<script>
import { ${rune} } from 'svelte-something-something';
</script>`);
expect(content.suggestions).toContain(
`You are importing "${rune}" from "svelte-something-something". If you are trying to import runes to use them this is not necessary, all runes are globally available. Please remove this import and use "$${rune}" directly. If you are importing the function from a separate library ignore this suggestion.`,
);
});
});
it('should not add the imported_runes suggestion when importing derived from svelte/store', () => {
const content = run_autofixers_on_code(`
<script>
import { derived } from 'svelte/store';
</script>`);
expect(content.suggestions).not.toContain(
'You are importing "derived" from "svelte/store". This is not necessary, all runes are globally available. Please remove this import and use "$derived" directly.',
);
});
});
describe('derived_with_function', () => {
it(`should add suggestions when using a function as the first argument to $derived`, () => {
const content = run_autofixers_on_code(`
<script>
const value = $derived(() => {
return 43;
});
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'You are passing a function to $derived when declaring "value" but $derived expects an expression. You can use $derived.by instead.',
);
});
it(`should add suggestions when using a function as the first argument to $derived in classes`, () => {
const content = run_autofixers_on_code(`
<script>
class Double {
value = $derived(() => 43);
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'You are passing a function to $derived when declaring "value" but $derived expects an expression. You can use $derived.by instead.',
);
});
it(`should add suggestions when using a function as the first argument to $derived in classes constructors`, () => {
const content = run_autofixers_on_code(`
<script>
class Double {
value;
constructor(){
this.value = $derived(function() { return 44; });
}
}
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'You are passing a function to $derived when declaring "value" but $derived expects an expression. You can use $derived.by instead.',
);
});
it(`should add suggestions when using a function as the first argument to $derived without the declaring part if it's not an identifier`, () => {
const content = run_autofixers_on_code(`
<script>
const { destructured } = $derived(() => 43);
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'You are passing a function to $derived but $derived expects an expression. You can use $derived.by instead.',
);
});
it(`should add suggestions when using a function as the first argument to $derived.by`, () => {
const content = run_autofixers_on_code(`
<script>
const { destructured } = $derived.by(() => 43);
</script>`);
expect(content.suggestions).not.toContain(
'You are passing a function to $derived but $derived expects an expression. You can use $derived.by instead.',
);
});
});
describe('use_runes_instead_of_store', () => {
describe.each([{ import: 'derived' }, { import: 'writable' }, { import: 'readable' }])(
'importing $import from svelte/store',
({ import: imported }) => {
it(`should add suggestions when importing '${imported}' from 'svelte/store'`, () => {
const content = run_autofixers_on_code(`
<script>
import { ${imported} } from 'svelte/store';
</script>`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
`You are importing "${imported}" from "svelte/store". Unless the user specifically asked for stores or it's required because some library/component requires a store as input consider using runes like \`$state\` or \`$derived\` instead, all runes are globally available.`,
);
});
},
);
it(`should not add suggestions when importing other identifiers from 'svelte/store'`, () => {
const content = run_autofixers_on_code(`
<script>
import { get } from 'svelte/store';
</script>`);
expect(content.suggestions).not.toContain(
`You are importing "get" from "svelte/store". Unless the user specifically asked for stores or it's required because some library/component requires a store as input consider using runes like \`$state\` or \`$derived\` instead, all runes are globally available.`,
);
});
});
describe('suggest_attachments', () => {
describe('bind:this', () => {
it('should add suggestions when using bind:this on an element', () => {
const content = run_autofixers_on_code(`
<script>
let a = $state();
</script>
<a bind:this={a} />`);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should not add suggestions when using bind:this on a component', () => {
const content = run_autofixers_on_code(`
<script>
import Child from './Child.svelte';
let a = $state();
</script>
<Child bind:this={a} />`);
expect(content.suggestions).not.toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should not add suggestions when using bind:this on a component nested in an element', () => {
const content = run_autofixers_on_code(`
<script>
import Child from './Child.svelte';
let a = $state();
</script>
<div>
<Child bind:this={a} />
</div>`);
expect(content.suggestions).not.toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action` or even better an `attachment`. Consider using the latter if possible.',
);
});
it('should add suggestions but not suggest attachments when using bind:this on an element and the desired svelte version is 4', () => {
const content = run_autofixers_on_code(
`
<script>
let a;
</script>
<a bind:this={a} />`,
4,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'The usage of `bind:this` can often be replaced with an easier to read `action`. Consider using the latter if possible.',
);
});
});
describe('use:', () => {
it('should add suggestions when using use: on an element and the action is declared as a function', () => {
const content = run_autofixers_on_code(
`<script>
function my_action(node) {
// do something with the node
}
</script>
<a use:my_action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should add suggestions when using use: on an element and the action is declared as a variable', () => {
const content = run_autofixers_on_code(
`<script>
const my_action = (node) => {
// do something with the node
}
</script>
<a use:my_action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should add suggestions when using use: on an element and the action is declared as an object', () => {
const content = run_autofixers_on_code(
`<script>
const my_action = {
action: (node) => {
// do something with the node
}
};
</script>
<a use:my_action.action />`,
);
expect(content.suggestions.length).toBeGreaterThanOrEqual(1);
expect(content.suggestions).toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the desired svelte version is 4', () => {
const content = run_autofixers_on_code(
`<script>
function my_action(node) {
// do something with the node
}
</script>
<a use:my_action />`,
4,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from an import', () => {
const content = run_autofixers_on_code(
`<script>
import { my_action } from './actions.js';
</script>
<a use:my_action />`,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from the props', () => {
const content = run_autofixers_on_code(
`<script>
const { my_action } = $props();
</script>
<a use:my_action />`,
);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
it('should not add suggestions when using use: on an element and the action comes from a global variable', () => {
const content = run_autofixers_on_code(`<a use:my_action />`);
expect(content.suggestions).not.toContain(
'Consider using an `attachment` instead of an `action` for "my_action".',
);
});
});
});
describe('read_state_with_dollar', () => {
with_possible_inits('($init)', ({ init }) => {
it(`should add an issue when reading a stateful variable initialized with ${init} like if it was a store`, () => {
const content = run_autofixers_on_code(`<script>
let x = ${init}(()=> 43);
$x;
</script>
`);
expect(content.issues).toContain(
`You are reading the stateful variable "$x" with a "$" prefix. Stateful variables are not stores and should be read without the "$". Please read it as a normal variable "x"`,
);
});
});
it(`should not add an issue when reading an imported variable like if it was a store`, () => {
const content = run_autofixers_on_code(`<script>
import { x } from "./my-stores.ts";
$x;
</script>
`);
expect(content.issues).not.toContain(
`You are reading the stateful variable "$x" with a "$" prefix. Stateful variables are not stores and should be read without the "$". Please read it as a normal variable "x"`,
);
});
it(`should not add an issue when reading a non-stateful variable like if it was a store`, () => {
const content = run_autofixers_on_code(`<script>
import { writable } from "svelte/store";
const x = writable(0);
$x;
</script>
`);
expect(content.issues).not.toContain(
`You are reading the stateful variable "$x" with a "$" prefix. Stateful variables are not stores and should be read without the "$". Please read it as a normal variable "x"`,
);
});
it(`should not add an issue when reading a prop like if it was a store`, () => {
const content = run_autofixers_on_code(`<script>
const { x } = $props();
$x;
</script>
`);
expect(content.issues).not.toContain(
`You are reading the stateful variable "$x" with a "$" prefix. Stateful variables are not stores and should be read without the "$". Please read it as a normal variable "x"`,
);
});
// https://github.com/sveltejs/ai-tools/issues/200
it('should not crash when reading $-prefixed identifier for variable initialized with member expression', () => {
expect(() =>
run_autofixers_on_code(`<div>{$x}</div>
<script>
const x = foo.bar;
</script>`),
).not.toThrow();
});
});
});

View File

@@ -0,0 +1,23 @@
import { parse } from '../../parse/parse.js';
import { walk } from '../../mcp/autofixers/ast/walk.js';
import type { Node } from 'estree';
import * as autofixers from './visitors/index.js';
export function add_autofixers_issues(
content: { issues: string[]; suggestions: string[] },
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
const parsed = parse(code, filename);
// Run each autofixer separately to avoid interrupting logic flow
for (const autofixer of Object.values(autofixers)) {
walk(
parsed.ast as unknown as Node,
{ output: content, parsed, desired_svelte_version, async },
autofixer,
);
}
}

View File

@@ -0,0 +1,39 @@
import { compile as compile_component, compileModule } from 'svelte/compiler';
import { extname } from 'path';
import ts from 'ts-blank-space';
export function add_compile_issues(
content: { issues: string[]; suggestions: string[] },
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
let compile = compile_component;
const extension = extname(filename);
if (extension !== '.svelte') {
compile = compileModule;
// compile module doesn't accept .ts files so we need to transpile them first with ts-blank-space
// a fast and lightweight typescript transpiler that can strips types replacing them with white spaces
// so the code positions are not affected
if (extension === '.ts') {
code = ts(code, (node) => {
content.issues.push(
`The provided file is a module but it contains invalid TypeScript code: ${node.getText()} at ${node.getStart()}`,
);
});
}
}
const compilation_result = compile(code, {
filename: filename || 'Component.svelte',
generate: false,
runes: desired_svelte_version >= 5,
experimental: { async },
});
for (const warning of compilation_result.warnings) {
content.issues.push(
`${warning.message} at line ${warning.start?.line}, column ${warning.start?.column}`,
);
}
}

View File

@@ -0,0 +1,96 @@
import { ESLint } from 'eslint';
import svelte_parser from 'svelte-eslint-parser';
import svelte from 'eslint-plugin-svelte';
import type { Config } from '@sveltejs/kit';
import ts from 'typescript-eslint';
let svelte_5_linter: ESLint | undefined;
let svelte_4_linter: ESLint | undefined;
function base_config(svelte_config: Config): ESLint.Options['baseConfig'] {
return [
...svelte.configs.recommended,
{
files: ['*.svelte', '*.svelte.ts', '*.svelte.js'],
rules: {
'no-self-assign': 'warn',
'svelte/infinite-reactive-loop': 'warn',
'svelte/no-dupe-else-if-blocks': 'warn',
'svelte/no-dupe-on-directives': 'warn',
'svelte/no-dupe-style-properties': 'warn',
'svelte/no-dupe-use-directives': 'warn',
'svelte/no-object-in-text-mustaches': 'warn',
'svelte/no-raw-special-elements': 'warn',
'svelte/no-reactive-functions': 'warn',
'svelte/no-reactive-literals': 'warn',
'svelte/no-store-async': 'warn',
'svelte/no-svelte-internal': 'warn',
'svelte/no-unnecessary-state-wrap': 'warn',
'svelte/no-unused-props': 'warn',
'svelte/no-unused-svelte-ignore': 'warn',
'svelte/no-useless-children-snippet': 'warn',
'svelte/no-useless-mustaches': 'warn',
'svelte/prefer-svelte-reactivity': 'warn',
'svelte/prefer-writable-derived': 'warn',
'svelte/require-event-dispatcher-types': 'warn',
'svelte/require-store-reactive-access': 'warn',
'svelte/no-inspect': 'off',
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parser: svelte_parser,
parserOptions: {
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig: svelte_config,
},
},
},
];
}
function get_linter(version: number, async = false) {
if (version < 5) {
return (svelte_4_linter ??= new ESLint({
overrideConfigFile: true,
baseConfig: base_config({
compilerOptions: {
runes: false,
},
}),
}));
}
return (svelte_5_linter ??= new ESLint({
overrideConfigFile: true,
baseConfig: base_config({
compilerOptions: {
runes: true,
experimental: { async },
},
}),
}));
}
export async function add_eslint_issues(
content: { issues: string[]; suggestions: string[] },
code: string,
desired_svelte_version: number,
filename = 'Component.svelte',
async = false,
) {
const eslint = get_linter(desired_svelte_version, async);
const results = await eslint.lintText(code, { filePath: filename || './Component.svelte' });
for (const message of results[0]?.messages ?? []) {
if (message.severity === 2) {
content.issues.push(`${message.message} at line ${message.line}, column ${message.column}`);
} else if (message.severity === 1) {
content.suggestions.push(
`${message.message} at line ${message.line}, column ${message.column}`,
);
}
}
}

View File

@@ -0,0 +1,16 @@
import type { Identifier, MemberExpression } from 'estree';
/**
* Gets the left-most identifier of a member expression or identifier.
*/
export function left_most_id(expression: MemberExpression | Identifier) {
while (expression.type === 'MemberExpression') {
expression = expression.object as MemberExpression | Identifier;
}
if (expression.type !== 'Identifier') {
return null;
}
return expression;
}

View File

@@ -0,0 +1,80 @@
import type {
AssignmentExpression,
CallExpression,
Identifier,
Node,
UpdateExpression,
} from 'estree';
import type { Autofixer, AutofixerState } from './index.js';
import { left_most_id } from '../ast/utils.js';
import type { AST } from 'svelte-eslint-parser';
import type { Context } from 'zimmerframe';
function run_if_in_effect(
path: (Node | AST.SvelteNode)[],
state: AutofixerState,
to_run: () => void,
) {
const in_effect = path.findLast(
(node) =>
node.type === 'CallExpression' && state.parsed.is_rune(node, ['$effect', '$effect.pre']),
);
if (in_effect) {
to_run();
}
}
function assign_or_update_visitor(
node: UpdateExpression | AssignmentExpression,
{ state, path, next }: Context<Node | AST.SvelteNode, AutofixerState>,
) {
run_if_in_effect(path, state, () => {
function check_if_stateful_id(id: Identifier) {
const reference = state.parsed.find_reference_by_id(id);
const definition = reference?.resolved?.defs[0];
if (definition && definition.type === 'Variable') {
const init = definition.node.init;
if (
init?.type === 'CallExpression' &&
state.parsed.is_rune(init, ['$state', '$state.raw', '$derived', '$derived.by'])
) {
state.output.suggestions.push(
`The stateful variable "${id.name}" is assigned inside an $effect which is generally consider a malpractice. Consider using $derived if possible.`,
);
}
}
}
const variable = node.type === 'UpdateExpression' ? node.argument : node.left;
if (variable.type === 'Identifier') {
check_if_stateful_id(variable);
} else if (variable.type === 'MemberExpression') {
const object = left_most_id(variable);
if (object) {
check_if_stateful_id(object);
}
}
});
next();
}
function call_expression_visitor(
node: CallExpression,
{ state, path, next }: Context<Node | AST.SvelteNode, AutofixerState>,
) {
run_if_in_effect(path, state, () => {
const function_name =
node.callee.type === 'Identifier' ? `the function \`${node.callee.name}\`` : 'a function';
state.output.suggestions.push(
`You are calling ${function_name} inside an $effect. Please check if the function is reassigning a stateful variable because that's considered malpractice and check if it could use \`$derived\` instead. Ignore this suggestion if you are sure this function is not assigning any stateful variable or if you can't check if it does.`,
);
});
next();
}
export const assign_in_effect: Autofixer = {
UpdateExpression: assign_or_update_visitor,
AssignmentExpression: assign_or_update_visitor,
CallExpression: call_expression_visitor,
};

View File

@@ -0,0 +1,41 @@
import type { Identifier, PrivateIdentifier } from 'estree';
import type { Autofixer } from './index.js';
export const derived_with_function: Autofixer = {
CallExpression(node, { state, path }) {
if (
node.callee.type === 'Identifier' &&
node.callee.name === '$derived' &&
state.parsed.is_rune(node, ['$derived']) &&
(node.arguments[0]?.type === 'ArrowFunctionExpression' ||
node.arguments[0]?.type === 'FunctionExpression')
) {
const parent = path[path.length - 1];
let variable_id: Identifier | PrivateIdentifier | undefined;
if (parent?.type === 'VariableDeclarator' && parent.id.type === 'Identifier') {
// const something = $derived(...)
variable_id = parent.id;
} else if (parent?.type === 'PropertyDefinition') {
// class X { something = $derived(...) }
variable_id =
parent.key.type === 'Identifier'
? parent.key
: parent.key.type === 'PrivateIdentifier'
? parent.key
: undefined;
} else if (parent?.type === 'AssignmentExpression') {
// this.something = $derived(...)
variable_id =
parent.left.type === 'MemberExpression'
? parent.left.property.type === 'Identifier'
? parent.left.property
: undefined
: undefined;
}
state.output.suggestions.push(
`You are passing a function to $derived ${variable_id ? `when declaring "${variable_id.name}" ` : ''}but $derived expects an expression. You can use $derived.by instead.`,
);
}
},
};

View File

@@ -0,0 +1,53 @@
import { base_runes } from '../../../constants.js';
import type { Autofixer } from './index.js';
const dollarless_runes = base_runes.map((r) => r.replace('$', ''));
function should_suggest_for_source(source: string, rune: string) {
if (!source.includes('svelte')) {
return false;
}
if (source === 'svelte/store' && rune === 'derived') {
return false;
}
return true;
}
export const imported_runes: Autofixer = {
ImportDeclaration(node, { state, next }) {
const source = (node.source.value || node.source.raw?.slice(1, -1))?.toString();
if (source) {
for (const specifier of node.specifiers) {
const id =
specifier.type === 'ImportDefaultSpecifier'
? specifier.local
: specifier.type === 'ImportNamespaceSpecifier'
? specifier.local
: specifier.type === 'ImportSpecifier'
? specifier.imported
: null;
if (
id &&
id.type === 'Identifier' &&
dollarless_runes.includes(id.name) &&
should_suggest_for_source(source, id.name)
) {
if (
source === 'svelte' ||
source.startsWith('svelte/') ||
source.startsWith('@sveltejs')
) {
state.output.suggestions.push(
`You are importing "${id.name}" from "${source}". This is not necessary, all runes are globally available. Please remove this import and use "$${id.name}" directly.`,
);
} else {
state.output.suggestions.push(
`You are importing "${id.name}" from "${source}". If you are trying to import runes to use them this is not necessary, all runes are globally available. Please remove this import and use "$${id.name}" directly. If you are importing the function from a separate library ignore this suggestion.`,
);
}
}
}
}
next();
},
};

View File

@@ -0,0 +1,21 @@
import type { Node } from 'estree';
import type { AST } from 'svelte-eslint-parser';
import type { Visitors } from 'zimmerframe';
import type { ParseResult } from '../../../parse/parse.js';
export type AutofixerState = {
output: { issues: string[]; suggestions: string[] };
parsed: ParseResult;
desired_svelte_version: number;
async?: boolean;
};
export type Autofixer = Visitors<Node | AST.SvelteNode, AutofixerState>;
export * from './assign-in-effect.js';
export * from './wrong-property-access-state.js';
export * from './imported-runes.js';
export * from './derived-with-function.js';
export * from './use-runes-instead-of-store.js';
export * from './suggest-attachments.js';
export * from './read-state-with-dollar.js';

View File

@@ -0,0 +1,22 @@
import type { Autofixer } from './index.js';
export const read_state_with_dollar: Autofixer = {
Identifier(node, { state }) {
if (node.name.startsWith('$')) {
const reference = state.parsed.find_reference_by_id(node);
if (reference && reference.resolved && reference.resolved.defs[0]?.node?.init) {
const is_state = state.parsed.is_rune(reference.resolved.defs[0].node.init, [
'$state',
'$state.raw',
'$derived',
'$derived.by',
]);
if (is_state) {
state.output.issues.push(
`You are reading the stateful variable "${node.name}" with a "$" prefix. Stateful variables are not stores and should be read without the "$". Please read it as a normal variable "${node.name.substring(1)}"`,
);
}
}
}
},
};

View File

@@ -0,0 +1,46 @@
import type { Identifier } from 'estree';
import type { Autofixer } from './index.js';
import { left_most_id } from '../ast/utils.js';
export const suggest_attachments: Autofixer = {
SvelteDirective(node, { state, next, path }) {
if (node.kind === 'Binding' && node.key.name.name === 'this') {
const parent_element = path.findLast((p) => p.type === 'SvelteElement');
if (parent_element?.kind === 'html' && parent_element.startTag.attributes.includes(node)) {
let better_an_attachment = ` or even better an \`attachment\``;
if (state.desired_svelte_version === 4) {
better_an_attachment = ``;
}
state.output.suggestions.push(
`The usage of \`bind:this\` can often be replaced with an easier to read \`action\`${better_an_attachment}. Consider using the latter if possible.`,
);
}
} else if (node.kind === 'Action' && state.desired_svelte_version === 5) {
let id: Identifier | null = null;
if (node.key.name.type === 'Identifier') {
id = node.key.name;
} else if (node.key.name.type === 'MemberExpression') {
id = left_most_id(node.key.name);
}
if (id) {
const reference = state.parsed.find_reference_by_id(id);
const definition = reference?.resolved?.defs[0];
if (
definition &&
(definition.type === 'Variable' ||
!(definition.type === 'ImportBinding' || definition.type === 'Parameter')) &&
!(
definition.type === 'Variable' &&
definition.node.init?.type === 'CallExpression' &&
state.parsed.is_rune(definition.node.init, ['$props'])
)
) {
state.output.suggestions.push(
`Consider using an \`attachment\` instead of an \`action\` for "${id.name}".`,
);
}
}
}
next();
},
};

View File

@@ -0,0 +1,21 @@
import type { Autofixer } from './index.js';
export const use_runes_instead_of_store: Autofixer = {
ImportDeclaration(node, { state, next }) {
const source = (node.source.value || node.source.raw?.slice(1, -1))?.toString();
if (source && source === 'svelte/store') {
for (const specifier of node.specifiers) {
if (
specifier.type === 'ImportSpecifier' &&
specifier.imported.type === 'Identifier' &&
['derived', 'writable', 'readable'].includes(specifier.imported.name)
) {
state.output.suggestions.push(
`You are importing "${specifier.imported.name}" from "svelte/store". Unless the user specifically asked for stores or it's required because some library/component requires a store as input consider using runes like \`$state\` or \`$derived\` instead, all runes are globally available.`,
);
}
}
}
next();
},
};

View File

@@ -0,0 +1,41 @@
import type { Autofixer } from './index.js';
import { left_most_id } from '../ast/utils.js';
const UPDATE_PROPERTIES = new Set(['set', 'update', '$']);
const METHODS = new Set(['set', 'update']);
export const wrong_property_access_state: Autofixer = {
MemberExpression(node, { state, next, path }) {
const parent = path[path.length - 1];
let is_property = false;
if (
node.property.type === 'Identifier' &&
((is_property = !METHODS.has(node.property.name)) ||
(parent?.type === 'CallExpression' && parent.callee === node)) &&
UPDATE_PROPERTIES.has(node.property.name)
) {
const id = left_most_id(node);
if (id) {
const reference = state.parsed.find_reference_by_id(id);
const definition = reference?.resolved?.defs[0];
if (definition && definition.type === 'Variable') {
const init = definition.node.init;
if (
init?.type === 'CallExpression' &&
state.parsed.is_rune(init, ['$state', '$state.raw', '$derived', '$derived.by'])
) {
let suggestion = is_property
? `You are trying to read the stateful variable "${id.name}" using "${node.property.name}". stateful variables should be read just by accessing them like normal variable, do not use properties to read them.`
: `You are trying to update the stateful variable "${id.name}" using "${node.property.name}". stateful variables should be updated with a normal assignment/mutation, do not use methods to update them.`;
const argument = init.arguments[0];
if (!argument || (argument.type !== 'Literal' && argument.type !== 'ArrayExpression')) {
suggestion += ` However I can't verify if "${id.name}" is a state variable of an object or a class with a "${node.property.name}" ${is_property ? 'property' : 'method'} on it. Please verify that before updating the code to use a normal ${is_property ? 'access' : 'assignment'}`;
}
state.output.suggestions.push(suggestion);
}
}
}
}
next();
},
};

View File

@@ -0,0 +1,22 @@
import type { SvelteMcp } from '../index.js';
import * as prompts from './prompts/index.js';
import * as tools from './tools/index.js';
import * as resources from './resources/index.js';
export function setup_tools(server: SvelteMcp) {
for (const tool in tools) {
tools[tool as keyof typeof tools](server);
}
}
export function setup_prompts(server: SvelteMcp) {
for (const prompt in prompts) {
prompts[prompt as keyof typeof prompts](server);
}
}
export function setup_resources(server: SvelteMcp) {
for (const resource in resources) {
resources[resource as keyof typeof resources](server);
}
}

Some files were not shown because too many files have changed in this diff Show More