mcp-adr-analysis-server 2.7.30 → 2.7.32
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/.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/resources/adrs-review-resource.d.ts +0 -82
- package/dist/src/resources/adrs-review-resource.d.ts.map +0 -1
- package/dist/src/resources/adrs-review-resource.js +0 -160
- package/dist/src/resources/adrs-review-resource.js.map +0 -1
- package/dist/src/resources/architectural-context-resource.d.ts +0 -95
- package/dist/src/resources/architectural-context-resource.d.ts.map +0 -1
- package/dist/src/resources/architectural-context-resource.js +0 -428
- package/dist/src/resources/architectural-context-resource.js.map +0 -1
- package/dist/src/resources/memory-expand-resource.d.ts +0 -90
- package/dist/src/resources/memory-expand-resource.d.ts.map +0 -1
- package/dist/src/resources/memory-expand-resource.js +0 -176
- package/dist/src/resources/memory-expand-resource.js.map +0 -1
- package/dist/src/utils/bootstrap-task-integration.d.ts +0 -214
- package/dist/src/utils/bootstrap-task-integration.d.ts.map +0 -1
- package/dist/src/utils/bootstrap-task-integration.js +0 -365
- package/dist/src/utils/bootstrap-task-integration.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -9
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -13
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/interactive-approval.d.ts +0 -63
- package/dist/src/utils/interactive-approval.d.ts.map +0 -1
- package/dist/src/utils/interactive-approval.js +0 -445
- package/dist/src/utils/interactive-approval.js.map +0 -1
- package/dist/src/utils/llm-artifact-detector.d.ts +0 -76
- package/dist/src/utils/llm-artifact-detector.d.ts.map +0 -1
- package/dist/src/utils/llm-artifact-detector.js +0 -426
- package/dist/src/utils/llm-artifact-detector.js.map +0 -1
- package/dist/src/utils/location-filter.d.ts +0 -104
- package/dist/src/utils/location-filter.d.ts.map +0 -1
- package/dist/src/utils/location-filter.js +0 -593
- package/dist/src/utils/location-filter.js.map +0 -1
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive approval workflow for smart git push
|
|
3
|
-
*
|
|
4
|
-
* Handles user interaction for approving/rejecting files with issues
|
|
5
|
-
*/
|
|
6
|
-
import { createInterface } from 'readline';
|
|
7
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
8
|
-
/**
|
|
9
|
-
* Main interactive approval function
|
|
10
|
-
*/
|
|
11
|
-
export async function handleInteractiveApproval(items, options) {
|
|
12
|
-
const result = {
|
|
13
|
-
approved: [],
|
|
14
|
-
rejected: [],
|
|
15
|
-
moved: [],
|
|
16
|
-
ignored: [],
|
|
17
|
-
actions: [],
|
|
18
|
-
proceed: false,
|
|
19
|
-
};
|
|
20
|
-
if (items.length === 0) {
|
|
21
|
-
result.proceed = true;
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
// Handle non-interactive mode
|
|
25
|
-
if (!options.interactiveMode) {
|
|
26
|
-
return handleNonInteractiveApproval(items, options);
|
|
27
|
-
}
|
|
28
|
-
// Display summary
|
|
29
|
-
displayApprovalSummary(items);
|
|
30
|
-
// Group items by severity for better UX
|
|
31
|
-
const errorItems = items.filter(item => item.severity === 'error');
|
|
32
|
-
const warningItems = items.filter(item => item.severity === 'warning');
|
|
33
|
-
const infoItems = items.filter(item => item.severity === 'info');
|
|
34
|
-
// Handle errors first (these are most critical)
|
|
35
|
-
if (errorItems.length > 0) {
|
|
36
|
-
console.log('\n🚨 CRITICAL ISSUES (Must be resolved before proceeding)');
|
|
37
|
-
for (const item of errorItems) {
|
|
38
|
-
const action = await handleItemApproval(item, options, true);
|
|
39
|
-
result.actions.push(action);
|
|
40
|
-
applyAction(action, result);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Handle warnings
|
|
44
|
-
if (warningItems.length > 0) {
|
|
45
|
-
console.log('\n⚠️ WARNING ISSUES (Review recommended)');
|
|
46
|
-
for (const item of warningItems) {
|
|
47
|
-
const action = await handleItemApproval(item, options, false);
|
|
48
|
-
result.actions.push(action);
|
|
49
|
-
applyAction(action, result);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Handle info items (auto-approve if option set)
|
|
53
|
-
if (infoItems.length > 0) {
|
|
54
|
-
if (options.autoApproveInfo) {
|
|
55
|
-
console.log(`\n✅ Auto-approving ${infoItems.length} info-level items`);
|
|
56
|
-
for (const item of infoItems) {
|
|
57
|
-
const action = { type: 'approve', filePath: item.filePath };
|
|
58
|
-
result.actions.push(action);
|
|
59
|
-
applyAction(action, result);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
console.log('\n💡 INFO ITEMS (Low priority)');
|
|
64
|
-
for (const item of infoItems) {
|
|
65
|
-
const action = await handleItemApproval(item, options, false);
|
|
66
|
-
result.actions.push(action);
|
|
67
|
-
applyAction(action, result);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Final confirmation
|
|
72
|
-
result.proceed = await getFinalConfirmation(result, options);
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Handle non-interactive approval
|
|
77
|
-
*/
|
|
78
|
-
function handleNonInteractiveApproval(items, options) {
|
|
79
|
-
const result = {
|
|
80
|
-
approved: [],
|
|
81
|
-
rejected: [],
|
|
82
|
-
moved: [],
|
|
83
|
-
ignored: [],
|
|
84
|
-
actions: [],
|
|
85
|
-
proceed: false,
|
|
86
|
-
};
|
|
87
|
-
for (const item of items) {
|
|
88
|
-
let action;
|
|
89
|
-
if (item.severity === 'error' && options.autoRejectErrors) {
|
|
90
|
-
action = { type: 'reject', filePath: item.filePath, reason: 'Auto-rejected due to errors' };
|
|
91
|
-
}
|
|
92
|
-
else if (item.severity === 'info' && options.autoApproveInfo) {
|
|
93
|
-
action = { type: 'approve', filePath: item.filePath };
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
// Default behavior based on severity
|
|
97
|
-
switch (item.severity) {
|
|
98
|
-
case 'error':
|
|
99
|
-
action = {
|
|
100
|
-
type: 'reject',
|
|
101
|
-
filePath: item.filePath,
|
|
102
|
-
reason: 'Automatic rejection due to errors',
|
|
103
|
-
};
|
|
104
|
-
break;
|
|
105
|
-
case 'warning':
|
|
106
|
-
action = item.allowedInLocation
|
|
107
|
-
? { type: 'approve', filePath: item.filePath }
|
|
108
|
-
: { type: 'reject', filePath: item.filePath, reason: 'Location violation' };
|
|
109
|
-
break;
|
|
110
|
-
case 'info':
|
|
111
|
-
action = { type: 'approve', filePath: item.filePath };
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
result.actions.push(action);
|
|
116
|
-
applyAction(action, result);
|
|
117
|
-
}
|
|
118
|
-
// In non-interactive mode, proceed if no errors were rejected
|
|
119
|
-
result.proceed = result.rejected.length === 0;
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Handle approval for a single item
|
|
124
|
-
*/
|
|
125
|
-
async function handleItemApproval(item, options, isError) {
|
|
126
|
-
console.log(`\n📄 ${item.filePath}`);
|
|
127
|
-
console.log(` Severity: ${item.severity.toUpperCase()}`);
|
|
128
|
-
console.log(` Confidence: ${(item.confidence * 100).toFixed(1)}%`);
|
|
129
|
-
console.log(` Location Valid: ${item.allowedInLocation ? '✅' : '❌'}`);
|
|
130
|
-
// Display issues
|
|
131
|
-
console.log('\n Issues:');
|
|
132
|
-
for (const issue of item.issues) {
|
|
133
|
-
console.log(` - ${issue.severity.toUpperCase()}: ${issue.message}`);
|
|
134
|
-
if (issue.line) {
|
|
135
|
-
console.log(` Line ${issue.line}`);
|
|
136
|
-
}
|
|
137
|
-
if (issue.context) {
|
|
138
|
-
const contextLines = issue.context.split('\n').slice(0, 3);
|
|
139
|
-
console.log(` Context: ${contextLines.join(' | ')}`);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// Display suggestions
|
|
143
|
-
if (item.suggestions.length > 0) {
|
|
144
|
-
console.log('\n Suggestions:');
|
|
145
|
-
for (let i = 0; i < item.suggestions.length; i++) {
|
|
146
|
-
console.log(` ${i + 1}. ${item.suggestions[i]}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Get user choice
|
|
150
|
-
const choices = buildChoices(item, isError);
|
|
151
|
-
const choice = await getUserChoice(choices, options);
|
|
152
|
-
return processChoice(choice, item, options);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Build available choices for user
|
|
156
|
-
*/
|
|
157
|
-
function buildChoices(item, isError) {
|
|
158
|
-
const choices = [
|
|
159
|
-
{ key: 'a', description: 'Approve (include in commit)', available: !isError },
|
|
160
|
-
{ key: 'r', description: 'Reject (exclude from commit)', available: true },
|
|
161
|
-
{ key: 'i', description: 'Ignore (add to .gitignore)', available: true },
|
|
162
|
-
{ key: 'm', description: 'Move to different location', available: !item.allowedInLocation },
|
|
163
|
-
{ key: 'v', description: 'View file content', available: true },
|
|
164
|
-
{ key: 'e', description: 'Edit file', available: true },
|
|
165
|
-
{ key: 's', description: 'Skip for now', available: false }, // Not implemented yet
|
|
166
|
-
{ key: 'h', description: 'Show help', available: true },
|
|
167
|
-
];
|
|
168
|
-
return choices;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Get user choice
|
|
172
|
-
*/
|
|
173
|
-
async function getUserChoice(choices, options) {
|
|
174
|
-
const availableChoices = choices.filter(c => c.available);
|
|
175
|
-
console.log('\n Available actions:');
|
|
176
|
-
for (const choice of availableChoices) {
|
|
177
|
-
console.log(` [${choice.key}] ${choice.description}`);
|
|
178
|
-
}
|
|
179
|
-
if (options.batchMode) {
|
|
180
|
-
console.log(' [all] Apply to all similar files');
|
|
181
|
-
}
|
|
182
|
-
const rl = createInterface({
|
|
183
|
-
input: process.stdin,
|
|
184
|
-
output: process.stdout,
|
|
185
|
-
});
|
|
186
|
-
return new Promise(resolve => {
|
|
187
|
-
const askQuestion = () => {
|
|
188
|
-
rl.question('\n Your choice: ', answer => {
|
|
189
|
-
const choice = answer.trim().toLowerCase();
|
|
190
|
-
if (choice === 'h') {
|
|
191
|
-
displayHelp();
|
|
192
|
-
askQuestion();
|
|
193
|
-
}
|
|
194
|
-
else if (availableChoices.some(c => c.key === choice) || choice === 'all') {
|
|
195
|
-
rl.close();
|
|
196
|
-
resolve(choice);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
console.log(' Invalid choice. Please try again.');
|
|
200
|
-
askQuestion();
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
askQuestion();
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Process user choice into action
|
|
209
|
-
*/
|
|
210
|
-
function processChoice(choice, item, options) {
|
|
211
|
-
switch (choice) {
|
|
212
|
-
case 'a':
|
|
213
|
-
return { type: 'approve', filePath: item.filePath };
|
|
214
|
-
case 'r':
|
|
215
|
-
return { type: 'reject', filePath: item.filePath, reason: 'User rejected' };
|
|
216
|
-
case 'i':
|
|
217
|
-
return { type: 'ignore', filePath: item.filePath };
|
|
218
|
-
case 'm': {
|
|
219
|
-
const targetDir = getMoveTarget(item);
|
|
220
|
-
return { type: 'move', filePath: item.filePath, target: targetDir };
|
|
221
|
-
}
|
|
222
|
-
case 'v':
|
|
223
|
-
viewFileContent(item.filePath);
|
|
224
|
-
return processChoice(choice, item, options); // Re-prompt after viewing
|
|
225
|
-
case 'e':
|
|
226
|
-
editFile(item.filePath);
|
|
227
|
-
return processChoice(choice, item, options); // Re-prompt after editing
|
|
228
|
-
default:
|
|
229
|
-
return { type: 'reject', filePath: item.filePath, reason: 'Invalid choice' };
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Get move target from suggestions
|
|
234
|
-
*/
|
|
235
|
-
function getMoveTarget(item) {
|
|
236
|
-
const moveSuggestions = item.suggestions.filter(s => s.includes('Move') || s.includes('move'));
|
|
237
|
-
if (moveSuggestions.length > 0) {
|
|
238
|
-
console.log('\n Suggested locations:');
|
|
239
|
-
for (let i = 0; i < moveSuggestions.length; i++) {
|
|
240
|
-
console.log(` ${i + 1}. ${moveSuggestions[i]}`);
|
|
241
|
-
}
|
|
242
|
-
// For now, extract first suggested directory
|
|
243
|
-
const firstSuggestion = moveSuggestions[0];
|
|
244
|
-
if (firstSuggestion) {
|
|
245
|
-
const dirMatch = firstSuggestion.match(/(?:to|in)\s+(\w+\/)/);
|
|
246
|
-
return dirMatch ? dirMatch[1] : 'scripts/';
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return 'scripts/'; // Default fallback
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* View file content
|
|
253
|
-
*/
|
|
254
|
-
function viewFileContent(filePath) {
|
|
255
|
-
try {
|
|
256
|
-
const content = readFileSync(filePath, 'utf8');
|
|
257
|
-
const lines = content.split('\n');
|
|
258
|
-
console.log(`\n Content of ${filePath}:`);
|
|
259
|
-
console.log(' ' + '='.repeat(50));
|
|
260
|
-
// Show first 20 lines
|
|
261
|
-
for (let i = 0; i < Math.min(20, lines.length); i++) {
|
|
262
|
-
console.log(` ${(i + 1).toString().padStart(3)}: ${lines[i]}`);
|
|
263
|
-
}
|
|
264
|
-
if (lines.length > 20) {
|
|
265
|
-
console.log(` ... (${lines.length - 20} more lines)`);
|
|
266
|
-
}
|
|
267
|
-
console.log(' ' + '='.repeat(50));
|
|
268
|
-
}
|
|
269
|
-
catch (error) {
|
|
270
|
-
console.log(` Error reading file: ${error instanceof Error ? error.message : String(error)}`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Edit file (placeholder - would open in editor)
|
|
275
|
-
*/
|
|
276
|
-
function editFile(filePath) {
|
|
277
|
-
console.log(`\n Opening ${filePath} in editor...`);
|
|
278
|
-
console.log(' (This would open your default editor in a real implementation)');
|
|
279
|
-
console.log(' Press Enter to continue after editing...');
|
|
280
|
-
// In a real implementation, this would:
|
|
281
|
-
// 1. Open the file in the user's default editor
|
|
282
|
-
// 2. Wait for the editor to close
|
|
283
|
-
// 3. Re-analyze the file for issues
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Apply action to result
|
|
287
|
-
*/
|
|
288
|
-
function applyAction(action, result) {
|
|
289
|
-
switch (action.type) {
|
|
290
|
-
case 'approve':
|
|
291
|
-
result.approved.push(action.filePath);
|
|
292
|
-
break;
|
|
293
|
-
case 'reject':
|
|
294
|
-
result.rejected.push(action.filePath);
|
|
295
|
-
break;
|
|
296
|
-
case 'move':
|
|
297
|
-
if (action.target) {
|
|
298
|
-
result.moved.push({ from: action.filePath, to: action.target });
|
|
299
|
-
}
|
|
300
|
-
break;
|
|
301
|
-
case 'ignore':
|
|
302
|
-
result.ignored.push(action.filePath);
|
|
303
|
-
break;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Display approval summary
|
|
308
|
-
*/
|
|
309
|
-
function displayApprovalSummary(items) {
|
|
310
|
-
console.log('\n' + '='.repeat(60));
|
|
311
|
-
console.log('🔍 SMART GIT PUSH - VALIDATION RESULTS');
|
|
312
|
-
console.log('='.repeat(60));
|
|
313
|
-
const errorCount = items.filter(item => item.severity === 'error').length;
|
|
314
|
-
const warningCount = items.filter(item => item.severity === 'warning').length;
|
|
315
|
-
const infoCount = items.filter(item => item.severity === 'info').length;
|
|
316
|
-
console.log(`📊 Summary: ${items.length} files with issues`);
|
|
317
|
-
console.log(` 🚨 Errors: ${errorCount}`);
|
|
318
|
-
console.log(` ⚠️ Warnings: ${warningCount}`);
|
|
319
|
-
console.log(` 💡 Info: ${infoCount}`);
|
|
320
|
-
if (errorCount > 0) {
|
|
321
|
-
console.log('\n❌ Files with errors must be resolved before proceeding');
|
|
322
|
-
}
|
|
323
|
-
console.log('\n📋 Review each file and choose an action:');
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Get final confirmation
|
|
327
|
-
*/
|
|
328
|
-
async function getFinalConfirmation(result, options) {
|
|
329
|
-
console.log('\n' + '='.repeat(60));
|
|
330
|
-
console.log('📋 FINAL SUMMARY');
|
|
331
|
-
console.log('='.repeat(60));
|
|
332
|
-
console.log(`✅ Approved: ${result.approved.length} files`);
|
|
333
|
-
console.log(`❌ Rejected: ${result.rejected.length} files`);
|
|
334
|
-
console.log(`📁 To Move: ${result.moved.length} files`);
|
|
335
|
-
console.log(`🙈 To Ignore: ${result.ignored.length} files`);
|
|
336
|
-
if (result.approved.length > 0) {
|
|
337
|
-
console.log('\n✅ Files to be committed:');
|
|
338
|
-
for (const file of result.approved) {
|
|
339
|
-
console.log(` - ${file}`);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
if (result.rejected.length > 0) {
|
|
343
|
-
console.log('\n❌ Files excluded from commit:');
|
|
344
|
-
for (const file of result.rejected) {
|
|
345
|
-
console.log(` - ${file}`);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (result.moved.length > 0) {
|
|
349
|
-
console.log('\n📁 Files to be moved:');
|
|
350
|
-
for (const move of result.moved) {
|
|
351
|
-
console.log(` - ${move.from} → ${move.to}`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (options.dryRun) {
|
|
355
|
-
console.log('\n🔍 DRY RUN - No actual changes will be made');
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
const rl = createInterface({
|
|
359
|
-
input: process.stdin,
|
|
360
|
-
output: process.stdout,
|
|
361
|
-
});
|
|
362
|
-
return new Promise(resolve => {
|
|
363
|
-
rl.question('\n🚀 Proceed with git push? (y/N): ', answer => {
|
|
364
|
-
rl.close();
|
|
365
|
-
const proceed = answer.trim().toLowerCase() === 'y' || answer.trim().toLowerCase() === 'yes';
|
|
366
|
-
resolve(proceed);
|
|
367
|
-
});
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Display help
|
|
372
|
-
*/
|
|
373
|
-
function displayHelp() {
|
|
374
|
-
console.log('\n' + '='.repeat(40));
|
|
375
|
-
console.log('📖 HELP');
|
|
376
|
-
console.log('='.repeat(40));
|
|
377
|
-
console.log('Actions:');
|
|
378
|
-
console.log(' [a] Approve - Include file in commit');
|
|
379
|
-
console.log(' [r] Reject - Exclude file from commit');
|
|
380
|
-
console.log(' [i] Ignore - Add file to .gitignore');
|
|
381
|
-
console.log(' [m] Move - Move file to appropriate location');
|
|
382
|
-
console.log(' [v] View - Show file content');
|
|
383
|
-
console.log(' [e] Edit - Open file in editor');
|
|
384
|
-
console.log(' [h] Help - Show this help');
|
|
385
|
-
console.log('');
|
|
386
|
-
console.log('Tips:');
|
|
387
|
-
console.log(' - Files with errors must be resolved before proceeding');
|
|
388
|
-
console.log(' - Use [m] to move files to proper directories');
|
|
389
|
-
console.log(' - Use [i] to permanently ignore temporary files');
|
|
390
|
-
console.log(' - Use [v] to examine file content before deciding');
|
|
391
|
-
console.log('='.repeat(40));
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Batch approval for similar files
|
|
395
|
-
*/
|
|
396
|
-
export function batchApproval(items, action, criteria) {
|
|
397
|
-
const actions = [];
|
|
398
|
-
const referenceItem = items.find(item => item.filePath === action.filePath);
|
|
399
|
-
if (!referenceItem) {
|
|
400
|
-
return [action];
|
|
401
|
-
}
|
|
402
|
-
for (const item of items) {
|
|
403
|
-
let matches = true;
|
|
404
|
-
if (criteria.sameSeverity && item.severity !== referenceItem.severity) {
|
|
405
|
-
matches = false;
|
|
406
|
-
}
|
|
407
|
-
if (criteria.sameIssueType) {
|
|
408
|
-
const itemTypes = item.issues.map(i => i.type);
|
|
409
|
-
const refTypes = referenceItem.issues.map(i => i.type);
|
|
410
|
-
if (!itemTypes.some(type => refTypes.includes(type))) {
|
|
411
|
-
matches = false;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
if (matches) {
|
|
415
|
-
actions.push({
|
|
416
|
-
type: action.type,
|
|
417
|
-
filePath: item.filePath,
|
|
418
|
-
target: action.target,
|
|
419
|
-
reason: `Batch ${action.type} - similar to ${action.filePath}`,
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return actions;
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* Save approval preferences for future use
|
|
427
|
-
*/
|
|
428
|
-
export async function saveApprovalPreferences(actions, configPath = '.smartgit-approvals.json') {
|
|
429
|
-
try {
|
|
430
|
-
const preferences = {
|
|
431
|
-
timestamp: new Date().toISOString(),
|
|
432
|
-
actions: actions.map(action => ({
|
|
433
|
-
pattern: action.filePath.replace(/[^/]+$/, '*'), // Replace filename with wildcard
|
|
434
|
-
type: action.type,
|
|
435
|
-
reason: action.reason,
|
|
436
|
-
})),
|
|
437
|
-
};
|
|
438
|
-
writeFileSync(configPath, JSON.stringify(preferences, null, 2));
|
|
439
|
-
console.log(`\n💾 Approval preferences saved to ${configPath}`);
|
|
440
|
-
}
|
|
441
|
-
catch (error) {
|
|
442
|
-
console.log(`\n⚠️ Could not save preferences: ${error instanceof Error ? error.message : String(error)}`);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
//# sourceMappingURL=interactive-approval.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-approval.js","sourceRoot":"","sources":["../../../src/utils/interactive-approval.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAkDjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAqB,EACrB,OAAwB;IAExB,MAAM,MAAM,GAAmB;QAC7B,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,KA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
|
1
|
-
/**
|
|
2
|
-
* LLM Artifact Detection System
|
|
3
|
-
*
|
|
4
|
-
* Detects files and content generated by LLMs that may not be suitable for production
|
|
5
|
-
* Focuses on development artifacts, debug scripts, and temporary files
|
|
6
|
-
*/
|
|
7
|
-
export interface LLMArtifactPattern {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
category: 'debug' | 'testing' | 'documentation' | 'experimental' | 'temporary' | 'tutorial';
|
|
11
|
-
severity: 'error' | 'warning' | 'info';
|
|
12
|
-
filePattern?: RegExp;
|
|
13
|
-
contentPattern?: RegExp;
|
|
14
|
-
combinedPattern?: (fileName: string, content: string) => boolean;
|
|
15
|
-
locationExceptions: string[];
|
|
16
|
-
confidence: number;
|
|
17
|
-
}
|
|
18
|
-
export interface LLMArtifactMatch {
|
|
19
|
-
pattern: LLMArtifactPattern;
|
|
20
|
-
matchType: 'filename' | 'content' | 'combined';
|
|
21
|
-
match: string;
|
|
22
|
-
line?: number;
|
|
23
|
-
context?: string;
|
|
24
|
-
confidence: number;
|
|
25
|
-
suggestions: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface LLMArtifactResult {
|
|
28
|
-
filePath: string;
|
|
29
|
-
isLLMArtifact: boolean;
|
|
30
|
-
matches: LLMArtifactMatch[];
|
|
31
|
-
overallConfidence: number;
|
|
32
|
-
severity: 'error' | 'warning' | 'info';
|
|
33
|
-
recommendations: string[];
|
|
34
|
-
allowedInCurrentLocation: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Comprehensive LLM artifact patterns
|
|
38
|
-
*/
|
|
39
|
-
export declare const LLM_ARTIFACT_PATTERNS: LLMArtifactPattern[];
|
|
40
|
-
/**
|
|
41
|
-
* Detect LLM artifacts in a file
|
|
42
|
-
*/
|
|
43
|
-
export declare function detectLLMArtifacts(filePath: string, content: string, customPatterns?: LLMArtifactPattern[]): LLMArtifactResult;
|
|
44
|
-
/**
|
|
45
|
-
* Batch analyze multiple files
|
|
46
|
-
*/
|
|
47
|
-
export declare function batchDetectLLMArtifacts(files: Array<{
|
|
48
|
-
path: string;
|
|
49
|
-
content: string;
|
|
50
|
-
}>, customPatterns?: LLMArtifactPattern[]): LLMArtifactResult[];
|
|
51
|
-
/**
|
|
52
|
-
* Get summary statistics for LLM artifact detection
|
|
53
|
-
*/
|
|
54
|
-
export declare function getLLMArtifactSummary(results: LLMArtifactResult[]): {
|
|
55
|
-
totalFiles: number;
|
|
56
|
-
artifactFiles: number;
|
|
57
|
-
allowedFiles: number;
|
|
58
|
-
errorCount: number;
|
|
59
|
-
warningCount: number;
|
|
60
|
-
infoCount: number;
|
|
61
|
-
categorySummary: Record<string, number>;
|
|
62
|
-
topPatterns: Array<{
|
|
63
|
-
name: string;
|
|
64
|
-
count: number;
|
|
65
|
-
}>;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Create a custom LLM artifact pattern
|
|
69
|
-
*/
|
|
70
|
-
export declare function createLLMPattern(name: string, description: string, category: LLMArtifactPattern['category'], severity: LLMArtifactPattern['severity'], options: {
|
|
71
|
-
filePattern?: string;
|
|
72
|
-
contentPattern?: string;
|
|
73
|
-
locationExceptions?: string[];
|
|
74
|
-
confidence?: number;
|
|
75
|
-
}): LLMArtifactPattern;
|
|
76
|
-
//# sourceMappingURL=llm-artifact-detector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-artifact-detector.d.ts","sourceRoot":"","sources":["../../../src/utils/llm-artifact-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,eAAe,GAAG,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;IAC5F,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,WAAW,CAAC,EAAE,MAA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