Part 8 of 10
The Elements Tooling
Install VS Code and Elements, build a todos app by asking an AI agent, and deploy the app to DigitalOcean. Then tour the project environment, the elements command, the website and the business.
- 1. Introduction 0:18
- 2. Install VS Code 3:30
- 3. Install Elements 1:27
- 4. Create Your First App 5:26
- 5. Set Up a Deployment Environment on DigitalOcean 4:49
- 6. Deploy Your App 3:11
- 7. The Project Environment 2:32
- 8. The Elements Tooling 6:07
- 9. The Elements Website and Community 2:48
- 10. The Elements Business 1:27
In this video we look at the elements command in the terminal: the manual, creating a project, the build, packages, the database shell, tests, JSON output for agents, and the project server.
The agent in the chat runs all of these for you. You can also run them yourself. If the app server is running in the terminal, press q to stop it first. You stay in the project's directory.
1. elements -h and the manual
Terminalelements -h
This lists every command. The first is man, the manual. Use it to look up how to do a task:
Terminalelements man
The other commands include create, start, build, test, install, uninstall and db.
2. elements create
Besides the Command Palette in VS Code, you can create an app from the terminal with the project's name:
Terminalelements create myapp
3. elements build
Terminalelements build
elements build connects to the project server and answers right away. The project server keeps the build up to date as files change, so the command asks the server for the current state instead of building. On screen it reports a green Ok in about 19 microseconds.
When the build state changes, the screen updates with the errors right away. Press q to exit.
Several agents can run elements build in the same project at the same time, each connected to the same project server.
4. elements install
Terminalelements install mime
This installs a package, and the build updates with it.
5. elements db
Terminalelements db
This opens a shell on the app's database. Type \d to list the tables. A new app has only the tables Elements uses; your app's own tables appear here as you build, and you can query them directly. Every app's data is in one database, where you and your agents can run queries for your business. Type \q to exit.
6. elements test
Terminalelements test
The agent writes tests as it builds, and the tests catch regressions: a new feature breaking something that worked for months. Elements runs tests in several processes at once, and reruns only the tests a change affects, usually in a few milliseconds. Test results are part of elements build too, so an agent knows right away whether a change broke something.
7. JSON output for agents
Agents pass -json to get structured data back instead of reading a screen:
Terminalelements build -json
Any command that returns data takes -json, including elements test.
8. The project server and elements kill
The project server runs in the background, which is why elements start connects and starts so quickly. VS Code connects to the same project server, so one server serves every client and you save memory and CPU. It keeps running after the clients exit, and shuts down on its own after a while with no clients connected.
To stop it yourself:
Terminalelements kill
The next client that connects, or the next elements start, starts the project server again.
You don't need the terminal
If you are new to coding or to the terminal, the agent in the chat runs any of these commands for you. The commands are there when you want to work without chatting.
Add a comment