slice-machine icon indicating copy to clipboard operation
slice-machine copied to clipboard

Expose SM API for automation

Open pentatiby opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Automating parts of the SM workflow (or even an entire workflow) is difficult.

Describe the solution you'd like

It would be very helpful to be able to run SM actions via its local REST API, rather than only via the UI.

It might be even possible to do it right now by using the endpoints here, but having official support for this kind of work would be required for production usage.

Describe alternatives you've considered

  1. manually working with the JSON models and the Prismic API (current choice)
  2. running SM in a headless browser and using the actual UI from automation tools

Both of these approaches have downsides - having the SM API officially exposed for automation would be the most robust approach, as an automated user would only need updates for the API interface.

Additional context

pentatiby avatar Jul 05 '22 11:07 pentatiby

Hi, I'm coming back to this issue. Sorry about the long delay. Could you provide more details about your use case? What problem would you solve if you had such ability?

comeprismic avatar Oct 20 '23 14:10 comeprismic

The use case back when this was opened was around using SM only via the CI pipeline to deploy/push updates to a production environment, for a more robust/streamlined workflow, especially that, at the time, support for concurrent usage was little and there was a high risk of work loss/overrides.

In general, this enhancement would allow certain actions you can do via the SM UI to be done via its API, which removes the need to directly work with the Prismic API in order to achieve the same result.

pentatiby avatar Oct 20 '23 15:10 pentatiby

Hi @pentatiby I'm coming back to you super late I'm sorry about that. But note that the team has worked on the topic and we now have a pretty clear vision on what we would like to do on that front, meaning providing workflows for teams of developers to create/delete/update their models without risk of compromising their work. Though, we are currently focused on modeling capabilities and we will come back to this topic in the future.

I hope you understand.

Best,

Côme

comeprismic avatar Jun 10 '24 13:06 comeprismic

Do you happen to have any updates here? My use case is to enable the AI agent to create required fields in a slice automatically, rather than doing it manually via the UI.

dimaportenko avatar Jul 10 '25 08:07 dimaportenko

Hi @dimaportenko,

Thanks for your message!

At the moment, we don’t plan to expose the Slice Machine API for external use. Instead, we’re more interested in understanding why users are asking for this — what specific problems or workflows you're trying to automate — so we can address them natively in the product when it makes sense.

That said, I’m a bit confused by your comment. Slice Machine doesn’t currently support the concept of “required fields” as a built-in feature. Could you clarify what you mean by “create required fields in a Slice”? Are you referring to setting validation rules? Or something else?

Happy to dig deeper if you can provide more context.

benjammartin avatar Jul 21 '25 13:07 benjammartin

@benjammartin ok, let's say I just need "create fields in a Slice" but not manually, but via some API, or even MCP server.

dimaportenko avatar Jul 21 '25 13:07 dimaportenko

@dimaportenko Got it! The idea of using an MCP server to control modeling is definitely interesting.

Out of curiosity, what would the ideal workflow look like for you? How would you imagine the MCP interacting with Prismic? From a tool like Cursor, Claude, or something else? Would it be fully automated, or more like a semi-assisted workflow?

Curious to hear how you see it playing out.

benjammartin avatar Jul 21 '25 13:07 benjammartin

@benjammartin last week I was working on the pretty simple task - convert figma web page design to configurable slices. I used claude code for it. Each slice creation was as simple as prompt with

  • design links desktop/mobile for figma mcp
  • example of prismic slice code if needed
  • predefined project rules regarding our design system

On planning step ai can even provide you input fields needed for your slice.

So the annoying part was manual creation of slice and adding fields. I think it will be perfect use case for Prismic MCP for basic operations like

  • create slice
  • add/edit/remove slice field

dimaportenko avatar Jul 21 '25 13:07 dimaportenko

@dimaportenko That makes total sense, and actually, we already have two features that go in this direction:

  1. Image to Slice: Generate a Slice Model automatically from a Figma screenshot, directly in Slice Machine.
  2. Prismic MCP: A first step towards automating coding Slice.

Your use case feels very aligned with these directions.

Curious to hear your thoughts:

  1. Have you had a chance to try either of these features?
  2. From your point of view, what’s missing to fully match the workflow you described?

Thx

benjammartin avatar Jul 21 '25 13:07 benjammartin

@benjammartin

Have you had a chance to try either of these features?

I haven't tried it yet. I definitely will.

From your point of view, what’s missing to fully match the workflow you described?

Even generation from image looks helpful, it still feels disconnected from ai assistant and can't be controlled by prompt. What if I need extra fields for additional configuration (e.g. type of button action, configurable padding, on/off animated appearance, etc). This information can't be taken from the image.

dimaportenko avatar Jul 21 '25 19:07 dimaportenko