#!/usr/bin/env python3 """ doocus CLI — extract one document into a textified run folder. Parallels process_meeting.py. Deterministic and offline: no cloud AI touches the source. Produces docs-output//{content.md, meta.json, thumb.jpg?, manifest.json}. python process_doc.py notes.docx python process_doc.py report.pdf --output-dir docs-output/run1 python process_doc.py scan.png --ocr """ import argparse import logging import sys from doocus.workflow import DocConfig, DocWorkflow def main() -> int: parser = argparse.ArgumentParser(description="Extract a document into a textified run folder.") parser.add_argument("source", help="Path to the document to extract") parser.add_argument("--output-dir", default="docs-output", help="Base output directory (default: docs-output)") parser.add_argument("--no-cache", action="store_true", help="Force a fresh run folder instead of reusing the latest") parser.add_argument("--render", action="store_true", help="Render page/slide images where supported (needs extra deps)") parser.add_argument("--ocr", action="store_true", help="OCR images / scanned PDFs (needs pytesseract + tesseract)") parser.add_argument("--verbose", action="store_true", help="Verbose logging") args = parser.parse_args() logging.basicConfig( level=logging.DEBUG if args.verbose else logging.INFO, format="%(message)s", ) config = DocConfig( source=args.source, output_dir=args.output_dir, no_cache=args.no_cache, render=args.render, ocr=args.ocr, ) try: result = DocWorkflow(config).run() except FileNotFoundError as e: print(f"ERROR: {e}", file=sys.stderr) return 1 print(f"\nāœ“ {result['family']} → {result['output_dir']}") if result["warnings"]: print(" warnings: " + "; ".join(result["warnings"])) return 0 if __name__ == "__main__": sys.exit(main())