From 8885543c25b17420be5770e1636c8d41ed4df52d Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 20 Mar 2026 12:13:42 +0000 Subject: [PATCH] fix overview command to match both storkit and legacy story-kit commit prefixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .story_kit → .storkit rename updated the grep pattern but all historical merge commits still use the old "story-kit:" prefix, so overview could not find any stories. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/src/matrix/commands/overview.rs | 52 ++++++++++++++++++-------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/server/src/matrix/commands/overview.rs b/server/src/matrix/commands/overview.rs index 2b98d1f..1c69129 100644 --- a/server/src/matrix/commands/overview.rs +++ b/server/src/matrix/commands/overview.rs @@ -4,7 +4,7 @@ use super::CommandContext; /// Show implementation summary for a story identified by its number. /// -/// Finds the `story-kit: merge {story_id}` commit on master, displays the +/// Finds the `storkit: merge {story_id}` commit on master, displays the /// git diff --stat (files changed with line counts), and extracts key /// function/struct/type names added or modified in the implementation. /// Returns a friendly message when no merge commit is found. @@ -82,12 +82,20 @@ pub(super) fn handle_overview(ctx: &CommandContext) -> Option { /// Find the merge commit hash for a story by its numeric ID. /// /// Searches git log for a commit whose subject matches -/// `story-kit: merge {num}_*`. +/// `storkit: merge {num}_*` or the legacy `story-kit: merge {num}_*`. fn find_story_merge_commit(root: &std::path::Path, num_str: &str) -> Option { use std::process::Command; - let grep_pattern = format!("story-kit: merge {num_str}_"); + // Match both the current prefix and the legacy one from before the rename. + let grep_pattern = format!("(storkit|story-kit): merge {num_str}_"); let output = Command::new("git") - .args(["log", "--format=%H", "--all", "--grep", &grep_pattern]) + .args([ + "log", + "--format=%H", + "--all", + "--extended-regexp", + "--grep", + &grep_pattern, + ]) .current_dir(root) .output() .ok() @@ -125,13 +133,11 @@ fn find_story_name(root: &std::path::Path, num_str: &str) -> Option { .filter(|s| !s.is_empty() && s.chars().all(|c| c.is_ascii_digit())) .unwrap_or(""); if file_num == num_str { - return std::fs::read_to_string(&path) - .ok() - .and_then(|c| { - crate::io::story_metadata::parse_front_matter(&c) - .ok() - .and_then(|m| m.name) - }); + return std::fs::read_to_string(&path).ok().and_then(|c| { + crate::io::story_metadata::parse_front_matter(&c) + .ok() + .and_then(|m| m.name) + }); } } } @@ -251,9 +257,16 @@ mod tests { #[test] fn overview_command_appears_in_help() { - let result = super::super::tests::try_cmd_addressed("Timmy", "@timmy:homeserver.local", "@timmy help"); + let result = super::super::tests::try_cmd_addressed( + "Timmy", + "@timmy:homeserver.local", + "@timmy help", + ); let output = result.unwrap(); - assert!(output.contains("overview"), "help should list overview command: {output}"); + assert!( + output.contains("overview"), + "help should list overview command: {output}" + ); } #[test] @@ -316,7 +329,11 @@ mod tests { #[test] fn overview_command_case_insensitive() { - let result = super::super::tests::try_cmd_addressed("Timmy", "@timmy:homeserver.local", "@timmy OVERVIEW 1"); + let result = super::super::tests::try_cmd_addressed( + "Timmy", + "@timmy:homeserver.local", + "@timmy OVERVIEW 1", + ); assert!(result.is_some(), "OVERVIEW should match case-insensitively"); } @@ -324,7 +341,8 @@ mod tests { #[test] fn parse_symbol_pub_fn() { - let result = parse_symbol_definition("pub fn handle_foo(ctx: &Context) -> Option {"); + let result = + parse_symbol_definition("pub fn handle_foo(ctx: &Context) -> Option {"); assert_eq!(result, Some("`handle_foo` (fn)".to_string())); } @@ -354,7 +372,9 @@ mod tests { #[test] fn parse_symbol_pub_type() { - let result = parse_symbol_definition("pub type SlackHistory = Arc>>>;"); + let result = parse_symbol_definition( + "pub type SlackHistory = Arc>>>;", + ); assert_eq!(result, Some("`SlackHistory` (type)".to_string())); } }