fix: doctor searches %LOCALAPPDATA%\ctask\bin first for status-line helper

Adds the canonical install location as the primary search path on Windows,
before falling back to GOPATH/bin. Updates the Claude config guidance message
to reference the new path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 17:18:21 -04:00
parent 2bdeffc8ae
commit bbd10d6e62
+10 -7
View File
@@ -61,12 +61,11 @@ func runDoctor(cmd *cobra.Command, args []string) error {
}
// Check 3: Status line helper exists
// The canonical location is next to the ctask binary in GOPATH/bin,
// or on Unix in ~/.local/bin. We check both the bash and powershell variants.
// Canonical location: %LOCALAPPDATA%\ctask\bin on Windows, ~/.local/bin on Unix.
// Also checks GOPATH/bin as a fallback for older installs.
statusLineFound := false
statusLinePath := ""
// Determine expected locations based on platform
var searchPaths []string
home, _ := os.UserHomeDir()
gopath := os.Getenv("GOPATH")
@@ -76,10 +75,14 @@ func runDoctor(cmd *cobra.Command, args []string) error {
gopathBin := filepath.Join(gopath, "bin")
if runtime.GOOS == "windows" {
searchPaths = []string{
filepath.Join(gopathBin, "ctask-statusline.sh"),
filepath.Join(gopathBin, "ctask-statusline.ps1"),
localAppData := os.Getenv("LOCALAPPDATA")
if localAppData != "" {
ctaskBin := filepath.Join(localAppData, "ctask", "bin")
searchPaths = append(searchPaths, filepath.Join(ctaskBin, "ctask-statusline.sh"))
searchPaths = append(searchPaths, filepath.Join(ctaskBin, "ctask-statusline.ps1"))
}
searchPaths = append(searchPaths, filepath.Join(gopathBin, "ctask-statusline.sh"))
searchPaths = append(searchPaths, filepath.Join(gopathBin, "ctask-statusline.ps1"))
} else {
searchPaths = []string{
filepath.Join(home, ".local", "bin", "ctask-statusline.sh"),
@@ -130,7 +133,7 @@ func runDoctor(cmd *cobra.Command, args []string) error {
fmt.Printf(" [FAIL] Claude Code status line not configured or misconfigured\n")
fmt.Printf(" Fix: add to %s:\n", claudeSettingsPath)
if runtime.GOOS == "windows" {
fmt.Printf(" \"statusLine\": {\"type\": \"command\", \"command\": \"bash /c/Users/<you>/go/bin/ctask-statusline.sh\"}\n")
fmt.Printf(" \"statusLine\": {\"type\": \"command\", \"command\": \"bash /c/Users/<you>/AppData/Local/ctask/bin/ctask-statusline.sh\"}\n")
} else {
fmt.Printf(" \"statusLine\": {\"type\": \"command\", \"command\": \"bash ~/.local/bin/ctask-statusline.sh\"}\n")
}