Documentation
¶
Index ¶
- Variables
- func BeginMarker(recipe Recipe, version, contentHash string) string
- func ContentHash(body string) string
- func ExtractSection(content string) (body string, meta string, found bool)
- func HasPine(start string) bool
- func InstallClaudeHook(root string) (string, error)
- func InstallCodexHook(root string) (string, error)
- func InstallCursorHook(root string) (string, error)
- func InstallSkillFile(root string, info RecipeInfo, opts RenderOptions) (string, error)
- func IsInteractive(r io.Reader) bool
- func MergeFile(path, markedSection string) error
- func RemoveClaudeHook(root string) (bool, error)
- func RemoveCodexHook(root string) (bool, error)
- func RemoveCursorHook(root string) (bool, error)
- func RemoveSection(path string) (bool, error)
- func RemoveSkillFile(root string, info RecipeInfo) (bool, error)
- func RenderSection(recipe Recipe, version string, opts RenderOptions) (string, error)
- func RenderSkill(opts RenderOptions) string
- func RepoRoot(start string) (string, error)
- func StdinIsInteractive() bool
- type HookKind
- type InstallStatus
- func CheckClaudeHook(root string) InstallStatus
- func CheckCodexHook(root string) InstallStatus
- func CheckCursorHook(root string) InstallStatus
- func CheckFile(path string, expectedBody string, recipe Recipe, version string) InstallStatus
- func CheckSkillFile(root string, info RecipeInfo, opts RenderOptions) InstallStatus
- type Recipe
- type RecipeInfo
- type RenderOptions
- type Runner
Constants ¶
This section is empty.
Variables ¶
var AllRecipes = []Recipe{RecipeAgents, RecipeClaude, RecipeGemini, RecipeCursor}
AllRecipes is the default wizard selection order.
Functions ¶
func BeginMarker ¶
BeginMarker builds the opening HTML comment for a pine section.
func ContentHash ¶
ContentHash returns a short hex digest of the section body for staleness checks.
func ExtractSection ¶
ExtractSection returns the pine-managed body, marker metadata, and whether it was found.
func InstallClaudeHook ¶ added in v0.3.0
InstallClaudeHook idempotently inserts Pine's learn-reminder Stop hook into .claude/settings.json, preserving every other setting and hook. Returns "installed" (added or updated) or "current" (already present and identical).
func InstallCodexHook ¶ added in v0.4.0
InstallCodexHook idempotently installs Pine's learn-reminder Stop hook into .codex/hooks.json and writes the companion script.
func InstallCursorHook ¶ added in v0.4.0
InstallCursorHook idempotently installs Pine's sessionStart learn-reminder into .cursor/hooks.json and writes the companion script.
func InstallSkillFile ¶ added in v0.3.0
func InstallSkillFile(root string, info RecipeInfo, opts RenderOptions) (string, error)
InstallSkillFile writes the Pine SKILL.md into an agent's skills directory. The file is wholly Pine-owned: it is (re)written only when its content differs from the current template, so re-running setup after a Pine upgrade refreshes it while an unchanged run is a no-op.
func IsInteractive ¶
IsInteractive reports whether r is a terminal (wizard can prompt).
func RemoveClaudeHook ¶ added in v0.3.0
RemoveClaudeHook strips Pine's learn-reminder hook from .claude/settings.json, leaving other settings intact. Returns whether a hook was removed.
func RemoveCodexHook ¶ added in v0.4.0
RemoveCodexHook strips Pine's Codex learn-reminder hook and script.
func RemoveCursorHook ¶ added in v0.4.0
RemoveCursorHook strips Pine's Cursor learn-reminder hook and script.
func RemoveSection ¶
RemoveSection deletes the pine block from path. Returns whether a section existed.
func RemoveSkillFile ¶ added in v0.3.0
func RemoveSkillFile(root string, info RecipeInfo) (bool, error)
RemoveSkillFile deletes a previously installed SKILL.md (and its now-empty directory, best-effort). Returns whether a file was removed.
func RenderSection ¶
func RenderSection(recipe Recipe, version string, opts RenderOptions) (string, error)
RenderSection builds the marked pine section for one recipe.
func RenderSkill ¶ added in v0.3.0
func RenderSkill(opts RenderOptions) string
RenderSkill builds the standalone SKILL.md content Pine installs into an agent's skills directory. Unlike RenderSection it is not marker-wrapped — the file is wholly Pine-owned and rewritten when the template changes.
func RepoRoot ¶
RepoRoot resolves the repository root from a starting directory. When no .git directory is found, the starting directory is used as the project root.
func StdinIsInteractive ¶
func StdinIsInteractive() bool
StdinIsInteractive is a convenience wrapper for os.Stdin.
Types ¶
type HookKind ¶ added in v0.4.0
type HookKind string
HookKind identifies which agent hook config Pine manages for a recipe.
type InstallStatus ¶
type InstallStatus string
InstallStatus reports whether a recipe section is present and current.
const ( StatusMissing InstallStatus = "missing" StatusStale InstallStatus = "stale" StatusCurrent InstallStatus = "current" )
func CheckClaudeHook ¶ added in v0.3.0
func CheckClaudeHook(root string) InstallStatus
CheckClaudeHook reports whether Pine's hook is present and current.
func CheckCodexHook ¶ added in v0.4.0
func CheckCodexHook(root string) InstallStatus
CheckCodexHook reports whether Pine's Codex hook is present and current.
func CheckCursorHook ¶ added in v0.4.0
func CheckCursorHook(root string) InstallStatus
CheckCursorHook reports whether Pine's Cursor hook is present and current.
func CheckFile ¶
func CheckFile(path string, expectedBody string, recipe Recipe, version string) InstallStatus
CheckFile compares the on-disk section to the expected rendered body.
func CheckSkillFile ¶ added in v0.3.0
func CheckSkillFile(root string, info RecipeInfo, opts RenderOptions) InstallStatus
CheckSkillFile reports whether the installed SKILL.md matches the current template.
type RecipeInfo ¶
type RecipeInfo struct {
Name Recipe
File string
Label string
Description string
Header string
// SkillFile is the repo-relative path where this agent looks for a skill
// file, or "" when the agent has no skill convention. When set, `pine setup`
// installs the Pine SKILL.md there in addition to merging the markdown block.
SkillFile string
// HookKind is the session-hook target for this recipe, or HookKindNone.
HookKind HookKind
// SectionRecipe, when set, is the recipe id used in the AGENTS.md/CLAUDE.md
// section marker. Cursor shares AGENTS.md with Codex, so it renders and
// checks as RecipeAgents while still owning only the Cursor hook on remove.
SectionRecipe Recipe
}
RecipeInfo describes one agent integration bundle.
func (RecipeInfo) InstructionRecipe ¶ added in v0.5.0
func (info RecipeInfo) InstructionRecipe() Recipe
InstructionRecipe is the recipe id used when rendering/checking the instruction file section.
func (RecipeInfo) OwnsInstruction ¶ added in v0.5.0
func (info RecipeInfo) OwnsInstruction() bool
OwnsInstructionReports whether this recipe owns the instruction file / skill for install-remove. Shared consumers (Cursor → AGENTS.md) do not.
type RenderOptions ¶
type RenderOptions struct {
// BoardColumns is a comma-separated list of kanban statuses, e.g. "todo, doing, done".
// When empty, the board-columns line is omitted.
BoardColumns string
}
RenderOptions supplies dynamic fragments when rendering agent instructions.
type Runner ¶
type Runner struct {
Root string // repository root (parent of .pine)
Version string
Opts RenderOptions
Out io.Writer
In io.Reader
// Confirm, when set, replaces the interactive Yes/No prompt (tests inject fakes).
Confirm func(title, description string, defaultYes bool) (bool, error)
// PickRecipes, when set, replaces the interactive multi-select (tests inject fakes).
PickRecipes func(infos []RecipeInfo) ([]Recipe, error)
// MultiSelect, when set, replaces tui.MultiSelectIO inside the default pickRecipes path.
MultiSelect func(title string, choices []tui.Choice) ([]string, error)
}
Runner performs setup operations against a repository root.