Skip to content

Update commands to use redis-cli shortcode for interactive examples#3608

Open
paoloredis wants to merge 9 commits into
mainfrom
DOC-6826
Open

Update commands to use redis-cli shortcode for interactive examples#3608
paoloredis wants to merge 9 commits into
mainfrom
DOC-6826

Conversation

@paoloredis

@paoloredis paoloredis commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Documentation and CI verification tooling only; no application or auth changes. CI may surface new mismatches against live redis.io/cli until examples stabilize.

Overview
Extends CI verification so check_tryit_output.py validates both clients-example and {{% redis-cli %}} blocks, with safer parsing for unclosed shortcodes, base64 $bin rendering for binary replies (e.g. Bloom/Cuckoo SCANDUMP), and auto-skip for volatile commands (TIME, PTTL, CLIENT, …), try_it="false", and non-deterministic output. COMMAND is treated as order-insensitive for comparison.

Refreshes command documentation across a large set of pages: examples move to the interactive {{% redis-cli %}} shortcode with full redis> / expected-output transcripts (replacing command-only lines or highlight bash fences). Bloom/Cuckoo filter pages get the same treatment; cf.info example output and labels are corrected.

Reviewed by Cursor Bugbot for commit 3f9674d. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

DOC-6826

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Staging links:
https://redis.io/docs/staging/DOC-6826/commands/append/
https://redis.io/docs/staging/DOC-6826/commands/arcount/
https://redis.io/docs/staging/DOC-6826/commands/ardel/
https://redis.io/docs/staging/DOC-6826/commands/ardelrange/
https://redis.io/docs/staging/DOC-6826/commands/arget/
https://redis.io/docs/staging/DOC-6826/commands/argetrange/
https://redis.io/docs/staging/DOC-6826/commands/argrep/
https://redis.io/docs/staging/DOC-6826/commands/arinfo/
https://redis.io/docs/staging/DOC-6826/commands/arinsert/
https://redis.io/docs/staging/DOC-6826/commands/arlastitems/
https://redis.io/docs/staging/DOC-6826/commands/arlen/
https://redis.io/docs/staging/DOC-6826/commands/armget/
https://redis.io/docs/staging/DOC-6826/commands/armset/
https://redis.io/docs/staging/DOC-6826/commands/arnext/
https://redis.io/docs/staging/DOC-6826/commands/arop/
https://redis.io/docs/staging/DOC-6826/commands/arring/
https://redis.io/docs/staging/DOC-6826/commands/arscan/
https://redis.io/docs/staging/DOC-6826/commands/arseek/
https://redis.io/docs/staging/DOC-6826/commands/arset/
https://redis.io/docs/staging/DOC-6826/commands/bf.add/
https://redis.io/docs/staging/DOC-6826/commands/bf.card/
https://redis.io/docs/staging/DOC-6826/commands/bf.exists/
https://redis.io/docs/staging/DOC-6826/commands/bf.info/
https://redis.io/docs/staging/DOC-6826/commands/bf.insert/
https://redis.io/docs/staging/DOC-6826/commands/bf.madd/
https://redis.io/docs/staging/DOC-6826/commands/bf.mexists/
https://redis.io/docs/staging/DOC-6826/commands/bf.reserve/
https://redis.io/docs/staging/DOC-6826/commands/bf.scandump/
https://redis.io/docs/staging/DOC-6826/commands/bitcount/

Comment thread content/commands/bf.add.md
@paoloredis paoloredis changed the title Update some command pages to have interactive examples Update {{% redis-cli %}} shortcode to support interactive examples Jul 21, 2026
Comment thread build/check_tryit_output.py Outdated
@paoloredis paoloredis changed the title Update {{% redis-cli %}} shortcode to support interactive examples Update commands to use redis-cli shortcode for interactive examples Jul 22, 2026
@paoloredis

Copy link
Copy Markdown
Collaborator Author

I updated a bunch of commands so that they use the redis-cli shortcode for interactivity, and updated the tooling to support it. You can test it against the staging environment

@andy-stark-redis andy-stark-redis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot has already noted the only problem I could spot (the random set of examples I tested worked fine interactively after the bit at the start), so LGTM.

@paoloredis

Copy link
Copy Markdown
Collaborator Author

Actually looks like I'm going to have to change the redis-cli shortcode because right now it's usage does not want an explicit redis> prefix

paoloredis and others added 2 commits July 22, 2026 14:28
{{% redis-cli %}} dumped its whole inner transcript — the "redis> " prompts and
the printed output — into the interactive terminal, so cli.js executed the
prompt and output lines as commands (double "redis> ", "unknown command
'redis>'"). Parse the transcript instead: keep only the "> "/"redis> " command
lines, strip the prompt, and feed just those bare commands to the form and the
"Try it" button (matching tabbed-clients-example). Blocks with no command lines
render as a static block.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… transcripts

Rewrite the bare-command {{% redis-cli %}} examples across content/commands as
"redis> " + expected-output transcripts (generated against redis.io/cli) so they
render as interactive terminals and can be verified. Random (SPOP, SRANDMEMBER,
...) and volatile (TIME, PTTL, CLIENT, ...) commands keep a representative sample
but omit the output that can't reproduce.

Also update the verifier (build/check_tryit_output.py) to parse {{% redis-cli %}}
blocks, honour try_it="false", render $bin binary replies, treat COMMAND /
FT.SEARCH / FT.AGGREGATE / VSIM as unordered and TIME/PTTL/CLIENT/... as volatile
(auto-skip), harden unclosed-block parsing, and guard on reply count.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0a16bdf. Configure here.

Comment thread build/check_tryit_output.py
COMMAND INFO/DOCS lists a command's subcommands in registration/hash order,
which isn't guaranteed, so the `config` subcommands reshuffle between backends
(staging vs redis.io/cli) and tripped an exact-match MISMATCH on command-info.md.
Add COMMAND to UNORDERED_CMDS so it's compared as an unordered multiset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@paoloredis

Copy link
Copy Markdown
Collaborator Author

I ended up having to update the redis-cli shortcode to support the new redis> prefix, and had to update all usages of the shortcode to include expected output

@andy-stark-redis

Copy link
Copy Markdown
Contributor

I ended up having to update the redis-cli shortcode to support the new redis> prefix, and had to update all usages of the shortcode to include expected output

Looks good now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants