Metadata-Version: 2.4
Name: codereporter
Version: 0.2.4
Summary: Generate instant HTML code-intelligence reports for any repository
Project-URL: Homepage, https://github.com/yourusername/codereporter
Project-URL: Repository, https://github.com/yourusername/codereporter
Project-URL: Issues, https://github.com/yourusername/codereporter/issues
License: MIT
License-File: LICENSE
Keywords: analysis,cli,code,loc,report,statistics
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# codereporter

**One command. Instant HTML code-intelligence report for any repository.**

```
codereporter /path/to/your/project
```

Opens a self-contained dashboard in your browser with:

- Lines of code, comment ratio, blank lines — per file and overall
- Language breakdown with share bars and charts
- Functions, async functions, classes — with counts
- API endpoint detection (FastAPI, Flask, Express.js)
- TODO / FIXME / HACK / BUG tracker with file + line references
- Top imported packages ranked by usage frequency
- Long-line detector (>100 chars)

---

## Installation

### pip

```bash
pip install codereporter
```

### uv

```bash
uv pip install codereporter
```

### from source

```bash
git clone https://github.com/yourusername/codereporter
cd codereporter
pip install -e .
```

---

## Usage

```bash
# Analyse the current directory
codereporter

# Analyse a specific repo
codereporter /path/to/project

# Custom output file name
codereporter /path/to/project --output my_report.html

# Don't auto-open the browser
codereporter . --no-open

# Also dump raw JSON stats
codereporter . --json

# Show version
codereporter --version
```

The HTML report is written into the analysed directory (default: `code_report.html`) and opened in your browser automatically.

---

## Python API

You can also use `codereporter` as a library:

```python
from codereporter import count_code_stats, build_html

data = count_code_stats("/path/to/repo")

# Access structured stats
print(data["summary"]["functions"])      # total function count
print(data["by_language"]["Python"])     # per-language breakdown
print(data["todos"])                     # list of TODO/FIXME items
print(data["endpoints"])                 # list of detected API endpoints

# Generate the HTML report
html = build_html(data)
with open("report.html", "w") as f:
    f.write(html)
```

### Data shape

`count_code_stats()` returns:

```python
{
    "summary": {
        "root": str,
        "generated_at": str,   # ISO timestamp
        "files": int,
        "loc": int,            # total lines
        "blank": int,
        "comments": int,
        "code": int,
        "functions": int,
        "async_functions": int,
        "classes": int,
        "endpoints": int,
        "todos": int,
        "long_lines": int,
    },
    "by_language": {
        "Python": {"files": int, "loc": int, "code": int, "comments": int,
                   "functions": int, "classes": int, "endpoints": int},
        ...
    },
    "file_details": [
        {"path": str, "lang": str, "loc": int, "code": int, "comments": int,
         "comment_ratio": float, "functions": int, "classes": int,
         "endpoints": int, "todos": int, "long_lines": int, "max_line_len": int},
        ...  # sorted by LOC descending
    ],
    "todos": [
        {"file": str, "line": int, "tag": str, "text": str},
        ...
    ],
    "endpoints": [
        {"file": str, "line": int, "method": str, "raw": str},
        ...
    ],
    "top_imports": [("requests", 12), ("os", 9), ...],  # top 20
}
```

---

## Supported languages

Python · JavaScript · TypeScript · JSX/TSX · Java · Go · Rust · C# · PHP · Ruby · Kotlin · Swift · SQL · Shell · YAML · TOML · JSON · Markdown · HTML · CSS · SCSS · Sass · Less · Vue · Svelte · C · C++

---

## Ignored directories

`.git` · `__pycache__` · `.venv` / `venv` / `env` · `node_modules` · `dist` · `build` · `.mypy_cache` · `.pytest_cache` · `.next` · `.nuxt` · `coverage` · `.tox`

---

## Requirements

- Python 3.11+
- No external runtime dependencies (stdlib only)

---

## License

MIT