MCPcopy Create free account
hub / github.com/EBWi11/AgentSmith-HUB / findProjectsUsingComponent

Function findProjectsUsingComponent

src/api/sample_data_intelligent.go:746–777  ·  view source on GitHub ↗

Find projects that use a specific component

(componentName string)

Source from the content-addressed store, hash-verified

744
745// Find projects that use a specific component
746func findProjectsUsingComponent(componentName string) []string {
747 projects := make([]string, 0)
748
749 // Extract component type and ID
750 parts := strings.Split(componentName, ".")
751 if len(parts) != 2 {
752 return projects
753 }
754
755 componentType := parts[0]
756 componentID := parts[1]
757
758 project.ForEachProject(func(projectID string, proj *project.Project) bool {
759 switch componentType {
760 case "ruleset":
761 if _, exists := proj.Rulesets[componentID]; exists {
762 projects = append(projects, projectID)
763 }
764 case "input":
765 if _, exists := proj.Inputs[componentID]; exists {
766 projects = append(projects, projectID)
767 }
768 case "output":
769 if _, exists := proj.Outputs[componentID]; exists {
770 projects = append(projects, projectID)
771 }
772 }
773 return true
774 })
775
776 return projects
777}
778
779// Get fallback sample data from any available source
780func getFallbackSampleData() []interface{} {

Callers 1

getRelatedProjectSamplesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected