Files
coder/agent/agentcontext/defaults.go
T
Kyle Carberry 8cd7f9ad4e fix(agent/agentcontext): preserve skill source precedence (#28443)
Duplicate workspace skills were sorted by source path before chat
hydration, so alphabetical paths could override the order configured in
`CODER_AGENT_EXP_SKILLS_DIRS`.

Resolve duplicate valid skill names before deterministic sorting and
persistence, with user-declared sources evaluated in configured order
ahead of built-in and working-directory discovery. This PR was generated
by Coder Agents.
2026-08-24 15:36:49 -07:00

33 lines
1.2 KiB
Go

package agentcontext
// defaultBuiltinRoots returns the scan roots layered after
// user-added sources and before working-directory discovery. These mirror the
// agentcontextconfig API resolves at every chat hydrate. The
// list is intentionally tolerant of missing entries; the
// resolver silently skips canonicalization failures and
// non-existent paths.
func defaultBuiltinRoots() []string {
return []string{
// User-level Coder config.
"~/.coder",
"~/.coder/skills",
// Claude Code plugin cache, picked up by the plugin
// RFC follow-up. v1 ignores plugin manifests, but
// watching the directory now prevents a surprise
// dirty bit when the resolver eventually classifies
// them.
"~/.claude/plugins/cache",
}
}
// defaultAllowedRoots returns the allow-list applied to runtime
// AddSource calls when ManagerOptions.AllowedRoots is empty.
// The set matches the RFC's authorization section: the home
// directory's Coder and Claude config trees. The Manager
// appends the working directory lazily on every check, which
// picks up the workspace's resolved path even when the manifest
// is loaded after agent init.
func defaultAllowedRoots() []string {
return []string{"~", "~/.coder", "~/.claude"}
}