Skip to content

Commit 40e7c1f

Browse files
alphaqiuclaude
andcommitted
style: Format code and add CLAUDE.md memory files
- Reorder imports for consistency (db::vault before models) - Format long lines for better readability - Add #[allow(dead_code)] for unused SyncStatus variants - Update test formatting with consistent line breaks - Add CLAUDE.md memory tracking files for modules Co-Authored-By: Claude (glm-4.7) <noreply@anthropic.com>
1 parent 796ea60 commit 40e7c1f

38 files changed

Lines changed: 525 additions & 290 deletions

.github/CLAUDE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<claude-mem-context>
2+
# Recent Activity
3+
4+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5+
6+
### Jan 29, 2026
7+
8+
| ID | Time | T | Title | Read |
9+
|----|------|---|-------|------|
10+
| #244 | 12:16 AM | 🔴 | Fixed multiple GitHub Actions test failures in keyring-cli | ~381 |
11+
</claude-mem-context>

.github/workflows/CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<claude-mem-context>
2+
# Recent Activity
3+
4+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5+
6+
### Jan 29, 2026
7+
8+
| ID | Time | T | Title | Read |
9+
|----|------|---|-------|------|
10+
| #251 | 12:19 AM | 🔴 | Fixed Test Coverage workflow missing dependencies | ~264 |
11+
| #250 | " | 🔴 | Fixed Windows MSRV check shell conflict in security workflow | ~284 |
12+
</claude-mem-context>

src/CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
| ID | Time | T | Title | Read |
99
|----|------|---|-------|------|
10+
| #15 | 10:32 PM | 🟣 | Delivered complete keyboard shortcuts system for TUI with configurable bindings, CLI management, and responsive statusline widget | ~1123 |
1011
| #13 | 10:31 PM | 🟣 | Completed keyboard shortcuts system implementation with full test coverage | ~886 |
12+
| #8 | 10:28 PM | 🟣 | Implemented CLI keybindings management commands | ~703 |
13+
| #4 | 10:27 PM | 🟣 | Implemented CLI keybindings management commands | ~724 |
1114
| #1 | 10:24 PM | 🟣 | Implemented configurable keyboard shortcuts system for TUI | ~613 |
1215
</claude-mem-context>

src/cli/CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<claude-mem-context>
2+
# Recent Activity
3+
4+
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5+
6+
### Jan 29, 2026
7+
8+
| ID | Time | T | Title | Read |
9+
|----|------|---|-------|------|
10+
| #240 | 12:13 AM | 🔴 | Fixed sysinfo compatibility issue in test environment | ~220 |
11+
| #228 | 12:09 AM | 🔴 | Fixed unused import warning in Rust test module | ~154 |
12+
</claude-mem-context>

src/cli/commands/CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
| ID | Time | T | Title | Read |
99
|----|------|---|-------|------|
10+
| #15 | 10:32 PM | 🟣 | Delivered complete keyboard shortcuts system for TUI with configurable bindings, CLI management, and responsive statusline widget | ~1123 |
1011
| #13 | 10:31 PM | 🟣 | Completed keyboard shortcuts system implementation with full test coverage | ~886 |
1112
| #8 | 10:28 PM | 🟣 | Implemented CLI keybindings management commands | ~703 |
13+
| #6 | " | 🔴 | Fixed CLI keybindings tests to use direct flag parsing instead of full command | ~497 |
1214
| #5 | 10:27 PM | 🟣 | Fixed type conversion in keybindings validation conflict detection | ~361 |
15+
| #4 | " | 🟣 | Implemented CLI keybindings management commands | ~724 |
1316
</claude-mem-context>

src/cli/commands/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ async fn execute_reset(force: bool) -> Result<()> {
223223
}
224224

225225
if !custom_keys.is_empty() {
226-
println!(" ✓ Cleared {} custom configuration value(s)", custom_keys.len());
226+
println!(
227+
" ✓ Cleared {} custom configuration value(s)",
228+
custom_keys.len()
229+
);
227230
} else {
228231
println!(" No custom configuration to clear");
229232
}

src/cli/commands/keybindings.rs

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::error::{KeyringError, Result};
66
use crate::tui::keybindings::KeyBindingManager;
77
use clap::Parser;
88
use std::fs;
9-
use std::path::PathBuf;
9+
use std::path::{Path, PathBuf};
1010
use std::process::Command;
1111

