Skip to main content

Magi_CLI is a command line interface for those who desire software development to feel more like magic.

Project description

Magi CLI: An Arcane Command Line Interface

banner

"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.

Overview

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.

Core Features

The Sanctum (~/.sanctum)

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

Cast Command

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)

Spell Design Tenets

  • Effectiveness: Spells must work reliably. Half-functioning spells won't be included in release versions.
  • Flavorfulness: Spells should feel magical, requiring only essential memorization unless additional features can be added in a thematic way.
  • Modularity: Each spell must work both as cast spell target and as a standalone script (python path/to/spell.py target).
  • Innovation: Spells should not duplicate standard UNIX commands. We're crafting new magic, not recreating existing tools.
  • Fun: Keep the magical essence alive with thematic messages and interactions!

Core Spells

File Management

  • Fireball (fb): Transmute a file or directory into ashes, sending it to the '.graveyard' realm
  • Banish (bn): Move files to a temporary exile realm
  • Divine (dv): Display detailed file/directory information

System Operations

  • Necromancy (nc): Initialize the .graveyard for file preservation
  • Raise_Dead (rd): Restore files from the .graveyard

Spell Management

  • Spellcraft (sc): Create new spells and spell bundles
  • Ponder (pd): 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 Guide

Spellcraft (sc) is a powerful tool for creating new spells. It supports three main types of spell creation:

1. Macro Spells

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

2. Script Spells

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

3. Bundled Spells

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

Installation

From PyPI

pip install magi-cli-pypi

From Source

git clone https://github.com/bobbyhiddn/Magi_CLI.git
cd Magi_CLI
pip install .

Workflow of SpellCasting

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

Security

  • Spells are verified using sigils (cryptographic signatures)
  • Dependencies are installed in isolated environments
  • Spell bundles are checked for integrity before execution

Contributing

See CONTRIBUTING.md for detailed guidelines.

License

MIT License

Acknowledgments

Created and maintained by Micah Longmire (@bobbyhiddn)

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

magi_cli_pypi-1.0.3.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

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

magi_cli_pypi-1.0.3-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file magi_cli_pypi-1.0.3.tar.gz.

File metadata

  • Download URL: magi_cli_pypi-1.0.3.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for magi_cli_pypi-1.0.3.tar.gz
Algorithm Hash digest
SHA256 40b26a8c098cbae35352af2b89e9a5edc35faba17882028cb40f3781ea7dcea8
MD5 7490b7f25fc7944b1f6aa9c85236919e
BLAKE2b-256 e7175da0c0f0645f8e749a91bcea7c7e8686e2b9ad583a53d6ba06c1c84abb07

See more details on using hashes here.

File details

Details for the file magi_cli_pypi-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: magi_cli_pypi-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for magi_cli_pypi-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3f94d9bfca5c2580f6434b0090cb2c3dae1d202713a7549a406138fdab5ee583
MD5 098ca56eef73bc3e4fd3dc1a3ba3a1b4
BLAKE2b-256 ec92a7df3f3b89b202a017a30c3cabb91240e9f70c674fc9713494983c60c448

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