@react-spa-scaffold/mcp 1.1.3 → 1.2.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 (217) hide show
  1. package/README.md +19 -15
  2. package/dist/features/definitions/api.d.ts +3 -0
  3. package/dist/features/definitions/api.d.ts.map +1 -0
  4. package/dist/features/definitions/api.js +20 -0
  5. package/dist/features/definitions/api.js.map +1 -0
  6. package/dist/features/definitions/ci.d.ts +3 -0
  7. package/dist/features/definitions/ci.d.ts.map +1 -0
  8. package/dist/features/definitions/ci.js +25 -0
  9. package/dist/features/definitions/ci.js.map +1 -0
  10. package/dist/features/definitions/core.d.ts +3 -0
  11. package/dist/features/definitions/core.d.ts.map +1 -0
  12. package/dist/features/definitions/core.js +76 -0
  13. package/dist/features/definitions/core.js.map +1 -0
  14. package/dist/features/definitions/devtools.d.ts +3 -0
  15. package/dist/features/definitions/devtools.d.ts.map +1 -0
  16. package/dist/features/definitions/devtools.js +53 -0
  17. package/dist/features/definitions/devtools.js.map +1 -0
  18. package/dist/features/definitions/forms.d.ts +3 -0
  19. package/dist/features/definitions/forms.d.ts.map +1 -0
  20. package/dist/features/definitions/forms.js +32 -0
  21. package/dist/features/definitions/forms.js.map +1 -0
  22. package/dist/features/definitions/i18n.d.ts +3 -0
  23. package/dist/features/definitions/i18n.d.ts.map +1 -0
  24. package/dist/features/definitions/i18n.js +50 -0
  25. package/dist/features/definitions/i18n.js.map +1 -0
  26. package/dist/features/definitions/index.d.ts +15 -0
  27. package/dist/features/definitions/index.d.ts.map +1 -0
  28. package/dist/features/definitions/index.js +15 -0
  29. package/dist/features/definitions/index.js.map +1 -0
  30. package/dist/features/definitions/mobile.d.ts +3 -0
  31. package/dist/features/definitions/mobile.d.ts.map +1 -0
  32. package/dist/features/definitions/mobile.js +19 -0
  33. package/dist/features/definitions/mobile.js.map +1 -0
  34. package/dist/features/definitions/observability.d.ts +3 -0
  35. package/dist/features/definitions/observability.d.ts.map +1 -0
  36. package/dist/features/definitions/observability.js +21 -0
  37. package/dist/features/definitions/observability.js.map +1 -0
  38. package/dist/features/definitions/performance.d.ts +3 -0
  39. package/dist/features/definitions/performance.d.ts.map +1 -0
  40. package/dist/features/definitions/performance.js +28 -0
  41. package/dist/features/definitions/performance.js.map +1 -0
  42. package/dist/features/definitions/routing.d.ts +3 -0
  43. package/dist/features/definitions/routing.d.ts.map +1 -0
  44. package/dist/features/definitions/routing.js +25 -0
  45. package/dist/features/definitions/routing.js.map +1 -0
  46. package/dist/features/definitions/state.d.ts +3 -0
  47. package/dist/features/definitions/state.d.ts.map +1 -0
  48. package/dist/features/definitions/state.js +27 -0
  49. package/dist/features/definitions/state.js.map +1 -0
  50. package/dist/features/definitions/testing.d.ts +3 -0
  51. package/dist/features/definitions/testing.d.ts.map +1 -0
  52. package/dist/features/definitions/testing.js +56 -0
  53. package/dist/features/definitions/testing.js.map +1 -0
  54. package/dist/features/definitions/theming.d.ts +3 -0
  55. package/dist/features/definitions/theming.d.ts.map +1 -0
  56. package/dist/features/definitions/theming.js +26 -0
  57. package/dist/features/definitions/theming.js.map +1 -0
  58. package/dist/features/definitions/ui.d.ts +3 -0
  59. package/dist/features/definitions/ui.d.ts.map +1 -0
  60. package/dist/features/definitions/ui.js +44 -0
  61. package/dist/features/definitions/ui.js.map +1 -0
  62. package/dist/features/index.d.ts +3 -2
  63. package/dist/features/index.d.ts.map +1 -1
  64. package/dist/features/index.js +2 -1
  65. package/dist/features/index.js.map +1 -1
  66. package/dist/features/registry.d.ts +3 -9
  67. package/dist/features/registry.d.ts.map +1 -1
  68. package/dist/features/registry.js +3 -554
  69. package/dist/features/registry.js.map +1 -1
  70. package/dist/features/types.d.ts +11 -9
  71. package/dist/features/types.d.ts.map +1 -1
  72. package/dist/features/types.js +24 -1
  73. package/dist/features/types.js.map +1 -1
  74. package/dist/server.d.ts +2 -7
  75. package/dist/server.d.ts.map +1 -1
  76. package/dist/server.js +22 -56
  77. package/dist/server.js.map +1 -1
  78. package/dist/server.test.d.ts +2 -0
  79. package/dist/server.test.d.ts.map +1 -0
  80. package/dist/server.test.js +14 -0
  81. package/dist/server.test.js.map +1 -0
  82. package/dist/tools/get-example.test.d.ts +5 -0
  83. package/dist/tools/get-example.test.d.ts.map +1 -0
  84. package/dist/tools/get-example.test.js +63 -0
  85. package/dist/tools/get-example.test.js.map +1 -0
  86. package/dist/tools/get-features.d.ts +0 -5
  87. package/dist/tools/get-features.d.ts.map +1 -1
  88. package/dist/tools/get-features.js +0 -2
  89. package/dist/tools/get-features.js.map +1 -1
  90. package/dist/tools/get-features.test.d.ts +5 -0
  91. package/dist/tools/get-features.test.d.ts.map +1 -0
  92. package/dist/tools/get-features.test.js +45 -0
  93. package/dist/tools/get-features.test.js.map +1 -0
  94. package/dist/tools/get-scaffold.d.ts +2 -2
  95. package/dist/tools/get-scaffold.test.d.ts +5 -0
  96. package/dist/tools/get-scaffold.test.d.ts.map +1 -0
  97. package/dist/tools/get-scaffold.test.js +194 -0
  98. package/dist/tools/get-scaffold.test.js.map +1 -0
  99. package/dist/tools/index.d.ts +2 -0
  100. package/dist/tools/index.d.ts.map +1 -1
  101. package/dist/tools/index.js +1 -0
  102. package/dist/tools/index.js.map +1 -1
  103. package/dist/tools/registry.d.ts +9 -0
  104. package/dist/tools/registry.d.ts.map +1 -0
  105. package/dist/tools/registry.js +29 -0
  106. package/dist/tools/registry.js.map +1 -0
  107. package/dist/tools/types.d.ts +23 -0
  108. package/dist/tools/types.d.ts.map +1 -0
  109. package/dist/tools/types.js +5 -0
  110. package/dist/tools/types.js.map +1 -0
  111. package/dist/utils/cache.d.ts +21 -0
  112. package/dist/utils/cache.d.ts.map +1 -0
  113. package/dist/utils/cache.js +45 -0
  114. package/dist/utils/cache.js.map +1 -0
  115. package/dist/utils/docs.test.d.ts +5 -0
  116. package/dist/utils/docs.test.d.ts.map +1 -0
  117. package/dist/utils/docs.test.js +37 -0
  118. package/dist/utils/docs.test.js.map +1 -0
  119. package/dist/utils/errors.d.ts +8 -0
  120. package/dist/utils/errors.d.ts.map +1 -0
  121. package/dist/utils/errors.js +19 -0
  122. package/dist/utils/errors.js.map +1 -0
  123. package/dist/utils/examples/api-patterns.d.ts +3 -0
  124. package/dist/utils/examples/api-patterns.d.ts.map +1 -0
  125. package/dist/utils/examples/api-patterns.js +19 -0
  126. package/dist/utils/examples/api-patterns.js.map +1 -0
  127. package/dist/utils/examples/component-patterns.d.ts +3 -0
  128. package/dist/utils/examples/component-patterns.d.ts.map +1 -0
  129. package/dist/utils/examples/component-patterns.js +71 -0
  130. package/dist/utils/examples/component-patterns.js.map +1 -0
  131. package/dist/utils/examples/context-patterns.d.ts +3 -0
  132. package/dist/utils/examples/context-patterns.d.ts.map +1 -0
  133. package/dist/utils/examples/context-patterns.js +32 -0
  134. package/dist/utils/examples/context-patterns.js.map +1 -0
  135. package/dist/utils/examples/hook-patterns.d.ts +3 -0
  136. package/dist/utils/examples/hook-patterns.d.ts.map +1 -0
  137. package/dist/utils/examples/hook-patterns.js +55 -0
  138. package/dist/utils/examples/hook-patterns.js.map +1 -0
  139. package/dist/utils/examples/i18n-patterns.d.ts +3 -0
  140. package/dist/utils/examples/i18n-patterns.d.ts.map +1 -0
  141. package/dist/utils/examples/i18n-patterns.js +43 -0
  142. package/dist/utils/examples/i18n-patterns.js.map +1 -0
  143. package/dist/utils/examples/index.d.ts +12 -0
  144. package/dist/utils/examples/index.d.ts.map +1 -0
  145. package/dist/utils/examples/index.js +69 -0
  146. package/dist/utils/examples/index.js.map +1 -0
  147. package/dist/utils/examples/mobile-patterns.d.ts +3 -0
  148. package/dist/utils/examples/mobile-patterns.d.ts.map +1 -0
  149. package/dist/utils/examples/mobile-patterns.js +38 -0
  150. package/dist/utils/examples/mobile-patterns.js.map +1 -0
  151. package/dist/utils/examples/page-patterns.d.ts +3 -0
  152. package/dist/utils/examples/page-patterns.d.ts.map +1 -0
  153. package/dist/utils/examples/page-patterns.js +34 -0
  154. package/dist/utils/examples/page-patterns.js.map +1 -0
  155. package/dist/utils/examples/store-patterns.d.ts +3 -0
  156. package/dist/utils/examples/store-patterns.d.ts.map +1 -0
  157. package/dist/utils/examples/store-patterns.js +40 -0
  158. package/dist/utils/examples/store-patterns.js.map +1 -0
  159. package/dist/utils/examples/test-patterns.d.ts +3 -0
  160. package/dist/utils/examples/test-patterns.d.ts.map +1 -0
  161. package/dist/utils/examples/test-patterns.js +58 -0
  162. package/dist/utils/examples/test-patterns.js.map +1 -0
  163. package/dist/utils/examples/types.d.ts +17 -0
  164. package/dist/utils/examples/types.d.ts.map +1 -0
  165. package/dist/utils/examples/types.js +2 -0
  166. package/dist/utils/examples/types.js.map +1 -0
  167. package/dist/utils/examples/utility-patterns.d.ts +3 -0
  168. package/dist/utils/examples/utility-patterns.d.ts.map +1 -0
  169. package/dist/utils/examples/utility-patterns.js +77 -0
  170. package/dist/utils/examples/utility-patterns.js.map +1 -0
  171. package/dist/utils/index.d.ts +5 -3
  172. package/dist/utils/index.d.ts.map +1 -1
  173. package/dist/utils/index.js +5 -3
  174. package/dist/utils/index.js.map +1 -1
  175. package/dist/utils/paths.d.ts +6 -25
  176. package/dist/utils/paths.d.ts.map +1 -1
  177. package/dist/utils/paths.js +11 -40
  178. package/dist/utils/paths.js.map +1 -1
  179. package/dist/utils/paths.test.d.ts +2 -0
  180. package/dist/utils/paths.test.d.ts.map +1 -0
  181. package/dist/utils/paths.test.js +17 -0
  182. package/dist/utils/paths.test.js.map +1 -0
  183. package/dist/utils/scaffold/commands.d.ts +11 -0
  184. package/dist/utils/scaffold/commands.d.ts.map +1 -0
  185. package/dist/utils/scaffold/commands.js +22 -0
  186. package/dist/utils/scaffold/commands.js.map +1 -0
  187. package/dist/utils/scaffold/compute.d.ts +18 -0
  188. package/dist/utils/scaffold/compute.d.ts.map +1 -0
  189. package/dist/utils/scaffold/compute.js +78 -0
  190. package/dist/utils/scaffold/compute.js.map +1 -0
  191. package/dist/utils/scaffold/dependencies.d.ts +32 -0
  192. package/dist/utils/scaffold/dependencies.d.ts.map +1 -0
  193. package/dist/utils/scaffold/dependencies.js +107 -0
  194. package/dist/utils/scaffold/dependencies.js.map +1 -0
  195. package/dist/utils/scaffold/file-structure.d.ts +23 -0
  196. package/dist/utils/scaffold/file-structure.d.ts.map +1 -0
  197. package/dist/utils/scaffold/file-structure.js +62 -0
  198. package/dist/utils/scaffold/file-structure.js.map +1 -0
  199. package/dist/utils/scaffold/generators.d.ts +17 -0
  200. package/dist/utils/scaffold/generators.d.ts.map +1 -0
  201. package/dist/utils/{scaffold.js → scaffold/generators.js} +6 -254
  202. package/dist/utils/scaffold/generators.js.map +1 -0
  203. package/dist/utils/scaffold/index.d.ts +11 -0
  204. package/dist/utils/scaffold/index.d.ts.map +1 -0
  205. package/dist/utils/scaffold/index.js +11 -0
  206. package/dist/utils/scaffold/index.js.map +1 -0
  207. package/package.json +1 -1
  208. package/templates/.github/workflows/release.yml +1 -1
  209. package/templates/e2e/tests/home.spec.ts +2 -2
  210. package/templates/e2e/tests/language.spec.ts +7 -3
  211. package/dist/utils/examples.d.ts +0 -27
  212. package/dist/utils/examples.d.ts.map +0 -1
  213. package/dist/utils/examples.js +0 -438
  214. package/dist/utils/examples.js.map +0 -1
  215. package/dist/utils/scaffold.d.ts +0 -59
  216. package/dist/utils/scaffold.d.ts.map +0 -1
  217. package/dist/utils/scaffold.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Code examples - provides real code patterns from the react-spa-scaffold repository.
