Skip to content

The three settings commands: get, update and delete - #30

Merged
curquiza merged 1 commit into
mainfrom
settings-commands
Oct 27, 2026
Merged

curquiza merged 1 commit into
mainfrom
settings-commands

Conversation

@curquiza

@curquiza curquiza commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What

Add meili get settings, meili update settings and meili delete settings, the three routes of /indexes/{index_uid}/settings.

Contract

  • The command name and flags derive from its routes by the naming rules of docs/contract/commands.md, and each route is reachable by a distinct set of flags, or the exception is recorded with its reason (or this pull request changes the contract and nothing else)
  • Output goes through src/lib/output.ts, errors through src/lib/errors.ts
  • The command never waits for a human: no prompt, no question, no $EDITOR; a delete command spreads BaseCommand.confirmFlags and its examples carry --yes
  • The command never speaks HTTP itself: the SDK or the generated client only, no fetch outside src/lib/clients/

Tests

  • --help snapshot added or updated on purpose
  • JSON output snapshot for one success case per route and one error case
  • Integration test added (Meilisearch API commands only)
  • pnpm lint, pnpm typecheck, pnpm test pass locally

Simplicity

  • Nothing in the diff exists for a case the API cannot produce, a caller that does not exist, or a generality nobody asked for (rule 16)
  • Anything shared lives in src/lib/, is used by this command, and is named below

Docs

  • docs/contract/ updated for every name, flag, variable or code this change adds or renames, or nothing to update
  • The ADRs that touch this change were read; what they decide still holds, or a new ADR says what changed
  • No accepted ADR was edited. A new ADR was added if a decision changed.

Housekeeping

  • oclif.manifest.json regenerated
  • Changeset added, or the change is invisible to users of the package (docs of this repository, tests, CI)
  • New dependency justified below, or none added

Notes for the reviewer

Three interface decisions, in the order I would look at them:

  1. --facet-search takes a value. facetSearch is a boolean whose default is true, and null resets it, so a bare flag could express neither false nor null. Rule 7 of commands.md gains one clause for it: a boolean the route also reads as false takes its value. This is the only contract change in the pull request.
  2. --filterable-attributes takes the comma-separated form only. Its rule objects (attributePatterns, features) go through --data or --file, the way the array-of-arrays form of --filter does on search.
  3. --chat is a flag. The /chats routes say in the document that they need the chatCompletions experimental feature; the index setting does not say it, so rule 10 does not apply to it and it derives like the other fields. If the engine team considers the setting gated too, the flag goes and --data still carries it.

Shared code: src/lib/values.ts, the rule 7 conversions. asJson and asNumber move out of search.ts unchanged, except that asNumber now sends a JSON null for null, which rule 7 already promised; asList and asText are new and used by update settings. No new dependency.

update settings with no setting flag sends PATCH {}, which the API accepts as a no-op: the CLI does not invent a refusal the API does not make.

Summary by CodeRabbit

  • New Features
    • Added commands to view, update, and reset index settings. Viewing settings shows current values and defaults.
    • Update settings individually or provide a complete settings object inline or from a file. Set a value to null to reset just that setting; settings not specified remain unchanged.
    • Reset all settings with the delete command, which requires confirmation.
  • Documentation
    • Clarified how boolean values are supplied in commands and documented the settings routes.

`meili get settings` covers `GET /indexes/{index_uid}/settings`,
`meili update settings` covers the `PATCH` route and `meili delete
settings` covers the `DELETE` one, which resets every setting. The
sub-routes stay out, as the exceptions table already says: `update
settings` sends any subset of the settings and `null` resets one.

`update settings` declares one flag per first-level field of the body,
from `--displayed-attributes` to `--chat`, each taking the value rule 7
of `commands.md` asks for: a comma-separated list for an array of
scalars, JSON text for an object, a scalar as it is, and `null` for the
JSON null that resets that one setting. `--facet-search` takes `true`,
`false` or `null` rather than being a bare flag, because a bare flag
says neither of the last two; rule 7 now says so.

The conversions `search` kept to itself move to `src/lib/values.ts`,
`asJson` and `asNumber` unchanged but for the `null` the rule already
promised, next to the `asList` and `asText` the settings need.

