awslabs/codeknit
v0.6.1Apache-2.0
Extract code structure, analyze dependency graphs, and find duplicate code with codeknit. Installs the codeknit binary on first use.
Changelog
This changelog tracks releases of the Codeknit Go package and CLI. Documentation-only changes, translations, and website dependency updates are excluded.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.6.1] - 2026-11-18
Added
graph show: nodes are colored by top-level folder, and any folder or file can be recolored from the sidebar tree (inherited by its children, saved per graph file).
Changed
graph show: edges are neutral gray with a line pattern per edge kind and turn white when highlighted; symbol categories no longer have their own colors and stay filterable.
Fixed
graph show: the file tree is shown relative to the project root, so folder checkboxes work for absolute input paths.
[0.6.0] - 2026-09-14
Added
- Shared
--include,--exclude,--max-file-size(10 MiB default), and--strictcontrols for source-processing commands. - Scan diagnostics for unreadable paths, skipped symlinks, non-regular sources, and size limits; strict mode rejects incomplete analysis before writing output.
Changed
- Tree output preserves source extensions (
foo.c.skt,foo.h.skt) and requires at least three lines per source chunk. - Generate directory output in staging, preserve unrelated files, and publish with locking, rollback, and recovery after interrupted replacement; replace individual reports without truncating existing files.
- Disclose approximate near-duplicate retrieval for large inputs; embedding reranking uses the parsed source snapshot.
Fixed
- Parse single-file inputs correctly and return a failure when no source files can be read.
- Prevent tree output collisions and chunking hangs; retain source headers and relationships across split files.
- Prevent nested blocks and same-line neighboring declarations from replacing callable fingerprints.
- Preserve every exact normalized-token duplicate pair across the 500-symbol retrieval threshold and make tied match ordering deterministic.
- Apply ancestor ignore rules independently of the working directory, respect repository boundaries, confine source reads, and enforce file-size limits while reading.
[0.5.0] - 2026-09-14
Changed
- Preserve uncertain relationships in JSON and SKT; show excluded relationship counts in graph analysis and HTML.
- Use native SKT edge annotations for uncertainty, with grouped targets and candidate short IDs.
- Give C/C++ file and include endpoints symbols so include relationships use short IDs instead of repeated paths; retain unresolved status and exclude this metadata from dependency metrics.
Fixed
- Resolve relationships using imports, lexical scope, and package identity instead of arbitrary name or proximity matches; preserve qualified calls and renamed imports.
- Respect shadowed receivers before resolving namespace imports, and restrict Python package imports to declarations in the imported module or package initializer.
- Preserve call ownership for same-line and overloaded declarations and isolate their scoped aliases; distinguish callback and return-value references from actual calls.
- Resolve override targets through inherited declarations instead of emitting self-links; preserve uncertainty for missing or competing targets.
- Correct TypeScript heritage edges, analyze all inheritance parents, count unique dependency neighbors, and prevent containment from making unused siblings reachable.
- Use the strongest dependency path for change-propagation scores and honor
graph analyze --top-n 0.
[0.4.0] - 2026-09-11
Added
- Added
--header-language c|cppto all source-processing CLI commands, retaining C as the default. - Added
.mts,.cts,.mjs, and.cjsfile support.
Fixed
- Parse TSX with the JSX-aware TypeScript grammar and traverse plain TypeScript namespace wrappers.
- Preserve Go grouped, unnamed, variadic, function-typed and generic parameters, multiple/named results, generic receiver ownership, and grouped type parameters.
- Emit Go interface method signatures and Go/Rust named struct fields in normal and fingerprint modes.
- Traverse Rust inline modules with qualified names and preserve Rust receiver/pattern parameters.
- Preserve Python annotations, defaults, splats, parameter separators, and return annotations.
- Traverse C/C++ header guards and C++ linkage wrappers; include signatures for prototypes and method declarations.
- Preserve scoped modules and attach package containment only to declarations without an existing owner.
- Escape multiline signatures in SKT while retaining their source formatting in JSON.
[0.3.1] - 2026-09-01
Changed
- Updated go-git to v5.19.2,
golang.org/x/cryptoto v0.53.0, andgolang.org/x/netto v0.56.0.
0.3.0 - 2026-07-22
Added
- Added semantic candidate generation to
codeknit fingerprint --rerank, merging category-aware embedding neighbors with structural candidates before weighted scoring. - Added batched Ollama embedding requests and projected embedding vectors for efficient nearest-neighbor retrieval.
Changed
- Improved fingerprint similarity scoring with category-aware comparisons, structural scoring for callables and modules, and payload-aware scoring for types and values.
- Improved embedding inputs by removing path and symbol-name leakage, stripping comments, adding normalized structural context, and preserving both ends of long symbols with Unicode-safe truncation.
- Updated CLI and TUI wording from semantic reranking to semantic matching.
Fixed
- Prevented variable ordinal bytes from being interpreted as semantic fingerprint tokens.
- Standardized call fingerprints to include a normalized callee hash and argument count in callable bodies and value initializers.
0.2.1 - 2026-07-21
Changed
- Updated Go dependencies, including Bubble Tea, Lip Gloss, the AWS SDK, go-git,
x/sync, and Rapid. - Updated the Tree-sitter Scala grammar to v0.24.1, the newest release compatible with the current Tree-sitter runtime ABI.
0.2.0 - 2026-07-21
Added
- Added
codeknit graph hotspotsto rank files by Git churn, recency, and structural importance, with temporal coupling analysis and SKT/JSON output.
0.1.2 - 2026-06-29
Fixed
- Made
codeknit graph showoutput fully self-contained by embedding D3, fixing browser failures when opening the generated HTML fromfile://.
0.1.1 - 2026-06-26
Added
- JSON output for
codeknit parsevia--format jsonin the CLI and TUI.
0.1.0 - 2026-06-16
Added
Core extraction
- Static code structure extraction for 12 languages: C, C++, C#, Go, Java, JavaScript, PHP, Python, Ruby, Rust, Scala, TypeScript
- Three output modes for
codeknit parse:inline,directory-flat,directory-tree - Compact
.sktoutput format with[symbols],[edges],[errors], and[dict]sections - Type-aware signatures: parameter types and return types included for statically typed languages
- Type references in signatures resolved to symbol IDs (e.g.,
Environment→S3) - Cross-file symbol resolution with directory proximity heuristics and import-aware disambiguation
- Configurable
--max-linesper output file with automatic splitting - Default output directory
./skeletonwhen no output path is specified - Stale output detection: refuses to overwrite existing
.sktfiles without--clean --minifyflag for dictionary-based token compression (shareddict.skt)--edgesflag to include the[edges]section (omitted by default to save tokens)--cleanflag to remove stale.sktfiles before writing--collect-testflag to include test files in analysis- Parallel file parsing with configurable
--workers
Graph visualization and analysis
codeknit graph showsubcommand: generates a self-contained interactive HTML visualization of the codebase graph, opened automatically in the default browsercodeknit graph analyzesubcommand: runs 22 structural graph algorithms and emits an LLM-readable.sktreport, including:- Cyclic dependencies (Tarjan's SCC)
- Hub detection (high fan-in/fan-out coupling)
- Orphan detection (dead code candidates)
- God class/function detection (excessive children)
- Instability metric (Robert C. Martin's Ce/(Ca+Ce))
- Deep inheritance chains
- Betweenness centrality (bottleneck detection)
- Articulation points (single points of failure)
- PageRank (recursive importance)
- Transitive fan-in (blast radius)
- Change propagation simulation
- Circular package dependencies
- Layer violation detection
- Reachability from entry points
- Weakly connected components
- Dependency weight (package coupling strength)
- Distance from Main Sequence (A+I balance)
- Shotgun surgery detection
- Feature envy detection
- Stable dependency violations
- Interface segregation violations
- Containment depth
- Configurable thresholds for hubs, god classes, inheritance depth, top-N ranking, betweenness, and change propagation
Fuzzy duplicate detection
codeknit fingerprintsubcommand: detects duplicate and near-duplicate code across files and languages using Context-Triggered Piecewise Hashing (CTPH) over normalized body tokens- Structural type fingerprints that capture class/struct/interface shape (field count, method signatures, inheritance) independently from method-body logic
--min-similarityand--max-similarityflags to bound the reported similarity range--show-allflag to emit the full per-symbol[fingerprints]section in addition to the[duplicates]pairs
Interactive terminal UI
codeknitwith no arguments launches an interactive TUI with command selection, directory completion, and field navigation- Per-command screens for
parse,graph show,graph analyze, andfingerprint
Tooling and distribution
- Per-command configuration architecture (Docker-style options structs) following the patterns used in kubectl, docker, gh, and hugo
- Deterministic output: planner iterates module maps in sorted key order so rerunning the tool produces byte-identical output
- Skill files for AI coding assistants in
skills/codeknit-parse/andskills/codeknit-fingerprint/ - Third-party license generation via
make third-party-licenses - Cross-plugin property test enforcing uniform signature format across all supported languages