@glw907/cairn-cms 0.58.0 → 0.60.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 (97) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/dist/components/CairnAdmin.svelte +3 -0
  3. package/dist/components/CairnMediaLibrary.svelte +1101 -27
  4. package/dist/components/CairnMediaLibrary.svelte.d.ts +10 -2
  5. package/dist/components/CairnTidySettings.svelte +553 -0
  6. package/dist/components/CairnTidySettings.svelte.d.ts +32 -0
  7. package/dist/components/EditPage.svelte +371 -2
  8. package/dist/components/MarkdownEditor.svelte +168 -1
  9. package/dist/components/MarkdownEditor.svelte.d.ts +44 -0
  10. package/dist/components/TidyReview.svelte +463 -0
  11. package/dist/components/TidyReview.svelte.d.ts +47 -0
  12. package/dist/components/admin-icons.d.ts +1 -0
  13. package/dist/components/admin-icons.js +1 -0
  14. package/dist/components/cairn-admin.css +913 -2
  15. package/dist/components/editor-tidy.d.ts +31 -0
  16. package/dist/components/editor-tidy.js +199 -0
  17. package/dist/components/index.d.ts +1 -0
  18. package/dist/components/index.js +1 -0
  19. package/dist/components/markdown-directives.d.ts +16 -0
  20. package/dist/components/markdown-directives.js +34 -0
  21. package/dist/components/objective-errors.d.ts +30 -0
  22. package/dist/components/objective-errors.js +113 -0
  23. package/dist/components/spellcheck-assets/dictionary-en-us.txt +104743 -0
  24. package/dist/components/spellcheck-assets/spellchecker-wasm-LICENSE.txt +21 -0
  25. package/dist/components/spellcheck-assets/spellchecker-wasm.wasm +0 -0
  26. package/dist/components/spellcheck-worker.d.ts +80 -0
  27. package/dist/components/spellcheck-worker.js +161 -0
  28. package/dist/components/spellcheck.d.ts +146 -0
  29. package/dist/components/spellcheck.js +541 -0
  30. package/dist/components/tidy-categorize.d.ts +67 -0
  31. package/dist/components/tidy-categorize.js +392 -0
  32. package/dist/components/tidy-diff.d.ts +60 -0
  33. package/dist/components/tidy-diff.js +147 -0
  34. package/dist/components/tidy-validate.d.ts +37 -0
  35. package/dist/components/tidy-validate.js +174 -0
  36. package/dist/content/compose.d.ts +1 -1
  37. package/dist/content/compose.js +11 -0
  38. package/dist/content/site-dictionary.d.ts +31 -0
  39. package/dist/content/site-dictionary.js +82 -0
  40. package/dist/content/types.d.ts +25 -0
  41. package/dist/doctor/checks-local.d.ts +1 -0
  42. package/dist/doctor/checks-local.js +55 -6
  43. package/dist/doctor/index.js +2 -1
  44. package/dist/log/events.d.ts +1 -1
  45. package/dist/media/bulk-delete-plan.d.ts +24 -0
  46. package/dist/media/bulk-delete-plan.js +25 -0
  47. package/dist/media/orphan-scan.d.ts +37 -0
  48. package/dist/media/orphan-scan.js +42 -0
  49. package/dist/media/reconcile.d.ts +3 -0
  50. package/dist/media/reconcile.js +3 -2
  51. package/dist/nav/site-config.d.ts +98 -0
  52. package/dist/nav/site-config.js +132 -0
  53. package/dist/sveltekit/admin-dispatch.d.ts +2 -0
  54. package/dist/sveltekit/admin-dispatch.js +6 -2
  55. package/dist/sveltekit/cairn-admin.d.ts +16 -1
  56. package/dist/sveltekit/cairn-admin.js +28 -3
  57. package/dist/sveltekit/content-routes.d.ts +171 -4
  58. package/dist/sveltekit/content-routes.js +597 -3
  59. package/dist/sveltekit/index.d.ts +1 -1
  60. package/dist/sveltekit/tidy-prompt.d.ts +11 -0
  61. package/dist/sveltekit/tidy-prompt.js +118 -0
  62. package/package.json +10 -1
  63. package/src/lib/components/CairnAdmin.svelte +3 -0
  64. package/src/lib/components/CairnMediaLibrary.svelte +1101 -27
  65. package/src/lib/components/CairnTidySettings.svelte +553 -0
  66. package/src/lib/components/EditPage.svelte +371 -2
  67. package/src/lib/components/MarkdownEditor.svelte +168 -1
  68. package/src/lib/components/TidyReview.svelte +463 -0
  69. package/src/lib/components/admin-icons.ts +1 -0
  70. package/src/lib/components/cairn-admin.css +25 -0
  71. package/src/lib/components/editor-tidy.ts +241 -0
  72. package/src/lib/components/index.ts +1 -0
  73. package/src/lib/components/markdown-directives.ts +35 -0
  74. package/src/lib/components/objective-errors.ts +155 -0
  75. package/src/lib/components/spellcheck-assets/dictionary-en-us.txt +104743 -0
  76. package/src/lib/components/spellcheck-assets/spellchecker-wasm-LICENSE.txt +21 -0
  77. package/src/lib/components/spellcheck-assets/spellchecker-wasm.wasm +0 -0
  78. package/src/lib/components/spellcheck-worker.ts +279 -0
  79. package/src/lib/components/spellcheck.ts +679 -0
  80. package/src/lib/components/tidy-categorize.ts +460 -0
  81. package/src/lib/components/tidy-diff.ts +196 -0
  82. package/src/lib/components/tidy-validate.ts +202 -0
  83. package/src/lib/content/compose.ts +11 -1
  84. package/src/lib/content/site-dictionary.ts +84 -0
  85. package/src/lib/content/types.ts +25 -0
  86. package/src/lib/doctor/checks-local.ts +59 -5
  87. package/src/lib/doctor/index.ts +2 -0
  88. package/src/lib/log/events.ts +9 -1
  89. package/src/lib/media/bulk-delete-plan.ts +54 -0
  90. package/src/lib/media/orphan-scan.ts +74 -0
  91. package/src/lib/media/reconcile.ts +3 -2
  92. package/src/lib/nav/site-config.ts +197 -0
  93. package/src/lib/sveltekit/admin-dispatch.ts +7 -3
  94. package/src/lib/sveltekit/cairn-admin.ts +38 -4
  95. package/src/lib/sveltekit/content-routes.ts +795 -7
  96. package/src/lib/sveltekit/index.ts +1 -0
  97. package/src/lib/sveltekit/tidy-prompt.ts +153 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,90 @@
