Idea summary
- An IDE plugin will authenticate with MW using OAuth and then post a bundle of modified files to a REST API.
- The preview form will then have a sandbox checkbox. When it is checked, the most recently posted sandbox bundle will be used, falling back to the deployed packages if a file is not in the bundle.
- The sandbox will eventually expire.
Discussion
Users want to be able to edit a file in a Produnto package and preview the result on Wikipedia, without having an MR be merged, and ideally without doing a git push.
From the loader (T412181) point of view, a sandbox is an overlay. It is a map of package/path to file contents to be used in preference to the cached file contents for that package.
A client-side script will post a bundle of files to MediaWiki, establishing a sandbox scoped to the authenticated MW user. On preview, we only need to show a boolean option asking the user whether they want to use a sandbox or not.
I considered having sandbox files represented as pages on the wiki in the user namespace, but this would be slow, complicated to implement, and is never going to be as nice to use as a proper IDE like VS Code Web.
GitLab has its own branded VS Code Web which allows users to easily edit files in the browser and submit MRs. It would be nice if we could extend it to add a button to deploy to a wiki sandbox.
@SD0001 suggested using the File System API, but note that Mozilla is intractably opposed to implementing showDirectoryPicker. VS Code Web uses this API to load files, and I think we could have a VS Code Web extension that posts modified files to MediaWiki. Also, if VS Code Web can do it, the desktop version of VS Code can probably do it too without too much extra effort.