Skip to content

Commit a9de7d0

Browse files
authored
Merge pull request #66 from mambo-wang/feat/mcp-refactor-and-incremental
feat: MCP server refactor with fine-grained tools and incremental update support
2 parents 8de0bdd + 2d6d83a commit a9de7d0

19 files changed

Lines changed: 2510 additions & 142 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ Thumbs.db
7272
*.tmp
7373
*.log
7474
*.bak
75+
.codewiki/

‎IDE_DRIVEN_GUIDE.md‎

Lines changed: 379 additions & 0 deletions
Large diffs are not rendered by default.

‎codewiki/__init__.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"""
22
CodeWiki: Transform codebases into comprehensive documentation using AI-powered analysis.
33
4-
This package provides a CLI tool for generating documentation from code repositories.
4+
This package provides a CLI tool for generating documentation from code repositories,
5+
and an MCP server for IDE-driven documentation generation.
56
"""
67

78
__version__ = "1.0.1"
89
__author__ = "CodeWiki Contributors"
910
__license__ = "MIT"
1011

11-
from codewiki.cli.main import cli
12-
13-
__all__ = ["cli", "__version__"]
12+
__all__ = ["__version__"]
1413

‎codewiki/cli/adapters/doc_generator.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def __init__(
3737
output_dir: Path,
3838
config: Dict[str, Any],
3939
verbose: bool = False,
40-
generate_html: bool = False
40+
generate_html: bool = False,
41+
commit_id: str = None,
4142
):
4243
"""
4344
Initialize the CLI documentation generator.
@@ -48,12 +49,14 @@ def __init__(
4849
config: LLM configuration
4950
verbose: Enable verbose output
5051
generate_html: Whether to generate HTML viewer
52+
commit_id: Git commit SHA for incremental update tracking
5153
"""
5254
self.repo_path = repo_path
5355
self.output_dir = output_dir
5456
self.config = config
5557
self.verbose = verbose
5658
self.generate_html = generate_html
59+
self.commit_id = commit_id
5760
self.progress_tracker = ProgressTracker(total_stages=5, verbose=verbose)
5861
self.job = DocumentationJob()
5962

@@ -178,7 +181,7 @@ async def _run_backend_generation(self, backend_config: BackendConfig):
178181
self.progress_tracker.update_stage(0.2, "Initializing dependency analyzer...")
179182

180183
# Create documentation generator
181-
doc_generator = DocumentationGenerator(backend_config)
184+
doc_generator = DocumentationGenerator(backend_config, commit_id=self.commit_id)
182185

183186
if self.verbose:
184187
self.progress_tracker.update_stage(0.5, "Parsing source files...")

‎codewiki/cli/commands/generate.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ def generate_command(
541541
agent_instructions_dict = config.agent_instructions.to_dict()
542542

543543
# Create generator
544+
# Get commit_id early so it can be stored in metadata.json for --update support
545+
commit_id = get_git_commit_hash(repo_path)
544546
generator = CLIDocumentationGenerator(
545547
repo_path=repo_path,
546548
output_dir=output_dir,
@@ -561,7 +563,8 @@ def generate_command(
561563
'max_depth': max_depth if max_depth is not None else config.max_depth,
562564
},
563565
verbose=verbose,
564-
generate_html=github_pages
566+
generate_html=github_pages,
567+
commit_id=commit_id,
565568
)
566569

567570
# Run generation
@@ -572,7 +575,6 @@ def generate_command(
572575

573576
# Get repository info
574577
repo_url = None
575-
commit_hash = get_git_commit_hash(repo_path)
576578
current_branch = get_git_branch(repo_path)
577579

578580
if is_git_repository(repo_path):

0 commit comments

Comments
 (0)