@panaversity/ksor 0.0.60 → 0.0.61

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/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @panaversity/ksor
2
2
 
3
+ ## 0.0.61
4
+
5
+ ### Patch Changes
6
+
7
+ - c8df2a0: `pnpm dev` now drops a document that is deleted or moved while it runs (#274).
8
+
9
+ The dev server keeps a staged copy of the record, and its watcher carried edits
10
+ and new documents into that copy but never removals. A document deleted during
11
+ a review went on answering 200 at its old url and stayed in the sidebar, and a
12
+ moved one was listed twice, once at each path, until the dev server restarted.
13
+ Nothing told the owner to restart.
14
+
15
+ The refresh now removes every staged file the record no longer holds, and every
16
+ folder that leaves empty, so the deleted or moved document answers 404 at its
17
+ old url and leaves the sidebar within about a second. A document whose audience
18
+ is edited so that the dev viewer may no longer read it leaves the same way.
19
+
20
+ Removals were held back because a 2026-08-18 measurement found that deleting a
21
+ staged file took the dev server down. On fumadocs-mdx 15.4.0 and Next 16.3.3
22
+ it recovers on its own, but the race behind it remains: Turbopack can compile
23
+ before fumadocs has regenerated the collection, so the dev log may show
24
+ `Module not found` for the removed file, and a request in that moment can
25
+ answer with a 500. Measured on a fresh scaffold, another page polled every 20ms
26
+ did so one to four times in 6 of 8 removals, then answered 200 again. Builds
27
+ are unaffected: they never run the watcher.
28
+
29
+ An existing project takes the fix with `ksor migrate --write-site`, which
30
+ reissues `system/site/lib/stage-knowledge.ts` with the rest of the site.
31
+
32
+ - 7d2e28a: A new npm or bun scaffold builds its site again.
33
+
34
+ `mdast-util-to-markdown@2.1.3`, published 2026-09-27, broke the MDX stringifier
35
+ of `fumadocs-core@16.15.4`, the version the scaffold pins. Any page with bold or
36
+ italic text sent it into recursion without end, so `npm run build` and
37
+ `bun run build` failed with `RangeError: Maximum call stack size exceeded`
38
+ (fuma-nama/fumadocs#3604). The npm and bun scaffolds ship no lockfile, so a
39
+ fresh install picked up 2.1.3. Their root `package.json` now has
40
+ `"overrides": { "mdast-util-to-markdown": "2.1.2" }`, and their README explains
41
+ it. The pnpm scaffold has not changed, because its committed lockfile already
42
+ holds 2.1.2.
43
+
44
+ If you scaffolded with npm or bun and your build now fails this way, add the
45
+ same `overrides` entry to your root `package.json` and install again. Remove the
46
+ entry when you move `fumadocs-core` to 16.15.15 or later, which has the
47
+ upstream fix.
48
+
3
49
  ## 0.0.60
4
50
 
5
51
  ### Patch Changes
package/dist/cli.mjs CHANGED
@@ -12337,6 +12337,20 @@ const SCRIPT_BODIES = {
12337
12337
  }
12338
12338
  };
12339
12339
  /**
12340
+ * Versions of dependencies of dependencies that npm and bun must be told to
12341
+ * hold, written as `overrides`, which both read. pnpm needs none here: its
12342
+ * committed lockfile already holds each one.
12343
+ *
12344
+ * mdast-util-to-markdown 2.1.3 (2026-09-27) writes bold and italic only
12345
+ * through a handler's `attention`. The MDX stringifier of the fumadocs-core
12346
+ * 16.15.4 that the site pins wraps every handler without it, so the site
12347
+ * build recursed until the stack overflowed (issue #276,
12348
+ * fuma-nama/fumadocs#3604, fixed in fumadocs-core 16.15.15). Remove the entry,
12349
+ * and the README paragraph that explains it, in the change that moves the site
12350
+ * to that Fumadocs: init-manager.integration.test.ts fails until they are gone.
12351
+ */
12352
+ const OVERRIDES = { "mdast-util-to-markdown": "2.1.2" };
12353
+ /**
12340
12354
  * Rewrite the scaffold's root package.json for the manager. Structured — a
12341
12355
  * JSON transform, never string surgery — because the manifest is the one
12342
12356
  * file where a half-applied spelling map would still parse and then lie.
@@ -12351,7 +12365,8 @@ function transformManifest(source, manager) {
12351
12365
  ...parsed.scripts,
12352
12366
  ...SCRIPT_BODIES[manager]
12353
12367
  },
12354
- workspaces: [...WORKSPACE_GLOBS]
12368
+ workspaces: [...WORKSPACE_GLOBS],
12369
+ overrides: { ...OVERRIDES }
12355
12370
  };
12356
12371
  return `${JSON.stringify(out, null, 2)}\n`;
12357
12372
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panaversity/ksor",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "Knowledge System of Record — compile governed markdown into a static site for people and an MCP server for AI agents, with citations and measured abstention.",
5
5
  "keywords": [
6
6
  "abstention",
@@ -94,6 +94,15 @@ never picks up a day-zero compromised release. bun has no equivalent — its
94
94
  default refusal of dependency install scripts covers the OTHER half of that
95
95
  posture, and this sentence is the disclosure.
96
96
 
97
+ <!-- /ksor:pm -->
98
+ <!-- ksor:pm npm bun -->
99
+
100
+ `package.json` also holds one dependency of a dependency back: `overrides`
101
+ keeps `mdast-util-to-markdown` at 2.1.2. With the `fumadocs-core` this scaffold
102
+ pins, version 2.1.3 makes the site build recurse until it runs out of stack
103
+ ([fumadocs#3604](https://github.com/fuma-nama/fumadocs/issues/3604)). Delete the
104
+ override when you move `fumadocs-core` to 16.15.15 or later, which has the fix.
105
+
97
106
  <!-- /ksor:pm -->
98
107
 
99
108
  ---
@@ -672,15 +672,15 @@ function fillStage(recordDir: string, stageDir: string, development: boolean): v
672
672
  }
673
673
 
674
674
  /**
675
- * Dev only: carry edits AND ARRIVALS into the stage, so `pnpm dev` shows the
676
- * record as the owner is writing it rather than as it stood when the server
677
- * started — the regenerated indexes included, so a retitled document is
675
+ * Dev only: carry edits, ARRIVALS and REMOVALS into the stage, so `pnpm dev`
676
+ * shows the record as the owner is writing it rather than as it stood when the
677
+ * server started — the regenerated indexes included, so a retitled document is
678
678
  * retitled in its folder's listing too.
679
679
  *
680
- * Adds and edits — never removals. The 2026-08-18 measurement this refused
681
- * adds on ("fumadocs' own watcher cannot see a dot-prefixed collection
682
- * directory") no longer holds: on fumadocs-mdx 15.3.0 a file written into
683
- * `.staged-knowledge` DOES regenerate the collection, twice-observed as
680
+ * Arrivals first. The 2026-08-18 measurement this refused adds on ("fumadocs'
681
+ * own watcher cannot see a dot-prefixed collection directory") no longer
682
+ * holds: on fumadocs-mdx 15.3.0 a file written into `.staged-knowledge` DOES
683
+ * regenerate the collection, twice-observed as
684
684
  * `[MDX] generated files` in the dev log. What actually kept a new document
685
685
  * off every surface was this function, which walked the STAGE and skipped
686
686
  * anything the stage did not already hold — so a plan entry with no file on
@@ -692,11 +692,23 @@ function fillStage(recordDir: string, stageDir: string, development: boolean): v
692
692
  * this way before the stage existed (0.0.40 serves an added document at 200),
693
693
  * so this is a regression repaired rather than a feature.
694
694
  *
695
- * REMOVALS still wait for the restart `pnpm dev` already needs for
696
- * instance.md: the same measurement found a deleted file leaves fumadocs'
697
- * generated imports pointing at something gone, which takes the dev server
698
- * down rather than showing a stale page. An arrival has no such failure mode
699
- * — nothing points at a file that has only just appeared.
695
+ * REMOVALS used to wait for a restart: the same 2026-08-18 measurement found a
696
+ * deleted file left fumadocs' generated imports pointing at something gone,
697
+ * which took the dev server down. On fumadocs-mdx 15.4.0 and Next 16.3.3 it
698
+ * does not stay down. Measured 2026-10-01 on a fresh scaffold: each document
699
+ * deleted or moved while `pnpm dev` ran regenerated the collection (`[MDX]
700
+ * generated files`), answered 404 at its old url within about a second and
701
+ * left the sidebar, and every other page answered 200 with no restart.
702
+ *
703
+ * What remains is a race, not an outage. Turbopack can compile
704
+ * `.source/server.ts` before fumadocs has rewritten it, so the log shows
705
+ * `Module not found` for the removed file and a request in that window answers
706
+ * 500: another page, polled every 20ms, did so one to four times in 6 of 8
707
+ * removals, then answered 200 again. Both watchers react to the same unlink,
708
+ * so nothing here can order them. Errors that clear themselves are still the
709
+ * better failure: before this, a deleted document went on serving at 200 and
710
+ * stayed in the sidebar, and a moved one was listed twice, until someone
711
+ * thought to restart (issue #274).
700
712
  */
701
713
  function refreshStage(recordDir: string, stageDir: string): void {
702
714
  // Under the lock like every other write here: a save landing while another
@@ -719,6 +731,9 @@ function refreshStage(recordDir: string, stageDir: string): void {
719
731
  mkdirSync(path.dirname(staged), { recursive: true });
720
732
  writeFileSync(staged, bytes);
721
733
  }
734
+ // Removals from the plan too: a staged file the plan no longer holds was
735
+ // deleted, moved, or withdrawn from this viewer, and is not the record.
736
+ pruneExcept(stageDir, new Set(plan.entries.map((e) => path.resolve(stageDir, e.rel))));
722
737
  writeManifest(stageDir, plan.manifest);
723
738
  });
724
739
  }
@@ -867,6 +882,14 @@ function publishSims(sourceDir: string): void {
867
882
  * nothing else writes it), so what is not published now does not belong.
868
883
  */
869
884
  function pruneSims(target: string, published: ReadonlySet<string>): void {
885
+ pruneExcept(target, published);
886
+ }
887
+
888
+ /**
889
+ * Every file under `target` whose resolved path `keep` does not hold, removed,
890
+ * and every directory that leaves empty. `target` itself always stays.
891
+ */
892
+ function pruneExcept(target: string, keep: ReadonlySet<string>): void {
870
893
  const walk = (dir: string): boolean => {
871
894
  let entries;
872
895
  try {
@@ -882,7 +905,7 @@ function pruneSims(target: string, published: ReadonlySet<string>): void {
882
905
  else empty = false;
883
906
  continue;
884
907
  }
885
- if (published.has(path.resolve(here))) {
908
+ if (keep.has(path.resolve(here))) {
886
909
  empty = false;
887
910
  continue;
888
911
  }