feat(reporting-governance): schema-validate profile generation

This commit is contained in:
Eve
2026-05-08 12:30:04 +08:00
parent de2d5d97b8
commit 74fbf43e83
5 changed files with 259 additions and 156 deletions

View File

@@ -12,14 +12,19 @@ function main() {
process.exit(1);
}
const sourcePath = path.resolve(sourcePathArg);
const outputPath = path.resolve(outputPathArg);
const artifact = generateDeploymentProfileArtifactFromFile(sourcePath);
validateDeploymentProfileArtifact(artifact);
try {
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));
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));
} catch (error) {
console.error(`profile artifact generation failed: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}
}
main();