Skip to content

Extract inline Markdown/JSON/YAML templates out of writers.py and adapters.py #1

@JRS1986

Description

@JRS1986

Context

src/coding_scaffold/writers.py is ~864 lines, of which roughly 700 are multi-line string literals. src/coding_scaffold/adapters.py follows the same pattern with embedded TypeScript and Markdown. Real logic is buried under template walls, diffs are noisy, and the templates themselves can't be linted, syntax-highlighted properly, or previewed standalone.

Recommendation

  • Move templates into src/coding_scaffold/templates/ as real .md, .json, .yaml, .ts, and .txt files.
  • Load via importlib.resources.files("coding_scaffold.templates").joinpath(...).
  • Use str.format or a small placeholder helper for variable substitution ({weak_model}, {strong_model}, {routine_threshold}).
  • Keep modules focused on orchestration (read inputs, pick template, fill placeholders, write output).

Verification

  • writers.py and adapters.py shrink to a few hundred lines each.
  • All 51 tests still pass.
  • git grep -n '\"\"\"' src/coding_scaffold/writers.py src/coding_scaffold/adapters.py returns far fewer matches.
  • Templates are visible/editable without scrolling through Python.

Carry-over from prior code review (F4).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions