Metadata-Version: 2.4
Name: codeclone
Version: 2.1.0a1
Summary: Structural Change Controller for AI-assisted Python development — baseline-aware, deterministic, built for CI and AI agents
Author-email: Den Rozhnovskiy <pytelemonbot@mail.ru>
Maintainer-email: Den Rozhnovskiy <pytelemonbot@mail.ru>
License-Expression: MPL-2.0 AND MIT
Project-URL: Homepage, https://github.com/orenlab/codeclone
Project-URL: Repository, https://github.com/orenlab/codeclone
Project-URL: Issues, https://github.com/orenlab/codeclone/issues
Project-URL: Changelog, https://github.com/orenlab/codeclone/releases
Project-URL: Documentation, https://orenlab.github.io/codeclone/
Keywords: python,ast,cfg,code-clone,duplication,static-analysis,architecture,control-flow,ci
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE-MIT
Requires-Dist: orjson>=3.11.9
Requires-Dist: packaging>=24.0
Requires-Dist: pydantic>=2.13.4
Requires-Dist: pygments>=2.20.0
Requires-Dist: rich>=15.0.0
Requires-Dist: tomlkit>=0.13.2
Requires-Dist: tomli>=2.0.1; python_version < "3.11"
Provides-Extra: mcp
Requires-Dist: mcp<2,>=1.28.1; extra == "mcp"
Requires-Dist: httpx<1,>=0.27.1; extra == "mcp"
Provides-Extra: token-bench
Requires-Dist: tiktoken>=0.13.0; extra == "token-bench"
Provides-Extra: coverage-xml
Requires-Dist: defusedxml<0.8,>=0.7.1; extra == "coverage-xml"
Provides-Extra: semantic-lancedb
Requires-Dist: lancedb>=0.33.0; extra == "semantic-lancedb"
Provides-Extra: semantic-fastembed
Requires-Dist: fastembed<0.9,>=0.8.0; extra == "semantic-fastembed"
Provides-Extra: semantic-local
Requires-Dist: lancedb>=0.33.0; extra == "semantic-local"
Requires-Dist: fastembed<0.9,>=0.8.0; extra == "semantic-local"
Provides-Extra: analytics
Requires-Dist: hdbscan>=0.8.0; extra == "analytics"
Requires-Dist: scikit-learn>=1.5.0; extra == "analytics"
Requires-Dist: lancedb>=0.34.0; extra == "analytics"
Requires-Dist: fastembed<0.9,>=0.8.0; extra == "analytics"
Requires-Dist: umap-learn>=0.5.6; python_version < "3.14" and extra == "analytics"
Requires-Dist: pynndescent>=0.6.0; python_version < "3.14" and extra == "analytics"
Requires-Dist: numba<0.66,>=0.61.0; python_version < "3.14" and extra == "analytics"
Requires-Dist: llvmlite<0.48,>=0.44.0; python_version < "3.14" and extra == "analytics"
Provides-Extra: perf
Requires-Dist: psutil<8,>=7; extra == "perf"
Provides-Extra: dev
Requires-Dist: pytest>=9.1.0; extra == "dev"
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
Requires-Dist: build>=1.4.3; extra == "dev"
Requires-Dist: twine>=6.2.0; extra == "dev"
Requires-Dist: mypy>=2.1.0; extra == "dev"
Requires-Dist: ruff>=0.15.20; extra == "dev"
Requires-Dist: pre-commit>=4.5.1; extra == "dev"
Requires-Dist: ty>=0.0.57; extra == "dev"
Requires-Dist: PyYAML>=6.0.2; extra == "dev"
Requires-Dist: jsonschema>=4.23.0; extra == "dev"
Requires-Dist: types-PyYAML>=6.0.12.20250915; extra == "dev"
Requires-Dist: types-jsonschema>=4.23.0.20250516; extra == "dev"
Dynamic: license-file

<p align="center">
  <picture>
    <source
      media="(prefers-color-scheme: dark)"
      srcset="https://raw.githubusercontent.com/orenlab/codeclone/main/docs/assets/codeclone-wordmark-dark.svg"
    >
    <source
      media="(prefers-color-scheme: light)"
      srcset="https://raw.githubusercontent.com/orenlab/codeclone/main/docs/assets/codeclone-wordmark.svg"
    >
    <img
      alt="CodeClone"
      src="https://raw.githubusercontent.com/orenlab/codeclone/main/docs/assets/codeclone-wordmark.svg"
      width="280"
    >
  </picture>
</p>

<p align="center">
  <strong>Deterministic Structural Change Controller for AI-assisted Python development</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/codeclone/"><img src="https://img.shields.io/pypi/v/codeclone?style=flat-square&color=6366f1" alt="PyPI"></a>
  <a href="https://pypi.org/project/codeclone/"><img src="https://img.shields.io/pypi/pyversions/codeclone?style=flat-square&color=6366f1" alt="Python"></a>
  <a href="https://github.com/orenlab/codeclone/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/orenlab/codeclone/tests.yml?branch=main&style=flat-square&label=tests" alt="Tests"></a>
</p>

CodeClone helps developers use AI coding agents without losing control of structural change. Before an agent edits
code, it records the intended change, maps the structural blast radius, and establishes explicit edit boundaries. After
the edit, it compares the real patch with the declared scope, verifies structural regressions, and leaves an auditable
review receipt.

Every finding and every gate comes from deterministic repository facts — not an LLM opinion — shared across agents,
human reviewers, IDEs, reports, and CI. CodeClone does not generate or rewrite source files.

> **Note:** Features marked `2.1 alpha` require the
> [CodeClone 2.1 prerelease](https://pypi.org/project/codeclone/#history). Everything else works with the current
> stable release.

## Quick start

Requires Python 3.10 or newer.

```bash
uvx codeclone@latest .              # analyze without installing
uvx codeclone@latest . --html --open-html-report

uv tool install codeclone           # install as a local tool
codeclone .
```

Record the accepted structural baseline once, then gate future changes against it in CI:

```bash
codeclone . --update-baseline
codeclone . --ci
```

The baseline separates **new regressions** from findings that already existed, so CI fails only on what the current
change introduced.

## What it provides

- **Structural Change Controller** — `2.1 alpha`: intent-first change control, blast radius, explicit edit boundaries,
  patch verification, and review receipts.
- **Baseline-aware governance** — records accepted legacy debt and separates it from regressions introduced by the
  current change.
- **One canonical report** — clones, complexity, coupling, cohesion, dead code, dependency cycles, a package/module
  dependency map (Module Map), public API inventory, coverage joins, and a guided finding-review queue, rendered
  through CLI, HTML, JSON, Markdown, SARIF, and CI from one payload.
- **Engineering Memory** — `2.1 alpha`: local, typed, evidence-linked project knowledge and reusable histories of prior
  controlled changes.
- **Agent coordination** — `2.1 alpha`: conflict-safe multi-agent intents, queues, recovery, and workspace hygiene.

CodeClone requires no hosted service or cloud account. Analysis state, controller state, Engineering Memory, and
trajectories are stored locally.

## MCP control surface and native clients

```bash
uv tool install --prerelease allow "codeclone[mcp]"
codeclone-mcp --transport stdio
```

The MCP server is read-only by contract: it never mutates source files, baselines, cache, or repository state. The same
canonical structural facts back every client — VS Code, Cursor, Claude Code, Codex, and Claude Desktop.

## Links

- Documentation: <https://orenlab.github.io/codeclone/>
- Getting started: <https://orenlab.github.io/codeclone/getting-started/>
- Structural Change Controller: <https://orenlab.github.io/codeclone/concepts/controlled-change/>
- Engineering Memory: <https://orenlab.github.io/codeclone/concepts/engineering-memory/>
- Configuration reference: <https://orenlab.github.io/codeclone/reference/configuration/>
- Source: <https://github.com/orenlab/codeclone>
- Issues: <https://github.com/orenlab/codeclone/issues>

## License

- Code: MPL-2.0
- Documentation: MIT

See [LICENSES.md](https://github.com/orenlab/codeclone/blob/main/LICENSES.md) for the license scope map.
