@@ -25,6 +25,7 @@ import (
2525 "github.com/entireio/cli/cmd/entire/cli/settings"
2626 "github.com/entireio/cli/cmd/entire/cli/strategy"
2727 "github.com/entireio/cli/cmd/entire/cli/trailers"
28+ "github.com/entireio/cli/cmd/entire/cli/transcript/compact"
2829 "github.com/entireio/cli/cmd/entire/cli/validation"
2930 "github.com/entireio/cli/cmd/entire/cli/versioninfo"
3031 "github.com/entireio/cli/perf"
@@ -737,3 +738,38 @@ func promptAmendCommit(ctx context.Context, w io.Writer, headCommit *object.Comm
737738 fmt .Fprintf (w , "Amended commit %s with Entire-Checkpoint: %s\n " , shortHash , checkpointIDStr )
738739 return nil
739740}
741+
742+ func compactTranscriptForStartLine (ctx context.Context , transcript []byte , m cpkg.CommittedMetadata , startLine int ) []byte {
743+ if len (transcript ) == 0 {
744+ return nil
745+ }
746+ if m .Agent == "" {
747+ logging .Warn (ctx , "compact transcript skipped: no agent type in checkpoint metadata" ,
748+ slog .String ("checkpoint_id" , string (m .CheckpointID )),
749+ )
750+ return nil
751+ }
752+
753+ compacted , err := compact .Compact (redact .AlreadyRedacted (transcript ), compact.MetadataFields {
754+ Agent : string (m .Agent ),
755+ CLIVersion : versioninfo .Version ,
756+ StartLine : startLine ,
757+ })
758+ if err != nil {
759+ logging .Warn (ctx , "compact transcript generation failed" ,
760+ slog .String ("checkpoint_id" , string (m .CheckpointID )),
761+ slog .String ("agent" , string (m .Agent )),
762+ slog .String ("error" , err .Error ()),
763+ )
764+ return nil
765+ }
766+ if len (compacted ) == 0 {
767+ logging .Warn (ctx , "transcript.jsonl generation produced no output" ,
768+ slog .String ("checkpoint_id" , string (m .CheckpointID )),
769+ slog .String ("agent" , string (m .Agent )),
770+ slog .Int ("input_bytes" , len (transcript )),
771+ )
772+ return nil
773+ }
774+ return compacted
775+ }
0 commit comments