Export patch
Session.ExportPatch on the one SDK, pkg/abox.
Asks the agent to add a file, then ExportPatch (guest git diff vs the imported baseline).
package main
import (
"context"
"fmt"
"os"
"github.com/AdminTurnedDevOps/ABox/pkg/abox"
)
func main() {
ctx := context.Background()
sess, err := abox.Open(ctx, abox.Options{})
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
defer sess.Close()
_, err = sess.Turn(ctx, "Create a file named hello.txt with the text hi using a patch.", func(ev abox.Event) {
if ev.Kind == "text" {
fmt.Print(ev.Text)
}
})
fmt.Println()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
patch, summary, err := sess.ExportPatch(ctx)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println("summary:", summary)
fmt.Println(patch)
}