{"id":35063397,"url":"https://github.com/kodustech/kodus-service-ast","last_synced_at":"2026-01-18T14:08:35.475Z","repository":{"id":299468605,"uuid":"966375975","full_name":"kodustech/kodus-service-ast","owner":"kodustech","description":"A high-performance microservice for source code analysis, generating Abstract Syntax Trees (ASTs) and relationship maps from codebases.","archived":false,"fork":false,"pushed_at":"2026-01-15T11:56:44.000Z","size":1456,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-15T16:30:52.094Z","etag":null,"topics":["ai-agents","ai-coding-tools","ast-tree","code-review"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodustech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-14T20:35:02.000Z","updated_at":"2026-01-15T11:56:51.000Z","dependencies_parsed_at":"2025-06-16T18:48:55.300Z","dependency_job_id":"f0a63299-33fd-4625-8d55-f3d9b135005f","html_url":"https://github.com/kodustech/kodus-service-ast","commit_stats":null,"previous_names":["kodustech/kodus-service-ast"],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/kodustech/kodus-service-ast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodustech%2Fkodus-service-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodustech%2Fkodus-service-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodustech%2Fkodus-service-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodustech%2Fkodus-service-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodustech","download_url":"https://codeload.github.com/kodustech/kodus-service-ast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodustech%2Fkodus-service-ast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28537492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T13:04:05.990Z","status":"ssl_error","status_checked_at":"2026-01-18T13:01:44.092Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-agents","ai-coding-tools","ast-tree","code-review"],"created_at":"2025-12-27T10:59:35.193Z","updated_at":"2026-01-18T14:08:35.460Z","avatar_url":"https://github.com/kodustech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kodus AST Service\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js Version](https://img.shields.io/badge/node-%3E%3D22.14.0-brightgreen.svg)](https://nodejs.org/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/kodustech/kodus-ast.svg)](https://hub.docker.com/r/kodustech/kodus-ast)\n\nA high-performance microservice for source code analysis, generating Abstract Syntax Trees (ASTs) and relationship maps from codebases.\n\n## ✨ Features\n\n- 🚀 AST generation for multiple programming languages\n- 🔍 Code relationship mapping\n- ⚡ High-performance processing with Node.js worker threads\n- 🐳 Docker and Kubernetes ready\n- 📊 Built-in health checks and metrics\n- 🔒 Secure by default\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- Node.js 22.14.0 or higher\n- Yarn (recommended) or npm\n- Docker (for containerized deployment)\n- Git\n\n### Installation\n\n1. **Clone the repository**\n\n    ```bash\n    git clone https://github.com/kodustech/kodus-service-ast.git\n    cd kodus-service-ast\n    ```\n\n2. **Install dependencies**\n    ```bash\n    yarn install\n    # or\n    npm install\n    ```\n\n## 🛠️ Development\n\n### Running Locally\n\n```bash\n# Development with hot-reload\nyarn start:dev\n\n# Build for production\nyarn build\n\n# Run in production mode locally\nyarn start:prod\n```\n\n## 🐰 RabbitMQ Troubleshooting\n\n### Queue Declaration Conflicts (Error 406 PRECONDITION_FAILED)\n\nIf you encounter RabbitMQ errors like \"PRECONDITION_FAILED - inequivalent arg\", it means queues are being declared with different arguments by different processes.\n\n**Solution:**\n\n1. Stop all applications (API + Worker)\n2. Run the cleanup script: `./scripts/cleanup-rabbitmq.sh`\n3. Restart applications - queues will be recreated with correct configuration\n\nThis happens when:\n\n- API and Worker modules declare the same queue with different `arguments`\n- Previous deployments created queues with different configurations\n- `@RabbitSubscribe` decorators conflict with module-level queue declarations\n\n## 🐳 Docker\n\n### Build Images\n\n```bash\n# Development\nmake dev-build\n# or\ndocker build -t kodus-ast:dev -f DockerFiles/Dockerfile.dev .\n\n# Production (replace x.y.z with the release version)\ndocker build \\\n  --build-arg RELEASE_VERSION=x.y.z \\\n  -t kodus-ast:x.y.z \\\n  -f DockerFiles/Dockerfile.prod .\n```\n\n### Run Containers\n\n```bash\n# Development\ndocker run -d \\\n  --name kodus-ast-dev \\\n  -p 3002:3002 \\\n  -v $(pwd):/usr/src/app \\\n  -v /usr/src/app/node_modules \\\n  kodus-ast:dev\n\n# Production (replace x.y.z with the desired version)\ndocker run -d \\\n  --name kodus-ast \\\n  -p 3002:3002 \\\n  -e NODE_ENV=production \\\n  -e LOG_LEVEL=info \\\n  --memory=\"4g\" \\\n  --cpus=\"2\" \\\n  kodus-ast:x.y.z\n```\n\n## 🌐 API Reference\n\n### Health Check\n\n```\nGET /health\n```\n\n### API Endpoints\n\n```\nPOST   /api/analyze     # Analyze source code\nGET    /api/status/:id  # Check analysis status\n# Other endpoints...\n```\n\n\u003e Note: All API routes except `/health` are prefixed with `/api/`\n\n## ⚙️ Configuration\n\n### Environment Variables\n\n| Variable                        | Default        | Description                                                                         |\n| ------------------------------- | -------------- | ----------------------------------------------------------------------------------- |\n| `NODE_ENV`                      | production     | Runtime environment                                                                 |\n| `LOG_LEVEL`                     | info           | Log level (error, warn, info, debug)                                                |\n| `API_PORT`                      | 3002           | API port                                                                            |\n| `UV_THREADPOOL_SIZE`            | Auto           | Node.js thread pool size                                                            |\n| `DB_URL`                        | -              | Postgres connection string (takes precedence over host/port vars)                   |\n| `DB_HOST`                       | localhost      | Postgres host (used when `DB_URL` is not set)                                       |\n| `DB_PORT`                       | 5432           | Postgres port                                                                       |\n| `DB_USER`                       | -              | Postgres username                                                                   |\n| `DB_PASSWORD`                   | -              | Postgres password                                                                   |\n| `DB_NAME`                       | -              | Postgres database                                                                   |\n| `DB_SCHEMA`                     | kodus_workflow | Schema dedicated a armazenar workflows/tarefas compartilhados                       |\n| `DB_SSL`                        | true           | Enables TLS (set `false` only in trusted local setups)                              |\n| `DB_SSL_REJECT_UNAUTHORIZED`    | true           | Reject self-signed/invalid certs (set `false` apenas se tiver CA interna conhecida) |\n| `DB_POOL_MAX`                   | 10             | Máximo de conexões simultâneas no pool                                              |\n| `DB_POOL_IDLE_TIMEOUT_MS`       | 30000          | Tempo para fechar conexões ociosas (ms)                                             |\n| `DB_POOL_CONNECTION_TIMEOUT_MS` | 5000           | Timeout para adquirir conexão (ms)                                                  |\n| `DB_STATEMENT_TIMEOUT_MS`       | 0              | Timeout por query (ms). 0 = ilimitado                                               |\n| `API_DATABASE_ENV`              | production     | Define se estamos em `development`/`local` (desativa TLS por padrão)                |\n\n\u003e Os campos `DB_*` também aceitam as variáveis utilizadas pelos demais serviços (`API_PG_DB_HOST`, `API_PG_DB_USERNAME`, etc.) como fallback.\n\n\u003e Observação: o serviço inicializa automaticamente o schema/tabelas (com `CREATE IF NOT EXISTS`) na primeira execução. Para ambientes gerenciados, execute as DDLs do diretório `docs/architecture` antes do deploy.\n\n## 🧪 Testing\n\n```bash\n# Run all tests\nyarn test\n\n# Run tests with coverage\nyarn test:cov\n\n# Run e2e tests\nyarn test:e2e\n```\n\n## 🚀 Deployment\n\nO deploy pode ser feito via pipelines CI/CD (GitHub Actions, Jenkins, etc.), gerando imagem container e aplicando-a na infraestrutura escolhida (ECS, Kubernetes, VMs, etc.).\n\n### Production Deployment\n\n```bash\n# Build and push the production image\nmake release VERSION=x.y.z\n\n# Deploy to your infrastructure\nkubectl apply -f k8s/\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 📚 Documentation\n\nFor more detailed documentation, please refer to our [documentation site](https://docs.kodus.tech/ast-service).\n\n## 📬 Contact\n\nProject Link: [https://github.com/kodustech/kodus-service-ast](https://github.com/kodustech/kodus-service-ast)\n\n## 🙏 Acknowledgments\n\n- Built with ❤️ by the Kodus Tech Team\n- Thanks to all contributors who have helped shape this project\n- Inspired by modern AST tooling and code analysis tools\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodustech%2Fkodus-service-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodustech%2Fkodus-service-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodustech%2Fkodus-service-ast/lists"}