Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(dev): preserve hook line endings with Windows awk
Éverton Toffanetto90e8acefe306
diff --git a/crates/ai-memory-cli/tests/suite/packaging.rs b/crates/ai-memory-cli/tests/suite/packaging.rsindex 409f678b..52902c52 100644--- a/crates/ai-memory-cli/tests/suite/packaging.rs+++ b/crates/ai-memory-cli/tests/suite/packaging.rs@@ -1967,8 +1967,11 @@ fn pre_push_hook_replaces_crlf_markers_and_stale_block_in_place() {std::fs::write(&fixture.hook, format!("{before}# >>> ai-memory pre-push >>>\r\necho stale-block\r\n# <<< ai-memory pre-push <<<\r\n{after}")).unwrap();fixture.install_hook();let installed = std::fs::read_to_string(&fixture.hook).unwrap();- assert!(installed.starts_with(before));- assert!(installed.ends_with(after));+ assert!(+ installed.starts_with(before),+ "changed prefix: {installed:?}"+ );+ assert!(installed.ends_with(after), "changed suffix: {installed:?}");assert!(!installed.contains("stale-block"));assert!(installed.contains("git rev-parse --local-env-vars"));fixture.install_hook();diff --git a/scripts/install-git-hooks.sh b/scripts/install-git-hooks.shindex 1c10df55..60722910 100755--- a/scripts/install-git-hooks.sh+++ b/scripts/install-git-hooks.sh@@ -79,8 +79,8 @@ fimkdir -p "${hook%/*}"tmp=$(mktemp "${hook}.XXXXXX")if [[ "$has_content" -eq 1 ]]; then- # ENVIRON preserves the block's backslashes; awk -v would interpret them.- if ! AI_MEMORY_PRE_PUSH_BLOCK="$managed_block" awk -v begin="$begin" -v end="$end" '+ # ENVIRON preserves backslashes; BINMODE prevents Windows CRLF translation.+ if ! AI_MEMORY_PRE_PUSH_BLOCK="$managed_block" awk -v BINMODE=3 -v begin="$begin" -v end="$end" '{marker = $0sub(/\r$/, "", marker)