@safetnsr/vet 1.8.3 → 1.8.5
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/checks/config.js +4 -9
- package/dist/checks/integrity.js +8 -2
- package/dist/checks/memory.js +3 -0
- package/dist/checks/verify.js +43 -3
- package/package.json +1 -1
package/dist/checks/config.js
CHANGED
|
@@ -160,18 +160,13 @@ export function checkConfig(cwd, ignore) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
if (analyses.length === 0) {
|
|
163
|
-
|
|
164
|
-
severity: 'error',
|
|
165
|
-
message: 'no AI agent config found — add CLAUDE.md, .cursorrules, or similar',
|
|
166
|
-
fixable: true,
|
|
167
|
-
fixHint: 'run vet init to generate agent config',
|
|
168
|
-
});
|
|
163
|
+
// No agent config = not applicable, not a penalty
|
|
169
164
|
return {
|
|
170
165
|
name: 'config',
|
|
171
|
-
score:
|
|
166
|
+
score: 100,
|
|
172
167
|
maxScore: 100,
|
|
173
|
-
issues,
|
|
174
|
-
summary: 'no agent configs
|
|
168
|
+
issues: [{ severity: 'info', message: 'no AI agent config found — run vet init to generate one', fixable: true, fixHint: 'run vet init' }],
|
|
169
|
+
summary: 'no agent configs (n/a)',
|
|
175
170
|
};
|
|
176
171
|
}
|
|
177
172
|
// Aggregate scores from best config
|
package/dist/checks/integrity.js
CHANGED
|
@@ -304,8 +304,14 @@ function isNextjsServerComponent(file) {
|
|
|
304
304
|
// Next.js app directory server components
|
|
305
305
|
if (NEXTJS_SERVER_FILES.test(base))
|
|
306
306
|
return true;
|
|
307
|
-
// Next.js
|
|
308
|
-
if (
|
|
307
|
+
// Next.js route handlers (route.ts/js/tsx/jsx) anywhere in app/
|
|
308
|
+
if (/^route\.[jt]sx?$/.test(base))
|
|
309
|
+
return true;
|
|
310
|
+
// Any file in app/api/ directory
|
|
311
|
+
if (normalized.includes('app/api/'))
|
|
312
|
+
return true;
|
|
313
|
+
// Next.js middleware
|
|
314
|
+
if (/^middleware\.[jt]s$/.test(base))
|
|
309
315
|
return true;
|
|
310
316
|
return false;
|
|
311
317
|
}
|
package/dist/checks/memory.js
CHANGED
|
@@ -193,6 +193,9 @@ export function checkMemory(cwd) {
|
|
|
193
193
|
// 2. Broken path references
|
|
194
194
|
const pathRefs = extractPaths(content);
|
|
195
195
|
for (const { path: p, line } of pathRefs) {
|
|
196
|
+
// Skip ../ references — they point to sibling repos and can't be validated locally
|
|
197
|
+
if (p.startsWith('../'))
|
|
198
|
+
continue;
|
|
196
199
|
const resolved = p.startsWith('/') ? p : resolve(cwd, p);
|
|
197
200
|
if (!existsSync(resolved)) {
|
|
198
201
|
issues.push({
|
package/dist/checks/verify.js
CHANGED
|
@@ -147,8 +147,30 @@ function isPythonProject(cwd) {
|
|
|
147
147
|
}
|
|
148
148
|
/** Directories where small files are expected (examples, demos, docs) */
|
|
149
149
|
const SMALL_FILE_DIRS = ['examples/', 'example/', 'demos/', 'demo/', 'docs/'];
|
|
150
|
+
/** Next.js app router files that are designed to be small wrappers */
|
|
151
|
+
const NEXTJS_APP_FILES = new Set([
|
|
152
|
+
'page.tsx', 'page.jsx', 'page.ts', 'page.js',
|
|
153
|
+
'layout.tsx', 'layout.jsx',
|
|
154
|
+
'loading.tsx', 'loading.jsx',
|
|
155
|
+
'not-found.tsx', 'not-found.jsx',
|
|
156
|
+
'error.tsx', 'error.jsx',
|
|
157
|
+
'template.tsx', 'template.jsx',
|
|
158
|
+
]);
|
|
159
|
+
function isNextjsAppFile(filePath) {
|
|
160
|
+
return NEXTJS_APP_FILES.has(basename(filePath));
|
|
161
|
+
}
|
|
162
|
+
/** Config files should never be flagged as test files */
|
|
163
|
+
function isConfigFile(filePath) {
|
|
164
|
+
const base = basename(filePath);
|
|
165
|
+
return /\.config\.[a-z]+$/i.test(base);
|
|
166
|
+
}
|
|
167
|
+
/** Python pattern directories where small files are expected */
|
|
168
|
+
const PYTHON_PATTERN_DIRS = ['profiles/', 'providers/', 'configs/', 'config/', 'tests/', 'test/'];
|
|
169
|
+
/** Python pattern file names that are expected to be small */
|
|
170
|
+
const PYTHON_PATTERN_NAMES = new Set(['version.py', '__version__.py', 'conftest.py']);
|
|
150
171
|
function isPythonBoilerplate(filePath) {
|
|
151
172
|
const base = basename(filePath);
|
|
173
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
152
174
|
if (base === '__init__.py')
|
|
153
175
|
return true;
|
|
154
176
|
if (base === '__main__.py')
|
|
@@ -157,7 +179,20 @@ function isPythonBoilerplate(filePath) {
|
|
|
157
179
|
return true;
|
|
158
180
|
if (filePath.endsWith('.pyi'))
|
|
159
181
|
return true;
|
|
160
|
-
if (
|
|
182
|
+
if (normalized.includes('__pycache__/'))
|
|
183
|
+
return true;
|
|
184
|
+
// Pattern-based small Python files
|
|
185
|
+
if (PYTHON_PATTERN_NAMES.has(base))
|
|
186
|
+
return true;
|
|
187
|
+
if (base.endsWith('_utils.py'))
|
|
188
|
+
return true;
|
|
189
|
+
// Test files in test directories (test_*.py, *_test.py)
|
|
190
|
+
if (/^test_.*\.py$/.test(base) || /^.*_test\.py$/.test(base)) {
|
|
191
|
+
if (PYTHON_PATTERN_DIRS.some(d => normalized.includes(d)))
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
// Files in pattern directories (profiles/, providers/, configs/, config/)
|
|
195
|
+
if (base.endsWith('.py') && PYTHON_PATTERN_DIRS.some(d => normalized.includes(d)))
|
|
161
196
|
return true;
|
|
162
197
|
return false;
|
|
163
198
|
}
|
|
@@ -263,6 +298,11 @@ export function checkVerify(cwd, since) {
|
|
|
263
298
|
verified++;
|
|
264
299
|
continue;
|
|
265
300
|
}
|
|
301
|
+
// Skip thin file check for Next.js app router files (designed as small wrappers)
|
|
302
|
+
if (isNextjsAppFile(relPath)) {
|
|
303
|
+
verified++;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
266
306
|
if (lineCount < 10 && lineCount > 0) {
|
|
267
307
|
issues.push({
|
|
268
308
|
severity: 'warning',
|
|
@@ -287,8 +327,8 @@ export function checkVerify(cwd, since) {
|
|
|
287
327
|
failed++;
|
|
288
328
|
continue;
|
|
289
329
|
}
|
|
290
|
-
// 3. Test files must have actual assertions
|
|
291
|
-
if (isTestFile(relPath)) {
|
|
330
|
+
// 3. Test files must have actual assertions (but not config files)
|
|
331
|
+
if (isTestFile(relPath) && !isConfigFile(relPath)) {
|
|
292
332
|
if (!hasAssertions(content)) {
|
|
293
333
|
issues.push({
|
|
294
334
|
severity: 'error',
|