quackstack 1.0.17 → 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.
Files changed (2) hide show
  1. package/dist/repl.js +31 -6
  2. package/package.json +1 -1
package/dist/repl.js CHANGED
@@ -6,6 +6,31 @@ 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"));
@@ -13,7 +38,7 @@ export async function startREPL(forceReindex = false, provider, model) {
13
38
  const aiClient = getAIClient(provider, model);
14
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
44
  console.error(chalk.red(`\nFailed to initialize AI provider: ${error.message}\n`));
@@ -73,13 +98,13 @@ export async function startREPL(forceReindex = false, provider, model) {
73
98
  }
74
99
  try {
75
100
  const { answer, sources } = await search(query, PROJECT_NAME, provider, model);
76
- console.log(chalk.white(`\n${answer}\n`));
101
+ console.log(chalk.white(`\n${wrapText(answer)}\n`));
77
102
  rl.question(chalk.cyan("šŸ’” Want more details? (y/n) > "), (showDetails) => {
78
103
  if (showDetails.toLowerCase() === "y") {
79
104
  console.log(chalk.blue("\nšŸ“š Relevant Code:\n"));
80
105
  sources.forEach((src, i) => {
81
106
  console.log(chalk.gray(`[${i + 1}] ${src.filePath} (relevance: ${(src.score * 100).toFixed(1)}%)`));
82
- console.log(chalk.white(src.content));
107
+ console.log(chalk.white(wrapText(src.content)));
83
108
  console.log(chalk.gray("\n---\n"));
84
109
  });
85
110
  }
@@ -104,7 +129,7 @@ async function handleCommand(command, rl) {
104
129
  if (args.length === 0) {
105
130
  try {
106
131
  const client = getAIClient();
107
- console.log(chalk.cyan(`\nCurrent: ${client.getProviderName()} - ${client.getModel()}\n`));
132
+ console.log(chalk.cyan(`\nšŸ¤– Current: ${client.getProviderName()} - ${client.getModel()}\n`));
108
133
  }
109
134
  catch (error) {
110
135
  console.log(chalk.red(`\nāŒ Error: ${error.message}\n`));
@@ -115,7 +140,7 @@ async function handleCommand(command, rl) {
115
140
  try {
116
141
  resetAIClient();
117
142
  const client = getAIClient(undefined, newModel);
118
- console.log(chalk.green(`\nSwitched to: ${client.getProviderName()} - ${client.getModel()}\n`));
143
+ console.log(chalk.green(`\nāœ… Switched to: ${client.getProviderName()} - ${client.getModel()}\n`));
119
144
  }
120
145
  catch (error) {
121
146
  console.log(chalk.red(`\nāŒ Error: ${error.message}\n`));
@@ -144,7 +169,7 @@ async function handleCommand(command, rl) {
144
169
  try {
145
170
  resetAIClient();
146
171
  const client = getAIClient(newProvider);
147
- console.log(chalk.green(`\nāœ… Switched to: ${client.getProviderName()} - ${client.getModel()}\n`));
172
+ console.log(chalk.green(`\nSwitched to: ${client.getProviderName()} - ${client.getModel()}\n`));
148
173
  }
149
174
  catch (error) {
150
175
  console.log(chalk.red(`\nāŒ Error: ${error.message}\n`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quackstack",
3
- "version": "1.0.17",
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",