Skip to content

Commit 2a4cbe6

Browse files
Use scanned file extensions as fallback for project type detection
If config-file detection returns Unknown, count file extensions from the directory scan (depth 3) and use the dominant extension to determine type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24e9008 commit 2a4cbe6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeep",
3-
"version": "1.2.128",
3+
"version": "1.2.129",
44
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
55
"type": "module",
66
"main": "dist/index.js",

src/utils/project.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,24 @@ export function getProjectContext(dir: string = process.cwd()): ProjectContext |
449449
try {
450450
const files = scanDirectory(dir, 3);
451451
const isProject = isProjectDirectory(dir);
452-
const projectType = isProject ? getProjectType(dir) : 'generic';
452+
let projectType = isProject ? getProjectType(dir) : 'generic';
453+
// If still Unknown, use scanned file extensions to detect type
454+
if (projectType === 'Unknown') {
455+
const extCounts: Record<string, number> = {};
456+
files.filter(f => !f.isDirectory).forEach(f => {
457+
const ext = f.path.split('.').pop()?.toLowerCase() || '';
458+
if (ext) extCounts[ext] = (extCounts[ext] || 0) + 1;
459+
});
460+
const dominant = Object.entries(extCounts).sort((a, b) => b[1] - a[1])[0];
461+
if (dominant) {
462+
const extTypeMap: Record<string, string> = {
463+
php: 'PHP', py: 'Python', rb: 'Ruby', java: 'Java',
464+
kt: 'Kotlin', swift: 'Swift', cs: 'C#', cpp: 'C++',
465+
c: 'C/C++', ex: 'Elixir', exs: 'Elixir', dart: 'Dart/Flutter',
466+
};
467+
projectType = extTypeMap[dominant[0]] || 'Unknown';
468+
}
469+
}
453470
const structure = generateTreeStructure(files, 25);
454471

455472
// Find key files that exist

0 commit comments

Comments
 (0)