@react-spa-scaffold/mcp 1.2.0 → 2.0.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.
Files changed (194) hide show
  1. package/README.md +36 -123
  2. package/dist/constants.d.ts +35 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +35 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/features/definitions/api.d.ts.map +1 -1
  7. package/dist/features/definitions/api.js +0 -1
  8. package/dist/features/definitions/api.js.map +1 -1
  9. package/dist/features/definitions/ci.d.ts.map +1 -1
  10. package/dist/features/definitions/ci.js +0 -1
  11. package/dist/features/definitions/ci.js.map +1 -1
  12. package/dist/features/definitions/core.d.ts.map +1 -1
  13. package/dist/features/definitions/core.js +0 -1
  14. package/dist/features/definitions/core.js.map +1 -1
  15. package/dist/features/definitions/devtools.d.ts.map +1 -1
  16. package/dist/features/definitions/devtools.js +0 -1
  17. package/dist/features/definitions/devtools.js.map +1 -1
  18. package/dist/features/definitions/forms.d.ts.map +1 -1
  19. package/dist/features/definitions/forms.js +0 -1
  20. package/dist/features/definitions/forms.js.map +1 -1
  21. package/dist/features/definitions/i18n.d.ts.map +1 -1
  22. package/dist/features/definitions/i18n.js +0 -1
  23. package/dist/features/definitions/i18n.js.map +1 -1
  24. package/dist/features/definitions/mobile.d.ts.map +1 -1
  25. package/dist/features/definitions/mobile.js +0 -1
  26. package/dist/features/definitions/mobile.js.map +1 -1
  27. package/dist/features/definitions/observability.d.ts.map +1 -1
  28. package/dist/features/definitions/observability.js +0 -1
  29. package/dist/features/definitions/observability.js.map +1 -1
  30. package/dist/features/definitions/performance.d.ts.map +1 -1
  31. package/dist/features/definitions/performance.js +0 -1
  32. package/dist/features/definitions/performance.js.map +1 -1
  33. package/dist/features/definitions/routing.d.ts.map +1 -1
  34. package/dist/features/definitions/routing.js +0 -1
  35. package/dist/features/definitions/routing.js.map +1 -1
  36. package/dist/features/definitions/state.d.ts.map +1 -1
  37. package/dist/features/definitions/state.js +0 -1
  38. package/dist/features/definitions/state.js.map +1 -1
  39. package/dist/features/definitions/testing.d.ts.map +1 -1
  40. package/dist/features/definitions/testing.js +0 -3
  41. package/dist/features/definitions/testing.js.map +1 -1
  42. package/dist/features/definitions/theming.js +2 -2
  43. package/dist/features/definitions/theming.js.map +1 -1
  44. package/dist/features/definitions/ui.d.ts.map +1 -1
  45. package/dist/features/definitions/ui.js +0 -1
  46. package/dist/features/definitions/ui.js.map +1 -1
  47. package/dist/features/types.d.ts +14 -20
  48. package/dist/features/types.d.ts.map +1 -1
  49. package/dist/features/types.js +4 -21
  50. package/dist/features/types.js.map +1 -1
  51. package/dist/features/types.test.d.ts +5 -0
  52. package/dist/features/types.test.d.ts.map +1 -0
  53. package/dist/features/types.test.js +32 -0
  54. package/dist/features/types.test.js.map +1 -0
  55. package/dist/resources/docs.d.ts +2 -8
  56. package/dist/resources/docs.d.ts.map +1 -1
  57. package/dist/resources/docs.js +27 -49
  58. package/dist/resources/docs.js.map +1 -1
  59. package/dist/server.d.ts.map +1 -1
  60. package/dist/server.js +9 -8
  61. package/dist/server.js.map +1 -1
  62. package/dist/tools/get-features.d.ts +15 -9
  63. package/dist/tools/get-features.d.ts.map +1 -1
  64. package/dist/tools/get-features.js +12 -0
  65. package/dist/tools/get-features.js.map +1 -1
  66. package/dist/tools/get-file.d.ts +23 -0
  67. package/dist/tools/get-file.d.ts.map +1 -0
  68. package/dist/tools/get-file.js +57 -0
  69. package/dist/tools/get-file.js.map +1 -0
  70. package/dist/tools/get-file.test.d.ts +5 -0
  71. package/dist/tools/get-file.test.d.ts.map +1 -0
  72. package/dist/tools/get-file.test.js +63 -0
  73. package/dist/tools/get-file.test.js.map +1 -0
  74. package/dist/tools/get-scaffold.d.ts +11 -33
  75. package/dist/tools/get-scaffold.d.ts.map +1 -1
  76. package/dist/tools/get-scaffold.js +31 -44
  77. package/dist/tools/get-scaffold.js.map +1 -1
  78. package/dist/tools/get-scaffold.test.js +29 -22
  79. package/dist/tools/get-scaffold.test.js.map +1 -1
  80. package/dist/tools/index.d.ts +2 -2
  81. package/dist/tools/index.d.ts.map +1 -1
  82. package/dist/tools/index.js +1 -1
  83. package/dist/tools/index.js.map +1 -1
  84. package/dist/tools/registry.d.ts +4 -0
  85. package/dist/tools/registry.d.ts.map +1 -1
  86. package/dist/tools/registry.js +26 -16
  87. package/dist/tools/registry.js.map +1 -1
  88. package/dist/tools/types.d.ts +24 -6
  89. package/dist/tools/types.d.ts.map +1 -1
  90. package/dist/tools/types.js +3 -0
  91. package/dist/tools/types.js.map +1 -1
  92. package/dist/utils/cache.d.ts +9 -5
  93. package/dist/utils/cache.d.ts.map +1 -1
  94. package/dist/utils/cache.js +21 -5
  95. package/dist/utils/cache.js.map +1 -1
  96. package/dist/utils/docs.d.ts +1 -3
  97. package/dist/utils/docs.d.ts.map +1 -1
  98. package/dist/utils/docs.js +3 -8
  99. package/dist/utils/docs.js.map +1 -1
  100. package/dist/utils/index.d.ts +0 -1
  101. package/dist/utils/index.d.ts.map +1 -1
  102. package/dist/utils/index.js +0 -1
  103. package/dist/utils/index.js.map +1 -1
  104. package/dist/utils/paths.d.ts +9 -0
  105. package/dist/utils/paths.d.ts.map +1 -1
  106. package/dist/utils/paths.js +19 -1
  107. package/dist/utils/paths.js.map +1 -1
  108. package/dist/utils/paths.test.js +22 -1
  109. package/dist/utils/paths.test.js.map +1 -1
  110. package/dist/utils/scaffold/claude-md/index.d.ts +7 -0
  111. package/dist/utils/scaffold/claude-md/index.d.ts.map +1 -0
  112. package/dist/utils/scaffold/claude-md/index.js +23 -0
  113. package/dist/utils/scaffold/claude-md/index.js.map +1 -0
  114. package/dist/utils/scaffold/claude-md/sections.d.ts +16 -0
  115. package/dist/utils/scaffold/claude-md/sections.d.ts.map +1 -0
  116. package/dist/utils/scaffold/claude-md/sections.js +269 -0
  117. package/dist/utils/scaffold/claude-md/sections.js.map +1 -0
  118. package/dist/utils/scaffold/commands.d.ts +2 -6
  119. package/dist/utils/scaffold/commands.d.ts.map +1 -1
  120. package/dist/utils/scaffold/commands.js +9 -12
  121. package/dist/utils/scaffold/commands.js.map +1 -1
  122. package/dist/utils/scaffold/compute.d.ts +5 -8
  123. package/dist/utils/scaffold/compute.d.ts.map +1 -1
  124. package/dist/utils/scaffold/compute.js +26 -41
  125. package/dist/utils/scaffold/compute.js.map +1 -1
  126. package/dist/utils/scaffold/dependencies.d.ts +10 -17
  127. package/dist/utils/scaffold/dependencies.d.ts.map +1 -1
  128. package/dist/utils/scaffold/dependencies.js +28 -34
  129. package/dist/utils/scaffold/dependencies.js.map +1 -1
  130. package/dist/utils/scaffold/generators.d.ts +3 -11
  131. package/dist/utils/scaffold/generators.d.ts.map +1 -1
  132. package/dist/utils/scaffold/generators.js +20 -288
  133. package/dist/utils/scaffold/generators.js.map +1 -1
  134. package/dist/utils/scaffold/index.d.ts +2 -3
  135. package/dist/utils/scaffold/index.d.ts.map +1 -1
  136. package/dist/utils/scaffold/index.js +1 -3
  137. package/dist/utils/scaffold/index.js.map +1 -1
  138. package/package.json +2 -2
  139. package/dist/tools/get-example.d.ts +0 -49
  140. package/dist/tools/get-example.d.ts.map +0 -1
  141. package/dist/tools/get-example.js +0 -91
  142. package/dist/tools/get-example.js.map +0 -1
  143. package/dist/tools/get-example.test.d.ts +0 -5
  144. package/dist/tools/get-example.test.d.ts.map +0 -1
  145. package/dist/tools/get-example.test.js +0 -63
  146. package/dist/tools/get-example.test.js.map +0 -1
  147. package/dist/utils/examples/api-patterns.d.ts +0 -3
  148. package/dist/utils/examples/api-patterns.d.ts.map +0 -1
  149. package/dist/utils/examples/api-patterns.js +0 -19
  150. package/dist/utils/examples/api-patterns.js.map +0 -1
  151. package/dist/utils/examples/component-patterns.d.ts +0 -3
  152. package/dist/utils/examples/component-patterns.d.ts.map +0 -1
  153. package/dist/utils/examples/component-patterns.js +0 -71
  154. package/dist/utils/examples/component-patterns.js.map +0 -1
  155. package/dist/utils/examples/context-patterns.d.ts +0 -3
  156. package/dist/utils/examples/context-patterns.d.ts.map +0 -1
  157. package/dist/utils/examples/context-patterns.js +0 -32
  158. package/dist/utils/examples/context-patterns.js.map +0 -1
  159. package/dist/utils/examples/hook-patterns.d.ts +0 -3
  160. package/dist/utils/examples/hook-patterns.d.ts.map +0 -1
  161. package/dist/utils/examples/hook-patterns.js +0 -55
  162. package/dist/utils/examples/hook-patterns.js.map +0 -1
  163. package/dist/utils/examples/i18n-patterns.d.ts +0 -3
  164. package/dist/utils/examples/i18n-patterns.d.ts.map +0 -1
  165. package/dist/utils/examples/i18n-patterns.js +0 -43
  166. package/dist/utils/examples/i18n-patterns.js.map +0 -1
  167. package/dist/utils/examples/index.d.ts +0 -12
  168. package/dist/utils/examples/index.d.ts.map +0 -1
  169. package/dist/utils/examples/index.js +0 -69
  170. package/dist/utils/examples/index.js.map +0 -1
  171. package/dist/utils/examples/mobile-patterns.d.ts +0 -3
  172. package/dist/utils/examples/mobile-patterns.d.ts.map +0 -1
  173. package/dist/utils/examples/mobile-patterns.js +0 -38
  174. package/dist/utils/examples/mobile-patterns.js.map +0 -1
  175. package/dist/utils/examples/page-patterns.d.ts +0 -3
  176. package/dist/utils/examples/page-patterns.d.ts.map +0 -1
  177. package/dist/utils/examples/page-patterns.js +0 -34
  178. package/dist/utils/examples/page-patterns.js.map +0 -1
  179. package/dist/utils/examples/store-patterns.d.ts +0 -3
  180. package/dist/utils/examples/store-patterns.d.ts.map +0 -1
  181. package/dist/utils/examples/store-patterns.js +0 -40
  182. package/dist/utils/examples/store-patterns.js.map +0 -1
  183. package/dist/utils/examples/test-patterns.d.ts +0 -3
  184. package/dist/utils/examples/test-patterns.d.ts.map +0 -1
  185. package/dist/utils/examples/test-patterns.js +0 -58
  186. package/dist/utils/examples/test-patterns.js.map +0 -1
  187. package/dist/utils/examples/types.d.ts +0 -17
  188. package/dist/utils/examples/types.d.ts.map +0 -1
  189. package/dist/utils/examples/types.js +0 -2
  190. package/dist/utils/examples/types.js.map +0 -1
  191. package/dist/utils/examples/utility-patterns.d.ts +0 -3
  192. package/dist/utils/examples/utility-patterns.d.ts.map +0 -1
  193. package/dist/utils/examples/utility-patterns.js +0 -77
  194. package/dist/utils/examples/utility-patterns.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/features/definitions/ui.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EAAE,GAAY;IACzB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE;QACR,+CAA+C;QAC/C,qBAAqB;QACrB,6CAA6C;QAC7C,oBAAoB;QACpB,+BAA+B;QAC/B,4BAA4B;QAC5B,4DAA4D;QAC5D,wBAAwB;QACxB,uCAAuC;QACvC,6CAA6C;QAC7C,gCAAgC;KACjC;IACD,eAAe,EAAE;QACf,sBAAsB;QACtB,0BAA0B;QAC1B,cAAc;QACd,UAAU;QACV,QAAQ;QACR,gBAAgB;KACjB;IACD,kBAAkB,EAAE,CAAC,QAAQ,CAAC;IAC9B,KAAK,EAAE;QACL,8BAA8B;QAC9B,qCAAqC;QACrC,+BAA+B;QAC/B,gCAAgC;QAChC,+BAA+B;QAC/B,8BAA8B;QAC9B,uCAAuC;QACvC,kCAAkC;QAClC,gCAAgC;QAChC,iBAAiB;KAClB;IACD,SAAS,EAAE,CAAC,oCAAoC,EAAE,uCAAuC,CAAC;IAC1F,QAAQ,EAAE,CAAC,cAAc,EAAE,iBAAiB,EAAE,uBAAuB,CAAC;IACtE,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,CAAC,iBAAiB,CAAC;CACjC,CAAC"}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/features/definitions/ui.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EAAE,GAAY;IACzB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE;QACR,+CAA+C;QAC/C,qBAAqB;QACrB,6CAA6C;QAC7C,oBAAoB;QACpB,+BAA+B;QAC/B,4BAA4B;QAC5B,4DAA4D;QAC5D,wBAAwB;QACxB,uCAAuC;QACvC,6CAA6C;QAC7C,gCAAgC;KACjC;IACD,eAAe,EAAE;QACf,sBAAsB;QACtB,0BAA0B;QAC1B,cAAc;QACd,UAAU;QACV,QAAQ;QACR,gBAAgB;KACjB;IACD,kBAAkB,EAAE,CAAC,QAAQ,CAAC;IAC9B,KAAK,EAAE;QACL,8BAA8B;QAC9B,qCAAqC;QACrC,+BAA+B;QAC/B,gCAAgC;QAChC,+BAA+B;QAC/B,8BAA8B;QAC9B,uCAAuC;QACvC,kCAAkC;QAClC,gCAAgC;QAChC,iBAAiB;KAClB;IACD,SAAS,EAAE,CAAC,oCAAoC,EAAE,uCAAuC,CAAC;IAC1F,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,CAAC,iBAAiB,CAAC;CACjC,CAAC"}
