openpencil/packages/cli/src
Danila Poyarkov fd44d7b853 Deduplicate: 47 → 28 clones, 1.37% → 0.61% duplication
Extracted shared helpers to eliminate copy-pasted code:

Core:
- computeAbsoluteBounds() in geometry.ts — replaces 4 bounding box loops
- makeDocumentNodeChange/makeCanvasNodeChange in kiwi-serialize.ts
- parseFigBuffer/parseFigKiwiContainer in kiwi/fig-parse-core.ts
  (fig-parse-worker.ts: 103 → 11 lines)
- createDefaultEditorState() — shared between core + app store
- calcClusterConfidence() in tools/analyze.ts
- retryWithNormalizedFamily() in fonts.ts
- getVectorNode() in tools/vector.ts
- renderFills() helper in renderer/scene.ts
- withNodeBounds() helper in renderer/overlays.ts
- drawNodeHighlightRect() in renderer/highlight-rect.ts
- isInViewport() in renderer/label-cache.ts

App:
- decodeTauriStderr() in utils/tauri.ts
- printNodeResults() in cli format.ts

Remaining 28 clones are: text-editor cursor movement (inherent),
xpath DOM traversal (inherent), small 5-line patterns too
context-specific to extract.
2026-03-17 11:10:11 +03:00
..
commands Deduplicate: 47 → 28 clones, 1.37% → 0.61% duplication 2026-03-17 11:10:11 +03:00
app-client.ts Fix RPC bridge review issues: centralize colors, ports, remove non-null assertions 2026-03-07 15:11:31 +03:00
format.ts Deduplicate: 47 → 28 clones, 1.37% → 0.61% duplication 2026-03-17 11:10:11 +03:00
headless.ts Move font loading and layout into SkiaRenderer.prepareForExport 2026-03-14 12:06:46 +03:00
index.ts XPath query for node selection (#82) 2026-03-09 15:32:27 +03:00