Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ton-blockchain/acton/llms.txt

Use this file to discover all available pages before exploring further.

acton fmt formats .tolk source files using the built-in Tolk formatter. By default it rewrites files in place; --check mode instead validates formatting and exits non-zero when any file needs changes, making it suitable for pre-commit hooks and CI. For editor integrations, --stdin reads a source buffer from standard input and writes the formatted result to standard output without touching any files.

Synopsis

acton fmt [OPTIONS] [PATHS...]
When PATHS is omitted, Acton scans the resolved project root recursively.

Arguments & options

Format options

FlagTypeDefaultDescription
[PATHS...]pathsproject rootFiles or directories to format. Repeatable. Conflicts with --stdin.
--checkflagfalseValidate formatting without rewriting. Prints a unified diff for each misformatted file and exits non-zero if any changes are needed.
--stdinflagfalseRead Tolk source from stdin and write formatted output to stdout. Intended for editor integrations. Conflicts with PATHS.
--stdin-filepath <PATH>stringVirtual file path shown in stdin diagnostics. Accepted only with --stdin. Acton does not read or write this path.
--range <startLine:startChar-endLine:endChar>stringFormat only the specified zero-based source range (zero-based lines, zero-based UTF-8 byte columns). Disables import reordering. Requires exactly one explicit .tolk file path (or --stdin).

Global flags

FlagTypeDefaultDescription
--color <WHEN>auto | always | neverautoControl coloured output.
--manifest-path <PATH>pathPath to Acton.toml. Conflicts with --project-root.
--project-root <PATH>pathPath to project root. Conflicts with --manifest-path.

Acton.toml configuration

Acton.toml
[fmt]
width                  = 100
ignore                 = ["contracts/generated/*.tolk"]
separate-import-groups = true
KeyTypeDefaultDescription
widthinteger80Maximum formatted line width.
ignoreglob[][]Additional exclude globs applied during directory traversal. Explicit file arguments bypass these globs.
separate-import-groupsboolfalseInsert blank lines between import groups.

Import sorting

Imports are sorted into groups in this order, lexicographically within each group:
  1. @stdlib
  2. @acton
  3. Other @… mappings
  4. Plain imports
  5. ./… relative
  6. ../… relative

Behaviour notes

  • Only .tolk files are formatted; directory traversal is recursive.
  • Built-in excludes always apply: node_modules, .git, target, .acton.
  • Explicit file arguments are formatted even when they match [fmt].ignore.
  • [fmt].ignore applies only to directory traversal, not to explicit paths.
  • Syntax errors are reported to stderr and cause a non-zero exit.
  • --stdin --check compares stdin with the formatted output and prints a unified diff.
  • --range disables import reordering for that invocation.
  • Editor integrations that expose Unicode scalar or UTF-16 positions must convert them to UTF-8 byte columns before invoking --range.

Examples

acton fmt

CI recipe

.github/workflows/ci.yml
- name: Check formatting
  run: acton fmt --check
Add acton fmt --check to your pre-commit hook (managed by acton hooks) so formatting is validated before every commit.

Build docs developers (and LLMs) love