Development
The Development section provides guidance on setting up your environment for contributing to or extending the AINU framework. This includes running the project locally, testing, and adding new features.
1. Setting Up the Development Environment
To start developing with AINU, clone the repository and install the dependencies:
git clone https://github.com/AINU-Framework/ainu.git
cd ainu
npm install
Ensure you have Node.js (v18 or higher) and npm installed on your system.
2. Project Structure
The AINU repository is organized into the following key directories:
src
: Contains the source code for the framework, including:agent/
: Core logic for agents.providers/
: Implementations for supported AI providers (e.g., Anthropic, OpenAI).tools/
: Tooling system for extending agent functionality.mcp/
: Model Context Protocol integration.utils/
: Utility functions and helpers.
tests
: Contains unit tests for all major components, organized by feature:agent/
: Tests for agent functionality.providers/
: Tests for Anthropic, OpenAI, and XAI providers.tools/
: Tests for tools and their integration with agents.mcp/
: Tests for MCP-related functionality.util/
: Tests for utility functions.
dist
: The compiled output directory (generated after runningnpm run build
).
3. Running the Project Locally
To run the project in development mode, use the following command:
npm run dev
This will start the project using tsx
with hot-reloading enabled. You can modify files in the src directory, and changes will automatically reflect.
This will automatically run the main index.ts
file. You can quickly prototype using this file with little friction.
4. Building the Project
To compile the TypeScript code into JavaScript, run:
npm run build
This will generate the output in the dist directory.
5. Testing
AINU uses Jest for testing. To run all tests, use:
npm test
You can also run tests for specific components:
Agents:
npm run test:agents
Providers:
npm run test:providers
Tools:
npm run test:tools
MCP:
npm run test:mcp
Utilities:
npm run test:utils
6. Adding New Features
To extend AINU, follow these steps:
Create a New Feature: Add your new feature to the appropriate directory in src. For example:
Add a new provider in providers.
Add a new tool in tools.
Write Tests: Add unit tests for your feature in the corresponding directory in tests. For example:
Add tests for a new provider in providers.
Run Tests: Ensure all tests pass before committing your changes.
Build and Verify: Build the project and verify that your feature works as expected.
7. Documentation
AINU uses TypeDoc to generate documentation. To update the documentation, run:
npm run docs
This will generate updated documentation in the docs directory.
8. Contributing
If you plan to contribute to AINU, follow these steps:
Fork the repository and create a new branch for your feature or bug fix.
Make your changes and ensure all existing and new tests pass.
Submit a pull request with a detailed description of your changes.
With this guide, you’re ready to start developing and contributing to AINU. Let me know if you'd like to expand on any of these sections!
Last updated