MCPcopy Create free account
hub / github.com/Stevenic/codepilot / query

Method query

src/CodeIndex.ts:264–275  ·  view source on GitHub ↗

* Queries the code index. * @param query Text to query the index with. * @param options Optional. Options to use when querying the index. * @returns Found documents.

(query: string, options?: DocumentQueryOptions)

Source from the content-addressed store, hash-verified

262 * @returns Found documents.
263 */
264 public async query(query: string, options?: DocumentQueryOptions): Promise<LocalDocumentResult[]> {
265 if (!await this.isCreated()) {
266 throw new Error('Index has not been created yet. Please run `codepilot create` first.');
267 }
268 if (!await this.hasKeys()) {
269 throw new Error("A local vectra.keys file couldn't be found. Please run `codepilot set --key <your OpenAI key>`.");
270 }
271
272 // Query document index
273 const index = await this.load();
274 return await index.queryDocuments(query, options);
275 }
276
277 // LLM-REGION
278

Callers 1

renderAsMessagesMethod · 0.45

Calls 3

isCreatedMethod · 0.95
hasKeysMethod · 0.95
loadMethod · 0.95

Tested by

no test coverage detected