@@ -1,34 +1,26 @@
1
1
  /**
2
2
  * Type definitions for feature modules
3
3
  */
4
- /**
5
- * All valid feature IDs as a const tuple.
6
- * Used for compile-time type safety when referencing features.
7
- */
8
- export declare const FEATURE_IDS: readonly ["core", "mobile", "routing", "ui", "forms", "state", "api", "i18n", "testing", "performance", "devtools", "ci", "observability", "theming"];
9
- /** Type-safe feature identifier */
10
- export type FeatureId = (typeof FEATURE_IDS)[number];
11
- /** Type guard to check if a string is a valid FeatureId */
4
+ import { FEATURE } from '../constants.js';
5
+ /** All valid feature IDs derived from FEATURE constant (single source of truth). */
6
+ export declare const FEATURE_IDS: readonly FeatureId[];
7
+ /** Type-safe feature identifier. */
8
+ export type FeatureId = (typeof FEATURE)[keyof typeof FEATURE];
9
+ /** Type guard to check if a string is a valid FeatureId. */
12
10
  export declare function isFeatureId(value: string): value is FeatureId;
13
11
  export interface Feature {
14
12
  name: string;
15
13
  description: string;
16
14
  required: boolean;
17
15
  includes: string[];
18
- /**
19
- * Dependency package names - versions resolved from webapp-base package.json at runtime.
20
- * This ensures scaffolded projects always get up-to-date dependency versions.
21
- */
16
+ /** Other features this feature depends on (auto-included when this feature is selected). */
17
+ requires?: FeatureId[];
18
+ /** Dependency package names - versions resolved from package.json at runtime. */
22
19
  dependencyNames?: string[];
23
20
  devDependencyNames?: string[];
24
21
  files: string[];
25
- /**
26
- * Test files associated with this feature.
27
- * Only included in scaffold when the 'testing' feature is also selected.
28
- * This keeps feature source files separate from test infrastructure concerns.
29
- */
22
+ /** Test files - only included when 'testing' feature is also selected. */
30
23
  testFiles?: string[];
31
- patterns: string[];
32
24
  scripts?: Record<string, string>;
33
25
  configFiles?: string[];
34
26
  }