3
+ */
4
+ import { readFile } from 'fs/promises';
5
+ import { resolveTemplatePath } from '../paths.js';
6
+ import { componentPatterns } from './component-patterns.js';
7
+ import { hookPatterns } from './hook-patterns.js';
8
+ import { mobilePatterns } from './mobile-patterns.js';
9
+ import { storePatterns } from './store-patterns.js';
10
+ import { pagePatterns } from './page-patterns.js';
11
+ import { contextPatterns } from './context-patterns.js';
12
+ import { apiPatterns } from './api-patterns.js';
13
+ import { testPatterns } from './test-patterns.js';
14
+ import { i18nPatterns } from './i18n-patterns.js';
15
+ import { utilityPatterns } from './utility-patterns.js';
16
+ /** All pattern definitions merged. */
17
+ const PATTERN_MAP = {
18
+ ...componentPatterns,
19
+ ...hookPatterns,
20
+ ...mobilePatterns,
21
+ ...storePatterns,
22
+ ...pagePatterns,
23
+ ...contextPatterns,
24
+ ...apiPatterns,
25
+ ...testPatterns,
26
+ ...i18nPatterns,
27
+ ...utilityPatterns,
28
+ };
29
+ /** Get all available pattern names. */
30
+ export function getAvailablePatterns() {
31
+ return Object.keys(PATTERN_MAP).sort();
32
+ }
33
+ /** Get code example for a pattern. */
34
+ export async function getCodeExample(pattern) {
35
+ const mapping = PATTERN_MAP[pattern];
36
+ if (!mapping)
37
+ return null;
38
+ const fullPath = resolveTemplatePath(mapping.file);
39
+ try {
40
+ const code = await readFile(fullPath, 'utf-8');
41
+ return {
42
+ pattern,
43
+ description: mapping.description,
44
+ filePath: mapping.file,
45
+ code,
46
+ keyPoints: mapping.keyPoints,
47
+ };
48
+ }
49
+ catch {
50
+ return {
51
+ pattern,
52
+ description: mapping.description,
53
+ filePath: mapping.file,
54
+ code: `// File not found: ${mapping.file}\n// Run MCP server from within react-spa-scaffold repository`,
55
+ keyPoints: mapping.keyPoints,
56
+ };
57
+ }
58
+ }
59
+ /** Get all examples for a list of patterns. */
60
+ export async function getFeatureExamples(patterns) {
61
+ const examples = [];
62
+ for (const pattern of patterns) {
63
+ const example = await getCodeExample(pattern);
64
+ if (example)
65
+ examples.push(example);
66
+ }
67
+ return examples;
68
+ }
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/examples/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,sCAAsC;AACtC,MAAM,WAAW,GAAe;IAC9B,GAAG,iBAAiB;IACpB,GAAG,YAAY;IACf,GAAG,cAAc;IACjB,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,eAAe;IAClB,GAAG,WAAW;IACd,GAAG,YAAY;IACf,GAAG,YAAY;IACf,GAAG,eAAe;CACnB,CAAC;AAEF,uCAAuC;AACvC,MAAM,UAAU,oBAAoB;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;AACzC,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAe;IAClD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO;YACL,OAAO;YACP,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,IAAI;YACtB,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,OAAO;YACP,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,IAAI;YACtB,IAAI,EAAE,sBAAsB,OAAO,CAAC,IAAI,+DAA+D;YACvG,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+CAA+C;AAC/C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAkB;IACzD,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,OAAO;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PatternMap } from './types.js';
2
+ export declare const mobilePatterns: PatternMap;
3
+ //# sourceMappingURL=mobile-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-patterns.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/mobile-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,UAoC5B,CAAC"}
@@ -0,0 +1,38 @@
1
+ export const mobilePatterns = {
2
+ 'mobile-context': {
3
+ file: 'src/contexts/mobileContext.tsx',
4
+ description: 'Mobile viewport detection context with optimized resize handling',
5
+ keyPoints: [
6
+ 'MobileProvider tracks viewport width via window.innerWidth',
7
+ 'useMobileContext hook returns isMobile, isTablet, isDesktop, width',
8
+ 'requestAnimationFrame debouncing for performance',
9
+ 'Only re-renders when width actually changes',
10
+ 'SSR-safe with BREAKPOINTS.lg fallback',
11
+ 'Throws error when used outside provider',
12
+ ],
13
+ },
14
+ 'use-media-query': {
15
+ file: 'src/hooks/useMediaQuery.ts',
16
+ description: 'Media query hook with breakpoint constants',
17
+ keyPoints: [
18
+ 'BREAKPOINTS: sm (640), md (768), lg (1024), xl (1280)',
19
+ 'useMediaQuery(query) for custom media queries',
20
+ 'useIsMobile() returns true if width < md breakpoint',
21
+ 'useIsDesktop() returns true if width >= lg breakpoint',
22
+ 'Uses useRef to persist MediaQueryList object',
23
+ 'SSR-safe initialization',
24
+ ],
25
+ },
26
+ 'use-touch-sizes': {
27
+ file: 'src/hooks/useTouchSizes.ts',
28
+ description: 'Touch-aware component sizing hook',
29
+ keyPoints: [
30
+ 'Returns size variants based on device type (mobile vs desktop)',
31
+ 'Integrates with MobileProvider via useMobileContext',
32
+ 'Provides: button, buttonSm, iconButton, iconButtonLg, input, select, toggle, textarea',
33
+ 'Mobile uses "touch" variants for larger tap targets',
34
+ 'Desktop uses "default" or smaller variants',
35
+ ],
36
+ },
37
+ };
38
+ //# sourceMappingURL=mobile-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-patterns.js","sourceRoot":"","sources":["../../../src/utils/examples/mobile-patterns.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,gBAAgB,EAAE;QAChB,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,kEAAkE;QAC/E,SAAS,EAAE;YACT,4DAA4D;YAC5D,oEAAoE;YACpE,kDAAkD;YAClD,6CAA6C;YAC7C,uCAAuC;YACvC,yCAAyC;SAC1C;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,4CAA4C;QACzD,SAAS,EAAE;YACT,uDAAuD;YACvD,+CAA+C;YAC/C,qDAAqD;YACrD,uDAAuD;YACvD,8CAA8C;YAC9C,yBAAyB;SAC1B;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,mCAAmC;QAChD,SAAS,EAAE;YACT,gEAAgE;YAChE,qDAAqD;YACrD,uFAAuF;YACvF,qDAAqD;YACrD,4CAA4C;SAC7C;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PatternMap } from './types.js';
2
+ export declare const pagePatterns: PatternMap;
3
+ //# sourceMappingURL=page-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-patterns.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/page-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,YAAY,EAAE,UAgC1B,CAAC"}
@@ -0,0 +1,34 @@
1
+ export const pagePatterns = {
2
+ 'page-component': {
3
+ file: 'src/pages/Home.tsx',
4
+ description: 'Page component with i18n and SEO',
5
+ keyPoints: [
6
+ 'Named export (PageNamePage convention)',
7
+ 'SEO component for page-specific meta tags',
8
+ 'Trans component for all user text',
9
+ 'Container layout classes',
10
+ 'Minimal logic (pages are thin)',
11
+ ],
12
+ },
13
+ 'lazy-page': {
14
+ file: 'src/App.tsx',
15
+ description: 'Lazy loading pattern for pages with default SEO',
16
+ keyPoints: [
17
+ 'React.lazy() with dynamic import',
18
+ 'Transform named to default: .then(m => ({ default: m.PageName }))',
19
+ 'Suspense boundary with fallback',
20
+ 'Route constants from lib/routes.ts',
21
+ 'Default SEO component for site-wide meta tags',
22
+ ],
23
+ },
24
+ 'route-constants': {
25
+ file: 'src/lib/routes.ts',
26
+ description: 'Typed route constants',
27
+ keyPoints: [
28
+ 'ROUTES object with as const',
29
+ 'AppRoute type for type-safe navigation',
30
+ 'Centralized route definitions',
31
+ ],
32
+ },
33
+ };
34
+ //# sourceMappingURL=page-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-patterns.js","sourceRoot":"","sources":["../../../src/utils/examples/page-patterns.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,gBAAgB,EAAE;QAChB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE;YACT,wCAAwC;YACxC,2CAA2C;YAC3C,mCAAmC;YACnC,0BAA0B;YAC1B,gCAAgC;SACjC;KACF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,iDAAiD;QAC9D,SAAS,EAAE;YACT,kCAAkC;YAClC,mEAAmE;YACnE,iCAAiC;YACjC,oCAAoC;YACpC,+CAA+C;SAChD;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,uBAAuB;QACpC,SAAS,EAAE;YACT,6BAA6B;YAC7B,wCAAwC;YACxC,+BAA+B;SAChC;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PatternMap } from './types.js';
2
+ export declare const storePatterns: PatternMap;
3
+ //# sourceMappingURL=store-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-patterns.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/store-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,aAAa,EAAE,UAsC3B,CAAC"}
@@ -0,0 +1,40 @@
1
+ export const storePatterns = {
2
+ 'zustand-store': {
3
+ file: 'src/stores/preferencesStore.ts',
4
+ description: 'Zustand store with persistence and devtools',
5
+ keyPoints: [
6
+ 'Separate type and interface definitions',
7
+ 'Middleware stack: devtools(persist(...))',
8
+ 'partialize for selective persistence',
9
+ 'Computed getter (getResolvedTheme)',
10
+ 'reset() action for initial state',
11
+ 'Multi-tab sync function export',
12
+ ],
13
+ },
14
+ 'store-persistence': {
15
+ file: 'src/stores/preferencesStore.ts',
16
+ description: 'Zustand persist middleware',
17
+ keyPoints: [
18
+ 'persist() middleware with name key',
19
+ 'partialize to select what to persist',
20
+ 'Storage key naming convention',
21
+ ],
22
+ },
23
+ 'multi-tab-sync': {
24
+ file: 'src/stores/preferencesStore.ts',
25
+ description: 'Multi-tab state synchronization',
26
+ keyPoints: ['Storage event listener', 'Rehydrate on storage change', 'Cleanup function for HMR'],
27
+ },
28
+ 'storage-utility': {
29
+ file: 'src/lib/storage.ts',
30
+ description: 'Type-safe localStorage utilities',
31
+ keyPoints: [
32
+ 'SSR-safe (typeof window check)',
33
+ 'JSON serialization',
34
+ 'Generic type parameter',
35
+ 'Error handling with fallback',
36
+ 'clearAppStorage for all prefixed keys',
37
+ ],
38
+ },
39
+ };
40
+ //# sourceMappingURL=store-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-patterns.js","sourceRoot":"","sources":["../../../src/utils/examples/store-patterns.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,eAAe,EAAE;QACf,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,6CAA6C;QAC1D,SAAS,EAAE;YACT,yCAAyC;YACzC,0CAA0C;YAC1C,sCAAsC;YACtC,oCAAoC;YACpC,kCAAkC;YAClC,gCAAgC;SACjC;KACF;IACD,mBAAmB,EAAE;QACnB,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE;YACT,oCAAoC;YACpC,sCAAsC;YACtC,+BAA+B;SAChC;KACF;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,iCAAiC;QAC9C,SAAS,EAAE,CAAC,wBAAwB,EAAE,6BAA6B,EAAE,0BAA0B,CAAC;KACjG;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE;YACT,gCAAgC;YAChC,oBAAoB;YACpB,wBAAwB;YACxB,8BAA8B;YAC9B,uCAAuC;SACxC;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PatternMap } from './types.js';
2
+ export declare const testPatterns: PatternMap;
3
+ //# sourceMappingURL=test-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-patterns.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/test-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,YAAY,EAAE,UAwD1B,CAAC"}
@@ -0,0 +1,58 @@
1
+ export const testPatterns = {
2
+ 'test-component': {
3
+ file: 'src/components/layout/Header.test.tsx',
4
+ description: 'Component test with Testing Library',
5
+ keyPoints: [
6
+ 'Import from vitest (describe, it, expect)',
7
+ 'Custom render from @/test',
8
+ 'screen queries (getByRole, getByText)',
9
+ 'Semantic role assertions',
10
+ 'Co-located with component source file',
11
+ ],
12
+ },
13
+ 'test-hook': {
14
+ file: 'src/hooks/useMediaQuery.test.ts',
15
+ description: 'Hook test with renderHook',
16
+ keyPoints: [
17
+ 'renderHook from Testing Library',
18
+ 'mockMatchMedia utility',
19
+ 'beforeEach for setup',
20
+ 'it.each for parameterized tests',
21
+ 'act() for state updates',
22
+ 'Co-located with hook source file',
23
+ ],
24
+ },
25
+ 'test-store': {
26
+ file: 'src/stores/preferencesStore.test.ts',
27
+ description: 'Zustand store test',
28
+ keyPoints: [
29
+ 'Direct store access: useStore.getState()',
30
+ 'act() wrapper for state changes',
31
+ 'Reset state in beforeEach',
32
+ 'Test actions and computed values',
33
+ 'Co-located with store source file',
34
+ ],
35
+ },
36
+ 'test-utility': {
37
+ file: 'src/lib/utils.test.ts',
38
+ description: 'Utility function test',
39
+ keyPoints: ['Simple describe/it/expect pattern', 'Test edge cases', 'No mocking needed'],
40
+ },
41
+ 'msw-handler': {
42
+ file: 'src/mocks/handlers/todos.ts',
43
+ description: 'MSW request handler',
44
+ keyPoints: [
45
+ 'http.get/post from msw',
46
+ 'HttpResponse.json() for responses',
47
+ 'URL parameter extraction',
48
+ 'delay() for realistic timing',
49
+ 'Error responses with status codes',
50
+ ],
51
+ },
52
+ 'test-fixture': {
53
+ file: 'src/mocks/fixtures/todos.ts',
54
+ description: 'Test data fixtures',
55
+ keyPoints: ['Typed mock data', 'Realistic test values', 'Reusable across tests'],
56
+ },
57
+ };
58
+ //# sourceMappingURL=test-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-patterns.js","sourceRoot":"","sources":["../../../src/utils/examples/test-patterns.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,gBAAgB,EAAE;QAChB,IAAI,EAAE,uCAAuC;QAC7C,WAAW,EAAE,qCAAqC;QAClD,SAAS,EAAE;YACT,2CAA2C;YAC3C,2BAA2B;YAC3B,uCAAuC;YACvC,0BAA0B;YAC1B,uCAAuC;SACxC;KACF;IACD,WAAW,EAAE;QACX,IAAI,EAAE,iCAAiC;QACvC,WAAW,EAAE,2BAA2B;QACxC,SAAS,EAAE;YACT,iCAAiC;YACjC,wBAAwB;YACxB,sBAAsB;YACtB,iCAAiC;YACjC,yBAAyB;YACzB,kCAAkC;SACnC;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qCAAqC;QAC3C,WAAW,EAAE,oBAAoB;QACjC,SAAS,EAAE;YACT,0CAA0C;YAC1C,iCAAiC;YACjC,2BAA2B;YAC3B,kCAAkC;YAClC,mCAAmC;SACpC;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,uBAAuB;QACpC,SAAS,EAAE,CAAC,mCAAmC,EAAE,iBAAiB,EAAE,mBAAmB,CAAC;KACzF;IACD,aAAa,EAAE;QACb,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,qBAAqB;QAClC,SAAS,EAAE;YACT,wBAAwB;YACxB,mCAAmC;YACnC,0BAA0B;YAC1B,8BAA8B;YAC9B,mCAAmC;SACpC;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,oBAAoB;QACjC,SAAS,EAAE,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;KACjF;CACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Code example returned by get_example tool. */
2
+ export interface CodeExample {
3
+ pattern: string;
4
+ description: string;
5
+ filePath: string;
6
+ code: string;
7
+ keyPoints: string[];
8
+ }
9
+ /** Pattern definition mapping. */
10
+ export interface PatternDef {
11
+ file: string;
12
+ description: string;
13
+ keyPoints: string[];
14
+ }
15
+ /** Pattern map type. */
16
+ export type PatternMap = Record<string, PatternDef>;
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/types.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAwB;AACxB,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/examples/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { PatternMap } from './types.js';
2
+ export declare const utilityPatterns: PatternMap;
3
+ //# sourceMappingURL=utility-patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility-patterns.d.ts","sourceRoot":"","sources":["../../../src/utils/examples/utility-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,UA2E7B,CAAC"}
@@ -0,0 +1,77 @@
1
+ export const utilityPatterns = {
2
+ 'zod-schema': {
3
+ file: 'src/lib/validations.ts',
4
+ description: 'Zod validation schemas with type inference',
5
+ keyPoints: [
6
+ 'z.object() for form schemas',
7
+ 'Chained validations (min, max, email, regex)',
8
+ 'Custom error messages',
9
+ 'Type inference with z.infer<>',
10
+ 'refine() for cross-field validation (password confirmation)',
11
+ ],
12
+ },
13
+ 'form-error-component': {
14
+ file: 'src/components/ui/form-error.tsx',
15
+ description: 'Form error display components',
16
+ keyPoints: [
17
+ 'FieldErrorMessage for single field',
18
+ 'FormErrorSummary for all errors',
19
+ 'RootFormError for form-level errors',
20
+ 'Integrates with react-hook-form types',
21
+ ],
22
+ },
23
+ 'register-form': {
24
+ file: 'src/components/shared/RegisterForm/RegisterForm.tsx',
25
+ description: 'Complete form component with validation',
26
+ keyPoints: [
27
+ 'Uses useRegisterForm custom hook',
28
+ 'Inline error display with FieldErrorMessage',
29
+ 'form.register() for input binding',
30
+ 'Disabled submit during isSubmitting',
31
+ 'Lingui Trans for i18n labels',
32
+ 'Demonstrates cross-field validation UX',
33
+ ],
34
+ },
35
+ 'theme-toggle': {
36
+ file: 'src/components/shared/ThemeToggle/ThemeToggle.tsx',
37
+ description: 'Theme toggle with system preference',
38
+ keyPoints: [
39
+ 'Three modes: light, dark, system',
40
+ 'Zustand store for persistence',
41
+ 'getResolvedTheme() for actual value',
42
+ 'Icon changes based on resolved theme',
43
+ ],
44
+ },
45
+ 'main-entry': {
46
+ file: 'src/main.tsx',
47
+ description: 'Application entry point with Sentry initialization',
48
+ keyPoints: [
49
+ 'Lazy Sentry initialization with requestIdleCallback for web vitals',
50
+ 'Global error handlers (window.onerror, onunhandledrejection)',
51
+ 'i18n initialization before render',
52
+ 'Provider hierarchy: Query → I18n → Router → Mobile → ErrorBoundary',
53
+ 'Multi-tab preferences sync with HMR cleanup',
54
+ ],
55
+ },
56
+ 'lib-config': {
57
+ file: 'src/lib/config.ts',
58
+ description: 'Centralized application configuration',
59
+ keyPoints: [
60
+ 'APP_CONFIG for app name and URL',
61
+ 'SENTRY_CONFIG with enabled flag, DSN, and tracesSampleRate',
62
+ 'Environment variables with fallback defaults',
63
+ 'as const for type inference',
64
+ ],
65
+ },
66
+ 'profiler-wrapper': {
67
+ file: 'src/contexts/performanceContext.tsx',
68
+ description: 'React Profiler wrapper component',
69
+ keyPoints: ['Wraps children with React.Profiler', 'Captures render timing', 'Only active in development'],
70
+ },
71
+ 'performance-e2e': {
72
+ file: 'e2e/performance/setup.ts',
73
+ description: 'Performance E2E test setup',
74
+ keyPoints: ['Lighthouse integration', 'Chrome launcher setup', 'Web Vitals assertions'],
75
+ },
76
+ };
77
+ //# sourceMappingURL=utility-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utility-patterns.js","sourceRoot":"","sources":["../../../src/utils/examples/utility-patterns.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAe;IACzC,YAAY,EAAE;QACZ,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,4CAA4C;QACzD,SAAS,EAAE;YACT,6BAA6B;YAC7B,8CAA8C;YAC9C,uBAAuB;YACvB,+BAA+B;YAC/B,6DAA6D;SAC9D;KACF;IACD,sBAAsB,EAAE;QACtB,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,+BAA+B;QAC5C,SAAS,EAAE;YACT,oCAAoC;YACpC,iCAAiC;YACjC,qCAAqC;YACrC,uCAAuC;SACxC;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qDAAqD;QAC3D,WAAW,EAAE,yCAAyC;QACtD,SAAS,EAAE;YACT,kCAAkC;YAClC,6CAA6C;YAC7C,mCAAmC;YACnC,qCAAqC;YACrC,8BAA8B;YAC9B,wCAAwC;SACzC;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,mDAAmD;QACzD,WAAW,EAAE,qCAAqC;QAClD,SAAS,EAAE;YACT,kCAAkC;YAClC,+BAA+B;YAC/B,qCAAqC;YACrC,sCAAsC;SACvC;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,oDAAoD;QACjE,SAAS,EAAE;YACT,oEAAoE;YACpE,8DAA8D;YAC9D,mCAAmC;YACnC,oEAAoE;YACpE,6CAA6C;SAC9C;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,uCAAuC;QACpD,SAAS,EAAE;YACT,iCAAiC;YACjC,4DAA4D;YAC5D,8CAA8C;YAC9C,6BAA6B;SAC9B;KACF;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,qCAAqC;QAC3C,WAAW,EAAE,kCAAkC;QAC/C,SAAS,EAAE,CAAC,oCAAoC,EAAE,wBAAwB,EAAE,4BAA4B,CAAC;KAC1G;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,CAAC,wBAAwB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;KACxF;CACF,CAAC"}
@@ -1,5 +1,7 @@
1
- export { isNpxMode, TEMPLATES_ROOT, resolveTemplatePath } from './paths.js';
2
- export { resolveFeatureDependencies, mergeDependencies, mergeScripts, computeFileStructure, getConfigFiles, getSetupCommands, computeScaffold, } from './scaffold.js';
3
- export { getAvailablePatterns, getCodeExample, getFeatureExamples, type CodeExample } from './examples.js';
1
+ export { isPublishedMode, CONTENT_ROOT, resolveTemplatePath } from './paths.js';
2
+ export { createCache, createSingletonCache } from './cache.js';
3
+ export { readWithFallback, getErrorMessage } from './errors.js';
4
+ export { resolveFeatureDependencies, mergeDependencies, mergeScripts, computeFileStructure, getConfigFiles, getSetupCommands, computeScaffold, } from './scaffold/index.js';
5
+ export { getAvailablePatterns, getCodeExample, getFeatureExamples, type CodeExample } from './examples/index.js';
4
6
  export { computeDocsForFeatures, computeDocsContent } from './docs.js';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,5 +1,7 @@
