mirror of
https://github.com/openai/codex.git
synced 2026-05-02 10:26:45 +00:00
Inline project codex home resolution
This commit is contained in:
@@ -33,7 +33,6 @@ use tracing::warn;
|
|||||||
|
|
||||||
use crate::codex::Session;
|
use crate::codex::Session;
|
||||||
use crate::codex::TurnContext;
|
use crate::codex::TurnContext;
|
||||||
use crate::config::Config;
|
|
||||||
use crate::config_loader::resolve_project_root;
|
use crate::config_loader::resolve_project_root;
|
||||||
use crate::event_mapping::parse_turn_item;
|
use crate::event_mapping::parse_turn_item;
|
||||||
use crate::tools::sandboxing::PermissionRequestPayload;
|
use crate::tools::sandboxing::PermissionRequestPayload;
|
||||||
@@ -267,9 +266,12 @@ async fn apply_execpolicy_amendment_destination(
|
|||||||
.map_err(|err| format!("failed to persist user prefix rule: {err}"))
|
.map_err(|err| format!("failed to persist user prefix rule: {err}"))
|
||||||
}
|
}
|
||||||
PermissionSuggestionDestination::ProjectSettings => {
|
PermissionSuggestionDestination::ProjectSettings => {
|
||||||
let project_codex_home = project_codex_home(turn_context.config.as_ref())
|
let config = turn_context.config.as_ref();
|
||||||
|
let project_codex_home = resolve_project_root(&config.config_layer_stack, &config.cwd)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| format!("failed to resolve project root for rules file: {err}"))?;
|
.map_err(|err| format!("failed to resolve project root for rules file: {err}"))?
|
||||||
|
.join(".codex")
|
||||||
|
.to_path_buf();
|
||||||
tokio::fs::create_dir_all(project_codex_home.join("rules"))
|
tokio::fs::create_dir_all(project_codex_home.join("rules"))
|
||||||
.await
|
.await
|
||||||
.map_err(|err| format!("failed to create project rules directory: {err}"))?;
|
.map_err(|err| format!("failed to create project rules directory: {err}"))?;
|
||||||
@@ -282,15 +284,6 @@ async fn apply_execpolicy_amendment_destination(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn project_codex_home(config: &Config) -> std::io::Result<std::path::PathBuf> {
|
|
||||||
Ok(
|
|
||||||
resolve_project_root(&config.config_layer_stack, &config.cwd)
|
|
||||||
.await?
|
|
||||||
.join(".codex")
|
|
||||||
.to_path_buf(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) async fn run_post_tool_use_hooks(
|
pub(crate) async fn run_post_tool_use_hooks(
|
||||||
sess: &Arc<Session>,
|
sess: &Arc<Session>,
|
||||||
turn_context: &Arc<TurnContext>,
|
turn_context: &Arc<TurnContext>,
|
||||||
|
|||||||
Reference in New Issue
Block a user