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
🤖 Plandex → apply pending changes ✏️ Add logic to read version from version.txt if not set through build variable
Dane Schneider61f72a35daea
diff --git a/app/cli/cmd/version.go b/app/cli/cmd/version.goindex 0e58aa6f..ccdbc9f7 100644--- a/app/cli/cmd/version.go+++ b/app/cli/cmd/version.go@@ -1,13 +1,30 @@package cmdimport (+ "bufio""fmt"+ "os"+ "strings""github.com/spf13/cobra"-)// Version will be set at build time using -ldflagsvar Version = "development"+func readVersionFromFile() string {+ file, err := os.Open("version.txt") // Adjust the path as necessary+ if err != nil {+ fmt.Println("Unable to read version from file, defaulting to:", Version)+ return Version+ }+ defer file.Close()++ scanner := bufio.NewScanner(file)+ if scanner.Scan() {+ return strings.TrimSpace(scanner.Text())+ }++ return Version+}// versionCmd represents the version commandvar versionCmd = &cobra.Command{@@ -15,6 +32,9 @@ var versionCmd = &cobra.Command{Short: "Print the version number of Plandex",Long: `All software has versions. This is Plandex's`,Run: func(cmd *cobra.Command, args []string) {+ if Version == "development" {+ Version = readVersionFromFile()+ }fmt.Println("Plandex CLI Version:", Version)},}