pi-knowledge 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-knowledge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vector knowledge base extension for Pi — index files, hybrid search, local embeddings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"ignore": "7.0.5",
|
|
38
38
|
"tree-sitter": "0.22.4",
|
|
39
39
|
"tree-sitter-go": "0.23.4",
|
|
40
|
+
"tree-sitter-java": "0.23.5",
|
|
40
41
|
"tree-sitter-python": "0.23.6",
|
|
41
42
|
"tree-sitter-rust": "0.23.2",
|
|
42
43
|
"tree-sitter-typescript": "0.23.2"
|
package/src/indexer/chunker.ts
CHANGED
|
@@ -252,7 +252,7 @@ export function chunkText(content: string, filePath: string): Omit<ChunkInsert,
|
|
|
252
252
|
export async function chunkFile(content: string, filePath: string): Promise<Omit<ChunkInsert, "kb_id">[]> {
|
|
253
253
|
const fileType = detectFileType(filePath);
|
|
254
254
|
if (fileType === "markdown") return chunkMarkdown(content, filePath);
|
|
255
|
-
if (["typescript", "javascript", "python", "go", "rust"].includes(fileType)) {
|
|
255
|
+
if (["typescript", "javascript", "python", "go", "rust", "java"].includes(fileType)) {
|
|
256
256
|
try {
|
|
257
257
|
const { chunkWithAST } = await import("./chunkers/code-ast.ts");
|
|
258
258
|
const astChunks = await chunkWithAST(content, filePath, fileType);
|
|
@@ -54,6 +54,13 @@ const LANGS: Record<string, LangConfig> = {
|
|
|
54
54
|
methodContainer: "impl_item",
|
|
55
55
|
fileType: "rust",
|
|
56
56
|
},
|
|
57
|
+
java: {
|
|
58
|
+
grammar: async () => { const m = await import("tree-sitter-java"); return m.default ?? m; },
|
|
59
|
+
fnTypes: new Set(["method_declaration", "constructor_declaration"]),
|
|
60
|
+
classTypes: new Set(["class_declaration", "interface_declaration", "enum_declaration"]),
|
|
61
|
+
classBody: "class_body",
|
|
62
|
+
fileType: "java",
|
|
63
|
+
},
|
|
57
64
|
};
|
|
58
65
|
|
|
59
66
|
function getName(node: ASTNode): string {
|