# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0] - 2026-02-19

### Known Limitations
- **No delete operations for milestones and task items**: FirebaseClient doesn't expose methods to delete embedded entities
  - Milestones and task items are embedded in task document
  - Requires task-core enhancement to add `updateTask()` method
  - Workaround: Update task item status to indicate it's no longer active
  - Future: Add `task_delete_milestone` and `task_delete_task_item` when task-core supports it

### Added
- **`task_get_tasks` tool** - List all tasks with optional status filtering
  - Discover available tasks when no task ID is known
  - Filter by status (not_started, in_progress, paused, completed, failed)
  - Limit results (default: 50, max: 100)
  - Returns summary with id, title, status, progress
- **`task_get_task` tool** - Get complete task object by ID
  - Replaces task_get_status with raw task data
  - Agents determine next steps from progress object
- **`task_get_milestone` tool** - Get milestone by ID
  - Complete CRUD for milestones
- **`task_get_task_item` tool** - Get task item by ID
  - Complete CRUD for task items
- **`task_update_milestone` tool** - Update milestone properties
  - Supports status, progress, description updates
  - Validates milestone exists
- **`task_update_task_item` tool** - Update task item properties
  - Supports status, description, estimated_hours updates
  - Auto-recalculates milestone progress
- **ACP Template Guidance** - Embedded complete templates in tool descriptions
  - Full ACP Milestone template in task_create_milestone
  - Full ACP Task template in task_create_task_item
  - Guides agents in creating properly structured documents

### Changed
- **BREAKING**: Complete API redesign for consistency
  - Consistent naming: task_<verb>_<entity>
  - Complete CRUD operations for all entities
  - Tool count: 13 tools (was 9)
- **Tool organization**: Grouped by entity
  - Task CRUD: create, get (plural), get, update, delete (5 tools)
  - Milestone CRU: create, get, update (3 tools)
  - Task Item CRU: create, get, update (3 tools)
  - Progress & Communication: update_progress, add_message (2 tools)

### Removed
- **BREAKING**: `task_get_status` - Use `task_get_task` instead
  - task_get_task returns complete task object
  - Agents determine status from task.status and task.progress
- **BREAKING**: `task_get_next_step` - Use `task_get_task` instead
  - Agents determine next step from task.progress object
  - Eliminates redundant "instruction generation" logic
- **BREAKING**: `task_complete_task_item` - Use `task_update_task_item` instead
  - Set status="completed" for same behavior
- **BREAKING**: `task_report_completion` - Use `task_update_task_item` + `task_get_task` instead
  - Removed convenience tool in favor of explicit operations

### Migration Guide

**For task item completion:**
```typescript
// Old (deprecated)
task_complete_task_item(task_id, milestone_id, task_item_id)

// New (recommended)
task_update_task_item(task_id, milestone_id, task_item_id, { status: "completed" })
```

**For reporting completion and getting next step:**
```typescript
// Old (deprecated)
task_report_completion(task_id, milestone_id, task_item_id, notes)

// New (recommended)
task_update_task_item(task_id, milestone_id, task_item_id, { status: "completed" })
task_add_message(task_id, "assistant", notes)  // if notes needed
task_get_next_step(task_id)
```

**For milestone updates:**
```typescript
// New capability
task_update_milestone(task_id, milestone_id, {
  status: "completed",
  progress: 100
})
```

## [1.2.0] - 2026-02-19

### Added
- **`task_update_task` tool** - Update task properties including status
  - Currently supports status updates (not_started/in_progress/paused/completed/failed)
  - Validates task exists before updating
  - Returns list of changes made
- **`task_delete_task` tool** - Delete tasks permanently
  - Requires explicit confirmation flag to prevent accidental deletion
  - Validates task exists before deletion
  - Returns deleted task title for confirmation

### Changed
- **BREAKING**: Renamed `task_create` to `task_create_task` for consistency with other task operations
  - Tool name: `task_create` → `task_create_task`
  - Function: `handleTaskCreate` → `handleTaskCreateTask`
  - All references updated in index and tests
- Tool count increased from 9 to 11 tools
- Updated tools index to register new tools

### Fixed
- Naming inconsistency: task operations now consistently use `task_*_task` pattern
- Complete CRUD operations now available: Create, Read (get_status), Update, Delete

## [1.1.0] - 2026-02-19

### Added
- **`task_create` tool** - Agents can now create new tasks programmatically through MCP interface
  - Accepts title (1-200 chars) and description (1-5000 chars)
  - Optional `auto_approve` configuration
  - Input validation with clear error messages
  - Returns task ID and next steps guidance
  - Enables fully autonomous task workflows
- Comprehensive test suite for `task_create` tool (14 tests, 100% coverage)

### Changed
- Updated tools registry to include `task_create` (now 9 tools total)
- Improved overall test coverage from 77.37% to 78.63%

### Fixed
- Critical gap: Agents previously could not create tasks through MCP, only work with existing tasks

## [1.0.0] - 2026-02-19

### Changed
- **BREAKING**: Migrated to `@prmichaelsen/task-core` package for core business logic
  - Core functionality (schemas, DTOs, services, Firebase client) now provided by external package
  - Reduced package size by removing ~2000+ lines of duplicated code
  - Enables code reuse between MCP server and REST API service

### Removed
- **BREAKING**: Local core files moved to `@prmichaelsen/task-core`
  - Removed `src/schemas/` - Use `@prmichaelsen/task-core/schemas`
  - Removed `src/dto/` - Use `@prmichaelsen/task-core/dto`
  - Removed `src/services/` - Use `@prmichaelsen/task-core/services`
  - Removed `src/client.ts` - Use `@prmichaelsen/task-core/client`
  - Removed `src/constant/` - Use `@prmichaelsen/task-core/constants`
