assemblyline.sh

al-control

al-control is the control room CLI: it shows what is in every bin, why workpieces failed, and starts and stops factory sessions, on this machine or on hosts you reach over SSH. It doesn't run stations. Install it with npm install -g @assemblyline/al-control (Node.js 18 or later, macOS or Linux). The same views, in a desktop app: Watch lines in Control Room.

al-control <resource> <action> [options]
Global optionWhat it does
--host <name>Target this host for one command, instead of the current host
-h, --helpShow help; works after any command
-v, --versionShow the version

Where its lines come from

al-control reads a factory's lines and stations from .factory/factory.json in the factory's folder. The factory session writes that file when it starts (startBinWatcher()), from the definitions on the Orchestrator. So:

  • A factory shows no lines until its session has started once. Until then lines status prints No lines for factory-acme: .factory/factory.json is written when the factory session starts.
  • It shows the definitions as of the session's last start. After changing a line or station on the Orchestrator, restart the session to see the change.

The bins and workpieces it reads straight from disk, in .factory/stations/.

Choosing the factory

Commands about one factory take -f, --factory:

-fMeans
a name, such as factory-acmeA factory in the config, on the current host (or --host)
a path, such as ., .., ~/factories/factory-acme or anything with a /That folder. Needs no config. With --host, a path on that host.

The current folder is used only when you pass -f ..

Config

~/.al/al-control/config.yml; AL_CONTROL_CONFIG_DIR moves the folder.

current_host: local
hosts:
  local:
    factories:
      factory-acme: ~/factories/factory-acme
  build-box:
    ssh: build-box                  # an alias from ~/.ssh/config
    node: /home/me/.nvm/versions/node/v22.21.0/bin/node   # when node and pm2 come from nvm
    factories:
      factory-acme:
        path: ~/factories/factory-acme
        keep: [IN5/output, IN5/done]    # bins workpieces clear never touches
  • local is this machine. Any other host is reached with your own ssh, which needs key-based login. Nothing is installed on it: al-control pipes a read-only script to its node, and runs its pm2.
  • Factory paths are paths on that host; ~ expands there.

Hosts and factories

CommandWhat it doesOptions
hosts listList the configured hosts--json
hosts use <name>Set the current host
hosts currentPrint the current host
factories listThe factories configured on the current host, and whether each is running--json
config showConfig path, current host, hosts and factories
completionPrint a shell completion script: al-control completion >> ~/.zshrc

Lines and stations

Each needs -f.

CommandWhat it doesOptions
lines listLines and their stations--json
lines show <line>A line's stations in dependency order, and its conveyors--json
lines status [line]Live bin counts; with no line, a summary per line--json, --watch, --interval <seconds> (default 1)
stations status <id>One station's bins and the workpieces in them; <id> is its short code--json, --watch, --interval <seconds> (default 1)

--watch redraws on an interval and can't be combined with --json.

Workpieces

<id> is a workpiece id, or a substring of one. --bin takes STATION/BIN, such as IN3/failed.

Command-fWhat it doesOptions
workpieces listyesWorkpieces on disk: position, last event, folder--line, --bin, --match <substring>, --json
workpieces show <id>yesOne workpiece and its journey; a substring that matches several shows the list--json
workpieces watch [id]yesLive tail of bin moves and new log events--line, --bin, --match, --interval <seconds> (default 2)
workpieces count [bin]optionalfailed, done and finished counts; [bin] shows only that one--by factory, line or station (default station), --json
workpieces errorsoptionalFailed workpieces grouped by error, most common first--line, --station, --json
workpieces cat <id> <file>yesPrint one file from a workpiece's folder, such as error.json; safe for binary files when redirected
workpieces open <id>yesOpen the workpiece's folder: in Finder locally (xdg-open on Linux), a shell in it on a remote host
workpieces clear [id]yesDelete done workpieces or finished ones, or one workpiece's done and finished copies. A dry run unless --yes.--bin done (every done bin) or --bin finished (each line's last output), --line, --station, --older-than <days> (no activity for that long), --yes
workpieces requeue [id]yesMove every workpiece in a failed bin, or one failed or done workpiece, back to its station's input/. A dry run unless --yes.--bin STATION/failed, --yes

count and errors cover every factory on the host unless given -f. clear skips the bins in a factory's keep list and bins a conveyor takes from.

How to use them on failures: Find out why a workpiece failed, and retry it.

Processes

Factory sessions run under pm2 on their host.

Command-fWhat it does
procs listEvery running factory on the host (--json)
procs startyesStart a factory under pm2
procs stopyesStop a factory pm2 runs
procs restartyesRestart a factory pm2 runs
procs logsyesTail a factory's pm2 logs; Ctrl-C stops
procs monitpm2's interactive CPU and memory monitor on the host