MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / setupFileWatchers

Method setupFileWatchers

src/services/skills/SkillsManager.ts:648–685  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

646 }
647
648 private async setupFileWatchers(): Promise<void> {
649 // Skip if test environment is detected or VSCode APIs are not available
650 if (process.env.NODE_ENV === "test" || !vscode.workspace.createFileSystemWatcher) {
651 return
652 }
653
654 const provider = this.providerRef.deref()
655 if (!provider?.cwd) return
656
657 // Watch for changes in skills directories
658 const globalRooDir = getGlobalRooDirectory()
659 const globalAgentsDir = getGlobalAgentsDirectory()
660 const projectRooDir = path.join(provider.cwd, ".roo")
661 const projectAgentsDir = getProjectAgentsDirectoryForCwd(provider.cwd)
662
663 // Watch global .roo skills directory
664 this.watchDirectory(path.join(globalRooDir, "skills"))
665
666 // Watch global .agents skills directory
667 this.watchDirectory(path.join(globalAgentsDir, "skills"))
668
669 // Watch project .roo skills directory
670 this.watchDirectory(path.join(projectRooDir, "skills"))
671
672 // Watch project .agents skills directory
673 this.watchDirectory(path.join(projectAgentsDir, "skills"))
674
675 // Watch mode-specific directories for all available modes
676 const modesList = await this.getAvailableModes()
677 for (const mode of modesList) {
678 // .roo mode-specific
679 this.watchDirectory(path.join(globalRooDir, `skills-${mode}`))
680 this.watchDirectory(path.join(projectRooDir, `skills-${mode}`))
681 // .agents mode-specific
682 this.watchDirectory(path.join(globalAgentsDir, `skills-${mode}`))
683 this.watchDirectory(path.join(projectAgentsDir, `skills-${mode}`))
684 }
685 }
686
687 private watchDirectory(dirPath: string): void {
688 if (process.env.NODE_ENV === "test" || !vscode.workspace.createFileSystemWatcher) {

Callers 1

initializeMethod · 0.95

Calls 5

watchDirectoryMethod · 0.95
getAvailableModesMethod · 0.95
getGlobalRooDirectoryFunction · 0.90
getGlobalAgentsDirectoryFunction · 0.90

Tested by

no test coverage detected