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

Function extractComponentsFromProject

src/api/testing.go:1590–1672  ·  view source on GitHub ↗

extractComponentsFromProject extracts component information from an existing project

(proj *project.Project)

Source from the content-addressed store, hash-verified

1588func extractComponentsFromProject(proj *project.Project) map[string]interface{} {
1589 componentCounts := map[string]int{
1590 "inputs": 0,
1591 "outputs": 0,
1592 "rulesets": 0,
1593 "agents": 0,
1594 }
1595
1596 components := map[string][]string{
1597 "inputs": {},
1598 "outputs": {},
1599 "rulesets": {},
1600 "agents": {},
1601 }
1602
1603 // Extract unique component names from FlowNodes
1604 inputNames := make(map[string]bool)
1605 outputNames := make(map[string]bool)
1606 rulesetNames := make(map[string]bool)
1607 agentNames := make(map[string]bool)
1608
1609 for _, node := range proj.FlowNodes {
1610 if node.FromType == "INPUT" {
1611 inputNames[node.FromID] = true
1612 }
1613 if node.FromType == "OUTPUT" {
1614 outputNames[node.FromID] = true
1615 }
1616 if node.FromType == "RULESET" {
1617 rulesetNames[node.FromID] = true
1618 }
1619 if node.FromType == "AGENT" {
1620 agentNames[node.FromID] = true
1621 }
1622
1623 if node.ToType == "INPUT" {
1624 inputNames[node.ToID] = true
1625 }
1626 if node.ToType == "OUTPUT" {
1627 outputNames[node.ToID] = true
1628 }
1629 if node.ToType == "RULESET" {
1630 rulesetNames[node.ToID] = true
1631 }
1632 if node.ToType == "AGENT" {
1633 agentNames[node.ToID] = true
1634 }
1635 }
1636
1637 // Convert to sorted slices
1638 for name := range inputNames {
1639 components["inputs"] = append(components["inputs"], name)
1640 }
1641 for name := range outputNames {
1642 components["outputs"] = append(components["outputs"], name)
1643 }
1644 for name := range rulesetNames {
1645 components["rulesets"] = append(components["rulesets"], name)
1646 }
1647 for name := range agentNames {

Callers 1

getProjectComponentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected