mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
Group external agent config migration into a module (#35992)
## What changed - Move the migration flow, model, and source picker under the `external_agent_config_migration` module. - Keep their tests and snapshots alongside the corresponding module files and update imports and snapshot source paths. GitOrigin-RevId: 4b2f83ca689534e4d9cd1dc7aaa8424e76166bba
This commit is contained in:
committed by
copyberry
parent
1da9f846b3
commit
f9b18d04ba
@@ -132,7 +132,7 @@ impl App {
|
||||
self.fetch_plugins_list(app_server_client, cwd);
|
||||
if should_report_completion {
|
||||
self.chat_widget.add_plain_history_lines(
|
||||
crate::external_agent_config_migration_flow::external_agent_config_migration_finished_lines(notification),
|
||||
crate::external_agent_config_migration::flow::external_agent_config_migration_finished_lines(notification),
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::session_lifecycle::ThreadAttachPresentation;
|
||||
use super::*;
|
||||
use crate::app_server_session::ForkGoalContinuation;
|
||||
use crate::config_update::format_config_error;
|
||||
use crate::external_agent_config_migration_flow::ExternalAgentConfigMigrationFlowOutcome;
|
||||
use crate::external_agent_config_migration::flow::ExternalAgentConfigMigrationFlowOutcome;
|
||||
#[cfg(target_os = "windows")]
|
||||
use codex_config::types::WindowsSandboxModeToml;
|
||||
|
||||
@@ -118,7 +118,7 @@ impl App {
|
||||
tui.frame_requester().schedule_frame();
|
||||
}
|
||||
AppEvent::OpenExternalAgentConfigMigration => {
|
||||
match crate::external_agent_config_migration_flow::handle_external_agent_config_migration_prompt(
|
||||
match crate::external_agent_config_migration::flow::handle_external_agent_config_migration_prompt(
|
||||
tui,
|
||||
app_server,
|
||||
&self.config,
|
||||
@@ -130,7 +130,7 @@ impl App {
|
||||
}
|
||||
Ok(ExternalAgentConfigMigrationFlowOutcome::NoItems) => {
|
||||
self.chat_widget.add_info_message(
|
||||
crate::external_agent_config_migration_flow::EXTERNAL_AGENT_CONFIG_MIGRATION_NO_ITEMS_MESSAGE
|
||||
crate::external_agent_config_migration::flow::EXTERNAL_AGENT_CONFIG_MIGRATION_NO_ITEMS_MESSAGE
|
||||
.to_string(),
|
||||
/*hint*/ None,
|
||||
);
|
||||
|
||||
+8
-7
@@ -1,11 +1,5 @@
|
||||
use crate::app_server_session::AppServerSession;
|
||||
use crate::app_server_session::EXTERNAL_AGENT_CONFIG_IMPORT_IN_PROGRESS_MESSAGE;
|
||||
use crate::external_agent_config_migration::ExternalAgentConfigMigrationOutcome;
|
||||
use crate::external_agent_config_migration::run_external_agent_config_migration_prompt;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_item_count;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_type_label;
|
||||
use crate::external_agent_config_migration_source::ExternalAgentConfigMigrationSource;
|
||||
use crate::external_agent_config_migration_source::run_external_agent_config_source_prompt;
|
||||
use crate::legacy_core::config::Config;
|
||||
use crate::tui;
|
||||
use codex_app_server_protocol::ExternalAgentConfigDetectParams;
|
||||
@@ -15,6 +9,13 @@ use codex_app_server_protocol::ExternalAgentConfigMigrationItemType;
|
||||
use ratatui::prelude::Stylize as _;
|
||||
use ratatui::text::Line;
|
||||
|
||||
use super::ExternalAgentConfigMigrationOutcome;
|
||||
use super::model::external_agent_config_migration_item_count;
|
||||
use super::model::external_agent_config_migration_type_label;
|
||||
use super::run_external_agent_config_migration_prompt;
|
||||
use super::source::ExternalAgentConfigMigrationSource;
|
||||
use super::source::run_external_agent_config_source_prompt;
|
||||
|
||||
pub(crate) const EXTERNAL_AGENT_CONFIG_MIGRATION_NO_ITEMS_MESSAGE: &str =
|
||||
"No compatible setup was found to import.";
|
||||
pub(crate) const EXTERNAL_AGENT_CONFIG_MIGRATION_REMOTE_UNAVAILABLE_MESSAGE: &str = "Import from other apps is unavailable in remote sessions. Start Codex locally and run /import.";
|
||||
@@ -374,5 +375,5 @@ pub(crate) async fn handle_external_agent_config_migration_prompt(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "external_agent_config_migration_flow_tests.rs"]
|
||||
#[path = "flow_tests.rs"]
|
||||
mod tests;
|
||||
+9
-5
@@ -1,9 +1,4 @@
|
||||
use crate::diff_render::display_path_for;
|
||||
use crate::external_agent_config_migration_model::ExternalAgentConfigMigrationGroupModel;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_count_summary;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_groups;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_item_detail;
|
||||
use crate::external_agent_config_migration_model::external_agent_config_migration_item_label;
|
||||
use crate::tui::FrameRequester;
|
||||
use crate::tui::Tui;
|
||||
use crate::tui::TuiEvent;
|
||||
@@ -17,7 +12,16 @@ use ratatui::prelude::Stylize as _;
|
||||
use ratatui::text::Line;
|
||||
use tokio_stream::StreamExt;
|
||||
|
||||
pub(crate) mod flow;
|
||||
mod model;
|
||||
mod render;
|
||||
mod source;
|
||||
|
||||
use self::model::ExternalAgentConfigMigrationGroupModel;
|
||||
use self::model::external_agent_config_migration_count_summary;
|
||||
use self::model::external_agent_config_migration_groups;
|
||||
use self::model::external_agent_config_migration_item_detail;
|
||||
use self::model::external_agent_config_migration_item_label;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum ExternalAgentConfigMigrationOutcome {
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration_flow_tests.rs
|
||||
source: tui/src/external_agent_config_migration/flow_tests.rs
|
||||
expression: messages
|
||||
---
|
||||
• Import started. You can keep working while it finishes.
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration_source_tests.rs
|
||||
source: tui/src/external_agent_config_migration/source_tests.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tui/src/external_agent_config_migration.rs
|
||||
source: tui/src/external_agent_config_migration/mod.rs
|
||||
expression: rendered
|
||||
---
|
||||
|
||||
+1
-1
@@ -196,5 +196,5 @@ impl WidgetRef for &ExternalAgentConfigSourceScreen {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "external_agent_config_migration_source_tests.rs"]
|
||||
#[path = "source_tests.rs"]
|
||||
mod tests;
|
||||
@@ -118,9 +118,6 @@ mod diff_render;
|
||||
mod exec_cell;
|
||||
mod exec_command;
|
||||
mod external_agent_config_migration;
|
||||
mod external_agent_config_migration_flow;
|
||||
mod external_agent_config_migration_model;
|
||||
mod external_agent_config_migration_source;
|
||||
mod external_editor;
|
||||
mod file_search;
|
||||
mod frames;
|
||||
|
||||
Reference in New Issue
Block a user