Implemented comprehensive Editor documentation indexing using TypeScript Compiler API to parse React/Next.js TSX files from the Babylon.js Editor repository. Key changes: - Added Editor repository (4th repo) to repository-config.ts - Created tsx-parser.ts using TypeScript Compiler API (zero new dependencies) - Extended document-parser.ts to route .tsx files to TSX parser - Updated lancedb-indexer.ts to discover page.tsx files - Added editor-docs source to index-docs.ts script Features: - Parses TSX/JSX files to extract text content, headings, and code blocks - Filters out className values and non-content text - Extracts categories from file paths (editor/adding-scripts, etc.) - Handles Editor-specific documentation structure Test coverage: - Added tsx-parser.test.ts (11 tests, 10 passing) - Extended document-parser.test.ts with TSX coverage (5 new tests) - Fixed repository-manager.test.ts for 4 repositories - Total: 167 tests passing, 1 skipped Results: - 902 documents now indexed (745 docs + 144 source + 13 editor) - Editor documentation appears in search results - Verified with Editor-specific queries (onStart, decorators, etc.) Updated ROADMAP.md with completion status for Editor integration phases 1-3. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
#!/usr/bin/env npx tsx
|
|
|
|
import { LanceDBSearch } from '../src/search/lancedb-search.js';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
async function main() {
|
|
const projectRoot = path.join(__dirname, '..');
|
|
const dbPath = path.join(projectRoot, 'data', 'lancedb');
|
|
|
|
console.log('Testing Editor Documentation Search');
|
|
console.log('===================================\n');
|
|
|
|
const searcher = new LanceDBSearch(dbPath);
|
|
await searcher.initialize();
|
|
|
|
const testQueries = [
|
|
'onStart lifecycle method',
|
|
'@nodeFromScene decorator',
|
|
'attaching scripts to objects',
|
|
'creating project in editor',
|
|
'Editor templates',
|
|
];
|
|
|
|
for (const query of testQueries) {
|
|
console.log(`\nQuery: "${query}"`);
|
|
console.log('---');
|
|
|
|
const results = await searcher.search(query, { limit: 3 });
|
|
|
|
results.forEach((result, i) => {
|
|
console.log(`${i + 1}. ${result.title}`);
|
|
console.log(` Source: ${result.source}`);
|
|
console.log(` Category: ${result.category}`);
|
|
console.log(` Score: ${result.score.toFixed(4)}`);
|
|
console.log(` URL: ${result.url}`);
|
|
});
|
|
}
|
|
|
|
// LanceDBSearch doesn't have close method
|
|
console.log('\n✓ Search tests completed!');
|
|
}
|
|
|
|
main().catch(console.error);
|