@panaversity/ksor 0.0.42 → 0.0.43

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,58 @@
1
1
  # @panaversity/ksor
2
2
 
3
+ ## 0.0.43
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ecfd78: **A document page that reads at a glance, and a dev server that sees new
8
+ documents again.**
9
+
10
+ The governance row is two tiers. It was one line carrying 79 characters, of
11
+ which the approver was 32 (41%) and the three labels 19 (24%) — so a producer
12
+ id was the longest thing on the page and the two facts a reader actually scans
13
+ for, what state this is in and whether anyone has checked it, competed with it.
14
+ Now the chips lead with Export beside them, and provenance sits beneath in
15
+ muted weight. Nothing is hidden: decision 21 requires a governance act to name
16
+ its actor and decision 27 requires a non-human approver to be disclosed, so the
17
+ approver moved one line down, not one click away, and every byte of it is still
18
+ in the server-rendered markup an agent parses.
19
+
20
+ Export no longer lands in the middle of the row. It and the reading time each
21
+ carried their own `ms-auto`, and on a row narrow enough to wrap they shared a
22
+ line — where two auto margins SPLIT the free space rather than stacking. They
23
+ are one right-hand cluster now.
24
+
25
+ **And adding a document to `knowledge/` while `pnpm dev` runs shows it again.**
26
+ This regressed in 0.0.41: `refreshStage` walked the STAGE and skipped anything
27
+ the stage did not already hold, so an arrival — which has no file to walk onto
28
+ — was never written, and the manifest naming what publishes never learned about
29
+ it. Measured: `/docs/<new>/` 404 → 200, sidebar 0 → 1, `llms.txt` 0 → 1;
30
+ 0.0.40 served it at 200, so this is a repair rather than a feature. Removals
31
+ still wait for a restart, deliberately — a deleted file leaves fumadocs'
32
+ generated imports pointing at something gone.
33
+
34
+ The comment explaining why arrivals were refused was also wrong, and is
35
+ corrected: fumadocs-mdx 15.3.0 DOES regenerate on a write into the
36
+ dot-prefixed stage. Our own function was the blocker.
37
+
38
+ Finally, the starter's `knowledge/surfaces/overview.md` was titled `Surfaces`
39
+ inside the Surfaces section, so its breadcrumb read `Surfaces › Surfaces`. It
40
+ is `Overview` now.
41
+
42
+ - 9ecfd78: **Two fixes on the document page.**
43
+
44
+ The governance row put **Export** in the middle of the row with nothing under
45
+ it. Export and the reading time each carried their own `ms-auto`, and on a row
46
+ narrow enough to wrap they landed on the same line — where two auto margins
47
+ SPLIT the free space between them rather than stacking, so Export came to rest
48
+ mid-row instead of at either end. They are now one right-hand cluster and
49
+ travel together at every width.
50
+
51
+ And the starter's `knowledge/surfaces/overview.md` was titled `Surfaces` inside
52
+ a section already called Surfaces, so its breadcrumb read `Surfaces › Surfaces`
53
+ and the sidebar showed a Surfaces inside Surfaces. It is titled `Overview` now,
54
+ matching its filename, and the generated section index was regenerated with it.
55
+
3
56
  ## 0.0.42
4
57
 
5
58
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panaversity/ksor",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
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",
@@ -1,5 +1,5 @@
1
1
  # Surfaces
2
2
 
3
- * [Surfaces](overview.md) - One source, published through several synchronized projections.
3
+ * [Overview](overview.md) - One source, published through several synchronized projections.
4
4
  * [The human surface](for-people.md) - Pages for reading, reviewing and sharing the record.
5
5
  * [The agent surface](for-agents.md) - MCP for retrieval with citations, and machine-readable files beside it.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  type: Document
3
- title: Surfaces
3
+ title: Overview
4
4
  description: One source, published through several synchronized projections.
5
5
  status: stable
6
6
  order: 4
