Documentation
¶
Index ¶
- Constants
- func CompileTemplate(id, body string) (*template.Template, error)
- func ExecuteTemplate(tmpl *template.Template, data TemplateData) ([]byte, error)
- func ValidateTemplates(manifest Manifest) error
- type Detection
- type Manifest
- type Metadata
- type OutputFormat
- type Scope
- type Spec
- type Target
- type TargetEntry
- type Targets
- type Template
- type TemplateData
Constants ¶
const ( Kind = "Adapter" APIVersion = components.APIVersion )
Variables ¶
This section is empty.
Functions ¶
func CompileTemplate ¶
CompileTemplate parses one body using the same options custom adapter rendering will use later.
func ExecuteTemplate ¶
func ExecuteTemplate(tmpl *template.Template, data TemplateData) ([]byte, error)
ExecuteTemplate renders a pre-validated template with the restricted data surface. It is available to planner work without exposing host callbacks.
func ValidateTemplates ¶
ValidateTemplates compiles inline custom adapter templates with the locked missing-key policy and verifies that actions only reference approved data.
Types ¶
type Detection ¶
type Detection struct {
Paths []string `json:"paths,omitempty"`
MarkerFiles []string `json:"markerFiles,omitempty"`
}
Detection describes read-only adapter discovery hints.
type Manifest ¶
type Manifest struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata Metadata `json:"metadata"`
Spec Spec `json:"spec"`
}
Manifest is a declarative adapter definition. It deliberately contains no command, script, hook, or lifecycle fields.
func (Manifest) TargetEntries ¶
func (m Manifest) TargetEntries() []TargetEntry
TargetEntries returns all declared targets in deterministic family order.
type Metadata ¶
type Metadata struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
}
Metadata identifies the custom adapter.
type OutputFormat ¶
type OutputFormat string
OutputFormat names the native output family for a custom adapter target.
const ( FormatJSON OutputFormat = "json" FormatJSONC OutputFormat = "jsonc" FormatTOML OutputFormat = "toml" FormatYAML OutputFormat = "yaml" FormatMarkdown OutputFormat = "markdown" FormatManagedMarkdownBlock OutputFormat = "managed-markdown-block" FormatManagedLineBlock OutputFormat = "managed-line-block" FormatSymlink OutputFormat = "symlink" FormatCopy OutputFormat = "copy" )
type Spec ¶
type Spec struct {
Scope Scope `json:"scope"`
Detection Detection `json:"detection,omitempty"`
Targets Targets `json:"targets"`
Support map[string]string `json:"support,omitempty"`
TemplateID string `json:"templateId,omitempty"`
Templates map[string]Template `json:"templates,omitempty"`
}
Spec defines detection metadata and all supported render targets.
type Target ¶
type Target struct {
Path string `json:"path"`
OutputFormat OutputFormat `json:"outputFormat"`
TemplateID string `json:"templateId,omitempty"`
TargetKey string `json:"targetKey,omitempty"`
InstallMode string `json:"installMode,omitempty"`
Scope Scope `json:"scope,omitempty"`
Support string `json:"support,omitempty"`
WriteLevel string `json:"writeLevel,omitempty"`
Notes []string `json:"notes,omitempty"`
}
Target defines one adapter-native output location.
type TargetEntry ¶
TargetEntry is a flattened target annotated with its component family.
type Targets ¶
type Targets struct {
Rules []Target `json:"rules,omitempty"`
Skills []Target `json:"skills,omitempty"`
MCP []Target `json:"mcp,omitempty"`
Ignore []Target `json:"ignore,omitempty"`
Permissions []Target `json:"permissions,omitempty"`
}
Targets groups native output targets by normalized component family.
type Template ¶
type Template struct {
OutputFormat OutputFormat `json:"outputFormat,omitempty"`
Body string `json:"body"`
}
Template is an inline custom adapter render template. Templates are inert text/template bodies; ContextCart never executes shell commands from them.
type TemplateData ¶
type TemplateData struct {
Component any
MCP any
Skill any
Rule any
Ignore any
Adapter Manifest
ProjectPath string
TargetPath string
Env map[string]string
OperationID string
}
TemplateData is the complete data surface available to custom adapter templates. It intentionally exposes data only, not helper functions.