Explore Python codebase
(path: &str)
| 403 | |
| 404 | /// Explore Python codebase |
| 405 | pub fn explore_python(path: &str) -> String { |
| 406 | let mut report = String::new(); |
| 407 | report.push_str("\n=== PYTHON ===\n\n"); |
| 408 | |
| 409 | // File structure |
| 410 | report.push_str("--- File Structure ---\n"); |
| 411 | let files = run_command( |
| 412 | "rg --files -g '*.py' . 2>/dev/null | grep -v '/__pycache__/' | grep -v '/venv/' | grep -v '/.venv/' | sort | head -100", |
| 413 | path, |
| 414 | ); |
| 415 | report.push_str(&files); |
| 416 | report.push('\n'); |
| 417 | |
| 418 | // Requirements/setup |
| 419 | report.push_str("--- Dependencies ---\n"); |
| 420 | let deps = run_command( |
| 421 | "cat requirements.txt 2>/dev/null | head -30 || cat pyproject.toml 2>/dev/null | head -50 || cat setup.py 2>/dev/null | head -30", |
| 422 | path, |
| 423 | ); |
| 424 | report.push_str(&deps); |
| 425 | report.push('\n'); |
| 426 | |
| 427 | // Classes |
| 428 | report.push_str("--- Classes ---\n"); |
| 429 | let classes = run_command( |
| 430 | r#"rg --no-heading --line-number --with-filename --max-filesize 500K -g '*.py' '^class ' . 2>/dev/null | grep -v '/__pycache__/' | grep -v '/venv/' | head -100"#, |
| 431 | path, |
| 432 | ); |
| 433 | report.push_str(&classes); |
| 434 | report.push('\n'); |
| 435 | |
| 436 | // Functions |
| 437 | report.push_str("--- Functions ---\n"); |
| 438 | let funcs = run_command( |
| 439 | r#"rg --no-heading --line-number --with-filename --max-filesize 500K -g '*.py' '^def |^async def ' . 2>/dev/null | grep -v '/__pycache__/' | grep -v '/venv/' | head -100"#, |
| 440 | path, |
| 441 | ); |
| 442 | report.push_str(&funcs); |
| 443 | report.push('\n'); |
| 444 | |
| 445 | report |
| 446 | } |
| 447 | |
| 448 | /// Explore TypeScript codebase |
| 449 | pub fn explore_typescript(path: &str) -> String { |
no test coverage detected