ALITSoftware Architect Get the extension

Extension tutorial

This tutorial walks through every part of Aliot Software Architect with one model: the window-lifter ECU of a car door. The door switch panel sends commands over LIN, the ECU drives the window motor, tracks the glass with a Hall sensor and reverses the motor when the current shows a trapped hand. You open the model, look at it in all seven views, change it from the diagrams, run its use cases and tests, simulate its schedule, fix a diagnostic, rename an element, export diagrams and call the command-line tools.

The current release on the Marketplace and Open VSX is 0.20.1, which bundles the swa.ml 3.2 language (language release 0.3.3). The screenshots were taken with a build of the next release, so a few behaviours are marked as coming in the next release: Add standing right after the view tabs, and "+ Kind" buttons on empty diagrams instead of extra "+" buttons on the toolbar. To learn the language itself, follow the swa.ml language tutorial, which builds the same model step by step.

Aliot Software Architect in VS Code: the window-lifter model on the left and its General View on the right

1. Install and open the model

  1. In VS Code, open the Extensions view, search for Aliot Software Architecture by voidaliot and install it, or use the Marketplace page. The extension works in desktop VS Code 1.104 or newer and in browser VS Code; the command-line tools need desktop VS Code and Node.js.
  2. Get the model. The window-lifter example is an MIT-licensed example in the swa.ml repository. Download the same files as window-lifter.zip, unzip it and open the window-lifter folder with File > Open Folder.
  3. Open window-lifter.swaml. The editor colours the swa.ml keywords, and the swa.ml status bar item shows the language server state and versions; swa.ml: Language Server Status shows the same details with Restart, the server output and Copy details for a bug report.
  4. Click the circular swa.ml diagram icon in the editor title bar, or run swa.ml: Show Diagram. The diagram opens beside the text. Right-click the file in the Explorer or its editor tab and choose Show swa.ml Diagrams to open the diagrams of the whole file.

The folder also holds steps/, seven files that build the model one topic at a time. They all declare the same package, so the archive's .swamlignore leaves steps/ out of the project: the project uses window-lifter.swaml, and a step file you open is checked on its own. The folder in the swa.ml repository has the same .swamlignore. Without a new model of your own at hand, swa.ml: New Model asks for a package name and a file, writes an empty package and opens it in General View. swa.ml: Browse Official Examples opens the public language examples, and swa.ml: Open Offline Help opens the editor, CLI, AI tools and language guides inside VS Code. The Get Started walkthrough "Model software architecture with swa.ml" covers the first two steps.

2. Find your way around the diagram

The diagram has one toolbar for every view. From left to right it holds:

On a narrow editor the toolbar gives up captions first, then labels and whole option groups, into one More menu; nothing is reachable only by scrolling, down to a 320 px pane.

The diagram always shows a root. Selecting something, in the canvas, the Model browser or Properties, or switching views never changes it. Only a deliberate navigation does: the diagram icon of a Model browser row, Open in on an element's menu, a pick in the path bar, Go to parent, the tiles of an overview and Back. Switching from GV to IV therefore keeps the package or component you were looking at.

The Model browser

Click Model to open the Model browser (Browser View), the model tree of the current root. Its header names it "Model" with the element count and offers Go to parent, Expand all, Collapse all and Show current diagram elements only. Each row reads name : Type, such as controller : Controller, and shows its child count while collapsed. On hover a row offers Show diagrams and an eye that hides the element in the current view; elements the current diagram does not draw are dimmed, and hidden ones are struck through. Double-click a row or press F2 to rename it in place, and right-click it for the same element menu as on the canvas. Hiding is saved with the diagram, never in the model.

The Model browser beside the diagram, listing the window-lifter elements as name and type

A large model stays navigable the same way: Interconnect, Flow and Sequence View open a package on an overview with one tile and thumbnail per diagram, the Model browser filters with the search field, and Depth decides how far components open. The picture shows the Interconnect overview of the AUTOSAR Classic door controller, a showcase model of about 4,000 lines in the swa.ml repository.

The Interconnect overview of the door-controller showcase model: one tile with a thumbnail per wiring diagram

Properties and the element menu

Select an element and click the Properties toggle at the right end of the toolbar. Properties shows the element's own fields, its members in source order and what describes it from outside, such as the requirements a definition satisfies. Fields with suggestions open their list on a click, Ctrl+Space or Arrow Down. Its + lists the member kinds the element can hold and opens the same creation card as Add. Properties and the Model browser start closed and remember whether they are open per view kind; opening them writes nothing to the model.

