fix(prompts): don't include ripgrep and gh prompts in testing

Kieran Klukas created

Change summary

internal/agent/tools/rg.go    | 4 ++++
internal/agent/tools/tools.go | 4 ++++
2 files changed, 8 insertions(+)

Detailed changes

internal/agent/tools/rg.go 🔗

@@ -7,11 +7,15 @@ import (
 	"path/filepath"
 	"strings"
 	"sync"
+	"testing"
 
 	"github.com/charmbracelet/crush/internal/log"
 )
 
 var getRg = sync.OnceValue(func() string {
+	if testing.Testing() {
+		return ""
+	}
 	path, err := exec.LookPath("rg")
 	if err != nil {
 		if log.Initialized() {

internal/agent/tools/tools.go 🔗

@@ -5,6 +5,7 @@ import (
 	"context"
 	"html/template"
 	"os/exec"
+	"testing"
 
 	"charm.land/fantasy"
 )
@@ -70,6 +71,9 @@ func NewPermissionDeniedResponse() fantasy.ToolResponse {
 
 // ghAvailable indicates whether the `gh` CLI is available on PATH.
 var ghAvailable = func() bool {
+	if testing.Testing() {
+		return false
+	}
 	_, err := exec.LookPath("gh")
 	return err == nil
 }()