MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getAllAgentFiles

Function getAllAgentFiles

sdk/src/agents/load-agents.ts:108–133  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

106const agentFileExtensions = new Set(['.ts', '.tsx', '.js', '.mjs', '.cjs'])
107
108const getAllAgentFiles = (dir: string): string[] => {
109 const files: string[] = []
110 try {
111 const entries = fs.readdirSync(dir, { withFileTypes: true })
112 for (const entry of entries) {
113 const fullPath = path.join(dir, entry.name)
114 if (entry.isDirectory()) {
115 if (entry.name === 'skills') continue
116 files.push(...getAllAgentFiles(fullPath))
117 continue
118 }
119 const extension = path.extname(entry.name).toLowerCase()
120 const isAgentFile =
121 entry.isFile() &&
122 agentFileExtensions.has(extension) &&
123 !entry.name.endsWith('.d.ts') &&
124 !entry.name.endsWith('.test.ts')
125 if (isAgentFile) {
126 files.push(fullPath)
127 }
128 }
129 } catch {
130 // Expected for user agent directories that may not exist
131 }
132 return files
133}
134
135const getDefaultAgentDirs = () => {
136 const cwdAgents = path.join(process.cwd(), '.agents')

Callers 1

loadLocalAgentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected