Skip to content

feat(api): allow custom title and description in requestInputs - #2294

Merged
chhoumann merged 3 commits into
masterfrom
issue-2293
Nov 21, 2026
Merged

chhoumann merged 3 commits into
masterfrom
issue-2293

Conversation

@chhoumann

@chhoumann chhoumann commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Why

Scripts calling quickAddApi.requestInputs could not change the hardcoded "Provide inputs" heading to give users guidance while filling out a form. Closes #2293.

What changed

  • Added src/preflight/formHeader.ts (DEFAULT_ONE_PAGE_FORM_TITLE, OnePageFormHeader, sanitizeOnePageFormHeader) to parse script-supplied header options at the API boundary.
  • Consolidated OnePageInputModal's trailing optional constructor arguments into OnePageInputModalOptions, rendering custom title and optional multi-line description while keeping InputPromptPeek in sync with title.
  • Extended quickAddApi.requestInputs(inputs, options?) to accept { title?: string; description?: string }, name title in non-interactive abort errors, and forward the header on the remote interactive type: "form" wire spec (PromptProtocol and RemotePromptProvider).
  • Styled .qa-onepage-title and .qa-onepage-description in src/styles.css.
  • Documented options.title and options.description in QuickAddAPI.md and onePageInputs.md.

Scope

Runtime quickAddApi.requestInputs forms and OnePageInputModal options. Choice preflight forms (runOnePagePreflight) keep the default "Provide inputs" heading.

Tradeoffs

  • Used an options object (requestInputs(inputs, { title, description })) instead of a bare string or union to match pickChoice, datePrompt, executeChoice, and applyTemplateToActiveFile and leave one way to pass form-level options.
  • Added description alongside title so scripts can keep headings short while giving multi-line guidance underneath.

Blast Radius

Backwards-compatible optional second argument on quickAddApi.requestInputs and additive optional title/description keys on the remote form prompt spec (omitted when unset or blank). No migration or settings impact.

Verification

  • pnpm run lint passed with 0 errors and 0 warnings (oxlint, svelte-policy, tsc, svelte-check).
  • Unit tests passed across all affected suites (269 tests in 8 files, plus full suite 504/505 with the 1 load-timeout file passing on rerun in 133ms).
  • pnpm run build passed.
  • Native Obsidian E2E specs passed (11/11 across request-inputs-header.test.ts, apply-template-one-page.test.ts, and one-page-alignment.test.ts).
  • Verified rendered heading, multi-line description, Peek chip subtitle, desktop and mobile layout (zero horizontal overflow), and zero dev:errors in isolated Obsidian.

Note

Low Risk
Backward-compatible optional second argument on requestInputs and additive UI/wire fields; no changes to choice preflight or core execution paths.

Overview
Adds an optional second options argument to quickAddApi.requestInputs, so scripts can set a custom form title (replacing the default "Provide inputs") and an optional multi-line description shown under the heading.

Header values are sanitized at the API boundary (sanitizeOnePageFormHeader), rendered in OnePageInputModal (including Peek chip title), forwarded to remote interactive type: "form" prompts, and used in non-interactive abort messages when a title is set. Choice preflight forms are unchanged and still use the default heading.

Documentation and styles for .qa-onepage-title / .qa-onepage-description are included; this is a backwards-compatible optional API extension.

Reviewed by Cursor Bugbot for commit c9d8fcf. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add optional title and description options to requestInputs

  • requestInputs accepts an optional second argument with title and description for the one-page input form, sanitized in formHeader.ts (trimmed, blank values dropped)
  • The local OnePageInputModal renders the header, falling back to Provide inputs for a missing title; descriptions render with pre-line line breaks
  • Remote prompt providers include truthy header values in the emitted form prompt spec via promptProvider.ts
  • In headless mode, a supplied title replaces the field-label list in the abort context
  • Refactors OnePageInputModal constructor to an options object (computePreview, discoveryForm); call sites in runOnePagePreflight.ts and tests updated

Macroscope summarized c9d8fcf.

Summary by CodeRabbit

  • New Features
    • requestInputs forms can now display a custom title and description. Blank or omitted values retain the default heading and omit the description.
    • Custom headings also appear in form previews and are used in non-interactive error messages when available.
  • Documentation
    • Updated the API reference with the optional form settings and an example.
  • Tests
    • Added coverage for custom headers, defaults, previews, and text entry.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

requestInputs accepts optional form title and description values. The values are sanitized and passed to interactive prompts or the one-page modal. The modal displays a custom title and, when provided, a description. Tests and documentation cover the new options.

