cf-mcp 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6fedb8afb35425286a38fc55133e951e59d657d81eeffc2a92d6db9818335d3
4
- data.tar.gz: 16d0549690be339cb5ffacd3441e9851caf726623928d69eea11fcc98bb6fa87
3
+ metadata.gz: fa40d95e95c2179eeaa55f22e374232510ee6857aec12ca73ab5c438d9808f16
4
+ data.tar.gz: 1047aa59ffc741fb792778037a9e958ee3af42fec332a0653882a351277ef10f
5
5
  SHA512:
6
- metadata.gz: a35368e604a65c472533a4fec75aa5a98d7d026fd0397ed63011bd8078b493692678884997527ad85397d32d2f5a3b34c8c5ec50d9344c195123a8967ca88415
7
- data.tar.gz: e62f7e33269effca4931b1a8a85f2519422c69a14a6b54db158638385e67f09dcd74a4771bbf8ef691e256f0ca33f67ad2eb8eb93eddd7fb1ecb2b62235fe7c1
6
+ metadata.gz: dac224a9ccf242b04a8d8a801b148f71bf1e9326bf8550560045b2e34ef8501e60f44a7bfd0ea14b06d762c0ddde9b82e50e4896dd2dd7a2489ee823658f9fa3
7
+ data.tar.gz: 8ebd60174ed5d853121255db222fb34ee4baa7c033d2ebfdd0fc246d9f5cdfe5cf824a18926e49591c34b052154fdd78623e5b25675bcf4b09521f6107260796
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.10.0] - 2026-01-14
9
+
10
+ ### Added
11
+
12
+ - Multi-keyword search support: queries like "draw circle rectangle" now match items containing any keyword
13
+ - Items matching more keywords rank higher in search results
14
+
8
15
  ## [0.9.3] - 2026-01-14
9
16
 
10
17
  ### Added
@@ -105,6 +112,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105
112
  - `cf_list_category` - List items by category
106
113
  - `cf_get_details` - Get full documentation by name
107
114
 
115
+ [0.10.0]: https://github.com/pusewicz/cf-mcp/compare/v0.9.3...v0.10.0
108
116
  [0.9.3]: https://github.com/pusewicz/cf-mcp/compare/v0.9.2...v0.9.3
109
117
  [0.9.2]: https://github.com/pusewicz/cf-mcp/compare/v0.9.1...v0.9.2
110
118
  [0.9.1]: https://github.com/pusewicz/cf-mcp/compare/v0.9.0...v0.9.1
@@ -37,45 +37,62 @@ module CF
37
37
  def matches?(query)
38
38
  return true if query.nil? || query.empty?
39
39
 
40
- pattern = Regexp.new(Regexp.escape(query), Regexp::IGNORECASE)
41
- [name, brief, remarks, category].any? { |field| field&.match?(pattern) }
40
+ keywords = query.split(/\s+/).reject(&:empty?)
41
+ return true if keywords.empty?
42
+
43
+ keywords.any? do |keyword|
44
+ pattern = Regexp.new(Regexp.escape(keyword), Regexp::IGNORECASE)
45
+ [name, brief, remarks, category].any? { |field| field&.match?(pattern) }
46
+ end
42
47
  end
43
48
 
44
49
  # Returns a relevance score for ranking search results.
45
50
  # Higher scores indicate better matches.
51
+ # Supports multi-keyword queries - scores are summed across all keywords.
46
52
  def relevance_score(query)
47
53
  return 0 if query.nil? || query.empty?
48
54
 
55
+ keywords = query.split(/\s+/).reject(&:empty?)
56
+ return 0 if keywords.empty?
57
+
58
+ keywords.sum { |keyword| keyword_score(keyword) }
59
+ end
60
+
61
+ private
62
+
63
+ def keyword_score(keyword)
49
64
  score = 0
50
- query_downcase = query.downcase
65
+ keyword_downcase = keyword.downcase
51
66
  name_downcase = name&.downcase || ""
52
67
 
53
68
  # Exact name match (highest priority)
54
- if name_downcase == query_downcase
69
+ if name_downcase == keyword_downcase
55
70
  score += 1000
56
- # Name starts with query (prefix match)
57
- elsif name_downcase.start_with?(query_downcase)
71
+ # Name starts with keyword (prefix match)
72
+ elsif name_downcase.start_with?(keyword_downcase)
58
73
  score += 500
59
- # Name ends with query (suffix match, e.g., "make_app" matches "cf_make_app")
60
- elsif name_downcase.end_with?(query_downcase)
74
+ # Name ends with keyword (suffix match)
75
+ elsif name_downcase.end_with?(keyword_downcase)
61
76
  score += 400
62
- # Name contains query
63
- elsif name_downcase.include?(query_downcase)
77
+ # Name contains keyword
78
+ elsif name_downcase.include?(keyword_downcase)
64
79
  score += 100
65
80
  end
66
81
 
67
- # Brief contains query
68
- score += 50 if brief&.downcase&.include?(query_downcase)
82
+ # Brief contains keyword
83
+ score += 50 if brief&.downcase&.include?(keyword_downcase)
69
84
 
70
- # Category contains query
71
- score += 30 if category&.downcase&.include?(query_downcase)
85
+ # Category contains keyword
86
+ score += 30 if category&.downcase&.include?(keyword_downcase)
72
87
 
73
- # Remarks contains query
74
- score += 10 if remarks&.downcase&.include?(query_downcase)
88
+ # Remarks contains keyword
89
+ score += 10 if remarks&.downcase&.include?(keyword_downcase)
75
90
 
76
91
  score
77
92
  end
78
93
 
94
+ public
95
+
79
96
  def source_urls
80
97
  return nil unless source_file
81
98
  # Header file URLs (include/cute_xxx.h)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CF
4
4
  module MCP
5
- VERSION = "0.9.3"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Usewicz