Documentation
¶
Overview ¶
Package sync deploys skills, subagent definitions, and config TOMLs to runtime directories.
It reads canonical agent Markdown files and skill directories from configured source paths, generates runtime-specific variants (Claude Code, Codex), and writes or symlinks them to the appropriate destination directories.
Plane: shared
Index ¶
- Constants
- func DenyPrimaryAgentsAsSubagents(agentNames []string, dryRun bool) (added []string, err error)
- func DeployCodexAgents(agents []*ParsedAgent, dryRun bool) error
- func DeployCodexRules(rules []RuleResult, dryRun bool) error
- func DeployCodexRulesTo(rules []RuleResult, agentsPath string, dryRun bool) error
- func GenerateCCCommandVariant(cmd *ParsedCommand) (string, error)
- func GenerateCCVariant(agent *ParsedAgent) (string, error)
- func GenerateCodexVariant(agent *ParsedAgent) string
- type AgentFrontmatter
- type AgentResult
- type CommandFrontmatter
- type ConfigResult
- type GlobalPromptResult
- type ParsedAgent
- type ParsedCommand
- type RuleResult
- type TtalAgentConfig
Constants ¶
const ManagedMarkerField = "managed_by: ttal-sync"
ManagedMarkerField is a YAML frontmatter field embedded in deployed files to identify them as ttal-managed.
Variables ¶
This section is empty.
Functions ¶
func DenyPrimaryAgentsAsSubagents ¶ added in v1.3.0
DenyPrimaryAgentsAsSubagents reads ~/.claude/settings.json and ensures Agent(<name>) deny entries exist for all deployed agents, preventing CC from spawning them directly as subagents. All agent routing must go through ttal go.
Additive only — appends new entries at the end of the deny list, never removes or reorders existing entries. Returns list of newly added entry names.
func DeployCodexAgents ¶
func DeployCodexAgents(agents []*ParsedAgent, dryRun bool) error
DeployCodexAgents writes per-agent .toml files and merges registration entries into config.toml.
func DeployCodexRules ¶ added in v1.0.0
func DeployCodexRules(rules []RuleResult, dryRun bool) error
DeployCodexRules aggregates all RULE.md contents into ~/.codex/AGENTS.md under a managed section delimited by HTML comment markers.
func DeployCodexRulesTo ¶ added in v1.0.0
func DeployCodexRulesTo(rules []RuleResult, agentsPath string, dryRun bool) error
DeployCodexRulesTo writes aggregated rules to a specific AGENTS.md path. Used by tests to avoid touching ~/.codex/AGENTS.md.
func GenerateCCCommandVariant ¶
func GenerateCCCommandVariant(cmd *ParsedCommand) (string, error)
GenerateCCCommandVariant produces a CC skill SKILL.md from a parsed canonical command. Includes shared fields (description, argument-hint) plus claude-code specific fields.
func GenerateCCVariant ¶
func GenerateCCVariant(agent *ParsedAgent) (string, error)
GenerateCCVariant produces a Claude Code agent .md file from a parsed canonical agent. Includes shared fields (name, description) plus claude-code specific fields.
func GenerateCodexVariant ¶
func GenerateCodexVariant(agent *ParsedAgent) string
GenerateCodexVariant produces a Codex agent .toml file content from a parsed canonical agent. The markdown body becomes developer_instructions; optional codex: frontmatter fields are merged.
Types ¶
type AgentFrontmatter ¶
type AgentFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Emoji string `yaml:"emoji"`
ClaudeCode map[string]interface{} `yaml:"claude-code"`
Codex map[string]interface{} `yaml:"codex"`
Ttal *TtalAgentConfig `yaml:"ttal"`
}
AgentFrontmatter holds parsed frontmatter from a canonical agent .md file.
type AgentResult ¶
AgentResult tracks a single agent deployment for reporting.
func DeployAgents ¶
func DeployAgents(subagentsPaths []string, dryRun bool) ([]AgentResult, error)
DeployAgents reads canonical agent .md files from the given paths and deploys runtime-specific variants to Claude Code and Codex agent directories.
type CommandFrontmatter ¶
type CommandFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
ArgumentHint string `yaml:"argument-hint"`
ClaudeCode map[string]interface{} `yaml:"claude-code"`
}
CommandFrontmatter holds parsed frontmatter from a canonical command .md file.
type ConfigResult ¶ added in v1.8.0
ConfigResult tracks a single config file deployment for reporting.
func DeployConfigs ¶ added in v1.8.0
func DeployConfigs(teamPath, configDir string, dryRun bool) ([]ConfigResult, error)
DeployConfigs copies allowlisted TOML files from teamPath to configDir. Only files that exist in teamPath are deployed. Missing files are silently skipped.
type GlobalPromptResult ¶
GlobalPromptResult tracks a single global prompt deployment for reporting.
func DeployGlobalPrompt ¶
func DeployGlobalPrompt(rawPath string, dryRun bool) ([]GlobalPromptResult, error)
DeployGlobalPrompt copies one canonical global prompt markdown file into runtime paths. Always targets Claude Code (~/.claude/CLAUDE.md), and additionally targets Codex (~/.codex/AGENTS.md) when ~/.codex exists and is a directory.
type ParsedAgent ¶
type ParsedAgent struct {
Frontmatter AgentFrontmatter
Body string
}
ParsedAgent holds the parsed frontmatter and body of an agent .md file.
func DiscoverTtalAgents ¶ added in v1.1.0
func DiscoverTtalAgents(subagentsPaths []string) ([]*ParsedAgent, error)
DiscoverTtalAgents scans subagents_paths for .md files with ttal: frontmatter. Returns only agents that have a ttal: section, sorted by name.
func ParseAgentFile ¶
func ParseAgentFile(content string) (*ParsedAgent, error)
ParseAgentFile splits a canonical agent .md file into frontmatter and body. Expected format:
--- name: foo ... --- Body text here
type ParsedCommand ¶
type ParsedCommand struct {
Frontmatter CommandFrontmatter
Body string
}
ParsedCommand holds the parsed frontmatter and body of a command .md file.
func ParseCommandFile ¶
func ParseCommandFile(content string) (*ParsedCommand, error)
ParseCommandFile splits a canonical command .md file into frontmatter and body. Expected format:
--- name: foo description: Short description ... --- Body text here
type RuleResult ¶ added in v1.0.0
type RuleResult struct {
Source string // Full path to RULE.md
Name string // Rule name (directory name)
Dest string // ~/.claude/rules/{name}.md
}
RuleResult records one RULE.md deployment.
func DeployRules ¶ added in v1.0.0
func DeployRules(rulesPaths []string, dryRun bool) ([]RuleResult, error)
DeployRules scans rules_paths for directories containing RULE.md and copies them to ~/.claude/rules/{name}.md.
func DeployRulesTo ¶ added in v1.0.0
func DeployRulesTo(rulesPaths []string, rulesDir string, dryRun bool) ([]RuleResult, error)
DeployRulesTo is like DeployRules but writes to a custom destination directory. Used by tests to avoid touching ~/.claude/rules/.
type TtalAgentConfig ¶ added in v1.1.0
TtalAgentConfig holds ttal-native execution config for a subagent. When present, ttal can run the agent directly without manual --tool/--model flags.