Properties of the selected Controller, with its ports, attribute and operations

Every element has one menu, the same on the canvas, in the Model browser and in the Properties header. It lists what the current view does with the element first (Add, Create relationship, presentation), then Show diagrams, Go to definition, Rename, the note and Delete. The menu works with the keyboard: the arrow keys move and Esc closes it.

3. Create and edit from the diagrams

Every view creates elements the same way:

Each opens the creation card. The card asks only for what the diagram does not already establish, with the key reference first (Type for components, ports and attributes; Subject for cases; Requirement for satisfy and verify). A kind that needs only a name opens as one typed line, and some kinds take a whole typed line such as level: int = 0 or read(x: int): int. Reference fields suggest names from the model: typing ecu. lists the members of ecu. Once the required fields are filled, the card's footer says what Apply also adds, such as "Also adds port def Flow.", from a dry run of the same edit, or why Apply would be refused.

The Add menu of the window-lifter diagram and the creation card with its footer

Every graphical edit is validated as a complete workspace before it changes your file. An edit is refused only for an error it would add; errors elsewhere in the workspace do not block editing. A refused edit says why in the diagram's message line, in plain words, and offers the fix as a button where one exists, for example the next free name for a duplicate, or making a port optional when nothing connects it. Undo, Redo and Save are VS Code's own, for text and diagram changes alike.

Layouts (positions, Depth, Show choices, hidden elements) are saved beside the model in .vscode/swaml/diagrams/<file>.swaml.json and never change the model. Looking at a diagram writes nothing.

4. General View: the structure at a glance

General View (GV) shows definitions, occurrences, requirements and how they relate. Open the package WindowLifter as the root to see the enums, the nine port definitions, the component definitions from InputHandler to BodyController, the occurrences driver, passenger, ecu, window and body, and the three requirements.

The picture below shows the view rooted at ecu's definition, WindowLifterEcu: its ports and parts with the ECU's documentation note.

General View of WindowLifterEcu: its five ports and five parts as cards beside the ECU's documentation note

5. Interconnect View: ports and wiring

Interconnect View (IV) shows typed ports and connections. A package opens on an overview with one tile and thumbnail per diagram; click the WindowLifterEcu tile, or root the view at ecu, to see the five parts of WindowLifterEcu wired to its LIN, motor, sensor and CAN ports. The package's own tile, WindowLifter, shows the top-level occurrences and the connections lin, motor, sensor, shunt and can.

Interconnect View of the ECU: input handler, tracker, anti-pinch, controller and motor driver connected through typed ports

6. Flow View: operations and state machines

Flow View (FV) follows an operation, use case or test step by step. A package or component opens on an overview with one tile per operation, state machine, use case and test. Open ecu.controller.control to see the controller's state machine: idle, closing, opening, autoClosing, autoOpening and reversing, each with its on entry region and its leaving lines.

Flow View of the controller's state machine: idle, closing, opening, autoClosing and autoOpening with their guarded transitions, such as request.command == Command.up and position.counts > 0 from idle to closing; reversing continues below

7. Sequence View: messages of a use case or test

Sequence View (SV) follows the messages of a use case or test across components. A package opens on an overview with one tile per case, showing its participants, message count and last result. Open Close with one touch: the driver publishes pressed(autoUp) to the ECU, the messages travel through the input handler and controller, and the body controller receives windowStatus.

Sequence View of the use case Close with one touch, from the switch panel through the ECU to the body controller

8. Case View: use cases, tests, actors and requirements

Case View (CV) draws use cases and tests inside their subject's frame, actors joined by short trunks and requirement links bundled on the right. Rooted at WindowLifter, it shows the two use cases and three tests of ecu inside its frame, the actors driver, body and passenger on the left, and the three requirements on the right with the verify links of the tests. The satisfy claims of this model name the definitions AntiPinch and Controller; they appear in Grid View's Satisfied by column.

Case View: the ECU's use cases and tests inside its frame, with actors on the left and requirements on the right

9. Timing View: schedules, deadlines and simulation

Timing View (TV) shows when each operation runs, on the language's own run of the schedule: one row per schedule entry, with the deadline and a band per state. Root it at ecu.controller.control, or at ecu for every part of the ECU.

Timing View of the window lifter: periodic rows at 10 ms and 100 ms with deadlines

swa.ml: Run Reference Simulation runs a package or one Package::component for a duration you choose, such as 100ms, shows the result as JSON and opens Timing View on the target. A simulation is evidence of one bounded, deterministic run, not a real-time guarantee.

Timing View with a simulation of the window lifter: activation bars and deadline flags

10. Grid View: tables you can edit

Grid View (GRV) shows one kind of element at a time as a table. The icons on the toolbar choose the table: packages, items, ports, connections, components, operations, states, requirements, use cases, tests, views and others. The requirements table shows each requirement's typed attributes as columns, such as reactionMs and currentLimitMa, with Satisfied by and Verified by; the tests table shows Subject, Participants and Verifies.

Grid View of the window-lifter requirements with their attributes, Satisfied by and Verified by

Edit a cell in place; an edit to several selected rows is validated as one batch. Columns sort and filter, and each table keeps its own column order, widths, filters and selection. Add follows the shown table: in Requirements it adds a requirement. Export CSV writes the shown table with its columns, filters and selection.

11. Run use cases and tests

The model has two use cases and three tests. Each runs in a fresh, deterministic, bounded run of its package and reports pass, fail at the failing statement, inconclusive (the time or step limit came first) or no checks (a case without statements).

Run them from any of these places:

The pill beside Run counts the results: passed, failed, without a verdict and stale (from an older source revision). It opens the same menu, whose Results section lists each result with Clear. After a run, the diagrams show the evidence of that one run: Sequence View puts values and times on the arrows and assert results on their markers, Flow View shows the executed path, per-statement counts and states taken, Interconnect shows the routes used with message counts, and Timing View shows the activations of the last single case run. Results become stale when the model changes. swa.ml: Clear Run Results removes them, and swa.ml: Inspect Test shows a test's checks and last result without running it.

The use case Close with one touch after Run: result pill ✓ 1, a gutter pass mark, '1 passed' in the status bar and the executed Sequence View with times and the checked assert

Results of all five window-lifter cases in the Testing view, the source gutter and the status bar, beside Case View

All five window-lifter cases pass. A passed test is evidence of one run, not a proof that the requirement holds.

12. Problems and diagnostics

The language server checks the model as you type: syntax, names, types, ports, schedules and cases. Diagnostics carry a stable code such as SW2001, appear in the editor and the Problems panel, and many offer quick fixes. Hover a keyword for a one-sentence explanation and a short example, with Open in the reference to its section of the keyword help.

A diagnostic in the window-lifter source and the Problems panel

Try it: in AntiPinch, change the schedule entry on every 10ms check() deadline 1ms; to deadline 20ms. The entry is underlined with error SW2007, "Periodic deadline cannot exceed its period.", and the Problems panel lists it with its file and line. Undo restores the model. (In Timing View, dragging the deadline flag stops at the period and its tip says why, so the diagram cannot make this mistake.)

One diagnostic is worth knowing about before you copy models around. When two files of a project declare the same package, each copy reports SW2001 once, says which copy the project uses and offers Leave out of this project, which adds the other copy's folder to .swamlignore. That is why the example's steps are left out.

More tools:

13. Rename and refactor

Press F2 on a name in the text, on the canvas or in the Model browser, or choose Rename from the element menu. The rename is validated as a complete workspace and updates every reference: declarations, enum literals, ports, schedule entries, connections, cases, satisfy and verify links and views. The element keeps its places on the saved diagrams. A name that is already taken is refused with the next free name as a fix. Double-click a name on the canvas to edit it in place; Escape cancels without changing the source.

Renaming an element in place on the diagram

The text editor also offers completion of names and paths, signature help, references, go to definition, formatting (swaml.format.*), inlay hints, auto-imports on save (swaml.editor.autoImportOnSave) and inline suggestions. swa.ml: Migrate 2.2 State Machines to 3.0 rewrites older state machines as states in the flow as one validated edit.

14. Export diagrams and tables

Click Export on the toolbar. In the six drawing views it offers Diagram as SVG, the drawing as you see it, without the toolbar; Grid offers Table as CSV. A save dialog asks where to write the file. swa.ml: Export Model Projection JSON writes the model's projection as JSON.

The Export menu of a diagram with Diagram as SVG

15. Validate and export from the command line

