u/rabidgremlin

I created a Markdown import script

I created a Markdown import script

I created a script to import a Markdown file into the selected text frame. It maps the Markdown headings, paragraphs, lists and block quotes etc to the standard Affinity paragraph and text styles.

This was built using Codex CLI and the new Affinity MCP.

You can get the script from https://github.com/rabidgremlin/affinity-scripting along with a tool you can use to install it (since you can't do that via the Affinity UI ATM)

u/rabidgremlin — 3 days ago

I did some digging around into new but the very "hidden" script functionary in 3.2 + some tools I created

I have been hanging out for the scripting functionality since the new Affinity was first announced, so I was surprised to see it barely get a mention in the release notes... kinda as an footnote amongst the AI/Claude/MCP stuff and no docs anywhere

So I did some sleuthing into what the MCP server was doing...

  • The MCP server has access to a bunch of documentation that an AI agent can use as reference for creating scripts etc. I created a extract_docs.js script that can extract all these docs and save them locally so you can take a look at them. This includes some example affinity scripts.
  • Affinity has a scripts panel (Window > General > Scripts) which lets you see and run scripts created by the AI. However you cannot see the actual script's code, edit it or create your own scripts in the UI. I created a script_mgr.js script that can be used to manage scripts in the library (add, list, save to disk).
  • The documentation tells the AI agent to use search_sdk_skills to search for solutions before creating its own. This doesn't actually exist in the list of MCP tools available to the AI but there is a search_sdk_hints tool. I created asearch_sdk.js script that can be used to call this tool, just pass it a search query. In my testing the returned results are not that accurate but they will no doubt get better over time, because the description for that tool says Search a global pool of SDK hints from millions of other MCP sessions. Use it to check for existing solutions to problems you are facing.
  • There is a add_sdk_hint tool in the MCP which I'm guessing goes hand in hand with search_sdk_hints but it's documentation seems to indicate that actually updates the preamble doc.

You can find these scripts and instructions here: https://github.com/rabidgremlin/affinity-scripting

u/rabidgremlin — 3 days ago