Skip to content

feat: add ddev add-on search subcommand, fixes #7491 - #7554

Merged
rfay merged 2 commits into
ddev:mainfrom
AkibaAT:20250824_akibaat_addon_search
Sep 30, 2025
Merged

rfay merged 2 commits into
ddev:mainfrom
AkibaAT:20250824_akibaat_addon_search

Conversation

@AkibaAT

@AkibaAT AkibaAT commented Aug 24, 2025

Copy link
Copy Markdown
Contributor

The Issue

How This PR Solves The Issue

Implemented a new search subcommand

Manual Testing Instructions

ddev add-on search "solr engine"

Automated Testing Overview

Added new TestCmdAddonSearch

Release/Deployment Notes

@github-actions

github-actions Bot commented Aug 24, 2025 •

Copy link
Copy Markdown

@AkibaAT
AkibaAT marked this pull request as ready for review August 24, 2025 23:26
@AkibaAT
AkibaAT requested a review from a team as a code owner August 24, 2025 23:26
@stasadev stasadev changed the title feat: add add-on search subcommand feat: add ddev add-on search subcommand, fixes #7491 Aug 25, 2025
@nickchomey

Copy link
Copy Markdown
Collaborator

Something like this was suggested and implemented in this PR but ultimately abandonned. It's still not evident to me why. It also briefly used fuzzy search, but a commit removed that. Again, it's not evident to me why fuzzy wouldn't be desirable.

#6353

Some fuzzy search libraries.

https://github.com/sahilm/fuzzy
https://github.com/lithammer/fuzzysearch
https://github.com/raphamorim/fuzzy

The latter is newer and fancier and compares itself to the other two. Not sure which would be appropriate here.

@rfay
rfay force-pushed the 20250824_akibaat_addon_search branch from 719c62f to daff479 Compare August 26, 2025 01:21
@rfay

rfay commented Aug 26, 2025

Copy link
Copy Markdown
Member

Rebased and fixed gofmt problem

@tyler36 tyler36 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This works well.

However, I think it should default to --all, otherwise its not obvious if there are other addons, or that we are only searching a subset of addon.

Example workflow

I want a "browsersync" addon

$ ddev add-on search browsersync
┌───────────────────────┬────────────────────────────────────────────────────┐
│ ADD-ON                │ DESCRIPTION                                        │
├───────────────────────┼────────────────────────────────────────────────────┤
│ ddev/ddev-browsersync │ Live-reload and HTTPS auto-refresh on file changes │
│                       │ for DDEV*                                          │
└───────────────────────┴────────────────────────────────────────────────────┘
1 repositories found matching 'browsersync'. Add-ons marked with '*' are officially maintained DDEV add-ons.

Good, there's 1 addon. And its marked with "*" so its official. (wonder if there are other unofficial ones and how do I find them?)

I want a "vscode" addon:

$ ddev add-on search vscode 
No add-ons found matching 'vscode'

Ok, none listed, official or otherwise. But I know I have an addon ....

$ ddev add-on search vscode --all
┌──────────────────────────────────┬─────────────────────────────────┐
│ ADD-ON                           │ DESCRIPTION                     │
├──────────────────────────────────┼─────────────────────────────────┤
│ tyler36/ddev-vscode-devcontainer │ Open a DDEV container in VSCode │
└──────────────────────────────────┴─────────────────────────────────┘
1 repositories found matching 'vscode'. Add-ons marked with '*' are officially maintained DDEV add-ons.

Suggestion

  • Default to --all search. (Personally prefer this option)

  • Alternatively, update the non/found message to include something like to:

    No add-ons found matching 'vscode'. Use "--all" to search official and unofficial add-ons.
    

Test

  • ✅ Find official addon: ddev addon search browsersync
  • ✅ Find unofficial addon: ddev addon search qr --all
  • ✅ Find unofficial addon via description: ddev addon search queries --all
  • ✅ Displays message when no addons found: ddev addon search meatball --all
  • ✅ Displays relevant help message: ddev addon search --all

@nickchomey

Copy link
Copy Markdown
Collaborator

I'd like to reiterate that this feature seems half-baked, at best, without fuzzy search. As it is, people have to already know exactly what they're looking for, and then spell it precisely correctly (or at least a subset of it).

Fuzzy search would account for typos, slight differences (vs code vs vscode), and overall help with discoverability.

It seems like a simple enough thing to add, no?

@AkibaAT

AkibaAT commented Sep 4, 2025 •

