Files
ccs/docs
Sergey Galuza 00a4dceb94 fix(shared-manager): publish adopted settings by replacement
Adoption moved the canonical settings.json aside with rename() and left
the path empty until publication, roughly 100 ms later. Claude Code or a
second `ccs` starting inside that window found no file and seeded an
empty placeholder; publication then failed with EEXIST because link() is
no-replace, and the rollback published a backup and unlinked the claim,
destroying the only remaining copy of the user's settings. Recovering
meant digging through sidecar files by hand.

Publish by replacement instead: write a temp file next to the canonical
inode and rename() it over the target, so the path always holds a regular
file and no placeholder can be seeded. A compare-and-swap guard on
(ino, mtime, size) runs immediately before the rename and refuses to
publish when the canonical inode changed since it was read, so a writer
that got there first is still never clobbered. The pre-image backup is
published before the replacement, keeping the old content recoverable if
publication is interrupted.

Drops the canonical claim entirely along with restoreCanonicalClaim, and
folds the two identical sidecar publishers into one helper.
recoverOrphanedCanonicalClaim stays, since claims written by older
versions may still be on disk.

New tests cover both writers seen in the incident: Claude Code seeding
`{}` with a trailing newline, and a second `ccs` seeding the 2-byte
variant from shared-dir-linker. Four tests that pinned the claim-based
design were rewritten, among them `preserves a canonical write that
lands during no-replace publication`, whose intent is now enforced by
the CAS guard instead of by an EEXIST from a no-replace link.

Built [OnSteroids](https://onsteroids.ai)
2026-08-23 08:32:26 +02:00
..

CCS Maintainer Documentation

This directory explains how the CLI repository is organized and maintained. User-facing guides and command reference live at docs.ccs.kaitran.ca.

Truth Hierarchy

Use the narrowest authoritative source:

  1. Source, tests, package scripts, and workflows define implemented behavior.
  2. CLAUDE.md and CONTRIBUTING.md define repository workflow.
  3. The documents below explain architecture, rationale, and maintainer decisions.
  4. Build artifacts, releases, and runtime checks define shipped or observed state.

When sources disagree, verify the implementation first and update or remove the stale prose. Avoid copying volatile counts, recursive trees, and exhaustive option lists when a source link can remain accurate.

Start Here

Need Owner
Repository domains and source entry points Codebase summary
Coding, testing, error, and size conventions Code standards
System boundaries and data flow System architecture
Current maintenance direction Project roadmap
Release mechanics Release process
Dashboard localization Dashboard i18n
Test layout and commands Test suite
Dashboard development UI guide

Feature-specific maintainer notes remain in this directory. Discover them by filename, then verify referenced behavior against the linked source.

Update Triggers

Update the owning documentation in the same change when any of these move:

  • CLI or dashboard behavior, commands, flags, or configuration
  • installation, deployment, release, or contributor workflow
  • architecture, data flow, persistence, security, or public contracts
  • source ownership or the stable entry point named by a guide

Pure refactors need documentation changes only when they invalidate a maintainer decision or navigation link. Public behavior changes also require a matching update in the separate kaitranntt/ccs-docs repository on the same target branch. Maintainers using the standard CloudPersonal checkout may have that repository at /Users/kaitran/CloudPersonal/ccs/docs; fork contributors can use their own checkout and coordinate the matching docs change in the PR.

Validation

Before review:

bash tests/docs/quickstart-parity.sh
git diff --check

The repository-owned docs test currently checks the canonical quickstart snippet only. For other changed Markdown, verify each relative link and referenced path directly, then run the focused validation command for any code or workflow the document describes.