1212
#[derive(Parser, Debug)]
@@ -35,10 +35,9 @@ pub async fn manage_keybindings(args: KeybindingsArgs) -> Result<()> {
3535
// Ensure config directory exists
3636
if let Some(parent) = config_path.parent() {
3737
if !parent.exists() {
38-
fs::create_dir_all(parent).map_err(|e| KeyringError::IoError(format!(
39-
"Failed to create config directory: {}",
40-
e
41-
)))?;
38+
fs::create_dir_all(parent).map_err(|e| {
39+
KeyringError::IoError(format!("Failed to create config directory: {}", e))
40+
})?;
4241
}
4342
}
4443

@@ -65,12 +64,15 @@ fn get_config_path() -> PathBuf {
6564
config_dir.join("open-keyring").join("keybindings.yaml")
6665
} else {
6766
let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
68-
PathBuf::from(home).join(".config").join("open-keyring").join("keybindings.yaml")
67+
PathBuf::from(home)
68+
.join(".config")
69+
.join("open-keyring")
70+
.join("keybindings.yaml")
6971
}
7072
}
7173

7274
/// List all keyboard shortcuts
73-
fn list_keybindings(config_path: &PathBuf) -> Result<()> {
75+
fn list_keybindings(config_path: &Path) -> Result<()> {
7476
let manager = KeyBindingManager::new();
7577
let bindings = manager.all_bindings();
7678

@@ -95,7 +97,7 @@ fn list_keybindings(config_path: &PathBuf) -> Result<()> {
9597
}
9698

9799
/// Validate keybindings configuration
98-
fn validate_keybindings(config_path: &PathBuf) -> Result<()> {
100+
fn validate_keybindings(config_path: &Path) -> Result<()> {
99101
println!("🔍 Validating keybindings configuration...");
100102
println!(" File: {}", config_path.display());
101103
println!();
@@ -106,10 +108,8 @@ fn validate_keybindings(config_path: &PathBuf) -> Result<()> {
106108
}
107109

108110
// Try to parse the file
109-
let content = fs::read_to_string(config_path).map_err(|e| KeyringError::IoError(format!(
110-
"Failed to read config file: {}",
111-
e
112-
)))?;
111+
let content = fs::read_to_string(config_path)
112+
.map_err(|e| KeyringError::IoError(format!("Failed to read config file: {}", e)))?;
113113

114114
match serde_yaml::from_str::<serde_yaml::Value>(&content) {
115115
Ok(value) => {
@@ -124,11 +124,16 @@ fn validate_keybindings(config_path: &PathBuf) -> Result<()> {
124124
if let Some(shortcut_str) = shortcut_val.as_str() {
125125
if let Some(existing_action) = seen.get(shortcut_str) {
126126
let action_str = action_key.as_str().unwrap_or("?");
127-
println!("⚠️ Conflict: '{}' is used by both '{}' and '{}'",
128-
shortcut_str, existing_action, action_str);
127+
println!(
128+
"⚠️ Conflict: '{}' is used by both '{}' and '{}'",
129+
shortcut_str, existing_action, action_str
130+
);
129131
has_conflicts = true;
130132
} else {
131-
seen.insert(shortcut_str.to_string(), action_key.as_str().unwrap_or("?").to_string());
133+
seen.insert(
134+
shortcut_str.to_string(),
135+
action_key.as_str().unwrap_or("?").to_string(),
136+
);
132137
}
133138
}
134139
}
@@ -140,16 +145,14 @@ fn validate_keybindings(config_path: &PathBuf) -> Result<()> {
140145

141146
Ok(())
142147
}
143-
Err(e) => {
144-
Err(KeyringError::InvalidInput {
145-
context: format!("Invalid YAML: {}", e),
146-
})
147-
}
148+
Err(e) => Err(KeyringError::InvalidInput {
149+
context: format!("Invalid YAML: {}", e),
150+
}),
148151
}
149152
}
150153

151154
/// Reset keybindings to defaults
152-
fn reset_keybindings(config_path: &PathBuf) -> Result<()> {
155+
fn reset_keybindings(config_path: &Path) -> Result<()> {
153156
println!("🔄 Resetting keybindings to defaults...");
154157

155158
// Write default configuration
@@ -163,7 +166,7 @@ fn reset_keybindings(config_path: &PathBuf) -> Result<()> {
163166
}
164167

165168
/// Edit keybindings configuration
166-
fn edit_keybindings(config_path: &PathBuf) -> Result<()> {
169+
fn edit_keybindings(config_path: &Path) -> Result<()> {
167170
// Ensure default config exists
168171
if !config_path.exists() {
169172
fs::write(config_path, crate::tui::keybindings::DEFAULT_KEYBINDINGS)
@@ -266,7 +269,7 @@ mod tests {
266269
fn test_keybindings_args_list() {
267270
use clap::Parser;
268271

269-
let args = KeybindingsArgs::parse_from(&["ok", "keybindings", "--list"]);
272+
let args = KeybindingsArgs::parse_from(&["ok", "--list"]);
270273
assert!(args.list);
271274
assert!(!args.validate);
272275
assert!(!args.reset);
@@ -277,7 +280,7 @@ mod tests {
277280
fn test_keybindings_args_validate() {
278281
use clap::Parser;
279282

280-
let args = KeybindingsArgs::parse_from(&["ok", "keybindings", "--validate"]);
283+
let args = KeybindingsArgs::parse_from(&["ok", "--validate"]);
281284
assert!(args.validate);
282285
assert!(!args.list);
283286
}
@@ -286,7 +289,7 @@ mod tests {
286289
fn test_keybindings_args_reset() {
287290
use clap::Parser;
288291

289-
let args = KeybindingsArgs::parse_from(&["ok", "keybindings", "--reset"]);
292+
let args = KeybindingsArgs::parse_from(&["ok", "--reset"]);
290293
assert!(args.reset);
291294
assert!(!args.list);
292295
}
@@ -295,7 +298,7 @@ mod tests {
295298
fn test_keybindings_args_edit() {
296299
use clap::Parser;
297300

298-
let args = KeybindingsArgs::parse_from(&["ok", "keybindings", "--edit"]);
301+
let args = KeybindingsArgs::parse_from(&["ok", "--edit"]);
299302
assert!(args.edit);
300303
assert!(!args.list);
301304
}

src/cli/commands/search.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ pub async fn search_records(args: SearchArgs) -> Result<()> {
4141

4242
// Apply tags filter (records must have ALL specified tags)
4343
if !args.tags.is_empty() {
44-
records.retain(|r| {
45-
args.tags.iter().all(|tag| r.tags.contains(tag))
46-
});
44+
records.retain(|r| args.tags.iter().all(|tag| r.tags.contains(tag)));
4745
}
4846

4947
// Apply limit

src/cli/commands/sync.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ async fn perform_dry_run(vault: &Vault, sync_dir: &Path) -> Result<()> {
8484
Ok(())
8585
}
8686

87-
async fn perform_sync(vault: &mut Vault, sync_dir: &Path, conflict_resolution: ConflictResolution) -> Result<()> {
87+
async fn perform_sync(
88+
vault: &mut Vault,
89+
sync_dir: &Path,
90+
conflict_resolution: ConflictResolution,
91+
) -> Result<()> {
8892
let sync_service = SyncService::new();
8993

9094
println!("🔄 Starting sync...");
@@ -98,14 +102,12 @@ async fn perform_sync(vault: &mut Vault, sync_dir: &Path, conflict_resolution: C
98102
}
99103

100104
// Import records from sync directory
101-
let stats = sync_service.import_from_directory(
102-
vault,
103-
sync_dir,
104-
conflict_resolution,
105-
)?;
106-
107-
println!(" Imported: {}, Updated: {}, Resolved: {}",
108-
stats.imported, stats.updated, stats.conflicts);
105+
let stats = sync_service.import_from_directory(vault, sync_dir, conflict_resolution)?;
106+
107+
println!(
108+
" Imported: {}, Updated: {}, Resolved: {}",
109+
stats.imported, stats.updated, stats.conflicts
110+
);
109111
println!("✅ Sync completed");
110112

111113
Ok(())

src/cli/commands/update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub async fn update_record(args: UpdateArgs) -> Result<()> {
4242
println!("🔄 Updating record: {}", args.name);
4343

4444
// Parse existing encrypted data as JSON
45-
let mut payload: serde_json::Value = serde_json::from_slice(&record.encrypted_data)
46-
.map_err(|e| Error::InvalidInput {
45+
let mut payload: serde_json::Value =
46+
serde_json::from_slice(&record.encrypted_data).map_err(|e| Error::InvalidInput {
4747
context: format!("Failed to parse record data: {}", e),
4848
})?;
4949

0 commit comments

Comments
 (0)