githits 0.1.5 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "githits-plugins",
3
+ "owner": {
4
+ "name": "GitHits",
5
+ "email": "support@githits.com"
6
+ },
7
+ "metadata": {
8
+ "description": "GitHits plugins for Claude Code - code examples from global open source",
9
+ "version": "0.1.8"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "githits",
14
+ "source": "./plugins/claude",
15
+ "description": "Code examples from global open source for developers and AI assistants",
16
+ "author": {
17
+ "name": "GitHits"
18
+ },
19
+ "homepage": "https://githits.com",
20
+ "repository": "https://github.com/githits-com/githits-cli",
21
+ "license": "Apache-2.0",
22
+ "keywords": ["code-search", "open-source", "examples"],
23
+ "category": "developer-tools"
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "githits",
3
+ "version": "0.1.8",
4
+ "description": "Code examples from global open source for developers and AI assistants",
5
+ "author": {
6
+ "name": "GitHits"
7
+ },
8
+ "homepage": "https://githits.com",
9
+ "repository": "https://github.com/githits-com/githits-cli",
10
+ "license": "Apache-2.0",
11
+ "keywords": ["githits", "code-examples", "search", "mcp", "ai"]
12
+ }
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "githits": {
4
+ "command": "npx",
5
+ "args": ["-y", "githits@latest", "mcp", "start"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "githits",
3
+ "version": "0.1.8",
4
+ "description": "Code examples from global open source for developers and AI assistants",
5
+ "author": {
6
+ "name": "GitHits"
7
+ },
8
+ "homepage": "https://githits.com",
9
+ "repository": "https://github.com/githits-com/githits-cli",
10
+ "license": "Apache-2.0",
11
+ "keywords": ["githits", "code-examples", "search", "mcp", "ai"]
12
+ }
package/GEMINI.md ADDED
@@ -0,0 +1,75 @@
1
+ # GitHits
2
+
3
+ Code examples from global open source for developers and AI assistants.
4
+
5
+ ## Available Tools
6
+
7
+ ### search
8
+
9
+ Find code examples from open source repositories.
10
+
11
+ **Parameters:**
12
+
13
+ - `query` (string, required) - natural language description of what you need
14
+ - `language` (string, required) - programming language name (use `search_language` to verify)
15
+ - `license_mode` (string, optional) - one of `strict` (default), `yolo`, or `custom`
16
+
17
+ ### search_language
18
+
19
+ Look up supported programming language names. Use this before calling `search` to get the correct language identifier.
20
+
21
+ **Parameters:**
22
+
23
+ - `query` (string, required) - partial or full language name to look up
24
+
25
+ ### feedback
26
+
27
+ Rate a search result. Submit feedback after each search to improve future result quality.
28
+
29
+ **Parameters:**
30
+
31
+ - `solution_id` (string, required) - the ID of the search result
32
+ - `accepted` (boolean, required) - whether the result was useful
33
+ - `feedback_text` (string, optional) - additional context about why the result was or was not helpful
34
+
35
+ ## When to Use
36
+
37
+ Use `search` when:
38
+
39
+ - You are stuck or blocked on an implementation problem
40
+ - You need up-to-date examples for an API, library, or framework
41
+ - The user mentions GitHits or asks you to search for code examples
42
+ - You encounter an error you cannot resolve from your training data
43
+
44
+ Do not use `search` for:
45
+
46
+ - General knowledge questions that do not require code examples
47
+ - Problems you can already solve confidently
48
+
49
+ ## Authentication
50
+
51
+ - If any GitHits tool returns an authentication error, immediately run
52
+ `npx -y githits login` in the terminal. This opens the user's browser for
53
+ quick OAuth approval. Wait for the command to complete, then retry the
54
+ original tool call.
55
+ - If the environment has no display (SSH, containers), use
56
+ `npx -y githits login --no-browser` instead, which prints a URL for the
57
+ user to open on another device.
58
+ - Do NOT ask the user to run login manually - handle it automatically.
59
+ - If login fails, inform the user of the error.
60
+
61
+ ## How to Search Well
62
+
63
+ - Call `search_language` first to confirm the correct language name before calling `search`
64
+ - Formulate queries as natural language questions (e.g., "How to stream responses with the Vercel AI SDK in Next.js")
65
+ - Include specific error messages, library names, or API names when relevant
66
+ - Keep queries focused: 3-4 technical terms maximum
67
+ - Submit `feedback` after every search result you use or discard
68
+
69
+ ## License Filtering
70
+
71
+ Results respect license filtering by default. Three modes:
72
+
73
+ - **strict** (default) - excludes copyleft licenses
74
+ - **yolo** - includes all licenses
75
+ - **custom** - uses the user's blocklist configured at githits.com
package/README.md CHANGED
@@ -7,32 +7,81 @@ GitHits gives your AI coding assistant access to verified, canonical code exampl
7
7
  ## Quick Start
8
8
 
9
9
  ```sh
10
- npx githits login
10
+ npx githits init
11
11
  ```
12
12
 
13
- This opens your browser to authenticate with your [GitHits](https://githits.com) account. Once logged in, set up your AI assistant:
13
+ `init` authenticates with your [GitHits](https://githits.com) account, then auto-detects your installed coding tools and configures each one with GitHits MCP.
14
+
15
+ Supported tools: Claude Code, Cursor, Windsurf, VS Code / Copilot, Cline, Claude Desktop, Codex CLI, Gemini CLI, and Google Antigravity.
16
+
17
+ If you are using a tool that is not listed above, use the manual MCP setup instructions near the end of this README.
18
+
19
+ ### Plugin Installation (Open Plugin standard)
20
+
21
+ The npm package includes Open Plugin-compatible files:
22
+
23
+ - `.plugin/plugin.json` (vendor-neutral, used by Cursor/Codex/Copilot-compatible hosts)
24
+ - `.claude-plugin/plugin.json` (Claude Code compatibility)
25
+ - `.claude-plugin/marketplace.json` (Claude Code marketplace catalog)
26
+ - `.mcp.json` (Open Plugin MCP server config for plugin hosts)
27
+ - `plugins/claude/` (Claude plugin runtime payload: `.claude-plugin/plugin.json`, `.mcp.json`, `skills/`, and `commands/`)
28
+
29
+ Root `.claude-plugin/marketplace.json` provides marketplace metadata. Claude Code
30
+ loads the plugin runtime payload from `plugins/claude/`.
14
31
 
15
- **Claude Code**
32
+ **Claude Code Plugin (Marketplace)**
33
+
34
+ Install from terminal (recommended):
16
35
 
17
36
  ```sh
18
- claude mcp add githits -- npx -y githits mcp start
37
+ claude plugin marketplace add githits-com/githits-cli
38
+ claude plugin install githits@githits-plugins
19
39
  ```
20
40
 
21
- **Cursor / VS Code**
41
+ This is preferred over in-session install so the plugin is loaded cleanly on
42
+ next `claude` launch.
22
43
 
23
- Add to your MCP settings JSON:
44
+ Alternative (inside Claude input):
24
45
 
25
- ```json
26
- {
27
- "mcpServers": {
28
- "githits": {
29
- "command": "npx",
30
- "args": ["-y", "githits", "mcp", "start"]
31
- }
32
- }
33
- }
46
+ ```sh
47
+ /plugin marketplace add githits-com/githits-cli
48
+ /plugin install githits@githits-plugins
49
+ ```
50
+
51
+ If installed inside a running Claude session, reload/restart Claude if the
52
+ plugin is not immediately available.
53
+
54
+ For unpublished/local testing of this repository:
55
+
56
+ ```sh
57
+ claude plugin marketplace add "$PWD"
58
+ claude plugin install githits@githits-plugins
59
+ ```
60
+
61
+ By default, the plugin starts MCP with `npx -y githits@latest mcp start` so installs track the latest published GitHits CLI.
62
+
63
+ For unpublished/local testing, install from your local repository path and verify behavior in your host before publishing.
64
+
65
+ In Claude Code, run `/mcp` and confirm `plugin:githits:githits` is listed for the plugin path.
66
+
67
+ Note: when running Claude in this repository directory, root `.mcp.json` can also register `githits` for project-level MCP. For plugin-only attribution during testing, run Claude from a different working directory.
68
+
69
+ **Gemini CLI extension install**
70
+
71
+ ```sh
72
+ gemini extensions install https://github.com/githits-com/githits-cli
34
73
  ```
35
74
 
75
+ For plugin-based hosts, install from npm/GitHub using your agent's plugin workflow and enable plugin `githits`.
76
+
77
+ ### Agent Coverage
78
+
79
+ - **Cursor**: reads vendor-neutral `.plugin/` for Open Plugin installs
80
+ - **Claude Code**: supports `.claude-plugin/` and Open Plugin components
81
+ - **Codex**: supports Open Plugin components
82
+ - **GitHub Copilot**: supports Open Plugin components
83
+ - **Gemini CLI**: supports `gemini-extension.json` and `GEMINI.md`
84
+
36
85
  That's it. Your assistant now has a `search` tool it will use automatically when it needs code examples.
37
86
 
38
87
  ## How It Works
@@ -84,7 +133,8 @@ export GITHITS_API_TOKEN=ghi-your-token-here
84
133
  ## Commands
85
134
 
86
135
  ```
87
- githits login Authenticate with your GitHits account
136
+ githits init Authenticate and configure your coding tools with GitHits MCP
137
+ githits login Authenticate with your GitHits account (also runs as part of init)
88
138
  githits logout Remove stored credentials
89
139
  githits mcp Show setup instructions in a terminal; starts MCP server when piped
90
140
  githits mcp start Always start MCP server (for use in MCP config files)
@@ -99,9 +149,44 @@ githits auth status Show current authentication status
99
149
  | `GITHITS_MCP_URL` | Override MCP server URL | `https://mcp.githits.com` |
100
150
  | `GITHITS_API_URL` | Override REST API URL | `https://api.githits.com` |
101
151
 
152
+ ## Manual Setup
153
+
154
+ If your tool is not in the supported `githits init` list, configure GitHits manually.
155
+
156
+ Use this MCP server command in your tool's MCP config (the host/agent runs this command):
157
+
158
+ ```sh
159
+ npx -y githits@latest mcp start
160
+ ```
161
+
162
+ A typical MCP config looks like this (check your tool's docs for exact schema/key names):
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "githits": {
168
+ "command": "npx",
169
+ "args": ["-y", "githits@latest", "mcp", "start"]
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ If you'd like another tool to be included in `githits init` for auto-configuration, open an issue or PR.
176
+
177
+ ## Development
178
+
179
+ ```sh
180
+ bun run build
181
+ npm link
182
+ githits --version
183
+ ```
184
+
185
+ After the initial `npm link`, only `bun run build` is needed for subsequent changes.
186
+
102
187
  ## Requirements
103
188
 
104
- - Node.js 20 or later
189
+ - Node.js 24 or later
105
190
 
106
191
  ## License
107
192
 
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Show available GitHits commands and usage
3
+ disable-model-invocation: true
4
+ ---
5
+
6
+ # GitHits Help
7
+
8
+ Run the GitHits CLI help command in the terminal:
9
+
10
+ ```
11
+ npx -y githits help
12
+ ```
13
+
14
+ Then display the command output clearly to the user, followed by this plugin
15
+ context summary:
16
+
17
+ ## Slash Commands
18
+
19
+ - `/githits:search <query>` — Search for code examples from open source.
20
+ - `/githits:login` — Authenticate with your GitHits account.
21
+ - `/githits:status` — Show your current authentication status.
22
+ - `/githits:logout` — Remove stored credentials.
23
+ - `/githits:help` — Show this help message.
24
+
25
+ ## MCP Tools
26
+
27
+ This plugin connects to the GitHits MCP server and exposes three tools:
28
+
29
+ - **search** — Find code examples by describing what you need in natural
30
+ language. Requires `query` and `language` parameters.
31
+ - **search_language** — Look up supported programming language names before
32
+ searching.
33
+ - **feedback** — Rate a search result to improve future quality.
34
+
35
+ ## Authentication
36
+
37
+ Run `npx -y githits login` to authenticate via browser, or set the
38
+ `GITHITS_API_TOKEN` environment variable for headless environments.
39
+
40
+ If users want to verify MCP tools loaded, suggest `/mcp`.
41
+
42
+ If the command fails, report the error and suggest running:
43
+
44
+ ```
45
+ npx -y githits login
46
+ ```
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: Log in to your GitHits account
3
+ ---
4
+
5
+ # Login
6
+
7
+ Authenticate the user with GitHits by running the CLI login command in the
8
+ terminal:
9
+
10
+ ```
11
+ npx -y githits login
12
+ ```
13
+
14
+ This opens the user's browser for secure OAuth authentication. Tokens are stored
15
+ locally and refreshed automatically.
16
+
17
+ If the environment has no display (SSH, CI, containers), use the `--no-browser`
18
+ flag instead:
19
+
20
+ ```
21
+ npx -y githits login --no-browser
22
+ ```
23
+
24
+ This prints a URL the user can open on another device.
25
+
26
+ Other useful flags:
27
+
28
+ - `--force` — re-authenticate even if already logged in.
29
+ - `--port <port>` — use a specific port for the local callback server.
30
+
31
+ After running the command, inform the user of the result. If login succeeds,
32
+ confirm they are authenticated. If it fails, provide the error and suggest they
33
+ try again.
34
+
35
+ Alternative: the user can set the `GITHITS_API_TOKEN` environment variable
36
+ instead of using browser login.
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Log out of your GitHits account
3
+ ---
4
+
5
+ # Logout
6
+
7
+ Sign the user out of GitHits by running the CLI logout command in the terminal:
8
+
9
+ ```
10
+ npx -y githits logout
11
+ ```
12
+
13
+ This removes the locally stored authentication tokens.
14
+
15
+ Confirm to the user that they have been logged out successfully. If the logout
16
+ fails, provide the error details.
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Search for code examples from open source via GitHits
3
+ ---
4
+
5
+ # Search
6
+
7
+ Search for code examples using GitHits for the query: "$ARGUMENTS"
8
+
9
+ Use the GitHits MCP `search` tool with the user's query. The tool requires two
10
+ parameters:
11
+
12
+ - **query**: The user's search query, formulated in natural language.
13
+ - **language**: The programming language. If the language is unclear from
14
+ context, use the `search_language` tool first to find the correct language
15
+ name.
16
+
17
+ Optional parameter:
18
+
19
+ - **license_mode**: `"strict"` (default, excludes copyleft), `"yolo"` (all
20
+ licenses), or `"custom"` (user's blocklist).
21
+
22
+ Present the results clearly. After the user has reviewed the result, use the
23
+ `feedback` tool to report whether the example was helpful.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Show your GitHits authentication status
3
+ ---
4
+
5
+ # Status
6
+
7
+ Check the user's current GitHits authentication status by running the CLI
8
+ command in the terminal:
9
+
10
+ ```
11
+ npx -y githits auth status
12
+ ```
13
+
14
+ This shows whether the user is authenticated, where credentials are sourced
15
+ from, and token expiry details when available.
16
+
17
+ After running the command, report the status clearly. If the user is not
18
+ authenticated, suggest running:
19
+
20
+ ```
21
+ npx -y githits login
22
+ ```