role

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package role ships the agent role prompts that drive a jaira board.

A lane carries the instructions for one step of the work; a role carries the instructions for one worker who performs steps. The lanes travel with the repository, so a teammate who clones gets the board — but until now the roles lived in one person's ~/.claude/skills, so the teammate got a board and nobody to drive it. The roles are compiled into the binary for the same reason the lanes are, and 'jaira roles install' writes them out.

A role is a directory, not a file: its SKILL.md is the prompt, and anything beside it (a reference document, a script) belongs to the same role and is installed with it. The directory name is the API — an agent harness derives the command name from it, not from the frontmatter — so the embedded directory names carry the jaira- prefix verbatim and nothing here rewrites them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

func File(id, rel string) ([]byte, error)

File returns the embedded bytes of one file of a role. rel is a path relative to the role's directory, as it appears in Role.Files.

func GlobalTarget

func GlobalTarget() (string, error)

GlobalTarget returns ~/.claude/skills — the personal skills directory, for a role installed for the person rather than for one repository.

func ProjectTarget

func ProjectTarget(root string) string

ProjectTarget returns the skills directory to install into for a project rooted at root.

The directory is returned, not created; Install creates what it writes to.

func SkippedAny

func SkippedAny(results []Result) bool

SkippedAny reports whether any file was left alone because it had been edited — what the CLI turns into a non-zero exit, so a script can tell "installed" from "installed except the ones you changed".

Types

type Action

type Action string

Action is what Install did with one file.

const (
	// Written: the file was not there.
	Written Action = "written"
	// Unchanged: the file is already byte-identical to the embedded one. A
	// second run of Install reports nothing but these.
	Unchanged Action = "unchanged"
	// Skipped: the file differs from the embedded one, so somebody edited it.
	// It is left exactly as it is and reported, because silently replacing an
	// adjusted role is the one failure this command must never have.
	Skipped Action = "skipped"
	// Overwritten: it differed and --force said to replace it anyway.
	Overwritten Action = "overwritten"
)

type Result

type Result struct {
	Role   string
	Path   string
	Action Action
}

Result is one file's outcome.

func Install

func Install(dstSkillsDir string, force bool) ([]Result, error)

Install writes every embedded role into dstSkillsDir as <dstSkillsDir>/<role-id>/<file>, and reports what happened to each file.

The comparison is against the embedded bytes, not os.Stat as lane.Export does. Stat answers two questions — there or not — and this needs three: a file identical to the embedded one is an already-finished install and must not be an error, while a file that differs is somebody's own version and must not be touched. Only --force collapses the last case back into a write.

type Role

type Role struct {
	// ID is the directory name, and therefore the name the harness invokes:
	// jaira-teamlead is /jaira-teamlead.
	ID          string
	Description string

	// Files are paths relative to the role's own directory, SKILL.md first
	// and the rest sorted. Always at least one entry.
	Files []string
}

Role is one agent prompt, with every file that belongs to it.

func Builtins

func Builtins() ([]Role, error)

Builtins returns every embedded role, sorted by id.

Jump to

Keyboard shortcuts

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