@@ -216,104 +216,132 @@ export function GovernanceMeta({
216
216
  // tier, `unverified` included, and that is the whole point of printing it.
217
217
  // The early return this replaced would have hidden the tier on exactly the
218
218
  // documents whose tier is the only governance fact they have.
219
+ /**
220
+ * TWO TIERS, because the row's length was never its vocabulary.
221
+ *
222
+ * Measured on the starter's own document: 79 characters, of which the
223
+ * APPROVER is 32 (41%) and the three labels 19 (24%). One producer id was
224
+ * longer than both governance chips together, so the two facts a reader
225
+ * scans for — what state is this in, and has anyone checked it — competed
226
+ * with a string that means nothing to them, and Export was pushed onto a
227
+ * line of its own.
228
+ *
229
+ * So the chips lead and the provenance follows beneath them. Nothing is
230
+ * hidden: decision 21 says a governance act NAMES its actor and decision
231
+ * 27's starter revision requires a non-human approver to be DISCLOSED, so
232
+ * demoting `ksor.approval` to a hover would trade a governance guarantee
233
+ * for a tidier row (critical rule 1). It is one line lower, not one click
234
+ * away, and every byte of it is still in the server-rendered markup an
235
+ * agent parses.
236
+ */
219
237
  return (
220
- <dl className="mb-7 flex flex-wrap items-baseline gap-x-8 gap-y-2.5 border-b border-fd-border pb-4">
221
- {state === null && alsoBadge === null ? null : (
222
- <Fact label="Status">
223
- <span className="flex flex-wrap items-baseline gap-1.5">
224
- {state === null ? null : <Chip text={state} tone={statusTone(status)} />}
225
- {alsoBadge === null ? null : (
226
- <BadgeChip badge={alsoBadge} effectiveFrom={effectiveFrom} />
227
- )}
228
- </span>
229
- </Fact>
230
- )}
231
- {/* The tier OKF's own vocabulary names, on every document including the
238
+ <div className="mb-7 border-b border-fd-border pb-4">
239
+ <dl className="flex flex-wrap items-baseline gap-x-8 gap-y-2.5">
240
+ {state === null && alsoBadge === null ? null : (
241
+ <Fact label="Status">
242
+ <span className="flex flex-wrap items-baseline gap-1.5">
243
+ {state === null ? null : <Chip text={state} tone={statusTone(status)} />}
244
+ {alsoBadge === null ? null : (
245
+ <BadgeChip badge={alsoBadge} effectiveFrom={effectiveFrom} />
246
+ )}
247
+ </span>
248
+ </Fact>
249
+ )}
250
+ {/* The tier OKF's own vocabulary names, on every document including the
232
251
  unverified ones — that is the honest state of a stable, approved
233
252
  concept nobody has reviewed, and hiding it would leave a reader unable
234
253
  to tell "checked" from "never mentioned" (research/okf-native.md
235
254
  §1.1). Never a colour: a tier is a fact about review, not a warning. */}
236
- <Fact label="Trust">
237
- <span className="flex flex-wrap items-baseline gap-1.5">
238
- <Chip text={trust.tier} />
239
- {trust.by === null ? null : (
240
- <span className="font-normal text-fd-muted-foreground">
241
- {trust.by}
242
- {trust.at === null ? null : <> · {day(trust.at)}</>}
243
- </span>
244
- )}
245
- </span>
246
- </Fact>
247
- {owner === null ? null : <Fact label="Owner">{owner}</Fact>}
248
- {/* Who let this into the record. `ksor.approval` is what makes a `stable`
255
+ <Fact label="Trust">
256
+ <span className="flex flex-wrap items-baseline gap-1.5">
257
+ <Chip text={trust.tier} />
258
+ {trust.by === null ? null : (
259
+ <span className="font-normal text-fd-muted-foreground">
260
+ {trust.by}
261
+ {trust.at === null ? null : <> · {day(trust.at)}</>}
262
+ </span>
263
+ )}
264
+ </span>
265
+ </Fact>
266
+ {/* Actions ride tier ONE: a reader who wants the bytes wants them
267
+ immediately, and this is the row with room. */}
268
+ {markdownUrl === undefined && minutes === undefined ? null : (
269
+ <div className="ms-auto flex items-center gap-x-6">
270
+ {markdownUrl === undefined ? null : <DocumentActions href={markdownUrl} />}
271
+ {minutes === undefined ? null : (
272
+ <div className="flex items-center gap-2 text-sm text-fd-muted-foreground">
273
+ <Clock aria-hidden className="size-3.5 shrink-0" />
274
+ <span>{minutes} min read</span>
275
+ </div>
276
+ )}
277
+ </div>
278
+ )}
279
+ </dl>
280
+ {/* Tier two RECEDES. It is provenance — who let this in, when it takes
281
+ effect, what it replaced — and it is read when a reader goes looking,
282
+ not scanned. At full `--foreground` weight it competed with the two
283
+ chips above it for the same attention, which is what made a producer
284
+ id the loudest thing on the page.
285
+
286
+ Links keep full strength: `Replaces` points at the document this one
287
+ superseded, and that is an action rather than a fact. */}
288
+ <dl className="mt-2.5 flex flex-wrap items-baseline gap-x-8 gap-y-2.5 empty:mt-0 [&_a]:text-fd-foreground [&_dd]:font-normal [&_dd]:text-fd-muted-foreground">
289
+ {owner === null ? null : <Fact label="Owner">{owner}</Fact>}
290
+ {/* Who let this into the record. `ksor.approval` is what makes a `stable`
249
291
  document stable at all (record spec §2.2), so a page that showed the
250
292
  word and not the signature would be publishing the claim without its
251
293
  author. */}
252
- {approval === null ? null : (
253
- <Fact label="Approved">
254
- <>
255
- {approval.by} · {day(approval.at)}
256
- </>
257
- </Fact>
258
- )}
259
- {/* found live 2026-08-25: a deprecated page named its successor and said
294
+ {approval === null ? null : (
295
+ <Fact label="Approved">
296
+ <>
297
+ {approval.by} · {day(approval.at)}
298
+ </>
299
+ </Fact>
300
+ )}
301
+ {/* found live 2026-08-25: a deprecated page named its successor and said
260
302
  nothing about WHO withdrew it, though `ksor.deprecated` is required on
261
303
  every deprecated concept (record spec §2.2) and readGovernance already
262
304
  refuses a document that omits it. Withdrawal is the most consequential
263
305
  act in a document's life; publishing it unattributed is exactly the
264
306
  gap the approver fact above closes at the other end. */}
265
- {deprecated === null ? null : (
266
- <Fact label="Withdrawn">
267
- <>
268
- {deprecated.by} · {day(deprecated.at)}
269
- </>
270
- </Fact>
271
- )}
272
- {replaces.length === 0 ? null : (
273
- // The other half of a supersession. The withdrawn document names its
274
- // successor above the title; this is the successor naming what it
275
- // replaced, so the history the record kept is reachable from the
276
- // current document instead of only from the retired one.
277
- <Fact label="Replaces">
278
- <>
279
- {replaces.map((entry, index) => (
280
- <span key={entry.href ?? `${index}-${entry.label}`}>
281
- {index === 0 ? null : ", "}
282
- {entry.href === null ? (
283
- entry.label
284
- ) : (
285
- <Link
286
- href={entry.href}
287
- className="underline underline-offset-4 transition-colors hover:text-fd-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fd-ring"
288
- >
289
- {entry.label}
290
- </Link>
291
- )}
292
- </span>
293
- ))}
294
- </>
295
- </Fact>
296
- )}
297
- {effectiveFrom === null || !showEffective ? null : (
298
- <Fact label="Effective from">{day(effectiveFrom)}</Fact>
299
- )}
300
- {staleAfter === null ? null : <Fact label="Review by">{day(staleAfter)}</Fact>}
301
- {markdownUrl === undefined ? null : (
302
- // On the governance row, not as a footnote below the sources: it is
303
- // how a reader hands this document to an agent (research/site-design.md
304
- // F2). Right-aligned: a column of things you DO, against a row of
305
- // things the record DECLARES (owner, 2026-08-22).
306
- <span className="ms-auto">
307
- <DocumentActions href={markdownUrl} />
308
- </span>
309
- )}
310
- {minutes === undefined ? null : (
311
- <div className="ms-auto flex items-center gap-2 text-sm text-fd-muted-foreground">
312
- <Clock aria-hidden className="size-3.5 shrink-0" />
313
- <span>{minutes} min read</span>
314
- </div>
315
- )}
316
- </dl>
307
+ {deprecated === null ? null : (
308
+ <Fact label="Withdrawn">
309
+ <>
310
+ {deprecated.by} · {day(deprecated.at)}
311
+ </>
312
+ </Fact>
313
+ )}
314
+ {replaces.length === 0 ? null : (
315
+ // The other half of a supersession. The withdrawn document names its
316
+ // successor above the title; this is the successor naming what it
317
+ // replaced, so the history the record kept is reachable from the
318
+ // current document instead of only from the retired one.
319
+ <Fact label="Replaces">
320
+ <>
321
+ {replaces.map((entry, index) => (
322
+ <span key={entry.href ?? `${index}-${entry.label}`}>
323
+ {index === 0 ? null : ", "}
324
+ {entry.href === null ? (
325
+ entry.label
326
+ ) : (
327
+ <Link
328
+ href={entry.href}
329
+ className="underline underline-offset-4 transition-colors hover:text-fd-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fd-ring"
330
+ >
331
+ {entry.label}
332
+ </Link>
333
+ )}
334
+ </span>
335
+ ))}
336
+ </>
337
+ </Fact>
338
+ )}
339
+ {effectiveFrom === null || !showEffective ? null : (
340
+ <Fact label="Effective from">{day(effectiveFrom)}</Fact>
341
+ )}
342
+ {staleAfter === null ? null : <Fact label="Review by">{day(staleAfter)}</Fact>}
343
+ </dl>
344
+ </div>
317
345
  );
318
346
  }
319
347
 
@@ -670,30 +670,51 @@ function fillStage(recordDir: string, stageDir: string, development: boolean): v
670
670
  }
