build: wikitool new project - Seite und Tracker-Projekt unter einem Namen (#126)
CI / verify (push) Successful in 47s
Release / release (push) Successful in 35s

Files changed:
- CHANGES.md
- VERSION
- tools/CONTRACT.md
- tools/chemenu/commands/new_page.py
- tools/chemenu/errors.py
- tools/chemenu/review.py
- tools/chemenu/tasks/__init__.py
- tools/chemenu/tests/test_new_page.py
This commit is contained in:
torben committed 2026-09-20 07:32:03 +02:00
1 parent 80b57e0d01
commit e4260fc2de
8 files changed
+342 -24

No files matched your search

+36 -2
View File
@@ -4,9 +4,43 @@
loops (#119 D1). This package is the one place `wikitool` crosses that line -
never an instruction, never a second MCP server (#119 D25): a provider is a
Python object behind `chemenu.tasks.protocol.TaskReader`/`TaskWriter`, and
everything above this package (the future `wikitool review`/`new project`
commands, #125/#126) talks to that protocol and nothing provider-specific.
everything above this package (`wikitool review`/`new project`, #125/#126)
talks to that protocol and nothing provider-specific.
No command lives here yet - this package is a library, per #124's own scope
note ("Kein Kommando. Diese Schicht ist Bibliothek").
`build_reader`/`build_writer` below are the one dispatch table from
`TasksConfig.provider` to a concrete adapter, shared by `chemenu.review`
(#125) and `chemenu.commands.new_page`'s `project` handling (#126) - kept in
one place per `AGENTS.md` invariant 8, rather than two copies of the same
`if cfg.provider == "superproductivity": ...` drifting apart.
"""
from __future__ import annotations
from chemenu.errors import ValidationError
from chemenu.tasks.config import TasksConfig
from chemenu.tasks.protocol import TaskReader, TaskWriter
def build_reader(cfg: TasksConfig) -> TaskReader:
"""Dispatch on `cfg.provider` to a concrete `TaskReader`."""
if cfg.provider == "superproductivity":
from chemenu.tasks import superproductivity as sp
sp_cfg = sp.SuperProductivityConfig.from_dict(cfg.provider_config)
return sp.SuperProductivityReader(sp_cfg)
raise ValidationError(f"No reader is wired up for task provider {cfg.provider!r}.")
def build_writer(cfg: TasksConfig, reader: TaskReader) -> TaskWriter:
"""Dispatch on `cfg.provider` to a concrete `TaskWriter`, over an
already-built `reader` - a writer that needs to re-check the read path
(e.g. `SuperProductivityWriter`'s own collision preflight) reads through
the same object its caller does, rather than opening a second one."""
if cfg.provider == "superproductivity":
from chemenu.tasks import superproductivity as sp
sp_cfg = sp.SuperProductivityConfig.from_dict(cfg.provider_config)
return sp.SuperProductivityWriter(sp_cfg, reader)
raise ValidationError(f"No writer is wired up for task provider {cfg.provider!r}.")