2
2
 
3
3
  All notable changes to this project are recorded here, most recent first.
4
4
 
5
+ ## 0.60.0
6
+
7
+ <!-- release-size: minor -->
8
+
9
+ The editor learns to copy-edit. Two features land together on the markdown source: a spellcheck that
10
+ runs as you write, and an opt-in tidy that reads a draft once with a language model and proposes a
11
+ light copy-edit you review before any of it lands.
12
+
13
+ Spellcheck is on by default. Misspelled words pick up a quiet amber underline, and the correction
14
+ popover offers ranked suggestions, an add-to-dictionary action, and an ignore-for-this-session
15
+ action, all keyboard-reachable. It runs locally on a Web Worker, so no text leaves the browser, and
16
+ it reads the markdown structure: code, links, frontmatter, layout-block machinery, and `media:`
17
+ tokens are never flagged. A second quiet layer catches the objective slips spellcheck misses: a
18
+ doubled word, a double space inside a line, a stray run of punctuation. The dialect is declared once
19
+ per site under `spellcheck.dialect` (default `en-us`), so a British site loads the British word list
20
+ and "colour" reads as correct. The personal dictionary is a git-committed file at
21
+ `src/content/.cairn/dictionary.txt`, so a word one editor adds is shared with the rest through the
22
+ same commit pipeline the content uses.
23
+
24
+ Tidy is opt-in and off until a developer enables it. When on, an editor runs it over the whole
25
+ document or a selection, and cairn reads the draft once through the Anthropic API and computes the
26
+ diff locally. The review is a step-in diff dialog: insertions show in green, deletions struck through
27
+ in red, and the author's original stays in the buffer until they apply. Objective fixes come pre-kept;
28
+ a judgment edit (a configured style normalization, a grammar reword) carries a review-this treatment
29
+ and a plain-language reason, and it is not swept by Accept fixes until confirmed. The prompt is built
30
+ from the site's own convention config and never harmonizes to the author's habits or guesses an
31
+ undeclared style, so an author's voice is preserved. Output is validated as a proofread, not a
32
+ restructure: a result that changes the heading structure, the frontmatter, a `media:` token, a code
33
+ block, or more than a bounded fraction of the wording is discarded with an honest message and the
34
+ document is left untouched. Conventions are edited in a two-tier settings screen and stored in the
35
+ committed site config under `tidy.conventions`.
36
+
37
+ New dependencies: `@codemirror/lint` (the surfacing layer for both spellcheck and the objective-error
38
+ underlines), `@anthropic-ai/sdk` (the Worker-side tidy model call, guarded off the client), and
39
+ `spellchecker-wasm` plus its bundled English dictionary asset (the spellcheck engine, delivered from
40
+ the packaged `dist` so the Worker and the word list reach a consumer build).
41
+
42
+ No consumer action is required for an existing site. Both features are additive. Spellcheck replaces
43
+ the browser's native spell checking with cairn's own, so an upgrading editor sees the new amber
44
+ underline and the in-editor correction popover in place of the browser's right-click menu, with no
45
+ config change needed. Tidy gives a site nothing until a developer turns it on: set `tidy.enabled: true`
46
+ in the site config, add the `ANTHROPIC_API_KEY` Worker secret, and optionally pick a model and
47
+ conventions. `cairn doctor` checks that the key is configured once tidy is enabled. The editor
48
+ walkthrough is in [write in the editor](docs/guides/write-in-the-editor.md), the developer setup is in
49
+ [enable tidy and the editor copy-edit](docs/guides/enable-tidy.md), and the design rationale is in
50
+ [the editor copy-edit](docs/explanation/editor-copyedit.md).
51
+
52
+ ## 0.59.0
53
+
54
+ <!-- release-size: minor -->
55
+
56
+ The Media Library learns to clear out images in bulk and to collect the files nothing uses any more.
57
+ Two surfaces ship together, sharing one safety floor: a strict cross-branch usage index built fresh
58
+ per action, and a refusal that commits nothing when usage cannot be verified.
59
+
60
+ Multi-select lands in both the grid and the table. Tick the images you mean, a sticky bar shows the
61
+ count, and one Delete runs the single safe-delete gate across the whole selection. cairn deletes the
62
+ assets nothing references and skips any still in use, reporting them rather than force-deleting one.
63
+ The batch is one commit that removes the manifest rows before the R2 objects, so a bulk delete is
64
+ recoverable from git history the same way a single safe-delete is. The dialog is a plain confirm with
65
+ the count, since nothing in use can be removed this way.
66
+
67
+ Find orphaned files collects stored bytes that drifted loose from content. It pairs a storage
68
+ reconcile with a strict usage read and reports two populations. Orphaned files are stored R2 bytes
69
+ with no manifest row and no reference anywhere across `main` and every open branch; a branch-only
70
+ upload is excluded, because the branch that uploaded it still references it. Broken references are the
71
+ reverse, a manifest row whose bytes are gone, shown as a read-only data-integrity readout with no
72
+ delete. The scan fails closed at detection: a branch it cannot read produces no result and an offer
73
+ to check again, rather than a half-answer that might call an in-use file orphaned.
74
+
75
+ The byte purge is the one irreversible media action. Everything else in the Library edits git-tracked
76
+ state and can be walked back from history, but raw R2 bytes carry no git record, so a purge cannot be
77
+ undone. It gates on a typed-count confirm, and at action time it re-derives the orphan set and
78
+ re-checks the strict usage index, so a key claimed by a new manifest row or referenced on a branch
79
+ since the scan is skipped, never purged. The shipped "Unused" triage facet is renamed to "No
80
+ references found", with the raw-HTML caveat stated where an editor acts: absence of a found reference
81
+ is not proof of disuse, since cairn cannot see an image hidden in raw HTML or a URL hardcoded in a
82
+ template.
83
+
84
+ No consumer action is required. The whole surface is admin-side and additive, with no public surface
85
+ change and no content-format change. An editor walkthrough is in
86
+ [manage the media library](docs/guides/manage-the-media-library.md), and the design rationale is in
87
+ [media storage](docs/explanation/media-storage.md).
88
+
5
89
  ## 0.58.0
6
90
 
7
91
  <!-- release-size: minor -->
@@ -14,6 +14,7 @@ mount inside `AdminLayout`. No styling or wrapper elements of its own.
14
14
  import ManageEditors from './ManageEditors.svelte';
15
15
  import NavTree from './NavTree.svelte';
16
16
  import CairnMediaLibrary from './CairnMediaLibrary.svelte';
17
+ import CairnTidySettings from './CairnTidySettings.svelte';
17
18
  import type { AdminData } from '../sveltekit/cairn-admin.js';
18
19
  import type { ContentFormFailure } from '../sveltekit/content-routes.js';
19
20
  import type { ComponentRegistry } from '../render/registry.js';
@@ -69,6 +70,8 @@ mount inside `AdminLayout`. No styling or wrapper elements of its own.
69
70
  <NavTree data={data.page} />
70
71
  {:else if data.view === 'media'}
71
72
  <CairnMediaLibrary data={data.page} {form} />
73
+ {:else if data.view === 'settings'}
74
+ <CairnTidySettings data={data.page} />
72
75
  {/if}
73
76
  </AdminLayout>
74
77
  {/if}