feat: XDG Base Directory compliance, --uninstall flag, and xclip advisory #13

Merged
rootiest merged 4 commits from feat/xdg-compliance-and-uninstall into main 2026-05-09 05:02:16 +00:00
Owner

Summary

  • XDG Base Directory compliance — all install/config/runtime paths now resolve via $XDG_CONFIG_HOME, $XDG_DATA_HOME, and $XDG_RUNTIME_DIR with the conventional defaults (~/.config, ~/.local/share, /tmp) as fallbacks. BIN_DIR stays ~/.local/bin since no XDG standard covers user binaries.
  • --uninstall flag — removes the binary symlink, .desktop entry, and data directory with colored per-step output and a post-run verification pass. Prompts to remove the config directory when stdin is a TTY; skips the prompt (keeps config) in non-interactive mode.
  • xclip advisory--check-deps and --install now emit a yellow warning when wl-clipboard is absent but xclip is found, explaining that xclip routes through XWayland and may be unreliable on Wayland.
  • Dependency message cleanup — normalized all clipboard messages to use package names (wl-clipboard, xclip) consistently.
  • Readable path output — added tilde_path helper that replaces the $HOME prefix with ~/ in any user-facing path string. Applied throughout --help, --install, and --uninstall output. Paths outside $HOME (e.g. custom XDG roots) are shown as full absolute paths. All actual file operations continue to use the original absolute paths.
  • README — updated install steps, usage block, and configuration section to reference XDG variables; added xclip advisory to prerequisites; documented --uninstall.
  • Tests — export XDG_CONFIG_HOME/XDG_DATA_HOME in the sandbox so the overridden HOME is respected (fixes a pre-existing test regression); add cp and ln to mocked tools; add test 15 (install verifies XDG file placement) and test 16 (uninstall verifies cleanup with config kept).

Manual Verification

  • Run color-tool --help and confirm --uninstall appears, the --install line shows ~/... paths, and the config path at the bottom shows ~/.config/color-tool/config.toml.
  • With $XDG_CONFIG_HOME and $XDG_DATA_HOME unset, run --install and confirm all output paths are shown as ~/... and files land in the correct locations.
  • Set XDG_DATA_HOME=/tmp/test-data XDG_CONFIG_HOME=/tmp/test-cfg, run --install, and confirm output shows the full /tmp/... paths (not ~/...) and files land under those custom locations.
  • Run --uninstall (after installing) and confirm all step output and the verification table show ~/... paths. Answer N at the config prompt and confirm the config directory is kept.
  • Run --uninstall again and confirm it exits cleanly, reporting each missing item as "not found — skipping".
  • Run --check-deps on a system where xclip is installed but wl-clipboard is not, and confirm the yellow └─ xclip found but wl-clipboard is missing advisory appears.
  • Run ./tests/run_tests.sh and confirm all 16 tests pass.
