| 59 | } |
| 60 | |
| 61 | function categorizeFile(rel: string): string { |
| 62 | const l = rel.toLowerCase(); |
| 63 | if (/\.(test|spec)\.|__tests__|\/tests?\//.test(l)) return 'tests'; |
| 64 | if (/^(src\/)?(index|main|app|server|cli|bin)\b/.test(l)) return 'entry'; |
| 65 | if (/\/(routes?|api|controllers?|handlers?|endpoints?)\//.test(l)) return 'routes/controllers'; |
| 66 | if (/\/(services?|business|domain|logic)\//.test(l)) return 'services'; |
| 67 | if (/\/(models?|entities|schema|db)\//.test(l)) return 'data/models'; |
| 68 | if (/\/(components?|widgets?|ui|views?|screens?|pages?)\//.test(l)) return 'ui'; |
| 69 | if (/\/(hooks?|composables?)\//.test(l)) return 'hooks'; |
| 70 | if (/\/(utils?|helpers?|common|shared|lib)\//.test(l)) return 'utils'; |
| 71 | if (/\/(config|configs|settings)\//.test(l) || /\.config\.[jt]sx?$/.test(l)) return 'config'; |
| 72 | if (/\/(types?|interfaces?|dto)\//.test(l) || /\.d\.ts$/.test(l)) return 'types'; |
| 73 | if (/\/(migrations?|seeds?)\//.test(l)) return 'migrations'; |
| 74 | if (/\/(middleware|guards?)\//.test(l)) return 'middleware'; |
| 75 | return 'other'; |
| 76 | } |
| 77 | |
| 78 | // ───────────────────────────────────────────────────────────────────────────── |
| 79 | // explain_codebase |