GitHub
Configuration

Clarigen relies on a Clarigen.toml file at the root-level of your repository. That file determines which files to generate, where to put them, and more.

clarinet

The only mandatory configuration you need to set is clarinet, which needs to point to your Clarinet.toml file. For most projects, your Clarinet.toml will also be at the root of your project. If you have a Clarinet project as a sub-directory, specify where the TOML file is.

Clarigen.toml
# for most projects:
clarinet = "./Clarinet.toml"
 
# or if a sub-directory
clarinet = "clarinet/Clarinet.toml"

types

The "types" output is for environments that utilize NPM (or yarn, pnpm, etc) packages. This mostly refers to Node.js or web projects.

types.output

Specify where you'd like the types file to be created.

To disable types generation, disable the output field

Clarigen.toml
[types]
output = "common/clarigen.ts"
 
# or disable:
# output = "common/clarigen.ts"

types.outputs

If you want to export multiple generated types files (like for a monorepo), you can use the outputs array. Note that if output is present, then this is ignored.

[types]
outputs = ["common/clarigen.ts", "packages/web/clarigen.ts"]

types.after

The code generated for types is not formatted, so it'll fail any linting you have. Use this field to specify a script you want ran after code is generated.

Clarigen.toml
[types]
output = "src/clarigen.ts"
// highlight-next-line
after = "yarn prettier -w src/clarigen.ts"

docs

Clarigen can automatically generate contract documentation for you.

docs.output

Specify the folder where you'd like markdown files generated. A markdown file will be generated for each of your contracts, along with a README.md file.

Clarigen.toml
[docs]
# docs will be generated at `./docs/$file.md`
output = "docs"

docs.exclude

By default, all contracts in Clarinet.toml are included in your docs. If you want to exclude certain contracts (such as traits and test helpers), you can use the excludes array.

Note that the values in excludes should be your contract names - not files.

If you have a Clarinet.toml like:

[contracts.extension-trait]
path = 'contracts/traits/extension-trait.clar'

Then to exclude that contract, you'd do:

Clarigen.toml
[docs]
exclude = ["extension-trait"]