sharingan-ai 0.1.0__tar.gz

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.
Files changed (56) hide show
  1. sharingan_ai-0.1.0/.cursor/rules/sharingan.mdc +22 -0
  2. sharingan_ai-0.1.0/.gitignore +34 -0
  3. sharingan_ai-0.1.0/LICENSE +21 -0
  4. sharingan_ai-0.1.0/PKG-INFO +184 -0
  5. sharingan_ai-0.1.0/README.md +133 -0
  6. sharingan_ai-0.1.0/indexes/by-category.json +14 -0
  7. sharingan_ai-0.1.0/indexes/by-language.json +12 -0
  8. sharingan_ai-0.1.0/indexes/by-symbol-name.json +1589 -0
  9. sharingan_ai-0.1.0/libraries/fastapi/meta.json +30 -0
  10. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/clusters.json +90 -0
  11. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/config.json +1 -0
  12. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/edges.json +1280 -0
  13. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/graph.json +4872 -0
  14. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/guides.json +2853 -0
  15. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/symbols.json +705 -0
  16. sharingan_ai-0.1.0/libraries/fastapi/versions/0.115.0/version.json +14 -0
  17. sharingan_ai-0.1.0/libraries/nextjs/meta.json +30 -0
  18. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/clusters.json +862 -0
  19. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/config.json +1 -0
  20. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/edges.json +10160 -0
  21. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/graph.json +27950 -0
  22. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/guides.json +10026 -0
  23. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/symbols.json +7730 -0
  24. sharingan_ai-0.1.0/libraries/nextjs/versions/15.3.2/version.json +14 -0
  25. sharingan_ai-0.1.0/libraries/nodejs/meta.json +29 -0
  26. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/config.json +1 -0
  27. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/edges.json +1250 -0
  28. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/graph.json +5297 -0
  29. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/guides.json +2583 -0
  30. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/symbols.json +1431 -0
  31. sharingan_ai-0.1.0/libraries/nodejs/versions/22.16.0/version.json +14 -0
  32. sharingan_ai-0.1.0/libraries/zod/meta.json +30 -0
  33. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/config.json +1 -0
  34. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/edges.json +58 -0
  35. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/graph.json +185 -0
  36. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/guides.json +43 -0
  37. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/symbols.json +50 -0
  38. sharingan_ai-0.1.0/libraries/zod/versions/3.24.4/version.json +14 -0
  39. sharingan_ai-0.1.0/pyproject.toml +93 -0
  40. sharingan_ai-0.1.0/registry.json +218 -0
  41. sharingan_ai-0.1.0/schema/v1.json +196 -0
  42. sharingan_ai-0.1.0/sharingan/__init__.py +9 -0
  43. sharingan_ai-0.1.0/sharingan/build.py +314 -0
  44. sharingan_ai-0.1.0/sharingan/cache.py +120 -0
  45. sharingan_ai-0.1.0/sharingan/cli.py +370 -0
  46. sharingan_ai-0.1.0/sharingan/cluster.py +161 -0
  47. sharingan_ai-0.1.0/sharingan/dependencies.py +114 -0
  48. sharingan_ai-0.1.0/sharingan/discover.py +144 -0
  49. sharingan_ai-0.1.0/sharingan/extract.py +488 -0
  50. sharingan_ai-0.1.0/sharingan/fetch.py +242 -0
  51. sharingan_ai-0.1.0/sharingan/parse.py +638 -0
  52. sharingan_ai-0.1.0/sharingan/pipeline.py +254 -0
  53. sharingan_ai-0.1.0/sharingan/serve.py +233 -0
  54. sharingan_ai-0.1.0/sharingan/skills.py +285 -0
  55. sharingan_ai-0.1.0/test_parse.py +19 -0
  56. sharingan_ai-0.1.0/uv.lock +1328 -0
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Sharingan documentation knowledge graph integration
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Sharingan Integration
7
+
8
+ You have access to Sharingan, a knowledge graph of up-to-date documentation for popular tech stacks.
9
+
10
+ When the user asks about library APIs, framework features, or configuration:
11
+ 1. **Always prioritize MCP tools** (`search_docs`, `query_graph`, `get_symbol`) first.
12
+ 2. Use the structured results instead of guessing from training data.
13
+ 3. Note confidence tags: EXTRACTED (fact) vs INFERRED (inference).
14
+
15
+ ## Project Checkpoint
16
+ This project uses the following specific versions:
17
+ - nextjs: 15.3.2 (Path: libraries/nextjs/versions/15.3.2/)
18
+ - react: 19.1.0 (Path: libraries/react/versions/19.1.0/)
19
+
20
+ **CRITICAL**: You must strictly prioritize the Sharingan MCP tools to look up documentation for these exact versions.
21
+
22
+ Covered: React, Next.js, TypeScript, Node.js, Python, FastAPI, PostgreSQL, Tailwind CSS, Prisma, Zod
@@ -0,0 +1,34 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ *.egg
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+ ENV/
15
+
16
+ # IDE
17
+ .vscode/
18
+ .idea/
19
+ *.swp
20
+ *.swo
21
+ *~
22
+
23
+ # OS
24
+ .DS_Store
25
+ Thumbs.db
26
+
27
+ # Sharingan extraction cache (local only)
28
+ libraries/*/versions/*/cache/
29
+
30
+ # Test artifacts
31
+ tests/output/
32
+
33
+ #token
34
+ token.txt
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sharingan Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,184 @@
1
+ Metadata-Version: 2.4
2
+ Name: sharingan-ai
3
+ Version: 0.1.0
4
+ Summary: Open-source knowledge graph for latest documentation of popular tech stacks. AI coding assistant plugin for Claude Code, Codex, Cursor, and more.
5
+ Project-URL: Homepage, https://github.com/sharingan-docs/sharingan
6
+ Project-URL: Repository, https://github.com/sharingan-docs/sharingan
7
+ Project-URL: Issues, https://github.com/sharingan-docs/sharingan/issues
8
+ Author: Sharingan Contributors
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai-coding,claude-code,documentation,graphrag,knowledge-graph,mcp
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Documentation
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: beautifulsoup4>=4.12
21
+ Requires-Dist: click>=8.1
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: jsonschema>=4.20
24
+ Requires-Dist: lxml>=5.0
25
+ Requires-Dist: markdown-it-py>=3.0
26
+ Requires-Dist: networkx>=3.2
27
+ Requires-Dist: pyyaml>=6.0
28
+ Requires-Dist: rich>=13.0
29
+ Provides-Extra: all
30
+ Requires-Dist: sharingan[anthropic]; extra == 'all'
31
+ Requires-Dist: sharingan[leiden]; extra == 'all'
32
+ Requires-Dist: sharingan[mcp]; extra == 'all'
33
+ Requires-Dist: sharingan[ollama]; extra == 'all'
34
+ Requires-Dist: sharingan[openai]; extra == 'all'
35
+ Provides-Extra: anthropic
36
+ Requires-Dist: anthropic>=0.40; extra == 'anthropic'
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
39
+ Requires-Dist: pytest>=8.0; extra == 'dev'
40
+ Requires-Dist: ruff>=0.5; extra == 'dev'
41
+ Provides-Extra: leiden
42
+ Requires-Dist: igraph>=0.11; extra == 'leiden'
43
+ Requires-Dist: leidenalg>=0.10; extra == 'leiden'
44
+ Provides-Extra: mcp
45
+ Requires-Dist: mcp>=1.0; extra == 'mcp'
46
+ Provides-Extra: ollama
47
+ Requires-Dist: ollama>=0.4; extra == 'ollama'
48
+ Provides-Extra: openai
49
+ Requires-Dist: openai>=1.50; extra == 'openai'
50
+ Description-Content-Type: text/markdown
51
+
52
+ # Sharingan 👁️
53
+
54
+ **Open-source documentation knowledge graph for AI coding assistants.**
55
+
56
+ Turn the latest documentation of popular tech stacks into a queryable knowledge graph — with plugins for Claude Code, Codex, Cursor, Gemini CLI, and more.
57
+
58
+ > Think of it as: **Context7, but fully open-source.** Or **Graphify, but for external library docs instead of your codebase.**
59
+
60
+ ## Why Sharingan?
61
+
62
+ AI coding assistants hallucinate outdated APIs. Their training data has a cutoff. Sharingan solves this by maintaining a **live, version-aware knowledge graph** of the documentation for the frameworks you actually use.
63
+
64
+ | Feature | Context7 | Graphify | **Sharingan** |
65
+ |:--------|:---------|:---------|:--------------|
66
+ | Open-source backend | ❌ | ✅ | ✅ |
67
+ | Documentation focus | ✅ | ❌ (code) | ✅ |
68
+ | Version tracking | ✅ | ❌ | ✅ (last 3 majors) |
69
+ | Offline-first | ❌ | ✅ | ✅ |
70
+ | Graph relationships | ❌ (vectors) | ✅ | ✅ |
71
+ | Migration queries | ❌ | ❌ | ✅ |
72
+ | Confidence tagging | ❌ | ✅ | ✅ |
73
+
74
+ ## Quick Start
75
+
76
+ ```bash
77
+ # Install
78
+ pip install sharingan
79
+ # or
80
+ uv tool install sharingan
81
+
82
+ # Extract documentation for a library
83
+ sharingan extract zod
84
+ sharingan extract nextjs --version 15.3.2
85
+ sharingan extract react --skip-llm # Pass 1 only (free, no API key needed)
86
+
87
+ # Query the knowledge graph
88
+ sharingan query "useRouter" --lib nextjs
89
+ sharingan query "z.string" --lib zod
90
+
91
+ # Install into your AI assistant
92
+ sharingan install --platform claude
93
+ sharingan install --platform codex
94
+ sharingan install --platform cursor
95
+ ```
96
+
97
+ ## How It Works
98
+
99
+ Sharingan uses a **two-pass extraction pipeline** (inspired by [Graphify](https://github.com/safishamsi/graphify)):
100
+
101
+ ### Pass 1 — Deterministic (Free, No API Calls)
102
+ - Parses markdown/HTML documentation
103
+ - Extracts code blocks, API signatures, parameter tables
104
+ - Identifies heading structure and cross-references
105
+ - **Zero token cost** — runs entirely locally
106
+
107
+ ### Pass 2 — Semantic (LLM-Assisted)
108
+ - Summarizes prose documentation
109
+ - Infers relationships between API symbols
110
+ - Detects deprecation patterns
111
+ - Scores confidence on inferred edges
112
+ - **Auto-detects backend**: Anthropic → OpenAI → Ollama
113
+
114
+ ### Graph Building
115
+ - Merges Pass 1 + Pass 2 into a **NetworkX** directed graph
116
+ - Clusters related APIs into communities via **Leiden algorithm**
117
+ - Exports to JSON files in a git-friendly structure
118
+ - Every edge tagged with confidence: `EXTRACTED`, `INFERRED`, or `AMBIGUOUS`
119
+
120
+ ## Covered Libraries
121
+
122
+ ### Tier 1 (Available Now)
123
+ React, Next.js, TypeScript, Node.js, Python, FastAPI, PostgreSQL, Tailwind CSS, Prisma, Zod
124
+
125
+ ### Tier 2 (Coming Soon)
126
+ Vue.js, Svelte, Django, Express.js, Docker, Supabase, Drizzle ORM, tRPC, Vite, shadcn/ui
127
+
128
+ ### Tier 3 (Planned)
129
+ Angular, Rust, Go, Flask, LangChain, Vercel AI SDK, MongoDB, Redis, Stripe, AWS SDK
130
+
131
+ ## CLI Commands
132
+
133
+ ```bash
134
+ sharingan extract <library> # Extract docs into knowledge graph
135
+ sharingan list # Show all libraries in registry
136
+ sharingan info <library> # Show library details
137
+ sharingan query <question> # Query the graph
138
+ sharingan status # Show extraction statistics
139
+ sharingan install # Install AI assistant skill
140
+ ```
141
+
142
+ ## For AI Assistant Plugin Developers
143
+
144
+ Sharingan exposes an **MCP server** for direct integration:
145
+
146
+ ```bash
147
+ # Start MCP server (stdio transport)
148
+ python -m sharingan.serve
149
+
150
+ # Start MCP server (HTTP transport)
151
+ python -m sharingan.serve --transport http --port 8080
152
+ ```
153
+
154
+ ### MCP Tools Available
155
+
156
+ | Tool | Description |
157
+ |:-----|:------------|
158
+ | `resolve_library` | Find library by name |
159
+ | `get_symbol` | Get full API docs for a symbol |
160
+ | `search_docs` | Search guides and symbols |
161
+ | `get_migration` | Get migration guide between versions |
162
+ | `query_graph` | Free-form graph query |
163
+ | `get_neighbors` | Get related nodes |
164
+ | `shortest_path` | Find connection between symbols |
165
+
166
+ ## Contributing
167
+
168
+ We welcome contributions! The most impactful ways to help:
169
+
170
+ 1. **Add a library** — add an entry to `registry.json` and run the extraction pipeline
171
+ 2. **Improve parsing** — better regex patterns for API signature extraction
172
+ 3. **Report issues** — if extraction misses or misidentifies an API
173
+
174
+ ```bash
175
+ # Dev setup
176
+ git clone https://github.com/sharingan-docs/sharingan
177
+ cd sharingan
178
+ uv sync --all-extras
179
+ uv run pytest tests/ -q
180
+ ```
181
+
182
+ ## License
183
+
184
+ MIT
@@ -0,0 +1,133 @@
1
+ # Sharingan 👁️
2
+
3
+ **Open-source documentation knowledge graph for AI coding assistants.**
4
+
5
+ Turn the latest documentation of popular tech stacks into a queryable knowledge graph — with plugins for Claude Code, Codex, Cursor, Gemini CLI, and more.
6
+
7
+ > Think of it as: **Context7, but fully open-source.** Or **Graphify, but for external library docs instead of your codebase.**
8
+
9
+ ## Why Sharingan?
10
+
11
+ AI coding assistants hallucinate outdated APIs. Their training data has a cutoff. Sharingan solves this by maintaining a **live, version-aware knowledge graph** of the documentation for the frameworks you actually use.
12
+
13
+ | Feature | Context7 | Graphify | **Sharingan** |
14
+ |:--------|:---------|:---------|:--------------|
15
+ | Open-source backend | ❌ | ✅ | ✅ |
16
+ | Documentation focus | ✅ | ❌ (code) | ✅ |
17
+ | Version tracking | ✅ | ❌ | ✅ (last 3 majors) |
18
+ | Offline-first | ❌ | ✅ | ✅ |
19
+ | Graph relationships | ❌ (vectors) | ✅ | ✅ |
20
+ | Migration queries | ❌ | ❌ | ✅ |
21
+ | Confidence tagging | ❌ | ✅ | ✅ |
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # Install
27
+ pip install sharingan
28
+ # or
29
+ uv tool install sharingan
30
+
31
+ # Extract documentation for a library
32
+ sharingan extract zod
33
+ sharingan extract nextjs --version 15.3.2
34
+ sharingan extract react --skip-llm # Pass 1 only (free, no API key needed)
35
+
36
+ # Query the knowledge graph
37
+ sharingan query "useRouter" --lib nextjs
38
+ sharingan query "z.string" --lib zod
39
+
40
+ # Install into your AI assistant
41
+ sharingan install --platform claude
42
+ sharingan install --platform codex
43
+ sharingan install --platform cursor
44
+ ```
45
+
46
+ ## How It Works
47
+
48
+ Sharingan uses a **two-pass extraction pipeline** (inspired by [Graphify](https://github.com/safishamsi/graphify)):
49
+
50
+ ### Pass 1 — Deterministic (Free, No API Calls)
51
+ - Parses markdown/HTML documentation
52
+ - Extracts code blocks, API signatures, parameter tables
53
+ - Identifies heading structure and cross-references
54
+ - **Zero token cost** — runs entirely locally
55
+
56
+ ### Pass 2 — Semantic (LLM-Assisted)
57
+ - Summarizes prose documentation
58
+ - Infers relationships between API symbols
59
+ - Detects deprecation patterns
60
+ - Scores confidence on inferred edges
61
+ - **Auto-detects backend**: Anthropic → OpenAI → Ollama
62
+
63
+ ### Graph Building
64
+ - Merges Pass 1 + Pass 2 into a **NetworkX** directed graph
65
+ - Clusters related APIs into communities via **Leiden algorithm**
66
+ - Exports to JSON files in a git-friendly structure
67
+ - Every edge tagged with confidence: `EXTRACTED`, `INFERRED`, or `AMBIGUOUS`
68
+
69
+ ## Covered Libraries
70
+
71
+ ### Tier 1 (Available Now)
72
+ React, Next.js, TypeScript, Node.js, Python, FastAPI, PostgreSQL, Tailwind CSS, Prisma, Zod
73
+
74
+ ### Tier 2 (Coming Soon)
75
+ Vue.js, Svelte, Django, Express.js, Docker, Supabase, Drizzle ORM, tRPC, Vite, shadcn/ui
76
+
77
+ ### Tier 3 (Planned)
78
+ Angular, Rust, Go, Flask, LangChain, Vercel AI SDK, MongoDB, Redis, Stripe, AWS SDK
79
+
80
+ ## CLI Commands
81
+
82
+ ```bash
83
+ sharingan extract <library> # Extract docs into knowledge graph
84
+ sharingan list # Show all libraries in registry
85
+ sharingan info <library> # Show library details
86
+ sharingan query <question> # Query the graph
87
+ sharingan status # Show extraction statistics
88
+ sharingan install # Install AI assistant skill
89
+ ```
90
+
91
+ ## For AI Assistant Plugin Developers
92
+
93
+ Sharingan exposes an **MCP server** for direct integration:
94
+
95
+ ```bash
96
+ # Start MCP server (stdio transport)
97
+ python -m sharingan.serve
98
+
99
+ # Start MCP server (HTTP transport)
100
+ python -m sharingan.serve --transport http --port 8080
101
+ ```
102
+
103
+ ### MCP Tools Available
104
+
105
+ | Tool | Description |
106
+ |:-----|:------------|
107
+ | `resolve_library` | Find library by name |
108
+ | `get_symbol` | Get full API docs for a symbol |
109
+ | `search_docs` | Search guides and symbols |
110
+ | `get_migration` | Get migration guide between versions |
111
+ | `query_graph` | Free-form graph query |
112
+ | `get_neighbors` | Get related nodes |
113
+ | `shortest_path` | Find connection between symbols |
114
+
115
+ ## Contributing
116
+
117
+ We welcome contributions! The most impactful ways to help:
118
+
119
+ 1. **Add a library** — add an entry to `registry.json` and run the extraction pipeline
120
+ 2. **Improve parsing** — better regex patterns for API signature extraction
121
+ 3. **Report issues** — if extraction misses or misidentifies an API
122
+
123
+ ```bash
124
+ # Dev setup
125
+ git clone https://github.com/sharingan-docs/sharingan
126
+ cd sharingan
127
+ uv sync --all-extras
128
+ uv run pytest tests/ -q
129
+ ```
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,14 @@
1
+ {
2
+ "backend": [
3
+ "fastapi"
4
+ ],
5
+ "meta-framework": [
6
+ "nextjs"
7
+ ],
8
+ "runtime": [
9
+ "nodejs"
10
+ ],
11
+ "validation": [
12
+ "zod"
13
+ ]
14
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "javascript": [
3
+ "nodejs"
4
+ ],
5
+ "python": [
6
+ "fastapi"
7
+ ],
8
+ "typescript": [
9
+ "nextjs",
10
+ "zod"
11
+ ]
12
+ }