1
- export { isNpxMode, TEMPLATES_ROOT, resolveTemplatePath } from './paths.js';
2
- export { resolveFeatureDependencies, mergeDependencies, mergeScripts, computeFileStructure, getConfigFiles, getSetupCommands, computeScaffold, } from './scaffold.js';
3
- export { getAvailablePatterns, getCodeExample, getFeatureExamples } from './examples.js';
1
+ export { isPublishedMode, CONTENT_ROOT, resolveTemplatePath } from './paths.js';
2
+ export { createCache, createSingletonCache } from './cache.js';
3
+ export { readWithFallback, getErrorMessage } from './errors.js';
4
+ export { resolveFeatureDependencies, mergeDependencies, mergeScripts, computeFileStructure, getConfigFiles, getSetupCommands, computeScaffold, } from './scaffold/index.js';
5
+ export { getAvailablePatterns, getCodeExample, getFeatureExamples } from './examples/index.js';
4
6
  export { computeDocsForFeatures, computeDocsContent } from './docs.js';
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAoB,MAAM,eAAe,CAAC;AAE3G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAoB,MAAM,qBAAqB,CAAC;AAEjH,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,29 +1,10 @@
1
1
  /**
2
- * Centralized path resolution for MCP server
3
- *
4
- * Handles detection of development vs published (npx) mode.
5
- * Uses a marker file (.bundled) to reliably detect npx mode,
6
- * avoiding issues where running `npm run bundle` during development
7
- * would cause the server to read from stale bundled files.
8
- */
9
- /**
10
- * Check if running in npx/published mode
11
- *
12
- * We check for a .bundled marker file instead of just checking if
13
- * templates/ exists. This prevents issues where a developer runs
14
- * `npm run bundle` during development and then gets stale files.
15
- */
16
- export declare const isNpxMode: boolean;
17
- /**
18
- * Root directory for reading template files
19
- *
20
- * - In development: reads from monorepo root (live files)
21
- * - In npx mode: reads from bundled templates directory
22
- */
23
- export declare const TEMPLATES_ROOT: string;
24
- /**
25
- * Resolve a path relative to templates root.
26
- * In npx mode, handles renamed dotfiles (npm strips .gitignore during publish).
2
+ * Path resolution for MCP server - handles dev vs published mode.
27
3
  */
