completely remove the skipping first player logic
This commit is contained in:
@@ -1703,16 +1703,6 @@ async fn run_autonomous(
|
|||||||
let loop_start = Instant::now();
|
let loop_start = Instant::now();
|
||||||
output.print("🔄 Starting coach-player feedback loop...");
|
output.print("🔄 Starting coach-player feedback loop...");
|
||||||
|
|
||||||
// Check if implementation files already exist
|
|
||||||
let skip_first_player = project.has_implementation_files(agent.ui_writer());
|
|
||||||
if skip_first_player {
|
|
||||||
output.print("📂 Detected existing implementation files in workspace");
|
|
||||||
output.print("⏭️ Skipping first player turn - proceeding directly to coach review");
|
|
||||||
} else {
|
|
||||||
output.print("📂 No existing implementation files detected");
|
|
||||||
output.print("🎯 Starting with player implementation");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load fast-discovery messages before the loop starts (if enabled)
|
// Load fast-discovery messages before the loop starts (if enabled)
|
||||||
let (discovery_messages, discovery_working_dir): (Vec<g3_providers::Message>, Option<String>) =
|
let (discovery_messages, discovery_working_dir): (Vec<g3_providers::Message>, Option<String>) =
|
||||||
if let Some(ref codebase_path) = codebase_fast_start {
|
if let Some(ref codebase_path) = codebase_fast_start {
|
||||||
|
|||||||
@@ -1297,11 +1297,6 @@ impl<W: UiWriter> Agent<W> {
|
|||||||
self.providers.get(None)
|
self.providers.get(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a reference to the UI writer
|
|
||||||
pub fn ui_writer(&self) -> &W {
|
|
||||||
&self.ui_writer
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the current session ID for this agent
|
/// Get the current session ID for this agent
|
||||||
pub fn get_session_id(&self) -> Option<&str> {
|
pub fn get_session_id(&self) -> Option<&str> {
|
||||||
self.session_id.as_deref()
|
self.session_id.as_deref()
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::exit;
|
|
||||||
|
|
||||||
use crate::ui_writer::UiWriter;
|
|
||||||
|
|
||||||
/// Represents a G3 project with workspace configuration
|
/// Represents a G3 project with workspace configuration
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -101,50 +98,6 @@ impl Project {
|
|||||||
self.requirements_text.is_some() || self.requirements_path.is_some()
|
self.requirements_text.is_some() || self.requirements_path.is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if implementation files exist in the workspace
|
|
||||||
pub fn has_implementation_files<W: UiWriter>(&self, ui_writer: &W) -> bool {
|
|
||||||
self.check_dir_for_implementation_files(&self.workspace_dir, ui_writer)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Recursively check a directory for implementation files
|
|
||||||
#[allow(clippy::only_used_in_recursion)]
|
|
||||||
fn check_dir_for_implementation_files<W: UiWriter>(&self, dir: &Path, ui_writer: &W) -> bool {
|
|
||||||
// Common source file extensions
|
|
||||||
let extensions = vec![
|
|
||||||
"swift", "rs", "py", "js", "ts", "java", "cpp", "c",
|
|
||||||
"go", "rb", "php", "cs", "kt", "scala", "m", "h"
|
|
||||||
];
|
|
||||||
|
|
||||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
|
||||||
for entry in entries.flatten() {
|
|
||||||
let path = entry.path();
|
|
||||||
|
|
||||||
if path.is_file() {
|
|
||||||
// Check if it's a source file
|
|
||||||
if let Some(ext) = path.extension() {
|
|
||||||
if let Some(ext_str) = ext.to_str() {
|
|
||||||
if extensions.contains(&ext_str) {
|
|
||||||
ui_writer.println(&format!("⚠️⚠️Existing implementation file found: {}", path.display()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if path.is_dir() {
|
|
||||||
// Skip hidden directories and common non-source directories
|
|
||||||
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
|
|
||||||
if !name.starts_with('.') && name != "logs" && name != "target" && name != "node_modules" {
|
|
||||||
// Recursively check subdirectories
|
|
||||||
if self.check_dir_for_implementation_files(&path, ui_writer) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read the requirements file content
|
/// Read the requirements file content
|
||||||
pub fn read_requirements(&self) -> Result<Option<String>> {
|
pub fn read_requirements(&self) -> Result<Option<String>> {
|
||||||
// Prioritize requirements text override
|
// Prioritize requirements text override
|
||||||
|
|||||||
Reference in New Issue
Block a user