quackstack 1.0.9 → 1.0.11

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { client } from "../lib/database.js";
3
3
  import { localEmbeddings } from "../lib/local-embeddings.js";
4
- import { aiClient } from "../lib/ai-provider.js";
4
+ import { getAIClient } from "../lib/ai-provider.js";
5
5
  export async function search(query, projectName) {
6
6
  const snippets = await client.codeSnippet.findMany({
7
7
  where: { projectName },
@@ -28,6 +28,7 @@ export async function search(query, projectName) {
28
28
  const context = uniqueResults
29
29
  .map((r, i) => `[${i + 1}] ${r.filePath}${r.functionName ? ` (${r.functionName})` : ""}\n${r.content}`)
30
30
  .join("\n\n---\n\n");
31
+ const aiClient = getAIClient();
31
32
  const answer = await aiClient.generateAnswer(query, context);
32
33
  return { answer, sources: uniqueResults };
33
34
  }
@@ -180,4 +180,10 @@ export class AIClient {
180
180
  return this.provider;
181
181
  }
182
182
  }
183
- export const aiClient = new AIClient();
183
+ let aiClientInstance = null;
184
+ export function getAIClient() {
185
+ if (!aiClientInstance) {
186
+ aiClientInstance = new AIClient();
187
+ }
188
+ return aiClientInstance;
189
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quackstack",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Your cracked unpaid intern for all things codebase related! AI-powered codebase search and Q&A.",
5
5
  "type": "module",
6
6
  "main": "dist/cli.cjs",