{"id":13577179,"url":"https://github.com/TIAcode/LLMShellAutoComplete","last_synced_at":"2025-04-05T11:31:26.923Z","repository":{"id":162633058,"uuid":"637145227","full_name":"TIAcode/LLMShellAutoComplete","owner":"TIAcode","description":"Use GPT to complete shell command line using atuin shell history database and terminal screen content as prompt","archived":false,"fork":false,"pushed_at":"2023-05-06T17:45:15.000Z","size":138,"stargazers_count":109,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-05T14:43:43.338Z","etag":null,"topics":["atuin","autocomplete","gpt","shell"],"latest_commit_sha":null,"homepage":"","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/TIAcode.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}},"created_at":"2023-05-06T16:40:45.000Z","updated_at":"2024-10-09T04:44:11.000Z","dependencies_parsed_at":"2024-01-16T20:42:21.478Z","dependency_job_id":null,"html_url":"https://github.com/TIAcode/LLMShellAutoComplete","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TIAcode%2FLLMShellAutoComplete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TIAcode%2FLLMShellAutoComplete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TIAcode%2FLLMShellAutoComplete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TIAcode%2FLLMShellAutoComplete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TIAcode","download_url":"https://codeload.github.com/TIAcode/LLMShellAutoComplete/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247330796,"owners_count":20921696,"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":["atuin","autocomplete","gpt","shell"],"created_at":"2024-08-01T15:01:18.888Z","updated_at":"2025-04-05T11:31:26.582Z","avatar_url":"https://github.com/TIAcode.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ChatGPT autocompletion with atuin\n\nAutocomplete using GPT, using data from [atuin](https://github.com/ellie/atuin) command history as input prompt. Uses streaming responses to get the first reply really quickly\nThe README is put together in minutes, I fill fix it soon.\n\n![GPT completer in use](gptcomplete.gif)\n\n## Usage\n\n## Python requirements\n`pip install --user tiktoken openai` should be enough, or you can do venv for them and point the shell configurations to the correct Python.\n\n## Other\n[fzf](https://github.com/junegunn/fzf) for selecting the correct result.\n\n### Nushell\nAdd this to config.nu:\n```\n{\n    name: complete_with_gtp\n    modifier: CONTROL\n    keycode: Char_o\n    mode: [emacs vi_normal vi_insert]\n    event:[\n        { send: executehostcommand,\n        cmd: \"commandline -r (python /path/to/completer.py (commandline) | fzf --track --height 8)\"\n        }\n        { send: Enter }\n    ]\n}\n```\n\n### Fish\nTo config.fish:\n\n```\nfunction gpt_completion\n         commandline (python /path/to/completer.py (commandline) | fzf --track --height 8)\nend\nbind \\ck \"gpt_completion\"\n```\n\n### Other parameters\n`--atuin`: atuin history database location\n\n`--dunst`: Use dunstify to notify what's happening (debug mostly)\n\n`--model`: gpt-3.5-turbo or gpt-4. GPT-4 feels much slower for me for this use.\n\n`--wezterm`: Append screen content from Wezterm\n\n### Atuin indexes\nThis makes a few queries from atuin database so few more indexes can speed it up quite a lot:\n```\nsqlite3 ~/.local/share/atuin/history.db\nCREATE INDEX idx_history_cwd on history(cwd);\nCREATE INDEX idx_history_session on history(session);\n```\n\n\n### Terminal content (Wezterm/Kitty)\nIf you're using [Wezterm](https://github.com/wez/wezterm) you can also add your current terminal screen content to the GPT prompt, which might be useful if there's some error messages that could help generating the correct command line. In that case add -w for the completer.py command line.\n\nKitty get-text is commented in the code as I couldn't get it working right now, I'll fix it soon or let me know if you find a way.\n\n## Disclaimer\nThis was posted quite hastily as Atuin hit the HN front page. Code is terrible, there's a bunch of half ready features commented out and I haven't tested it too much. Might require some fixes to work well elsewhere. I'll have a look in the coming days to clean it up.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTIAcode%2FLLMShellAutoComplete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTIAcode%2FLLMShellAutoComplete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTIAcode%2FLLMShellAutoComplete/lists"}