Skip to main content

CmdDocGen - Universal command line help information extraction and man page generation tool powered by LLM for intelligent subcommand analysis

Project description

CmdDocGen

CmdDocGen Logo

Universal Command Line Help Information Extraction and Man Page Generation Tool

Powered by LLM for intelligent subcommand analysis

License: MIT Python 3.8+

Overview

CmdDocGen is a universal command line help information extraction tool that can automatically generate standard man page format documentation. It leverages the power of Large Language Models (LLMs) to parse complex help text and supports recursive processing of subcommands.

Key Features

  • Universal Support: Works with any command line tool's help documentation
  • Standard Format: Automatically generates man page format documentation
  • LLM-Powered Analysis: Uses LLM to intelligently parse complex help text
  • Recursive Processing: Supports recursive extraction of subcommands
  • Multiple LLM Providers: Compatible with various LLM providers
  • Performance Optimization: Caching mechanism for improved performance

Installation

From PyPI (Recommended)

pip install cmddocgen

From Source

git clone https://github.com/2niuhe/CmdDocGen.git
cd CmdDocGen
pip install .

Configuration

Environment Variables

CmdDocGen uses environment variables for LLM configuration. Start by copying the example configuration file:

cp .env.example .env

Then edit the .env file with your settings:

# LLM API Base URL
LLM_BASE_URL=https://api.your-llm-provider.com/v1

# LLM API Key
LLM_API_KEY=your-api-key-here

# LLM Model Name
LLM_MODEL=gpt-4o-mini

# LLM Parameters
LLM_TEMPERATURE=0.2
LLM_MAX_TOKENS=8096

Example Configurations

Using AI Proxy

LLM_BASE_URL=https://api.aiproxy.io/v1
LLM_API_KEY=your-aiproxy-api-key
LLM_MODEL=gpt-4o-mini

Using DeepSeek

LLM_BASE_URL=https://api.deepseek.com
LLM_API_KEY=your-deepseek-api-key
LLM_MODEL=deepseek-chat

Usage

Basic Usage

cmddocgen --command "your-command" [--output-dir OUTPUT_DIR]

Examples

# Extract help information for the ls command
cmddocgen ls

# Extract help information for docker command and its subcommands
cmddocgen docker --max-depth 2

# Specify output directory
cmddocgen docker --output-dir "./docs"

Development

  1. Clone the repository
  2. Copy the configuration file
  3. Create a virtual environment
  4. Install dependencies
git clone https://github.com/2niuhe/CmdDocGen.git
cd CmdDocGen
cp .env.example .env
python -m venv .venv
source .venv/bin/activate
pip install -e .

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT License

Important Notes

  • Make sure to properly configure the LLM-related environment variables
  • Generated documentation will be saved in the specified output directory
  • Cache files are stored in the cache/ directory
  • For large command sets with many subcommands, consider limiting the recursion depth

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

cmddocgen-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

cmddocgen-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file cmddocgen-0.1.0.tar.gz.

File metadata

  • Download URL: cmddocgen-0.1.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for cmddocgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 33e1f2b877860c50d92f6915d43f5512db48e7617a802de3fede1b1a2fbbccfd
MD5 c8e7dcf04758a9a31678f65eb0867c57
BLAKE2b-256 c40088328468ede54e96b453a5f39e744d2bdf2731b9b15526b09a8ee1566b97

See more details on using hashes here.

File details

Details for the file cmddocgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cmddocgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for cmddocgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58aabca6395d851ea8e22e6638a7ea6e3198a6ade85aa1f61e97345c89e46759
MD5 ac88cb41373395b4abe4f89181a99799
BLAKE2b-256 ec8a3ea87db313374e3e8d873a6ad98ac25a1f511dc2fe888738f002d970758b

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