quackstack 1.0.16 → 1.0.18

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.cjs CHANGED
@@ -46,8 +46,8 @@ program
46
46
  });
47
47
  });
48
48
  console.log(chalk_1.default.cyan("\nUsage:"));
49
- console.log(chalk_1.default.white(" quackstack --provider anthropic --model claude-sonnet-4-5-20250929"));
50
- console.log(chalk_1.default.white(" quackstack -p openai -m gpt-4o\n"));
49
+ console.log(chalk_1.default.white(" quack --provider anthropic --model claude-sonnet-4-20250514"));
50
+ console.log(chalk_1.default.white(" quack -p openai -m gpt-4o\n"));
51
51
  process.exit(0);
52
52
  }
53
53
  const title = chalk_animation_1.default.rainbow("QuackStack\n");
package/dist/repl.js CHANGED
@@ -6,17 +6,42 @@ import { client } from "./lib/database.js";
6
6
  import path from "path";
7
7
  import { detectFileChanges, formatChangeMessage } from "./lib/file-change-detector.js";
8
8
  import { getAIClient, resetAIClient } from "./lib/ai-provider.js";
9
+ function wrapText(text, width = process.stdout.columns || 80) {
10
+ const lines = [];
11
+ const paragraphs = text.split('\n');
12
+ for (const paragraph of paragraphs) {
13
+ if (paragraph.length <= width) {
14
+ lines.push(paragraph);
15
+ continue;
16
+ }
17
+ const words = paragraph.split(' ');
18
+ let currentLine = '';
19
+ for (const word of words) {
20
+ if ((currentLine + word).length <= width) {
21
+ currentLine += (currentLine ? ' ' : '') + word;
22
+ }
23
+ else {
24
+ if (currentLine)
25
+ lines.push(currentLine);
26
+ currentLine = word;
27
+ }
28
+ }
29
+ if (currentLine)
30
+ lines.push(currentLine);
31
+ }
32
+ return lines.join('\n');
33
+ }
9
34
  const PROJECT_NAME = path.basename(process.cwd());
