Skip to content

Add meili get version - #35

Merged
curquiza merged 1 commit into
mainfrom
get-version-command
Oct 28, 2026
Merged

curquiza merged 1 commit into
mainfrom
get-version-command

Conversation

@curquiza

@curquiza curquiza commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What

Add meili get version, the one route of GET /version.

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

No shared code added, no dependency, no exception. The command is fifteen lines: the resource is a singleton, so rule 2 gives get version and the route has neither a path nor a query parameter. It is the smallest command of the tree, get health with a key action.

Two things worth a look:

  1. keyActions = ["version"]. The document declares Bearer: ["version", "*"] on this route, so the specific action is version, not version.get: the contract test reads it from the document and would fail on the other spelling. It is also what makes this command different from get health, which declares security: [] and works without a key.

  2. The error case is the key the instance refuses, 403 with invalid_api_key, exit 3, snapshotted in the unit test and run for real in the integration test with a wrong key. There is no 404 to pin here: the route takes nothing.

Ran the simplify skill on the diff: reuse, simplification and altitude, which found two small things, both applied — the msw handler's comment restated its three field names, and the changeset line explained the key action at a level its neighbours do not, which belongs here rather than in the changelog. I did not run the efficiency angle: the command makes one call, sets up no fixture and declares no flag of its own.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added meili get version to retrieve the Meilisearch instance version and build information.
  • Documentation
    • Added the version command to the command reference.

A singleton resource, so rule 2 gives `get version`, and the route has
neither a path nor a query parameter: the command is `get health` with a
key action, `version`, the one the document declares on it. That key action
is the whole difference between the two: `GET /health` declares none and
answers without a key, `GET /version` refuses one the instance does not
accept, which the tests pin at exit 3.

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: e072297a-2391-430d-8b26-7dd82e5be9e0
Commits

Reviewing files that changed from the base of the PR and between 39bc99b and 1db113c.

Files ignored due to path filters: 3
  • test/commands/get/__snapshots__/version.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: 7
  • .changeset/first-version.md
  • docs/contract/commands.md
  • oclif.manifest.json
  • src/commands/get/version.ts
  • test/commands/get/version.test.ts
  • test/helpers/meilisearch-handlers.ts
  • test/integration/meilisearch/get-version.test.ts

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

Walkthrough

The pull request adds meili get version. The command calls GET /version and outputs the Meilisearch instance version and build commit. Mocked and integration tests cover successful requests and invalid API keys.

Changes: Version command

Layer / File(s) Summary
Command and route registration
src/commands/get/version.ts, oclif.manifest.json, docs/contract/commands.md, .changeset/first-version.md
The command requests GET /version and sends the response to output(). The manifest registers get:version, and the command reference and changeset document the command.
Command validation
test/helpers/meilisearch-handlers.ts, test/commands/get/version.test.ts, test/integration/meilisearch/get-version.test.ts
Mocked and integration tests cover help output, successful version responses, and invalid API keys. The mocked handler returns fixed version and commit data.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: Minimal · up to 1db11

No merge-blocking issue is identified; run the normal checks before merging.

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 "Add meili get version" names the primary change. The changeset adds the meili get version command, which calls GET /version and reports the Meilisearch instance version and build comm…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. 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: Title check

Explanation

The title "Add meili get version" names the primary change. The changeset adds the meili get version command, which calls GET /version and reports the Meilisearch instance version and build commit. The title is specific, short, and free of file lists or vague terms, so a teammate scanning history can identify the change.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 4 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 7f4109e into main Oct 28, 2026
3 checks passed
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