@@ -18,6 +18,26 @@ export async function model(root, { skipIndex = false } = {}) {
1818export const plan = base . plan ;
1919export const generate = base . generate ;
2020
21+ function ensureAuditDefaults ( root ) {
22+ const paths = projectPaths ( root ) ;
23+ const config = loadConfig ( root ) ;
24+ config . audit ??= { } ;
25+ let changed = false ;
26+ if ( ! [ 'off' , 'advisory' , 'blocking' ] . includes ( String ( config . audit . llmMode ?? '' ) . toLowerCase ( ) ) ) {
27+ config . audit . llmMode = 'off' ;
28+ changed = true ;
29+ }
30+ if ( config . audit . requiredSectionsAsWarnings === undefined ) {
31+ config . audit . requiredSectionsAsWarnings = true ;
32+ changed = true ;
33+ }
34+ if ( changed ) {
35+ writeJson ( paths . config , config ) ;
36+ console . log ( '[docgen] audit CONFIG MIGRATION | llmMode=off | requiredSectionsAsWarnings=true' ) ;
37+ }
38+ return config ;
39+ }
40+
2141async function finishDeterministicOnlyAudit ( root ) {
2242 const paths = projectPaths ( root ) ;
2343 const quality = readJson ( path . join ( paths . audit , 'deterministic.json' ) ) ;
@@ -34,7 +54,7 @@ async function finishDeterministicOnlyAudit(root) {
3454}
3555
3656export async function audit ( root ) {
37- const config = loadConfig ( root ) ;
57+ const config = ensureAuditDefaults ( root ) ;
3858 const llmMode = auditLlmMode ( config ) ;
3959 try {
4060 return await guardedAudit ( root , llmMode === 'off' ? finishDeterministicOnlyAudit : base . audit ) ;
0 commit comments