Welcome to Magi.Spells, a collection of optional spells for the Magi.CLI tool. These spells enhance your magical command-line experience by providing additional functionalities.
The spells are stored in the Magi.Chamber server and can be easily pulled into your local environment. It serves as both a spell repository and a devlog for the MAGI CLI project at this site:
- Magi.Spells
Magi.Spells is a repository that serves as the source for additional spells used by Magi.CLI, a command-line tool that brings a touch of magic to your terminal. The spells in this repository are designed to extend the capabilities of Magi.CLI, allowing you to perform complex tasks with simple commands.
Each spell declares its own dependencies, ensuring modularity and scalability. This per-spell dependency management allows you to install only the packages required for the spells you use, keeping your environment clean and efficient.
To add spells from Magi.Spells to your Magi.CLI tool, use the ponder
command, which handles the installation of spells and their dependencies.
Ensure you have Magi.CLI installed:
pip install magi_cli_pypi
Install spells using the ponder
command:
cast ponder <spell_name>
Replace <spell_name>
with the name of the spell you wish to install. For example:
cast ponder runecraft
The ponder
command will fetch the spell from the Magi.Chamber, install any required dependencies, and make the spell available for use.
Each spell specifies its external dependencies using a special __requires__
variable within the spell script. This variable is a list of packages that are not part of Python's standard library but are required for the spell to function.
For example:
__requires__ = ['click', 'requests', 'openai']
When you install a spell using the ponder
command:
- The
ponder
command extracts the__requires__
variable from the spell. - It prompts you for consent before installing the dependencies.
- It installs the necessary packages, ensuring the spell functions correctly.
If you attempt to use a spell whose dependencies are not installed, Magi.CLI will:
- Gracefully handle the missing dependencies.
- Provide a clear error message indicating which dependencies are missing.
- Suggest running
cast ponder <spell_name>
to install the missing dependencies.
To prevent issues with missing dependencies at startup, Magi.CLI employs lazy loading for spells:
- Spells are only loaded when invoked.
- This approach allows the CLI tool to function even if some spells have unmet dependencies.
- It improves startup performance and reduces unnecessary resource usage.
Below is a list of available spells along with their descriptions and dependencies.
- Description: Call upon the arcane intellect of an artificial intelligence to answer your questions and generate spells or Python scripts.
- Dependencies:
click
,openai
- Description: Clone a remote repository, start a local server, and populate a webpage with the repository's files.
- Dependencies:
click
,flask
,gitpython
- Description: Generate a GUI for a Bash script in the form of an enchanted rune.
- Dependencies:
click
,requests
,Pillow
,openai
,PyQt5
- Description: Craft a Markdown page from a URL through the use of aether inquiry (AI).
- Dependencies:
click
,beautifulsoup4
,openai
,requests
- Description: Transcribe the contents of a file or directory into markdown.
- Dependencies:
click
- Description: Warp to remote SSH sessions with ease.
- Dependencies:
click
,paramiko
,cryptography
- Description: Create a macro spell and store it in
.tome
. - Dependencies:
click
To install the runecraft
spell:
cast ponder runecraft
You'll be prompted to install the spell and its dependencies.
After installing, you can use the spell by casting it with its alias:
cast rc path/to/your/script.sh
If you wish to uninstall a spell:
cast ponder runecraft
If the spell is already installed, the ponder
command will offer to uninstall it.
We welcome contributions to Magi.Spells! If you have an idea for a new spell or improvements to existing ones, please follow the guidelines below.
-
Fork the Repository: Create your own fork of the Magi.Spells repository.
-
Create a New Spell:
- Add your spell script to the
spells
directory. - Ensure your spell includes the following:
- An
__requires__
variable listing any external dependencies. - An
alias
variable for the spell's command alias. - A
main
function that invokes your spell.
- An
- Follow the existing spell format for consistency.
- Add your spell script to the
-
Test Your Spell:
- Use the
ponder
command to install your spell and verify that dependencies are correctly managed. - Ensure your spell functions as intended.
- Use the
-
Update Documentation:
- Add your spell to the Available Spells section in the
README.md
. - Include a description and list of dependencies.
- Add your spell to the Available Spells section in the
-
Submit a Pull Request:
- Once your spell is ready, submit a pull request to the main repository.
- Provide a detailed description of your spell and any relevant information.
- Code Style:
- Follow Python best practices and PEP 8 guidelines.
- Keep your code clean and well-documented.
- Dependencies:
- Only include necessary external dependencies.
- Use standard library modules whenever possible.
- Error Handling:
- Ensure your spell handles errors gracefully.
- Provide meaningful error messages to the user.
- Testing:
- Thoroughly test your spell in various scenarios.
- Verify that dependencies are properly declared and installed.
- Licensing:
- By contributing, you agree that your contributions will be licensed under the same license as this repository (MIT License).
If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository. Provide as much detail as possible to help us address the problem.
Magi.Spells is released under the MIT License. By contributing to this repository, you agree to have your contributions licensed under the MIT License.