Script To Help You With Start Devcontainers

Hey all. I’ve seen a fair bit of trouble from folks trying to programmatically start dev-containers within Cursor (as it works slightly different from VsCode). By programatic I mean not using the command pallete. I analyzed the Cursor source code for the command they use to launch it to get the exact arguments needed and created this gist with a script for Typescript/Deno and Javascript/Node that does the trick.

GIST: https://gist.github.com/zackiles/c4734c1d18eadee34337545bee392d20

HOW IT WORKS:

  • Can call it with no arguments if ran from the project root (where your .devcontainer folder is)
  • Can specify a few optional flags if you wish. By default it’ll launch your dev container and close the other current instances of Cursor you have open for the workspace.
  • Put it in your [tasks/package-scripts/deno-tasks] whatever, and call it when you need it
  • Should work cross platform, but haven’t had a chance to test on windows. Works good on Mac + Linux

NOTE: I wrote and use the Deno version, the Node version hasn’t been tested I just quickly used Claude to convert it from the Deno one before sharing.