Skip to content

Commit 61a24d0

Browse files
authored
Merge pull request #5 from sopaco/v2
Remove unused imports and simplify directory creation logic
2 parents 9d66df5 + 46d6a3c commit 61a24d0

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

crates/cowork-core/src/pipeline/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ pub fn create_cowork_pipeline(config: &ModelConfig) -> Result<Arc<dyn Agent>> {
5252
/// This function intelligently determines which stage to resume from
5353
/// by checking what data files already exist.
5454
pub fn create_resume_pipeline(config: &ModelConfig) -> Result<Arc<dyn Agent>> {
55-
use crate::storage::*;
5655
use std::path::Path;
5756

58-
let llm = create_llm_client(&config.llm)?;
57+
let _llm = create_llm_client(&config.llm)?;
5958

6059
// Determine which stage to start from based on existing data
6160
let start_stage = if Path::new(".cowork/artifacts/delivery_report.md").exists() {

crates/cowork-core/src/storage/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ const COWORK_DIR: &str = ".cowork";
1212
/// Get the .cowork directory path, create if not exists
1313
pub fn get_cowork_dir() -> Result<PathBuf> {
1414
let path = PathBuf::from(COWORK_DIR);
15-
if !path.exists() {
16-
fs::create_dir_all(&path)
17-
.with_context(|| format!("Failed to create .cowork directory at {:?}", path))?;
18-
19-
// Create subdirectories
20-
fs::create_dir_all(path.join("data"))?;
21-
fs::create_dir_all(path.join("artifacts"))?;
22-
fs::create_dir_all(path.join("session"))?;
23-
fs::create_dir_all(path.join("logs"))?;
24-
}
15+
16+
// Create main directory and subdirectories (create_dir_all is idempotent and safe for concurrent calls)
17+
// We don't need to check if it exists first - create_dir_all handles that
18+
fs::create_dir_all(&path)
19+
.with_context(|| format!("Failed to create .cowork directory at {:?}", path))?;
20+
fs::create_dir_all(path.join("data"))?;
21+
fs::create_dir_all(path.join("artifacts"))?;
22+
fs::create_dir_all(path.join("session"))?;
23+
fs::create_dir_all(path.join("logs"))?;
24+
2525
Ok(path)
2626
}
2727

crates/cowork-core/src/storage/storage_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#[cfg(test)]
22
mod tests {
33
use crate::storage::*;
4-
use crate::data::*;
54
use tempfile::TempDir;
65
use std::env;
76

0 commit comments

Comments
 (0)