explainshell  by idank

Command-line argument explainer using manpage parsing and LLMs

Created 12 years ago
14,026 stars

Top 3.7% on SourcePulse

GitHubView on GitHub
Project Summary

Summary Explainshell simplifies command-line understanding by matching arguments to help text extracted from manpages. It targets developers, sysadmins, and power users, offering a web interface and backend to demystify command syntax and options, reducing learning curves.

How It Works The system comprises a manpage reader, an options extractor (roff macros or LLMs), a SQLite backend, and a matcher. It parses command ASTs via bashlex, then matches arguments against stored options. A key feature is its dual extraction strategy: fast source mode (roff parsing) and accurate llm mode (LLM slicing), which prevents hallucinations by directly extracting text.

Quick Start & Requirements Clone the repo, set up a Python 3 virtual environment (python3 -m venv .venv, source .venv/bin/activate), and install dependencies (pip install -r requirements-dev.txt). Download the live DB (make download-live-db) or parse manpages locally (python -m explainshell.manager extract --mode source <path>). Run the web server with make serve. LLM extraction requires an API key. Demo: explainshell.com.

Highlighted Details

  • Storage: Manpages and metadata in a single SQLite DB (explainshell.db) with tables for raw manpages, parsed options, and command mappings.
  • Manpage Sourcing: Utilizes Ubuntu archives and manned.org; sources managed via git submodule.
  • Extraction Modes: Offers source (fast roff) and llm:<provider/model> (accurate LLM slicing) strategies; LLM mode supports batch processing.
  • CLI Tools: manager CLI handles DB operations, manpage processing, and extraction comparison (diff).
  • Benchmarking: Includes tools/llm_bench.py for evaluating LLM extractor performance.

Maintenance & Community The README lacks specific details on maintainers, community channels (e.g., Discord, Slack), or recent activity, which are important project health indicators.

Licensing & Compatibility The license for Explainshell is not specified in the README. This omission requires further investigation before commercial use or integration.

Limitations & Caveats The source extraction method may fail on non-standard manpages. LLM extraction requires API keys, incurs costs, and may show minor run-to-run variance. Reliance on external manpage archives means availability is subject to those sources.

Health Check
Last Commit

17 hours ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
1
Star History
48 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.