-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[STG-2191] feat(cli): static browse skill nudge + de-spam update notice #2200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shrey150
wants to merge
10
commits into
main
Choose a base branch
from
shrey/browse-skill-nudge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f681dc1
feat(cli): nudge agents to install the browse skill + de-spam update …
shrey150 598d2c6
chore(cli): drop no-op changeset (browse is changeset-ignored)
shrey150 3362936
chore(cli): restore browse patch changeset
shrey150 19921e1
refactor(cli): de-scope skill nudge to static model (always-on help b…
shrey150 47aeb84
feat(cli): push the update notice once per discovered release on regu…
shrey150 e13a4eb
feat(cli): remind about updates until upgraded, once per 20h (codex p…
shrey150 9c38b32
fix(cli): detect project-scoped skill installs too
shrey150 7fa623c
chore(cli): drop reviewer-facing aside from skill-presence comment
shrey150 4b5f305
feat(cli): nudge skill install at browser-session start instead of on…
shrey150 cae6087
style(cli): prettier on init hook and nudge tests
shrey150 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "browse": patch | ||
| --- | ||
|
|
||
| Surface the browse skill at runtime with two static touchpoints. Root help (`browse` / `browse --help`) now always leads with a "Start here (for AI agents)" banner pointing to `browse skills install`. Separately, the first regular command on a fresh install prints a one-time stderr hint (never stdout) when the canonical skill dir (`~/.agents/skills/browse`) is absent — gated by a once-per-install marker file in the CLI cache dir, skipped on `help`/`skills` commands and in CI/tests, and disabled with `BROWSE_DISABLE_SKILL_NUDGE=1`. No agent detection, session keys, or time windows are involved; the only check is one canonical-path lookup. Command telemetry includes a `skill_present` property driven by the same check so skill adoption is measurable. | ||
|
|
||
| Also stop the "Update available" notice from printing on every command. The update check still refreshes its cache silently in the background, but the notice is now shown only on the human-facing surfaces — `browse` / `browse --help` and `browse doctor` — so it no longer spams scripts and agent command loops. |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { join } from "node:path"; | ||
|
|
||
| import { Help } from "@oclif/core"; | ||
|
|
||
| import { getUpdateNotice } from "./update.js"; | ||
|
|
||
| const AGENT_START_HERE = `Start here (for AI agents): | ||
| Run \`browse skills install\` to load the browse skill into your coding agent | ||
| (Claude Code, Codex, Cursor, Gemini, …), then prefer \`browse\` for browser | ||
| automation. | ||
| `; | ||
|
|
||
| /** | ||
| * Root-help override that leads with an agent-targeted "Start here" pointer to | ||
| * the browse skill — static help text, always shown on bare `browse` and | ||
| * `browse --help` (both route through showRootHelp). Also surfaces the update | ||
| * notice here and in `doctor` — the only human-facing surfaces that show it, | ||
| * so it never spams commands. | ||
| */ | ||
| export default class BrowseHelp extends Help { | ||
| public override async showRootHelp(): Promise<void> { | ||
| this.log(AGENT_START_HERE); | ||
| await super.showRootHelp(); | ||
| await this.writeUpdateNotice(); | ||
| } | ||
|
|
||
| private async writeUpdateNotice(): Promise<void> { | ||
| try { | ||
| const notice = await getUpdateNotice(this.config.version, process.env, { | ||
| cacheFile: join(this.config.cacheDir, "update-check.json"), | ||
| }); | ||
| if (notice) { | ||
| process.stderr.write(`\n${notice}`); | ||
| } | ||
| } catch { | ||
| // Best-effort update notice should never affect help output. | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import { isBrowseSkillInstalled } from "./skill-presence.js"; | ||
|
|
||
| /** | ||
| * Stderr tip suggesting `browse skills install`, shown when a new browser | ||
| * session's daemon starts and the bundled skill is not installed. The daemon | ||
| * spawn is the session boundary, so the tip appears once per session until | ||
| * the skill is installed — no marker files or time windows. Best-effort and | ||
| * stderr-only: it can never affect machine-readable stdout. | ||
| */ | ||
| export async function maybeNudgeInstallSkill( | ||
| env: NodeJS.ProcessEnv = process.env, | ||
| ): Promise<void> { | ||
| if (isNudgeDisabled(env)) { | ||
| return; | ||
| } | ||
|
|
||
| if (await isBrowseSkillInstalled()) { | ||
| return; | ||
| } | ||
|
|
||
| writeNudge(); | ||
| } | ||
|
|
||
| function writeNudge(): void { | ||
| process.stderr.write( | ||
| [ | ||
| "Tip: browse works best with its skill loaded into your agent.", | ||
| "Run:", | ||
| " browse skills install", | ||
| "", | ||
| ].join("\n"), | ||
| ); | ||
| } | ||
|
|
||
| function isNudgeDisabled(env: NodeJS.ProcessEnv): boolean { | ||
| if ( | ||
| env.BROWSE_DISABLE_SKILL_NUDGE === "1" || | ||
| env.BB_DISABLE_SKILL_NUDGE === "1" | ||
| ) { | ||
| return true; | ||
| } | ||
| if (env.NODE_ENV === "test") { | ||
| return true; | ||
| } | ||
| return isCiEnvironment(env); | ||
| } | ||
|
|
||
| function isCiEnvironment(env: NodeJS.ProcessEnv): boolean { | ||
| const value = env.CI; | ||
| if (!value) { | ||
| return false; | ||
| } | ||
| const normalized = value.trim().toLowerCase(); | ||
| return !( | ||
| normalized === "" || | ||
| normalized === "0" || | ||
| normalized === "false" || | ||
| normalized === "no" || | ||
| normalized === "off" | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { access } from "node:fs/promises"; | ||
| import { homedir } from "node:os"; | ||
| import { join } from "node:path"; | ||
|
|
||
| /** | ||
| * Check the canonical install locations for the bundled browse skill, matching | ||
| * the `skills` CLI's own two scopes (its source resolves | ||
| * `join(global ? homedir() : cwd, ".agents", "skills")`): | ||
| * | ||
| * - global: `~/.agents/skills/browse` — what `browse skills install` | ||
| * itself writes (`npx skills add --global --agent '*'`) | ||
| * - project: `<cwd>/.agents/skills/browse` — `skills add` without `-g` | ||
| * | ||
| * Agent-specific dirs are symlinks/copies alongside the canonical dir, so two | ||
| * filesystem checks cover every agent at both scopes. | ||
| */ | ||
| export async function isBrowseSkillInstalled( | ||
| home: string = homedir(), | ||
| cwd: string = process.cwd(), | ||
| ): Promise<boolean> { | ||
| const candidates = [ | ||
| join(home, ".agents", "skills", "browse"), | ||
| join(cwd, ".agents", "skills", "browse"), | ||
| ]; | ||
|
|
||
| for (const candidate of candidates) { | ||
| try { | ||
| await access(candidate); | ||
| return true; | ||
| } catch { | ||
| // Keep checking the remaining scopes. | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.