Changes: Request Input Form Headers

Layer / File(s) Summary
Define and pass header options
src/preflight/formHeader.ts, src/api/requestInputs.ts, src/interactive/promptProtocol.ts, src/interactive/promptProvider.ts, src/quickAddApi.ts, src/quickAddApi.requestInputs.test.ts, src/quickAddApi.test.ts, src/quickAddApi.audit-api-prompts.test.ts, src/interactive/promptProvider.test.ts, docs/src/content/docs/docs/Advanced/onePageInputs.md, docs/src/content/docs/docs/QuickAddAPI.md
The API accepts optional title and description values. The prompt protocol and remote provider include nonblank values in form prompts. Tests and documentation cover option handling and examples.
Display headers in the one-page modal
src/preflight/OnePageInputModal.ts, src/preflight/runOnePagePreflight.ts, src/styles.css, src/preflight/OnePageInputModal.test.ts, src/preflight/OnePageInputModal.peek.test.ts, src/preflight/runOnePagePreflight.filenamePreview.test.ts, tests/e2e/request-inputs-header.test.ts
The modal displays a trimmed custom title or the default title, and displays a nonblank description below it. Preflight passes modal options as an object. Tests cover the modal header, peek view, and end-to-end input submission.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller as QuickAdd API caller
  participant QuickAddApi as QuickAddApi.requestInputs
  participant RequestInputs as requestInputs
  participant Modal as OnePageInputModal
  participant User
  Caller->>QuickAddApi: fields and optional header
  QuickAddApi->>RequestInputs: forward fields and header
  RequestInputs->>Modal: missing fields and sanitized header
  Modal->>User: display title and optional description
  User->>Modal: enter requested values
  Modal-->>RequestInputs: resolve input values
  RequestInputs-->>Caller: return input values
Loading
Merge Risk: Minimal · up to c9d8f

