-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme.py
More file actions
45 lines (34 loc) · 1.28 KB
/
Copy pathreadme.py
File metadata and controls
45 lines (34 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from pathlib import Path
from ..orchestrator import AIOrchestrator
from ..forge import RepoScanner
class READMEGenerator:
"""Generates README files"""
def __init__(self, repo_path: str):
self.repo_path = Path(repo_path)
self.orchestrator = AIOrchestrator()
self.scanner = RepoScanner(repo_path)
def generate(self) -> str:
"""Generate README content"""
analysis = self.scanner.analyze()
prompt = f"""Generate a professional README.md for this project:
Project Analysis:
- Languages: {analysis['languages']}
- Stats: {analysis['stats']}
- Structure: {list(analysis['structure'].keys())[:10]}
Include:
1. Project title and description
2. Features
3. Installation instructions
4. Usage examples
5. Project structure
6. Contributing guidelines
7. License
Make it professional and well-formatted in Markdown."""
return self.orchestrator.generate(prompt, task_type="documentation")
def save(self, output_path: str = None):
"""Generate and save README"""
readme = self.generate()
output = output_path or (self.repo_path / 'README.md')
with open(output, 'w') as f:
f.write(readme)
return output