A simple command-line interface (CLI) application to track and manage your tasks. Built with TypeScript and Node.js, this project helps you organize what you need to do, what you're currently working on, and what you've completed.
- ✅ Add, update, and delete tasks
- 🔄 Mark tasks as in-progress or done
- 📋 List all tasks or filter by status
- 💾 Tasks stored in JSON format
- 🚀 No external dependencies required
- Node.js (v14 or higher)
- TypeScript (v4 or higher)
- Clone the repository:
git clone https://github.com/yourusername/task-tracker-cli.git
cd task-tracker-cli- Install dependencies (if any):
npm install- Compile TypeScript to JavaScript (if using TypeScript):
npx tsc index.tsOr if you have a build script in package.json:
npm run buildAdd a new task with a description:
node index.js add "Buy groceries"Output:
Task added successfully (ID: 1)
Update the description of an existing task:
node index.js update 1 "Buy groceries and cook dinner"Output:
Task updated successfully (ID: 1)
Delete a task by its ID:
node index.js delete 1Output:
Task deleted successfully (ID: 1)
Mark a task as in-progress:
node index.js mark-in-progress 1Output:
Task marked as in-progress (ID: 1)
Mark a task as done:
node index.js mark-done 1Output:
Task marked as done (ID: 1)
List all tasks:
node index.js listList tasks by status:
# List only completed tasks
node index.js list done
# List only pending tasks
node index.js list todo
# List only in-progress tasks
node index.js list in-progressExample output:
[1] Buy groceries - Status: todo
[2] Write documentation - Status: in-progress
[3] Deploy application - Status: done
Each task contains the following properties:
| Property | Type | Description |
|---|---|---|
id |
number | Unique identifier for the task |
description |
string | Short description of the task |
status |
string | Task status: todo, in-progress, or done |
createdAt |
number | Timestamp when the task was created |
updatedAt |
number | Timestamp when the task was last updated |
Tasks are stored in a tasks.json file in the same directory as the script. The file is automatically created if it doesn't exist.
Example tasks.json structure:
[
{
"id": 1,
"description": "Buy groceries",
"status": "todo",
"createdAt": 1704067200000,
"updatedAt": 1704067200000
},
{
"id": 2,
"description": "Write documentation",
"status": "in-progress",
"createdAt": 1704153600000,
"updatedAt": 1704240000000
}
]The application includes comprehensive error handling for:
- Missing required arguments
- Invalid task IDs
- Non-existent tasks
- Invalid commands
Example error messages:
# Missing description
node index.js add
Error: Please provide a task description
# Task not found
node index.js update 999 "New description"
Error: Task with ID 999 not found
# Invalid command
node index.js invalid-command
Error: Invalid command
Available commands: add, update, delete, mark-in-progress, mark-done, listtask-tracker-cli/
│
├── node_modules/ # Dependencies (auto-generated)
├── .gitignore # Git ignore file
├── index.js # Main JavaScript source file
├── index.ts # Main TypeScript source file
├── package-lock.json # Dependency lock file
├── package.json # Project configuration
├── README.md # Project documentation
└── tasks.json # Task data storage (auto-generated)
If you're using TypeScript, create a tsconfig.json file in your project root:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"outDir": "./",
"rootDir": "./",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["index.ts"],
"exclude": ["node_modules"]
}Create or update your package.json:
{
"name": "task-tracker-cli",
"version": "1.0.0",
"description": "A simple CLI task tracker",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node index.js"
},
"keywords": ["cli", "task", "tracker", "todo"],
"author": "Your Name",
"license": "MIT"
}Create a .gitignore file to exclude unnecessary files:
# Dependencies
node_modules/
# Task data (optional - remove this line if you want to commit tasks)
tasks.json
# Compiled output (if keeping source TS files)
# index.js
# TypeScript cache
*.tsbuildinfo
# OS files
.DS_Store
Thumbs.db
# IDE
.vscode/
.idea/
# Logs
*.log
npm-debug.log*
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Potential features for future versions:
- Task priorities (high, medium, low)
- Due dates for tasks
- Task categories/tags
- Search functionality
- Export tasks to CSV
- Task statistics and analytics
- Undo last action
- Task archiving
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by the need for a simple, lightweight task management solution
- Built as a practical exercise in CLI development with TypeScript
- Project idea from roadmap.sh
Your Name - @yourtwitter - your.email@example.com
Project Link: https://github.com/yourusername/task-tracker-cli
Happy Task Tracking! 📝✨