Skip to content

Commit 392f96d

Browse files
committed
deprecates use of profile flags
1 parent dec2a80 commit 392f96d

File tree

4 files changed

+35
-26
lines changed

4 files changed

+35
-26
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use knowledge::KnowledgeSubcommand;
2323
use mcp::McpArgs;
2424
use model::ModelArgs;
2525
use persist::PersistSubcommand;
26-
use profile::ProfileSubcommand;
26+
use profile::AgentSubcommand;
2727
use prompts::PromptsArgs;
2828
use tools::ToolsArgs;
2929

@@ -47,9 +47,9 @@ pub enum SlashCommand {
4747
Quit,
4848
/// Clear the conversation history
4949
Clear(ClearArgs),
50-
/// Manage profiles
51-
#[command(subcommand)]
52-
Profile(ProfileSubcommand),
50+
/// Manage agents
51+
#[command(subcommand, aliases = ["profile"])]
52+
Agent(AgentSubcommand),
5353
/// Manage context files for the chat session
5454
#[command(subcommand)]
5555
Context(ContextSubcommand),
@@ -89,7 +89,7 @@ impl SlashCommand {
8989
match self {
9090
Self::Quit => Ok(ChatState::Exit),
9191
Self::Clear(args) => args.execute(session).await,
92-
Self::Profile(subcommand) => subcommand.execute(os, session).await,
92+
Self::Agent(subcommand) => subcommand.execute(os, session).await,
9393
Self::Context(args) => args.execute(os, session).await,
9494
Self::Knowledge(subcommand) => subcommand.execute(os, session).await,
9595
Self::PromptEditor(args) => args.execute(session).await,

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ use crate::util::directories::chat_global_agent_path;
1717
#[deny(missing_docs)]
1818
#[derive(Debug, PartialEq, Subcommand)]
1919
#[command(
20-
before_long_help = "Profiles allow you to organize and manage different sets of context files for different projects or tasks.
20+
before_long_help = "Agents allow you to organize and manage different sets of context files for different projects or tasks.
2121
2222
Notes
23-
• The \"global\" profile contains context files that are available in all profiles
24-
• The \"default\" profile is used when no profile is specified
25-
• You can switch between profiles to work on different projects
26-
• Each profile maintains its own set of context files"
23+
• Launch q chat with a specific agent with --agent
24+
• Construct an agent under ~/.aws/amazonq/agents/ (accessible globally) or cwd/.aws/amazonq/agents (accessible in workspace)
25+
• See example config under global directory
26+
• Set default agent to assume with settings by running \"q settings chat.defaultAgent agent_name\"
27+
• Each agent maintains its own set of context and customizations"
2728
)]
28-
pub enum ProfileSubcommand {
29+
pub enum AgentSubcommand {
2930
/// List all available profiles
3031
List,
3132
/// Create a new profile with the specified name
@@ -38,7 +39,7 @@ pub enum ProfileSubcommand {
3839
Rename { old_name: String, new_name: String },
3940
}
4041

41-
impl ProfileSubcommand {
42+
impl AgentSubcommand {
4243
pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
4344
let agents = &session.conversation.agents;
4445

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ pub struct ChatArgs {
153153
#[arg(short, long)]
154154
pub resume: bool,
155155
/// Context profile to use
156-
#[arg(long = "profile")]
157-
pub profile: Option<String>,
156+
#[arg(long = "agent", alias = "profile")]
157+
pub agent: Option<String>,
158158
/// Current model to use
159159
#[arg(long = "model")]
160160
pub model: Option<String>,
@@ -178,13 +178,21 @@ impl ChatArgs {
178178
bail!("Input must be supplied when running in non-interactive mode");
179179
}
180180

181+
let args: Vec<String> = std::env::args().collect();
182+
if args
183+
.iter()
184+
.any(|arg| arg == "--profile" || arg.starts_with("--profile="))
185+
{
186+
eprintln!("Warning: --profile is deprecated, use --agent instead");
187+
}
188+
181189
let stdout = std::io::stdout();
182190
let mut stderr = std::io::stderr();
183191

184192
let agents = {
185193
let mut default_agent_name = None::<String>;
186-
let agent_name = if let Some(profile) = self.profile.as_deref() {
187-
Some(profile)
194+
let agent_name = if let Some(agent) = self.agent.as_deref() {
195+
Some(agent)
188196
} else if let Some(agent) = os.database.settings.get_string(Setting::ChatDefaultAgent) {
189197
default_agent_name.replace(agent);
190198
default_agent_name.as_deref()
@@ -194,7 +202,7 @@ impl ChatArgs {
194202
let mut agents = Agents::load(os, agent_name, self.non_interactive, &mut stderr).await;
195203
agents.trust_all_tools = self.trust_all_tools;
196204

197-
if let Some(name) = self.profile.as_ref() {
205+
if let Some(name) = self.agent.as_ref() {
198206
match agents.switch(name) {
199207
Ok(agent) if !agent.mcp_servers.mcp_servers.is_empty() => {
200208
if !self.non_interactive

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ mod test {
352352
subcommand: Some(RootSubcommand::Chat(ChatArgs {
353353
resume: false,
354354
input: None,
355-
profile: None,
355+
agent: None,
356356
model: None,
357357
trust_all_tools: false,
358358
trust_tools: None,
@@ -391,7 +391,7 @@ mod test {
391391
RootSubcommand::Chat(ChatArgs {
392392
resume: false,
393393
input: None,
394-
profile: Some("my-profile".to_string()),
394+
agent: Some("my-profile".to_string()),
395395
model: None,
396396
trust_all_tools: false,
397397
trust_tools: None,
@@ -407,7 +407,7 @@ mod test {
407407
RootSubcommand::Chat(ChatArgs {
408408
resume: false,
409409
input: Some("Hello".to_string()),
410-
profile: Some("my-profile".to_string()),
410+
agent: Some("my-profile".to_string()),
411411
model: None,
412412
trust_all_tools: false,
413413
trust_tools: None,
@@ -423,7 +423,7 @@ mod test {
423423
RootSubcommand::Chat(ChatArgs {
424424
resume: false,
425425
input: None,
426-
profile: Some("my-profile".to_string()),
426+
agent: Some("my-profile".to_string()),
427427
model: None,
428428
trust_all_tools: true,
429429
trust_tools: None,
@@ -439,7 +439,7 @@ mod test {
439439
RootSubcommand::Chat(ChatArgs {
440440
resume: true,
441441
input: None,
442-
profile: None,
442+
agent: None,
443443
model: None,
444444
trust_all_tools: false,
445445
trust_tools: None,
@@ -451,7 +451,7 @@ mod test {
451451
RootSubcommand::Chat(ChatArgs {
452452
resume: true,
453453
input: None,
454-
profile: None,
454+
agent: None,
455455
model: None,
456456
trust_all_tools: false,
457457
trust_tools: None,
@@ -467,7 +467,7 @@ mod test {
467467
RootSubcommand::Chat(ChatArgs {
468468
resume: false,
469469
input: None,
470-
profile: None,
470+
agent: None,
471471
model: None,
472472
trust_all_tools: true,
473473
trust_tools: None,
@@ -483,7 +483,7 @@ mod test {
483483
RootSubcommand::Chat(ChatArgs {
484484
resume: false,
485485
input: None,
486-
profile: None,
486+
agent: None,
487487
model: None,
488488
trust_all_tools: false,
489489
trust_tools: Some(vec!["".to_string()]),
@@ -499,7 +499,7 @@ mod test {
499499
RootSubcommand::Chat(ChatArgs {
500500
resume: false,
501501
input: None,
502-
profile: None,
502+
agent: None,
503503
model: None,
504504
trust_all_tools: false,
505505
trust_tools: Some(vec!["fs_read".to_string(), "fs_write".to_string()]),

0 commit comments

Comments
 (0)