feat(cli): wire up --include-prompt in main CLI and agent mode

Updates lib.rs and agent_mode.rs to read the include prompt file
and pass it through to combine_project_content(). The include prompt
is placed after language prompts but before project memory.
This commit is contained in:
Dhanji R. Prasanna
2026-01-17 15:19:55 +05:30
parent 56e8fddfc4
commit e45d5b25f3
2 changed files with 10 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ use tracing::debug;
use g3_core::ui_writer::UiWriter;
use g3_core::Agent;
use crate::project_files::{combine_project_content, read_agents_config, read_project_memory, read_project_readme};
use crate::project_files::{combine_project_content, read_agents_config, read_include_prompt, read_project_memory, read_project_readme};
use crate::language_prompts::{get_language_prompts_for_workspace, get_agent_language_prompts_for_workspace_with_langs};
use crate::simple_output::SimpleOutput;
use crate::embedded_agents::load_agent_prompt;
@@ -25,6 +25,7 @@ pub async fn run_agent_mode(
chrome_headless: bool,
safari: bool,
chat: bool,
include_prompt_path: Option<PathBuf>,
) -> Result<()> {
use g3_core::find_incomplete_agent_session;
use g3_core::get_agent_system_prompt;
@@ -186,12 +187,16 @@ pub async fn run_agent_mode(
system_prompt
};
// Read include prompt if specified
let include_prompt = read_include_prompt(include_prompt_path.as_deref());
// Combine all content for the agent's context
let combined_content = combine_project_content(
agents_content_opt,
readme_content_opt,
memory_content_opt,
language_content,
include_prompt,
&workspace_dir,
);

View File

@@ -33,7 +33,7 @@ use accumulative::run_accumulative_mode;
use agent_mode::run_agent_mode;
use autonomous::run_autonomous;
use interactive::run_interactive;
use project_files::{combine_project_content, read_agents_config, read_project_memory, read_project_readme};
use project_files::{combine_project_content, read_agents_config, read_include_prompt, read_project_memory, read_project_readme};
use simple_output::SimpleOutput;
use ui_writer_impl::ConsoleUiWriter;
use utils::{initialize_logging, load_config_with_cli_overrides, setup_workspace_directory};
@@ -89,6 +89,7 @@ pub async fn run() -> Result<()> {
cli.chrome_headless,
cli.safari,
cli.chat,
cli.include_prompt.clone(),
)
.await;
}
@@ -101,6 +102,7 @@ pub async fn run() -> Result<()> {
let readme_content = read_project_readme(&workspace_dir);
let memory_content = read_project_memory(&workspace_dir);
let language_content = language_prompts::get_language_prompts_for_workspace(&workspace_dir);
let include_prompt = read_include_prompt(cli.include_prompt.as_deref());
// Create project model
let project = create_project(&cli, &workspace_dir)?;
@@ -113,7 +115,7 @@ pub async fn run() -> Result<()> {
let config = load_config_with_cli_overrides(&cli)?;
// Combine AGENTS.md, README, and memory content
let combined_content = combine_project_content(agents_content, readme_content, memory_content, language_content, &workspace_dir);
let combined_content = combine_project_content(agents_content, readme_content, memory_content, language_content, include_prompt, &workspace_dir);
run_console_mode(cli, config, project, combined_content, workspace_dir).await
}