Skip to content

v0.2.0: standalone viewer as app, narratology runtime, rename tvplotlines → tvplot#1

Merged
BirdInTheTree merged 24 commits intomainfrom
feat/standalone-html-viewer
Apr 15, 2026
Merged

v0.2.0: standalone viewer as app, narratology runtime, rename tvplotlines → tvplot#1
BirdInTheTree merged 24 commits intomainfrom
feat/standalone-html-viewer

Conversation

@BirdInTheTree
Copy link
Copy Markdown
Owner

Summary

Ten commits; the headline changes:

  • Package renamed tvplotlinestvplot (version bump to 0.2.0). PyPI name, import path, CLI command, env vars, and localStorage keys all move together. Old `tvplotlines 0.1.0` on PyPI will be yanked.
  • Narratology pipeline is runnable. `src/tvplot/narratology.py` runs all six passes (context → fabula → actants → story → arc → review) and maps actant fields onto the existing `TVPlotlinesResult` shape, so the viewer renders hollywood and narratology output unchanged. The browser viewer has a matching `runPipelineNarratology`.
  • Two analysis systems under one `--system` flag. Prompts live under `src/tvplot/prompts/{hollywood,narratology}/` and are inlined into the HTML at build time so the viewer never drifts from the source.
  • HTML viewer is an end-to-end app. Welcome screen takes show + season, viewer asks the LLM for synopses, lets the user edit them, runs the pipeline, exports JSON/CSV/FDX/PDF. PDF via lazy-loaded jsPDF with print-fallback.
  • Compliance — `docs/ai-disclosure.md` + `docs/methodology.md` + README "How this uses AI" + dismissible footer in the viewer. Publisher is Alpine Animation (Switzerland), contact `tvplot@alpineanimation.ch`.
  • Repo hygiene — Russian prompt set dropped, sister repo folded in, internal planning docs moved back to `3-resources/`, README rewritten from scratch, `docs/` (index/quickstart/api/formulas) brought in sync with the code.

Test plan

  • `pytest tests/` — 115 passed on the rename commit
  • `python -m tvplot.html.build` produces a standalone HTML (~350KB)
  • JS syntax check on `pipeline.js`, `app.js`, `export.js` (all parse)
  • Manual smoke — open the built HTML in Chrome/Safari, run "Analyze a series" on Breaking Bad S01 end-to-end (needs real API key)
  • Manual smoke — switch system to narratology in settings, re-run (needs real API key)
  • PyPI publish + yank old package (tracked as a follow-up checklist outside this PR)

🤖 Generated with Claude Code

BirdInTheTree and others added 24 commits April 9, 2026 22:52
Build script assembles shell.html + parts (CSS, JS, demo data) into a
single self-contained HTML file. Three-screen layout: welcome, grid,
analytics with modal container and placeholder slots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep battle-tested styles: color palette (light + Catppuccin Mocha dark),
function colors, rank badges, tension variables, grid layout, analytics.
Remove HTMX/edit-mode/merge/split styles (v1 is read-only).
Add screen routing, welcome screen, and toolbar/navigation styles.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port plotline x episode grid from tvplotlines-app Jinja2 template to
vanilla JS. Includes event grid lookup, character resolution, guest
detection, rank sorting, function legend filtering, season/character
filters, and read-only event detail modal. App.js handles screen
routing, dark mode persistence, demo data loading, and file upload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port computation (analytics.py) and rendering (analytics.html) to
standalone JS: scorecard, arc map, episode pulse, convergence moments,
character weight. Wire up Analytics button in app.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Store object centralizes all localStorage access (API keys, results,
settings, onboarding state). Toolbar now has series dropdown, Grid/Analytics
tab buttons, dark mode toggle, load/export/LLM/onboarding placeholders.
Series switching re-renders current view and persists last selection.
Drop zone overlay supports drag-and-drop and file picker for JSON import.
Init logic checks onboarding state and restores last session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Export dropdown in toolbar with 4 formats. Single floating menu
shared between grid and analytics screens. CSV chosen over XLS
to avoid SheetJS dependency — includes both events and plotlines
summary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement pipeline.js with streaming API client (Anthropic + OpenAI),
all 5 passes with embedded prompts, post-processing, and synopsis
file upload. Wire drop zone to accept .txt synopses alongside JSON,
add LLM settings dialog, and pipeline progress overlay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ode labels

