Name | cmd_assist JSON |
Version |
0.1.11
JSON |
| download |
home_page | None |
Summary | A tool to save and retrieve frequently used commands. |
upload_time | 2024-08-11 11:08:37 |
maintainer | Darren Rabbitt |
docs_url | None |
author | Darren Rabbitt |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
commands
cli
tools
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Command Assist Tool
Command Assist is a versatile CLI tool designed to streamline the management and organization of commands. It offers robust features for saving, listing, exporting, importing, backing up, and restoring commands, with support for AWS S3. The tool is aimed at helping developers efficiently store and retrieve useful commands, reducing time spent searching through command history or searching for a specifc command.
In addition to these core functionalities, Command Assist includes an AI assistance feature. This AI integration provides intelligent guidance and support for command-related queries, making it easier to discover and use commands effectively
## Table of Contents
- [Motivation](#motivation)
- [Python Versions](#python-versions)
- [Features](#features)
- [Installation](#installation)
- [Option 1: Using a Virtual Environment and Symbolic Links](#option-1-using-a-virtual-environment-and-symbolic-links)
- [Option 2: Installing Directly to System Python](#option-2-installing-directly-to-system-python)
- [Setting Up](#setting-up)
- [Commands](#commands)
## Motivation
Motivation
Managing commands and snippets in the terminal can be cumbersome, especially when juggling different contexts, switching between applications, or manually saving commands to notes. Many developers find themselves constantly copying commands from their terminal to other tools or having to search through command history to retrieve useful snippets.
The Command Assist Tool was created to streamline this process and enhance portability. Inspired by solutions like Warp, which offer advanced terminal features, I wanted to build a tool that allows me to manage and access my personal stash of commands directly from the terminal.
A key feature of Command Assist is its ability to seamlessly back up commands to cloud storage solutions such as AWS S3. This ensures that your command stash is not only organized and accessible but also portable. By storing your commands in the cloud, you can easily back them up and restore them if you switch devices, providing peace of mind and flexibility for developers who work across multiple environments.
In addition, Command Assist integrates with OpenAI to provide intelligent assistance for command-related queries. This AI integration offers context-aware guidance and suggestions, helping you discover and utilize commands more effectively without leaving the terminal.
While AWS S3 is an affordable and reliable starting point for cloud storage, there is potential for future updates to support additional storage solutions. The current choice of AWS S3 reflects its cost-effectiveness and wide adoption, but the tool is designed with flexibility in mind, allowing for the integration of other cloud providers as needed.
With features for saving commands, creating backups, leveraging AI assistance, and ensuring portability, Command Assist aims to simplify command management and enhance productivity, all while ensuring that your valuable command data is securely stored and easily retrievable from anywhere.
This version now includes the integration with OpenAI, highlighting how the AI assistance can enhance the tool’s capabilities.
## Python Versions
This project supports Python versions specified in the `pyproject.toml` file:
```toml
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
```
## Features
• Save Commands: Store commands with categories and descriptions.
• List Commands: Retrieve saved commands with filtering options.
• Import Commands: Import commands from JSON or YAML files.
• Backup Commands: Back up commands to local storage or an AWS S3 bucket.
• Restore Commands: Restore commands from an AWS S3 bucket.
• Configuration Management: Override and display configuration settings.
• AI Assistance: Get AI-generated assistance for command-related queries.
## Installation
Ensure you are using Python 3.9 and above.
### Option 1: Using a Virtual Environment and Symbolic Links
1. **Ensure Python Version**
- Verify you have Python 3.9 or later:
```bash
python --version
```
2. **Create and Activate Virtual Environment**
- **Create**:
```bash
python -m venv myenv
```
- **Activate**:
- **Windows**:
```bash
myenv\Scripts\activate
```
- **macOS/Linux**:
```bash
source myenv/bin/activate
```
3. **Install `cmd_assist`**
```bash
pip install cmd_assist
```
4. **Create Symbolic Links**
- **Locate** your virtual environment’s `bin` directory:
```bash
/path/to/myenv/bin/
```
- **Create Symbolic Link**:
- **macOS/Linux**:
```bash
sudo ln -s /path/to/myenv/bin/ca /usr/local/bin/ca
```
- **Windows**:
```powershell
mklink C:\Path\To\Global\Folder\ca C:\Path\To\myenv\Scripts\ca.exe
```
5. **Verify Installation**
```bash
ca --help
```
## Option 2: Installing Directly to System Python
1. **Ensure Python Version**
- Verify you have Python 3.9 or later:
```bash
python --version
```
2. **Install `cmd_assist`**
```bash
python -m pip install cmd_assist
```
3. **Verify Installation**
```bash
ca --help
```
### Setting Up
To configure cmd_assist, follow these steps:
1. You can view the default structure by running `ca show-config`.
2. Copy and paste this YAML to a convenient location or edit the config file inside your home directory `~/.cmd_assist/config.yaml`.
3. By default, the backup strategy is set to "local". However, you can choose to use an AWS bucket as the backup provider. To do this, make sure you are authenticated and have appropriate IAM permissions to create a bucket.
4. Edit the `backup_provider` field in the `config.yaml` file to "aws". Choose a suitable region and bucket name.
5. Run the command `ca create-backup` to create a backup using the AWS bucket as the provider.
6. The `command_files` directory is the default location where your commands are stored. Local backups will be saved in a sub-directory called `backups`.
```yaml
backup_provider: local # or aws
# Configuration specific to different backup providers.
backup_providers:
aws:
region: us-east-1
bucket_name: cmd-assist-bucket
bucket_acl: private
local:
directory: /tmp/cmd_assist/
directory_name: backups
# Path to the file where commands are stored.
commands_file: /tmp/commands.yaml
# Name of the object (file) to be used for backup.
object_name: commands.json
```
Please note that the above commands are placeholders and need to be implemented with their respective functionalities.
## Commands
Here are some examples of commands and their expected outputs:
```bash
ca --help
Usage: ca [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
backup
create-backup
destroy-backup Command function to destroy the backup.
export-config
fetch
import
list
list-all
list-categories Command function to list all categories.
remove Command function to remove commands based on provided...
restore
save
set-config
show-bundles
show-config
assist Command function to get ai asssitance
```
- `set_config`:
- Description: Set the configuration.
- Output: The configuration is successfully set. Additional bundles to different repos can be added. Just ensure to follow the same schema convention, and if it's a public repo, it will be fetched. Pre-configured bundles for this tool are available from [cmd_assist_bundles](https://github.com/darrenrabbs/cmd_assist_bundles).
- `show_config`:
- Description: Show the configuration.
- Output: The current configuration is displayed. A list of pre-configured bundles which can be fetched.
- `export_config`:
- Description: Export the configuration.
- Output: The configuration is exported to a file.
- `show_bundles`:
- Description: Show the bundles.
- Output: The available bundles are listed.
- `save_command`:
- Description: Save a command.
- Example:
```bash
ca save git log "commit log for all branches" "git log --all --graph --oneline --decorate"
Saved command: git log --all --graph --oneline --decorate
```
- Output: The comamnd is successfully saved
- `list_commands`:
- Description: List all commands.
- Output: All saved commands are displayed.
```bash
ca list git
{
"log": {
"commit log for all branches": "git log --all --graph --oneline --decorate"
}
}
```
- `list_all_commands`:
- Description: List all commands.
- Output: All saved commands are displayed.
- `list_categories`:
- Description: List categories.
- Output: All available categories are listed.
- `import_commands`:
- Description: Import commands.
- Output: The commands are successfully imported.
- `create_backup`:
- Description: Create a backup.
- Output: A backup of the commands is created. This is required if you are using AWS bucket. Ensure you are authenticated.
- `destroy_backup`:
- Description: Destroy a backup.
- Output: The backup is successfully destroyed.
- `remove`:
- Description: Remove a command.
- Output: The command is successfully removed.
```bash
ca remove --category git --subcategory diff --description 'command to compare a file between 2 branches'
Are you sure you want to remove the commands? This action cannot be undone. [y/N]: y
```
- `backup`:
- Description: Backup commands.
- Output: The commands are backed up depending on what you have configured, local or AWS.
```bash
ca backup
File /tmp/commands.yaml backed up to /tmp/cmd_assist/backups/backups/commands_20240807_235241.txt.
```
- `fetch`:
- Description: Fetch commands.
- Output: The commands are fetched from the configured bundles.
```bash
ca fetch ansible
Commands saved to fetched/ansible_commands.json
Commands successfully imported from fetched/ansible_commands.json
```
- `restore`:
- Description: Restore commands.
- Output: The commands are successfully restored from backup.
## AI Assistance
The Command Assist Tool features AI assistance to enhance your experience. Use the assist command to interact with the AI, which provides intelligent support and suggestions based on your command-related queries. This feature helps you discover and utilize commands more effectively. There is a requirement to have an OPEN_AI_TOKEN and account setup to use this feature.
### Example1
```bash
cmd_assist_tool % ca assist linux volumes "command to mount a volume on linux"
Processing query for category: linux, subcategory: volumes, description: command to mount a volume on linux...
Suggested command: START_COMMAND
mount /dev/sdb1 /mnt/my_volume
END_COMMAND
Would you like to save this command? (yes/no) [no]: yes
Command saved.
```
### Example2
```bash
ca assist git history "command to show last person to change a specific file"
Processing query for category: git, subcategory: history, description: command to show last person to change a specific file...
Suggested command: START_COMMAND
git log -n 1 -- <file>
END_COMMAND
Would you like to save this command? (y/n) [n]: y
Command saved.
ca list git
{
"history": {
"command to see last commit": "git log -1",
"command to show last person to change a specific file": "git log -n 1 -- <file>"
},
..
```
## Contact
If you encounter any issues or have any suggestions, please feel free to send them to dev@darrenrabbitt.com. Thank you for your support!
Raw data
{
"_id": null,
"home_page": null,
"name": "cmd_assist",
"maintainer": "Darren Rabbitt",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "dev@darrenrabbitt.com",
"keywords": "commands, CLI, tools",
"author": "Darren Rabbitt",
"author_email": "dev@darrenrabbitt.com",
"download_url": "https://files.pythonhosted.org/packages/02/81/3fa9490fb365634132898936e63b6d64d726d7a23990f1d0aee5e17a6f0f/cmd_assist-0.1.11.tar.gz",
"platform": null,
"description": "# Command Assist Tool\n\nCommand Assist is a versatile CLI tool designed to streamline the management and organization of commands. It offers robust features for saving, listing, exporting, importing, backing up, and restoring commands, with support for AWS S3. The tool is aimed at helping developers efficiently store and retrieve useful commands, reducing time spent searching through command history or searching for a specifc command.\n\nIn addition to these core functionalities, Command Assist includes an AI assistance feature. This AI integration provides intelligent guidance and support for command-related queries, making it easier to discover and use commands effectively\n\n## Table of Contents\n\n- [Motivation](#motivation)\n- [Python Versions](#python-versions)\n- [Features](#features)\n- [Installation](#installation)\n - [Option 1: Using a Virtual Environment and Symbolic Links](#option-1-using-a-virtual-environment-and-symbolic-links)\n - [Option 2: Installing Directly to System Python](#option-2-installing-directly-to-system-python)\n- [Setting Up](#setting-up)\n- [Commands](#commands)\n\n## Motivation\nMotivation\n\nManaging commands and snippets in the terminal can be cumbersome, especially when juggling different contexts, switching between applications, or manually saving commands to notes. Many developers find themselves constantly copying commands from their terminal to other tools or having to search through command history to retrieve useful snippets.\n\nThe Command Assist Tool was created to streamline this process and enhance portability. Inspired by solutions like Warp, which offer advanced terminal features, I wanted to build a tool that allows me to manage and access my personal stash of commands directly from the terminal.\n\nA key feature of Command Assist is its ability to seamlessly back up commands to cloud storage solutions such as AWS S3. This ensures that your command stash is not only organized and accessible but also portable. By storing your commands in the cloud, you can easily back them up and restore them if you switch devices, providing peace of mind and flexibility for developers who work across multiple environments.\n\nIn addition, Command Assist integrates with OpenAI to provide intelligent assistance for command-related queries. This AI integration offers context-aware guidance and suggestions, helping you discover and utilize commands more effectively without leaving the terminal.\n\nWhile AWS S3 is an affordable and reliable starting point for cloud storage, there is potential for future updates to support additional storage solutions. The current choice of AWS S3 reflects its cost-effectiveness and wide adoption, but the tool is designed with flexibility in mind, allowing for the integration of other cloud providers as needed.\n\nWith features for saving commands, creating backups, leveraging AI assistance, and ensuring portability, Command Assist aims to simplify command management and enhance productivity, all while ensuring that your valuable command data is securely stored and easily retrievable from anywhere.\n\nThis version now includes the integration with OpenAI, highlighting how the AI assistance can enhance the tool\u2019s capabilities.\n\n## Python Versions\nThis project supports Python versions specified in the `pyproject.toml` file:\n```toml\n[tool.poetry.dependencies]\npython = \">=3.9,<4.0\"\n```\n\n## Features\n\t\u2022\tSave Commands: Store commands with categories and descriptions.\n\t\u2022\tList Commands: Retrieve saved commands with filtering options.\n\t\u2022\tImport Commands: Import commands from JSON or YAML files.\n\t\u2022\tBackup Commands: Back up commands to local storage or an AWS S3 bucket.\n\t\u2022\tRestore Commands: Restore commands from an AWS S3 bucket.\n\t\u2022\tConfiguration Management: Override and display configuration settings.\n\t\u2022\tAI Assistance: Get AI-generated assistance for command-related queries.\n\n## Installation\nEnsure you are using Python 3.9 and above.\n\n### Option 1: Using a Virtual Environment and Symbolic Links\n\n1. **Ensure Python Version**\n - Verify you have Python 3.9 or later:\n ```bash\n python --version\n ```\n\n2. **Create and Activate Virtual Environment**\n - **Create**:\n ```bash\n python -m venv myenv\n ```\n\n - **Activate**:\n - **Windows**:\n ```bash\n myenv\\Scripts\\activate\n ```\n - **macOS/Linux**:\n ```bash\n source myenv/bin/activate\n ```\n\n3. **Install `cmd_assist`**\n ```bash\n pip install cmd_assist\n ```\n\n4. **Create Symbolic Links**\n - **Locate** your virtual environment\u2019s `bin` directory:\n ```bash\n /path/to/myenv/bin/\n ```\n\n - **Create Symbolic Link**:\n - **macOS/Linux**:\n ```bash\n sudo ln -s /path/to/myenv/bin/ca /usr/local/bin/ca\n ```\n - **Windows**:\n ```powershell\n mklink C:\\Path\\To\\Global\\Folder\\ca C:\\Path\\To\\myenv\\Scripts\\ca.exe\n ```\n\n5. **Verify Installation**\n ```bash\n ca --help\n ```\n\n## Option 2: Installing Directly to System Python\n\n1. **Ensure Python Version**\n - Verify you have Python 3.9 or later:\n ```bash\n python --version\n ```\n\n2. **Install `cmd_assist`**\n ```bash\n python -m pip install cmd_assist\n ```\n3. **Verify Installation**\n ```bash\n ca --help\n ```\n\n### Setting Up\n\nTo configure cmd_assist, follow these steps:\n\n1. You can view the default structure by running `ca show-config`. \n\n2. Copy and paste this YAML to a convenient location or edit the config file inside your home directory `~/.cmd_assist/config.yaml`.\n\n3. By default, the backup strategy is set to \"local\". However, you can choose to use an AWS bucket as the backup provider. To do this, make sure you are authenticated and have appropriate IAM permissions to create a bucket.\n\n4. Edit the `backup_provider` field in the `config.yaml` file to \"aws\". Choose a suitable region and bucket name.\n\n5. Run the command `ca create-backup` to create a backup using the AWS bucket as the provider.\n\n\n6. The `command_files` directory is the default location where your commands are stored. Local backups will be saved in a sub-directory called `backups`.\n\n\n```yaml\nbackup_provider: local # or aws\n\n# Configuration specific to different backup providers.\nbackup_providers:\n aws:\n region: us-east-1\n bucket_name: cmd-assist-bucket\n bucket_acl: private\n\n local:\n directory: /tmp/cmd_assist/\n directory_name: backups\n\n# Path to the file where commands are stored.\ncommands_file: /tmp/commands.yaml\n\n# Name of the object (file) to be used for backup.\nobject_name: commands.json\n```\n\n\n\nPlease note that the above commands are placeholders and need to be implemented with their respective functionalities.\n\n## Commands\nHere are some examples of commands and their expected outputs:\n```bash\nca --help\nUsage: ca [OPTIONS] COMMAND [ARGS]...\nOptions:\n--help Show this message and exit.\nCommands:\nbackup\ncreate-backup\ndestroy-backup Command function to destroy the backup.\nexport-config\nfetch\nimport\nlist\nlist-all\nlist-categories Command function to list all categories.\nremove Command function to remove commands based on provided...\nrestore\nsave\nset-config\nshow-bundles\nshow-config\nassist Command function to get ai asssitance \n```\n\n- `set_config`:\n - Description: Set the configuration.\n - Output: The configuration is successfully set. Additional bundles to different repos can be added. Just ensure to follow the same schema convention, and if it's a public repo, it will be fetched. Pre-configured bundles for this tool are available from [cmd_assist_bundles](https://github.com/darrenrabbs/cmd_assist_bundles).\n \n- `show_config`:\n - Description: Show the configuration.\n - Output: The current configuration is displayed. A list of pre-configured bundles which can be fetched.\n\n- `export_config`:\n - Description: Export the configuration.\n - Output: The configuration is exported to a file.\n\n- `show_bundles`:\n - Description: Show the bundles.\n - Output: The available bundles are listed.\n\n- `save_command`:\n - Description: Save a command.\n - Example:\n```bash\n ca save git log \"commit log for all branches\" \"git log --all --graph --oneline --decorate\"\n Saved command: git log --all --graph --oneline --decorate\n```\n - Output: The comamnd is successfully saved\n\n- `list_commands`:\n - Description: List all commands.\n - Output: All saved commands are displayed.\n```bash\n ca list git\n {\n \"log\": {\n \"commit log for all branches\": \"git log --all --graph --oneline --decorate\"\n }\n }\n```\n\n- `list_all_commands`:\n - Description: List all commands.\n - Output: All saved commands are displayed.\n\n- `list_categories`:\n - Description: List categories.\n - Output: All available categories are listed.\n\n- `import_commands`:\n - Description: Import commands.\n - Output: The commands are successfully imported.\n\n- `create_backup`:\n - Description: Create a backup.\n - Output: A backup of the commands is created. This is required if you are using AWS bucket. Ensure you are authenticated.\n\n- `destroy_backup`:\n - Description: Destroy a backup.\n - Output: The backup is successfully destroyed. \n\n- `remove`:\n - Description: Remove a command.\n - Output: The command is successfully removed.\n ```bash\n ca remove --category git --subcategory diff --description 'command to compare a file between 2 branches'\n Are you sure you want to remove the commands? This action cannot be undone. [y/N]: y\n ```\n- `backup`:\n - Description: Backup commands.\n - Output: The commands are backed up depending on what you have configured, local or AWS.\n```bash\n ca backup\n File /tmp/commands.yaml backed up to /tmp/cmd_assist/backups/backups/commands_20240807_235241.txt.\n```\n\n- `fetch`:\n - Description: Fetch commands.\n - Output: The commands are fetched from the configured bundles.\n```bash\n ca fetch ansible\n Commands saved to fetched/ansible_commands.json\n Commands successfully imported from fetched/ansible_commands.json\n```\n\n- `restore`:\n - Description: Restore commands.\n - Output: The commands are successfully restored from backup.\n\n## AI Assistance\n\nThe Command Assist Tool features AI assistance to enhance your experience. Use the assist command to interact with the AI, which provides intelligent support and suggestions based on your command-related queries. This feature helps you discover and utilize commands more effectively. There is a requirement to have an OPEN_AI_TOKEN and account setup to use this feature.\n\n### Example1\n```bash\ncmd_assist_tool % ca assist linux volumes \"command to mount a volume on linux\"\nProcessing query for category: linux, subcategory: volumes, description: command to mount a volume on linux...\nSuggested command: START_COMMAND\nmount /dev/sdb1 /mnt/my_volume\nEND_COMMAND\nWould you like to save this command? (yes/no) [no]: yes\nCommand saved.\n```\n### Example2\n```bash\nca assist git history \"command to show last person to change a specific file\"\nProcessing query for category: git, subcategory: history, description: command to show last person to change a specific file...\nSuggested command: START_COMMAND\ngit log -n 1 -- <file>\nEND_COMMAND\nWould you like to save this command? (y/n) [n]: y\nCommand saved.\nca list git \n{\n \"history\": {\n \"command to see last commit\": \"git log -1\",\n \"command to show last person to change a specific file\": \"git log -n 1 -- <file>\"\n },\n..\n```\n\n\n\n## Contact\nIf you encounter any issues or have any suggestions, please feel free to send them to dev@darrenrabbitt.com. Thank you for your support!",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool to save and retrieve frequently used commands.",
"version": "0.1.11",
"project_urls": null,
"split_keywords": [
"commands",
" cli",
" tools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "162691ef88c0fec05f99bf0a94f359cd52904e60c92f1a4d30c99473e4c9a995",
"md5": "6146e25e31250fc298335abf387dcea3",
"sha256": "e9b704b978111781315297038ba794c55d9057959f804eb5eca7eade55e5da88"
},
"downloads": -1,
"filename": "cmd_assist-0.1.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6146e25e31250fc298335abf387dcea3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 29921,
"upload_time": "2024-08-11T11:08:34",
"upload_time_iso_8601": "2024-08-11T11:08:34.673169Z",
"url": "https://files.pythonhosted.org/packages/16/26/91ef88c0fec05f99bf0a94f359cd52904e60c92f1a4d30c99473e4c9a995/cmd_assist-0.1.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02813fa9490fb365634132898936e63b6d64d726d7a23990f1d0aee5e17a6f0f",
"md5": "d1525e4ea7b3ed2d42722f4ea30669b1",
"sha256": "e549957d8105d84159154fbe59143e71ddc71472650dce85108727948739ddac"
},
"downloads": -1,
"filename": "cmd_assist-0.1.11.tar.gz",
"has_sig": false,
"md5_digest": "d1525e4ea7b3ed2d42722f4ea30669b1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 26048,
"upload_time": "2024-08-11T11:08:37",
"upload_time_iso_8601": "2024-08-11T11:08:37.104986Z",
"url": "https://files.pythonhosted.org/packages/02/81/3fa9490fb365634132898936e63b6d64d726d7a23990f1d0aee5e17a6f0f/cmd_assist-0.1.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-11 11:08:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "cmd_assist"
}