vvk
A command-line interface tool that converts natural language instructions into shell commands using OpenAI's GPT-4.
Prerequisites
Before using this tool, you need to configure your API key and preferences. Get an OpenAI API key at https://platform.openai.com/api-keys. Alternatively, sign up for VVK Cloud.
Installation
Verify with:
node --version# Using npm
npm install -g vvk
# Using pnpm
pnpm add -g vvk
# Using yarn
yarn global add vvkvvk --versionnpm update -g vvk
# or
pnpm update -g vvknpm uninstall -g vvk
# or
pnpm remove -g vvkPermission Errors: Use sudo (not recommended) or fix npm permissions:
# Reset npm permissions
npm config set prefix ~/.npm-global
echo 'export PATH="$PATH:$HOME/.npm-global/bin"' >> ~/.bashrc
source ~/.bashrcSetup Configuration
Use the vvk config set command to configure your settings:
# If using your own Openai API key, set it in the config
vvk config set openaiApiKey your_api_key_here
# Enable or disable command confirmation (default: true)
vvk config set confirmCommand true
# Set default confirmation behavior (y/n)
vvk config set defaultConfirmation yYou can check your current settings with:
vvk config listUse vvk config remove to remove/reset a configuration option:
vvk config remove <key>Login
If using VVK Cloud, use the vvk login command to log in through the browser. If you have an OpenAI API key set, vvk will default to that. Use vvk config remove openaiApiKey to remove it.
# Sets the key and userId values
vvk loginYou can log out with:
vvk logoutUsage
Run commands using natural language:
vvk <your natural language command>Examples
# List all files in the current directory
vvk show me all files in this folder
# Find large files
vvk find files larger than 100MB
# Search for text in files
vvk search for "hello world" in all javascript filesThe tool will:
- Process your natural language input
- Generate an appropriate shell command
- Show you the command for confirmation (if enabled)
- Execute the command upon your approval
Development
To set up the development environment:
# Clone the repository
git clone https://github.com/matyik/vvk.git
# Install dependencies
pnpm install
# Build the project
pnpm build
# Create a global link
pnpm link --global
# Now you can use the development version globally
vvk License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Using with Ollama
VVK can use Ollama as an alternative to OpenAI's API for generating commands.
Setup Ollama
- Install Ollama from ollama.ai
- Start the Ollama service
- Pull your preferred model:
ollama pull llama3
Configure VVK to use Ollama
# Enable Ollama
vvk config set useOllama true
# Set Ollama host (default is http://localhost:11434)
vvk config set ollamaHost http://localhost:11434
# Set Ollama model (default is llama3)
vvk config set ollamaModel llama3When Ollama is enabled, VVK will use it instead of OpenAI or VVK Cloud for generating commands.