{"id":25059644,"url":"https://github.com/glav/llm-code-analyser","last_synced_at":"2026-02-14T00:46:15.360Z","repository":{"id":259351738,"uuid":"869805181","full_name":"glav/llm-code-analyser","owner":"glav","description":"experiment to try out LLM code analysis - locally and in cloud","archived":false,"fork":false,"pushed_at":"2025-02-11T19:18:33.000Z","size":122,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-19T14:44:26.563Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/glav.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}},"created_at":"2024-10-08T23:21:44.000Z","updated_at":"2024-11-22T03:52:16.000Z","dependencies_parsed_at":"2024-10-24T19:07:35.624Z","dependency_job_id":"28e3f651-5c0e-447a-b9ee-ca35689427c8","html_url":"https://github.com/glav/llm-code-analyser","commit_stats":null,"previous_names":["glav/llm-code-analyser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glav/llm-code-analyser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glav%2Fllm-code-analyser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glav%2Fllm-code-analyser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glav%2Fllm-code-analyser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glav%2Fllm-code-analyser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glav","download_url":"https://codeload.github.com/glav/llm-code-analyser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glav%2Fllm-code-analyser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29427103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T22:20:51.549Z","status":"ssl_error","status_checked_at":"2026-02-13T22:20:49.838Z","response_time":78,"last_error":"SSL_read: 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":[],"created_at":"2025-02-06T15:35:52.238Z","updated_at":"2026-02-14T00:46:15.340Z","avatar_url":"https://github.com/glav.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Code Analyser\nAn experiment to see how effective an LLM can be in helping to classify and potentially migrate applications to a new platform.\n\nThis codebase is primarily targetting non PaaS or cloud hosted models to remove any security concerns of an organisations code (which may contains various secrets or IP) being shared with a public cloud hosted service.\nThis solution assumes you are using [Ollama](https://ollama.com/) and you have at least 1 model downloaded and able to run. Most of the testing has been performed using Llama3.1 model but it has not been comprehensively tested.\n\n## Table of contents\n- [LLM Code Analyser](#llm-code-analyser)\n  - [Table of contents](#table-of-contents)\n- [Pre-requisites](#pre-requisites)\n  - [Ensuring Ollama is accessible](#ensuring-ollama-is-accessible)\n    - [Configuring the solution](#configuring-the-solution)\n    - [Running inside a devcontainer](#running-inside-a-devcontainer)\n- [Running the code](#running-the-code)\n\n# Pre-requisites\n1. [Ollama](https://ollama.com/) installed and at least one model like 'Llama3.1' downloaded. Executing \n![Ollama list](./images/ollama-list.png)\n2. VSCode installed with Python extension\n  - However this is not strictly true, but all development has been performed within the devcontainer so many assumptions are already taken care of.\n3. A solution to analyse. You can use the source code of this app or you can try something like [replatform-java-webapp-on-aws](https://github.com/aws-samples/replatform-java-webapp-on-aws) from the AWS Samples GitHub repository.\n4. If you want to use cloud hosted models, you need to have deployed an Azure OpenAI model like gpt-4o (the default)\n\n## Ensuring Ollama is accessible\nOllama can be typically accessed via http://localhost:11434 (default - but can be changed - see Ollama documentation). \n\nTo ensure the Ollama is in fact accessible via HTTP, you can execute:\n```bash\ncurl http://localhost:11434\n```\nIf it is running, you should receive:\n```\nOllama is running\n```\n*Note:* If you are executing the command from within the devcontainer, you may need to use the `host.docker.internal` hostname to access the Ollama service running on the host machine. For example:\n```bash\ncurl http://host.docker.internal:11434\n```\n### Configuring the solution\nSet the .env file within the `app` directory with the correct configuration values, use the `.env-sample` as a template. \n```\nLOCAL_LLM_MODEL_NAME = \"llama3.1\"\nLLM_MODE = \"local\"  # or 'azure'\n\n# if using azure\nAZURE_OPENAI_API_KEY = \"\u003cyour-azure-openai-key\"\nAZURE_OPENAI_ENDPOINT = \"https://{name}.openai.azure.com\"\nAZURE_API_VERSION = \"2024-02-15-preview\"\nAZURE_LLM_MODEL_NAME = \"gpt-4o\"\nAZURE_STORAGE_CONNECTION_STRING=\"\u003cyour-storage-acct-connection-string\u003e\"  # Only required if you are performing an image analysis using cloud models\nAZURE_AUTH_MODE=\"key\" # key or identity, defaults to key - uses identity from 'az login'\n\n```\n### Running inside a devcontainer\nFor the solution to work inside a devcontainer, there is a configuration element in the `.devcontainer/devcontainer.json` file that sets the `OLLAMA_HOST` environment variable. This is used by the code to connect to the Ollama service on `localhost:11434`. If you are using a different host or port, you will need to update this value.\n```\n\"containerEnv\": {\n    \t\"OLLAMA_HOST\": \"host.docker.internal:11434\" // OLLAMA_HOST is the hostname of the OLLAMA server - this is to enable use of ollama package inside devcontainer\n\t},\n```\n\n# Running the code\nThere are multiple options to choose from, all of which do somewhat different functions but you cannot use all at once. Only the `--ref-image-path` and `--target-image-path` can be used together.\nThe usage is:\n```python\ncd app\npython app.py {options{...}}\n```\nwhere options can be: \n- `--solution-path SOLUTION_PATH`: Path to the solution files\n- `--ref-image-path REF_IMAGE_PATH`: The reference architecture image to compare with\n- `--target-image-path TARGET_IMAGE_PATH`: The target architecture image to compare against the reference architecture image\n- `--solution-plan-path SOLUTION_PLAN_PATH`: Path to the solution files for which to create a migration plan\n- `--solution-plan-path-result-file SOLUTION_PLAN_PATH_RESULT_FILE`: Path to the result file from the `--solution-plan-path` argument from which to process, by passing the generation of the result file and simply creating the plan summary from.\n- `--solution-app-env-extract-path SOLUTION_APP_ENV_EXTRACT_PATH`: Path to the solution files for which to extract the environment information.\n\n\nTo run the analysis on a solution (prefer Java or python), execute the following:\n```bash\ncd app\npython app.py --solutionpath SOLUTIONPATH\n```\nor\n```\npython app.py --ref-image-path REF_IMAGE_PATH --target-image-path TARGET_IMAGE_PATH\n```\nWhere:\n- `SOLUTIONPATH` is the path to the solution you want to analyse. For example:\n```bash\npython app.py --solutionpath ..\n```\nand\n- `ref-image-path`: The reference architecture image to compare with\n- `target-image-path`: The target architecture image to compare against the reference architecture image\nThis will analyse the solution in the parent directory of the app directory for this solution.\n```bash\npython app.py --ref-image-path ../.local/ref_arch.png --target-image-path ../.local/test_arch.png\n```\n\n**Important Note:** If you are not using a device with a suitable GPU, this process can take quite some time and consume a lot of CPU.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglav%2Fllm-code-analyser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglav%2Fllm-code-analyser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglav%2Fllm-code-analyser/lists"}