Creating a project
In AEL, the Agent Engineering Language, one command creates a ready-to-build project: ael init.
Usage
ael init <name>
ael init <name> --template <template>
| Argument or option | Meaning |
|---|---|
<name> | The project's name. It becomes the name of the new folder and is recorded in metadata.ael. |
--template <template> | Start from a template instead of the minimal project. |
--json | A machine-readable report of what was created. |
What it creates
ael init support creates a folder named support in the current folder, holding the three files every project has at its root:
support/
main.ael # main support(): the program's entry point
pack.ael # the packages the project uses; empty
metadata.ael # the project's name and settings
main.aeldeclares amainthat carries the name you gave and does nothing, so the new project checks, builds and runs as it is:
# main.ael
main support() {
return;
}
pack.aeldeclares no packages. It stays in the project even while it is empty:
pack { schema = 1; dependencies = []; }
metadata.aelrecords the name you gave, which namesmainand the program thatael buildwrites:
metadata {
schema = 1;
name = "support";
}
The new project is a console program. It opens no network port and adds no server; you add the HTTP package and declare routes only when you want it to serve an API, as Services and APIs shows. A new project has no pack.lock and no .package folder: they appear beside pack.ael when you add the first package with ael pack add.
Every other folder and file is your choice. Project layout shows a larger project.
Names
A project name is an AEL identifier:
- letters, digits and
_, not starting with a digit; - at most 64 characters;
- not a keyword, not
_on its own and not the reserved nameprint; - not
main: the name followsmaininmain.ael, andael init mainis refused, asmain main()is.
Names are case-sensitive, but ael init refuses a folder name that differs only in letter case from one already beside it, and names that some operating systems reserve for devices, so the new folder means the same thing on every operating system.
It never overwrites
- If a file or folder with the project's name already exists,
ael initstops and changes nothing. - The files are prepared beside the new folder, and the folder appears only when all three are complete. You never find a project with one of its root files missing.
- If it is interrupted, it reports anything it left behind, so you can remove it.
A project for a package
The same project layout serves a package. To build one with ael package, the name in metadata.ael has to be a package name, such as acme/billing: lower case and slash-separated. The package's main then takes the last segment of that name, as in main billing(). Building a package describes the rules.
Next
- Checking source: check the new project.
- A first program: a walk-through from
ael initto a running program. - Files and roles: the file names and roles of a project.