CLI Interface
CLI Interface
Section titled “CLI Interface”pjt CLI is designed to be easy to use with powerful options for advanced users.
Basic syntax
Section titled “Basic syntax”pjt [options]Options
Section titled “Options”—help, -h
Section titled “—help, -h”Show help and all available options.
pjt --help—version, -v
Section titled “—version, -v”Show pjt version.
pjt --version—verbose, -V
Section titled “—verbose, -V”Enable verbose mode for more detailed output.
pjt --verbose—clean-only
Section titled “—clean-only”Clean repository without reinstalling dependencies.
pjt --clean-only—dry-run
Section titled “—dry-run”Simulate operations without actual changes.
pjt --dry-runUsage examples
Section titled “Usage examples”Standard cleaning
Section titled “Standard cleaning”cd /path/to/your/repopjtCleaning with details
Section titled “Cleaning with details”pjt --verboseOutput:
🔍 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!Clean only
Section titled “Clean only”pjt --clean-onlyUse when you want to clean without reinstallation.
Registry system
Section titled “Registry system”pjt uses a registry system to manage configurations. Registry files are located in src/bin/registry.ts.
Registry structure
Section titled “Registry structure”export const registries = { eslint: { name: 'ESLint', configs: ['recommended', 'strict', 'minimal'] }, prettier: { name: 'Prettier', configs: ['default', 'custom'] }};Error handling
Section titled “Error handling”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.
Exit codes
Section titled “Exit codes”0: Success1: General error2: Invalid options3: Git repository not found
Integration with other tools
Section titled “Integration with other tools”In npm scripts
Section titled “In npm scripts”Add to package.json:
{ "scripts": { "clean": "pjt --clean-only", "fresh": "pjt" }}In Git hooks
Section titled “In Git hooks”Use with Husky for automatic cleaning pre-commit:
pjt --clean-onlyTroubleshooting
Section titled “Troubleshooting””Command not found”
Section titled “”Command not found””# Check PATHecho $PATH
# Reinstallnpm install -g pjtPermission denied
Section titled “Permission denied”# On Linux/Macsudo pjt
# Or change permissionschmod +x $(which pjt)Git repository not found
Section titled “Git repository not found”# Initialize Git repogit init
# Or navigate to existingcd /path/to/git/repo