Files
snowprint 54f427ea21
Some checks failed
Deploy to GitHub Pages / build-and-deploy (push) Has been cancelled
init geek calc
2025-10-04 10:53:41 +08:00

5.4 KiB

Tasks: Geek Calculator

Input: Design documents from /specs/001-build-a-single/ Prerequisites: plan.md (required), research.md, data-model.md, contracts/

Execution Flow (main)

1. Load plan.md from feature directory
   → If not found: ERROR "No implementation plan found"
   → Extract: tech stack, libraries, structure
2. Load optional design documents:
   → data-model.md: Extract entities → model tasks
   → contracts/: Each file → contract test task
   → research.md: Extract decisions → setup tasks
3. Generate tasks by category:
   → Setup: project init, dependencies, linting
   → Tests: contract tests, integration tests
   → Core: models, services, CLI commands
   → Integration: DB, middleware, logging
   → Polish: unit tests, performance, docs
4. Apply task rules:
   → Different files = mark [P] for parallel
   → Same file = sequential (no [P])
   → Tests before implementation (TDD)
5. Number tasks sequentially (T001, T002...)
6. Generate dependency graph
7. Create parallel execution examples
8. Validate task completeness:
   → All contracts have tests?
   → All entities have models?
   → All endpoints implemented?
9. Return: SUCCESS (tasks ready for execution)

Format: [ID] [P?] Description

  • [P]: Can run in parallel (different files, no dependencies)
  • Include exact file paths in descriptions

Path Conventions

  • Single project: index.html, styles.css, app.js at repository root
  • Test files: tests/unit/, tests/integration/ directories

Phase 3.1: Setup

  • T001 Create project structure: index.html, styles.css, app.js, service-worker.js, manifest.webmanifest
  • T002 [P] Create test directory structure: tests/unit/, tests/integration/, tests/index.html
  • T003 [P] Create README.md with usage instructions

Phase 3.2: Tests First (TDD) ⚠️ MUST COMPLETE BEFORE 3.3

CRITICAL: These tests MUST be written and MUST FAIL before ANY implementation

  • T004 [P] Contract test for Core Calculator API in tests/unit/calculator.test.js
  • T005 [P] Contract test for RPN Calculator API in tests/unit/rpn-calculator.test.js
  • T021 Unit tests for core math operations in tests/unit/math.test.js
  • T022 Unit tests for RPN stack operations in tests/unit/rpn.test.js
  • T016 Integration tests for user scenarios in tests/integration/ui.test.js

Phase 3.3: Core Implementation (ONLY after tests are failing)

  • T006 [P] Calculator class implementation in calculator.js
  • T007 [P] RPN Calculator class implementation in rpn-calculator.js
  • T008 [P] State management class implementation in state.js
  • T009 [P] UI controller implementation in ui.js
  • T010 [P] Utility functions in utils.js
  • T015 [P] Custom test harness implementation in tests/test-harness.js

Phase 3.4: Integration

  • T011 [P] Service worker implementation for offline functionality in service-worker.js
  • T012 Web app manifest for PWA features in manifest.webmanifest
  • T013 [P] Accessibility features (ARIA roles, keyboard navigation) in ui.js and index.html
  • T014 [P] History with localStorage implementation in state.js
  • T019 [P] Keyboard controls implementation in ui.js
  • T020 [P] Command palette feature implementation in ui.js

Phase 3.5: Polish

  • T017 [P] Performance validation and size budget check script
  • T018 [P] CSS styling for dark theme, ASCII banner, and terminal aesthetic in styles.css
  • T023 [P] GitHub Pages deployment setup
  • T024 Size optimization to ensure <50KB payload

Dependencies

  • Setup (T001-T003) before everything
  • Tests (T004-T005, T021-T022, T016) before implementation (T006-T010, T015)
  • Core implementation (T006-T010, T015) before integration (T011-T014, T019-T020)
  • Integration (T011-T014, T019-T020) before polish (T017-T018, T023-T024)

Parallel Example

# Launch T004-T005, T021-T022 together:
Task: "Contract test for Core Calculator API in tests/unit/calculator.test.js"
Task: "Contract test for RPN Calculator API in tests/unit/rpn-calculator.test.js"
Task: "Unit tests for core math operations in tests/unit/math.test.js"
Task: "Unit tests for RPN stack operations in tests/unit/rpn.test.js"

# Launch T006-T010 together:
Task: "Calculator class implementation in calculator.js"
Task: "RPN Calculator class implementation in rpn-calculator.js"
Task: "State management class implementation in state.js"
Task: "UI controller implementation in ui.js"
Task: "Utility functions in utils.js"

Notes

  • [P] tasks = different files, no dependencies
  • Verify tests fail before implementing
  • Commit after each task
  • Avoid: vague tasks, same file conflicts

Task Generation Rules

Applied during main() execution

  1. From Contracts:

    • Each contract file → contract test task [P]
    • Each endpoint → implementation task
  2. From Data Model:

    • Each entity → model creation task [P]
    • Relationships → service layer tasks
  3. From User Stories:

    • Each story → integration test [P]
    • Quickstart scenarios → validation tasks
  4. Ordering:

    • Setup → Tests → Models → Services → Endpoints → Polish
    • Dependencies block parallel execution

Validation Checklist

GATE: Checked by main() before returning

  • All contracts have corresponding tests
  • All entities have model tasks
  • All tests come before implementation
  • Parallel tasks truly independent
  • Each task specifies exact file path
  • No task modifies same file as another [P] task