notex.nvim/specs/002-notex-is-a/tasks.md

9.1 KiB

Tasks: Relational Document System for Neovim

Input: Design documents from /specs/002-notex-is-a/ Prerequisites: plan.md (required), research.md, data-model.md, contracts/, quickstart.md

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

  • Neovim plugin: lua/notex/, tests/ at repository root
  • Paths shown below follow the project structure from plan.md

Phase 3.1: Setup

  • T001 Create project structure per implementation plan (lua/notex/, tests/)
  • T002 Initialize Lua project with lsqlite3, lyaml, busted dependencies
  • T003 [P] Configure luacheck and stylua for Lua code formatting

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 query parsing API in tests/contract/test_query_api.lua
  • T005 [P] Contract test query execution API in tests/contract/test_query_api.lua
  • T006 [P] Contract test virtual buffer API in tests/contract/test_query_api.lua
  • T007 [P] Integration test document indexing workflow in tests/integration/test_document_indexing.lua
  • T008 [P] Integration test query workflow in tests/integration/test_query_workflow.lua
  • T009 [P] Integration test virtual buffer workflow in tests/integration/test_virtual_buffer.lua

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

  • T010 [P] Database connection module in lua/notex/database/init.lua
  • T011 [P] Database schema module in lua/notex/database/schema.lua
  • T012 [P] Database migrations module in lua/notex/database/migrations.lua
  • T013 Document model implementation in lua/notex/database/schema.lua
  • T014 Property model implementation in lua/notex/database/schema.lua
  • T015 Query model implementation in lua/notex/database/schema.lua
  • T016 Schema model implementation in lua/notex/database/schema.lua

Phase 3.4: Core Implementation - Parser Layer

  • T017 [P] YAML header parser in lua/notex/parser/yaml.lua
  • T018 [P] Markdown content parser in lua/notex/parser/markdown.lua
  • T019 Parser coordination module in lua/notex/parser/init.lua
  • T020 Document indexing coordination in lua/notex/index/init.lua
  • T021 [P] File system scanner in lua/notex/index/scanner.lua
  • T022 [P] Incremental index updater in lua/notex/index/updater.lua

Phase 3.5: Core Implementation - Query Layer

  • T023 [P] Query syntax parser in lua/notex/query/parser.lua
  • T024 [P] SQL query builder in lua/notex/query/builder.lua
  • T025 [P] Query execution engine in lua/notex/query/executor.lua
  • T026 Query coordination module in lua/notex/query/init.lua

Phase 3.6: Core Implementation - UI Layer

  • T027 [P] Virtual buffer manager in lua/notex/ui/buffer.lua
  • T028 [P] Query result visualization in lua/notex/ui/view.lua
  • T029 [P] Inline editing interface in lua/notex/ui/editor.lua
  • T030 UI coordination module in lua/notex/ui/init.lua

Phase 3.7: Core Implementation - Plugin Integration

  • T031 [P] Utility functions in lua/notex/utils/init.lua
  • T032 [P] Date parsing and formatting in lua/notex/utils/date.lua
  • T033 [P] Type detection and conversion in lua/notex/utils/types.lua
  • T034 [P] Data validation helpers in lua/notex/utils/validation.lua
  • T035 Plugin entry point and setup in lua/notex/init.lua

Phase 3.8: Integration and Error Handling

  • T036 Connect database layer to parser layer
  • T037 Connect parser layer to query layer
  • T038 Connect query layer to UI layer
  • T039 Error handling and logging integration
  • T040 Performance optimization and caching

Phase 3.9: Polish and Documentation

  • T041 [P] Unit tests for utility functions in tests/unit/utils/
  • T042 [P] Unit tests for database operations in tests/unit/database/
  • T043 [P] Unit tests for parser functions in tests/unit/parser/
  • T044 [P] Unit tests for query operations in tests/unit/query/
  • T045 [P] Unit tests for UI components in tests/unit/ui/
  • T046 Performance tests (<100ms query execution)
  • T047 [P] Update README.md with installation and usage
  • T048 [P] Create comprehensive API documentation
  • T049 Remove code duplication and optimize
  • T050 Run quickstart.md manual testing scenarios

Dependencies

  • Setup (T001-T003) before everything
  • Tests (T004-T009) before all implementation (T010-T050)
  • Database layer (T010-T016) blocks parser layer (T017-T022)
  • Parser layer (T017-T022) blocks query layer (T023-T026)
  • Query layer (T023-T026) blocks UI layer (T027-T030)
  • UI layer (T027-T030) blocks plugin integration (T031-T035)
  • Integration (T036-T040) before polish (T041-T050)

Parallel Execution Examples

Phase 3.2 - Contract Tests (Parallel)

# Launch T004-T009 together:
Task: "Contract test query parsing API in tests/contract/test_query_api.lua"
Task: "Contract test query execution API in tests/contract/test_query_api.lua"
Task: "Contract test virtual buffer API in tests/contract/test_query_api.lua"
Task: "Integration test document indexing workflow in tests/integration/test_document_indexing.lua"
Task: "Integration test query workflow in tests/integration/test_query_workflow.lua"
Task: "Integration test virtual buffer workflow in tests/integration/test_virtual_buffer.lua"

Phase 3.3 - Database Models (Parallel)

# Launch T010-T016 together:
Task: "Database connection module in lua/notex/database/init.lua"
Task: "Database schema module in lua/notex/database/schema.lua"
Task: "Database migrations module in lua/notex/database/migrations.lua"
Task: "Document model implementation in lua/notex/database/schema.lua"
Task: "Property model implementation in lua/notex/database/schema.lua"
Task: "Query model implementation in lua/notex/database/schema.lua"
Task: "Schema model implementation in lua/notex/database/schema.lua"

Phase 3.4 - Parser Components (Parallel)

# Launch T017-T022 together:
Task: "YAML header parser in lua/notex/parser/yaml.lua"
Task: "Markdown content parser in lua/notex/parser/markdown.lua"
Task: "File system scanner in lua/notex/index/scanner.lua"
Task: "Incremental index updater in lua/notex/index/updater.lua"

Phase 3.9 - Unit Tests (Parallel)

# Launch T041-T045 together:
Task: "Unit tests for utility functions in tests/unit/utils/"
Task: "Unit tests for database operations in tests/unit/database/"
Task: "Unit tests for parser functions in tests/unit/parser/"
Task: "Unit tests for query operations in tests/unit/query/"
Task: "Unit tests for UI components in tests/unit/ui/"

Notes

  • [P] tasks = different files, no dependencies
  • Verify tests fail before implementing
  • Commit after each task
  • Avoid: vague tasks, same file conflicts
  • Follow constitutional principles: Clean Code, Functional Style, Descriptive Coding, Test-First Development, Performance by Design

Task Generation Rules Applied

  1. From Contracts:

    • query-api.md → contract tests T004-T006 [P]
    • API endpoints → implementation tasks T023-T030
  2. From Data Model:

    • Document entity → model task T013 [P]
    • Property entity → model task T014 [P]
    • Query entity → model task T015 [P]
    • Schema entity → model task T016 [P]
  3. From Research Decisions:

    • lsqlite3 dependency → setup task T002
    • lyaml dependency → parser task T017
    • busted framework → test tasks T004-T009
  4. From User Stories:

    • Document indexing → integration test T007 [P]
    • Query execution → integration test T008 [P]
    • Virtual buffer interaction → integration test T009 [P]
    • Quickstart scenarios → validation task T050
  5. Ordering Strategy:

    • Setup → Tests → Database → Parser → Query → UI → Integration → Polish
    • Dependencies block parallel execution

Validation Checklist

  • 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