Commit graph

123 commits

Author SHA1 Message Date
Shekhar Vaidya
bc857c4986 fix(cli): send telemetry synchronously; tag eval-via-picker correctly
Telemetry was fired as a goroutine then the process exited immediately,
killing it before the HTTP request could complete. Now called
synchronously — sendTelemetry already has a 2s internal timeout so
worst-case latency is unchanged for the user.

Also moves the combined picker into run() so eval products selected
interactively are tagged action=eval with the correct eval_slug instead
of action=interactive with no slug.

Adds What's New changelog section to release notes, auto-generated from
commits since the previous tag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 07:50:13 +05:30
Shekhar Vaidya
5fa1b11835 chore(winget): bump manifests to v0.3.0
SHA256: FA6DA7B905CFCAD52A0DAE884641055B00A831914F38E78F86F927DED51B0639

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 07:28:58 +05:30
Shekhar Vaidya
2c068ff055 feat(cli): v0.3.0 — telemetry, arch picker, O/C menu, eval in picker
Backend:
- GET /cli/version update-check endpoint
- POST /telemetry anonymous usage counters (Redis-persisted)
- Telemetry counters in /metrics response

CLI:
- Version var injected via ldflags at build time
- Update notice on every run (non-blocking, 500ms timeout)
- Architecture picker when multiple links returned
- Post-fetch [O] Open in browser / [C] Copy / [Enter] Exit menu
- Combined interactive picker includes Evaluation/Enterprise products
  (Windows Server 2025/2022/2019/2016, Windows 11 Enterprise)
- openInBrowser: writes URL to temp .url file — & no longer truncated
- copyToClipboard: calls clip.exe via full SystemRoot path

Frontend:
- Winget elevated to primary install on CLI page + CliHandoff card
- CliHandoff command shows msdl (no .exe suffix)

Docs: README telemetry disclosure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 07:26:31 +05:30
Shekhar Vaidya
a9c713cd6a feat(cli): combined product picker with eval products + clipboard fix
- Interactive `msdl` (no flags) now lists consumer + eval products in one
  picker with an Evaluation / Enterprise separator; selecting a server
  product routes to the eval flow automatically
- copyToClipboard calls clip.exe by full SystemRoot path, bypassing
  cmd.exe PATH lookup that failed in some terminal environments
- CliHandoff card: winget primary install + msdl (no .exe) in run command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 07:25:03 +05:30
Shekhar Vaidya
7a267a2581 fix(cli): open browser via temp .url file to preserve & in signed URLs
cmd.exe treats & as a command separator, truncating Microsoft's signed
download URLs at the first query parameter boundary. Writing the URL to
a Windows Internet Shortcut (.url) file means cmd.exe only ever sees a
temp filename with no special characters; the browser reads the full URL
from the file contents.

Uses %COMSPEC% to locate cmd.exe reliably across environments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 07:06:02 +05:30
Shekhar Vaidya
9e836503c0 Merge branch 'main' into feat/cli-telemetry 2026-06-30 06:40:46 +05:30
Shekhar Vaidya
d4973ab42a fix(backend): truncate HTTP error body in logs to 120 chars
Microsoft's 403 capacity page was logging hundreds of lines of HTML
per error. Both non-200 error paths now cap the body at 120 chars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 10:33:03 +05:30
Shekhar Vaidya
d2c5c3c082 feat(frontend): use tracked shortlink for CLI releases download button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 12:17:59 +05:30
Shekhar Vaidya
40327c33b4 fix(frontend): show lockdown message on error path when no stale data
When the backend returns 429+lockdown with no cached stale data to serve,
the error section now shows the human-readable lockdown explanation instead
of the raw "Sentinel marked this request as rejected." string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 12:12:51 +05:30
Shekhar Vaidya
e4e0e52971 Merge feat/sentinel-lockdown into main 2026-06-25 12:07:11 +05:30
Shekhar Vaidya
3141635300 feat(backend+frontend): Sentinel lockdown mode + stale UX overhaul
Backend (main.go):
- negCacheEntry gains IsSentinel bool; lockdownTTL = 90min constant
- Lockdown gate at top of handleProxy: serves stale with X-MSDL-Lockdown:1
  header or 429 {"error":"...","lockdown":true} — zero MS API calls made
