aiagentconfig

package
v1.85.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverAll

func DiscoverAll(basePath string) (map[string][]DiscoveredFile, error)

DiscoverAll searches basePath for AI agent configuration files and groups them by agent. Only agents with at least one exclusive file match are included. Shared files are appended to each detected agent's file list. Returns a map of agent name → sorted, deduplicated discovered files.

Types

type Agent

type Agent struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
}

Agent identifies the AI agent provider

type ConfigFile

type ConfigFile struct {
	Path    string         `json:"path"`
	Kind    ConfigFileKind `json:"kind"`
	SHA256  string         `json:"sha256"`
	Size    int64          `json:"size"`
	Content string         `json:"content"`
}

ConfigFile represents a single discovered configuration file

type ConfigFileKind added in v1.82.3

type ConfigFileKind string

ConfigFileKind classifies the purpose of a discovered configuration file.

const (
	// ConfigFileKindConfiguration is for settings and JSON config files.
	ConfigFileKindConfiguration ConfigFileKind = "configuration"
	// ConfigFileKindInstruction is for markdown instruction/rules files.
	ConfigFileKindInstruction ConfigFileKind = "instruction"
	// ConfigFileKindSkill is for skill definition files.
	ConfigFileKindSkill ConfigFileKind = "skill"

	// EvidenceID is the identifier for the AI agent config material type
	EvidenceID = "CHAINLOOP_AI_AGENT_CONFIG"
	// EvidenceSchemaURL is the URL to the JSON schema for AI agent config
	EvidenceSchemaURL = "https://schemas.chainloop.dev/aiagentconfig/0.1/ai-agent-config.schema.json"
)

type Data added in v1.82.3

type Data struct {
	Agent       Agent        `json:"agent"`
	ConfigHash  string       `json:"config_hash"`
	GitContext  *GitContext  `json:"git_context,omitempty"`
	ConfigFiles []ConfigFile `json:"config_files"`
	// Future fields for richer analysis
	Permissions any         `json:"permissions,omitempty"`
	MCPServers  []MCPServer `json:"mcp_servers,omitempty"`
	Subagents   any         `json:"subagents,omitempty"`
}

Data is the AI agent configuration payload

func Build

func Build(basePath string, discovered []DiscoveredFile, agentName string, gitCtx *GitContext) (*Data, error)

Build reads discovered files and constructs the AI agent config payload. basePath is the base directory, discovered contains files relative to basePath with their kinds. agentName identifies the AI agent (e.g. "claude", "cursor"). gitCtx may be nil if not in a git repository.

type DiscoveredFile added in v1.82.3

type DiscoveredFile struct {
	Path string
	Kind ConfigFileKind
}

DiscoveredFile represents a file found during discovery, before reading its content.

type Evidence

type Evidence struct {
	ID     string `json:"chainloop.material.evidence.id"`
	Schema string `json:"schema"`
	Data   Data   `json:"data"`
}

Evidence represents the complete evidence structure for AI agent config

func NewEvidence added in v1.82.3

func NewEvidence(data Data) *Evidence

NewEvidence creates a new Evidence instance

type GitContext

type GitContext struct {
	Repository string `json:"repository,omitempty"`
	Branch     string `json:"branch,omitempty"`
	CommitSHA  string `json:"commit_sha,omitempty"`
}

GitContext holds optional git information at capture time

type MCPServer added in v1.85.0

type MCPServer struct {
	Name     string   `json:"name"`
	Command  string   `json:"command,omitempty"`
	Args     []string `json:"args,omitempty"`
	URL      string   `json:"url,omitempty"`
	EnvKeys  []string `json:"env_keys,omitempty"`
	Disabled bool     `json:"disabled,omitempty"`
}

MCPServer represents a single MCP server entry extracted from configuration.

func ExtractMCPServers added in v1.85.0

func ExtractMCPServers(content []byte) ([]MCPServer, error)

ExtractMCPServers parses MCP server entries from raw JSON content. It handles both .mcp.json format and .claude/settings.json format. Environment variable values are stripped; only key names are retained. Returns nil without error if the JSON is valid but contains no mcpServers.

Jump to

Keyboard shortcuts

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