@lisa.ai/agent 1.0.5 → 1.0.7
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.
|
@@ -79,11 +79,6 @@ ${fileContent}
|
|
|
79
79
|
2. Do not suppress TypeScript errors with @ts-ignore or any type assertions unless absolutely unavoidable.
|
|
80
80
|
3. Fix the underlying type or logic issue.
|
|
81
81
|
4. Return the code wrapped in a markdown code block (\`\`\`typescript ... \`\`\`). Do not include any explanation or intro text.`;
|
|
82
|
-
// Provide a mock bypass if keys are not present to test the Git loop
|
|
83
|
-
if (!process.env.GOOGLE_GENERATIVE_AI_API_KEY && !process.env.OPENAI_API_KEY && !process.env.ANTHROPIC_API_KEY) {
|
|
84
|
-
console.log(`[Lisa.ai Warning] No API keys found in environment. Using mock LLM fix for testing.`);
|
|
85
|
-
return `const missingImportStr: string = "42";\nconsole.log(missingImportStr);\n`;
|
|
86
|
-
}
|
|
87
82
|
const { text } = await (0, ai_1.generateText)({
|
|
88
83
|
model,
|
|
89
84
|
prompt,
|
|
@@ -105,10 +100,6 @@ ${sourceFileContent}
|
|
|
105
100
|
2. Do not include any explanation or intro text.
|
|
106
101
|
3. Include all necessary imports assuming Jest is available.
|
|
107
102
|
4. Aim for 100% logic coverage.`;
|
|
108
|
-
// Provide a mock bypass if keys are not present
|
|
109
|
-
if (!process.env.GOOGLE_GENERATIVE_AI_API_KEY && !process.env.OPENAI_API_KEY && !process.env.ANTHROPIC_API_KEY) {
|
|
110
|
-
return `import { something } from './${path.basename(sourceFilePath, '.ts')}';\n\ndescribe('Auto-Generated Test', () => { \n it('should pass dynamically', () => { \n expect(true).toBe(true); \n }); \n});\n`;
|
|
111
|
-
}
|
|
112
103
|
const { text } = await (0, ai_1.generateText)({
|
|
113
104
|
model,
|
|
114
105
|
prompt,
|
package/dist/utils/parser.js
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFilePath = extractFilePath;
|
|
4
4
|
function extractFilePath(errorLog) {
|
|
5
|
+
// Sanitize invisible ANSI color codes (e.g. \x1b[96m) from CLI output logs
|
|
6
|
+
const cleanLog = errorLog.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
|
|
5
7
|
// Matches typical TS/Angular error patterns:
|
|
6
8
|
// e.g., "src/app/app.component.ts:12:3 - error TS2322:"
|
|
7
9
|
// e.g., "Error: src/app/app.component.ts:12:3"
|
|
8
10
|
// Try to match path near an error
|
|
9
11
|
const tsErrorRegex = /([a-zA-Z0-9_.\-\/\\]+\.ts)(?:[:(])/;
|
|
10
|
-
const match = tsErrorRegex.exec(
|
|
12
|
+
const match = tsErrorRegex.exec(cleanLog);
|
|
11
13
|
if (match && match[1]) {
|
|
12
14
|
return match[1];
|
|
13
15
|
}
|
|
14
16
|
// Fallback: Just try to find anything that looks like a .ts file path
|
|
15
17
|
const fallbackRegex = /([a-zA-Z0-9_.\-\/\\]+\.ts)/;
|
|
16
|
-
const fallbackMatch = fallbackRegex.exec(
|
|
18
|
+
const fallbackMatch = fallbackRegex.exec(cleanLog);
|
|
17
19
|
return fallbackMatch ? fallbackMatch[1] : null;
|
|
18
20
|
}
|