Skip to main content

Tunisian Shell Command Assistant

Project description


BourguibaGPT - Tunisian Shell Command Assistant

OVERVIEW

BourguibaGPT is an interactive shell command generator that helps users generate, validate, and execute safe shell commands using natural language prompts. Powered by Ollama AI, it offers an engaging interface with animated banners and interactive prompts. The tool is designed with safety in mind—it validates commands before execution and keeps a history of generated commands along with user feedback.

FEATURES

• Interactive command generation using AI (Ollama API) • Animated banner display for a dynamic user experience • Command validation to ensure only safe commands are executed • Command history tracking and feedback mechanism • Cross-platform support (Linux, macOS, and Windows) • Customizable model selection based on system memory and user preferences • OS-specific installation and service management routines

FILE STRUCTURE

Project files are organized under the "src/bourguibagpt" directory as follows:

  1. main.py

    • Main application entry point.
    • Displays the animated banner.
    • Manages interactive command generation and execution.
    • Handles installation and verification of the Ollama CLI.
  2. config.py

    • Contains default model configurations and OS-specific settings.
    • Manages user preferences for the preferred model.
    • Provides utility functions to load and save configuration settings.
  3. validators.py

    • Implements command validation logic to ensure only safe commands are executed.
    • Checks the base command against a predefined whitelist and validates arguments.
  4. windows.py

    • Contains Windows-specific functions.
    • Handles installation of Ollama on Windows.
    • Provides functions to verify installation and start the Ollama service.

DEPENDENCIES

• Python 3.7 or later • Rich (for enhanced terminal UI) - Install with: pip install rich • Requests (for HTTP API calls) - Install with: pip install requests • psutil (for system memory detection) - Install with: pip install psutil • Standard libraries: argparse, json, subprocess, logging, time, os, platform, etc.

INSTALLATION

  1. Ensure Python 3.7 or later is installed on your system.
  2. Clone the repository to your local machine.
  3. Navigate to the repository’s root directory.
  4. Install the required Python packages. If a requirements file is available, run: pip install -r requirements.txt Otherwise, manually install the necessary packages (rich, requests, psutil).
  5. The application will check for the Ollama CLI. If not found, it will attempt to install it automatically based on your operating system.
    • On Windows, it will use winget or download the installer directly.
    • On Linux and macOS, it will attempt installation via curl or brew, respectively.
  6. Ensure you have the necessary permissions on your system to install and run external software.

USAGE

To launch the application, run the following command from the project root:

python -m src.bourguibagpt.main

Once started, the application will display an animated banner followed by a prompt. You can interact with the tool using the following commands:

• help - Display help information and available commands. • history - Show the history of generated commands. • execute - Execute a specific shell command. • model - Change the AI model used for command generation. • sibourguiba - Alias for changing the model. • exit / quit - Exit the application.

At the prompt, simply type a natural language description of the desired shell command. BourguibaGPT will generate the command, display it, and ask for confirmation before executing it.

CONFIGURATION

User preferences are saved in a configuration file located at: (Your Home Directory)/.config/bourguibagpt/settings.json

This file stores your preferred AI model and the last used timestamp. The application automatically updates this file when you change the model preference.

TROUBLESHOOTING

• If the Ollama service is not running, the tool will attempt to start it automatically. On Linux and macOS, ensure that you have the necessary permissions. • In case of errors during command generation or execution, refer to the error messages displayed in the terminal. • Log messages are printed to the console for further troubleshooting. Check these messages if unexpected behavior occurs. • For command validation failures, ensure that your command requests use allowed commands and safe argument formats.

LICENSE & SUPPORT

This project is released under the MIT License. For support, contact the project maintainer or consult the issue tracker provided in the repository.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bourguibagpt-2.0.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bourguibagpt-2.0.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file bourguibagpt-2.0.1.tar.gz.

File metadata

  • Download URL: bourguibagpt-2.0.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for bourguibagpt-2.0.1.tar.gz
Algorithm Hash digest
SHA256 6d30d0350174a02eb5d36f8c00192ec26857479b7004ccd5c561e53f0e55cdfb
MD5 b8e0fe81cee2c9e602c9ade295e379b2
BLAKE2b-256 245aa7e9f520c0ffcd1f139a2a17cd8f80bfc441db71f6f811324ad6e4bdf344

See more details on using hashes here.

File details

Details for the file bourguibagpt-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: bourguibagpt-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for bourguibagpt-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab6452753c6cf1ae3b616d7ca9f49cd76602919bec64473d21aa3019537e78b1
MD5 9b724bcb3408f681ccd89cb417e4f3c9
BLAKE2b-256 81c9c81f6aa3420db353d8d69aa3670e9bcfebc326449c39cd1fd53808a50346

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page