sync

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ManagedMarkerField = "managed_by: ttal-sync"

ManagedMarkerField is a YAML frontmatter field embedded in deployed files so CleanAgents and CleanCommands can identify ttal-managed files and avoid deleting user-created ones.

Variables

This section is empty.

Functions

func CleanAgents

func CleanAgents(subagentsPaths []string, dryRun bool) ([]string, error)

CleanAgents removes ttal-managed agent files that no longer exist in source paths. Only removes files containing the ManagedMarkerField to avoid deleting user-created agents. Also cleans stale Codex agent .toml files and config.toml entries.

func CleanCodexAgents

func CleanCodexAgents(validNames map[string]bool, dryRun bool) ([]string, error)

CleanCodexAgents removes stale ttal-managed Codex agent files and config.toml entries.

func CleanCommands

func CleanCommands(commandsPaths []string, dryRun bool) ([]string, error)

CleanCommands removes ttal-managed command files that no longer exist in source paths.

func CleanSkills

func CleanSkills(skillsPaths []string, dryRun bool) ([]string, error)

CleanSkills removes symlinks in ~/.claude/skills/ that point to directories no longer present in any skills_paths source.

func DeployCodexAgents

func DeployCodexAgents(agents []*ParsedAgent, dryRun bool) error

DeployCodexAgents writes per-agent .toml files and merges registration entries into config.toml.

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.

func GenerateOCCommandVariant

func GenerateOCCommandVariant(cmd *ParsedCommand) (string, error)

GenerateOCCommandVariant produces an OC command .md from a parsed canonical command. Includes shared fields (description, argument-hint) plus opencode specific fields.

func GenerateOCVariant

func GenerateOCVariant(agent *ParsedAgent) (string, error)

GenerateOCVariant produces an OpenCode agent .md file from a parsed canonical agent. Includes shared fields (name, description) plus opencode specific fields.

Types

type AgentFrontmatter

type AgentFrontmatter struct {
	Name        string                 `yaml:"name"`
	Description string                 `yaml:"description"`
	ClaudeCode  map[string]interface{} `yaml:"claude-code"`
	OpenCode    map[string]interface{} `yaml:"opencode"`
	Codex       map[string]interface{} `yaml:"codex"`
}

AgentFrontmatter holds parsed frontmatter from a canonical agent .md file.

type AgentResult

type AgentResult struct {
	Source    string
	Name      string
	CCDest    string
	OCDest    string
	CodexDest string
}

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, OpenCode, 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"`
	OpenCode     map[string]interface{} `yaml:"opencode"`
}

CommandFrontmatter holds parsed frontmatter from a canonical command .md file.

type CommandResult

type CommandResult struct {
	Source string
	Name   string
	CCDest string
	OCDest string
}

CommandResult tracks a single command deployment for reporting.

func DeployCommands

func DeployCommands(commandsPaths []string, dryRun bool) ([]CommandResult, error)

DeployCommands reads canonical command .md files from the given paths and deploys runtime-specific variants to Claude Code (as skills) and OpenCode (as commands).

type GlobalPromptResult

type GlobalPromptResult struct {
	Source  string
	Dest    string
	Runtime string
}

GlobalPromptResult tracks a single global prompt deployment for reporting.

func DeployGlobalPrompt

func DeployGlobalPrompt(rawPath string, dryRun bool) ([]GlobalPromptResult, error)

DeployGlobalPrompt symlinks 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 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 SkillResult

type SkillResult struct {
	Source string
	Name   string
	Dest   string
}

SkillResult tracks a single skill deployment for reporting.

func DeploySkills

func DeploySkills(skillsPaths []string, dryRun bool) ([]SkillResult, error)

DeploySkills symlinks skill directories (those containing SKILL.md) to ~/.claude/skills/.

Jump to

Keyboard shortcuts

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