Implement real PES file export #2

Closed
opened 2026-06-22 14:58:57 +00:00 by Mark · 4 comments
Owner

⚠️ Re-scoped — blocked on #11

This work was originally framed as "implement from scratch." After auditing the
existing ~/Projects/easystitch/ project (a complete Python embroidery CAM with
5-stage pipeline, satin/fill/running generation, ΔE color matching, and PES/DST/
EXP/JEF output), the right shape is call the EasyStitch service rather than
re-implement the algorithms.

Blocked on #11 ("Stand up EasyStitch as an HTTP service for ThreadCraft").
Until that service exists, this work has no backend to call.

Donor code in EasyStitch (do not port — call it):

  • ~/Projects/easystitch/src/output_generators/pes_generator.py
  • ~/Projects/easystitch/src/post_processing/pull_compensation.py

New scope (post #11)

Replace the in-app PES export with a thin client of the EasyStitch
service. Specifically:

  1. Add a src/lib/easystitch-client.ts typed wrapper (or use the one
    introduced in #11) with a exportPES(stitchObjects, opts) => Blob
    function that calls POST /v1/export and returns the binary.
  2. Update src/components/workspace/ExportDialog.tsx to call this
    client when the user picks PES, and trigger a file download with
    the returned bytes.
  3. Show a progress state during the round-trip (typical: 200-600ms).
  4. Surface the service's X-Stitch-Count and X-Color-Count headers
    in the export confirmation toast.
  5. Error handling: if the service is unreachable, show a toast with
    the failure and offer a "retry". Do not crash the React tree.

Acceptance: a real PES file downloads from the Workspace export
flow and opens in an embroidery viewer (e.g. Ink/Stitch or
embroiderviewer.com) with the design rendered correctly.

## ⚠️ Re-scoped — blocked on #11 > This work was originally framed as "implement from scratch." After auditing the > existing `~/Projects/easystitch/` project (a complete Python embroidery CAM with > 5-stage pipeline, satin/fill/running generation, ΔE color matching, and PES/DST/ > EXP/JEF output), the right shape is **call the EasyStitch service** rather than > re-implement the algorithms. > > **Blocked on #11** ("Stand up EasyStitch as an HTTP service for ThreadCraft"). > Until that service exists, this work has no backend to call. > > Donor code in EasyStitch (do not port — call it): - `~/Projects/easystitch/src/output_generators/pes_generator.py` - `~/Projects/easystitch/src/post_processing/pull_compensation.py` ## New scope (post #11) Replace the in-app PES export with a thin client of the EasyStitch service. Specifically: 1. Add a `src/lib/easystitch-client.ts` typed wrapper (or use the one introduced in #11) with a `exportPES(stitchObjects, opts) => Blob` function that calls `POST /v1/export` and returns the binary. 2. Update `src/components/workspace/ExportDialog.tsx` to call this client when the user picks PES, and trigger a file download with the returned bytes. 3. Show a progress state during the round-trip (typical: 200-600ms). 4. Surface the service's `X-Stitch-Count` and `X-Color-Count` headers in the export confirmation toast. 5. Error handling: if the service is unreachable, show a toast with the failure and offer a "retry". Do not crash the React tree. Acceptance: a real PES file downloads from the Workspace export flow and opens in an embroidery viewer (e.g. Ink/Stitch or embroiderviewer.com) with the design rendered correctly.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Blocked on #11 (Stand up EasyStitch as an HTTP service for ThreadCraft).

This work has been re-scoped — see the updated body. The reframe replaces
"implement from scratch" with "call the EasyStitch service and render the
result." #11 must complete first; once the service exposes /v1/digitize and
/v1/export, this work becomes a thin client + canvas rendering job.

cc: #11

**Blocked on #11** (Stand up EasyStitch as an HTTP service for ThreadCraft). This work has been re-scoped — see the updated body. The reframe replaces "implement from scratch" with "call the EasyStitch service and render the result." #11 must complete first; once the service exposes `/v1/digitize` and `/v1/export`, this work becomes a thin client + canvas rendering job. cc: #11
Author
Owner

Blocked-on update

This issue is blocked on easystitch-service#2 ("Dockerfile + node_hub deployment configuration").

Why: needs the FastAPI wrapper (#1) deployed before /v1/export can be called from the browser.

The parent ticket [Kimi_Agent_Brother_10_Digitizing_App#11] is the integration contract. The actual implementation lives in Mark/easystitch-service. When easystitch-service#2 closes, this issue can move forward.

There is also a frontend-side wiring issue: [Mark/easystitch-service#3] ("TypeScript client wrapper + vite dev proxy") — that one will be mirrored into the ThreadCraft repo as a frontend sub-issue when it's ready to dispatch.

## Blocked-on update This issue is blocked on **easystitch-service#2** ("Dockerfile + node_hub deployment configuration"). **Why:** needs the FastAPI wrapper (#1) deployed before /v1/export can be called from the browser. The parent ticket [Kimi_Agent_Brother_10_Digitizing_App#11] is the integration contract. The actual implementation lives in [Mark/easystitch-service](https://forgejo.tail018ac4.ts.net/Mark/easystitch-service). When easystitch-service#2 closes, this issue can move forward. There is also a frontend-side wiring issue: [Mark/easystitch-service#3] ("TypeScript client wrapper + vite dev proxy") — that one will be mirrored into the ThreadCraft repo as a frontend sub-issue when it's ready to dispatch.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Mark 2026-06-27 03:51:32 +00:00
Sign in to join this conversation.
No description provided.