- Sentinel stale path: sets 90min lockdown neg cache, adds lockdown header,
  suppresses background refresh (retrying extends the Sentinel block timer)
- Non-Sentinel stale path: unchanged (60s neg cache, bg refresh fires)
- Expose X-MSDL-Lockdown in Access-Control-Expose-Headers

Frontend (ProductDetailPage.tsx):
- isLockdown state: set from X-MSDL-Lockdown header or data.lockdown field
- Stale state hides expired download links entirely; shows CLI recommendation
  inside the card instead of sending users to look for options elsewhere
- Lockdown: red banner explaining 90min cooldown + highlighted CLI card,
  no Refresh button (it cannot help while Sentinel block is active)
- Normal stale: amber banner + highlighted CLI card + secondary Refresh button
- Outer CliHandoff suppressed when already shown inside card (stale states)

Frontend (CliHandoff.tsx):
- CLI command uses msdl.exe (primary audience is Windows users)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 12:07:00 +05:30
Shekhar Vaidya
3e45bfd0c7 feat(cli): architecture picker + post-fetch O/C/Enter menu
When multiple download links are returned (e.g. x32+x64 for consumer
ISOs), an architecture picker is shown before printing the URL.

After the URL is printed, an interactive menu lets the user open the
link in the default browser (O), copy it to the clipboard (C), or exit
(Enter). Menu is suppressed when stdout is not a terminal (piping).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-23 11:49:31 +05:30
Shekhar Vaidya
0525015ca9 fix(backend): detect Sentinel in JSON Errors field, evict session on block
Microsoft's WAF returns HTTP 200 with {"Errors":[{"Value":"Sentinel marked
this request as rejected."}]}. The existing Sentinel check only ran for
non-200 responses, so the session was never evicted — every subsequent
request reused the poisoned session and hit Sentinel again.

Add the same eviction + rateLimitError logic inside the errMap["Value"]
branch so the session is evicted regardless of the WAF's HTTP status code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 11:13:34 +05:30
Shekhar Vaidya
29d6b6b3f1 feat(frontend): elevate winget install to primary method on CLI page
Replaces the dim "coming soon" footnote with a featured green card at the
top of the Install section. Manual binary downloads moved to a secondary
"Other platforms" section below. Ships with the post-winget-approval release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 21:38:40 +05:30
Shekhar Vaidya
1e00dcee2e fix(backend): validate telemetry fields; add method guard to /cli/version
- Add platform allowlist validation (windows, darwin, linux) and length caps for version (≤20) and product_id (≤10) in handleTelemetry to prevent unbounded Redis hash growth from attacker-controlled field values.
- Add HTTP method guard to handleCLIVersion to reject non-GET requests with 405 Method Not Allowed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 21:14:21 +05:30
Shekhar Vaidya
70f0da6464 docs: add CLI telemetry disclosure to README 2026-06-21 21:09:55 +05:30
Shekhar Vaidya
a21f05239a feat(cli): update check and anonymous telemetry on every run 2026-06-21 21:07:18 +05:30
Shekhar Vaidya
c047a2929f feat(cli): Version var injected via ldflags, updated --help text 2026-06-21 21:03:20 +05:30
Shekhar Vaidya
2978012120 feat(backend): include telemetry counters in /metrics response 2026-06-21 20:58:11 +05:30
Shekhar Vaidya
470abbc94b feat(backend): Redis persistence for metrics (seed + 5min flush + graceful shutdown)
- seedMetricsFromRedis: loads persisted counters into atomics on startup
- flushMetricsToRedis: writes all 12 counters to 3 Redis hashes on demand
- startMetricsFlusher: goroutine that flushes every 5 minutes
- Graceful shutdown: SIGINT/SIGTERM flushes metrics then drains HTTP in 10s
- http.ListenAndServe replaced with http.Server for Shutdown support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 20:48:08 +05:30
Shekhar Vaidya
cbe5ca2f9b feat(backend): POST /telemetry endpoint with Redis HINCRBY counters 2026-06-21 20:43:27 +05:30
Shekhar Vaidya
f968942763 feat(backend): GET /cli/version returns latest CLI version 2026-06-21 20:40:13 +05:30
Shekhar Vaidya
68466da7da docs: spec and implementation plan for CLI telemetry + update check
- docs/superpowers/specs/2026-06-21-cli-telemetry-update-check-design.md
- docs/superpowers/plans/2026-06-21-cli-telemetry-update-check.md

