1
0
This commit is contained in:
2026-02-27 22:09:13 +09:00
commit 6f3c9d25a8
11 changed files with 422 additions and 0 deletions

18
src/core/writer.rs Normal file
View File

@@ -0,0 +1,18 @@
use anyhow::{Context, Result};
use std::fs;
use std::path::PathBuf;
fn config_dir() -> PathBuf {
dirs::config_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("aigpt")
}
pub fn save_memory(content: &str) -> Result<()> {
let dir = config_dir();
fs::create_dir_all(&dir)
.with_context(|| format!("Failed to create {}", dir.display()))?;
let path = dir.join("memory.md");
fs::write(&path, content)
.with_context(|| format!("Failed to write {}", path.display()))
}