recipes

package
v0.1.113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package recipes turns the "Recipes" section of an app's guide (docs/lidza-guide.md) into task recipes: prompts served by `lidza mcp`, and skills for Claude Code (.claude/skills) and for Codex and Gemini CLI (.agents/skills, the Agent Skills layout both read; Gemini offers each as a /<name> command). The guide is the only source; everything else is rewritten from it by `lidza gen`.

Index

Constants

View Source
const (
	SkillsDir       = ".claude/skills"
	AgentsSkillsDir = ".agents/skills"
	// GeminiCommandsDir held a TOML command per recipe (/lidza:<name>)
	// before Gemini CLI read .agents/skills, which made each recipe
	// appear twice there; lidza gen removes the generated ones.
	GeminiCommandsDir = ".gemini/commands/lidza"
)

SkillsDir is where Claude Code reads skills, relative to the project root; AgentsSkillsDir is the Agent Skills layout Codex and Gemini CLI read. Both get the same SKILL.md files.

View Source
const (
	Heading    = "## Recipes"
	AppHeading = "## App recipes"
)

Heading is the guide section that holds the framework's recipes, which `lidza gen` refreshes from the template; AppHeading holds the app's own, which nothing but the app's developers touch.

View Source
const (
	ScopeFramework = "framework"
	ScopeApp       = "app"
)

Scopes of a recipe.

View Source
const GuideFile = "docs/lidza-guide.md"

GuideFile is the app guide, relative to the project root.

Variables

OutputDirs lists every directory lidza gen writes recipes to or clears generated files from.

Functions

func RefreshGuide

func RefreshGuide(dir, guide string) (bool, error)

RefreshGuide replaces the guide with guide (the framework's, rendered for this app) keeping the app's own: the body of its "## App recipes" section. It reports whether anything changed; an app without a guide is left alone.

func ReplaceFramework

func ReplaceFramework(dir, body string) (bool, error)

ReplaceFramework replaces the body of the "## Recipes" section of the guide with body (the framework's current recipes) and reports whether anything changed. A guide without the section is left alone.

func Skill

func Skill(r Recipe) string

Skill renders a recipe as a SKILL.md.

func Slug

func Slug(title string) string

Slug lowercases a title, drops articles and joins the words with dashes: "Add an API route" is "add-api-route".

func WriteSkills

func WriteSkills(dir string, rs []Recipe) ([]string, error)

WriteSkills writes every recipe as a skill for Claude Code and for Codex and Gemini CLI, removes generated files whose recipe is gone and the Gemini commands lidza wrote before, and returns the paths it wrote, relative to dir.

Types

type Recipe

type Recipe struct {
	// Name is the slug of the title: the prompt name and the skill
	// directory ("add-api-route").
	Name  string `json:"name"`
	Title string `json:"title"`
	// Description is the first paragraph of the body on one line.
	Description string `json:"description"`
	// Body is the markdown under the heading, trimmed.
	Body string `json:"body"`
	// Scope is "framework" (under "## Recipes") or "app" (under
	// "## App recipes").
	Scope string `json:"scope"`
}

Recipe is one task: a level-3 heading under "## Recipes" and its text.

func Add

func Add(dir, title, description string, steps []string) (Recipe, error)

Add appends a recipe to the guide's "## App recipes" section, creating the section after "## Recipes" when the guide has none. Steps become a numbered list; an empty list leaves the steps to fill in. It returns the recipe as parsed back.

func Load

func Load(dir string) ([]Recipe, error)

Load reads the guide in dir and parses it.

func Parse

func Parse(guide string) []Recipe

Parse extracts the recipes from the guide's markdown. A guide without a Recipes section yields none.

func Sync

func Sync(dir string) ([]Recipe, error)

Sync loads the guide and writes the skills. A project without a guide is left alone.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL