Bricks Panel and the Asset Store

The Bricks panel is where Studio shows and changes the bricks a project uses, and the bricks every Studio installation has. What a brick is, how the manifest declares one, and how to publish it are in Bricks. This page covers the panel itself.

Open it from the command palette with View: Bricks. It is a panel like the others, so it can be dragged, tabbed or floated as described in Dockable Panels.

Studio and Project

Bricks come in two scopes, and the Studio and Project chips at the right of the panel's header choose which one you see:

  • Studio bricks belong to the Studio installation. The panel says they are installed for every project.
  • Project bricks belong to the open project. They are listed in the project's Bricks/manifest.json and travel with it.

The panel follows the open project until you pick a scope yourself. With no project open, it shows the Studio's bricks. The chips are shown only when the Studio has bricks of its own. Enabling a brick from the other scope installs it where it belongs: the panel's details say Studio, for every project or The open project.

The list

The Bricks tab lists every brick the chosen scope can use, grouped as In use and Available. Use the controls above the list to narrow it:

  • The search box, Search bricks, matches a brick's id, name, author, description and keywords.
  • The filters are All, Installed, Available, Updates and Built-in.
  • The category menu, which starts at Everything, narrows to Looks, Themes, Icon Themes or Fonts.

Click a row to show the brick in the Inspector. The checkbox on the row stages turning the brick on or off.

Staging changes

Enabling, disabling and updating are staged: nothing changes until you press Apply in the bar that appears above the list. Apply makes every waiting change at once, so the project resolves its bricks and recompiles once, not once per brick. Discard drops every waiting change. The brick's own form offers the same choice for one brick, as Apply Change or Undo Change.

The brick's form

The Inspector shows the selected brick in sections:

  • Status, such as In use, Downloaded, not in use or Available, and Version, which adds the newer version when one exists.
  • Installs In, Pending and Also Disables, when they apply. Linked To appears when a link points the brick at a local folder.
  • Details: description, author, license, keywords, dependencies, Needed By, Origin and Installed At.
  • Versions, when the brick is offered in more than one version: Available to choose one with Use Selected Version, Form and Forms Published for the kinds of build the brick comes in, and Downloads, which lists the copies on this machine and their size. Remove N Old Downloads frees the copies nothing uses.

The buttons depend on the brick's state. An available brick offers Enable. An installed one also offers Uninstall. An enabled one offers Disable, Update and, in a project that supports forks, Make Local, which copies the brick into the project to change it. A brick the project has made local offers Revert To Global. An enabled baked twin from a registry offers Edit Source, which switches to the source form, and an embedded brick that allows twins offers Use Baked Twin.

Installing from the asset store

The built-in registry, the MASS4 asset store, is the one every Studio takes bricks from. Its bricks are in the Available group on the Bricks tab, and you install one by enabling it.

To install a brick by its id, press + in the toolbar and choose Add by name…, then type the id, such as org.mass4.turian.pooling. A brick the catalog already knows is enabled; any other is installed from the registries. Choose Add from git URL… for a git repository, or Add from folder… and Add from .brick file… for a brick on disk. The folder option takes a brick folder, and the file option takes a packed .brick file.

The Registries tab lists the registries bricks come from. The built-in one is read-only; + adds another, and Remove stops taking bricks from one of your own. Registries and their signing keys are described in Bricks.

Problems are shown as toasts with their first line. The rest of the message is in the Output panel; see Output Panel. While the Studio works on a change, the panel shows Working….

Pinned sources

Each brick comes from a source, and the lock file records exactly what was resolved. A project's lock file is Bricks/packages-lock.json, and it should be committed. It holds, for every brick, the exact version, the commit or content hash, and the source the brick came from.

  • A git source (git+<url>#<ref>) is resolved to a commit. The lock keeps that commit, so a later checkout gets the same code, until you run Update or Update all, which move the brick to its newest commit.
  • An archive (a .brick file) is checked against the hash recorded in the lock. A file that no longer matches fails to restore.
  • A registry brick is recorded with its version, its file hash, the registry it came from and the key that signed it.
  • A folder source (file:<folder>) is used in place and is never copied to the store.

Update all moves every brick to the newest version its source allows. Restore fetches the bricks the project declares. The … menu holds these commands, along with Refresh registries, Bricks settings and Clean up downloads…. Clean-up keeps the newest version of each brick and every version the project or the Studio uses. Another project that pinned a removed version downloads it again.

On the command line the same work is done by turian-cli brick restore --locked in CI, which fails rather than change the lock; see Bricks.

Restart notices

Project bricks are loaded into the project, and changing them recompiles it. Studio's own bricks are different: their code is part of the running application. When a change to a Studio brick changes the Studio's library files, the panel shows Restart Studio to activate the changed plugin assemblies, menus and panels. Restart Studio to use the new code.

Command-line plugins from bricks

A brick can add commands to turian-cli. Its editor assembly implements ICliPlugin from MASS4.Turian.Cli.Sdk (namespace Turian.Cli.Sdk), and the plugin uses System.CommandLine to describe its commands:

using System.CommandLine;
using Turian.Cli.Sdk;

namespace Acme.Tools;

public sealed class HelloCliPlugin : ICliPlugin
{
    public IEnumerable<CliCommand> CreateCommands(CliPluginContext context)
    {
        var hello = new Command("hello", "Says hello from an installed brick.");
        hello.SetAction(result =>
        {
            Console.WriteLine($"Hello from {context.BrickRoot}");
            return 0;
        });
        yield return new CliCommand(hello);
    }
}

The rules are these:

  • A provider has a public parameterless constructor, and creating its commands must not change the workspace.
  • CliCommand's ParentPath places a command under shared groups. An empty path adds a root command, and new CliCommand(command, "import") adds it under an import group that other plugins may also use.
  • Built-in commands, existing commands and aliases cannot be replaced. A provider whose registrations clash is rejected as a whole, and logged, without disabling other providers.
  • The plugin's commands appear in turian-cli --help only while its brick is installed and compiled.
  • The CLI finds bricks of the project it is run in, and of the Studio. Pass --cli-project <folder> to choose the project explicitly.

The Studio's own theme verify command is a built-in plugin of this kind.

Next steps


← All docs Edit this page