mirror of https://github.com/buster-so/buster.git
- Add proper error handling for Slack API failures with typed responses
- Implement message operation types for better type safety
- Add retry logic with exponential backoff for transient failures
- Export webhook types for external consumers
- Update Slack agent task to handle errors gracefully and continue processing
- Add proper validation and error messages for failed operations
- Include structured error tracking for debugging
🤖 Generated with Anthropic
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
---|---|---|
.. | ||
dist | ||
src | ||
.gitignore | ||
README.md | ||
biome.json | ||
package.json | ||
tsconfig.json |
README.md
@buster/env-utils
Shared utilities for environment variable validation across the monorepo.
Overview
This package provides utilities to:
- Load environment variables from the root
.env
file - Validate required environment variables
- Skip validation in CI/Docker/Production environments
Usage
In your package's validate-env.js script:
#!/usr/bin/env node
import { loadRootEnv, validateEnv } from '@buster/env-utils';
// Load environment variables from root .env file
loadRootEnv();
// Define required environment variables for this package
const requiredEnv = {
DATABASE_URL: process.env.DATABASE_URL,
API_KEY: process.env.API_KEY,
// Add your required variables here
};
// Validate environment variables
const { hasErrors } = validateEnv(requiredEnv);
if (hasErrors) {
process.exit(1);
}
Adding env-utils to your package:
- Add the dependency to your package.json:
{
"dependencies": {
"@buster/env-utils": "workspace:*"
}
}
-
Update your validate-env.js script as shown above
-
Make sure your required environment variables are defined in the root
.env
file
Migration Guide
To migrate an existing package to use the centralized env system:
- Remove any local
.env
files from your package - Add
@buster/env-utils
as a dependency - Update your
scripts/validate-env.js
to use the shared utilities - Move any package-specific env variables to the root
.env
file - Ensure all env variables are listed in the root
turbo.json
globalEnv array
API
loadRootEnv()
Loads environment variables from the root .env
file.
validateEnv(requiredVars, options?)
Validates that all required environment variables are set.
Parameters:
requiredVars
: Object mapping env var names to their valuesoptions
: Optional configurationskipInCI
: Skip validation in CI (default: true)skipInProduction
: Skip validation in production (default: true)skipInDocker
: Skip validation in Docker builds (default: true)
Returns:
{ hasErrors: boolean, missingVariables: string[] }