Skip to content

Batch 3: frontend cleanup (split scripts, vendored libs, sanitised AI output, currencies) - #3

Open
Arvi23 wants to merge 2 commits into
batch-2-numbersfrom
batch-3-frontend
Open

Arvi23 wants to merge 2 commits into
batch-2-numbersfrom
batch-3-frontend

Conversation

@Arvi23

@Arvi23 Arvi23 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Stacked on #2. Merge #1 and #2 first.

What changed

  • Split: the 2,400-line index.html is now css/app.css plus ten plain scripts in static/js/, with no build step. They're plain scripts rather than ES modules because the markup uses inline handlers (D11).
  • No CDNs: Chart.js, marked, DOMPurify and the Inter font are vendored at pinned versions (npm run vendor). The Tailwind Play CDN is replaced by a precompiled static/css/tailwind.css (npm run build:css), and CI fails if it's stale.
  • Security: all LLM markdown goes through DOMPurify, with images forbidden. The chat's raw-HTML injection action is gone.
  • Currencies:
    • Prices use the stock's currency.
    • Free cash flow uses the statement currency (TSM shows NT$).
    • Yahoo's minor units (GBp, ZAc, ILA) are handled.
    • Market cap is shown compactly ("$3.08T").
  • Wording: plainer labels (Analyze / New AI report / Ask about this stock), a disclaimer line, and readable markdown styling.
  • Tests: scripts/ui_smoke.js is a pass/fail Playwright test, run in CI on a new frontend job against the fake server. It includes an XSS probe and RON/TWD currency checks.

Live-test checklist: docs/HANDOFF.md.


Generated by Claude Code

Arvi23 and others added 2 commits November 4, 2026 03:56
…I output, currencies

- Split the 2,400-line index.html into css/app.css and ten classic scripts in
  static/js/ (shared global scope, ordered; startup in main.js). See D11.
- Vendor and pin Chart.js 4.6.1, marked 18.1.3, DOMPurify 3.4.17 and the Inter
  font (latin + latin-ext for Romanian diacritics) via package.json +
  scripts/vendor.mjs. No CDN dependencies left besides TradingView and logos.
- Replace the Tailwind Play CDN (runtime compiler) with precompiled
  static/css/tailwind.css (Tailwind 3.4.19). CI fails if it's stale.
- All LLM markdown goes through DOMPurify (images forbidden). Remove the chat's
  raw-HTML update_tab_content action.
- Currency-aware money formatting: prices in `currency`, statement values in
  `financialCurrency`, Yahoo minor units (GBp/ZAc/ILA), compact $3.08T style.
  Watchlist quotes carry their currency.
- Plain-language wording and an AI disclaimer line; markdown styling for reports.
- scripts/ui_smoke.js is now a pass/fail Playwright test (sanitising, currencies,
  breakdowns, watchlist, refresh, chat, no-key hint, failure toast), run in CI
  against scripts/fake_server.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
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