> For the complete documentation index, see [llms.txt](https://docs.ainu.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ainu.pro/getting-started/development.md).

# 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:

```bash
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 running `npm run build`).

***

## **3. Running the Project Locally**

To run the project in development mode, use the following command:

```bash
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:

```bash
npm run build
```

This will generate the output in the dist directory.

***

## **5. Testing**

AINU uses Jest for testing. To run all tests, use:

```bash
npm test
```

You can also run tests for specific components:

* **Agents**:

  ```bash
  npm run test:agents
  ```
* **Providers**:

  ```bash
  npm run test:providers
  ```
* **Tools**:

  ```bash
  npm run test:tools
  ```
* **MCP**:

  ```bash
  npm run test:mcp
  ```
* **Utilities**:

  ```bash
  npm run test:utils
  ```

***

## **6. Adding New Features**

To extend AINU, follow these steps:

1. **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.
2. **Write Tests**:\
   Add unit tests for your feature in the corresponding directory in tests. For example:
   * Add tests for a new provider in providers.
3. **Run Tests**:\
   Ensure all tests pass before committing your changes.
4. **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:

```bash
npm run docs
```

This will generate updated documentation in the docs directory.

***

## **8. Contributing**

If you plan to contribute to AINU, follow these steps:

1. Fork the repository and create a new branch for your feature or bug fix.
2. Make your changes and ensure all existing and new tests pass.
3. 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!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ainu.pro/getting-started/development.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
