Metadata-Version: 2.4
Name: srcly
Version: 0.1.17
Summary: Interactive codebase treemap and metrics viewer.
Requires-Python: >=3.13
Requires-Dist: fastapi>=0.121.3
Requires-Dist: httpx>=0.28.1
Requires-Dist: lizard>=1.19.0
Requires-Dist: pathspec>=0.12.1
Requires-Dist: pydantic>=2.12.4
Requires-Dist: pytest>=9.0.1
Requires-Dist: tree-sitter-css==0.25.0
Requires-Dist: tree-sitter-markdown<0.6.0,>=0.5.1
Requires-Dist: tree-sitter-python==0.25.0
Requires-Dist: tree-sitter-scss==1.0.0
Requires-Dist: tree-sitter-typescript>=0.23.2
Requires-Dist: tree-sitter>=0.25.2
Requires-Dist: uvicorn>=0.38.0
Description-Content-Type: text/markdown

# Srcly Server

A FastAPI server for static code analysis using [lizard](https://github.com/terryyin/lizard).

## Features

- **Static Analysis**: Scans the codebase for cyclomatic complexity and LOC (Lines of Code).
- **Caching**: Caches analysis results to `codebase_mri.json` to avoid redundant scans.
- **File Serving**: Provides an API to read raw file contents (absolute paths).
- **API Documentation**: Auto-generated Swagger UI at `/docs`.

## Setup

This project is managed with `uv`.

1. **Install dependencies**:

   ```bash
   uv sync
   ```

## Running the Server

Start the server with hot-reloading:

```bash
uv run uvicorn app.main:app --reload
```

The API will be available at `http://localhost:8000`.

## API Endpoints

### Analysis

- `GET /api/analysis`: Get the analysis tree. Scans if no cache exists.
- `POST /api/analysis/refresh`: Force a new scan.

### Files

- `GET /api/files/content?path=/absolute/path/to/file`: Get raw file content.

## Client Generation

You can generate a client SDK (TypeScript, Python, etc.) using the OpenAPI schema available at `http://localhost:8000/openapi.json`.

Example using `openapi-generator-cli`:

```bash
npx @openapitools/openapi-generator-cli generate -i http://localhost:8000/openapi.json -g typescript-axios -o ../client/src/api
```
