Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions src/auggie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export type RunAuggieOptions = {
context?: GithubPullRequest;
/** The body of the comment that triggered this action, if triggered by a comment */
commentBody?: string;
/** The ID of the comment that triggered this action, if triggered by a comment */
commentId?: number;
};

/**
Expand All @@ -27,6 +29,7 @@ export async function runAuggie(options: RunAuggieOptions): Promise<string> {
workspaceRoot,
context,
commentBody,
commentId,
} = options;

const workspace = workspaceRoot || process.cwd();
Expand Down Expand Up @@ -70,6 +73,12 @@ export async function runAuggie(options: RunAuggieOptions): Promise<string> {
core.info("📨 User comment included in prompt");
}

// Add triggering comment ID if available
if (commentId) {
fullPrompt = `${fullPrompt}\n\n## Triggering Comment ID:\n${commentId}`;
core.info(`📍 Triggering comment ID: ${commentId}`);
}

// Add user prompt
fullPrompt = `${fullPrompt}\n\n${userPrompt}`;

Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async function main(): Promise<void> {
augmentApiUrl,
workspaceRoot,
commentBody,
commentId,
} = getAuggieParams();
const { owner, repo } = parseRepository();
const githubToken = process.env.GITHUB_TOKEN;
Expand All @@ -34,6 +35,7 @@ async function main(): Promise<void> {
apiUrl: augmentApiUrl,
workspaceRoot: workspaceRoot || undefined,
commentBody,
commentId,
});

core.info("✅ Auggie agent completed successfully");
Expand Down
3 changes: 3 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ type AuggieParams = {
augmentApiUrl: string;
workspaceRoot: string | undefined;
commentBody: string | undefined;
commentId: number | undefined;
};

/**
Expand All @@ -189,12 +190,14 @@ export function getAuggieParams(): AuggieParams {
const augmentApiUrl = getInput("augment_api_url", true);
const workspaceRoot = getInput("workspace_root");
const commentBody = getCommentBodyFromEvent();
const commentId = getCommentIdFromEvent();
return {
eventName,
prompt,
augmentApiKey,
augmentApiUrl,
workspaceRoot,
commentBody,
commentId,
}
}
26 changes: 23 additions & 3 deletions src/utils/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,31 @@ Important: How you handle changes depends on the context:
- If you are working on a Pull Request (PR): You are allowed to commit directly to that PR's branch.
- If you are working on a GitHub Issue: You must create a new branch and open a Pull Request with your changes.

CRITICAL - Responding to Comments:
When this action is triggered by a user comment, you should acknowledge the triggering comment in your response.
- A "Triggering Comment ID" will be provided in the prompt context.
- Use the github-api tool to interact with GitHub.

How to respond depends on the comment type:

1. For issue/PR timeline comments (most common):
- GitHub issue comments do NOT support threaded replies - there is no reply endpoint.
- Create a new comment using: POST /repos/{owner}/{repo}/issues/{issue_number}/comments
- In your comment body, reference the triggering comment by quoting it or linking to it.
- Example: Start your comment with "> Replying to [comment](link):" or quote the relevant text.

2. For PR review comments (inline code comments):
- These DO support threaded replies via the \`in_reply_to\` parameter.
- Use: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments with \`in_reply_to\` set to the triggering comment ID.

If no triggering comment ID is provided, simply create a new comment on the issue/PR.

Your workflow:
1. Add a comment to the PR letting the user know you're starting to work on it.
1. Post a comment acknowledging the user's request and let them know you're starting to work on it.
- Reference the triggering comment (see instructions above for how to respond to comments).
2. Read the PR context and understand the request.
3. Create a Todo List:
- Update the original comment on the PR with a todo list of what you're going to do. (Use the github-api tool to update the comment. Replace the initial message with the todo list.)
- Update your comment with a todo list of what you're going to do. (Use the github-api tool with PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} to update your comment.)
- Use your GitHub comment to maintain a detailed task list based on the request.
- Format todos as a checklist (- [ ] for incomplete, - [x] for complete).
- Update the comment with each task completion.
Expand All @@ -29,7 +49,7 @@ Your workflow:
- Files modified
- Links to PRs/commits
5. Final Comment Update (IMPORTANT):
- When you are completely done with all tasks, update the original comment ONE FINAL TIME.
- When you are completely done with all tasks, update your comment ONE FINAL TIME.
- REMOVE the entire task list/checklist from the comment.
- Replace the comment body with ONLY a concise, minimal final summary.
- Keep it brief: just state what was attempted and what was done.
Expand Down