Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions assistant/INTEGRATION_GUIDE.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this / agent generated?

Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Comment Reaction Action - Integration Guide

## Summary

A new GitHub Action has been created in the `augment-agent` repository that can react to user comments with emoji reactions. This action is designed to be used in workflows that respond to PR review comments and issue comments.

## Repository Information

- **Repository**: `augmentcode/augment-agent`
- **Branch**: `feature/comment-reaction-action`
- **Action Path**: `comment-reaction/`
- **Commit**: `826fcce`

## What Was Created

### Files Created

1. **comment-reaction/action.yml** - Action metadata and composite action definition
2. **comment-reaction/src/index.ts** - TypeScript implementation
3. **comment-reaction/package.json** - Node.js dependencies
4. **comment-reaction/tsconfig.json** - TypeScript configuration
5. **comment-reaction/README.md** - Documentation and usage examples
6. **comment-reaction/package-lock.json** - Dependency lock file

### Key Features

- ✅ React to PR review comments
- ✅ React to issue comments
- ✅ Support for all 8 GitHub reaction types (+1, -1, laugh, confused, heart, hooray, rocket, eyes)
- ✅ Configurable reaction type with sensible default (eyes)
- ✅ Full TypeScript implementation with type safety
- ✅ Comprehensive error handling and logging
- ✅ Output indicating success/failure

## How to Reference in assistant.yml

### Option 1: Reference the Branch Directly

```yaml
- name: React to original comment with eyes
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
```

### Option 2: With Custom Reaction

```yaml
- name: React to original comment with rocket
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
reaction: rocket
```

### Complete Example for assistant.yml

Replace the existing `actions/github-script@v7` step (lines 31-53) with:

```yaml
- name: React to original comment with eyes
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
reaction: eyes
```

## Inputs

| Input | Description | Required | Default |
| -------------- | --------------------------------- | -------- | ------- |
| `github_token` | GitHub token for API access | Yes | - |
| `comment_id` | The ID of the comment to react to | Yes | - |
| `event_name` | The GitHub event name | Yes | - |
| `reaction` | The reaction type to add | No | `eyes` |

## Outputs

| Output | Description |
| --------- | --------------------------------------------------------------- |
| `success` | Whether the reaction was successfully added (`true` or `false`) |

## Supported Reactions

- `+1` - 👍
- `-1` - 👎
- `laugh` - 😄
- `confused` - 😕
- `heart` - ❤️
- `hooray` - 🎉
- `rocket` - 🚀
- `eyes` - 👀

## Next Steps

1. **Test the Action**: You can now reference this action in the `bumpy/.github/workflows/assistant.yml` file
2. **Merge to Main**: Once tested, merge the `feature/comment-reaction-action` branch to `main`
3. **Create a Tag**: After merging, create a version tag (e.g., `v1.0.0`) for stable references
4. **Update References**: Update workflow files to use the tag instead of the branch name

## Example: Full Workflow Integration

```yaml
name: Augment Agent

on:
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]

permissions:
contents: read
pull-requests: write
issues: write
id-token: write
actions: read

jobs:
auggie-review-comment:
if: |
contains(github.event.comment.body, '@augment') ||
contains(github.event.comment.body, '@Augment')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}

- name: React to original comment with eyes
uses: augmentcode/augment-agent/comment-reaction@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
reaction: eyes

# ... rest of your workflow steps
```

## Support

For issues or questions, please refer to the README.md in the comment-reaction directory or create an issue in the augment-agent repository.
190 changes: 190 additions & 0 deletions assistant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# PR Assistant Action

An AI-powered GitHub Action that implements code changes based on PR comments using the Auggie SDK.

## Features

- 🤖 **AI-Powered Implementation**: Uses Auggie SDK to understand and implement requested changes
- 📋 **Context-Aware**: Gathers full PR context including diff, files, and comment threads
- 🔄 **Automatic Commits**: Commits and pushes changes directly to the PR branch
- 💬 **Status Updates**: Posts success/failure comments to the PR
- 👀 **Visual Feedback**: Adds emoji reactions to show processing status
- ✅ **Full TypeScript**: Type-safe implementation with comprehensive error handling

## Usage

### Basic Example

