@bobsworkshop/cli 0.1.0 → 0.1.1
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/bin/{analyse-auto-OBCDWYWX.js → analyse-auto-KKWLMLHZ.js} +2 -1
- package/dist/bin/{analyse-results-QSOD3KVC.js → analyse-results-N5QLJNND.js} +2 -1
- package/dist/bin/bob.js +4 -3
- package/dist/bin/{chunk-LHWBSCJ4.js → chunk-WEHSNZKO.js} +2 -0
- package/package.json +11 -5
- package/bin/bob.ts +0 -74
- package/dist/bin/analyse-auto-AAWSETKY.js +0 -540
- package/dist/bin/analyse-auto-FQ62GYPV.js +0 -533
- package/dist/bin/analyse-auto-JAD24IQ5.js +0 -511
- package/dist/bin/analyse-auto-R4MZA7SX.js +0 -511
- package/dist/bin/analyse-auto-V3SH4MS7.js +0 -524
- package/dist/bin/analyse-auto-WQUK5YPO.js +0 -531
- package/dist/bin/analyse-auto-WVAY6467.js +0 -280
- package/dist/bin/analyse-results-3NSD6MAY.js +0 -363
- package/dist/bin/analyse-results-B7LONUXU.js +0 -265
- package/dist/bin/analyse-results-E6NBAVDB.js +0 -265
- package/dist/bin/analyse-results-FIDS4635.js +0 -9
- package/dist/bin/analyse-results-LMGVKAUX.js +0 -342
- package/dist/bin/analyse-results-LSMLUEIB.js +0 -338
- package/dist/bin/analyse-results-MOCLBCD7.js +0 -326
- package/dist/bin/analyse-results-NLAEAOOP.js +0 -10
- package/dist/bin/analyse-results-PYQIKWYL.js +0 -9
- package/dist/bin/analyse-results-R3MG5H7G.js +0 -329
- package/dist/bin/analyse-results-UYZZSBHB.js +0 -9
- package/dist/bin/analyse-results-YYGHIK2Q.js +0 -9
- package/dist/bin/analysis-tracker-N5VANTLH.js +0 -12
- package/dist/bin/chunk-3RSDDQE2.js +0 -420
- package/dist/bin/chunk-6KWC4HDO.js +0 -97
- package/dist/bin/chunk-6W7WDF4Q.js +0 -589
- package/dist/bin/chunk-7CXM3RLM.js +0 -287
- package/dist/bin/chunk-FGYL6SWO.js +0 -465
- package/dist/bin/chunk-J4BSKFCW.js +0 -624
- package/dist/bin/chunk-KWOQFI6L.js +0 -287
- package/dist/bin/chunk-OOGLZ2QB.js +0 -322
- package/dist/bin/chunk-TEVQLSGD.js +0 -287
- package/dist/bin/chunk-VUS7R7SO.js +0 -479
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
callCloudFunction,
|
|
3
|
-
callLocalModel,
|
|
4
|
-
ensureProjectStructure,
|
|
5
|
-
proposeAndWriteFile,
|
|
6
|
-
readFileContent
|
|
7
|
-
} from "./chunk-6W7WDF4Q.js";
|
|
8
|
-
|
|
9
|
-
// src/commands/analyse-results.ts
|
|
10
|
-
import chalk from "chalk";
|
|
11
|
-
import inquirer from "inquirer";
|
|
12
|
-
import * as fs from "fs";
|
|
13
|
-
import * as path from "path";
|
|
14
|
-
var RED = chalk.hex("#EF5350");
|
|
15
|
-
var PURPLE = chalk.hex("#AB47BC");
|
|
16
|
-
var BLUE = chalk.hex("#42A5F5");
|
|
17
|
-
var TEAL = chalk.hex("#26A69A");
|
|
18
|
-
var AMBER = chalk.hex("#FFAB00");
|
|
19
|
-
var GRAY = chalk.gray;
|
|
20
|
-
var BORDER = chalk.hex("#455A64");
|
|
21
|
-
var PRIORITY_COLORS = {
|
|
22
|
-
"critical": chalk.bgHex("#B71C1C").white,
|
|
23
|
-
"high": chalk.hex("#FF6D00"),
|
|
24
|
-
"medium": chalk.hex("#FFA726"),
|
|
25
|
-
"low": chalk.hex("#66BB6A")
|
|
26
|
-
};
|
|
27
|
-
var CATEGORY_COLORS = {
|
|
28
|
-
"bugs": RED,
|
|
29
|
-
"features": PURPLE,
|
|
30
|
-
"improvements": BLUE,
|
|
31
|
-
"upgrades": TEAL
|
|
32
|
-
};
|
|
33
|
-
async function showInteractiveResults(config, category, sort, search) {
|
|
34
|
-
let allSuggestions = [];
|
|
35
|
-
if (config.tier === "platform" && config.provider !== "local" && config.loggedIn && config.conversationId) {
|
|
36
|
-
try {
|
|
37
|
-
const result = await callCloudFunction("getCLIAnalysisResults", {
|
|
38
|
-
conversationId: config.conversationId,
|
|
39
|
-
category,
|
|
40
|
-
sort: sort || "priority",
|
|
41
|
-
search: search || null
|
|
42
|
-
});
|
|
43
|
-
allSuggestions = result?.suggestions || [];
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.log(chalk.red(` \u274C ${error.message}`));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
allSuggestions = loadLocalSuggestions(category);
|
|
50
|
-
}
|
|
51
|
-
if (search) {
|
|
52
|
-
const query = search.toLowerCase();
|
|
53
|
-
allSuggestions = allSuggestions.filter(
|
|
54
|
-
(s) => (s.description || "").toLowerCase().includes(query) || (s.title || "").toLowerCase().includes(query) || (s.filePath || "").toLowerCase().includes(query)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
sortSuggestions(allSuggestions, sort || "priority");
|
|
58
|
-
if (allSuggestions.length === 0) {
|
|
59
|
-
console.log("");
|
|
60
|
-
console.log(chalk.green(" \u2705 No items found. Clean!"));
|
|
61
|
-
console.log("");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const color = CATEGORY_COLORS[category] || GRAY;
|
|
65
|
-
let running = true;
|
|
66
|
-
let displaySuggestions = [...allSuggestions];
|
|
67
|
-
let currentSort = sort || "priority";
|
|
68
|
-
let currentSearch = search || null;
|
|
69
|
-
while (running) {
|
|
70
|
-
console.log("");
|
|
71
|
-
console.log(color(` \u25C6 ${category.toUpperCase()} (${displaySuggestions.length} items)`));
|
|
72
|
-
if (currentSearch) {
|
|
73
|
-
console.log(GRAY(` Filtered by: "${currentSearch}" | Sort: ${currentSort}`));
|
|
74
|
-
} else {
|
|
75
|
-
console.log(GRAY(` Sort: ${currentSort}`));
|
|
76
|
-
}
|
|
77
|
-
console.log(GRAY(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
78
|
-
console.log("");
|
|
79
|
-
const choices = [];
|
|
80
|
-
choices.push({
|
|
81
|
-
name: chalk.cyan(" \u{1F50D} Search / Filter"),
|
|
82
|
-
value: "__search__",
|
|
83
|
-
short: "Search"
|
|
84
|
-
});
|
|
85
|
-
choices.push({
|
|
86
|
-
name: chalk.cyan(` \u{1F500} Sort (current: ${currentSort})`),
|
|
87
|
-
value: "__sort__",
|
|
88
|
-
short: "Sort"
|
|
89
|
-
});
|
|
90
|
-
if (currentSearch) {
|
|
91
|
-
choices.push({
|
|
92
|
-
name: chalk.yellow(" \u2716 Clear filter"),
|
|
93
|
-
value: "__clear_filter__",
|
|
94
|
-
short: "Clear filter"
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
choices.push(new inquirer.Separator(GRAY(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")));
|
|
98
|
-
for (let idx = 0; idx < displaySuggestions.length; idx++) {
|
|
99
|
-
const item = displaySuggestions[idx];
|
|
100
|
-
const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
|
|
101
|
-
const priorityLabel = (item.priority || "MEDIUM").toUpperCase().padEnd(9);
|
|
102
|
-
const filePath = (item.filePath || "unknown").split("/").pop() || "unknown";
|
|
103
|
-
const desc = (item.description || item.title || "No description").slice(0, 42);
|
|
104
|
-
choices.push({
|
|
105
|
-
name: `${pColor(priorityLabel)} ${chalk.cyan(filePath.padEnd(18))} ${chalk.white(desc)}`,
|
|
106
|
-
value: idx,
|
|
107
|
-
short: item.title || item.description?.slice(0, 30) || "Item"
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
choices.push(new inquirer.Separator(GRAY(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")));
|
|
111
|
-
choices.push({
|
|
112
|
-
name: chalk.gray(" \u2190 Back (quit)"),
|
|
113
|
-
value: "__quit__",
|
|
114
|
-
short: "Quit"
|
|
115
|
-
});
|
|
116
|
-
const { selected } = await inquirer.prompt([
|
|
117
|
-
{
|
|
118
|
-
type: "select",
|
|
119
|
-
name: "selected",
|
|
120
|
-
message: color("Select:"),
|
|
121
|
-
choices,
|
|
122
|
-
pageSize: 12,
|
|
123
|
-
loop: false
|
|
124
|
-
}
|
|
125
|
-
]);
|
|
126
|
-
if (selected === "__quit__") {
|
|
127
|
-
running = false;
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
if (selected === "__search__") {
|
|
131
|
-
const { query } = await inquirer.prompt([
|
|
132
|
-
{
|
|
133
|
-
type: "input",
|
|
134
|
-
name: "query",
|
|
135
|
-
message: chalk.cyan("Search keyword:")
|
|
136
|
-
}
|
|
137
|
-
]);
|
|
138
|
-
if (query && query.trim()) {
|
|
139
|
-
currentSearch = query.trim();
|
|
140
|
-
const q = currentSearch.toLowerCase();
|
|
141
|
-
displaySuggestions = allSuggestions.filter(
|
|
142
|
-
(s) => (s.description || "").toLowerCase().includes(q) || (s.title || "").toLowerCase().includes(q) || (s.filePath || "").toLowerCase().includes(q)
|
|
143
|
-
);
|
|
144
|
-
console.log(chalk.cyan(` Found ${displaySuggestions.length} results for "${currentSearch}"`));
|
|
145
|
-
}
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
if (selected === "__sort__") {
|
|
149
|
-
const { newSort } = await inquirer.prompt([
|
|
150
|
-
{
|
|
151
|
-
type: "select",
|
|
152
|
-
name: "newSort",
|
|
153
|
-
message: "Sort by:",
|
|
154
|
-
choices: [
|
|
155
|
-
{ name: "Priority (critical first)", value: "priority" },
|
|
156
|
-
{ name: "File path (A-Z)", value: "file" }
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
]);
|
|
160
|
-
currentSort = newSort;
|
|
161
|
-
sortSuggestions(displaySuggestions, currentSort);
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (selected === "__clear_filter__") {
|
|
165
|
-
currentSearch = null;
|
|
166
|
-
displaySuggestions = [...allSuggestions];
|
|
167
|
-
sortSuggestions(displaySuggestions, currentSort);
|
|
168
|
-
console.log(chalk.gray(" Filter cleared."));
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
if (typeof selected === "number") {
|
|
172
|
-
const item = displaySuggestions[selected];
|
|
173
|
-
const action = await showExpandedView(item, category);
|
|
174
|
-
if (action === "implement") {
|
|
175
|
-
await handleImplement(item, config);
|
|
176
|
-
} else if (action === "dismiss") {
|
|
177
|
-
displaySuggestions.splice(selected, 1);
|
|
178
|
-
const originalIdx = allSuggestions.findIndex((s) => s.id === item.id);
|
|
179
|
-
if (originalIdx !== -1) allSuggestions.splice(originalIdx, 1);
|
|
180
|
-
console.log(chalk.gray(" \u23ED\uFE0F Dismissed."));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async function showExpandedView(item, category) {
|
|
186
|
-
const color = CATEGORY_COLORS[category] || GRAY;
|
|
187
|
-
const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
|
|
188
|
-
console.log("");
|
|
189
|
-
console.log(color(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
190
|
-
console.log(color(" \u2551 ") + pColor(`${(item.priority || "MEDIUM").toUpperCase()} ${category.toUpperCase().slice(0, -1)}`));
|
|
191
|
-
console.log(color(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
|
|
192
|
-
console.log(color(" \u2551") + chalk.gray(" File: ") + chalk.cyan(item.filePath || "unknown"));
|
|
193
|
-
console.log(color(" \u2551") + chalk.gray(" Priority: ") + pColor((item.priority || "medium").toUpperCase()));
|
|
194
|
-
console.log(color(" \u2551"));
|
|
195
|
-
console.log(color(" \u2551") + chalk.gray(" Title:"));
|
|
196
|
-
console.log(color(" \u2551") + chalk.white.bold(` ${item.title || "No title"}`));
|
|
197
|
-
console.log(color(" \u2551"));
|
|
198
|
-
console.log(color(" \u2551") + chalk.gray(" Description:"));
|
|
199
|
-
const descLines = wrapText(item.description || "No description", 54);
|
|
200
|
-
for (const line of descLines) {
|
|
201
|
-
console.log(color(" \u2551") + chalk.white(` ${line}`));
|
|
202
|
-
}
|
|
203
|
-
if (item.implementation) {
|
|
204
|
-
console.log(color(" \u2551"));
|
|
205
|
-
console.log(color(" \u2551") + chalk.gray(" Implementation:"));
|
|
206
|
-
const implLines = wrapText(item.implementation, 54);
|
|
207
|
-
for (const line of implLines) {
|
|
208
|
-
console.log(color(" \u2551") + chalk.white(` ${line}`));
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
console.log(color(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
212
|
-
console.log("");
|
|
213
|
-
const { action } = await inquirer.prompt([
|
|
214
|
-
{
|
|
215
|
-
type: "select",
|
|
216
|
-
name: "action",
|
|
217
|
-
message: "What do you want to do?",
|
|
218
|
-
choices: [
|
|
219
|
-
{ name: chalk.green(" \u{1F527} Implement this fix"), value: "implement" },
|
|
220
|
-
{ name: chalk.red(" \u{1F5D1}\uFE0F Dismiss"), value: "dismiss" },
|
|
221
|
-
{ name: chalk.gray(" \u2190 Back to list"), value: "back" }
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
]);
|
|
225
|
-
return action;
|
|
226
|
-
}
|
|
227
|
-
async function handleImplement(item, config) {
|
|
228
|
-
console.log("");
|
|
229
|
-
console.log(chalk.cyan(" \u{1F527} Implementing fix..."));
|
|
230
|
-
console.log("");
|
|
231
|
-
if (config.provider === "local" && config.localEndpoint) {
|
|
232
|
-
const fileContent = readFileContent(item.filePath);
|
|
233
|
-
if (!fileContent) {
|
|
234
|
-
console.log(chalk.red(` \u274C Could not read file: ${item.filePath}`));
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const prompt = `You are an expert programmer implementing a specific code change.
|
|
238
|
-
|
|
239
|
-
CURRENT FILE: ${item.filePath}
|
|
240
|
-
${fileContent}
|
|
241
|
-
|
|
242
|
-
CHANGE TO IMPLEMENT:
|
|
243
|
-
Title: ${item.title}
|
|
244
|
-
Description: ${item.description}
|
|
245
|
-
Implementation Instructions: ${item.implementation || "Apply the fix described above."}
|
|
246
|
-
|
|
247
|
-
RULES:
|
|
248
|
-
- Return ONLY the complete updated file content with the change applied.
|
|
249
|
-
- Start the code with: // File: ${item.filePath}
|
|
250
|
-
- PRESERVE all existing code structure. Only change what's needed.
|
|
251
|
-
- Do NOT include any explanation outside the code.`;
|
|
252
|
-
try {
|
|
253
|
-
const messages = [
|
|
254
|
-
{ role: "system", content: "You are an expert programmer. Return ONLY the complete updated file. Start with // File: path comment. Preserve existing structure." },
|
|
255
|
-
{ role: "user", content: prompt }
|
|
256
|
-
];
|
|
257
|
-
const response = await callLocalModel(config.localEndpoint, messages);
|
|
258
|
-
const lines = response.split("\n");
|
|
259
|
-
const firstLine = lines[0].trim();
|
|
260
|
-
let newContent;
|
|
261
|
-
if (firstLine.match(/^\/\/\s*(File:)?\s*/)) {
|
|
262
|
-
newContent = lines.slice(1).join("\n").trim();
|
|
263
|
-
} else {
|
|
264
|
-
newContent = response.trim();
|
|
265
|
-
}
|
|
266
|
-
await proposeAndWriteFile({
|
|
267
|
-
filePath: item.filePath,
|
|
268
|
-
content: newContent,
|
|
269
|
-
isNew: false
|
|
270
|
-
});
|
|
271
|
-
} catch (error) {
|
|
272
|
-
console.log(chalk.red(` \u274C Implementation failed: ${error.message}`));
|
|
273
|
-
}
|
|
274
|
-
} else if (config.loggedIn && config.conversationId) {
|
|
275
|
-
try {
|
|
276
|
-
const result = await callCloudFunction("implementSuggestion", {
|
|
277
|
-
conversationId: config.conversationId,
|
|
278
|
-
filePath: item.filePath,
|
|
279
|
-
suggestionId: item.id || "unknown",
|
|
280
|
-
category: "bugs",
|
|
281
|
-
jobId: `cli_impl_${Date.now()}`
|
|
282
|
-
});
|
|
283
|
-
if (result?.success) {
|
|
284
|
-
console.log(chalk.green(` \u2705 ${result.message}`));
|
|
285
|
-
} else {
|
|
286
|
-
console.log(chalk.red(" \u274C Implementation failed on platform."));
|
|
287
|
-
}
|
|
288
|
-
} catch (error) {
|
|
289
|
-
console.log(chalk.red(` \u274C ${error.message}`));
|
|
290
|
-
}
|
|
291
|
-
} else {
|
|
292
|
-
console.log(chalk.red(" \u274C No provider configured for implementation."));
|
|
293
|
-
}
|
|
294
|
-
console.log("");
|
|
295
|
-
}
|
|
296
|
-
function sortSuggestions(suggestions, method) {
|
|
297
|
-
if (method === "file") {
|
|
298
|
-
suggestions.sort((a, b) => (a.filePath || "").localeCompare(b.filePath || ""));
|
|
299
|
-
} else {
|
|
300
|
-
const priorityMap = { "critical": 0, "high": 1, "medium": 2, "low": 3 };
|
|
301
|
-
suggestions.sort((a, b) => {
|
|
302
|
-
const pA = priorityMap[a.priority?.toLowerCase()] ?? 99;
|
|
303
|
-
const pB = priorityMap[b.priority?.toLowerCase()] ?? 99;
|
|
304
|
-
return pA - pB;
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function loadLocalSuggestions(category) {
|
|
309
|
-
const cwd = process.cwd();
|
|
310
|
-
const { analysisDir } = ensureProjectStructure(cwd);
|
|
311
|
-
const analysisPath = path.join(analysisDir, "results", "analysis.json");
|
|
312
|
-
if (!fs.existsSync(analysisPath)) return [];
|
|
313
|
-
const allResults = JSON.parse(fs.readFileSync(analysisPath, "utf-8"));
|
|
314
|
-
const suggestions = [];
|
|
315
|
-
for (const [filePath, fileResults] of Object.entries(allResults)) {
|
|
316
|
-
const items = fileResults[category] || [];
|
|
317
|
-
suggestions.push(...items.map((item, idx) => ({
|
|
318
|
-
...item,
|
|
319
|
-
filePath,
|
|
320
|
-
id: `${filePath.replace(/[\/\\]/g, "_")}_${idx}`
|
|
321
|
-
})));
|
|
322
|
-
}
|
|
323
|
-
return suggestions;
|
|
324
|
-
}
|
|
325
|
-
function wrapText(text, maxWidth) {
|
|
326
|
-
const words = text.split(" ");
|
|
327
|
-
const lines = [];
|
|
328
|
-
let currentLine = "";
|
|
329
|
-
for (const word of words) {
|
|
330
|
-
if (currentLine.length + word.length + 1 > maxWidth) {
|
|
331
|
-
lines.push(currentLine);
|
|
332
|
-
currentLine = word;
|
|
333
|
-
} else {
|
|
334
|
-
currentLine += (currentLine ? " " : "") + word;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
if (currentLine) lines.push(currentLine);
|
|
338
|
-
return lines;
|
|
339
|
-
}
|
|
340
|
-
export {
|
|
341
|
-
showInteractiveResults
|
|
342
|
-
};
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
callCloudFunction,
|
|
3
|
-
callLocalModel,
|
|
4
|
-
ensureProjectStructure,
|
|
5
|
-
proposeAndWriteFile,
|
|
6
|
-
readFileContent
|
|
7
|
-
} from "./chunk-6W7WDF4Q.js";
|
|
8
|
-
|
|
9
|
-
// src/commands/analyse-results.ts
|
|
10
|
-
import chalk from "chalk";
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
var RED = chalk.hex("#EF5350");
|
|
14
|
-
var PURPLE = chalk.hex("#AB47BC");
|
|
15
|
-
var BLUE = chalk.hex("#42A5F5");
|
|
16
|
-
var TEAL = chalk.hex("#26A69A");
|
|
17
|
-
var AMBER = chalk.hex("#FFAB00");
|
|
18
|
-
var GRAY = chalk.gray;
|
|
19
|
-
var BORDER = chalk.hex("#455A64");
|
|
20
|
-
var HIGHLIGHT = chalk.hex("#FFAB00");
|
|
21
|
-
var PRIORITY_COLORS = {
|
|
22
|
-
"critical": chalk.bgHex("#B71C1C").white,
|
|
23
|
-
"high": chalk.hex("#FF6D00"),
|
|
24
|
-
"medium": chalk.hex("#FFA726"),
|
|
25
|
-
"low": chalk.hex("#66BB6A")
|
|
26
|
-
};
|
|
27
|
-
var CATEGORY_COLORS = {
|
|
28
|
-
"bugs": RED,
|
|
29
|
-
"features": PURPLE,
|
|
30
|
-
"improvements": BLUE,
|
|
31
|
-
"upgrades": TEAL
|
|
32
|
-
};
|
|
33
|
-
var PAGE_SIZE = 5;
|
|
34
|
-
async function showInteractiveResults(config, category, sort, search) {
|
|
35
|
-
let suggestions = [];
|
|
36
|
-
if (config.tier === "platform" && config.provider !== "local" && config.loggedIn && config.conversationId) {
|
|
37
|
-
try {
|
|
38
|
-
const result = await callCloudFunction("getCLIAnalysisResults", {
|
|
39
|
-
conversationId: config.conversationId,
|
|
40
|
-
category,
|
|
41
|
-
sort: sort || "priority",
|
|
42
|
-
search: search || null
|
|
43
|
-
});
|
|
44
|
-
suggestions = result?.suggestions || [];
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.log(chalk.red(` \u274C ${error.message}`));
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
suggestions = loadLocalSuggestions(category);
|
|
51
|
-
}
|
|
52
|
-
if (search) {
|
|
53
|
-
const query = search.toLowerCase();
|
|
54
|
-
suggestions = suggestions.filter(
|
|
55
|
-
(s) => (s.description || "").toLowerCase().includes(query) || (s.title || "").toLowerCase().includes(query) || (s.filePath || "").toLowerCase().includes(query)
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
if (sort === "file") {
|
|
59
|
-
suggestions.sort((a, b) => (a.filePath || "").localeCompare(b.filePath || ""));
|
|
60
|
-
} else {
|
|
61
|
-
const priorityMap = { "critical": 0, "high": 1, "medium": 2, "low": 3 };
|
|
62
|
-
suggestions.sort((a, b) => {
|
|
63
|
-
const pA = priorityMap[a.priority?.toLowerCase()] ?? 99;
|
|
64
|
-
const pB = priorityMap[b.priority?.toLowerCase()] ?? 99;
|
|
65
|
-
return pA - pB;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (suggestions.length === 0) {
|
|
69
|
-
console.log("");
|
|
70
|
-
console.log(chalk.green(" \u2705 No items found. Clean!"));
|
|
71
|
-
console.log("");
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
await interactiveSelector(suggestions, category, config);
|
|
75
|
-
}
|
|
76
|
-
async function interactiveSelector(suggestions, category, config) {
|
|
77
|
-
let selectedIndex = 0;
|
|
78
|
-
let page = 0;
|
|
79
|
-
const totalPages = Math.ceil(suggestions.length / PAGE_SIZE);
|
|
80
|
-
const color = CATEGORY_COLORS[category] || GRAY;
|
|
81
|
-
let lastRenderLines = 0;
|
|
82
|
-
const render = () => {
|
|
83
|
-
const start = page * PAGE_SIZE;
|
|
84
|
-
const end = Math.min(start + PAGE_SIZE, suggestions.length);
|
|
85
|
-
const pageItems = suggestions.slice(start, end);
|
|
86
|
-
let out = "\n";
|
|
87
|
-
out += color(` \u25C6 ${category.toUpperCase()} (${suggestions.length} items) \u2014 Page ${page + 1}/${totalPages}
|
|
88
|
-
`);
|
|
89
|
-
out += GRAY(" \u2191\u2193 Navigate | Enter: Expand | n: Next page | p: Prev | q: Quit\n");
|
|
90
|
-
out += GRAY(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n");
|
|
91
|
-
for (let i = 0; i < pageItems.length; i++) {
|
|
92
|
-
const item = pageItems[i];
|
|
93
|
-
const globalIndex = start + i;
|
|
94
|
-
const isSelected = globalIndex === selectedIndex;
|
|
95
|
-
const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
|
|
96
|
-
const priorityLabel = (item.priority || "MEDIUM").toUpperCase().padEnd(8);
|
|
97
|
-
const filePath = (item.filePath || "unknown").slice(-28).padStart(28);
|
|
98
|
-
const description = (item.description || item.title || "No description").slice(0, 52).padEnd(52);
|
|
99
|
-
if (isSelected) {
|
|
100
|
-
out += HIGHLIGHT(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n");
|
|
101
|
-
out += HIGHLIGHT(" \u2551 ") + pColor(priorityLabel) + " ".repeat(22) + chalk.cyan(filePath) + HIGHLIGHT(" \u2551\n");
|
|
102
|
-
out += HIGHLIGHT(" \u2551 ") + chalk.white(description) + HIGHLIGHT(" \u2551\n");
|
|
103
|
-
out += HIGHLIGHT(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
|
|
104
|
-
} else {
|
|
105
|
-
out += BORDER(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n");
|
|
106
|
-
out += BORDER(" \u2502 ") + pColor(priorityLabel) + " ".repeat(22) + chalk.cyan(filePath) + BORDER(" \u2502\n");
|
|
107
|
-
out += BORDER(" \u2502 ") + chalk.white(description) + BORDER(" \u2502\n");
|
|
108
|
-
out += BORDER(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n");
|
|
109
|
-
}
|
|
110
|
-
out += "\n";
|
|
111
|
-
}
|
|
112
|
-
if (lastRenderLines > 0) {
|
|
113
|
-
process.stdout.write(`\x1B[${lastRenderLines}A\x1B[G\x1B[J`);
|
|
114
|
-
}
|
|
115
|
-
process.stdout.write(out);
|
|
116
|
-
lastRenderLines = out.split("\n").length - 1;
|
|
117
|
-
};
|
|
118
|
-
render();
|
|
119
|
-
return new Promise((resolve) => {
|
|
120
|
-
if (!process.stdin.isTTY) {
|
|
121
|
-
console.log(GRAY(" (Interactive mode requires a TTY terminal)"));
|
|
122
|
-
resolve();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
process.stdin.setRawMode(true);
|
|
126
|
-
process.stdin.resume();
|
|
127
|
-
process.stdin.setEncoding("utf8");
|
|
128
|
-
const onKey = async (key) => {
|
|
129
|
-
const pageStart = page * PAGE_SIZE;
|
|
130
|
-
const pageEnd = Math.min(pageStart + PAGE_SIZE, suggestions.length) - 1;
|
|
131
|
-
if (key === "" || key === "q") {
|
|
132
|
-
cleanup();
|
|
133
|
-
console.log("");
|
|
134
|
-
resolve();
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (key === "\x1B[A") {
|
|
138
|
-
if (selectedIndex > pageStart) selectedIndex--;
|
|
139
|
-
render();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (key === "\x1B[B") {
|
|
143
|
-
if (selectedIndex < pageEnd) selectedIndex++;
|
|
144
|
-
render();
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (key === "n" && page < totalPages - 1) {
|
|
148
|
-
page++;
|
|
149
|
-
selectedIndex = page * PAGE_SIZE;
|
|
150
|
-
render();
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (key === "p" && page > 0) {
|
|
154
|
-
page--;
|
|
155
|
-
selectedIndex = page * PAGE_SIZE;
|
|
156
|
-
render();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (key === "\r" || key === "\n") {
|
|
160
|
-
cleanup();
|
|
161
|
-
if (lastRenderLines > 0) {
|
|
162
|
-
process.stdout.write(`\x1B[${lastRenderLines}A\x1B[G\x1B[J`);
|
|
163
|
-
lastRenderLines = 0;
|
|
164
|
-
}
|
|
165
|
-
const selected = suggestions[selectedIndex];
|
|
166
|
-
await showExpandedView(selected, category, config);
|
|
167
|
-
process.stdin.setRawMode(true);
|
|
168
|
-
process.stdin.resume();
|
|
169
|
-
process.stdin.on("data", onKey);
|
|
170
|
-
render();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
const cleanup = () => {
|
|
175
|
-
process.stdin.setRawMode(false);
|
|
176
|
-
process.stdin.pause();
|
|
177
|
-
process.stdin.removeListener("data", onKey);
|
|
178
|
-
};
|
|
179
|
-
process.stdin.on("data", onKey);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async function showExpandedView(item, category, config) {
|
|
183
|
-
const color = CATEGORY_COLORS[category] || GRAY;
|
|
184
|
-
const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
|
|
185
|
-
let out = "\n";
|
|
186
|
-
out += color(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n");
|
|
187
|
-
const headerText = `${(item.priority || "MEDIUM").toUpperCase()} ${category.toUpperCase().slice(0, -1)}`;
|
|
188
|
-
const headerPad = " ".repeat(58 - headerText.length);
|
|
189
|
-
out += color(" \u2551 ") + pColor(headerText) + color(headerPad + " \u2551\n");
|
|
190
|
-
out += color(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n");
|
|
191
|
-
const printRow = (label, value, valueColor) => {
|
|
192
|
-
const rawVisibleString = ` ${label}${value}`;
|
|
193
|
-
const padding = " ".repeat(Math.max(0, 58 - rawVisibleString.length));
|
|
194
|
-
out += color(" \u2551") + chalk.gray(` ${label}`) + valueColor(value) + color(padding + "\u2551\n");
|
|
195
|
-
};
|
|
196
|
-
printRow("File: ", item.filePath || "unknown", chalk.cyan);
|
|
197
|
-
printRow("Priority: ", (item.priority || "medium").toUpperCase(), pColor);
|
|
198
|
-
printRow("", "", chalk.white);
|
|
199
|
-
printRow("Title:", "", chalk.white);
|
|
200
|
-
printRow("", item.title || "No title", chalk.white);
|
|
201
|
-
printRow("", "", chalk.white);
|
|
202
|
-
printRow("Description:", "", chalk.white);
|
|
203
|
-
const descLines = wrapText(item.description || "No description", 54);
|
|
204
|
-
for (const line of descLines) {
|
|
205
|
-
printRow("", line, chalk.white);
|
|
206
|
-
}
|
|
207
|
-
if (item.implementation) {
|
|
208
|
-
printRow("", "", chalk.white);
|
|
209
|
-
printRow("Implementation:", "", chalk.white);
|
|
210
|
-
const implLines = wrapText(item.implementation, 54);
|
|
211
|
-
for (const line of implLines) {
|
|
212
|
-
printRow("", line, chalk.white);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
printRow("", "", chalk.white);
|
|
216
|
-
out += color(" \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n");
|
|
217
|
-
const footerText = " [i] Implement [d] Dismiss [esc] Back";
|
|
218
|
-
const footerPad = " ".repeat(58 - footerText.length);
|
|
219
|
-
out += color(" \u2551") + chalk.white(footerText) + color(footerPad + "\u2551\n");
|
|
220
|
-
out += color(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
|
|
221
|
-
process.stdout.write(out);
|
|
222
|
-
const linesPrinted = out.split("\n").length - 1;
|
|
223
|
-
return new Promise((resolve) => {
|
|
224
|
-
process.stdin.setRawMode(true);
|
|
225
|
-
process.stdin.resume();
|
|
226
|
-
const handler = async (key) => {
|
|
227
|
-
process.stdin.removeListener("data", handler);
|
|
228
|
-
process.stdin.setRawMode(false);
|
|
229
|
-
process.stdin.pause();
|
|
230
|
-
process.stdout.write(`\x1B[${linesPrinted}A\x1B[G\x1B[J`);
|
|
231
|
-
if (key === "i") {
|
|
232
|
-
await handleImplement(item, config);
|
|
233
|
-
} else if (key === "d") {
|
|
234
|
-
console.log(chalk.gray(" \u23ED\uFE0F Dismissed.\n"));
|
|
235
|
-
}
|
|
236
|
-
resolve();
|
|
237
|
-
};
|
|
238
|
-
process.stdin.on("data", handler);
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
async function handleImplement(item, config) {
|
|
242
|
-
console.log("");
|
|
243
|
-
console.log(chalk.cyan(" \u{1F527} Implementing fix..."));
|
|
244
|
-
if (config.provider === "local" && config.localEndpoint) {
|
|
245
|
-
const fileContent = readFileContent(item.filePath);
|
|
246
|
-
if (!fileContent) {
|
|
247
|
-
console.log(chalk.red(` \u274C Could not read file: ${item.filePath}`));
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
const prompt = `You are an expert programmer implementing a specific code change.
|
|
251
|
-
|
|
252
|
-
CURRENT FILE: ${item.filePath}
|
|
253
|
-
${fileContent}
|
|
254
|
-
|
|
255
|
-
CHANGE TO IMPLEMENT:
|
|
256
|
-
Title: ${item.title}
|
|
257
|
-
Description: ${item.description}
|
|
258
|
-
Implementation Instructions: ${item.implementation || "Apply the fix described above."}
|
|
259
|
-
|
|
260
|
-
Return ONLY the complete updated file content with the change applied.
|
|
261
|
-
Start with: // File: ${item.filePath}
|
|
262
|
-
Do not include explanations outside the code.`;
|
|
263
|
-
try {
|
|
264
|
-
const messages = [
|
|
265
|
-
{ role: "system", content: "You are an expert programmer. Return ONLY the complete updated file. Start with // File: path comment." },
|
|
266
|
-
{ role: "user", content: prompt }
|
|
267
|
-
];
|
|
268
|
-
const response = await callLocalModel(config.localEndpoint, messages);
|
|
269
|
-
const lines = response.split("\n");
|
|
270
|
-
const filePathLine = lines[0];
|
|
271
|
-
let newContent;
|
|
272
|
-
if (filePathLine.match(/^\/\/\s*(File:)?\s*/)) {
|
|
273
|
-
newContent = lines.slice(1).join("\n").trim();
|
|
274
|
-
} else {
|
|
275
|
-
newContent = response.trim();
|
|
276
|
-
}
|
|
277
|
-
await proposeAndWriteFile({
|
|
278
|
-
filePath: item.filePath,
|
|
279
|
-
content: newContent,
|
|
280
|
-
isNew: false
|
|
281
|
-
});
|
|
282
|
-
} catch (error) {
|
|
283
|
-
console.log(chalk.red(` \u274C Implementation failed: ${error.message}`));
|
|
284
|
-
}
|
|
285
|
-
} else if (config.loggedIn && config.conversationId) {
|
|
286
|
-
try {
|
|
287
|
-
const result = await callCloudFunction("implementSuggestion", {
|
|
288
|
-
conversationId: config.conversationId,
|
|
289
|
-
filePath: item.filePath,
|
|
290
|
-
suggestionId: item.id || "unknown",
|
|
291
|
-
category: "bugs",
|
|
292
|
-
// TODO: pass actual category
|
|
293
|
-
jobId: `cli_impl_${Date.now()}`
|
|
294
|
-
});
|
|
295
|
-
if (result?.success) {
|
|
296
|
-
console.log(chalk.green(` \u2705 ${result.message}`));
|
|
297
|
-
} else {
|
|
298
|
-
console.log(chalk.red(" \u274C Implementation failed on platform."));
|
|
299
|
-
}
|
|
300
|
-
} catch (error) {
|
|
301
|
-
console.log(chalk.red(` \u274C ${error.message}`));
|
|
302
|
-
}
|
|
303
|
-
} else {
|
|
304
|
-
console.log(chalk.red(" \u274C No provider configured for implementation."));
|
|
305
|
-
}
|
|
306
|
-
console.log("");
|
|
307
|
-
}
|
|
308
|
-
function loadLocalSuggestions(category) {
|
|
309
|
-
const cwd = process.cwd();
|
|
310
|
-
const { analysisDir } = ensureProjectStructure(cwd);
|
|
311
|
-
const analysisPath = path.join(analysisDir, "results", "analysis.json");
|
|
312
|
-
if (!fs.existsSync(analysisPath)) return [];
|
|
313
|
-
const allResults = JSON.parse(fs.readFileSync(analysisPath, "utf-8"));
|
|
314
|
-
const suggestions = [];
|
|
315
|
-
for (const [filePath, fileResults] of Object.entries(allResults)) {
|
|
316
|
-
const items = fileResults[category] || [];
|
|
317
|
-
suggestions.push(...items.map((item) => ({ ...item, filePath })));
|
|
318
|
-
}
|
|
319
|
-
return suggestions;
|
|
320
|
-
}
|
|
321
|
-
function wrapText(text, maxWidth) {
|
|
322
|
-
const words = text.split(" ");
|
|
323
|
-
const lines = [];
|
|
324
|
-
let currentLine = "";
|
|
325
|
-
for (const word of words) {
|
|
326
|
-
if (currentLine.length + word.length + 1 > maxWidth) {
|
|
327
|
-
lines.push(currentLine);
|
|
328
|
-
currentLine = word;
|
|
329
|
-
} else {
|
|
330
|
-
currentLine += (currentLine ? " " : "") + word;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (currentLine) lines.push(currentLine);
|
|
334
|
-
return lines;
|
|
335
|
-
}
|
|
336
|
-
export {
|
|
337
|
-
showInteractiveResults
|
|
338
|
-
};
|