Skip to content

perf(cli): lazy-load DLP deps — 6x faster startup, optionalDependencies#278

Merged
cdot65 merged 2 commits into
mainfrom
cdot65/perf/lazy-dlp-deps
Jul 7, 2026
Merged

perf(cli): lazy-load DLP deps — 6x faster startup, optionalDependencies#278
cdot65 merged 2 commits into
mainfrom
cdot65/perf/lazy-dlp-deps

Conversation

@cdot65

@cdot65 cdot65 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

airs --help went from ~0.35-0.45s to ~0.06s. The DLP generate command's import chain (sharp, pdf-lib, docx + the whole embed/generate graph) loaded on every invocation; it now loads via dynamic import only when the command runs. sharp/pdf-lib/docx/piexifjs moved to optionalDependencies per user decision.

Changes

  • loadGenerateCorpus() lazy loader in dlp/generate.ts with actionable missing-dep error (pnpm add sharp pdf-lib docx piexifjs), exit 1
  • package.json: 4 packages → optionalDependencies
  • Docs: generate.md documents optional deps

Verification

  • Parked node_modules/sharp--help works, dlp generate prints install hint
  • Startup measured 3x: 0.06s real (baseline 0.33-0.45s)
  • 643/643 tests, lint + tsc clean

Checklist

  • TDD — failing tests committed first
  • Gates green
  • Docs + changeset (minor)

Closes #266

@cdot65 cdot65 merged commit 67d4fdf into main Jul 7, 2026
4 checks passed
@cdot65 cdot65 deleted the cdot65/perf/lazy-dlp-deps branch July 7, 2026 01:05
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.

perf(cli): lazy-load DLP heavy deps; sharp/pdf-lib/docx/piexifjs to optionalDependencies

1 participant