nia-mcp-server 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl

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.

Potentially problematic release.


This version of nia-mcp-server might be problematic. Click here for more details.

@@ -0,0 +1,312 @@
1
+ # NIA Integration for Visual Studio Code
2
+
3
+ ## VSCode-Specific Configuration
4
+
5
+ ### 1. Workspace Settings
6
+ Configure `.vscode/settings.json` for NIA integration:
7
+
8
+ ```json
9
+ {
10
+ "nia.defaultRepositories": [
11
+ "owner/main-project",
12
+ "owner/dependency-lib"
13
+ ],
14
+ "nia.searchHistory": true,
15
+ "nia.autoIndex": {
16
+ "enabled": true,
17
+ "patterns": ["github.com/*/*"]
18
+ },
19
+ "nia.apiEndpoint": "https://api.trynia.ai",
20
+ "nia.cacheTimeout": 3600
21
+ }
22
+ ```
23
+
24
+ ### 2. Tasks Configuration
25
+ Set up `.vscode/tasks.json` for common NIA operations:
26
+
27
+ ```json
28
+ {
29
+ "version": "2.0.0",
30
+ "tasks": [
31
+ {
32
+ "label": "NIA: Index Current Repository",
33
+ "type": "shell",
34
+ "command": "echo 'index_repository ${workspaceFolder}'",
35
+ "problemMatcher": []
36
+ },
37
+ {
38
+ "label": "NIA: List Indexed Repositories",
39
+ "type": "shell",
40
+ "command": "echo 'list_repositories'",
41
+ "problemMatcher": []
42
+ },
43
+ {
44
+ "label": "NIA: Search Codebase",
45
+ "type": "shell",
46
+ "command": "echo 'search_codebase \"${input:searchQuery}\"'",
47
+ "problemMatcher": []
48
+ }
49
+ ],
50
+ "inputs": [
51
+ {
52
+ "id": "searchQuery",
53
+ "type": "promptString",
54
+ "description": "Enter your search query"
55
+ }
56
+ ]
57
+ }
58
+ ```
59
+
60
+ ### 3. Code Snippets
61
+ Add to `.vscode/nia.code-snippets`:
62
+
63
+ ```json
64
+ {
65
+ "Nia Index Repository": {
66
+ "prefix": "nia-index",
67
+ "body": [
68
+ "index_repository ${1:https://github.com/owner/repo}"
69
+ ],
70
+ "description": "Index a repository with Nia"
71
+ },
72
+ "Nia Search Code": {
73
+ "prefix": "nia-search",
74
+ "body": [
75
+ "search_codebase \"${1:How does authentication work?}\""
76
+ ],
77
+ "description": "Search indexed codebases"
78
+ },
79
+ "Nia Web Search": {
80
+ "prefix": "nia-web",
81
+ "body": [
82
+ "nia_web_search \"${1:find RAG implementation libraries}\""
83
+ ],
84
+ "description": "Search the web with Nia"
85
+ },
86
+ "Nia Deep Research": {
87
+ "prefix": "nia-research",
88
+ "body": [
89
+ "nia_deep_research_agent \"${1:compare X vs Y for use case}\""
90
+ ],
91
+ "description": "Perform deep research analysis"
92
+ }
93
+ }
94
+ ```
95
+
96
+ ### 4. Launch Configuration
97
+ Configure `.vscode/launch.json` for debugging with NIA context:
98
+
99
+ ```json
100
+ {
101
+ "version": "0.2.0",
102
+ "configurations": [
103
+ {
104
+ "name": "Debug with NIA Context",
105
+ "type": "node",
106
+ "request": "launch",
107
+ "program": "${workspaceFolder}/index.js",
108
+ "env": {
109
+ "NIA_API_KEY": "${env:NIA_API_KEY}",
110
+ "NIA_INDEXED_REPOS": "${workspaceFolder}/.nia/indexed_repos.json"
111
+ }
112
+ }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ ### 5. Extensions Recommendations
118
+ Add to `.vscode/extensions.json`:
119
+
120
+ ```json
121
+ {
122
+ "recommendations": [
123
+ "github.copilot",
124
+ "continue.continue",
125
+ "codeium.codeium"
126
+ ]
127
+ }
128
+ ```
129
+
130
+ ## VSCode Command Palette Integration
131
+
132
+ ### Quick Commands
133
+ Access via `Cmd/Ctrl + Shift + P`:
134
+
135
+ 1. **Nia: Index This Repository**
136
+ - Automatically indexes the current workspace
137
+ - Shows progress in status bar
138
+ - Notifies when complete
139
+
140
+ 2. **Nia: Search Symbol**
141
+ - Search for functions, classes, or variables
142
+ - Across all indexed repositories
143
+ - Jump to definition support
144
+
145
+ 3. **Nia: Explain Code**
146
+ - Select code and search for explanations
147
+ - Find similar implementations
148
+ - Understand patterns
149
+
150
+ 4. **Nia: Find Examples**
151
+ - Search for usage examples
152
+ - Filter by language or framework
153
+ - Copy-paste ready snippets
154
+
155
+ ## VSCode-Specific Workflows
156
+
157
+ ### 1. Project Onboarding
158
+ When opening a new project:
159
+ ```
160
+ 1. Check if repo is indexed: list_repositories
161
+ 2. If not, index it: index_repository [current repo]
162
+ 3. Index related dependencies
163
+ 4. Search for architecture overview
164
+ 5. Create workspace documentation
165
+ ```
166
+
167
+ ### 2. Code Review Assistance
168
+ During code reviews:
169
+ ```
170
+ 1. Search for similar patterns in indexed repos
171
+ 2. Find best practices for the specific feature
172
+ 3. Check for common pitfalls
173
+ 4. Suggest improvements based on examples
174
+ ```
175
+
176
+ ### 3. Debugging Workflow
177
+ When debugging issues:
178
+ ```
179
+ 1. Search for error messages across repos
180
+ 2. Find similar bug fixes
181
+ 3. Understand the problematic code context
182
+ 4. Search for test cases
183
+ ```
184
+
185
+ ### 4. Learning & Documentation
186
+ For learning new codebases:
187
+ ```
188
+ 1. Index the main repository
189
+ 2. Search for entry points (main, index, app)
190
+ 3. Understand the architecture
191
+ 4. Find example usage patterns
192
+ ```
193
+
194
+ ## Terminal Integration
195
+
196
+ ### Integrated Terminal Commands
197
+ Use in VSCode's integrated terminal:
198
+
199
+ ```bash
200
+ # Quick index
201
+ alias nia-index='echo "index_repository $(git remote get-url origin)"'
202
+
203
+ # Search current project
204
+ alias nia-search='echo "search_codebase"'
205
+
206
+ # List all indexed
207
+ alias nia-list='echo "list_repositories"'
208
+ ```
209
+
210
+ ### PowerShell Functions
211
+ For Windows users in `.vscode/powershell_profile.ps1`:
212
+
213
+ ```powershell
214
+ function Nia-Index {
215
+ param($repo)
216
+ Write-Host "index_repository $repo"
217
+ }
218
+
219
+ function Nia-Search {
220
+ param($query)
221
+ Write-Host "search_codebase `"$query`""
222
+ }
223
+ ```
224
+
225
+ ## Output Formatting for VSCode
226
+
227
+ ### 1. File References
228
+ Format as clickable links:
229
+ ```
230
+ 📁 authentication/middleware.ts:45
231
+ 📁 lib/auth/session.ts:23-67
232
+ 📁 pages/api/auth/[...nextauth].ts:12
233
+ ```
234
+
235
+ ### 2. Code Blocks
236
+ Use proper syntax highlighting:
237
+ ```typescript
238
+ // From: lib/auth/session.ts
239
+ export async function getSession(req: Request) {
240
+ // Implementation details
241
+ }
242
+ ```
243
+
244
+ ### 3. Problem Markers
245
+ For issues found during search:
246
+ ```
247
+ ⚠️ Warning: Deprecated pattern found
248
+ File: utils/oldAuth.js:34
249
+ Suggestion: Use new auth method
250
+
251
+ ❌ Error: Security vulnerability
252
+ File: api/user.js:56
253
+ Fix: Validate input parameters
254
+ ```
255
+
256
+ ## Keyboard Shortcuts
257
+ Suggested keybindings for `.vscode/keybindings.json`:
258
+
259
+ ```json
260
+ [
261
+ {
262
+ "key": "ctrl+shift+n i",
263
+ "command": "workbench.action.terminal.sendSequence",
264
+ "args": { "text": "index_repository " }
265
+ },
266
+ {
267
+ "key": "ctrl+shift+n s",
268
+ "command": "workbench.action.terminal.sendSequence",
269
+ "args": { "text": "search_codebase \"" }
270
+ },
271
+ {
272
+ "key": "ctrl+shift+n l",
273
+ "command": "workbench.action.terminal.sendSequence",
274
+ "args": { "text": "list_repositories\n" }
275
+ }
276
+ ]
277
+ ```
278
+
279
+ ## Performance Optimization
280
+
281
+ ### 1. Workspace-Specific Cache
282
+ Store frequently searched queries:
283
+ ```
284
+ .vscode/.nia-cache/
285
+ ├── search-results.json
286
+ ├── indexed-files.json
287
+ └── common-queries.json
288
+ ```
289
+
290
+ ### 2. Search Filters
291
+ Use repository context for faster searches:
292
+ ```
293
+ search_codebase "authentication" repositories=["current-project"]
294
+ ```
295
+
296
+ ### 3. Batch Operations
297
+ Index related repositories together:
298
+ ```
299
+ index_repository repo1
300
+ index_repository repo2
301
+ index_repository repo3
302
+ ```
303
+
304
+ ### 4. Documentation Indexing
305
+ When indexing documentation:
306
+ - If user provides just a URL without patterns, use `["/*"]` to index everything
307
+ - Or ask: "Should I index the entire documentation or specific sections?"
308
+ - Common patterns: `["/docs/*", "/api/*", "/guide/*", "/reference/*"]`
309
+ - Example: `index_documentation "https://docs.example.com" ["/*"]`
310
+ - Can index multiple doc sites for comprehensive searches
311
+
312
+ Remember: Make Nia feel like a native part of the VSCode experience!
@@ -0,0 +1,92 @@
1
+ # Nia Integration for Windsurf Cascade
2
+
3
+ ## Quick Reference
4
+ - **List indexed repos**: `list_repositories`
5
+ - **Index new repo**: `index_repository repo_url`
6
+ - **Index docs**: `index_documentation url` (use `["/*"]` for entire site)
7
+ - **Search code**: `search_codebase "your question"`
8
+ - **Search docs**: `search_documentation "your question"`
9
+ - **Web search**: `nia_web_search "find X library"`
10
+ - **Deep research**: `nia_deep_research_agent "compare X vs Y"`
11
+
12
+ ## Windsurf Cascade Guidelines
13
+
14
+ ### 1. Flow-Based Development
15
+ When using Cascade's flow feature:
16
+ - Start flows by checking indexed repositories with `list_repositories`
17
+ - Auto-suggest indexing when users mention GitHub URLs
18
+ - Use Nia search results to inform multi-step flows
19
+ - Reference specific files found via search in subsequent steps
20
+
21
+ ### 2. Memory Integration
22
+ Create memories for frequently used repositories:
23
+ - "Remember: Project X is indexed at owner/repo"
24
+ - "Remember: Use Nia to search for implementation patterns"
25
+ - Memories will automatically recall indexed repos context
26
+
27
+ ### 3. Code Understanding Workflow
28
+ For codebase exploration:
29
+ ```
30
+ 1. Check if indexed: list_repositories
31
+ 2. If not indexed: index_repository [url]
32
+ 3. Search naturally: search_codebase "How does X work?"
33
+ 4. Use results in flow steps
34
+ ```
35
+
36
+ ### 4. Search Optimization for Cascade
37
+
38
+ #### Natural Language Queries
39
+ - Write complete questions: "How is authentication implemented in this Next.js app?"
40
+ - Include context: "Find React hooks that handle user state"
41
+ - Be specific: "Show me where API routes are defined"
42
+
43
+ #### Multi-Step Flows
44
+ 1. Research: `nia_deep_research_agent "compare state management libraries"`
45
+ 2. Find examples: `nia_web_search "Redux toolkit examples"`
46
+ 3. Index chosen repo: `index_repository https://github.com/...`
47
+ 4. Explore patterns: `search_codebase "action creators pattern"`
48
+
49
+ ### 5. Cascade Commands
50
+
51
+ When users ask about code:
52
+ - Always check if the repository is indexed first
53
+ - Suggest indexing if working with a new codebase
54
+ - Use search results to build comprehensive responses
55
+ - Create flows that combine multiple searches
56
+
57
+ ### 6. Best Practices
58
+
59
+ #### For New Projects
60
+ 1. Index the main repository immediately
61
+ 2. Search for architecture overview: "How is this project structured?"
62
+ 3. Create memories of key findings
63
+ 4. Build flows based on discovered patterns
64
+
65
+ #### For Debugging
66
+ 1. Search for error messages across indexed repos
67
+ 2. Find similar implementations that work
68
+ 3. Compare working vs broken code
69
+ 4. Create fix flow based on findings
70
+
71
+ #### For Feature Development
72
+ 1. Search for similar features in indexed repos
73
+ 2. Understand existing patterns
74
+ 3. Find best practices examples
75
+ 4. Generate code following discovered patterns
76
+
77
+ ### 7. Documentation Indexing
78
+
79
+ When indexing documentation:
80
+ - If user provides just a URL without patterns, use `["/*"]` to index everything
81
+ - Or ask: "Should I index the entire documentation or specific sections?"
82
+ - Common patterns: `["/docs/*", "/api/*", "/guide/*", "/reference/*"]`
83
+ - Example: `index_documentation "https://docs.example.com" ["/*"]`
84
+
85
+ ### 8. Integration Tips
86
+
87
+ - Nia complements Cascade's abilities by providing deep code search
88
+ - Use Nia for finding specific implementations
89
+ - Let Cascade handle the creative synthesis
90
+ - Combine both for powerful development workflows
91
+
92
+ Remember: Nia provides the knowledge, Cascade provides the flow!
@@ -0,0 +1,263 @@
1
+ """
2
+ Nia Profile Configurations
3
+ Defines IDE/Editor profile configurations for rule transformation
4
+ """
5
+ from typing import Dict, Any, Optional, List
6
+
7
+ # Profile configurations define how rules are transformed and where they're placed
8
+ PROFILE_CONFIGS: Dict[str, Dict[str, Any]] = {
9
+ "cursor": {
10
+ "name": "Cursor",
11
+ "target_dir": ".cursor/rules",
12
+ "file_extension": ".mdc",
13
+ "file_map": {
14
+ "cursor_rules.md": "nia.mdc"
15
+ },
16
+ "mcp_config": True,
17
+ "format": "mdc",
18
+ "features": ["mcp", "composer", "inline_edits"],
19
+ "global_replacements": {
20
+ "# Nia": "# Nia for Cursor",
21
+ "{{IDE}}": "Cursor"
22
+ }
23
+ },
24
+
25
+ "vscode": {
26
+ "name": "Visual Studio Code",
27
+ "target_dir": ".vscode",
28
+ "file_extension": ".md",
29
+ "file_map": {
30
+ "nia_rules.md": "nia-guide.md",
31
+ "vscode_rules.md": "nia-vscode-integration.md"
32
+ },
33
+ "mcp_config": False,
34
+ "format": "markdown",
35
+ "features": ["tasks", "snippets", "terminal_integration"],
36
+ "global_replacements": {
37
+ "# Nia": "# Nia for VSCode",
38
+ "{{IDE}}": "VSCode"
39
+ },
40
+ "additional_files": {
41
+ "tasks.json": "vscode_tasks_template",
42
+ "nia.code-snippets": "vscode_snippets_template"
43
+ }
44
+ },
45
+
46
+ "claude": {
47
+ "name": "Claude Desktop",
48
+ "target_dir": ".claude",
49
+ "file_extension": ".md",
50
+ "file_map": {
51
+ "nia_rules.md": "nia_rules.md",
52
+ "claude_rules.md": "nia_claude_integration.md"
53
+ },
54
+ "mcp_config": False,
55
+ "format": "markdown",
56
+ "features": ["conversational", "context_aware", "multi_step"],
57
+ "global_replacements": {
58
+ "# Nia": "# Nia for Claude Desktop",
59
+ "{{IDE}}": "Claude"
60
+ }
61
+ },
62
+
63
+ "windsurf": {
64
+ "name": "Windsurf",
65
+ "target_dir": ".windsurfrules",
66
+ "file_extension": ".md",
67
+ "file_map": {
68
+ "nia_rules.md": "nia_rules.md",
69
+ "windsurf_rules.md": "windsurf_nia_guide.md"
70
+ },
71
+ "mcp_config": True,
72
+ "format": "markdown",
73
+ "features": ["cascade", "memories", "flows"],
74
+ "global_replacements": {
75
+ "# Nia": "# Nia for Windsurf Cascade",
76
+ "{{IDE}}": "Windsurf"
77
+ }
78
+ },
79
+
80
+ "cline": {
81
+ "name": "Cline",
82
+ "target_dir": ".cline",
83
+ "file_extension": ".md",
84
+ "file_map": {
85
+ "nia_rules.md": "nia_rules.md"
86
+ },
87
+ "mcp_config": True,
88
+ "format": "markdown",
89
+ "features": ["autonomous", "task_planning"],
90
+ "global_replacements": {
91
+ "# Nia": "# Nia for Cline",
92
+ "{{IDE}}": "Cline"
93
+ }
94
+ },
95
+
96
+ "codex": {
97
+ "name": "OpenAI Codex",
98
+ "target_dir": ".codex",
99
+ "file_extension": ".md",
100
+ "file_map": {
101
+ "nia_rules.md": "nia_codex_guide.md"
102
+ },
103
+ "mcp_config": False,
104
+ "format": "markdown",
105
+ "features": ["completion", "generation"],
106
+ "global_replacements": {
107
+ "# Nia": "# Nia for Codex",
108
+ "{{IDE}}": "Codex"
109
+ }
110
+ },
111
+
112
+ "zed": {
113
+ "name": "Zed",
114
+ "target_dir": ".zed",
115
+ "file_extension": ".md",
116
+ "file_map": {
117
+ "nia_rules.md": "nia_assistant.md"
118
+ },
119
+ "mcp_config": False,
120
+ "format": "markdown",
121
+ "features": ["assistant", "collaboration"],
122
+ "global_replacements": {
123
+ "# Nia": "# Nia for Zed",
124
+ "{{IDE}}": "Zed"
125
+ }
126
+ },
127
+
128
+ "jetbrains": {
129
+ "name": "JetBrains IDEs",
130
+ "target_dir": ".idea/nia",
131
+ "file_extension": ".md",
132
+ "file_map": {
133
+ "nia_rules.md": "nia_guide.md"
134
+ },
135
+ "mcp_config": False,
136
+ "format": "markdown",
137
+ "features": ["ai_assistant", "code_completion"],
138
+ "global_replacements": {
139
+ "# Nia": "# Nia for JetBrains",
140
+ "{{IDE}}": "JetBrains IDE"
141
+ }
142
+ },
143
+
144
+ "neovim": {
145
+ "name": "Neovim",
146
+ "target_dir": ".config/nvim/nia",
147
+ "file_extension": ".md",
148
+ "file_map": {
149
+ "nia_rules.md": "nia_guide.md"
150
+ },
151
+ "mcp_config": False,
152
+ "format": "markdown",
153
+ "features": ["copilot", "cmp"],
154
+ "global_replacements": {
155
+ "# Nia": "# Nia for Neovim",
156
+ "{{IDE}}": "Neovim"
157
+ }
158
+ },
159
+
160
+ "sublime": {
161
+ "name": "Sublime Text",
162
+ "target_dir": ".sublime",
163
+ "file_extension": ".md",
164
+ "file_map": {
165
+ "nia_rules.md": "nia_guide.md"
166
+ },
167
+ "mcp_config": False,
168
+ "format": "markdown",
169
+ "features": ["copilot"],
170
+ "global_replacements": {
171
+ "# Nia": "# Nia for Sublime Text",
172
+ "{{IDE}}": "Sublime Text"
173
+ }
174
+ }
175
+ }
176
+
177
+ # Additional template configurations for specific file types
178
+ TEMPLATE_CONFIGS = {
179
+ "vscode_tasks_template": {
180
+ "content": """{
181
+ "version": "2.0.0",
182
+ "tasks": [
183
+ {
184
+ "label": "Nia: Index Repository",
185
+ "type": "shell",
186
+ "command": "echo 'Run: index_repository ${input:repoUrl}'",
187
+ "problemMatcher": []
188
+ },
189
+ {
190
+ "label": "Nia: Search Codebase",
191
+ "type": "shell",
192
+ "command": "echo 'Run: search_codebase \\"${input:searchQuery}\\"'",
193
+ "problemMatcher": []
194
+ },
195
+ {
196
+ "label": "Nia: List Repositories",
197
+ "type": "shell",
198
+ "command": "echo 'Run: list_repositories'",
199
+ "problemMatcher": []
200
+ }
201
+ ],
202
+ "inputs": [
203
+ {
204
+ "id": "repoUrl",
205
+ "type": "promptString",
206
+ "description": "GitHub repository URL"
207
+ },
208
+ {
209
+ "id": "searchQuery",
210
+ "type": "promptString",
211
+ "description": "Search query"
212
+ }
213
+ ]
214
+ }"""
215
+ },
216
+
217
+ "vscode_snippets_template": {
218
+ "content": """{
219
+ "Nia Index": {
220
+ "prefix": "nia-index",
221
+ "body": ["index_repository ${1:repo_url}"],
222
+ "description": "Index a repository with Nia"
223
+ },
224
+ "Nia Search": {
225
+ "prefix": "nia-search",
226
+ "body": ["search_codebase \\"${1:query}\\""],
227
+ "description": "Search indexed repositories"
228
+ },
229
+ "Nia Web Search": {
230
+ "prefix": "nia-web",
231
+ "body": ["nia_web_search \\"${1:query}\\""],
232
+ "description": "Search the web with Nia"
233
+ },
234
+ "Nia Research": {
235
+ "prefix": "nia-research",
236
+ "body": ["nia_deep_research_agent \\"${1:query}\\""],
237
+ "description": "Perform deep research with Nia"
238
+ }
239
+ }"""
240
+ }
241
+ }
242
+
243
+
244
+ def get_profile_config(profile: str) -> Optional[Dict[str, Any]]:
245
+ """Get configuration for a specific profile"""
246
+ return PROFILE_CONFIGS.get(profile)
247
+
248
+
249
+ def get_supported_profiles() -> List[str]:
250
+ """Get list of all supported profiles"""
251
+ return list(PROFILE_CONFIGS.keys())
252
+
253
+
254
+ def get_profile_features(profile: str) -> List[str]:
255
+ """Get features supported by a profile"""
256
+ config = get_profile_config(profile)
257
+ return config.get("features", []) if config else []
258
+
259
+
260
+ def is_mcp_enabled(profile: str) -> bool:
261
+ """Check if a profile supports MCP"""
262
+ config = get_profile_config(profile)
263
+ return config.get("mcp_config", False) if config else False