Skip to content

feat: prep first release#1

Merged
AVGVSTVS96 merged 9 commits into
mainfrom
publish
May 18, 2026
Merged

feat: prep first release#1
AVGVSTVS96 merged 9 commits into
mainfrom
publish

Conversation

@AVGVSTVS96

Copy link
Copy Markdown
Owner

Prep work for the first public release. Eight atomic commits — each builds and runs on its own.

🐛 Fixes

  • README typo (it'sits)
  • FAQ snippet referenced a nonexistent provider (tmux_windowtmux_window_name)
  • Providers table claimed tmux-pane-%17/ but util.sanitize strips % — corrected to tmux-pane-_17/ with a clarifying note

🏗️ Refactor

init.lua was doing six jobs at once. Split it into focused modules so each concern is reviewable, testable, and lazy-loaded:

Module Responsibility
config.lua defaults + merge, typed PersistenceScope.Config
scope.lua provider resolution, current scope, base_dir/session_dir, scope-from-file
session.lua glob, .vim parsing, item construction, load_file, typed PersistenceScope.SessionItem
restore.lua the restore() decision tree, isolated
pickers/snacks.lua absorbed Snacks-specific preview rendering (was wrongly in init.lua)
init.lua now ~110 lines: public API + setup() wiring only

Public API is unchanged. The one intentional behavioral change is a friendlier notify prefix (persistence-scope: ...) — everything else was verified bit-for-bit equivalent against the pre-refactor code.

✨ Features

  • :checkhealth persistence_scope — reports Neovim version, dependency status, resolved scope, target directory, tmux state, and session-file count
  • User commands registered in plugin/ so :PersistenceScopeRestore / :PersistenceScopeSelect are discoverable in :command before setup() runs
  • Friendly vim.notify error when folke/persistence.nvim is missing, instead of a Lua stack trace
  • Typed annotations (PersistenceScope.Config / Scope / SessionItem) for LSP hovers and custom-provider authors

🧰 Tooling & CI

  • stylua.toml, .editorconfig, .luacheckrc for contributor baseline
  • GitHub Actions workflow with three jobs:
    • stylua --check
    • luacheck
    • Headless smoke test across Neovim 0.10.4 / stable / nightly (clones persistence.nvim, runs setup(), asserts API, runs :checkhealth)

📚 Documentation

  • vim.pack install snippet for Neovim 0.12+ users (native package manager)
  • Troubleshooting section in both README and vimdoc pointing at :checkhealth
  • Documented the need option (forwarded to persistence.nvim) which was previously undocumented
  • Vimdoc rewrite with proper helptags so :help persistence_scope.restore() works for each Lua API entry
  • Framing line under the directory diagram clarifying this plugin layers on top of persistence.nvim rather than replacing it

✅ Verified

Local headless run confirms:

  • Commands exist before setup() is called
  • Scope resolves correctly with a stub provider
  • persistence.select / load_file are patched as expected
  • sessions() enumerates real session files (477 in my state dir) with branches and buffer summaries
  • :checkhealth persistence_scope renders cleanly

Commits

ac79565 docs(readme): add vim.pack install, need option, troubleshooting
373dfb9 docs: rewrite vimdoc with helptags for Lua API and new options
d156a04 ci: add stylua, luacheck, and headless smoke test workflow
9a84bae chore: add stylua, editorconfig, and luacheck configs
75dcee8 feat: add :checkhealth persistence_scope
d0a9164 feat: register user commands in plugin/ for early discovery
bba0374 refactor: split init.lua into focused modules
1b04fd7 fix(docs): correct README typos and inaccurate examples

- 'it's tmux window name' -> 'its tmux window name' (possessive)
- FAQ snippet referenced provider = 'tmux_window' which does not exist;
  corrected to 'tmux_window_name'
- Providers table claimed tmux-pane-%17/ but util.sanitize strips '%';
  corrected to tmux-pane-_17/ with a clarifying note
init.lua was doing six jobs at once (config, scope state, file parsing,
item construction, Snacks preview rendering, restore decision tree).
Reduce it to ~110 lines of public API plus setup() wiring, with each
concern in its own module:

  config.lua    defaults + merge, typed PersistenceScope.Config
  scope.lua     provider resolution, current scope, base_dir/session_dir,
                scope-from-file
  session.lua   glob, .vim parsing, item construction, load_file,
                recent_count, typed PersistenceScope.SessionItem
  restore.lua   the restore() decision tree, isolated and testable

Snacks-specific preview rendering (SnacksPicker* highlight groups) moved
out of init.lua and into pickers/snacks.lua where it belongs. Preview
building is now lazy so the vim.ui fallback never pays for it.

All inner modules are lazy-required from init.lua so importing the
package does almost no work until a function is actually called.

Bundled in this commit because they touch the same setup() function:

- Friendly vim.notify error when folke/persistence.nvim is missing,
  instead of a cryptic Lua stack trace.
- Restore-failure notify now prefixed with 'persistence-scope:' so users
  can tell which plugin is talking. This is the one intentional
  behavioral change; verified against the pre-refactor code that
  everything else is bit-for-bit equivalent.
- Added desc fields to the user-command registrations.

Public API surface is unchanged: setup, restore, select, sessions,
load_file, config, scope.
Previously :PersistenceScopeRestore and :PersistenceScopeSelect were
only created inside setup(), which meant they did not appear in
:command output (or tab completion) until setup() ran.

Define them in plugin/persistence_scope.lua at startup with lazy-required
handlers, so they are discoverable immediately. setup() re-registers
them with force=true (identical behavior, just cleaner discovery).

Guarded with vim.g.loaded_persistence_scope to prevent double loading.
Reports everything a user needs to self-diagnose:

  - Neovim version (errors below 0.10)
  - folke/persistence.nvim installed (errors if missing, warns if its
    fire() function is missing)
  - folke/snacks.nvim installed (info-only, optional dependency)
  - Whether setup() has been called or defaults are in use
  - Resolved scope: kind, label, and the target sessions directory
    (or 'global' / base_dir when no scope is resolved)
  - Whether the editor is running inside tmux
  - Count of session files currently under base_dir

Uses the modern vim.health.{start,ok,warn,error,info} API with a
fallback to vim.health.report_* for compatibility.
stylua.toml      2-space indent, 120-column, double quotes
.editorconfig    LF, trim trailing whitespace, 2-space Lua, tab Makefile
.luacheckrc      declares vim and Snacks as known globals, sets
                 max_line_length=120, ignores a few benign Lua warnings

These set baseline expectations for contributors and are consumed by
the CI workflow added in the following commit.
Three jobs run on every push to main and on pull requests:

  stylua   stylua --check . fails the build on formatting drift
  lint     luacheck lua plugin catches unused vars, shadowing, etc.
  smoke    headless Neovim across 0.10.4 / stable / nightly clones
           folke/persistence.nvim, runs runtime plugin/persistence_scope,
           calls setup() with a stub provider, asserts the public API is
           present, and runs :checkhealth persistence_scope

The smoke test catches load-time regressions across the supported
Neovim version matrix. Behavioral regressions still need targeted
tests, which are intentionally left as a follow-up.
Previously the Lua API was a single unanchored block in the help file.
Each function now has its own tag so :help works for individual entries:

  :help persistence_scope.restore()
  :help persistence_scope.select()
  :help persistence_scope.sessions()
  :help persistence_scope.load_file()

Also adds:

  *persistence-scope-need-option*           documents 'need', forwarded
                                            to persistence.nvim
  *persistence-scope-custom-provider*       direct anchor for the custom
                                            provider example
  *persistence-scope-troubleshooting*       new section pointing at
                                            :checkhealth persistence_scope

Reformatted to follow standard Vim help conventions (>/< code blocks,
column-aligned tags) and regenerated doc/tags accordingly.
- vim.pack install snippet for Neovim 0.12+ users (native package
  manager) right after the lazy.nvim snippet
- 'Sessions are still written by folke/persistence.nvim' framing line
  under the directory diagram so readers immediately understand this
  is a layer on top of persistence.nvim, not a replacement
- New Troubleshooting section pointing at :checkhealth persistence_scope
  with a 3-step debug checklist
- Config block: document the 'need' option (forwarded to persistence.nvim)
  and clarify that setup() with no arguments works fine
- Minor copy clean-ups in the config block and IMPORTANT callout
- TOC entry for the new Troubleshooting section
@AVGVSTVS96 AVGVSTVS96 changed the title Prep for first public release feat: prep first release May 18, 2026
Fixes stylua --check violations caught by the new CI workflow:

- util.lua and vim_ui.lua predate this PR; one nested table.concat
  call in each exceeded the 120-column budget and got reflowed.
- session.lua is new in this PR; a long 3-clause if condition got
  collapsed onto a single line.

All formatting choices are stylua's defaults under the repo's
stylua.toml (2-space, 120-col, double quotes).
@AVGVSTVS96 AVGVSTVS96 merged commit 8346bf9 into main May 18, 2026
5 checks passed
@AVGVSTVS96 AVGVSTVS96 deleted the publish branch May 18, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant