Skip to content

CLI Interface

pjt CLI is designed to be easy to use with powerful options for advanced users.

Terminal window
pjt [options]

Show help and all available options.

Terminal window
pjt --help

Show pjt version.

Terminal window
pjt --version

Enable verbose mode for more detailed output.

Terminal window
pjt --verbose

Clean repository without reinstalling dependencies.

Terminal window
pjt --clean-only

Simulate operations without actual changes.

Terminal window
pjt --dry-run
Terminal window
cd /path/to/your/repo
pjt
Terminal window
pjt --verbose

Output:

🔍 Detected package manager: pnpm
🗂️ Found 5 empty directories
🗂️ Removed: empty-folder/
🗂️ Removed: another-empty/
...
🚫 Found 12 ignored files
🚫 Removed: node_modules/.cache/file.js
...
📦 Cleaning node_modules...
📦 Reinstalling dependencies...
✅ Done!
Terminal window
pjt --clean-only

Use when you want to clean without reinstallation.

pjt uses a registry system to manage configurations. Registry files are located in src/bin/registry.ts.

export const registries = {
eslint: {
name: 'ESLint',
configs: ['recommended', 'strict', 'minimal']
},
prettier: {
name: 'Prettier',
configs: ['default', 'custom']
}
};

CLI has robust error handling:

  • Validation errors: Invalid options or parameters
  • File system errors: Problems accessing files
  • Git errors: Problems with Git repository
  • Package manager errors: Errors during installation

All errors are logged with clear messages and suggestions for resolution.

  • 0: Success
  • 1: General error
  • 2: Invalid options
  • 3: Git repository not found

Add to package.json:

{
"scripts": {
"clean": "pjt --clean-only",
"fresh": "pjt"
}
}

Use with Husky for automatic cleaning pre-commit:

.husky/pre-commit
pjt --clean-only
Terminal window
# Check PATH
echo $PATH
# Reinstall
npm install -g pjt
Terminal window
# On Linux/Mac
sudo pjt
# Or change permissions
chmod +x $(which pjt)
Terminal window
# Initialize Git repo
git init
# Or navigate to existing
cd /path/to/git/repo