@@ -85,6 +85,8 @@ type DerivedCoverageScores = QaMaturityCoverageScores & {
|
85 | 85 | warnings: string[]; |
86 | 86 | }; |
87 | 87 | |
| 88 | +const MATURITY_DOC_OUTPUTS = ["maturity/scorecard.md", "maturity/taxonomy.md"] as const; |
| 89 | + |
88 | 90 | function parseArgs(argv: string[]): Args { |
89 | 91 | const args: Args = { |
90 | 92 | taxonomy: DEFAULT_TAXONOMY_PATH, |
@@ -848,14 +850,58 @@ function writeOrCheck(outputPath: string, content: string, check: boolean): bool
|
848 | 850 | return false; |
849 | 851 | } |
850 | 852 | |
| 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 | + |
851 | 884 | function main(): void { |
852 | 885 | const args = parseArgs(process.argv.slice(2)); |
853 | 886 | const taxonomyPath = path.normalize(args.taxonomy); |
854 | 887 | const scoresPath = path.normalize(args.scores); |
855 | 888 | const docsRoot = path.normalize(args.docsRoot); |
856 | 889 | const outputDir = path.normalize(args.outputDir); |
857 | | -const evidenceSummaries = readEvidenceSummaries(args.evidenceDir); |
858 | 890 | 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); |
859 | 905 | const coverage = deriveCoverageScores(taxonomy, evidenceSummaries); |
860 | 906 | const { scores, warnings: scoreWarnings } = readValidatedQaMaturityScoreSources({ |
861 | 907 | coverageScores: coverage, |
|