4
+ /** True when running as published npm package (npx mode). */
5
+ export declare const isPublishedMode: boolean;
6
+ /** Root directory for reading content files. */
7
+ export declare const CONTENT_ROOT: string;
8
+ /** Resolves path relative to content root, handling dotfile renames in published mode. */
28
9
  export declare function resolveTemplatePath(relativePath: string): string;
29
10
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,SAA4B,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAgD,CAAC;AAU5E;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAShE"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,6DAA6D;AAC7D,eAAO,MAAM,eAAe,SAA4B,CAAC;AAEzD,gDAAgD;AAChD,eAAO,MAAM,YAAY,QAAiD,CAAC;AAO3E,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAKhE"}
@@ -1,53 +1,24 @@
1
1
  /**
2
- * Centralized path resolution for MCP server
3
- *
4
- * Handles detection of development vs published (npx) mode.
5
- * Uses a marker file (.bundled) to reliably detect npx mode,
6
- * avoiding issues where running `npm run bundle` during development
7
- * would cause the server to read from stale bundled files.
2
+ * Path resolution for MCP server - handles dev vs published mode.
8
3
  */
9
4
  import { existsSync } from 'fs';
10
5
  import { dirname, join } from 'path';
11
6
  import { fileURLToPath } from 'url';
12
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
13
- // Path to bundled templates (for npx distribution)
14
- const BUNDLED_TEMPLATES = join(__dirname, '..', '..', 'templates');
15
- // Marker file created by bundle script to indicate npx mode
16
- const BUNDLE_MARKER = join(BUNDLED_TEMPLATES, '.bundled');
17
- // Monorepo root (react-spa-scaffold app lives at root alongside packages/)
8
+ const BUNDLED_PATH = join(__dirname, '..', '..', 'templates');
9
+ const BUNDLE_MARKER = join(BUNDLED_PATH, '.bundled');
18
10
  const MONOREPO_ROOT = join(__dirname, '..', '..', '..', '..');
