Skip to content

aditherevenger/task-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

75 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Task Manager

Go Version License Test Coverage Build Status

A robust task management application built with Go, featuring both CLI and REST API interfaces. Designed with clean architecture principles and best practices for Go development.

πŸ“‹ Features

  • Task Management: Create, read, update, and delete tasks
  • Status Tracking: Mark tasks as complete or incomplete
  • Due Dates: Set and track task deadlines
  • Priority Levels: Assign importance to tasks (highest to lowest)
  • Filtering: View tasks by status (all, pending, completed, overdue)
  • Statistics: Get insights into task completion and status
  • Dual Interface: Use as CLI tool or REST API server
  • Persistent Storage: Tasks saved to JSON file
  • Comprehensive Testing: 80%+ code coverage with automated enforcement
  • Security Scanning: CodeQL integration for vulnerability detection
  • Dependency Monitoring: Automated dependency review for security issues

πŸš€ Installation

Prerequisites

  • Go 1.24 or higher

From Source

# Clone the repository
git clone https://github.com/yourusername/task-manager.git
cd task-manager

# Build the application
make build

# Run tests with coverage
make test

πŸ–₯️ Usage

CLI Mode

task_manager [options] [command] [arguments]

Options

  • file string: Storage file path (default "tasks.json" )
  • api: Run in API mode
  • addr string: API server address (default ":8080")
  • help: Show help

⌨️ Commands

Command Alias Description Example
add βž• a Add a new task task-manager add "Buy groceries" "Milk, eggs, bread"
list πŸ“œ ls, l List pending tasks task-manager list
list-all πŸ“‹ la List all tasks task-manager list-all
list-completed βœ… lc List completed tasks task-manager list-completed
list-pending ⏳ lp List pending tasks task-manager list-pending
list-overdue ⚠️ lo List overdue tasks task-manager list-overdue
detail πŸ” d Show task details task-manager detail 1
complete βœ”οΈ c Mark task as complete task-manager complete 1
uncomplete ↩️ uc Mark task as incomplete task-manager uncomplete 1
update ✏️ u Update task title/description task-manager update 1 "New title" "New description"
delete πŸ—‘οΈ del, rm Delete a task task-manager delete 1
due πŸ“… due-date Set task due date task-manager due 1 2023-12-31
priority πŸ” p Set task priority task-manager priority 1 high
stats πŸ“Š st Show task statistics task-manager stats
help ❓ h Show help task-manager help
  # Add a new task
task_manager add "Complete project documentation" "Add usage examples and API documentation"

# List all pending tasks
task_manager list

# Mark a task as complete
task_manager complete 1

# Set a due date
task_manager due 2 2023-12-31

# Set priority
task_manager priority 3 high

# View task statistics
task_manager stats

API Mode

Start the API server:

task_manager -api -addr :8080

πŸ“‘ API Endpoints

Method Endpoint Description
GET /api/v1/tasks List all tasks
GET /api/v1/tasks/:id Get a specific task
POST /api/v1/tasks Create a new task
PUT /api/v1/tasks/:id Update a task
DELETE /api/v1/tasks/:id Delete a task
PATCH /api/v1/tasks/:id/complete Mark a task as complete
PATCH /api/v1/tasks/:id/uncomplete Mark a task as incomplete
PATCH /api/v1/tasks/:id/due-date Set a task's due date
PATCH /api/v1/tasks/:id/priority Set a task's priority
GET /api/v1/stats Get task statistics

πŸ“ Architecture

The project follows clean architecture principles with clear separation of concerns:

task-manager/
β”œβ”€β”€ task_manager/
β”‚   β”œβ”€β”€ main.go                      # Main application entry point (CLI & API startup logic)
β”‚   └── main_test.go                 # Tests for CLI entry point and flags
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/                         # API-related code
β”‚   β”‚   β”œβ”€β”€ handlers/                # HTTP request handlers (routes implementation)
β”‚   β”‚   β”‚   β”œβ”€β”€ task_handler.go      # Handlers for task CRUD operations
β”‚   β”‚   β”‚   └── task_handler_test.go # Unit tests for task handlers
β”‚   β”‚   β”œβ”€β”€ middleware/              # HTTP middleware logic
β”‚   β”‚   β”‚   β”œβ”€β”€ logger.go            # Logging middleware for requests/responses
β”‚   β”‚   β”‚   └── logger_test.go       # Tests for logging middleware
β”‚   β”‚   β”œβ”€β”€ server.go                # API server setup and route registration
β”‚   β”‚   └── server_test.go           # Tests for API server setup and routes
β”‚   β”œβ”€β”€ manager/                     # Business logic (core task management)
β”‚   β”‚   β”œβ”€β”€ task_manager.go          # Core logic for managing tasks (CRUD, filters, stats)
β”‚   β”‚   └── task_manager_test.go     # Tests for business logic
β”‚   β”œβ”€β”€ model/                       # Domain models (data structures)
β”‚   β”‚   β”œβ”€β”€ task.go                  # Task model (fields: ID, Title, DueDate, etc.)
β”‚   β”‚   └── task_test.go             # Tests for task model (validation, struct checks)
β”‚   └── storage/                     # Data persistence layer
β”‚       β”œβ”€β”€ storage.go               # Logic to save/load tasks (e.g., JSON, file operations)
β”‚       └── storage_test.go          # Tests for storage persistence logic
└── pkg/
    └── utils/                       # Reusable utility functions
        β”œβ”€β”€ utils.go                 # Helper functions (date parsing, string utilities)
        └── utils_test.go            # Tests for utility functions

πŸ§ͺ Testing

The project maintains a high standard of code quality with comprehensive test coverage:

# Run all tests with coverage report
make test

# View detailed coverage report
go tool cover -html=coverage.out

Our CI pipeline enforces a minimum of 80% test coverage across the codebase.

πŸ”’ Security

This project uses multiple security tools to ensure code quality and security:

  • CodeQL Analysis: Advanced static analysis to detect security vulnerabilities
  • Dependency Review: Automated scanning of dependencies for known vulnerabilities
  • Supply Chain Security: Monitoring and enforcement of secure dependencies

πŸ› οΈ Development

Makefile Commands

The project includes a comprehensive Makefile to simplify development tasks:

make build      # Build the application
make run        # Run the application
make test       # Run tests with coverage
make clean      # Clean build artifacts
make fmt        # Format code
make deps       # Download dependencies
make tidy       # Tidy go.mod file

CI/CD Pipeline The project uses GitHub Actions for continuous integration and deployment:

  • Build & Test: Automatically builds and tests the code on each push
  • Coverage Enforcement: Ensures test coverage remains above 80%
  • CodeQL Analysis: Performs security scanning
  • Dependency Review: Checks for vulnerable dependencies

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

Please make sure your code passes all tests and follows the project's coding style.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details

πŸ“Š Project Status

This project is actively maintained and in development. New features and improvements are being added regularly.

About

A task management application built with Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published