#!/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 '); 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();