@lisa.ai/agent 1.1.2 → 1.1.4

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.
@@ -95,7 +95,7 @@ async function coverageCommand(command, modelProvider, attempt = 1, maxRetries =
95
95
  await (0, telemetry_service_1.reportTelemetry)({
96
96
  projectId,
97
97
  type: 'coverage',
98
- filePath: targetFilePath,
98
+ filePath: targetFilePath, // Keeping original as the provided edit was syntactically incorrect for an object literal
99
99
  modelUsed: modelProvider,
100
100
  status: 'success',
101
101
  details: `### Missing Logic Coverage Detected\n**Auto-Generated Specification Suite (${modelProvider}):**\n\`\`\`typescript\n${testCode}\n\`\`\``
@@ -66,7 +66,7 @@ async function healCommand(command, modelProvider, attempt = 1, healedFilePath =
66
66
  process.exit(1);
67
67
  }
68
68
  console.log(`\n[Lisa.ai Auto-Heal] Analyzing errors...`);
69
- const filePath = (0, parser_1.extractFilePath)(errorLog, skipLedger);
69
+ const filePath = (0, parser_1.extractFilePath)(errorLog, skipLedger, process.cwd());
70
70
  if (!filePath) {
71
71
  console.error(`\n🚨 [Lisa.ai Error] Could not parse a valid failing file path from the logs (or all were explicitly skipped).`);
72
72
  process.exit(1);
@@ -35,7 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.extractFilePath = extractFilePath;
37
37
  const path = __importStar(require("path"));
38
- function extractFilePath(errorLog, skipFiles = []) {
38
+ const fs = __importStar(require("fs"));
39
+ function extractFilePath(errorLog, skipFiles = [], searchDir = process.cwd()) {
39
40
  // Sanitize invisible ANSI color codes (e.g. \x1b[96m) from CLI output logs
40
41
  const cleanLog = errorLog.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
41
42
  // Normalize skip files for reliable absolute path comparison
@@ -62,6 +63,60 @@ function extractFilePath(errorLog, skipFiles = []) {
62
63
  return foundPath;
63
64
  }
64
65
  }
66
+ // 3. Third Pass (Karma/Jasmine Abstract Fallback): Match Angular Class names
67
+ // Example: "Chrome 145.0.0.0 (Windows 10) ConfigureNotificationComponent should create FAILED"
68
+ // Example: "NullInjectorError: R3InjectorError(Standalone[RegisterComponent])"
69
+ const classRegex = /([A-Z][a-zA-Z0-9]+(?:Component|Service|Module|Directive|Pipe|Guard|Interceptor))/g;
70
+ let classMatch;
71
+ while ((classMatch = classRegex.exec(cleanLog)) !== null) {
72
+ const className = classMatch[1];
73
+ if (className) {
74
+ console.log(`[Lisa.ai Parser] Discovered abstract class failure: ${className}. Scanning 'src/' tree...`);
75
+ const matchedFile = findFileByClassName(className, path.join(searchDir, 'src'));
76
+ if (matchedFile && !normalizedSkips.includes(path.resolve(matchedFile))) {
77
+ // Return path relative to project root
78
+ return path.relative(searchDir, matchedFile);
79
+ }
80
+ }
81
+ }
65
82
  // Exhausted all options and couldn't find an un-skipped file
66
83
  return null;
67
84
  }
85
+ /**
86
+ * Recursively walks a directory looking for a `.ts` file that exports the target class.
87
+ * Designed to bypass Karma's frustrating habit of omitting absolute script paths in Spec exceptions.
88
+ */
89
+ function findFileByClassName(className, dir) {
90
+ if (!fs.existsSync(dir))
91
+ return null;
92
+ const files = fs.readdirSync(dir);
93
+ for (const file of files) {
94
+ const fullPath = path.join(dir, file);
95
+ const stat = fs.statSync(fullPath);
96
+ if (stat.isDirectory()) {
97
+ // Recurse into subdirectories (ignore node_modules just in case)
98
+ if (file !== 'node_modules') {
99
+ const found = findFileByClassName(className, fullPath);
100
+ if (found)
101
+ return found;
102
+ }
103
+ }
104
+ else if (file.endsWith('.ts')) {
105
+ // Read file and check if it has "export class ClassName" or similar
106
+ const content = fs.readFileSync(fullPath, 'utf8');
107
+ // We use a broader regex just looking for the exact class name
108
+ if (content.includes(`class ${className}`) || content.includes(className)) {
109
+ // For tests, if a spec fails, we want to heal the spec file first!
110
+ // If the class is found in a non-spec file, and a spec file exists next to it, favor the spec.
111
+ if (!file.endsWith('.spec.ts')) {
112
+ const hypotheticalSpec = fullPath.replace('.ts', '.spec.ts');
113
+ if (fs.existsSync(hypotheticalSpec)) {
114
+ return hypotheticalSpec;
115
+ }
116
+ }
117
+ return fullPath;
118
+ }
119
+ }
120
+ }
121
+ return null;
122
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lisa.ai/agent",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Lisa.ai Autonomous CI/CD Worker Agent",
5
5
  "main": "dist/index.js",
6
6
  "bin": {