/**
* Constants for searchfox-mcp
*/
// File extension to language mappings
export const FILE_EXTENSIONS: Record<string, string> = {
".cpp": "cpp",
".cc": "cpp",
".cxx": "cpp",
".c++": "cpp",
".hpp": "cpp",
".hh": "cpp",
".hxx": "cpp",
".h++": "cpp",
".c": "c",
".h": "c",
".js": "js",
".jsm": "js",
".mjs": "js",
".jsx": "js",
".ts": "js",
".tsx": "js",
".webidl": "webidl",
".idl": "webidl",
".rs": "rust",
};
// Language to file extension mappings (for filtering)
export const LANGUAGE_EXTENSIONS: Record<string, string[]> = {
cpp: [".cpp", ".cc", ".cxx", ".c++", ".hpp", ".hh", ".hxx", ".h++", ".h"],
c: [".c", ".h"],
js: [".js", ".jsm", ".mjs", ".jsx", ".ts", ".tsx"],
webidl: [".webidl", ".idl"],
rust: [".rs"],
};
// Repository to GitHub mapping
export const REPO_GITHUB_MAPPING: Record<
string,
{ repo: string; branch: string }
> = {
"mozilla-central": {
repo: "mozilla/firefox",
branch: "main",
},
autoland: {
repo: "mozilla/firefox",
branch: "autoland",
},
"mozilla-beta": {
repo: "mozilla/firefox",
branch: "beta",
},
"mozilla-release": {
repo: "mozilla/firefox",
branch: "release",
},
"mozilla-esr115": {
repo: "mozilla/firefox",
branch: "esr115",
},
"mozilla-esr128": {
repo: "mozilla/firefox",
branch: "esr128",
},
"mozilla-esr140": {
repo: "mozilla/firefox",
branch: "esr140",
},
"comm-central": {
repo: "mozilla/releases-comm-central",
branch: "main",
},
};
// Test file patterns (for filtering)
export const TEST_PATTERNS = [
"/test/",
"/tests/",
"/testing/",
"Test.cpp",
"Test.js",
"_test.",
"_tests.",
".test.",
".tests.",
"test_",
"tests_",
];
// Generated file patterns (for filtering)
export const GENERATED_PATTERNS = [
"/generated/",
"/build/",
"/dist/",
".pb.cc",
".pb.h",
"/ipdl/",
"Binding.cpp",
"Binding.h",
];
// Third-party file patterns (for filtering)
export const THIRDPARTY_PATTERNS = [
"/third_party/",
"/thirdparty/",
"/external/",
"/vendor/",
];
// Searchfox base URL
export const SEARCHFOX_BASE_URL = "https://searchfox.org";
// Default limits
export const DEFAULT_SEARCH_LIMIT = 50;
export const DEFAULT_DEFINITION_MAX_LINES = 200;
export const DEFAULT_CALL_GRAPH_DEPTH = 1;
export const MAX_CALL_GRAPH_DEPTH = 3;
export const DEFAULT_PATH_SEARCH_LIMIT = 100;