safe-trunk
v1.2.0
Published
A simple, professional, and modern template for building and maintaining TypeScript libraries. This template integrates the best tools, workflows, and practices to help you focus on developing your library without worrying about setup.
Maintainers
Readme
SafeTrunk
A powerful CLI tool for improving trunk-based development workflows by automating quality checks and ensuring code quality standards.
Features
- 🚀 Automated pre-push checks to maintain code quality
- 🔍 Comprehensive verification system
- 🔄 Smart branch synchronization
- 📊 Insightful code analysis
- 🎮 Gamification system to encourage best practices
- 🔌 Extensible plugin architecture
- 🎨 Customizable output formats
- 📝 Detailed reporting and suggestions
Installation
npm install -g safe-trunkQuick Start
- Initialize SafeTrunk in your project:
safetrunk init- Run pre-push checks:
safetrunk run- Verify your changes without pushing:
safetrunk checkCommand Reference
safetrunk run
Executes pre-push checks and performs the push if all checks pass.
safetrunk run [options]
Options:
-c, --config <path> Path to custom configuration
-v, --verbose Enable verbose output
-q, --quiet Enable quiet mode
-h, --help Display help informationsafetrunk check
Runs verification checks without pushing changes.
safetrunk check [options]
Options:
-c, --config <path> Path to custom configuration
-v, --verbose Enable verbose output
-q, --quiet Enable quiet mode
-h, --help Display help informationConfiguration
SafeTrunk can be configured through a safetrunk.config.js, safetrunk.config.ts, or safetrunk.config.json file in your project root.
// safetrunk.config.ts
export default {
branches: {
include: ["main", "develop", "feature/*"],
exclude: ["docs/*"],
},
prePushSteps: [
{
name: "lint",
command: "npm run lint",
},
{
name: "test",
command: "npm run test",
},
],
feedback: {
enableGamification: true,
showImpactAreas: true,
suggestionLevel: "normal",
},
};For detailed configuration options and error handling, see our Configuration Guide.
Plugin System
SafeTrunk supports plugins to extend its functionality. Create a plugin by implementing the SafeTrunkPlugin interface:
import type { SafeTrunkPlugin } from "safe-trunk";
export class MyCustomPlugin implements SafeTrunkPlugin {
name = "my-custom-plugin";
register(trunk: SafeTrunk): void {
trunk.on("beforeCheck", async (context) => {
// Custom logic here
});
}
}Contributing
We welcome contributions! Please see our Contributing Guide for details.
Documentation
For detailed documentation, visit our official documentation site.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Acknowledgments
Special thanks to all contributors who have helped make SafeTrunk better!
