MCPcopy Create free account
hub / github.com/dallay/agentsync / scan_agent_files

Function scan_agent_files

src/init.rs:346–917  ·  view source on GitHub ↗

Scan project for existing agent-related files

(project_root: &Path)

Source from the content-addressed store, hash-verified

344
345/// Scan project for existing agent-related files
346fn scan_agent_files(project_root: &Path) -> Result<Vec<DiscoveredFile>> {
347 let mut discovered = Vec::new();
348
349 // -------------------------------------------------------------------------
350 // Native MCP agents
351 // -------------------------------------------------------------------------
352
353 // Claude Code: CLAUDE.md
354 let claude_path = project_root.join("CLAUDE.md");
355 if claude_path.exists() {
356 discovered.push(DiscoveredFile {
357 path: "CLAUDE.md".into(),
358 file_type: AgentFileType::ClaudeInstructions,
359 display_name: "CLAUDE.md (Claude Code instructions)".to_string(),
360 });
361 }
362
363 // Claude Code: .claude/skills/ directory
364 let claude_skills_path = project_root.join(".claude").join("skills");
365 if claude_skills_path.exists() && claude_skills_path.is_dir() {
366 // Only report if directory has at least one child entry
367 let has_content = dir_has_entries(&claude_skills_path)?;
368 if has_content {
369 discovered.push(DiscoveredFile {
370 path: ".claude/skills".into(),
371 file_type: AgentFileType::ClaudeSkills,
372 display_name: "Claude Code skills (.claude/skills/)".to_string(),
373 });
374 }
375 }
376
377 // Claude Code: .claude/commands/ directory
378 let claude_commands_path = project_root.join(".claude").join("commands");
379 if claude_commands_path.exists() && claude_commands_path.is_dir() {
380 let has_content = dir_has_entries(&claude_commands_path)?;
381 if has_content {
382 discovered.push(DiscoveredFile {
383 path: ".claude/commands".into(),
384 file_type: AgentFileType::ClaudeCommands,
385 display_name: "Claude Code commands (.claude/commands/)".to_string(),
386 });
387 }
388 }
389
390 // GitHub Copilot: .github/copilot-instructions.md
391 let copilot_path = project_root.join(".github").join("copilot-instructions.md");
392 if copilot_path.exists() {
393 discovered.push(DiscoveredFile {
394 path: ".github/copilot-instructions.md".into(),
395 file_type: AgentFileType::CopilotInstructions,
396 display_name: ".github/copilot-instructions.md (Copilot instructions)".to_string(),
397 });
398 }
399
400 // Copilot: .vscode/mcp.json
401 let copilot_mcp_path = project_root.join(".vscode").join("mcp.json");
402 if copilot_mcp_path.exists() {
403 discovered.push(DiscoveredFile {

Calls 1

dir_has_entriesFunction · 0.85