Documentation
¶
Index ¶
- Constants
- func IsValidContentType(ct catalog.ContentType) bool
- func PreserveUserMetadata(existing *registry.ManifestItem, detected *DetectedItem)
- func ResolveReferences(path string, repoRoot string) []string
- func SanitizeItem(item *DetectedItem)
- func SaveScanAsConfig(repoRoot string, cfg *ScanAsConfig) error
- func ShouldTriggerInteractiveFallback(result *AnalysisResult) bool
- func ToManifestItem(item *DetectedItem) registry.ManifestItem
- func WriteGeneratedManifest(name string, items []*DetectedItem) error
- type AnalysisConfig
- type AnalysisResult
- type Analyzer
- type CandidateMatch
- type ClaudeCodeDetector
- type ClaudeCodePluginDetector
- type ClineDetector
- type CodexDetector
- type ConfidenceCategory
- type ConfidenceTier
- type ContentDetector
- type ContentSignalDetector
- func (d *ContentSignalDetector) Classify(path, repoRoot string) ([]*DetectedItem, error)
- func (d *ContentSignalDetector) ClassifyUnmatched(unmatchedPaths []string, repoRoot string, ...) ([]*DetectedItem, []SkipEntry, error)
- func (d *ContentSignalDetector) Patterns() []DetectionPattern
- func (d *ContentSignalDetector) ProviderSlug() string
- type CopilotDetector
- type CursorDetector
- type DependencyRef
- type DetectedItem
- type DetectionPattern
- type GeminiDetector
- type ReanalysisResult
- type RooCodeDetector
- type ScanAsConfig
- type ScanAsEntry
- type SignalEntry
- type SkipEntry
- type SyllagoDetector
- type TopLevelDetector
- type ValidationIssue
- type WalkResult
- type WindsurfDetector
Constants ¶
const DefaultAutoThreshold = 0.80
DefaultAutoThreshold is the default minimum confidence for auto-detection.
const DefaultSkipThreshold = 0.50
DefaultSkipThreshold is the default minimum confidence to include at all.
Variables ¶
This section is empty.
Functions ¶
func IsValidContentType ¶
func IsValidContentType(ct catalog.ContentType) bool
IsValidContentType checks whether ct is a recognized content type.
func PreserveUserMetadata ¶
func PreserveUserMetadata(existing *registry.ManifestItem, detected *DetectedItem)
PreserveUserMetadata merges user-edited display metadata from an existing manifest item into a newly-analyzed DetectedItem. Only non-empty user values are preserved.
func ResolveReferences ¶
ResolveReferences finds files referenced by a content item. path is the item's primary file path (relative to repoRoot). repoRoot must be filepath.EvalSymlinks-resolved. Returns relative paths of referenced files that exist within repoRoot.
func SanitizeItem ¶
func SanitizeItem(item *DetectedItem)
SanitizeItem strips C0/C1 control characters from all string fields of a DetectedItem and truncates fields that exceed display length limits. Must be called after Classify, before dedup or audit writes.
func SaveScanAsConfig ¶
func SaveScanAsConfig(repoRoot string, cfg *ScanAsConfig) error
SaveScanAsConfig writes cfg to .syllago.yaml in repoRoot.
func ShouldTriggerInteractiveFallback ¶
func ShouldTriggerInteractiveFallback(result *AnalysisResult) bool
ShouldTriggerInteractiveFallback returns true if the result is sparse enough to warrant user-directed discovery. Only applicable in interactive mode.
func ToManifestItem ¶
func ToManifestItem(item *DetectedItem) registry.ManifestItem
ToManifestItem converts a DetectedItem to a registry.ManifestItem.
func WriteGeneratedManifest ¶
func WriteGeneratedManifest(name string, items []*DetectedItem) error
WriteGeneratedManifest writes a registry.yaml to the syllago cache directory for the named registry. This file is separate from the repo's own registry.yaml.
Types ¶
type AnalysisConfig ¶
type AnalysisConfig struct {
AutoThreshold float64 // default DefaultAutoThreshold
SkipThreshold float64 // default DefaultSkipThreshold
ExcludeDirs []string // additional per-registry exclusions
SymlinkPolicy string // "ask", "follow", "skip"
Strict bool // disables content-signal fallback
ScanAsPaths map[string]catalog.ContentType // user-directed: path prefix → type
DebugSkips bool // collect per-file skip reasons
NoConfig bool // suppress .syllago.yaml loading
}
AnalysisConfig controls analyzer behavior.
func DefaultConfig ¶
func DefaultConfig() AnalysisConfig
DefaultConfig returns the default analysis configuration.
type AnalysisResult ¶
type AnalysisResult struct {
Auto []*DetectedItem // confidence > AutoThreshold (excluding hooks/MCP)
Confirm []*DetectedItem // confidence in [SkipThreshold, AutoThreshold], plus ALL hooks/MCP
Warnings []string
SkipReasons []SkipEntry // populated when DebugSkips=true
}
AnalysisResult holds the output of a full repository analysis.
func (*AnalysisResult) AllItems ¶
func (r *AnalysisResult) AllItems() []*DetectedItem
AllItems returns Auto and Confirm combined, Auto first.
func (*AnalysisResult) CountByType ¶
func (r *AnalysisResult) CountByType() map[catalog.ContentType]int
CountByType returns a map of ContentType to item count across Auto+Confirm.
func (*AnalysisResult) IsEmpty ¶
func (r *AnalysisResult) IsEmpty() bool
IsEmpty returns true if both Auto and Confirm are empty.
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer orchestrates content discovery for a repository.
func New ¶
func New(config AnalysisConfig) *Analyzer
New creates an Analyzer with all built-in detectors registered.
type CandidateMatch ¶
type CandidateMatch struct {
Path string
Pattern DetectionPattern
Detector ContentDetector
}
CandidateMatch records one detector's claim on a file path.
func MatchPatterns ¶
func MatchPatterns(paths []string, detectors []ContentDetector) []CandidateMatch
MatchPatterns evaluates all detectors' patterns against the path index. Returns one CandidateMatch per (detector, path) pair where the glob matched. paths are relative to repoRoot (as returned by Walk), normalized to forward slashes via filepath.ToSlash before matching (B4: ensures patterns work on all platforms since filepath.Match uses the OS separator on Windows).
type ClaudeCodeDetector ¶
type ClaudeCodeDetector struct{}
ClaudeCodeDetector detects Claude Code content.
func (*ClaudeCodeDetector) Classify ¶
func (d *ClaudeCodeDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*ClaudeCodeDetector) Patterns ¶
func (d *ClaudeCodeDetector) Patterns() []DetectionPattern
func (*ClaudeCodeDetector) ProviderSlug ¶
func (d *ClaudeCodeDetector) ProviderSlug() string
type ClaudeCodePluginDetector ¶
type ClaudeCodePluginDetector struct{}
ClaudeCodePluginDetector detects Claude Code Plugin content.
func (*ClaudeCodePluginDetector) Classify ¶
func (d *ClaudeCodePluginDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*ClaudeCodePluginDetector) Patterns ¶
func (d *ClaudeCodePluginDetector) Patterns() []DetectionPattern
func (*ClaudeCodePluginDetector) ProviderSlug ¶
func (d *ClaudeCodePluginDetector) ProviderSlug() string
type ClineDetector ¶
type ClineDetector struct{}
ClineDetector detects Cline content.
func (*ClineDetector) Classify ¶
func (d *ClineDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*ClineDetector) Patterns ¶
func (d *ClineDetector) Patterns() []DetectionPattern
func (*ClineDetector) ProviderSlug ¶
func (d *ClineDetector) ProviderSlug() string
type CodexDetector ¶
type CodexDetector struct{}
CodexDetector detects OpenAI Codex content.
func (*CodexDetector) Classify ¶
func (d *CodexDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*CodexDetector) Patterns ¶
func (d *CodexDetector) Patterns() []DetectionPattern
func (*CodexDetector) ProviderSlug ¶
func (d *CodexDetector) ProviderSlug() string
type ConfidenceCategory ¶
type ConfidenceCategory int
ConfidenceCategory partitions items for UI presentation.
const ( CategoryAuto ConfidenceCategory = iota // > autoThreshold CategoryConfirm // >= skipThreshold and <= autoThreshold CategorySkip // < skipThreshold (never included in manifest) )
type ConfidenceTier ¶
type ConfidenceTier string
ConfidenceTier classifies a content-signal item's confidence level.
const ( TierLow ConfidenceTier = "Low confidence" TierMedium ConfidenceTier = "Medium confidence" TierHigh ConfidenceTier = "High confidence" TierUser ConfidenceTier = "User-asserted, no content signals" )
func TierForItem ¶
func TierForItem(item *DetectedItem) ConfidenceTier
TierForItem returns the confidence tier label for a DetectedItem. User-directed items with zero content signals get a special label.
func TierForMeta ¶
func TierForMeta(confidence float64, method string) ConfidenceTier
TierForMeta applies tier logic from persisted metadata fields. Uses DetectionMethod instead of floating-point equality to identify user-directed items — avoids fragile float comparison at the 0.60 boundary.
type ContentDetector ¶
type ContentDetector interface {
// ProviderSlug returns the detector's provider identifier.
ProviderSlug() string
// Patterns returns the glob patterns this detector recognizes.
Patterns() []DetectionPattern
// Classify inspects a candidate path and returns detected items.
// Returns nil if the path matched a pattern but content inspection
// shows it is not actually content.
// repoRoot is filepath.EvalSymlinks-resolved before being passed in.
Classify(path string, repoRoot string) ([]*DetectedItem, error)
}
ContentDetector is the interface every provider detector implements.
type ContentSignalDetector ¶
type ContentSignalDetector struct{}
ContentSignalDetector classifies files that pattern-based detectors did not match. It uses weighted signal scoring against static fingerprints only.
func (*ContentSignalDetector) Classify ¶
func (d *ContentSignalDetector) Classify(path, repoRoot string) ([]*DetectedItem, error)
Classify satisfies ContentDetector but is not used by this detector.
func (*ContentSignalDetector) ClassifyUnmatched ¶
func (d *ContentSignalDetector) ClassifyUnmatched( unmatchedPaths []string, repoRoot string, scanAsPaths map[string]catalog.ContentType, debugSkips bool, ) ([]*DetectedItem, []SkipEntry, error)
ClassifyUnmatched inspects files not matched by any pattern-based detector. unmatchedPaths are relative to repoRoot. scanAsPaths maps relative path prefixes to their user-specified content type (bypasses directory keyword filter). When debugSkips is true, skipped files are recorded in the returned skip entries.
func (*ContentSignalDetector) Patterns ¶
func (d *ContentSignalDetector) Patterns() []DetectionPattern
Patterns returns empty — the content-signal detector does not participate in MatchPatterns. It operates on unmatched files via ClassifyUnmatched.
func (*ContentSignalDetector) ProviderSlug ¶
func (d *ContentSignalDetector) ProviderSlug() string
type CopilotDetector ¶
type CopilotDetector struct{}
CopilotDetector detects VS Code Copilot content.
func (*CopilotDetector) Classify ¶
func (d *CopilotDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*CopilotDetector) Patterns ¶
func (d *CopilotDetector) Patterns() []DetectionPattern
func (*CopilotDetector) ProviderSlug ¶
func (d *CopilotDetector) ProviderSlug() string
type CursorDetector ¶
type CursorDetector struct{}
CursorDetector detects Cursor content.
func (*CursorDetector) Classify ¶
func (d *CursorDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*CursorDetector) Patterns ¶
func (d *CursorDetector) Patterns() []DetectionPattern
func (*CursorDetector) ProviderSlug ¶
func (d *CursorDetector) ProviderSlug() string
type DependencyRef ¶
type DependencyRef struct {
Registry string
Type catalog.ContentType
Name string
}
DependencyRef references another content item this item depends on.
type DetectedItem ¶
type DetectedItem struct {
Name string
Type catalog.ContentType
InternalLabel string // "hook-script", "hook-wiring", etc. Empty = use Type.
Provider string
Path string // primary file or directory (relative to repoRoot)
ContentHash string // SHA-256 of primary file content
Confidence float64
Scripts []string // referenced script files (relative to repoRoot)
References []string // other files needed (relative to repoRoot)
Dependencies []DependencyRef
HookEvent string
HookIndex int
ConfigSource string // where wiring was found (e.g., ".claude/settings.json")
DisplayName string
Description string
// Providers holds alias paths for deduplicated items — paths of lower-confidence
// duplicates that were suppressed in favor of this item (same name+type+hash).
Providers []string
// Signals records the content-signal scoring breakdown for audit logging.
// Only populated for items from the ContentSignalDetector.
Signals []SignalEntry
}
DetectedItem is the output of a detector's Classify call.
func DeduplicateItems ¶
func DeduplicateItems(items []*DetectedItem) (deduped []*DetectedItem, conflicts [][2]*DetectedItem)
DeduplicateItems processes classified items: 1. Suppresses hook-script items whose Path appears in another item's Scripts list. 2. Deduplicates same (type, name) items:
- Same content hash: keep highest confidence, record other paths in Providers alias.
- Different content hash: keep both (conflicts returned separately).
Returns deduplicated items and conflict pairs.
type DetectionPattern ¶
type DetectionPattern struct {
Glob string
ContentType catalog.ContentType
// InternalLabel overrides ContentType for detector-internal classification.
// Use for "hook-script", "hook-wiring", "plugin-manifest", "output-style".
// Empty means use ContentType directly.
InternalLabel string
Confidence float64
}
DetectionPattern declares a glob pattern a detector recognizes.
type GeminiDetector ¶
type GeminiDetector struct{}
GeminiDetector detects Gemini CLI content.
func (*GeminiDetector) Classify ¶
func (d *GeminiDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*GeminiDetector) Patterns ¶
func (d *GeminiDetector) Patterns() []DetectionPattern
func (*GeminiDetector) ProviderSlug ¶
func (d *GeminiDetector) ProviderSlug() string
type ReanalysisResult ¶
type ReanalysisResult struct {
Unchanged []*registry.ManifestItem // path exists, hash unchanged
Changed []string // relative paths where hash changed
Missing []string // relative paths that no longer exist
Warnings []string
}
ReanalysisResult holds the outcome of a sync hash comparison.
func DiffManifest ¶
func DiffManifest(manifest *registry.Manifest, repoRoot string) ReanalysisResult
DiffManifest compares the current filesystem state against an existing manifest. For each item in the manifest, it reads the file at item.Path (relative to repoRoot) and compares its SHA-256 against item.ContentHash. Items with empty ContentHash are treated as Unchanged (authored manifests without hashes).
type RooCodeDetector ¶
type RooCodeDetector struct{}
RooCodeDetector detects Roo Code content.
func (*RooCodeDetector) Classify ¶
func (d *RooCodeDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*RooCodeDetector) Patterns ¶
func (d *RooCodeDetector) Patterns() []DetectionPattern
func (*RooCodeDetector) ProviderSlug ¶
func (d *RooCodeDetector) ProviderSlug() string
type ScanAsConfig ¶
type ScanAsConfig struct {
ScanAs []ScanAsEntry `yaml:"scan-as"`
}
ScanAsConfig is the parsed content of .syllago.yaml.
func LoadScanAsConfig ¶
func LoadScanAsConfig(repoRoot string) (*ScanAsConfig, error)
LoadScanAsConfig reads .syllago.yaml from repoRoot. Returns an empty config if the file does not exist.
func (*ScanAsConfig) ToPathMap ¶
func (c *ScanAsConfig) ToPathMap() map[string]catalog.ContentType
ToPathMap converts ScanAsConfig entries to the map format used by AnalysisConfig.
type ScanAsEntry ¶
type ScanAsEntry struct {
Type catalog.ContentType `yaml:"type"`
Path string `yaml:"path"`
}
ScanAsEntry is one path-to-type mapping in .syllago.yaml.
type SignalEntry ¶
SignalEntry records one matched signal and its weight contribution. Exported for audit logging; populated by ContentSignalDetector.
type SkipEntry ¶
type SkipEntry struct {
Path string `json:"path"`
Reason string `json:"reason"` // pre_filter_excluded, below_threshold, locked_conflict, walk_skipped
}
SkipEntry records why a file was not classified by the content-signal detector.
type SyllagoDetector ¶
type SyllagoDetector struct{}
SyllagoDetector detects content organized in syllago's canonical layout.
func (*SyllagoDetector) Classify ¶
func (d *SyllagoDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*SyllagoDetector) Patterns ¶
func (d *SyllagoDetector) Patterns() []DetectionPattern
func (*SyllagoDetector) ProviderSlug ¶
func (d *SyllagoDetector) ProviderSlug() string
type TopLevelDetector ¶
type TopLevelDetector struct{}
TopLevelDetector detects provider-agnostic content in top-level directories.
func (*TopLevelDetector) Classify ¶
func (d *TopLevelDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*TopLevelDetector) Patterns ¶
func (d *TopLevelDetector) Patterns() []DetectionPattern
func (*TopLevelDetector) ProviderSlug ¶
func (d *TopLevelDetector) ProviderSlug() string
type ValidationIssue ¶
type ValidationIssue struct {
ItemName string
DeclaredType string
DetectedType catalog.ContentType
Path string
Severity string // "warning", "error"
Message string
}
ValidationIssue describes a disagreement between registry.yaml and file content.
func ValidateManifest ¶
func ValidateManifest(m *registry.Manifest, repoRoot string) []ValidationIssue
ValidateManifest cross-checks an authored registry.yaml against actual file content.
type WalkResult ¶
WalkResult holds all file paths collected during a walk.
func Walk ¶
func Walk(root string, extraExcludeDirs []string) WalkResult
Walk collects all non-excluded file paths under root. extraExcludeDirs are appended to defaultExcludeDirs. root must already be filepath.EvalSymlinks-resolved.
type WindsurfDetector ¶
type WindsurfDetector struct{}
WindsurfDetector detects Windsurf content.
func (*WindsurfDetector) Classify ¶
func (d *WindsurfDetector) Classify(path string, repoRoot string) ([]*DetectedItem, error)
func (*WindsurfDetector) Patterns ¶
func (d *WindsurfDetector) Patterns() []DetectionPattern
func (*WindsurfDetector) ProviderSlug ¶
func (d *WindsurfDetector) ProviderSlug() string
Source Files
¶
- analyzer.go
- confidence.go
- dedup.go
- detector_cc.go
- detector_cc_plugin.go
- detector_content_signal.go
- detector_copilot.go
- detector_cursor.go
- detector_simple.go
- detector_syllago.go
- detector_toplevel.go
- helpers.go
- manifest.go
- match.go
- reanalysis.go
- references.go
- sanitize.go
- scanconfig.go
- types.go
- validate.go
- vocabulary.go
- walk.go