Skip to content

Comments

fix: rename version query param to avoid global --version flag conflict#2

Open
toyayuto wants to merge 1 commit intolangfuse:mainfrom
toyayuto:fix/version-flag-conflict
Open

fix: rename version query param to avoid global --version flag conflict#2
toyayuto wants to merge 1 commit intolangfuse:mainfrom
toyayuto:fix/version-flag-conflict

Conversation

@toyayuto
Copy link

@toyayuto toyayuto commented Feb 19, 2026

Body

Problem

Running langfuse api prompts get my-prompt --version 4 displays the specli version number ("0.0.39") instead of fetching prompt version 4.

This happens because specli (via commander.js) reserves --version as a global flag for CLI version display. The version query parameter on the prompts get endpoint is converted to a --version CLI flag, which collides with the global one.

Fix

Add a parameter rename step to scripts/patch-openapi.ts that renames the version query parameter to prompt-version for the prompts_get operation. This produces a --prompt-version flag that doesn't collide:

# Before (broken)
langfuse api prompts get my-prompt --version 4
# → prints "0.0.39"

# After (works)
langfuse api prompts get my-prompt --prompt-version 4
# → returns prompt version 4

The rename logic uses a data-driven paramRenames map, making it easy to add more renames if other parameters collide in the future (e.g. datasetItems_list also has a version query parameter).

Change

One file modified: scripts/patch-openapi.ts

  • Added paramRenames configuration map
  • Added a loop that iterates paths/operations and renames matching query parameters
  • Adjusted the write condition to account for renames in addition to schema patches

Verification

$ langfuse api prompts get --help
Usage: prompts get <prompt-name> [options]

Get a prompt

Options:
  --label <string>
      Label of the prompt to be retrieved.
  --prompt-version <integer>
      Version of the prompt to be retrieved.
  ...

Note

The underlying cause is specli's global --version reservation. A separate issue has been considered for specli, but this patch-openapi.ts workaround is consistent with the existing approach of pre-processing the spec to work around specli limitations (e.g. discriminated union flattening).

specli (via commander.js) reserves --version as a global flag for
displaying the CLI version number. This causes the `version` query
parameter on `prompts get` to be unusable — running
`langfuse api prompts get my-prompt --version 4` displays "0.0.39"
instead of fetching prompt version 4.

Rename the parameter to `prompt-version` in patch-openapi.ts so the
generated CLI flag becomes `--prompt-version`, avoiding the collision.

The rename logic is data-driven via a `paramRenames` map, making it
easy to add more renames if other parameters collide in the future.

Co-authored-by: Cursor <cursoragent@cursor.com>
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