codex: add dynamic tool hook support

This commit is contained in:
Andrei Eternal
2026-05-01 19:39:56 -07:00
parent bacaeb7060
commit c98b0d1925
9 changed files with 1122 additions and 20 deletions
+25
View File
@@ -194,6 +194,14 @@ mod tests {
fn literal_matcher_uses_exact_matching() {
assert!(matches_matcher(Some("Bash"), Some("Bash")));
assert!(!matches_matcher(Some("Bash"), Some("BashOutput")));
assert!(matches_matcher(
Some("dynamic__codex_app__automation_update"),
Some("dynamic__codex_app__automation_update")
));
assert!(!matches_matcher(
Some("dynamic__codex_app"),
Some("dynamic__codex_app__automation_update")
));
assert!(matches_matcher(
Some("mcp__memory__create_entities"),
Some("mcp__memory__create_entities")
@@ -228,6 +236,23 @@ mod tests {
assert_eq!(validate_matcher_pattern("mcp__memory__.*"), Ok(()));
}
#[test]
fn dynamic_matchers_support_regex_wildcards() {
assert!(matches_matcher(
Some("dynamic__codex_app__.*"),
Some("dynamic__codex_app__automation_update")
));
assert!(matches_matcher(
Some("dynamic__.*__automation_update"),
Some("dynamic__codex_app__automation_update")
));
assert!(!matches_matcher(
Some("dynamic__other_app__.*"),
Some("dynamic__codex_app__automation_update")
));
assert_eq!(validate_matcher_pattern("dynamic__codex_app__.*"), Ok(()));
}
#[test]
fn matcher_supports_anchored_regexes() {
assert!(matches_matcher(Some("^Bash$"), Some("Bash")));