githits 0.1.7 → 0.1.9

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.9"
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.9",
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.9",
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
@@ -14,11 +14,81 @@ npx githits init
14
14
 
15
15
  Supported tools: Claude Code, Cursor, Windsurf, VS Code / Copilot, Cline, Claude Desktop, Codex CLI, Gemini CLI, and Google Antigravity.
16
16
 
17
- That's it. Your assistant now has a `search` tool it will use automatically when it needs code examples.
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/`.
31
+
32
+ **Claude Code Plugin (Marketplace)**
33
+
34
+ Install from terminal (recommended):
35
+
36
+ ```sh
37
+ claude plugin marketplace add githits-com/githits-cli
38
+ claude plugin install githits@githits-plugins
39
+ ```
40
+
41
+ This is preferred over in-session install so the plugin is loaded cleanly on
42
+ next `claude` launch.
43
+
44
+ Alternative (inside Claude input):
45
+
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
73
+ ```
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
+
85
+ That's it. Your assistant now has GitHits search tools, and on accounts with package/source access enabled it also gets dependency inspection tools.
18
86
 
19
87
  ## How It Works
20
88
 
21
- GitHits runs as an [MCP server](https://modelcontextprotocol.io/) that your AI assistant connects to over stdio. The assistant gets three tools:
89
+ GitHits runs as an [MCP server](https://modelcontextprotocol.io/) that your AI assistant connects to over stdio.
90
+
91
+ Core tools available in every authenticated session:
22
92
 
23
93
  | Tool | Purpose |
24
94
  |---|---|
@@ -28,6 +98,21 @@ GitHits runs as an [MCP server](https://modelcontextprotocol.io/) that your AI a
28
98
 
29
99
  The assistant decides when to call these tools on its own — typically when it's stuck, needs a working example for an unfamiliar API, or encounters an error it can't resolve from its training data alone.
30
100
 
101
+ When package/source access is enabled for the current token, GitHits also exposes these capability-gated tools:
102
+
103
+ | Tool | Purpose |
104
+ |---|---|
105
+ | `package_summary` | Quick package overview: version, license, downloads, quickstart, advisories |
106
+ | `package_vulnerabilities` | CVE / OSV advisories for a package or specific version |
107
+ | `package_dependencies` | Direct dependencies, dependency groups, and optional transitive graph |
108
+ | `package_changelog` | Release notes / changelog entries for a package or GitHub repo |
109
+ | `search_symbols` | Exact-token search inside indexed dependency source |
110
+ | `list_files` | Discover what files a dependency or repo contains |
111
+ | `read_file` | Read a dependency file by path |
112
+ | `grep_file` | Search for a case-insensitive substring within one file |
113
+
114
+ These advanced tools remain feature-gated. The MCP server advertises them only when the authenticated token is entitled to package/source access.
115
+
31
116
  ### License Filtering
32
117
 
33
118
  Search results respect license filtering by default, excluding copyleft-licensed code. Three modes are available:
@@ -73,6 +158,13 @@ githits mcp start Always start MCP server (for use in MCP config files)
73
158
  githits auth status Show current authentication status
74
159
  ```
75
160
 
161
+ When package/source access is enabled for the current token, two extra command groups are also available:
162
+
163
+ ```
164
+ githits pkg ... Package metadata: overview, advisories, deps, changelog
165
+ githits code ... Dependency source inspection: search, files, read, grep
166
+ ```
167
+
76
168
  ## Environment Variables
77
169
 
78
170
  | Variable | Purpose | Default |
@@ -80,6 +172,35 @@ githits auth status Show current authentication status
80
172
  | `GITHITS_API_TOKEN` | API token for authentication | — |
81
173
  | `GITHITS_MCP_URL` | Override MCP server URL | `https://mcp.githits.com` |
82
174
  | `GITHITS_API_URL` | Override REST API URL | `https://api.githits.com` |
175
+ | `GITHITS_CODE_NAV_URL` | Override package/source service URL | environment-specific |
176
+ | `GITHITS_CODE_NAVIGATION` | Expose hidden `pkg` / `code` command groups locally | — |
177
+
178
+ ## Manual Setup
179
+
180
+ If your tool is not in the supported `githits init` list, configure GitHits manually.
181
+
182
+ The same MCP server command exposes both the core search tools and, when your token is entitled, the package/source inspection tools. No separate install is required.
183
+
184
+ Use this MCP server command in your tool's MCP config (the host/agent runs this command):
185
+
186
+ ```sh
187
+ npx -y githits@latest mcp start
188
+ ```
189
+
190
+ A typical MCP config looks like this (check your tool's docs for exact schema/key names):
191
+
192
+ ```json
193
+ {
194
+ "mcpServers": {
195
+ "githits": {
196
+ "command": "npx",
197
+ "args": ["-y", "githits@latest", "mcp", "start"]
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ If you'd like another tool to be included in `githits init` for auto-configuration, open an issue or PR.
83
204
 
84
205
  ## Development
85
206
 
@@ -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
+ ```