The extension ships two self-contained Node.js tools. In desktop VS Code, run swa.ml: Copy Headless CLI Command and choose validation or export; it copies the command with the installed path. The same tools are published on npm as @voidaliot/swaml-cli with the commands swaml-validate and swaml-diagram. In the examples, <extension-folder> is the installed extension's folder.

node "<extension-folder>/out/cli.mjs" --version
node "<extension-folder>/out/validate.mjs" window-lifter.swaml
node "<extension-folder>/out/validate.mjs" . --format sarif > validation.sarif
node "<extension-folder>/out/cli.mjs" export --file window-lifter.swaml --view iv --anchor "WindowLifter::ecu" --out ecu.svg
node "<extension-folder>/out/cli.mjs" export --file window-lifter.swaml --view fv --anchor "WindowLifter::Controller::control" --out control.svg
node "<extension-folder>/out/cli.mjs" export --file window-lifter.swaml --view grv --out requirements.csv
node "<extension-folder>/out/cli.mjs" export --file window-lifter.swaml --all --out-dir export

The version line names the installed extension and language swa.ml 3.2 (language release 0.3.3), and validation prints Validated 1 swa.ml file(s), swa.ml 3.2 (language release 0.3.3). Export draws what the diagram file says, as the editor does. Flow and Sequence View of a package are overviews, so --all skips them and names the anchors to export one with --anchor. Validation supports text, JSON, SARIF and GitHub annotations; see Command-line tools for every option.

The extension's tools validate and export; they do not run cases. To run the use cases and tests outside VS Code, use the swaml test command of the swa.ml language, which prints one line per case and a summary and exits 1 when a case fails:

pass         WindowLifter::Close with one touch
pass         WindowLifter::Close manually
pass         WindowLifter::Auto-up closes fully
pass         WindowLifter::Pinch reverses within 100 ms
pass         WindowLifter::Manual closing stops on release
5 case(s): 5 pass, 0 fail, 0 inconclusive, 0 no checks.

The VS Code integrated terminal validating and exporting the window-lifter model

16. Work with an AI agent

The extension registers nine tools through VS Code's language-model API: eight read-only tools and swaml_run_tests, which runs use cases and tests. A compatible VS Code chat agent can use them; the extension supplies no model, account or subscription, and it is not an MCP server.

Reference What it does
#swamlGuidance The pinned language rules and evidence boundaries, to read before writing a model.
#swamlContext The source or selection with its diagnostics and real symbols.
#swamlValidate Validates proposed swa.ml text against the complete workspace without changing it.
#swamlSearch Finds real declarations in the workspace and libraries.
#swamlResolve Resolves a name or source position to its declaration or occurrence path.
#swamlTrace A requirement's text, attributes, satisfy and verify links and the last result of its tests.
#swamlDiagnostic Explains a diagnostic code.
#swamlRunTests Runs one case, a package or every case and returns each result.
#swamlTestResults Reads the last recorded results without running anything.

With window-lifter.swaml open, you could ask: Use #swamlTrace to show which tests verify 'Anti-pinch reversal', then #swamlRunTests to run them. Review every suggested change before applying it. AI authoring tools describes each tool's inputs and results.

The language-model tools the extension registers, listed on its Features page in the VS Code Extensions view

17. Settings

Open the Settings editor and search for swaml. The most useful settings:

Setting Default Effect
swaml.preview.diagrams.defaultKind gv The view a diagram opens in.
swaml.preview.diagrams.update live Refresh diagrams live, on save or manually.
swaml.preview.diagrams.lineStyle straight Straight, orthogonal or curved lines; also remembered per view.
swaml.preview.diagrams.showPortLabels true Port names beside port glyphs.
swaml.preview.diagrams.showMultiplicities false Declared multiplicities where they apply.
swaml.preview.diagrams.makeRoom on for IV, GV, FV Move nearby content aside when opening or resizing elements.
swaml.lint.profile default Advisory diagnostics: default, quiet or strict.
swaml.validation.severities {} Display severity per diagnostic code.
swaml.library.directories [] Extra source directories for explicit imports.
swaml.format.indentStyle, indentSize, blankLines, lineWidth follow the editor Formatting.
swaml.inlayHints.enabled true Resolved defaults and effective signatures in the text.
swaml.inlineCompletion.enabled true Grammar-valid inline suggestions.
swaml.editor.autoImportOnSave false Insert unambiguous imports on save.

swaml.languageVersion is 3.2, the only language version of this extension.

Where to go next