MCPcopy Create free account
hub / github.com/diillson/chatcli / appendMatchingRules

Function appendMatchingRules

cli/workspace/context_builder.go:228–245  ·  view source on GitHub ↗

appendMatchingRules appends path-specific rules for any file-like hints, mirroring the rule-loading logic shared by the prefix builders.

(rules *RulesLoader, hints []string, parts []string)

Source from the content-addressed store, hash-verified

226// appendMatchingRules appends path-specific rules for any file-like hints,
227// mirroring the rule-loading logic shared by the prefix builders.
228func appendMatchingRules(rules *RulesLoader, hints []string, parts []string) []string {
229 if rules == nil || len(hints) == 0 {
230 return parts
231 }
232 var pathHints []string
233 for _, h := range hints {
234 if strings.Contains(h, ".") || strings.Contains(h, "/") {
235 pathHints = append(pathHints, h)
236 }
237 }
238 if len(pathHints) == 0 {
239 return parts
240 }
241 if rc := rules.LoadMatchingRules(pathHints); rc != "" {
242 parts = append(parts, rc)
243 }
244 return parts
245}
246
247// BuildDynamicContext returns time-sensitive and session-aware context.
248// Includes current time, working directory, and disambiguation instructions

Callers 1

Calls 1

LoadMatchingRulesMethod · 0.80

Tested by

no test coverage detected