Show HN:Zev——记住(或发现)终端命令
Show HN: Zev – Remember (or discover) terminal commands

原始链接: https://github.com/dtnewman/zev

Zev是一个命令行工具,它利用自然语言帮助用户发现和记住终端命令。Zev由OpenAI API提供支持,可以将用户友好的指令(例如“查找过去24小时内修改的所有.py文件”)转换成相应的终端命令。 用户可以通过输入`zev '<你想做什么>'`以交互模式与Zev交互。第一次运行Zev时,系统会提示用户输入他们的OpenAI API密钥。 或者,Zev可以配置为与Ollama一起工作,允许用户在本地运行命令,而无需依赖OpenAI API。这需要安装具有所需模型的Ollama,然后使用`zev --setup`命令配置API基本URL和模型名称。 Zev是开源的,并根据MIT许可证授权,欢迎通过问题和拉取请求贡献代码。使用OpenAI API需要一个OpenAI账户和订阅。

“Zev” 是一款新工具,利用大型语言模型 (LLM) 帮助用户记住或发现终端命令。它接收用户想要执行操作的自然语言描述,并生成一系列可能的终端命令列表。用户选择所需的命令后,该命令会被复制到剪贴板以便手动运行。 一些评论者分享了他们使用的类似方案,例如利用 bash/zsh 历史记录以及诸如 fzf 之类的模糊搜索工具。有人担心可能会生成破坏性命令,创建者正在考虑添加安全措施,例如标记潜在危险的命令并提供解释。一些用户建议将其与现有的工具(如管理 shell 历史记录的 Atuin 和 llm-cmd)集成。其他用户也有类似的项目,例如 gencmd.com 和 how.sh。通过 pip 安装可能需要虚拟环境,但创建者正在努力减少依赖项。
相关文章

原文

PyPI version License: MIT

Zev helps you remember (or discover) terminal commands using natural language.

Description

This project runs on top of the OpenAI API. After your first time running it, you will be prompted to enter an OpenAI key.

Option 1: Interactive Mode

zev '<what you want to do>'
# Find running processes
zev 'show all running python processes'

# File operations
zev 'find all .py files modified in the last 24 hours'

# System information
zev 'show disk usage for current directory'

# Network commands
zev 'check if google.com is reachable'

# Git operations
zev 'show uncommitted changes in git'

You can update your OpenAI API key or other settings by running:

To use the OpenAI key, you must have an OpenAI account and a subscription. You can create an API key on this page.

You can use Zev with Ollama as an alternative to OpenAI, which lets you run all commands locally. To set this up:

  1. Install and start Ollama with a model of your choice

  2. Run zev --setup and put in the proper settings. For example:

Enter your OpenAI API key:
Enter your OpenAI base URL: http://localhost:11434/v1
Enter your OpenAI model: llama3.2

Contributions are welcome! Feel free to open issues or submit pull requests.

This project is licensed under the MIT License - see the LICENSE file for details.

联系我们 contact @ memedata.com