## New Features - Implemented TSDoc extraction using TypeDoc API - Added API documentation indexing with LanceDB vector search - Created search_babylon_api MCP tool for querying API docs - Added 6 indexing and testing scripts ## API Indexing System - TSDocExtractor: Parses TypeScript source files and extracts documentation - ApiIndexer: Converts API docs to embeddings and stores in LanceDB - Support for all Babylon.js packages (core, gui, materials, loaders, etc.) - Successfully indexed 44,253 API entries from core package ## Bug Fixes - Fixed TypeScript strict mode errors with exactOptionalPropertyTypes - Fixed optional property handling in tsConfigPath and returns fields - Resolved EventEmitter MaxListeners warning in test suite - Updated all failing handler tests for real implementation ## Test Coverage Improvements - Added 27 new tests (92 → 119 tests passing) - Lines: 93.88% (was 82.53%, target 80%) ✓ - Functions: 100% (was 91.17%, target 80%) ✓ - Statements: 93.3% (was 81.58%, target 80%) ✓ - Branches: 69.72% (was 51.37%, target 75%) ## New Test Files - src/search/lancedb-search.test.ts (15 tests) - Enhanced handlers.test.ts with API search tests - Enhanced document-parser.test.ts with edge case tests ## Scripts Added - scripts/index-api.ts: Index all Babylon.js API documentation - scripts/test-api-indexing.ts: Test API indexing for core package - scripts/test-api-search.ts: Test API search functionality - scripts/get-api-details.ts: Display detailed API documentation - scripts/search-handmenu-api.ts: Search for HandMenu API examples ## Technical Details - TypeDoc integration for TSDoc extraction - Vector embeddings using Xenova/all-MiniLM-L6-v2 model - Semantic search across 11 Babylon.js packages - GitHub source links with line numbers in search results 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
104 lines
2.5 KiB
TypeScript
104 lines
2.5 KiB
TypeScript
import { LanceDBSearch } from '../src/search/lancedb-search.js';
|
|
|
|
async function main() {
|
|
console.log('Getting full details for Scene.getMeshByName...\n');
|
|
|
|
const search = new LanceDBSearch('./data/lancedb', 'babylon_docs');
|
|
await search.initialize();
|
|
|
|
try {
|
|
const results = await search.searchApi('Scene.getMeshByName', { limit: 1 });
|
|
|
|
if (results.length === 0) {
|
|
console.log('No results found');
|
|
return;
|
|
}
|
|
|
|
const result = results[0];
|
|
|
|
console.log('='.repeat(80));
|
|
console.log(`${result.fullName} (${result.kind})`);
|
|
console.log('='.repeat(80));
|
|
console.log();
|
|
|
|
if (result.summary) {
|
|
console.log('Summary:');
|
|
console.log(` ${result.summary}`);
|
|
console.log();
|
|
}
|
|
|
|
if (result.description) {
|
|
console.log('Description:');
|
|
console.log(` ${result.description}`);
|
|
console.log();
|
|
}
|
|
|
|
if (result.parameters) {
|
|
const params = JSON.parse(result.parameters);
|
|
if (params.length > 0) {
|
|
console.log('Parameters:');
|
|
for (const param of params) {
|
|
console.log(` - ${param.name}: ${param.type}`);
|
|
if (param.description) {
|
|
console.log(` ${param.description}`);
|
|
}
|
|
}
|
|
console.log();
|
|
}
|
|
}
|
|
|
|
if (result.returns) {
|
|
const returns = JSON.parse(result.returns);
|
|
console.log('Returns:');
|
|
console.log(` Type: ${returns.type}`);
|
|
if (returns.description) {
|
|
console.log(` Description: ${returns.description}`);
|
|
}
|
|
console.log();
|
|
}
|
|
|
|
if (result.type) {
|
|
console.log(`Type: ${result.type}`);
|
|
console.log();
|
|
}
|
|
|
|
if (result.examples) {
|
|
console.log('Examples:');
|
|
console.log(result.examples);
|
|
console.log();
|
|
}
|
|
|
|
if (result.deprecated) {
|
|
console.log(`⚠️ DEPRECATED: ${result.deprecated}`);
|
|
console.log();
|
|
}
|
|
|
|
if (result.see) {
|
|
console.log(`See Also: ${result.see}`);
|
|
console.log();
|
|
}
|
|
|
|
if (result.since) {
|
|
console.log(`Since: ${result.since}`);
|
|
console.log();
|
|
}
|
|
|
|
console.log('Source:');
|
|
console.log(` File: ${result.sourceFile}`);
|
|
console.log(` Line: ${result.sourceLine}`);
|
|
console.log(` URL: ${result.url}`);
|
|
console.log();
|
|
|
|
console.log('='.repeat(80));
|
|
} catch (error) {
|
|
console.error('Error getting API details:', error);
|
|
if (error instanceof Error) {
|
|
console.error('Stack:', error.stack);
|
|
}
|
|
}
|
|
|
|
await search.close();
|
|
}
|
|
|
|
main().catch(console.error);
|