From f68be488147076e57cf80a9394613b5cdab916e0 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Mon, 6 Apr 2026 20:34:47 +0200 Subject: [PATCH 1/2] feat: add dart support --- src/scanner/anatomy-scanner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner/anatomy-scanner.ts b/src/scanner/anatomy-scanner.ts index c058ce9..081d227 100644 --- a/src/scanner/anatomy-scanner.ts +++ b/src/scanner/anatomy-scanner.ts @@ -41,7 +41,7 @@ const BINARY_EXTENSIONS = new Set([ const CODE_EXTENSIONS = new Set([ ".ts", ".js", ".tsx", ".jsx", ".py", ".rs", ".go", ".java", ".c", ".cpp", ".h", ".css", ".scss", ".sql", ".sh", ".yaml", - ".yml", ".json", ".toml", ".xml", + ".yml", ".json", ".toml", ".xml", ".dart", ]); const PROSE_EXTENSIONS = new Set([".md", ".txt", ".rst", ".adoc"]); From d71d925ad97a637fc450008e12a09cf504172dd6 Mon Sep 17 00:00:00 2001 From: Saad Khan Date: Sat, 11 Apr 2026 14:31:16 -0400 Subject: [PATCH 2/2] feat: extend scanner language support and sync CODE_EXTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds Flutter-critical languages (Kotlin, Swift, Objective-C) plus common gaps (C++ variants, C#, Ruby, PHP, Lua, Vue, Svelte, HTML, Protobuf, GraphQL, Terraform, shell variants) to both extension sets. Also brings src/tracker/token-estimator.ts CODE_EXTS back in sync with src/scanner/anatomy-scanner.ts CODE_EXTENSIONS — the two sets had drifted apart since only CODE_EXTENSIONS gets the .dart addition from #10. Adds a one-line "Keep in sync with ..." comment above each so future additions hit both places. These sets control the chars-per-token ratio (3.5 for code vs 3.75 fallback) used by estimateTokens; the net effect is ~7% more accurate token accounting in anatomy.md and detectContentType() consumers for projects written in these languages. --- src/scanner/anatomy-scanner.ts | 7 +++++++ src/tracker/token-estimator.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/scanner/anatomy-scanner.ts b/src/scanner/anatomy-scanner.ts index 081d227..1de2234 100644 --- a/src/scanner/anatomy-scanner.ts +++ b/src/scanner/anatomy-scanner.ts @@ -38,10 +38,17 @@ const BINARY_EXTENSIONS = new Set([ ".lock", ]); +// Keep in sync with CODE_EXTS in src/tracker/token-estimator.ts const CODE_EXTENSIONS = new Set([ ".ts", ".js", ".tsx", ".jsx", ".py", ".rs", ".go", ".java", ".c", ".cpp", ".h", ".css", ".scss", ".sql", ".sh", ".yaml", ".yml", ".json", ".toml", ".xml", ".dart", + ".kt", ".kts", ".swift", ".m", ".mm", + ".hpp", ".hh", ".cc", ".cxx", + ".cs", ".rb", ".php", ".lua", + ".vue", ".svelte", ".html", ".htm", + ".proto", ".graphql", ".gql", ".tf", + ".bash", ".zsh", ".fish", ]); const PROSE_EXTENSIONS = new Set([".md", ".txt", ".rst", ".adoc"]); diff --git a/src/tracker/token-estimator.ts b/src/tracker/token-estimator.ts index 4e93b0d..6009a91 100644 --- a/src/tracker/token-estimator.ts +++ b/src/tracker/token-estimator.ts @@ -1,9 +1,16 @@ import * as path from "node:path"; +// Keep in sync with CODE_EXTENSIONS in src/scanner/anatomy-scanner.ts const CODE_EXTS = new Set([ ".ts", ".js", ".tsx", ".jsx", ".py", ".rs", ".go", ".java", ".c", ".cpp", ".h", ".css", ".scss", ".sql", ".sh", ".yaml", - ".yml", ".json", ".toml", ".xml", + ".yml", ".json", ".toml", ".xml", ".dart", + ".kt", ".kts", ".swift", ".m", ".mm", + ".hpp", ".hh", ".cc", ".cxx", + ".cs", ".rb", ".php", ".lua", + ".vue", ".svelte", ".html", ".htm", + ".proto", ".graphql", ".gql", ".tf", + ".bash", ".zsh", ".fish", ]); const PROSE_EXTS = new Set([".md", ".txt", ".rst", ".adoc"]);