{"id":21128731,"url":"https://github.com/rishi255/posh_codex","last_synced_at":"2025-07-08T23:33:06.442Z","repository":{"id":44588046,"uuid":"437385688","full_name":"rishi255/posh_codex","owner":"rishi255","description":"PowerShell module that enables you to use AI Code Completion in the command line.","archived":false,"fork":false,"pushed_at":"2024-11-06T17:48:45.000Z","size":7582,"stargazers_count":77,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-20T05:02:55.814Z","etag":null,"topics":["ai","codex","command-line","command-line-tool","deepseek","github-copilot","ollama","openai","openai-codex","powershell","powershell-module","scoop-bucket","shell","terminal"],"latest_commit_sha":null,"homepage":"https://www.powershellgallery.com/packages/PoshCodex/","language":"PowerShell","has_issues":false,"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/rishi255.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":"2021-12-11T20:48:20.000Z","updated_at":"2024-11-11T12:19:40.000Z","dependencies_parsed_at":"2024-11-20T06:15:15.744Z","dependency_job_id":null,"html_url":"https://github.com/rishi255/posh_codex","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/rishi255/posh_codex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishi255%2Fposh_codex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishi255%2Fposh_codex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishi255%2Fposh_codex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishi255%2Fposh_codex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rishi255","download_url":"https://codeload.github.com/rishi255/posh_codex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishi255%2Fposh_codex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264366006,"owners_count":23596952,"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":["ai","codex","command-line","command-line-tool","deepseek","github-copilot","ollama","openai","openai-codex","powershell","powershell-module","scoop-bucket","shell","terminal"],"created_at":"2024-11-20T05:02:16.962Z","updated_at":"2025-07-08T23:33:05.780Z","avatar_url":"https://github.com/rishi255.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"\u003chtml\u003e\n\u003ch1 align=\"center\"\u003e⌨️ 🦾 PowerShell Codex\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  Brings the power of AI code completion to the command line.\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.powershellgallery.com/packages/PoshCodex\"\u003e\n    \u003cimg\n        src=\"https://img.shields.io/powershellgallery/v/PoshCodex?colorA=2c2837\u0026style=for-the-badge\"\n        alt=\"PowerShell package latest version\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.powershellgallery.com/packages/PoshCodex\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/powershellgallery/dt/PoshCodex?colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"PowerShell package download stats\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/rishi255/posh_codex/stargazers\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/github/stars/rishi255/posh_codex?colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"Repository's stars\"\n    /\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://github.com/rishi255/posh_codex/issues\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/github/issues-raw/rishi255/posh_codex?colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"Issues\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/rishi255/posh_codex/blob/main/LICENSE\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/github/license/rishi255/posh_codex?colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"License\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/rishi255/posh_codex/commits/main\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/github/last-commit/rishi255/posh_codex/main?colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"Latest commit\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/rishi255/posh_codex\"\u003e\n    \u003cimg\n      src=\"https://img.shields.io/github/actions/workflow/status/rishi255/posh_codex/main.yml?branch=main\u0026colorA=2c2837\u0026style=for-the-badge\"\n      alt=\"GitHub Workflow build status\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg\n   src=\"assets/PoshCodex_Demo.gif\"\n   style=\"width: 80%\"\n   alt=\"PoshCodex Demo\"\n   /\u003e\n  \u003cdiv align=\"center\"\u003e\n    You just need to write a comment or variable name and the AI will write the\n    corresponding code.\n  \u003c/div\u003e\n\u003c/div\u003e\n\u003c/html\u003e\n\n## What is it?\n\nThis is a PowerShell plugin that enables you to plug and play any AI code completion model in the command line, to improve efficiency, reduce errors and optimize your workflow.\n\nIt is completely free, as it can be used with any open-source model from Ollama, like [CodeLlama](https://ollama.com/library/codellama), or the powerful [Deepseek-Coder-v2](https://ollama.com/library/deepseek-coder:6.7b) (default for this module).\n\nInspired by the impressive [zsh version of this extension by Tom Doerr](https://github.com/tom-doerr/zsh_codex).\n\n## How to Install\n\n\u003cdetails open\u003e\n  \u003csummary\u003e\u003ch3\u003e 1. Using PowerShellGallery (recommended, cross-platform) \u003c/h3\u003e\u003c/summary\u003e\n\n```powershell\n# to install or update to the latest version\nInstall-Module -Name PoshCodex -Force\n\nImport-Module PoshCodex -Force\n\n# to check if it's installed properly:\nGet-Module -Name PoshCodex # should display the Enter-CompletionKeybind command\n\n# Auto-import the module on every powershell session, so you can directly use the keybind for completion:\necho \"`nImport-Module PoshCodex\" \u003e\u003e $PROFILE\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch3\u003e 2. Using Scoop (Windows only) \u003c/h3\u003e\u003c/summary\u003e\n  \n  Scoop is an easy-to-use command-line installer for Windows apps. You can get Scoop from [here](https://scoop.sh/).\n  \n  ```powershell\n  scoop bucket add poshcodex_bucket https://github.com/rishi255/posh_codex\n  scoop install PoshCodex # not case sensitive\n  \n  Import-Module PoshCodex -Force\n  \n  # to update the module later, you can use:\n  scoop update PoshCodex\n  \n  # Auto-import the module on every powershell session, so you can directly use the keybind for completion:\n  echo \"`nImport-Module PoshCodex\" \u003e\u003e $PROFILE\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch3\u003e 3. By building the module yourself \u003c/h3\u003e\u003c/summary\u003e\n  \n  ```powershell\n  # Clone the repository\n  git clone https://github.com/rishi255/posh_codex\n  cd ./posh_codex/PoshCodex/\n  \n  # Install Invoke-Build and build the module\n  Install-Module InvokeBuild -Force\n  Invoke-Build -File build.ps1\n  \n  # Now import the built module\n  Import-Module ./Output/PoshCodex/\u003cversion_number\u003e/PoshCodex.psd1\n  \n  # Now the module can be used in the current powershell session.\n  # Auto-import the module on every powershell session, so you can directly use the keybind for completion:\n  echo \"`nImport-Module ./Output/PoshCodex/\u003cversion_number\u003e/PoshCodex.psd1\" \u003e\u003e $PROFILE\n  ```\n\u003c/details\u003e\n\n## Configuration of the Ollama Model\n\n**Note:** The AI completion will run locally on your machine, and the below commands will download the model file.\n\n```powershell\n# install ollama (visit https://ollama.com/download or install using scoop with the below commands):\nscoop bucket add versions\nscoop install versions/innounp-unicode\nscoop install ollama\n\n# pull the base model\nollama pull rishi255/posh_codex_model:latest\n\n# or, create a new model tailored for your needs using Modelfile.txt\n# (refer https://github.com/ollama/ollama/blob/main/docs/modelfile.md)\nollama create my_model -f .\\Modelfile.txt\necho \"`n$env:OLLAMA_MODEL='my_model'\" \u003e\u003e $PROFILE\n```\n\n## Usage\n\nJust type a comment or partial code snippet, and hit the keybind!\n\nSee the GIF above for a demonstration.\n\n```powershell\n# print hello world to the console\n```\n\n`Hit Ctrl+Shift+O after typing the above comment`\n\n## Changing the keybind\n\n**The default keybind is `Ctrl+Shift+O`.**\n\nAfter you import the module, you can enter your own keybind.  \nJust type `Enter-CompletionKeybind` in the terminal and record the keyboard shortcut you want to use.\n\n## Configuration\n\nThe following environment variables are available for configuration:\n\n| Environment Variable     | Default Value               | Description                                     |\n| ------------------------ | --------------------------- | ----------------------------------------------- |\n| `OLLAMA_MODEL`           | `rishi255/posh_codex_model` | The Ollama model name to use for AI completion. |\n| `OLLAMA_HOST`            | `http://localhost:11434`    | The base URL of your Ollama API.                |\n| `AUTOCOMPLETE_KEYBIND`   | `Ctrl+Shift+O`              | The keybind to use for AI completion.           |\n\n## The Journey So Far (there's still a lot TODO)\n\n- [x] Test basic PS plugin working with hardcoded completions\n- [x] Test plugin by comparing the generated output from [my text-to-PowerShell OpenAI playground](https://platform.openai.com/playground/chat?models=gpt-3.5-turbo-0125\u0026preset=4FqkeG4WQuIPfOUS6cvXQfQR)\n- [x] Publish plugin for installation through PSGallery\n- [x] Add installation instructions to README.md\n- [x] Integrate with GitHub Actions to auto-publish new versions\n- [x] Make required modules auto-install when this module is installed\n- [x] Publish plugin for installation through Scoop\n- [x] Add a way to change the hotkey for completion by reading key input: `Enter-CompletionKeybind`\n- [ ] Stream the output, instead of waiting for entire thing to be generated\n  - [ ] AND/OR Show a progress/loading indicator when inference is running\n- [ ] Extra layer of validation - validate the syntax of the response PowerShell code\n- [ ] Need support for inline completion (similar to Copilot on VSCode) - currently we are inserting the response on a new line\n  - [ ] Need to fine tune / prompt engineer the model better for this as well - currently it isn't very good at it\n- [ ] Make completed text a lighter colour to show that it is only a potential solution\n  - [ ] For changing text colour of prediction, look at `Set-PSReadLineOption` or in that direction\n- [ ] Switch to chat API instead of generate\n  - [ ] Provide context of previous messages\n  - [ ] Provide context of all commands in current terminal session? Possible using PSReadLine history\n- [ ] Switch from environment variables based configuration to a config file (`poshcodex.ini`)\n  - [ ] Ensure that getting and setting config values are only done through the config file\n  - [ ] After this change, `Initialize-Module-On-Import` needs to call `Set-CompletionKeybind` internally after reading latest value from config.\n- [ ] Add proper documentation for all the functions and `Docs/about_PoshCodex.md`\n- [ ] Support for install using Chocolatey\n- [ ] Cycle through suggestions using some modifiable keybind (e.g. `Alt+C`)\n- [ ] Make a website playground that lets users try this out live? Need to check feasibility.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishi255%2Fposh_codex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishi255%2Fposh_codex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishi255%2Fposh_codex/lists"}