{"id":32514494,"url":"https://github.com/bencode/codescope","last_synced_at":"2025-10-27T23:46:37.036Z","repository":{"id":320835895,"uuid":"1080939159","full_name":"bencode/codescope","owner":"bencode","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-27T02:06:47.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-27T03:27:46.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bencode.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-22T04:44:51.000Z","updated_at":"2025-10-27T02:06:50.000Z","dependencies_parsed_at":"2025-10-27T03:27:53.347Z","dependency_job_id":null,"html_url":"https://github.com/bencode/codescope","commit_stats":null,"previous_names":["bencode/entrota","bencode/codentro","bencode/codescope"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bencode/codescope","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencode%2Fcodescope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencode%2Fcodescope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencode%2Fcodescope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencode%2Fcodescope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencode","download_url":"https://codeload.github.com/bencode/codescope/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencode%2Fcodescope/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281361347,"owners_count":26487881,"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-27T02:00:05.855Z","response_time":61,"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":[],"created_at":"2025-10-27T23:46:33.852Z","updated_at":"2025-10-27T23:46:37.021Z","avatar_url":"https://github.com/bencode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codescope\n\nCode structure analysis tool for understanding complexity and dependencies.\n\n## Overview\n\nCodescope analyzes code structure using Tree-sitter to provide multi-dimensional quality metrics:\n\n- **Symbols**: Classes, functions, interfaces, types, and enums\n- **Code Size**: LOC, comment lines, and blank lines\n- **Structure Metrics**: Function count, class count, type definitions\n- **Coupling Metrics**: Fan-in, fan-out, and import count\n- **Quality Rules**: Configurable thresholds with severity levels\n\n## Current Status: v0.1 (CLI-only)\n\nThis version provides CLI commands for analyzing TypeScript, JavaScript, and TSX files.\n\n## Installation\n\n```bash\ncargo install --path crates/codescope-cli\n```\n\nOr build from source:\n\n```bash\ncargo build --release\n```\n\nThe binary will be at `target/release/codescope`.\n\n## Usage\n\n### Basic Analysis\n\n```bash\n# Analyze a file or directory (default behavior)\ncodescope \u003cpath\u003e\n\n# Examples\ncodescope src/main.ts\ncodescope src/\ncodescope .\n```\n\n### Output Formats\n\n```bash\n# JSON output\ncodescope src/main.ts -f json\n\n# Markdown output\ncodescope src/main.ts -f md\n\n# Output to file\ncodescope src/ -o report.json -f json\n```\n\n### Configuration\n\n```bash\n# Generate default config file\ncodescope init\n\n# Use custom config\ncodescope src/ -c custom.toml\n```\n\n### Options\n\n```bash\ncodescope [OPTIONS] [PATH]\n\nOptions:\n  -f, --format \u003cFORMAT\u003e        Output format: table, json, md [default: table]\n  -o, --output \u003cFILE\u003e          Write output to file\n      --max-depth \u003cN\u003e          Maximum directory depth\n      --no-suggest             Hide refactoring suggestions\n      --sort \u003cFIELD\u003e           Sort by: loc, name, issues [default: loc]\n  -c, --config \u003cFILE\u003e          Custom config file\n  -h, --help                   Print help\n  -V, --version                Print version\n```\n\n**Sample output (table format):**\n\n```\nTarget: src/core/graph.ts (typescript, 85 LOC, 12 comment, 5 blank)\n\n[Quality Metrics]\nCategory     Metric                    Value      Threshold  Status\n---------------------------------------------------------------------------\nSize         file_loc                  85         300        ✓\nStructure    function_count            2          20         ✓\nCoupling     fan_out                   1          7          ✓\n\n[Structure]\nType         Name                      LOC    Issues\n--------------------------------------------------------------------------------\nclass        GraphBuilder              45\nfunction     buildGraph                20\nfunction     computeComplexity         50     ⚠ function size\n\n[Outgoing]\nTarget                        Relation     Strength\n----------------------------- ------------ --------\nsrc/utils/math.ts             import       0.70\n```\n\n\n## Architecture\n\nCodescope follows a clean, modular architecture:\n\n```\n/crates\n  /codescope-core        # Core engine (AST, IR, graph, metrics)\n  /codescope-adapters    # Language adapters (TypeScript/JS/TSX)\n  /codescope-cli         # CLI interface\n```\n\n### Key Concepts\n\n**Multi-dimensional Quality Metrics**: Instead of a single complexity score, Codescope provides multiple independent metrics:\n\n**Size Metrics**:\n- `file_loc`: Code lines (excluding comments and blanks)\n- `comment_lines`: Comment line count\n- `blank_lines`: Empty line count\n\n**Structure Metrics**:\n- `function_count`: Number of functions\n- `class_count`: Number of classes\n- `type_definition_count`: Number of types/interfaces/enums\n- `large_function_count`: Functions exceeding size threshold\n\n**Coupling Metrics**:\n- `fan_out`: Number of dependencies (imports)\n- `fan_in`: Number of dependents\n- `import_count`: Total import statements\n\n**Quality Rules**: Each metric has a configurable threshold and severity level (Info/Warning/Error).\n\n**Dependency Graph**: Files and their import relationships, enabling:\n- Fan-in/fan-out analysis\n- Circular dependency detection (future)\n- Impact analysis (future)\n\n### Configuration\n\nCreate a `.codescope.toml` file to customize thresholds:\n\n```toml\n[rules]\nmax_file_loc = 300\nmax_function_loc = 40\nmax_functions_per_file = 20\nmax_types_per_file = 30\nmax_fan_out = 7\nmax_imports = 15\n\n[rules.severity]\nmax_file_loc = \"Warning\"\nmax_function_loc = \"Warning\"\nmax_fan_out = \"Warning\"\n```\n\n## Development\n\n### Run Tests\n\n```bash\ncargo test\n```\n\n### Run Checks\n\n```bash\ncargo check\ncargo clippy\n```\n\n### Try the CLI\n\n```bash\ncargo run -p codescope-cli -- \u003cpath\u003e\ncargo run -p codescope-cli -- src/main.ts -f json\n```\n\n## Roadmap\n\n- **v0.1** (current): CLI-only analysis for TypeScript/JavaScript/TSX\n- **v0.2**: MCP server for LLM integration\n- **v0.3**: Web server + frontend UI\n- **v0.4+**: Multi-language support, call graphs, time-series analysis\n\n## Contributing\n\nContributions welcome! Please ensure:\n\n1. Code follows the functional programming style\n2. Files stay under 200 lines, functions under 40 lines\n3. Core logic includes unit tests\n4. No unnecessary try/catch blocks\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencode%2Fcodescope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencode%2Fcodescope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencode%2Fcodescope/lists"}