Wire post-audit cleanup into promotion workflow and document history maintenance
- docs/audit-workflow.md: add full reference for cleanup, restore, and purge scripts including usage examples and protected paths - prepare-audit-promotions.mjs: invoke runCleanup after artifact generation with aggressive scope; warns and continues on failure
This commit is contained in:
@@ -5,6 +5,7 @@ import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { runCleanup } from './cleanup-copilot-history.mjs';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -470,12 +471,35 @@ function main() {
|
||||
const generatedArtifacts = writeArtifacts(auditDir, approvedRows);
|
||||
const summaryPath = writeSummary(auditDir, manifestPath, approvedRows, generatedArtifacts);
|
||||
|
||||
let cleanupSummaryPath = '';
|
||||
try {
|
||||
const cleanupResult = runCleanup({
|
||||
repoRoot: options.repoRoot,
|
||||
auditDir,
|
||||
completionCutoff: new Date().toISOString(),
|
||||
scope: 'aggressive',
|
||||
execute: true,
|
||||
quarantineDir: path.join(
|
||||
os.homedir(),
|
||||
'.copilot-resources-state',
|
||||
'quarantine',
|
||||
'copilot-history-cleanup',
|
||||
),
|
||||
});
|
||||
cleanupSummaryPath = cleanupResult.summaryPath;
|
||||
} catch (error) {
|
||||
console.warn(`Post-audit cleanup failed: ${error?.message || String(error)}`);
|
||||
}
|
||||
|
||||
console.log('Audit promotion preparation complete.');
|
||||
console.log(`Audit directory: ${auditDir}`);
|
||||
console.log(`Approved rows: ${approvedRows.length}`);
|
||||
console.log(`Draft resources: ${generatedArtifacts.filter((artifact) => artifact.kind === 'draft').length}`);
|
||||
console.log(`Staging notes: ${generatedArtifacts.filter((artifact) => artifact.kind === 'note').length}`);
|
||||
console.log(`Summary: ${summaryPath}`);
|
||||
if (cleanupSummaryPath) {
|
||||
console.log(`Cleanup summary: ${cleanupSummaryPath}`);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user