CmdDocGen - Universal command line help information extraction and man page generation tool powered by LLM for intelligent subcommand analysis
Project description
CmdDocGen
Universal Command Line Help Information Extraction and Man Page Generation Tool
Powered by LLM for intelligent subcommand analysis
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
- Clone the repository
- Copy the configuration file
- Create a virtual environment
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33e1f2b877860c50d92f6915d43f5512db48e7617a802de3fede1b1a2fbbccfd
|
|
| MD5 |
c8e7dcf04758a9a31678f65eb0867c57
|
|
| BLAKE2b-256 |
c40088328468ede54e96b453a5f39e744d2bdf2731b9b15526b09a8ee1566b97
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58aabca6395d851ea8e22e6638a7ea6e3198a6ade85aa1f61e97345c89e46759
|
|
| MD5 |
ac88cb41373395b4abe4f89181a99799
|
|
| BLAKE2b-256 |
ec8a3ea87db313374e3e8d873a6ad98ac25a1f511dc2fe888738f002d970758b
|