Setup Guide
Get SAM up and running in your repository in just a few minutes.
Prerequisites
Clone the Repository
Clone the SAM repository to your local machine.
git clone https://github.com/saaragh/sam.git cd samInstall Dependencies
Install the required Node.js packages.
cd webhook-server npm installConfigure Environment Variables
Create a .env file with your configuration.
# .env
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_WEBHOOK_SECRET=your_webhook_secret
# Choose your AI provider
OPENAI_API_KEY=your_openai_api_key
# or
ANTHROPIC_API_KEY=your_anthropic_api_key
# Server configuration
PORT=3000
NODE_ENV=productionSet Up GitHub Webhook
Configure a webhook in your GitHub repository to send events to SAM.
- Go to your repository Settings → Webhooks
- Click "Add webhook"
- Set the Payload URL to your SAM server (e.g.,
https://your-server.com/webhook) - Set Content type to
application/json - Add your webhook secret
- Select "Let me select individual events" and choose: Issues, Issue comments, Pull requests
Enable SAM in Your Repository
Create a .sam/config.yaml file in your repository to enable SAM.
# .sam/config.yaml
sam:
enabled: true
target_directory: "src"
tech_stack:
- "TypeScript"
- "React"
conventions:
components: "src/components/"
tests: "__tests__/"
labels:
trigger_dev: "ready-for-dev"Start the Server
Run the SAM server to start processing webhooks.
npm startSAM is now running! Create an issue in your repository to see it in action.
Troubleshooting
Webhooks not being received?
Check that your server is publicly accessible. For local development, use a tunnel like ngrok or cloudflared.
API rate limits?
Ensure you're using a GitHub token with appropriate permissions. For high-volume repositories, consider using a GitHub App instead of a personal access token.
Agent not responding?
Check the server logs for errors. Make sure your AI API keys are valid and have sufficient credits.
Need more help?
Check out the full documentation or visit our GitHub repository.