@sledorze/cairn 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -18
- package/dist/cli.js +68527 -70592
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -10
- package/dist/config.js.map +1 -1
- package/dist/core/Config.d.ts +21 -21
- package/dist/core/Config.d.ts.map +1 -1
- package/dist/core/Config.js +33 -33
- package/dist/core/Config.js.map +1 -1
- package/dist/core/DocSummaries.d.ts +13 -1
- package/dist/core/DocSummaries.d.ts.map +1 -1
- package/dist/core/DocSummaries.js +25 -3
- package/dist/core/DocSummaries.js.map +1 -1
- package/dist/core/MarkdownLinks.bench.js +1 -1
- package/dist/core/MarkdownLinks.d.ts.map +1 -1
- package/dist/core/StampStore.d.ts +47 -0
- package/dist/core/StampStore.d.ts.map +1 -0
- package/dist/core/StampStore.js +90 -0
- package/dist/core/StampStore.js.map +1 -0
- package/dist/core/SummaryTree.bench.js +23 -14
- package/dist/core/SummaryTree.bench.js.map +1 -1
- package/dist/core/SummaryTree.d.ts +10 -1
- package/dist/core/SummaryTree.d.ts.map +1 -1
- package/dist/core/SummaryTree.js +34 -9
- package/dist/core/SummaryTree.js.map +1 -1
- package/dist/core/glob.bench.js +1 -1
- package/dist/core/glob.d.ts.map +1 -1
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/init/content.d.ts +2 -2
- package/dist/init/content.d.ts.map +1 -1
- package/dist/init/content.js +45 -15
- package/dist/init/content.js.map +1 -1
- package/dist/init/generate.d.ts +1 -1
- package/dist/init/generate.d.ts.map +1 -1
- package/dist/init/generate.js +1 -1
- package/dist/io/DocsFs.d.ts +2 -3
- package/dist/io/DocsFs.d.ts.map +1 -1
- package/dist/io/DocsFs.js +15 -5
- package/dist/io/DocsFs.js.map +1 -1
- package/dist/program/CheckLinks.d.ts.map +1 -1
- package/dist/program/CheckLinks.js +4 -4
- package/dist/program/CheckLinks.js.map +1 -1
- package/dist/program/CheckSummaries.bench.d.ts +2 -0
- package/dist/program/CheckSummaries.bench.d.ts.map +1 -0
- package/dist/program/CheckSummaries.bench.js +92 -0
- package/dist/program/CheckSummaries.bench.js.map +1 -0
- package/dist/program/CheckSummaries.d.ts +25 -5
- package/dist/program/CheckSummaries.d.ts.map +1 -1
- package/dist/program/CheckSummaries.js +143 -40
- package/dist/program/CheckSummaries.js.map +1 -1
- package/dist/program/JsonReport.d.ts.map +1 -1
- package/dist/program/JsonReport.js +2 -2
- package/dist/program/locale.d.ts.map +1 -1
- package/package.json +6 -8
- package/schema/cairn.schema.json +35 -38
package/README.md
CHANGED
|
@@ -16,15 +16,18 @@ compares modification times. But **git does not preserve mtimes**: after a clone
|
|
|
16
16
|
checkout, every file looks freshly written, so a time-based check silently passes on
|
|
17
17
|
summaries that are actually stale. The bug you meant to catch ships anyway.
|
|
18
18
|
|
|
19
|
-
`cairn` checks **content**, not clocks.
|
|
20
|
-
|
|
19
|
+
`cairn` checks **content**, not clocks. The SHA-256 of the source each summary
|
|
20
|
+
summarizes is recorded in a hidden sidecar under `.cairn/`, mirroring your docs tree —
|
|
21
|
+
never inside the summary itself, so the tracking system leaves zero bytes in the docs
|
|
22
|
+
you write:
|
|
21
23
|
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
+
```
|
|
25
|
+
.cairn/docs/guide.summary.md.json → {"sha256": "3f9a…(64 hex)", "version": 1}
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
The checker recomputes the source hash and compares
|
|
27
|
-
missing — and it behaves identically on your laptop and in CI,
|
|
28
|
+
The checker recomputes the source hash and compares it to the sidecar. Mismatch means
|
|
29
|
+
stale, missing means missing — and it behaves identically on your laptop and in CI,
|
|
30
|
+
before and after a clone. Commit `.cairn/` alongside your docs; it isn't gitignored.
|
|
28
31
|
|
|
29
32
|
## Install
|
|
30
33
|
|
|
@@ -42,24 +45,36 @@ The round-trip when you touch a doc:
|
|
|
42
45
|
|
|
43
46
|
1. **Edit** `docs/guide.md`.
|
|
44
47
|
2. `npx cairn check` **flags it stale** — the source hash no longer matches the
|
|
45
|
-
|
|
48
|
+
sidecar recorded for `guide.summary.md`.
|
|
46
49
|
3. **Write** the updated `guide.summary.md` (and update any parent `_SUMMARY.md`).
|
|
47
|
-
4. **Stamp**: `npx cairn check --summaries-only --stamp` rewrites the
|
|
48
|
-
|
|
50
|
+
4. **Stamp**: `npx cairn check --summaries-only --stamp` rewrites the `.cairn/`
|
|
51
|
+
sidecar hashes bottom-up — your summary's content is never touched.
|
|
49
52
|
5. **Check** again — `npx cairn check` exits 0. Green.
|
|
50
53
|
|
|
51
|
-
You author the prose; the tool verifies and stamps. It never invents content
|
|
54
|
+
You author the prose; the tool verifies and stamps. It never invents content, and it
|
|
55
|
+
never writes into content either.
|
|
52
56
|
|
|
53
57
|
### Commands
|
|
54
58
|
|
|
55
|
-
| Command | What it does
|
|
56
|
-
| ----------------------------------------- |
|
|
57
|
-
| `cairn check` | Check summaries + links; exit 1 on any problem
|
|
58
|
-
| `cairn check --summaries-only` | Check only summary freshness
|
|
59
|
-
| `cairn check --links-only` | Check only Markdown links
|
|
60
|
-
| `cairn check --links-only --fix` | Auto-repair unambiguous dead links
|
|
61
|
-
| `cairn check --summaries-only --stamp` | Rewrite
|
|
62
|
-
| `cairn
|
|
59
|
+
| Command | What it does |
|
|
60
|
+
| ----------------------------------------- | ------------------------------------------------------------------------- |
|
|
61
|
+
| `cairn check` | Check summaries + links; exit 1 on any problem |
|
|
62
|
+
| `cairn check --summaries-only` | Check only summary freshness |
|
|
63
|
+
| `cairn check --links-only` | Check only Markdown links |
|
|
64
|
+
| `cairn check --links-only --fix` | Auto-repair unambiguous dead links |
|
|
65
|
+
| `cairn check --summaries-only --stamp` | Rewrite the `.cairn/` sidecar hash of existing summaries, bottom-up |
|
|
66
|
+
| `cairn check --prune` | Delete orphan summaries and orphan `.cairn/` sidecars |
|
|
67
|
+
| `cairn check --migrate-stamps` | Optional: same self-healing `--stamp` already does, as its own named step |
|
|
68
|
+
| `cairn init --agent claude\|copilot\|all` | Scaffold agent guidance files |
|
|
69
|
+
|
|
70
|
+
### Upgrading from an older cairn
|
|
71
|
+
|
|
72
|
+
Nothing to look up. If a summary still carries the old in-content
|
|
73
|
+
`<!-- source-sha256: ... -->` comment, the ordinary `--stamp` command strips it and
|
|
74
|
+
writes the `.cairn/` sidecar in the same run — automatically, every time. There is no
|
|
75
|
+
separate migration step to discover: whatever `stampCommand` your repo already runs
|
|
76
|
+
already handles it. `--migrate-stamps` exists only as an optional, explicitly-named
|
|
77
|
+
alias for the same behavior, for anyone who wants the cleanup reported as its own step.
|
|
63
78
|
|
|
64
79
|
## The two summary kinds
|
|
65
80
|
|