Studio Code: Add data liberation slash command - #3940
Conversation
📊 Performance Test ResultsComparing a04daa9 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
| import { textResult } from './utils'; | ||
|
|
||
| const ENGINE_DIR = path.join( STUDIO_SITES_ROOT, '_liberations', 'data-liberation' ); | ||
| const ENGINE_REPO = 'https://github.com/Automattic/data-liberation-agent.git'; |
There was a problem hiding this comment.
IS this how we want to consume this, feels very fragile to me. I'd have preferred if that liberation agent becomes just a package in the Studio repository personally.
There was a problem hiding this comment.
(shouldn't stop this PR from shipping if we think it's producing good results but I believe it's something important to solve. @borkweb was also thinking about these things.
There was a problem hiding this comment.
Also related to this, "data-liberation" is not the only "tool/package" that would benefit from this, we have the taxonomist too which is very similar.
sejas
left a comment
There was a problem hiding this comment.
Vova, thanks for exploring the integration of the Liberate skill into Studio ✨.
On Riad’s note, I see that we require users to have git and npm installed on users' machines, and running npm ci could also introduce Node version compatibility issues. Do you think we could explore adding Liberate as a package?
| await runProcess( | ||
| 'git', | ||
| [ 'clone', '--depth', '1', '--branch', 'main', ENGINE_REPO, ENGINE_DIR ], | ||
| STUDIO_SITES_ROOT | ||
| ); | ||
|
|
||
| await runProcess( 'npm', [ 'ci' ], ENGINE_DIR ); |
There was a problem hiding this comment.
What if the user doesn't have git or npm installed?
Makes sense
@youknowriad, what do you mean by "package"? To download the GitHub repo during build time, build it, and include it in the Studio bundle? |
Ideall for me is a "packages" folder in Studio repo like we have "apps" with reusable npm packages, that we can ship independently if needed but also bundle in other "apps" (like CLI) |
@youknowriad do you propose to remove https://github.com/Automattic/data-liberation-agent github repo and move all the code into <this_studio_github_repo>/packages/data-liberation-agent folder? |
|
Yes |
|
@youknowriad @sejas @borkweb I propose to align and agree the solution. Is everybody okay with archiving https://github.com/Automattic/data-liberation-agent and moving the code into |
|
Do we know how much kb would add the addition of the data liberation agent to Studio CLI. My initial impression is that it should be negligible but I could be wrong. |
There are many dependencies - https://github.com/Automattic/data-liberation-agent/blob/main/package.json I asked AI to analyze deps and there is good news about
|
|
My guess is that the biggest chunk of these dependencies is already a dependency of Studio CLI |
I'm ok with that, although I can only answer with the part of accepting the package into the Studio repository. I don't have the context to talk about the future of the https://github.com/Automattic/data-liberation-agent repository. |
|
@youknowriad, one more question - do you think Matthew Batchelder’s approval is enough for us to move the repo into Studio, or can we proceed without waiting for a response? Also, do we need Matt’s approval since he created the repo? |
borkweb
left a comment
There was a problem hiding this comment.
Just one small change with one small thought:
In the data-liberation-agent, there's an alias to the /liberate skill called /migrate that I added because the word liberate is probably not something that folks would easily remember. The migrate Skill merely invokes the liberate Skill.
I wonder if we should do similarly here—adding a /migrate slash command that merely calls liberate.
Not 100% necessary, but might be a good usability boost.
|
|
||
| # Liberate a website into Studio | ||
|
|
||
| This skill is only a **redirect**. The real, always-up-to-date pipeline lives in the Data Liberation engine's own skill, which Studio downloads on first use. Do NOT re-plan or summarize the steps here — defer to the engine skill so its updates take effect automatically. Your job is just to (1) stand the engine up and (2) follow its skill, translating its tool calls into Studio's bridge. |
There was a problem hiding this comment.
| This skill is only a **redirect**. The real, always-up-to-date pipeline lives in the Data Liberation engine's own skill, which Studio downloads on first use. Do NOT re-plan or summarize the steps here — defer to the engine skill so its updates take effect automatically. Your job is just to (1) stand the engine up and (2) follow its skill, translating its tool calls into Studio's bridge. | |
| This skill is only a **redirect**. The real, always-up-to-date pipeline lives in the Data Liberation engine's own skill. Do NOT re-plan or summarize the steps here — defer to the engine skill so its updates take effect automatically. Your job is just to (1) stand the engine up and (2) follow its skill, translating its tool calls into Studio's bridge. |
675e440 to
56c5d39
Compare
## Related issues <!-- Link a related issue to this PR. If the PR does not immediately resolve the issue, for example, it requires a separate deployment to production, avoid using the "Fixes" keyword and use "Related to" instead. --> - Fixes # ## How AI was used in this PR <!-- Help reviewers understand what to look for and verify that you've reviewed the code yourself. --> ## Proposed Changes <!-- Explain the intent of this PR: - What problem does it solve, or what need does it address? - How does it affect the user (new capability, fix, performance, accessibility, etc.)? - Note any user-visible behavior changes or trade-offs. Focus on the "why" and the user impact. Avoid listing modified files or describing implementation mechanics — the diff already shows that. --> - ## Testing Instructions <!-- Add as many details as possible to help others reproduce the issue and test the fix. "Before / After" screenshots can also be very helpful when the change is visual. --> - ## Pre-merge Checklist <!-- Complete applicable items on this checklist **before** merging into trunk. Inapplicable items can be left unchecked. Both the PR author and reviewer are responsible for ensuring the checklist is completed. --> - [ ] Have you checked for TypeScript, React or other console errors?
56c5d39 to
a827a32
Compare
I completely agree. I think /migrate is easier to remember and understand at a glance than /liberate. |
|
I'm testing and I'll share my findings as I go through it. The first thing is that after running the liberate_extract, I got a timeout and it told me, it's fine because it's running in the background and then every second I'm seeing
That doesn't feel like a great user experience, instead I'd prefer a loader/spinner like we do for import/export. |
|
And that tool call on loop is probably consuming a lot of tokens as well. |
Thanks, yeah, right now I am working on this and will improve/fix a few more. |
|
I'm totally ok with merging and iterating 👍 |
|
I noticed the agent trips often on random WP CLI commands and things like that. Also for some reason (tried liberating this randomly found wix site https://www.studio-chocolate.co.uk) the result has nothing to do with the site (I picked block based recreation). Even the colors are different. I'll try again with "custom HTML option" |
Then, review please the approach (code) and assert that it works. |
…-skills-to-import-content
|
I am also testing this website - https://www.studio-chocolate.co.uk/ |
|
Ok I tried the site again, this time I picked "custom css, theme fidelity" option and the result is very close to the original site, it's night and day compared to the other option. |
I also get this at the end, right after the summary message. It might not be specific to the data liberation though. |
The "blocks" reconstruction underperforms even in the standalone data-liberation-agent (without Studio Code as a proxy). It's the blocks path itself, which I've reproduced locally (example in the PR description). But I see ways to improve it. |
|
|
||
| ## Step 3 — Follow the engine's real liberate skill | ||
|
|
||
| `Read` the `liberateSkill` path from Step 1 (the engine's own `SKILL.md`) and execute its workflow verbatim, applying these Studio bindings wherever it instructs you: |
There was a problem hiding this comment.
This is a very weird way to use the data_liberation. If the data liberation packages bundles skills, can't we actually "import" them directly where we define the skills of Studio Code instead of having a "wrapper" skill?
youknowriad
left a comment
There was a problem hiding this comment.
I think it's ok to ship this PR as is but I'd love to know if there's better ways to actually embed the data liberation engine into studio Code, importing tools and skills directly instead of having "wrappers".
Like ideally, there skills and tools are no different than any other first party Studio Code tools and skills.
|
@youknowriad - I still think the right solution for this is to support AI plugins in Studio Code. No that we are on pi.dev, maybe implementing something like including https://pi.dev/packages/pi-claude-marketplace in order to consume the data-liberation stuff as a plugin - then we shouldn't need a wrapper of any sort (though I haven't tested this) |
|
What kind of plugins do we expect to have outside data liberation and taxonomist? |
@youknowriad, the single-wrapper approach here (
So I see two real options: the wrapper approach in this PR, or something like Matthew's plugin-system idea (AFAIU). A plugin system is the cleaner long-term answer if we expect several such embedded engines — but for a 1 (or maybe 2, also taxonomist ) engine today it feels like overkill. My proposal: ship the wrapper now, and revisit the plugin approach later if a second use case makes it worth the investment. One more thing worth noting: the integration in this PR is thin — it's a small amount of glue code, and it requires almost no changes to the data-liberation-agent's own codebase. We consume it close to as-is, which means upstream updates flow in with minimal friction and we keep a clean seam between the two projects. Merging the tools/skills directly would break that seam: we'd have to reshape the engine's internals to fit Studio Code's conventions, which makes both codebases harder to maintain — the engine included. |
6c78547 to
9bcba95
Compare
9bcba95 to
fa6d85f
Compare
@youknowriad - the site-builder library/plugin we're working on (extracting Telex site builder logic into something reusable). Re: @nightnei -
Definitely meaningless outside the concept of liberation/migration. But definitely meaningful calling them individually if the user stops the liberation process partway and wants to resume. Or wants to retry certain steps. Most of those pieces are resumable and a handful of them are callable as single items in isolation to redo portions of the flow. Re-calling portions to pick up from the middle saves a lot of time and tokens than always starting from the beginning from my experience! |
|
Sounds good to me but I think it's not a clear cut to be honest. For instance, we now have two "scaffold theme" skills, one within the data liberation and one outside and they probably duplicate some stuff, and do some other stuff differently. How can we avoid this |
Yeah, great point 👍 It should be documentet somehow, to understand the UX and work flows. But maybe it's already documentet inside the data-liberation-agent, I haven't read all *.md files 😅 @youknowriad @borkweb I have the next proposition/plan:
My goal is not to block "Studio Code: Power Tools" linear project (studio-code-power-tools-45e9dd76a8ba) and move forward with WDYT? |
youknowriad
left a comment
There was a problem hiding this comment.
Personally, I'm not convinced by the plugin approach, I think a first-party import approach would result in a better product. But this shouldn't stop neither this PR from landing nor explorations of these approaches.



Related issues
How AI was used in this PR
The solution is completely mine and is written partially manually.
AI helped with writing code.
Proposed Changes
We are adding
/liberatecommand for Studio Code. Which, under the hood, uses https://github.com/Automattic/data-liberation-agentIt allows the creation of websites based on closed platforms. See example below.
Note: I have created dozens of sites, and I have occasionally encountered imperfect results with broken pages, but those cases were rare. Keep in mind that if the result doesn’t look right, it may be worth trying again. For example, in the screenshot below, the page generated through
Block → data-liberation-agent → /liberate → Home pagedoesn’t look as polished as the result generated with Studio Code.Also, it's not connected to the PR -
Theme replicationworks much better thanBlocks. JFYI.My Wix site - https://neicss.wixsite.com/sunflower-valley-exp
Theme replication
Blocks
Testing Instructions
node apps/cli/dist/cli/main.mjs code/liberate https://neicss.wixsite.com/sunflower-valley-expor you can use own site. I was testing with this my sunflower-valley-exp site.Migrate content into blocks~/Studio/_liberations/<your_site>/liberate https://neicss.wixsite.com/sunflower-valley-expagainTheme replication