feat: one-time GitHub-star nudge (postinstall + doctor) + RepoStars README badge#860
Closed
ken-jo wants to merge 2 commits into
Closed
feat: one-time GitHub-star nudge (postinstall + doctor) + RepoStars README badge#860ken-jo wants to merge 2 commits into
ken-jo wants to merge 2 commits into
Conversation
…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>
03e9558 to
8f4a6aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 — noFixes #.)With this PR applied, after a real
npm i -g context-modeand after acontext-mode doctorrun, the user sees a single star request; the account is starred only on an explicit "Y".This PR (one commit per item):
src/star-nudge.tsmaybeStarNudge(surface), wired intosrc/cli.tsdoctor()(interactive consent) andscripts/postinstall.mjs(print-only). Shown once per surface via marker~/.context-mode/.star-nudge.<surface>; only whenghis present and the repo is not already starred; stars only on an explicit "Y" at theStar now? (Y/n/skip)prompt; no TTY (postinstall) → message + URL only, never stars; opt out withCONTEXT_MODE_NO_STAR_NUDGE; never under CI; best-effort throughout.tests/star-nudge.test.ts: opt-out, CI-safety, and the once-per-surface marker guard.Affected platforms
Agent / CLI scope:
context-mode doctorCLI layer, common to every agent; no agent-specific or MCP/adapter code path is touched.OS scope:
ghsmoke.star-nudge.tsis 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:
doctorpath. 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
npm run build+npm run typecheckvitest run tests/star-nudge.test.tsgh, not starred, non-TTY)ghabsent)context-mode doctor(fakegh)Behavioral evidence:
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.mjsand thecontext-mode doctorCLI 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
star-nudgemodule; no existing focused test owns this behaviornpm run build+npm run typecheckpassCONTEXT_MODE_NO_STAR_NUDGE) — no opt-in flagnext