project / Aug 2024 – Sept 2024

AIHelp CLI

Python CLI that converts natural-language intent into shell commands with Groq-backed generation, syntax validation, and configurable execution guardrails.

timelineAug 2024 - Sep 2024
focusai, devtools
stack
  • Python
  • GroqCloud

problem

Terminal users often know what they want to do but not the exact shell syntax, while AI-generated commands can be risky if executed without validation or guardrails.

approach

Generate commands through a configurable LLM provider, validate bash syntax, enforce allowlist or blocklist policy, and require confirmation when configurable regexes detect dangerous operations.

implementation notes

  • Installed a console command, `aihelp`, from a Python package centered on aihelp/cli.py.
  • Used ~/.aihelp_config.json for provider/model defaults, dangerous-command regexes, allow/block policy, and logging preferences.
  • Read API keys from environment variables, with Groq implemented and placeholder scaffolding for OpenAI, Google/Gemini, and Anthropic providers.
  • Added bash syntax validation, configurable dangerous-pattern detection, interactive confirmation, --force, and allow/blocklist enforcement.
  • Included tests for config handling, CLI options, provider behavior, dangerous-command flows, and command policy rules.

impact

  • Lowers friction for shell use by translating intent into executable commands
  • Adds safety controls around destructive operations
  • Keeps provider, logging, and command policy behavior configurable

links