- Force color-scheme to prevent Firefox dark mode override
- .hidden !important to fix drop zone appearing on load
- inciting_incident: no background, bright green text
- crisis function color added
- Story engine / logline moved above all analytics sections
- Episode numbers shown once in scorecard header
- Episode Pulse: removed themes, added plotline color legend

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generate a standalone HTML viewer alongside the result JSON when
--html is passed. Uses build_html() from the html module. Defaults
to saving next to the JSON with .html extension; --html-output
overrides the path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Japanese minimalism aesthetic: lightweight typography, pill-shaped
"Play me" button, subtle "Skip" link. First visit shows welcome,
returning visits skip straight to grid. Smooth fade-out transition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Animated walkthrough plays on actual app screens using Breaking Bad
demo data: LLM settings modal, file upload, pipeline progress,
grid reveal, analytics tour, and export. Ends with real LLM modal
so user can connect their key. Skip link aborts animation cleanly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tem parameter

- Rename prompts_en/ to prompts/hollywood/
- Import 8 narratology prompts (formerly tvplotlines_narratology repo) into prompts/narratology/
- Drop prompts_ru/ entirely — Russian support out of current scope
- Replace lang parameter with system across library: get_plotlines, LLMConfig, CLI
- Narratology pipeline raises NotImplementedError for now; prompts in place for v2
- Copy schema.md into docs/layered-schema.md (base + layers JSON design)
- Update pyproject.toml artifacts, example, tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Pass 2: every event gets id {episode}#{index:02d} and keeps it downstream
- Passes 4–6: reference events by id, not by description
- Pass 5 mre: event_id instead of episode+description
- glossary: plain-English actant names (who_chases, bigger_force, …)
  now mapped to their Greimas terms (subject, power, …)
- docs/layered-schema.md aligned with prompt output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Welcome screen now has an "Analyze a series" form (show + season).
  Clicking Analyze asks the configured LLM for episode synopses from
  its training memory, shows them in an editable preview modal, then
  runs the 5-pass pipeline on whatever the user confirms.
- LLM settings modal gains an "Analysis system" selector. Hollywood is
  live; Narratology is disabled with a "coming soon" note until its
  runtime lands in v2.
- Exports: added "PDF (via print)" that calls window.print(); a print
  stylesheet hides the toolbar/modals and lays the grid out in
  landscape, so Cmd+P → "Save as PDF" produces a usable document.
- Drag-and-drop .txt flow unchanged — it's the fallback when the model
  doesn't know the show.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…owledge move

1. Narratology pipeline is now runnable, Python and browser both:
   - src/tvplotlines/narratology.py runs all six passes (context → fabula →
     actants → story → arc → review) and maps results into the existing
     TVPlotlinesResult shape so the viewer renders either system unchanged
   - pipeline.js grows runPipelineNarratology mirroring the Python orchestrator
     (per-episode and per-plotline passes parallelised), and the top-level
     runPipeline dispatches on the user's system choice
   - The "Narratology" option in LLM settings is enabled
