Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(plugins): keep plugin trees and shell scripts LF on every checkout
AkitaOnRailsf4c8e3293eb6
diff --git a/.gitattributes b/.gitattributesindex be3e364f..2e2d0329 100644--- a/.gitattributes+++ b/.gitattributes@@ -3,3 +3,15 @@crates/ai-memory-core/src/routing_skills/*/SKILL.md text eol=lfcrates/ai-memory-core/src/routing_skills/*.md text eol=lfcrates/ai-memory-consolidate/prompts/*.md text eol=lf++# Generated plugin trees, catalogs and the templates they are rendered from:+# the drift test compares bytes, and a CRLF launcher breaks `sh` on Unix+# ("/bin/sh^M"), so these stay LF on every checkout. Windows-native .ps1/.cmd+# files keep the default policy.+plugins/** text eol=lf+.claude-plugin/* text eol=lf+.agents/plugins/* text eol=lf+crates/ai-memory-cli/templates/plugin/* text eol=lf+LICENSE text eol=lf+*.sh text eol=lf+install.sh text eol=lfdiff --git a/crates/ai-memory-cli/src/commands/render_plugins.rs b/crates/ai-memory-cli/src/commands/render_plugins.rsindex 306bbc32..78926790 100644--- a/crates/ai-memory-cli/src/commands/render_plugins.rs+++ b/crates/ai-memory-cli/src/commands/render_plugins.rs@@ -61,14 +61,24 @@ pub struct PluginFile {}impl PluginFile {+ /// Every constructor goes through here. The templates and LICENSE are+ /// `include_str!`ed, so a CRLF checkout (Windows `core.autocrlf`) would+ /// otherwise ship `/bin/sh^M` launchers and break the drift test.fn text(path: impl Into<String>, contents: impl Into<String>) -> Self {Self {path: path.into(),- contents: contents.into(),+ contents: contents.into().replace("\r\n", "\n"),executable: false,}}+ fn script(path: impl Into<String>, contents: impl Into<String>) -> Self {+ Self {+ executable: true,+ ..Self::text(path, contents)+ }+ }+fn json(path: impl Into<String>, value: &Value) -> Self {let mut contents = serde_json::to_string_pretty(value).unwrap_or_default();contents.push('\n');@@ -134,11 +144,7 @@ fn codex_catalog(version: &str) -> Value {/// status skill and the license.fn common_files(dir: &str) -> Vec<PluginFile> {let mut files = vec![- PluginFile {- path: format!("{dir}/{LAUNCHER_PATH}"),- contents: LAUNCHER.to_owned(),- executable: true,- },+ PluginFile::script(format!("{dir}/{LAUNCHER_PATH}"), LAUNCHER),PluginFile::text(format!("{dir}/LICENSE"), LICENSE),PluginFile::text(format!("{dir}/skills/status/SKILL.md"), STATUS_SKILL),];@@ -416,6 +422,17 @@ mod tests {}}+ #[test]+ fn rendered_files_are_lf_even_from_a_crlf_checkout() {+ let launcher = PluginFile::script("x", "#!/bin/sh\r\nexec \"$bin\"\r\n");+ assert_eq!(launcher.contents, "#!/bin/sh\nexec \"$bin\"\n");+ assert!(launcher.executable);+ assert_eq!(PluginFile::text("y", "a\r\nb").contents, "a\nb");+ for file in render("1.0.0") {+ assert!(!file.contents.contains('\r'), "{}", file.path);+ }+ }+#[test]fn render_writes_the_tree_with_an_executable_launcher() {let temp = tempfile::tempdir().unwrap();