@lisa.ai/agent 2.1.3 → 2.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.
|
@@ -130,12 +130,21 @@ async function coverageCommand(command, modelProvider, attempt = 1, maxRetries =
|
|
|
130
130
|
try {
|
|
131
131
|
// Find JSON summary expecting standard output paths
|
|
132
132
|
const coveragePath = path.resolve(process.cwd(), 'coverage/coverage-summary.json');
|
|
133
|
+
let uncoveredFiles = [];
|
|
133
134
|
if (!fs.existsSync(coveragePath)) {
|
|
134
|
-
console.
|
|
135
|
-
|
|
135
|
+
console.log(`\n[Lisa.ai Coverage] No coverage-summary.json found. Initiating Cold-Start Project Crawler...`);
|
|
136
|
+
// [Lisa.ai Phase 8] Cold-Start Discovery
|
|
137
|
+
uncoveredFiles = discovery_service_1.AutoDiscoveryService.findUntestedFiles(process.cwd());
|
|
138
|
+
if (uncoveredFiles.length === 0) {
|
|
139
|
+
console.log(`✅ [Lisa.ai Coverage] Zero-Test scan complete. No untested source files discovered.`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
console.log(`[Lisa.ai Coverage] Discovered ${uncoveredFiles.length} untested file(s). Seeding first test suite...`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
console.log(`[Lisa.ai Coverage] Evaluating summary...`);
|
|
146
|
+
uncoveredFiles = (0, coverage_parser_1.parseCoverageSummary)('coverage/coverage-summary.json');
|
|
136
147
|
}
|
|
137
|
-
console.log(`[Lisa.ai Coverage] Evaluating summary...`);
|
|
138
|
-
const uncoveredFiles = (0, coverage_parser_1.parseCoverageSummary)('coverage/coverage-summary.json');
|
|
139
148
|
if (uncoveredFiles.length === 0) {
|
|
140
149
|
console.log(`✅ [Lisa.ai Coverage] 100% Logic Coverage Verified! No un-covered files remaining.`);
|
|
141
150
|
return; // We exit the loop
|
|
@@ -89,5 +89,53 @@ class AutoDiscoveryService {
|
|
|
89
89
|
}
|
|
90
90
|
return result;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Recursively crawls the project to find source files that lack any corresponding test/spec files.
|
|
94
|
+
*/
|
|
95
|
+
static findUntestedFiles(dir, skipList = []) {
|
|
96
|
+
const untested = [];
|
|
97
|
+
if (!fs.existsSync(dir))
|
|
98
|
+
return untested;
|
|
99
|
+
const files = fs.readdirSync(dir);
|
|
100
|
+
const ignoreDirs = ['node_modules', 'dist', 'build', '.git', '.angular', 'coverage', 'public', 'assets'];
|
|
101
|
+
const ignoreFiles = ['main.ts', 'index.ts', 'app.config.ts', 'app.routes.ts', 'styles.css', 'styles.scss', 'tailwind.config.js', 'eslint.config.js'];
|
|
102
|
+
for (const file of files) {
|
|
103
|
+
const fullPath = path.join(dir, file);
|
|
104
|
+
if (ignoreDirs.includes(file))
|
|
105
|
+
continue;
|
|
106
|
+
let stat;
|
|
107
|
+
try {
|
|
108
|
+
stat = fs.statSync(fullPath);
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (stat.isDirectory()) {
|
|
114
|
+
untested.push(...this.findUntestedFiles(fullPath, skipList));
|
|
115
|
+
}
|
|
116
|
+
else if (file.match(/\.(ts|tsx|js|jsx|vue)$/) && !file.includes('.spec.') && !file.includes('.test.')) {
|
|
117
|
+
if (ignoreFiles.includes(file))
|
|
118
|
+
continue;
|
|
119
|
+
const ext = path.extname(file);
|
|
120
|
+
const base = file.slice(0, -ext.length);
|
|
121
|
+
const possibleSpecs = [
|
|
122
|
+
path.join(dir, `${base}.spec${ext}`),
|
|
123
|
+
path.join(dir, `${base}.test${ext}`),
|
|
124
|
+
path.join(dir, `${base}.spec.js`),
|
|
125
|
+
path.join(dir, `${base}.test.js`),
|
|
126
|
+
path.join(dir, `${base}.spec.ts`),
|
|
127
|
+
path.join(dir, `${base}.test.ts`)
|
|
128
|
+
];
|
|
129
|
+
const hasTest = possibleSpecs.some(p => fs.existsSync(p));
|
|
130
|
+
if (!hasTest) {
|
|
131
|
+
const relativePath = path.relative(process.cwd(), fullPath);
|
|
132
|
+
if (!skipList.includes(relativePath)) {
|
|
133
|
+
untested.push(relativePath);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return untested;
|
|
139
|
+
}
|
|
92
140
|
}
|
|
93
141
|
exports.AutoDiscoveryService = AutoDiscoveryService;
|