Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52ba1da

Browse files
committed
cleaned up and organized codebase
1 parentf509ce9 commit52ba1da

File tree

7 files changed

+145
-149
lines changed

7 files changed

+145
-149
lines changed

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"claude",
3434
"copilot"
3535
],
36-
"author":"Janardhan Pollle <www.janardhanpolle@gmail.com>",
36+
"author":"Janardhan Pollle",
3737
"license":"MIT",
3838
"repository": {
3939
"type":"git",

‎src/prompts/helpers.ts‎

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/**
2+
* Helper function to get page type specific instructions
3+
*/
4+
exportfunctiongetPageTypeSpecificInstructions(pageType:string):string{
5+
constinstructions={
6+
dashboard:`
7+
- Use dashboard blocks as foundation (dashboard-01)
8+
- Include metrics cards, charts, and data tables
9+
- Implement sidebar navigation with proper menu structure
10+
- Add header with user profile and notifications
11+
- Create responsive grid layout for widgets`,
12+
13+
login:`
14+
- Use login blocks as reference (login-01 through login-05)
15+
- Implement form validation with clear error messages
16+
- Add social authentication options if specified
17+
- Include forgot password and sign-up links
18+
- Ensure mobile-responsive design`,
19+
20+
calendar:`
21+
- Use calendar blocks (calendar-01 through calendar-32)
22+
- Implement different calendar views (month, week, day)
23+
- Add event creation and management
24+
- Include date navigation and filtering
25+
- Support event categories and colors`,
26+
27+
sidebar:`
28+
- Use sidebar blocks as foundation (sidebar-01 through sidebar-16)
29+
- Implement collapsible navigation
30+
- Add proper menu hierarchy
31+
- Include search functionality
32+
- Support both light and dark themes`,
33+
34+
products:`
35+
- Use products blocks as reference (products-01)
36+
- Create product grid/list views
37+
- Implement filtering and sorting
38+
- Add product details modal or page
39+
- Include shopping cart functionality if needed`,
40+
41+
custom:`
42+
- Analyze requirements and choose appropriate blocks
43+
- Combine multiple block patterns as needed
44+
- Focus on component reusability
45+
- Ensure consistent design patterns`,
46+
}
47+
48+
return(
49+
instructions[pageTypeaskeyoftypeofinstructions]||instructions.custom
50+
)
51+
}
52+
53+
/**
54+
* Helper function to get optimization specific instructions
55+
*/
56+
exportfunctiongetOptimizationInstructions(
57+
optimization:string,
58+
framework:string
59+
):string{
60+
constgetPerformanceInstructions=(framework:string)=>{
61+
switch(framework){
62+
case"svelte":
63+
return`
64+
- Use Svelte's built-in reactivity with runes for fine-grained updates
65+
- Minimize the use of reactive statements that cause unnecessary updates
66+
- Use derived state with $derived for computed values
67+
- Consider using $effect only when necessary for side effects
68+
- Implement lazy loading for heavy components
69+
- Use $state.raw for non-reactive data to avoid unnecessary reactivity overhead
70+
- Leverage Svelte's compile-time optimizations`
71+
72+
case"vue":
73+
return`
74+
- Use Vue 3's Composition API with reactive refs and computed properties
75+
- Use defineAsyncComponent for code splitting and lazy loading
76+
- Minimize watchers and use computed properties when possible
77+
- Leverage Vue's built-in reactivity system efficiently
78+
- Use shallowRef and shallowReactive for performance-critical scenarios
79+
- Implement virtual scrolling for large lists using Vue Virtual Scroller`
80+
81+
case"react":
82+
default:
83+
return`
84+
- Implement React.memo for preventing unnecessary re-renders
85+
- Use useMemo and useCallback hooks appropriately
86+
- Optimize bundle size by code splitting with React.lazy
87+
- Implement virtual scrolling for large lists
88+
- Minimize DOM manipulations and use refs efficiently
89+
- Use lazy loading for heavy components
90+
- Consider using React.startTransition for non-urgent updates`
91+
}
92+
}
93+
94+
constinstructions={
95+
performance:getPerformanceInstructions(framework),
96+
97+
accessibility:`
98+
- Add proper ARIA labels and roles
99+
- Ensure keyboard navigation support
100+
- Implement focus management
101+
- Add screen reader compatibility
102+
- Ensure color contrast compliance
103+
- Support high contrast mode
104+
- Use semantic HTML elements`,
105+
106+
responsive:`
107+
- Implement mobile-first design approach
108+
- Use CSS Grid and Flexbox effectively
109+
- Add proper breakpoints for all screen sizes
110+
- Optimize touch interactions for mobile
111+
- Ensure readable text sizes on all devices
112+
- Implement responsive navigation patterns
113+
- Use container queries where appropriate`,
114+
115+
animations:`
116+
- Add smooth transitions between states
117+
- Implement loading animations and skeletons
118+
- Use CSS transforms for better performance
119+
- Add hover and focus animations
120+
- Implement page transition animations
121+
- Ensure animations respect reduced motion preferences
122+
- Use hardware acceleration with transform3d when needed`,
123+
}
124+
125+
return(
126+
instructions[optimizationaskeyoftypeofinstructions]||
127+
`Focus on general code quality improvements and${framework}-specific best practices implementation.`
128+
)
129+
}

‎src/prompts.ts‎renamed to ‎src/prompts/index.ts‎

Lines changed: 5 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
/**
2-
* Prompts implementation for the Model Context Protocol (MCP) server.
3-
*
4-
* This file defines prompts that guide the AI model's responses.
5-
* Prompts help to direct the model on how to process user requests.
6-
*/
7-
8-
import{getFramework}from"./utils/framework.js"
1+
import{getFramework}from"../utils/framework.js"
2+
import{
3+
getOptimizationInstructions,
4+
getPageTypeSpecificInstructions,
5+
}from"./helpers.js"
96

107
/**
118
* List of prompts metadata available in this MCP server
@@ -499,133 +496,3 @@ Provide complete ${framework} data table implementation with proper TypeScript t
499496
}
500497
},
501498
}
502-
503-
/**
504-
* Helper function to get page type specific instructions
505-
*/
506-
functiongetPageTypeSpecificInstructions(pageType:string):string{
507-
constinstructions={
508-
dashboard:`
509-
- Use dashboard blocks as foundation (dashboard-01)
510-
- Include metrics cards, charts, and data tables
511-
- Implement sidebar navigation with proper menu structure
512-
- Add header with user profile and notifications
513-
- Create responsive grid layout for widgets`,
514-
515-
login:`
516-
- Use login blocks as reference (login-01 through login-05)
517-
- Implement form validation with clear error messages
518-
- Add social authentication options if specified
519-
- Include forgot password and sign-up links
520-
- Ensure mobile-responsive design`,
521-
522-
calendar:`
523-
- Use calendar blocks (calendar-01 through calendar-32)
524-
- Implement different calendar views (month, week, day)
525-
- Add event creation and management
526-
- Include date navigation and filtering
527-
- Support event categories and colors`,
528-
529-
sidebar:`
530-
- Use sidebar blocks as foundation (sidebar-01 through sidebar-16)
531-
- Implement collapsible navigation
532-
- Add proper menu hierarchy
533-
- Include search functionality
534-
- Support both light and dark themes`,
535-
536-
products:`
537-
- Use products blocks as reference (products-01)
538-
- Create product grid/list views
539-
- Implement filtering and sorting
540-
- Add product details modal or page
541-
- Include shopping cart functionality if needed`,
542-
543-
custom:`
544-
- Analyze requirements and choose appropriate blocks
545-
- Combine multiple block patterns as needed
546-
- Focus on component reusability
547-
- Ensure consistent design patterns`,
548-
}
549-
550-
return(
551-
instructions[pageTypeaskeyoftypeofinstructions]||instructions.custom
552-
)
553-
}
554-
555-
/**
556-
* Helper function to get optimization specific instructions
557-
*/
558-
functiongetOptimizationInstructions(
559-
optimization:string,
560-
framework:string
561-
):string{
562-
constgetPerformanceInstructions=(framework:string)=>{
563-
switch(framework){
564-
case"svelte":
565-
return`
566-
- Use Svelte's built-in reactivity with runes for fine-grained updates
567-
- Minimize the use of reactive statements that cause unnecessary updates
568-
- Use derived state with $derived for computed values
569-
- Consider using $effect only when necessary for side effects
570-
- Implement lazy loading for heavy components
571-
- Use $state.raw for non-reactive data to avoid unnecessary reactivity overhead
572-
- Leverage Svelte's compile-time optimizations`
573-
574-
case"vue":
575-
return`
576-
- Use Vue 3's Composition API with reactive refs and computed properties
577-
- Use defineAsyncComponent for code splitting and lazy loading
578-
- Minimize watchers and use computed properties when possible
579-
- Leverage Vue's built-in reactivity system efficiently
580-
- Use shallowRef and shallowReactive for performance-critical scenarios
581-
- Implement virtual scrolling for large lists using Vue Virtual Scroller`
582-
583-
case"react":
584-
default:
585-
return`
586-
- Implement React.memo for preventing unnecessary re-renders
587-
- Use useMemo and useCallback hooks appropriately
588-
- Optimize bundle size by code splitting with React.lazy
589-
- Implement virtual scrolling for large lists
590-
- Minimize DOM manipulations and use refs efficiently
591-
- Use lazy loading for heavy components
592-
- Consider using React.startTransition for non-urgent updates`
593-
}
594-
}
595-
596-
constinstructions={
597-
performance:getPerformanceInstructions(framework),
598-
599-
accessibility:`
600-
- Add proper ARIA labels and roles
601-
- Ensure keyboard navigation support
602-
- Implement focus management
603-
- Add screen reader compatibility
604-
- Ensure color contrast compliance
605-
- Support high contrast mode
606-
- Use semantic HTML elements`,
607-
608-
responsive:`
609-
- Implement mobile-first design approach
610-
- Use CSS Grid and Flexbox effectively
611-
- Add proper breakpoints for all screen sizes
612-
- Optimize touch interactions for mobile
613-
- Ensure readable text sizes on all devices
614-
- Implement responsive navigation patterns
615-
- Use container queries where appropriate`,
616-
617-
animations:`
618-
- Add smooth transitions between states
619-
- Implement loading animations and skeletons
620-
- Use CSS transforms for better performance
621-
- Add hover and focus animations
622-
- Implement page transition animations
623-
- Ensure animations respect reduced motion preferences
624-
- Use hardware acceleration with transform3d when needed`,
625-
}
626-
627-
return(
628-
instructions[optimizationaskeyoftypeofinstructions]||
629-
`Focus on general code quality improvements and${framework}-specific best practices implementation.`
630-
)
631-
}

‎src/resource-templates/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* resources based on parameters in the URI.
66
*/
77

8-
import{getFramework}from"./utils/framework.js"
8+
import{getFramework}from"../utils/framework.js"
99

1010
/**
1111
* Resource template definitions exported to the MCP handler

‎src/resources/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Resources are static content or dynamically generated content referenced by URIs.
66
*/
77

8-
import{logError}from'./utils/logger.js';
8+
import{logError}from'../utils/logger.js';
99

1010
/**
1111
* Resource definitions exported to the MCP handler

‎src/handler.ts‎renamed to ‎src/server/handler.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ import {
1818
McpError
1919
}from"@modelcontextprotocol/sdk/types.js";
2020
import{typeServer}from"@modelcontextprotocol/sdk/server/index.js";
21-
import{resourceHandlers,resources}from"./resources.js";
22-
import{promptHandlers,prompts}from"./prompts.js";
23-
import{toolHandlers,tools}from"./tools/index.js";
21+
import{resourceHandlers,resources}from"../resources/index.js";
22+
import{promptHandlers,prompts}from"../prompts/index.js";
23+
import{toolHandlers,tools}from"../tools/index.js";
2424
import{
2525
getResourceTemplate,
2626
resourceTemplates,
27-
}from"./resource-templates.js";
27+
}from"../resource-templates/index.js";
2828
import{z}from"zod";
29-
import{validateAndSanitizeParams}from'./utils/validation.js';
30-
import{circuitBreakers}from'./utils/circuit-breaker.js';
31-
import{logError,logInfo}from'./utils/logger.js';
29+
import{validateAndSanitizeParams}from'../utils/validation.js';
30+
import{circuitBreakers}from'../utils/circuit-breaker.js';
31+
import{logError,logInfo}from'../utils/logger.js';
3232

3333
// Define basic component schemas here for tool validation
3434
constcomponentSchema={componentName:z.string()};

‎src/server/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{StdioServerTransport}from"@modelcontextprotocol/sdk/server/stdio.js"
2-
import{setupHandlers}from"../handler.js"
2+
import{setupHandlers}from"./handler.js"
33
import{
44
validateFrameworkSelection,
55
getAxiosImplementation,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp