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.

    klyndoc -sourcepath ./lib -d ./docs/api --version 0.1.2

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

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 and exposed with the `Metrik` command line. It counts files, lines, blanks, comments, code, complexity, duplication, and quality hotspots.

    Metrik --quality --hotspots 10 ./lib ./samples
    Metrik --format json --output metrics.json ./src

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.