Skip to content

feat: pre-fill authors from the host profile; make the preset/Format precedence visible - #40

Merged
SongshGeo merged 7 commits into
mainfrom
dev
Sep 8, 2026
Merged

SongshGeo merged 7 commits into
mainfrom
dev

Conversation

@SongshGeo

Copy link
Copy Markdown

Release candidate for 2.4.0-beta.7. Everything since 2.4.0-beta.6, from PR #39.

Issue What lands
#38 Run Pandoc Export greys out Format while a preset is set, naming the preset and the format it produces (Ignored — the preset "paperbell" decides the output format (PDF).). The Template / preset dropdown labels every entry — paperbell — PDF, manuscript-obsidian — DOCX. A notice covers saved workflows and the headless Run workflow: path. The precedence itself is unchanged.
#30 New paper projects pre-fill creators[0] and the cover letter's corresponding: from the host's v2 profile, per field, and never at the cost of a consent prompt. No host / older host / ungranted scope → today's scaffold byte for byte.
#34 The dev → main merge convention is written into MAINTAINING.mdand this PR is the first one to follow it: squash-merge, please.
#28 The project: key verification, as tests: a Strip Frontmatter unit test, plus a real-pandoc golden for the Cover Letter workflow (the one that keeps the note's frontmatter on purpose). Manual steps still open on the issue.
#33 The "small, independent" half only: subscribe to paperbell:plugins-changed and re-read capabilities. The read API / event bus stays open, blocked on a host decision.
#27 Verified already done and closed — no code.

Plus a quality pass over the above (008c02f): the preset listing split along the *-utils.ts seam MAINTAINING.md documents and covered by tests, the precedence sentence reduced to one declaration with three consumers, leadCreator(ctx) deduplicated across both metadata.json files, and the golden tests' hasBin/ASSETS shared instead of copied a third time.

Why this merge should be squashed

2.4.0-beta.6's changelog carries the same fix twice — once from PR #36's merge commit, once from the original — which is exactly what #34 diagnoses and what this PR documents the fix for.

Verification

npm run build (svelte-check + eslint + rollup) clean; npm run test:unit 485 passed / 2 skipped, including the cover-letter and response-letter goldens, which really run against the local pandoc + pandoc-assets/.

Closes #38
Closes #30
Closes #34

🤖 Generated with Claude Code

https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC

SongshGeo and others added 7 commits September 8, 2026 12:36
Setting Format on a Run Pandoc Export step that also has a preset had no
effect, and nothing said so: the only signal was a console.warn. The
precedence itself is deliberate and documented — this makes it visible.

- The step editor greys the Format control out while a preset is set and
  says which preset decided the format. Declared as a generic
  `disabledBy` / `disabledDescription` pair on CompileStepOption, resolved
  by one shared helper both option renderers now use.
- The Template / preset dropdown labels each preset with what it produces
  (`paperbell — PDF`, `manuscript-obsidian — DOCX`), read from the preset's
  own yaml via the existing exportTargetForDefaults. Best-effort: an
  unreadable preset keeps its bare name.
- A Notice on export covers the paths the editor can't: workflows saved
  before this, and the headless `Run workflow: <name>` command.

Closes #38

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
The verification owed by #25 that unit tests could not close. Two halves,
because the workflows differ:

- Manuscript / SI / Response open with Strip Frontmatter, which drops the
  whole yaml block — asserted directly on the step, for both scene and
  manuscript kinds. It had no test file of its own until now.
- Cover Letter has no such step: its single Run Pandoc Export hands the
  note's frontmatter to pandoc on purpose, since the cover_letter template
  reads to/date/manuscript from it. So that one gets a real pandoc run,
  gated on the assets like the response-letter golden, asserting the
  template does read the frontmatter and that `project:` still emits
  nothing.

Refs #28

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
The `paperbell:plugins-changed` event constant was vendored but never
subscribed. It is the only consent-free push the host gives us between
ready events, so take it as a cue to re-read plugin-info: capabilities
the host gained or dropped mid-session no longer sit stale until it
reloads. Registers nothing and prompts for nothing.

The capabilities read moves out of `attach()` into a small method both
paths share.

Refs #33

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
Every new paper started by hand-correcting four fields the PaperBell host
already knows. Its v2 `profile` now fills `creators[0]` in both
metadata.json files and the cover letter's `corresponding:` line, each
field falling back to its own placeholder — no host, an older host, a
half-filled profile and an ungranted scope all still produce today's
scaffold byte for byte.

`profileIfGranted()` reads the profile only when that costs no consent
prompt: the config the host already pushed, or a fetch when listGrants()
says `config` is already granted. A dialog raised by opening the
new-paper modal could outlive it (#31), and a pre-filled author is not
worth that.

The name is written exactly as the host gave it — it is a display name
and metadata.json's placeholder follows Zenodo's "Lastname, Firstname",
but reordering it would be a guess. ORCID stays a placeholder; the host
has no such field.

Closes #30

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
The release process documented the release PR but said nothing about how
the feature PR before it should be merged — which is what let a merge
commit inheriting a `feat:` PR title double-count in 2.4.0-beta.5's
changelog. Squash, and say why.

Closes #34

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
Follow-up to the review of this branch.

- Split the preset listing along the seam MAINTAINING.md documents: the
  fs + parseYaml half stays in pandoc-templates.ts, the pairing and its
  degradation move to a pandoc-templates-utils.ts sibling that vitest can
  load — so "an unreadable preset keeps its name and loses its label" is
  now asserted rather than asserted-to-be-obvious.
- The step editor's disabled description now names the format the preset
  imposes ("decides the output format (PDF)"), which is what #38 asked
  for. The export-time warning and notice are filled from that same
  string via `fillOptionText`, so the three copies of the sentence become
  one declaration and three consumers. The notice moves after the target
  is resolved, which is where the format is known.
- `leadCreator(ctx)` replaces the creators[0] block duplicated between
  the main and supplementary metadata.
- `listPandocTemplateNames` for the error path that only wants names;
  `dynamicChoices` narrowed to its one literal; assorted one-liners
  (discarded return, over-defensive branches, mixed ctx access).
- `hasBin`/`ASSETS` for the golden tests extracted to a shared harness
  rather than copied a third time.

Left alone deliberately: the notice fires on every export (a saved
misconfiguration is worth repeating), compile-step strings stay English
(file-local precedent), and ScaffoldProfile keeps copying fields rather
than aliasing the vendored contract type — that decoupling is the point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ivDqLS8ZQvs3gVQ7qeJGC
…gnal

fix: make the pandoc preset/Format precedence visible, plus four small issues
@SongshGeo
SongshGeo merged commit ece5a81 into main Sep 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant