Files
skillshare/internal/audit/analyzer_static.go
T
Willie 1b284e92b5 feat(audit): add semantic coloring to TUI summary footer
Labels use dim style while values use bold semantic colors, making
counts visually prominent. Threat category breakdown now colors each
category independently (injection=red, exfiltration=orange, etc.)
instead of uniform yellow, so users can distinguish threat types at
a glance.
2026-03-03 16:08:11 +08:00

28 lines
1.0 KiB
Go

package audit
// staticAnalyzer wraps regex-based rule scanning for both content and markdown links.
type staticAnalyzer struct{}
func (a *staticAnalyzer) ID() string { return AnalyzerStatic }
func (a *staticAnalyzer) Scope() AnalyzerScope { return ScopeFile }
func (a *staticAnalyzer) Analyze(ctx *AnalyzeContext) ([]Finding, error) {
if ctx.IsMarkdown {
return ScanMarkdownContentWithRules(ctx.Content, ctx.FileName, ctx.MDContentRules), nil
}
return ScanContentWithRules(ctx.Content, ctx.FileName, ctx.Rules), nil
}
// markdownLinkAnalyzer runs markdown link rule checks (skill scope — needs all MD files).
type markdownLinkAnalyzer struct{}
func (a *markdownLinkAnalyzer) ID() string { return AnalyzerStatic }
func (a *markdownLinkAnalyzer) Scope() AnalyzerScope { return ScopeSkill }
func (a *markdownLinkAnalyzer) Analyze(ctx *AnalyzeContext) ([]Finding, error) {
if len(ctx.MDFiles) == 0 || len(ctx.MDLinkRules) == 0 {
return nil, nil
}
return checkMarkdownLinkRules(ctx.MDFiles, ctx.MDLinks, ctx.MDLinkRules), nil
}