Skip to main content

Spark CLI

🔥 Your intelligent code snippet manager for developers

Spark helps you save, organize, and quickly access your frequently used commands and code snippets. Never forget that perfect command again!

PyPI version Python 3.8+

Available on PyPI: pip install spark-cli

Features

  • 💾 Save snippets with optional tags for organization
  • 🔍 Smart search - Find snippets by command or tag content
  • 📋 Quick copy - Copy snippets to clipboard with one command
  • 🏷️ Tag system - Organize snippets with comma-separated tags
  • 🗑️ Flexible deletion - Delete by ID or by text content (with preview)
  • 🎨 Beautiful output - Colorful, table-based display using Rich
  • ⚠️ Duplicate detection - Warns if you try to save a duplicate command
  • 🔄 Auto-migration - Database schema updates automatically
  • 🤖 Intelligent Auto-Tagging - Automatically detects and adds relevant tags based on command content, tools, languages, and project context

Installation

From PyPI (Recommended)

pip install spark-cli

After installation, the spark command is available globally.

Note: If spark doesn't work after installation (e.g., with editable installs), you can use python -m spark as an alternative.

From source

git clone https://github.com/zeroequalsone/spark-cli.git
cd spark-cli
pip install -e .

Note: With editable installs, if spark command doesn't work, use python -m spark instead.

Quick Start

After installation, Spark is ready to use. No configuration needed! The database is automatically created in ~/.spark/snippets.db on first use.

# Save your first snippet (auto-tags detected automatically!)
spark save "docker-compose up -d"  # Auto-tags: compose,docker

# Save with manual tags (auto-tags are merged)
spark save "git log --oneline -10" --tags "git,log,history"

# Save without auto-tagging
spark save "echo hello" --no-auto-tags

# Find snippets
spark find docker

# List all snippets
spark list

# List snippets by tag
spark list --tag docker

# Copy to clipboard
spark copy 1

# Delete a snippet
spark delete 1

# Delete by text content
spark delete "docker"

Commands

spark save <command> [--tags] [--no-auto-tags]

Save a new code snippet with intelligent auto-tagging.

spark save "npm install" --tags "npm,node,install"
spark save "docker-compose up -d"  # Auto-tags: compose,docker
spark save "git log" --no-auto-tags  # Disable auto-tagging

Features:

  • Intelligent Auto-Tagging: Automatically detects tags based on:
    • Tools: docker, git, npm, python, terraform, etc.
    • Languages: Python, JavaScript, Rust, Go, Java, etc.
    • Project Context: Detects language/technology from project files (package.json → JavaScript, requirements.txt → Python, Cargo.toml → Rust, etc.)
    • Directory Context: Recognizes backend/frontend/mobile projects from directory structure
  • Tag Merging: Auto-tags are automatically combined with your manual tags
  • Duplicate detection: If a command already exists, Spark will warn you and ask for confirmation
  • Tags are optional: You can save snippets with or without tags
  • Tags are comma-separated: --tags "tag1,tag2,tag3"
  • Disable auto-tagging: Use --no-auto-tags flag

spark find <search-term>

Search for snippets containing the search term in either the command or tags.

spark find docker
spark find git

spark list [--tag <tag>]

List all snippets, optionally filtered by tag.

spark list
spark list --tag docker

spark copy <id>

Copy a snippet to your clipboard by ID.

spark copy 1

spark delete <id|text>

Delete a snippet by ID or by text content. When deleting by text, Spark shows all matching snippets and asks for confirmation.

# Delete by ID (immediate)
spark delete 1

# Delete by text (shows preview table and asks for confirmation)
spark delete "docker"

Note: When deleting by text, all snippets containing that text will be shown. You can confirm or cancel the deletion.

spark clear

Delete all snippets and reset the database. This also resets the ID counter back to 1.

spark clear

Warning: This action cannot be undone!

Examples

Organizing Docker Commands

# Auto-tagging detects "docker" and "compose" automatically
spark save "docker-compose up -d"  # Auto-tags: compose,docker

# Add custom tags - auto-tags are merged
spark save "docker ps -a" --tags "containers"  # Tags: containers,docker

# Find all docker commands
spark list --tag docker

Git Workflow Snippets

spark save "git log --oneline -10" --tags "git,log,history"
spark save "git checkout -b feature/new-feature" --tags "git,branch,workflow"
spark save "git push origin HEAD" --tags "git,push,remote"

# Search for git commands
spark find git

Python Development

# Auto-tagging detects Python tools and languages
spark save "python -m pytest tests/"  # Auto-tags: pytest,python,test
spark save "python -m black ."  # Auto-tags: python
spark save "pip install -e ."  # Auto-tags: pip,python

# Add custom tags - auto-tags are merged
spark save "python manage.py migrate" --tags "django"  # Tags: django,python

# List all Python-related snippets
spark list --tag python

Data Storage

Spark stores all snippets in a local SQLite database located at:

  • Linux/macOS: ~/.spark/snippets.db
  • Windows: %USERPROFILE%\.spark\snippets.db

Your data stays local and private.

Requirements

  • Python 3.8+
  • typer
  • rich
  • pyperclip

Version

Current version: 0.4.1

What's new in v0.4.1:

  • Fixed: Added support for python -m spark as fallback method
  • Improved installation compatibility

What's new in v0.4.0:

  • 🎯 Intelligent Auto-Tagging - Automatically detects relevant tags from commands
  • Enhanced tag merging with manual tags
  • Improved project context detection

Check for updates:

pip install --upgrade spark-cli

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Ideas for contributions:

  • Import from bash history
  • Export/backup functionality
  • Statistics and usage tracking
  • Shell completion scripts
  • VS Code extension

License

MIT License - see LICENSE file for details.

Acknowledgments

Inspired by tools like pet and cheat.sh, but designed to be more personal and intelligent.

Links

Metadata

Release files for spark-cli 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spark-cli 0.4.1
File Size Uploaded Provenance Actions
spark_cli-0.4.1.tar.gz 13.0 kB Without provenance Details for spark_cli-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spark-cli 0.4.1
File Interpreter ABI Platform Actions
spark_cli-0.4.1-py3-none-any.whl Python 3 none any Details for spark_cli-0.4.1-py3-none-any.whl

Total release size: 24.3 kB

Release files / spark_cli-0.4.1.tar.gz

Download URL spark_cli-0.4.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d14d1e6c5a97268abba22222d729985fc7b801e1f06206444ff7a21ca6ad4a9c
BLAKE2b-256 checksum
How to use checksums
9ccce499fd8f9320de2f5cb714324116ef8e98c0bcbfb3b604acd20ed52af54c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / spark_cli-0.4.1-py3-none-any.whl

Download URL spark_cli-0.4.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63174d968475ef57d3f4249c312641b065e90c47afb70e5c96c5277b0b25b25f
BLAKE2b-256 checksum
How to use checksums
e5754f9c89a1e6f4814631ffbf25327765ae646a70cec1ddca1d6324264bf1ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for spark-cli 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page