diff --git a/scripts/knowledge_gap_identifier.py b/scripts/knowledge_gap_identifier.py index 27cf750..c6f657a 100644 --- a/scripts/knowledge_gap_identifier.py +++ b/scripts/knowledge_gap_identifier.py @@ -75,7 +75,7 @@ class GapReport: return { "repo_path": self.repo_path, "total_gaps": len(self.gaps), - "stats": {k: len(v) for k, v in + "stats": {k.value: len(v) for k, v in {gt: [g for g in self.gaps if g.gap_type == gt] for gt in GapType}.items() if v}, "gaps": [ @@ -273,3 +273,44 @@ class KnowledgeGapIdentifier: )) return report + +def main() -> None: + import argparse + import json + import sys + parser = argparse.ArgumentParser( + description="Knowledge Gap Identifier — cross-reference code, docs, and tests to find gaps" + ) + parser.add_argument( + "repo_path", + nargs="?", + default=".", + help="Path to repository root (default: current directory)" + ) + parser.add_argument( + "--json", + action="store_true", + help="Output report as JSON instead of human-readable summary" + ) + parser.add_argument( + "-o", "--output", + help="Write report to file instead of stdout" + ) + args = parser.parse_args() + + report = KnowledgeGapIdentifier().analyze(args.repo_path) + + if args.json: + output = json.dumps(report.to_dict(), indent=2, default=str) + else: + output = report.summary() + + if args.output: + with open(args.output, "w") as fh: + print(output, file=fh) + else: + print(output) + + +if __name__ == "__main__": + main()