fix: rename version query param to avoid global --version flag conflict#2
Open
toyayuto wants to merge 1 commit intolangfuse:mainfrom
Open
fix: rename version query param to avoid global --version flag conflict#2toyayuto wants to merge 1 commit intolangfuse:mainfrom
toyayuto wants to merge 1 commit intolangfuse:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Body
Problem
Running
langfuse api prompts get my-prompt --version 4displays the specli version number ("0.0.39") instead of fetching prompt version 4.This happens because specli (via commander.js) reserves
--versionas a global flag for CLI version display. Theversionquery parameter on theprompts getendpoint is converted to a--versionCLI flag, which collides with the global one.Fix
Add a parameter rename step to
scripts/patch-openapi.tsthat renames theversionquery parameter toprompt-versionfor theprompts_getoperation. This produces a--prompt-versionflag that doesn't collide:The rename logic uses a data-driven
paramRenamesmap, making it easy to add more renames if other parameters collide in the future (e.g.datasetItems_listalso has aversionquery parameter).Change
One file modified:
scripts/patch-openapi.tsparamRenamesconfiguration mapVerification
Note
The underlying cause is specli's global
--versionreservation. 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).