MCPcopy Create free account
hub / github.com/coderaidershaun/rust-auto-gippity-full-code / execute

Method execute

src/models/agents/agent_architect.rs:73–152  ·  view source on GitHub ↗
(
        &mut self,
        factsheet: &mut FactSheet,
    )

Source from the content-addressed store, hash-verified

71 }
72
73 async fn execute(
74 &mut self,
75 factsheet: &mut FactSheet,
76 ) -> Result<(), Box<dyn std::error::Error>> {
77 // !!! WARNING - BE CAREFUL OF INFINITATE LOOPS !!!
78 while self.attributes.state != AgentState::Finished {
79 match self.attributes.state {
80 AgentState::Discovery => {
81 let project_scope: ProjectScope = self.call_project_scope(factsheet).await;
82
83 // Confirm if external urls
84 if project_scope.is_external_urls_required {
85 self.call_determine_external_urls(
86 factsheet,
87 factsheet.project_description.clone(),
88 )
89 .await;
90 self.attributes.state = AgentState::UnitTesting;
91 }
92 }
93
94 AgentState::UnitTesting => {
95 let mut exclude_urls: Vec<String> = vec![];
96
97 let client: Client = Client::builder()
98 .timeout(Duration::from_secs(5))
99 .build()
100 .unwrap();
101
102 // Defining urls to check
103 let urls: &Vec<String> = factsheet
104 .external_urls
105 .as_ref()
106 .expect("No URL object on factsheet");
107
108 // Find faulty urls
109 for url in urls {
110 let endpoint_str: String = format!("Testing URL Endpoint: {}", url);
111 PrintCommand::UnitTest.print_agent_message(
112 self.attributes.position.as_str(),
113 endpoint_str.as_str(),
114 );
115
116 // Perform URL Test
117 match check_status_code(&client, url).await {
118 Ok(status_code) => {
119 if status_code != 200 {
120 exclude_urls.push(url.clone())
121 }
122 }
123 Err(e) => println!("Error checking {}: {}", url, e),
124 }
125 }
126
127 // Exclude any faulty urls
128 if exclude_urls.len() > 0 {
129 let new_urls: Vec<String> = factsheet
130 .external_urls

Callers 1

tests_solution_architectFunction · 0.45

Calls 4

check_status_codeFunction · 0.85
call_project_scopeMethod · 0.80
print_agent_messageMethod · 0.80

Tested by

no test coverage detected