Class: Kward::Tools::CodeSearch
- Defined in:
- lib/kward/tools/code_search.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call(args, _conversation, cancellation: nil) ⇒ Object
-
#initialize(code_search:) ⇒ CodeSearch
constructor
A new instance of CodeSearch.
Methods inherited from Base
Constructor Details
#initialize(code_search:) ⇒ CodeSearch
Returns a new instance of CodeSearch.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/kward/tools/code_search.rb', line 6 def initialize(code_search:) @code_search = code_search super( "code_search", "Find package repos, cache GitHub repos, and search/read bounded snippets.", properties: { action: { type: "string", enum: %w[package_search github_search repo_clone repo_search repo_read list_cache refresh_cache clear_cache], description: "Operation." }, ecosystem: { type: "string", enum: %w[rubygems npm pypi crates go], description: "Package ecosystem." }, package: { type: "string", description: "Package." }, query: { type: "string", description: "Search query." }, repo: { type: "string", description: "GitHub URL or owner/name." }, path: { type: "string", description: "Repo-relative path." }, start_line: { type: "integer", description: "1-indexed start line." }, line_count: { type: "integer", description: "Line count; capped." }, max_results: { type: "integer", description: "Max results; capped at 50." }, context_lines: { type: "integer", description: "Context lines; capped at 5." } }, required: ["action"] ) end |
Instance Method Details
#call(args, _conversation, cancellation: nil) ⇒ Object
59 60 61 62 |
# File 'lib/kward/tools/code_search.rb', line 59 def call(args, _conversation, cancellation: nil) cancellation&.raise_if_cancelled! @code_search.call(args) end |