quackstack 1.0.16 ā 1.0.17
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 +2 -2
- package/dist/repl.js +28 -29
- package/package.json +1 -1
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("
|
|
50
|
-
console.log(chalk_1.default.white("
|
|
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
|
@@ -11,12 +11,12 @@ export async function startREPL(forceReindex = false, provider, model) {
|
|
|
11
11
|
console.log(chalk.cyan("\nš„ Welcome to QuackStack!\n"));
|
|
12
12
|
try {
|
|
13
13
|
const aiClient = getAIClient(provider, model);
|
|
14
|
-
console.log(chalk.cyan(
|
|
14
|
+
console.log(chalk.cyan(`Using: ${aiClient.getProviderName()} - ${aiClient.getModel()}`));
|
|
15
15
|
console.log(chalk.gray("š” Tip: Type '/help' for commands or 'quack --list-models' to see all options"));
|
|
16
16
|
console.log(chalk.cyan("ā” Press Ctrl+C to exit\n"));
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
|
-
console.error(chalk.red(`\
|
|
19
|
+
console.error(chalk.red(`\nFailed to initialize AI provider: ${error.message}\n`));
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
22
|
if (!forceReindex) {
|
|
@@ -25,7 +25,16 @@ export async function startREPL(forceReindex = false, provider, model) {
|
|
|
25
25
|
console.log(chalk.yellow(`\nā ļø Detected ${changes.totalChanges} file change${changes.totalChanges > 1 ? 's' : ''} since last index:`));
|
|
26
26
|
console.log(chalk.yellow(` ${formatChangeMessage(changes)}`));
|
|
27
27
|
console.log(chalk.yellow(` Run 'quack --reindex' for best results.\n`));
|
|
28
|
-
const
|
|
28
|
+
const tempRl = readline.createInterface({
|
|
29
|
+
input: process.stdin,
|
|
30
|
+
output: process.stdout,
|
|
31
|
+
});
|
|
32
|
+
const shouldReindex = await new Promise((resolve) => {
|
|
33
|
+
tempRl.question(chalk.yellow("Reindex now? (y/n) > "), (answer) => {
|
|
34
|
+
tempRl.close();
|
|
35
|
+
resolve(answer);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
29
38
|
if (shouldReindex.toLowerCase() === 'y') {
|
|
30
39
|
forceReindex = true;
|
|
31
40
|
}
|
|
@@ -36,14 +45,14 @@ export async function startREPL(forceReindex = false, provider, model) {
|
|
|
36
45
|
});
|
|
37
46
|
if (existingCount === 0 || forceReindex) {
|
|
38
47
|
if (forceReindex) {
|
|
39
|
-
console.log(chalk.gray("
|
|
48
|
+
console.log(chalk.gray("Clearing old index..."));
|
|
40
49
|
await client.codeSnippet.deleteMany({
|
|
41
50
|
where: { projectName: PROJECT_NAME },
|
|
42
51
|
});
|
|
43
52
|
}
|
|
44
53
|
console.log(chalk.gray("š Indexing your codebase..."));
|
|
45
54
|
await ingest(process.cwd(), PROJECT_NAME, true);
|
|
46
|
-
console.log(chalk.green("
|
|
55
|
+
console.log(chalk.green("Indexing complete\n"));
|
|
47
56
|
}
|
|
48
57
|
const rl = readline.createInterface({
|
|
49
58
|
input: process.stdin,
|
|
@@ -65,20 +74,22 @@ export async function startREPL(forceReindex = false, provider, model) {
|
|
|
65
74
|
try {
|
|
66
75
|
const { answer, sources } = await search(query, PROJECT_NAME, provider, model);
|
|
67
76
|
console.log(chalk.white(`\n${answer}\n`));
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
rl.question(chalk.cyan("š” Want more details? (y/n) > "), (showDetails) => {
|
|
78
|
+
if (showDetails.toLowerCase() === "y") {
|
|
79
|
+
console.log(chalk.blue("\nš Relevant Code:\n"));
|
|
80
|
+
sources.forEach((src, i) => {
|
|
81
|
+
console.log(chalk.gray(`[${i + 1}] ${src.filePath} (relevance: ${(src.score * 100).toFixed(1)}%)`));
|
|
82
|
+
console.log(chalk.white(src.content));
|
|
83
|
+
console.log(chalk.gray("\n---\n"));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
rl.prompt();
|
|
87
|
+
});
|
|
77
88
|
}
|
|
78
89
|
catch (error) {
|
|
79
90
|
console.error(chalk.red(`\nā Error: ${error.message}\n`));
|
|
91
|
+
rl.prompt();
|
|
80
92
|
}
|
|
81
|
-
rl.prompt();
|
|
82
93
|
});
|
|
83
94
|
rl.on("close", () => {
|
|
84
95
|
console.log(chalk.gray("\nš Happy coding!\n"));
|
|
@@ -93,7 +104,7 @@ async function handleCommand(command, rl) {
|
|
|
93
104
|
if (args.length === 0) {
|
|
94
105
|
try {
|
|
95
106
|
const client = getAIClient();
|
|
96
|
-
console.log(chalk.cyan(`\
|
|
107
|
+
console.log(chalk.cyan(`\nCurrent: ${client.getProviderName()} - ${client.getModel()}\n`));
|
|
97
108
|
}
|
|
98
109
|
catch (error) {
|
|
99
110
|
console.log(chalk.red(`\nā Error: ${error.message}\n`));
|
|
@@ -104,7 +115,7 @@ async function handleCommand(command, rl) {
|
|
|
104
115
|
try {
|
|
105
116
|
resetAIClient();
|
|
106
117
|
const client = getAIClient(undefined, newModel);
|
|
107
|
-
console.log(chalk.green(`\
|
|
118
|
+
console.log(chalk.green(`\nSwitched to: ${client.getProviderName()} - ${client.getModel()}\n`));
|
|
108
119
|
}
|
|
109
120
|
catch (error) {
|
|
110
121
|
console.log(chalk.red(`\nā Error: ${error.message}\n`));
|
|
@@ -153,15 +164,3 @@ async function handleCommand(command, rl) {
|
|
|
153
164
|
console.log(chalk.gray("š” Type /help for available commands\n"));
|
|
154
165
|
}
|
|
155
166
|
}
|
|
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
|
-
}
|