MCPcopy Create free account
hub / github.com/NiladriHazra/WhatToBuild / getFileSummary

Function getFileSummary

components/RepositoryKeyFiles.tsx:260–326  ·  view source on GitHub ↗
(fileName: string, reason: string, filePath: string = '')

Source from the content-addressed store, hash-verified

258
259 // Helper: 1-2 line summary for file type with more detailed descriptions
260 function getFileSummary(fileName: string, reason: string, filePath: string = '') {
261 // Framework-specific summaries
262 if (/layout\.tsx$/.test(fileName)) return 'Next.js layout component that wraps pages with common UI elements.';
263 if (/page\.tsx$/.test(fileName)) return 'Next.js page component that defines a route in the application.';
264 if (/route\.ts$/.test(fileName)) return 'Next.js API route handler for server-side API endpoints.';
265 if (/App\.tsx$|App\.jsx$/.test(fileName)) return 'Root React component that initializes the application.';
266 if (/store\.ts$|store\.js$/.test(fileName)) return 'State management store configuration (Redux/Zustand/etc).';
267 if (/context\.tsx$|context\.jsx$/.test(fileName)) return 'React context provider for state management.';
268
269 // Common file types
270 if (/readme\.md/i.test(fileName)) return 'Project overview, setup instructions and documentation.';
271 if (/package\.json/.test(fileName)) return 'Defines project dependencies, scripts, and metadata.';
272 if (/tsconfig\.json/.test(fileName)) return 'TypeScript compiler configuration and type checking options.';
273 if (/dockerfile/i.test(fileName)) return 'Docker container build instructions and environment setup.';
274 if (/\.env/.test(fileName)) return 'Environment variable definitions for configuration.';
275 if (/next\.config/.test(fileName)) return 'Next.js framework configuration for routing, plugins, and build options.';
276 if (/vite\.config/.test(fileName)) return 'Vite build tool configuration for development and production.';
277 if (/tailwind\.config/.test(fileName)) return 'Tailwind CSS configuration for styling and theme customization.';
278 if (/jest\.config/.test(fileName)) return 'Jest testing framework configuration for unit and integration tests.';
279
280 // Entry points
281 if (/main\./i.test(fileName)) return 'Main application entry point that bootstraps the app.';
282 if (/index\./i.test(fileName)) {
283 if (filePath.includes('/api/')) return 'API route entry point for handling requests.';
284 if (filePath.includes('/components/')) return 'Component entry point for exporting UI elements.';
285 if (filePath.includes('/pages/')) return 'Page component that defines a route in the application.';
286 if (filePath.includes('/hooks/')) return 'Custom React hooks entry point for shared logic.';
287 if (filePath.includes('/utils/') || filePath.includes('/lib/')) return 'Utility functions entry point for shared helpers.';
288 return 'Module or application entry point.';
289 }
290
291 if (/server\./i.test(fileName)) return 'Server initialization and configuration.';
292 if (/webpack\.config/i.test(fileName)) return 'Webpack bundler configuration for build process.';
293 if (/docker-compose/i.test(fileName)) return 'Multi-container Docker services configuration.';
294 if (/app\./i.test(fileName)) return 'Main application logic and initialization.';
295
296 // File extensions
297 if (/\.jsx$|\.tsx$/.test(fileName)) return 'React component with JSX syntax.';
298 if (/\.js$|\.ts$/.test(fileName)) {
299 if (filePath.includes('/api/')) return 'API endpoint or service function.';
300 if (filePath.includes('/utils/') || filePath.includes('/lib/')) return 'Utility functions or helper library.';
301 if (filePath.includes('/hooks/')) return 'Custom React hook for shared stateful logic.';
302 if (filePath.includes('/context/')) return 'Context provider for state management.';
303 if (filePath.includes('/services/')) return 'Service layer for external API communication.';
304 return 'JavaScript/TypeScript source code.';
305 }
306
307 if (/\.json$/.test(fileName)) return 'JSON configuration or data file.';
308 if (/\.md$/.test(fileName)) return 'Markdown documentation file.';
309 if (/\.css$|\.scss$|\.sass$|\.less$/.test(fileName)) return 'Stylesheet for component or application styling.';
310 if (/\.svg$|\.png$|\.jpg$|\.jpeg$/.test(fileName)) return 'Image asset used in the UI.';
311 if (/\.graphql$|\.gql$/.test(fileName)) return 'GraphQL schema or query definitions.';
312 if (/\.prisma$/.test(fileName)) return 'Prisma ORM schema defining database models.';
313
314 // Reason-based fallbacks
315 if (reason === 'Large file') {
316 if (/\.json$/.test(fileName)) return 'Large data file containing application data or configuration.';
317 if (/\.min\.js$/.test(fileName)) return 'Minified JavaScript library or bundle.';

Callers 1

fetchKeyFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected