Skip to content

Update cli to match exactly what redis returns#3468

Merged
paoloredis merged 1 commit into
mainfrom
DOC-6710
Jun 10, 2026
Merged

Update cli to match exactly what redis returns#3468
paoloredis merged 1 commit into
mainfrom
DOC-6710

Conversation

@paoloredis

@paoloredis paoloredis commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Display-only changes in static/js/cli.js with no auth or server logic touched.

Overview
Aligns the embedded redis.io web CLI output with native redis-cli formatting.

Reply rendering now threads a per-reply status flag from the API: simple strings / status replies (e.g. PONG, OK) print unquoted; bulk strings use a new reprString() that escapes UTF-8 bytes like redis-cli’s sdscatrepr (\xHH for non-printable bytes, named escapes for \n, quotes, etc.). Backend-wrapped large integers ({$int: "..."}) render as (integer) … instead of being mishandled as objects.

Minor: restores the trailing newline at end of cli.js.

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

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

DOC-6710

@jit-ci

jit-ci Bot commented Jun 9, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@paoloredis

paoloredis commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

This pr makes it so the cli replies match exactly what redis returns. For instance PING now returns PONG (without quotes).

@andy-stark-redis @dwdougherty you can test the changes on https://staging.learn.redis.com/docs/latest/develop/ , I sent you creds in a dm

@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.

Approved.

@dwdougherty

Copy link
Copy Markdown
Collaborator

I tested PING, ARGET/ARGETRANGE, HSET/HGETALL, and INFO. The PING, array, and hash commands look good, but INFO isn't quite right. INFO returns a large bulk string and correctly ends each line with a line feed, but in the CLI, the output is one long line.

Output from redis-cli:

127.0.0.1:6379> INFO
# Server
redis_version:8.8.0
redis_git_sha1:00000000
redis_git_dirty:1
redis_build_id:5ab495a1e5f6aa3e
redis_mode:standalone
os:Linux 6.12.76-linuxkit aarch64
arch_bits:64
monotonic_clock:ARM CNTVCT @ 24 ticks/us
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:14.2.0
process_id:1
process_supervised:no
run_id:932c8173f482ab51551a49964a26a61d05a04ab2
...

Output from the CLI widget is one long line:

redis> INFO
"# Server\r\nredis_version:8.8.0\r\nredis_git_sha1:00000000\r\nredis_git_dirty:1\r\n..."

@dwdougherty dwdougherty left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thank you, @paoloredis!

@paoloredis paoloredis merged commit 1912b99 into main Jun 10, 2026
73 checks passed
@paoloredis paoloredis deleted the DOC-6710 branch June 10, 2026 07:57
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.

3 participants