Commit c9b4db6b authored by Irun's avatar Irun
Browse files

Trying out another workaround

parent 3f17098c
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -5,10 +5,24 @@ model: haiku
effort: low
---

Just run:
This skill is just a workaround to give the user the exact cli command to call a script in this plugin, because the script might conflict with Claude Code's permission.

```bash
node ${CLAUDE_SKILL_DIR}/scripts/get-instruction.js
Just write the text below in `./.figma-to-code/extraction.md`:

---

Command + path to extract:

```
node ${CLAUDE_SKILL_DIR}/scripts/extract.js
```

This skill and script is just a workaround to give the user the exact cli command to call a script in this plugin, because the script might conflict with Claude Code's permission.
node ${CLAUDE_SKILL_DIR}/scripts/extract.js [CHANNEL] [-n = PAGE_NAME_OVERRIDE]

This needs `https://www.figma.com/community/plugin/1485687494525374295/cursor-talk-to-figma-mcp-plugin` opened in a Figma file, connected to a channel, with a page/screen element selected to work.

If a previous channel is saved, the script will try to use it as a fallback.

An invalid channel might fail silently!

If image export takes a long time, you might need to keep the Figma app / web page on the foreground.
+0 −26
Original line number Diff line number Diff line
// Inside your skill's JS file
import { writeFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
const scriptPath = join(__dirname, 'extract.js');
const command = `Command + path to extract:

\`\`\`
node ${scriptPath}
\`\`\`

node ${scriptPath} [CHANNEL] [-n = PAGE_NAME_OVERRIDE]

This needs \`https://www.figma.com/community/plugin/1485687494525374295/cursor-talk-to-figma-mcp-plugin\` opened in a Figma file, connected to a channel, with a page/screen element selected to work.

If a previous channel is saved, the script will try to use it as a fallback.

An invalid channel might fail silently!

If image export takes a long time, you might need to keep the Figma app / web page on the foreground.
`;

// Write to the project directory (cwd = the user's project when Claude Code runs)
writeFileSync(join(process.cwd(), '.figma-to-code', 'extraction.md'), command);
 No newline at end of file