feature/recipe_implementation #5
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"gmgauthier.com/grokkit/internal/recipe" // adjust if your module name differs
|
"gmgauthier.com/grokkit/internal/recipe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var recipeCmd = &cobra.Command{
|
var recipeCmd = &cobra.Command{
|
||||||
@ -25,7 +25,7 @@ var runCmd = &cobra.Command{
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
recipeCmd.AddCommand(runCmd)
|
recipeCmd.AddCommand(runCmd)
|
||||||
rootCmd.AddCommand(recipeCmd) // this is how every other command is wired in your project
|
rootCmd.AddCommand(recipeCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRecipe(cmd *cobra.Command, args []string) error {
|
func runRecipe(cmd *cobra.Command, args []string) error {
|
||||||
@ -84,8 +84,7 @@ func resolveRecipePath(nameOrPath string) (string, error) {
|
|||||||
if _, err := os.Stat(global); err == nil {
|
if _, err := os.Stat(global); err == nil {
|
||||||
fmt.Printf("Recipe %q not found in project.\nFound globally at %s\nUse this one? [y/N] ", nameOrPath, global)
|
fmt.Printf("Recipe %q not found in project.\nFound globally at %s\nUse this one? [y/N] ", nameOrPath, global)
|
||||||
var answer string
|
var answer string
|
||||||
_, err := fmt.Scanln(&answer)
|
if _, err := fmt.Scanln(&answer); err != nil {
|
||||||
if err != nil {
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(strings.ToLower(answer), "y") {
|
if strings.HasPrefix(strings.ToLower(answer), "y") {
|
||||||
|
|||||||
@ -15,8 +15,7 @@ var (
|
|||||||
// stepRe finds every "### Step N: Title" heading
|
// stepRe finds every "### Step N: Title" heading
|
||||||
stepRe = regexp.MustCompile(`(?m)^### Step (\d+): (.+)$`)
|
stepRe = regexp.MustCompile(`(?m)^### Step (\d+): (.+)$`)
|
||||||
|
|
||||||
// subRe finds the three labelled sections inside each step.
|
// subRe finds the three labelled sections inside each step (no Perl lookahead)
|
||||||
// We use a simple non-capturing group + word-boundary approach instead of lookahead.
|
|
||||||
subRe = regexp.MustCompile(`(?m)^(\*\*(?:Objective|Instructions|Expected output):\*\*)\s*(.+?)(?:\n\n|\n###|\z)`)
|
subRe = regexp.MustCompile(`(?m)^(\*\*(?:Objective|Instructions|Expected output):\*\*)\s*(.+?)(?:\n\n|\n###|\z)`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -11,12 +11,15 @@ func NewRunner(r *Recipe) *Runner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runner) Run() error {
|
func (r *Runner) Run() error {
|
||||||
fmt.Printf("🍳 Starting recipe: %s v%s\n", r.Recipe.Name, r.Recipe.Version)
|
fmt.Printf("🍳 Starting recipe: %s v%s\n\n", r.Recipe.Name, r.Recipe.Version)
|
||||||
|
|
||||||
for _, step := range r.Recipe.Steps {
|
for _, step := range r.Recipe.Steps {
|
||||||
fmt.Printf("Step %d/%d: %s\n", step.Number, len(r.Recipe.Steps), step.Title)
|
fmt.Printf("Step %d/%d: %s\n", step.Number, len(r.Recipe.Steps), step.Title)
|
||||||
// TODO: here we will send step.Instructions to the LLM
|
// TODO: here we will send step.Instructions (plus Objective/Expected) to the LLM
|
||||||
// and handle the response according to Expected
|
// and handle the response according to Expected output
|
||||||
|
fmt.Println(" → (LLM call coming soon)")
|
||||||
}
|
}
|
||||||
fmt.Println("✅ Recipe complete.")
|
|
||||||
|
fmt.Println("\n✅ Recipe complete.")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user