TypeScript command line utilities package.
Clone and biuld
git clone https://github.com/bestdan/tsu.git
cd tsu
chmod +x script/setup.sh
sh script/setup.shtsu <namespace> <command> [options]To use tsu to check your dart changes before pushing, create a pre-push hook in your .git/hooks directory:
cd ~/src/mobile
cat > .git/hooks/pre-push << 'EOF'
#!/bin/bash
# Enable pipefail so pipe failures are captured properly
set -o pipefail
echo "📋 Running pre-push tsu checks"
tsu hook collate
# tsu hook collate --verbose # If you want verbose output
EOF
chmod +x .git/hooks/pre-push- check - System dependency checks (documentation)
- upgrade - Check for newer versions (documentation)
- git - Git-related utilities (documentation)
- dart - Dart/Flutter project utilities (documentation)
- hook - Git / Claude hook utilities for Dart (documentation)
- files - File filtering utilities (documentation)
# Run all checks concurrently, collate results
tsu hook format --verbose
# Check and upgrade tsutils
tsutils check version --verbose
tsutils upgrade --verbose
# Check external dependencies
tsutils check externals --verbose
# Check if in a git repository
tsutils git check && echo "In a git repo"
# Get git root path
cd "$(tsutils git root)"
# Show changed files
tsutils git changed
# Format check for Dart files (git hook)
tsutils hook format check
# Filter files by extension
tsutils git changed | tsutils files filter --suffix .tsAll commands follow a pipe-friendly design:
- Clean, parseable output to stdout
- Error messages to stderr
- Appropriate exit codes
--verboseflag for debugging (outputs to stderr)
- Node.js: >=20.0.0
- Vitest: >=4.0.6 // for proper ignores in test coverage
Some commands require additional tools:
- Claude CLI: For
git commit-msgandgit pr-description- Install - Dart SDK: For
dartcommands - Install - DCM: For
hook dcm check- Install - Melos: For
hook graphql check- Install
See the git docs and dart docs for details on which commands need what.
src/
├── cli.ts # CLI entry point
├── index.ts # Library exports
├── commands/ # CLI commands
│ ├── git/ # Git namespace commands
│ ├── dart/ # Dart namespace commands
│ └── files/ # Files namespace commands
└── utils/ # Utility functions
├── logger.ts
├── git.ts # Git utilities
├── dart.ts # Dart utilities
└── files.ts # File utilities
- Contributing Guide
- Release Management - Automated versioning and releases
- Security Policy: See SECURITY.md for our security policy and how to report vulnerabilities
- Automated Scanning: CodeQL security scanning runs on every PR and weekly
- Dependency Monitoring: Dependabot monitors dependencies for known vulnerabilities
- Minimal Dependencies: Only one runtime dependency (
commander) - Regular Updates: Dependencies are regularly updated to patch security issues
- Code Reviews: All changes undergo security-focused code review
Please do not report security vulnerabilities through public GitHub issues.
Report security issues privately via GitHub Security Advisories or see our Security Policy for details.
MIT