19
- /**
20
- * Check if running in npx/published mode
21
- *
22
- * We check for a .bundled marker file instead of just checking if
23
- * templates/ exists. This prevents issues where a developer runs
24
- * `npm run bundle` during development and then gets stale files.
25
- */
26
- export const isNpxMode = existsSync(BUNDLE_MARKER);
27
- /**
28
- * Root directory for reading template files
29
- *
30
- * - In development: reads from monorepo root (live files)
31
- * - In npx mode: reads from bundled templates directory
32
- */
33
- export const TEMPLATES_ROOT = isNpxMode ? BUNDLED_TEMPLATES : MONOREPO_ROOT;
34
- /**
35
- * Dotfiles that npm strips during publish, renamed in bundled templates.
36
- * Maps from original name → bundled name
37
- */
11
+ /** True when running as published npm package (npx mode). */
12
+ export const isPublishedMode = existsSync(BUNDLE_MARKER);
13
+ /** Root directory for reading content files. */
14
+ export const CONTENT_ROOT = isPublishedMode ? BUNDLED_PATH : MONOREPO_ROOT;
15
+ /** Dotfiles renamed in bundled templates (npm strips .gitignore). */
38
16
  const RENAMED_DOTFILES = {
39
17
  '.gitignore': 'gitignore',
40
18
  };
