package author import ( "context" "embed" "fmt" "os" "os/exec" "path/filepath" "git.a-wan.net/alan/pipelines/internal/draft" ) //go:embed skill/SKILL.md skill/references/format.md var content embed.FS // Command launches the normal CLI directly. Skill loading and questions belong // to OpenCode; no session/API/backend discovery is performed before launch. func Command(ctx context.Context, executable string, d draft.Draft, request, cli string) (*exec.Cmd, error) { dir, err := SkillDirectory() if err != nil { return nil, err } if _, err := os.Stat(filepath.Join(dir, "SKILL.md")); err != nil { return nil, fmt.Errorf("pipelines skill is not installed; run pipelines skill install: %w", err) } cwd, err := os.Getwd() if err != nil { return nil, err } cmd := exec.CommandContext(ctx, executable, cwd, "--prompt", Prompt(d, request, cli)) cmd.Dir = cwd return cmd, nil } func Prompt(d draft.Draft, request, command string) string { prompt := fmt.Sprintf("@pipelines\nDraft context: %q\nCLI: %s", d.Path+".json", command) if request != "" { prompt += "\nRequest: " + request } return prompt }