Focal is a command-line AI coding agent powered by the Gemini API. It can interact with your local filesystem to perform tasks such as listing files, reading and writing file content, and executing Python scripts. The agent is designed to be a helpful tool for developers, providing a conversational interface to automate and assist with coding-related tasks.
- Conversational AI: Interact with the agent using natural language prompts.
- File System Operations: The agent can list files, read file content, and write to files within the project's working directory.
- Python Script Execution: Execute Python scripts directly from the agent.
- Command-Line Interface: A rich and user-friendly command-line interface with formatted output.
- Standalone Calculator: The project also includes a standalone command-line calculator for evaluating mathematical expressions. (can be used for testing the agent)
- Python 3.10 or higher
uvpackage manager
-
Clone the repository:
git clone https://github.com/xonoxc/Focal.cli.git cd Focal.cli -
Create and activate a virtual environment:
uv venv source .venv/bin/activate -
Install the dependencies using
uv:uv pip install -r requirements.txt
-
Create a
.envfile by copying thesample.envfile:cp sample.env .env
-
Add your Gemini API key to the
.envfile:GEMINI_API_KEY=your_api_key
To use the AI agent, run the main.py script with your prompt as an argument:
uv run python main.py "your prompt here"For example:
uv run python main.py "list all the files in the calculator directory"You can also enable verbose mode to see more detailed output:
uv run python main.py "your prompt here" --verboseThe project includes a standalone calculator that can be used from the command line:
python calculator/main.py "3 + 5".
├── calculator/ # Standalone calculator application for testing the agent
├── config/ # Project configuration
├── main.py # Main entry point for the AI agent
├── system/ # System prompts for the AI agent
├── tests/ # Tests for the utility functions
├── tests.py # Additional tests
└── utils/ # Utility functions for the AI agent
calculator/: Contains the standalone calculator application for testing the agent.config/: Contains configuration files for the project.main.py: The main entry point for the AI coding agent.system/: Contains the system prompt that defines the agent's behavior.tests/: Contains tests for the file utility functions.tests.py: Contains additional tests for the project.utils/: Contains utility functions for the agent, including tools for file system operations and the user interface.
To run the tests, use pytest:
pytest -v tests.py