From aa759c06aaa0c04dcefb0116a0af876186ae8855 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Mon, 29 Dec 2025 18:44:03 -0800 Subject: [PATCH] fix: improve jira sync error when Python script not found (GH#803) - Add BD_JIRA_SCRIPT env var to let users specify script location - Improve error message with clear instructions for binary users - Show all locations that were searched --- cmd/bd/jira.go | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/cmd/bd/jira.go b/cmd/bd/jira.go index 2571d4a0..3999b436 100644 --- a/cmd/bd/jira.go +++ b/cmd/bd/jira.go @@ -553,12 +553,18 @@ func doPushToJira(ctx context.Context, dryRun bool, createOnly bool, updateRefs // findJiraScript locates the Jira Python script. func findJiraScript(name string) (string, error) { + // Check environment variable first (allows users to specify script location) + if envPath := os.Getenv("BD_JIRA_SCRIPT"); envPath != "" { + if _, err := os.Stat(envPath); err == nil { + return envPath, nil + } + return "", fmt.Errorf("BD_JIRA_SCRIPT points to non-existent file: %s", envPath) + } + // Check common locations locations := []string{ // Relative to current working directory filepath.Join("examples", "jira-import", name), - // Relative to executable - "", } // Add executable-relative path @@ -575,9 +581,6 @@ func findJiraScript(name string) (string, error) { } for _, loc := range locations { - if loc == "" { - continue - } if _, err := os.Stat(loc); err == nil { absPath, err := filepath.Abs(loc) if err == nil { @@ -587,7 +590,19 @@ func findJiraScript(name string) (string, error) { } } - return "", fmt.Errorf("script not found: %s (looked in examples/jira-import/)", name) + return "", fmt.Errorf(`script not found: %s + +The Jira sync feature requires the Python script from the beads repository. + +To fix this, either: + 1. Set BD_JIRA_SCRIPT to point to the script: + export BD_JIRA_SCRIPT=/path/to/jira2jsonl.py + + 2. Or download it from GitHub: + curl -o jira2jsonl.py https://raw.githubusercontent.com/steveyegge/beads/main/examples/jira-import/jira2jsonl.py + export BD_JIRA_SCRIPT=$PWD/jira2jsonl.py + +Looked in: %v`, name, locations) } // JiraConflict represents a conflict between local and Jira versions.