graph TD
Start([Start: Tasks Docs Creation]) --> Phase1[Phase 1: CREATE tasks/README.md]
Phase1 --> CheckExists{README.md
exists?}
CheckExists -->|Yes| Preserved[Preserve existing
README.md]
CheckExists -->|No| CreateReadme[Create from template
+ replace DATE placeholder]
Preserved --> Phase2
CreateReadme --> Phase2
Phase2[Phase 2: Structure Validation
Auto-fix SCOPE tags, sections, Maintenance]
Phase2 --> AutoFix[Auto-fix violations:
SCOPE tags, required sections,
Maintenance, POSIX endings]
AutoFix --> Phase3[Phase 3: Content Validation
Semantic validation + Linear Configuration]
Phase3 --> ValidateReadme[Validate tasks/README.md sections:
Linear Integration, Task Workflow, Templates]
Phase3 --> CheckKanban{kanban_board.md
exists?}
CheckKanban -->|No| Summary
CheckKanban -->|Yes| LinearConfig[Linear Configuration
Special Handling]
LinearConfig --> PlaceholderCheck{Has placeholders
[TEAM_NAME/UUID/KEY]?}
PlaceholderCheck -->|Yes| InteractiveSetup[Interactive Setup Mode
User prompts + validation:
UUID regex, Team Key regex]
PlaceholderCheck -->|No| ValidationMode[Validation Mode
Check UUID/Team Key formats]
InteractiveSetup --> UpdateConfig[Replace placeholders
+ Set Epic/Story counters to 1]
ValidationMode --> EpicTracking
UpdateConfig --> EpicTracking[Validate Epic Tracking section]
EpicTracking --> Summary
ValidateReadme --> Summary[Notify: Task documentation
validated (3-phase complete)]
Summary --> End([End: ✓ Tasks docs created + validated])
%% Styling
classDef action fill:#C8E6C9,stroke:#388E3C,stroke-width:2px
classDef validation fill:#FFF9C4,stroke:#F57C00,stroke-width:2px
classDef decision fill:#FFE0B2,stroke:#E64A19,stroke-width:2px
class Phase1,CreateReadme,Preserved,AutoFix,InteractiveSetup,UpdateConfig,Summary action
class Phase2,Phase3,ValidateReadme,LinearConfig,ValidationMode,EpicTracking validation
class CheckExists,CheckKanban,PlaceholderCheck decision