Developer Tools
Alongside compiling and running, here are some other useful commands.
Type checking
Use typecheck (or tc):
agency typecheck foo.agency
agency tc foo.agencyYou can give it
- a file
- a list of files
- input on stdin.
Directories are not supported yet.
Pass --strict to treat variables without types as errors.
You can also set options in agency.json.
References
Generating docs
Use agency doc:
agency doc lib -o docsGive it a source file or a directory, and it will generate markdown files as docs. You can then feed the markdown files into your favorite documentation generator, such as VitePress.
agency doc documents:
- types (if exported)
- functions (if exported)
- nodes
- effects
- effect sets (if exported)
For functions, agency doc uses their docstrings as descriptions. You can also add a /** ... */ doc comment above any of these for more detail:
/** Greets a person by name. */
def greet(name: string): string {
return `Hello, ${name}!`
}Each generated entry links back to its source code. Options:
| Flag | Description |
|---|---|
-o, --output <dir> | Output directory for the generated markdown. Default docs. |
--base-url <url> | Base URL that each entry's source link points to. |
--ignore <dirs...> | Directory names to skip when scanning a directory recursively. |
References
Formatting
Agency has a built-in formatter. Run format (alias fmt) on a file, a list of files, or whole directories:
agency format foo.agency
agency fmt src/By default, the formatted result prints to stdout. Pass -i / --in-place to overwrite the files instead of printing.
agency fmt can also read from stdin:
cat foo.agency | agency fmt