ppt-cli-tools
v1.0.0
Published
Personal productivity tools
Readme
PPT - Personal Productivity Tools
A CLI tool to boost productivity when working with Git, formatting files, and automating common workflows.
🚀 Features
- Git Commands: Manage branches, find release branches, view checkout history
- Auto-completion: Automate PR creation and cherry-pick workflow
- Formatter Commands: Convert between CSV and JSON formats
- Extensible: Easily add new commands
- Fast: Built with TypeScript and SWC
📦 Installation
Development (Local)
# Clone repository
git clone <your-repo-url>
cd ppt
# Install dependencies
npm install
# Build project
npm run build
# Link globally to use from anywhere
npm linkAfter linking, you can use ppt from any directory!
Production (Global Install)
# If published to npm
npm install -g ppt
# Or install from local
npm install -g .🎯 Usage
Git Commands
Branch Management
# List all branches
ppt git branch
# or
ppt g b
# Find recent release branches (local + remote)
ppt git branch --show-release
# View 10 most recently checked out branches (local only)
ppt git branch --show-current-list
# Create new branch
ppt git branch feature/new-featureAuto-completion Workflow
Automate the complete workflow from feature branch to release:
# From your feature branch (after commit and push)
ppt git auto-completion release/v2.1.0This command will:
- Create PR from feature branch to
master - Checkout the specified release branch
- Create a new branch
<feature-branch>-refrom release branch - Cherry-pick the latest commit
- Push the new branch to remote
- Create PR from new branch to release branch
Example:
# You're on branch: feature/user-authentication
# After committing and pushing your changes
ppt git auto-completion release/v2.1.0
# This will:
# - Create PR: feature/user-authentication -> master
# - Create branch: feature/user-authentication-re
# - Cherry-pick your commit
# - Create PR: feature/user-authentication-re -> release/v2.1.0📚 Commands Reference
Git
| Command | Alias | Description |
|---------|-------|-------------|
| ppt git branch | ppt g b | List branches or create new branch |
| ppt git branch --show-release | | Show 5 most recent release branches (local + remote) |
| ppt git branch --show-current-list | | Show 10 most recently checked out branches (local) |
| ppt git auto-completion <release-branch> | | Automate PR creation and cherry-pick to release branch |
Formatter
| Command | Alias | Description |
|---------|-------|-------------|
| ppt formatter tojson <csv-file> [output-file] | ppt f tj | Convert CSV file to JSON |
| ppt formatter tocsv <json-file> [output-file] | ppt f tc | Convert JSON file to CSV |
🛠️ Development
Project Structure
ppt/
├── src/
│ ├── main.ts # Entry point
│ ├── core/ # CLI framework
│ │ ├── BaseCommand.ts # Base class for commands
│ │ ├── CLI.ts # CLI parser and runner
│ │ └── CommandRegistry.ts
│ ├── commands/ # Command implementations
│ │ ├── git/
│ │ └── formatter/
│ ├── types/ # TypeScript types
│ └── utils/ # Utilities
├── dist/ # Compiled JavaScript
├── bin/ # Executable scripts
└── package.jsonScripts
# Build project
npm run build
# Development mode (auto-reload)
npm run dev
# Run compiled code
npm start
# Link globally
npm run linkAdding a New Command
- Create a class extending
BaseCommand:
// src/commands/mycommand/MyCommand.ts
import { BaseCommand } from '../../core/BaseCommand';
import { CommandContext, CommandResult } from '../../types';
export class MyCommand extends BaseCommand {
name = 'mycommand';
description = 'My awesome command';
aliases = ['mc'];
async execute(context: CommandContext): Promise<CommandResult> {
const { args, options, cwd } = context;
// Your logic here
return this.success('Command executed!');
}
}- Export in
src/commands/index.ts:
export { MyCommand } from './mycommand/MyCommand';- Register in
src/main.ts:
import { MyCommand } from './commands';
cli.register(new MyCommand());- Build and test:
npm run build
ppt mycommand🔧 Configuration
TypeScript
The tsconfig.json file is configured with:
- Target: ES2020
- Module: CommonJS
- Strict mode enabled
Build Tool
The project uses SWC for faster TypeScript compilation.
📝 Examples
Git Workflow
# View release branches
ppt git branch --show-release
# View recently checked out branches
ppt git branch --show-current-list
# Create new feature branch
ppt git branch feature/user-authentication
# Complete auto-completion workflow
ppt git auto-completion release/v2.1.0
# Convert CSV to JSON
ppt formatter tojson data.csv
# Convert JSON to CSV
ppt formatter tocsv data.jsonFormatter Commands
CSV to JSON
# Convert CSV file to JSON
ppt formatter tojson data.csv
# or
ppt f tj data.csv
# Specify output file
ppt formatter tojson data.csv output.jsonJSON to CSV
# Convert JSON file to CSV
ppt formatter tocsv data.json
# or
ppt f tc data.json
# Specify output file
ppt formatter tocsv data.json output.csvAuto-completion Workflow Example
# 1. You're working on a feature
git checkout -b feature/payment-integration
# ... make changes ...
git add .
git commit -m "Add payment integration"
git push origin feature/payment-integration
# 2. Run auto-completion
ppt git auto-completion release/v2.1.0
# This automatically:
# - Creates PR: feature/payment-integration -> master
# - Creates branch: feature/payment-integration-re from release/v2.1.0
# - Cherry-picks your commit
# - Pushes and creates PR: feature/payment-integration-re -> release/v2.1.0🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git branch feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
ISC
🙏 Acknowledgments
- Built with TypeScript
- Compiled with SWC
- Inspired by productivity tools like
git,gh, etc.
Made with ❤️ for productivity