Covers: GET /cli/version, POST /telemetry (Redis HINCRBY), Redis persistence
for existing in-memory metrics (seed + 5min flush + graceful shutdown),
CLI update check goroutine, telemetry goroutine, --help update, MSDL_NO_TELEMETRY opt-out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 20:33:27 +05:30
Shekhar Vaidya
2a41874ad4 fix: evict session and serve stale on Sentinel WAF block
When Microsoft Sentinel rejects a request (HTTP 502 with 'Sentinel'
in body), the session was being reused on every retry — hammering the
same poisoned session and making the block worse.

Now: detect Sentinel response, evict the session from cache, and
return a rateLimitError so stale-on-failure kicks in and users get
the last cached link instead of an error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 19:46:16 +05:30
Shekhar Vaidya
1ca871a839 fix: support P1 (Unix timestamp) expiry param in contribute endpoint
Consumer ISO CDN URLs use P1 (Unix timestamp) instead of se (RFC3339).
extractRawExpiry now tries se first then falls back to P1, so CLI
contributions of consumer ISOs are no longer rejected.

Also refactors parseLinkExpiry to call extractRawExpiry (DRY) and
fixes stale log message referencing 'se param'.
2026-06-21 19:40:18 +05:30
Shekhar Vaidya
0bad3d1582 fix: update stale log message in contribute expiry validation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 19:39:49 +05:30
Shekhar
84429ebaaf fix: support P1 query parameter for consumer download link expiry 2026-06-21 09:09:54 +05:30
Shekhar Vaidya
3a007662be docs: update README with CLI tool, Redis cache, /contribute endpoint
- Add CLI Tool section: install table, usage examples, crowdsourced cache opt-out
- Update project structure to include cli/ directory
- Add /contribute API reference
- Update caching section to mention Redis/Valkey L2
- Add CLI and Redis to tech stack table
- Bump winget manifests from 0.1.0 to 0.2.0 with updated SHA256

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 14:32:12 +05:30
Shekhar Vaidya
9c7ae6e6cb feat: Phase 4 — CLI showcase, CliHandoff, CORS fix, recently viewed clear
Merges feat/resilience-phase4 into main.

- CliHandoff component: shows install + msdl command when Microsoft WAF blocks backend
- /cli page: install guide, usage examples, contribute explanation
- CLI nav dock entry and homepage promo strip
- Recently viewed clear button
- Backend CORS fix for Tailscale/LAN subnets
2026-06-20 14:24:06 +05:30
Shekhar Vaidya
b27d7c0b9f feat: CLI page, dock entry, homepage promo, and clear recently viewed
- Add /cli page with install guide, usage examples, and contribute section
- Add CLI item to nav dock (between Products and About)
- Add homepage CLI promo strip (terminal snippet style, links to /cli)
- Add clear button to recently viewed section
- Integrate CliHandoff component into ProductDetailPage error states

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 14:22:00 +05:30
Shekhar Vaidya
bf5dca1fe4 feat: Phase 4 web-to-CLI handoff UX
- Add CliHandoff component: shows install link + pre-filled msdl command
- Highlighted card (Recommended) shown inline on Sentinel/WAF errors
- Collapsed version shown below OfficialFallback on stale links
- Rename instructions with platform-specific filenames (msdl.exe / msdl)
- Fix backend CORS to allow local network origins (100.x, 192.168.x)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 12:16:43 +05:30
Shekhar Vaidya
6bc2785994 feat(cli): formatted download output and contribute message
Show the ISO filename above each link with a separator rule so the
output is easier to read. Updated contribute message to reference
MSDL Web App with URL instead of bare domain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 11:21:19 +05:30
Shekhar Vaidya
36c875ab23 fix: use extractRawExpiry for /contribute expiry validation
parseLinkExpiry has a 1h safety floor that causes it to treat already-
expired URLs as valid. Replace with extractRawExpiry + direct se
timestamp comparison so any URL expiring < 1h out is rejected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 16:12:36 +05:30
Shekhar Vaidya
9a5f41290d feat: Phase 3 crowdsourced cache contribution
- Redis L2 persistent cache: initRedis() from REDIS_URL env, seed
  in-memory linkCache on startup, write-through on every fresh fetch
  and background refresh (silent fallback to memory-only if unavailable)
