1- export interface Trailer {
2- readonly key : string ;
3- readonly value : string ;
4- }
1+ import { Schema } from "effect" ;
2+
3+ export const Trailer = Schema . Struct ( {
4+ key : Schema . String ,
5+ value : Schema . String ,
6+ } ) ;
7+
8+ export type Trailer = typeof Trailer . Type ;
59
610export const parseTrailerText = ( input : string ) : Trailer | undefined => {
711 const separator = ": " ;
@@ -22,28 +26,40 @@ export const parseTrailerText = (input: string): Trailer | undefined => {
2226 } ;
2327} ;
2428
25- export interface CommitMessage {
26- readonly title : string ;
27- readonly bullets : ReadonlyArray < string > ;
28- readonly explanation : string ;
29- }
30-
31- export interface CommitGroup {
32- readonly files : ReadonlyArray < string > ;
33- readonly message : CommitMessage | undefined ;
34- }
35-
36- export interface CommitPlan {
37- readonly groups : ReadonlyArray < CommitGroup > ;
38- }
39-
40- export interface SingleCommitResult {
41- readonly title : string ;
42- readonly bullets : ReadonlyArray < string > ;
43- readonly explanation : string ;
44- readonly files : ReadonlyArray < string > ;
45- readonly output : string | undefined ;
46- }
29+ export const CommitMessage = Schema . Struct ( {
30+ title : Schema . String ,
31+ bullets : Schema . Array ( Schema . String ) ,
32+ explanation : Schema . String ,
33+ } ) ;
34+
35+ export type CommitMessage = typeof CommitMessage . Type ;
36+
37+ export const CommitGroup = Schema . Struct ( {
38+ files : Schema . Array ( Schema . String ) ,
39+ message : CommitMessage . pipe ( Schema . UndefinedOr ) ,
40+ } ) ;
41+
42+ export type CommitGroup = typeof CommitGroup . Type ;
43+
44+ export const CommitPlan = Schema . Struct ( {
45+ groups : Schema . Array ( CommitGroup ) ,
46+ } ) ;
47+
48+ export type CommitPlan = typeof CommitPlan . Type ;
49+
50+ export const SingleCommitResult = Schema . Struct ( {
51+ title : Schema . String ,
52+ bullets : Schema . Array ( Schema . String ) ,
53+ explanation : Schema . String ,
54+ files : Schema . Array ( Schema . String ) ,
55+ output : Schema . String . pipe ( Schema . UndefinedOr ) ,
56+ } ) ;
57+
58+ export type SingleCommitResult = typeof SingleCommitResult . Type ;
59+
60+ export const CommitResponse = Schema . Array ( SingleCommitResult ) ;
61+
62+ export type CommitResponse = typeof CommitResponse . Type ;
4763
4864export const renderCommitBody = ( message : CommitMessage ) : string => {
4965 const bulletSection = message . bullets . map ( ( bullet ) => `- ${ bullet } ` ) . join ( "\n" ) ;
0 commit comments