Agent Police Department v1.0.0 MVP
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const buildDir = '/home/node/.openclaw/workspace/agents/bunbun/builds/agent-police-department-claude-code-agent-governan';
|
||||
const filesToCheck = [
|
||||
'lib/detectors.js',
|
||||
'lib/policy.js',
|
||||
'lib/audit.js',
|
||||
'lib/hash.js',
|
||||
'background.js',
|
||||
'content_script.js',
|
||||
'popup.js'
|
||||
];
|
||||
|
||||
let issues = [];
|
||||
|
||||
for (const file of filesToCheck) {
|
||||
const filePath = path.join(buildDir, file);
|
||||
if (!fs.existsSync(filePath)) continue;
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
const lines = content.split('\n');
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
|
||||
// Flag functions that are ONLY a return statement (skeleton)
|
||||
if (line.match(/^function\s+\w+\s*\([^)]*\)\s*\{\s*return\s+null\s*;\s*\}$/)) {
|
||||
issues.push(`${file}:${i+1}: skeleton function (return null)`);
|
||||
}
|
||||
if (line.match(/^function\s+\w+\s*\([^)]*\)\s*\{\s*return\s*;\s*\}$/)) {
|
||||
issues.push(`${file}:${i+1}: skeleton function (empty return)`);
|
||||
}
|
||||
if (line.match(/^\w+\s*=>\s*null\s*;?$/)) {
|
||||
issues.push(`${file}:${i+1}: skeleton arrow function (return null)`);
|
||||
}
|
||||
|
||||
// Flag TODO/FIXME/PLACEHOLDER in actual code (not comments about placeholders)
|
||||
if (line.match(/TODO\s*[:\-]/i) || line.match(/FIXME\s*[:\-]/i)) {
|
||||
issues.push(`${file}:${i+1}: TODO/FIXME marker`);
|
||||
}
|
||||
if (line.match(/NOT\s+IMPLEMENTED/i) || line.match(/STUB\s*\(/i)) {
|
||||
issues.push(`${file}:${i+1}: not implemented/stub marker`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (issues.length > 0) {
|
||||
console.log('Anti-skeleton check: ISSUES FOUND');
|
||||
for (const issue of issues) {
|
||||
console.log(' - ' + issue);
|
||||
}
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('Anti-skeleton check: PASSED — no skeleton code detected');
|
||||
process.exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user