## Summary - **XDG Base Directory compliance** — all install/config/runtime paths now resolve via `$XDG_CONFIG_HOME`, `$XDG_DATA_HOME`, and `$XDG_RUNTIME_DIR` with the conventional defaults (`~/.config`, `~/.local/share`, `/tmp`) as fallbacks. `BIN_DIR` stays `~/.local/bin` since no XDG standard covers user binaries. - **`--uninstall` flag** — removes the binary symlink, `.desktop` entry, and data directory with colored per-step output and a post-run verification pass. Prompts to remove the config directory when stdin is a TTY; skips the prompt (keeps config) in non-interactive mode. - **xclip advisory** — `--check-deps` and `--install` now emit a yellow warning when `wl-clipboard` is absent but `xclip` is found, explaining that xclip routes through XWayland and may be unreliable on Wayland. - **Dependency message cleanup** — normalized all clipboard messages to use package names (`wl-clipboard`, `xclip`) consistently. - **Readable path output** — added `tilde_path` helper that replaces the `$HOME` prefix with `~/` in any user-facing path string. Applied throughout `--help`, `--install`, and `--uninstall` output. Paths outside `$HOME` (e.g. custom XDG roots) are shown as full absolute paths. All actual file operations continue to use the original absolute paths. - **README** — updated install steps, usage block, and configuration section to reference XDG variables; added xclip advisory to prerequisites; documented `--uninstall`. - **Tests** — export `XDG_CONFIG_HOME`/`XDG_DATA_HOME` in the sandbox so the overridden `HOME` is respected (fixes a pre-existing test regression); add `cp` and `ln` to mocked tools; add test 15 (install verifies XDG file placement) and test 16 (uninstall verifies cleanup with config kept). ## Manual Verification - [x] Run `color-tool --help` and confirm `--uninstall` appears, the `--install` line shows `~/...` paths, and the config path at the bottom shows `~/.config/color-tool/config.toml`. - [x] With `$XDG_CONFIG_HOME` and `$XDG_DATA_HOME` **unset**, run `--install` and confirm all output paths are shown as `~/...` and files land in the correct locations. - [x] Set `XDG_DATA_HOME=/tmp/test-data XDG_CONFIG_HOME=/tmp/test-cfg`, run `--install`, and confirm output shows the full `/tmp/...` paths (not `~/...`) and files land under those custom locations. - [x] Run `--uninstall` (after installing) and confirm all step output and the verification table show `~/...` paths. Answer **N** at the config prompt and confirm the config directory is kept. - [x] Run `--uninstall` again and confirm it exits cleanly, reporting each missing item as "not found — skipping". - [x] Run `--check-deps` on a system where `xclip` is installed but `wl-clipboard` is not, and confirm the yellow `└─ xclip found but wl-clipboard is missing` advisory appears. - [x] Run `./tests/run_tests.sh` and confirm all 16 tests pass.
rootiest added 1 commit 2026-05-09 03:16:25 +00:00
feat: XDG Base Directory compliance, --uninstall flag, and xclip advisory
Test PR / test (pull_request) Successful in 7s
Auto Label PRs / label (pull_request) Successful in 3s
9ff6a58814
- Resolve all paths via $XDG_CONFIG_HOME, $XDG_DATA_HOME, and
  $XDG_RUNTIME_DIR with conventional fallbacks (~/.config,
  ~/.local/share, /tmp); BIN_DIR stays ~/.local/bin (no XDG standard)
- Add --uninstall: removes symlink, desktop entry, and data dir with
  colored per-step output; prompts to remove config when interactive,
  skips silently when not; post-run verification reports any failures
- Warn in --check-deps and --install when only xclip is present —
  xclip operates through XWayland and can be unreliable on Wayland
- Normalize dependency messages to package names (wl-clipboard, xclip)
- Update README: XDG paths in install steps, --uninstall in usage,
  xclip advisory in prerequisites
- Fix test sandbox: export XDG_CONFIG_HOME and XDG_DATA_HOME so the
  overridden HOME is respected; add install (test 15) and uninstall
  (test 16) coverage; add cp and ln to mocked tool set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rootiest force-pushed feat/xdg-compliance-and-uninstall from 9ff6a58814 to 06dd84d3a3 2026-05-09 03:46:19 +00:00 Compare
rootiest added 1 commit 2026-05-09 04:57:54 +00:00
fix(deps): dynamic clipboard label and yellow check for xclip-only in --check-deps
Test PR / test (pull_request) Successful in 6s
Auto Label PRs / label (pull_request) Successful in 2s
ad7a1f15b3
Show only the binary(s) actually present in the clipboard row label,
and use a yellow ✔ (instead of green) when only xclip is found so the
degraded state stands out from a fully-satisfied check.
rootiest added 1 commit 2026-05-09 05:00:36 +00:00
fix(tests): redirect stdin from /dev/null in uninstall test to prevent hang
Test PR / test (pull_request) Successful in 6s
Auto Label PRs / label (pull_request) Successful in 3s
Release on Merge / release (pull_request) Successful in 7s
1a27dbde4e
--uninstall prompts for config removal when stdin is a TTY. Running the
test from an interactive terminal caused it to block on read. Feeding
/dev/null forces the non-interactive path without changing behaviour.
rootiest added the Kind/Enhancement label 2026-05-09 05:01:48 +00:00
rootiest merged commit c206d78ce7 into main 2026-05-09 05:02:16 +00:00
rootiest deleted branch feat/xdg-compliance-and-uninstall 2026-05-09 05:02:17 +00:00
Sign in to join this conversation.