{"id":24538429,"url":"https://github.com/rdiachenko/checkstyle-xpath-llm-poc","last_synced_at":"2025-03-16T02:24:47.742Z","repository":{"id":273082816,"uuid":"918533427","full_name":"rdiachenko/checkstyle-xpath-llm-poc","owner":"rdiachenko","description":"AI-Powered XPath Generator for Checkstyle Suppressions PoC","archived":false,"fork":false,"pushed_at":"2025-01-18T14:20:50.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T15:29:22.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/rdiachenko.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}},"created_at":"2025-01-18T07:05:33.000Z","updated_at":"2025-01-18T14:21:18.000Z","dependencies_parsed_at":"2025-01-18T15:29:39.278Z","dependency_job_id":"d42d3414-3709-43d2-aa04-ddb3c9d2947b","html_url":"https://github.com/rdiachenko/checkstyle-xpath-llm-poc","commit_stats":null,"previous_names":["rdiachenko/checkstyle-xpath-llm-poc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdiachenko%2Fcheckstyle-xpath-llm-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdiachenko%2Fcheckstyle-xpath-llm-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdiachenko%2Fcheckstyle-xpath-llm-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdiachenko%2Fcheckstyle-xpath-llm-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdiachenko","download_url":"https://codeload.github.com/rdiachenko/checkstyle-xpath-llm-poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"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","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-01-22T15:13:24.113Z","updated_at":"2025-03-16T02:24:47.241Z","avatar_url":"https://github.com/rdiachenko.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XPath Generator PoC\n\nA proof of concept for generating Checkstyle XPath suppressions using LLMs. This project demonstrates the feasibility of using Code Llama to generate XPath expressions for suppressing specific Checkstyle violations.\n\n## Prerequisites\n\n- Docker\n- Python 3.x (for local testing)\n- Java 17 or higher (for testing only)\n- Hugging Face API token (set as `HF_TOKEN` environment variable)\n\n## Project Structure\n\n```\ncheckstyle-xpath-llm-poc/\n│\n├── config.py                   # Model and generation parameters\n│\n├── docker/                     # Docker-related files\n│   ├── Dockerfile              # Optimized for LLM inference\n│   └── inference.py            # Core XPath generation script\n│\n├── testing/                    # Testing infrastructure\n│   └── test_xpath.py           # Testing and validation script\n│\n├── models/                     # Directory for downloaded models (gitignored)\n└── README.md\n```\n\n## Setup\n\n1. Set your Hugging Face token:\n```bash\nexport HF_TOKEN=\"your_token_here\"\n```\n\n2. Create a directory for model storage:\n```bash\nmkdir -p models\n```\n\n3. Build the Docker image:\n```bash\ndocker build -t xpath-generator -f docker/Dockerfile .\n```\n\n4. Download Checkstyle (required for testing):\n```bash\ncd testing\ncurl -L -o checkstyle-10.21.1-all.jar \\\n    https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.21.1/checkstyle-10.21.1-all.jar\n```\n\n## Usage\n\nRun the test script to see the XPath generation in action:\n```bash\ncd testing\npython3 test_xpath.py\n```\n\nThe script will:\n1. Generate AST from a sample Java code\n2. Pass the code, violation, and AST to the LLM\n3. Generate an XPath expression\n4. Validate the generated XPath using Checkstyle\n\nCheck docker container logs:\n```bash\ndocker logs -f xpath-generator-instance\n```\n\n## Configuration\n\nThe model and generation parameters can be configured in `config.py`. Key settings include:\n- Model repository and local folder\n- Model parameters (dtype, device mapping, etc.)\n- Tokenizer parameters\n- Generation parameters (beam size, temperature, etc.)\n\n## Limitations\n\nThis is an experimental proof of concept and has several limitations:\n- Uses a simplified prompt structure\n- May generate incorrect XPaths for complex cases\n- Requires downloading a large language model\n- Limited to basic Checkstyle violation cases\n\n## Note\n\nThis proof of concept demonstrates the basic approach of using LLMs for XPath generation. It's not intended for production use and serves as a starting point for further development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdiachenko%2Fcheckstyle-xpath-llm-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdiachenko%2Fcheckstyle-xpath-llm-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdiachenko%2Fcheckstyle-xpath-llm-poc/lists"}