Repository navigation
Add checked definitions, glossary links, and optional previews - #98
Conversation
Add an opt-in, alpha package for glossary definition data. It needs only the core dependencies (stdlib, markdown-it-py, mdit-py-plugins), and `import kpress` does not load it. - records: frozen records (Alternate, SourceRef, DefinitionGroup, DefinitionEntry, DefinitionSet, DefinitionDiagnostic) and the version 1 JSON interchange. parse_definitions and load_definitions check shape only and reject unknown keys at every level, duplicate JSON keys (with the key path), wrong types, non-standard constants, and other versions. KPressDefinitionsError carries every diagnostic. - check: check_definitions runs the semantic checks (ids, duplicate ids and groups, unknown and self references, blank text, alternates, and http(s)-only link safety) in a deterministic order. - grammar: the defining-sentence emphasis check. short_definition must bold exactly expected_defined_forms(entry), parsed like KPress prose so escapes, code spans, and math never count as bold; detail and notation must not use bold; raw HTML bold is reported. - contract: MODULE_ID, STABILITY, SCHEMA_VERSION, PUBLIC_API, and the DIAGNOSTIC_CODES the checker can emit. None of it joins kpress.contract. Tests cover every declared code, the round trip, ordering, and the import boundary (no publisher, PDF, optimizer, Playwright, or CLI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
`kpress definitions check FILE [--format text|json]` loads and checks a
version 1 JSON definition file. It exits 0 when no diagnostic is an
error, 1 when one is, and 2 when the file cannot be read (argparse
invocation errors also exit 2).
Text output prints one line per diagnostic to stdout, as
`FILE: <location or entry id>: <code>: <message> [field]` with control
characters escaped, and a one-line summary to stderr. JSON output prints
`{"file", "diagnostics", "ok"}` to stdout. The handler imports
kpress.definitions lazily, so other commands never load it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
…initions DefinitionsModule adds ::: glossary and ::: term <id> entries with authored anchors, [text](term:<id>) links that resolve on the page or to glossary_href, anchor collision diagnostics, and an optional preview: a sanitized page-local pool plus a native ESM behavior that opens from the dotted-underlined term link on hover or keyboard focus. Pages without term syntax are byte-identical. Docs, the using-kpress skill (with a mirror drift check), and kpress.yml format.modules.definitions are included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Paper 1's glossary showed two needs. An entry such as "Kernel and Image" bolds kernel and image rather than its title, so records gain an optional defined_form for the primary bold form. Published glossary URLs point at headings, so each entry heading now carries the authored anchor, reserved ahead of slugging; a same-named ordinary heading gets a numbered suffix. Docs follow the link-triggered preview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
…initions # Conflicts: # docs/modules/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
…e fences
From the ojoshe sample page: the guide's load_definitions("glossary.json") call
read the str as JSON text, and the typed API never ran the checker. from_file reads
a path, runs check_definitions, and raises KPressDefinitionsError on errors (the
kpress.yml factory now uses it and reports unreadable files). The guide shows
blank lines inside fences, which Flowmark otherwise joins into one line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
From the Paper 1 adoption: - Records gain an optional teaching_label, so a shared glossary can say which paper its backlink goes to without host string rewriting. - Preview panels reset the term's inline formatting (no all-bold previews under a bold term link). - The landing scroll margin sits on the anchored entry heading. - Preview math is typeset with KaTeX on first open; the template pool was never reached by the page's KaTeX pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5kBhCB4ov4f4pDq8Am3VT
…ress-consolidation
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
…ex/kpress-consolidation
jlevy
left a comment
There was a problem hiding this comment.
Review A (senior engineering review, round 1) · head 75fcf57 · base claude/kpress-v040-devices at de875ee
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 84-file layer. Changed runtime and primary contracts; research captures and peripheral docs inventoried.
Tests run: Runtime code and primary contracts reviewed. Research captures and peripheral docs were inventoried. Pinned checker tests passed 209 cases with four scratch-dependent cases excluded.
- A1 · Low — An interrupted static example rebuild can leave a partially written page or asset. Reuse the atomic writer for individual files. Example build
jlevy
left a comment
There was a problem hiding this comment.
Review B (security review, round 1) · head 75fcf57 · base claude/kpress-v040-devices at de875ee
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 84-file layer. Changed runtime and primary contracts; research captures and peripheral docs inventoried.
Tests run: Defensive review of strict JSON, URL policy, container matching, sanitization, and preview insertion. Pinned parser and sanitizer probes passed 13 cases.
No security findings. Preview bodies pass through the document sanitizer and native term links retain stable destinations.
jlevy
left a comment
There was a problem hiding this comment.
Review C (correctness review, round 1) · head 75fcf57 · base claude/kpress-v040-devices at de875ee
Reviewer: strong tier, requested gpt-6-astra at xhigh · Channel: formal review
Coverage: 84-file layer. Changed runtime and primary contracts; research captures and peripheral docs inventoried.
Tests run: Pinned render probes covered link references, footnotes, task lists and source URLs.
- C1 · Medium — Generated entries go through the complete parser with a disposable environment before the document parses their inlines again. Reference definitions are lost, a footnote can become orphaned, and task markers can disappear before checkbox tokens are emitted. Parse entry blocks into the document environment before the shared inline pass. Snippet parser
- C2 · Medium — A checked source URL containing a closing parenthesis loses part of its destination when emitted as a bare Markdown link. Serialize the escaped destination inside angle brackets. Source-link rendering
|
Dispositions for review A at
|
|
Dispositions for review C at
|
KPress stack #100 · Layer 3 of 8
Previous layer #97 · Next layer #101 · Whole-stack guide and latest build
Versioned checked records feed the same glossary entries, authored anchors, native term links, and optional previews. Preview teardown cancels queued hover, drops listeners, and preserves independently bound roots. The module demo connects structural and iconic devices to its checked glossary and includes a plain Markdown control.
The final review hardened glossary URLs and anchor collision checks, preserved related-term links inside previews, isolated repeated term IDs across embedded articles, and made Escape dismiss pointer-opened previews.
The research follow-up preserves the original Ojoshe evidence and updates both module designs after an independent Astra review and new GitHub rendering probes. It records portable source choices, the device interchange fidelity gap, definitions grammar differences, and touch interaction decisions.
This layer adopts the shared paired
<k-block>language across the devices and definitions modules. It replaces the earlier optional-module fences, moves module designs beside their code, rewrites the delivery and capability plan, and publishes five sample pages with isolated and combined coverage.The delivery plan now records the verified alpha, its adopted decisions, and the remaining implementation and review work in Beads under kpr-dutr. The planning-only revision leaves the verified runtime pin at
1e7de36.This layer introduces the explainer. PR #101 develops it into the source-backed publication and consolidates inspection into Rendered, Source, and HTML. Epic
kpr-xlsftracks the publication.The authoring and design material now lives in one reference per module. The integration skill and maintained documentation follow the common doc guidelines.