assistant: Remove some re-exports (#23262)

Marshall Bowers created

This PR removes some re-exports from the `assistant` to make it clearer
what its constituent modules depend on.

Release Notes:

- N/A

Change summary

Cargo.lock                                    |  3 +++
crates/assistant/src/assistant.rs             | 21 ++++++++++-----------
crates/assistant/src/context/context_tests.rs |  3 ++-
crates/assistant/src/context_store.rs         |  3 +--
crates/assistant/src/prompt_library.rs        |  2 +-
crates/assistant/src/slash_command.rs         |  2 +-
crates/assistant/src/slash_command_picker.rs  |  2 +-
crates/collab/Cargo.toml                      |  4 +++-
crates/collab/src/tests/integration_tests.rs  |  4 +++-
crates/zed/Cargo.toml                         |  1 +
crates/zed/src/zed.rs                         |  2 +-
11 files changed, 27 insertions(+), 20 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -2622,6 +2622,7 @@ dependencies = [
  "anthropic",
  "anyhow",
  "assistant",
+ "assistant_slash_command",
  "assistant_tool",
  "async-stripe",
  "async-trait",
@@ -2678,6 +2679,7 @@ dependencies = [
  "pretty_assertions",
  "project",
  "prometheus",
+ "prompt_library",
  "prost 0.9.0",
  "rand 0.8.5",
  "recent_projects",
@@ -16246,6 +16248,7 @@ dependencies = [
  "project",
  "project_panel",
  "project_symbols",
+ "prompt_library",
  "proto",
  "recent_projects",
  "release_channel",

crates/assistant/src/assistant.rs 🔗

@@ -12,35 +12,34 @@ pub mod slash_command_settings;
 mod streaming_diff;
 mod terminal_inline_assistant;
 
-pub use ::prompt_library::PromptBuilder;
-use ::prompt_library::PromptLoadingParams;
-pub use assistant_panel::{AssistantPanel, AssistantPanelEvent};
+use std::path::PathBuf;
+use std::sync::Arc;
+
+use ::prompt_library::{PromptBuilder, PromptLoadingParams};
 use assistant_settings::AssistantSettings;
 use assistant_slash_command::SlashCommandRegistry;
-pub use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet};
 use assistant_slash_commands::{ProjectSlashCommandFeatureFlag, SearchSlashCommandFeatureFlag};
 use client::{proto, Client};
 use command_palette_hooks::CommandPaletteFilter;
-pub use context::*;
-pub use context_store::*;
 use feature_flags::FeatureFlagAppExt;
 use fs::Fs;
 use gpui::impl_internal_actions;
 use gpui::{actions, AppContext, Global, SharedString, UpdateGlobal};
-pub(crate) use inline_assistant::*;
 use language_model::{
     LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage,
 };
-pub use patch::*;
 use semantic_index::{CloudEmbeddingProvider, SemanticDb};
 use serde::{Deserialize, Serialize};
 use settings::{Settings, SettingsStore};
-use std::path::PathBuf;
-use std::sync::Arc;
-pub(crate) use streaming_diff::*;
 use util::ResultExt;
 
+pub use crate::assistant_panel::{AssistantPanel, AssistantPanelEvent};
+pub use crate::context::*;
+pub use crate::context_store::*;
+pub(crate) use crate::inline_assistant::*;
+pub use crate::patch::*;
 use crate::slash_command_settings::SlashCommandSettings;
+pub(crate) use crate::streaming_diff::*;
 
 actions!(
     assistant,

crates/assistant/src/context/context_tests.rs 🔗

@@ -1,7 +1,7 @@
 use super::{AssistantEdit, MessageCacheMetadata};
 use crate::{
     assistant_panel, AssistantEditKind, CacheStatus, Context, ContextEvent, ContextId,
-    ContextOperation, InvokedSlashCommandId, MessageId, MessageStatus, PromptBuilder,
+    ContextOperation, InvokedSlashCommandId, MessageId, MessageStatus,
 };
 use anyhow::Result;
 use assistant_slash_command::{
@@ -22,6 +22,7 @@ use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Rol
 use parking_lot::Mutex;
 use pretty_assertions::assert_eq;
 use project::Project;
+use prompt_library::PromptBuilder;
 use rand::prelude::*;
 use serde_json::json;
 use settings::SettingsStore;

crates/assistant/src/context_store.rs 🔗

@@ -1,10 +1,9 @@
-use crate::SlashCommandId;
 use crate::{
     Context, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext,
     SavedContextMetadata,
 };
 use anyhow::{anyhow, Context as _, Result};
-use assistant_slash_command::SlashCommandWorkingSet;
+use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet};
 use assistant_tool::{ToolId, ToolWorkingSet};
 use client::{proto, telemetry::Telemetry, Client, TypedEnvelope};
 use clock::ReplicaId;

crates/assistant/src/prompt_library.rs 🔗

@@ -1,6 +1,6 @@
-use crate::SlashCommandWorkingSet;
 use crate::{slash_command::SlashCommandCompletionProvider, AssistantPanel, InlineAssistant};
 use anyhow::Result;
+use assistant_slash_command::SlashCommandWorkingSet;
 use collections::{HashMap, HashSet};
 use editor::{actions::Tab, CurrentLineHighlight, Editor, EditorElement, EditorEvent, EditorStyle};
 use gpui::{

crates/assistant/src/slash_command.rs 🔗

@@ -1,8 +1,8 @@
 use crate::assistant_panel::ContextEditor;
-use crate::SlashCommandWorkingSet;
 use anyhow::Result;
 use assistant_slash_command::AfterCompletion;
 pub use assistant_slash_command::SlashCommand;
+use assistant_slash_command::SlashCommandWorkingSet;
 use editor::{CompletionProvider, Editor};
 use fuzzy::{match_strings, StringMatchCandidate};
 use gpui::{Model, Task, ViewContext, WeakView, WindowContext};

crates/assistant/src/slash_command_picker.rs 🔗

@@ -1,11 +1,11 @@
 use std::sync::Arc;
 
+use assistant_slash_command::SlashCommandWorkingSet;
 use gpui::{AnyElement, DismissEvent, SharedString, Task, WeakView};
 use picker::{Picker, PickerDelegate, PickerEditorPosition};
 use ui::{prelude::*, ListItem, ListItemSpacing, PopoverMenu, PopoverTrigger, Tooltip};
 
 use crate::assistant_panel::ContextEditor;
-use crate::SlashCommandWorkingSet;
 
 #[derive(IntoElement)]
 pub(super) struct SlashCommandSelector<T: PopoverTrigger> {

crates/collab/Cargo.toml 🔗

@@ -79,8 +79,8 @@ uuid.workspace = true
 
 [dev-dependencies]
 assistant = { workspace = true, features = ["test-support"] }
+assistant_slash_command.workspace = true
 assistant_tool.workspace = true
-context_server.workspace = true
 async-trait.workspace = true
 audio.workspace = true
 call = { workspace = true, features = ["test-support"] }
@@ -88,6 +88,7 @@ channel.workspace = true
 client = { workspace = true, features = ["test-support"] }
 collab_ui = { workspace = true, features = ["test-support"] }
 collections = { workspace = true, features = ["test-support"] }
+context_server.workspace = true
 ctor.workspace = true
 editor = { workspace = true, features = ["test-support"] }
 env_logger.workspace = true
@@ -108,6 +109,7 @@ node_runtime.workspace = true
 notifications = { workspace = true, features = ["test-support"] }
 pretty_assertions.workspace = true
 project = { workspace = true, features = ["test-support"] }
+prompt_library.workspace = true
 recent_projects = { workspace = true }
 release_channel.workspace = true
 remote = { workspace = true, features = ["test-support"] }

crates/collab/src/tests/integration_tests.rs 🔗

@@ -6,13 +6,15 @@ use crate::{
     },
 };
 use anyhow::{anyhow, Result};
-use assistant::{ContextStore, PromptBuilder, SlashCommandWorkingSet};
+use assistant::ContextStore;
+use assistant_slash_command::SlashCommandWorkingSet;
 use assistant_tool::ToolWorkingSet;
 use call::{room, ActiveCall, ParticipantLocation, Room};
 use client::{User, RECEIVE_TIMEOUT};
 use collections::{HashMap, HashSet};
 use fs::{FakeFs, Fs as _, RemoveOptions};
 use futures::{channel::mpsc, StreamExt as _};
+use prompt_library::PromptBuilder;
 
 use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode};
 use gpui::{

crates/zed/Cargo.toml 🔗

@@ -87,6 +87,7 @@ profiling.workspace = true
 project.workspace = true
 project_panel.workspace = true
 project_symbols.workspace = true
+prompt_library.workspace = true
 proto.workspace = true
 recent_projects.workspace = true
 release_channel.workspace = true

crates/zed/src/zed.rs 🔗

@@ -12,7 +12,6 @@ pub(crate) mod windows_only_instance;
 use anyhow::Context as _;
 pub use app_menus::*;
 use assets::Assets;
-use assistant::PromptBuilder;
 use breadcrumbs::Breadcrumbs;
 use client::{zed_urls, ZED_URL_SCHEME};
 use collections::VecDeque;
@@ -32,6 +31,7 @@ use outline_panel::OutlinePanel;
 use paths::{local_settings_file_relative_path, local_tasks_file_relative_path};
 use project::{DirectoryLister, ProjectItem};
 use project_panel::ProjectPanel;
+use prompt_library::PromptBuilder;
 use quick_action_bar::QuickActionBar;
 use recent_projects::open_ssh_project;
 use release_channel::{AppCommitSha, ReleaseChannel};