so in a talk awhile back, I gave an example of a platform for running sandboxed CLI applications that could be a drop-in replacement for basic-cli, except that it prompts the user every time it would do some potentially risky I/O (e.g. filesystem reads/writes but not stdio operations)
it recently occurred to me that we could probably set up basic-cli codebase to build both the basic-cli platform and the sandboxed version, and use Rust compile-time feature detection to build one or the other, while sharing code between the two implementations!
that way we could pretty much guarantee that they would be drop-in replacements for each other, plus then we could actually ship this tool - which I think would be really nice, because it would mean people would finally have an actually safe way to run scripts downloaded from the Internet - at least, as safe as a browser where all risky operations are preceded by a confirmation prompt (and there's no way for the script author to get around the prompt)
on the Roc side, I think we could share...all of the code? :big_smile:
the only thing I could maybe see wanting to change might be the documentation, specifically noting in the sandboxed version which operations get prompts and which ones don't
but as a first pass, seems like it would be fine to just have all the .roc files be the same as today, and just swap out which host is used during the build/publish step
obviously that would make the overall basic-cli code base and build system some amount more complicated, but I think it would be worth it for the guarantee that one really is a drop-in replacement for the other
anyone have thoughts on that?
I've had a couple of attempts at getting basic-cli to build the prebuilt binary using cargo. I haven't succeeded due to my lack of rust skills.
My goal is to lay the groundwork for removing the platform rebuilding stuff out of the compiler. But that would also make this much easier to implement. I'm wondering if someone could help me navigate the rust build script to build the platform into an object ready for linking?
I think the sandboxed cli is a great idea, even if it just validates the idea and doesn't necessarily ship all of the functionality to start with.
Yeah, I think it should be a feature flag on a basic cli
That would also be a great example of what platforms are capable of, for those who just quickly check out roc concepts (not for the fans who watch all the roc talks) . That would show platforms are not your run-of-the-mill language frameworks and the this concept has sirious benefits. Having it be a drop-in replacement for basic-cli is the way to do it I think.
Last updated: Jun 16 2026 at 16:19 UTC