@@ -47,12 +39,14 @@ export interface ScaffoldResult {
47
39
  engines: Record<string, string>;
48
40
  };
49
41
  structure: string[];
50
- configFiles: Record<string, string>;
42
+ /** Config file paths (use get_file to fetch content) */
43
+ configFiles: string[];
51
44
  setupCommands: string[];
52
45
  claudeMd: string;
53
46
  viteEnvDts: string;
54
47
  envTs: string;
55
48
  routesTs?: string;
56
- docs: Record<string, string>;
49
+ /** Documentation file paths (use get_file to fetch content) */
50
+ docs: string[];
57
51
  }
58
52
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW,uJAed,CAAC;AAEX,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE7D;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE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M,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,wDAAwD;IACxD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"}
@@ -1,27 +1,10 @@
1
1
  /**
2
2
  * Type definitions for feature modules
3
3
  */
4
- /**
5
- * All valid feature IDs as a const tuple.
6
- * Used for compile-time type safety when referencing features.
7
- */
8
- export const FEATURE_IDS = [
9
- 'core',
10
- 'mobile',
11
- 'routing',
12
- 'ui',
13
- 'forms',
14
- 'state',
15
- 'api',
16
- 'i18n',
17
- 'testing',
18
- 'performance',
19
- 'devtools',
20
- 'ci',
21
- 'observability',
22
- 'theming',
23
- ];
24
- /** Type guard to check if a string is a valid FeatureId */
4
+ import { FEATURE } from '../constants.js';
5
+ /** All valid feature IDs derived from FEATURE constant (single source of truth). */
6
+ export const FEATURE_IDS = Object.values(FEATURE);
7
+ /** Type guard to check if a string is a valid FeatureId. */
25
8
  export function isFeatureId(value) {
26
9
  return FEATURE_IDS.includes(value);
27
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,QAAQ;IACR,SAAS;IACT,IAAI;IACJ,OAAO;IACP,OAAO;IACP,KAAK;IACL,MAAM;IACN,SAAS;IACT,aAAa;IACb,UAAU;IACV,IAAI;IACJ,eAAe;IACf,SAAS;CACD,CAAC;AAKX,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAkB,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/features/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAyB,CAAC;AAK1E,4DAA4D;AAC5D,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAQ,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for feature type definitions.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../src/features/types.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Tests for feature type definitions.
3
+ */
4
+ import { describe, it, expect } from 'vitest';
5
+ import { FEATURE } from '../constants.js';
6
+ import { FEATURE_IDS, isFeatureId } from './types.js';
7
+ describe('FEATURE_IDS', () => {
8
+ it('is derived from FEATURE constant', () => {
9
+ expect(FEATURE_IDS).toEqual(Object.values(FEATURE));
10
+ });
11
+ it('contains expected features', () => {
12
+ expect(FEATURE_IDS).toContain('core');
13
+ expect(FEATURE_IDS).toContain('routing');
14
+ expect(FEATURE_IDS).toContain('testing');
15
+ });
16
+ it('has 14 features', () => {
17
+ expect(FEATURE_IDS).toHaveLength(14);
18
+ });
19
+ });
20
+ describe('isFeatureId', () => {
21
+ it('returns true for valid feature IDs', () => {
22
+ expect(isFeatureId('core')).toBe(true);
23
+ expect(isFeatureId('routing')).toBe(true);
24
+ expect(isFeatureId('theming')).toBe(true);
25
+ });
26
+ it('returns false for invalid feature IDs', () => {
27
+ expect(isFeatureId('invalid')).toBe(false);
28
+ expect(isFeatureId('')).toBe(false);
29
+ expect(isFeatureId('CORE')).toBe(false);
30
+ });
31
+ });
32
+ //# sourceMappingURL=types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../../src/features/types.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,9 +1,5 @@
1
1
  /**
2
- * Documentation resources
3
- *
4
- * Reads actual documentation files from the react-spa-scaffold repository
5
- * to ensure MCP resources stay in sync with the real docs.
6
- * Uses in-memory caching to avoid repeated disk reads.
2
+ * Documentation resources - reads docs from react-spa-scaffold repository.
7
3
  */
8
4
  /**
9
5
  * Get list of all available documentation resources
@@ -14,9 +10,7 @@ export declare function getDocumentationResources(): {
14
10
  description: string;
15
11
  mimeType: string;
16
12
  }[];
17
- /**
18
- * Read documentation content for a resource URI (cached)
19
- */
13
+ /** Read documentation content for a resource URI (cached, parallel). */
20
14
  export declare function readDocumentation(uri: string): Promise<string | null>;
21
15
  /**
22
16
  * Check if a URI is a valid documentation resource
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/resources/docs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuDH;;GAEG;AACH,wBAAgB,yBAAyB;;;;;IAOxC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiC3E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/resources/docs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkDH;;GAEG;AACH,wBAAgB,yBAAyB;;;;;IAOxC;AAED,wEAAwE;AACxE,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiB3E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
@@ -1,47 +1,39 @@
1
1
  /**
2
- * Documentation resources
3
- *
4
- * Reads actual documentation files from the react-spa-scaffold repository
5
- * to ensure MCP resources stay in sync with the real docs.
6
- * Uses in-memory caching to avoid repeated disk reads.
2
+ * Documentation resources - reads docs from react-spa-scaffold repository.
7
3
  */
8
4
  import { readFile } from 'fs/promises';
5
+ import { DOCS_URI } from '../constants.js';
6
+ import { createCache } from '../utils/cache.js';
9
7
  import { resolveTemplatePath } from '../utils/paths.js';
10
- // Simple in-memory cache for documentation content
11
- const cache = new Map();
12
- /**
13
- * Documentation file mapping
14
- *
15
- * Maps resource URIs to actual files in the repository.
16
- * Add new entries here to expose additional documentation.
17
- */
8
+ const docsCache = createCache();
9
+ /** Documentation file mapping - maps URIs to repository files. */
18
10
  const DOCS_MAP = {
19
- 'docs://conventions': {
11
+ [DOCS_URI.CONVENTIONS]: {
20
12
  files: ['docs/CODING_STANDARDS.md', 'docs/COMPONENT_GUIDELINES.md'],
21
13
  name: 'Coding Conventions',
22
- description: 'Coding standards, naming conventions, and component patterns for react-spa-scaffold projects',
14
+ description: 'Coding standards, naming conventions, and component patterns',
23
15
  },
24
- 'docs://architecture': {
16
+ [DOCS_URI.ARCHITECTURE]: {
25
17
  files: ['docs/ARCHITECTURE.md'],
26
18
  name: 'Architecture Overview',
27
- description: 'Technology stack, data flow, and architectural decisions for react-spa-scaffold',
19
+ description: 'Technology stack, data flow, and architectural decisions',
28
20
  },
29
- 'docs://testing': {
21
+ [DOCS_URI.TESTING]: {
30
22
  files: ['docs/TESTING.md', 'docs/E2E_TESTING.md'],
31
23
  name: 'Testing Guide',
32
24
  description: 'Unit testing with Vitest and E2E testing with Playwright',
33
25
  },
34
- 'docs://i18n': {
26
+ [DOCS_URI.I18N]: {
35
27
  files: ['docs/INTERNATIONALIZATION.md'],
36
28
  name: 'Internationalization',
37
29
  description: 'LinguiJS setup, Trans component usage, and translation workflow',
38
30
  },
39
- 'docs://api': {
31
+ [DOCS_URI.API]: {
40
32
  files: ['docs/API_REFERENCE.md'],
41
33
  name: 'API Reference',
42
34
  description: 'API client utilities, hooks, and data fetching patterns',
43
35
  },
44
- 'docs://claude': {
36
+ [DOCS_URI.CLAUDE]: {
45
37
  files: ['CLAUDE.md'],
46
38
  name: 'Claude AI Guidance',
47
39
  description: 'AI assistant instructions and project-specific guidance',
@@ -58,37 +50,23 @@ export function getDocumentationResources() {
58
50
  mimeType: 'text/markdown',
59
51
  }));
60
52
  }
61
- /**
62
- * Read documentation content for a resource URI (cached)
63
- */
53
+ /** Read documentation content for a resource URI (cached, parallel). */
64
54
  export async function readDocumentation(uri) {
65
55
  const doc = DOCS_MAP[uri];
66
- if (!doc) {
56
+ if (!doc)
67
57
  return null;
68
- }
69
- // Return cached content if available
70
- if (cache.has(uri)) {
71
- return cache.get(uri);
72
- }
73
- const contents = [];
74
- for (const file of doc.files) {
75
- const fullPath = resolveTemplatePath(file);
76
- try {
77
- const content = await readFile(fullPath, 'utf-8');
78
- contents.push(content);
79
- }
80
- catch {
81
- // File might not exist
82
- contents.push(`<!-- File not found: ${file} -->\n`);
83
- }
84
- }
85
- // Join multiple files with a separator
86
- const result = contents.length > 1 ? contents.join('\n\n---\n\n') : contents[0] || null;
87
- // Cache the result
88
- if (result) {
89
- cache.set(uri, result);
90
- }
91
- return result;
58
+ return docsCache.getOrSet(uri, async () => {
59
+ const contents = await Promise.all(doc.files.map(async (file) => {
60
+ const fullPath = resolveTemplatePath(file);
61
+ try {
62
+ return await readFile(fullPath, 'utf-8');
63
+ }
64
+ catch {
65
+ return `<!-- File not found: ${file} -->\n`;
66
+ }
67
+ }));
68
+ return contents.length > 1 ? contents.join('\n\n---\n\n') : (contents[0] ?? '');
69
+ });
92
70
  }
93
71
  /**
94
72
  * Check if a URI is a valid documentation resource
@@ -1 +1 @@
1
- {"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/resources/docs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,mDAAmD;AACnD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,QAAQ,GAOV;IACF,oBAAoB,EAAE;QACpB,KAAK,EAAE,CAAC,0BAA0B,EAAE,8BAA8B,CAAC;QACnE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,8FAA8F;KAC5G;IACD,qBAAqB,EAAE;QACrB,KAAK,EAAE,CAAC,sBAAsB,CAAC;QAC/B,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,iFAAiF;KAC/F;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;QACjD,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,0DAA0D;KACxE;IACD,aAAa,EAAE;QACb,KAAK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CAAC,GAAG,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC;gBACH,OAAO,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,wBAAwB,IAAI,QAAQ,CAAC;YAC9C,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QACF,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,OAAO,GAAG,IAAI,QAAQ,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAyCnE,6CAA6C;AAC7C,wBAAgB,YAAY,IAAI,MAAM,CA0DrC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA0CnE,6CAA6C;AAC7C,wBAAgB,YAAY,IAAI,MAAM,CA0DrC"}
package/dist/server.js CHANGED
@@ -3,8 +3,9 @@
3
3
  */
4
4
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
5
  import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
6
- import { TOOL_REGISTRY, getToolDefinitions } from './tools/index.js';
7
- import { getDocumentationResources, readDocumentation, isValidDocumentationUri } from './resources/index.js';
6
+ // Direct imports - flattened for faster startup
7
+ import { TOOL_REGISTRY, getToolDefinitions } from './tools/registry.js';
8
+ import { getDocumentationResources, readDocumentation, isValidDocumentationUri } from './resources/docs.js';
8
9
  import { VERSION } from './version.js';
9
10
  function jsonResponse(data) {
10
11
  return {
@@ -21,16 +22,16 @@ const SERVER_INSTRUCTIONS = `
21
22
  react-spa-scaffold MCP Server - Project Scaffolding Assistant
22
23
 
23
24
  Usage:
24
- 1. Call get_features to see available feature modules
25
- 2. Call get_scaffold with desired features to get project structure
26
- 3. Call get_example to get code patterns for specific file types
27
- 4. Read docs:// resources for conventions and best practices
25
+ 1. get_features - list available feature modules
26
+ 2. get_scaffold - get project structure (paths only)
27
+ 3. get_file - fetch content for EACH file
28
+
29
+ CRITICAL: Do not generate files. Fetch via get_file, then strip unselected features.
28
30
 
29
31
  Tips:
30
32
  - Core feature is always included automatically
31
- - Features are mostly independent - select only what you need
32
33
  - Theming feature automatically includes state (requires Zustand)
33
- - Check docs://conventions before generating code
34
+ - Read docs:// resources for conventions and best practices
34
35
  `.trim();
35
36
  /** Creates and configures the MCP server. */
36
37
  export function createServer() {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,kBA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AM,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1C,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,aAAa,CAAC,mBAAmB,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,iBAAiB,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAChE,SAAS,EAAE,yBAAyB,EAAE;KACvC,CAAC,CAAC,CAAC;IAEJ,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACpE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QAE/B,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;SAC9D,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -5,6 +5,8 @@
5
5
  * AI agents use this to understand what features are available
6
6
  * and present options to users.
7
7
  */
8
+ import type { ToolDefinition } from './types.js';
9
+ /** Feature summary returned by get_features tool. */
8
10
  export interface FeatureSummary {
9
11
  id: string;
10
12
  name: string;
@@ -12,14 +14,18 @@ export interface FeatureSummary {
12
14
  required: boolean;
13
15
  includes: string[];
14
16
  }
17
+ /**
18
+ * Lists all available features for scaffolding.
19
+ *
20
+ * @returns Array of feature summaries with id, name, description, required flag, and includes
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const features = getFeatures();
25
+ * // [{ id: 'core', name: 'Core', required: true, ... }, ...]
26
+ * ```
27
+ */
15
28
  export declare function getFeatures(): FeatureSummary[];
16
- export declare const getFeaturesToolDefinition: {
17
- name: string;
18
- description: string;
19
- inputSchema: {
20
- type: "object";
21
- properties: {};
22
- required: string[];
23
- };
24
- };
29
+ /** Tool definition for get_features - no input required. */
30
+ export declare const getFeaturesToolDefinition: ToolDefinition;
25
31
  //# sourceMappingURL=get-features.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-features.d.ts","sourceRoot":"","sources":["../../src/tools/get-features.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,WAAW,IAAI,cAAc,EAAE,CAW9C;AAED,eAAO,MAAM,yBAAyB;;;;;;kBAqBlB,MAAM,EAAE;;CAE3B,CAAC"}
1
+ {"version":3,"file":"get-features.d.ts","sourceRoot":"","sources":["../../src/tools/get-features.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,IAAI,cAAc,EAAE,CAW9C;AAED,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,EAAE,cAuBvC,CAAC"}
@@ -6,6 +6,17 @@
6
6
  * and present options to users.
7
7
  */
8
8
  import { FEATURES, FEATURE_IDS } from '../features/index.js';
9
+ /**
10
+ * Lists all available features for scaffolding.
11
+ *
12
+ * @returns Array of feature summaries with id, name, description, required flag, and includes
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const features = getFeatures();
17
+ * // [{ id: 'core', name: 'Core', required: true, ... }, ...]
18
+ * ```
19
+ */
9
20
  export function getFeatures() {
10
21
  return FEATURE_IDS.map((id) => {
11
22
  const feature = FEATURES[id];
@@ -18,6 +29,7 @@ export function getFeatures() {
18
29
  };
19
30
  });
20
31
  }
32
+ /** Tool definition for get_features - no input required. */
21
33
  export const getFeaturesToolDefinition = {
22
34
  name: 'get_features',
23
35
  description: `List all available feature modules for react-spa-scaffold project scaffolding.
@@ -1 +1 @@
1
- {"version":3,"file":"get-features.js","sourceRoot":"","sources":["../../src/tools/get-features.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAU7D,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAkB,EAAE;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE;;;;;;;;;;;;;;;uEAewD;IACrE,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAc;KACzB;CACF,CAAC"}
1
+ {"version":3,"file":"get-features.js","sourceRoot":"","sources":["../../src/tools/get-features.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAY7D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAkB,EAAE;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAmB;IACvD,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE;;;;;;;;;;;;;;;uEAewD;IACrE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACb;CACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * get_file tool
3
+ *
4
+ * Fetches content of ANY file from react-spa-scaffold templates.
5
+ * Used for lazy loading after get_scaffold returns paths.
6
+ */
7
+ import { z } from 'zod';
8
+ import type { ToolDefinition } from './types.js';
9
+ /** Zod schema for get_file input - single source of truth. */
10
+ export declare const getFileSchema: z.ZodObject<{
11
+ path: z.ZodString;
12
+ }, z.core.$strip>;
13
+ export type GetFileInput = z.infer<typeof getFileSchema>;
14
+ export declare function getFile(input: GetFileInput): Promise<{
15
+ path: string;
16
+ content: string;
17
+ } | {
18
+ error: string;
19
+ hint: string;
20
+ }>;
21
+ /** Tool definition derived from Zod schema (Zod v4 native). */
22
+ export declare const getFileToolDefinition: ToolDefinition;
23
+ //# sourceMappingURL=get-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file.d.ts","sourceRoot":"","sources":["../../src/tools/get-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,8DAA8D;AAC9D,eAAO,MAAM,aAAa;;iBAExB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEzD,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY;UATX,MAAM;aAAW,MAAM;;;;GAgC5D;AAED,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,EAAE,cAgBnC,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * get_file tool
3
+ *
4
+ * Fetches content of ANY file from react-spa-scaffold templates.
5
+ * Used for lazy loading after get_scaffold returns paths.
6
+ */
7
+ import { readFile } from 'fs/promises';
8
+ import { z } from 'zod';
9
+ import { createCache } from '../utils/cache.js';
10
+ import { isPathWithinRoot, resolveTemplatePath } from '../utils/paths.js';
11
+ const fileCache = createCache();
12
+ /** Zod schema for get_file input - single source of truth. */
13
+ export const getFileSchema = z.object({
14
+ path: z.string().describe('File path from get_scaffold (fileStructure, configFiles, or docs)'),
15
+ });
16
+ export async function getFile(input) {
17
+ const { path: filePath } = input;
18
+ // Security: prevent path traversal
19
+ if (!isPathWithinRoot(filePath)) {
20
+ return {
21
+ error: 'Invalid path: must be within template directory',
22
+ hint: 'Use paths from get_scaffold (fileStructure, configFiles, or docs)',
23
+ };
24
+ }
25
+ try {
26
+ return await fileCache.getOrSet(filePath, async () => {
27
+ const fullPath = resolveTemplatePath(filePath);
28
+ const content = await readFile(fullPath, 'utf-8');
29
+ return { path: filePath, content };
30
+ });
31
+ }
32
+ catch {
33
+ return {
34
+ error: `File not found: ${filePath}`,
35
+ hint: 'Ensure MCP server runs from react-spa-scaffold directory',
36
+ };
37
+ }
38
+ }
39
+ /** Tool definition derived from Zod schema (Zod v4 native). */
40
+ export const getFileToolDefinition = {
41
+ name: 'get_file',
42
+ description: `Fetch file content from react-spa-scaffold templates.
43
+
44
+ Use with paths from \`get_scaffold\` response:
45
+ - \`configFiles\`: config file paths
46
+ - \`docs\`: documentation paths
47
+ - \`fileStructure\`: ALL source file paths
48
+
49
+ IMPORTANT: Fetch content for EVERY file in fileStructure, then strip code for unselected features.
50
+
51
+ Examples:
52
+ - \`{ path: "vite.config.ts" }\`
53
+ - \`{ path: "docs/TESTING.md" }\`
54
+ - \`{ path: "src/App.tsx" }\``,
55
+ inputSchema: z.toJSONSchema(getFileSchema),
56
+ };
57
+ //# sourceMappingURL=get-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file.js","sourceRoot":"","sources":["../../src/tools/get-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI1E,MAAM,SAAS,GAAG,WAAW,EAAqC,CAAC;AAEnE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mEAAmE,CAAC;CAC/F,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAmB;IAC/C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjC,mCAAmC;IACnC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO;YACL,KAAK,EAAE,iDAAiD;YACxD,IAAI,EAAE,mEAAmE;SAC1E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAC/C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,KAAK,EAAE,mBAAmB,QAAQ,EAAE;YACpC,IAAI,EAAE,0DAA0D;SACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACnD,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;;;;;;;;;;;;8BAYe;IAC5B,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,aAAa,CAAkC;CAC5E,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for get_file tool
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=get-file.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-file.test.d.ts","sourceRoot":"","sources":["../../src/tools/get-file.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Tests for get_file tool
3
+ */
4
+ import { describe, it, expect } from 'vitest';
5
+ import { getFile, getFileSchema } from './get-file.js';
6
+ describe('get_file tool', () => {
7
+ describe('schema validation', () => {
8
+ it('accepts valid path', () => {
9
+ const result = getFileSchema.safeParse({ path: 'vite.config.ts' });
10
+ expect(result.success).toBe(true);
11
+ });
12
+ it('rejects missing path', () => {
13
+ const result = getFileSchema.safeParse({});
14
+ expect(result.success).toBe(false);
15
+ });
16
+ });
17
+ describe('file fetching', () => {
18
+ it('fetches config file content', async () => {
19
+ const result = await getFile({ path: 'vite.config.ts' });
20
+ expect(result).not.toHaveProperty('error');
21
+ expect(result).toHaveProperty('path', 'vite.config.ts');
22
+ expect(result).toHaveProperty('content');
23
+ expect(result.content).toContain('defineConfig');
24
+ });
25
+ it('fetches documentation file content', async () => {
26
+ const result = await getFile({ path: 'docs/ARCHITECTURE.md' });
27
+ expect(result).not.toHaveProperty('error');
28
+ expect(result).toHaveProperty('path', 'docs/ARCHITECTURE.md');
29
+ expect(result).toHaveProperty('content');
30
+ expect(result.content).toContain('#');
31
+ });
32
+ it('fetches .gitignore content', async () => {
33
+ const result = await getFile({ path: '.gitignore' });
34
+ expect(result).not.toHaveProperty('error');
35
+ expect(result).toHaveProperty('content');
36
+ expect(result.content).toContain('node_modules');
37
+ });
38
+ });
39
+ describe('security', () => {
40
+ it('rejects path traversal attempts', async () => {
41
+ const result = await getFile({ path: '../../../etc/passwd' });
42
+ expect(result).toHaveProperty('error');
43
+ expect(result.error).toContain('Invalid path');
44
+ });
45
+ it('rejects absolute paths outside root', async () => {
46
+ const result = await getFile({ path: '/etc/passwd' });
47
+ expect(result).toHaveProperty('error');
48
+ });
49
+ it('rejects embedded path traversal', async () => {
50
+ const result = await getFile({ path: 'docs/../../../etc/passwd' });
51
+ expect(result).toHaveProperty('error');
52
+ });
53
+ });
54
+ describe('error handling', () => {
55
+ it('returns error for non-existent file', async () => {
56
+ const result = await getFile({ path: 'nonexistent-file.xyz' });
57
+ expect(result).toHaveProperty('error');
58
+ expect(result.error).toContain('File not found');
59
+ expect(result).toHaveProperty('hint');
60
+ });
61
+ });
62
+ });
63
+ //# sourceMappingURL=get-file.test.js.map