Milestone: #83
Depends on: #90
Context
src/tycoon/commands/sources.py, run_all.py, sync_cmd.py, explore.py all use from tycoon.config import config and access config.sources, config.raw_db, config.root. The singleton is constructed at import time, which complicates testing and prevents the project path from being determined at invocation time.
Goal
In each of the four files, replace the module-level config import with local load_project() calls inside each command function body. Pattern:
# Before
from tycoon.config import config
def list_sources(...):
_require_project()
sources = config.sources
# After
from tycoon.project import load_project
def _require_project_here():
root = _find_project_root() # walk up from cwd looking for tycoon.yml
project = load_project(root)
if project is None:
error("No tycoon.yml found. Run 'tycoon init' first.")
raise typer.Exit(1)
return project, root
def list_sources(...):
project, root = _require_project_here()
sources = project.sources
The TycoonConfig class and config singleton remain unchanged in config.py — this is a partial migration.
Acceptance
pytest tests/test_sources.py passes without monkey-patching the config singleton
tycoon data sources list works in a temp directory with a valid tycoon.yml
Milestone: #83
Depends on: #90
Context
src/tycoon/commands/sources.py,run_all.py,sync_cmd.py,explore.pyall usefrom tycoon.config import configand accessconfig.sources,config.raw_db,config.root. The singleton is constructed at import time, which complicates testing and prevents the project path from being determined at invocation time.Goal
In each of the four files, replace the module-level
configimport with localload_project()calls inside each command function body. Pattern:The
TycoonConfigclass andconfigsingleton remain unchanged inconfig.py— this is a partial migration.Acceptance
pytest tests/test_sources.pypasses without monkey-patching theconfigsingletontycoon data sources listworks in a temp directory with a validtycoon.yml