2. Viewer prompts are no longer hardcoded. build.py reads every
   prompts/{hollywood,narratology}/*.md at build time and injects them as a
   _PROMPTS object, eliminating drift between source prompts and the viewer
3. Native PDF export — jsPDF is lazy-loaded from CDN and generates a vector
   PDF from the loaded result (title, per-plotline sections with actants/
   story-DNA + event list, episode appendix). Falls back to window.print()
   when offline
4. Knowledge consolidated from 3-resources/tvplotlines/ into
   docs/knowledge/ (decisions, specs, theory, prompting, results,
   v3_narratology evergreens, archive). Personal artifacts stay in place

All 115 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- docs/knowledge/ — moved to 3-resources/tvplotlines/. Knowledge,
  evergreens, autoresearch drafts, and strategy notes belong out of the
  public repo. Personal artifacts already lived there
- docs/viewer/{spec,plan,decisions}.md — internal Russian planning docs,
  moved to 3-resources/tvplotlines/viewer-planning/
- .gitignore — exclude Untitled.md draft and the dacomply compliance/
  scan output so they can sit in the working tree without leaking
- README — rewrite to reflect the current code: hollywood + narratology
  systems with the --system flag, standalone HTML viewer mode, the
  "Analyze a series" entry flow, --html/--html-output, narratology's
  six-pass table, fixed the broken license badge and the dead
  prompts_en/glossary.md link

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- api.md: get_plotlines signature gains `system`, `skip_review`,
  `base_url`, `suggested_plotlines`; new system-comparison table;
  Plotline gets reviewed_rank/computed_rank/nature/confidence,
  Event gets plot_fn; full CLI flag table for run + write-synopses
- quickstart.md: --system and --html flags, standalone-viewer section
  with "Analyze a series" flow, system switch in Python example
- index.md: mentions standalone viewer + layered-schema link
- formulas.md: Pass 4 section (was missing), narratology pipeline
  section at the end documenting all six passes and the actant ↔
  hero/goal/obstacle/stakes mapping

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Untitled.md and compliance/ live in 3-resources/tvplotlines/
alongside the rest of the private notes; they don't need
to be ignored here any more.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address the compliance scan items that actually apply to an installable
library with no hosted service:

- docs/ai-disclosure.md — single source of truth for data flow,
  vendor policies, and user rights. Alpine Animation (Switzerland) is
  named as publisher; we collect nothing. Names the three synopsis
  paths (user-supplied, Wikipedia-scraped via write-synopses, and the
  browser's "Analyze a series" flow), covers Anthropic AUP and OpenAI
  Usage Policies compliance, and records a use-case paper trail
- docs/methodology.md — plain-language Art. 50 explainer written from
  the code (pipeline.py, narratology.py, pass*.py, postprocess.py),
  not the dacomply template. Points to formulas.md for line-by-line
  rules
- README gains a "How this uses AI" section linking both docs
- HTML viewer shows a dismissible AI-assisted-content footer naming
  the model family and Alpine Animation; dismissal persists in
  localStorage; footer is hidden at print time so PDF exports stay clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Alongside GitHub issues — gives data-subject and methodology requests
a direct channel to the publisher, which is what the compliance scan
flagged as missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace <411@alpineanimation.ch> with "411 [at] alpineanimation [dot] ch".
Defeats ~80–90% of off-the-shelf email harvesters that look for
mailto: links or @-symbols; humans read it without effort.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tvplotlines@alpineanimation.ch — easy to kill and recreate if it ever
gets scraped, which is a better strategy than trying to obfuscate a
shared catch-all mailbox.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shorter, snappier. PyPI name, import path, CLI command (tvplot run),
env vars (TVPLOT_*), localStorage keys, and all docs move in one step.
Version bumps to 0.2.0 and CHANGELOG carries a BREAKING migration note.

What changes externally:
- pip install tvplot
- from tvplot import get_plotlines
- tvplot run my-show/ --system narratology
- TVPLOT_OUTPUT_DIR, TVPLOT_SYNOPSES_DIR

What stays:
- Public API surface (get_plotlines signature, Plotline/Event models)
- All pipeline logic and prompts
- Existing result JSONs remain valid

Rationale: no meaningful users yet on PyPI (80%+ of the 0.1.0
download count is bots and scanners), the rename is much cheaper
now than after promotion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@BirdInTheTree BirdInTheTree merged commit e38648d into main Apr 15, 2026
3 checks passed
@BirdInTheTree BirdInTheTree deleted the feat/standalone-html-viewer branch April 15, 2026 10:57
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