mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
The LLM-backed commit-message and PR-text generators lived in the 6.6k-line session god-file but were consumed only by CheckoutSession, which reached them through two host callbacks (the host comment even flagged that it "does not own them"). The two methods were ~80% identical. Lift them into session/checkout/git-metadata-generator.ts as a deep module with a two-method interface, collapsing the duplicated diff -> fileList -> patch -> prompt -> generate -> fallback scaffold. The LLM call is now an injected StructuredTextGeneration port: production wires resolve-providers + structured generation; the new unit test injects a fake and exercises success, both fallback paths, and error rethrow without mocking any module. CheckoutSession takes the generator as a typed collaborator instead of two host callbacks; Session sheds ~160 lines plus five now-unused imports. Behaviour is unchanged — the existing session.test.ts generation tests pass untouched.