@@ -2498,10 +2498,16 @@ function goEncodingBlocksCode(blocks: string[] | undefined): string {
24982498 return joinGoCode ( lines ) ;
24992499}
25002500
2501+ function goDoNotEditHeader ( schemaFileName : string ) : string [ ] {
2502+ return [
2503+ `// Code generated by scripts/codegen/go.ts; DO NOT EDIT.` ,
2504+ `// Source: ${ schemaFileName } ` ,
2505+ ] ;
2506+ }
2507+
25012508function goGeneratedEncodingFileCode ( schemaFileName : string , packageName : string , generatedEncodingCode : string , wrapComments = false ) : string {
25022509 const lines : string [ ] = [ ] ;
2503- lines . push ( `// AUTO-GENERATED FILE - DO NOT EDIT` ) ;
2504- lines . push ( `// Generated from: ${ schemaFileName } ` ) ;
2510+ lines . push ( ...goDoNotEditHeader ( schemaFileName ) ) ;
25052511 lines . push ( `` ) ;
25062512 lines . push ( `package ${ packageName } ` ) ;
25072513 lines . push ( `` ) ;
@@ -2692,8 +2698,7 @@ function generateGoSessionEventsCode(schema: JSONSchema7): GoGeneratedTypeCode {
26922698
26932699 // Assemble file
26942700 const out : string [ ] = [ ] ;
2695- out . push ( `// AUTO-GENERATED FILE - DO NOT EDIT` ) ;
2696- out . push ( `// Generated from: session-events.schema.json` ) ;
2701+ out . push ( ...goDoNotEditHeader ( "session-events.schema.json" ) ) ;
26972702 out . push ( `` ) ;
26982703 out . push ( `package copilot` ) ;
26992704 out . push ( `` ) ;
@@ -2895,7 +2900,7 @@ async function generateSessionEvents(schemaPath?: string): Promise<void> {
28952900 const generatedTypeCode = stripTrailingGoWhitespace ( generatedSessionCode . typeCode ) ;
28962901 const generatedEncodingCode = stripTrailingGoWhitespace ( generatedSessionCode . encodingCode ) ;
28972902
2898- const outPath = await writeGeneratedFile ( "go/generated_session_events .go" , generatedTypeCode ) ;
2903+ const outPath = await writeGeneratedFile ( "go/zsession_events .go" , generatedTypeCode ) ;
28992904 console . log ( ` ✓ ${ outPath } ` ) ;
29002905
29012906 await formatGoFile ( outPath ) ;
@@ -3058,8 +3063,7 @@ async function generateRpc(schemaPath?: string): Promise<void> {
30583063
30593064 // Build method wrappers
30603065 const lines : string [ ] = [ ] ;
3061- lines . push ( `// AUTO-GENERATED FILE - DO NOT EDIT` ) ;
3062- lines . push ( `// Generated from: api.schema.json` ) ;
3066+ lines . push ( ...goDoNotEditHeader ( "api.schema.json" ) ) ;
30633067 lines . push ( `` ) ;
30643068 lines . push ( `package rpc` ) ;
30653069 lines . push ( `` ) ;
@@ -3102,7 +3106,7 @@ async function generateRpc(schemaPath?: string): Promise<void> {
31023106 emitClientSessionApiRegistration ( lines , schema . clientSession , resolveType ) ;
31033107 }
31043108
3105- const outPath = await writeGeneratedFile ( "go/rpc/generated_rpc .go" , wrapGeneratedGoComments ( lines . join ( "\n" ) ) ) ;
3109+ const outPath = await writeGeneratedFile ( "go/rpc/zrpc .go" , wrapGeneratedGoComments ( lines . join ( "\n" ) ) ) ;
31063110 console . log ( ` ✓ ${ outPath } ` ) ;
31073111
31083112 await formatGoFile ( outPath ) ;
0 commit comments