Documentation
¶
Overview ¶
Package config parses CronFoundry manifest and skill files and resolves single-level `{{ include "..." }}` directives inside skill bodies.
Index ¶
- func CollectSecretRefs(destinations, env json.RawMessage, llmRef *string, extra ...json.RawMessage) []string
- func ResolveIncludes(body, root string) (string, error)
- type AutoPauseConfig
- type Destination
- type EmailDest
- type EnvValue
- type GitHubIssueDest
- type HTTPDest
- type MCPServer
- type Manifest
- type Schedule
- type Skill
- type SkillEntry
- type SkillFrontmatter
- type SkillWritebackFrontmatter
- type WebhookDest
- type WritebackConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectSecretRefs ¶
func CollectSecretRefs(destinations, env json.RawMessage, llmRef *string, extra ...json.RawMessage) []string
CollectSecretRefs extracts all secret names referenced from destinations JSON, env JSON, and an optional LLM secret reference. Secret references appear in the form `{ "secret": "name" }` anywhere in the JSON.
Non-string "secret" values are skipped. Results are sorted + deduplicated.
func ResolveIncludes ¶
ResolveIncludes replaces `{{ include "path" }}` directives with the file contents read from `root`. The directive is single-level only — included content is inserted verbatim without re-processing.
Security:
- absolute paths are rejected
- paths that escape `root` (via `..`) are rejected
Types ¶
type AutoPauseConfig ¶
type AutoPauseConfig struct {
After int `json:"after"`
}
AutoPauseConfig controls the auto-pause-on-consecutive-failures behavior. If nil, the schedule uses the global default (DefaultAutoPauseAfter).
type Destination ¶
type Destination struct {
GitHubIssue *GitHubIssueDest `json:"github-issue,omitempty"`
Slack *WebhookDest `json:"slack,omitempty"`
Discord *WebhookDest `json:"discord,omitempty"`
Teams *WebhookDest `json:"teams,omitempty"`
HTTP *HTTPDest `json:"http,omitempty"`
Email *EmailDest `json:"email,omitempty"`
// When controls which run outcomes trigger this destination.
// Valid values: "always" (default), "on_success", "on_failure".
When string `json:"when,omitempty"`
}
func (Destination) ShouldPublish ¶
func (d Destination) ShouldPublish(runSucceeded bool) bool
ShouldPublish returns true when the destination should fire given runSucceeded.
func (Destination) Validate ¶
func (d Destination) Validate() error
Validate returns an error if the destination config is invalid.
type EmailDest ¶
type EmailDest struct {
SMTPHost string `json:"smtp_host"`
SMTPPort int `json:"smtp_port,omitempty"` // default 587
UsernameSecret string `json:"username_secret"`
PasswordSecret string `json:"password_secret"`
From string `json:"from"`
To []string `json:"to"`
Subject string `json:"subject,omitempty"` // template.Render template; default below
Format string `json:"format,omitempty"` // "html" (default) or "text"
Output string `json:"output,omitempty"` // named output block to use; empty = full output
}
func (*EmailDest) EffectiveFormat ¶
func (*EmailDest) EffectiveSMTPPort ¶
type EnvValue ¶
EnvValue is either a literal string or a `{ secret: name }` reference.
func (*EnvValue) UnmarshalJSON ¶
type GitHubIssueDest ¶
type GitHubIssueDest struct {
Repo string `json:"repo"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
Labels []string `json:"labels,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Output string `json:"output,omitempty"` // named output block to use; empty = full output
}
type HTTPDest ¶
type HTTPDest struct {
URL string `json:"url"`
Method string `json:"method,omitempty"` // default "POST"
Secret string `json:"secret,omitempty"` // logical secret name; sent as Bearer token
Headers map[string]string `json:"headers,omitempty"`
BodyTemplate string `json:"body_template,omitempty"` // Go template; default sends {"output":"<output>"}
Output string `json:"output,omitempty"`
}
type Manifest ¶
type Manifest struct {
Version int `json:"version"`
Skills []SkillEntry `json:"skills"`
}
func ParseManifest ¶
func (*Manifest) FindSchedule ¶
func (m *Manifest) FindSchedule(skillPath, scheduleName string) (*SkillEntry, *Schedule, error)
FindSchedule returns pointers to the skill and schedule matching the given coordinates, or an error if either is not found.
type Schedule ¶
type Schedule struct {
Name string `json:"name"`
Cron string `json:"cron"`
Timezone string `json:"timezone"`
OverlapPolicy string `json:"overlap_policy"`
TimeoutSec int `json:"timeout_sec"`
Provider string `json:"provider"`
Model string `json:"model"`
MaxTurns int `json:"max_turns,omitempty"`
Destinations []Destination `json:"destinations"`
Writeback *WritebackConfig `json:"writeback,omitempty"`
Env map[string]EnvValue `json:"env"`
MCPEnv map[string]map[string]EnvValue `json:"mcp_env,omitempty"`
AutoPause *AutoPauseConfig `json:"auto_pause,omitempty"`
CopilotPrefix string `json:"copilot_prefix,omitempty"`
}
func (*Schedule) EffectiveOverlapPolicy ¶
EffectiveOverlapPolicy returns the overlap policy with the default resolved. An empty OverlapPolicy in the YAML means "skip" — this method centralizes that default so callers don't need to handle both forms.
type Skill ¶
type Skill struct {
Frontmatter SkillFrontmatter
Body string
}
func ParseSkillFile ¶
ParseSkillFile extracts the YAML frontmatter and prompt body. Frontmatter is delimited by `---\n` on its own line at the top of the file and a matching `---\n` closing line.
type SkillEntry ¶
type SkillFrontmatter ¶
type SkillFrontmatter struct {
Name string `json:"name"`
Description string `json:"description"`
ModelHint string `json:"model_hint"`
MaxTokens int `json:"max_tokens"`
MaxTurns int `json:"max_turns"`
MCPServers []MCPServer `json:"mcp_servers,omitempty"`
Writeback SkillWritebackFrontmatter `json:"writeback"`
}
type SkillWritebackFrontmatter ¶
type SkillWritebackFrontmatter struct {
BlockFormat string `json:"block_format"`
}
type WebhookDest ¶
type WebhookDest struct {
Secret string `json:"secret"`
Text string `json:"text,omitempty"`
Content string `json:"content,omitempty"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
Format string `json:"format,omitempty"` // "blocks" (Slack default), "text", "card" (Teams)
Output string `json:"output,omitempty"` // named output block to use; empty = full output
}