Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agent guidance

codeint is a command-line tool that measures the Software entropy of a codebase, in any language that has a Language plugin, so that developers who work with coding agents see it grow before it compounds.
Built-in Language plugins cover TypeScript/JavaScript/Vue/Svelte, Rust, PHP, Dart, and Python.
Built-in Language plugins cover TypeScript/JavaScript/Vue/Svelte, Rust, PHP, Dart, Python, and Go.

Kit: avidianity/factory v0.4.0, bootstrapped 2026-11-21.
Review mode: Never ([ADR 0001](docs/adr/0001-review-mode-never.md)).
Expand Down
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ clap = { version = "=4.6.9", features = ["derive"] }
codeint-config = { path = "crates/config" }
codeint-git = { path = "crates/git" }
codeint-lang-dart = { path = "plugins/languages/dart" }
codeint-lang-go = { path = "plugins/languages/go" }
codeint-lang-php = { path = "plugins/languages/php" }
codeint-lang-python = { path = "plugins/languages/python" }
codeint-lang-rust = { path = "plugins/languages/rust" }
Expand Down
6 changes: 3 additions & 3 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

codeint measures the Software entropy of a codebase, in any language that has a Language plugin: duplication, needless verbosity, and complexity concentrated in a few large functions.
It is for developers whose code is increasingly written by coding agents, so they see Software entropy grow before it compounds.
Built-in Language plugins cover TypeScript/JavaScript/Vue/Svelte, Rust, PHP, Dart, and Python.
Built-in Language plugins cover TypeScript/JavaScript/Vue/Svelte, Rust, PHP, Dart, Python, and Go.

## Language

Expand Down Expand Up @@ -76,7 +76,7 @@ A directional rule or public-file constraint governing which architectural zones
_Avoid_: layer rule, module fence

**Orphan file**:
A Production source file unreachable through runtime imports from any manifest-declared, program-start, or configured entry point, classified as unreferenced or test-only.
A Production source file unreachable through runtime imports from any entry point, classified as unreferenced or test-only.
_Avoid_: dead file, unused file

**Dependency hygiene**:
Expand All @@ -88,7 +88,7 @@ A runtime import that the Language plugin could not match to a repository file o
_Avoid_: broken import, missing import

**Workspace package**:
A package declared by a repository workspace, measured on its own alongside the repository total.
A package declared by a repository workspace or by a module manifest such as `go.mod`, measured on its own alongside the repository total.
_Avoid_: subpackage, member package, workspace member

**Finding**:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Each pull request can pass tests and linters while quietly adding copied blocks,
Over dozens of changes, that structural drag compounds until both humans and agents slow down.

codeint measures **Software entropy** directly from the shape of your source code so you see it grow before it compounds.
It ships with five built-in Language plugins covering TypeScript/JavaScript (including React `.jsx`/`.tsx`, Vue, and Svelte `<script>` blocks), Rust, PHP, Dart, and Python, plus sandboxed WebAssembly Plugins for other languages and custom Metrics.
It ships with six built-in Language plugins covering TypeScript/JavaScript (including React `.jsx`/`.tsx`, Vue, and Svelte `<script>` blocks), Rust, PHP, Dart, Python, and Go, plus sandboxed WebAssembly Plugins for other languages and custom Metrics.

## How it works

Expand All @@ -51,7 +51,7 @@ Additional independent Metrics and structural checks run in the same pass:

- **Cognitive complexity**: share of total nesting-weighted cognitive complexity held by functions scoring over 15.
- **Orphan files**: Production files unreachable from manifest-declared, program-start, and configured `entry_points`, classified as `unreferenced` or `test-only`.
- **Dependency hygiene**: three independent Metrics (`unused_dependencies`, `unlisted_dependencies`, and `dev_in_production_dependencies`) comparing `package.json`, `Cargo.toml`, `pyproject.toml`, `composer.json`, and `pubspec.yaml` against imported external packages while excluding standard-library built-ins.
- **Dependency hygiene**: three independent Metrics (`unused_dependencies`, `unlisted_dependencies`, and `dev_in_production_dependencies`) comparing `package.json`, `Cargo.toml`, `pyproject.toml`, `composer.json`, `pubspec.yaml`, and `go.mod` against imported external packages while excluding standard-library built-ins.
- **Architectural import boundaries**: named zones, built-in `layered` and `hexagonal` presets, `public_files` encapsulation, directional `allow`/`deny` rules, and pre-edit `codeint guard <path>` checks before a file even exists on disk.

