MCPcopy Index your code
hub / github.com/Microck/opencode-studio / findRulesFile

Function findRulesFile

server/index.js:940–956  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

938};
939
940const findRulesFile = () => {
941 const configPath = getConfigPath();
942 if (!configPath) return { path: null, source: 'none' };
943
944 let dir = path.dirname(configPath);
945 let last = null;
946 while (dir && dir !== last) {
947 const agentsPath = path.join(dir, 'AGENTS.md');
948 if (fs.existsSync(agentsPath)) return { path: agentsPath, source: 'AGENTS.md' };
949 const claudePath = path.join(dir, 'CLAUDE.md');
950 if (fs.existsSync(claudePath)) return { path: claudePath, source: 'CLAUDE.md' };
951 last = dir;
952 dir = path.dirname(dir);
953 }
954
955 return { path: null, source: 'none' };
956};
957
958const detectTool = (tool) => {
959 const command = process.platform === 'win32' ? `where ${tool}` : `which ${tool}`;

Callers 1

index.jsFile · 0.85

Calls 1

getConfigPathFunction · 0.85

Tested by

no test coverage detected