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

Method detect_repository_info

codewiki/cli/html_generator.py:238–283  ·  view source on GitHub ↗

Detect repository information from git. Args: repo_path: Repository path Returns: Dictionary with 'name', 'url', 'github_pages_url'

(self, repo_path: Path)

Source from the content-addressed store, hash-verified

236 commit_short = info["commit_id"][:8]
237 html_parts.append(
238 f'<div class="info-row"><strong>Commit:</strong> {commit_short}</div>'
239 )
240
241 if stats.get("total_components"):
242 components_str = f"{stats['total_components']:,}"
243 html_parts.append(
244 f'<div class="info-row"><strong>Components:</strong> {components_str}</div>'
245 )
246
247 if stats.get("max_depth"):
248 html_parts.append(
249 f'<div class="info-row"><strong>Max Depth:</strong> {stats["max_depth"]}</div>'
250 )
251
252 return "\n ".join(html_parts)
253
254 def _escape_html(self, text: str) -> str:
255 """
256 Escape HTML special characters.
257
258 Args:
259 text: Text to escape
260
261 Returns:
262 Escaped text
263 """
264 return (
265 text.replace("&", "&amp;")
266 .replace("<", "&lt;")
267 .replace(">", "&gt;")
268 .replace('"', "&quot;")
269 .replace("'", "&#39;")
270 )
271
272 def detect_repository_info(self, repo_path: Path) -> Dict[str, Optional[str]]:
273 """
274 Detect repository information from git.
275
276 Args:
277 repo_path: Repository path
278
279 Returns:
280 Dictionary with 'name', 'url', 'github_pages_url'
281 """
282 info = {
283 "name": repo_path.name,
284 "url": None,
285 "github_pages_url": None,
286 }

Callers 1

_run_html_generationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected