Refactoring
Natural invoke
- "Extract analysis logic from scripts/ into src/"
- "Split infrastructure/validation monolith into smaller modules"
- "Rename public API with all call sites updated"
Inputs to confirm
- Scope — paths/modules affected.
- Behavior — preserve externally observable behavior unless user requests breaking change.
Workflow
Baseline — run tests on scope; record coverage.
Move logic — from scripts to
src/orinfrastructure/; keep orchestrators thin.Update imports — repo-wide grep; fix tests and docs.
Migration — if breaking, document in project/infrastructure AGENTS.md; no silent API removal.
Verify — pytest + ruff/mypy on public scope paths; pipeline smoke if project scripts moved.
Deliverables
- Before/after structure summary
- Test command output showing pass + coverage maintained
Verification commands
uv run pytest <affected-test-path> -v
uv run python -m infrastructure.project.public_scope lint-paths | xargs uv run ruff check
uv run python scripts/pipeline/stage_01_test.py --project <project> # when project scope
When NOT to use
- New capability → feature-addition
- Docs-only restructure → documentation-creation
References
docs/core/architecture.md- Module line-count gate:
uv run python scripts/gates/module_line_count_check.py