fix: use jq for completion name extraction to avoid nested matches
The regex "name":\s*"..." on JSON matched nested server names inside project objects, mixing resource types in completions. Switch to jq -r '.[].name' for proper top-level extraction. Add jq as RPM dependency. Add pr.sh for PR creation via Gitea API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,19 +66,18 @@ function __mcpctl_get_resource_type
|
||||
end
|
||||
end
|
||||
|
||||
# Fetch resource names dynamically from the API
|
||||
# Fetch resource names dynamically from the API (jq extracts only top-level names)
|
||||
function __mcpctl_resource_names
|
||||
set -l resource (__mcpctl_get_resource_type)
|
||||
if test -z "$resource"
|
||||
return
|
||||
end
|
||||
# Use mcpctl to fetch names (quick JSON parse with string manipulation)
|
||||
mcpctl get $resource -o json 2>/dev/null | string match -rg '"name":\s*"([^"]+)"'
|
||||
mcpctl get $resource -o json 2>/dev/null | jq -r '.[].name' 2>/dev/null
|
||||
end
|
||||
|
||||
# Fetch project names for --project value
|
||||
function __mcpctl_project_names
|
||||
mcpctl get projects -o json 2>/dev/null | string match -rg '"name":\s*"([^"]+)"'
|
||||
mcpctl get projects -o json 2>/dev/null | jq -r '.[].name' 2>/dev/null
|
||||
end
|
||||
|
||||
# --project value completion
|
||||
|
||||
Reference in New Issue
Block a user