`--filterable-attributes` takes the comma-separated form; its rule
objects go through `--data`, like the array-of-arrays form of `--filter`
on `search`. `--chat` is a flag because the document describes that
setting like any other: the `/chats` routes say they need the
`chatCompletions` experimental feature, the index setting does not.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 185ab183-7abb-413c-a51b-1bb6d1b50cd3
Commits

Reviewing files that changed from the base of the PR and between 59bb558 and aab3801.

Files ignored due to path filters: 5
  • test/commands/delete/__snapshots__/settings.test.ts.snap is excluded by !**/*.snap
  • test/commands/get/__snapshots__/settings.test.ts.snap is excluded by !**/*.snap
  • test/commands/update/__snapshots__/settings.test.ts.snap is excluded by !**/*.snap
  • test/contract/__snapshots__/commands.test.ts.snap is excluded by !**/*.snap
  • test/contract/__snapshots__/help.test.ts.snap is excluded by !**/*.snap
Files selected for processing: 15
  • .changeset/first-version.md
  • docs/contract/commands.md
  • oclif.manifest.json
  • src/commands/delete/settings.ts
  • src/commands/get/settings.ts
  • src/commands/search.ts
  • src/commands/update/settings.ts
  • src/lib/values.ts
  • test/commands/delete/settings.test.ts
  • test/commands/get/settings.test.ts
  • test/commands/update/settings.test.ts
  • test/helpers/meilisearch-handlers.ts
  • test/integration/meilisearch/delete-settings.test.ts
  • test/integration/meilisearch/get-settings.test.ts
  • test/integration/meilisearch/update-settings.test.ts

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

This change adds CLI commands to retrieve, update, and reset index settings. Updates accept individual setting flags or JSON body input. Shared value converters handle setting values, and tests cover command behavior and Meilisearch responses.

Changes: Index settings

Layer / File(s) Summary
Retrieve and reset settings
src/commands/get/settings.ts, src/commands/delete/settings.ts, oclif.manifest.json, docs/contract/commands.md, test/commands/get/settings.test.ts, test/commands/delete/settings.test.ts, test/integration/meilisearch/get-settings.test.ts, test/integration/meilisearch/delete-settings.test.ts, test/helpers/meilisearch-handlers.ts, .changeset/first-version.md
Adds commands to retrieve settings and reset all settings for an index. The delete command requires --yes. Tests cover request paths, output, errors, and reset behavior. The manifest also relocates get:tasks and removes its reverse flag.
Update settings and convert values
src/commands/update/settings.ts, src/lib/values.ts, src/commands/search.ts, oclif.manifest.json, docs/contract/commands.md, test/commands/update/settings.test.ts, test/integration/meilisearch/update-settings.test.ts
Adds settings flags and JSON body input for updates. Defined flags override matching body fields. Shared converters parse JSON, numbers, lists, and text; search.ts now uses the JSON and number converters. Tests cover conversion, null resets, body merging, and API responses.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant UpdateSettings
  participant readJsonObjectBody
  participant ValuesModule as src/lib/values.ts
  participant IndexUpdateSettings as Index.updateSettings
  participant outputTask
  CLI->>UpdateSettings: Pass settings flags and body input
  UpdateSettings->>readJsonObjectBody: Read JSON object body
  readJsonObjectBody-->>UpdateSettings: Return body fields
  UpdateSettings->>ValuesModule: Convert defined flag values
  ValuesModule-->>UpdateSettings: Return converted values
  UpdateSettings->>IndexUpdateSettings: Submit merged settings
  IndexUpdateSettings-->>UpdateSettings: Return update task
  UpdateSettings->>outputTask: Output task result
Loading

Possibly related issues

Possibly related PRs

  • meilisearch/cli#25: This PR moves the search value converters into a shared module and reuses them for settings.
  • meilisearch/cli#24: This PR uses the shared body-input pattern for settings updates and adds settings PATCH and DELETE commands.
  • meilisearch/cli#29: This PR changes the get:tasks manifest entry introduced by that PR and removes its reverse flag.
Merge Risk: Minimal · up to aab38

The settings commands have no established merge-blocking issue in the supplied evidence. Confirm the task-list flag and integration-test behavior during normal validation.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the three main commands added by the pull request: get, update, and delete settings.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 12 files. (3 skipped: 3 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@curquiza
curquiza merged commit 82da7ba into main Oct 27, 2026
3 checks passed
This was referenced Oct 27, 2026
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