Repository navigation
The three settings commands: get, update and delete - #30
Conversation
`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>
|
No actionable comments were generated in the recent review.
|
| 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:
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
Possibly related issues
- [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-go#823: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-java#1004: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-php#960: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-python#1296: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-ruby#720: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-dart#506: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-dotnet#772: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-rust#810: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input. - [Meilisearch v1.56] Add support for
sampledCountin facetingsortFacetValuesBymeilisearch-swift#535: The settings commands provide get, update, and reset operations that can carry thesortFacetValuesBysetting through structured input.
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:tasksmanifest entry introduced by that PR and removes itsreverseflag.
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: 
5
-
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.
What
Add
meili get settings,meili update settingsandmeili delete settings, the three routes of/indexes/{index_uid}/settings.Contract
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)src/lib/output.ts, errors throughsrc/lib/errors.ts$EDITOR; adeletecommand spreadsBaseCommand.confirmFlagsand its examples carry--yesfetchoutsidesrc/lib/clients/Tests
--helpsnapshot added or updated on purposepnpm lint,pnpm typecheck,pnpm testpass locallySimplicity
src/lib/, is used by this command, and is named belowDocs
docs/contract/updated for every name, flag, variable or code this change adds or renames, or nothing to updateHousekeeping
oclif.manifest.jsonregeneratedNotes for the reviewer
Three interface decisions, in the order I would look at them:
--facet-searchtakes a value.facetSearchis a boolean whose default istrue, andnullresets it, so a bare flag could express neitherfalsenornull. Rule 7 ofcommands.mdgains one clause for it: a boolean the route also reads asfalsetakes its value. This is the only contract change in the pull request.--filterable-attributestakes the comma-separated form only. Its rule objects (attributePatterns,features) go through--dataor--file, the way the array-of-arrays form of--filterdoes onsearch.--chatis a flag. The/chatsroutes say in the document that they need thechatCompletionsexperimental 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--datastill carries it.Shared code:
src/lib/values.ts, the rule 7 conversions.asJsonandasNumbermove out ofsearch.tsunchanged, except thatasNumbernow sends a JSON null fornull, which rule 7 already promised;asListandasTextare new and used byupdate settings. No new dependency.update settingswith no setting flag sendsPATCH {}, which the API accepts as a no-op: the CLI does not invent a refusal the API does not make.Summary by CodeRabbit
nullto reset just that setting; settings not specified remain unchanged.