open-codebase-index 0.22.4 → 0.22.5
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/cli.cjs +34 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +34 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +34 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/pi-extension.cjs +34 -3
- package/dist/pi-extension.cjs.map +1 -1
- package/dist/pi-extension.js +34 -3
- package/dist/pi-extension.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.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/pi-extension.cjs
CHANGED
|
@@ -9011,6 +9011,29 @@ function extractPrimaryIdentifierQueryHint(query) {
|
|
|
9011
9011
|
const best = codeTerms.find((term) => term.length >= 6);
|
|
9012
9012
|
return best ?? null;
|
|
9013
9013
|
}
|
|
9014
|
+
function pathSegmentsForAffinityMatch(filePath) {
|
|
9015
|
+
const normalizedPath2 = normalizeRankingText(filePath).replace(/\\/g, "/");
|
|
9016
|
+
const segments = normalizedPath2.split("/").filter((segment) => segment.length > 0);
|
|
9017
|
+
if (segments.length === 0) {
|
|
9018
|
+
return [];
|
|
9019
|
+
}
|
|
9020
|
+
const basename5 = segments[segments.length - 1] ?? "";
|
|
9021
|
+
const basenameWithoutExt = basename5.replace(/\.[^/.]+$/u, "");
|
|
9022
|
+
const normalizedSegments = segments.map((segment) => segment.toLowerCase());
|
|
9023
|
+
return Array.from(/* @__PURE__ */ new Set([
|
|
9024
|
+
...normalizedSegments,
|
|
9025
|
+
basenameWithoutExt.toLowerCase()
|
|
9026
|
+
]));
|
|
9027
|
+
}
|
|
9028
|
+
function hasModuleAffinity(filePath, exactIdentifierVariants) {
|
|
9029
|
+
const haystack = pathSegmentsForAffinityMatch(filePath);
|
|
9030
|
+
return exactIdentifierVariants.some((variant) => {
|
|
9031
|
+
if (!variant || variant.length < 2) {
|
|
9032
|
+
return false;
|
|
9033
|
+
}
|
|
9034
|
+
return haystack.includes(variant);
|
|
9035
|
+
});
|
|
9036
|
+
}
|
|
9014
9037
|
var FILE_PATH_HINT_EXTENSIONS = [
|
|
9015
9038
|
"ts",
|
|
9016
9039
|
"tsx",
|
|
@@ -9086,10 +9109,13 @@ function buildDeterministicIdentifierPass(query, candidates, limit, prioritizeSo
|
|
|
9086
9109
|
).map((candidate) => {
|
|
9087
9110
|
const nameLower = (candidate.metadata.name ?? "").toLowerCase();
|
|
9088
9111
|
const pathLower = candidate.metadata.filePath.toLowerCase();
|
|
9089
|
-
|
|
9090
|
-
const
|
|
9112
|
+
const exactIdentifierVariants = primaryVariants.filter((value) => value.length >= 2);
|
|
9113
|
+
const exactMatch = exactIdentifierVariants.some(
|
|
9091
9114
|
(variant) => nameLower === variant || nameLower.replace(/[^a-z0-9]/g, "") === variant.replace(/[^a-z0-9]/g, "")
|
|
9092
9115
|
);
|
|
9116
|
+
let maxMatch = 0;
|
|
9117
|
+
const nameMatchesPrimary = exactMatch;
|
|
9118
|
+
const pathAffinity = exactMatch ? hasModuleAffinity(candidate.metadata.filePath, exactIdentifierVariants) : false;
|
|
9093
9119
|
const pathMatchesFileHint = filePathHint ? pathMatchesHint(candidate.metadata.filePath, filePathHint) : false;
|
|
9094
9120
|
for (const hint of hints) {
|
|
9095
9121
|
const variants = normalizeIdentifierVariants(hint);
|
|
@@ -9110,12 +9136,17 @@ function buildDeterministicIdentifierPass(query, candidates, limit, prioritizeSo
|
|
|
9110
9136
|
candidate,
|
|
9111
9137
|
maxMatch,
|
|
9112
9138
|
pathMatchesFileHint,
|
|
9113
|
-
nameMatchesPrimary
|
|
9139
|
+
nameMatchesPrimary,
|
|
9140
|
+
pathAffinity
|
|
9114
9141
|
};
|
|
9115
9142
|
}).filter((entry) => entry.maxMatch >= 0.7).sort((a, b) => {
|
|
9116
9143
|
const aAnchored = a.pathMatchesFileHint && a.nameMatchesPrimary ? 1 : 0;
|
|
9117
9144
|
const bAnchored = b.pathMatchesFileHint && b.nameMatchesPrimary ? 1 : 0;
|
|
9118
9145
|
if (aAnchored !== bAnchored) return bAnchored - aAnchored;
|
|
9146
|
+
if (a.nameMatchesPrimary !== b.nameMatchesPrimary) {
|
|
9147
|
+
return b.nameMatchesPrimary ? 1 : -1;
|
|
9148
|
+
}
|
|
9149
|
+
if (a.pathAffinity !== b.pathAffinity) return b.pathAffinity ? 1 : -1;
|
|
9119
9150
|
if (b.maxMatch !== a.maxMatch) return b.maxMatch - a.maxMatch;
|
|
9120
9151
|
if (b.candidate.score !== a.candidate.score) return b.candidate.score - a.candidate.score;
|
|
9121
9152
|
return a.candidate.id.localeCompare(b.candidate.id);
|