a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
51 lines
1.7 KiB
Go
51 lines
1.7 KiB
Go
package excludes
|
|
|
|
import (
|
|
"path"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// agentConfigRoots are editor/agent state directories that Builtin
|
|
// excludes wholesale (their bulk content — settings, transcripts, skills —
|
|
// is noise) but which may also carry an MCP server config the
|
|
// MCP-config-as-graph feature wants in the graph. Callers descend these
|
|
// subtrees and index only the MCP config files within them; see the
|
|
// indexer's shouldExclude.
|
|
var agentConfigRoots = []string{".claude", ".kiro"}
|
|
|
|
// mcpConfigExactBasenames and mcpConfigSuffix mirror the MCP config
|
|
// extractor's Extensions() (internal/parser/languages/mcp_config.go) —
|
|
// keep them in sync. ".mcp.json" is matched as a suffix (so a repo-root
|
|
// ".mcp.json" or "x.mcp.json" qualifies); the rest are exact basenames.
|
|
var mcpConfigExactBasenames = map[string]bool{
|
|
"mcp.json": true,
|
|
"claude_desktop_config.json": true,
|
|
}
|
|
|
|
const mcpConfigSuffix = ".mcp.json"
|
|
|
|
// InAgentConfigDir reports whether a repo-root-relative path is the root
|
|
// of, or lives under, one of the agent-config directories (.claude/,
|
|
// .kiro/). Used to carve a descend-but-only-MCP-configs exception out of
|
|
// the wholesale Builtin exclusion of those directories.
|
|
func InAgentConfigDir(relPath string) bool {
|
|
rel := strings.TrimPrefix(filepath.ToSlash(relPath), "./")
|
|
for _, root := range agentConfigRoots {
|
|
if rel == root || strings.HasPrefix(rel, root+"/") {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// IsMCPConfigFile reports whether a path's basename is a recognised MCP
|
|
// server config file name.
|
|
func IsMCPConfigFile(relPath string) bool {
|
|
base := path.Base(filepath.ToSlash(relPath))
|
|
if mcpConfigExactBasenames[base] {
|
|
return true
|
|
}
|
|
return strings.HasSuffix(base, mcpConfigSuffix)
|
|
}
|