- POST /contribute endpoint: validates product catalog, expiry > 1h,
  Microsoft CDN host allow-list, per-IP token bucket (~5/min),
  CONTRIBUTE_SECRET header; writes to in-memory + Redis; logs all
  accepts and rejections
- CLI --no-contribute flag (also MSDL_NO_CONTRIBUTE=1 env var):
  background goroutine posts raw MS JSON to /contribute after every
  consumer fetch; best-effort 5s timeout; opt-out message to stderr

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 14:07:35 +05:30
Shekhar
7ebf5a9560
feat: msdl CLI — direct Windows ISO downloads from user's machine (Phase 2)
feat: msdl CLI — direct Windows ISO downloads from user's machine (Phase 2)
2026-06-18 13:13:04 +05:30
Shekhar
72ad55eda8
feat: web graceful degradation for Microsoft WAF blocks (Phase 1)
feat: web graceful degradation for Microsoft WAF blocks (Phase 1)
2026-06-18 13:09:58 +05:30
Shekhar Vaidya
9acc5dbf31 feat(cli): interactive language picker for eval downloads 2026-06-18 13:08:05 +05:30
Shekhar Vaidya
4cc344e666 chore(winget): fill SHA256 for v0.1.0 Windows binary 2026-06-18 12:47:04 +05:30
Shekhar Vaidya
ad7ebb312f fix(ci): check WINGET_TOKEN in shell, not in workflow if condition 2026-06-18 12:43:10 +05:30
Shekhar Vaidya
17691b0c79 chore(winget): initial manifest for starkSV.msdl v0.1.0 2026-06-18 12:17:00 +05:30
Shekhar Vaidya
5c7f805f41 ci: GitHub Actions release workflow for msdl CLI binaries 2026-06-18 12:11:56 +05:30
Shekhar Vaidya
cdf64f4c3e feat(cli): main flow with interactive and named-arg modes 2026-06-18 12:09:56 +05:30
Shekhar Vaidya
2f93726ec9 fix(cli): guard empty slices in pickers, propagate scanner I/O errors 2026-06-18 12:01:13 +05:30
Shekhar Vaidya
e8a4be2698 feat(cli): interactive numbered picker (stdin/stderr separated) 2026-06-18 11:53:59 +05:30
Shekhar Vaidya
09c3b2b175 feat(cli): direct Microsoft client (session, SKU, links, eval scrape) 2026-06-18 11:45:14 +05:30
Shekhar Vaidya
86f9b685de feat(cli): product catalog with word-based search 2026-06-18 11:39:09 +05:30
Shekhar Vaidya
9a860022fd feat(cli): scaffold Go module 2026-06-18 11:36:33 +05:30
Shekhar Vaidya
123643a947 feat: use short links for guide URLs in OfficialFallback; add Win 8.1 guide
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 11:29:38 +05:30
Shekhar Vaidya
3cd8528430 feat: add tech-latest guide links to official fallback component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 11:20:42 +05:30
Shekhar Vaidya
77056cb50f feat: Phase 1 graceful degradation for WAF-blocked links
- Backend: emit X-MSDL-Link-Status (fresh/cached/stale) and
  X-MSDL-Link-Expires headers on every /proxy response; expose
  both via Access-Control-Expose-Headers
- Frontend: read headers in handleGetLinks/handleRefreshLinks;
  show amber stale warning when backend is WAF-blocked
- Frontend: new OfficialFallback component (collapsible) with
  step-by-step guide to Microsoft's official download page,
  pre-filled with the user's selected language; shown on stale
- Plan: add Redis/Valkey persistence section to Phase 3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 11:13:46 +05:30