Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
handling uncommitted changes, buncha fixes, basis for flexibile builds/rebuilds
Dane Schneideraaf489a2b548
diff --git a/cli/cmd/apply.go b/cli/cmd/apply.goindex 660c4ebd..833600e7 100644--- a/cli/cmd/apply.go+++ b/cli/cmd/apply.go@@ -10,7 +10,6 @@ import ("plandex/types""strings"- "github.com/erikgeiser/promptkit/selection""github.com/fatih/color""github.com/olekukonko/tablewriter""github.com/spf13/cobra"@@ -70,8 +69,9 @@ func apply(cmd *cobra.Command, args []string) error {return fmt.Errorf("error getting current plan files: %w", err)}- // check if any files have been modified since the plan result was generated+ aborted := false+ // check if any files have been modified since the plan result was generatedpathsRemoved := []string{}pathsOutdated := []string{}pathsUnmodified := []string{}@@ -123,55 +123,66 @@ func apply(cmd *cobra.Command, args []string) error {table.SetHeader([]string{"Path", "Status"})table.SetAutoWrapText(false)- var unmodifiedLabel = "Unmodified"-- hasConflicts := (len(pathsRemoved) + len(pathsOutdated)) > 0+ numConflicts := len(pathsRemoved) + len(pathsOutdated)+ hasConflicts := numConflicts > 0if hasConflicts {- fmt.Println("⚠️ Files in context have been modified since the plan was generated")- fmt.Println()+ suffix := ""+ verb := "has"+ if numConflicts > 1 {+ suffix = "s"+ verb = "have"+ }++ color.New(color.Bold).Printf("⚠️ %d file%s in context %s been modified since the plan was generated\n\n", numConflicts, suffix, verb)for _, path := range pathsRemoved {table.Rich([]string{path, "🔴 Removed"}, []tablewriter.Colors{{tablewriter.FgHiRedColor, tablewriter.Bold},- {tablewriter.FgHiRedColor},+ {tablewriter.FgHiWhiteColor},})}for _, path := range pathsOutdated {- table.Rich([]string{path, "🟠 Modified"}, []tablewriter.Colors{+ table.Rich([]string{path, "🟡 Modified"}, []tablewriter.Colors{{tablewriter.FgHiYellowColor, tablewriter.Bold},- {tablewriter.FgHiYellowColor},+ {tablewriter.FgHiWhiteColor},})}} else {- fmt.Printf("⚡️ %d files will be updated\n\n", len(pathsUnmodified)+len(pathsNew))- unmodifiedLabel = "Changes"+ numUnmodified := len(pathsUnmodified) + len(pathsNew)+ suffix := ""++ if numUnmodified > 1 {+ suffix = "s"+ }++ color.New(color.Bold).Printf("⚡️ %d file%s will be updated\n\n", numUnmodified, suffix)}- for _, path := range pathsNew {- table.Rich([]string{path, "🟢 New File"}, []tablewriter.Colors{+ for _, path := range pathsUnmodified {+ table.Rich([]string{path, "🟢 Ready for update"}, []tablewriter.Colors{{tablewriter.FgHiGreenColor, tablewriter.Bold},- {tablewriter.FgHiGreenColor},+ {tablewriter.FgHiWhiteColor},})}- for _, path := range pathsUnmodified {- table.Rich([]string{path, "🔵 " + unmodifiedLabel}, []tablewriter.Colors{+ for _, path := range pathsNew {+ table.Rich([]string{path, "🔵 New file"}, []tablewriter.Colors{{tablewriter.FgHiCyanColor, tablewriter.Bold},- {tablewriter.FgHiCyanColor},+ {tablewriter.FgHiWhiteColor},})}table.Render()- var conflictStrategy types.PlanOutdatedStrategy+ var conflictStrategy stringif hasConflicts {fmt.Println()if conflictStrategy == "" {- options := []types.PlanOutdatedStrategy{+ options := []string{types.PlanOutdatedStrategyOverwrite,}@@ -184,13 +195,10 @@ func apply(cmd *cobra.Command, args []string) error {types.PlanOutdatedStrategyCancel,)- sp := selection.New("🤔 How do you want to handle it?", options)- sp.Filter = nil+ choice, err := lib.SelectFromList("🤔 How do you want to handle it?", options)- choice, err := sp.RunPrompt()if err != nil {- fmt.Printf("Error selecting choice: %v\n", err)- os.Exit(1)+ return fmt.Errorf("failed to get user input: %w", err)}conflictStrategy = choice@@ -199,16 +207,16 @@ func apply(cmd *cobra.Command, args []string) error {switch conflictStrategy {case types.PlanOutdatedStrategyOverwrite:- fmt.Println("⚡️ Will force apply and overwrite modifications")+ fmt.Println("⚡️ Overwriting modifications")case types.PlanOutdatedStrategyApplyUnmodified:- fmt.Println("⚡️ Will apply only new and unmodified files")+ fmt.Println("⚡️ Applying only new and unmodified files")case types.PlanOutdatedStrategyRebuild:- fmt.Println("⚡️ Will rebuild the plan with updated context")+ fmt.Println("⚡️ Rebuilding the plan with updated context")case types.PlanOutdatedStrategyCancel:- fmt.Println("🛑 Will abort and exit")+ aborted = truereturn nil}@@ -222,21 +230,6 @@ func apply(cmd *cobra.Command, args []string) error {if err != nil {return fmt.Errorf("error checking for uncommitted changes: %w", err)}-- if hasUncommittedChanges {- // If there are uncommitted changes, stash them- err := lib.GitStashCreate("Plandex auto-stash")- if err != nil {- return fmt.Errorf("failed to create git stash: %w", err)- }-- defer func() {- err := lib.GitStashPop(conflictStrategy)- if err != nil {- fmt.Printf("failed to pop git stash: %v\n", err)- }- }()- }}toApply := map[string]string{}@@ -255,42 +248,75 @@ func apply(cmd *cobra.Command, args []string) error {fmt.Println("🤷♂️ No changes to apply")} else {if !autoConfirm && !hasConflicts {- shouldContinue, err := lib.ConfirmYesNo("Apply changes to %d files?", len(toApply))+ fmt.Println()+ numToApply := len(toApply)+ suffix := ""+ if numToApply > 1 {+ suffix = "s"+ }+ shouldContinue, err := lib.ConfirmYesNo("Apply changes to %d file%s?", numToApply, suffix)if err != nil {return fmt.Errorf("failed to get confirmation user input: %s", err)}if !shouldContinue {- fmt.Println("🚫 Will abort and exit")+ aborted = truereturn nil}}+ if isRepo && hasUncommittedChanges {+ // If there are uncommitted changes, stash them+ err := lib.GitStashCreate("Plandex auto-stash")+ if err != nil {+ return fmt.Errorf("failed to create git stash: %w", err)+ }++ defer func() {+ if aborted {+ // clear any partially applied changes before popping the stash+ err := lib.GitClearUncommittedChanges()+ if err != nil {+ fmt.Printf("failed to clear uncommitted changes: %v\n", err)+ }+ }++ err := lib.GitStashPop(conflictStrategy)+ if err != nil {+ fmt.Printf("failed to pop git stash: %v\n", err)+ }+ }()+ }+for path, content := range toApply {// Compute destination pathdstPath := filepath.Join(lib.ProjectRoot, path)// Write the fileerr = os.WriteFile(dstPath, []byte(content), 0644)if err != nil {+ aborted = truereturn fmt.Errorf("failed to write %s: %w", dstPath, err)}}err := lib.SetPendingResultsApplied(planResByPath)if err != nil {+ aborted = truereturn fmt.Errorf("failed to set pending results applied: %w", err)}if isRepo {desc, err := lib.GetLatestPlanDescription()if err != nil {+ aborted = truereturn fmt.Errorf("failed to get latest plan description: %w", err)}// Commit the changeserr = lib.GitAddAndCommit(lib.ProjectRoot, color.New(color.BgBlue, color.FgHiWhite, color.Bold).Sprintln(" 🤖 Plandex ")+desc.CommitMsg, true)if err != nil {+ aborted = truereturn fmt.Errorf("failed to commit changes: %w", err)}}diff --git a/cli/cmd/tell.go b/cli/cmd/tell.goindex 7a70c008..c8e62a76 100644--- a/cli/cmd/tell.go+++ b/cli/cmd/tell.go@@ -57,10 +57,15 @@ func tell(cmd *cobra.Command, args []string) {return}- instruction := "Write your prompt below, then save and exit to send it to Plandex.\n\n"- _, err = tempFile.WriteString(instruction)+ instructions := getEditorInstructions(editor)+ filename := tempFile.Name()+ err = os.WriteFile(filename, []byte(instructions), 0644)+ if err != nil {+ fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)+ return+ }- editorCmd := prepareEditorCommand(editor, tempFile.Name())+ editorCmd := prepareEditorCommand(editor, filename)editorCmd.Stdin = os.StdineditorCmd.Stdout = os.StdouteditorCmd.Stderr = os.Stderr@@ -84,75 +89,33 @@ func tell(cmd *cobra.Command, args []string) {return}- prompt = strings.TrimPrefix(prompt, strings.TrimSpace(instruction))+ prompt = strings.TrimPrefix(prompt, strings.TrimSpace(instructions))prompt = strings.TrimSpace(prompt)if prompt != "" {- fmt.Print("Prompt:\n\n")+ fmt.Print("\n\n")+ fmt.Print(lib.GetDivisionLine())+ fmt.Print("\n\n")fmt.Println(prompt)+ fmt.Print("\n\n")+ fmt.Print(lib.GetDivisionLine())+ fmt.Print("\n\n")}}if prompt == "" {- fmt.Fprintln(os.Stderr, "🤷♂️ No prompt to send.")+ fmt.Fprintln(os.Stderr, "🤷♂️ No prompt to send")return}- // fmt.Println("lib.Propose(prompt)")-err := lib.Propose(prompt)if err != nil {fmt.Fprintln(os.Stderr, "Prompt error:", err)return}-- // fmt.Println("lib.Propose(prompt) success")}func prepareEditorCommand(editor string, filename string) *exec.Cmd {- switch editor {- case "vim":- vimInstructions := "Write your prompt below, then save and exit to send it to Plandex.\n\n" +- "Vim Instructions:\n" +- "Use the arrow keys or 'hjkl' to navigate around the text.\n" +- "Press 'i' to enter 'Insert' mode and start typing your prompt.\n" +- "To exit 'Insert' mode and go back to 'Normal' mode, press 'Esc'.\n" +- "In 'Normal' mode, type ':wq' followed by 'Enter' key to save and exit.\n" +- "If you want to exit without saving, type ':q!' followed by 'Enter'."-- // Write the Vim specific instructions into the temporary file- err := os.WriteFile(filename, []byte(vimInstructions), 0644)- if err != nil {- fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)- return nil- }-- return exec.Command(editor, filename)-- case "nano":- nanoInstructions := "Write your prompt below, then save and exit to send it to Plandex.\n\n" +- "Nano Instructions:\n" +- "Use the arrow keys to navigate around the text.\n" +- "Type your prompt as needed.\n" +- "When you're ready, press 'Ctrl + O' to save the file, then 'Enter' to confirm.\n" +- "Finally, press 'Ctrl + X' to exit Nano and send your prompt."-- // Write the Nano specific instructions into the temporary file- err := os.WriteFile(filename, []byte(nanoInstructions), 0644)- if err != nil {- fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)- return nil- }-- return exec.Command(editor, filename)- default:- return exec.Command(editor, filename)- }- if err != nil {- fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)- return nil- }-switch editor {case "vim":return exec.Command(editor, "+normal G$", "+startinsert!", filename)@@ -162,3 +125,31 @@ func prepareEditorCommand(editor string, filename string) *exec.Cmd {return exec.Command(editor, filename)}}++func getEditorInstructions(editor string) string {++ return "Write your prompt below, then save and exit to send it to Plandex.\n\n"++ // var instructions string++ // switch editor {+ // case "vim":+ // instructions = "Write your prompt below, then save and exit to send it to Plandex.\n\n" ++ // "Vim Instructions:\n" ++ // "Use the arrow keys or 'hjkl' to navigate around the text.\n" ++ // "Press 'i' to enter 'Insert' mode and start typing your prompt.\n" ++ // "To exit 'Insert' mode and go back to 'Normal' mode, press 'Esc'.\n" ++ // "In 'Normal' mode, type ':wq' followed by 'Enter' key to save, exit, and send your prompt.\n" ++ // "If you want to exit without saving, type ':q!' followed by 'Enter'."++ // case "nano":+ // instructions = "Write your prompt below, then save and exit to send it to Plandex.\n\n" ++ // "Nano Instructions:\n" ++ // "Use the arrow keys to navigate around the text.\n" ++ // "Type your prompt as needed.\n" ++ // "When you're ready, press 'Ctrl + O' to save the file, then 'Enter' to confirm.\n" ++ // "Finally, press 'Ctrl + X' to exit Nano and send your prompt."+ // }++ // return instructions+}diff --git a/cli/go.mod b/cli/go.modindex 54c21b41..6702425a 100644--- a/cli/go.mod+++ b/cli/go.mod@@ -3,41 +3,42 @@ module plandexgo 1.21.3require (- github.com/charmbracelet/lipgloss v0.7.1- github.com/davecgh/go-spew v1.1.1- github.com/fatih/color v1.13.0+ github.com/charmbracelet/lipgloss v0.9.1+ github.com/fatih/color v1.16.0github.com/looplab/fsm v1.0.1github.com/olekukonko/tablewriter v0.0.5- github.com/spf13/cobra v1.7.0- golang.org/x/term v0.12.0+ github.com/plandex-ai/survey/v2 v2.0.0-00010101000000-000000000000+ github.com/spf13/cobra v1.8.0+ golang.org/x/term v0.14.0)require (github.com/alecthomas/chroma v0.10.0 // indirect- github.com/andybalholm/cascadia v1.3.1 // indirect- github.com/atotto/clipboard v0.1.4 // indirect+ github.com/andybalholm/cascadia v1.3.2 // indirectgithub.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirectgithub.com/aymerick/douceur v0.2.0 // indirectgithub.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirectgithub.com/dlclark/regexp2 v1.10.0 // indirect- github.com/google/uuid v1.3.0 // indirect- github.com/gorilla/css v1.0.0 // indirect+ github.com/google/uuid v1.4.0 // indirect+ github.com/gorilla/css v1.0.1 // indirect+ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirectgithub.com/lucasb-eyer/go-colorful v1.2.0 // indirect- github.com/mattn/go-colorable v0.1.12 // indirect- github.com/mattn/go-isatty v0.0.19 // indirect+ github.com/mattn/go-colorable v0.1.13 // indirect+ github.com/mattn/go-isatty v0.0.20 // indirectgithub.com/mattn/go-localereader v0.0.1 // indirect- github.com/microcosm-cc/bluemonday v1.0.21 // indirect+ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect+ github.com/microcosm-cc/bluemonday v1.0.26 // indirectgithub.com/mitchellh/go-homedir v1.1.0 // indirectgithub.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirectgithub.com/muesli/cancelreader v0.2.2 // indirectgithub.com/muesli/reflow v0.3.0 // indirectgithub.com/muesli/termenv v0.15.2 // indirectgithub.com/rivo/uniseg v0.4.4 // indirect- github.com/yuin/goldmark v1.5.2 // indirect- github.com/yuin/goldmark-emoji v1.0.1 // indirect- golang.org/x/net v0.7.0 // indirect- golang.org/x/sync v0.3.0 // indirect- golang.org/x/sys v0.12.0 // indirect+ github.com/yuin/goldmark v1.6.0 // indirect+ github.com/yuin/goldmark-emoji v1.0.2 // indirect+ golang.org/x/net v0.18.0 // indirect+ golang.org/x/sync v0.5.0 // indirect+ golang.org/x/sys v0.14.0 // indirect)require (@@ -48,14 +49,15 @@ require (github.com/charmbracelet/glamour v0.6.0github.com/charmbracelet/glow v1.5.1github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203- github.com/erikgeiser/promptkit v0.9.0github.com/inconshreveable/mousetrap v1.1.0 // indirectgithub.com/mattn/go-runewidth v0.0.15 // indirectgithub.com/pkoukk/tiktoken-go v0.1.6 // indirectgithub.com/plandex/plandex/shared v0.0.0-00010101000000-000000000000- github.com/sashabaranov/go-openai v1.15.1+ github.com/sashabaranov/go-openai v1.17.7github.com/spf13/pflag v1.0.5 // indirectgolang.org/x/text v0.14.0 // indirect)replace github.com/plandex/plandex/shared => ../shared++replace github.com/plandex-ai/survey/v2 => ../../surveydiff --git a/cli/go.sum b/cli/go.sumindex a2fb830e..3d72c2b7 100644--- a/cli/go.sum+++ b/cli/go.sum@@ -184,6 +184,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=+github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=+github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ=@@ -194,8 +196,9 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuygithub.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=-github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=+github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=+github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=@@ -205,7 +208,6 @@ github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=-github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=github.com/aymanbagabas/go-osc52 v1.2.1/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4=@@ -240,8 +242,8 @@ github.com/charmbracelet/glow v1.5.1 h1:o1mwT4xXXpkfUhJG6euQayNxLZf9yKctOCNHLztrgithub.com/charmbracelet/glow v1.5.1/go.mod h1:rGgop0a2/4gXWiAxUW1iEQseoE+9Ctpb7M4sM9cY9CU=github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk=-github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E=-github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c=+github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=+github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=@@ -270,7 +272,10 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVgithub.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=+github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=+github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=+github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=@@ -293,12 +298,11 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mgithub.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=-github.com/erikgeiser/promptkit v0.9.0 h1:3qL1mS/ntCrXdb8sTP/ka82CJ9kEQaGuYXNrYJkWYBc=-github.com/erikgeiser/promptkit v0.9.0/go.mod h1:pU9dtogSe3Jlc2AY77EP7R4WFP/vgD4v+iImC83KsCo=github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=-github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=+github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=+github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=@@ -391,8 +395,9 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLegithub.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=-github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=+github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=+github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=@@ -407,8 +412,9 @@ github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEgithub.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=-github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=+github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=+github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=@@ -449,6 +455,8 @@ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOngithub.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=github.com/hashicorp/serf v0.9.8/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=+github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=+github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=@@ -466,6 +474,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=@@ -492,8 +502,9 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOgithub.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=-github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=+github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=+github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=@@ -502,10 +513,9 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kygithub.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=-github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=-github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=-github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=@@ -518,8 +528,12 @@ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHshgithub.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=github.com/meowgorithm/babyenv v1.3.0/go.mod h1:lwNX+J6AGBFqNrMZ2PTLkM6SO+W4X8DOg9zBDO4j3Ig=github.com/meowgorithm/babyenv v1.3.1/go.mod h1:lwNX+J6AGBFqNrMZ2PTLkM6SO+W4X8DOg9zBDO4j3Ig=-github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg=+github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=+github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=+github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM=+github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=+github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a/go.mod h1:v8eSC2SMp9/7FTKUncp7fH9IwPfw+ysMObcEz5FWheQ=@@ -537,7 +551,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJgithub.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=-github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34=github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=@@ -555,7 +568,6 @@ github.com/muesli/termenv v0.7.4/go.mod h1:pZ7qY9l3F7e5xsAOS0zCew2tME+p7bWeBkotCgithub.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc=github.com/muesli/termenv v0.14.0/go.mod h1:kG/pF1E7fh949Xhe156crRUrHNyK221IuGO7Ez60Uc8=-github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=@@ -604,8 +616,6 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=-github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=-github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=@@ -619,8 +629,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFogithub.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b18R55ulyQ/h3RaWyloPyER7fWQVZvimKKhnI5OfrJQ=github.com/sagikazarmark/crypt v0.8.0/go.mod h1:TmKwZAo97S4Fy4sfMH/HX/cQP5D+ijra2NyLpNNmttY=github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=-github.com/sashabaranov/go-openai v1.15.1 h1:BAV5LCVEzvZ3rN/Lh5NRVs2z6AahPt/jn5s2/cEEG0M=-github.com/sashabaranov/go-openai v1.15.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=+github.com/sashabaranov/go-openai v1.17.7 h1:MPcAwlwbeo7ZmhQczoOgZBHtIBY1TfZqsdx6+/ndloM=+github.com/sashabaranov/go-openai v1.17.7/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=@@ -635,8 +645,8 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUgithub.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=-github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=-github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=+github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=+github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=@@ -671,11 +681,14 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9degithub.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=+github.com/yuin/goldmark v1.3.7/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=-github.com/yuin/goldmark v1.5.2 h1:ALmeCk/px5FSm1MAcFBAsVKZjDuMVj8Tm7FFIlMJnqU=github.com/yuin/goldmark v1.5.2/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=-github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os=+github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=+github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ=+github.com/yuin/goldmark-emoji v1.0.2 h1:c/RgTShNgHTtc6xdz2KKI74jJr6rWi7FPgnP9GAsO5s=+github.com/yuin/goldmark-emoji v1.0.2/go.mod h1:RhP/RWpexdp+KHs7ghKnifRoIs/Bq4nDS7tRbCkOwKY=go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8=go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ=@@ -808,8 +821,10 @@ golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSgolang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=-golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=+golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=+golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=+golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=@@ -848,10 +863,9 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJgolang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=-golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=-golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=+golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=+golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=@@ -945,14 +959,14 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=-golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=+golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=+golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=-golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=-golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=+golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8=+golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=diff --git a/cli/lib/build.go b/cli/lib/build.gonew file mode 100644index 00000000..55c21f80--- /dev/null+++ b/cli/lib/build.go@@ -0,0 +1 @@+package libdiff --git a/cli/lib/git.go b/cli/lib/git.goindex 16d7470b..fc20bd7e 100644--- a/cli/lib/git.go+++ b/cli/lib/git.go@@ -142,7 +142,7 @@ func GitStashCreate(message string) error {const PopStashConflictMsg = "overwritten by merge"const ConflictMsgFilesEnd = "commit your changes"-func GitStashPop(conflictStrategy types.PlanOutdatedStrategy) error {+func GitStashPop(conflictStrategy string) error {gitMutex.Lock()defer gitMutex.Unlock()@@ -231,6 +231,17 @@ func gitCommitRootUpdate(commitMsg string, lockMutex bool) error {return nil}+func GitClearUncommittedChanges() error {+ gitMutex.Lock()+ defer gitMutex.Unlock()++ res, err := exec.Command("git", "checkout", ".").CombinedOutput()+ if err != nil {+ return fmt.Errorf("error clearing uncommitted changes: %v, output: %s", err, string(res))+ }++ return nil+}func GitCommitContextUpdate(commitMsg string) error {gitMutex.Lock()diff --git a/cli/lib/proposal.go b/cli/lib/proposal.goindex f9c34e8e..3108a86e 100644--- a/cli/lib/proposal.go+++ b/cli/lib/proposal.go@@ -300,8 +300,10 @@ func Propose(prompt string) error {streamFinished = trueif filesFinished {- close(done)- closedDone = true+ if !closedDone {+ close(done)+ closedDone = true+ }writeFileProgress()}@@ -410,8 +412,10 @@ func Propose(prompt string) error {}if streamFinished {- close(done)- closedDone = true+ if !closedDone {+ close(done)+ closedDone = true+ }writeFileProgress()}}@@ -578,13 +582,17 @@ func checkOutdatedContext(s *spinner.Spinner) (bool, error) {fmt.Println()- _, canceled, err := ConfirmYesNoCancel("Update context now?")+ confirmed, canceled, err := ConfirmYesNoCancel("Update context now?")if err != nil {return false, fmt.Errorf("failed to get user input: %s", err)}- shouldContinue := canceled+ if confirmed {+ MustUpdateContextWithOuput()+ }++ shouldContinue := !canceledreturn shouldContinue, nil}diff --git a/cli/lib/term.go b/cli/lib/term.goindex c5c718a9..7feedebc 100644--- a/cli/lib/term.go+++ b/cli/lib/term.go@@ -126,8 +126,8 @@ func GetUserInput() (rune, error) {}func ConfirmYesNo(fmtStr string, fmtArgs ...interface{}) (bool, error) {- color.New(color.FgHiGreen, color.Bold).Printf(fmtStr+" (y)es | (n)o", fmtArgs...)- color.New(color.FgHiGreen, color.Bold).Print("> ")+ color.New(color.FgHiMagenta, color.Bold).Printf(fmtStr+" (y)es | (n)o", fmtArgs...)+ color.New(color.FgHiMagenta, color.Bold).Print("> ")char, err := GetUserInput()if err != nil {@@ -147,8 +147,8 @@ func ConfirmYesNo(fmtStr string, fmtArgs ...interface{}) (bool, error) {}func ConfirmYesNoCancel(fmtStr string, fmtArgs ...interface{}) (bool, bool, error) {- color.New(color.FgHiGreen, color.Bold).Printf(fmtStr+" (y)es | (n)o | (c)ancel", fmtArgs...)- color.New(color.FgHiGreen, color.Bold).Print("> ")+ color.New(color.FgHiMagenta, color.Bold).Printf(fmtStr+" (y)es | (n)o | (c)ancel", fmtArgs...)+ color.New(color.FgHiMagenta, color.Bold).Print("> ")char, err := GetUserInput()if err != nil {diff --git a/cli/types/types.go b/cli/types/types.goindex 1591e6e9..0199cb58 100644--- a/cli/types/types.go+++ b/cli/types/types.go@@ -66,11 +66,9 @@ type LoadContextParams struct {NamesOnly bool}-type PlanOutdatedStrategy string-const (- PlanOutdatedStrategyOverwrite PlanOutdatedStrategy = "Clear the modifications and then apply"- PlanOutdatedStrategyApplyUnmodified PlanOutdatedStrategy = "Apply only new and unmodified files"- PlanOutdatedStrategyRebuild PlanOutdatedStrategy = "Rebuild the plan with updated context"- PlanOutdatedStrategyCancel PlanOutdatedStrategy = "Cancel"+ PlanOutdatedStrategyOverwrite string = "Clear the modifications and then apply"+ PlanOutdatedStrategyApplyUnmodified string = "Apply only new and unmodified files"+ PlanOutdatedStrategyRebuild string = "Rebuild the plan with updated context"+ PlanOutdatedStrategyCancel string = "Cancel")diff --git a/server/handlers/build.go b/server/handlers/build.goindex 5ac8282f..17e4551d 100644--- a/server/handlers/build.go+++ b/server/handlers/build.go@@ -1 +1,50 @@package handlers++import (+ "encoding/json"+ "io"+ "log"+ "net/http"++ "github.com/plandex/plandex/shared"+)++func BuildHandler(w http.ResponseWriter, r *http.Request) {+ log.Println("Received a request for BuildHandler")++ // Read the request body+ body, err := io.ReadAll(r.Body)+ if err != nil {+ log.Printf("Error reading request body: %v\n", err)+ http.Error(w, "Error reading request body", http.StatusInternalServerError)+ return+ }+ defer r.Body.Close()++ // Unmarshal the request body to get the 'prompt'+ var requestBody shared.BuildRequest+ if err := json.Unmarshal(body, &requestBody); err != nil {+ log.Printf("Error parsing request body: %v\n", err)+ http.Error(w, "Error parsing request body", http.StatusBadRequest)+ return+ }++ // startStream(w, func(onStream types.OnStreamFunc) error {++ // err := proposal.BuildPlan(&types.BuildParams{+ // ProposalId: requestBody.ProposalId,+ // BuildPaths: requestBody.BuildPaths,+ // CurrentPlan: requestBody.CurrentPlan,+ // }, onStream)++ // if err != nil {+ // log.Printf("Error building plan: %v\n", err)+ // http.Error(w, "Error building plan: "+err.Error(), http.StatusInternalServerError)+ // return err+ // }++ // return nil++ // })++}diff --git a/server/handlers/create.go b/server/handlers/create.goindex 0afe7322..86697694 100644--- a/server/handlers/create.go+++ b/server/handlers/create.go@@ -7,7 +7,7 @@ import ("log""net/http""plandex-server/model/proposal"- "sync"+ "plandex-server/types""github.com/plandex/plandex/shared")@@ -41,66 +41,18 @@ func ProposalHandler(w http.ResponseWriter, r *http.Request) {w.Header().Set("Transfer-Encoding", "chunked")w.Header().Set("Content-Type", "text/plain; charset=utf-8")- var isResponseClosed bool- done := make(chan struct{})-- var streamMu sync.Mutex-- onStream := func(content string, err error) {- streamMu.Lock()- defer streamMu.Unlock()-- if isResponseClosed {- return- }+ startStream(w, func(onStream types.OnStreamFunc) error {+ fmt.Println("creating proposal and starting stream")+ err = proposal.CreateProposal(requestBody, onStream)if err != nil {- isResponseClosed = true- log.Printf("Error writing stream content to client: %v\n", err)- close(done)- return- }-- // stream content to client- if content != "" {- // fmt.Println("writing stream content to client:", content)-- bytes := []byte(content + shared.STREAM_MESSAGE_SEPARATOR)- _, err = w.Write(bytes)- if err != nil {- isResponseClosed = true- log.Printf("Error writing stream content to client: %v\n", err)- log.Printf("Content: %s\n", string(bytes))- close(done)- return- }- if flusher, ok := w.(http.Flusher); ok {- flusher.Flush()- }- }-- if content == shared.STREAM_FINISHED {- isResponseClosed = true- close(done)- fmt.Println("proposal stream finished")- return+ log.Printf("Error creating proposal: %v\n", err)+ http.Error(w, "Error creating proposal: "+err.Error(), http.StatusInternalServerError)+ return err}- }-- fmt.Println("creating proposal and starting stream")- err = proposal.CreateProposal(requestBody, onStream)-- if err != nil {- log.Printf("Error creating proposal: %v\n", err)- http.Error(w, "Error creating proposal: "+err.Error(), http.StatusInternalServerError)- return- }-- // block until streaming is done- <-done-- fmt.Println("done")+ return nil+ })}func AbortProposalHandler(w http.ResponseWriter, r *http.Request) {diff --git a/server/handlers/stream.go b/server/handlers/stream.gonew file mode 100644index 00000000..3718ab55--- /dev/null+++ b/server/handlers/stream.go@@ -0,0 +1,71 @@+package handlers++import (+ "fmt"+ "log"+ "net/http"+ "plandex-server/types"+ "sync"++ "github.com/plandex/plandex/shared"+)++func startStream(w http.ResponseWriter, startFn func(onStream types.OnStreamFunc) error) {+ var isResponseClosed bool+ done := make(chan struct{})+ var streamMu sync.Mutex++ onStream := func(content string, err error) {+ streamMu.Lock()+ defer streamMu.Unlock()++ if isResponseClosed {+ return+ }++ if err != nil {+ isResponseClosed = true+ log.Printf("Error writing stream content to client: %v\n", err)+ close(done)+ return+ }++ // stream content to client+ if content != "" {+ // fmt.Println("writing stream content to client:", content)++ bytes := []byte(content + shared.STREAM_MESSAGE_SEPARATOR)+ _, err = w.Write(bytes)+ if err != nil {+ isResponseClosed = true+ log.Printf("Error writing stream content to client: %v\n", err)+ log.Printf("Content: %s\n", string(bytes))+ close(done)+ return+ }+ if flusher, ok := w.(http.Flusher); ok {+ flusher.Flush()+ }+ }++ if content == shared.STREAM_FINISHED {+ isResponseClosed = true+ close(done)+ fmt.Println("proposal stream finished")+ return+ }+ }++ err := startFn(onStream)+ if err != nil {+ log.Printf("Error starting stream: %v\n", err)+ close(done)+ return+ }++ // block until streaming is done+ <-done++ fmt.Println("done")++}diff --git a/server/main.go b/server/main.goindex 35898ae5..7aa1253a 100644--- a/server/main.go+++ b/server/main.go@@ -31,7 +31,7 @@ func main() {r.HandleFunc("/short-summary", handlers.ShortSummaryHandler).Methods("POST")r.HandleFunc("/filename", handlers.FileNameHandler).Methods("POST")r.HandleFunc("/convo-summary/{rootId}", handlers.ConvoSummaryHandler).Methods("GET")- // r.HandleFunc("/build", handlers.BuildHandler).Methods("PUT")+ r.HandleFunc("/build", handlers.BuildHandler).Methods("PUT")// Get port from the environment variable or default to 8088port := os.Getenv("PORT")diff --git a/server/model/proposal/abort.go b/server/model/proposal/abort.goindex e7154325..3daaa857 100644--- a/server/model/proposal/abort.go+++ b/server/model/proposal/abort.go@@ -15,11 +15,11 @@ func AbortProposal(proposalId string) error {proposals.Set(proposalId, proposal)}- plan := plans.Get(proposalId)+ plan := builds.Get(proposalId)if plan != nil {aborted := plan.Abort()if aborted {- plans.Set(proposalId, plan)+ builds.Set(proposalId, plan)}}diff --git a/server/model/proposal/build.go b/server/model/proposal/build.goindex 9bf61a32..2edd7532 100644--- a/server/model/proposal/build.go+++ b/server/model/proposal/build.go@@ -14,6 +14,7 @@ import ("time""github.com/davecgh/go-spew/spew"+ "github.com/google/uuid""github.com/plandex/plandex/shared""github.com/sashabaranov/go-openai")@@ -21,18 +22,11 @@ import (const MaxRetries = 3const MaxReplacementRetries = 1-type buildPlanParams struct {- ProposalId string- FileContents map[string]string- NumTokensByFile map[string]int- OnStream types.OnStreamFunc-}--func buildPlan(params buildPlanParams) error {- proposalId := params.ProposalId- fileContents := params.FileContents- numTokensByFile := params.NumTokensByFile- onStream := params.OnStream+func BuildPlan(params *types.BuildParams, onStream types.OnStreamFunc) error {+ // proposalId := params.ProposalId+ // fileContents := params.FileContents+ // numTokensByFile := params.NumTokensByFile+ // onStream := params.OnStream// goEnv := os.Getenv("GOENV")// if goEnv == "test" {@@ -40,6 +34,8 @@ func buildPlan(params buildPlanParams) error {// return nil// }+ proposalId := params.ProposalId+proposal := proposals.Get(proposalId)if proposal == nil {return errors.New("proposal not found")@@ -49,9 +45,21 @@ func buildPlan(params buildPlanParams) error {return errors.New("proposal not finished")}+ buildUUID, err := uuid.NewRandom()+ if err != nil {+ fmt.Printf("Failed to generate build id: %v\n", err)+ return err+ }+ buildId := buildUUID.String()++ replyInfo := shared.NewReplyInfo()+ replyInfo.AddToken(proposal.Content, true)+ _, fileContents, numTokensByFile, _ := replyInfo.FinishAndRead()+ctx, cancel := context.WithCancel(context.Background())- plans.Set(proposalId, &types.Plan{+ builds.Set(proposalId, &types.Build{+ BuildId: buildId,ProposalId: proposalId,NumFiles: len(proposal.PlanDescription.Files),Buffers: map[string]string{},@@ -67,7 +75,7 @@ func buildPlan(params buildPlanParams) error {onStream(shared.STREAM_WRITE_PHASE, nil)- plan := plans.Get(proposalId)+ plan := builds.Get(proposalId)ts := shared.StringTs()for _, planRes := range plan.Results {@@ -91,7 +99,7 @@ func buildPlan(params buildPlanParams) error {// fmt.Println("onFinishBuildFile: " + filePath)// spew.Dump(planRes)- plans.Update(proposalId, func(plan *types.Plan) {+ builds.Update(proposalId, func(plan *types.Build) {plan.Results[filePath] = planResif plan.DidFinish() {@@ -109,7 +117,7 @@ func buildPlan(params buildPlanParams) error {onBuildFileError := func(filePath string, err error) {fmt.Printf("Error for file %s: %v\n", filePath, err)- plans.Update(proposalId, func(p *types.Plan) {+ builds.Update(proposalId, func(p *types.Build) {p.Errs[filePath] = errp.SetErr(err)})@@ -161,8 +169,9 @@ func buildPlan(params buildPlanParams) error {// new fileplanRes := &shared.PlanResult{- Path: filePath,- Content: fileContents[filePath],+ ProposalId: proposalId,+ Path: filePath,+ Content: fileContents[filePath],}onFinishBuildFile(filePath, planRes)return@@ -334,7 +343,7 @@ func buildPlan(params buildPlanParams) error {fmt.Printf("File %s: Stream finished with non-function call\n", filePath)fmt.Println("finish reason: " + choice.FinishReason)- plan := plans.Get(proposalId)+ plan := builds.Get(proposalId)if plan.Results[filePath] == nil {fmt.Printf("Stream finished before replacements parsed. File: %s\n", filePath)fmt.Println("Buffer:")@@ -376,7 +385,7 @@ func buildPlan(params buildPlanParams) error {onStream(string(planTokenCountJson), nil)var buffer string- plans.Update(proposalId, func(p *types.Plan) {+ builds.Update(proposalId, func(p *types.Build) {p.Buffers[filePath] += contentbuffer = p.Buffers[filePath]})@@ -386,7 +395,7 @@ func buildPlan(params buildPlanParams) error {if err == nil && len(replacements.Replacements) > 0 {fmt.Printf("File %s: Parsed replacements\n", filePath)- planResult, allSucceeded := getPlanResult(filePath, currentState, contextPart, replacements.Replacements)+ planResult, allSucceeded := getPlanResult(proposalId, filePath, currentState, contextPart, replacements.Replacements)if !allSucceeded {fmt.Println("Failed replacements:")@@ -435,7 +444,7 @@ func buildPlan(params buildPlanParams) error {return nil}-func getPlanResult(filePath, currentState string, contextPart *shared.ModelContextPart, replacements []*shared.Replacement) (*shared.PlanResult, bool) {+func getPlanResult(proposalId, filePath, currentState string, contextPart *shared.ModelContextPart, replacements []*shared.Replacement) (*shared.PlanResult, bool) {updated := currentStatesort.Slice(replacements, func(i, j int) bool {@@ -476,6 +485,7 @@ func getPlanResult(filePath, currentState string, contextPart *shared.ModelConte}return &shared.PlanResult{+ ProposalId: proposalId,Path: filePath,Replacements: replacements,ContextSha: contextSha,diff --git a/server/model/proposal/create.go b/server/model/proposal/create.goindex 1175a14a..1b639e23 100644--- a/server/model/proposal/create.go+++ b/server/model/proposal/create.go@@ -313,7 +313,7 @@ func CreateProposal(req shared.PromptRequest, onStream types.OnStreamFunc) error}()}- files, fileContents, numTokensByFile, _ := replyInfo.FinishAndRead()+ files, _, _, _ := replyInfo.FinishAndRead()var planDescription *shared.PlanDescription@@ -359,7 +359,11 @@ func CreateProposal(req shared.PromptRequest, onStream types.OnStreamFunc) erroronStream(shared.STREAM_FINISHED, nil)} else {onStream(shared.STREAM_BUILD_PHASE, nil)- err = buildPlan(buildPlanParams{proposalId, fileContents, numTokensByFile, onStream})+ err = BuildPlan(&types.BuildParams{+ ProposalId: proposalId,+ BuildPaths: files,+ CurrentPlan: req.CurrentPlan,+ }, onStream)if err != nil {onError(fmt.Errorf("failed to confirm proposal: %v", err))}diff --git a/server/model/proposal/state.go b/server/model/proposal/state.goindex d2fad38c..4eaa4c22 100644--- a/server/model/proposal/state.go+++ b/server/model/proposal/state.go@@ -8,7 +8,7 @@ import (var (proposals types.SafeMap[*types.Proposal] = *types.NewSafeMap[*types.Proposal]()- plans types.SafeMap[*types.Plan] = *types.NewSafeMap[*types.Plan]()+ builds types.SafeMap[*types.Build] = *types.NewSafeMap[*types.Build]()convoSummaryProcs types.SafeMap[*types.ConvoSummaryProc] = *types.NewSafeMap[*types.ConvoSummaryProc]()convoSummaries types.SafeMap[*shared.ConversationSummary] = *types.NewSafeMap[*shared.ConversationSummary]())diff --git a/server/types/build.go b/server/types/build.gonew file mode 100644index 00000000..45d60c81--- /dev/null+++ b/server/types/build.go@@ -0,0 +1,23 @@+package types++import "github.com/plandex/plandex/shared"++type BuildParams struct {+ ProposalId string `json:"proposalId"`+ BuildPaths []string `json:"buildPaths"`+ CurrentPlan *shared.CurrentPlanFiles `json:"currentPlan"`+}++type Build struct {+ BuildId string+ ProposalId string+ NumFiles int+ Buffers map[string]string+ Results map[string]*shared.PlanResult+ Errs map[string]error+ ProposalStage+}++func (s *Build) DidFinish() bool {+ return len(s.Results) == int(s.NumFiles)+}diff --git a/server/types/plan.go b/server/types/plan.godeleted file mode 100644index 92251e72..00000000--- a/server/types/plan.go+++ /dev/null@@ -1,16 +0,0 @@-package types--import "github.com/plandex/plandex/shared"--type Plan struct {- ProposalId string- NumFiles int- Buffers map[string]string- Results map[string]*shared.PlanResult- Errs map[string]error- ProposalStage-}--func (s *Plan) DidFinish() bool {- return len(s.Results) == int(s.NumFiles)-}diff --git a/shared/plan_result.go b/shared/plan_result.goindex ca614f72..47ca71a1 100644--- a/shared/plan_result.go+++ b/shared/plan_result.go@@ -10,6 +10,7 @@ type Replacement struct {}type PlanResult struct {+ ProposalId string `json:"proposalId"`Path string `json:"path"`ContextSha string `json:"contextSha"`Content string `json:"content"`diff --git a/shared/types.go b/shared/types.goindex d8c4f1c8..3856df9f 100644--- a/shared/types.go+++ b/shared/types.go@@ -42,6 +42,10 @@ type FileNameResponse struct {FileName string `json:"fileName"`}+type BuildRequest struct {+ ProposalIds []string `json:"proposalIds"`+}+type ModelContextPartType stringconst (