Skip to main content
Version: 0.3.4

Appendix

Exit codes​

CodeMeaning
0clean — nothing to do, or everything merged
1unresolved conflicts: a sync recorded them, or a status found them; or a file md canonicalize --check found not canonical
2error — nothing was merged

Per command:

Codesnapshotdiffsyncstatusresolve
0now trackingreportedmerged clean, or up to datereportedsettled, or --show
1——conflicts recordedconflicts open—
2already tracked, bad path, unreadable --from, structural driftnothing tracked, untracked doc, structural driftnothing tracked, conflicts already open, missing upstream, structural drift, structure mismatchuntracked doc, missing base, missing working copyno/ambiguous key, --take local on an orphan, block edited since

And for the md group (the md verbs):

Codemd canonicalizemd ast / md json / md blocksmd from-json
0written, or --check passedprintedrendered
1--check on a non-canonical file——
2missing file, -i on stdinmissing fileinvalid JSON, wrong shape, not a token

Two rules a CI script depends on: 1 never means "broken" and 2 never means "needs a human". Within one sync run over several documents, 2 wins — an error anywhere means the run's conflict count is not the whole story. md canonicalize --check keeps that reading: unformatted is a thing a human fixes, not a breakage.

Warnings are outside this table. The $...$ math warning (Limits, stated plainly) is stderr text and nothing else: it never adds a code, never upgrades one, and a document that gained a math span still returns what it returned before — preserving the math gave cedit nothing to fail on. Anything that needs to fail a build gates on md canonicalize --check.

State layout​

PathContentsCommitted
<doc>your working copy (L)yes — it is the product
.cedit/base/<doc>canonicalized base snapshot (B)yes — the merge is impossible without it
.cedit/manifest.jsonper-doc upstream, base hash, sync time, unresolved conflictsyes
.cedit/overlay.jsonderived local-edit overlayyes, like a lockfile

manifest.json shape​

{
"schema": "cedit-manifest/v1",
"docs": {
"<doc path>": {
"upstream": "<--from as last given>",
"base_doc_hash": "<16 hex chars>",
"synced_at": "<UTC ISO-8601>",
"conflicts": {
"<hash>:<occurrence>": {
"reason": "conflict | orphan",
"kind": "opaque | unit",
"node_type": "fence | paragraph | heading | td | th | front_matter | ...",
"context": "<heading trail>",
"base_text": "...", "base_info": "...",
"local_text": "...", "local_info": "...",
"upstream_text": "... | null (orphan)", "upstream_info": "..."
}
}
}
}
}

overlay.json shape​

{
"schema": "cedit-overlay/v1",
"docs": {
"<doc path>": {
"derived_at": "<UTC ISO-8601>",
"edits": [
{
"kind": "opaque | unit",
"node_type": "fence | paragraph | ...",
"hash": "<16 hex chars>",
"occurrence": 0,
"context": "<heading trail>",
"base_text": "...", "base_info": "...",
"local_text": "...", "local_info": "..."
}
]
}
}
}

Both files serialize documents in sorted key order, UTF-8, ensure_ascii=False, so diffs stay local and reviewable.

Defaults and constants​

ThingValueWhere
state directory.ceditstate.DEFAULT_STATE_DIR
manifest schemacedit-manifest/v1state.MANIFEST_SCHEMA
overlay schemacedit-overlay/v1state.OVERLAY_SCHEMA
hash width16 hex charsmdcore.tree_diff.hash_tree
edit-pairing threshold0.4mdcore.tree_diff.SIM_THRESHOLD
fuzzy (moved+edited) threshold0.6mdcore.tree_diff.FUZZY_THRESHOLD
display clip width110 charsmdcore.tree_diff.WIDTH
opaque node typesfence, code_block, html_block, front_matter, hrmdcore.tree_diff.OPAQUE
unit node typesheading, paragraph, th, tdmdcore.tree_diff.UNIT_PARENTS

Things cedit deliberately will not do​

  • Fetch upstream. --from reads what is already on disk.
  • Write conflict markers into the document. ======= is a setext heading underline; a marked-up file would stop parsing as itself and every hash downstream would move.
  • Merge local structural changes. Phase 1 is replacements only, and the refusal is per block with a report.
  • Clobber your text. On a conflict the working file keeps the local version, always.
  • Rewrite $...$ math. It cannot parse it as math, but it preserves the span byte for byte on every write path. The one construct it cannot protect — a span in a table cell holding \| — is warned about on stderr first (Limits, stated plainly).
  • Sync a document with open conflicts. It would merge against a base you never accepted.
  • Commit anything. The document and .cedit/ are yours to commit, together.

See also​

DocumentWhat it covers
README.mdthe two-minute version: setup, quickstart, layout
SPEC.mdthe normative design — merge matrix, sync algorithm, state format, reuse rules, phases
AGENTS.mdworking on cedit itself: orientation, invariants, repo workflow
ARCHITECTURE.mdthe implementation module by module, and the recipes for extending it
cedit-canonicalization-reference.mdevery Markdown element and how cedit md canonicalize transforms it, known caveats, and quick test commands