671
671
 
672
672
  /**
673
- * Dev only: carry edits into the files the stage already holds, so
674
- * `pnpm dev` shows the record as the owner is writing it rather than as it
675
- * stood when the server started — the regenerated indexes included, so a
676
- * retitled document is retitled in its folder's listing too.
673
+ * Dev only: carry edits AND ARRIVALS into the stage, so `pnpm dev` shows the
674
+ * record as the owner is writing it rather than as it stood when the server
675
+ * started — the regenerated indexes included, so a retitled document is
676
+ * retitled in its folder's listing too.
677
677
  *
678
- * Edits only — never adds, never removals. fumadocs' own watcher cannot see
679
- * a dot-prefixed collection directory (measured 2026-08-18: adding a file to
680
- * the stage regenerated nothing, and removing one left the generated imports
681
- * pointing at a file that was gone), so a document that ARRIVES or changes
682
- * audience needs the restart `pnpm dev` already needs for instance.md. Leaving
683
- * that to a restart keeps dev honest in the direction that matters: the
684
- * published build is always staged from scratch.
678
+ * Adds and edits — never removals. The 2026-08-18 measurement this refused
679
+ * adds on ("fumadocs' own watcher cannot see a dot-prefixed collection
680
+ * directory") no longer holds: on fumadocs-mdx 15.3.0 a file written into
681
+ * `.staged-knowledge` DOES regenerate the collection, twice-observed as
682
+ * `[MDX] generated files` in the dev log. What actually kept a new document
683
+ * off every surface was this function, which walked the STAGE and skipped
684
+ * anything the stage did not already hold — so a plan entry with no file on
685
+ * disk was never written, and the manifest that names what publishes never
686
+ * learned about it either.
687
+ *
688
+ * Measured before and after, adding a document while `pnpm dev` ran:
689
+ * `/docs/<new>/` 404 -> 200, sidebar 0 -> 1, `llms.txt` 0 -> 1. It worked
690
+ * this way before the stage existed (0.0.40 serves an added document at 200),
691
+ * so this is a regression repaired rather than a feature.
692
+ *
693
+ * REMOVALS still wait for the restart `pnpm dev` already needs for
694
+ * instance.md: the same measurement found a deleted file leaves fumadocs'
695
+ * generated imports pointing at something gone, which takes the dev server
696
+ * down rather than showing a stale page. An arrival has no such failure mode
697
+ * — nothing points at a file that has only just appeared.
685
698
  */
