Files
Profa 49cd27b57a fix(platform): cross-platform compatibility for Windows/macOS/Linux
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>
2026-02-11 09:14:14 +00:00

79 lines
2.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Sync v3 QE agents from the repo to the v3 package assets (cross-platform).
* Replaces the bash sync:agents npm 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);
function ensureDir(dirPath) {
fs.mkdirSync(dirPath, { recursive: true });
}
function main() {
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');
ensureDir(destAgentsDir);
let mainCount = 0;
let subCount = 0;
// Copy main qe-*.md 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);
if (fs.statSync(src).isFile()) {
fs.copyFileSync(src, path.join(destAgentsDir, file));
mainCount++;
}
}
} catch {
// Source directory missing or unreadable -- silently ignore
}
// Copy subagent qe-*.md files
ensureDir(destSubagentsDir);
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);
if (fs.statSync(src).isFile()) {
fs.copyFileSync(src, path.join(destSubagentsDir, file));
subCount++;
}
}
} catch {
// Subagents directory missing or unreadable -- silently ignore
}
const total = mainCount + subCount;
console.log(
'Synced v3 QE agents (' +
mainCount +
' main + ' +
subCount +
' subagents = ' +
total +
' total)'
);
}
main();