Skip to content

Commit

Permalink
Merge branch 'elizaOS:main' into reclaim
Browse files Browse the repository at this point in the history
  • Loading branch information
Gajesh2007 authored Jan 6, 2025
2 parents 4b6395b + ea9d1c0 commit b7b4d98
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
- 🎮 Video Game NPCs
- 🧠 Trading

## 💰 If you plan to launch a token

This framework is the number one open source project on github, we are enabling the next generation of human-machine interface but we still need your help to ensure the code is of the utmost quality with response rapid to critical issues that will affect our builder community at large.

To ensure sustainable development and continued innovation, we ask contributions of 5-10% of initial token distributions from successful launches.

All contributions are publicly tracked on-chain and used exclusively for ecosystem development.

### ⚠️ Don't forget to tip the big guy 10%: ⚠️
[AM84n1iLdxgVTAyENBcLdjXoyvjentTbu5Q6EpKV1PeG](https://solscan.io/account/AM84n1iLdxgVTAyENBcLdjXoyvjentTbu5Q6EpKV1PeG)

## 🚀 Quick Start

### Prerequisites
Expand Down Expand Up @@ -138,6 +149,7 @@ pnpm install --include=optional sharp

- [GitHub Issues](https://github.com/elizaos/eliza/issues). Best for: bugs you encounter using Eliza, and feature proposals.
- [Discord](https://discord.gg/ai16z). Best for: sharing your applications and hanging out with the community.
- [Developer Discord](https://discord.gg/3f67SH4rXT). Best for: getting help and plugin development.

## Contributors

Expand Down
147 changes: 147 additions & 0 deletions packages/client-github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Client-GitHub for Eliza Framework

## Overview

The `client-github` module is a component of the Eliza framework designed to interact with GitHub repositories. It provides functionalities to clone repositories, manage branches, create pull requests, and maintain file-based knowledge for Eliza agents.

This client leverages GitHub's REST API via the `@octokit/rest` library and includes robust error handling and configuration validation.

## Features

- **Repository Management**: Clone, pull, and switch branches
- **File Processing**: Generate agent memories from repository files
- **Pull Request Management**: Create and manage pull requests programmatically
- **Commit Operations**: Stage, commit, and push files with ease
- **Knowledge Base Integration**: Convert repository content into agent memories
- **Branch Management**: Flexible branch switching and creation

## Installation

Install the package as part of the Eliza framework:
bash
pnpm add @elizaos/client-github

## Configuration

The GitHub client requires the following environment variables:

| Variable | Description | Required |
|-------------------|------------------------------------|----------|
| `GITHUB_OWNER` | Owner of the GitHub repository | Yes |
| `GITHUB_REPO` | Repository name | Yes |
| `GITHUB_BRANCH` | Target branch (default: `main`) | Yes |
| `GITHUB_PATH` | Path to focus on within the repo | Yes |
| `GITHUB_API_TOKEN`| GitHub API token for authentication| Yes |

## Usage

### Initialization
typescript:packages/client-github/README.md
import { GitHubClientInterface } from "@elizaos/client-github";
// Initialize the client
const client = await GitHubClientInterface.start(runtime);

### Creating Memories

```typescript
// Convert repository files to agent memories
await client.createMemoriesFromFiles();

typescript
// Convert repository files to agent memories
await client.createMemoriesFromFiles();
```

### Creating Pull Requests

```typescript
await client.createPullRequest(
"Feature: Add new functionality",
"feature/new-feature",
[
{
path: "src/feature.ts",
content: "// New feature implementation"
}
],
"Implements new functionality with tests"
);


typescript
await client.createPullRequest(
"Feature: Add new functionality",
"feature/new-feature",
[
{
path: "src/feature.ts",
content: "// New feature implementation"
}
],
"Implements new functionality with tests"
);
```

### Direct Commits

```typescript
await client.createCommit(
"Update configuration",
[
{
path: "config.json",
content: JSON.stringify(config, null, 2)
}
]
);


```

## API Reference

### GitHubClientInterface

- `start(runtime: IAgentRuntime)`: Initialize the client
- `stop(runtime: IAgentRuntime)`: Clean up resources

### GitHubClient

- `initialize()`: Set up repository and configuration
- `createMemoriesFromFiles()`: Generate agent memories
- `createPullRequest(title: string, branch: string, files: Array<{path: string, content: string}>, description?: string)`: Create PR
- `createCommit(message: string, files: Array<{path: string, content: string}>)`: Direct commit

## Scripts

```bash
# Build the project
pnpm run build

# Development with watch mode
pnpm run dev

# Lint the codebase
pnpm run lint
```

## Dependencies

- `@elizaos/core`: ^0.1.7-alpha.2
- `@octokit/rest`: ^20.1.1
- `@octokit/types`: ^12.6.0
- `glob`: ^10.4.5
- `simple-git`: ^3.27.0

## Development Dependencies

- `@types/glob`: ^8.1.0
- `tsup`: ^8.3.5

## Contribution

Contributions are welcome! Please ensure all code adheres to the framework's standards and passes linting checks.

## License

This project is licensed under the MIT License. See the LICENSE file for details.

0 comments on commit b7b4d98

Please sign in to comment.