686
699
  function refreshStage(recordDir: string, stageDir: string): void {
687
700
  // Under the lock like every other write here: a save landing while another
688
701
  // evaluation is refilling the stage is the same race from the other side.
689
702
  withStageLock(stageDir, () => {
690
703
  const plan = planStage(recordDir, true);
691
- const permitted = new Map(plan.entries.map((e) => [path.join(stageDir, e.rel), e] as const));
692
- for (const staged of walkFiles(stageDir)) {
693
- const entry = permitted.get(staged);
694
- if (entry === undefined) continue;
704
+ // Drive from the PLAN, not from the stage. Walking the stage could only
705
+ // ever find what was already there, which is exactly why an arrival was
706
+ // invisible: it has no file to walk onto.
707
+ for (const entry of plan.entries) {
708
+ const staged = path.join(stageDir, entry.rel);
695
709
  const bytes = entry.bytes();
696
- if (bytes.equals(readFileSync(staged))) continue;
710
+ let current: Buffer | null = null;
711
+ try {
712
+ current = readFileSync(staged);
713
+ } catch {
714
+ // Not staged yet — an arrival. Written below.
715
+ }
716
+ if (current !== null && current.equals(bytes)) continue;
717
+ mkdirSync(path.dirname(staged), { recursive: true });
697
718
  writeFileSync(staged, bytes);
698
719
  }
699
720
  writeManifest(stageDir, plan.manifest);