Copy link
Copy Markdown
Contributor Author

Suggestion

  • Default to --all search. (Personally prefer this option)
  • Alternatively, update the non/found message to include something like to:
    No add-ons found matching 'vscode'. Use "--all" to search official and unofficial add-ons.
    

The search command is using the same default as the list command because I'd expect to find the same behaviour in both. It also has the same issue of not giving any hint about other addons, and the --all flag.

@rfay What do you think? Default to --all true (best replacing it with an --official flag to limit to those), or behaviour like now, but just with an added comment about the flag? For both the list, as well as the search commands.

@rfay
rfay force-pushed the 20250824_akibaat_addon_search branch from daff479 to e5bc30c Compare September 6, 2025 02:27
@rfay

rfay commented Sep 6, 2025

Copy link
Copy Markdown
Member

Rebased

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Previously, we had one ddev get command, and there was no choice between using different flags for different actions.

But now, with subcommands (thanks to @GuySartorelli), we can have different behavior.

I agree with @tyler36, the search subcommand is expected to search everywhere, so the --all flag is not needed here.

The search command is using the same default as the list command because I'd expect to find the same behaviour in both. It also has the same issue of not giving any hint about other addons, and the --all flag.

@AkibaAT, what about using this in addon-list.go?

-func renderRepositoryList(repos []*github.Repository) string {
+func renderRepositoryList(repos []*github.Repository, officialOnly bool) string {
-return out.String() + fmt.Sprintf("%d repositories found. Add-ons marked with '*' are officially maintained DDEV add-ons.", len(repos))
+message := out.String() + fmt.Sprintf("%d repositories found. Add-ons marked with '*' are officially maintained DDEV add-ons.", len(repos))
+if officialOnly {
+	message = message + "\nTo view all add-ons, use `ddev add-on list --all`"
+}
+return message

@rfay

rfay commented Sep 19, 2025

Copy link
Copy Markdown
Member

I agree as well that people would expect to search all add-ons when using ddev add-on search.

One thing that has changed since the beginning of add-ons is that these days there are a number of popular add-ons that don't really need to move to the "official" ddev namespace, but are still valuable to particular groups of users.

@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from e5bc30c to 49a1dbe Compare September 28, 2025 20:30
@AkibaAT
AkibaAT requested a review from a team as a code owner September 28, 2025 20:30
@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from 49a1dbe to 960704f Compare September 28, 2025 20:32
@AkibaAT

AkibaAT commented Sep 28, 2025

Copy link
Copy Markdown
Contributor Author

Rebased and dropped --all from list & search

@AkibaAT
AkibaAT requested a review from tyler36 September 28, 2025 20:33
@ChloeSartorelli

Copy link
Copy Markdown
Contributor

Why are you dropping --all from the list command? From what I can see in the discussion above, the suggestion was to not require --all for the new search command with no mention of removing it from the existing list command? It's possible I misunderstood that though.

Comment thread cmd/ddev/cmd/addon-search.go Resolved
@AkibaAT

AkibaAT commented Sep 28, 2025

Copy link
Copy Markdown
Contributor Author

Why are you dropping --all from the list command? From what I can see in the discussion above, the suggestion was to not require --all for the new search command with no mention of removing it from the existing list command? It's possible I misunderstood that though.

I understood the last input as it no longer making sense to filter by "official" addons, and instead to always show all.
If I misunderstood, it is in its own commit.

@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from 960704f to 77f7653 Compare September 28, 2025 21:10
@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from 77f7653 to a58dacc Compare September 28, 2025 21:14

@tyler36 tyler36 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Works well!

Thank you for sticking with this.

@stasadev
stasadev self-requested a review September 29, 2025 15:06
Comment thread cmd/ddev/cmd/addon-list.go Resolved
Comment thread docs/content/users/usage/commands.md Resolved
@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from a58dacc to 89cf15a Compare September 29, 2025 22:28
Comment thread cmd/ddev/cmd/addon-search.go Resolved
Comment thread cmd/ddev/cmd/get.go Resolved
@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from 89cf15a to 6c1d6e0 Compare September 29, 2025 22:37
@AkibaAT
AkibaAT force-pushed the 20250824_akibaat_addon_search branch from 6c1d6e0 to 7b9b1a6 Compare September 29, 2025 22:41

@stasadev stasadev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.

@rfay rfay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Congrats, thank you!

@rfay
rfay merged commit b4b5570 into ddev:main Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants