MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / CLIDocumentationGenerator

Class CLIDocumentationGenerator

codewiki/cli/adapters/doc_generator.py:26–350  ·  view source on GitHub ↗

CLI adapter for documentation generation with progress reporting. This class wraps the backend documentation generator and adds CLI-specific features like progress tracking and error handling.

Source from the content-addressed store, hash-verified

24
25
26class CLIDocumentationGenerator:
27 """
28 CLI adapter for documentation generation with progress reporting.
29
30 This class wraps the backend documentation generator and adds
31 CLI-specific features like progress tracking and error handling.
32 """
33
34 def __init__(
35 self,
36 repo_path: Path,
37 output_dir: Path,
38 config: Dict[str, Any],
39 verbose: bool = False,
40 generate_html: bool = False,
41 commit_id: str = None,
42 ):
43 """
44 Initialize the CLI documentation generator.
45
46 Args:
47 repo_path: Repository path
48 output_dir: Output directory
49 config: LLM configuration
50 verbose: Enable verbose output
51 generate_html: Whether to generate HTML viewer
52 commit_id: Git commit SHA for incremental update tracking
53 """
54 self.repo_path = repo_path
55 self.output_dir = output_dir
56 self.config = config
57 self.verbose = verbose
58 self.generate_html = generate_html
59 self.commit_id = commit_id
60 self.progress_tracker = ProgressTracker(total_stages=5, verbose=verbose)
61 self.job = DocumentationJob()
62
63 # Setup job metadata
64 self.job.repository_path = str(repo_path)
65 self.job.repository_name = repo_path.name
66 self.job.output_directory = str(output_dir)
67 self.job.llm_config = LLMConfig(
68 main_model=config.get('main_model', ''),
69 cluster_model=config.get('cluster_model', ''),
70 base_url=config.get('base_url', '')
71 )
72
73 # Configure backend logging
74 self._configure_backend_logging()
75
76 def _configure_backend_logging(self):
77 """Configure backend logger for CLI use with colored output."""
78 from codewiki.src.be.dependency_analyzer.utils.logging_config import ColoredFormatter
79
80 # Get backend logger (parent of all backend modules)
81 backend_logger = logging.getLogger('codewiki.src.be')
82
83 # Remove existing handlers to avoid duplicates

Callers 1

generate_commandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected