consolidate hardcoded paths into config, refactor apply_agent
Move prompts_dir into Config (was hardcoded ~/poc/memory/prompts). Replace hardcoded ~/.claude/memory paths in spectral.rs, graph.rs, and main.rs with store::memory_dir() or config::get(). Replace hardcoded ~/.claude/projects in knowledge.rs and main.rs with config::get().projects_dir. Extract apply_agent_file() from cmd_apply_agent() — separates file scanning from per-file JSON parsing and link application.
This commit is contained in:
parent
52523403c5
commit
2f2c84e1c0
6 changed files with 96 additions and 96 deletions
|
|
@ -11,15 +11,9 @@ use super::scoring::{
|
|||
replay_queue, replay_queue_with_graph, detect_interference,
|
||||
};
|
||||
|
||||
/// Prompt template directory
|
||||
pub fn prompts_dir() -> std::path::PathBuf {
|
||||
let home = std::env::var("HOME").unwrap_or_default();
|
||||
std::path::PathBuf::from(home).join("poc/memory/prompts")
|
||||
}
|
||||
|
||||
/// Load a prompt template, replacing {{PLACEHOLDER}} with data
|
||||
pub fn load_prompt(name: &str, replacements: &[(&str, &str)]) -> Result<String, String> {
|
||||
let path = prompts_dir().join(format!("{}.md", name));
|
||||
let path = crate::config::get().prompts_dir.join(format!("{}.md", name));
|
||||
let mut content = std::fs::read_to_string(&path)
|
||||
.map_err(|e| format!("load prompt {}: {}", path.display(), e))?;
|
||||
for (placeholder, data) in replacements {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue