role

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 12 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

View Source
const DefaultAgent = "claude"

DefaultAgent is the agent installed for when none is named.

Variables

This section is empty.

Functions

func AgentNames added in v0.4.2

func AgentNames() string

AgentNames lists the known agents, for a message naming them.

func Dirs added in v0.4.2

func Dirs(global bool) string

Dirs lists, for a flag's help, the directory each agent writes in one scope: "claude: .claude/skills, copilot: .github/skills", or with ~/ for global.

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 InstalledIn added in v0.4.2

func InstalledIn(dirs []string) (string, error)

InstalledIn returns the first of dirs that already holds a built-in role's SKILL.md, or "" when none does. One role is enough: that role is the one a second install would register twice.

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".

func UpdateCommand added in v0.4.2

func UpdateCommand(dir, root string, global bool) (string, error)

UpdateCommand returns the jaira command that updates the roles already in dir: the --project or --global run of the agent that writes there, and --into for a directory none of them writes. root is the repository root for a project scope, ignored for global.

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 Agent added in v0.4.2

type Agent struct {
	Name string

	// Project and Global are the directories written to: Project relative to
	// the repository root, Global relative to the home directory.
	Project, Global string

	// AlsoProject and AlsoGlobal are the other directories every surface of
	// the harness reads. Roles already in one of them are already installed for
	// it, and a write into Project or Global would be the second copy.
	AlsoProject, AlsoGlobal []string

	// Mods: whether the harness loads the jaira mods. They are Claude Code
	// plugin folders, and anywhere else they are files nothing reads.
	Mods bool
}

Agent is one harness the roles can be installed for: where it reads skills, in a repository and in the home directory.

Only one directory per scope is written, even where the harness reads several: a harness that reads more than one of them would find the same role registered twice under the same command name, and nothing would say which copy answered. Installing into several places is not the same choice as core/board/announce.go writing both AGENTS.md and CLAUDE.md — those are two files one reader reads once, while these are two registrations of one command. A project that keeps its skills elsewhere names that directory with --into rather than getting a copy in every candidate.

func AgentNamed added in v0.4.2

func AgentNamed(name string) (Agent, bool)

AgentNamed returns the agent called name, and false when there is none.

func (Agent) GlobalTarget added in v0.4.2

func (a Agent) GlobalTarget() (string, []string, error)

GlobalTarget returns the personal skills directory — for a role installed for the person rather than for one repository — and the other personal directories the agent reads.

func (Agent) Install added in v0.4.2

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

Install is install for this agent: with the mods where it loads them.

func (Agent) ProjectTarget added in v0.4.2

func (a Agent) ProjectTarget(root string) (string, []string)

ProjectTarget returns the skills directory to install into for a project rooted at root, and the other directories the agent reads there.

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

type Result

type Result struct {
	Role   string
	Path   string
	Action Action
}

Result is one file's outcome.

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