41
- /**
42
- * Resolve a path relative to templates root.
43
- * In npx mode, handles renamed dotfiles (npm strips .gitignore during publish).
44
- */
19
+ /** Resolves path relative to content root, handling dotfile renames in published mode. */
45
20
  export function resolveTemplatePath(relativePath) {
46
- let resolvedPath = relativePath;
47
- // In npx mode, use renamed versions of dotfiles that npm would strip
48
- if (isNpxMode && RENAMED_DOTFILES[relativePath]) {
49
- resolvedPath = RENAMED_DOTFILES[relativePath];
50
- }
51
- return join(TEMPLATES_ROOT, resolvedPath);
21
+ const resolvedPath = isPublishedMode && RENAMED_DOTFILES[relativePath] ? RENAMED_DOTFILES[relativePath] : relativePath;
22
+ return join(CONTENT_ROOT, resolvedPath);
52
23
  }
53
24
  //# sourceMappingURL=paths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAEnE,4DAA4D;AAC5D,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAE1D,2EAA2E;AAC3E,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC;AAE5E;;;GAGG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,YAAY,EAAE,WAAW;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAoB;IACtD,IAAI,YAAY,GAAG,YAAY,CAAC;IAEhC,qEAAqE;IACrE,IAAI,SAAS,IAAI,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC;QAChD,YAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAC9D,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE9D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;AAEzD,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC;AAE3E,qEAAqE;AACrE,MAAM,gBAAgB,GAA2B;IAC/C,YAAY,EAAE,WAAW;CAC1B,CAAC;AAEF,0FAA0F;AAC1F,MAAM,UAAU,mBAAmB,CAAC,YAAoB;IACtD,MAAM,YAAY,GAChB,eAAe,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IAEpG,OAAO,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=paths.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.test.d.ts","sourceRoot":"","sources":["../../src/utils/paths.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { isPublishedMode, CONTENT_ROOT, resolveTemplatePath } from './paths.js';
3
+ describe('paths', () => {
4
+ it('isPublishedMode is boolean', () => {
5
+ expect(typeof isPublishedMode).toBe('boolean');
6
+ });
7
+ it('CONTENT_ROOT is non-empty string', () => {
8
+ expect(typeof CONTENT_ROOT).toBe('string');
9
+ expect(CONTENT_ROOT.length).toBeGreaterThan(0);
10
+ });
11
+ it('resolveTemplatePath returns full path', () => {
12
+ const result = resolveTemplatePath('package.json');
13
+ expect(result).toContain('package.json');
14
+ expect(result).toContain(CONTENT_ROOT);
15
+ });
16
+ });
17
+ //# sourceMappingURL=paths.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.test.js","sourceRoot":"","sources":["../../src/utils/paths.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEhF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,MAAM,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Setup commands utility
3
+ *
4
+ * Generates the npm commands needed to set up a scaffolded project.
5
+ */
6
+ import type { FeatureId } from '../../features/types.js';
7
+ /**
8
+ * Generate setup commands based on selected features
9
+ */
10
+ export declare function getSetupCommands(featureIds: FeatureId[]): string[];
11
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/utils/scaffold/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAgBlE"}