@macroforge/mcp-server 0.1.38 → 0.1.39

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.
@@ -69,7 +69,7 @@ const user = new User("Alice", 30, "alice@example.com");
69
69
 
70
70
  // Debug: toString()
71
71
  console.log(user.toString());
72
- // Output: User { name: Alice, age: 30, email: alice@example.com }
72
+ // Output: User { name: Alice, age: 30, email: alice@example.com }
73
73
 
74
74
  // Clone: clone()
75
75
  const copy = user.clone();
@@ -130,7 +130,7 @@ export function userToString(value: User): string {
130
130
  ``` ```
131
131
  const user = new User(42, "Alice", "secret123");
132
132
  console.log(user.toString());
133
- // Output: User { userId: 42, name: Alice }
133
+ // Output: User { userId: 42, name: Alice }
134
134
  // Note: 'id' is renamed to 'userId', 'password' is skipped
135
135
  ``` **Field-level decorators Field-level decorators let you control exactly how each field is handled by the macro. ## Next Steps
136
136
  - [Learn how macros work under the hood](../../docs/concepts)
@@ -15,15 +15,15 @@ pnpm add macroforge
15
15
  The simplest way to use Macroforge is with the built-in derive macros. Add a `@derive` comment decorator to your class:
16
16
  ```
17
17
  /** @derive(Debug, Clone, PartialEq) */
18
- class User {
18
+ class User {
19
19
  name: string;
20
20
  age: number;
21
21
 
22
- constructor(name: string, age: number) {
22
+ constructor(name: string, age: number) {
23
23
  this.name = name;
24
24
  this.age = age;
25
- }
26
- }
25
+ }
26
+ }
27
27
 
28
28
  // After macro expansion, User has:
29
29
  // - toString(): string (from Debug)
@@ -32,15 +32,15 @@ class User {
32
32
  ``` ## IDE Integration
33
33
  For the best development experience, add the TypeScript plugin to your `tsconfig.json`:
34
34
  ```
35
- {
36
- "compilerOptions": {
35
+ {
36
+ "compilerOptions": {
37
37
  "plugins": [
38
- {
38
+ {
39
39
  "name": "@macroforge/typescript-plugin"
40
- }
40
+ }
41
41
  ]
42
- }
43
- }
42
+ }
43
+ }
44
44
  ``` This enables features like:
45
45
  - Accurate error positions in your source code
46
46
  - Autocompletion for generated methods
@@ -49,16 +49,16 @@ class User {
49
49
  If you're using Vite, add the plugin to your config for automatic macro expansion during build:
50
50
  ```
51
51
  import macroforge from "@macroforge/vite-plugin";
52
- import { defineConfig } from "vite";
52
+ import { defineConfig } from "vite";
53
53
 
54
- export default defineConfig({
54
+ export default defineConfig({
55
55
  plugins: [
56
- macroforge({
56
+ macroforge({
57
57
  generateTypes: true,
58
58
  typesOutputDir: ".macroforge/types"
59
- })
59
+ })
60
60
  ]
61
- });
61
+ });
62
62
  ``` ## Next Steps
63
63
  Now that you have Macroforge installed, learn how to use it:
64
64
  - [Create your first macro](../docs/getting-started/first-macro)
@@ -15,7 +15,7 @@ cargo build --release --bin macroforge
15
15
  ### macroforge expand
16
16
  Expands macros in a TypeScript file and outputs the transformed code.
17
17
  ```
18
- macroforge expand <input> [options]
18
+ macroforge expand &#x3C;input> [options]
19
19
  ``` #### Arguments
20
20
  | Argument | Description |
21
21
  | --- | --- |
@@ -60,15 +60,15 @@ macroforge tsc -p tsconfig.build.json
60
60
  When expanding a file like this:
61
61
  ```
62
62
  /** @derive(Debug) */
63
- class User {
63
+ class User &#123;
64
64
  name: string;
65
65
  age: number;
66
66
 
67
- constructor(name: string, age: number) {
67
+ constructor(name: string, age: number) &#123;
68
68
  this.name = name;
69
69
  this.age = age;
70
- }
71
- }
70
+ &#125;
71
+ &#125;
72
72
  ``` The CLI outputs the expanded code with the generated methods:
73
73
  ```
74
74
  class User {
@@ -94,11 +94,11 @@ class User {
94
94
  Use `macroforge tsc` in your CI pipeline to type-check with macro expansion:
95
95
  ```
96
96
  # package.json
97
- {
98
- "scripts": {
97
+ &#123;
98
+ "scripts": &#123;
99
99
  "typecheck": "macroforge tsc"
100
- }
101
- }
100
+ &#125;
101
+ &#125;
102
102
  ``` ### Debugging Macro Output
103
103
  Use `macroforge expand` to inspect what code your macros generate:
104
104
  ```
@@ -3,17 +3,17 @@
3
3
  ## Configuration File
4
4
  Create a `macroforge.json` file:
5
5
  ```
6
- {
6
+ &#123;
7
7
  "allowNativeMacros": true,
8
8
  "macroPackages": [],
9
9
  "keepDecorators": false,
10
- "limits": {
10
+ "limits": &#123;
11
11
  "maxExecutionTimeMs": 5000,
12
12
  "maxMemoryBytes": 104857600,
13
13
  "maxOutputSize": 10485760,
14
14
  "maxDiagnostics": 100
15
- }
16
- }
15
+ &#125;
16
+ &#125;
17
17
  ``` ## Options Reference
18
18
  ### allowNativeMacros
19
19
  | Type | `boolean` |
@@ -24,12 +24,12 @@
24
24
  | Default | `[]` |
25
25
  List of npm packages that provide macros. Macroforge will look for macros in these packages.
26
26
  ```
27
- {
27
+ &#123;
28
28
  "macroPackages": [
29
29
  "@my-org/custom-macros",
30
30
  "community-macros"
31
31
  ]
32
- }
32
+ &#125;
33
33
  ``` ### keepDecorators
34
34
  | Type | `boolean` |
35
35
  | Default | `false` |
@@ -37,8 +37,8 @@
37
37
  ### limits
38
38
  Configure resource limits for macro expansion:
39
39
  ```
40
- {
41
- "limits": {
40
+ &#123;
41
+ "limits": &#123;
42
42
  // Maximum time for a single macro expansion (ms)
43
43
  "maxExecutionTimeMs": 5000,
44
44
 
@@ -50,18 +50,18 @@
50
50
 
51
51
  // Maximum number of diagnostics per file
52
52
  "maxDiagnostics": 100
53
- }
54
- }
53
+ &#125;
54
+ &#125;
55
55
  ``` ## Macro Runtime Overrides
56
56
  Override settings for specific macros:
57
57
  ```
58
- {
59
- "macroRuntimeOverrides": {
60
- "@my-org/macros": {
58
+ &#123;
59
+ "macroRuntimeOverrides": &#123;
60
+ "@my-org/macros": &#123;
61
61
  "maxExecutionTimeMs": 10000
62
- }
63
- }
64
- }
62
+ &#125;
63
+ &#125;
64
+ &#125;
65
65
  ``` **Warning Be careful when increasing limits, as this could allow malicious macros to consume excessive resources. ## Environment Variables
66
66
  Some settings can be overridden with environment variables:
67
67
  | Variable | Description |
@@ -12,14 +12,14 @@ claude mcp add -t stdio -s [scope] macroforge -- npx -y @macroforge/mcp-server
12
12
  ## Claude Desktop
13
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:
14
14
  ```
15
- {
16
- "mcpServers": {
17
- "macroforge": {
15
+ &#123;
16
+ "mcpServers": &#123;
17
+ "macroforge": &#123;
18
18
  "command": "npx",
19
19
  "args": ["-y", "@macroforge/mcp-server"]
20
- }
21
- }
22
- }
20
+ &#125;
21
+ &#125;
22
+ &#125;
23
23
  ``` ## Codex CLI
24
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):
25
25
  ```
@@ -7,52 +7,51 @@ npm install -D @macroforge/svelte-preprocessor
7
7
  Add the preprocessor to your `svelte.config.js`:
8
8
  ```
9
9
  import adapter from '@sveltejs/adapter-auto';
10
- import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
11
- import { macroforgePreprocess } from '@macroforge/svelte-preprocessor';
10
+ import &#123; vitePreprocess &#125; from '@sveltejs/vite-plugin-svelte';
11
+ import &#123; macroforgePreprocess &#125; from '@macroforge/svelte-preprocessor';
12
12
 
13
- /** @type {import('@sveltejs/kit').Config} */
14
- const config = {
13
+ /** @type &#123;import('@sveltejs/kit').Config&#125; */
14
+ const config = &#123;
15
15
  preprocess: [
16
16
  macroforgePreprocess(), // Expand macros FIRST
17
17
  vitePreprocess() // Then handle TypeScript/CSS
18
18
  ],
19
19
 
20
- kit: {
20
+ kit: &#123;
21
21
  adapter: adapter()
22
- }
23
- };
22
+ &#125;
23
+ &#125;;
24
24
 
25
25
  export default config;
26
26
  ``` **Warning Always place `macroforgePreprocess()` **before** other preprocessors like `vitePreprocess()`. This ensures macros are expanded before TypeScript compilation. ## Usage
27
27
  Use `@derive` decorators directly in your Svelte component scripts:
28
28
  ```
29
- **<script lang="ts">
29
+ &#x3C;script lang="ts">
30
30
  /** @derive(Debug, Clone) */
31
- class User {
31
+ class User &#123;
32
32
  name: string;
33
33
  email: string;
34
34
 
35
- constructor(name: string, email: string) {
35
+ constructor(name: string, email: string) &#123;
36
36
  this.name = name;
37
37
  this.email = email;
38
- }
39
- }
38
+ &#125;
39
+ &#125;
40
40
 
41
41
  let user = new User("Alice", "alice@example.com");
42
42
  console.log(user.toString()); // Generated by Debug macro
43
- </script>
44
-
45
- User: {user.name}
43
+ &#x3C;/script>
46
44
 
45
+ &#x3C;p>User: &#123;user.name&#125;&#x3C;/p>
47
46
  ``` ## Options
48
47
  ```
49
- macroforgePreprocess({
48
+ macroforgePreprocess(&#123;
50
49
  // Keep @derive decorators in output (for debugging)
51
50
  keepDecorators: false,
52
51
 
53
52
  // Process JavaScript files (not just TypeScript)
54
53
  processJavaScript: false
55
- })
54
+ &#125;)
56
55
  ``` ### Option Reference
57
56
  | Option | Type | Default | Description |
58
57
  | --- | --- | --- | --- |
@@ -64,66 +63,66 @@ macroforgePreprocess({
64
63
  2. Checks for `@derive` decorators (skips files without them)
65
64
  3. Expands macros using the native Macroforge binary
66
65
  4. Returns the transformed code for Svelte compilation
67
- **Tip Files without `@derive` decorators are passed through unchanged with zero overhead. ## SvelteKit Integration
66
+ ****Tip Files without `@derive` decorators are passed through unchanged with zero overhead. ## SvelteKit Integration
68
67
  For SvelteKit projects, you can use both the preprocessor (for `.svelte` files) and the Vite plugin (for standalone `.ts` files):
69
68
  ```
70
69
  // svelte.config.js
71
- import { macroforgePreprocess } from '@macroforge/svelte-preprocessor';
72
- import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
70
+ import &#123; macroforgePreprocess &#125; from '@macroforge/svelte-preprocessor';
71
+ import &#123; vitePreprocess &#125; from '@sveltejs/vite-plugin-svelte';
73
72
 
74
- export default {
73
+ export default &#123;
75
74
  preprocess: [
76
75
  macroforgePreprocess(),
77
76
  vitePreprocess()
78
77
  ]
79
- };
78
+ &#125;;
80
79
  ``` ```
81
80
  // vite.config.ts
82
81
  import macroforge from '@macroforge/vite-plugin';
83
- import { sveltekit } from '@sveltejs/kit/vite';
84
- import { defineConfig } from 'vite';
82
+ import &#123; sveltekit &#125; from '@sveltejs/kit/vite';
83
+ import &#123; defineConfig &#125; from 'vite';
85
84
 
86
- export default defineConfig({
85
+ export default defineConfig(&#123;
87
86
  plugins: [
88
87
  macroforge(), // For .ts files
89
88
  sveltekit()
90
89
  ]
91
- });
90
+ &#125;);
92
91
  ``` ## Using with Vitest
93
92
  The preprocessor works seamlessly with Vitest for testing Svelte components:
94
93
  ```
95
94
  // vitest.config.ts
96
- import { defineConfig } from 'vitest/config';
97
- import { sveltekit } from '@sveltejs/kit/vite';
98
- import { svelteTesting } from '@testing-library/svelte/vite';
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';
99
98
  import macroforge from '@macroforge/vite-plugin';
100
99
 
101
- export default defineConfig({
100
+ export default defineConfig(&#123;
102
101
  plugins: [
103
102
  macroforge(),
104
103
  sveltekit(),
105
104
  svelteTesting()
106
105
  ],
107
- test: {
106
+ test: &#123;
108
107
  environment: 'jsdom',
109
- include: ['src/**/*.{test,spec}.{js,ts}']
110
- }
111
- });
108
+ include: ['src/**/*.&#123;test,spec&#125;.&#123;js,ts&#125;']
109
+ &#125;
110
+ &#125;);
112
111
  ``` ## Svelte 5 Runes Compatibility
113
112
  The preprocessor is fully compatible with Svelte 5 runes (`$state`, `$derived`, `$props`, etc.). Files using runes but without `@derive` decorators are skipped entirely.
114
113
  ```
115
- **<script lang="ts">
114
+ &#x3C;script lang="ts">
116
115
  // Runes work normally
117
116
  let count = $state(0);
118
117
  let doubled = $derived(count * 2);
119
118
 
120
119
  // Macros expand correctly
121
120
  /** @derive(Debug) */
122
- class Counter {
121
+ class Counter &#123;
123
122
  value: number;
124
- constructor(value: number) {
123
+ constructor(value: number) &#123;
125
124
  this.value = value;
126
- }
127
- }
128
- </script>
129
- ```
125
+ &#125;
126
+ &#125;
127
+ &#x3C;/script>
128
+ ```**
@@ -6,32 +6,32 @@ npm install -D @macroforge/typescript-plugin
6
6
  ``` ## Configuration
7
7
  Add the plugin to your `tsconfig.json`:
8
8
  ```
9
- {
10
- "compilerOptions": {
9
+ &#123;
10
+ "compilerOptions": &#123;
11
11
  "plugins": [
12
- {
12
+ &#123;
13
13
  "name": "@macroforge/typescript-plugin"
14
- }
14
+ &#125;
15
15
  ]
16
- }
17
- }
16
+ &#125;
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
20
  1. Open the Command Palette (`Cmd/Ctrl + Shift + P`)
21
21
  2. Search for "TypeScript: Select TypeScript Version"
22
22
  3. Choose "Use Workspace Version"
23
23
  **Tip Add this setting to your `.vscode/settings.json` to make it permanent: ```
24
- {
24
+ &#123;
25
25
  "typescript.tsdk": "node_modules/typescript/lib"
26
- }
26
+ &#125;
27
27
  ``` ## Features
28
28
  ### Error Reporting
29
29
  Errors in macro-generated code are reported at the `@derive` decorator position:
30
30
  ```
31
- /** @derive(Debug) */ // **<- Errors appear here
32
- class User {
31
+ /** @derive(Debug) */ // &#x3C;- Errors appear here
32
+ class User &#123;
33
33
  name: string;
34
- }
34
+ &#125;
35
35
  ``` ### Completions
36
36
  The plugin provides completions for generated methods:
37
37
  ```
@@ -51,4 +51,5 @@ const copy = user.clone();
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)
54
+ 2. Check that your file is saved (plugins process on save)
55
+ **
@@ -7,16 +7,16 @@ npm install -D @macroforge/vite-plugin
7
7
  Add the plugin to your `vite.config.ts`:
8
8
  ```
9
9
  import macroforge from "@macroforge/vite-plugin";
10
- import { defineConfig } from "vite";
10
+ import &#123; defineConfig &#125; from "vite";
11
11
 
12
- export default defineConfig({
12
+ export default defineConfig(&#123;
13
13
  plugins: [
14
14
  macroforge()
15
15
  ]
16
- });
16
+ &#125;);
17
17
  ``` ## Options
18
18
  ```
19
- macroforge({
19
+ macroforge(&#123;
20
20
  // Generate .d.ts files for expanded code
21
21
  generateTypes: true,
22
22
 
@@ -32,7 +32,7 @@ macroforge({
32
32
  // File patterns to process
33
33
  include: ["**/*.ts", "**/*.tsx"],
34
34
  exclude: ["node_modules/**"]
35
- })
35
+ &#125;)
36
36
  ``` ### Option Reference
37
37
  | Option | Type | Default | Description |
38
38
  | --- | --- | --- | --- |
@@ -45,26 +45,26 @@ macroforge({
45
45
  ```
46
46
  import macroforge from "@macroforge/vite-plugin";
47
47
  import react from "@vitejs/plugin-react";
48
- import { defineConfig } from "vite";
48
+ import &#123; defineConfig &#125; from "vite";
49
49
 
50
- export default defineConfig({
50
+ export default defineConfig(&#123;
51
51
  plugins: [
52
52
  macroforge(), // Before React plugin
53
53
  react()
54
54
  ]
55
- });
55
+ &#125;);
56
56
  ``` ### SvelteKit
57
57
  ```
58
58
  import macroforge from "@macroforge/vite-plugin";
59
- import { sveltekit } from "@sveltejs/kit/vite";
60
- import { defineConfig } from "vite";
59
+ import &#123; sveltekit &#125; from "@sveltejs/kit/vite";
60
+ import &#123; defineConfig &#125; from "vite";
61
61
 
62
- export default defineConfig({
62
+ export default defineConfig(&#123;
63
63
  plugins: [
64
64
  macroforge(), // Before SvelteKit
65
65
  sveltekit()
66
66
  ]
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:
70
70
  - Watches for file changes
@@ -23,7 +23,7 @@ cd crates/extensions/svelte-macroforge
23
23
  Alternatively, symlink the extension to your Zed extensions directory:
24
24
  ```
25
25
  # macOS
26
- ln -s /path/to/macroforge-ts/crates/extensions/vtsls-macroforge ~/Library/Application\ Support/Zed/extensions/installed/vtsls-macroforge
26
+ ln -s /path/to/macroforge-ts/crates/extensions/vtsls-macroforge ~/Library/Application\\ Support/Zed/extensions/installed/vtsls-macroforge
27
27
 
28
28
  # Linux
29
29
  ln -s /path/to/macroforge-ts/crates/extensions/vtsls-macroforge ~/.config/zed/extensions/installed/vtsls-macroforge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@macroforge/mcp-server",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "MCP server for Macroforge documentation and code analysis",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "typescript": "^5.7.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "macroforge": "^0.1.38"
32
+ "macroforge": "^0.1.39"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "macroforge": {