|
1 | | -📚 README |
2 | | -================ |
| 1 | +# 📚 README |
3 | 2 |
|
4 | | -👋 Introduction |
5 | | ---------------- |
| 3 | +## 👋 Introduction |
6 | 4 |
|
7 | 5 | This project is a Go-based command-line interface (CLI) that utilizes the Groq API to provide a simple and efficient way to generate descriptive commit messages and chat responses. 🤖 |
8 | 6 |
|
9 | | -🚀 Project Setup |
10 | | ------------------ |
| 7 | +## 🚀 Project Setup |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +1. **Install Go**: Download and install Go from the official website: https://go.dev/dl/ 📦 |
| 12 | + |
| 13 | +2. **Install Make**: |
| 14 | + - **Windows**: |
| 15 | + ```bash |
| 16 | + # Using Chocolatey |
| 17 | + choco install make |
| 18 | + # or using Scoop |
| 19 | + scoop install make |
| 20 | + ``` |
| 21 | + - **macOS**: |
| 22 | + ```bash |
| 23 | + # Using Homebrew |
| 24 | + brew install make |
| 25 | + ``` |
| 26 | + - **Linux**: |
| 27 | + ```bash |
| 28 | + # Debian/Ubuntu |
| 29 | + sudo apt-get install make |
| 30 | + # Fedora |
| 31 | + sudo dnf install make |
| 32 | + # CentOS/RHEL |
| 33 | + sudo yum install make |
| 34 | + ``` |
| 35 | + |
| 36 | +3. **Get the Repository**: Clone the repository: |
| 37 | + ```bash |
| 38 | + git clone https://github.com/NevroHelios/cliagent.git |
| 39 | + ``` |
| 40 | + |
| 41 | +4. **Install Dependencies**: |
| 42 | + ```bash |
| 43 | + go get -u github.com/joho/godotenv |
| 44 | + go get -u github.com/kelvins/go-uber-zap |
| 45 | + go get -u github.com/urfave/cli/v2 |
| 46 | + ``` |
| 47 | + |
| 48 | +### Building the Project |
| 49 | + |
| 50 | +#### Development Build (using .env) |
| 51 | +1. Create a `.env` file in the project root: |
| 52 | + ```makefile |
| 53 | + GROQ_API_KEY=your_api_key_here |
| 54 | + ``` |
| 55 | +2. Build the project: |
| 56 | + ```bash |
| 57 | + go build -o gocli |
| 58 | + ``` |
| 59 | + |
| 60 | +#### Production Build (embedded API key) |
| 61 | +Build the project with your API key embedded: |
11 | 62 |
|
12 | | -To set up the project, follow these steps: |
13 | | - |
14 | | -1. **Install Go**: Make sure you have Go installed on your system. You can download it from the official Go website: https://go.dev/dl/ 📦 |
15 | | -2. **Get the Repository**: Clone the repository using the following command: |
16 | 63 | ```bash |
17 | | -git clone https://github.com/NevroHelios/cliagent.git |
| 64 | +# Linux/macOS |
| 65 | +go build -ldflags "-X main.GROQ_API_KEY=your-api-key-here" -o gocli |
| 66 | +
|
| 67 | +# Windows (PowerShell) |
| 68 | +go build -ldflags "-X main.GROQ_API_KEY=your-api-key-here" -o gocli.exe |
18 | 69 | ``` |
19 | | -3. **Install Dependencies**: Install the required dependencies using the following command: |
| 70 | + |
| 71 | +Alternatively, use environment variable: |
20 | 72 | ```bash |
21 | | -go get -u github.com/joho/godotenv |
22 | | -go get -u github.com/kelvins/go-uber-zap |
23 | | -go get -u github.com/urfave/cli/v2 |
24 | | -``` |
25 | | -4. **Create a `.env` File**: Create a new file named `.env` in the root of the project and add your Groq API key: |
26 | | -```makefile |
27 | | -GROQ_API_KEY=your_api_key_here |
| 73 | +# Linux/macOS |
| 74 | +export GROQ_API_KEY=your-api-key-here |
| 75 | +go build -ldflags "-X main.GROQ_API_KEY=$GROQ_API_KEY" -o gocli |
| 76 | +
|
| 77 | +# Windows (PowerShell) |
| 78 | +$env:GROQ_API_KEY="your-api-key-here" |
| 79 | +go build -ldflags "-X main.GROQ_API_KEY=$env:GROQ_API_KEY" -o gocli.exe |
28 | 80 | ``` |
29 | | -🏃♂️ Running the Project |
30 | | -------------------------- |
31 | 81 |
|
32 | | -To run the project, follow these steps: |
| 82 | +### Creating a Symlink (Optional) |
33 | 83 |
|
34 | | -1. **Navigate to the Project Directory**: Navigate to the project directory using the following command: |
35 | | -```bash |
36 | | -cd cliagent |
37 | | -``` |
38 | | -2. **Build the Project**: Build the project using the following command: |
39 | | -```bash |
40 | | -go build -o gocli |
41 | | -``` |
42 | | -3. **Run the Project**: Run the project using the following command: |
43 | | -```bash |
44 | | -./gocli |
45 | | -``` |
46 | | -4. **Follow the Prompts**: Follow the prompts to select a model, enter a query, and generate a response. 🤔 |
| 84 | +To run the CLI from any directory: |
| 85 | + |
| 86 | +- **Windows** (Run PowerShell as Administrator): |
| 87 | + ```powershell |
| 88 | + New-Item -ItemType SymbolicLink -Path "C:\Windows\System32\gocli.exe" -Target "$pwd\gocli.exe" |
| 89 | + ``` |
| 90 | + |
| 91 | +- **Linux/macOS**: |
| 92 | + ```bash |
| 93 | + sudo ln -s "$(pwd)/gocli" /usr/local/bin/gocli |
| 94 | + ``` |
| 95 | + |
| 96 | +## 🏃♂️ Running the Project |
| 97 | + |
| 98 | +1. **Navigate to the Project Directory**: |
| 99 | + ```bash |
| 100 | + cd cliagent |
| 101 | + ``` |
47 | 102 |
|
48 | | -📝 Generating Commit Messages |
49 | | ------------------------------ |
| 103 | +2. **Run the Project**: |
| 104 | + ```bash |
| 105 | + ./gocli |
| 106 | + # If symlinked, simply run from anywhere: |
| 107 | + gocli |
| 108 | + ``` |
50 | 109 |
|
51 | | -To generate a descriptive commit message, follow these steps: |
| 110 | +3. **Follow the Prompts**: Follow the prompts to select a model, enter a query, and generate a response. 🤔 |
| 111 | + |
| 112 | +## 📝 Generating Commit Messages |
52 | 113 |
|
53 | 114 | 1. **Select the "Commit" Option**: Select the "Commit" option from the main menu. |
54 | 115 | 2. **Select a Model**: Enter a query to generate a commit message. |
55 | 116 | 3. **Generate the Commit Message**: The project will generate a descriptive commit message with your selected Model. 📝 |
56 | 117 |
|
57 | | -🤖 Generating Chat Responses |
58 | | ------------------------------ |
59 | | - |
60 | | -To generate a chat response, follow these steps: |
| 118 | +## 🤖 Generating Chat Responses |
61 | 119 |
|
62 | 120 | 1. **Select the "Chat" Option**: Select the "Chat" option from the main menu. |
63 | 121 | 2. **Enter a Query**: Enter a query to generate a chat response. |
64 | 122 | 3. **Generate the Chat Response**: The project will generate a chat response based on your query. 💬 |
65 | 123 |
|
66 | | -👍 Contributing |
67 | | ------------------ |
| 124 | +## 👍 Contributing |
68 | 125 |
|
69 | 126 | If you'd like to contribute to the project, please follow these steps: |
70 | 127 |
|
71 | 128 | 1. **Fork the Repository**: Fork the repository using the GitHub fork button. |
72 | 129 | 2. **Make Changes**: Make changes to the code and commit them using a descriptive commit message. |
73 | 130 | 3. **Create a Pull Request**: Create a pull request to merge your changes into the main repository. 🚀 |
74 | 131 |
|
75 | | -🙏 Acknowledgments |
76 | | ------------------- |
| 132 | +## ⚠️ Security Note |
| 133 | +
|
| 134 | +When building with an embedded API key: |
| 135 | +- Never commit the build command containing your API key |
| 136 | +- Consider using environment variables for the build process |
| 137 | +- Keep your compiled binary secure as it contains your API key |
| 138 | +
|
| 139 | +## 🙏 Acknowledgments |
77 | 140 |
|
78 | 141 | This project utilizes the following libraries and frameworks: |
79 | 142 |
|
|
0 commit comments