handlayout

command
v0.169.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: BSD-3-Clause Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

handlayout refuses hand-written UI in a go-widgets application.

handlayout --diff <base>      findings the range base..HEAD ADDS; exit 1 if any
handlayout --hook             PreToolUse hook on Bash: refuse a gitpush that adds one
handlayout --repo <clone>     audit the code already there (the backlog sweep)

⛔ WHY IT EXISTS. The rule is old (2026-07-28): a go-widgets application never computes or draws its own UI; what is missing goes into go-widgets/toolkit. It was broken again on 2026-11-20/21 in go-agentsync/agentscope (splitter weights turned into pane sizes by hand, a panel laid out by hand, wrap widths computed as width / average glyph width), and two visible defects followed whose root causes were in the toolkit (toolkit#605, #606). A note did not stop it twice; this is the gate (fleettools#384).

What it detects

With go/packages, go/ast and go/types over the non-test Go files — resolved types, never a regexp on text:

painter-primitive   a call of a go-widgets/painter drawing method
                    (FillRect, StrokeRect, Text, PutPixel, an image blit ...)
layout-arithmetic   + - * / over toolkit/painter geometry or metrics: a Rect
                    field (X Y W H), an exported metric such as SplitterHandleW
                    or StatusbarH, TextWidth and the like — directly, or through
                    a local computed from them
hit-test            two or more bound comparisons over such values in one
                    && / || chain (a point-in-rect test written by hand)

A plain i+1, arithmetic on the application's own values, a toolkit constant that is not a metric, and string concatenation do not fire.

What it never looks at

go-widgets/toolkit and go-widgets/painter themselves (the module path), any _test.go, and any repository that does not depend on them.

Waiver, and what it cannot read

A line "handlayout-waiver: <reason>" in a commit message of the range turns the refusal into an allowance and the reason is printed. Whatever the detector cannot read (no go.mod, a package that does not type-check, no remote branch to measure from) is ALLOWED and REPORTED: unread is never counted as clean, so --diff and --repo exit 2 for it, and the hook allows with the notice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL