Skip to main content

Universal safe-save for concurrent text files — let a user and one or more AI agents edit the same file together without lost updates.

Project description

cotype (CLI)

The Python implementation of the cotype CLI — universal safe-save for concurrent text files.

This is the package that gets installed by editor integrations and agent drivers. The full product story (use case, KB, ADRs) lives at the monorepo root.

Install

Requires Python ≥ 3.11 and POSIX diff3 (from diffutils).

# from the monorepo root
pip install -e cli/

# verify
cotype --help

Test

cd cli
pip install pytest
pytest -q

Layout

cli/
├── pyproject.toml
├── cotype/                  the package
│   ├── __main__.py         python -m cotype
│   ├── cli.py              argparse + dispatch + JSON envelope
│   ├── errors.py           stable error names + exit codes
│   ├── hash.py             SHA-256 of raw bytes (P5 byte-exact)
│   ├── paths.py            sidecar resolution; conflict-id validation
│   ├── lock.py             advisory flock on <sidecar>/lock
│   ├── atomic_write.py     tmp -> fsync -> rename -> fsync(parent)
│   ├── store.py            state.json read/write, base storage
│   ├── merge.py            POSIX diff3 -m wrapper
│   └── commands/
│       ├── init.py
│       ├── open_.py
│       ├── save.py
│       ├── status.py
│       ├── resolve.py
│       └── catbase.py
└── tests/                  84 pytest tests

Commands

cotype init    FILE [--json]
cotype open    FILE [--json]
cotype save    FILE --base-sha HASH [--actor ACTOR] [--json] < proposed
cotype status  FILE [--json]
cotype resolve FILE [--conflict-id ID | --use-merged] [--actor ACTOR] [--json]
cotype cat-base FILE [--base-sha HASH]

Full surface, exit codes, and stable error names: see ../README.md and ../kb/spec/.

Architecture in one paragraph

A small layered package: pure leaves (hash, paths, errors), I/O primitives (lock, atomic_write), persistence (store), the merge wrapper (merge), command implementations under commands/, and a single cli.py that wires argparse and the JSON envelope. Every mutating command holds an exclusive flock on <sidecar>/lock; every file replacement goes through the canonical tmp → fsync → rename → fsync(parent) sequence. 3-way merge invokes POSIX diff3 -m in subprocess (list form, never shell). All public functions are typed; files are under 200 lines; the test suite covers SPEC §14 conformance (T1–T10), every named property (P1–P15), security edges, and a threaded atomic-visibility smoke test.

For the "why" behind these choices: ../kb/architecture/decisions/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cotype-0.2.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cotype-0.2.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file cotype-0.2.2.tar.gz.

File metadata

  • Download URL: cotype-0.2.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cotype-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ad63b954e0abf1b723c2291e0eb699e213b56b32ea684ccb0958e9c2f56f6f46
MD5 12ffa93105fd23ea9c7cb1bdb2ba2a9d
BLAKE2b-256 a36eb32cfc38c39d0dfccb523055bf205da3300b2259db1fe212b8b2882091d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotype-0.2.2.tar.gz:

Publisher: publish.yml on yurug/cotype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cotype-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: cotype-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cotype-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7acb780374fd822d65b7fa271b08e761ae9481255f55299537f6c69f5197e833
MD5 79e0382a78dbed8c42cbf25112f55e49
BLAKE2b-256 f3537abe354044ab98bd9dfa23836006550cd0737aa284310e5e95d52175ddb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotype-0.2.2-py3-none-any.whl:

Publisher: publish.yml on yurug/cotype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page