@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.
Files changed (36) hide show
  1. package/dist/bin/{analyse-auto-OBCDWYWX.js → analyse-auto-KKWLMLHZ.js} +2 -1
  2. package/dist/bin/{analyse-results-QSOD3KVC.js → analyse-results-N5QLJNND.js} +2 -1
  3. package/dist/bin/bob.js +4 -3
  4. package/dist/bin/{chunk-LHWBSCJ4.js → chunk-WEHSNZKO.js} +2 -0
  5. package/package.json +11 -5
  6. package/bin/bob.ts +0 -74
  7. package/dist/bin/analyse-auto-AAWSETKY.js +0 -540
  8. package/dist/bin/analyse-auto-FQ62GYPV.js +0 -533
  9. package/dist/bin/analyse-auto-JAD24IQ5.js +0 -511
  10. package/dist/bin/analyse-auto-R4MZA7SX.js +0 -511
  11. package/dist/bin/analyse-auto-V3SH4MS7.js +0 -524
  12. package/dist/bin/analyse-auto-WQUK5YPO.js +0 -531
  13. package/dist/bin/analyse-auto-WVAY6467.js +0 -280
  14. package/dist/bin/analyse-results-3NSD6MAY.js +0 -363
  15. package/dist/bin/analyse-results-B7LONUXU.js +0 -265
  16. package/dist/bin/analyse-results-E6NBAVDB.js +0 -265
  17. package/dist/bin/analyse-results-FIDS4635.js +0 -9
  18. package/dist/bin/analyse-results-LMGVKAUX.js +0 -342
  19. package/dist/bin/analyse-results-LSMLUEIB.js +0 -338
  20. package/dist/bin/analyse-results-MOCLBCD7.js +0 -326
  21. package/dist/bin/analyse-results-NLAEAOOP.js +0 -10
  22. package/dist/bin/analyse-results-PYQIKWYL.js +0 -9
  23. package/dist/bin/analyse-results-R3MG5H7G.js +0 -329
  24. package/dist/bin/analyse-results-UYZZSBHB.js +0 -9
  25. package/dist/bin/analyse-results-YYGHIK2Q.js +0 -9
  26. package/dist/bin/analysis-tracker-N5VANTLH.js +0 -12
  27. package/dist/bin/chunk-3RSDDQE2.js +0 -420
  28. package/dist/bin/chunk-6KWC4HDO.js +0 -97
  29. package/dist/bin/chunk-6W7WDF4Q.js +0 -589
  30. package/dist/bin/chunk-7CXM3RLM.js +0 -287
  31. package/dist/bin/chunk-FGYL6SWO.js +0 -465
  32. package/dist/bin/chunk-J4BSKFCW.js +0 -624
  33. package/dist/bin/chunk-KWOQFI6L.js +0 -287
  34. package/dist/bin/chunk-OOGLZ2QB.js +0 -322
  35. package/dist/bin/chunk-TEVQLSGD.js +0 -287
  36. package/dist/bin/chunk-VUS7R7SO.js +0 -479
