Skip to content

feat: one-time GitHub-star nudge (postinstall + doctor) + RepoStars README badge#860

Closed
ken-jo wants to merge 2 commits into
mksglu:nextfrom
ken-jo:feat/repostars-star-nudge
Closed

feat: one-time GitHub-star nudge (postinstall + doctor) + RepoStars README badge#860
ken-jo wants to merge 2 commits into
mksglu:nextfrom
ken-jo:feat/repostars-star-nudge

Conversation

@ken-jo

@ken-jo ken-jo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What / Why / How

Adds a friendly, consent-gated GitHub-star nudge — shown at most once after a real global install and once after context-mode doctor — plus the RepoStars badge at the bottom of the README. (Feature request, not a bug — no Fixes #.)

With this PR applied, after a real npm i -g context-mode and after a context-mode doctor run, the user sees a single star request; the account is starred only on an explicit "Y".

This PR (one commit per item):

  • star nudgesrc/star-nudge.ts maybeStarNudge(surface), wired into src/cli.ts doctor() (interactive consent) and scripts/postinstall.mjs (print-only). Shown once per surface via marker ~/.context-mode/.star-nudge.<surface>; only when gh is present and the repo is not already starred; stars only on an explicit "Y" at the Star now? (Y/n/skip) prompt; no TTY (postinstall) → message + URL only, never stars; opt out with CONTEXT_MODE_NO_STAR_NUDGE; never under CI; best-effort throughout.
  • README — RepoStars badge at the bottom.
  • teststests/star-nudge.test.ts: opt-out, CI-safety, and the once-per-surface marker guard.
  • preserved maintainer invariants: opt-OUT env only (no opt-in flag); exact string compare for the prompt (no NL regex); no MCP/adapter/hook/session behavior changed.

Affected platforms

Agent / CLI scope:

  • All platforms — this is the shared install (postinstall) + context-mode doctor CLI layer, common to every agent; no agent-specific or MCP/adapter code path is touched.

OS scope:

  • Linux — build + typecheck + unit tests + fake-gh smoke.
  • macOS / Windows — not separately gated: star-nudge.ts is pure cross-platform Node (os.homedir(), spawnSync, readline, fs, path.join) with no platform-specific branches, and the postinstall hook is OS-agnostic. (A macOS spot-smoke also passed.)

Scope notes:

  • Touches only the install/update + CLI doctor path. No change to the MCP server, hooks, adapters, or any agent integration — Claude Code / Codex / Cursor / Gemini / pi / OpenCode runtime behavior is unaffected.

Root Cause

N/A — this is an additive feature, not a fix for prior behavior, so there is no regression source to trace. It introduces one new module and two call sites and preserves the maintainer invariants listed above (opt-out-only env, no NL regex, no shared-path behavior change).

Validation

Check Result
npm run build + npm run typecheck pass
vitest run tests/star-nudge.test.ts 3 pass (opt-out, CI-safety, once-per-surface marker)
Smoke (fake gh, not starred, non-TTY) nudge prints once → marker suppresses repeat ✓
Smoke (already starred) silent; marker written ✓
Smoke (gh absent) no-op; no marker (retries later) ✓
Smoke (non-TTY) prints message; never prompts / stars / hangs ✓
context-mode doctor (fake gh) exits 0, nudge appended after the outro ✓

Behavioral evidence:

  • BEFORE: no star prompt anywhere.
  • AFTER: a single, consent-gated prompt after a real global install and after doctor; never stars without an explicit "Y"; never runs in CI or under the opt-out env.

Cross-agent / cross-OS risk

Minimal. The change lives entirely in scripts/postinstall.mjs and the context-mode doctor CLI path; it adds no dependency and does not touch the MCP server, hooks, adapters, or session paths. Pure cross-platform Node, so no OS-specific risk. The only outward action (gh api -X PUT) runs solely on explicit user consent at an interactive prompt.

Checklist

  • Tests added with a real behavioral regression guard (opt-out, CI-safety, once-per-surface marker)
  • New test file justified — new star-nudge module; no existing focused test owns this behavior
  • npm run build + npm run typecheck pass
  • Generated bundles regenerate via CI (not committed)
  • No new runtime dependency
  • One PR, one commit per item (star nudge; README badge)
  • Env is opt-OUT only (CONTEXT_MODE_NO_STAR_NUDGE) — no opt-in flag
  • No regex for prompt parsing — exact string compare
  • 3OS validation — Linux verified; macOS/Windows not separately gated (OS-portable Node, no platform branches)
  • Targets next

@ken-jo ken-jo marked this pull request as draft June 22, 2026 12:33
ken-jo and others added 2 commits June 22, 2026 12:42
…ctor)

Shows a friendly star request at most once per surface (marker ~/.context-mode/.star-nudge.<surface>). Stars only on an explicit "Y" at an interactive Y/n/skip prompt; postinstall (no TTY) prints the message + URL only and never touches the account. Opt out with CONTEXT_MODE_NO_STAR_NUDGE; never runs under CI. New test file tests/star-nudge.test.ts (new module — no existing file owns this behavior).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ken-jo ken-jo force-pushed the feat/repostars-star-nudge branch from 03e9558 to 8f4a6aa Compare June 22, 2026 12:42
@mksglu mksglu closed this Jun 22, 2026
@ken-jo ken-jo deleted the feat/repostars-star-nudge branch June 22, 2026 14:34
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.

2 participants