This adds optional title and description settings to requestInputs forms. Existing behavior is unchanged when the options are omitted, and no merge-blocking issue was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(api): allow custom title and description in requestInputs" matches the main change. The PR adds optional title and description options to quickAddApi.requestInputs, and the changeset i…
Linked Issues check Passed [#2293] The issue asks that callers of requestInputs can edit the prompt form title. The change implements this. (1) src/api/requestInputs.ts accepts an optional RequestInputsOptions header, sanitized…
Out of Scope Changes check Passed All changes connect to the header feature. The OnePageInputModal constructor change (positional preview and discovery-form arguments consolidated into OnePageInputModalOptions) is needed to pass title…
Full details: Title check

Explanation

The title "feat(api): allow custom title and description in requestInputs" matches the main change. The PR adds optional title and description options to quickAddApi.requestInputs, and the changeset implements them across the API, prompt protocol, modal, header sanitizer, styles, tests, and docs. The title is specific and concise, and it uses a conventional commit prefix.

Full details: Linked Issues check

Explanation

[#2293] The issue asks that callers of requestInputs can edit the prompt form title. The change implements this. (1) src/api/requestInputs.ts accepts an optional RequestInputsOptions header, sanitized by sanitizeOnePageFormHeader in src/preflight/formHeader.ts. (2) OnePageInputModal renders the trimmed custom title as the heading, and falls back to DEFAULT_ONE_PAGE_FORM_TITLE ("Provide inputs") when blank or omitted. The InputPromptPeek title follows the same value. (3) The remote interactive form spec in src/interactive/promptProtocol.ts and RemotePromptProvider in src/interactive/promptProvider.ts forward title and description when nonblank. (4) Unit tests in src/quickAddApi.requestInputs.test.ts, src/quickAddApi.test.ts, src/interactive/promptProvider.test.ts, and src/preflight/OnePageInputModal.test.ts cover trimming, blank handling, and forwarding. The E2E spec tests/e2e/request-inputs-header.test.ts covers the rendered heading. The optional description is additional scope that does not conflict with the issue. No unmet coding requirement is evident from the summary and the code evidence it cites. Checks were based on the PR summary and described tests; I did not re-run them.

Full details: Out of Scope Changes check

Explanation

All changes connect to the header feature. The OnePageInputModal constructor change (positional preview and discovery-form arguments consolidated into OnePageInputModalOptions) is needed to pass title and description through the modal, and runOnePagePreflight and its filename-preview test were updated to match. The promptProtocol and promptProvider changes carry the header to the remote form spec. The styles.css changes style the new heading and description. The docs update QuickAddAPI.md and onePageInputs.md for the new options. The tests cover the new behavior. The PR states that choice preflight forms keep the default heading, and the summary shows no change that alters other prompt behavior. No demonstrated unrelated change was found.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit trims a title neat,
And sets a note beneath the greet.
“Provide inputs” stays in view,
When custom words are blank or few.
I hop, then peek, then type with care,
And leave the answers waiting there.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d087d5d3-fee2-42c4-b1a7-8cd2a139c749
Commits

Reviewing files that changed from the base of the PR and between d04060a and c9d8fcf.

Files selected for processing: 18

  • docs/src/content/docs/docs/Advanced/onePageInputs.md
  • docs/src/content/docs/docs/QuickAddAPI.md
  • src/api/requestInputs.ts
  • src/interactive/promptProtocol.ts
  • src/interactive/promptProvider.test.ts
  • src/interactive/promptProvider.ts
  • src/preflight/OnePageInputModal.peek.test.ts
  • src/preflight/OnePageInputModal.test.ts
  • src/preflight/OnePageInputModal.ts
  • src/preflight/formHeader.ts
  • src/preflight/runOnePagePreflight.filenamePreview.test.ts
  • src/preflight/runOnePagePreflight.ts
  • src/quickAddApi.audit-api-prompts.test.ts
  • src/quickAddApi.requestInputs.test.ts
  • src/quickAddApi.test.ts
  • src/quickAddApi.ts
  • src/styles.css
  • tests/e2e/request-inputs-header.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: c9d8fcf
Status: ✅  Deploy successful!
Preview URL: https://91f1b4b8.quickadd.pages.dev
Branch Preview URL: https://issue-2293.quickadd.pages.dev

View logs

@chhoumann

Copy link
Copy Markdown
Owner Author

Independent verification: PASS+NOTES

Head c9d8fcf347c99c4779dd5e67fa046cfa173ca621 (base d04060a4). I only inspected and tested. No files changed.

The PR does what #2293 asks. A script can name the requestInputs form and add guidance below the name. Omitted, blank, or invalid options fall back to "Provide inputs" with no description.

Automated runs

  • pnpm run lint: exit 0. svelte-check reported 0 errors and 0 warnings. oxlint, svelte-policy, and the tsconfig check passed.
  • Targeted vitest (7 files listed in the brief): 256 passed.
  • pnpm run build: exit 0.
  • .agents/run-e2e tests/e2e/request-inputs-header.test.ts tests/e2e/apply-template-one-page.test.ts tests/e2e/one-page-alignment.test.ts: 3 files, 11 tests passed.

Manual runs in the isolated Obsidian 1.14.4 instance

Each probe called app.plugins.plugins.quickadd.api.requestInputs with a text field and an optional textarea, read the DOM, and submitted by clicking Submit.

options h2 description <p> Peek chip result
{title:"Weekly review", description:"Answer what applies.\nLeave the rest blank."} Weekly review 2 rendered lines (pre-line, muted, 13px, centered) "Weekly review" resolved {mood:"calm", notes:"line one"}
{description:"Only guidance here."} Provide inputs shown "Provide inputs" resolved
{title:"Daily check-in"} Daily check-in absent - resolved
{title:" ", description:42} Provide inputs absent "Provide inputs" resolved, no throw
null, "oops", omitted Provide inputs absent - resolved, no throw

The title stayed the same after returning from Peek. Escape rejected with MacroAbortError. No .modal-container was left after any probe.

Layout. I tested a long title with a 3-sentence, 2-line description.

  • Desktop at 1024px: the title wraps to 2 centered lines in a 560px dialog. The description is 16px above the first field. No horizontal overflow.
  • Phone at 390px with dev:mobile on, a CDP viewport override, and is-phone: the title takes 2 lines and the description 4 lines within 334px. No overflow, and the footer stays in view.
  • Peek on the phone shows a chip titled "Weekly review", and submitting resolved.

dev:errors reported "No errors captured."

Notes (non-blocking)

  • dev:mobile on reloads the app, so the clean dev:errors result covers the phone probes. It may not cover the earlier desktop probes. No probe threw or rejected unexpectedly.
  • The phone check used the specs' body-class swap plus a CDP viewport, not a real device.
  • OnePageInputModal trims title and description again even though sanitizeOnePageFormHeader already trims them. This is harmless but redundant.
  • I did not test the remote (Raycast) form path live. Unit tests cover it in promptProvider.test.ts and quickAddApi.requestInputs.test.ts.

@chhoumann
chhoumann merged commit 50edd21 into master Nov 21, 2026
17 of 18 checks 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

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Edit title for prompts

1 participant