```yaml
- name: PR Assistant
uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
augment_api_token: ${{ secrets.AUGMENT_API_KEY }}
augment_api_url: ${{ secrets.AUGMENT_API_URL }}
```

### With Custom Reaction

```yaml
- name: PR Assistant
uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
reaction: rocket
augment_api_token: ${{ secrets.AUGMENT_API_KEY }}
augment_api_url: ${{ secrets.AUGMENT_API_URL }}
```

### Complete Workflow Example

```yaml
name: PR Assistant
on:
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]

permissions:
contents: read
pull-requests: write
issues: write

jobs:
assistant:
if: |
contains(github.event.comment.body, '@augment') ||
contains(github.event.comment.body, '@Augment')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Run PR Assistant
uses: augmentcode/augment-agent/assistant@feature/comment-reaction-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
comment_id: ${{ github.event.comment.id }}
event_name: ${{ github.event_name }}
reaction: eyes
augment_api_token: ${{ secrets.AUGMENT_API_KEY }}
augment_api_url: ${{ secrets.AUGMENT_API_URL }}
```

## How It Works

1. **Trigger**: Workflow is triggered by a comment containing `@augment` or `@Augment`
2. **React**: Adds an emoji reaction (default: 👀) to show processing has started
3. **Gather Context**: Collects PR metadata, diff, files changed, and comment thread
4. **Invoke Auggie**: Sends the context and instruction to Auggie SDK
5. **Implement**: Auggie analyzes the request and implements the changes
6. **Commit**: Automatically commits changes with a descriptive message
7. **Push**: Pushes the commit to the PR's head branch
8. **Notify**: Posts a success or failure comment to the PR

## Inputs

| Input | Description | Required | Default |
| ------------------- | ------------------------------------------------------------------------ | -------- | ------- |
| `github_token` | GitHub token for API access and git operations | Yes | - |
| `comment_id` | The ID of the comment that triggered the workflow | Yes | - |
| `event_name` | The GitHub event name (`pull_request_review_comment` or `issue_comment`) | Yes | - |
| `augment_api_token` | Augment API token for authentication | Yes | - |
| `augment_api_url` | Augment API URL endpoint | Yes | - |
| `reaction` | The reaction type to add (optional) | No | `eyes` |

## Supported Reactions

- `+1` - 👍
- `-1` - 👎
- `laugh` - 😄
- `confused` - 😕
- `heart` - ❤️
- `hooray` - 🎉
- `rocket` - 🚀
- `eyes` - 👀

## Outputs

| Output | Description |
| --------- | --------------------------------------------------------------- |
| `success` | Whether the reaction was successfully added (`true` or `false`) |

## Permissions

The action requires the following permissions:

```yaml
permissions:
contents: read # To read repository content
pull-requests: write # To add reactions and comments to PRs
issues: write # To add reactions and comments to issues
```

## Setup

### 1. Configure Secrets

Add the following secrets to your repository:

- `AUGMENT_API_KEY`: Your Augment API token
- `AUGMENT_API_URL`: Your Augment API URL endpoint

### 2. Create Workflow

Create `.github/workflows/assistant.yml` with the example workflow above.

### 3. Test

Create a test PR and comment with `@augment <your instruction>`. For example:

```
@augment Add error handling to the login function
```

The assistant will:

- React with 👀 to acknowledge
- Gather PR context
- Implement the requested changes
- Commit and push to the PR branch
- Comment with the result

## Example Instructions

- `@augment Add unit tests for the UserService class`
- `@augment Refactor this function to use async/await`
- `@augment Fix the TypeScript errors in this file`
- `@augment Add JSDoc comments to all exported functions`
- `@augment Implement the TODO comments in this PR`

## Troubleshooting

### No changes committed

- Check that Auggie has write access to the repository
- Verify that the PR branch is not protected
- Check the workflow logs for errors

### Auggie fails to connect

- Verify `AUGMENT_API_KEY` and `AUGMENT_API_URL` are set correctly
- Check that the API endpoint is accessible from GitHub Actions

### Changes not appearing

- Ensure the workflow has `contents: write` permission
- Check that the checkout step uses the correct branch reference

## License

MIT
Loading