Skip to content

Refactor GUI and CLI onto a shared compression core - #12

Merged
SLP-DEV1 merged 4 commits into
mainfrom
refactor/shared-compression-core
Aug 26, 2026
Merged

Refactor GUI and CLI onto a shared compression core#12
SLP-DEV1 merged 4 commits into
mainfrom
refactor/shared-compression-core

Conversation

@SLP-DEV1

Copy link
Copy Markdown
Owner

Summary

Remove duplicated Sharp compression logic from the server and CLI and move it into one shared Node compression engine.

Shared core

  • add lib/compression-core.mjs
  • centralize format normalization and extension mapping
  • centralize Sharp pipeline construction
  • centralize resize, metadata, JPG flatten, PNG/WebP/JPEG encoder settings
  • centralize target-size binary quality search
  • centralize Auto Best candidate generation and selection
  • centralize candidate summaries and metadata reads

Server

  • keep API/job/reSmush/ZIP behavior in server/index.mjs
  • delegate all local compression, Auto Best and target-size work to the shared core
  • remove the previous duplicate implementations

CLI

  • delegate local, Auto Best and target-size processing to the same shared core
  • preserve existing CLI-facing method names and JSON structure through a thin adapter
  • keep CLI local-only

CI

  • syntax-check the shared core directly
  • exercise target-size and Auto Best directly against an in-memory generated image
  • keep the existing end-to-end CLI target-size and Auto Best tests
  • keep strict TypeScript and production build validation

The goal is behavioral consistency: future encoder or search changes should be implemented once instead of separately in GUI/server and CLI.

@SLP-DEV1
SLP-DEV1 merged commit 245da83 into main Aug 26, 2026
1 check 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