From bb0446ab03b6e16a3082ef2c4a9222613ef8dc90 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 27 May 2026 09:50:41 +0300 Subject: feat(showcase): add interactive SVG rank history graph Generate rank-history.svg alongside showcase.gmi.tpl on every showcase run (full or single-repo update). The graph shows a Google-Trends-style polyline per project from oldest to newest; hovering highlights the selected project and shows a tooltip with rank and snapshot date for each recorded week. Key implementation details: - new file internal/showcase/rank_history_svg.go with GenerateRankHistorySVG - golden-ratio HSL colour spacing for visually distinct project lines - M/L SVG path commands with gaps for weeks with no snapshot data - PROJECTS JSON array embedded in CDATA script for JS tooltip rendering - rank-history.svg linked from the gemtext showcase header Changes to showcase.go: - updateShowcaseFile returns ([]ProjectSummary, error) so the caller can pass the full merged+sorted list to writeRankHistorySVGFile - extract showcaseOutputDir() helper to deduplicate the hardcoded ~/git/foo.zone-content/gemtext/about path used in four places - log a warning (instead of silently continuing) when getRepositories fails inside updateShowcaseFile so data loss is visible to the operator Bug fixes found during review: - off-by-bounds panic: reversal loop used revIdx=numPoints-1-j as source index but numPoints is a constant (5) not len(s.RankHistory); replaced with j as source and numPoints-1-j as destination so partial slices never panic - redundant getElementById in JS onEnter replaced with allPG[idx] which is already the correct element Co-Authored-By: Claude Sonnet 4.6 --- internal/cmd/showcase.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/cmd') diff --git a/internal/cmd/showcase.go b/internal/cmd/showcase.go index d6d8faf..0433ad3 100644 --- a/internal/cmd/showcase.go +++ b/internal/cmd/showcase.go @@ -63,6 +63,6 @@ func init() { showcaseCmd.Flags().StringVarP(&outputPath, "output", "o", "", "custom output eath (default: ~/git/foo.zone-content/gemtext/about/showcase.gmi.tpl)") showcaseCmd.Flags().StringVar(&outputFormat, "format", "gemtext", "output format: gemtext, markdown, html") showcaseCmd.Flags().StringVar(&excludePattern, "exclude", "", "exclude repos matching pattern") - showcaseCmd.Flags().StringVar(&showcaseAITool, "ai-tool", "opencode", "AI tool for summaries: opencode, hexai, claude, amp, or claude-code (default tries opencode→hexai→claude→amp)") + showcaseCmd.Flags().StringVar(&showcaseAITool, "ai-tool", "opencode", "AI tool for summaries: opencode, hexai, claude, amp, or claude-code (default tries opencode→hexai→claude→amp)") showcaseCmd.Flags().StringVar(&showcaseRepo, "repo", "", "only generate showcase for a single repository") } -- cgit v1.2.3