Conversation
FileUtils.cp preserves the source file mode. When trmnlp is installed into a read-only location — NixOS stores gems under /nix/store with 0444 permissions — init produced project files the author could not edit. The copy now adds owner-write while keeping any executable bit, so a freshly initialised plugin is always editable.
The preview already displayed the merge-variable payload size, but as plain text — an author had no at-a-glance signal that a payload was approaching the size the hosted service starts rejecting. The badge now turns yellow from 75 KB and red from 100 KB, so an oversized payload is obvious before the plugin misbehaves in production.
A text/html or text/plain polling response that is not secretly JSON
was exposed to the template as {{ text }}. The hosted service exposes
the same body as {{ data }}. A plugin author writing Liquid against
production and previewing locally would find their template empty
with no error to explain it. The poller now uses {{ data }} to match.
trmnlp build only produced HTML, so seeing a plugin as it renders on e-ink meant booting the serve command. build --png now screenshots each view through the existing quantization pipeline and writes a 1-bit PNG alongside the HTML. The headless Firefox factory that powers the screenshots was private to the serve command. With build as a second consumer it moves to a shared FirefoxDriver module rather than being duplicated.
The Reporter hand-rolled ANSI escape codes and emitted them unconditionally, so colour leaked into piped or redirected output as unreadable escape sequences. Colour was also limited to the lint summary. Output now routes through the tone gem, which suppresses ANSI when the stream is not a terminal. Colour extends to the warnings the poller and form-field validation emit, and to the error the executable prints on a fatal failure.
Nothing measured test coverage, so a drop in coverage could land unnoticed. SimpleCov now runs from spec_helper and CI gates on a 90% floor — set just below the current 92.5% so a real regression fails the build while normal variance does not. Only 2 of the 13 lint checks had a dedicated spec; the other 11 were exercised only incidentally through the lint command against the fixture plugin. Each check now has a focused spec covering a passing and a failing input.
The Reporter used exactly two things from tone: a colour helper and terminal detection. Earning those pulled tone, zeitwerk, and refinements into the dependency tree of a gem users install. A four-line hand-rolled colorizer covers both — the same ANSI codes, suppressed off a terminal. The Reporter specs pass unchanged because they assert on output, not on the colour library, so the swap carries no behaviour change.
build --png always rendered at 800x480 with the bit depth sniffed from the markup, with no way to override either. The serve command's PNG route already accepts width, height, and color_depth as params. build now takes --width, --height, and --color-depth, threading them through the same ScreenGenerator the route uses. --color-depth overrides the screen--Nbit markup sniff; an omitted flag leaves the existing default in place.
Necessary to ready the 0.8.1 release. The changelog records the new build --png command, the payload-size colour coding, the coloured CLI output, and the init and polling fixes. The README documents how to drive the build command and notes the SimpleCov coverage report.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six independent pieces of work from the post-0.8.0 backlog, one commit each, plus
two follow-up commits. Every change ships with specs; the full suite is green and
RuboCop is clean.
trmnlp initno longer creates read-only project files{{ data }}trmnlp build --pngrenders a PNG per viewDetails
Fixed
initcreating read-only files — #83initcopied templates with a bareFileUtils.cp, which preserves the source filemode. On read-only gem installs — NixOS stores gems under
/nix/storeat0444—the generated project was not editable. The copy now adds owner-write while keeping
any executable bit, so
bin/trmnlpstays runnable.Payload-size colour coding — #67
The merge-variable payload size was shown as plain text. The badge now turns yellow
from 75 KB and red from 100 KB, so an oversized payload is obvious before the plugin
misbehaves in production.
Non-JSON polling key — #81
A
text/htmlortext/plainpoll response that is not secretly JSON was exposed tothe template as
{{ text }}, while the hosted service uses{{ data }}. They nowmatch, so a plugin previews locally the same way it runs in production.
trmnlp build --png— #92buildonly wrote HTML.build --pngnow screenshots each view through the existingquantization pipeline and writes a PNG alongside.
--width,--height, and--color-depthflags override the defaults for parity with the serve PNG route. Theheadless-Firefox factory moved out of
serveinto a sharedFirefoxDrivermodule,since
buildis its second consumer.TTY-aware coloured output — #33
Reporterhand-rolled ANSI escape codes and emitted them unconditionally, so colourleaked into piped output as unreadable sequences. Colour is now suppressed off a
terminal and extended to warnings and the fatal-error message. (A colour gem was
trialed, then dropped in favour of a four-line hand-rolled colorizer to avoid three
transitive dependencies — see the commit history.)
Coverage tracking + lint specs
SimpleCov now runs from
spec_helper; CI gates on a 90% line-coverage floor(currently 92.5%). The 11 lint checks that had no dedicated spec — previously
exercised only incidentally through the lint command — each gained a focused
pass/fail spec.
Closes
Closes #33
Closes #67
Closes #81
Closes #83
Closes #92
Test plan
bundle exec rspec— 268 examples, 0 failuresbundle exec rubocop— 111 files, no offensesCI=true bundle exec rspecexits 0 at 92.5%trmnlp build --pngagainstexamples/hn-stories— four 800×480 PNGs, real rendertrmnlp lintpiped — no ANSI codes; in a terminal — coloured