figmatk 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "name": "figmatk",
15
15
  "description": "Swiss Army Knife for Figma Files (.deck)",
16
- "version": "0.3.0",
16
+ "version": "0.3.1",
17
17
  "author": {
18
18
  "name": "FigmaTK Contributors"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Create and edit Figma Slides .deck files programmatically — no Figma API required",
5
5
  "author": {
6
6
  "name": "FigmaTK Contributors"
package/README.md CHANGED
@@ -67,7 +67,23 @@ Or add manually in Claude Desktop → Settings → Developer → Edit Config:
67
67
  }
68
68
  ```
69
69
 
70
- Available MCP tools: `figmatk_create_deck`, `figmatk_inspect`, `figmatk_list_text`, `figmatk_list_overrides`, `figmatk_update_text`, `figmatk_insert_image`, `figmatk_clone_slide`, `figmatk_remove_slide`, `figmatk_roundtrip`.
70
+ Available MCP tools: `figmatk_create_deck`, `figmatk_create_template_draft`, `figmatk_annotate_template_layout`, `figmatk_publish_template_draft`, `figmatk_list_template_layouts`, `figmatk_create_from_template`, `figmatk_inspect`, `figmatk_list_text`, `figmatk_list_overrides`, `figmatk_update_text`, `figmatk_insert_image`, `figmatk_clone_slide`, `figmatk_remove_slide`, `figmatk_roundtrip`.
71
+
72
+ ## Template Workflows
73
+
74
+ FigmaTK supports two related template states:
75
+
76
+ - Draft templates: `SLIDE_ROW -> SLIDE -> ...`
77
+ - Published templates: `SLIDE_ROW -> MODULE -> SLIDE -> ...`
78
+
79
+ Use explicit naming conventions when authoring reusable templates:
80
+
81
+ - Layouts: `layout:<name>`
82
+ - Text slots: `slot:text:<name>`
83
+ - Image slots: `slot:image:<name>`
84
+ - Decorative fixed imagery: `fixed:image:<name>`
85
+
86
+ `figmatk_list_template_layouts` understands those conventions and only falls back to heuristic image placeholders when a layout has not been explicitly annotated yet.
71
87
 
72
88
  ## Programmatic API
73
89
 
@@ -84,6 +100,7 @@ await deck.save('output.deck');
84
100
  |------|---|
85
101
  | High-level API | [docs/figmatk-api-spec.md](docs/figmatk-api-spec.md) |
86
102
  | Low-level FigDeck API | [docs/library.md](docs/library.md) |
103
+ | Template workflows | [docs/template-workflows.md](docs/template-workflows.md) |
87
104
  | File format internals | [docs/format/](docs/format/) |
88
105
 
89
106
  ## License
package/lib/fig-deck.mjs CHANGED
@@ -14,9 +14,10 @@ import { decompress } from 'fzstd';
14
14
  import { inflateRaw, deflateRaw } from 'pako';
15
15
  import { ZstdCodec } from 'zstd-codec';
16
16
  import archiver from 'archiver';
17
- import { readFileSync, createWriteStream, existsSync, mkdirSync, cpSync } from 'fs';
17
+ import { readFileSync, createWriteStream, existsSync, mkdtempSync } from 'fs';
18
18
  import { execSync } from 'child_process';
19
19
  import { join, resolve } from 'path';
20
+ import { tmpdir } from 'os';
20
21
  import { nid } from './node-helpers.mjs';
21
22
 
22
23
  export class FigDeck {
@@ -42,9 +43,8 @@ export class FigDeck {
42
43
  const absPath = resolve(deckPath);
43
44
 
44
45
  // Extract to temp dir
45
- const tmp = `/tmp/figmatk_${Date.now()}`;
46
- execSync(`rm -rf ${tmp} && mkdir -p ${tmp}`);
47
- execSync(`unzip -o "${absPath}" -d ${tmp}`, { stdio: 'pipe' });
46
+ const tmp = mkdtempSync(join(tmpdir(), 'figmatk_'));
47
+ execSync(`unzip -o "${absPath}" -d "${tmp}"`, { stdio: 'pipe' });
48
48
  deck._tempDir = tmp;
49
49
 
50
50
  // Read canvas.fig