Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
feat(figma): incremental skip when file version is unchanged
grumingff1bf75fd553
diff --git a/understand-anything-plugin/packages/core/src/figma/source/types.ts b/understand-anything-plugin/packages/core/src/figma/source/types.tsindex 3b28e399..665f267c 100644--- a/understand-anything-plugin/packages/core/src/figma/source/types.ts+++ b/understand-anything-plugin/packages/core/src/figma/source/types.ts@@ -14,6 +14,8 @@ export interface FigmaDocument {document: FigmaNode; // root (DOCUMENT) whose children are CANVAS (pages)components?: Record<string, { key: string; name: string; componentSetId?: string }>;componentSets?: Record<string, { key: string; name: string }>;+ version?: string; // Figma file version (changes on every edit)+ lastModified?: string; // ISO timestamp}export interface FigmaStyles {diff --git a/understand-anything-plugin/skills/understand-figma/SKILL.md b/understand-anything-plugin/skills/understand-figma/SKILL.mdindex 18b0fc68..b20f256c 100644--- a/understand-anything-plugin/skills/understand-figma/SKILL.md+++ b/understand-anything-plugin/skills/understand-figma/SKILL.md@@ -36,6 +36,8 @@ FIGMA_TOKEN="$FIGMA_TOKEN" node <SKILL_DIR>/figma-scan.mjs "$PROJECT_ROOT" "<urlIt writes `.understand-anything/intermediate/scan-manifest.json` and prints the node counts. Relay the counts to the user. If it exits non-zero, relay stderr and STOP.+> If the scan prints `UP_TO_DATE`, report "Design graph is already up to date for this Figma file version" and STOP. To force a full rebuild, re-run with `UNDERSTAND_FIGMA_FORCE=1` set in the environment.+## Phase 2 — ANALYZE (LLM enrichment)1. Read `scan-manifest.json`. Group nodes into batches of ~15, grouped by page when possible.diff --git a/understand-anything-plugin/skills/understand-figma/figma-merge.mjs b/understand-anything-plugin/skills/understand-figma/figma-merge.mjsindex e7c757c2..68df456d 100644--- a/understand-anything-plugin/skills/understand-figma/figma-merge.mjs+++ b/understand-anything-plugin/skills/understand-figma/figma-merge.mjs@@ -25,6 +25,7 @@ writeFileSync(join(outDir, "knowledge-graph.json"), JSON.stringify(result.data,writeFileSync(join(outDir, "meta.json"), JSON.stringify({lastAnalyzedAt: new Date().toISOString(),gitCommitHash: "",+ figmaVersion: manifest.figmaVersion ?? "",version: "1.0.0",analyzedFiles: result.data.nodes.length,}, null, 2));diff --git a/understand-anything-plugin/skills/understand-figma/figma-scan.mjs b/understand-anything-plugin/skills/understand-figma/figma-scan.mjsindex 54fb3d96..b453f245 100644--- a/understand-anything-plugin/skills/understand-figma/figma-scan.mjs+++ b/understand-anything-plugin/skills/understand-figma/figma-scan.mjs@@ -1,5 +1,5 @@#!/usr/bin/env node-import { writeFileSync, mkdirSync } from "node:fs";+import { writeFileSync, mkdirSync, readFileSync, existsSync } from "node:fs";import { join } from "node:path";import { parseFileKey, FigmaApiSource, parseDocument, extractTokens } from "@understand-anything/core/figma";@@ -12,6 +12,21 @@ if (!projectRoot || !urlOrKey) {const fileKey = parseFileKey(urlOrKey);const source = new FigmaApiSource(fileKey); // reads FIGMA_TOKEN from env; throws a friendly error if missingconst doc = await source.fetchDocument();++const metaPath = join(projectRoot, ".understand-anything", "meta.json");+let prevVersion = null;+if (existsSync(metaPath)) {+ try {+ prevVersion = JSON.parse(readFileSync(metaPath, "utf8")).figmaVersion ?? null;+ } catch {+ prevVersion = null; // malformed/partial meta.json → fall through to a full rebuild+ }+}+if (doc.version && prevVersion === doc.version && process.env.UNDERSTAND_FIGMA_FORCE !== "1") {+ console.error("UP_TO_DATE");+ process.exit(0);+}+const styles = await source.fetchStyles().catch(() => ({ meta: { styles: [] } }));const structural = parseDocument(doc, fileKey);@@ -42,6 +57,7 @@ const manifest = {gitCommitHash: "",},fileKey,+ figmaVersion: doc.version ?? "",nodes,edges,};