moai/.planning/phases/01-foundation/01-01-PLAN.md
Mikkel Georgsen c48eb1cea7 docs(01): create phase 1 foundation plans
Phase 1: Foundation
- 3 plans created
- 9 total tasks defined
- Ready for execution

Plan 01: Project scaffolding (pyproject.toml, pre-commit, src layout)
Plan 02: SQLAlchemy models (Project, Discussion, Round, Message, Consensus)
Plan 03: Database setup and model tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:57:27 +00:00

132 lines
4 KiB
Markdown

---
phase: 01-foundation
plan: 01
type: execute
---
<objective>
Set up project scaffolding with pyproject.toml, ruff, pre-commit, and src layout.
Purpose: Establish consistent tooling from day one—linting, formatting, testing infrastructure.
Output: Working Python project structure with `uv sync` installing all deps, ruff/pre-commit configured.
</objective>
<execution_context>
~/.claude/get-shit-done/workflows/execute-phase.md
~/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@SPEC.md
@CLAUDE.md
**Constraints from PROJECT.md:**
- Python 3.11+
- ruff (line length 100)
- pytest, 80%+ coverage on core logic
- Type hints required on public functions
- Docstrings required on modules and classes
- Dependencies unpinned unless security required
</context>
<tasks>
<task type="auto">
<name>Task 1: Create pyproject.toml with dependencies and tool config</name>
<files>pyproject.toml</files>
<action>
Create pyproject.toml with:
**[project] section:**
- name = "moai"
- version = "0.1.0"
- description = "Multi-AI collaborative brainstorming platform"
- requires-python = ">=3.11"
- dependencies: python-telegram-bot, sqlalchemy, httpx, aiosqlite (for async SQLite)
**[project.optional-dependencies]:**
- dev: pytest, pytest-cov, pytest-asyncio, ruff, pre-commit
**[tool.ruff] section:**
- line-length = 100
- target-version = "py311"
**[tool.ruff.lint]:**
- select = ["E", "F", "I", "N", "W", "UP"]
**[tool.pytest.ini_options]:**
- testpaths = ["tests"]
- asyncio_mode = "auto"
**[build-system]:**
- requires = ["hatchling"]
- build-backend = "hatchling.build"
Use hatchling as build backend (modern, works well with uv).
Do NOT pin dependency versions.
</action>
<verify>uv sync completes without errors</verify>
<done>pyproject.toml valid, all dependencies installable</done>
</task>
<task type="auto">
<name>Task 2: Create pre-commit configuration</name>
<files>.pre-commit-config.yaml</files>
<action>
Create .pre-commit-config.yaml with:
**Hooks:**
1. ruff (linting): repo = https://github.com/astral-sh/ruff-pre-commit, hooks = [ruff, ruff-format]
2. Standard pre-commit hooks: trailing-whitespace, end-of-file-fixer, check-yaml
Use latest rev for ruff-pre-commit (check GitHub for current version, approximately v0.11.x).
Do NOT add pytest hook—running tests on every commit is too slow. Tests run manually or in CI.
</action>
<verify>pre-commit install && pre-commit run --all-files passes</verify>
<done>Pre-commit hooks installed and passing</done>
</task>
<task type="auto">
<name>Task 3: Create src layout and package structure</name>
<files>src/moai/__init__.py, src/moai/bot/__init__.py, src/moai/bot/handlers/__init__.py, src/moai/core/__init__.py, tests/__init__.py</files>
<action>
Create directory structure per SPEC.md:
src/moai/__init__.py - Package marker with __version__ = "0.1.0"
src/moai/bot/__init__.py - Bot subpackage marker (docstring: "Telegram bot handlers and entry point")
src/moai/bot/handlers/__init__.py - Handlers subpackage marker
src/moai/core/__init__.py - Core subpackage marker (docstring: "Core business logic, models, and services")
tests/__init__.py - Test package marker
Each __init__.py should have a module docstring describing its purpose.
Use triple-quoted docstrings at the top of each file.
</action>
<verify>python -c "import moai; print(moai.__version__)" prints "0.1.0"</verify>
<done>Package importable, structure matches SPEC.md</done>
</task>
</tasks>
<verification>
Before declaring plan complete:
- [ ] `uv sync` succeeds without errors
- [ ] `pre-commit run --all-files` passes
- [ ] `python -c "import moai"` succeeds
- [ ] `ruff check src tests` passes
- [ ] Directory structure matches SPEC.md file structure
</verification>
<success_criteria>
- All tasks completed
- All verification checks pass
- No linting errors
- Package installable and importable
</success_criteria>
<output>
After completion, create `.planning/phases/01-foundation/01-01-SUMMARY.md`
</output>