@macroforge/mcp-server 0.1.32 → 0.1.34

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.
Files changed (50) hide show
  1. package/README.md +68 -0
  2. package/dist/index.d.ts +32 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +46 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/tools/docs-loader.d.ts +133 -5
  7. package/dist/tools/docs-loader.d.ts.map +1 -1
  8. package/dist/tools/docs-loader.js +131 -15
  9. package/dist/tools/docs-loader.js.map +1 -1
  10. package/dist/tools/index.d.ts +48 -1
  11. package/dist/tools/index.d.ts.map +1 -1
  12. package/dist/tools/index.js +163 -14
  13. package/dist/tools/index.js.map +1 -1
  14. package/docs/api/api-overview.md +24 -46
  15. package/docs/api/expand-sync.md +24 -51
  16. package/docs/api/native-plugin.md +24 -56
  17. package/docs/api/position-mapper.md +34 -76
  18. package/docs/api/transform-sync.md +27 -59
  19. package/docs/builtin-macros/clone.md +150 -68
  20. package/docs/builtin-macros/debug.md +216 -81
  21. package/docs/builtin-macros/default.md +234 -91
  22. package/docs/builtin-macros/deserialize.md +891 -166
  23. package/docs/builtin-macros/hash.md +238 -82
  24. package/docs/builtin-macros/macros-overview.md +42 -103
  25. package/docs/builtin-macros/ord.md +205 -92
  26. package/docs/builtin-macros/partial-eq.md +178 -97
  27. package/docs/builtin-macros/partial-ord.md +209 -98
  28. package/docs/builtin-macros/serialize.md +326 -137
  29. package/docs/concepts/architecture.md +40 -99
  30. package/docs/concepts/derive-system.md +132 -125
  31. package/docs/concepts/how-macros-work.md +52 -84
  32. package/docs/custom-macros/custom-overview.md +17 -39
  33. package/docs/custom-macros/rust-setup.md +22 -55
  34. package/docs/custom-macros/ts-macro-derive.md +43 -107
  35. package/docs/custom-macros/ts-quote.md +177 -507
  36. package/docs/getting-started/first-macro.md +108 -33
  37. package/docs/getting-started/installation.md +32 -73
  38. package/docs/integration/cli.md +70 -156
  39. package/docs/integration/configuration.md +32 -75
  40. package/docs/integration/integration-overview.md +16 -55
  41. package/docs/integration/mcp-server.md +30 -69
  42. package/docs/integration/svelte-preprocessor.md +60 -83
  43. package/docs/integration/typescript-plugin.md +32 -74
  44. package/docs/integration/vite-plugin.md +30 -79
  45. package/docs/language-servers/ls-overview.md +22 -46
  46. package/docs/language-servers/svelte.md +30 -69
  47. package/docs/language-servers/zed.md +34 -72
  48. package/docs/roadmap/roadmap.md +54 -130
  49. package/docs/sections.json +3 -262
  50. package/package.json +2 -2
@@ -1,51 +1,138 @@
1
1
  # Debug
2
-
3
- *The `Debug` macro generates a `toString()` method that produces a human-readable string representation of your class.*
4
-
5
- ## Basic Usage
6
-
7
- <MacroExample before={data.examples.basic.before} after={data.examples.basic.after} />
8
-
9
- ```typescript
2
+ *The `Debug` macro generates a human-readable `toString()` method for TypeScript classes, interfaces, enums, and type aliases.*
3
+ ## Basic Usage
4
+ **Before:**
5
+ ```
6
+ /** @derive(Debug) */
7
+ class User {
8
+ name: string;
9
+ age: number;
10
+
11
+ constructor(name: string, age: number) {
12
+ this.name = name;
13
+ this.age = age;
14
+ }
15
+ }
16
+ ```
17
+ **After:**
18
+ ```
19
+ class User {
20
+ name: string;
21
+ age: number;
22
+
23
+ constructor(name: string, age: number) {
24
+ this.name = name;
25
+ this.age = age;
26
+ }
27
+
28
+ toString(): string {
29
+ const parts: string[] = [];
30
+ parts.push('name: ' + this.name);
31
+ parts.push('age: ' + this.age);
32
+ return 'User { ' + parts.join(', ') + ' }';
33
+ }
34
+ }
35
+ ``` ```
10
36
  const user = new User("Alice", 30);
11
37
  console.log(user.toString());
12
38
  // Output: User { name: Alice, age: 30 }
39
+ ``` ## Field Options
40
+ Use the `@debug` field decorator to customize behavior:
41
+ ### Renaming Fields
42
+ **Before:**
13
43
  ```
