Resources Tools

Tools

Klyn ships with companion tools written in Klyn. They are intended to keep the language ecosystem self-hosted where it makes sense: documentation generation, source analysis, and quality feedback should use the same language and runtime as application code.

KlynDoc

KlynDoc is the static API documentation generator for Klyn source trees. It scans KlynDoc comments, packages, types, members, and signatures, then writes a navigable HTML API reference.

klyn tools/klyndoc/KlynDocMain.kn \
    -sourcepath ./lib \
    -d ./docs/api \
    --version "$(cat version.txt)"

From a source checkout, the project-level helper script injects the version from version.txt when it regenerates the standard library API reference.

./klyndoc.sh

Run klyn tools/klyndoc/KlynDocMain.kn --help for the complete option list. In a packaged distribution the source entry point remains under tools/klyndoc; no separate native klyndoc executable is required.

Best use

Use KlynDoc for public library APIs. Keep comments close to the source and include a short description, parameters, return value, exceptions when relevant, and an example.

Metrik

Metrik is the source-code metrics tool currently implemented by the tools/metrik application. It counts files, lines, blanks, comments, code, complexity, duplication, and quality hotspots.

klyn tools/metrik/MetrikApp.kn --quality --hotspots 10 ./lib ./samples
klyn tools/metrik/MetrikApp.kn --format json --output metrics.json ./src

Use klyn tools/metrik/MetrikApp.kn --help to list language filters, output formats, generated/minified-file handling, duplicate detection, and quality-report options.

Its output is useful before refactoring: start with the maintainability summary, then inspect the highest-ranked hotspots instead of guessing where the codebase is hardest to maintain.

Best use

Use Metrik for trend checks and code-review preparation. It is not a replacement for tests or profiling, but it makes large files, duplication, and high-complexity areas visible early.