# Tasks: Project Schedule Tools **Input**: Design documents from `/specs/001-schedule-tools/` **Prerequisites**: plan.md, spec.md, research.md, data-model.md, contracts/ **Tests**: TDD is mandated by constitution - tests MUST be written and fail before implementation. **Organization**: Tasks are grouped by user story to enable independent implementation and testing. ## Format: `[ID] [P?] [Story] Description` - **[P]**: Can run in parallel (different files, no dependencies) - **[Story]**: Which user story this task belongs to (US1, US2, US3, US4) - Include exact file paths in descriptions ## Path Conventions - **Source**: `src/xer_mcp/` - **Tests**: `tests/` - **Config**: `pyproject.toml` --- ## Phase 1: Setup (Shared Infrastructure) **Purpose**: Project initialization and basic structure - [ ] T001 Create project directory structure per plan.md in src/xer_mcp/ - [ ] T002 Initialize Python project with uv and create pyproject.toml with dependencies (mcp, pytest, pytest-asyncio, ruff) - [ ] T003 [P] Configure ruff for linting and formatting in pyproject.toml - [ ] T004 [P] Create src/xer_mcp/__init__.py with version 0.1.0 - [ ] T005 [P] Create tests/conftest.py with sample XER file fixtures --- ## Phase 2: Foundational (Blocking Prerequisites) **Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented **⚠️ CRITICAL**: No user story work can begin until this phase is complete - [ ] T006 Create data models in src/xer_mcp/models/__init__.py (export all models) - [ ] T007 [P] Create Project dataclass in src/xer_mcp/models/project.py - [ ] T008 [P] Create Activity dataclass in src/xer_mcp/models/activity.py - [ ] T009 [P] Create Relationship dataclass in src/xer_mcp/models/relationship.py - [ ] T010 [P] Create PaginationMetadata dataclass in src/xer_mcp/models/pagination.py - [ ] T011 Create SQLite schema in src/xer_mcp/db/schema.py with all tables and indexes - [ ] T012 Create database connection manager in src/xer_mcp/db/__init__.py - [ ] T013 Create MCP server skeleton in src/xer_mcp/server.py with stdio transport - [ ] T014 Create base table handler abstract class in src/xer_mcp/parser/table_handlers/base.py - [ ] T015 Create error types and NO_FILE_LOADED error in src/xer_mcp/errors.py **Checkpoint**: Foundation ready - user story implementation can now begin --- ## Phase 3: User Story 1 - Load XER File (Priority: P1) 🎯 MVP **Goal**: Parse XER files and load schedule data into SQLite database **Independent Test**: Load a sample XER file and verify projects, activities, relationships are stored in SQLite ### Tests for User Story 1 > **NOTE: Write these tests FIRST, ensure they FAIL before implementation** - [ ] T016 [P] [US1] Contract test for load_xer tool in tests/contract/test_load_xer.py - [ ] T017 [P] [US1] Integration test for XER parsing in tests/integration/test_xer_parsing.py - [ ] T018 [P] [US1] Integration test for multi-project handling in tests/integration/test_multi_project.py - [ ] T019 [P] [US1] Unit test for XER parser in tests/unit/test_parser.py - [ ] T020 [P] [US1] Unit test for table handlers in tests/unit/test_table_handlers.py ### Implementation for User Story 1 - [ ] T021 [US1] Create XER parser main class in src/xer_mcp/parser/xer_parser.py - [ ] T022 [P] [US1] Create PROJECT table handler in src/xer_mcp/parser/table_handlers/project.py - [ ] T023 [P] [US1] Create TASK table handler in src/xer_mcp/parser/table_handlers/task.py - [ ] T024 [P] [US1] Create TASKPRED table handler in src/xer_mcp/parser/table_handlers/taskpred.py - [ ] T025 [P] [US1] Create PROJWBS table handler in src/xer_mcp/parser/table_handlers/projwbs.py - [ ] T026 [P] [US1] Create CALENDAR table handler in src/xer_mcp/parser/table_handlers/calendar.py - [ ] T027 [US1] Create table handler registry in src/xer_mcp/parser/table_handlers/__init__.py - [ ] T028 [US1] Create database loader in src/xer_mcp/db/loader.py to insert parsed data into SQLite - [ ] T029 [US1] Implement load_xer MCP tool in src/xer_mcp/tools/load_xer.py - [ ] T030 [US1] Register load_xer tool in src/xer_mcp/server.py - [ ] T031 [US1] Add file-not-found and parse-error handling in src/xer_mcp/tools/load_xer.py - [ ] T032 [US1] Add multi-project detection and selection logic in src/xer_mcp/tools/load_xer.py **Checkpoint**: User Story 1 complete - XER files can be loaded and parsed --- ## Phase 4: User Story 2 - Query Project Activities (Priority: P1) **Goal**: List and filter activities, get activity details with pagination **Independent Test**: Load XER file, query activities with filters, verify pagination metadata ### Tests for User Story 2 > **NOTE: Write these tests FIRST, ensure they FAIL before implementation** - [ ] T033 [P] [US2] Contract test for list_activities tool in tests/contract/test_list_activities.py - [ ] T034 [P] [US2] Contract test for get_activity tool in tests/contract/test_get_activity.py - [ ] T035 [P] [US2] Unit test for activity queries in tests/unit/test_db_queries.py ### Implementation for User Story 2 - [ ] T036 [US2] Create activity query functions with pagination in src/xer_mcp/db/queries.py - [ ] T037 [US2] Implement list_activities MCP tool in src/xer_mcp/tools/list_activities.py - [ ] T038 [US2] Implement get_activity MCP tool in src/xer_mcp/tools/get_activity.py - [ ] T039 [US2] Register list_activities and get_activity tools in src/xer_mcp/server.py - [ ] T040 [US2] Add NO_FILE_LOADED error check to activity tools in src/xer_mcp/tools/list_activities.py - [ ] T041 [US2] Add date range filtering to list_activities in src/xer_mcp/tools/list_activities.py - [ ] T042 [US2] Add WBS and activity_type filtering to list_activities in src/xer_mcp/tools/list_activities.py **Checkpoint**: User Stories 1 AND 2 complete - activities are queryable --- ## Phase 5: User Story 3 - Query Activity Relationships (Priority: P2) **Goal**: Query predecessors, successors, and full relationship network **Independent Test**: Load XER file, query relationships for an activity, verify types and lags ### Tests for User Story 3 > **NOTE: Write these tests FIRST, ensure they FAIL before implementation** - [ ] T043 [P] [US3] Contract test for list_relationships tool in tests/contract/test_list_relationships.py - [ ] T044 [P] [US3] Contract test for get_predecessors tool in tests/contract/test_get_predecessors.py - [ ] T045 [P] [US3] Contract test for get_successors tool in tests/contract/test_get_successors.py ### Implementation for User Story 3 - [ ] T046 [US3] Create relationship query functions in src/xer_mcp/db/queries.py - [ ] T047 [US3] Implement list_relationships MCP tool in src/xer_mcp/tools/list_relationships.py - [ ] T048 [US3] Implement get_predecessors MCP tool in src/xer_mcp/tools/get_predecessors.py - [ ] T049 [US3] Implement get_successors MCP tool in src/xer_mcp/tools/get_successors.py - [ ] T050 [US3] Register relationship tools in src/xer_mcp/server.py - [ ] T051 [US3] Add NO_FILE_LOADED error check to relationship tools **Checkpoint**: User Stories 1, 2, AND 3 complete - relationships are queryable --- ## Phase 6: User Story 4 - Query Project Summary (Priority: P3) **Goal**: Get project overview, milestones, and critical path activities **Independent Test**: Load XER file, get summary, list milestones, get critical path ### Tests for User Story 4 > **NOTE: Write these tests FIRST, ensure they FAIL before implementation** - [ ] T052 [P] [US4] Contract test for get_project_summary tool in tests/contract/test_get_project_summary.py - [ ] T053 [P] [US4] Contract test for list_milestones tool in tests/contract/test_list_milestones.py - [ ] T054 [P] [US4] Contract test for get_critical_path tool in tests/contract/test_get_critical_path.py ### Implementation for User Story 4 - [ ] T055 [US4] Create summary query functions in src/xer_mcp/db/queries.py - [ ] T056 [US4] Implement get_project_summary MCP tool in src/xer_mcp/tools/get_project_summary.py - [ ] T057 [US4] Implement list_milestones MCP tool in src/xer_mcp/tools/list_milestones.py - [ ] T058 [US4] Implement get_critical_path MCP tool in src/xer_mcp/tools/get_critical_path.py - [ ] T059 [US4] Register summary tools in src/xer_mcp/server.py - [ ] T060 [US4] Add NO_FILE_LOADED error check to summary tools **Checkpoint**: All user stories complete - full MCP server functional --- ## Phase 7: Polish & Cross-Cutting Concerns **Purpose**: Improvements that affect multiple user stories - [ ] T061 [P] Integration test for edge cases in tests/integration/test_edge_cases.py - [ ] T062 [P] Unit test for models in tests/unit/test_models.py - [ ] T063 Add logging throughout src/xer_mcp/ modules - [ ] T064 Run quickstart.md validation - test all documented examples - [ ] T065 Add __main__.py entry point in src/xer_mcp/__main__.py - [ ] T066 Final type checking with mypy and fix any issues - [ ] T067 Run ruff format and fix any linting issues --- ## Dependencies & Execution Order ### Phase Dependencies - **Setup (Phase 1)**: No dependencies - can start immediately - **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories - **User Story 1 (Phase 3)**: Depends on Foundational - BLOCKS US2, US3, US4 (they need load_xer) - **User Story 2 (Phase 4)**: Depends on US1 (needs loaded data to query) - **User Story 3 (Phase 5)**: Depends on US1 (needs loaded data to query) - **User Story 4 (Phase 6)**: Depends on US1 (needs loaded data to query) - **Polish (Phase 7)**: Depends on all user stories being complete ### User Story Dependencies - **US1 (Load XER)**: Foundation for all others - MUST complete first - **US2 (Activities)**: Can start after US1 - independent of US3, US4 - **US3 (Relationships)**: Can start after US1 - independent of US2, US4 - **US4 (Summary)**: Can start after US1 - independent of US2, US3 ### Within Each User Story - Tests MUST be written and FAIL before implementation - Models before services/queries - Queries before MCP tools - Core implementation before error handling - Register tools in server.py after implementation ### Parallel Opportunities **Phase 2 (Foundational)**: ```bash # These can run in parallel: Task T007: "Create Project dataclass" Task T008: "Create Activity dataclass" Task T009: "Create Relationship dataclass" Task T010: "Create PaginationMetadata dataclass" ``` **Phase 3 (US1 - Table Handlers)**: ```bash # These can run in parallel: Task T022: "Create PROJECT table handler" Task T023: "Create TASK table handler" Task T024: "Create TASKPRED table handler" Task T025: "Create PROJWBS table handler" Task T026: "Create CALENDAR table handler" ``` **After US1 Complete (US2, US3, US4 can start in parallel)**: ```bash # Developer A: User Story 2 (Activities) # Developer B: User Story 3 (Relationships) # Developer C: User Story 4 (Summary) ``` --- ## Implementation Strategy ### MVP First (User Story 1 + 2) 1. Complete Phase 1: Setup 2. Complete Phase 2: Foundational 3. Complete Phase 3: User Story 1 (Load XER) 4. **STOP and VALIDATE**: Can load XER files successfully 5. Complete Phase 4: User Story 2 (Activities) 6. **MVP COMPLETE**: Can load XER and query activities ### Incremental Delivery 1. Setup + Foundational → Project ready 2. User Story 1 → XER files load → Demo loading 3. User Story 2 → Activities queryable → Demo activity queries 4. User Story 3 → Relationships queryable → Demo dependency analysis 5. User Story 4 → Summary available → Demo project overview 6. Polish → Production ready ### Parallel Team Strategy With multiple developers after US1: - Developer A: User Story 2 (list_activities, get_activity) - Developer B: User Story 3 (relationships, predecessors, successors) - Developer C: User Story 4 (summary, milestones, critical_path) --- ## Notes - [P] tasks = different files, no dependencies on incomplete tasks - [Story] label maps task to specific user story for traceability - Constitution mandates TDD: write tests first, verify they fail, then implement - Commit after each task or logical group - Stop at any checkpoint to validate story independently - All query tools must check for NO_FILE_LOADED condition