10
35
  export async function startREPL(forceReindex = false, provider, model) {
11
36
  console.log(chalk.cyan("\n🐄 Welcome to QuackStack!\n"));
12
37
  try {
13
38
  const aiClient = getAIClient(provider, model);
14
- console.log(chalk.cyan(`šŸ¤– Using: ${aiClient.getProviderName()} - ${aiClient.getModel()}`));
39
+ console.log(chalk.cyan(`Using: ${aiClient.getProviderName()} - ${aiClient.getModel()}`));
15
40
  console.log(chalk.gray("šŸ’” Tip: Type '/help' for commands or 'quack --list-models' to see all options"));
16
- console.log(chalk.cyan("⚔ Press Ctrl+C to exit\n"));
41
+ console.log(chalk.cyan("Press Ctrl+C to exit\n"));
17
42
  }
18
43
  catch (error) {
19
- console.error(chalk.red(`\nāŒ Failed to initialize AI provider: ${error.message}\n`));
44
+ console.error(chalk.red(`\nFailed to initialize AI provider: ${error.message}\n`));
20
45
  process.exit(1);
21
46
  }
22
47
  if (!forceReindex) {
@@ -25,7 +50,16 @@ export async function startREPL(forceReindex = false, provider, model) {
25
50
  console.log(chalk.yellow(`\nāš ļø Detected ${changes.totalChanges} file change${changes.totalChanges > 1 ? 's' : ''} since last index:`));
26
51
  console.log(chalk.yellow(` ${formatChangeMessage(changes)}`));
27
52
  console.log(chalk.yellow(` Run 'quack --reindex' for best results.\n`));
28
- const shouldReindex = await promptUser(chalk.yellow("šŸ”„ Reindex now? (y/n) > "));
53
+ const tempRl = readline.createInterface({
54
+ input: process.stdin,
55
+ output: process.stdout,
56
+ });
57
+ const shouldReindex = await new Promise((resolve) => {
58
+ tempRl.question(chalk.yellow("Reindex now? (y/n) > "), (answer) => {
59
+ tempRl.close();
60
+ resolve(answer);
61
+ });
62
+ });
29
63
  if (shouldReindex.toLowerCase() === 'y') {
30
64
  forceReindex = true;
31
65
  }
@@ -36,14 +70,14 @@ export async function startREPL(forceReindex = false, provider, model) {
36
70
  });
37
71
  if (existingCount === 0 || forceReindex) {
38
72
  if (forceReindex) {
39
- console.log(chalk.gray("šŸ—‘ļø Clearing old index..."));
73
+ console.log(chalk.gray("Clearing old index..."));
40
74
  await client.codeSnippet.deleteMany({
41
75
  where: { projectName: PROJECT_NAME },
42
76
  });
43
77
  }
44
78
  console.log(chalk.gray("šŸ” Indexing your codebase..."));
45
79
  await ingest(process.cwd(), PROJECT_NAME, true);
46
- console.log(chalk.green("āœ… Indexing complete\n"));
80
+ console.log(chalk.green("Indexing complete\n"));
47
81
  }
48
82
  const rl = readline.createInterface({
49
83
  input: process.stdin,
@@ -64,21 +98,23 @@ export async function startREPL(forceReindex = false, provider, model) {
64
98
  }
65
99
  try {
66
100
  const { answer, sources } = await search(query, PROJECT_NAME, provider, model);
67
- console.log(chalk.white(`\n${answer}\n`));
68
- const showDetails = await promptUser(chalk.cyan("šŸ’” Want more details? (y/n) > "));
69
- if (showDetails.toLowerCase() === "y") {
70
- console.log(chalk.blue("\nšŸ“š Relevant Code:\n"));
71
- sources.forEach((src, i) => {
72
- console.log(chalk.gray(`[${i + 1}] ${src.filePath} (relevance: ${(src.score * 100).toFixed(1)}%)`));
73
- console.log(chalk.white(src.content));
74
- console.log(chalk.gray("\n---\n"));
75
- });
76
- }
101
+ console.log(chalk.white(`\n${wrapText(answer)}\n`));
102
+ rl.question(chalk.cyan("šŸ’” Want more details? (y/n) > "), (showDetails) => {
103
+ if (showDetails.toLowerCase() === "y") {
104
+ console.log(chalk.blue("\nšŸ“š Relevant Code:\n"));
105
+ sources.forEach((src, i) => {
106
+ console.log(chalk.gray(`[${i + 1}] ${src.filePath} (relevance: ${(src.score * 100).toFixed(1)}%)`));
107
+ console.log(chalk.white(wrapText(src.content)));
108
+ console.log(chalk.gray("\n---\n"));
109
+ });
110
+ }
111
+ rl.prompt();
112
+ });
77
113
  }
78
114
  catch (error) {
79
115
  console.error(chalk.red(`\nāŒ Error: ${error.message}\n`));
116
+ rl.prompt();
80
117
  }
81
- rl.prompt();
82
118
  });
83
119
  rl.on("close", () => {
84
120
  console.log(chalk.gray("\nšŸ‘‹ Happy coding!\n"));
@@ -133,7 +169,7 @@ async function handleCommand(command, rl) {
133
169
  try {
134
170
  resetAIClient();
135
171
  const client = getAIClient(newProvider);
136
- console.log(chalk.green(`\nāœ… Switched to: ${client.getProviderName()} - ${client.getModel()}\n`));
172
+ console.log(chalk.green(`\nSwitched to: ${client.getProviderName()} - ${client.getModel()}\n`));
137
173
  }
138
174
  catch (error) {
139
175
  console.log(chalk.red(`\nāŒ Error: ${error.message}\n`));
@@ -153,15 +189,3 @@ async function handleCommand(command, rl) {
153
189
  console.log(chalk.gray("šŸ’” Type /help for available commands\n"));
154
190
  }
155
191
  }
156
- function promptUser(question) {
157
- const rl = readline.createInterface({
158
- input: process.stdin,
159
- output: process.stdout,
160
- });
161
- return new Promise((resolve) => {
162
- rl.question(question, (answer) => {
163
- rl.close();
164
- resolve(answer);
165
- });
166
- });
167
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quackstack",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
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",