3b67c6813e008b82d194f765d31abbd456c06c50
29
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3b67c6813e |
The PicoCalc's console font is a preference, and the shell gets its own back
A Linux VT loads one font for the whole console, so asking for the 6x8 build (53x40, fourteen rows more) changes what the shell is drawn in too. The new console_font preference (6x12 default, 6x8 the alternative, offered on the PicoCalc only, round-tripping through preferences.yaml on every platform) therefore comes with services/consolefont.py: remember the font the shell had with `setfont -O`, apply the one the preference names, and restore it on every way out -- the menu's finally and an atexit hook, since ^Q and an unhandled error leave by other doors. Verified on the device that setfont -O captures the current font with its unicode table and that feeding it back reproduces it exactly, with no sudo, because the VT is the process's own controlling terminal. Only the interactive menu switches; a scripted run never touches the console it was invited into. Changing the preference on its page applies live. Shipping both fonts needed the licence untangled: the 6x8 base is the Linux kernel's font_6x8 bitmap, GPL-2.0, so its build moves into calculinux-console-font-6x8.sh under that licence with the GPLv2 text beside it in scripts/LICENSE.GPL-2.0. The shared generator stays in the 6x12 script between BEGIN/END markers and the 6x8 script executes that block, so the marks, donors and aliases the font contract pins exist in one place. The produced PSF is a data file the kernel console reads; MeshTerm never links or bundles it, and NOTICE and the hardware manual say so. PrefSpec gains a platforms gate for the page; the labels use an ASCII x because U+00D7 is not in the console font. The 6x8 base has no Cyrillic; the manual says so and the owner accepts it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
ffd2649a35 |
Shared logic sits in the layer that reads it, and the CLI answers --version
A pre-release architecture and QA pass, applied as one change because the moves share files and only the whole set was gate-tested (2480 passed, ruff clean). Three new modules pull logic down out of layers that should not own it: core/channel_probe.py (ChannelSlot, read_channel_slots, probe_channel_slots) so services/device_state.py no longer imports a screen; services/markers.py (gather_markers, with MapMarker a core/models dataclass) so two screens stop importing a tool; core/tracing.py (trace_timeout, path_hash_flags) so core/connection.py no longer imports services. The routing-prefix width is DeviceState.routing_prefix_bytes(), replacing five private cross-module imports. One definition per thing: is_path_hash, the NodeResolver/NameKeyResolver aliases, TILE_RETRY_SECONDS, haversine_km, marks.SELF_MARK, MENTION; nine private names that crossed module boundaries got public ones and menus.__all__ lists what other modules import. A preference's default is written once (ALERT_CAP, DONE_CAP, DEFAULT_VIEW_FRACTION read the registry), the stranded PREFERENCES doc comment sits on its subject, and three docstrings stop naming questionary, a library dropped long ago. The command line gains --version (eager, exit 0, documented, tested) and drops the -p short form on trace, trace-path and tx-optimize: the root lifts -p as --profile before a leaf ever sees it, so the leaf's could never work, and a derived test now checks every leaf against every root short option. tx-optimize with a one-hop --path is a usage error, exit 2, because nothing transmitted is not a device failure. Log handlers are closed before they are cleared (197 unclosed-file warnings gone), chat's fire-and-forget tasks keep a reference, coroutines use get_running_loop(), the never-awaited MapScreen._load in a test is awaited, and the CLI sweep passes --no-ble to devices so a test run stops turning on the Bluetooth radio three times (the suite is 40 % faster). The about page lists every dependency, and the release skill bumps the README's download names, which still said 0.2.8. apply_ops stays in tools/: it and its helpers build report blocks and open two screens, so moving it to core/ would invert core over ui. The widgets CLAUDE.md names by their private spellings (_format_age, _NODE_GLYPHS) keep them until CLAUDE.md is edited alongside. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
b42b0a473e |
Take the flag where it is typed, and stop the heading from lying
`meshterm contacts --json` is what a person types, and it failed with a bare usage error: Click binds an option to whatever command declares it, so a global on the callback is a parse error one word later. For an output format that is the wrong way round — `-o json` goes after the verb in every tool that has one, and --json is the first thing anyone reaches for. The group's own options are now lifted to the front before Click parses, so both orders mean the same run. `--` stops the lifting and --help is never lifted, since `contacts --help` must stay the contacts help rather than quietly becoming the program's. And a column headed AGE held `2026-09-08T04:18:25-04:00` under --absolute. Every other time column already names the fact — HEARD, RECORDED, FINISHED — which stays true whichever form the run asked for; only chat's named the form. `when()` now says so where the header is declared. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
e3ae668f4a |
Give the person at the prompt back what a redirect never wanted
Five small things the seam left standing, each one a rule applied a step too far or a question asked of the wrong flag. ack and a tool's closing message go to stderr instead of being dropped. The reason they were dropped was sound as far as it went — an acknowledgement is not the answer, and `meshterm contacts > f` must catch only the answer — but stdout is not the only stream. Someone watching a five-minute `config restore` gets the setting-by-setting ✓ back, and the redirect still catches nothing extra. tx-optimize asked --json whether it could prompt. That is a question about output format, and it answered this one wrong in both directions: with the flag a piped run failed cleanly, without it a scheduled run on a terminal sat waiting for a password nobody was going to type. It now asks stdin — and asks it properly on Windows, where NUL is a character device that isatty() calls a terminal and getpass then reads the console directly and blocks forever. A missing password is a usage error, since nothing was transmitted. courier send on an id nobody has raised a device failure, which told a scheduled sender to retry a typo. It is a bad argument: the outbox is a local file. --mock alongside --port/--ble/--tcp used to let --mock win silently, so a scheduled `--port COM7 --mock info` reported on a simulator while reading as though it had reached the radio. And stderr stops folding at 80 columns off a terminal, which is what made `grep 'not already connected' errors.log` come back empty — the sentence was there, with a newline through the middle of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
109fe7645d |
Move every command onto the seam, and give the plain face its own premise
Forty-nine leaf commands now state a Report instead of printing one, so --json works on all of them at once rather than on the two that grew a branch for it. The two hand-rolled JSON paths are gone: devices no longer builds a payload dict of its own, and its empty scan exits 5 like the plain path always did rather than 0 — a rendering flag has no business moving the report. The plain face changes premise along with it. It used to be a serialisation format a person could squint at, and several of its rules existed only to make splitting safe. Splitting is the machine face's job now, so: - Names are bare. Alignment is the delimiter; the escaping under the quoting stays, because nothing else stops a name a node broadcast from ending its own record. - Times are ages. "Heard recently?" is the question a contacts listing is opened to ask, and an ISO instant makes the reader do arithmetic to answer it. --absolute puts the instants back; an appointment, the device clock and a live capture's own column were never ages and still aren't. - A route takes arrows and a path keeps its commas. The lexicon has always split these and the output never did, so a route line looked pasteable into --path, which it is not. - The listings gain what was cut for parser hygiene: contacts gets the HASH --path takes and a LOCATION the model has always carried, preferences gets the DESCRIPTION already written in its registry, and the two live streams get pinned lanes — which is what let them have columns at all, and with them the last call site for the quoting. - The four written pages wrap at 72 instead of printing 600-cell paragraphs. It is the one exception to "no wrapping", and the rule's own reason says why: a paragraph has no fields to land under the wrong headings. info keeps its keys and gains a gloss on the four readings nobody can hold in their head (93784 (1d 2h)); it is the one key/value block with no set behind it, so there is no round trip to protect. config show is untouched, deliberately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
1c24f9149d |
Let a tool state its answer instead of printing it
The CLI said what it found by printing it: run() called ctx.ui.show(<a table>) and handed back a ToolResult carrying only bookkeeping. By the time the boundary saw that result the contacts had gone down the pipe already rendered, and there was nothing left to offer a second format — which is exactly why --json reached two commands out of twenty and stopped, each one growing an `if ctx.json_output:` branch above the rendering that restated the whole answer in a dialect nobody else could reuse. exit_code has always worked the other way round: the tool states it, the boundary turns it into a process status, and no tool calls sys.exit. The answer now travels the same way. A tool states a Report; a renderer turns it into bytes; --json picks the renderer. ui/report.py holds the model — a Listing of records or a set of Facts, whose rows carry the typed value and whose columns carry both projections of it. ui/fields.py is the shared shapes, one constructor per concept, so every listing that mentions a node speaks the same five-key object by construction rather than by review. ui/renderers.py is the two faces: aligned text for a person, and the bare document for a program — an array for a listing, an object for a set of facts, no envelope, because the report a caller needs is still $?. Nothing is migrated yet: report defaults to None and every command renders exactly as it did. The script vocabulary the plain face will need lands alongside — ages, durations, locations, the arrow-drawn route, the comma-joined spec, pinned lanes for a live stream, and a wrap for the written pages — with the quoting still in place until its callers move off it. Also here, because the field library needs it: cli_time_format, the preference that says whether the command line prints ages or timestamps, with --absolute as its per-run override rather than a second switch beside it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
98c635a62e |
Refuse the wrong answer instead of quietly giving it
Four places where the CLI answered a question the caller had not asked. `--profile yagi` naming no profile fell through to ordinary discovery, so a typo in a scheduled advert transmitted from whichever radio happened to be attached. Naming a profile is a claim about which device; an unkeepable claim is a bad argument, not a default. `--sort bogus` sorted by the default and `--category long_hual` selected every discipline — which then came back as exit 5, the code that means a real empty result. A caller branching on 5 could not tell "no records" from "you misspelled the discipline". `ContactsSort.from_name` still forgives an unknown name, because a saved preference from an older build must not wedge the menu's list; the command line refuses instead. A `--port` that would not open reported exit 4 and "the connection to the device was lost", describing a connection there had never been. Every failure while acquiring the device is the other status: nothing was transmitted. It now says which port, and why. A message body could hold a newline, which ended its record early and left the remainder indented under the other columns as a second record with an empty TIME — the one field a stranger fills in, breaking the one rule the format has. script.oneline folds it flat. And an unnamed node read as `""` in one listing and `-` in the next: seven of the ten places that print a name were claiming "called nothing" where they meant "never said". script.name draws the distinction once, which is also the one the JSON rendering will need. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
da05dd402f |
Give the CLI its own voice, meant for a pipe rather than an eye
The CLI had grown the menu's manners -- colour, boxes, section headings, glyph columns, a closing check mark -- and every one of them is in the way of the thing it is actually for. It now prints like a standard Unix utility: plain text, no escape sequences at all, no frames, one record per line, and nothing wrapped, so a long line runs off the right instead of folding its fields onto a second one. meshterm/ui/script.py is the whole vocabulary. Listings are an uppercase header and space-aligned records; key/value blocks are sysctl's shape, and a `get` prints the bare value alone. Names are quoted wherever they share a line, because a name can hold a space or a comma and a bare one is not a field. A route reads "Origin" (3d),"Relay" (f2),"Us" (a1) -- the hash outside the quotes, our own node a hop like any other rather than a star, since the hash is what carries the identity that colour carries on screen. Times are absolute local ISO-8601 and "-" is the one token for absent. The return value is now half the report: 0 ok, 1 failure, 2 usage, 3 no device, 4 the device was reached and the operation failed, 5 nothing to report. That last one is the point -- a command that ran fine and found nothing prints nothing and says so in $?, so a script never has to count output lines to tell an empty mesh from a full one. Errors and progress moved to stderr, and an expected failure no longer arrives as a traceback. Two things lose their scripted face rather than get a degraded one. The map is a picture whose nodes are told apart by colour: monochrome it would be unreadable, coloured it could not be piped anywhere useful, and the nodes themselves are still in `contacts`. The QR codes are a second rendering of a link the output already prints. ui.ack joins ui.note to draw the line the change needed: a note is output, an acknowledgement is reassurance a person wants and a script must filter out, so the menu prints it and the CLI drops it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
690807370b |
Take them to the better terminal instead of asking permission to
Installers / windows-x64 (push) Canceled after 0s
Installers / macos-x64 (push) Canceled after 0s
Installers / macos-arm64 (push) Canceled after 0s
Installers / linux-x64 (push) Canceled after 0s
Installers / linux-arm64 (push) Canceled after 0s
GitHub release / build (push) Canceled after 0s
GitHub release / create the release (push) Canceled after 0s
The classic Windows console cannot draw a single MeshTerm icon whatever font it is given, so "reopen in Windows Terminal?" had exactly one sensible answer -- and was being put to someone who had not seen the app yet and so had nothing to weigh it against, at the one moment nothing had been drawn. So it moves. It still says what it is doing and still names the way to stop it, because a program that opens a window you did not ask for should say so. Installing a font keeps its consent, and the split is deliberate: moving window costs nothing and undoes itself by closing, while a font is a file written to someone's machine that Windows will not let go of until their next logon. The console_setup preference reads auto/off now rather than ask/off, and its help says what it does. An older stored "ask" is not "off", so it keeps working and simply means auto. JP's call, and it is the right one -- the reference experience should be what an end user gets, not what they think to ask for. Release 0.2.7. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
54bbb93233 |
Offer the terminal, then the font -- in that order
The font work made the classic Windows console as good as it can be, and it still cannot show a single icon. No font fixes that: the only two fonts on a Windows machine carrying emoji glyphs are Segoe UI Emoji and Segoe UI Symbol, both proportional, and a console will not take a proportional font. Measured across every font installed here, no monospace face has more than one of the 33 emoji MeshTerm draws. What actually decides all of this is the terminal, not the font. A modern one borrows a missing glyph from another font on the machine, which is why the app looks right in Windows Terminal with a font (Hack Nerd Font) that holds no braille and no emoji itself. The classic console is the one host that does not, so the fix for it is to leave it. So the first offer is now to reopen in Windows Terminal -- present on every Windows 11 machine, free on 10 -- asked with yes as the default, since it installs nothing and changes nothing. The font offer stays as the fallback for a reader who declines or has no Windows Terminal, and keeps its own second ask. One preference, console_setup, remembers a refusal of either. Verified end to end: launched in cmd.exe, accepted, and the session came back up in Windows Terminal with colour emoji, braille charts and rounded borders. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
5158268a73 |
A font we installed ourselves has to be loaded before it can be selected
Found by testing the second launch rather than the first. AddFontResourceW adds a font to the running process's font table; the HKCU registration beside it is what makes it permanent, and Windows reads that at the next logon. So between an install and a logoff there is a window where a new MeshTerm process finds its own registration, believes the font is ready, and selects nothing -- SetCurrentConsoleFontEx reports success and quietly keeps the old font. consolefont.use() retries once after loading our own copy, which is a no-op for the Cascadia that came with Windows and the fix for the one we put there. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
f06b593a0f |
Ship a font the charts can be drawn in, and offer to install it
Every timeline in MeshTerm is made of braille characters, and almost no monospace font has them. Reading the cmap of every font on this machine: Consolas, Lucida Console, Hack Nerd Font, JetBrains Mono, Fira Code and Source Code Pro all carry zero of the 256 -- and so does DejaVu Sans *Mono*, which is where the widespread "install DejaVu for braille" advice falls down. DejaVu *Sans*, proportional, has all 256. That is the whole trick: terminals fall back to a proportional face for the block, and the charts have always been drawn by a font nobody chose. Which is fine everywhere except the one host that does no fallback. In the classic Windows console -- what a double-clicked build gets -- Consolas draws 57 of the 122 characters we use and none of the charts. So MeshTerm now bundles Cascadia Mono PL (SIL OFL, licence beside it) and offers it there. Cascadia is one of two mainstream coder fonts with the block; the PL build adds the powerline separators the path lines want, and at 723KB covers exactly what the 2.4MB Nerd Font build does. A machine that already has Cascadia -- every Windows 11, anyone with Windows Terminal -- is only offered the switch. Both halves are verified on Windows 10 22H2, and neither needs admin: a font installs for one user under %LOCALAPPDATA% with AddFontResourceW and an HKCU registration, and SetCurrentConsoleFontEx selects a face the console's own properties dialog will not even list -- that dialog offers only what is under the machine-wide Console\TrueTypeFont key, which here is Lucida Console and Consolas, so without that API the font could be installed and still unpickable. Declining is answered with what declining looks like -- charts as rows of boxes -- and asked once more, because a reader who has never seen the app cannot picture what it costs. A second no is remembered in the console_font preference and never raised again. Windows locks a font file once loaded: it cannot be deleted even elevated, even after restarting the font cache, until the next logon. So nothing here offers to uninstall one, and the install is written to be repeatable instead of reversible. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ea5f644d73 |
The console that can't draw an emoji says so before we draw one
The classic Windows console renders through GDI with the console font and no emoji font behind it, so every icon in the menu came up as a replacement box. It is what a double-clicked build gets, which is most of the Windows audience. The fix already existed: the compact single-character glyph table built for the PicoCalc, reached by Platform.emoji. The seam's flags are independent, so clearing that one alone keeps the desktop's width, colour and accented names and moves only the icons — without_emoji() is the whole change to the platform. Identifying the host has to be structural. It cannot be asked in band, because a missing glyph still fills its cell: a classic console stores an emoji intact and advances two cells while showing a box, and a ConPTY reads back as U+FFFD while drawing it perfectly, so a write-and-read-back probe answers both hosts backwards. Nor can the environment answer, since WT_SESSION is inherited across process launches. So two independent facts must agree — the console font has a real pixel width (a ConPTY's hidden conhost reports zero) and the buffer is taller than its window (a ConPTY has no scrollback of its own) — and an unknown never degrades anything. MESHTERM_EMOJI overrides either way, and `meshterm platform` reports the verdict and its reason. Verified on Windows 10 22H2 in all three: a real conhost turns the icons compact, Windows Terminal keeps its emoji, a redirected run is left alone. _has_wide_glyph asked the same flag to mean "nothing here is two cells wide", which was true of the PicoCalc's fixed font rather than of the flag. A console that merely lacks emoji still renders the rest of the BMP, and a contact named in CJK is two cells wide there like anywhere else, so it now asks ascii_fold — the fold is what actually guarantees it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
d062b5b706 |
The Windows console call that broke the app is ours alone
Installers / windows-x64 (push) Canceled after 0s
Installers / macos-x64 (push) Canceled after 0s
Installers / macos-arm64 (push) Canceled after 0s
Installers / linux-x64 (push) Canceled after 0s
Installers / linux-arm64 (push) Canceled after 0s
GitHub release / build (push) Canceled after 0s
GitHub release / create the release (push) Canceled after 0s
MeshTerm died building its screen on Windows with a ctypes type error, and on a double-clicked build the traceback and the window it printed to were destroyed together — which is why this needed a log file before it could be looked at. `ctypes.windll.kernel32` is a cache. Every caller in the process receives the same object and each function on it is a shared attribute, so declaring `.argtypes` is not configuration, it is a process-wide mutation where the last writer wins. The emoji-width probe declared `GetConsoleScreenBufferInfo` as taking a pointer to its own copy of the screen-buffer struct; prompt_toolkit then called that same function object with a pointer to its own copy — same layout, different class — and ctypes refused it. Nothing here reaches for `ctypes.windll` any more. Five call sites take private handles from `core/win32dll.py`, built by constructing `WinDLL` directly so each one gets its own function cache and a declaration made for one purpose cannot be seen by anything else. Each call returns a fresh handle, because two parts of MeshTerm disagreeing about a signature is the same bug in miniature. The regression test was checked against the defect rather than assumed to cover it: with the old line restored it fails, and with the fix it passes. A test that passes either way would only have recorded that somebody thought about the problem. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
3379ea2d44 |
A crash you can read, on a window that waits
Double-clicking the executable on Windows gives the process its own console, and Windows destroys that console the moment the process ends. So a traceback was drawn and erased in the same instant: the report was "it displays a trace but the window closes almost instantly", which is not a rendering problem, it is the window being owned by the thing that died. Two changes, because one of them is not enough. The window now waits. `GetConsoleProcessList` says how many processes share this console; when the answer is one, nobody else is holding the window open and it will close with us. On that path only, and only after a failure, MeshTerm asks for a keypress before it goes. A run started from a shell leaves its output on the screen anyway, and a run that worked should never make anyone press a key to be allowed to leave. And the interactive session logs what killed it. It was catching the missing Windows console and re-raising everything else untouched, which is precisely backwards for the case that needs a record most: the session whose console is about to vanish is the one whose traceback nobody will get to read. It goes into the file first, and the terminal is told where the file is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
bdc16fc448 |
The log is a text file that records what went wrong
Three things were true of the log at once: it was JSON Lines, it never rotated, and it almost never recorded a failure. Of the last twenty thousand records in a real one, nine were warnings and three were errors. It faithfully kept the boring parts and missed the interesting ones, which is exactly backwards for the only job it has. It is plain text now, `~/.meshterm/meshterm.log`, one line per record with the traceback indented under the line that raised it. JSON Lines was there in case something replayed it; nothing ever did, and the actual reader is a person who has hit a problem and is about to paste the last twenty lines into an issue. That reader has a text editor. It rotates, at 2MB across three files. The old handler grew without limit and a real one reached 11MB over ten weeks — a lot of disk on a handheld, and an unreasonable thing to ask someone to attach. How much it keeps is a preference, `log_level` under a new Diagnostics group, defaulting to WARNING. That is what makes the file useful rather than large: it holds the problems, and turning it up to DEBUG for one run is how you chase something. Loaded before logging is configured, since it decides how logging is configured, and handed to the context afterwards so the file is not read twice. And failures are written down at last. Every unhandled error reaches the log with its traceback and the terminal says where to find it; expected errors — an ambiguous device, a bad preference — go in as warnings, because a log that only holds crashes cannot answer "what happened just before". The bug form now asks for the file, which it had no reason to before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
e2161fd191 |
Two MeshTerms can share a machine, but not a directory
Every copy on a machine reads and writes the same ~/.meshterm — a checkout, a downloaded build, a second one for a second radio — and nothing about how it was installed changes that. Two at once will not corrupt anything, but each holds the JSON stores in memory and rewrites them whole, so the second to save discards the first's changes. A lost contact is much harder to notice than a crash. The interactive session now takes an exclusive lock on the directory it is using, and a second one is refused with the fix in the message: set MESHTERM_HOME. The lock belongs to the operating system rather than to a process id written in a file, because a pid file has to answer "is that still alive?", the answer differs per platform, and it is wrong once a reboot recycles the number — so a crash leaves a lock nobody can explain and everyone learns to delete it. One-shot subcommands do not take it; blocking `meshterm contacts` because a menu is open in another window would be an obstacle rather than a guard. The scratch-file race is fixed at the same time, and it was ten places rather than the three I first counted: every store under core/ carried the same three lines, writing to a fixed `.tmp` name beside its file. Two processes saving together took turns inside that one scratch file and then each renamed whatever was in it over the real one — the rename is atomic, the thing being renamed was not. They now go through one `write_atomically`, whose temporary carries the writing process's id, and which cleans up after a failed write instead of leaving a partial file behind. And the Windows console error is answered rather than raised. prompt_toolkit needs a Win32 console; Git Bash, MSYS and Cygwin are not one, and its complaint arrives as a traceback that reads like a broken application when the answer is "open a different terminal". It now says that, and points out that every screen has a subcommand which pipes perfectly well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
4f60f44512 |
A build you can download and run without Python
Most people who want MeshTerm have a radio and a terminal, not a Python toolchain. This is the install for them: one file, download it, run it. `packaging/meshterm.spec` freezes the app with PyInstaller in console mode — which is not a detail, since a windowed build of a terminal program starts with nowhere to draw and exits. The assets land at `meshterm/assets` inside the bundle so that `Path(__file__).parent.parent / "assets"` keeps resolving exactly as it does in a checkout, and bleak's per-platform backends are named as hidden imports because nothing static ever sees the one that actually gets used. UPX is off: a few megabytes are not worth being flagged by antivirus on a first release. The build was run here rather than only written. The Windows executable comes out at 14 MB, runs from a directory with no source tree in sight, and draws the specimen card — which is the real test, because the specimen reads the asset files. `installers.yml` does the same on five machines, because frozen builds cannot be cross-compiled. Windows, macOS on both Apple silicon and Intel (plenty of people still have one, and an arm64 build will not run for them), and Linux on x64 and ARM64 — the last for the uConsole. Each leg runs the binary from a temporary directory before uploading it, so a build that only works beside its own source fails on the runner instead of on somebody's laptop, and each one gets a checksum written beside it. It publishes nothing; attaching these to a release stays a separate decision. Also here: `meshterm --help` now opens with the same sentence as the package summary, rather than a fourth description of the project written in its own way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
92d31a3191 |
Every file is spelled the way the formatter spells it
`ruff format .` across the repo: 153 files, no behaviour change. This is the second gate CONTRIBUTING.md promises, and until now it reported 154 files needing reformat — so a first contributor ran the command the guide told them to run and could not tell their own diff from the background. Landed on its own, with nothing else in it, because a whole-repo reformat is only safe to skip past in blame if it is provably nothing but layout. It was checked that way rather than assumed: every changed file was formatted in memory and compared by full `ast.dump()`, and 152 of 153 come out structurally identical (the one exception was a docstring opening on a quote character, fixed in the commit before this one). The string and comment token streams were diffed separately, so a quote flip or an edited comment could not hide inside a re-layout — five quote-style normalisations and sixteen implicit-concatenation joins, all value-identical, and one commented-out line gaining the space after its `#`. `meshterm specimen` is byte-identical on both platforms, and the suite is 1888 green, gallery gate and `test_theme16` included. What actually changed, in order of how much of the diff it is: wrapped calls and signatures rejoin onto one line where they fit inside the hundred columns; the magic trailing comma expands what it is there to expand; complex slices gain their spaces (`[len(noise) :]`); a few redundant parens go. The tables that are laid out to be read were fenced in the previous commit and are untouched here. The aligned trailing-comment column is gone from about ninety lanes that were not fenced — including the `heat.*` ladder in `MESH_THEME`, which cannot be fenced where it sits. Every comment stays on the entry it describes, so nothing there reads wrong; it just no longer lines up. Add this commit to `.git-blame-ignore-revs`, which follows immediately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
71b16ec7b7 |
The annotations, imports, and dead locals answer to ruff
`ruff check --fix` over the whole tree, ahead of putting the linter in CI: 1977 mechanical fixes, overwhelmingly `Optional[X]` → `X | None` (1186 in the package alone) and the quoted annotations that `from __future__ import annotations` already made unnecessary, plus import sorting and unused imports. Nothing here changes behaviour — the suite is 1885 green before and after. Four findings were real rather than stylistic and are fixed by hand: a dead `cells` range in `MapCanvas`, a dead slot dict in the heat-ladder test, a `ProgressScreen` task handle nobody read, and a tab loop binding a `label` it never used. The two `F821`s were quoted forward references to names imported inside their function bodies — now declared under `TYPE_CHECKING`, which keeps `test_performance`'s local import (it guards the startup import graph) while letting the linter resolve the name. 412 findings remain and are deliberately untouched: they need a decision about the rule, not an edit to the code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
cef7a764af |
How MeshTerm behaves gets a page of its own
Three kinds of "setting" were tangled into two files and one of them had no screen at all. The radio's settings live on the radio and are edited on Device config. Machine setup -- where the database is, which companion to talk to -- stays in config.toml, a text editor's job. Everything in between was app behaviour: six keys sitting in config.toml with nothing to open them, and a dozen more that were only module constants a reader could never reach. Those are preferences now, and they have a page. core/preferences.py is a PrefSpec registry in the shape of the device-config one -- group, type, bounds, help, and a default -- and the page is built from the same parts as the device editor, deliberately: one grouped lane-aligned list, current -> new staged in warn, Apply/Back appearing only once something is staged, the shared discard confirm on the way out. Two editors that stage values should not be two screens to learn. What it adds is a Defaults section holding one row that stages every changed preference back to its built-in value; it is drawn only while a reset would do something, and it stages rather than writes, so it is as reviewable and as Esc-discardable as any other change and the file is still only ever written by the one action at the bottom. Its rows scroll sideways where the device editor's don't: the explanation is the widest thing on the row and the only part that runs past the edge, so <-> slide it under a pinned setting and value. The file is preferences.yaml and holds only the values you disagree with the code about -- grouped and commented, each entry above its help and its default. That is what lets a later change to a default reach an install that never asked to be exempt; delete a line and the code takes over again. A hand edit gone wrong costs that line, never the session. Every preference is wired to something that reads it. ctx.preferences is the explicit path; preferences.current() is for the render layer, which has no context to reach through, the same reason get_platform() exists. The About pages come along into a This app section, the third scope after this node and other nodes, with Preferences leading it -- the one row there that changes MeshTerm rather than describing it. A section of one would have broken the menu's own no-bucket-of-one rule, and the app's scope is the honest home for both halves anyway. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
84caae53f8 |
P3 rework: the PicoCalc visual language, done properly
The first P3 (a84abf3) ran on the wrong model and its palette never reached the TUI: MESH_THEME_16 was written in 256-colour cube indices instead of the 16 VT slots, and the platform theme pick was wired into the scripted-CLI console while the real rasterizer stayed hardcoded to truecolor. Replace it end to end: - theme._VT_SLOTS: the canonical slot->RGB design (conventional hue families kept; slots 5/6 become the track/faint slates), MESH_THEME_16 rewritten against color(0..15) with the VT's bold-as-brightness and dim-bank-background rules pinned by tests. /etc/vtrgb + a boot oneshot install it (console-font script), OSC fallback when kbd is absent. - platforms.on_platform: set_platform now re-runs registered bindings, so theme, rasterizer and widgets swap implementations once per switch and hot paths read module globals - no per-call get_platform(). - The render-boundary fold (theme.fold_text): one str.translate pass (NFKD accent folds - the Terminus base has no accented Latin - plus symbol stand-ins and the width-padded emoji map), an embedded-SGR quantizer for canvas truecolor, and a ?-at-own-width catch-all that makes the no-wide-glyph short-circuit true by construction. Applied at the only two places every visible byte passes: render_to_ansi and MapCanvas.to_ansi_lines. - ui/fontset.py freezes the installed font's inventory (dumped live); the gallery now asserts rendered picocalc ANSI carries no truecolor/ 256-colour SGR and no character outside it - the parity gate the first attempt faked by asserting a dataclass field. - Font build: nine new 6x12 marks (ellipsis, warn, backspace, shift, gear, refresh, clock, crosshair, padlock) drawn into donor slots, with donor misses now fatal and a keeper canary (donating pi once erased Cyrillic pe - shared slot). Table re-dumped on-device: identical to fontset.py, 519 = 519. - Type-based name colouring: registry moved to core/nodetypes (services no longer import ui), fed from monitor observations, heard_nodes and merge_contacts. Heat gradient quantizes to heat.* steps on picocalc. - ui/marks.py: the P2-deferred constant relocation - widgets no longer drags map_render/mapcanvas/pathgraph for tuples and aliases. - meshterm specimen: the visual language on one card through the real funnels - the on-device acceptance screen (JP's request). - tools/chat: delivered/no-ack state uses the standard check/query marks, not the banned emoji pair. Verified on the Lyra: font+palette installed, specimen framebuffer captures in .claude/plans/. 1259 tests green, 13 xfailed (P6 list). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
8f1fba135e |
Platform seam: meshterm/platforms.py, --platform flag, dual-platform gallery
One frozen Platform spec (REGULAR/PICOCALC), resolved once at boot (--platform flag > MESHTERM_PLATFORM env > /proc/device-tree/model auto-detect > REGULAR) and read via get_platform()/set_platform() - never a stale `from platforms import PLATFORM`, which the module docstring calls out. `meshterm platform` reports the resolution and everything it looked at. Wires the two correctness bindings that matter before any flavour work lands: width_reclaim off on PicoCalc's exact-width console (session._reclaim_last_column, env override still wins), and the emoji-width calibration probe skipped outright when a platform never draws emoji. tests/test_gallery.py renders all 16 screens the interactive menu opens against REGULAR (72x24) and PICOCALC (53x26 live floor, 53x40 lux case), asserting no line overflows its platform - 35 passing cases, 13 xfailed as a real P6 worklist (contacts, map, walk, livefeed, remote_cli, path_composer). Also caught and left alone: the map screen's footer hint already overflowed the *existing* 72-col standard before this seam existed, unrelated to picocalc - xfailed rather than fixed as a drive-by. tests/test_platforms.py unit-tests the module directly; conftest.py gained an autouse fixture resetting the platform between tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|
|
965783d276 |
Network (TCP) companions: connect, remember, and manage from the picker
Add TCP alongside serial and BLE as a first-class companion transport, end to end: discovery/connection/selection learn a tcp: stable_id and host:port target, --tcp and TCP config profiles reach a WiFi board or network proxy, and a network companion -- which isn't discoverable -- is rebuilt into the picker from its remembered endpoint. Device picker gains the network-device affordances: - "Add a network device" prompts for host:port, smoke-tests it, and remembers it. The row is marked "- experimental" in the cautionary hue. - Delete on a network row opens a chromeless Cancel/Remove confirm (Cancel left, Remove right and default: Enter removes, Esc cancels), then DeviceStore.forget prunes it and re-draws the list. Serial/BLE rows stay inert. - The "Del remove" footer atom now follows the highlight, surfacing on the box's bottom border only while the cursor sits on a deletable row; the box is sized to the fullest footer so it never widens mid-navigation. Folds in the accompanying courier, channels, and config refinements built along the way. Screens stay readable at 72 cols; full suite green (745 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
216a6549f5 |
CLI: strip the framing from scripted output, keep a legible splash
Scripted runs print straight to the terminal, so a tool's heavy Rich framing — a Panel's border, a Table's full box, Typer's boxed help panels — is chrome between the reader and the data. Lighten it to a middle ground: PlainUi de-frames tool output (Panel/Table titles become bold-accent headings, tables keep just a single rule under their header), and the Typer help drops its rounded Options/Commands/Error panels for the same heading-over-content shape while keeping rich mode's colour (yellow usage, cyan options, green switches). Functional, easy to scan, none of the interactive menu's weight. The full-screen TUI is untouched. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> |
||
|
|
a23b12f6a4 |
Normalize UI copy: casing, headers, descriptions, backtracking
Enforce one voice across every screen: column and section headers are
UPPERCASE, menu items are Capitalized buttons, and short descriptions
drop their trailing period (with real ellipses instead of "...").
Tools gain a display `title` separate from their kebab-case CLI name,
so a menu item now reads exactly like the screen it opens ("Device
configuration" opens Device configuration) and result windows inherit
the same name. Every sub-screen backs out via a "Back" row below a
blank separator (the config editor was missing both; its Close is now
Back, spelling out the discard when changes are staged), while the main
menu and device picker keep "Quit". Panel and dialog titles now wear a
brighter tint of their border colour via new title.* theme styles.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
||
|
|
7850587e2a |
Add Bluetooth LE companion support alongside serial
Companions can now be reached over Bluetooth as well as USB. Rather than a parallel BLE path, this generalizes the existing serial abstractions so a device is identified by a transport (serial | ble) plus a target (COM port or Bluetooth address); every feature rides the same Device interface and works over either link unchanged. - discovery: DiscoveredDevice gains transport/address/name and transport-aware stable_id/label/confidence/target; discover_ble_devices scans for MeshCore* adverts via bleak, discover_all merges both. - connection: MeshCoreDevice opens create_ble vs create_serial by transport; new link_present() liveness (OS port enumeration for serial, the BLE client's is_connected flag for Bluetooth); is_connection_lost recognizes Bleak errors and BLE transport callbacks; probe_device is the transport-aware smoke test. - disconnect: the session watcher polls transport-neutral link_alive(), so a dropped BLE link raises the same reconnect dialog and auto-resume as an unplugged cable; reconnect rebuilds the same endpoint by address. - selection/context/store/profiles: --ble address, remembered BLE default, and BLE device profiles all resolve to the right transport. - UI/CLI: startup picker scans both transports behind a spinner and tags Bluetooth companions; `devices` lists them (--no-ble to skip); global --ble/--ble-pin flags; README and example config updated. Validated on hardware: discovery, connect, reconnect, and channel messaging (send + receive) over BLE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
dd097e48e5 |
Prompt to reconnect or abort when the device drops mid-session
Watch the companion link while the menu runs; if it disconnects, float a
centered dialog with a spinner and a single Abort button while a
background task retries the connection. The dialog dismisses itself the
moment the device returns, so the user's only action is to give up:
Enter aborts, and Esc is deliberately inert so a stray keypress can't
drop the session while a replug may be a second away.
Give every popup dialog the same cyan reverse-highlight button. This
adds a "selected" theme style (and "err.reverse"): Rich silently renders
a style string that mixes a theme name with an attribute ("reverse
brand") as plain text, so the reverse is baked into a single-name theme
entry instead. Center the button chips with manual padding rather than
Text(justify="center"), which strips a styled span's trailing whitespace
and left the label hugging the fill's left edge.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|
|
2ec18138a7 |
Rename project from MeshTools to MeshTerm
Rename the package directory, imports, brand strings, env-var prefixes, console-script entry point, and the config/data dir (~/.config/meshterm). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |