@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.
Files changed (57) hide show
  1. package/README.md +33 -18
  2. package/dist/cli.js +68527 -70592
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +10 -10
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/Config.d.ts +21 -21
  8. package/dist/core/Config.d.ts.map +1 -1
  9. package/dist/core/Config.js +33 -33
  10. package/dist/core/Config.js.map +1 -1
  11. package/dist/core/DocSummaries.d.ts +13 -1
  12. package/dist/core/DocSummaries.d.ts.map +1 -1
  13. package/dist/core/DocSummaries.js +25 -3
  14. package/dist/core/DocSummaries.js.map +1 -1
  15. package/dist/core/MarkdownLinks.bench.js +1 -1
  16. package/dist/core/MarkdownLinks.d.ts.map +1 -1
  17. package/dist/core/StampStore.d.ts +47 -0
  18. package/dist/core/StampStore.d.ts.map +1 -0
  19. package/dist/core/StampStore.js +90 -0
  20. package/dist/core/StampStore.js.map +1 -0
  21. package/dist/core/SummaryTree.bench.js +23 -14
  22. package/dist/core/SummaryTree.bench.js.map +1 -1
  23. package/dist/core/SummaryTree.d.ts +10 -1
  24. package/dist/core/SummaryTree.d.ts.map +1 -1
  25. package/dist/core/SummaryTree.js +34 -9
  26. package/dist/core/SummaryTree.js.map +1 -1
  27. package/dist/core/glob.bench.js +1 -1
  28. package/dist/core/glob.d.ts.map +1 -1
  29. package/dist/core/paths.d.ts.map +1 -1
  30. package/dist/index.js +10 -10
  31. package/dist/init/content.d.ts +2 -2
  32. package/dist/init/content.d.ts.map +1 -1
  33. package/dist/init/content.js +45 -15
  34. package/dist/init/content.js.map +1 -1
  35. package/dist/init/generate.d.ts +1 -1
  36. package/dist/init/generate.d.ts.map +1 -1
  37. package/dist/init/generate.js +1 -1
  38. package/dist/io/DocsFs.d.ts +2 -3
  39. package/dist/io/DocsFs.d.ts.map +1 -1
  40. package/dist/io/DocsFs.js +15 -5
  41. package/dist/io/DocsFs.js.map +1 -1
  42. package/dist/program/CheckLinks.d.ts.map +1 -1
  43. package/dist/program/CheckLinks.js +4 -4
  44. package/dist/program/CheckLinks.js.map +1 -1
  45. package/dist/program/CheckSummaries.bench.d.ts +2 -0
  46. package/dist/program/CheckSummaries.bench.d.ts.map +1 -0
  47. package/dist/program/CheckSummaries.bench.js +92 -0
  48. package/dist/program/CheckSummaries.bench.js.map +1 -0
  49. package/dist/program/CheckSummaries.d.ts +25 -5
  50. package/dist/program/CheckSummaries.d.ts.map +1 -1
  51. package/dist/program/CheckSummaries.js +143 -40
  52. package/dist/program/CheckSummaries.js.map +1 -1
  53. package/dist/program/JsonReport.d.ts.map +1 -1
  54. package/dist/program/JsonReport.js +2 -2
  55. package/dist/program/locale.d.ts.map +1 -1
  56. package/package.json +6 -8
  57. 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. Each summary embeds the SHA-256 of the
20
- source it summarizes as its first line:
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
- ```markdown
23
- <!-- source-sha256: 3f9a…(64 hex) -->
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. Mismatch means stale, missing means
27
- missing — and it behaves identically on your laptop and in CI, before and after a clone.
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
- stamp in `guide.summary.md`.
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
- `source-sha256` lines bottom-up.
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 `source-sha256` of existing summaries, bottom-up |
62
- | `cairn init --agent claude\|copilot\|all` | Scaffold agent guidance files |
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