llm-code-lens


Namellm-code-lens JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryIntelligent code analysis tool for LLM context generation
upload_time2025-01-12 09:01:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords ast code analysis llm sql analysis static analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CodeLens - Intelligent Code Analysis Tool

CodeLens is an intelligent code analysis tool designed to generate LLM-friendly context from your codebase. With seamless integration and insightful output, it helps developers analyze their projects effectively.

---

## Features

- **Multi-language support**: Analyzes Python and JavaScript/TypeScript codebases.
- **LLM-optimized analysis**: Extracts key elements like functions, classes, dependencies, and comments.
- **Token-friendly outputs**: Splits large file contents into token-limited chunks for LLM compatibility.
- **Seamless CLI**: Easy-to-use command-line interface with multiple options.
- **TODO tracking**: Highlights TODOs and FIXMEs for better code maintenance.
- **Pre-commit hook integration**: Automatically runs tests before committing to ensure code quality.

---

## Installation

To install CodeLens, use pip:

```bash
pip install llm-code-lens
```

---

## Usage

### Basic Usage
Analyze the current directory:
```bash
llmcl
```

Analyze a specific directory:
```bash
llmcl path/to/your/code
```

Specify output format (default is `txt`):
```bash
llmcl --format json
```

### Advanced Options
- Export full file contents in token-limited chunks:
  ```bash
  llmcl --full
  ```

- Enable debug output:
  ```bash
  llmcl --debug
  ```

- Customize the output directory:
  ```bash
  llmcl --output /path/to/output
  ```

---

## Configuration

CodeLens requires no additional configuration. However, you can integrate it with pre-commit hooks for seamless testing workflows.

### Setting up Pre-commit Hooks

1. Navigate to the `scripts/` directory.
2. Run the following script to install the pre-commit hook:
   ```bash
   python scripts/install-hooks.py
   ```
3. The pre-commit hook will automatically run tests using `pytest` before committing.

---

## Output Structure

CodeLens creates a `.codelens` directory containing the following:
- **`analysis.txt` (or `.json`)**: Complete codebase analysis, including:
  - Project summary
  - Key insights
  - File structure and context
  - Dependencies
  - TODOs and comments
- **Full file content files**: When using the `--full` option, the full content of files is exported in token-limited chunks.

---

## SQL Server Integration

CodeLens supports analyzing SQL Server databases including stored procedures, views, and functions.

### Prerequisites

