@@ -85,6 +85,8 @@ type DerivedCoverageScores = QaMaturityCoverageScores & {
8585 warnings : string [ ] ;
8686} ;
8787
88+ const MATURITY_DOC_OUTPUTS = [ "maturity/scorecard.md" , "maturity/taxonomy.md" ] as const ;
89+
8890function parseArgs ( argv : string [ ] ) : Args {
8991 const args : Args = {
9092 taxonomy : DEFAULT_TAXONOMY_PATH ,
@@ -848,14 +850,58 @@ function writeOrCheck(outputPath: string, content: string, check: boolean): bool
848850 return false ;
849851}
850852
853+ function checkEvidenceIndependentInputs ( {
854+ args,
855+ scoresPath,
856+ taxonomy,
857+ taxonomyPath,
858+ } : {
859+ args : Args ;
860+ scoresPath : string ;
861+ taxonomy : QaMaturityTaxonomy ;
862+ taxonomyPath : string ;
863+ } ) : void {
864+ const { warnings } = readValidatedQaMaturityScoreSources ( {
865+ scoresPath,
866+ taxonomy,
867+ taxonomyPath,
868+ } ) ;
869+ writeInputWarnings ( warnings ) ;
870+ if ( args . strictInputs ) {
871+ enforceStrictInputs ( warnings ) ;
872+ }
873+
874+ const missing = MATURITY_DOC_OUTPUTS . map ( ( fileName ) =>
875+ path . join ( args . outputDir , fileName ) ,
876+ ) . filter ( ( outputPath ) => ! fs . existsSync ( outputPath ) ) ;
877+ if ( missing . length > 0 ) {
878+ throw new Error (
879+ `maturity docs check cannot skip evidence-backed freshness because generated docs are missing:\n${ missing . map ( ( file ) => `- ${ file } ` ) . join ( "\n" ) } ` ,
880+ ) ;
881+ }
882+ }
883+
851884function main ( ) : void {
852885 const args = parseArgs ( process . argv . slice ( 2 ) ) ;
853886 const taxonomyPath = path . normalize ( args . taxonomy ) ;
854887 const scoresPath = path . normalize ( args . scores ) ;
855888 const docsRoot = path . normalize ( args . docsRoot ) ;
856889 const outputDir = path . normalize ( args . outputDir ) ;
857- const evidenceSummaries = readEvidenceSummaries ( args . evidenceDir ) ;
858890 const taxonomy = readQaMaturityTaxonomySource ( taxonomyPath ) ;
891+ if ( args . check && ! args . evidenceDir ?. trim ( ) ) {
892+ checkEvidenceIndependentInputs ( {
893+ args : { ...args , outputDir } ,
894+ scoresPath,
895+ taxonomy,
896+ taxonomyPath,
897+ } ) ;
898+ process . stdout . write (
899+ `maturity docs inputs are valid in ${ outputDir } ; evidence-backed freshness check skipped because --evidence-dir was not supplied\n` ,
900+ ) ;
901+ return ;
902+ }
903+
904+ const evidenceSummaries = readEvidenceSummaries ( args . evidenceDir ) ;
859905 const coverage = deriveCoverageScores ( taxonomy , evidenceSummaries ) ;
860906 const { scores, warnings : scoreWarnings } = readValidatedQaMaturityScoreSources ( {
861907 coverageScores : coverage ,
0 commit comments