feat: add COMMAND DOCS command support#3270
Conversation
Implement the COMMAND DOCS command which returns detailed documentation about Redis commands. This command was introduced in Redis 7.0. The command accepts optional command names as arguments and returns a map of command documentation including: - summary: Brief description of the command - since: Redis version when the command was introduced - group: Command group (e.g., string, list, hash) - complexity: Time complexity description - arguments: Command argument specifications Fixes redis#1934
Add unit tests for the COMMAND DOCS command implementation.
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
|
@ruguoba thanks for the PR, looks like cursor found some issues |
1. Fix JSON.parse crash on 'arguments' field (already parsed RESP array) 2. Fix test to use lowercase keys (Redis returns lowercase command names)
|
@nkaradzhov Thanks for pointing that out! I've fixed all 3 issues flagged by Cursor Bot:
All fixes pushed! |
Add COMMAND_DOCS import and register as both COMMAND_DOCS and commandDocs aliases in the commands index.
- Fix type error: use unknown[] casting for RESP2 array iteration
- Transform arguments from flat arrays to objects with name/type/optional/multiple
- Add RESP2/RESP3 transformReply separation ({ 2: ..., 3: ... } pattern)
- Handle 'flags' array in arguments (extract 'optional' and 'multiple')
- Guard against non-array details entries
Fixes cursor[bot] review comments on PR redis#3270
- Verify arguments are objects with name/type properties - Verify lowercase command names returned by Redis - Add structure validation for arguments array
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 522ec5c. Configure here.
|
@nkaradzhov Hi! Just checking in on this PR. I've fixed the issues raised by the bot reviews:
All CI checks are passing. Is there anything else needed for this PR? |
|
@nkaradzhov Thanks for the review! I've addressed the cursor bot issues:
The command is already registered in the index (line 74, 1141, 1146 in index.ts). Please let me know if there are any other concerns! |
|
@nkaradzhov Thanks for the review! All 6 issues identified by cursor bot have been fixed in subsequent commits:
Could you please re-review? All identified issues have been addressed. |

Summary
Implement the
COMMAND DOCScommand which returns detailed documentation about Redis commands. This command was introduced in Redis 7.0.Changes
COMMAND_DOCS.tswith full implementationCOMMAND_DOCS.spec.tswith unit testsUsage
Testing
commandDocs()returns documentation for all commandsFixes #1934
Note
Low Risk
Low risk and additive: introduces a new read-only command and its reply transformation without changing existing command behavior. Main risk is limited to potential edge cases in reply parsing/argument flag normalization across Redis versions.
Overview
Adds a new
COMMAND DOCScommand implementation (COMMAND_DOCS.ts) and wires it into the client command registry asclient.commandDocs(), with optional filtering by command names.Implements RESP2 reply transformation into a typed object, including normalization of the
argumentsfield (handlingflagssuch asoptional/multiple). Adds a spec (COMMAND_DOCS.spec.ts) that validates basic result structure for both unfiltered and filtered calls.Reviewed by Cursor Bugbot for commit 926d731. Bugbot is set up for automated code reviews on this repo. Configure here.