| 323 | // -- File categorization ------------------------------------------------------ |
| 324 | |
| 325 | function categorizeFiles(files) { |
| 326 | const categories = { |
| 327 | Source: [], |
| 328 | Tests: [], |
| 329 | Docs: [], |
| 330 | Config: [], |
| 331 | Skills: [], |
| 332 | Hooks: [], |
| 333 | Scripts: [], |
| 334 | Other: [], |
| 335 | }; |
| 336 | |
| 337 | for (const f of files) { |
| 338 | const lower = f.toLowerCase(); |
| 339 | if (/\.(test|spec)\.\w+$/.test(lower) || lower.includes('__test')) { |
| 340 | categories.Tests.push(f); |
| 341 | } else if (lower.startsWith('skills/') || lower.includes('/skills/')) { |
| 342 | categories.Skills.push(f); |
| 343 | } else if (lower.startsWith('hooks_src/') || lower.includes('/hooks/')) { |
| 344 | categories.Hooks.push(f); |
| 345 | } else if (lower.startsWith('scripts/') || lower.includes('/scripts/')) { |
| 346 | categories.Scripts.push(f); |
| 347 | } else if (/\.(md|txt|rst)$/.test(lower) || lower.includes('readme') || lower.includes('docs/')) { |
| 348 | categories.Docs.push(f); |
| 349 | } else if (/\.(json|ya?ml|toml|ini|env|config)$/.test(lower) || lower.includes('config')) { |
| 350 | categories.Config.push(f); |
| 351 | } else if (/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs)$/.test(lower)) { |
| 352 | categories.Source.push(f); |
| 353 | } else { |
| 354 | categories.Other.push(f); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | return categories; |
| 359 | } |
| 360 | |
| 361 | // -- Intake item generation --------------------------------------------------- |
| 362 | |