code-discovery


Namecode-discovery JSON
Version 0.1.11 PyPI version JSON
download
home_pagehttps://github.com/yourusername/codediscovery
SummaryAutomatic API discovery system for multiple frameworks and VCS platforms
upload_time2025-10-16 15:31:24
maintainerNone
docs_urlNone
authorCode Discovery Team
requires_python>=3.9
licenseNone
keywords api openapi swagger documentation discovery spring-boot fastapi flask micronaut aspnet
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Code Discovery - Automatic API Discovery System

[![GitHub release](https://img.shields.io/github/v/release/YOUR_USERNAME/code-discovery)](https://github.com/YOUR_USERNAME/code-discovery/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)

## Overview

Code Discovery is an automated system that discovers API endpoints in code repositories and generates OpenAPI specifications. It supports multiple version control systems and frameworks, running entirely within your VCS runners for maximum security.

## ⚑ Quick Start

```bash
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/code-discovery.git
cd code-discovery

# 2. Install
pip install -r requirements.txt
pip install -e .

# 3. Run on your project
code-discovery --repo-path /path/to/your/api/project
```

βœ… That's it! Your OpenAPI spec is generated at `openapi-spec.yaml`

πŸ“– **Detailed Instructions**: See [INSTALL_INSTRUCTIONS.md](INSTALL_INSTRUCTIONS.md)

## Features

- **Multi-VCS Support**: GitHub, GitLab, Jenkins, CircleCI, Harness
- **Multi-Framework Support**:
  - Java: Spring Boot, Micronaut
  - Python: FastAPI, Flask
  - .NET: ASP.NET Core
- **Automatic OpenAPI Generation**: Discovers endpoints, inputs, outputs, and authentication requirements
- **Secure Execution**: Runs entirely on your infrastructure - code never leaves your VCS environment
- **Extensible Architecture**: Easy to add new frameworks and VCS platforms

## Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    VCS Platform                         β”‚
β”‚  (GitHub/GitLab/Jenkins/CircleCI/Harness)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Orchestrator                          β”‚
β”‚  - Coordinates the discovery workflow                   β”‚
β”‚  - Manages VCS interactions                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β–Ό             β–Ό             β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Detectorsβ”‚   β”‚  Parsers β”‚   β”‚Generator β”‚
    β”‚          β”‚   β”‚          β”‚   β”‚          β”‚
    β”‚Framework β”‚   β”‚API Info  β”‚   β”‚ OpenAPI  β”‚
    β”‚Detection β”‚   β”‚Extractionβ”‚   β”‚   Spec   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Installation

### Method 1: Install from GitHub (Recommended)

```bash
# Clone the repository
git clone https://github.com/YOUR_USERNAME/code-discovery.git
cd code-discovery

# Install dependencies and package
pip install -r requirements.txt
pip install -e .

# Verify installation
code-discovery --version
```

πŸ“– **Full installation guide**: [INSTALL_INSTRUCTIONS.md](INSTALL_INSTRUCTIONS.md)

### Method 2: CI/CD Integration

**GitHub Actions** - Add to `.github/workflows/api-discovery.yml`:
```yaml
- name: Install Code Discovery
  run: |
    git clone https://github.com/YOUR_USERNAME/code-discovery.git /tmp/code-discovery
    cd /tmp/code-discovery
    pip install -r requirements.txt
    pip install -e .

- name: Run Discovery
  run: code-discovery --repo-path .
```

**GitLab CI** - Add to `.gitlab-ci.yml`:
```yaml
before_script:
  - git clone https://github.com/YOUR_USERNAME/code-discovery.git /tmp/code-discovery
  - cd /tmp/code-discovery && pip install -r requirements.txt && pip install -e .
  - cd $CI_PROJECT_DIR

script:
  - code-discovery --repo-path .
```

See example configurations in `.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, etc.

## Configuration

Create a `.codediscovery.yml` file in your repository root:

```yaml
# API Discovery Configuration
api_discovery:
  enabled: true
  
  # Frameworks to scan (leave empty to auto-detect all)
  frameworks:
    - spring-boot
    - micronaut
    - fastapi
    - flask
    - aspnet-core
  
  # OpenAPI specification settings
  openapi:
    version: "3.0.0"
    output_path: "openapi-spec.yaml"
    include_examples: true
  
  # External API endpoint (optional)
  external_api:
    enabled: true
    endpoint: "https://api.example.com/openapi/upload"
    auth_token_env: "API_DISCOVERY_TOKEN"
```

## Usage

### Automatic (Recommended)

Once installed as a VCS app, the system automatically:
1. Triggers on push/PR events
2. Scans the repository for API frameworks
3. Extracts API endpoint information
4. Generates OpenAPI specification
5. Commits the spec back to the repository
6. Notifies your external API endpoint

### Manual Execution

```bash
# Run discovery on current directory
python -m src.main

# Specify repository path
python -m src.main --repo-path /path/to/repo

# Dry run (don't commit back)
python -m src.main --dry-run
```

## Extending the System

### Adding a New Framework

1. Create a detector in `src/detectors/your_framework.py`:
```python
from src.detectors.base import BaseDetector

class YourFrameworkDetector(BaseDetector):
    def detect(self) -> bool:
        # Detection logic
        pass
```

2. Create a parser in `src/parsers/your_framework_parser.py`:
```python
from src.parsers.base import BaseParser

class YourFrameworkParser(BaseParser):
    def parse(self) -> List[APIEndpoint]:
        # Parsing logic
        pass
```

### Adding a New VCS Platform

Implement the `BaseVCSAdapter` interface in `src/vcs/your_platform.py`:
```python
from src.vcs.base import BaseVCSAdapter

class YourPlatformAdapter(BaseVCSAdapter):
    def get_repository_path(self) -> str:
        pass
    
    def commit_file(self, file_path: str, message: str):
        pass
```

## Security Considerations

- Code never leaves your VCS environment
- Runs on your own runners/agents
- Supports secret management via environment variables
- OpenAPI specs are committed to your repository under your control

## License

MIT License - See LICENSE file for details

## Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/codediscovery",
    "name": "code-discovery",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "api, openapi, swagger, documentation, discovery, spring-boot, fastapi, flask, micronaut, aspnet",
    "author": "Code Discovery Team",
    "author_email": "team@codediscovery.dev",
    "download_url": "https://files.pythonhosted.org/packages/23/60/cd5770aa51b13030bcf38b7e804d2dfdd6f27bfb7399008da127bd418d32/code_discovery-0.1.11.tar.gz",
    "platform": null,
    "description": "# Code Discovery - Automatic API Discovery System\n\n[![GitHub release](https://img.shields.io/github/v/release/YOUR_USERNAME/code-discovery)](https://github.com/YOUR_USERNAME/code-discovery/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)\n\n## Overview\n\nCode Discovery is an automated system that discovers API endpoints in code repositories and generates OpenAPI specifications. It supports multiple version control systems and frameworks, running entirely within your VCS runners for maximum security.\n\n## \u26a1 Quick Start\n\n```bash\n# 1. Clone the repository\ngit clone https://github.com/YOUR_USERNAME/code-discovery.git\ncd code-discovery\n\n# 2. Install\npip install -r requirements.txt\npip install -e .\n\n# 3. Run on your project\ncode-discovery --repo-path /path/to/your/api/project\n```\n\n\u2705 That's it! Your OpenAPI spec is generated at `openapi-spec.yaml`\n\n\ud83d\udcd6 **Detailed Instructions**: See [INSTALL_INSTRUCTIONS.md](INSTALL_INSTRUCTIONS.md)\n\n## Features\n\n- **Multi-VCS Support**: GitHub, GitLab, Jenkins, CircleCI, Harness\n- **Multi-Framework Support**:\n  - Java: Spring Boot, Micronaut\n  - Python: FastAPI, Flask\n  - .NET: ASP.NET Core\n- **Automatic OpenAPI Generation**: Discovers endpoints, inputs, outputs, and authentication requirements\n- **Secure Execution**: Runs entirely on your infrastructure - code never leaves your VCS environment\n- **Extensible Architecture**: Easy to add new frameworks and VCS platforms\n\n## Architecture\n\n```\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                    VCS Platform                         \u2502\n\u2502  (GitHub/GitLab/Jenkins/CircleCI/Harness)              \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                          \u2502\n                          \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                   Orchestrator                          \u2502\n\u2502  - Coordinates the discovery workflow                   \u2502\n\u2502  - Manages VCS interactions                            \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                          \u2502\n            \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n            \u25bc             \u25bc             \u25bc\n    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n    \u2502 Detectors\u2502   \u2502  Parsers \u2502   \u2502Generator \u2502\n    \u2502          \u2502   \u2502          \u2502   \u2502          \u2502\n    \u2502Framework \u2502   \u2502API Info  \u2502   \u2502 OpenAPI  \u2502\n    \u2502Detection \u2502   \u2502Extraction\u2502   \u2502   Spec   \u2502\n    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Installation\n\n### Method 1: Install from GitHub (Recommended)\n\n```bash\n# Clone the repository\ngit clone https://github.com/YOUR_USERNAME/code-discovery.git\ncd code-discovery\n\n# Install dependencies and package\npip install -r requirements.txt\npip install -e .\n\n# Verify installation\ncode-discovery --version\n```\n\n\ud83d\udcd6 **Full installation guide**: [INSTALL_INSTRUCTIONS.md](INSTALL_INSTRUCTIONS.md)\n\n### Method 2: CI/CD Integration\n\n**GitHub Actions** - Add to `.github/workflows/api-discovery.yml`:\n```yaml\n- name: Install Code Discovery\n  run: |\n    git clone https://github.com/YOUR_USERNAME/code-discovery.git /tmp/code-discovery\n    cd /tmp/code-discovery\n    pip install -r requirements.txt\n    pip install -e .\n\n- name: Run Discovery\n  run: code-discovery --repo-path .\n```\n\n**GitLab CI** - Add to `.gitlab-ci.yml`:\n```yaml\nbefore_script:\n  - git clone https://github.com/YOUR_USERNAME/code-discovery.git /tmp/code-discovery\n  - cd /tmp/code-discovery && pip install -r requirements.txt && pip install -e .\n  - cd $CI_PROJECT_DIR\n\nscript:\n  - code-discovery --repo-path .\n```\n\nSee example configurations in `.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, etc.\n\n## Configuration\n\nCreate a `.codediscovery.yml` file in your repository root:\n\n```yaml\n# API Discovery Configuration\napi_discovery:\n  enabled: true\n  \n  # Frameworks to scan (leave empty to auto-detect all)\n  frameworks:\n    - spring-boot\n    - micronaut\n    - fastapi\n    - flask\n    - aspnet-core\n  \n  # OpenAPI specification settings\n  openapi:\n    version: \"3.0.0\"\n    output_path: \"openapi-spec.yaml\"\n    include_examples: true\n  \n  # External API endpoint (optional)\n  external_api:\n    enabled: true\n    endpoint: \"https://api.example.com/openapi/upload\"\n    auth_token_env: \"API_DISCOVERY_TOKEN\"\n```\n\n## Usage\n\n### Automatic (Recommended)\n\nOnce installed as a VCS app, the system automatically:\n1. Triggers on push/PR events\n2. Scans the repository for API frameworks\n3. Extracts API endpoint information\n4. Generates OpenAPI specification\n5. Commits the spec back to the repository\n6. Notifies your external API endpoint\n\n### Manual Execution\n\n```bash\n# Run discovery on current directory\npython -m src.main\n\n# Specify repository path\npython -m src.main --repo-path /path/to/repo\n\n# Dry run (don't commit back)\npython -m src.main --dry-run\n```\n\n## Extending the System\n\n### Adding a New Framework\n\n1. Create a detector in `src/detectors/your_framework.py`:\n```python\nfrom src.detectors.base import BaseDetector\n\nclass YourFrameworkDetector(BaseDetector):\n    def detect(self) -> bool:\n        # Detection logic\n        pass\n```\n\n2. Create a parser in `src/parsers/your_framework_parser.py`:\n```python\nfrom src.parsers.base import BaseParser\n\nclass YourFrameworkParser(BaseParser):\n    def parse(self) -> List[APIEndpoint]:\n        # Parsing logic\n        pass\n```\n\n### Adding a New VCS Platform\n\nImplement the `BaseVCSAdapter` interface in `src/vcs/your_platform.py`:\n```python\nfrom src.vcs.base import BaseVCSAdapter\n\nclass YourPlatformAdapter(BaseVCSAdapter):\n    def get_repository_path(self) -> str:\n        pass\n    \n    def commit_file(self, file_path: str, message: str):\n        pass\n```\n\n## Security Considerations\n\n- Code never leaves your VCS environment\n- Runs on your own runners/agents\n- Supports secret management via environment variables\n- OpenAPI specs are committed to your repository under your control\n\n## License\n\nMIT License - See LICENSE file for details\n\n## Contributing\n\nContributions are welcome! Please read CONTRIBUTING.md for guidelines.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Automatic API discovery system for multiple frameworks and VCS platforms",
    "version": "0.1.11",
    "project_urls": {
        "Bug Reports": "https://github.com/yourusername/codediscovery/issues",
        "Documentation": "https://docs.code-discovery.io",
        "Homepage": "https://github.com/yourusername/codediscovery",
        "Source": "https://github.com/yourusername/codediscovery"
    },
    "split_keywords": [
        "api",
        " openapi",
        " swagger",
        " documentation",
        " discovery",
        " spring-boot",
        " fastapi",
        " flask",
        " micronaut",
        " aspnet"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c9c7cd180b757330c9476603658dfd9c2fed2dd29231e12608201adec2a7b83a",
                "md5": "ab60dca9198a28a28bd82e1261291b04",
                "sha256": "cb4907744b61bfedb38b84c771c5f30cdb599c7aa918fa411b56ac3998379492"
            },
            "downloads": -1,
            "filename": "code_discovery-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab60dca9198a28a28bd82e1261291b04",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 54772,
            "upload_time": "2025-10-16T15:31:22",
            "upload_time_iso_8601": "2025-10-16T15:31:22.656652Z",
            "url": "https://files.pythonhosted.org/packages/c9/c7/cd180b757330c9476603658dfd9c2fed2dd29231e12608201adec2a7b83a/code_discovery-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2360cd5770aa51b13030bcf38b7e804d2dfdd6f27bfb7399008da127bd418d32",
                "md5": "43a68803abe8cadb8210ec0c89d16aad",
                "sha256": "4450c9abed50b1d32bebae9effe79ca0f5a00aae77207afa5ae1734dfb7ae392"
            },
            "downloads": -1,
            "filename": "code_discovery-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "43a68803abe8cadb8210ec0c89d16aad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 47516,
            "upload_time": "2025-10-16T15:31:24",
            "upload_time_iso_8601": "2025-10-16T15:31:24.147148Z",
            "url": "https://files.pythonhosted.org/packages/23/60/cd5770aa51b13030bcf38b7e804d2dfdd6f27bfb7399008da127bd418d32/code_discovery-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-16 15:31:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "codediscovery",
    "github_not_found": true,
    "lcname": "code-discovery"
}
        
Elapsed time: 1.35188s