mty new¶
Scaffold a new Mighty package.
Synopsis¶
Arguments¶
| Name | Description |
|---|---|
NAME |
Package name. A directory of this name is created in the current working directory. |
--template <TEMPLATE> |
Template name. Default blank. Built-in templates: blank, web-game. |
Templates¶
| Name | Files | When to use |
|---|---|---|
blank (default) |
mighty.toml + src/main.mty (one-line log body) |
Library or CLI starting point. |
web-game |
adds web/index.html + web/dom-shim.js + a canvas-driven GameInput agent + a README.md |
Browser-hosted game scaffold ready for mty serve. See mty serve. |
What blank produces¶
mighty.toml:
src/main.mty:
What web-game produces¶
<NAME>/
├── README.md # how to drive the dev loop
├── mighty.toml
├── src/
│ └── main.mty # GameInput protocol + agent + export fn keystrokes
└── web/
├── index.html # canvas + log panel + reload-ws bootstrap
└── dom-shim.js # wasm loader + canvas mirror + reload-ws client
The agent in src/main.mty uses the v0.22 log("evt:...") pattern
the v0.24 canvas WIT binding will eventually replace; see the NOTE
comment near the top of the generated file and
crates/mty-codegen-wasm/wit/mty-web/canvas.wit.
Behavior¶
- Refuses to overwrite an existing directory of the same name.
- Creates the package directory and its
srcsubdirectory. - Writes every file the chosen template ships, substituting
{{NAME}}with the package name.
Exit codes¶
| Code | Meaning |
|---|---|
0 |
package created |
1 |
directory already exists, or I/O error writing the scaffold |
2 |
unknown --template value |