A fully-featured command-line task management tool built with TypeScript. This is my TypeScript learning project showcasing modern TypeScript development best practices.
- 📝 Task Management: Create, edit, and delete tasks
- 🏷️ Status Tracking: Todo, In Progress, Completed
- ⏰ Due Dates: Set and track task deadlines
- 🎨 Interactive CLI: Beautiful command-line interface
- 📊 Statistics: Task completion rates and overdue alerts
- 💾 Data Persistence: JSON file storage
- Language:
TypeScript 5.2+ - Runtime:
Node.js 16+ - CLI Framework:
Commander.js - Interactive Interface:
Inquirer.js - Styling:
Chalk(terminal colors) - Tools:
ts-node,nodemon
npm installnpm run build# Show help
npm start -- --help
# Add a task
npm start -- add -t "My first task" -d "This is a task description"
# List all tasks
npm start -- list
# Enter interactive mode
npm start -- interactive
# Show statistics
npm start -- statsnpm run link
task-manager --help| Command | Description | Example |
|---|---|---|
add |
Add a new task | add -t "Learn TypeScript" |
list |
List tasks | list --status todo |
update |
Update a task | update <id> -s completed |
delete |
Delete a task | delete <id> |
stats |
Show statistics | stats |
interactive |
Interactive mode | interactive |
todo- To Do ⏳in_progress- In Progress 🔄completed- Completed ✅
# Add task with due date
npm start -- add -t "Complete project report" --due-date "2024-12-31"
# Filter tasks by status
npm start -- list -s completed
# Update task status
npm start -- update task_xyz123 -s in_progress
# Interactive task update
npm start -- update task_xyz123src/
├── index.ts # Application entry point
├── types/
│ └── Task.ts # Type definitions
├── services/
│ └── TaskService.ts # Core business logic
├── utils/
│ └── fileUtils.ts # File operation utilities
└── cli/
└── commands.ts # CLI command handlers
data/
└── tasks.json # Task data file
dist/ # Compiled JavaScript files
This project showcases the following TypeScript core concepts:
// Interface definition
interface Task {
id: string;
title: string;
status: TaskStatus;
dueDate?: Date;
}
// Enums
enum TaskStatus {
TODO = 'todo',
IN_PROGRESS = 'in_progress',
COMPLETED = 'completed'
}interface ApiResponse<T> {
success: boolean;
data?: T;
}class TaskService {
private tasks: Task[] = [];
async createTask(input: CreateTaskInput): Promise<ApiResponse<Task>> {
// Implementation logic
}
}- Optional chaining:
task.description?.trim() - Nullish coalescing:
title ?? currentTask.title - Spread operator:
{...currentTask, ...updateData} - Type guards:
status is TaskStatus - Async/await: Modern asynchronous programming
npm run build # Compile TypeScript
npm run dev # Development mode
npm run watch # Watch mode
npm run clean # Clean compiled files
npm run rebuild # Clean and rebuild