14
-
15
- ## Field Options
16
-
17
- Use the `@debug` field decorator to customize behavior:
18
-
19
- ### Renaming Fields
20
-
21
- <MacroExample before={data.examples.rename.before} after={data.examples.rename.after} />
22
-
23
- ```typescript
44
+ /** @derive(Debug) */
45
+ class User {
46
+ /** @debug({ rename: "userId" }) */
47
+ id: number;
48
+
49
+ name: string;
50
+
51
+ constructor(id: number, name: string) {
52
+ this.id = id;
53
+ this.name = name;
54
+ }
55
+ }
56
+ ```
57
+ **After:**
58
+ ```
59
+ class User {
60
+ id: number;
61
+
62
+ name: string;
63
+
64
+ constructor(id: number, name: string) {
65
+ this.id = id;
66
+ this.name = name;
67
+ }
68
+
69
+ toString(): string {
70
+ const parts: string[] = [];
71
+ parts.push('userId: ' + this.id);
72
+ parts.push('name: ' + this.name);
73
+ return 'User { ' + parts.join(', ') + ' }';
74
+ }
75
+ }
76
+ ``` ```
24
77
  const user = new User(42, "Alice");
25
78
  console.log(user.toString());
26
79
  // Output: User { userId: 42, name: Alice }
80
+ ``` ### Skipping Fields
81
+ Use `skip: true` to exclude sensitive fields from the output:
82
+ **Before:**
27
83
  ```
28
-
29
- ### Skipping Fields
30
-
31
- Use `skip: true` to exclude sensitive fields from the output:
32
-
33
- <MacroExample before={data.examples.skip.before} after={data.examples.skip.after} />
34
-
35
- ```typescript
84
+ /** @derive(Debug) */
85
+ class User {
86
+ name: string;
87
+ email: string;
88
+
89
+ /** @debug({ skip: true }) */
90
+ password: string;
91
+
92
+ /** @debug({ skip: true }) */
93
+ authToken: string;
94
+
95
+ constructor(name: string, email: string, password: string, authToken: string) {
96
+ this.name = name;
97
+ this.email = email;
98
+ this.password = password;
99
+ this.authToken = authToken;
100
+ }
101
+ }
102
+ ```
103
+ **After:**
104
+ ```
105
+ class User {
106
+ name: string;
107
+ email: string;
108
+
109
+ password: string;
110
+
111
+ authToken: string;
112
+
113
+ constructor(name: string, email: string, password: string, authToken: string) {
114
+ this.name = name;
115
+ this.email = email;
116
+ this.password = password;
117
+ this.authToken = authToken;
118
+ }
119
+
120
+ toString(): string {
121
+ const parts: string[] = [];
122
+ parts.push('name: ' + this.name);
123
+ parts.push('email: ' + this.email);
124
+ return 'User { ' + parts.join(', ') + ' }';
125
+ }
126
+ }
127
+ ``` ```
36
128
  const user = new User("Alice", "alice@example.com", "secret", "tok_xxx");
37
129
  console.log(user.toString());
38
130
  // Output: User { name: Alice, email: alice@example.com }
39
131
  // Note: password and authToken are not included
132
+ ``` **Security Always skip sensitive fields like passwords, tokens, and API keys to prevent accidental logging. ## Combining Options
133
+ ****Source:**
40
134
  ```
41
-
42
- <Alert type="tip" title="Security">
43
- Always skip sensitive fields like passwords, tokens, and API keys to prevent accidental logging.
44
- </Alert>
45
-
46
- ## Combining Options
47
-
48
- <InteractiveMacro code={`/** @derive(Debug) */
135
+ /** @derive(Debug) */
49
136
  class ApiResponse {
50
137
  /** @debug({ rename: "statusCode" }) */
51
138
  status: number;
@@ -54,70 +141,118 @@ class ApiResponse {
54
141
 
55
142
  /** @debug({ skip: true }) */
56
143
  internalMetadata: Record<string, unknown>;
57
- }`} />
58
-
59
- ## All Options
60
-
61
- | `rename`
62
- | `string`
63
- | Display a different name in the output
64
-
65
- | `skip`
66
- | `boolean`
67
- | Exclude this field from the output
68
-
69
- ## Interface Support
70
-
71
- Debug also works with interfaces. For interfaces, a namespace is generated with a `toString` function:
72
-
73
- <MacroExample before={data.examples.interface.before} after={data.examples.interface.after} />
74
-
75
- ```typescript
144
+ }
145
+ ``` ## All Options
146
+ | Option | Type | Description |
147
+ | --- | --- | --- |
148
+ | `rename` | `string` | Display a different name in the output |
149
+ | `skip` | `boolean` | Exclude this field from the output |
150
+ ## Interface Support
151
+ Debug also works with interfaces. For interfaces, a namespace is generated with a `toString` function:
152
+ **Before:**
153
+ ```
154
+ /** @derive(Debug) */
155
+ interface Status {
156
+ active: boolean;
157
+ message: string;
158
+ }
159
+ ```
160
+ **After:**
161
+ ```
162
+ interface Status {
163
+ active: boolean;
164
+ message: string;
165
+ }
166
+
167
+ export namespace Status {
168
+ export function toString(self: Status): string {
169
+ const parts: string[] = [];
170
+ parts.push('active: ' + self.active);
171
+ parts.push('message: ' + self.message);
172
+ return 'Status { ' + parts.join(', ') + ' }';
173
+ }
174
+ }
175
+ ``` ```
76
176
  const status: Status = { active: true, message: "OK" };
77
177
  console.log(Status.toString(status));
78
178
  // Output: Status { active: true, message: OK }
179
+ ``` ## Enum Support
180
+ Debug also works with enums. For enums, a namespace is generated with a `toString` function that displays the enum name and variant:
181
+ **Before:**
79
182
  ```
80
-
81
- ## Enum Support
82
-
83
- Debug also works with enums. For enums, a namespace is generated with a `toString` function that displays the enum name and variant:
84
-
85
- <MacroExample before={data.examples.enum.before} after={data.examples.enum.after} />
86
-
87
- ```typescript
183
+ /** @derive(Debug) */
184
+ enum Priority {
185
+ Low = 1,
186
+ Medium = 2,
187
+ High = 3
188
+ }
189
+ ```
190
+ **After:**
191
+ ```
192
+ enum Priority {
193
+ Low = 1,
194
+ Medium = 2,
195
+ High = 3
196
+ }
197
+
198
+ export namespace Priority {
199
+ export function toString(value: Priority): string {
200
+ const key = Priority[value as unknown as keyof typeof Priority];
201
+ if (key !== undefined) {
202
+ return 'Priority.' + key;
203
+ }
204
+ return 'Priority(' + String(value) + ')';
205
+ }
206
+ }
207
+ ``` ```
88
208
  console.log(Priority.toString(Priority.High));
89
209
  // Output: Priority.High
90
210
 
91
211
  console.log(Priority.toString(Priority.Low));
92
212
  // Output: Priority.Low
213
+ ``` Works with both numeric and string enums:
214
+ **Source:**
93
215
  ```
94
-
95
- Works with both numeric and string enums:
96
-
97
- <InteractiveMacro code={`/** @derive(Debug) */
216
+ /** @derive(Debug) */
98
217
  enum Status {
99
218
  Active = "active",
100
219
  Inactive = "inactive",
101
- }`} />
102
-
103
- ## Type Alias Support
104
-
105
- Debug works with type aliases. For object types, fields are displayed similar to interfaces:
106
-
107
- <MacroExample before={data.examples.typeAlias.before} after={data.examples.typeAlias.after} />
108
-
109
- ```typescript
220
+ }
221
+ ``` ## Type Alias Support
222
+ Debug works with type aliases. For object types, fields are displayed similar to interfaces:
223
+ **Before:**
224
+ ```
225
+ /** @derive(Debug) */
226
+ type Point = {
227
+ x: number;
228
+ y: number;
229
+ };
230
+ ```
231
+ **After:**
232
+ ```
233
+ type Point = {
234
+ x: number;
235
+ y: number;
236
+ };
237
+
238
+ export namespace Point {
239
+ export function toString(value: Point): string {
240
+ const parts: string[] = [];
241
+ parts.push('x: ' + value.x);
242
+ parts.push('y: ' + value.y);
243
+ return 'Point { ' + parts.join(', ') + ' }';
244
+ }
245
+ }
246
+ ``` ```
110
247
  const point: Point = { x: 10, y: 20 };
111
248
  console.log(Point.toString(point));
112
249
  // Output: Point { x: 10, y: 20 }
250
+ ``` For union types, the value is displayed using JSON.stringify:
251
+ **Source:**
113
252
  ```
114
-
115
- For union types, the value is displayed using JSON.stringify:
116
-
117
- <InteractiveMacro code={`/** @derive(Debug) */
118
- type ApiStatus = "loading" | "success" | "error";`} />
119
-
120
- ```typescript
253
+ /** @derive(Debug) */
254
+ type ApiStatus = "loading" | "success" | "error";
255
+ ``` ```
121
256
  console.log(ApiStatus.toString("success"));
122
257
  // Output: ApiStatus("success")
123
258
  ```