@@ -1,287 +0,0 @@
1
- import {
2
- callCloudFunction,
3
- callLocalModel,
4
- ensureProjectStructure,
5
- proposeAndWriteFile,
6
- readFileContent
7
- } from "./chunk-J4BSKFCW.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
- while (running) {
69
- console.log("");
70
- console.log(color(` \u25C6 ${category.toUpperCase()} (${displaySuggestions.length} items) | Sort: ${currentSort}`));
71
- 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"));
72
- console.log("");
73
- const choices = displaySuggestions.map((item, idx) => {
74
- const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
75
- const priorityLabel = (item.priority || "MEDIUM").toUpperCase().padEnd(9);
76
- const filePath = (item.filePath || "unknown").split("/").pop() || "unknown";
77
- const desc = (item.description || item.title || "No description").slice(0, 42);
78
- const displayName = `${pColor(priorityLabel)} ${chalk.cyan(filePath.padEnd(18))} ${chalk.white(desc)}`;
79
- return {
80
- name: displayName,
81
- value: idx,
82
- short: item.title || item.description?.slice(0, 30) || "Item",
83
- // Used for search matching
84
- description: `${item.priority} ${item.filePath} ${item.title} ${item.description}`
85
- };
86
- });
87
- const { selected } = await inquirer.prompt([
88
- {
89
- type: "search",
90
- name: "selected",
91
- message: color(`Search ${category} (type to filter, arrows to navigate):`),
92
- source: (input) => {
93
- if (!input) return [...choices, { name: chalk.cyan(" \u{1F500} Toggle sort"), value: "__sort__", short: "Sort" }, { name: chalk.gray(" \u2190 Quit"), value: "__quit__", short: "Quit" }];
94
- const query = input.toLowerCase();
95
- const filtered = choices.filter((c) => {
96
- const searchable = c.description?.toLowerCase() || "";
97
- return searchable.includes(query);
98
- });
99
- return [...filtered, { name: chalk.gray(" \u2190 Quit"), value: "__quit__", short: "Quit" }];
100
- },
101
- pageSize: 12
102
- }
103
- ]);
104
- if (selected === "__quit__") {
105
- running = false;
106
- break;
107
- }
108
- if (selected === "__sort__") {
109
- currentSort = currentSort === "priority" ? "file" : "priority";
110
- sortSuggestions(displaySuggestions, currentSort);
111
- console.log(chalk.cyan(` Sort changed to: ${currentSort}`));
112
- continue;
113
- }
114
- if (typeof selected === "number") {
115
- const item = displaySuggestions[selected];
116
- const action = await showExpandedView(item, category);
117
- if (action === "implement") {
118
- await handleImplement(item, config);
119
- } else if (action === "dismiss") {
120
- displaySuggestions.splice(selected, 1);
121
- const originalIdx = allSuggestions.findIndex((s) => s.id === item.id);
122
- if (originalIdx !== -1) allSuggestions.splice(originalIdx, 1);
123
- console.log(chalk.gray(" \u23ED\uFE0F Dismissed."));
124
- }
125
- }
126
- }
127
- }
128
- async function showExpandedView(item, category) {
129
- const color = CATEGORY_COLORS[category] || GRAY;
130
- const pColor = PRIORITY_COLORS[item.priority?.toLowerCase()] || GRAY;
131
- console.log("");
132
- 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"));
133
- console.log(color(" \u2551 ") + pColor(`${(item.priority || "MEDIUM").toUpperCase()} ${category.toUpperCase().slice(0, -1)}`));
134
- 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"));
135
- console.log(color(" \u2551") + chalk.gray(" File: ") + chalk.cyan(item.filePath || "unknown"));
136
- console.log(color(" \u2551") + chalk.gray(" Priority: ") + pColor((item.priority || "medium").toUpperCase()));
137
- console.log(color(" \u2551"));
138
- console.log(color(" \u2551") + chalk.gray(" Title:"));
139
- console.log(color(" \u2551") + chalk.white.bold(` ${item.title || "No title"}`));
140
- console.log(color(" \u2551"));
141
- console.log(color(" \u2551") + chalk.gray(" Description:"));
142
- const descLines = wrapText(item.description || "No description", 54);
143
- for (const line of descLines) {
144
- console.log(color(" \u2551") + chalk.white(` ${line}`));
145
- }
146
- if (item.implementation) {
147
- console.log(color(" \u2551"));
148
- console.log(color(" \u2551") + chalk.gray(" Implementation:"));
149
- const implLines = wrapText(item.implementation, 54);
150
- for (const line of implLines) {
151
- console.log(color(" \u2551") + chalk.white(` ${line}`));
152
- }
153
- }
154
- 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"));
155
- console.log("");
156
- const { action } = await inquirer.prompt([
157
- {
158
- type: "select",
159
- name: "action",
160
- message: "What do you want to do?",
161
- choices: [
162
- { name: chalk.green(" \u{1F527} Implement this fix"), value: "implement" },
163
- { name: chalk.red(" \u{1F5D1}\uFE0F Dismiss"), value: "dismiss" },
164
- { name: chalk.gray(" \u2190 Back to list"), value: "back" }
165
- ]
166
- }
167
- ]);
168
- return action;
169
- }
170
- async function handleImplement(item, config) {
171
- console.log("");
172
- console.log(chalk.cyan(" \u{1F527} Implementing fix..."));
173
- console.log("");
174
- if (config.provider === "local" && config.localEndpoint) {
175
- const fileContent = readFileContent(item.filePath);
176
- if (!fileContent) {
177
- console.log(chalk.red(` \u274C Could not read file: ${item.filePath}`));
178
- return;
179
- }
180
- const prompt = `You are an expert programmer implementing a specific code change.
181
-
182
- CURRENT FILE: ${item.filePath}
183
- ${fileContent}
184
-
185
- CHANGE TO IMPLEMENT:
186
- Title: ${item.title}
187
- Description: ${item.description}
188
- Implementation Instructions: ${item.implementation || "Apply the fix described above."}
189
-
190
- RULES:
191
- - Return ONLY the complete updated file content with the change applied.
192
- - Start the code with: // File: ${item.filePath}
193
- - PRESERVE all existing code structure. Only change what's needed.
194
- - Do NOT include any explanation outside the code.`;
195
- try {
196
- const messages = [
197
- { role: "system", content: "You are an expert programmer. Return ONLY the complete updated file. Start with // File: path comment. Preserve existing structure." },
198
- { role: "user", content: prompt }
199
- ];
200
- const response = await callLocalModel(config.localEndpoint, messages);
201
- const lines = response.split("\n");
202
- const firstLine = lines[0].trim();
203
- let newContent;
204
- if (firstLine.match(/^\/\/\s*(File:)?\s*/)) {
205
- newContent = lines.slice(1).join("\n").trim();
206
- } else {
207
- newContent = response.trim();
208
- }
209
- await proposeAndWriteFile({
210
- filePath: item.filePath,
211
- content: newContent,
212
- isNew: false
213
- });
214
- } catch (error) {
215
- console.log(chalk.red(` \u274C Implementation failed: ${error.message}`));
216
- }
217
- } else if (config.loggedIn && config.conversationId) {
218
- try {
219
- const result = await callCloudFunction("implementSuggestion", {
220
- conversationId: config.conversationId,
221
- filePath: item.filePath,
222
- suggestionId: item.id || "unknown",
223
- category: "bugs",
224
- jobId: `cli_impl_${Date.now()}`
225
- });
226
- if (result?.success) {
227
- console.log(chalk.green(` \u2705 ${result.message}`));
228
- } else {
229
- console.log(chalk.red(" \u274C Implementation failed on platform."));
230
- }
231
- } catch (error) {
232
- console.log(chalk.red(` \u274C ${error.message}`));
233
- }
234
- } else {
235
- console.log(chalk.red(" \u274C No provider configured for implementation."));
236
- }
237
- console.log("");
238
- }
239
- function sortSuggestions(suggestions, method) {
240
- if (method === "file") {
241
- suggestions.sort((a, b) => (a.filePath || "").localeCompare(b.filePath || ""));
242
- } else {
243
- const priorityMap = { "critical": 0, "high": 1, "medium": 2, "low": 3 };
244
- suggestions.sort((a, b) => {
245
- const pA = priorityMap[a.priority?.toLowerCase()] ?? 99;
246
- const pB = priorityMap[b.priority?.toLowerCase()] ?? 99;
247
- return pA - pB;
248
- });
249
- }
250
- }
251
- function loadLocalSuggestions(category) {
252
- const cwd = process.cwd();
253
- const { analysisDir } = ensureProjectStructure(cwd);
254
- const analysisPath = path.join(analysisDir, "results", "analysis.json");
255
- if (!fs.existsSync(analysisPath)) return [];
256
- const allResults = JSON.parse(fs.readFileSync(analysisPath, "utf-8"));
257
- const suggestions = [];
258
- for (const [filePath, fileResults] of Object.entries(allResults)) {
259
- const items = fileResults[category] || [];
260
- suggestions.push(...items.map((item, idx) => ({
261
- ...item,
262
- filePath,
263
- id: `${filePath.replace(/[\/\\]/g, "_")}_${idx}`
264
- })));
265
- }
266
- return suggestions;
267
- }
268
- function wrapText(text, maxWidth) {
269
- const words = text.split(" ");
270
- const lines = [];
271
- let currentLine = "";
272
- for (const word of words) {
273
- if (currentLine.length + word.length + 1 > maxWidth) {
274
- lines.push(currentLine);
275
- currentLine = word;
276
- } else {
277
- currentLine += (currentLine ? " " : "") + word;
278
- }
279
- }
280
- if (currentLine) lines.push(currentLine);
281
- return lines;
282
- }
283
-
284
- export {
285
- showInteractiveResults,
286
- loadLocalSuggestions
287
- };