-
-
Notifications
You must be signed in to change notification settings - Fork 89
feat: welcome ai-tools
#1050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jycouet
wants to merge
10
commits into
main
Choose a base branch
from
ai-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: welcome ai-tools
#1050
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b2708a6
mv
jycouet 1ea90d1
feat: welcome `ai-tools`
jycouet d594c43
abc
jycouet 980ee92
don't format skills
jycouet cbe7987
opencode -> plugin, claude question, subagents
jycouet b9d2d34
fmt
jycouet f2546ba
cleanup snap
jycouet b2588fd
merging
jycouet 44d2dc8
snap
jycouet dcf4696
Merge branch 'main' of github.com:sveltejs/cli into ai-tools
jycouet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'sv': minor | ||
| --- | ||
|
|
||
| feat(ai-tools): replace `mcp` add-on with `ai-tools` add-on that includes both MCP and skills setup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| packages/sv/src/cli/tests/snapshots/* | ||
| packages/sv-utils/src/tests/**/output.ts | ||
| packages/sv-utils/src/tests/**/output.ts | ||
| packages/sv/src/create/shared/+skills/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,26 @@ const options = defineAddonOptions() | |
| required: true, | ||
| condition: ({ ide }) => !(ide.length === 1 && ide.includes('opencode')) | ||
| }) | ||
| .add('skills', { | ||
| question: 'Do you want to install skills?', | ||
| type: 'select', | ||
| default: 'files', | ||
| options: [ | ||
| { value: 'files', label: 'Add files to the project' }, | ||
| { | ||
| value: 'none', | ||
| label: 'Skip', | ||
| hint: 'for Claude Code you can install the plugin instead: /plugin install svelte' | ||
| } | ||
| ], | ||
| condition: ({ ide }) => ide.some((i) => i !== 'opencode' && i !== 'other') | ||
| }) | ||
| .build(); | ||
|
|
||
| export default defineAddon({ | ||
| id: 'mcp', | ||
| shortDescription: 'Svelte MCP', | ||
| homepage: 'https://svelte.dev/docs/mcp', | ||
| id: 'ai-tools', | ||
| shortDescription: 'Svelte AI Tools', | ||
| homepage: 'https://svelte.dev/docs/ai', | ||
| options, | ||
| run: ({ sv, options }) => { | ||
| const getLocalConfig = (o?: { | ||
|
|
@@ -72,14 +86,19 @@ export default defineAddon({ | |
| }; | ||
| agentPath: string; | ||
| configPath: string; | ||
| skillsPath?: string; | ||
| agentsPath?: string; | ||
| agentExtension?: string; | ||
| customData?: Record<string, any>; | ||
| extraFiles?: Array<{ path: string; data: Record<string, any> }>; | ||
| } | ||
| | { other: true } | ||
| > = { | ||
| 'claude-code': { | ||
| agentPath: 'CLAUDE.md', | ||
| agentPath: '.claude/CLAUDE.md', | ||
| configPath: '.mcp.json', | ||
| skillsPath: '.claude/skills', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Claude plugin also ships with skills but we can't really add it for them I think...what can we do in this case to avoid adding duplicate stuff?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| agentsPath: '.claude/agents', | ||
| mcpOptions: { | ||
| typeLocal: 'stdio', | ||
| typeRemote: 'http', | ||
|
|
@@ -89,11 +108,13 @@ export default defineAddon({ | |
| cursor: { | ||
| agentPath: 'AGENTS.md', | ||
| configPath: '.cursor/mcp.json', | ||
| agentsPath: '.cursor/agents', | ||
| mcpOptions: {} | ||
| }, | ||
| gemini: { | ||
| agentPath: 'GEMINI.md', | ||
| configPath: '.gemini/settings.json', | ||
| agentsPath: '.gemini/agents', | ||
| schema: | ||
| 'https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json', | ||
| mcpOptions: {} | ||
|
|
@@ -115,6 +136,8 @@ export default defineAddon({ | |
| vscode: { | ||
| agentPath: 'AGENTS.md', | ||
| configPath: '.vscode/mcp.json', | ||
| agentsPath: '.github/agents', | ||
| agentExtension: '.agent.md', | ||
| mcpOptions: { | ||
| serversKey: 'servers' | ||
| } | ||
|
|
@@ -127,16 +150,29 @@ export default defineAddon({ | |
| const filesAdded: string[] = []; | ||
| const filesExistingAlready: string[] = []; | ||
|
|
||
| const sharedFiles = getSharedFiles().filter((file) => file.include.includes('mcp')); | ||
| const agentFile = sharedFiles.find((file) => file.name === 'AGENTS.md'); | ||
| const sharedFiles = getSharedFiles(); | ||
| const mcpFiles = sharedFiles.filter((file) => file.include.includes('mcp')); | ||
| const skillFiles = sharedFiles.filter((file) => file.include.includes('skills')); | ||
| const agentFiles = sharedFiles.filter((file) => file.include.includes('agents')); | ||
| const agentFile = mcpFiles.find((file) => file.name === 'AGENTS.md'); | ||
|
|
||
| for (const ide of options.ide) { | ||
| const value = configurator[ide]; | ||
|
|
||
| if (value === undefined) continue; | ||
| if ('other' in value) continue; | ||
|
|
||
| const { mcpOptions, agentPath, configPath, schema, customData, extraFiles } = value; | ||
| const { | ||
| mcpOptions, | ||
| agentPath, | ||
| configPath, | ||
| skillsPath, | ||
| agentsPath, | ||
| agentExtension, | ||
| schema, | ||
| customData, | ||
| extraFiles | ||
| } = value; | ||
|
|
||
| // We only add the agent file if it's not already added | ||
| if (!filesAdded.includes(agentPath)) { | ||
|
|
@@ -184,12 +220,42 @@ export default defineAddon({ | |
| ); | ||
| } | ||
| } | ||
|
|
||
| // Add skills for clients that support them (not opencode - plugin handles it) | ||
| if (skillsPath && options.skills === 'files') { | ||
| for (const file of skillFiles) { | ||
| const filePath = `${skillsPath}/${file.name}`; | ||
| sv.file(filePath, (content) => { | ||
| if (content) { | ||
| filesExistingAlready.push(filePath); | ||
| return false; | ||
| } | ||
| return file.contents; | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // Add sub-agents for clients that support them (not opencode - plugin handles it) | ||
| if (agentsPath) { | ||
| for (const file of agentFiles) { | ||
| const ext = agentExtension ?? '.md'; | ||
| const name = file.name.replace(/\.md$/, ext); | ||
| const filePath = `${agentsPath}/${name}`; | ||
| sv.file(filePath, (content) => { | ||
| if (content) { | ||
| filesExistingAlready.push(filePath); | ||
| return false; | ||
| } | ||
| return file.contents; | ||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (filesExistingAlready.length > 0) { | ||
| log.warn( | ||
| `${filesExistingAlready.map((path) => color.path(path)).join(', ')} already exists, we didn't touch ${filesExistingAlready.length > 1 ? 'them' : 'it'}. ` + | ||
| `See ${color.website('https://svelte.dev/docs/mcp/overview#Usage')} for manual setup.` | ||
| `See ${color.website('https://svelte.dev/docs/ai')} for manual setup.` | ||
| ); | ||
| } | ||
| }, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...cli/tests/snapshots/create-with-all-addons/.claude/agents/sv-files-snapshots.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| svelte-file-editor.md |
11 changes: 11 additions & 0 deletions
11
...cli/tests/snapshots/create-with-all-addons/.claude/skills/sv-files-snapshots.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| svelte-code-writer/SKILL.md | ||
| svelte-core-bestpractices/SKILL.md | ||
| svelte-core-bestpractices/references/$inspect.md | ||
| svelte-core-bestpractices/references/@attach.md | ||
| svelte-core-bestpractices/references/@render.md | ||
| svelte-core-bestpractices/references/await-expressions.md | ||
| svelte-core-bestpractices/references/bind.md | ||
| svelte-core-bestpractices/references/each.md | ||
| svelte-core-bestpractices/references/hydratable.md | ||
| svelte-core-bestpractices/references/snippet.md | ||
| svelte-core-bestpractices/references/svelte-reactivity.md |
1 change: 1 addition & 0 deletions
1
...cli/tests/snapshots/create-with-all-addons/.cursor/agents/sv-files-snapshots.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| svelte-file-editor.md |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Uh oh!
There was an error while loading. Please reload this page.