Add language-specific prompt injection for toolchain guidance

- Add language_prompts module that auto-detects programming languages in workspace
- Scan for language files with depth limit (2) to inject relevant toolchain prompts
- Add prompts/langs/ directory for language-specific markdown files
- Include Racket/raco toolchain guidance as first language prompt
- Update combine_project_content() to accept language_content parameter
- Integrate language detection into main CLI flow and agent mode
- Update project memory with new feature documentation
This commit is contained in:
Dhanji R. Prasanna
2026-01-14 21:00:52 +05:30
parent 716d598bd8
commit afec65fd50
6 changed files with 230 additions and 6 deletions

View File

@@ -90,12 +90,13 @@ pub fn combine_project_content(
agents_content: Option<String>,
readme_content: Option<String>,
memory_content: Option<String>,
language_content: Option<String>,
workspace_dir: &Path,
) -> Option<String> {
// Always include working directory to prevent LLM from hallucinating paths
let cwd_info = format!("📂 Working Directory: {}", workspace_dir.display());
let parts: Vec<String> = [Some(cwd_info), agents_content, readme_content, memory_content]
let parts: Vec<String> = [Some(cwd_info), agents_content, readme_content, memory_content, language_content]
.into_iter()
.flatten()
.collect();
@@ -222,6 +223,7 @@ mod tests {
Some("agents".to_string()),
Some("readme".to_string()),
Some("memory".to_string()),
Some("language".to_string()),
&workspace,
);
assert!(result.is_some());
@@ -230,12 +232,13 @@ mod tests {
assert!(content.contains("agents"));
assert!(content.contains("readme"));
assert!(content.contains("memory"));
assert!(content.contains("language"));
}
#[test]
fn test_combine_project_content_partial() {
let workspace = std::path::PathBuf::from("/test/workspace");
let result = combine_project_content(None, Some("readme".to_string()), None, &workspace);
let result = combine_project_content(None, Some("readme".to_string()), None, None, &workspace);
assert!(result.is_some());
let content = result.unwrap();
assert!(content.contains("📂 Working Directory: /test/workspace"));
@@ -245,7 +248,7 @@ mod tests {
#[test]
fn test_combine_project_content_all_none() {
let workspace = std::path::PathBuf::from("/test/workspace");
let result = combine_project_content(None, None, None, &workspace);
let result = combine_project_content(None, None, None, None, &workspace);
// Now always returns Some because we always include the working directory
assert!(result.is_some());
assert!(result.unwrap().contains("📂 Working Directory: /test/workspace"));