RUSH-1835: agents share usage analytics + per-user GitHub namespaces#1406
Conversation
…L namespaces - Inject Cloudflare Web Analytics beacon into published HTML (cookieless, privacy-first). Opt out with --no-analytics. Token configured via setup --analytics-token or agents.yaml share.analyticsToken. - Namespace shares by GitHub username: share.agents-cli.sh/<user>/<slug>. Resolved from gh auth login, git config github.user, or AGENTS_SHARE_GITHUB_USER, with --github-user override. /<user> renders a public gallery. - Worker routes namespace paths and falls back to legacy flat slugs. - Add agents share analytics subcommand and enrich status output. Source: apps/cli/src/commands/share.ts, apps/cli/src/lib/share/*, apps/cli/src/lib/git.ts, apps/cli/docs/share.md.
Code ReviewerVerdict: Changes requested (non-blocking) — build and tests are green; two behavioral points worth the author's eyes before merge. Build: ✅ Read for repo/context: root Changes that work well
Issues that need attention1. Net effect: a user authenticated only via from 2. Public gallery changes the "unguessable slug" privacy model (worth confirming intended). Two smaller edge cases in the same function, non-blocking:
Things to verify manually
Reviewed by Code Reviewer — actually ran the build and tests on this branch. |
… private prix flagged that the 'unguessable slug' framing contradicts the new public /<github-username> gallery, which lists every non-expired namespaced share. Make the tradeoff explicit: the random tail is collision-avoidance, not a privacy control. The renderGallery pagination (cursor loop) and expiry filter prix also noted are already implemented in worker-template.ts:83-96.
# Conflicts: # apps/cli/docs/share.md
Code ReviewerVerdict: Ready to merge Build: ✅ I attempted the full suite ( I read Changes that work well
Things to verify manually
Reviewed by Code Reviewer — actually ran the build and tests on this branch. |
Code ReviewerVerdict: Changes requested Build: ✅ Read Issues that need attention
const cfg: ShareConfig = { baseUrl, accountId, workerName, bucketName, domain, analyticsToken: opts.analyticsToken };
writeShareConfig(cfg);
I reproduced this live against the actual This isn't a hypothetical re-run either — Fix: only include Test coverage gap: Changes that work well
Things to verify manually
Reviewed by Code Reviewer — actually ran the build and tests on this branch. |
Implements RUSH-1835 for the CLI.
What changed
agents share setup --analytics-token <token>stores the zone token in synced share config; every HTML publish injects thebeacon.min.jssnippet before</body>. Opt out per publish with--no-analytics.agents share foo.htmlnow publishes to<base>/<github-username>/foo. Username is resolved fromgh auth login,git config --global github.user,AGENTS_SHARE_GITHUB_USER, or--github-user. Slugs passed via--slugare scoped under the namespace, with/sanitized away.GET /<username>lists that user's shares as a styled HTML gallery./<slug>) still resolve.agents share analyticssubcommand;agents share statusnow shows namespace + analytics state.Verification
bunx tsc --noEmitclean.bun run testclean: 6425 passed, 78 skipped.Source:
apps/cli/src/commands/share.ts,apps/cli/src/lib/share/*,apps/cli/src/lib/git.ts,apps/cli/docs/share.md.