(agentName: SetupAgent, scope: Scope)
| 220 | } |
| 221 | |
| 222 | async function hasRule(agentName: SetupAgent, scope: Scope): Promise<boolean> { |
| 223 | const agent = getAgent(agentName); |
| 224 | const rule = agent.rule; |
| 225 | |
| 226 | if (rule.kind === "file") { |
| 227 | const ruleDir = |
| 228 | scope === "global" ? rule.dir("global") : join(process.cwd(), rule.dir("project")); |
| 229 | return pathExists(join(ruleDir, rule.filename)); |
| 230 | } |
| 231 | |
| 232 | const filePath = |
| 233 | scope === "global" ? rule.file("global") : join(process.cwd(), rule.file("project")); |
| 234 | |
| 235 | try { |
| 236 | const existing = await readFile(filePath, "utf-8"); |
| 237 | return existing.includes(CONTEXT7_SECTION_MARKER); |
| 238 | } catch { |
| 239 | return false; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | async function hasSkill(agentName: SetupAgent, scope: Scope, skillName: string): Promise<boolean> { |
| 244 | const agent = getAgent(agentName); |
no test coverage detected