Hello everyone and welcome to the first article of a five part series discussing custom scripting with AcceleratXR. This article will focus on introducing you to the AcceleratXR Script Manager, an extension for Visual Studio Code making the management of scripts simple and powerful.

The Script Manager extension allows you to interact with an AcceleratXR cluster’s scripting system by implementing a Source Control Provider. The scm provider is able to communicate with your AXR backend cluster. With the manager you can automatically synchronize existing scripts to a local workspace, modify and commit changes, then publish those changes when you’re ready to make them live. Scripts can also be deleted and recovered so that you never lose precious work.

In AcceleratXR scripts can be created from two different places. The first script source is called disk. These are scripts that have been bundled with the service code itself. They can never be permanently deleted but they can be unpublished and/or modified. The second source of scripts are user scripts. These are scripts that you create with the Script Manager or AcceleratXR console tools. These scripts are only visible to the service that they were created with and only exist in the cluster database.

Let’s get started. Open up Visual Studio Code to the extensions panel. Type in acceleratxr into the search box. You’ll immediately see an entry for the AcceleratXR Script Manager. Click on it and hit Install.

Next you’ll want to create a workspace to synchronize the scripts to. Click on File -> Save workspace As... and choose a suitable location. Now you can synchronize the scripts from your AXR cluster using the axr.checkout command using the command menu (Ctrl+Shift+P).

You will be prompted for the cluster address. This is the base url of your AXR cluster that the dashboard and clients use to connect to the service (e.g. https://api.demo.goaxr.cloud/v1). Once entered you’ll be prompted for the username of a user account to login with. The user must have the admin role in order to manage scripts. Finally enter the account password. The extension will automatically save this configuration into the settings.json file of the workspace. You can optionally have the extension remember your password so that you don’t get prompted each time you open the workspace. However note that the password is stored in plaintext.

The final prompt you’ll see is to install the script dependencies. This will install all NodeJS dependencies that the system needs in order to ensure you have the optimal scripting environment. While this is optional, it is highly recommended.

Once synchronized you’ll notice several new files have been added to your local workspace folder.

Let’s modify a script. Open the DependenciesRoute.ts file from the routes folder and make some edit. You’ll notice that the Source Control icon now shows one (1) pending change.  If you click on the scm icon you can now see three (3) separate categories in the SCM panel; Changes, Unpublished, and Deleted.

The Changes category lists all locally modified script changes. If you click on a given script the editor will show you a diff from what exists on the remote server.