Shell: the console's commands on the device's own screen and keyboard (#67) #78

Open
twisla wants to merge 4 commits from shell-app into main
Owner

For #67: a Shell App that runs the console's commands on the device itself (decisions Q204 to Q212, docs/milestones/S1.md).

What it does

  • An App, "Shell", in the Launcher. Type a command, Enter. Tab completes the command's name (from the firmware's help text); Fn with up and down recalls earlier lines; Alt with up and down scrolls back; clear, quit.
  • It shows what the console prints while it is open. Ctrl+b hides the background: only what is printed in the ten seconds after each command is kept (a reply can't be told from other output any better: ls and tasks answer later, from other tasks).
  • Trusted like USB serial: debug on and debug token work from it. A token being set is not echoed into the console.
  • rm asks first in the Shell; rm -f doesn't. Over the consoles rm is unchanged.
  • screenshot [seconds] saves the screen as a PNG in /screenshots, now or after a pause (from the Shell, "now" is the Shell). Over the Debug Console a bare screenshot still sends the screen to the PC; with a number it saves to the card.
  • get, put, coredump get and reset answer Debug Console only.
  • A guide page, the keys in the shared table, README, CONTEXT.

Cost: 12 KB of flash and 16 bytes of static RAM. Open: about 7 KB of heap (107.6 KB free before, 100.7 with it open, 106.1 after leaving). Closed: nothing.

Checked: 487 host tests (11 new). On the device, driven over the Debug Console: commands and their output, Tab (one match, several, none), history, screenshot (the PNG fetched and decoded on the PC: 240 x 135, indexed, every CRC right), a delayed screenshot of another screen, rm asking (Cancel keeps, Delete removes), rm -f, quit, the help panel. Site: 70 pages, 0 problems.

Not checked:

  • Ctrl+b and the Alt scroll: the remote key command can't press modifiers. The filter is host-tested; the key that flips it is not.
  • The real keyboard, altogether.
  • The Toast after a screenshot (published; not looked at).

One change beyond the issue: the help text's shorthand is written out (update check | update list | …), because Tab reads its command names from there.

Follow-up filed: #77, the Shell in Safe Mode.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT

For #67: a Shell App that runs the console's commands on the device itself (decisions Q204 to Q212, `docs/milestones/S1.md`). **What it does** - **An App, "Shell", in the Launcher.** Type a command, Enter. Tab completes the command's name (from the firmware's `help` text); Fn with up and down recalls earlier lines; Alt with up and down scrolls back; `clear`, `quit`. - **It shows what the console prints while it is open.** Ctrl+b hides the background: only what is printed in the ten seconds after each command is kept (a reply can't be told from other output any better: `ls` and `tasks` answer later, from other tasks). - **Trusted like USB serial:** `debug on` and `debug token` work from it. A token being set is not echoed into the console. - **`rm` asks first** in the Shell; `rm -f` doesn't. Over the consoles `rm` is unchanged. - **`screenshot [seconds]`** saves the screen as a PNG in `/screenshots`, now or after a pause (from the Shell, "now" is the Shell). Over the Debug Console a bare `screenshot` still sends the screen to the PC; with a number it saves to the card. - `get`, `put`, `coredump get` and `reset` answer `Debug Console only`. - A guide page, the keys in the shared table, README, CONTEXT. **Cost:** 12 KB of flash and 16 bytes of static RAM. Open: about 7 KB of heap (107.6 KB free before, 100.7 with it open, 106.1 after leaving). Closed: nothing. **Checked:** 487 host tests (11 new). On the device, driven over the Debug Console: commands and their output, Tab (one match, several, none), history, `screenshot` (the PNG fetched and decoded on the PC: 240 x 135, indexed, every CRC right), a delayed screenshot of another screen, `rm` asking (Cancel keeps, Delete removes), `rm -f`, `quit`, the help panel. Site: 70 pages, 0 problems. **Not checked:** - **Ctrl+b and the Alt scroll**: the remote `key` command can't press modifiers. The filter is host-tested; the key that flips it is not. - **The real keyboard**, altogether. - The Toast after a screenshot (published; not looked at). **One change beyond the issue:** the `help` text's shorthand is written out (`update check | update list | …`), because Tab reads its command names from there. Follow-up filed: #77, the Shell in Safe Mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla added 1 commit 2026-10-07 08:53:34 +00:00
Shell: the console's commands on the device's own screen and keyboard (#67)
Site / build (pull_request) Successful in 9s
CI / build (pull_request) Successful in 1m48s
3863d28593
An App in the Launcher that runs the same commands as USB serial and the
Debug Console, trusted like the first. It shows what the console prints
while it is open, through a second ring of the console's that exists only
meanwhile; Ctrl+b keeps only what follows your own commands. Tab completes
a command's name from the firmware's help text, Fn with up and down recalls
earlier lines, Alt with up and down scrolls back. `rm` asks first in the
Shell, `rm -f` doesn't. Nothing is kept once the App is left.

`screenshot [seconds]` saves the screen as a PNG in /screenshots on the
card, now or after a pause: written a row at a time, indexed colour with
RGB332 as the palette, in one stored deflate block.

487 host tests (11 new: the PNG writer, the Shell's log filter, Tab).
Checked on the device over the Debug Console: commands, Tab, history, a
screenshot fetched and decoded on the PC, rm with and without the question,
a delayed screenshot of another screen. 12 KB of flash; 7 KB of heap while
open. Decisions Q204 to Q212 in docs/milestones/S1.md. Safe Mode: #77.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla added 1 commit 2026-10-07 09:35:34 +00:00
Shell: only its own replies, Apps by their names, and rm as Unix has it (#67)
Site / build (pull_request) Successful in 10s
CI / build (pull_request) Successful in 1m38s
7b5df713ad
The Shell shows the replies to its own commands and nothing else. The
console knows who each line is printed for (Console::As, Console::origin):
a command run from the Shell prints as the Shell's, and what answers it
later from another task carries that along (ls, tasks, du, cp, update
check, sd list, screenshot, gemini get). Ctrl+b shows everything instead.
This replaces the ten-second window, which was a guess.

An App's name with a capital opens it (Notes, Irc, Wifi, Gnss, Gemini, Lora,
Storage, Shell, System, Settings), from the Shell and from the consoles.

rm needs -r for a folder, here and over the consoles. In the Shell a file,
or a folder with something in it, is asked about unless -f; an empty folder
with -r goes without a word.

The Shell now hands its line to the main loop to run: run from inside the
key handler, rm on a folder overflowed the loop's stack and crashed the
device. `info` says which App is in front.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla added 1 commit 2026-10-07 10:03:51 +00:00
Shell: Tab completes a path on the SD card (#67)
Site / build (pull_request) Successful in 10s
CI / build (pull_request) Successful in 1m48s
d17d10948d
Past the command's name, Tab completes the word being typed as a path: a
folder keeps its slash to go on from, a file completed whole gets a space,
several candidates are listed. Any case typed, the name's own is taken.
After a file command the first slash is understood (`cat no` is /no).
The folder is read on the storage task, bounded to 400 entries looked at
and 24 candidates.

489 host tests (2 new). Checked on the device: a folder, a file inside it,
several candidates, no slash, another case, nothing matching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
twisla added 1 commit 2026-10-07 10:47:14 +00:00
Shell: Tab completes every word of a command, and * and ? stand for several files (#67)
Site / build (pull_request) Successful in 9s
CI / build (pull_request) Successful in 1m38s
0fdbb5b1ed
Tab used to complete a command's first word only. It now follows the help
text word by word: `lora st` gives `lora status`, `gnss track ` lists
`start  stop`. The words are read from the help text as written, so a new
command completes with no table to keep; the Shell's own words are added in
the same notation.

`*` and `?` in the last part of a path, for ls, du, rm, cp and mv, from the
Shell and both consoles. The command runs once for each name matched, lined
up and run by the main loop as each finishes; `cancel` empties the line-up.
64 matches at most, refused whole past that. In the Shell, rm with a pattern
asks once, with the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
All checks were successful
CI / build (pull_request) Successful in 1m38s
Site / build (pull_request) Successful in 9s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin shell-app:shell-app
git checkout shell-app
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: twisla/roro9stack#78