Skip to content

Commit df72776

Browse files
authored
chore(workspace): fix bugs, remove dead code, improve performance (#193)
* Comprehensive codebase cleanup: fix bugs, remove dead code, fix performance issues - Fix watcher tests: add serial_test to prevent race conditions in cortex-skills - Fix unsafe arithmetic: use saturating_sub/floor_char_boundary in TUI rendering to prevent panics on small terminal sizes - Remove dead code in cortex-tui: delete unused functions (_save_provider_api_key, _remove_mcp_server, _get_chat_area, _handle_backend_event, _handle_app_event, _handle_subagent_event, _handle_subagent_completed, _handle_subagent_failed, _get_remote_server_config, _render_tool_call, _render_subagent, _render_chat_with_welcome, _generate_welcome_lines, _generate_message_lines, _render_messages_only, calculate_messages_height, render_message, render_text_content, render_streaming_content, render_motd_compact, render_welcome_text, cmd_mcp_auth, cmd_mcp_logs, is_cjk_char, allocate_remaining, remaining_height), remove dead variables - Remove dead code in cortex-engine: move NoOpDelegate, ChannelDelegate, CompositeDelegate, TruncateTransformer, StripAnsiTransformer, NonEmptyFilter, TurnBuilder into #[cfg(test)] modules; delete unused ProfileSessionState - Performance: replace unnecessary Vec clones in config_loader and template iteration; replace format!("{}", x) with x.to_string() in 5 locations - Remove 3 unnecessary clippy lint suppressions from cortex-engine lib.rs * style: fix formatting issues — remove extra blank lines, fix import ordering * style: fix remaining formatting issue in login.rs
1 parent a936194 commit df72776

31 files changed

Lines changed: 307 additions & 1208 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ Thumbs.db
3434
# Backup files
3535
*.bak
3636
*.backup
37+
.cargo-home/
38+
.sccache/
39+
.rustup/

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cortex-tui-framework/crates/cortex-tui-text/src/wrap.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -382,33 +382,6 @@ fn is_word_break(grapheme: &str) -> bool {
382382
false
383383
}
384384

385-
/// Check if a character is a potential word break point (for CJK text).
386-
///
387-
/// CJK characters can break anywhere, so we treat them as word boundaries.
388-
#[allow(dead_code)]
389-
fn is_cjk_char(c: char) -> bool {
390-
matches!(c as u32,
391-
// CJK Unified Ideographs
392-
0x4E00..=0x9FFF |
393-
// CJK Extension A
394-
0x3400..=0x4DBF |
395-
// CJK Extension B-F (surrogate pairs in UTF-16)
396-
0x20000..=0x2A6DF |
397-
0x2A700..=0x2B73F |
398-
0x2B740..=0x2B81F |
399-
0x2B820..=0x2CEAF |
400-
0x2CEB0..=0x2EBEF |
401-
// CJK Compatibility Ideographs
402-
0xF900..=0xFAFF |
403-
// Hiragana
404-
0x3040..=0x309F |
405-
// Katakana
406-
0x30A0..=0x30FF |
407-
// Hangul Syllables
408-
0xAC00..=0xD7AF
409-
)
410-
}
411-
412385
/// Iterator that yields wrapped lines.
413386
pub struct WrapIterator<'a> {
414387
remaining: &'a str,

src/cortex-compact/src/auto_compaction/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn timestamp_now() -> u64 {
1515
/// Get current timestamp as formatted string for filenames.
1616
pub fn chrono_timestamp() -> String {
1717
let now = timestamp_now();
18-
format!("{}", now)
18+
now.to_string()
1919
}
2020

2121
/// Estimate available disk space in bytes (platform-specific).

0 commit comments

Comments
 (0)