Skip to content

feat: emit Claude Code plugin hint for the official Pinecone plugin#100

Merged
austin-denoble merged 2 commits into
mainfrom
feat/claude-code-plugin-hint
Jun 24, 2026
Merged

feat: emit Claude Code plugin hint for the official Pinecone plugin#100
austin-denoble merged 2 commits into
mainfrom
feat/claude-code-plugin-hint

Conversation

@hdworld11

@hdworld11 hdworld11 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Claude Code plugin-hint protocol. When pc runs inside a Claude Code session, it writes a one-line marker to stderr recommending the official Pinecone plugin:

<claude-code-hint v="1" type="plugin" value="pinecone@claude-plugins-official" />

Claude Code strips this line from the command output before it reaches the model (so it never appears in the conversation or counts toward tokens) and shows the user a one-time prompt to install the plugin. Installation always requires explicit user confirmation.

What the user sees

  • Running pc directly in a terminal: no change at all — emission is gated on env vars that Claude Code sets, so a no-op otherwise.
  • Running pc through Claude Code: a one-time install prompt naming the pinecone plugin. Rate-limited to once per plugin (ever) and once per Claude Code session.

Changes

  • New internal/pkg/utils/pluginhint package:
    • Emits the marker to stderr on its own line.
    • Gated on either CLAUDECODE or CLAUDE_CODE_CHILD_SESSION being set.
    • sync.Once-guarded — emits at most once per process.
  • Wired into root.Execute() so it fires for every invocation (including --help and unknown-command errors), regardless of any subcommand PersistentPreRun overrides.
  • Unit tests covering emission per env var, no-op outside Claude Code, emit-once behavior, and protocol conformance of the hint string.

Notes for reviewers

  • ⚠️ The hint only takes effect once a plugin named pinecone is listed in the official claude-plugins-official marketplace. Hints pointing at any other marketplace are silently dropped by Claude Code. If the official listing uses a different name, update hintLine in pluginhint.go (and the matching test assertion).
  • ⚠️ I was unable to run go build / go test / go vet locally (Go isn't installed on the dev machine). Please confirm CI is green before merging.

🤖 Generated with Claude Code


Note

Low Risk
Behavior is gated on Claude Code env vars and only adds optional stderr output with no changes to auth, API calls, or normal terminal usage.

Overview
Adds Claude Code plugin-hint support so pc can suggest installing pinecone@claude-plugins-official when the CLI runs inside a Claude Code session.

A new pluginhint helper writes a single protocol line to stderr only when CLAUDECODE or CLAUDE_CODE_CHILD_SESSION is set, guarded by sync.Once so it fires at most once per process. Outside Claude Code it is a no-op.

root.Execute() calls pluginhint.Emit() before Cobra runs so the hint applies to every invocation (including --help and unknown commands), not only subcommands that run PersistentPreRun. Unit tests cover env detection, no-op behavior, emit-once, and the hint string format.

Reviewed by Cursor Bugbot for commit 6eb1bd9. Bugbot is set up for automated code reviews on this repo. Configure here.

hdworld11 and others added 2 commits June 23, 2026 11:26
Add support for the Claude Code plugin-hint protocol
(https://code.claude.com/docs/en/plugin-hints). When `pc` runs inside a
Claude Code session, it writes a one-line `<claude-code-hint />` marker to
stderr recommending the official `pinecone@claude-plugins-official` plugin.
Claude Code strips the marker before it reaches the model and shows the user
a one-time install prompt.

- New `internal/pkg/utils/pluginhint` package gated on the CLAUDECODE and
  CLAUDE_CODE_CHILD_SESSION env vars, emitting at most once per process.
- Wired into root Execute() so it fires for every invocation (including
  --help and unknown-command errors) regardless of subcommand PreRun hooks.
- Unit tests for emission, no-op-outside-Claude-Code, emit-once, and protocol
  conformance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Keep the protocol-rule comments a reader can't infer from the code
(package doc, hintLine constraints, env-var semantics) and drop the
per-symbol restatements.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hdworld11 hdworld11 requested a review from austin-denoble June 23, 2026 17:24
@hdworld11 hdworld11 marked this pull request as ready for review June 23, 2026 17:24

@austin-denoble austin-denoble left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @hdworld11 for taking the time to get this spun up!

@austin-denoble austin-denoble merged commit daec5fa into main Jun 24, 2026
9 checks passed
@austin-denoble austin-denoble deleted the feat/claude-code-plugin-hint branch June 24, 2026 18:30
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