Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions __tests__/extraction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2974,6 +2974,38 @@ export function multiply(a: number, b: number): number {

cg.close();
});

it('should count file-level tracked YAML files as indexed', async () => {
fs.writeFileSync(path.join(tempDir, 'app.yaml'), 'name: test\n');
fs.writeFileSync(path.join(tempDir, 'routes.yml'), 'route: value\n');

const cg = CodeGraph.initSync(tempDir);
const result = await cg.indexAll();

expect(result.success).toBe(true);
expect(result.filesIndexed).toBe(2);
expect(result.filesSkipped).toBe(0);
expect(cg.getFiles().map((f) => f.path).sort()).toEqual(['app.yaml', 'routes.yml']);

cg.close();
});

it('should count file-level tracked YAML/Twig files as indexed in indexFiles()', async () => {
fs.writeFileSync(path.join(tempDir, 'app.yaml'), 'name: test\n');
fs.writeFileSync(path.join(tempDir, 'view.twig'), '{{ title }}\n');

const cg = CodeGraph.initSync(tempDir);
const result = await cg.indexFiles(['app.yaml', 'view.twig']);

expect(result.success).toBe(true);
expect(result.filesIndexed).toBe(2);
expect(result.filesSkipped).toBe(0);

const tracked = cg.getFiles().map((f) => `${f.path}:${f.language}`).sort();
expect(tracked).toEqual(['app.yaml:yaml', 'view.twig:twig']);

cg.close();
});
});

describe('Path Normalization', () => {
Expand Down
17 changes: 15 additions & 2 deletions src/extraction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,15 @@ export class ExtractionOrchestrator {
} else if (result.errors.some((e) => e.severity === 'error')) {
filesErrored++;
} else {
filesSkipped++;
// Files with no symbols but no errors (e.g. yaml, twig) are tracked
// at the file level — count them as indexed so the CLI doesn't
// misleadingly report "No files found to index".
const lang = detectLanguage(filePath, content);
if (lang === 'yaml' || lang === 'twig') {
filesIndexed++;
} else {
filesSkipped++;
}
}
}
}
Expand Down Expand Up @@ -1004,7 +1012,12 @@ export class ExtractionOrchestrator {
} else if (result.errors.some((e) => e.severity === 'error')) {
filesErrored++;
} else {
filesSkipped++;
const tracked = this.queries.getFileByPath(filePath);
if (tracked && (tracked.language === 'yaml' || tracked.language === 'twig')) {
filesIndexed++;
} else {
filesSkipped++;
}
}
}

Expand Down