aios-core
Version:
Synkra AIOS: AI-Orchestrated System for Full Stack Development - Core Framework
59 lines (49 loc) âĸ 1.58 kB
JavaScript
;
const { execSync } = require('child_process');
const { validateManifest } = require('./validate-manifest');
const { generateManifest, writeManifest } = require('./generate-install-manifest');
function getStagedFiles() {
try {
const output = execSync('git diff --cached --name-only', { encoding: 'utf8' }).trim();
if (!output) return [];
return output.split('\n').map((line) => line.trim()).filter(Boolean);
} catch (_error) {
return [];
}
}
function shouldCheckManifest(stagedFiles) {
if (stagedFiles.length === 0) return false;
return stagedFiles.some((file) => {
if (file === '.aios-core/install-manifest.yaml') return false;
return file.startsWith('.aios-core/');
});
}
async function main() {
const stagedFiles = getStagedFiles();
if (!shouldCheckManifest(stagedFiles)) {
console.log('âšī¸ manifest: no .aios-core changes staged, skipping check');
return;
}
const result = validateManifest();
if (result.valid) {
console.log('â
manifest: already up-to-date');
return;
}
console.log('đ manifest: outdated, regenerating...');
const manifest = await generateManifest();
await writeManifest(manifest);
execSync('git add .aios-core/install-manifest.yaml', { stdio: 'inherit' });
console.log('â
manifest: regenerated and staged');
}
if (require.main === module) {
main().catch((error) => {
console.error(`â manifest: ensure failed - ${error.message}`);
process.exit(1);
});
}
module.exports = {
getStagedFiles,
shouldCheckManifest,
main,
};