task-sh-0.1.3 is not a library.
task.sh
task.sh turns natural language task descriptions into safe shell command suggestions using OpenAI. The CLI is designed for cross-platform usage (Linux, macOS) and emphasizes safety, observability, and customization.
Features
task gensubcommand with--shellselection (bash,zsh).- Verbose mode prints raw AI output and explanations.
- Regex-based command safety filters.
- Optional
TASK_SH_FAKE_RESPONSEenvironment variable for deterministic tests.
Getting Started
Prerequisites
- Rust toolchain (via rustup).
- OpenAI API key with access to GPT-3.5 (or compatible) models.
Installation
Edit .env and set OPENAI_API_KEY to your secret key.
Usage
# Generate a bash command with explanation
# Pipe input via stdin
|
# Use the fake response mode for testing/demos
TASK_SH_FAKE_RESPONSE=$'Command: ls\nExplanation: list files'
Inspect all options:
Environment
OPENAI_API_KEY: Required for live generation.TASK_SH_FAKE_RESPONSE: Optional string that substitutes the OpenAI response for testing.
Development
Build Scripts
For cross-compilation (requires cargo-zigbuild):
Documentation
The mdBook-based docs live in docs/.
Publish to task.sh/docs or serve locally with mdbook serve docs.
Contributing
- Fork the repository and create a feature branch.
- Add tests covering new functionality.
- Run
cargo fmt,cargo clippy, andcargo testbefore submitting a PR. - Submit a PR with a concise description of the changes.
License
Licensed under the MIT License.