"Any sufficiently advanced technology is indistinguishable from magic."
― Arthur C. Clarke
Embrace the arcane with Magi CLI, a spellcasting-inspired command line interface (CLI) tool that fuses the mystical arts with practical utility. Unravel the secrets of the cosmos and command your operating system with the wisdom of the ancient magi.
Magi CLI is forged in Python, channeling the enigmatic power of the Click library. It offers an array of spells (commands) that manipulate the filesystem, manage files, and automate tasks. Designed to be extendable, Magi CLI allows you to add new spells as your knowledge of the hidden arts expands. While platform agnostic, it performs best with a bash terminal like Git Bash.
Your magical workspace contains:
- .tome/
: Storage for spell bundles
- .orb/
: Local spell cache
- .graveyard/
: Temporary storage for deleted files
- .runes/
: GUI elements for spell execution
The root command serving as the universal execution command. It displays all available spells and .spell
files in your tome when run without arguments. Currently supports:
- Python scripts (.py)
- Shell scripts (.sh)
- Spell bundles (.spell)
cast spell target
and as a standalone script (python path/to/spell.py target
).fb
): Transmute a file or directory into ashes, sending it to the '.graveyard' realmbn
): Move files to a temporary exile realmdv
): Display detailed file/directory informationnc
): Initialize the .graveyard for file preservationrd
): Restore files from the .graveyardsc
): Create new spells and spell bundlespd
): Explore and manage available spells. Connect to the Chamber for additional community spells.Additional spells are available through the Magi Chamber (magi-chamber.fly.dev
), accessible via the ponder
spell.
Spellcraft (sc
) is a powerful tool for creating new spells. It supports three main types of spell creation:
Create spells that combine multiple commands:
# Create a macro spell with 3 commands
cast sc 3 backup_spell
The wizard will prompt you for:
- Spell description
- Three commands to be executed in sequence
Convert existing Python or Shell scripts into spells:
# Create a spell from a Python script
cast sc path/to/script.py spell_name
# Create a spell from a Shell script
cast sc path/to/script.sh spell_name
Create complex spells with multiple files and resources using YAML configuration:
# spell.yaml
name: my_spell
description: A powerful new spell
type: bundled
shell_type: python
entry_point: spell/main.py
dependencies:
python:
- requests>=2.0.0
code: |
import click
@click.command()
def main():
"""Your spell's magic here."""
click.echo("Spell cast successfully!")
artifacts:
- path: data/config.json
content: |
{
"settings": "value"
}
Create the bundled spell:
cast sc spell.yaml
pip install magi-cli-pypi
git clone https://github.com/bobbyhiddn/Magi_CLI.git
cd Magi_CLI
pip install .
stateDiagram-v2
state "cast" as entry
state "Command Handling" as commands {
SpellParser
CommandRegistry
}
state "Executable Types" as types {
state ".py files" as py
state ".sh files" as sh
state ".spell bundles" as bundle
}
state "Spellcraft System" as craft {
state "SpellBundle" as sb {
LoadConfig
CreateBundle
}
state "Sigildry" as sig {
GenerateHash
GenerateSVG
VerifySigil
}
}
state "~/.sanctum" as sanctum {
.tome
.orb
.graveyard
}
entry --> commands
commands --> types
bundle --> craft
craft --> sanctum
types --> sanctum
See CONTRIBUTING.md for detailed guidelines.
MIT License
Created and maintained by Micah Longmire (@bobbyhiddn)