Tonto
Theory & Reference

Package Architecture

Understand the Tonto monorepo packages, build workflow, and contributor commands.

Tonto is organized as an npm workspace monorepo.

Workspaces

WorkspaceRole
packages/tontotonto-cli, grammar, language server services, validators, generators, parser utilities, templates.
packages/extensionVS Code extension package published as Lenke.tonto.
packages/tpmTonto Package Manager package published as tpm.
packages/webviewReact/Vite webview package for diagram experiences.
packages/sprotty-vscodeSprotty VS Code extension-side integration.
packages/sprotty-vscode-webviewSprotty webview-side integration.
packages/tonto-documentationNext.js documentation application with a GitHub Pages static export.

Root scripts

Run these from the repository root:

npm run build
npm run test
npm run lint
npm run docs:dev
npm run docs:check

Language generation:

npm run langium:generate
npm run langium:watch

CLI package

The CLI package contains:

  • Langium grammar files under src/language.
  • Validators under src/language/validators.
  • CLI commands under src/cli/actions/commands.
  • Generators for JSON, Tonto, PlantUML, and project templates.
  • Tonto ontology skill and guidance templates.

Extension package

The extension package contributes:

  • VS Code language registrations.
  • Commands and status bar actions.
  • Webview and diagram commands.
  • tonto.json schema association.
  • Feature toggle for .tontodiagram.

Webview package

The webview package contains the React-based diagram editor and supporting UI. It is built with Vite and bundled for the extension.

Documentation package

The documentation package is a Next.js site using Tailwind CSS and shadcn/ui patterns. It remains in the workspace so documentation scripts and dependency locking live with the rest of the project. Existing MDX files and docs.json provide the content and navigation data.

Run:

npm run docs:dev
npm run docs:check

The static build is generated at:

packages/tonto-documentation/out

The GitHub Actions workflow at .github/workflows/documentation.yml publishes this directory to GitHub Pages.

Contributor workflow

Before publishing a change that affects syntax, commands, or generated artifacts:

  1. Update the code and tests.
  2. Run npm run langium:generate when grammar changes require generated language files.
  3. Run npm run test.
  4. Update relevant documentation pages in packages/tonto-documentation.
  5. Run npm run docs:check.

Documentation should describe current behavior from source code, not only legacy docs.