Overview
Tembo Hooks are configured through a.tembo.json file in your repository root. These hooks execute shell commands at predefined lifecycle events, giving you full control over how Tembo interacts with your codebase and development environment.
Configuration
Create a.tembo.json file in your repository root with the following structure:
Available Hooks
postClone
Executes immediately after Tembo clones your repository and before it begins working on the issue.
Common use cases:
- Install dependencies (
npm install,pip install -r requirements.txt) - Set up development environment
- Download required assets or configurations
- Initialize database connections or test data
prePush
Runs after Tembo has made changes to your code but before pushing the changes and creating a pull request.
Common use cases:
- Run linting and formatting (
eslint,prettier,black) - Execute test suites
- Build the project to ensure no compilation errors
- Run security scans or code quality checks
- Generate documentation or update version files
Hook Execution Details
Execution Environment
- Hooks run in the same Docker sandbox environment as Tembo
- Commands execute in the repository’s root directory
- All environment variables available to Tembo are also available to hooks
- Commands run with the same permissions as the Tembo process
Error Handling
- If any command in a hook fails (returns non-zero exit code), the hook execution stops
- For
postCloneandprePushhooks, failures will cause the entire issue resolution process to fail
Command Execution
- Commands are executed sequentially in the order they appear in the array
- Each command runs in a separate shell session
- Commands support shell features like piping, redirects, and environment variables
- Multi-line commands can be written as single strings with semicolons or
&&operators
Advanced Configuration Examples
Full Stack Application
Monorepo with Multiple Services
Go Application with Custom Tooling
Best Practices
Keep Commands Fast
- Avoid long-running processes in hooks as they extend the overall solution time
- Use caching mechanisms where possible (
npm ciinstead ofnpm install) - Consider running only essential checks in
prePushhooks
Error Handling
- Include commands that verify successful execution where critical
- Use
set -ein shell scripts to fail fast on errors - Provide meaningful error messages for debugging
Security Considerations
- Don’t include sensitive information directly in hook commands
- Use environment variables for credentials and API keys
- Be cautious with commands that modify system-level configurations
Testing Hooks
- Test your hooks locally before committing the
.tembo.jsonfile - Start with simple commands and gradually add complexity
- Monitor Tembo’s execution logs to verify hooks run as expected
Troubleshooting
Common Issues
Hook Commands Not Found- Ensure required tools are installed in the
postClonehook - Verify the command exists in the Docker environment Tembo uses
- Check that commands don’t require elevated privileges
- Ensure file permissions allow the operations you’re trying to perform
- Long-running commands may cause timeouts
- Consider moving lengthy processes to background tasks or separate CI/CD pipelines
Debugging
- Check Tembo’s execution logs in your dashboard for hook output
- Add
echostatements to track hook progress - Test commands individually in a similar environment before adding to hooks