@macroforge/mcp-server 0.1.39 → 0.1.42

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.
@@ -1,45 +1,45 @@
1
1
  # MCP Server
2
2
  *The MCP (Model Context Protocol) server enables AI assistants to understand and work with Macroforge macros, providing documentation lookup, code validation, and macro expansion.*
3
- The local (stdio) version of the MCP server is available via the [`@macroforge/mcp-server`](https://www.npmjs.com/package/@macroforge/mcp-server) npm package. You can either install it globally and then reference it in your configuration or run it with `npx`:
3
+ The local (stdio) version of the MCP server is available via the [<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@macroforge<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">/<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">mcp<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">server</code>](https://www.npmjs.com/package/@macroforge/mcp-server) npm package. You can either install it globally and then reference it in your configuration or run it with <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">npx</code>:
4
4
  ```
5
- npx -y @macroforge/mcp-server
5
+ npx&nbsp;-y&nbsp;@macroforge/mcp-server
6
6
  ``` Here's how to set it up in some common MCP clients:
7
7
  ## Claude Code
8
8
  To include the local MCP version in Claude Code, simply run the following command:
9
9
  ```
10
- claude mcp add -t stdio -s [scope] macroforge -- npx -y @macroforge/mcp-server
11
- ``` The `[scope]` must be `user`, `project` or `local`.
10
+ claude&nbsp;mcp&nbsp;add&nbsp;-t&nbsp;stdio&nbsp;-s&nbsp;[scope]&nbsp;macroforge&nbsp;--&nbsp;npx&nbsp;-y&nbsp;@macroforge/mcp-server
11
+ ``` The <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">[scope]</code> must be <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">user</code>, <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">project</code> or <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">local</code>.
12
12
  ## Claude Desktop
13
- 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:
13
+ In the Settings > Developer section, click on Edit Config. It will open the folder with a <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">claude_desktop_config.json</code> file in it. Edit the file to include the following configuration:
14
14
  ```
15
15
  &#123;
16
- "mcpServers": &#123;
17
- "macroforge": &#123;
18
- "command": "npx",
19
- "args": ["-y", "@macroforge/mcp-server"]
20
- &#125;
21
- &#125;
16
+ &nbsp;&nbsp;&nbsp;&nbsp;"mcpServers":&nbsp;&#123;
17
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"macroforge":&nbsp;&#123;
18
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"command":&nbsp;"npx",
19
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"args":&nbsp;["-y",&nbsp;"@macroforge/mcp-server"]
20
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
21
+ &nbsp;&nbsp;&nbsp;&nbsp;&#125;
22
22
  &#125;
23
23
  ``` ## Codex CLI
24
- 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):
24
+ Add the following to your <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;--shiki-light:#B31D28;--shiki-light-font-style:italic">config.toml</code> (which defaults to <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic;--shiki-light:#B31D28;--shiki-light-font-style:italic">~/.codex/config.toml</code>, but refer to [the configuration documentation](https://github.com/openai/codex/blob/main/docs/config.md) for more advanced setups):
25
25
  ```
26
26
  [mcp_servers.macroforge]
27
- command = "npx"
28
- args = ["-y", "@macroforge/mcp-server"]
27
+ command&nbsp;=&nbsp;"npx"
28
+ args&nbsp;=&nbsp;["-y",&nbsp;"@macroforge/mcp-server"]
29
29
  ``` ## Gemini CLI
30
30
  To include the local MCP version in Gemini CLI, simply run the following command:
31
31
  ```
32
- gemini mcp add -t stdio -s [scope] macroforge npx -y @macroforge/mcp-server
33
- ``` The `[scope]` must be `user`, `project` or `local`.
32
+ gemini&nbsp;mcp&nbsp;add&nbsp;-t&nbsp;stdio&nbsp;-s&nbsp;[scope]&nbsp;macroforge&nbsp;npx&nbsp;-y&nbsp;@macroforge/mcp-server
33
+ ``` The <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">[scope]</code> must be <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">user</code>, <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">project</code> or <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">local</code>.
34
34
  ## Other Clients
35
- 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 @macroforge/mcp-server` as the arguments.
35
+ If we didn't include the MCP client you are using, refer to their documentation for <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">stdio</code> servers and use <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">npx</code> as the command and <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">y @macroforge<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">/<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">mcp<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">server</code> as the arguments.
36
36
  ## Available Tools
37
37
  The MCP server provides five tools for AI assistants:
38
38
  | Tool | Description |
39
39
  | --- | --- |
40
- | `list-sections` | Lists all available Macroforge documentation sections |
41
- | `get-documentation` | Retrieves full documentation for one or more sections |
42
- | `macroforge-autofixer` | Validates code with `@derive` decorators and returns diagnostics |
43
- | `expand-code` | Expands macros and returns the transformed TypeScript code |
44
- | `get-macro-info` | Retrieves documentation for macros and field decorators |
40
+ | list-sections | Lists all available Macroforge documentation sections |
41
+ | get-documentation | Retrieves full documentation for one or more sections |
42
+ | macroforge-autofixer | Validates code with @derive decorators and returns diagnostics |
43
+ | expand-code | Expands macros and returns the transformed TypeScript code |
44
+ | get-macro-info | Retrieves documentation for macros and field decorators |
45
45
  > **Note:** For code validation and expansion features (macroforge-autofixer, expand-code, get-macro-info), the MCP server requires macroforge as a peer dependency. Install it in your project with npm install macroforge.
@@ -1,128 +1,128 @@
1
1
  # Svelte Preprocessor
2
- *The Svelte preprocessor expands Macroforge macros in `<script>` blocks before Svelte compilation, enabling seamless macro usage in Svelte components.*
2
+ *The Svelte preprocessor expands Macroforge macros in <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"><<span style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">script<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">></code> blocks before Svelte compilation, enabling seamless macro usage in Svelte components.*
3
3
  ## Installation
4
4
  ```
5
- npm install -D @macroforge/svelte-preprocessor
5
+ npm&nbsp;install&nbsp;-D&nbsp;@macroforge/svelte-preprocessor
6
6
  ``` ## Configuration
7
- Add the preprocessor to your `svelte.config.js`:
7
+ Add the preprocessor to your <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">svelte.config.js</code>:
8
8
  ```
9
- import adapter from '@sveltejs/adapter-auto';
10
- import &#123; vitePreprocess &#125; from '@sveltejs/vite-plugin-svelte';
11
- import &#123; macroforgePreprocess &#125; from '@macroforge/svelte-preprocessor';
9
+ import&nbsp;adapter&nbsp;from&nbsp;'@sveltejs/adapter-auto';
10
+ import&nbsp;&#123;&nbsp;vitePreprocess&nbsp;&#125;&nbsp;from&nbsp;'@sveltejs/vite-plugin-svelte';
11
+ import&nbsp;&#123;&nbsp;macroforgePreprocess&nbsp;&#125;&nbsp;from&nbsp;'@macroforge/svelte-preprocessor';
12
12
 
13
- /** @type &#123;import('@sveltejs/kit').Config&#125; */
14
- const config = &#123;
15
- preprocess: [
16
- macroforgePreprocess(), // Expand macros FIRST
17
- vitePreprocess() // Then handle TypeScript/CSS
18
- ],
13
+ /**&nbsp;@type&nbsp;&#123;import('@sveltejs/kit').Config&#125;&nbsp;*/
14
+ const&nbsp;config&nbsp;=&nbsp;&#123;
15
+ &nbsp;&nbsp;preprocess:&nbsp;[
16
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforgePreprocess(),&nbsp;&nbsp;//&nbsp;Expand&nbsp;macros&nbsp;FIRST
17
+ &nbsp;&nbsp;&nbsp;&nbsp;vitePreprocess()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Then&nbsp;handle&nbsp;TypeScript/CSS
18
+ &nbsp;&nbsp;],
19
19
 
20
- kit: &#123;
21
- adapter: adapter()
22
- &#125;
20
+ &nbsp;&nbsp;kit:&nbsp;&#123;
21
+ &nbsp;&nbsp;&nbsp;&nbsp;adapter:&nbsp;adapter()
22
+ &nbsp;&nbsp;&#125;
23
23
  &#125;;
24
24
 
25
- export default config;
26
- ``` **Warning Always place `macroforgePreprocess()` **before** other preprocessors like `vitePreprocess()`. This ensures macros are expanded before TypeScript compilation. ## Usage
27
- Use `@derive` decorators directly in your Svelte component scripts:
25
+ export&nbsp;default&nbsp;config;
26
+ ``` **Warning Always place **<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">macroforgePreprocess<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">()</code> **before** other preprocessors like <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#B392F0;--shiki-light:#6F42C1">vitePreprocess<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">()</code>. This ensures macros are expanded before TypeScript compilation. ## Usage
27
+ Use <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorators directly in your Svelte component scripts:
28
28
  ```
29
- &#x3C;script lang="ts">
30
- /** @derive(Debug, Clone) */
31
- class User &#123;
32
- name: string;
33
- email: string;
29
+ &#x3C;script&nbsp;lang="ts">
30
+ &nbsp;&nbsp;/**&nbsp;@derive(Debug,&nbsp;Clone)&nbsp;*/
31
+ &nbsp;&nbsp;class&nbsp;User&nbsp;&#123;
32
+ &nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;string;
33
+ &nbsp;&nbsp;&nbsp;&nbsp;email:&nbsp;string;
34
34
 
35
- constructor(name: string, email: string) &#123;
36
- this.name = name;
37
- this.email = email;
38
- &#125;
39
- &#125;
35
+ &nbsp;&nbsp;&nbsp;&nbsp;constructor(name:&nbsp;string,&nbsp;email:&nbsp;string)&nbsp;&#123;
36
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.name&nbsp;=&nbsp;name;
37
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.email&nbsp;=&nbsp;email;
38
+ &nbsp;&nbsp;&nbsp;&nbsp;&#125;
39
+ &nbsp;&nbsp;&#125;
40
40
 
41
- let user = new User("Alice", "alice@example.com");
42
- console.log(user.toString()); // Generated by Debug macro
41
+ &nbsp;&nbsp;let&nbsp;user&nbsp;=&nbsp;new&nbsp;User("Alice",&nbsp;"alice@example.com");
42
+ &nbsp;&nbsp;console.log(user.toString());&nbsp;&nbsp;//&nbsp;Generated&nbsp;by&nbsp;Debug&nbsp;macro
43
43
  &#x3C;/script>
44
44
 
45
- &#x3C;p>User: &#123;user.name&#125;&#x3C;/p>
45
+ &#x3C;p>User:&nbsp;&#123;user.name&#125;&#x3C;/p>
46
46
  ``` ## Options
47
47
  ```
48
48
  macroforgePreprocess(&#123;
49
- // Keep @derive decorators in output (for debugging)
50
- keepDecorators: false,
49
+ &nbsp;&nbsp;//&nbsp;Keep&nbsp;@derive&nbsp;decorators&nbsp;in&nbsp;output&nbsp;(for&nbsp;debugging)
50
+ &nbsp;&nbsp;keepDecorators:&nbsp;false,
51
51
 
52
- // Process JavaScript files (not just TypeScript)
53
- processJavaScript: false
52
+ &nbsp;&nbsp;//&nbsp;Process&nbsp;JavaScript&nbsp;files&nbsp;(not&nbsp;just&nbsp;TypeScript)
53
+ &nbsp;&nbsp;processJavaScript:&nbsp;false
54
54
  &#125;)
55
55
  ``` ### Option Reference
56
56
  | Option | Type | Default | Description |
57
57
  | --- | --- | --- | --- |
58
- | `keepDecorators` | `boolean` | `false` | Keep decorators in output |
59
- | `processJavaScript` | `boolean` | `false` | Process `<script>` blocks without `lang="ts"` |
58
+ | keepDecorators | boolean | false | Keep decorators in output |
59
+ | processJavaScript | boolean | false | Process <script> blocks without lang="ts" |
60
60
  ## How It Works
61
61
  The preprocessor:
62
- 1. Intercepts `<script lang="ts">` blocks in `.svelte` files
63
- 2. Checks for `@derive` decorators (skips files without them)
62
+ 1. Intercepts <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#F97583;--shiki-light:#D73A49"><<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">script lang<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">=<span style="--shiki-dark:#9ECBFF;--shiki-light:#032F62">"ts"<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">></code> blocks in <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.svelte</code> files
63
+ 2. Checks for <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorators (skips files without them)
64
64
  3. Expands macros using the native Macroforge binary
65
65
  4. Returns the transformed code for Svelte compilation
66
- ****Tip Files without `@derive` decorators are passed through unchanged with zero overhead. ## SvelteKit Integration
67
- For SvelteKit projects, you can use both the preprocessor (for `.svelte` files) and the Vite plugin (for standalone `.ts` files):
66
+ **Tip Files without **<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorators are passed through unchanged with zero overhead. ## SvelteKit Integration
67
+ For SvelteKit projects, you can use both the preprocessor (for <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.svelte</code> files) and the Vite plugin (for standalone <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.ts</code> files):
68
68
  ```
69
- // svelte.config.js
70
- import &#123; macroforgePreprocess &#125; from '@macroforge/svelte-preprocessor';
71
- import &#123; vitePreprocess &#125; from '@sveltejs/vite-plugin-svelte';
69
+ //&nbsp;svelte.config.js
70
+ import&nbsp;&#123;&nbsp;macroforgePreprocess&nbsp;&#125;&nbsp;from&nbsp;'@macroforge/svelte-preprocessor';
71
+ import&nbsp;&#123;&nbsp;vitePreprocess&nbsp;&#125;&nbsp;from&nbsp;'@sveltejs/vite-plugin-svelte';
72
72
 
73
- export default &#123;
74
- preprocess: [
75
- macroforgePreprocess(),
76
- vitePreprocess()
77
- ]
73
+ export&nbsp;default&nbsp;&#123;
74
+ &nbsp;&nbsp;preprocess:&nbsp;[
75
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforgePreprocess(),
76
+ &nbsp;&nbsp;&nbsp;&nbsp;vitePreprocess()
77
+ &nbsp;&nbsp;]
78
78
  &#125;;
79
79
  ``` ```
80
- // vite.config.ts
81
- import macroforge from '@macroforge/vite-plugin';
82
- import &#123; sveltekit &#125; from '@sveltejs/kit/vite';
83
- import &#123; defineConfig &#125; from 'vite';
80
+ //&nbsp;vite.config.ts
81
+ import&nbsp;macroforge&nbsp;from&nbsp;'@macroforge/vite-plugin';
82
+ import&nbsp;&#123;&nbsp;sveltekit&nbsp;&#125;&nbsp;from&nbsp;'@sveltejs/kit/vite';
83
+ import&nbsp;&#123;&nbsp;defineConfig&nbsp;&#125;&nbsp;from&nbsp;'vite';
84
84
 
85
- export default defineConfig(&#123;
86
- plugins: [
87
- macroforge(), // For .ts files
88
- sveltekit()
89
- ]
85
+ export&nbsp;default&nbsp;defineConfig(&#123;
86
+ &nbsp;&nbsp;plugins:&nbsp;[
87
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforge(),&nbsp;&nbsp;//&nbsp;For&nbsp;.ts&nbsp;files
88
+ &nbsp;&nbsp;&nbsp;&nbsp;sveltekit()
89
+ &nbsp;&nbsp;]
90
90
  &#125;);
91
91
  ``` ## Using with Vitest
92
92
  The preprocessor works seamlessly with Vitest for testing Svelte components:
93
93
  ```
94
- // vitest.config.ts
95
- import &#123; defineConfig &#125; from 'vitest/config';
96
- import &#123; sveltekit &#125; from '@sveltejs/kit/vite';
97
- import &#123; svelteTesting &#125; from '@testing-library/svelte/vite';
98
- import macroforge from '@macroforge/vite-plugin';
94
+ //&nbsp;vitest.config.ts
95
+ import&nbsp;&#123;&nbsp;defineConfig&nbsp;&#125;&nbsp;from&nbsp;'vitest/config';
96
+ import&nbsp;&#123;&nbsp;sveltekit&nbsp;&#125;&nbsp;from&nbsp;'@sveltejs/kit/vite';
97
+ import&nbsp;&#123;&nbsp;svelteTesting&nbsp;&#125;&nbsp;from&nbsp;'@testing-library/svelte/vite';
98
+ import&nbsp;macroforge&nbsp;from&nbsp;'@macroforge/vite-plugin';
99
99
 
100
- export default defineConfig(&#123;
101
- plugins: [
102
- macroforge(),
103
- sveltekit(),
104
- svelteTesting()
105
- ],
106
- test: &#123;
107
- environment: 'jsdom',
108
- include: ['src/**/*.&#123;test,spec&#125;.&#123;js,ts&#125;']
109
- &#125;
100
+ export&nbsp;default&nbsp;defineConfig(&#123;
101
+ &nbsp;&nbsp;plugins:&nbsp;[
102
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforge(),
103
+ &nbsp;&nbsp;&nbsp;&nbsp;sveltekit(),
104
+ &nbsp;&nbsp;&nbsp;&nbsp;svelteTesting()
105
+ &nbsp;&nbsp;],
106
+ &nbsp;&nbsp;test:&nbsp;&#123;
107
+ &nbsp;&nbsp;&nbsp;&nbsp;environment:&nbsp;'jsdom',
108
+ &nbsp;&nbsp;&nbsp;&nbsp;include:&nbsp;['src/**/*.&#123;test,spec&#125;.&#123;js,ts&#125;']
109
+ &nbsp;&nbsp;&#125;
110
110
  &#125;);
111
111
  ``` ## Svelte 5 Runes Compatibility
112
- The preprocessor is fully compatible with Svelte 5 runes (`$state`, `$derived`, `$props`, etc.). Files using runes but without `@derive` decorators are skipped entirely.
112
+ The preprocessor is fully compatible with Svelte 5 runes (<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">$state</code>, <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">$derived</code>, <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">$props</code>, etc.). Files using runes but without <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorators are skipped entirely.
113
113
  ```
114
- &#x3C;script lang="ts">
115
- // Runes work normally
116
- let count = $state(0);
117
- let doubled = $derived(count * 2);
114
+ &#x3C;script&nbsp;lang="ts">
115
+ &nbsp;&nbsp;//&nbsp;Runes&nbsp;work&nbsp;normally
116
+ &nbsp;&nbsp;let&nbsp;count&nbsp;=&nbsp;$state(0);
117
+ &nbsp;&nbsp;let&nbsp;doubled&nbsp;=&nbsp;$derived(count&nbsp;*&nbsp;2);
118
118
 
119
- // Macros expand correctly
120
- /** @derive(Debug) */
121
- class Counter &#123;
122
- value: number;
123
- constructor(value: number) &#123;
124
- this.value = value;
125
- &#125;
126
- &#125;
119
+ &nbsp;&nbsp;//&nbsp;Macros&nbsp;expand&nbsp;correctly
120
+ &nbsp;&nbsp;/**&nbsp;@derive(Debug)&nbsp;*/
121
+ &nbsp;&nbsp;class&nbsp;Counter&nbsp;&#123;
122
+ &nbsp;&nbsp;&nbsp;&nbsp;value:&nbsp;number;
123
+ &nbsp;&nbsp;&nbsp;&nbsp;constructor(value:&nbsp;number)&nbsp;&#123;
124
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.value&nbsp;=&nbsp;value;
125
+ &nbsp;&nbsp;&nbsp;&nbsp;&#125;
126
+ &nbsp;&nbsp;&#125;
127
127
  &#x3C;/script>
128
- ```**
128
+ ```
@@ -2,54 +2,53 @@
2
2
  *The TypeScript plugin provides IDE integration for Macroforge, including error reporting, completions, and type checking for generated code.*
3
3
  ## Installation
4
4
  ```
5
- npm install -D @macroforge/typescript-plugin
5
+ npm&nbsp;install&nbsp;-D&nbsp;@macroforge/typescript-plugin
6
6
  ``` ## Configuration
7
- Add the plugin to your `tsconfig.json`:
7
+ Add the plugin to your <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">tsconfig.json</code>:
8
8
  ```
9
9
  &#123;
10
- "compilerOptions": &#123;
11
- "plugins": [
12
- &#123;
13
- "name": "@macroforge/typescript-plugin"
14
- &#125;
15
- ]
16
- &#125;
10
+ &nbsp;&nbsp;"compilerOptions":&nbsp;&#123;
11
+ &nbsp;&nbsp;&nbsp;&nbsp;"plugins":&nbsp;[
12
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
13
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"name":&nbsp;"@macroforge/typescript-plugin"
14
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
15
+ &nbsp;&nbsp;&nbsp;&nbsp;]
16
+ &nbsp;&nbsp;&#125;
17
17
  &#125;
18
18
  ``` ## VS Code Setup
19
19
  VS Code uses its own TypeScript version by default. To use the workspace version (which includes plugins):
20
- 1. Open the Command Palette (`Cmd/Ctrl + Shift + P`)
20
+ 1. Open the Command Palette (<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">Cmd<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">/<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">Ctrl <span style="--shiki-dark:#F97583;--shiki-light:#D73A49">+<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E"> Shift <span style="--shiki-dark:#F97583;--shiki-light:#D73A49">+<span style="--shiki-dark:#79B8FF;--shiki-light:#005CC5"> P</code>)
21
21
  2. Search for "TypeScript: Select TypeScript Version"
22
22
  3. Choose "Use Workspace Version"
23
- **Tip Add this setting to your `.vscode/settings.json` to make it permanent: ```
23
+ **Tip Add this setting to your **<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.vscode/settings.json</code> to make it permanent: ```
24
24
  &#123;
25
- "typescript.tsdk": "node_modules/typescript/lib"
25
+ &nbsp;&nbsp;"typescript.tsdk":&nbsp;"node_modules/typescript/lib"
26
26
  &#125;
27
27
  ``` ## Features
28
28
  ### Error Reporting
29
- Errors in macro-generated code are reported at the `@derive` decorator position:
29
+ Errors in macro-generated code are reported at the <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorator position:
30
30
  ```
31
- /** @derive(Debug) */ // &#x3C;- Errors appear here
32
- class User &#123;
33
- name: string;
31
+ /**&nbsp;@derive(Debug)&nbsp;*/&nbsp;&nbsp;//&nbsp;&#x3C;-&nbsp;Errors&nbsp;appear&nbsp;here
32
+ class&nbsp;User&nbsp;&#123;
33
+ &nbsp;&nbsp;name:&nbsp;string;
34
34
  &#125;
35
35
  ``` ### Completions
36
36
  The plugin provides completions for generated methods:
37
37
  ```
38
- const user = new User("Alice");
39
- user.to // Suggests: toString(), toJSON(), etc.
38
+ const&nbsp;user&nbsp;=&nbsp;new&nbsp;User("Alice");
39
+ user.to&nbsp;&nbsp;//&nbsp;Suggests:&nbsp;toString(),&nbsp;toJSON(),&nbsp;etc.
40
40
  ``` ### Type Information
41
41
  Hover over generated methods to see their types:
42
42
  ```
43
- // Hover over 'clone' shows:
44
- // (method) User.clone(): User
45
- const copy = user.clone();
43
+ //&nbsp;Hover&nbsp;over&nbsp;'clone'&nbsp;shows:
44
+ //&nbsp;(method)&nbsp;User.clone():&nbsp;User
45
+ const&nbsp;copy&nbsp;=&nbsp;user.clone();
46
46
  ``` ## Troubleshooting
47
47
  ### Plugin Not Loading
48
48
  1. Ensure you're using the workspace TypeScript version
49
49
  2. Restart the TypeScript server (Command Palette → "TypeScript: Restart TS Server")
50
- 3. Check that the plugin is listed in `tsconfig.json`
50
+ 3. Check that the plugin is listed in <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">tsconfig.json</code>
51
51
  ### Errors Not Showing
52
52
  If errors from macros aren't appearing:
53
53
  1. Make sure the Vite plugin is also installed (for source file watching)
54
- 2. Check that your file is saved (plugins process on save)
55
- **
54
+ 2. Check that your file is saved (plugins process on save)
@@ -2,68 +2,68 @@
2
2
  *The Vite plugin provides build-time macro expansion, transforming your code during development and production builds.*
3
3
  ## Installation
4
4
  ```
5
- npm install -D @macroforge/vite-plugin
5
+ npm&nbsp;install&nbsp;-D&nbsp;@macroforge/vite-plugin
6
6
  ``` ## Configuration
7
- Add the plugin to your `vite.config.ts`:
7
+ Add the plugin to your <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">vite.config.ts</code>:
8
8
  ```
9
- import macroforge from "@macroforge/vite-plugin";
10
- import &#123; defineConfig &#125; from "vite";
9
+ import&nbsp;macroforge&nbsp;from&nbsp;"@macroforge/vite-plugin";
10
+ import&nbsp;&#123;&nbsp;defineConfig&nbsp;&#125;&nbsp;from&nbsp;"vite";
11
11
 
12
- export default defineConfig(&#123;
13
- plugins: [
14
- macroforge()
15
- ]
12
+ export&nbsp;default&nbsp;defineConfig(&#123;
13
+ &nbsp;&nbsp;plugins:&nbsp;[
14
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforge()
15
+ &nbsp;&nbsp;]
16
16
  &#125;);
17
17
  ``` ## Options
18
18
  ```
19
19
  macroforge(&#123;
20
- // Generate .d.ts files for expanded code
21
- generateTypes: true,
20
+ &nbsp;&nbsp;//&nbsp;Generate&nbsp;.d.ts&nbsp;files&nbsp;for&nbsp;expanded&nbsp;code
21
+ &nbsp;&nbsp;generateTypes:&nbsp;true,
22
22
 
23
- // Output directory for generated types
24
- typesOutputDir: ".macroforge/types",
23
+ &nbsp;&nbsp;//&nbsp;Output&nbsp;directory&nbsp;for&nbsp;generated&nbsp;types
24
+ &nbsp;&nbsp;typesOutputDir:&nbsp;".macroforge/types",
25
25
 
26
- // Emit metadata files for debugging
27
- emitMetadata: false,
26
+ &nbsp;&nbsp;//&nbsp;Emit&nbsp;metadata&nbsp;files&nbsp;for&nbsp;debugging
27
+ &nbsp;&nbsp;emitMetadata:&nbsp;false,
28
28
 
29
- // Keep @derive decorators in output (for debugging)
30
- keepDecorators: false,
29
+ &nbsp;&nbsp;//&nbsp;Keep&nbsp;@derive&nbsp;decorators&nbsp;in&nbsp;output&nbsp;(for&nbsp;debugging)
30
+ &nbsp;&nbsp;keepDecorators:&nbsp;false,
31
31
 
32
- // File patterns to process
33
- include: ["**/*.ts", "**/*.tsx"],
34
- exclude: ["node_modules/**"]
32
+ &nbsp;&nbsp;//&nbsp;File&nbsp;patterns&nbsp;to&nbsp;process
33
+ &nbsp;&nbsp;include:&nbsp;["**/*.ts",&nbsp;"**/*.tsx"],
34
+ &nbsp;&nbsp;exclude:&nbsp;["node_modules/**"]
35
35
  &#125;)
36
36
  ``` ### Option Reference
37
37
  | Option | Type | Default | Description |
38
38
  | --- | --- | --- | --- |
39
- | `generateTypes` | `boolean` | `true` | Generate .d.ts files |
40
- | `typesOutputDir` | `string` | `.macroforge/types` | Where to write type files |
41
- | `emitMetadata` | `boolean` | `false` | Emit macro metadata files |
42
- | `keepDecorators` | `boolean` | `false` | Keep decorators in output |
39
+ | generateTypes | boolean | true | Generate .d.ts files |
40
+ | typesOutputDir | string | .macroforge/types | Where to write type files |
41
+ | emitMetadata | boolean | false | Emit macro metadata files |
42
+ | keepDecorators | boolean | false | Keep decorators in output |
43
43
  ## Framework Integration
44
44
  ### React (Vite)
45
45
  ```
46
- import macroforge from "@macroforge/vite-plugin";
47
- import react from "@vitejs/plugin-react";
48
- import &#123; defineConfig &#125; from "vite";
46
+ import&nbsp;macroforge&nbsp;from&nbsp;"@macroforge/vite-plugin";
47
+ import&nbsp;react&nbsp;from&nbsp;"@vitejs/plugin-react";
48
+ import&nbsp;&#123;&nbsp;defineConfig&nbsp;&#125;&nbsp;from&nbsp;"vite";
49
49
 
50
- export default defineConfig(&#123;
51
- plugins: [
52
- macroforge(), // Before React plugin
53
- react()
54
- ]
50
+ export&nbsp;default&nbsp;defineConfig(&#123;
51
+ &nbsp;&nbsp;plugins:&nbsp;[
52
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforge(),&nbsp;&nbsp;//&nbsp;Before&nbsp;React&nbsp;plugin
53
+ &nbsp;&nbsp;&nbsp;&nbsp;react()
54
+ &nbsp;&nbsp;]
55
55
  &#125;);
56
56
  ``` ### SvelteKit
57
57
  ```
58
- import macroforge from "@macroforge/vite-plugin";
59
- import &#123; sveltekit &#125; from "@sveltejs/kit/vite";
60
- import &#123; defineConfig &#125; from "vite";
58
+ import&nbsp;macroforge&nbsp;from&nbsp;"@macroforge/vite-plugin";
59
+ import&nbsp;&#123;&nbsp;sveltekit&nbsp;&#125;&nbsp;from&nbsp;"@sveltejs/kit/vite";
60
+ import&nbsp;&#123;&nbsp;defineConfig&nbsp;&#125;&nbsp;from&nbsp;"vite";
61
61
 
62
- export default defineConfig(&#123;
63
- plugins: [
64
- macroforge(), // Before SvelteKit
65
- sveltekit()
66
- ]
62
+ export&nbsp;default&nbsp;defineConfig(&#123;
63
+ &nbsp;&nbsp;plugins:&nbsp;[
64
+ &nbsp;&nbsp;&nbsp;&nbsp;macroforge(),&nbsp;&nbsp;//&nbsp;Before&nbsp;SvelteKit
65
+ &nbsp;&nbsp;&nbsp;&nbsp;sveltekit()
66
+ &nbsp;&nbsp;]
67
67
  &#125;);
68
68
  ``` > **Note:** Always place the Macroforge plugin before other framework plugins to ensure macros are expanded first. ## Development Server
69
69
  During development, the plugin:
@@ -74,4 +74,4 @@ export default defineConfig(&#123;
74
74
  During production builds, the plugin:
75
75
  - Expands all macros in the source files
76
76
  - Generates type declaration files
77
- - Strips `@derive` decorators from output
77
+ - Strips <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@derive</code> decorators from output
@@ -1,5 +1,5 @@
1
1
  # Svelte Language Server
2
- *`@macroforge/svelte-language-server` provides full Svelte IDE support with macroforge integration.*
2
+ *<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@macroforge<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">/<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">svelte<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">language<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">server</code> provides full Svelte IDE support with macroforge integration.*
3
3
  **Developer Installation Required This package is not yet published as an official extension. You'll need to build and install it manually. ## Features
4
4
  - **Svelte syntax diagnostics** - Errors and warnings in .svelte files
5
5
  - **HTML support** - Hover info, autocompletions, Emmet, outline symbols
@@ -10,32 +10,31 @@
10
10
  ## Installation
11
11
  ### 1. Clone the Repository
12
12
  ```
13
- git clone https://github.com/rymskip/macroforge-ts.git
14
- cd macroforge-ts
13
+ git&nbsp;clone&nbsp;https://github.com/rymskip/macroforge-ts.git
14
+ cd&nbsp;macroforge-ts
15
15
  ``` ### 2. Build the Language Server
16
16
  ```
17
- # Install dependencies
18
- npm install
17
+ #&nbsp;Install&nbsp;dependencies
18
+ npm&nbsp;install
19
19
 
20
- # Build the Svelte language server
21
- cd packages/svelte-language-server
22
- npm run build
20
+ #&nbsp;Build&nbsp;the&nbsp;Svelte&nbsp;language&nbsp;server
21
+ cd&nbsp;packages/svelte-language-server
22
+ npm&nbsp;run&nbsp;build
23
23
  ``` ### 3. Configure Your Editor
24
- The language server exposes a `svelteserver` binary that implements the Language Server Protocol (LSP). Configure your editor to use it:
24
+ The language server exposes a **<code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">svelteserver</code> binary that implements the Language Server Protocol (LSP). Configure your editor to use it:
25
25
  ```
26
- # The binary is located at:
26
+ #&nbsp;The&nbsp;binary&nbsp;is&nbsp;located&nbsp;at:
27
27
  ./packages/svelte-language-server/bin/server.js
28
28
  ``` ## Package Info
29
- | Package | `@macroforge/svelte-language-server` |
29
+ | Package | @macroforge/svelte-language-server |
30
30
  | Version | 0.1.7 |
31
- | CLI Command | `svelteserver` |
31
+ | CLI Command | svelteserver |
32
32
  | Node Version | >= 18.0.0 |
33
33
  ## How It Works
34
34
  The Svelte language server extends the standard Svelte language tooling with macroforge integration:
35
- 1. Parses `.svelte` files and extracts TypeScript/JavaScript blocks
36
- 2. Expands macros using the `@macroforge/typescript-plugin`
35
+ 1. Parses <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">.svelte</code> files and extracts TypeScript/JavaScript blocks
36
+ 2. Expands macros using the <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">@macroforge<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">/<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">typescript<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">plugin</code>
37
37
  3. Maps diagnostics back to original source positions
38
38
  4. Provides completions for macro-generated methods
39
39
  ## Using with Zed
40
- For Zed editor, see the [Zed Extensions](../../docs/language-servers/zed) page for the dedicated `svelte-macroforge` extension.
41
- **
40
+ For Zed editor, see the [Zed Extensions](../../docs/language-servers/zed) page for the dedicated <code class="shiki-inline"><span class="line"><span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">svelte<span style="--shiki-dark:#F97583;--shiki-light:#D73A49">-<span style="--shiki-dark:#E1E4E8;--shiki-light:#24292E">macroforge</code> extension.