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.
- 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
- Go 1.24 or higher
# 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
CLI Mode
task_manager [options] [command] [arguments]
- file string: Storage file path (default "tasks.json" )
- api: Run in API mode
- addr string: API server address (default ":8080")
- help: Show help
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
Start the API server:
task_manager -api -addr :8080
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 |
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
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.
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
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
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.
This project is licensed under the MIT License - see the LICENSE file for details
This project is actively maintained and in development. New features and improvements are being added regularly.