From d9d65f1ff1efd702935dc09a3b2aa04147889451 Mon Sep 17 00:00:00 2001 From: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Date: Mon, 24 Aug 2026 02:09:55 +0530 Subject: [PATCH] fix: re-running `init` fails to remove tab-separated `install` lines - dese - crates\cli\src\commands\init.rs: treat tab-separated install lines like space-separated Fixes #200 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> --- COMMITMSG | 7 +++++++ crates/cli/src/commands/init.rs | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 COMMITMSG diff --git a/COMMITMSG b/COMMITMSG new file mode 100644 index 0000000..dac93c1 --- /dev/null +++ b/COMMITMSG @@ -0,0 +1,7 @@ +fix: re-running `init` fails to remove tab-separated `install` lines - dese + +- crates\cli\src\commands\init.rs: treat tab-separated install lines like space-separated + +Fixes #200 + +Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> diff --git a/crates/cli/src/commands/init.rs b/crates/cli/src/commands/init.rs index f612f56..00d653a 100644 --- a/crates/cli/src/commands/init.rs +++ b/crates/cli/src/commands/init.rs @@ -15,12 +15,21 @@ const GITIGNORE_ENTRIES: &[&str] = &[".skillfile/cache/", ".skillfile/conflict"] /// Build a new manifest string with install lines replaced. /// Pure transformation: takes existing content and new targets, returns new content. + +fn is_install_line(stripped: &str) -> bool { + let rest = match stripped.strip_prefix("install") { + Some(r) => r, + None => return false, + }; + rest.is_empty() || rest.starts_with(char::is_whitespace) +} + fn build_manifest_with_targets(existing: &str, new_targets: &[(String, String)]) -> String { let mut non_install: Vec<&str> = existing .lines() .filter(|line| { let stripped = line.trim(); - !stripped.starts_with("install ") && stripped != "install" + !is_install_line(stripped) && stripped != "install" }) .collect();