Use your machines in every project
When you use the same workflow in many projects, such as a review that you do on every pull request, put its machine in your user config. smllm combines the user config with the config of each project, so every session on your computer can enter the machine, and a project needs no copy of it.
Steps
-
Create the user config:
$ smllm init --user created ~/.config/smllm/config.tomlThe user config is
~/.config/smllm/config.tomlon Linux and macOS, and%APPDATA%\smllm\config.tomlon Windows. smllm prints the full path, and this guide shortens your home folder to~. The following steps use the path of Linux and macOS. -
Write a template machine beside the user config, and list it there:
$ smllm new review --write --config ~/.config/smllm/config.toml created ~/.config/smllm/review.smllm.yaml and listed it in ~/.config/smllm/config.toml--configmakessmllm newwritereview.smllm.yamlbeside that config,~/.config/smllm/review.smllm.yaml, and list it in the config’s[machines]table. Replace the template with your machine, as in Your first state machine. This guide uses a short review machine:~/.config/smllm/review.smllm.yamlid: review initial: READ meta: smllm: 1 states: READ: on: read: COMMENT COMMENT: on: commented: DONE DONE: type: finalThe command lists the machine in the user config:
~/.config/smllm/config.toml[machines] files = ["review.smllm.yaml"] -
Check the machine from any project:
$ smllm validate 0 errors, 0 warnings, 0 info $ smllm graph review review (initial READ) READ read → COMMENT COMMENT commented → DONE DONE [final]Both commands read the user config as well as the project’s, and so does every session. A folder without a config of its own runs the machines of the user config alone.
-
To change the machine for one project, define a machine with the same ID in the project’s config. Create the project’s config and a template machine
review:$ smllm init created .smllm/config.toml $ smllm new review --write created .smllm/review.smllm.yaml and listed it in .smllm/config.tomlReplace the template with the project’s machine. This one adds a step that runs the tests:
.smllm/review.smllm.yamlid: review initial: READ meta: smllm: 1 states: READ: on: read: TEST TEST: on: passed: COMMENT COMMENT: on: commented: DONE DONE: type: finalThe project’s machine replaces the user’s, and
smllm validate --inforeports which one it replaces:$ smllm validate --info .smllm/review.smllm.yaml: info: machine review here replaces the one in ~/.config/smllm/review.smllm.yaml (FMT-7) 0 errors, 0 warnings, 1 info
Troubleshooting
- An instance of a user machine shows in
smllm instance listof every project: smllm keeps the instances of each config beside that config, in itsstatefolder, so the instances of a user machine are in~/.config/smllm/state/. To keep them elsewhere, setdirin the[state]table of the user config, relative to the config file. - A machine of the user config doesn’t appear: the project defines a machine with the same ID, which replaces it. Run
smllm validate --infoto see the replacement.