{"id":25531165,"url":"https://github.com/gustycube/codect","last_synced_at":"2025-10-07T07:49:50.791Z","repository":{"id":277365825,"uuid":"931684634","full_name":"GustyCube/Codect","owner":"GustyCube","description":"A detector for AI-written code","archived":false,"fork":false,"pushed_at":"2025-07-31T05:14:45.000Z","size":150,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-31T07:38:25.741Z","etag":null,"topics":["ai-detection","ai-detector","artificial-intelligence","collaborate","help-wanted","helpwanted","iconscout","machine-learning","python","python-app","python3","svelte","sveltejs","sveltekit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GustyCube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-12T17:28:31.000Z","updated_at":"2025-07-31T05:13:59.000Z","dependencies_parsed_at":"2025-04-11T09:59:23.394Z","dependency_job_id":"4ef7d34b-995a-432d-8709-cce2a3d34867","html_url":"https://github.com/GustyCube/Codect","commit_stats":null,"previous_names":["gustycube/codect"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GustyCube/Codect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustyCube%2FCodect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustyCube%2FCodect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustyCube%2FCodect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustyCube%2FCodect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GustyCube","download_url":"https://codeload.github.com/GustyCube/Codect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustyCube%2FCodect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278740819,"owners_count":26037480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-detection","ai-detector","artificial-intelligence","collaborate","help-wanted","helpwanted","iconscout","machine-learning","python","python-app","python3","svelte","sveltejs","sveltekit"],"created_at":"2025-02-20T00:39:15.315Z","updated_at":"2025-10-07T07:49:50.783Z","avatar_url":"https://github.com/GustyCube.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codect: AI-Generated Code Detection\n[![DeepSource](https://app.deepsource.com/gh/GustyCube/Codect.svg/?label=active+issues\u0026show_trend=true\u0026token=UOiRrqqUZoWYwfD_tPL8ifiy)](https://app.deepsource.com/gh/GustyCube/Codect/) \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/GustyCube/Codect\" alt=\"License\"\u003e\u003c/a\u003e\n\n## Overview\nCodect is a free and open-source tool designed to detect whether a piece of code was written by an AI or a human. It supports multiple programming languages and provides detailed insights based on various code features such as entropy, comment ratio, AST complexity, and more.\n\nThis monorepo contains three main packages:\n- **@codect/core**: Core detection algorithms and language analysis\n- **@codect/cli**: Beautiful command-line interface with interactive mode\n- **@codect/api**: Fast REST API server built with FastAPI\n\n## Features\n- **Multi-Language Support**: Detect AI-generated code in Python and JavaScript\n- **Entropy \u0026 Complexity Analysis**: Uses token entropy and AST depth to determine AI-generated patterns\n- **Comment Ratio Evaluation**: Analyzes documentation habits in code\n- **Function \u0026 Loop Detection**: Evaluates structure complexity\n- **Beautiful CLI**: Interactive terminal UI with colors and ASCII art\n- **Fast API**: High-performance REST API with FastAPI\n- **Modular Architecture**: Clean separation of concerns with monorepo structure\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=GustyCube/Codect\u0026type=Date)](https://star-history.com/#GustyCube/Codect\u0026Date)\n\n## Installation\n\n### Prerequisites\n- Node.js 18+ and npm\n- Python 3.8+\n- Git\n\n### Setup\n```bash\n# Clone the repository\ngit clone https://github.com/GustyCube/Codect.git\ncd Codect\n\n# Install dependencies\nnpm install\nnpm run build\n\n# Install Python dependencies for the API\ncd packages/api\npip install -r requirements.txt\ncd ../..\n```\n\n## Usage\n\n### CLI Tool\nThe CLI provides a beautiful terminal interface for code analysis:\n\n```bash\n# Run interactive mode\nnpx codect\n\n# Analyze a specific file\nnpx codect analyze path/to/file.py --detailed\n\n# Get help\nnpx codect --help\n```\n\nFeatures:\n- Interactive mode with menu navigation\n- Beautiful ASCII art logo with gradient colors\n- Colored output and progress spinners\n- Detailed analysis with feature breakdown\n- Support for both file and snippet analysis\n\n### API Server\nStart the API server:\n\n```bash\ncd packages/api\npython main.py\n```\n\nThe API will be available at `http://localhost:8000`\n\n#### Endpoints\n\n**Health Check**\n```bash\ncurl http://localhost:8000/health\n```\n\n**Basic Analysis** (`/basic`)\n```bash\ncurl -X POST \"http://localhost:8000/basic\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\": \"def add(x, y): return x + y\", \"language\": \"python\"}'\n```\n\n**Detailed Analysis** (`/premium`)\n```bash\ncurl -X POST \"http://localhost:8000/premium\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\": \"def add(x, y): return x + y\", \"language\": \"python\"}'\n```\n\n### Development\n```bash\n# Run all packages in development mode\nnpm run dev\n\n# Run tests\nnpm test\n\n# Lint code\nnpm run lint\n\n# Build all packages\nnpm run build\n```\n\n## How It Works\n1. The code is **tokenized**, and entropy is measured.\n2. **Comment ratio** is calculated to analyze documentation habits.\n3. **AST parsing** extracts function, loop, and exception counts.\n4. The system **assigns a score** based on heuristic rules.\n5. If the score exceeds a threshold, the code is flagged as **AI-generated**.\n\n## Contributing\nWe welcome contributions! Feel free to:\n- Submit issues \u0026 feature requests.\n- Improve multi-language support.\n- Optimize AI detection heuristics.\n- Expand API functionality.\n\n## License\nCodect is licensed under the GNU General Public v3.0 license. You are free to modify and distribute the project as needed.\n\n## Contact\nFor questions or contributions, open an issue on GitHub or reach out to `gc@gustycube.xyz`.\n\n---\n\nLet us know if you have any suggestions! 🚀","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustycube%2Fcodect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgustycube%2Fcodect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustycube%2Fcodect/lists"}