@macroforge/mcp-server 0.1.17 → 0.1.20
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/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +108 -0
- package/dist/tools/index.js.map +1 -1
- package/docs/builtin-macros/clone.md +18 -77
- package/docs/builtin-macros/debug.md +19 -118
- package/docs/builtin-macros/default.md +13 -98
- package/docs/builtin-macros/deserialize.md +38 -383
- package/docs/builtin-macros/hash.md +16 -98
- package/docs/builtin-macros/macros-overview.md +33 -9
- package/docs/builtin-macros/ord.md +16 -115
- package/docs/builtin-macros/partial-eq.md +26 -128
- package/docs/builtin-macros/partial-ord.md +19 -99
- package/docs/builtin-macros/serialize.md +28 -126
- package/docs/concepts/architecture.md +27 -58
- package/docs/concepts/derive-system.md +17 -45
- package/docs/concepts/how-macros-work.md +11 -50
- package/docs/custom-macros/custom-overview.md +4 -5
- package/docs/custom-macros/rust-setup.md +3 -4
- package/docs/custom-macros/ts-macro-derive.md +4 -5
- package/docs/custom-macros/ts-quote.md +2 -2
- package/docs/getting-started/first-macro.md +6 -72
- package/docs/getting-started/installation.md +2 -2
- package/docs/integration/integration-overview.md +21 -14
- package/docs/integration/mcp-server.md +84 -0
- package/docs/integration/svelte-preprocessor.md +152 -0
- package/docs/language-servers/svelte.md +80 -0
- package/docs/language-servers/zed.md +84 -0
- package/docs/roadmap/roadmap.md +131 -0
- package/docs/sections.json +29 -5
- package/package.json +4 -3
|
@@ -6,59 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Start by creating a simple `User` class. We'll use the `@derive` decorator to automatically generate methods.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
```typescript
|
|
11
|
-
import { Debug, Clone, Eq } from "macroforge";
|
|
12
|
-
|
|
13
|
-
/** @derive(Debug, Clone, Eq) */
|
|
14
|
-
export class User {
|
|
15
|
-
name: string;
|
|
16
|
-
age: number;
|
|
17
|
-
email: string;
|
|
18
|
-
|
|
19
|
-
constructor(name: string, age: number, email: string) {
|
|
20
|
-
this.name = name;
|
|
21
|
-
this.age = age;
|
|
22
|
-
this.email = email;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## What Gets Generated
|
|
28
|
-
|
|
29
|
-
After macro expansion, your class will have these methods:
|
|
30
|
-
|
|
31
|
-
`user.ts (expanded)`
|
|
32
|
-
```typescript
|
|
33
|
-
export class User {
|
|
34
|
-
name: string;
|
|
35
|
-
age: number;
|
|
36
|
-
email: string;
|
|
37
|
-
|
|
38
|
-
constructor(name: string, age: number, email: string) {
|
|
39
|
-
this.name = name;
|
|
40
|
-
this.age = age;
|
|
41
|
-
this.email = email;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Generated by Debug
|
|
45
|
-
toString(): string {
|
|
46
|
-
return \`User { name: \${this.name}, age: \${this.age}, email: \${this.email} }\`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Generated by Clone
|
|
50
|
-
clone(): User {
|
|
51
|
-
return new User(this.name, this.age, this.email);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Generated by Eq
|
|
55
|
-
equals(other: User): boolean {
|
|
56
|
-
return this.name === other.name
|
|
57
|
-
&& this.age === other.age
|
|
58
|
-
&& this.email === other.email;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
```
|
|
9
|
+
<MacroExample before={data.examples.basic.before} after={data.examples.basic.after} />
|
|
62
10
|
|
|
63
11
|
## Using the Generated Methods
|
|
64
12
|
|
|
@@ -84,32 +32,18 @@ console.log(user.equals(different)); // false
|
|
|
84
32
|
|
|
85
33
|
You can customize how macros work using field-level decorators. For example, with the Debug macro:
|
|
86
34
|
|
|
87
|
-
|
|
88
|
-
/** @derive(Debug) */
|
|
89
|
-
export class User {
|
|
90
|
-
/** @debug({ rename: "userId" }) */
|
|
91
|
-
id: number;
|
|
92
|
-
|
|
93
|
-
name: string;
|
|
94
|
-
|
|
95
|
-
/** @debug({ skip: true }) */
|
|
96
|
-
password: string;
|
|
97
|
-
|
|
98
|
-
constructor(id: number, name: string, password: string) {
|
|
99
|
-
this.id = id;
|
|
100
|
-
this.name = name;
|
|
101
|
-
this.password = password;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
35
|
+
<MacroExample before={data.examples.customizing.before} after={data.examples.customizing.after} />
|
|
104
36
|
|
|
37
|
+
```typescript
|
|
105
38
|
const user = new User(42, "Alice", "secret123");
|
|
106
39
|
console.log(user.toString());
|
|
107
40
|
// Output: User { userId: 42, name: Alice }
|
|
108
41
|
// Note: 'id' is renamed to 'userId', 'password' is skipped
|
|
109
42
|
```
|
|
110
43
|
|
|
111
|
-
>
|
|
112
|
-
|
|
44
|
+
<Alert type="tip" title="Field-level decorators">
|
|
45
|
+
Field-level decorators let you control exactly how each field is handled by the macro.
|
|
46
|
+
</Alert>
|
|
113
47
|
|
|
114
48
|
## Next Steps
|
|
115
49
|
|
|
@@ -27,20 +27,27 @@ npm install -D @macroforge/typescript-plugin @macroforge/vite-plugin
|
|
|
27
27
|
|
|
28
28
|
## How They Work Together
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
<IntegrationFlow
|
|
31
|
+
source="Your Code"
|
|
32
|
+
sourceDesc="TypeScript with @derive decorators"
|
|
33
|
+
branches={[
|
|
34
|
+
{
|
|
35
|
+
plugin: 'TypeScript Plugin',
|
|
36
|
+
pluginDesc: 'Language service integration',
|
|
37
|
+
outputs: [
|
|
38
|
+
{ label: 'IDE Feedback', desc: 'Errors & completions' }
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
plugin: 'Vite Plugin',
|
|
43
|
+
pluginDesc: 'Build-time transformation',
|
|
44
|
+
outputs: [
|
|
45
|
+
{ label: 'Dev Server', desc: 'Hot reload' },
|
|
46
|
+
{ label: 'Production Build', desc: 'Optimized output' }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]}
|
|
50
|
+
/>
|
|
44
51
|
|
|
45
52
|
## Detailed Guides
|
|
46
53
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# MCP Server
|
|
2
|
+
|
|
3
|
+
*The MCP (Model Context Protocol) server enables AI assistants to understand and work with Macroforge macros, providing documentation lookup, code validation, and macro expansion.*
|
|
4
|
+
|
|
5
|
+
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`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @macroforge/mcp-server
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Here's how to set it up in some common MCP clients:
|
|
12
|
+
|
|
13
|
+
## Claude Code
|
|
14
|
+
|
|
15
|
+
To include the local MCP version in Claude Code, simply run the following command:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add -t stdio -s [scope] macroforge -- npx -y @macroforge/mcp-server
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The `[scope]` must be `user`, `project` or `local`.
|
|
22
|
+
|
|
23
|
+
## Claude Desktop
|
|
24
|
+
|
|
25
|
+
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:
|
|
26
|
+
|
|
27
|
+
`claude_desktop_config.json`
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"macroforge": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@macroforge/mcp-server"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Codex CLI
|
|
40
|
+
|
|
41
|
+
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):
|
|
42
|
+
|
|
43
|
+
`config.toml`
|
|
44
|
+
```toml
|
|
45
|
+
[mcp_servers.macroforge]
|
|
46
|
+
command = "npx"
|
|
47
|
+
args = ["-y", "@macroforge/mcp-server"]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Gemini CLI
|
|
51
|
+
|
|
52
|
+
To include the local MCP version in Gemini CLI, simply run the following command:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
gemini mcp add -t stdio -s [scope] macroforge npx -y @macroforge/mcp-server
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The `[scope]` must be `user`, `project` or `local`.
|
|
59
|
+
|
|
60
|
+
## Other Clients
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
## Available Tools
|
|
65
|
+
|
|
66
|
+
The MCP server provides five tools for AI assistants:
|
|
67
|
+
|
|
68
|
+
| `list-sections`
|
|
69
|
+
| Lists all available Macroforge documentation sections
|
|
70
|
+
|
|
71
|
+
| `get-documentation`
|
|
72
|
+
| Retrieves full documentation for one or more sections
|
|
73
|
+
|
|
74
|
+
| `macroforge-autofixer`
|
|
75
|
+
| Validates code with `@derive` decorators and returns diagnostics
|
|
76
|
+
|
|
77
|
+
| `expand-code`
|
|
78
|
+
| Expands macros and returns the transformed TypeScript code
|
|
79
|
+
|
|
80
|
+
| `get-macro-info`
|
|
81
|
+
| Retrieves documentation for macros and field decorators
|
|
82
|
+
|
|
83
|
+
>
|
|
84
|
+
> 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`.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Svelte Preprocessor
|
|
2
|
+
|
|
3
|
+
*The Svelte preprocessor expands Macroforge macros in `<script>` blocks before Svelte compilation, enabling seamless macro usage in Svelte components.*
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @macroforge/svelte-preprocessor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Add the preprocessor to your `svelte.config.js`:
|
|
14
|
+
|
|
15
|
+
`svelte.config.js`
|
|
16
|
+
```javascript
|
|
17
|
+
import adapter from '@sveltejs/adapter-auto';
|
|
18
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
19
|
+
import { macroforgePreprocess } from '@macroforge/svelte-preprocessor';
|
|
20
|
+
|
|
21
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
22
|
+
const config = {
|
|
23
|
+
preprocess: [
|
|
24
|
+
macroforgePreprocess(), // Expand macros FIRST
|
|
25
|
+
vitePreprocess() // Then handle TypeScript/CSS
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
kit: {
|
|
29
|
+
adapter: adapter()
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default config;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> **Warning:**
|
|
37
|
+
> Always place `macroforgePreprocess()` **before** other preprocessors like `vitePreprocess()`. This ensures macros are expanded before TypeScript compilation.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
Use `@derive` decorators directly in your Svelte component scripts:
|
|
42
|
+
|
|
43
|
+
`UserCard.svelte`
|
|
44
|
+
```svelte
|
|
45
|
+
User: {user.name}
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Options
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
macroforgePreprocess({
|
|
53
|
+
// Keep @derive decorators in output (for debugging)
|
|
54
|
+
keepDecorators: false,
|
|
55
|
+
|
|
56
|
+
// Process JavaScript files (not just TypeScript)
|
|
57
|
+
processJavaScript: false
|
|
58
|
+
})
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Option Reference
|
|
62
|
+
|
|
63
|
+
| `keepDecorators`
|
|
64
|
+
| `boolean`
|
|
65
|
+
| `false`
|
|
66
|
+
| Keep decorators in output
|
|
67
|
+
|
|
68
|
+
| `processJavaScript`
|
|
69
|
+
| `boolean`
|
|
70
|
+
| `false`
|
|
71
|
+
| Process `<script>` blocks without `lang="ts"`
|
|
72
|
+
|
|
73
|
+
## How It Works
|
|
74
|
+
|
|
75
|
+
The preprocessor:
|
|
76
|
+
|
|
77
|
+
1. Intercepts `<script lang="ts">` blocks in `.svelte` files
|
|
78
|
+
|
|
79
|
+
2. Checks for `@derive` decorators (skips files without them)
|
|
80
|
+
|
|
81
|
+
3. Expands macros using the native Macroforge binary
|
|
82
|
+
|
|
83
|
+
4. Returns the transformed code for Svelte compilation
|
|
84
|
+
|
|
85
|
+
>
|
|
86
|
+
> Files without `@derive` decorators are passed through unchanged with zero overhead.
|
|
87
|
+
|
|
88
|
+
## SvelteKit Integration
|
|
89
|
+
|
|
90
|
+
For SvelteKit projects, you can use both the preprocessor (for `.svelte` files) and the Vite plugin (for standalone `.ts` files):
|
|
91
|
+
|
|
92
|
+
`svelte.config.js`
|
|
93
|
+
```javascript
|
|
94
|
+
// svelte.config.js
|
|
95
|
+
import { macroforgePreprocess } from '@macroforge/svelte-preprocessor';
|
|
96
|
+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
preprocess: [
|
|
100
|
+
macroforgePreprocess(),
|
|
101
|
+
vitePreprocess()
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`vite.config.ts`
|
|
107
|
+
```typescript
|
|
108
|
+
// vite.config.ts
|
|
109
|
+
import macroforge from '@macroforge/vite-plugin';
|
|
110
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
111
|
+
import { defineConfig } from 'vite';
|
|
112
|
+
|
|
113
|
+
export default defineConfig({
|
|
114
|
+
plugins: [
|
|
115
|
+
macroforge(), // For .ts files
|
|
116
|
+
sveltekit()
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Using with Vitest
|
|
122
|
+
|
|
123
|
+
The preprocessor works seamlessly with Vitest for testing Svelte components:
|
|
124
|
+
|
|
125
|
+
`vitest.config.ts`
|
|
126
|
+
```typescript
|
|
127
|
+
// vitest.config.ts
|
|
128
|
+
import { defineConfig } from 'vitest/config';
|
|
129
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
130
|
+
import { svelteTesting } from '@testing-library/svelte/vite';
|
|
131
|
+
import macroforge from '@macroforge/vite-plugin';
|
|
132
|
+
|
|
133
|
+
export default defineConfig({
|
|
134
|
+
plugins: [
|
|
135
|
+
macroforge(),
|
|
136
|
+
sveltekit(),
|
|
137
|
+
svelteTesting()
|
|
138
|
+
],
|
|
139
|
+
test: {
|
|
140
|
+
environment: 'jsdom',
|
|
141
|
+
include: ['src/**/*.{test,spec}.{js,ts}']
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Svelte 5 Runes Compatibility
|
|
147
|
+
|
|
148
|
+
The preprocessor is fully compatible with Svelte 5 runes (`$state`, `$derived`, `$props`, etc.). Files using runes but without `@derive` decorators are skipped entirely.
|
|
149
|
+
|
|
150
|
+
```svelte
|
|
151
|
+
|
|
152
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Svelte Language Server
|
|
2
|
+
|
|
3
|
+
*`@macroforge/svelte-language-server` provides full Svelte IDE support with macroforge integration.*
|
|
4
|
+
|
|
5
|
+
<Alert type="warning" title="Developer Installation Required">
|
|
6
|
+
This package is not yet published as an official extension. You'll need to build and install it manually.
|
|
7
|
+
</Alert>
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Svelte syntax diagnostics** - Errors and warnings in .svelte files
|
|
12
|
+
|
|
13
|
+
- **HTML support** - Hover info, autocompletions, Emmet, outline symbols
|
|
14
|
+
|
|
15
|
+
- **CSS/SCSS/LESS** - Diagnostics, hover, completions, formatting, Emmet, color picking
|
|
16
|
+
|
|
17
|
+
- **TypeScript/JavaScript** - Full language features with macroforge macro expansion
|
|
18
|
+
|
|
19
|
+
- **Go-to-definition** - Navigate to macro-generated code
|
|
20
|
+
|
|
21
|
+
- **Code actions** - Quick fixes and refactorings
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### 1. Clone the Repository
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/rymskip/macroforge-ts.git
|
|
29
|
+
cd macroforge-ts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Build the Language Server
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Install dependencies
|
|
36
|
+
npm install
|
|
37
|
+
|
|
38
|
+
# Build the Svelte language server
|
|
39
|
+
cd packages/svelte-language-server
|
|
40
|
+
npm run build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Configure Your Editor
|
|
44
|
+
|
|
45
|
+
The language server exposes a `svelteserver` binary that implements the Language Server Protocol (LSP). Configure your editor to use it:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# The binary is located at:
|
|
49
|
+
./packages/svelte-language-server/bin/server.js
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Package Info
|
|
53
|
+
|
|
54
|
+
| Package
|
|
55
|
+
| `@macroforge/svelte-language-server`
|
|
56
|
+
|
|
57
|
+
| Version
|
|
58
|
+
| 0.1.7
|
|
59
|
+
|
|
60
|
+
| CLI Command
|
|
61
|
+
| `svelteserver`
|
|
62
|
+
|
|
63
|
+
| Node Version
|
|
64
|
+
| >= 18.0.0
|
|
65
|
+
|
|
66
|
+
## How It Works
|
|
67
|
+
|
|
68
|
+
The Svelte language server extends the standard Svelte language tooling with macroforge integration:
|
|
69
|
+
|
|
70
|
+
1. Parses `.svelte` files and extracts TypeScript/JavaScript blocks
|
|
71
|
+
|
|
72
|
+
2. Expands macros using the `@macroforge/typescript-plugin`
|
|
73
|
+
|
|
74
|
+
3. Maps diagnostics back to original source positions
|
|
75
|
+
|
|
76
|
+
4. Provides completions for macro-generated methods
|
|
77
|
+
|
|
78
|
+
## Using with Zed
|
|
79
|
+
|
|
80
|
+
For Zed editor, see the [Zed Extensions]({base}/docs/language-servers/zed) page for the dedicated `svelte-macroforge` extension.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Zed Extensions
|
|
2
|
+
|
|
3
|
+
*Macroforge provides two extensions for the [Zed editor](https://zed.dev): one for TypeScript via VTSLS, and one for Svelte.*
|
|
4
|
+
|
|
5
|
+
<Alert type="warning" title="Developer Installation Required">
|
|
6
|
+
These extensions are not yet in the Zed extension registry. You'll need to install them as developer extensions.
|
|
7
|
+
</Alert>
|
|
8
|
+
|
|
9
|
+
## Available Extensions
|
|
10
|
+
|
|
11
|
+
| `vtsls-macroforge`
|
|
12
|
+
| VTSLS with macroforge support for TypeScript
|
|
13
|
+
| `crates/extensions/vtsls-macroforge`
|
|
14
|
+
|
|
15
|
+
| `svelte-macroforge`
|
|
16
|
+
| Svelte language support with macroforge
|
|
17
|
+
| `crates/extensions/svelte-macroforge`
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### 1. Clone the Repository
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/rymskip/macroforge-ts.git
|
|
25
|
+
cd macroforge-ts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Build the Extension
|
|
29
|
+
|
|
30
|
+
Build the extension you want to use:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# For VTSLS (TypeScript)
|
|
34
|
+
cd crates/extensions/vtsls-macroforge
|
|
35
|
+
|
|
36
|
+
# Or for Svelte
|
|
37
|
+
cd crates/extensions/svelte-macroforge
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. Install as Dev Extension in Zed
|
|
41
|
+
|
|
42
|
+
In Zed, open the command palette and run **zed: install dev extension**, then select the extension directory.
|
|
43
|
+
|
|
44
|
+
Alternatively, symlink the extension to your Zed extensions directory:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# macOS
|
|
48
|
+
ln -s /path/to/macroforge-ts/crates/extensions/vtsls-macroforge ~/Library/Application\\ Support/Zed/extensions/installed/vtsls-macroforge
|
|
49
|
+
|
|
50
|
+
# Linux
|
|
51
|
+
ln -s /path/to/macroforge-ts/crates/extensions/vtsls-macroforge ~/.config/zed/extensions/installed/vtsls-macroforge
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## vtsls-macroforge
|
|
55
|
+
|
|
56
|
+
This extension wraps [VTSLS](https://github.com/yioneko/vtsls) (a TypeScript language server) with macroforge integration. It provides:
|
|
57
|
+
|
|
58
|
+
- Full TypeScript language features
|
|
59
|
+
|
|
60
|
+
- Macro expansion at edit time
|
|
61
|
+
|
|
62
|
+
- Accurate error positions in original source
|
|
63
|
+
|
|
64
|
+
- Completions for macro-generated methods
|
|
65
|
+
|
|
66
|
+
## svelte-macroforge
|
|
67
|
+
|
|
68
|
+
This extension provides Svelte support using the `@macroforge/svelte-language-server`. It includes:
|
|
69
|
+
|
|
70
|
+
- Svelte component syntax support
|
|
71
|
+
|
|
72
|
+
- HTML, CSS, and TypeScript features
|
|
73
|
+
|
|
74
|
+
- Macroforge integration in script blocks
|
|
75
|
+
|
|
76
|
+
## Troubleshooting
|
|
77
|
+
|
|
78
|
+
### Extension not loading
|
|
79
|
+
|
|
80
|
+
Make sure you've restarted Zed after installing the extension. Check the Zed logs for any error messages.
|
|
81
|
+
|
|
82
|
+
### Macros not expanding
|
|
83
|
+
|
|
84
|
+
Ensure your project has the `macroforge` package installed and a valid `tsconfig.json` with the TypeScript plugin configured.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
*Planned features and improvements for Macroforge. This roadmap reflects our current priorities but may change based on community feedback.*
|
|
4
|
+
|
|
5
|
+
## IDE Extensions
|
|
6
|
+
|
|
7
|
+
Bring Macroforge support directly into your favorite editors with native extensions.
|
|
8
|
+
|
|
9
|
+
| VS Code / Cursor
|
|
10
|
+
| Planned
|
|
11
|
+
| Native extension with macro expansion preview, error highlighting, and completions
|
|
12
|
+
|
|
13
|
+
| Zed
|
|
14
|
+
| Available
|
|
15
|
+
| Full support via vtsls-macroforge and svelte-macroforge extensions
|
|
16
|
+
|
|
17
|
+
| Neovim
|
|
18
|
+
| Considering
|
|
19
|
+
| LSP integration for Neovim users
|
|
20
|
+
|
|
21
|
+
| JetBrains (WebStorm)
|
|
22
|
+
| Considering
|
|
23
|
+
| Plugin for WebStorm and other JetBrains IDEs
|
|
24
|
+
|
|
25
|
+
## Framework Support
|
|
26
|
+
|
|
27
|
+
Expanding Macroforge to work seamlessly with popular frontend frameworks.
|
|
28
|
+
|
|
29
|
+
| Svelte / SvelteKit
|
|
30
|
+
| Available
|
|
31
|
+
| Full support via svelte-language-server and Vite plugin
|
|
32
|
+
|
|
33
|
+
| React
|
|
34
|
+
| Planned
|
|
35
|
+
| React-specific macros and integration with React tooling
|
|
36
|
+
|
|
37
|
+
| Vue
|
|
38
|
+
| Planned
|
|
39
|
+
| Vue SFC support and Vue-specific derive macros
|
|
40
|
+
|
|
41
|
+
| Angular
|
|
42
|
+
| Planned
|
|
43
|
+
| Angular decorator integration and CLI support
|
|
44
|
+
|
|
45
|
+
| Solid
|
|
46
|
+
| Planned
|
|
47
|
+
| SolidJS integration
|
|
48
|
+
|
|
49
|
+
## Pure TypeScript Macro Creation
|
|
50
|
+
|
|
51
|
+
While Rust provides the best performance and type safety, we recognize that not everyone wants to write Rust. We're exploring options for writing macros in pure TypeScript.
|
|
52
|
+
|
|
53
|
+
| TypeScript Macro API
|
|
54
|
+
| Planned
|
|
55
|
+
| Define macros using TypeScript with a simple API
|
|
56
|
+
|
|
57
|
+
| Template Strings
|
|
58
|
+
| Planned
|
|
59
|
+
| Generate code using tagged template literals
|
|
60
|
+
|
|
61
|
+
| AST Helpers
|
|
62
|
+
| Planned
|
|
63
|
+
| TypeScript utilities for working with the AST
|
|
64
|
+
|
|
65
|
+
## Built-in Macros
|
|
66
|
+
|
|
67
|
+
Expanding the library of built-in derive macros.
|
|
68
|
+
|
|
69
|
+
| Debug, Clone, PartialEq, Ord, Hash
|
|
70
|
+
| Available
|
|
71
|
+
| Core derive macros
|
|
72
|
+
|
|
73
|
+
| Serialize, Deserialize
|
|
74
|
+
| Available
|
|
75
|
+
| JSON serialization with validation
|
|
76
|
+
|
|
77
|
+
| Builder
|
|
78
|
+
| Planned
|
|
79
|
+
| Generate builder pattern for classes
|
|
80
|
+
|
|
81
|
+
| Immutable
|
|
82
|
+
| Considering
|
|
83
|
+
| Generate immutable update methods (with, set)
|
|
84
|
+
|
|
85
|
+
## Distribution & Packaging
|
|
86
|
+
|
|
87
|
+
Making it easier to publish and share custom macros.
|
|
88
|
+
|
|
89
|
+
| Native Node Binaries
|
|
90
|
+
| Available
|
|
91
|
+
| Platform-specific binaries for maximum performance
|
|
92
|
+
|
|
93
|
+
| WASM Binary Generation
|
|
94
|
+
| Planned
|
|
95
|
+
| Cross-platform WebAssembly binaries for easier macro distribution
|
|
96
|
+
|
|
97
|
+
| Macro Registry
|
|
98
|
+
| Considering
|
|
99
|
+
| Central registry for discovering and sharing community macros
|
|
100
|
+
|
|
101
|
+
## Tooling & DX
|
|
102
|
+
|
|
103
|
+
Improvements to the developer experience.
|
|
104
|
+
|
|
105
|
+
| CLI Expansion
|
|
106
|
+
| Available
|
|
107
|
+
| Expand macros from the command line
|
|
108
|
+
|
|
109
|
+
| Macro Playground
|
|
110
|
+
| Planned
|
|
111
|
+
| Web-based playground to test macros
|
|
112
|
+
|
|
113
|
+
| create-macroforge
|
|
114
|
+
| Planned
|
|
115
|
+
| Scaffolding tool for new macro projects
|
|
116
|
+
|
|
117
|
+
| Macro Debugging
|
|
118
|
+
| Considering
|
|
119
|
+
| Step-through debugging for macro expansion
|
|
120
|
+
|
|
121
|
+
## Contributing
|
|
122
|
+
|
|
123
|
+
Interested in helping? We welcome contributions of all kinds:
|
|
124
|
+
|
|
125
|
+
- Feature requests and feedback on [GitHub Issues](https://github.com/rymskip/macroforge-ts/issues)
|
|
126
|
+
|
|
127
|
+
- Pull requests for new macros or improvements
|
|
128
|
+
|
|
129
|
+
- Documentation improvements
|
|
130
|
+
|
|
131
|
+
- Framework integrations
|