diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-27 09:50:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-27 09:50:41 +0300 |
| commit | bb0446ab03b6e16a3082ef2c4a9222613ef8dc90 (patch) | |
| tree | ef7f1a4f4a2ff3662a9db24eb82b7bc08227437e /internal/cmd | |
| parent | e0648fdc2ed75a09f16e08626f122a5ed4582ad1 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/cmd')
| -rw-r--r-- | internal/cmd/showcase.go | 2 |
1 files changed, 1 insertions, 1 deletions
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") } |
