@lisa.ai/agent 1.1.9 → 1.1.10
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/commands/coverage.js +30 -3
- package/dist/commands/heal.js +43 -5
- package/package.json +1 -1
|
@@ -44,11 +44,38 @@ const telemetry_service_1 = require("../services/telemetry.service");
|
|
|
44
44
|
async function coverageCommand(command, modelProvider, attempt = 1, maxRetries = 3, projectId = 'local', apiKey) {
|
|
45
45
|
console.log(`\n[Lisa.ai Coverage] ${command} (Attempt ${attempt}/${maxRetries}) Using Model: ${modelProvider}`);
|
|
46
46
|
let executionPassed = true;
|
|
47
|
+
const runSilentlyAndIntercept = (cmd, printProgress = false) => {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const parts = cmd.split(' ');
|
|
50
|
+
const childTarget = process.platform === 'win32' ? `${parts[0]}.cmd` : parts[0];
|
|
51
|
+
const childArgs = parts.slice(1);
|
|
52
|
+
const child = (0, child_process_1.spawn)(parts[0], childArgs, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
53
|
+
child.stdout?.on('data', (data) => {
|
|
54
|
+
const text = data.toString();
|
|
55
|
+
if (printProgress) {
|
|
56
|
+
const lines = text.split('\n');
|
|
57
|
+
for (const line of lines) {
|
|
58
|
+
if (line.includes('Executed')) {
|
|
59
|
+
process.stdout.write(line + '\n');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
child.on('close', (code) => {
|
|
65
|
+
if (code === 0) {
|
|
66
|
+
resolve();
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
reject(new Error(`Test process exited with code ${code}`));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
47
74
|
try {
|
|
48
75
|
// 1. Run the test command which should ideally produce coverage-summary.json
|
|
49
|
-
// Use
|
|
50
|
-
console.log(`[Lisa.ai Coverage] Booting testing framework
|
|
51
|
-
|
|
76
|
+
// Use the native interceptor to stream the live Karma/Jest progress bar without error spam
|
|
77
|
+
console.log(`[Lisa.ai Coverage] Booting testing framework in the background. This may take a moment...`);
|
|
78
|
+
await runSilentlyAndIntercept(command, true);
|
|
52
79
|
console.log(`\n✅ [Lisa.ai Coverage] Tests passed successfully on attempt ${attempt}.`);
|
|
53
80
|
}
|
|
54
81
|
catch (error) {
|
package/dist/commands/heal.js
CHANGED
|
@@ -43,9 +43,10 @@ const git_service_1 = require("../services/git.service");
|
|
|
43
43
|
const telemetry_service_1 = require("../services/telemetry.service");
|
|
44
44
|
function isolateTestCommand(globalCommand, targetFile) {
|
|
45
45
|
const cmd = globalCommand.toLowerCase();
|
|
46
|
-
|
|
46
|
+
const parsed = path.parse(targetFile);
|
|
47
|
+
// Karma requires generic glob matching, it frequently fails on direct absolute OS paths from node
|
|
47
48
|
if (cmd.includes('ng test') || cmd.includes('karma')) {
|
|
48
|
-
return `${globalCommand} --include
|
|
49
|
+
return `${globalCommand} --include **/${parsed.base}`;
|
|
49
50
|
}
|
|
50
51
|
// Jest/Vitest/Playwright
|
|
51
52
|
if (cmd.includes('jest') || cmd.includes('vitest') || cmd.includes('playwright')) {
|
|
@@ -59,9 +60,46 @@ function isolateTestCommand(globalCommand, targetFile) {
|
|
|
59
60
|
}
|
|
60
61
|
async function healCommand(command, modelProvider, attempt = 1, healedFilePath = null, maxRetries = 3, projectId = 'local', lastFixDetails, apiKey, skipLedger = [], consecutiveFails = 0, failTracker = {}) {
|
|
61
62
|
console.log(`\n[Lisa.ai Executing] ${command} (Global Engine) Using Model: ${modelProvider}`);
|
|
63
|
+
const runSilentlyAndIntercept = (cmd, printProgress = false) => {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
// Split command correctly for cross-platform spawn
|
|
66
|
+
const parts = cmd.split(' ');
|
|
67
|
+
const childTarget = process.platform === 'win32' ? `${parts[0]}.cmd` : parts[0];
|
|
68
|
+
const childArgs = parts.slice(1);
|
|
69
|
+
// If the command doesn't have .cmd but we are on Windows and it fails, wrap it in a shell
|
|
70
|
+
const child = (0, child_process_1.spawn)(parts[0], childArgs, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
71
|
+
let stdoutData = '';
|
|
72
|
+
let stderrData = '';
|
|
73
|
+
child.stdout?.on('data', (data) => {
|
|
74
|
+
const text = data.toString();
|
|
75
|
+
stdoutData += text;
|
|
76
|
+
// [Lisa.ai Stream Interceptor]
|
|
77
|
+
// The user explicitly requested to see the progress bar, but not the gigantic error dumps.
|
|
78
|
+
// We filter the stdout to only print lines containing "Executed" (Karma/Jasmine standard).
|
|
79
|
+
if (printProgress) {
|
|
80
|
+
const lines = text.split('\n');
|
|
81
|
+
for (const line of lines) {
|
|
82
|
+
if (line.includes('Executed')) {
|
|
83
|
+
process.stdout.write(line + '\n');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
child.stderr?.on('data', (data) => {
|
|
89
|
+
stderrData += data.toString();
|
|
90
|
+
});
|
|
91
|
+
child.on('close', (code) => {
|
|
92
|
+
if (code === 0) {
|
|
93
|
+
resolve({ stdout: stdoutData, stderr: stderrData });
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
reject({ message: `Process exited with code ${code}`, stdout: stdoutData, stderr: stderrData });
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
62
101
|
try {
|
|
63
|
-
|
|
64
|
-
console.log(output);
|
|
102
|
+
await runSilentlyAndIntercept(command, true); // True = stream progress globally
|
|
65
103
|
console.log(`\n✅ [Lisa.ai Success] Global Command executed successfully.`);
|
|
66
104
|
if (healedFilePath) {
|
|
67
105
|
await (0, git_service_1.createPullRequestForHeal)(healedFilePath);
|
|
@@ -112,7 +150,7 @@ async function healCommand(command, modelProvider, attempt = 1, healedFilePath =
|
|
|
112
150
|
try {
|
|
113
151
|
// Verify the isolated file silently without exploding the Global terminal with 400 other spec errors
|
|
114
152
|
console.log(`[Lisa.ai Micro-Heal] Verifying fix with isolated command: ${isolatedCommand}`);
|
|
115
|
-
|
|
153
|
+
await runSilentlyAndIntercept(isolatedCommand, false); // False = completely invisible isolated healing
|
|
116
154
|
console.log(`✅ [Lisa.ai Micro-Heal] Isolated verification passed for ${filePath}!`);
|
|
117
155
|
isFixed = true;
|
|
118
156
|
}
|