project-librarian 0.4.0 → 0.4.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/README.ko.md +21 -6
- package/README.md +14 -0
- package/dist/args.js +5 -2
- package/dist/code-index/evidence.js +79 -0
- package/dist/code-index/extractors/config.js +58 -0
- package/dist/code-index/extractors/light-languages.js +52 -0
- package/dist/code-index/extractors/registry.js +137 -0
- package/dist/code-index/extractors/shared.js +36 -0
- package/dist/code-index/extractors/tree-sitter.js +319 -0
- package/dist/code-index/extractors/types.js +2 -0
- package/dist/code-index/extractors/typescript.js +211 -0
- package/dist/code-index/incremental.js +16 -0
- package/dist/code-index/index-health.js +164 -0
- package/dist/code-index/modes.js +303 -0
- package/dist/code-index/ownership.js +183 -0
- package/dist/code-index/reports.js +322 -0
- package/dist/code-index/schema.js +196 -0
- package/dist/code-index/search.js +153 -0
- package/dist/code-index-file-policy.js +21 -27
- package/dist/code-index.js +167 -1850
- package/dist/init-project-wiki.js +38 -40
- package/dist/mcp-server.js +60 -6
- package/dist/migration.js +10 -6
- package/dist/modes.js +73 -42
- package/dist/path-ignore-policy.js +30 -0
- package/dist/wiki-corpus.js +25 -0
- package/dist/wiki-diagnostics.js +19 -0
- package/dist/wiki-files.js +2 -1
- package/dist/wiki-graph.js +1 -2
- package/package.json +9 -3
|
@@ -43,27 +43,13 @@ exports.smallRepoCodeIndexGate = smallRepoCodeIndexGate;
|
|
|
43
43
|
const childProcess = __importStar(require("node:child_process"));
|
|
44
44
|
const fs = __importStar(require("node:fs"));
|
|
45
45
|
const path = __importStar(require("node:path"));
|
|
46
|
+
const path_ignore_policy_1 = require("./path-ignore-policy");
|
|
46
47
|
const workspace_1 = require("./workspace");
|
|
47
48
|
// Single source of truth for the disposable code-evidence directory name. Both
|
|
48
49
|
// the heavy code-index module and the light bootstrap path (hooks.ts) key off
|
|
49
50
|
// this; keeping it here avoids loading typescript/node:sqlite during bootstrap.
|
|
50
51
|
exports.codeEvidenceDirectory = ".project-wiki";
|
|
51
|
-
exports.ignoredDirectories =
|
|
52
|
-
".git",
|
|
53
|
-
".codex",
|
|
54
|
-
".claude",
|
|
55
|
-
".cursor",
|
|
56
|
-
".gemini",
|
|
57
|
-
exports.codeEvidenceDirectory,
|
|
58
|
-
"node_modules",
|
|
59
|
-
".next",
|
|
60
|
-
"dist",
|
|
61
|
-
"build",
|
|
62
|
-
"coverage",
|
|
63
|
-
"vendor",
|
|
64
|
-
"tmp",
|
|
65
|
-
"temp",
|
|
66
|
-
]);
|
|
52
|
+
exports.ignoredDirectories = (0, path_ignore_policy_1.ignoredDirectorySet)([exports.codeEvidenceDirectory]);
|
|
67
53
|
const languageByExtension = {
|
|
68
54
|
".c": "c",
|
|
69
55
|
".cc": "cpp",
|
|
@@ -123,10 +109,7 @@ function shouldIndexFile(relativePath) {
|
|
|
123
109
|
return ["Dockerfile", "Makefile", "package.json", "tsconfig.json"].includes(base);
|
|
124
110
|
}
|
|
125
111
|
function isIgnoredCodePath(relativePath) {
|
|
126
|
-
return (0,
|
|
127
|
-
.split("/")
|
|
128
|
-
.filter(Boolean)
|
|
129
|
-
.some((part) => exports.ignoredDirectories.has(part));
|
|
112
|
+
return (0, path_ignore_policy_1.pathContainsIgnoredDirectory)(relativePath, exports.ignoredDirectories);
|
|
130
113
|
}
|
|
131
114
|
// Mirrors normalizeProjectRelative in code-index.ts for git ls-files output, but
|
|
132
115
|
// throws instead of exiting so the light bootstrap path can use discovery too.
|
|
@@ -180,16 +163,27 @@ function gitTrackedAndUnignoredFiles(scopes) {
|
|
|
180
163
|
return null;
|
|
181
164
|
}
|
|
182
165
|
}
|
|
166
|
+
function indexableFileStat(file) {
|
|
167
|
+
try {
|
|
168
|
+
const stat = fs.statSync((0, workspace_1.abs)(file));
|
|
169
|
+
return stat.isFile() ? stat : null;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
183
175
|
function discoverCodeFiles(scopes) {
|
|
184
176
|
const gitFiles = gitTrackedAndUnignoredFiles(scopes);
|
|
185
177
|
const candidates = gitFiles ?? scopes.flatMap((scope) => walkCodeFiles(scope));
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
178
|
+
const files = [];
|
|
179
|
+
for (const file of Array.from(new Set(candidates))) {
|
|
180
|
+
if (isIgnoredCodePath(file) || !shouldIndexFile(file))
|
|
181
|
+
continue;
|
|
182
|
+
const stat = indexableFileStat(file);
|
|
183
|
+
if (stat && stat.size <= exports.maxIndexedBytes)
|
|
184
|
+
files.push(file);
|
|
185
|
+
}
|
|
186
|
+
return files.sort();
|
|
193
187
|
}
|
|
194
188
|
// --- Scale-aware code-evidence gate ------------------------------------------
|
|
195
189
|
//
|