Add AST extraction tests, broader ignore patterns, build dist
- ast-extract.ts: Support tree-sitter-python and tree-sitter-go grammar loading (pkg.language fallback) - discover.ts: Add cache directories to default ignore (.cache, tmp, temp, .turbo, .parcel-cache, .eslintcache, .prettiercache) - tests: Add TypeScript AST extraction tests (exports + imports) - Verified on real project: media_library_viewer (196 .pi-map.md files) with accurate React component extraction - Build: npm run build produces clean dist/ output All 16 tests pass.
This commit is contained in:
+2
-1
@@ -40,7 +40,8 @@ export async function extractFileAST(
|
||||
// For other languages, try to require the grammar package
|
||||
try {
|
||||
const pkg = require(`tree-sitter-${langName}`);
|
||||
grammar = pkg.default || pkg;
|
||||
// Some packages export { language }, others export the grammar directly
|
||||
grammar = pkg.language || pkg.default || pkg;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@ const DEFAULT_IGNORE = [
|
||||
".DS_Store",
|
||||
"*.log",
|
||||
".pi-map.md",
|
||||
".cache",
|
||||
"tmp",
|
||||
"temp",
|
||||
".tmp",
|
||||
".turbo",
|
||||
".parcel-cache",
|
||||
".eslintcache",
|
||||
".prettiercache",
|
||||
];
|
||||
|
||||
export interface DirectoryEntry {
|
||||
|
||||
Reference in New Issue
Block a user