diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d36da..5eb2345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,16 +119,20 @@ description of what scroll ships today. - **Minimum Go: 1.25.9.** Bumped from 1.25.3 to pick up stdlib security fixes flagged by govulncheck (crypto/x509, crypto/tls, net/url, os). -- Makefile targets: `build`, `test`, `release`, `clean`. - `make release` cross-compiles linux + darwin (amd64 + arm64). +- Makefile targets: `build`, `test`, `release`, `licenses`, + `clean`. `make release` cross-compiles linux + darwin + (amd64 + arm64). `make licenses` walks `go list -deps` and + copies each dependency's LICENSE / COPYING file into + `third_party/`. - GitHub Actions workflow `ci.yml`: `go vet`, `staticcheck`, `govulncheck`, `go test -race`, `go build` on every PR and push to `main`. - GitHub Actions workflow `release.yml`: tag-triggered cross-platform build, archives each binary as - `scroll---.tar.gz` with `LICENSE` and - `README.md`, generates `checksums.txt`, attaches everything - to the GitHub release. + `scroll---.tar.gz` containing the binary, + `LICENSE`, `README.md`, and the `third_party/` tree of + dependency notices. Generates `checksums.txt`, attaches + everything to the GitHub release. - Dependabot enabled (monthly) for both `gomod` and `github-actions`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57f2ebb..e41ab48 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,6 @@ Optional but recommended: - `staticcheck` — `go install honnef.co/go/tools/cmd/staticcheck@latest` - `govulncheck` — `go install golang.org/x/vuln/cmd/govulncheck@latest` -- `go-licenses` — `go install github.com/google/go-licenses@latest` - `termaid` — for testing mermaid rendering: `go install github.com/fasouto/termaid@latest` diff --git a/Makefile b/Makefile index af9c2eb..e790e92 100644 --- a/Makefile +++ b/Makefile @@ -13,13 +13,31 @@ release: GOOS=darwin GOARCH=amd64 go build -o bin/scroll-darwin-amd64 . GOOS=darwin GOARCH=arm64 go build -o bin/scroll-darwin-arm64 . -# licenses regenerates ./third_party/ — one LICENSE file per module -# scroll's main binary actually links against. Bundled into every -# release archive by .github/workflows/release.yml. Run locally -# whenever go.mod changes if you want to inspect the output. +# licenses regenerates ./third_party/ — one LICENSE file per +# module scroll's main binary actually links against. Bundled +# into every release archive by .github/workflows/release.yml. +# Run locally whenever go.mod changes if you want to inspect. +# +# Implemented as a shell loop over `go list -deps` rather than +# google/go-licenses because go-licenses currently fails on +# Go 1.25 stdlib introspection (upstream issue #128). licenses: - go install github.com/google/go-licenses@latest - go-licenses save . --save_path=./third_party --force --ignore github.com/rynobey/scroll + @rm -rf third_party && mkdir -p third_party + @go list -deps -f '{{if .Module}}{{.Module.Path}}|{{.Module.Dir}}{{end}}' . \ + | sort -u \ + | grep -v '^github.com/rynobey/scroll|' \ + | while IFS='|' read -r modpath moddir; do \ + [ -z "$$modpath" ] && continue; \ + lic=$$(ls "$$moddir"/LICENSE "$$moddir"/LICENSE.txt "$$moddir"/LICENSE.md "$$moddir"/COPYING "$$moddir"/COPYING.txt "$$moddir"/COPYING.md 2>/dev/null | head -1); \ + if [ -z "$$lic" ]; then \ + echo "WARN: no license file found for $$modpath" >&2; \ + continue; \ + fi; \ + mkdir -p "third_party/$$modpath"; \ + cp "$$lic" "third_party/$$modpath/$$(basename $$lic)"; \ + done + @count=$$(find third_party -mindepth 2 -type f | wc -l); \ + echo "wrote $$count license files to third_party/" clean: rm -f scroll diff --git a/README.md b/README.md index 4a8a93e..d87b6d3 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,6 @@ things that workflow needs: - **Live reload, per-file scroll-position memory, TOML themes** with a template DSL for custom decoration. -See the [comparison table](#how-does-it-compare) below for how -this lines up against `glow` and `mdcat`. - ## Install @@ -102,28 +99,6 @@ Common keybindings (full list under `?` in the viewer): | `?` | help overlay | | `q` | quit | -## How does it compare? - -| | scroll | [glow][glow] | [mdcat][mdcat] | -|---------------------------------|:--:|:--:|:--:| -| Static render to stdout | ✓ | ✓ | ✓ | -| Interactive viewer | ✓ | ✓ | | -| Multi-column reading layout | ✓ | | | -| Live reload | ✓ | | | -| Within-doc search | ✓ | ✓ | | -| Heading-tree folding | ✓ | | | -| Link nav with back/forward | ✓ | | | -| GFM tables (per-cell wrap) | ✓ | | ✓ | -| Image impressions on any terminal (block-glyph approximation) | ✓ | | | -| Pixel-accurate inline images (Kitty / iTerm protocol) | (experimental, Kitty only) | | ✓ | -| Mermaid → terminal art | ✓ (termaid) | | | -| Syntax-highlighted code blocks | ✓ | ✓ | ✓ | -| Configurable themes (TOML) | ✓ | ✓ | | -| Scroll-position memory per file | ✓ | | | - -[glow]: https://github.com/charmbracelet/glow -[mdcat]: https://github.com/swsnr/mdcat - ## Configuration Put a TOML config at `~/.config/scroll/config.toml` (or pass diff --git a/cmd/interactive.go b/cmd/interactive.go index 23413ac..94a2222 100644 --- a/cmd/interactive.go +++ b/cmd/interactive.go @@ -344,9 +344,9 @@ func (m model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { } // Extra quit keys (comma-separated list) declared via - // SCROLL_QUIT_KEYS. Lets the parent process map arbitrary keys - // to "close scroll" — used by sesh-cheatsheet to make alt+h - // toggle the cheatsheet. + // SCROLL_QUIT_KEYS. Lets a host CLI map arbitrary keys to + // "close scroll" — useful when scroll is launched as a popup + // from an outer app and the popup wants its own dismiss key. if extra := os.Getenv("SCROLL_QUIT_KEYS"); extra != "" { for _, qk := range strings.Split(extra, ",") { if strings.TrimSpace(qk) == key { @@ -1945,8 +1945,7 @@ func (m model) renderSearchPrompt() string { // rendered by scroll itself (dogfooding) via renderHelp. // helpMarkdownWide is the 4-column layout shown on wide terminals // (≥ 160 cols). Halves the vertical extent of each section by -// pairing rows side-by-side, matching the sesh cheatsheet's wide -// variant. +// pairing rows side-by-side. const helpMarkdownWide = "# scroll — keybindings\n" + "\n" + "## Scrolling\n" + @@ -2128,8 +2127,7 @@ func (m model) renderHelp() string { helpTheme.H1.Align = "center" helpTheme.H2.Align = "center" // Always render in a single document-column; the wide variant - // uses 4-column tables to spread keys side-by-side, matching - // the sesh cheatsheet layout. + // uses 4-column tables to spread keys side-by-side. helpTheme.Columns = 1 src := helpMarkdown if m.width >= 160 { diff --git a/docs/releasing.md b/docs/releasing.md index c480774..2c953ad 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -46,10 +46,11 @@ broken state. - [ ] `go test -race -count=1 ./...` passes. - [ ] `make release` succeeds locally — proves all four cross-targets actually compile from the current tree. -- [ ] `make licenses` succeeds locally — proves go-licenses can - still resolve every module's license file. (Run separately - from `make release` so the failure mode is obvious if a - newly-added dep ships without a recognised license.) +- [ ] `make licenses` succeeds locally — proves every module + ships a discoverable LICENSE / COPYING file in its module + cache directory. Run separately from `make release` so + the failure mode (`WARN: no license file found for X`) + is obvious if a newly-added dep ships without one. ### Smoke tests @@ -96,7 +97,7 @@ The convention is documented in - [ ] `git push origin vX.Y.Z`. - [ ] Watch the `release.yml` workflow on the [Actions tab](https://github.com/rynobey/scroll/actions/workflows/release.yml). - It should: generate `third_party/` via `go-licenses`, + It should: generate `third_party/` via `make licenses`, cross-compile four binaries, package each as `scroll-vX.Y.Z--.tar.gz` (containing the binary, `LICENSE`, `README.md`, and the `third_party/` diff --git a/docs/roadmap.md b/docs/roadmap.md index 4b64a9f..f01785b 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -15,8 +15,6 @@ Concrete steps to take the repo from "imported" to markers point at `docs/screenshots/{hero,multi-column,fineblocks-photo}.png`. Capture and drop them in (the docs/screenshots/README.md has capture suggestions). -- **Clean `testdata/`.** Current footprint ~600K; audit for - fixtures that aren't load-bearing for any test and remove. - **GoReleaser (optional).** The current `release.yml` is a hand-rolled cross-compile + archive flow that works for linux/darwin amd64+arm64. If we want windows builds, signed @@ -40,7 +38,7 @@ Concrete steps to take the repo from "imported" to (indirect dep via bubbletea) declares MIT in its `README.md` but ships no committed `LICENSE` file. Currently a non-issue for scroll because the package only compiles on Windows and - we don't ship Windows builds — `go-licenses` skips it. If + we don't ship Windows builds — `make licenses` skips it. If Windows ever becomes a release target, we'd hit it; worth filing an upstream PR adding a `LICENSE` file as defensive hygiene either way. diff --git a/examples/nvim-preview.toml b/examples/nvim-preview.toml index cdddf68..554e54e 100644 --- a/examples/nvim-preview.toml +++ b/examples/nvim-preview.toml @@ -1,8 +1,8 @@ -# Scroll theme used when the nvim `mp` floating terminal +# Scroll theme used when the nvim plugin's floating terminal # launches scroll. Overrides only the status-bar colour so the -# preview reads as a distinct sesh-branded overlay — everything -# else inherits scroll's defaults. +# preview reads as a distinct overlay against the surrounding +# editor — everything else inherits scroll's defaults. [status_bar] color = "0" # black text -background = "215" # orange bg (sesh accent, matches popup border) +background = "215" # orange bg (matches the float's border) diff --git a/main.go b/main.go index 3005502..6bb49ef 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,7 @@ -// scroll — a terminal markdown viewer. This binary is being built -// incrementally alongside sesh; long-term it will live in its own repo. +// scroll — a terminal markdown viewer. // -// Current capabilities: static render (--static) of a markdown file. -// Interactive viewer, tables, navigation, config loading, and theming -// land in subsequent tranches. +// CLI entrypoint. The actual rendering and viewer logic live under +// internal/render and cmd/. See docs/design.md for architecture. package main import ( diff --git a/testdata/features.md b/testdata/features.md index 1b6a472..970e6dd 100644 --- a/testdata/features.md +++ b/testdata/features.md @@ -14,7 +14,7 @@ spaces or a backslash still wrap correctly. Links come in several flavours: a [relative markdown file](sample2.md), an [absolute URL](https://example.com), an [in-doc anchor](#tables), -an autolink , and an email autolink +an autolink , and an email autolink . Images render as inline placeholders — ![diagram](./assets/flow.png) diff --git a/testdata/image-sample.md b/testdata/image-sample.md index 3aa82f9..c5ecf8f 100644 --- a/testdata/image-sample.md +++ b/testdata/image-sample.md @@ -16,9 +16,8 @@ If you're inside tmux, you also need set -g allow-passthrough on ``` -in `~/.config/tmux/tmux.conf` (or wherever your sesh tmux config -lives). Without it tmux silently swallows the escape and the image -area shows as a blank gap. +in `~/.config/tmux/tmux.conf`. Without it tmux silently +swallows the escape and the image area shows as a blank gap. ## 1. Wide landscape (800×200)