overlane 0.1.139 → 0.1.140

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/dist/overlane.mjs CHANGED
@@ -34557,7 +34557,7 @@ var VERSION;
34557
34557
  var init_assets = __esm({
34558
34558
  "src/assets.ts"() {
34559
34559
  "use strict";
34560
- VERSION = true ? "0.1.139" : "0.0.0-dev";
34560
+ VERSION = true ? "0.1.140" : "0.0.0-dev";
34561
34561
  }
34562
34562
  });
34563
34563
 
@@ -42713,20 +42713,45 @@ function wordsOf(text) {
42713
42713
  function idf(index, word) {
42714
42714
  return Math.log(index.wordDocs / (1 + (index.words.get(word) ?? 0)));
42715
42715
  }
42716
- function scoreSymbols(index, task) {
42717
- const exactNames = /* @__PURE__ */ new Set();
42716
+ function isGeneric(index, word) {
42717
+ return (index.words.get(word) ?? 0) >= Math.max(GENERIC_DF_FLOOR, index.wordDocs * GENERIC_DF_SHARE);
42718
+ }
42719
+ function isTestPath(path) {
42720
+ return /(^|\/)(tests?|__tests__|__mocks__|fixtures?|__fixtures__)\//.test(path) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(path) || /(^|\/)[^/]*\.fixtures?\.[cm]?[jt]sx?$/.test(path);
42721
+ }
42722
+ function testFilter(task) {
42723
+ if (/\b(tests?|specs?|fixtures?|testing|vitest|jest|mocks?)\b/i.test(task)) return () => true;
42724
+ const lower = task.toLowerCase();
42725
+ return (path) => {
42726
+ if (!isTestPath(path)) return true;
42727
+ const file2 = (path.split("/").pop() ?? path).toLowerCase();
42728
+ return lower.includes(file2) || lower.includes(file2.replace(/\.[cm]?[jt]sx?$/, ""));
42729
+ };
42730
+ }
42731
+ function identifierTokens(task) {
42732
+ const out2 = /* @__PURE__ */ new Set();
42718
42733
  for (const match of task.matchAll(/[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*/g)) {
42719
42734
  const token = match[0];
42735
+ if (/^[A-Za-z][a-z]*$/.test(token) && task.charAt((match.index ?? 0) - 1) !== "`") continue;
42736
+ out2.add(token);
42737
+ }
42738
+ return out2;
42739
+ }
42740
+ function scoreSymbols(index, task) {
42741
+ const exactNames = /* @__PURE__ */ new Set();
42742
+ for (const token of identifierTokens(task)) {
42720
42743
  if (token.length >= 4 && index.byName.has(token)) exactNames.add(token);
42721
42744
  if (token.includes(".")) exactNames.add(token);
42722
42745
  }
42723
42746
  const taskWords = new Set(wordsOf(task));
42747
+ const allowed = testFilter(task);
42724
42748
  const scored = [];
42725
42749
  for (const symbol2 of index.symbols.values()) {
42726
- if (!SEEDABLE.has(symbol2.kind)) continue;
42750
+ if (!SEEDABLE.has(symbol2.kind) || !allowed(symbol2.path)) continue;
42727
42751
  if (symbol2.kind === "constant" && !/^[A-Z][A-Z0-9_]+$/.test(symbol2.name)) continue;
42728
42752
  let score = 0;
42729
42753
  let exact = false;
42754
+ const hitWords = [];
42730
42755
  if (exactNames.has(symbol2.qualified)) {
42731
42756
  score = 200;
42732
42757
  exact = true;
@@ -42742,14 +42767,19 @@ function scoreSymbols(index, task) {
42742
42767
  let hits = 0;
42743
42768
  for (const word of own2) if (taskWords.has(word) && idf(index, word) >= MIN_WORD_IDF) {
42744
42769
  score += idf(index, word);
42770
+ if (isGeneric(index, word)) continue;
42745
42771
  hits += 1;
42772
+ hitWords.push([word, idf(index, word)]);
42773
+ }
42774
+ for (const word of fileWords) if (!own2.has(word) && taskWords.has(word) && idf(index, word) >= MIN_WORD_IDF) {
42775
+ score += idf(index, word) * 0.4;
42776
+ if (!isGeneric(index, word)) hitWords.push([word, idf(index, word) * 0.4]);
42746
42777
  }
42747
- for (const word of fileWords) if (!own2.has(word) && taskWords.has(word) && idf(index, word) >= MIN_WORD_IDF) score += idf(index, word) * 0.4;
42748
42778
  if (hits === 0) score = 0;
42749
42779
  else score /= 1 + 0.15 * own2.size;
42750
42780
  if (score < MIN_SOFT_SCORE) score = 0;
42751
42781
  }
42752
- if (score > 0) scored.push({ symbol: symbol2, score, exact });
42782
+ if (score > 0) scored.push({ symbol: symbol2, score, exact, hits: hitWords });
42753
42783
  }
42754
42784
  return scored.sort((a, b) => b.score - a.score || a.symbol.path.localeCompare(b.symbol.path) || a.symbol.line - b.symbol.line);
42755
42785
  }
@@ -42847,11 +42877,11 @@ function layout(index) {
42847
42877
  }
42848
42878
  return [`Layout: ${index.files} source files. ${[...domains].sort().map(([key, count]) => `${key}(${count})`).join(" ")}`];
42849
42879
  }
42850
- function mostCalled(index, limit) {
42880
+ function mostCalled(index, limit, allowed) {
42851
42881
  const counts2 = [];
42852
42882
  for (const [id2, callers] of index.callers) {
42853
42883
  const symbol2 = index.symbols.get(id2);
42854
- if (symbol2 === void 0 || !SEEDABLE.has(symbol2.kind) || symbol2.kind === "constant") continue;
42884
+ if (symbol2 === void 0 || !SEEDABLE.has(symbol2.kind) || symbol2.kind === "constant" || !allowed(symbol2.path)) continue;
42855
42885
  counts2.push({ symbol: symbol2, callers: callers.size });
42856
42886
  }
42857
42887
  counts2.sort((a, b) => b.callers - a.callers || a.symbol.path.localeCompare(b.symbol.path) || a.symbol.line - b.symbol.line);
@@ -42861,11 +42891,12 @@ function buildCodeMap(index, task, options = DEFAULT_MAP_OPTIONS) {
42861
42891
  const lines = [...layout(index), "Edges: 'called by' and 'calls' are resolved by name within imported files, ignoring comments and strings. Lines are file:line of the declaration."];
42862
42892
  const fits = (extra) => estimateTokens(`${[...lines, ...extra].join("\n")}
42863
42893
  `) <= options.maxTokens;
42894
+ const allowed = testFilter(task);
42864
42895
  const scored = scoreSymbols(index, task);
42865
42896
  const seeds = [];
42866
42897
  const shownFiles = /* @__PURE__ */ new Set();
42867
42898
  const taskFree = scored.length === 0;
42868
- const candidates = taskFree ? mostCalled(index, options.maxSeeds).map((symbol2) => ({ symbol: symbol2, score: 1 })) : scored;
42899
+ const candidates = taskFree ? mostCalled(index, options.maxSeeds, allowed).map((symbol2) => ({ symbol: symbol2, score: 1 })) : scored;
42869
42900
  lines.push("", taskFree ? "Most called symbols:" : "Symbols most relevant to the task:");
42870
42901
  for (const item of candidates) {
42871
42902
  if (seeds.length >= options.maxSeeds) break;
@@ -42879,10 +42910,13 @@ function buildCodeMap(index, task, options = DEFAULT_MAP_OPTIONS) {
42879
42910
  shownFiles.add(item.symbol.path);
42880
42911
  }
42881
42912
  const personal = /* @__PURE__ */ new Map();
42882
- if (taskFree) for (const path of index.byFile.keys()) personal.set(path, 1);
42883
- else for (const item of scored.slice(0, 40)) personal.set(item.symbol.path, (personal.get(item.symbol.path) ?? 0) + item.score);
42913
+ if (taskFree) {
42914
+ for (const path of index.byFile.keys()) if (allowed(path)) personal.set(path, 1);
42915
+ } else {
42916
+ for (const item of scored.slice(0, 40)) personal.set(item.symbol.path, (personal.get(item.symbol.path) ?? 0) + item.score);
42917
+ }
42884
42918
  const rank = pageRank(index, personal);
42885
- const ordered = [...rank].filter(([path]) => !shownFiles.has(path)).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
42919
+ const ordered = [...rank].filter(([path]) => !shownFiles.has(path) && allowed(path)).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
42886
42920
  const related = [];
42887
42921
  const top = ordered[0]?.[1] ?? 0;
42888
42922
  for (const [path, mass] of ordered) {
@@ -42916,7 +42950,7 @@ function serializeRepoIndex(index) {
42916
42950
  const heritage = [...index.heritage].map(([id2, h]) => ({ id: at(id2), extends: h.extends.map(at), implements: h.implements.map(at) }));
42917
42951
  return { schemaVersion: "1", files: index.files, wordDocs: index.wordDocs, symbols: symbols2, callees, heritage, paths: [...index.imports.keys()], words: [...index.words] };
42918
42952
  }
42919
- var SEEDABLE, MIN_WORD_IDF, MIN_SOFT_SCORE, MAX_RELATED_FILES, STOP, DEFAULT_MAP_OPTIONS, estimateTokens, where;
42953
+ var SEEDABLE, MIN_WORD_IDF, MIN_SOFT_SCORE, MAX_RELATED_FILES, GENERIC_DF_SHARE, GENERIC_DF_FLOOR, STOP, DEFAULT_MAP_OPTIONS, estimateTokens, where;
42920
42954
  var init_rank = __esm({
42921
42955
  "../index-builder/src/rank.ts"() {
42922
42956
  "use strict";
@@ -42925,6 +42959,8 @@ var init_rank = __esm({
42925
42959
  MIN_WORD_IDF = 2.5;
42926
42960
  MIN_SOFT_SCORE = 3.5;
42927
42961
  MAX_RELATED_FILES = 14;
42962
+ GENERIC_DF_SHARE = 4e-3;
42963
+ GENERIC_DF_FLOOR = 30;
42928
42964
  STOP = /* @__PURE__ */ new Set(["the", "a", "an", "of", "to", "in", "is", "are", "and", "or", "for", "that", "this", "it", "its", "by", "be", "on", "as", "at", "with", "from", "which", "what", "when", "where", "who", "how", "do", "does", "not", "any", "each", "every", "all", "also", "than", "then", "so", "if", "into", "file", "path", "answer", "end", "final", "message", "line", "start", "follow", "separate", "comma", "give", "name", "modify", "files", "repository", "source", "code", "change", "update", "make", "use", "uses", "used", "other", "only", "about", "will", "can", "should", "need", "needs", "happen", "merely", "share", "same", "return", "returns", "pass", "passes"]);
42929
42965
  DEFAULT_MAP_OPTIONS = { maxTokens: 3400, maxSeeds: 6 };
42930
42966
  estimateTokens = estimateCodeMapTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overlane",
3
- "version": "0.1.139",
3
+ "version": "0.1.140",
4
4
  "description": "Overlane: connect a GitHub project to your coding agents. One portable CLI with project memory, tasks, a code index, guardrails and the Claude Code and Codex plugin.",
5
5
  "keywords": [
6
6
  "overlane",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mvrx-harness",
3
- "version": "0.1.139",
3
+ "version": "0.1.140",
4
4
  "description": "Overlane context at session start and the shared Overlane skills.",
5
5
  "author": {
6
6
  "name": "owenob1"