Run the dependency analysis, write results to workspace files, and return a compact summary with file paths.
(
arguments: Dict[str, Any],
store: SessionStore,
)
| 280 | or cf.endswith("/" + comp_file) |
| 281 | ): |
| 282 | hit = True |
| 283 | break |
| 284 | # Changed dir contains the component file, or vice versa |
| 285 | if cf.startswith(comp_file + "/") or comp_file.startswith(cf + "/"): |
| 286 | hit = True |
| 287 | break |
| 288 | if hit: |
| 289 | break |
| 290 | if hit: |
| 291 | affected.add(mod_name) |
| 292 | cascade.update(parents) |
| 293 | |
| 294 | children = mod_info.get("children", {}) |
| 295 | if isinstance(children, dict) and children: |
| 296 | _walk(children, parents + [mod_name]) |
| 297 | |
| 298 | _walk(module_tree) |
| 299 | |
| 300 | # overview.md depends on all child docs, always refresh if anything changed |
| 301 | if affected: |
| 302 | cascade.add("overview") |
| 303 | |
| 304 | return affected, cascade |
| 305 | |
| 306 | |
| 307 | def handle_analyze_repo( |
| 308 | arguments: dict[str, Any], |
| 309 | store: SessionStore, |
| 310 | ) -> str: |
| 311 | """Run the dependency analysis, write results to workspace files, |
| 312 | and return a compact summary with file paths.""" |
| 313 | repo_path = Path(arguments["repo_path"]).expanduser().resolve() |
| 314 | if not repo_path.exists(): |
| 315 | return json.dumps({"error": f"Repository not found: {repo_path}"}) |
| 316 | |
| 317 | output_dir = Path(arguments.get("output_dir", str(repo_path / "docs"))).expanduser().resolve() |
| 318 | output_dir.mkdir(parents=True, exist_ok=True) |
| 319 | |
| 320 | # Build a minimal Config for the dependency analyzer (no LLM fields used) |
| 321 | from codewiki.src.config import Config |
| 322 | |
| 323 | config = Config( |
| 324 | repo_path=str(repo_path), |
| 325 | output_dir=str(output_dir / "temp"), |
| 326 | dependency_graph_dir=str(output_dir / "temp" / "dependency_graphs"), |
| 327 | docs_dir=str(output_dir), |
| 328 | max_depth=2, |
| 329 | llm_base_url="not-needed", |
| 330 | llm_api_key="not-needed", |
| 331 | main_model="unused", |
| 332 | cluster_model="unused", |
| 333 | use_gitignore=arguments.get("use_gitignore", True), |
| 334 | ) |
| 335 | |
| 336 | # Apply optional include/exclude patterns |
| 337 | include = arguments.get("include_patterns") |
| 338 | exclude = arguments.get("exclude_patterns") |
| 339 | if include or exclude: |