Every file belongs to one **Source set** (`production`, `test`, `generated`, or `vendored`), so fixtures and generated code never distort Production ratios.
Expand Down Expand Up @@ -85,7 +85,7 @@ Read [docs/guide/philosophy-and-architecture.md](./docs/guide/philosophy-and-arc

## Calibrated Reference ranges

10th to 90th percentile across 20 pre-2023 open-source repositories per language or framework ([ADR 0008](./docs/adr/0008-typescript-reference-ranges.md), [ADR 0010](./docs/adr/0010-rust-reference-ranges.md), [ADR 0011](./docs/adr/0011-php-reference-ranges.md), [ADR 0012](./docs/adr/0012-dart-reference-ranges.md), [ADR 0013](./docs/adr/0013-python-reference-ranges.md), [ADR 0014](./docs/adr/0014-vue2-reference-ranges.md), [ADR 0015](./docs/adr/0015-vue3-reference-ranges.md), [ADR 0020](./docs/adr/0020-react-reference-ranges.md)):
10th to 90th percentile across 20 pre-2023 open-source repositories per language or framework ([ADR 0008](./docs/adr/0008-typescript-reference-ranges.md), [ADR 0010](./docs/adr/0010-rust-reference-ranges.md), [ADR 0011](./docs/adr/0011-php-reference-ranges.md), [ADR 0012](./docs/adr/0012-dart-reference-ranges.md), [ADR 0013](./docs/adr/0013-python-reference-ranges.md), [ADR 0014](./docs/adr/0014-vue2-reference-ranges.md), [ADR 0015](./docs/adr/0015-vue3-reference-ranges.md), [ADR 0020](./docs/adr/0020-react-reference-ranges.md), [ADR 0021](./docs/adr/0021-go-reference-ranges.md)):

| Language | Erosion | Duplication | Verbosity | Import cycles |
| -------- | ------- | ----------- | --------- | ------------- |
Expand All @@ -97,6 +97,7 @@ Read [docs/guide/philosophy-and-architecture.md](./docs/guide/philosophy-and-arc
| PHP | 5.5% to 67.7% | 4.1% to 29.0% | 4.2% to 29.2% | 0.0% to 10.7% |
| Dart | 4.7% to 41.9% | 7.3% to 25.6% | 8.0% to 25.9% | 7.3% to 52.4% |
| Python | 14.4% to 62.4% | 1.2% to 20.1% | 1.4% to 20.4% | 0.0% to 32.1% |
| Go | 37.9% to 69.2% | 4.4% to 18.1% | 4.5% to 18.3% | 0.0% to 0.0% |

See [docs/guide/languages.md](./docs/guide/languages.md) for per-language rules and sample repository timings.

Expand Down Expand Up @@ -153,7 +154,7 @@ let pr_diff = diff(Path::new("."), "main", &DiffOptions::default())?;

## Documentation

- [Guide](./docs/guide/README.md): walkthroughs for [Philosophy and Architecture](./docs/guide/philosophy-and-architecture.md), [Getting Started](./docs/guide/getting-started.md), [Configuration](./docs/guide/configuration.md), [Built-in Languages](./docs/guide/languages.md), [CI and GitHub Actions](./docs/guide/ci-and-github-actions.md), and [Coding-Agent Integration (MCP)](./docs/guide/mcp.md).
- [Guide](./docs/guide/README.md): walkthroughs for [Philosophy and Architecture](./docs/guide/philosophy-and-architecture.md), [Getting Started](./docs/guide/getting-started.md), [Configuration](./docs/guide/configuration.md), [Built-in Languages](./docs/guide/languages.md), [Go](./docs/guide/go.md), [CI and GitHub Actions](./docs/guide/ci-and-github-actions.md), and [Coding-Agent Integration (MCP)](./docs/guide/mcp.md).
- [Reference](./docs/reference.md): tested reference for every command, flag, exit code, report format (`toon`, `json`, `sarif`, `markdown`, `text`), and configuration key.
- [Programmatic API](./docs/programmatic.md): JavaScript/TypeScript SDK and Rust library API.
- [Plugins](./docs/plugins.md): build, hash, declare, and test external WebAssembly Language and Metric plugins.
Expand Down
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ path = "src/main.rs"
codeint-config = { workspace = true }
codeint-git = { workspace = true }
codeint-lang-dart = { workspace = true }
codeint-lang-go = { workspace = true }
codeint-lang-php = { workspace = true }
codeint-lang-python = { workspace = true }
codeint-lang-rust = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion crates/cli/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use codeint_config::{
};
use codeint_git::{GitError, Repository, Snapshot};
use codeint_lang_dart::Dart;
use codeint_lang_go::Go;
use codeint_lang_php::Php;
use codeint_lang_python::Python;
use codeint_lang_rust::Rust;
Expand Down Expand Up @@ -282,7 +283,7 @@ pub(crate) struct NamedLanguagePlugin<'plugin> {
pub(crate) plugin: &'plugin dyn LanguagePlugin,
}

pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 5] = [
pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 6] = [
NamedLanguagePlugin {
name: "typescript-javascript",
plugin: &TypeScriptAndJavaScript,
Expand All @@ -303,6 +304,10 @@ pub(crate) const BUILT_IN_LANGUAGE_PLUGINS: [NamedLanguagePlugin<'static>; 5] =
name: "python",
plugin: &Python,
},
NamedLanguagePlugin {
name: "go",
plugin: &Go,
},
];

pub(crate) fn built_in_languages() -> Vec<LanguageSchema> {
Expand Down
33 changes: 31 additions & 2 deletions crates/cli/tests/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ fn validation_errors_in_codeint_jsonc_name_codeint_jsonc() {
assert_operational_error(
&output,
"codeint: codeint.jsonc names an unknown Language plugin cobol at languages[0].plugin; \
the Language plugins are typescript-javascript, rust, php, dart, python\n\
the Language plugins are typescript-javascript, rust, php, dart, python, go\n\
Name one of the Language plugins listed, or remove the entry from languages.\n",
);
}
Expand Down Expand Up @@ -3044,7 +3044,7 @@ fn a_languages_entry_that_names_an_unknown_language_plugin_names_it_and_exits_2(
{ "plugin": "cobol", "include": ["scripts"] }
] }"#,
"codeint.json names an unknown Language plugin cobol at languages[1].plugin; \
the Language plugins are typescript-javascript, rust, php, dart, python",
the Language plugins are typescript-javascript, rust, php, dart, python, go",
"Name one of the Language plugins listed, or remove the entry from languages.",
);
}
Expand Down Expand Up @@ -5861,3 +5861,32 @@ fn no_imports_only_repo_shows_absent_import_totals_and_budgets_do_not_trip() {
assert_eq!(section.get("boundaries"), None);
}
}

#[test]
fn go_check_displays_calibrated_reference_ranges_next_to_go_values() {
let repository = Repository::new();
repository.write("go.mod", "module example.com/demo\n\ngo 1.24\n");
repository.write(
"main.go",
"package main\n\nfunc classify(x int) int {\n\tif x > 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}\n",
);
repository.commit_all();

let report = check_json_with_exit(&repository, &["check", "--format", "json"], 0);
let prod = &report["source_sets"]["production"];
let expected_source = "codeint panel of 20 Go repositories, ADR 0021, codeint 0.6.0";
for (metric, low, high) in [
("erosion", 0.379, 0.692),
("verbosity", 0.045, 0.183),
("duplication", 0.044, 0.181),
("import_cycles", 0.0, 0.0),
] {
let rr = &prod[metric]["reference_range"];
assert_eq!(rr["low"], low, "{metric} reference_range.low");
assert_eq!(rr["high"], high, "{metric} reference_range.high");
assert_eq!(
rr["source"], expected_source,
"{metric} reference_range.source"
);
}
}
Loading
Loading