@khivi/opencode-codebase-index 0.5.2 → 0.5.3
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.md +126 -587
- package/dist/git-cli.cjs +24 -7
- package/dist/git-cli.cjs.map +1 -1
- package/dist/git-cli.js +24 -7
- package/dist/git-cli.js.map +1 -1
- package/native/codebase-index-native.darwin-arm64.node +0 -0
- package/native/codebase-index-native.darwin-x64.node +0 -0
- package/native/codebase-index-native.linux-arm64-gnu.node +0 -0
- package/native/codebase-index-native.linux-x64-gnu.node +0 -0
- package/native/codebase-index-native.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/git-cli.cjs
CHANGED
|
@@ -651,13 +651,30 @@ var require_ignore = __commonJS({
|
|
|
651
651
|
var import_child_process = require("child_process");
|
|
652
652
|
var import_fs = require("fs");
|
|
653
653
|
var path = __toESM(require("path"), 1);
|
|
654
|
-
|
|
654
|
+
function extractExtensions(includePatterns) {
|
|
655
|
+
const exts = /* @__PURE__ */ new Set();
|
|
656
|
+
for (const pattern of includePatterns) {
|
|
657
|
+
const braceMatch = pattern.match(/\*\.?\{([^}]+)\}/);
|
|
658
|
+
if (braceMatch) {
|
|
659
|
+
for (const ext of braceMatch[1].split(",")) {
|
|
660
|
+
exts.add(`.${ext.trim()}`);
|
|
661
|
+
}
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
const singleMatch = pattern.match(/\*\.(\w+)$/);
|
|
665
|
+
if (singleMatch) {
|
|
666
|
+
exts.add(`.${singleMatch[1]}`);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return exts;
|
|
670
|
+
}
|
|
655
671
|
function repoRoot() {
|
|
656
672
|
return (0, import_child_process.execSync)("git rev-parse --show-toplevel", { encoding: "utf-8" }).trim();
|
|
657
673
|
}
|
|
658
|
-
function activeFiles(root) {
|
|
674
|
+
function activeFiles(root, includePatterns) {
|
|
659
675
|
const output = (0, import_child_process.execSync)("git ls-files", { cwd: root, encoding: "utf-8" });
|
|
660
|
-
|
|
676
|
+
const exts = extractExtensions(includePatterns);
|
|
677
|
+
return output.split("\n").filter((f) => f.length > 0 && exts.has(path.extname(f)));
|
|
661
678
|
}
|
|
662
679
|
function blobSha(filepath, root) {
|
|
663
680
|
return (0, import_child_process.execSync)(`git hash-object ${JSON.stringify(filepath)}`, {
|
|
@@ -5834,7 +5851,9 @@ function loadPluginConfig(projectRoot) {
|
|
|
5834
5851
|
// src/commands/incremental.ts
|
|
5835
5852
|
async function runIncremental() {
|
|
5836
5853
|
const root = repoRoot();
|
|
5837
|
-
const
|
|
5854
|
+
const rawConfig = loadPluginConfig(root);
|
|
5855
|
+
const config = parseConfig(rawConfig);
|
|
5856
|
+
const files = activeFiles(root, config.include);
|
|
5838
5857
|
const stored = loadHashes(root);
|
|
5839
5858
|
const current = {};
|
|
5840
5859
|
const changed = [];
|
|
@@ -5851,8 +5870,6 @@ async function runIncremental() {
|
|
|
5851
5870
|
console.log(`${files.length} files checked, 0 reindexed, 0 deleted`);
|
|
5852
5871
|
return;
|
|
5853
5872
|
}
|
|
5854
|
-
const rawConfig = loadPluginConfig(root);
|
|
5855
|
-
const config = parseConfig(rawConfig);
|
|
5856
5873
|
const indexer = new Indexer(root, config);
|
|
5857
5874
|
await indexer.initialize();
|
|
5858
5875
|
const stats = await indexer.index((progress) => {
|
|
@@ -5883,7 +5900,7 @@ async function runQuery(queryText, limit) {
|
|
|
5883
5900
|
const indexer = new Indexer(root, config);
|
|
5884
5901
|
await indexer.initialize();
|
|
5885
5902
|
const results = await indexer.search(queryText, limit * 2);
|
|
5886
|
-
const active = new Set(activeFiles(root));
|
|
5903
|
+
const active = new Set(activeFiles(root, config.include));
|
|
5887
5904
|
const filtered = results.filter((r) => {
|
|
5888
5905
|
const rel = path9.relative(root, r.filePath);
|
|
5889
5906
|
return active.has(rel);
|