Skip to content

Commit 2eb0f07

Browse files
authored
Improve changelog rendering and clarify prompt commands (#3048)
- Sort changelog entries by change type alphabetically - Display change types in colored brackets (e.g., [Added], [Fixed]) - Clarify prompt subcommands refer to local prompts
1 parent c9d6266 commit 2eb0f07

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ pub enum PromptsSubcommand {
866866
/// Optional arguments for the prompt
867867
arguments: Option<Vec<String>>,
868868
},
869-
/// Create a new prompt
869+
/// Create a new local prompt
870870
Create {
871871
/// Name of the prompt to create
872872
#[arg(short = 'n', long)]
@@ -878,15 +878,15 @@ pub enum PromptsSubcommand {
878878
#[arg(long)]
879879
global: bool,
880880
},
881-
/// Edit an existing prompt
881+
/// Edit an existing local prompt
882882
Edit {
883883
/// Name of the prompt to edit
884884
name: String,
885885
/// Edit global prompt instead of local
886886
#[arg(long)]
887887
global: bool,
888888
},
889-
/// Remove an existing prompt
889+
/// Remove an existing local prompt
890890
Remove {
891891
/// Name of the prompt to remove
892892
name: String,

crates/chat-cli/src/cli/feed.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"changes": [
6767
{
6868
"type": "added",
69-
"description": "Add support for preToolUse and postToolUse hook - [#2875](https://github.com/aws/amazon-q-developer-cli/pull/2875)"
69+
"description": "Add support for preToolUse and postToolUse hook - [#2875](https://github.com/aws/amazon-q-developer-cli/pull/2875)"
7070
},
7171
{
7272
"type": "added",

crates/chat-cli/src/util/ui.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,21 @@ pub fn render_changelog_content(output: &mut impl Write) -> Result<()> {
4242
style::SetForegroundColor(Color::Reset),
4343
)?;
4444

45-
for change in &entry.changes {
46-
// Process **bold** syntax and remove PR links
45+
let mut sorted_changes = entry.changes.clone();
46+
sorted_changes.sort_by(|a, b| a.change_type.cmp(&b.change_type));
47+
48+
for change in &sorted_changes {
4749
let cleaned_description = clean_pr_links(&change.description);
4850
let processed_description = process_bold_text(&cleaned_description);
49-
execute!(output, style::Print("• "))?;
51+
let capitalized_type = capitalize_first_word(&change.change_type);
52+
execute!(output, style::Print("• ["))?;
53+
execute!(
54+
output,
55+
style::SetForegroundColor(Color::Magenta),
56+
style::Print(&capitalized_type),
57+
style::SetForegroundColor(Color::Reset),
58+
)?;
59+
execute!(output, style::Print("] "))?;
5060
print_with_bold(output, &processed_description)?;
5161
execute!(output, style::Print("\n"))?;
5262
}
@@ -60,6 +70,19 @@ pub fn render_changelog_content(output: &mut impl Write) -> Result<()> {
6070
Ok(())
6171
}
6272

73+
/// Capitalizes the first character of a string.
74+
fn capitalize_first_word(s: &str) -> String {
75+
let mut chars = s.chars();
76+
match chars.next() {
77+
None => String::new(),
78+
Some(first) => {
79+
let mut result = first.to_uppercase().collect::<String>();
80+
result.push_str(chars.as_str());
81+
result
82+
},
83+
}
84+
}
85+
6386
/// Removes PR links and numbers from changelog descriptions to improve readability.
6487
///
6588
/// Removes text matching the pattern " - [#NUMBER](URL)" from the end of descriptions.

0 commit comments

Comments
 (0)