Story: Refactor ores.codegen: merge generator.py into codegen/ package

Table of Contents

This page documents a story in Sprint 21. It captures the goal, current status, acceptance criteria, and the tasks that compose it.

Goal

Eliminate the structural coupling between codegen/generate.py and the top-level generator.py monolith. After this story, generator.py does not exist; all generation logic lives inside the codegen/ package and is importable without sys.path manipulation. Tooling (mypy, pytest, editors) can resolve all symbols normally.

Status

Field Value
State DONE
Parent sprint Sprint 21
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-06-26

Acceptance

  • src/codegen/core.py exists and contains all generation functions.
  • src/generator.py is deleted.
  • codegen/generate.py imports from .core with no sys.path manipulation.
  • python3 -c "from codegen import generate" succeeds.
  • codegen generate --profile protocol --entity country produces zero diff.

Decisions

  • Moved all content into a single codegen/core.py rather than splitting into sub-modules (model_types.py, profiles.py, etc.). The story asked for the merge; splitting is a separate future refactor.
  • Deleted the legacy main() function that existed in generator.py — it duplicated CLI functionality now handled by codegen/cli.py and was never called via the normal entry point.

Tasks

Task State Start End Description
Scaffold story: Refactor ores.codegen: merge generator.py into codegen/ package DONE 2026-06-26 2026-06-26 Story scaffolding rides this task: documents, sprint wiring, and the scaffold PR. Close it before merging that PR.
Move generator.py logic into codegen/ package and delete the monolith DONE 2026-06-26 2026-06-26 Initial task for: Refactor ores.codegen: merge generator.py into codegen/ package
Add compass codegen pillar: wrap codegen generate/regenerate DONE 2026-06-26 2026-06-26 Add compass codegen generate and compass codegen regenerate subcommands that invoke the codegen Python functions directly, making compass the single documented entry point for code generation.
Add compass codegen entity sub-commands: list, add, generate, show, diff DONE 2026-06-26 2026-06-26 compass codegen entity sub-commands for entity management grouped by model type (domain_entity/junction vs meta-entities): list, add, generate (all profiles), show (staleness), diff (git).

Decisions

Out of scope

Emacs 29.1 (Org mode 9.6.6)