1+ import path from 'node:path' ;
12import * as base from './pipeline-base.mjs' ;
23import { guardedAudit } from './audit-guard.mjs' ;
34import { budgetReport } from './provider.mjs' ;
45import { ingestModels } from './indexer.mjs' ;
5- import { sourceSnapshot } from './core.mjs' ;
6+ import { loadConfig , projectPaths , readJson , sourceSnapshot , updateStage , writeJson } from './core.mjs' ;
67import { synthesizeModels } from './model-synthesis.mjs' ;
78
89export const index = base . index ;
@@ -16,7 +17,32 @@ export async function model(root, { skipIndex = false } = {}) {
1617export const plan = base . plan ;
1718export const generate = base . generate ;
1819export async function audit ( root ) {
19- return guardedAudit ( root , base . audit ) ;
20+ try {
21+ return await guardedAudit ( root , base . audit ) ;
22+ } catch ( error ) {
23+ const paths = projectPaths ( root ) ;
24+ const summaryFile = path . join ( paths . audit , 'quality-summary.json' ) ;
25+ const summary = readJson ( summaryFile , null ) ;
26+ const blockOnLlmFindings = loadConfig ( root ) . audit ?. blockOnLlmFindings === true ;
27+ if ( ! blockOnLlmFindings && summary ?. deterministicFailures === 0 && summary . highRiskFindings > 0 ) {
28+ const advisory = {
29+ ...summary ,
30+ pass : true ,
31+ llmFindingsBlocking : false ,
32+ advisoryHighRiskFindings : summary . highRiskFindings
33+ } ;
34+ writeJson ( summaryFile , advisory ) ;
35+ updateStage ( root , 'audit' , 'completed' , {
36+ ...advisory ,
37+ inputHash : advisory . auditInputHash ,
38+ advisory : true ,
39+ originalError : error . message
40+ } ) ;
41+ console . warn ( `[docgen] audit ADVISORY | ${ summary . highRiskFindings } high/critical LLM finding(s) recorded but not blocking. Set audit.blockOnLlmFindings=true to enforce them.` ) ;
42+ return advisory ;
43+ }
44+ throw error ;
45+ }
2046}
2147export const publish = base . publish ;
2248export function status ( root ) {
0 commit comments