• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
abhishektown

abhishektown

commnet-on-prs

Public
Like
commnet-on-prs
Home
Code
6
.kiro
1
.vtignore
AGENTS.md
README.md
deno.json
H
webhook-handler.http.ts
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
.kiro
/
specs
/
pr-bot-reviewer
/
requirements.md
Code
/
.kiro
/
specs
/
pr-bot-reviewer
/
requirements.md
Search
…
Viewing readonly version of main branch: v19
View latest version
requirements.md

Requirements Document

Introduction

This feature implements an automated GitHub webhook handler that detects when a pull request is opened by a bot user and automatically comments on the PR to trigger multiple AI code review services. The system will integrate with GitHub's webhook API to receive PR events and use the GitHub API to post comments.

Glossary

  • GitHub_Webhook_Handler: The Val Town script that receives and processes GitHub webhook payloads
  • Bot_User: A GitHub user account with type "Bot" or login ending in "[bot]"
  • PR_Comment_Service: The service that posts standardized review trigger comments to pull requests
  • GitHub_API: GitHub's REST API for interacting with repositories and pull requests
  • Personal_Access_Token: GitHub authentication token stored as environment variable

Requirements

Requirement 1

User Story: As a repository maintainer, I want automated code reviews to be triggered when bots open pull requests, so that I can ensure code quality without manual intervention.

Acceptance Criteria

  1. WHEN a GitHub webhook payload is received, THE GitHub_Webhook_Handler SHALL validate the payload structure and extract PR information
  2. WHEN the webhook action is "opened", THE GitHub_Webhook_Handler SHALL process the pull request event
  3. WHEN the PR opener is identified as a bot, THE GitHub_Webhook_Handler SHALL trigger the comment posting process
  4. WHEN a valid bot-opened PR is detected, THE PR_Comment_Service SHALL post the standardized review comment
  5. WHEN the comment is posted successfully, THE GitHub_Webhook_Handler SHALL return a success response

Requirement 2

User Story: As a developer, I want the system to correctly identify bot users, so that only automated PRs trigger the review comments.

Acceptance Criteria

  1. WHEN checking user type, THE GitHub_Webhook_Handler SHALL identify users with type "Bot" as bots
  2. WHEN checking user login, THE GitHub_Webhook_Handler SHALL identify users with login ending in "[bot]" as bots
  3. WHEN a user is neither type "Bot" nor has login ending in "[bot]", THE GitHub_Webhook_Handler SHALL classify them as human users
  4. WHEN a human user opens a PR, THE GitHub_Webhook_Handler SHALL not post any comments

Requirement 3

User Story: As a repository maintainer, I want specific AI review services to be triggered, so that I get comprehensive automated code reviews.

Acceptance Criteria

  1. WHEN posting a review comment, THE PR_Comment_Service SHALL include "@coderabbitai review" in the comment
  2. WHEN posting a review comment, THE PR_Comment_Service SHALL include "/gemini review" in the comment
  3. WHEN posting a review comment, THE PR_Comment_Service SHALL include "@cubic-dev-ai review" in the comment
  4. WHEN posting a review comment, THE PR_Comment_Service SHALL include "@greptile review" in the comment
  5. WHEN formatting the comment, THE PR_Comment_Service SHALL place each review trigger on a separate line

Requirement 4

User Story: As a system administrator, I want secure GitHub API authentication, so that the system can post comments without exposing credentials.

Acceptance Criteria

  1. WHEN authenticating with GitHub API, THE PR_Comment_Service SHALL use a Personal Access Token from environment variables
  2. WHEN the Personal Access Token is missing, THE GitHub_Webhook_Handler SHALL return an error response
  3. WHEN making GitHub API requests, THE PR_Comment_Service SHALL include proper authorization headers
  4. WHEN API requests fail due to authentication, THE GitHub_Webhook_Handler SHALL handle the error gracefully

Requirement 5

User Story: As a developer, I want proper error handling and logging, so that I can troubleshoot issues when the webhook fails.

Acceptance Criteria

  1. WHEN webhook payload is malformed, THE GitHub_Webhook_Handler SHALL return appropriate error response
  2. WHEN GitHub API requests fail, THE GitHub_Webhook_Handler SHALL log the error details
  3. WHEN processing succeeds, THE GitHub_Webhook_Handler SHALL return HTTP 200 status
  4. WHEN processing fails, THE GitHub_Webhook_Handler SHALL return appropriate HTTP error status
  5. WHEN unexpected errors occur, THE GitHub_Webhook_Handler SHALL handle them gracefully without crashing
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.