A command-line interface (CLI) tool for validating and working with Brazilian CPF numbers.
- Validate CPF numbers
- Clean formatting
- Cross-platform support (built in Go)
brew tap diegopeixoto/cpf-cli-go
brew install cpf-cli-go
-
Download the latest release for your platform from the releases page:
- Windows:
cpf-cli-go_Windows_x86_64.zip
- Linux:
cpf-cli-go_Linux_x86_64.tar.gz
- macOS:
cpf-cli-go_Darwin_x86_64.zip
- Windows:
-
Extract the archive:
# For Windows: # Extract the .zip file using Windows Explorer or: unzip cpf-cli-go_Windows_x86_64.zip # For Linux: tar xzf cpf-cli-go_Linux_x86_64.tar.gz # For macOS: unzip cpf-cli-go_Darwin_x86_64.zip
-
Add to PATH:
- Windows:
- Move
cpf.exe
to a directory likeC:\Program Files\cpf-cli-go\
- Add that directory to your PATH environment variable
- Move
- Linux/macOS:
sudo mv cpf /usr/local/bin/
- Windows:
-
Verify the installation:
# Windows cpf.exe --version # Linux/macOS cpf --version
Requirements:
- Go 1.23 or higher
# Clone the repository
git clone https://github.com/diegopeixoto/cpf-cli-go.git
# Navigate to the project directory
cd cpf-cli-go
# Build the project
go build
# (Optional) Install globally
go install
# Validate a CPF
cpf validate 123.456.789-09
# Clean CPF formatting
cpf clean "123.456.789-09"
# Telemetry Management
cpf telemetry enable # Enable telemetry
cpf telemetry disable # Disable telemetry
cpf telemetry status # Check telemetry status
This tool includes optional telemetry to help us understand how it's being used and improve it. We use PostHog for telemetry collection. The telemetry:
- Is disabled by default
- Only collects anonymous usage data:
- Commands used
- Success/error rates
- OS and architecture
- CLI version
- Never collects personal information or CPF numbers
- Can be enabled/disabled at any time using the
cpf telemetry
command - Stores its configuration in
~/.cpf-cli/telemetry.json
To manage telemetry:
cpf telemetry enable # Enable telemetry
cpf telemetry disable # Disable telemetry
cpf telemetry status # Check current status
When building from source, you can configure the PostHog API key at build time:
# Build with PostHog API key
POSTHOG_API_KEY=your_api_key go build -ldflags="-X github.com/diegopeixoto/cpf-cli-go/pkg/telemetry.apiKey=$POSTHOG_API_KEY"
# Or using make (if you have a Makefile)
make build POSTHOG_API_KEY=your_api_key
The official releases are built with telemetry enabled and configured to send data to our PostHog instance. This helps us understand how the tool is being used and improve it. You can always disable telemetry after installation using cpf telemetry disable
.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Diego Peixoto - GitHub