Skip to content

feat(help): show version, command counts, and allowed/not-allowed builtins#181

Open
julesmcrt wants to merge 1 commit intojules.macret/Q/release-workflowfrom
jules.macret/Q/help-add-allowed_commands
Open

feat(help): show version, command counts, and allowed/not-allowed builtins#181
julesmcrt wants to merge 1 commit intojules.macret/Q/release-workflowfrom
jules.macret/Q/help-add-allowed_commands

Conversation

@julesmcrt
Copy link
Copy Markdown
Collaborator

@julesmcrt julesmcrt commented Apr 14, 2026

Summary

Depends on #183 (version package and release workflow). Target that PR first.

  • The help builtin now shows a header with the rshell version and builtin count
  • When commands are restricted, help shows a compact "Not allowed:" list and help --all shows both sections as full description tables
  • When all builtins are allowed and --all is used, shows "All builtins are allowed in this session."

Before / After

1. ./rshell --allowed-commands "rshell:echo,rshell:help,rshell:ls" -c 'help'

Only 3 builtins are allowed. Running help without --all.

Before:

echo  write arguments to stdout
help  display help for commands
ls    list directory contents

Run 'help <command>' for more information on a specific command.

After:

rshell 0.0.10 — 3 of 28 builtins enabled

echo  write arguments to stdout
help  display help for commands
ls    list directory contents

Not allowed: [, break, cat, continue, cut, exit, false, find, grep, head, ip, ping, printf,
  ps, sed, sort, ss, strings, tail, test, tr, true, uname, uniq, wc

Run 'help <command>' for more information on a specific command.

2. ./rshell --allowed-commands "rshell:echo,rshell:help,rshell:ls" -c 'help --all'

Only 3 builtins are allowed. Running help --all to see full descriptions for not-allowed builtins too.

Before:

help: unknown flag: --all

After:

rshell 0.0.10 — 3 of 28 builtins enabled

echo  write arguments to stdout
help  display help for commands
ls    list directory contents

Not allowed:
[         evaluate conditional expression
break     exit from a loop
cat       concatenate and print files
continue  continue a loop iteration
cut       remove sections from each line
exit      exit the shell
false     return unsuccessful exit status
find      search for files in a directory hierarchy
grep      print lines that match patterns
head      output the first part of files
ip        show network interface and routing information
ping      send ICMP echo requests to a network host
printf    format and print data
ps        report process status
sed       stream editor for filtering and transforming text
sort      sort lines of text files
ss        display socket statistics
strings   print printable character sequences
tail      output the last part of files
test      evaluate conditional expression
tr        translate or delete characters
true      return successful exit status
uname     print system information
uniq      report or omit repeated lines
wc        print newline, word, and byte counts

Run 'help <command>' for more information on a specific command.

3. ./rshell --allow-all-commands -c 'help'

All builtins are allowed. Running help without --all.

Before:

[         evaluate conditional expression
break     exit from a loop
cat       concatenate and print files
continue  continue a loop iteration
cut       remove sections from each line
echo      write arguments to stdout
exit      exit the shell
false     return unsuccessful exit status
find      search for files in a directory hierarchy
grep      print lines that match patterns
head      output the first part of files
help      display help for commands
ip        show network interface and routing information
ls        list directory contents
ping      send ICMP echo requests to a network host
printf    format and print data
ps        report process status
sed       stream editor for filtering and transforming text
sort      sort lines of text files
ss        display socket statistics
strings   print printable character sequences
tail      output the last part of files
test      evaluate conditional expression
tr        translate or delete characters
true      return successful exit status
uname     print system information
uniq      report or omit repeated lines
wc        print newline, word, and byte counts

Run 'help <command>' for more information on a specific command.

After:

rshell 0.0.10 — All 28 builtins available

[         evaluate conditional expression
break     exit from a loop
cat       concatenate and print files
continue  continue a loop iteration
cut       remove sections from each line
echo      write arguments to stdout
exit      exit the shell
false     return unsuccessful exit status
find      search for files in a directory hierarchy
grep      print lines that match patterns
head      output the first part of files
help      display help for commands
ip        show network interface and routing information
ls        list directory contents
ping      send ICMP echo requests to a network host
printf    format and print data
ps        report process status
sed       stream editor for filtering and transforming text
sort      sort lines of text files
ss        display socket statistics
strings   print printable character sequences
tail      output the last part of files
test      evaluate conditional expression
tr        translate or delete characters
true      return successful exit status
uname     print system information
uniq      report or omit repeated lines
wc        print newline, word, and byte counts

Run 'help <command>' for more information on a specific command.

4. ./rshell --allow-all-commands -c 'help --all'

All builtins are allowed. Running help --all.

Before:

help: unknown flag: --all

After:

rshell 0.0.10 — All 28 builtins available

[         evaluate conditional expression
break     exit from a loop
cat       concatenate and print files
continue  continue a loop iteration
cut       remove sections from each line
echo      write arguments to stdout
exit      exit the shell
false     return unsuccessful exit status
find      search for files in a directory hierarchy
grep      print lines that match patterns
head      output the first part of files
help      display help for commands
ip        show network interface and routing information
ls        list directory contents
ping      send ICMP echo requests to a network host
printf    format and print data
ps        report process status
sed       stream editor for filtering and transforming text
sort      sort lines of text files
ss        display socket statistics
strings   print printable character sequences
tail      output the last part of files
test      evaluate conditional expression
tr        translate or delete characters
true      return successful exit status
uname     print system information
uniq      report or omit repeated lines
wc        print newline, word, and byte counts

All builtins are allowed in this session.

Run 'help <command>' for more information on a specific command.

Test plan

  • All existing help tests updated and passing
  • New tests for header, --all flag, restricted "Not allowed:" output
  • Scenario tests for restricted and unrestricted modes
  • Full test suite passes (go test ./... — 43 packages, 0 failures)
  • Symbol analysis tests pass (new internal/version.Version added to allowlists)

🤖 Generated with Claude Code

@julesmcrt julesmcrt marked this pull request as ready for review April 14, 2026 15:07
@julesmcrt julesmcrt changed the title feat(help): show version, command counts, and allowed/not-allowed builtins feat(help): show version, command counts, allowed/not-allowed builtins, and automated release workflow Apr 14, 2026
…ltins

The help builtin now displays:
- A header with the rshell version and builtin count summary
  ("All N builtins available" or "N of M builtins enabled")
- A compact "Not allowed:" list when commands are restricted
- With --all, full description tables for both allowed and
  not-allowed builtins
- When all builtins are allowed and --all is used, a confirmation
  message "All builtins are allowed in this session."

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@julesmcrt julesmcrt force-pushed the jules.macret/Q/help-add-allowed_commands branch from 4ee0b74 to cdc07cf Compare April 14, 2026 16:40
@julesmcrt julesmcrt changed the title feat(help): show version, command counts, allowed/not-allowed builtins, and automated release workflow feat(help): show version, command counts, and allowed/not-allowed builtins Apr 14, 2026
@julesmcrt julesmcrt changed the base branch from main to jules.macret/Q/release-workflow April 14, 2026 16:41
if len(notAllowed) > 0 {
if *allFlag {
// --all: full description table for not-allowed commands.
callCtx.Out("\nNot allowed:\n")
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.

nit: i think "Disabled" is a better choice of word

printCommandTable(callCtx, notAllowed)
} else {
// Default: compact comma-separated list.
callCtx.Outf("\nNot allowed: %s\n", wrapNames(notAllowed, 80))
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.

same here

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.

2 participants