Thank you for your interest in contributing to AlphaAgent! We welcome contributions that help improve this secure, CLI-first AI coding assistant.
- Python >= 3.11
- Git
-
Fork and clone the repository:
git clone https://github.com/yourusername/AlphaAgent.git cd AlphaAgent -
Create and activate a virtual environment:
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install the package to development setup:
pip install -e . -
Initialize the workspaces:
alpha-agent init
- Code Style: We follow PEP 8 standard formatting in Python. Please run a formatter like
blackorruffbefore making PRs. - Typing: Use strong typing with Python's standard
typingmodule (e.g.,list[str],str | None). - Security: Do not compromise the strict sandbox limits of the agent. The
FilesystemGuardandCommandPolicyare vital. - Documentation: All functions, methods, and classes should have clear docstrings. Ensure changes are reflected in relevant
.mddocumentation files.
- Start here: docs/README.md - table of contents for all user guides, reference, architecture, and development docs.
- User-facing slash commands: docs/slash-commands.md. CLI flags: docs/user_guide/CLI_Reference.md.
- Step 1: Add an entry to the
_SLASH_COMMANDSdict inalpha_agent/cli/chat.py(key =/name, value = description). - Step 2: Implement the handler logic in
ChatLoop._handle_slash_command. - Step 3: If the command is registered but not yet implemented, use the standard stub:
self.console.print("[dim]/name - not yet implemented[/dim]")
- Step 4: Document the new command in
docs/slash-commands.mdmatching the established format.Note:
_SLASH_COMMANDSis the single source of truth that drives both the/helptext output and theprompt_toolkitWordCompleter. Do not maintain separate lists!
When adding a tool that modifies files, you should display a unified diff instead of a generic "file written" message:
- The
is_binary_filecheck (fromalpha_agent/tools/diff_util.py) must come before calling anyread_textfor the diff. - Pattern: Capture the
beforesnapshot if it exists and is not binary. Mutate the file. Capture theaftersnapshot. - Pass the snapshots to
print_unified_diff(fromalpha_agent/cli/ui.py). - Note that
print_unified_diffenforces a 50-line cap for display; longer diffs are truncated with an omission notice.
- Add an entry to the
PERSONASdict inalpha_agent/cli/personas.py. - Provide the
description(shown in the/personalist) andprefix(injected directly before the agent's system prompt). - If creating a
default-like configuration, setprefixto an empty string (""), meaning the nativeAGENT.mdremains unchanged by a persona prefix.
Security and sandbox isolation are paramount. The suite includes config/LLM mocks, CLI smoke tests, filesystem guard tests, and policy/audit coverage.
From the repository root (recommended):
python -m pytest tests/- Default run excludes tests marked
integration(seepyproject.tomladdopts). Unit and mocked tests must not require real API keys. - To run only integration tests (e.g. nightly jobs with secrets):
python -m pytest -m integration - On some Windows setups,
tests/test_security.pyadjustssys.stdout; if pytest reports capture teardown errors, usepython -m pytest tests/ --capture=no.
You can still execute python tests/test_security.py directly for a quick guard/policy check.
Ensure all tests pass before submitting a Pull Request.
- Create a feature branch from
main:git checkout -b feature/your-feature-name
- Make your respective changes, ensuring the addition of related test code for the new capabilities.
- Commit your changes with descriptive and clean commit messages.
- Push your branch and open a Pull Request (PR).
- Ensure your PR description clearly describes the problem and solution. It will be reviewed by the maintainers.