An autonomous coding agent CLI that converts a natural language prompt into code actions using Gemini.
- Sends natural language prompts to an LLM
- Detects webpage URLs in prompts
- Extracts webpage structure and resource summaries
- Adds webpage context to prompts before sending to Gemini
- Executes agent actions such as creating or modifying files and running commands
- Python 3.11+
GEMINI_API_KEYandGEMINI_MODEL_NAMEenvironment variables set- Optional: Playwright browser support for richer webpage extraction
- Clone the repository:
git clone https://github.com/<your-org>/CLI-coding-agent.git
cd CLI-coding-agent- Install Python dependencies:
python -m pip install -r src/requirements.txt- Create a
.envfile in the repo root with:
GEMINI_API_KEY=your_api_key
GEMINI_MODEL_NAME=your_model_name- If you want Playwright browser extraction, install browsers:
python -m playwright installIf browser installation fails or is unavailable, the CLI falls back to a simpler HTML-based extraction using
requestsandBeautifulSoup.
Run the CLI from the repository root:
python src/agent_cli.py "Create a webpage based on https://www.example.com"Or start the interactive prompt:
python src/agent_cli.pyThen enter prompts at agent>.
- If the prompt contains a URL, the agent attempts to extract webpage data first
- It adds a webpage summary to the prompt before sending it to the LLM
- The goal is to produce code files like
index.html,styles.css, andscript.js
- The CLI logs extraction and execution progress
- If Playwright is unavailable, it falls back to requests/BeautifulSoup extraction
- For best results, provide clear instructions such as:
Generate HTML, CSS, and JS that matches the design of https://example.com
- If the CLI fails to import Playwright, ensure Playwright is installed and
python -m playwright installhas run successfully - If webpage extraction fails, the fallback method may still provide useful prompt context
- Use
--verboseto enable more detailed logging:
python src/agent_cli.py --verbose "Create a webpage like https://www.example.com"