Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade the CLI to use the Go API client version 4 #176

Closed
wants to merge 45 commits into from

Conversation

kai687
Copy link
Contributor

@kai687 kai687 commented Jan 30, 2025

This PR migrates the Algolia CLI to use version 4 of the Algolia Go API client.

Features

All commands and glue code use the latest major version of the Algolia Go API client.

Improvements on top of that

  • algolia settings import command now has support for --forward-to-replicas just like algolia settings set
  • algolia objects operations command now supports the clear and deleteIndex actions as well (this makes the operations command support all batch operations).
  • algolia rules browse now returns an error if an index doesn't exist
  • algolia synonyms browse now returns an error if an index doesn't exist
  • All indexing operations now support the --wait flag:
    • algolia indices clear
    • algolia indices delete
    • algolia objects delete
    • algolia objects import
    • algolia rules delete
    • algolia rules import
    • algolia settings import
    • algolia settings set
    • algolia synonyms delete
    • algolia synonyms import
    • algolia synonyms save
  • Potentially breaking change renamed the --includeReplicas option to --include-replicas for the algolia indices delete command to be in line with other CLI options
  • Added command aliases:
    • You can also use records for objects
    • You can also use list for browse

Bugfixes

  • algolia indices copy command has support again for the --wait flag
  • algolia events tail now works with newer profile files (that have api_key instead of admin_api_key stored

Improvements for developers

  • Added gosec, gofumpt, and stylecheck linters for more consistency and safety (fixed some potential issues thanks of that)
  • Defined tasks using Taskfile.yml instead of Makefile. Allows for better discoverability (task -l), documentation (each task can have descriptions), and cleaner syntax (no .PHONY build targets as tasks, handling of variables)
  • Fixed the Dockerfile to work across platforms
  • Define project dependencies and environment variables in devbox.json file (Devbox and direnv are great in combination)

@kai687 kai687 force-pushed the feat/v4 branch 2 times, most recently from 80e2188 to 9d9dfb1 Compare February 10, 2025 10:15
Adds devbox for easy environment management.
In combination with `direnv`, the env is started automatically.
Without `direnv`, just do `devbox shell`.
Running Make as a task runner is phony.
A Taskfile is better suited for this.
With gofumpt and golines for more readability
Copying the binary into the Docker container doesn't work
if the host CPU architecture is different (like an M1 mac).
Since it's quick to build, we can just build the CLI
inside Docker.
This commit also re-enables support for the `--wait` flag,
which was commented out.
This commit gets rid of some custom validation code.
We don't have to validate the multiple-batch request body
in the CLI, since that is done in the v4 API client now.
This commit also adds support for the 'delete index' and 'clear objects'
actions.
@kai687 kai687 closed this Feb 10, 2025
@kai687 kai687 deleted the feat/v4 branch February 10, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant