@sveltejs/opencode 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.ts CHANGED
@@ -15,6 +15,9 @@ const default_config = {
15
15
  instructions: {
16
16
  enabled: true,
17
17
  },
18
+ skills: {
19
+ enabled: true,
20
+ },
18
21
  };
19
22
 
20
23
  export const config_schema = v.object({
@@ -34,6 +37,11 @@ export const config_schema = v.object({
34
37
  enabled: v.optional(v.boolean()),
35
38
  }),
36
39
  ),
40
+ skills: v.optional(
41
+ v.object({
42
+ enabled: v.optional(v.boolean()),
43
+ }),
44
+ ),
37
45
  });
38
46
 
39
47
  export type McpConfig = v.InferInput<typeof config_schema>;
@@ -104,6 +112,10 @@ function merge_with_defaults(user_config: Partial<McpConfig>): McpConfig {
104
112
  ...default_config.instructions,
105
113
  ...user_config.instructions,
106
114
  },
115
+ skills: {
116
+ ...default_config.skills,
117
+ ...user_config.skills,
118
+ },
107
119
  };
108
120
  }
109
121
 
package/index.ts CHANGED
@@ -12,6 +12,8 @@ export const svelte_plugin: Plugin = async (ctx) => {
12
12
  input.agent ??= {};
13
13
  input.mcp ??= {};
14
14
  input.instructions ??= [];
15
+ // @ts-expect-error -- types are wrong in the opencode package...will fix there and remove this
16
+ input.skills ??= [];
15
17
  // by default we use svelte as the name for the svelte MCP server
16
18
  let svelte_mcp_name = 'svelte';
17
19
  // we loop over every mcp server to see if any of them is already the svelte MCP server
@@ -35,6 +37,12 @@ export const svelte_plugin: Plugin = async (ctx) => {
35
37
  input.instructions.push(...instructions_paths.map((file) => join(instructions_dir, file)));
36
38
  }
37
39
 
40
+ if (mcp_config.skills?.enabled !== false) {
41
+ const skills_dir = join(current_dir, 'skills');
42
+ // @ts-expect-error -- skills is a new opencode feature
43
+ input.skills.push(skills_dir);
44
+ }
45
+
38
46
  // if the user doesn't have the MCP server already we add one based on config
39
47
  if (!input.mcp[svelte_mcp_name] && mcp_config.mcp?.enabled !== false) {
40
48
  if (mcp_config.mcp?.type === 'remote') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/opencode",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/sveltejs/mcp#readme",
@@ -10,7 +10,8 @@
10
10
  "files": [
11
11
  "index.ts",
12
12
  "config.ts",
13
- "instructions"
13
+ "instructions",
14
+ "skills"
14
15
  ],
15
16
  "repository": {
16
17
  "type": "git",
@@ -24,7 +25,7 @@
24
25
  "valibot": "^1.2.0"
25
26
  },
26
27
  "devDependencies": {
27
- "@opencode-ai/plugin": "^1.1.21",
28
+ "@opencode-ai/plugin": "^1.1.44",
28
29
  "@valibot/to-json-schema": "^1.5.0",
29
30
  "@types/node": "^24.3.1"
30
31
  },
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: svelte-code-writer
3
+ description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating or editing 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.
4
+ ---
5
+
6
+ # Svelte 5 Code Writer
7
+
8
+ ## CLI Tools
9
+
10
+ You have access to `@sveltejs/mcp` CLI for Svelte-specific assistance. Use these commands via `npx`:
11
+
12
+ ### List Documentation Sections
13
+
14
+ ```bash
15
+ npx @sveltejs/mcp list-sections
16
+ ```
17
+
18
+ Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths.
19
+
20
+ ### Get Documentation
21
+
22
+ ```bash
23
+ npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."
24
+ ```
25
+
26
+ Retrieves full documentation for specified sections. Use after `list-sections` to fetch relevant docs.
27
+
28
+ **Example:**
29
+
30
+ ```bash
31
+ npx @sveltejs/mcp get-documentation "$state,$derived,$effect"
32
+ ```
33
+
34
+ ### Svelte Autofixer
35
+
36
+ ```bash
37
+ npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]
38
+ ```
39
+
40
+ Analyzes Svelte code and suggests fixes for common issues.
41
+
42
+ **Options:**
43
+
44
+ - `--async` - Enable async Svelte mode (default: false)
45
+ - `--svelte-version` - Target version: 4 or 5 (default: 5)
46
+
47
+ **Examples:**
48
+
49
+ ```bash
50
+ # Analyze inline code (escape $ as \$)
51
+ npx @sveltejs/mcp svelte-autofixer '<script>let count = \$state(0);</script>'
52
+
53
+ # Analyze a file
54
+ npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
55
+
56
+ # Target Svelte 4
57
+ npx @sveltejs/mcp svelte-autofixer ./Component.svelte --svelte-version 4
58
+ ```
59
+
60
+ **Important:** When passing code with runes (`$state`, `$derived`, etc.) via the terminal, escape the `$` character as `\$` to prevent shell variable substitution.
61
+
62
+ ## Workflow
63
+
64
+ 1. **Uncertain about syntax?** Run `list-sections` then `get-documentation` for relevant topics
65
+ 2. **Reviewing/debugging?** Run `svelte-autofixer` on the code to detect issues
66
+ 3. **Always validate** - Run `svelte-autofixer` before finalizing any Svelte component