This repo is used both as a product workspace and as an automation target for coding agents.
- Prefer minimal, surgical edits.
- Keep changes consistent with existing conventions.
- Avoid reformatting or renaming unless necessary.
vendor/contains external dependencies; when possible, track them as git submodules.muonium-kotlin/is the Kotlin Multiplatform implementation area.investor/contains pitch/docs and should not be modified unless explicitly requested.
- Use
git submodule statusto verify state. - When updating a submodule, commit:
.gitmodules(only if changed)- the submodule gitlink (the submodule directory entry)
- Do not edit vendored submodule contents directly unless the intent is to fork.
When porting vendor/pygments-swift into Kotlin Multiplatform:
- Preserve behavior and token output fidelity first, then optimize.
- Keep a stable, small public API to support rendering/consumers.
- Ensure deterministic output across JVM/Android and Kotlin/Native.
- Do not implement a full IDE/editor.
- Do not introduce heavy dependencies (e.g., full parser frameworks) unless required.
- A KMP library that exposes:
- a tokenizer/lexer API
- token types + scopes
- theme mapping primitives (optional)
- A test corpus that compares Kotlin output to the Swift reference for a set of fixtures.
- Tokenization is hot-path: avoid per-character allocations.
- Prefer streaming APIs (append to mutable lists / emit callbacks).
- Benchmark with representative file sizes and languages.
- If uncertain about an API surface, create a small RFC doc first.
- Always add or update tests when implementing core lexing behavior.
The Kotlin CLI supports exporting highlighted output:
- Entry point:
muonium-kotlin/cli(run viamuonium-kotlin/tools/gradle.shor repomake run) - Formats:
--format tokens(default) or--format text(alias): prints token stream to stdout--format html|png|pdf: writes to--out <file>
- Common flags:
--language <name>,--theme light|dark,--font-size <n>
Quick smoke (from repo root):
cd muonium-kotlin && ./tools/gradle.sh :cli:run --args="../vendor/pygments-swift/sample-code/fibonacci.json --format html --out /tmp/muonium.html"cd muonium-kotlin && ./tools/gradle.sh :cli:run --args="../vendor/pygments-swift/sample-code/fibonacci.json --format png --out /tmp/muonium.png"cd muonium-kotlin && ./tools/gradle.sh :cli:run --args="../vendor/pygments-swift/sample-code/fibonacci.json --format pdf --out /tmp/muonium.pdf"
Note: PDF generation may log PDFBox font-cache warnings on first run; that’s expected.
After completing or implementing a task, always validate by running the repo Make targets and then return control to the user.
- Prefer:
make build && make test && make run - If the task touches Kotlin export/rendering, additionally run an export smoke (HTML/PNG/PDF) and confirm files are non-empty.
- If the task is vendor/OCR related, additionally run the vendor targets you touched (e.g.
make vendor-test,make vendor-render-samples,make ocr-check). - If a target is a placeholder (for example, Kotlin Gradle scaffolding not present yet), still run it and report what it did (or that it no-op’d) along with any actionable follow-up.
- If explicitly requested, run
makein each subfolder that contains a Makefile bycdinto the folder and executingmake.
Return control after:
- commands complete successfully, or
- failures are explained with the exact error output and the next minimal fix.