{"id":15489262,"url":"https://github.com/werifu/complish","last_synced_at":"2025-04-22T18:19:39.775Z","repository":{"id":132695572,"uuid":"610336093","full_name":"werifu/complish","owner":"werifu","description":"Generate auto-completion for any CLI via ChatGPT.","archived":false,"fork":false,"pushed_at":"2023-03-30T13:58:58.000Z","size":167,"stargazers_count":29,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T08:16:54.265Z","etag":null,"topics":["chatgpt","cli","fish","fish-completion","fish-shell","typescript","typescript-library","zsh","zsh-completion"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/werifu.png","metadata":{"files":{"readme":"README-zh.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}},"created_at":"2023-03-06T15:12:07.000Z","updated_at":"2024-04-23T11:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"aee0d5de-febe-4f7f-bd63-75d6c6ad2278","html_url":"https://github.com/werifu/complish","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"a03c9e54d2acb2a7ee24689c0a848144a59651a3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werifu%2Fcomplish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werifu%2Fcomplish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werifu%2Fcomplish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werifu%2Fcomplish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/werifu","download_url":"https://codeload.github.com/werifu/complish/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250296438,"owners_count":21407037,"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":["chatgpt","cli","fish","fish-completion","fish-shell","typescript","typescript-library","zsh","zsh-completion"],"created_at":"2024-10-02T07:04:39.618Z","updated_at":"2025-04-22T18:19:39.732Z","avatar_url":"https://github.com/werifu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# complish\n![license](https://img.shields.io/github/license/werifu/complish)\n![release](https://img.shields.io/npm/v/complish?label=最新版本)\n\n[English](./README.md) | [简体中文](./README-zh.md)\n\n\u003ch3 align=\"center\"\u003e使用ChatGPT自动生成CLI的自动补全文件\u003c/h3\u003e\n\nComplish是一款用于为任何类型的CLI生成补全文件的工具，现在支持 __zsh__ 和 __fish__ 。\n\n该工具使用chatGPT API解析CLI的帮助页面（执行`cmd --help`时打印出来的文本）并输出关于帮助页面的结构化信息。然后为特定的shell（如zsh或fish）生成补全脚本。\n\n## 安装\n\n```bash\nnpm i -g complish\n```\n\n需要OpenAI的API密钥，你可以通过设置环境变量或使用下面这条命令来设置密钥：\n\n```bash\nexport OPENAI_API_KEY=your_openai_api_key\n```\n\n或者\n\n```bash\ncomplish set-key your_openai_api_key\n```\n\n如果没有密钥，你可以在[OpenAI](https://platform.openai.com/account/api-keys)申请一个，并记得保密！\n\n## 使用\n\n```bash\ncomplish [options] [cmd]\n```\n\n### 在fish中的实例\n\n生成名为`mycmd`的CLI的fish补全文件\n\n```bash\ncomplish mycmd --shell fish\n```\n\n当脚本执行完毕时，你会发现当前目录中存在`mycmd.fish`文件。\n\n\u003e 注意，执行速度受ChatGPT的响应时间限制，因此生成补全文件可能需要10秒到1分钟或更长时间。\n\n将fish脚本复制到fish shell的补全目录中，即可自动加载文件。其他可用的fish补全目录可以在[这里](https://fishshell.com/docs/current/completions.html)找到\n\n```bash\ncp ./croc.fish ~/.config/fish/completions/\n```\n\n重新打开终端后，当您按下\\\u003cTAB\\\u003e时，您会发现补全已经生效!\n\n![](./assets/mycmd-fish.png)\n\n### 在zsh中的实例\n\n生成名为`mycmd`的CLI的zsh补全文件。\n\n```bash\ncomplish mycmd --shell zsh\n```\n\n当脚本执行完成时，你会在当前目录发现一个名为`_mycmd`的zsh-completion格式的文件。然后将zsh补全文件复制到环境变量`$fpath`中的目录中。你可以在zsh中运行`echo $fpath`查看所有有效的目录。\n\n```bash\ncp ./_mycmd /Users/you/.zsh/functions\n```\n\n重新打开终端后，当您按下\\\u003cTAB\\\u003e时，您会发现补全已经生效！\n\n![](./assets/mycmd-zsh.png)\n\n## 开发\n\n克隆此存储库。\n\n```bash\ngit clone https://github.com/werifu/complish.git\n```\n\n我使用pnpm来管理依赖项:\n\n安装依赖项:\n\n```bash\npnpm i\n```\n\n编译TypeScript代码并运行已编译的JavaScript:\n\n```bash\npnpm build\n./dist/index.js\n```\n\n或者你可以直接使用ts-node运行它:\n\n```bash\npnpm dev\n```\n\n## 贡献\n\n欢迎Pull requests / issues! 请给我您的建议或其他反馈！😊\n\n## TODO\n\n* [ ] 支持bash补全（规划中）\n* [ ] 减少API调用次数（此工具的瓶颈）\n* [ ] 更详细的参数补全","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerifu%2Fcomplish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwerifu%2Fcomplish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerifu%2Fcomplish/lists"}