mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
49cd27b57a
Replace all bash-specific syntax in npm scripts, lifecycle hooks, and TypeScript execSync calls with cross-platform Node.js equivalents so aqe works on Windows (cmd.exe/PowerShell) without WSL. CRITICAL fixes: - package.json: replace mkdir -p, echo >, rm -rf with node -e inline - v3/package.json: replace bash scripts with .cjs Node.js scripts - New prepare-assets.cjs, sync-agents.cjs, sync-agents-check.cjs HIGH fixes: - Remove 2>/dev/null from 7 TypeScript execSync calls (try/catch suffices) - Add process.env.USERPROFILE fallback for Windows HOME detection - Simplify hook commands: remove [ -n ], || true, $(date +%s) bash-isms - preinstall.cjs: cross-platform binary detection (which/where) Skill validation framework: - New validator-lib.cjs + validate-skill.cjs universal validator - migrate-validators.cjs auto-extracts 107 validate-config.json files - Replaces 52 individual validate.sh scripts with single Node.js framework Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Check whether the v3 QE agents in the assets directory are in sync with the
|
|
* source files in the repo (cross-platform replacement for the bash sync:agents:check script).
|
|
*
|
|
* Uses CommonJS for maximum Node.js compatibility across Windows, Mac, and Linux.
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const SCRIPT_DIR = __dirname;
|
|
const V3_DIR = path.dirname(SCRIPT_DIR);
|
|
const REPO_ROOT = path.dirname(V3_DIR);
|
|
|
|
/**
|
|
* Compare two files by reading their contents. Returns true if they are identical.
|
|
* Returns false if either file does not exist or contents differ.
|
|
*/
|
|
function filesMatch(fileA, fileB) {
|
|
try {
|
|
const contentsA = fs.readFileSync(fileA);
|
|
const contentsB = fs.readFileSync(fileB);
|
|
return contentsA.equals(contentsB);
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
console.log('Checking v3 QE agents sync status:');
|
|
|
|
const sourceAgentsDir = path.join(REPO_ROOT, '.claude', 'agents', 'v3');
|
|
const destAgentsDir = path.join(V3_DIR, 'assets', 'agents', 'v3');
|
|
const sourceSubagentsDir = path.join(sourceAgentsDir, 'subagents');
|
|
const destSubagentsDir = path.join(destAgentsDir, 'subagents');
|
|
|
|
let warnings = 0;
|
|
|
|
// Check main agents
|
|
try {
|
|
const files = fs.readdirSync(sourceAgentsDir).filter(function (f) {
|
|
return f.startsWith('qe-') && f.endsWith('.md');
|
|
});
|
|
for (const file of files) {
|
|
const src = path.join(sourceAgentsDir, file);
|
|
const dest = path.join(destAgentsDir, file);
|
|
if (fs.statSync(src).isFile() && !filesMatch(src, dest)) {
|
|
console.log(' Warning: ' + file);
|
|
warnings++;
|
|
}
|
|
}
|
|
} catch {
|
|
// Source directory missing -- nothing to check
|
|
}
|
|
|
|
// Check subagents
|
|
try {
|
|
const files = fs.readdirSync(sourceSubagentsDir).filter(function (f) {
|
|
return f.startsWith('qe-') && f.endsWith('.md');
|
|
});
|
|
for (const file of files) {
|
|
const src = path.join(sourceSubagentsDir, file);
|
|
const dest = path.join(destSubagentsDir, file);
|
|
if (fs.statSync(src).isFile() && !filesMatch(src, dest)) {
|
|
console.log(' Warning: subagents/' + file);
|
|
warnings++;
|
|
}
|
|
}
|
|
} catch {
|
|
// Subagents directory missing -- nothing to check
|
|
}
|
|
|
|
if (warnings > 0) {
|
|
console.log(warnings + ' file(s) out of sync. Run "npm run sync:agents" to update.');
|
|
}
|
|
|
|
console.log('Check complete');
|
|
}
|
|
|
|
main();
|