Repository navigation
feat(ui,core): in-document question blocks — core + ui (PR 1) - #1637
Merged
Merged
Conversation
…(PR 1) Adds @plannotator/core/question-block (parser, stable key, answer validator, export section, authoring guide) and the approved Card QuestionBlock in @plannotator/ui, wired through BlockRenderer/Viewer with one optional Viewer prop (onAnswerQuestion). Answers are stored as one annotation carrying questionAnswer; the highlighter skips them and the three exporters print an Answers section before numbered feedback. Minimal editor hook (useQuestionAnswers) wires the Viewer prop in Plannotator so the feature works end to end; history, the progress chip and agent framing are PR 2/3. core 0.25.8, ui 0.48.0.
…a note A note-only answer on a settled question replaced the settled selection with the answer's empty one, so the [x] radio unchecked and the status dropped to Open. The settled choice now stays drawn until the reviewer picks, fills Other or skips.
This was referenced Sep 29, 2026
Merged
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 1 of the approved question/answer components feature (
.product/approved/qa-components/: SPEC §8 PR 1, with the owner's approval.md decisions applied). It covers core and ui. Editor polish, agent prompts, SKILL.md and WebMCP are PR 2/3.What this adds
@plannotator/core/question-block(new subpath, pure;packages/shared/question-block.tsshim)parseQuestionBlock: the:::question/:::question-multi/:::question-textgrammar. It reuses the prototype parser (archive/grillsheet-prototype, fd31a196) with the §3.4 changes:[x]means settled.Recommended:is the primary marker. The arrow forms are aliases.*/+/1.markers, plain bullets, continuation lines,**Recommended:**,label — reason, and multi lists.nulland never throws.indexQuestionBlocks(numbering, prompt line, de-duplicated keys) andquestionKey(q-+ hash8).QuestionAnswer, with the fail-closed and cappedparseQuestionAnswer.formatQuestionAnswersSectionand helpers,buildQuestionAnswerAnnotation.QUESTION_AUTHORING_GUIDE.@plannotator/uicomponents/blocks/QuestionBlock.tsx: the approved Card.annotation-exclude.BlockRenderer/Viewerwiring.Viewergains one optional prop,onAnswerQuestion?(blockId, answer | null, key), and draws answers from its existingannotationsprop. With no prop, or underreadOnly, the cards are read-only. An unparseable block falls back to the existingCallout. Older ui versions show:::questionas a callout through the untouched directive path.Annotation.questionAnswer(types).utils/questionAnswersprovidesupsertQuestionAnswerAnnotationandcollectQuestionAnswersfor hosts.questionAnswerrows.exportAnnotations,exportLinkedDocAnnotationsandexportAnnotationEntry. It comes first, and answers are excluded from the feedback count.0.25.8exactly. Publish core first. Nothing is published here.Minimal editor hook, used only to show the feature working:
packages/editor/hooks/useQuestionAnswers.tspassesonAnswerQuestionto the main Viewer and upserts the annotation. Answers draw, autosave in the draft, restore on reload, and export on Send Feedback. It has no undo history, progress chip, Send answers framing or Questions panel section. Those are PR 2.Evidence
[x],Recommended:, the free-text form, malformed blocks.bun test packages/ui packages/core packages/editor: 1539 pass.test.yml.tsconfig.strict-consumer.json, which now lists the new files.smoke:packagepasses:@plannotator/ui@0.48.0with@plannotator/core@0.25.8.bun run --cwd apps/review build && bun run build:hook. I then ranbun run apps/hook/server/index.ts annotate offline-sync.md(5 questions) and drove it in headless Chromium (--use-mock-keychain --password-store=basic):answered,answered,answered,skipped,settled.Screenshots
The images are hosted on the
assets/qa-components-pr1branch. Delete that branch after review.Drag across option text: this selects text and shows the annotation toolbar. It does not pick the option.
Deviations and decisions to review
[x]and the reviewer left alone is not counted in "N of M" and is not listed under Unanswered. The count line then adds "1 already settled in the document was left as is." The SPEC does not say how to count these.onAnswerQuestiontakes a third argument,key. The SPEC signature is(blockId, answer | null). The key is needed to remove an answer whenansweris null. The change is additive.buildQuestionAnswerAnnotationreturns a structural record withtype: 'COMMENT'. The ui-typed version isquestionAnswerToAnnotationinutils/questionAnswers, because a string literal is not assignable to theAnnotationTypeenum.aria-labelledbypointing at the visible prompt, not a<legend>, so the prompt stays annotatable document text.color-scheme, so radios and checkboxes are dark in dark mode.guide-viewer-manifest.tspins a new CSS hash.check:manifestpasses. Deploy guides.show before a release that ships this.Left for PR 2 (editor)
annotationOwnsHighlight/repaintHighlights/applyEditedDocumentshould treatann-question-*likeann-checkbox-*.feedbackLoss"answers" copy.PR 3 covers the
plan.answeredprompt (both runtimes), the SKILL.md section written fromQUESTION_AUTHORING_GUIDEwith a freshness test, the PFM paragraph, the feedback-archivequestionAnswerfield, and read-only WebMCPquestions.