1. **ODBC Driver**: Install the Microsoft ODBC Driver for SQL Server:
   - Windows: Install "ODBC Driver 17 for SQL Server" from Microsoft
   - Linux: Follow [Microsoft's instructions](https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server) for your distribution

2. **Database Access**: Ensure you have appropriate permissions to view database objects

### Configuration

Three ways to configure SQL Server access:

1. **Environment Variables**:
   ```bash
   export MSSQL_SERVER=your_server
   export MSSQL_DATABASE=your_database  # Optional
   export MSSQL_USERNAME=your_username
   export MSSQL_PASSWORD=your_password
   ```

2. **Command Line Options**:
   ```bash
   llmcl --sql-server "server_name" --sql-database "database_name"
   ```

3. **Configuration File** (recommended for teams):
   Create a `sql-config.json`:
   ```json
   {
     "server": "server_name",
     "database": "database_name",
     "env": {
       "MSSQL_USERNAME": "username",
       "MSSQL_PASSWORD": "password"
     }
   }
   ```
   Then use:
   ```bash
   llmcl --sql-config sql-config.json
   ```

### Usage Examples

Analyze both files and SQL Server:
```bash
llmcl --sql-server "server_name" --sql-database "database_name"
```

Export full object definitions:
```bash
llmcl --sql-server "server_name" --sql-database "database_name" --full
```

Analyze specific database with JSON output:
```bash
llmcl --sql-config sql-config.json --format json
```

### Output Structure

SQL analysis includes:
- Object inventory (procedures, views, functions)
- Dependencies between objects
- Complexity metrics
- TODOs and comments
- Parameter analysis
- Full object definitions (with --full flag)

### Security Notes

- Never commit SQL configuration files with credentials
- Use environment variables or secure secret management
- Consider using integrated security when possible
- Ensure minimum required permissions for analysis

---

## Requirements

- Python >= 3.8

---

## Development

### Setting up the Environment

1. Clone the repository:
   ```bash
   git clone https://github.com/SikamikanikoBG/codelens.git
   ```
2. Navigate to the project directory:
   ```bash
   cd codelens
   ```
3. Create a virtual environment and activate it:
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows: venv\Scripts\activate
   ```
4. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

### Running Tests

Run the test suite using:
```bash
pytest
```

---

## Contributing

We welcome contributions! To get started:
1. Fork the repository.
2. Create a new branch for your feature or fix.
3. Submit a pull request with a detailed description of your changes.

---

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## Support

For issues or feature requests, please visit our [GitHub Issues](https://github.com/SikamikanikoBG/codelens/issues).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-code-lens",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ast, code analysis, llm, sql analysis, static analysis",
    "author": null,
    "author_email": "Arsen Apostolov <arsen.apostolov@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fb/07/480b2e18c63f171f580963555a6f289c4836c4bc0f684aa2e2ddbafa4e12/llm_code_lens-0.3.0.tar.gz",
    "platform": null,
    "description": "# CodeLens - Intelligent Code Analysis Tool\n\nCodeLens is an intelligent code analysis tool designed to generate LLM-friendly context from your codebase. With seamless integration and insightful output, it helps developers analyze their projects effectively.\n\n---\n\n## Features\n\n- **Multi-language support**: Analyzes Python and JavaScript/TypeScript codebases.\n- **LLM-optimized analysis**: Extracts key elements like functions, classes, dependencies, and comments.\n- **Token-friendly outputs**: Splits large file contents into token-limited chunks for LLM compatibility.\n- **Seamless CLI**: Easy-to-use command-line interface with multiple options.\n- **TODO tracking**: Highlights TODOs and FIXMEs for better code maintenance.\n- **Pre-commit hook integration**: Automatically runs tests before committing to ensure code quality.\n\n---\n\n## Installation\n\nTo install CodeLens, use pip:\n\n```bash\npip install llm-code-lens\n```\n\n---\n\n## Usage\n\n### Basic Usage\nAnalyze the current directory:\n```bash\nllmcl\n```\n\nAnalyze a specific directory:\n```bash\nllmcl path/to/your/code\n```\n\nSpecify output format (default is `txt`):\n```bash\nllmcl --format json\n```\n\n### Advanced Options\n- Export full file contents in token-limited chunks:\n  ```bash\n  llmcl --full\n  ```\n\n- Enable debug output:\n  ```bash\n  llmcl --debug\n  ```\n\n- Customize the output directory:\n  ```bash\n  llmcl --output /path/to/output\n  ```\n\n---\n\n## Configuration\n\nCodeLens requires no additional configuration. However, you can integrate it with pre-commit hooks for seamless testing workflows.\n\n### Setting up Pre-commit Hooks\n\n1. Navigate to the `scripts/` directory.\n2. Run the following script to install the pre-commit hook:\n   ```bash\n   python scripts/install-hooks.py\n   ```\n3. The pre-commit hook will automatically run tests using `pytest` before committing.\n\n---\n\n## Output Structure\n\nCodeLens creates a `.codelens` directory containing the following:\n- **`analysis.txt` (or `.json`)**: Complete codebase analysis, including:\n  - Project summary\n  - Key insights\n  - File structure and context\n  - Dependencies\n  - TODOs and comments\n- **Full file content files**: When using the `--full` option, the full content of files is exported in token-limited chunks.\n\n---\n\n## SQL Server Integration\n\nCodeLens supports analyzing SQL Server databases including stored procedures, views, and functions.\n\n### Prerequisites\n\n1. **ODBC Driver**: Install the Microsoft ODBC Driver for SQL Server:\n   - Windows: Install \"ODBC Driver 17 for SQL Server\" from Microsoft\n   - Linux: Follow [Microsoft's instructions](https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server) for your distribution\n\n2. **Database Access**: Ensure you have appropriate permissions to view database objects\n\n### Configuration\n\nThree ways to configure SQL Server access:\n\n1. **Environment Variables**:\n   ```bash\n   export MSSQL_SERVER=your_server\n   export MSSQL_DATABASE=your_database  # Optional\n   export MSSQL_USERNAME=your_username\n   export MSSQL_PASSWORD=your_password\n   ```\n\n2. **Command Line Options**:\n   ```bash\n   llmcl --sql-server \"server_name\" --sql-database \"database_name\"\n   ```\n\n3. **Configuration File** (recommended for teams):\n   Create a `sql-config.json`:\n   ```json\n   {\n     \"server\": \"server_name\",\n     \"database\": \"database_name\",\n     \"env\": {\n       \"MSSQL_USERNAME\": \"username\",\n       \"MSSQL_PASSWORD\": \"password\"\n     }\n   }\n   ```\n   Then use:\n   ```bash\n   llmcl --sql-config sql-config.json\n   ```\n\n### Usage Examples\n\nAnalyze both files and SQL Server:\n```bash\nllmcl --sql-server \"server_name\" --sql-database \"database_name\"\n```\n\nExport full object definitions:\n```bash\nllmcl --sql-server \"server_name\" --sql-database \"database_name\" --full\n```\n\nAnalyze specific database with JSON output:\n```bash\nllmcl --sql-config sql-config.json --format json\n```\n\n### Output Structure\n\nSQL analysis includes:\n- Object inventory (procedures, views, functions)\n- Dependencies between objects\n- Complexity metrics\n- TODOs and comments\n- Parameter analysis\n- Full object definitions (with --full flag)\n\n### Security Notes\n\n- Never commit SQL configuration files with credentials\n- Use environment variables or secure secret management\n- Consider using integrated security when possible\n- Ensure minimum required permissions for analysis\n\n---\n\n## Requirements\n\n- Python >= 3.8\n\n---\n\n## Development\n\n### Setting up the Environment\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/SikamikanikoBG/codelens.git\n   ```\n2. Navigate to the project directory:\n   ```bash\n   cd codelens\n   ```\n3. Create a virtual environment and activate it:\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   ```\n4. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n### Running Tests\n\nRun the test suite using:\n```bash\npytest\n```\n\n---\n\n## Contributing\n\nWe welcome contributions! To get started:\n1. Fork the repository.\n2. Create a new branch for your feature or fix.\n3. Submit a pull request with a detailed description of your changes.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## Support\n\nFor issues or feature requests, please visit our [GitHub Issues](https://github.com/SikamikanikoBG/codelens/issues).\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Intelligent code analysis tool for LLM context generation",
    "version": "0.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/SikamikanikoBG/codelens/issues",
        "Homepage": "https://github.com/SikamikanikoBG/codelens.git"
    },
    "split_keywords": [
        "ast",
        " code analysis",
        " llm",
        " sql analysis",
        " static analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "503ac3ad705b37b2ad11fdcd6913f40ab47e74472daa2f167a482e38fe283cb6",
                "md5": "71471d2ccafe6a388403de2f447312f3",
                "sha256": "850d3f065e8750a1b3232fba0fd9db40a2ce1f0420032ee68a51a3959ff9d5f2"
            },
            "downloads": -1,
            "filename": "llm_code_lens-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "71471d2ccafe6a388403de2f447312f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 31061,
            "upload_time": "2025-01-12T09:01:43",
            "upload_time_iso_8601": "2025-01-12T09:01:43.173462Z",
            "url": "https://files.pythonhosted.org/packages/50/3a/c3ad705b37b2ad11fdcd6913f40ab47e74472daa2f167a482e38fe283cb6/llm_code_lens-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb07480b2e18c63f171f580963555a6f289c4836c4bc0f684aa2e2ddbafa4e12",
                "md5": "f9e26ba161684ca08db99a5a164b5edb",
                "sha256": "f8997fa2eba616109108aae022edee4b4d1f203ac1d851e10652aa08a9aa74ad"
            },
            "downloads": -1,
            "filename": "llm_code_lens-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f9e26ba161684ca08db99a5a164b5edb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 130929,
            "upload_time": "2025-01-12T09:01:44",
            "upload_time_iso_8601": "2025-01-12T09:01:44.887869Z",
            "url": "https://files.pythonhosted.org/packages/fb/07/480b2e18c63f171f580963555a6f289c4836c4bc0f684aa2e2ddbafa4e12/llm_code_lens-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-12 09:01:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SikamikanikoBG",
    "github_project": "codelens",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "llm-code-lens"
}
        
Elapsed time: 0.79606s