Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ cleanup_deprecated_paths() {
print_info "Cleaned up $cleaned deprecated agent path(s)"
fi

# Remove oh-my-opencode config file if present
local omo_config="$HOME/.config/opencode/oh-my-opencode.json"
if [[ -f "$omo_config" ]]; then
rm -f "$omo_config"
print_info "Removed deprecated oh-my-opencode config"
fi

# Remove oh-my-opencode from plugin array in opencode.json if present
local opencode_config
opencode_config=$(find_opencode_config 2>/dev/null) || true
if [[ -n "$opencode_config" ]] && [[ -f "$opencode_config" ]] && command -v jq &>/dev/null; then
if jq -e '.plugin | index("oh-my-opencode")' "$opencode_config" >/dev/null 2>&1; then
local tmp_file
tmp_file=$(mktemp)
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' "$opencode_config" > "$tmp_file" && mv "$tmp_file" "$opencode_config"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The jq command to remove an element from the JSON array can be simplified. Using the -= operator is more concise and idiomatic for removing elements from a JSON array, which improves code readability and maintainability.

Suggested change
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' "$opencode_config" > "$tmp_file" && mv "$tmp_file" "$opencode_config"
jq '.plugin -= ["oh-my-opencode"]' "$opencode_config" > "$tmp_file" && mv "$tmp_file" "$opencode_config"

print_info "Removed oh-my-opencode from OpenCode plugin list"
fi
fi

return 0
}

Expand Down
Loading