open-codebase-index 0.22.2 → 0.22.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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- // opencode-codebase-index - Semantic codebase search for OpenCode
1
+ // open-codebase-index - Semantic codebase indexing and search
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -16783,6 +16783,8 @@ var GitHeadWatcher = class {
16783
16783
  debounceTimer = null;
16784
16784
  debounceMs = 100;
16785
16785
  // Short debounce for git operations
16786
+ readyPromise = Promise.resolve();
16787
+ resolveReady = null;
16786
16788
  constructor(projectRoot) {
16787
16789
  this.projectRoot = projectRoot;
16788
16790
  }
@@ -16791,8 +16793,12 @@ var GitHeadWatcher = class {
16791
16793
  return;
16792
16794
  }
16793
16795
  if (!isGitRepo(this.projectRoot)) {
16796
+ this.readyPromise = Promise.resolve();
16794
16797
  return;
16795
16798
  }
16799
+ this.readyPromise = new Promise((resolve15) => {
16800
+ this.resolveReady = resolve15;
16801
+ });
16796
16802
  this.onBranchChange = handler;
16797
16803
  this.currentBranch = getCurrentBranch(this.projectRoot);
16798
16804
  const headPath = getHeadPath(this.projectRoot);
@@ -16807,6 +16813,10 @@ var GitHeadWatcher = class {
16807
16813
  });
16808
16814
  this.watcher.on("change", () => this.handleHeadChange());
16809
16815
  this.watcher.on("add", () => this.handleHeadChange());
16816
+ this.watcher.once("ready", () => {
16817
+ this.resolveReady?.();
16818
+ this.resolveReady = null;
16819
+ });
16810
16820
  }
16811
16821
  handleHeadChange() {
16812
16822
  if (this.debounceTimer) {
@@ -16844,10 +16854,16 @@ var GitHeadWatcher = class {
16844
16854
  await watcher.close();
16845
16855
  }
16846
16856
  this.onBranchChange = null;
16857
+ this.resolveReady?.();
16858
+ this.resolveReady = null;
16859
+ this.readyPromise = Promise.resolve();
16847
16860
  }
16848
16861
  isRunning() {
16849
16862
  return this.watcher !== null;
16850
16863
  }
16864
+ async waitUntilReady() {
16865
+ await this.readyPromise;
16866
+ }
16851
16867
  };
16852
16868
 
16853
16869
  // src/watcher/index.ts
@@ -16897,7 +16913,10 @@ function createWatcherWithIndexer(getIndexer, projectRoot, config, host, options
16897
16913
  fileWatcher,
16898
16914
  gitWatcher,
16899
16915
  whenReady() {
16900
- return fileWatcher.waitUntilReady();
16916
+ return Promise.all([
16917
+ fileWatcher.waitUntilReady(),
16918
+ gitWatcher?.waitUntilReady()
16919
+ ]).then(() => void 0);
16901
16920
  },
16902
16921
  async stop() {
16903
16922
  stopped = true;