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 is the opinionated Tolk code formatter built into Acton. It rewrites .tolk files in place to produce consistent, predictable output — uniform indentation, import ordering, and line width — so code review stays focused on logic rather than style. The formatter can also run in a non-destructive check mode for CI validation and accepts source from stdin for seamless editor integration.
Format all files in the project
Run without arguments from the project root to format every.tolk file discovered under it:
node_modules, .git, target, .acton, .codex, .claude) are always skipped.
Format selected files or directories
Pass one or more paths to limit the scope:Format from another directory
Point Acton at the project explicitly when the current shell is outside the project root:--manifest-path to also load a specific Acton.toml:
Check mode (CI)
Use--check to validate formatting without rewriting files:
Stdin mode (editor integration)
Use--stdin to pipe source through the formatter without touching disk. This is the integration point used by editor plugins that format on save:
--stdin cannot be combined with file or directory path arguments.
Diff output
--check already prints diffs for unformatted files. To see what changes acton fmt would make without applying them, combine --check with standard output redirection:
Configuring the formatter
Store formatter defaults in the[fmt] section of Acton.toml:
Acton.toml
| Field | Type | Default | Description |
|---|---|---|---|
width | integer | 100 | Maximum formatted line width. |
ignore | string[] | — | Glob patterns of files to skip during recursive traversal. |
separate-import-groups | boolean | false | Insert a blank line between import groups. |
@stdlib, @acton, @<other>, plain imports, ./, ../. The formatter sorts imports within each group automatically.
A file passed explicitly to
acton fmt is still formatted even if it matches [fmt].ignore. Ignore patterns apply only during directory traversal, not to explicit path arguments.Git pre-commit hook
Add a pre-commit hook to format staged Tolk files before every commit:cat > .git/hooks/pre-commit << 'EOF'
#!/usr/bin/env bash
set -e
# Collect staged .tolk files
STAGED=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.tolk$' || true)
[ -z "$STAGED" ] && exit 0
# Format them in place
echo "$STAGED" | xargs acton fmt
# Re-stage the formatted files
echo "$STAGED" | xargs git add
EOF
chmod +x .git/hooks/pre-commit
Editor integration
- VS Code
- JetBrains
- Other editors (generic LSP/stdin)
The TON extension for VS Code calls The extension reads
acton fmt --stdin automatically on save. After installing the extension, add the following to your workspace settings.json:.vscode/settings.json
[fmt] settings from Acton.toml automatically, so width and import-group preferences are respected without additional configuration.Troubleshooting
The formatter reports syntax errors
The formatter reports syntax errors
Fix the parse error first, then run the formatter again.
acton fmt formats only valid Tolk source files. The error output includes the file name and line where parsing failed.A file was skipped unexpectedly
A file was skipped unexpectedly
Check whether the file path matches a pattern in
[fmt].ignore or one of Acton’s built-in excluded directories: node_modules, .git, target, .acton, .codex, .claude. Pass the path explicitly to override ignore patterns.CI fails on formatting
CI fails on formatting
Run
acton fmt locally, commit the rewritten .tolk files, and rerun the pipeline. Make sure the same Acton.toml is checked in so the width and ignore settings match between local and CI environments.Import order keeps changing between runs
Import order keeps changing between runs
Import ordering is deterministic. If order changes between runs, different versions of Acton may be producing different output. Pin the Acton version in
[toolchain]:Acton.toml