Skip to content

feat(ai-export): add intro, chart descriptions, and strategy link (#553)#570

Merged
Gregable merged 2 commits into
mainfrom
worktree-feat-553-ai-export-content
Jun 19, 2026
Merged

feat(ai-export): add intro, chart descriptions, and strategy link (#553)#570
Gregable merged 2 commits into
mainfrom
worktree-feat-553-ai-export-content

Conversation

@Gregable

Copy link
Copy Markdown
Owner

Summary

Expands the "Copy for AI assistant" markdown export with three additions aimed at the AI assistant reading the document, requested as a follow-up to the calculator button (#553).

  1. ## About this summary intro — orients the AI: what the document is (a complete, self-contained benefit derivation), and how to use it (answer from the figures, show your work, link to or embed the charts, point to the strategy optimizer). Single and couple variants.
  2. ## Interactive charts reframed — the intro now recommends linking to or embedding the relevant chart directly in answers, and each chart gets a one-line "what it shows" description (filing-age, indexed earnings, bend points, couple filing-age).
  3. ## Find the optimal filing age — a pre-filled https://ssa.tools/strategy deep link with a short description of the optimizer. The /strategy base is derived from the calculator baseUrl (sibling paths), and reuses the existing per-recipient/couple URL hash.

Also adds a small wrapText helper so the interpolated prose wraps evenly (~76 cols) — keeps the copy-preview readable regardless of name length.

Testing

  • 6 new golden tests (intro present + ordered first; per-chart descriptions; single + couple strategy link with pia/dob; custom-baseUrl /strategy derivation). Prose assertions normalize whitespace so they aren't coupled to wrap positions.
  • Full suite green: 2039 passed. npm run quality clean (Biome + svelte-check 0/0).
  • Verified the rendered single + couple output end-to-end.

Notes

No behavior change to the button/modal — this is purely the exported text. The builder remains clock-free and deterministic.

Expands the "Copy for AI assistant" export with three sections aimed at the
AI reading it:

- "## About this summary" intro: what the document is and how to use it
  (answer from the figures, show work, link or embed the charts).
- "## Interactive charts" reframed to recommend linking/embedding, with a
  one-line "what it shows" description per chart (filing-age, indexed
  earnings, bend points, couple filing-age).
- "## Find the optimal filing age": a pre-filled https://ssa.tools/strategy
  deep link plus a short description of the optimizer.

Adds a wrapText helper so the interpolated prose wraps evenly (~76 cols) for
the copy preview, and derives the /strategy base from the calculator baseUrl.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 19, 2026

Copy link
Copy Markdown

Deploying social-security-tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1953392
Status: ✅  Deploy successful!
Preview URL: https://18a406d9.social-security-tools.pages.dev
Branch Preview URL: https://worktree-feat-553-ai-export-d0iv.social-security-tools.pages.dev

View logs

- wrapText: collapse runs of whitespace (split on / +/) so it is robust to its
  own callers, and export it for direct unit testing (matching renderTable).
  Adds tests: wrap width, overlong word emitted whole, whitespace collapse,
  empty input.
- Add coverage for the two new branchy helpers: the strategyBase non-/calculator
  baseUrl fallback, and the subjectName "this person" fallback (unnamed
  recipient must not emit an empty possessive or leak Self/Spouse sentinels).
- Comment accuracy: "possessive-ready" -> a phrase callers suffix with "'s";
  CHART_DESCRIPTIONS "One-line" -> short blurb (wrapped by wrapText at render).
@Gregable
Gregable merged commit 3fff1bb into main Jun 19, 2026
6 checks passed
@Gregable
Gregable deleted the worktree-feat-553-ai-export-content branch June 19, 2026 23:38
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.

1 participant