Skip to content

Ishiezz/cli-devkit-ts

Repository files navigation

MyCLI DevKit 🚀

A powerful CLI tool built with Node.js + TypeScript using Object-Oriented Programming concepts. Features 12 unique commands, 3 API integrations, colored output, input validation, and more!

SESD Workshop 2 — CLI Project Submission


🛠️ Setup Instructions

Prerequisites

  • Node.js v18+ installed
  • npm installed

Installation

# Clone the repository
git clone https://github.com/Ishiezz/cli-devkit-ts.git
cd cli-devkit-ts

# Install dependencies
npm install

# Compile TypeScript
npx tsc

# (Optional) Link globally so you can use `mycli` anywhere
npm link

📦 Tech Stack

Technology Purpose
TypeScript Type-safe language
Commander.js Command routing & argument parsing
Chalk v4 Colored terminal output
Axios HTTP requests to APIs
Node.js crypto Hashing & password generation

🏗️ OOP Architecture

BaseCommand (Abstract Class)
├── GitHubCommand
├── WeatherCommand
├── JokeCommand
├── PasswordCommand
├── HashCommand
├── ColorCommand
├── CountdownCommand
├── AgeCommand
├── DiceCommand
├── FlipCommand
├── EncodeCommand
└── DecodeCommand

ApiService (Abstract Class)
├── GitHubService   → api.github.com
├── WeatherService  → api.open-meteo.com
└── JokeService     → v2.jokeapi.dev

CLIApp (Controller)
└── Registers & routes all commands

🌐 API Integrations (3 APIs)

API Command What it does
GitHub API mycli github <username> Fetches public profile info
Open-Meteo mycli weather <city> Current weather report
JokeAPI mycli joke Random programming joke

🎯 Available Commands (12 commands)

🌐 API Commands

# GitHub user profile card
mycli github torvalds

# Current weather for a city
mycli weather Delhi

# Random programming joke
mycli joke

🔧 Developer Tools

# Generate a secure password (default 16 chars)
mycli password 20
mycli password 12 --no-symbols

# Hash text (default: sha256)
mycli hash "hello world"
mycli hash "hello world" -a md5

# Preview a hex color in terminal
mycli color ff6347
mycli color "#3498db"

# Base64 encode
mycli encode "Hello World!"

# Base64 decode
mycli decode "SGVsbG8gV29ybGQh"

🎲 Fun & Utility

# Start a countdown timer (seconds)
mycli countdown 10

# Calculate exact age from birthdate
mycli age 2000-05-15

# Roll dice (default: 6 sides, 1 die)
mycli dice
mycli dice 20 -c 5

# Flip a coin
mycli flip

⚙️ System

# Show version
mycli --version
mycli -v

# Show help
mycli --help
mycli help <command>

✨ Bonus Features

  • Colored CLI output — chalk-powered beautiful output with emojis
  • Input validation — every command has a validate() method
  • Flags/Options — e.g. --no-symbols, -a md5, -c 5
  • Help descriptions — auto-generated by Commander.js
  • Version commandmycli -v
  • OOP structure — Abstract base classes with inheritance

📂 Project Structure

cli-devkit-ts/
├── index.ts          # Entry point — registers all commands
├── CLIApp.ts         # Main CLI application class
├── BaseCommand.ts    # Abstract base command class
├── commands.ts       # All 12 command class implementations
├── services.ts       # All 3 API service classes
├── package.json
├── tsconfig.json
├── .gitignore
└── dist/             # Compiled JavaScript output

👩‍💻 Author

Isha Singh

About

A TypeScript CLI developer toolkit with 12 commands, 3 API integrations, and OOP architecture — built with Commander.js and Chalk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors