Skip to content

Commit 4a4759a

Browse files
committed
Fix /context to use original ContextSubcommand
- /context now shows only original context functionality (pinned files) - /resource shows both indexed and pinned resources (unified view) - Updated main SlashCommand enum in mod.rs (not unified_slash_command.rs) - Fixed deprecation message for /knowledge to point to /resource
1 parent 1f4e1ac commit 4a4759a

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

crates/chat-cli/src/cli/chat/cli/mod.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub mod usage;
1818
use clap::Parser;
1919
use clear::ClearArgs;
2020
use compact::CompactArgs;
21+
use context::ContextSubcommand;
2122
use editor::EditorArgs;
2223
use hooks::HooksArgs;
2324
use knowledge::KnowledgeSubcommand;
@@ -26,8 +27,8 @@ use model::ModelArgs;
2627
use persist::PersistSubcommand;
2728
use profile::AgentSubcommand;
2829
use prompts::PromptsArgs;
30+
use resource::ResourceSubcommand;
2931
use tools::ToolsArgs;
30-
use unified_context::UnifiedContextSubcommand;
3132

3233
use crate::cli::chat::cli::subscribe::SubscribeArgs;
3334
use crate::cli::chat::cli::usage::UsageArgs;
@@ -55,9 +56,12 @@ pub enum SlashCommand {
5556
Agent(AgentSubcommand),
5657
#[command(hide = true)]
5758
Profile,
58-
/// Manage context files and knowledge base for the chat session
59+
/// Manage context files for the chat session (original functionality)
5960
#[command(subcommand)]
60-
Context(UnifiedContextSubcommand),
61+
Context(ContextSubcommand),
62+
/// Manage resources (pinned and indexed)
63+
#[command(subcommand)]
64+
Resource(ResourceSubcommand),
6165
/// (Deprecated) Use /context instead. Manage knowledge base for persistent context storage.
6266
#[command(subcommand, hide = true)]
6367
Knowledge(KnowledgeSubcommand),
@@ -118,6 +122,7 @@ impl SlashCommand {
118122
})
119123
},
120124
Self::Context(args) => args.execute(os, session).await,
125+
Self::Resource(subcommand) => subcommand.execute(os, session).await,
121126
Self::Knowledge(subcommand) => {
122127
use crossterm::{
123128
execute,
@@ -128,7 +133,7 @@ impl SlashCommand {
128133
style::SetForegroundColor(style::Color::Yellow),
129134
style::Print("The /knowledge command is deprecated. Use"),
130135
style::SetForegroundColor(style::Color::Cyan),
131-
style::Print(" /context --knowledge "),
136+
style::Print(" /resource --type indexed "),
132137
style::SetForegroundColor(style::Color::Yellow),
133138
style::Print("instead.\n"),
134139
style::ResetColor,
@@ -174,6 +179,7 @@ impl SlashCommand {
174179
Self::Agent(_) => "agent",
175180
Self::Profile => "profile",
176181
Self::Context(_) => "context",
182+
Self::Resource(_) => "resource",
177183
Self::Knowledge(_) => "knowledge",
178184
Self::PromptEditor(_) => "editor",
179185
Self::Compact(_) => "compact",
@@ -195,7 +201,7 @@ impl SlashCommand {
195201
pub fn subcommand_name(&self) -> Option<&'static str> {
196202
match self {
197203
SlashCommand::Agent(sub) => Some(sub.name()),
198-
SlashCommand::Context(sub) => Some(sub.name()),
204+
SlashCommand::Resource(sub) => Some(sub.name()),
199205
SlashCommand::Knowledge(sub) => Some(sub.name()),
200206
SlashCommand::Tools(arg) => arg.subcommand_name(),
201207
SlashCommand::Prompts(arg) => arg.subcommand_name(),

crates/chat-cli/src/cli/chat/cli/resource.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use eyre::Result;
44
use crate::cli::chat::{ChatError, ChatSession, ChatState};
55
use crate::os::Os;
66

7-
use super::context::ContextSubcommand as OriginalContextSubcommand;
7+
use super::context::ContextSubcommand;
88
use super::knowledge::KnowledgeSubcommand;
99

1010
#[derive(Clone, Debug, PartialEq, Eq, ValueEnum)]
@@ -57,9 +57,9 @@ impl ResourceSubcommand {
5757
Self::Show { expand, r#type } => {
5858
match r#type {
5959
Some(StorageType::Indexed) => KnowledgeSubcommand::Show.execute(os, session).await,
60-
Some(StorageType::Pinned) => OriginalContextSubcommand::Show { expand }.execute(os, session).await,
60+
Some(StorageType::Pinned) => ContextSubcommand::Show { expand }.execute(os, session).await,
6161
None => {
62-
OriginalContextSubcommand::Show { expand }.execute(os, session).await?;
62+
ContextSubcommand::Show { expand }.execute(os, session).await?;
6363
KnowledgeSubcommand::Show.execute(os, session).await
6464
}
6565
}
@@ -75,12 +75,12 @@ impl ResourceSubcommand {
7575
}.execute(os, session).await
7676
},
7777
StorageType::Pinned => {
78-
OriginalContextSubcommand::Add { paths, force }.execute(os, session).await
78+
ContextSubcommand::Add { paths, force }.execute(os, session).await
7979
},
8080
}
8181
},
8282
Self::Remove { paths } => {
83-
let _ = OriginalContextSubcommand::Remove { paths: paths.clone() }.execute(os, session).await;
83+
let _ = ContextSubcommand::Remove { paths: paths.clone() }.execute(os, session).await;
8484
// Remove first path from knowledge (knowledge only supports single path)
8585
if let Some(first_path) = paths.first() {
8686
KnowledgeSubcommand::Remove { path: first_path.clone() }.execute(os, session).await
@@ -91,9 +91,9 @@ impl ResourceSubcommand {
9191
Self::Clear { r#type } => {
9292
match r#type {
9393
Some(StorageType::Indexed) => KnowledgeSubcommand::Clear.execute(os, session).await,
94-
Some(StorageType::Pinned) => OriginalContextSubcommand::Clear.execute(os, session).await,
94+
Some(StorageType::Pinned) => ContextSubcommand::Clear.execute(os, session).await,
9595
None => {
96-
OriginalContextSubcommand::Clear.execute(os, session).await?;
96+
ContextSubcommand::Clear.execute(os, session).await?;
9797
KnowledgeSubcommand::Clear.execute(os, session).await
9898
}
9999
}

crates/chat-cli/src/cli/chat/cli/unified_slash_command.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::os::Os;
1010
use super::agent::AgentSubcommand;
1111
use super::clear::ClearArgs;
1212
use super::compact::CompactArgs;
13-
use super::context::ContextSubcommand as OriginalContextSubcommand;
13+
use super::context::ContextSubcommand;
1414
use super::editor::EditorArgs;
1515
use super::hooks::HooksArgs;
1616
use super::issue;
@@ -42,9 +42,9 @@ pub enum UnifiedSlashCommand {
4242
Agent(AgentSubcommand),
4343
#[command(hide = true)]
4444
Profile,
45-
/// Manage context files and knowledge base (unified interface)
45+
/// Manage context files (original functionality)
4646
#[command(subcommand)]
47-
Context(UnifiedContextSubcommand),
47+
Context(ContextSubcommand),
4848
/// Manage resources (pinned and indexed)
4949
#[command(subcommand)]
5050
Resource(ResourceSubcommand),
@@ -103,7 +103,7 @@ impl UnifiedSlashCommand {
103103
})
104104
},
105105
Self::Context(subcommand) => {
106-
// Use the new unified context system
106+
// Use original context system
107107
subcommand.execute(os, session).await
108108
},
109109
Self::Resource(subcommand) => {

0 commit comments

Comments
 (0)