Skip to content

j4r0-code/navi-ia

 
 

Repository files navigation

Navi: AI-Powered Shell Guide

"Navi" means "guide" in Hindi, and that's exactly what this tool aims to be. Navi is a command-line tool that utilizes the Gemini API to leverage artificial intelligence in generating shell commands based on your prompts. It simplifies your workflow by understanding your intent and providing the necessary commands to achieve your tasks.

Screen.Recording.2024-03-24.at.5.46.04.PM.mp4

Usage

Navi - Your AI-powered Shell Guide

Usage:
  navi [flags]
  navi [command]

Examples:
navi "List all files in the current directory."

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  explain     Explain - Understand your shell commands
  help        Help about any command

Flags:
  -h, --help   help for navi

Use "navi [command] --help" for more information about a command.

Commands

1. navi

The navi command takes a string as an argument and generates a shell command based on that string.

Example:

$ navi "list all files`

$ >> ls -a

2. navi explain

The navi explain command also takes a string (shell command) as an argument, and explains the functionality of a given shell command.

Example:

$ navi explain "ls -a`

$ Explanation >>

the command explanation

Installation

You can install Navi using the go install command:

go install github.com/nitintf/navi

After installation, don't forget to export your Gemini API key:

export GEMINI_API_KEY="..."

You can obtain your Gemini API key from the Gemini API Management page.

Vim integration

Plugin load and installation

Edit navi.vim to set g:NaviBin to your custom binary location. Optionally, change the preferred key combination (defaults to <C-k>).

In Vim, you simply have to :source navi.vim.

However, if you want the plugin to be persistent, make it load when Vim starts: copy navi.vim to any directory present in your runtime path (:echo &runtimepath). Restart Vim. Verify if the script is loaded with :scriptnames.

Usage

In Normal Mode, press your preferred key combination (or by default) to pass your current line to Navi. In Visual Mode, you may select more lines.

Caution

While Navi uses AI to generate shell commands, it's important to understand that AI isn't perfect. Always review the generated commands before executing them, especially if you're working in a production environment or dealing with sensitive data. Navi is a tool designed to assist you, but it doesn't replace good judgment and understanding of shell commands.

Contribution

Contributions to Navi are very welcome! If you have a feature request, bug report, or proposal for code refactoring, please feel free to open an issue or submit a pull request.

This thing only supports Gemini for the moment, but it could be easily updated to support other models using Replicate, Ollama, etc. Pull requests welcome!

License

MIT

About

Navi : AI-Powered Shell Guide

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 68.6%
  • Vim Script 20.2%
  • Makefile 11.2%