opencode-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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // opencode-codebase-index - Semantic codebase search for OpenCode
2
+ // open-codebase-index - Semantic codebase indexing and search
3
3
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -19592,6 +19592,8 @@ var GitHeadWatcher = class {
19592
19592
  debounceTimer = null;
19593
19593
  debounceMs = 100;
19594
19594
  // Short debounce for git operations
19595
+ readyPromise = Promise.resolve();
19596
+ resolveReady = null;
19595
19597
  constructor(projectRoot) {
19596
19598
  this.projectRoot = projectRoot;
19597
19599
  }
@@ -19600,8 +19602,12 @@ var GitHeadWatcher = class {
19600
19602
  return;
19601
19603
  }
19602
19604
  if (!isGitRepo(this.projectRoot)) {
19605
+ this.readyPromise = Promise.resolve();
19603
19606
  return;
19604
19607
  }
19608
+ this.readyPromise = new Promise((resolve18) => {
19609
+ this.resolveReady = resolve18;
19610
+ });
19605
19611
  this.onBranchChange = handler;
19606
19612
  this.currentBranch = getCurrentBranch(this.projectRoot);
19607
19613
  const headPath = getHeadPath(this.projectRoot);
@@ -19616,6 +19622,10 @@ var GitHeadWatcher = class {
19616
19622
  });
19617
19623
  this.watcher.on("change", () => this.handleHeadChange());
19618
19624
  this.watcher.on("add", () => this.handleHeadChange());
19625
+ this.watcher.once("ready", () => {
19626
+ this.resolveReady?.();
19627
+ this.resolveReady = null;
19628
+ });
19619
19629
  }
19620
19630
  handleHeadChange() {
19621
19631
  if (this.debounceTimer) {
@@ -19653,10 +19663,16 @@ var GitHeadWatcher = class {
19653
19663
  await watcher.close();
19654
19664
  }
19655
19665
  this.onBranchChange = null;
19666
+ this.resolveReady?.();
19667
+ this.resolveReady = null;
19668
+ this.readyPromise = Promise.resolve();
19656
19669
  }
19657
19670
  isRunning() {
19658
19671
  return this.watcher !== null;
19659
19672
  }
19673
+ async waitUntilReady() {
19674
+ await this.readyPromise;
19675
+ }
19660
19676
  };
19661
19677
 
19662
19678
  // src/watcher/index.ts
@@ -19706,7 +19722,10 @@ function createWatcherWithIndexer(getIndexer, projectRoot, config, host, options
19706
19722
  fileWatcher,
19707
19723
  gitWatcher,
19708
19724
  whenReady() {
19709
- return fileWatcher.waitUntilReady();
19725
+ return Promise.all([
19726
+ fileWatcher.waitUntilReady(),
19727
+ gitWatcher?.waitUntilReady()
19728
+ ]).then(() => void 0);
19710
19729
  },
19711
19730
  async stop() {
19712
19731
  stopped = true;