- **BREAKING**: Package exports for core modules
  - Removed `./schemas`, `./dto`, `./services`, `./client`, `./constants` exports
  - Only MCP-specific exports remain: `./` (server), `./factory`, `./api-client`
- Dependencies now provided by task-core
  - Removed `firebase-admin` from direct dependencies
  - Removed `zod` from direct dependencies

### Added
- Dependency on `@prmichaelsen/task-core@^1.0.1`
- Jest mocks for external task-core package

### Migration Guide
To migrate from v0.4.0 to v1.0.0:

1. **Install task-core**: Already included as dependency
2. **Update imports**:
   - `@prmichaelsen/task-mcp/schemas` → `@prmichaelsen/task-core/schemas`
   - `@prmichaelsen/task-mcp/dto` → `@prmichaelsen/task-core/dto`
   - `@prmichaelsen/task-mcp/services` → `@prmichaelsen/task-core/services`
   - `@prmichaelsen/task-mcp/client` → `@prmichaelsen/task-core/client`
3. **MCP server usage unchanged**: The MCP server exports remain the same

## [0.4.0] - 2026-02-16

### Added
- Build configuration with esbuild
  - `esbuild.build.js` - Production build script
  - `esbuild.watch.js` - Development watch mode
  - Bundles all entry points (server, factory, client, services, schemas, dto, api-client)
  - Generates TypeScript declarations and source maps
  - External dependencies properly configured
  - Shebang added to server.js for CLI usage
- Package scripts for building and development
  - `npm run build` - Build all bundles and declarations
  - `npm run build:watch` - Watch mode for development
  - `npm run clean` - Clean dist/ directory
  - `npm run dev` - Alias for watch mode
  - `npm run prepublishOnly` - Pre-publish validation

### Changed
- Build process now uses esbuild instead of tsc only
- Faster build times with bundling
- Smaller bundle sizes with tree-shaking

## [0.3.0] - 2026-02-16

### Added
- REST API Client for consuming task-mcp REST API
  - `TaskApiClient` class with type-safe methods
  - Authentication with service token
  - Automatic retry logic with exponential backoff
  - Comprehensive error handling with structured error classes
  - Support for all task management operations (CRUD, status, progress)
  - Support for milestone management (create, update, complete)
  - Support for task item management (create, update, complete)
  - Support for message management (get, add)
  - Request timeout and abort controller support
  - Optional logger for debugging
- Error classes for API client
  - `TaskApiError` - Base error class
  - `TaskNotFoundError` - 404 errors
  - `UnauthorizedError` - 401 errors
  - `ValidationError` - 400 errors
  - `ServerError` - 500 errors
  - `TimeoutError` - Request timeout errors
  - `NetworkError` - Network failure errors
- Package export for API client via `@prmichaelsen/task-mcp/api-client`
- 25 comprehensive unit tests for API client (91% coverage)

## [0.2.0] - 2026-02-16

### Added
- API Response DTOs for REST API integration
  - `TaskApiResponse` - Complete task representation without internal execution fields
  - `TaskListApiResponse` - List response with total count
  - `TaskMessageApiResponse` - Task message representation
  - `TaskMessageListApiResponse` - Message list response
  - Input DTOs: `CreateTaskDto`, `UpdateTaskDto`, `CreateMessageDto`, etc.
- DTO transformer functions for schema-to-API conversion
  - 9 transformer functions with 100% test coverage
  - Automatic exclusion of internal fields (api_messages, tool_results)
- Package export for DTOs via `task-mcp/dto`
- 18 comprehensive unit tests for DTO transformers

### Changed
- Updated package.json with `./dto` export

## [0.1.0] - 2026-02-16

### Added
- Initial project setup with TypeScript and ESM
- Task data model with Zod schemas
  - Task, Milestone, TaskItem, TaskProgress, TaskConfig, TaskMetadata schemas
  - Standardized timestamp fields with `_at` suffix
- TaskDatabaseService for Firestore operations
  - CRUD operations for tasks
  - Task message operations
  - Progress tracking (milestones, task items)
  - Query methods (by status, search by title)
- FirebaseClient wrapper for multi-tenant Firebase Admin SDK access
- 8 core MCP tools for task management
  - `task_get_status` - Get current task status
  - `task_get_next_step` - Get next step instructions
  - `task_update_progress` - Update progress percentage
  - `task_complete_task_item` - Mark task item complete
  - `task_create_milestone` - Create new milestone
  - `task_create_task_item` - Create task item in milestone
  - `task_report_completion` - Report completion and get next step
  - `task_add_message` - Add message to task thread
- MCP server implementation
  - Server factory for multi-tenant usage (mcp-auth compatible)
  - Standalone server with stdio transport
  - Tool registration and request handling
- Comprehensive test suite
  - 51 unit tests (14 database + 11 client + 18 tools + 8 server)
  - Jest configuration with ESM + TypeScript support
  - Mocked Firebase client for testing
- Firestore security rules with user-scoped access
- Collection path helpers for consistent Firestore paths
- Agent Context Protocol (ACP) documentation
  - Design documents for architecture and requirements
  - Milestone and task planning documents
  - Progress tracking with progress.yaml

### Security
- User-scoped data access enforced at service layer
- Internal execution fields excluded from API responses
- Service account authentication for Firebase Admin SDK

[Unreleased]: https://github.com/yourusername/task-mcp/compare/v0.4.0...HEAD
[0.4.0]: https://github.com/yourusername/task-mcp/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/yourusername/task-mcp/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/yourusername/task-mcp/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/yourusername/task-mcp/releases/tag/v0.1.0
