Skip to content

fix(theme): validate what lich's install accepts on three edge cases - #52

Merged
omartelo merged 1 commit into
mainfrom
fix/theme-validate-match-lich-install
Oct 8, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/theme-validate-match-lich-install

Conversation

@omartelo

@omartelo omartelo commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Aligns validate.mjs with readPackTheme/Import in lich's internal/themes, one test each (failing before, passing after):

  • formatVersion: 0 passes: lich decodes an omitted one to 0. (lich's own schema says minimum: 1, which the Go accepts below; not touched here.)
  • source that does not decode into {url, version} fails as a parse error. Its contents are not run through validateRemote: Import drops a written source and readPackTheme replaces it, so lich never rejects a theme for one. A test pins that a decodable source with a bad URL passes.
  • A directory named *.json is skipped in a repository, not counted (a pack of only that now reports no theme JSON).

node --test tests/*.test.mjs: 335 pass. Real packs (rose-pine, lotus, catppuccin, eldritch, moonfly, oceanic-next) still pass.

validate.mjs disagreed with readPackTheme and Import in lich's
internal/themes:

- formatVersion 0 was rejected; lich decodes an omitted one to 0 and
  reads it as format 1.
- a source that does not decode into {url, version} passed; lich fails
  to parse the file. Its contents stay unchecked, since both install
  paths replace a written source before validating.
- a directory named *.json counted toward the repository's themes, so
  a pack holding only one passed; lich skips it.
@omartelo
omartelo merged commit 327e2e9 into main Oct 8, 2026
3 checks passed
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