Skip to content

Conversation

@Gops123
Copy link
Collaborator

@Gops123 Gops123 commented Dec 28, 2025

Summary

Adds --triggers-dir flag to aofctl serve command and fixes GitHub webhook response posting.

Fixes #92

Changes

New Feature: --triggers-dir Flag

  • Load Trigger YAML files from specified directory
  • Auto-register GitHub platform from trigger configuration
  • Register slash command bindings from trigger files

Bug Fixes

  • GitHub response posting: Include issue/PR number in channel_id (e.g., owner/repo#8) so responses can be posted back as comments
  • Empty command handling: Construct context from PR metadata when command text is empty (e.g., /review without arguments)
  • Slash command detection: Detect /commands directly in issue_comment text

Usage

aofctl serve \
  --triggers-dir /path/to/triggers/ \
  --agents-dir ./examples/agents/ \
  --port 8081

Example Trigger File

apiVersion: aof.dev/v1
kind: Trigger
metadata:
  name: github-pr-bot
spec:
  type: GitHub
  config:
    webhook_secret: ${GITHUB_WEBHOOK_SECRET}
    github_events:
      - pull_request
      - issue_comment
  commands:
    /review:
      agent: devops
      description: "Run comprehensive code review"

Testing

  • Webhook receives GitHub events
  • Slash commands detected in PR comments
  • Commands routed to correct agent
  • Agent executes with PR context
  • Response posted back to PR (requires GITHUB_TOKEN)

🤖 Generated with Claude Code

Gopal and others added 4 commits December 28, 2025 12:17
Adds the ability to load Trigger resources from a directory when starting
the trigger server, matching the existing --agents-dir and --flows-dir flags.

Changes:
- Added --triggers-dir CLI argument to serve command
- Added TriggersConfig struct for config file support
- Load triggers from directory using TriggerRegistry
- Auto-register platforms based on trigger types (e.g., GitHub)
- Log command bindings from loaded triggers

Usage:
  aofctl serve --triggers-dir ./triggers/ --agents-dir ./agents/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The GitHubPlatform requires both token and webhook_secret. Now reads
GITHUB_TOKEN or GH_TOKEN from environment when registering GitHub
platforms from triggers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This fixes the /review and other slash commands not being processed
when users comment on PRs or issues.

Changes:
- Add register_command_binding() method to TriggerHandler for dynamic
  command registration
- Export CommandBinding from aof-triggers crate
- Update serve.rs to actually register command bindings from Trigger
  YAML files (was only logging them, not registering)
- Fix GitHub issue_comment event handling to detect slash commands:
  - When comment starts with /, use raw comment body as message text
  - Add comment_body, comment_id, comment_html_url to metadata
  - Add is_pr_comment flag to detect if comment is on a PR vs issue
- Fix workflow_tests.rs to include new command_bindings field

Now when a user comments "/review" on a PR, the system will:
1. Parse the webhook and extract the slash command
2. Match it against registered command bindings from Trigger YAML
3. Route to the configured fleet/agent/flow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix channel_id to include #number suffix (e.g., owner/repo#8)
- Enables send_response to post comments back to PR/issue
- Add context construction from PR metadata when command text is empty
- Fixes /review without arguments receiving proper PR context

Fixes #92

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub webhook responses not posted back to PR/issue

2 participants