| layout | default |
|---|---|
| title | Chapter 7: Git, Branching, and Review Workflows |
| nav_order | 7 |
| parent | Plandex Tutorial |
Welcome to Chapter 7: Git, Branching, and Review Workflows. In this part of Plandex Tutorial: Large-Task AI Coding Agent Workflows, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
Plandex integrates with Git-oriented team workflows for reviewable and reversible delivery.
- branch per task stream
- run sandbox review + tests
- commit with structured messages
- open PR with change rationale and validation
You now have a repeatable review workflow for team-scale Plandex adoption.
Next: Chapter 8: Self-Hosting and Production Operations
The AddLineNums function in app/shared/utils.go handles a key part of this chapter's functionality:
type LineNumberedTextType string
func AddLineNums(s string) LineNumberedTextType {
return LineNumberedTextType(AddLineNumsWithPrefix(s, "pdx-"))
}
func AddLineNumsWithPrefix(s, prefix string) LineNumberedTextType {
var res string
for i, line := range strings.Split(s, "\n") {
res += fmt.Sprintf("%s%d: %s\n", prefix, i+1, line)
}
return LineNumberedTextType(res)
}
func RemoveLineNums(s LineNumberedTextType) string {
return RemoveLineNumsWithPrefix(s, "pdx-")
}
func RemoveLineNumsWithPrefix(s LineNumberedTextType, prefix string) string {
return regexp.MustCompile(fmt.Sprintf(`(?m)^%s\d+: `, prefix)).ReplaceAllString(string(s), "")
}
// indexRunes searches for the slice of runes `needle` in the slice of runes `haystack`
// and returns the index of the first rune of `needle` in `haystack`, or -1 if `needle` is not present.
func IndexRunes(haystack []rune, needle []rune) int {
if len(needle) == 0 {
return 0
}
if len(haystack) == 0 {
return -1
}This function is important because it defines how Plandex Tutorial: Large-Task AI Coding Agent Workflows implements the patterns covered in this chapter.
The AddLineNumsWithPrefix function in app/shared/utils.go handles a key part of this chapter's functionality:
func AddLineNums(s string) LineNumberedTextType {
return LineNumberedTextType(AddLineNumsWithPrefix(s, "pdx-"))
}
func AddLineNumsWithPrefix(s, prefix string) LineNumberedTextType {
var res string
for i, line := range strings.Split(s, "\n") {
res += fmt.Sprintf("%s%d: %s\n", prefix, i+1, line)
}
return LineNumberedTextType(res)
}
func RemoveLineNums(s LineNumberedTextType) string {
return RemoveLineNumsWithPrefix(s, "pdx-")
}
func RemoveLineNumsWithPrefix(s LineNumberedTextType, prefix string) string {
return regexp.MustCompile(fmt.Sprintf(`(?m)^%s\d+: `, prefix)).ReplaceAllString(string(s), "")
}
// indexRunes searches for the slice of runes `needle` in the slice of runes `haystack`
// and returns the index of the first rune of `needle` in `haystack`, or -1 if `needle` is not present.
func IndexRunes(haystack []rune, needle []rune) int {
if len(needle) == 0 {
return 0
}
if len(haystack) == 0 {
return -1
}
// Search for the needleThis function is important because it defines how Plandex Tutorial: Large-Task AI Coding Agent Workflows implements the patterns covered in this chapter.
The RemoveLineNums function in app/shared/utils.go handles a key part of this chapter's functionality:
}
func RemoveLineNums(s LineNumberedTextType) string {
return RemoveLineNumsWithPrefix(s, "pdx-")
}
func RemoveLineNumsWithPrefix(s LineNumberedTextType, prefix string) string {
return regexp.MustCompile(fmt.Sprintf(`(?m)^%s\d+: `, prefix)).ReplaceAllString(string(s), "")
}
// indexRunes searches for the slice of runes `needle` in the slice of runes `haystack`
// and returns the index of the first rune of `needle` in `haystack`, or -1 if `needle` is not present.
func IndexRunes(haystack []rune, needle []rune) int {
if len(needle) == 0 {
return 0
}
if len(haystack) == 0 {
return -1
}
// Search for the needle
for i := 0; i <= len(haystack)-len(needle); i++ {
found := true
for j := 0; j < len(needle); j++ {
if haystack[i+j] != needle[j] {
found = false
break
}
}
if found {
return i
}This function is important because it defines how Plandex Tutorial: Large-Task AI Coding Agent Workflows implements the patterns covered in this chapter.
The RemoveLineNumsWithPrefix function in app/shared/utils.go handles a key part of this chapter's functionality:
func RemoveLineNums(s LineNumberedTextType) string {
return RemoveLineNumsWithPrefix(s, "pdx-")
}
func RemoveLineNumsWithPrefix(s LineNumberedTextType, prefix string) string {
return regexp.MustCompile(fmt.Sprintf(`(?m)^%s\d+: `, prefix)).ReplaceAllString(string(s), "")
}
// indexRunes searches for the slice of runes `needle` in the slice of runes `haystack`
// and returns the index of the first rune of `needle` in `haystack`, or -1 if `needle` is not present.
func IndexRunes(haystack []rune, needle []rune) int {
if len(needle) == 0 {
return 0
}
if len(haystack) == 0 {
return -1
}
// Search for the needle
for i := 0; i <= len(haystack)-len(needle); i++ {
found := true
for j := 0; j < len(needle); j++ {
if haystack[i+j] != needle[j] {
found = false
break
}
}
if found {
return i
}
}This function is important because it defines how Plandex Tutorial: Large-Task AI Coding Agent Workflows implements the patterns covered in this chapter.
flowchart TD
A[AddLineNums]
B[AddLineNumsWithPrefix]
C[RemoveLineNums]
D[RemoveLineNumsWithPrefix]
E[IndexRunes]
A --> B
B --> C
C --> D
D --> E