feat: add deployment profile generation slice

This commit is contained in:
Eve
2026-05-08 12:23:02 +08:00
parent 36bc00cc3f
commit de2d5d97b8
6 changed files with 409 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env node
import fs from 'node:fs';
import path from 'node:path';
import { generateDeploymentProfileArtifactFromFile } from '../plugins/reporting-governance/src/storage/profile-generator.mjs';
import { validateDeploymentProfileArtifact } from '../plugins/reporting-governance/src/storage/profile-artifact.mjs';
function main() {
const [, , sourcePathArg, outputPathArg] = process.argv;
if (!sourcePathArg || !outputPathArg) {
console.error('usage: node scripts/generate_reporting_governance_profile_artifact.mjs <source-profile.yaml> <output-artifact.json>');
process.exit(1);
}
const sourcePath = path.resolve(sourcePathArg);
const outputPath = path.resolve(outputPathArg);
const artifact = generateDeploymentProfileArtifactFromFile(sourcePath);
validateDeploymentProfileArtifact(artifact);
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
fs.writeFileSync(outputPath, JSON.stringify(artifact, null, 2) + '\n', 'utf8');
console.log(JSON.stringify({ ok: true, sourcePath, outputPath, profileId: artifact.metadata.id }, null, 2));
}
main();