From 74477e8c322b7091cd83a777ed762a1b5202027c Mon Sep 17 00:00:00 2001 From: planetabhi <1704622+planetabhi@users.noreply.github.com> Date: Sat, 15 Aug 2026 19:06:50 +0530 Subject: [PATCH] v0.0.4 --- .gitignore | 4 +++- index.ts | 1 + src/core.ts | 15 ++++++++------- src/fetch/figma.ts | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index e75623a..32df7a2 100644 --- a/.gitignore +++ b/.gitignore @@ -156,4 +156,6 @@ Thumbs.db # local scratch files plan.md -dummy.png \ No newline at end of file +dummy.png + +rules/ \ No newline at end of file diff --git a/index.ts b/index.ts index 0df556d..daeece6 100644 --- a/index.ts +++ b/index.ts @@ -136,6 +136,7 @@ function parseIgnore(spec: string | undefined): IgnoreRegion { if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n))) { fail(`--ignore expects x,y,w,h (got "${spec ?? ""}")`); } + // SAFETY: the guard above proves parts holds exactly four finite numbers. const [x, y, width, height] = parts as [number, number, number, number]; return { x, y, width, height }; } diff --git a/src/core.ts b/src/core.ts index e3fe915..58d97eb 100644 --- a/src/core.ts +++ b/src/core.ts @@ -118,18 +118,19 @@ export async function designDiff(opts: DesignDiffOptions): Promise(path: string, token: string): Promise { for (let attempt = 0; ; attempt++) { const res = await fetch(`${FIGMA_API}${path}`, { headers: { "X-Figma-Token": token } }); + // SAFETY: these Figma REST endpoints return the fields declared by the caller's response + // type (FigmaNodesResponse / FigmaImagesResponse); every accessed field is guarded downstream. if (res.ok) return (await res.json()) as T; const retryable = res.status === 429 || res.status >= 500; if (!retryable || attempt >= MAX_RETRIES) {