@nerviq/cli 0.0.1 → 0.9.0-beta.2
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.
- package/CHANGELOG.md +181 -0
- package/LICENSE +21 -0
- package/README.md +447 -0
- package/bin/cli.js +749 -0
- package/content/case-study-template.md +91 -0
- package/content/claims-governance.md +37 -0
- package/content/claude-code/audit-repo/SKILL.md +20 -0
- package/content/claude-native-integration.md +60 -0
- package/content/devto-article.json +9 -0
- package/content/launch-posts.md +226 -0
- package/content/pilot-rollout-kit.md +30 -0
- package/content/release-checklist.md +31 -0
- package/package.json +53 -4
- package/src/activity.js +529 -0
- package/src/aider/activity.js +226 -0
- package/src/aider/config-parser.js +166 -0
- package/src/aider/context.js +158 -0
- package/src/aider/deep-review.js +316 -0
- package/src/aider/domain-packs.js +278 -0
- package/src/aider/freshness.js +168 -0
- package/src/aider/governance.js +253 -0
- package/src/aider/interactive.js +334 -0
- package/src/aider/mcp-packs.js +98 -0
- package/src/aider/patch.js +214 -0
- package/src/aider/plans.js +186 -0
- package/src/aider/premium.js +360 -0
- package/src/aider/setup.js +404 -0
- package/src/aider/techniques.js +1323 -0
- package/src/analyze.js +821 -0
- package/src/audit.js +1003 -0
- package/src/badge.js +13 -0
- package/src/benchmark.js +339 -0
- package/src/claudex-sync.json +7 -0
- package/src/codex/activity.js +324 -0
- package/src/codex/config-parser.js +183 -0
- package/src/codex/context.js +221 -0
- package/src/codex/deep-review.js +493 -0
- package/src/codex/domain-packs.js +372 -0
- package/src/codex/freshness.js +167 -0
- package/src/codex/governance.js +192 -0
- package/src/codex/interactive.js +618 -0
- package/src/codex/mcp-packs.js +660 -0
- package/src/codex/patch.js +209 -0
- package/src/codex/plans.js +251 -0
- package/src/codex/premium.js +614 -0
- package/src/codex/setup.js +603 -0
- package/src/codex/techniques.js +2649 -0
- package/src/context.js +272 -0
- package/src/copilot/activity.js +309 -0
- package/src/copilot/config-parser.js +226 -0
- package/src/copilot/context.js +197 -0
- package/src/copilot/deep-review.js +346 -0
- package/src/copilot/domain-packs.js +350 -0
- package/src/copilot/freshness.js +197 -0
- package/src/copilot/governance.js +222 -0
- package/src/copilot/interactive.js +406 -0
- package/src/copilot/mcp-packs.js +572 -0
- package/src/copilot/patch.js +238 -0
- package/src/copilot/plans.js +253 -0
- package/src/copilot/premium.js +450 -0
- package/src/copilot/setup.js +488 -0
- package/src/copilot/techniques.js +1822 -0
- package/src/cursor/activity.js +301 -0
- package/src/cursor/config-parser.js +265 -0
- package/src/cursor/context.js +236 -0
- package/src/cursor/deep-review.js +334 -0
- package/src/cursor/domain-packs.js +346 -0
- package/src/cursor/freshness.js +214 -0
- package/src/cursor/governance.js +229 -0
- package/src/cursor/interactive.js +391 -0
- package/src/cursor/mcp-packs.js +571 -0
- package/src/cursor/patch.js +243 -0
- package/src/cursor/plans.js +254 -0
- package/src/cursor/premium.js +468 -0
- package/src/cursor/setup.js +488 -0
- package/src/cursor/techniques.js +1786 -0
- package/src/deep-review.js +345 -0
- package/src/domain-packs.js +364 -0
- package/src/formatters/sarif.js +115 -0
- package/src/gemini/activity.js +402 -0
- package/src/gemini/config-parser.js +275 -0
- package/src/gemini/context.js +221 -0
- package/src/gemini/deep-review.js +559 -0
- package/src/gemini/domain-packs.js +371 -0
- package/src/gemini/freshness.js +204 -0
- package/src/gemini/governance.js +201 -0
- package/src/gemini/interactive.js +860 -0
- package/src/gemini/mcp-packs.js +658 -0
- package/src/gemini/patch.js +229 -0
- package/src/gemini/plans.js +269 -0
- package/src/gemini/premium.js +759 -0
- package/src/gemini/setup.js +692 -0
- package/src/gemini/techniques.js +2084 -0
- package/src/governance.js +523 -0
- package/src/harmony/advisor.js +383 -0
- package/src/harmony/audit.js +303 -0
- package/src/harmony/canon.js +444 -0
- package/src/harmony/cli.js +331 -0
- package/src/harmony/drift.js +401 -0
- package/src/harmony/governance.js +313 -0
- package/src/harmony/memory.js +238 -0
- package/src/harmony/sync.js +458 -0
- package/src/harmony/watch.js +336 -0
- package/src/index.js +256 -0
- package/src/insights.js +119 -0
- package/src/interactive.js +118 -0
- package/src/mcp-packs.js +597 -0
- package/src/opencode/activity.js +286 -0
- package/src/opencode/config-parser.js +109 -0
- package/src/opencode/context.js +247 -0
- package/src/opencode/deep-review.js +313 -0
- package/src/opencode/domain-packs.js +240 -0
- package/src/opencode/freshness.js +158 -0
- package/src/opencode/governance.js +159 -0
- package/src/opencode/interactive.js +392 -0
- package/src/opencode/mcp-packs.js +474 -0
- package/src/opencode/patch.js +184 -0
- package/src/opencode/plans.js +231 -0
- package/src/opencode/premium.js +413 -0
- package/src/opencode/setup.js +449 -0
- package/src/opencode/techniques.js +1713 -0
- package/src/plans.js +655 -0
- package/src/secret-patterns.js +30 -0
- package/src/setup.js +1274 -0
- package/src/synergy/adaptive.js +261 -0
- package/src/synergy/compensation.js +156 -0
- package/src/synergy/evidence.js +193 -0
- package/src/synergy/learning.js +184 -0
- package/src/synergy/patterns.js +227 -0
- package/src/synergy/ranking.js +83 -0
- package/src/synergy/report.js +163 -0
- package/src/synergy/routing.js +152 -0
- package/src/techniques.js +1354 -0
- package/src/watch.js +229 -0
- package/src/windsurf/activity.js +302 -0
- package/src/windsurf/config-parser.js +267 -0
- package/src/windsurf/context.js +249 -0
- package/src/windsurf/deep-review.js +337 -0
- package/src/windsurf/domain-packs.js +348 -0
- package/src/windsurf/freshness.js +215 -0
- package/src/windsurf/governance.js +231 -0
- package/src/windsurf/interactive.js +388 -0
- package/src/windsurf/mcp-packs.js +535 -0
- package/src/windsurf/patch.js +231 -0
- package/src/windsurf/plans.js +247 -0
- package/src/windsurf/premium.js +467 -0
- package/src/windsurf/setup.js +471 -0
- package/src/windsurf/techniques.js +1758 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode MCP Pack System — 26 MCP packs
|
|
3
|
+
*
|
|
4
|
+
* MCP config in OpenCode lives in opencode.json under "mcp": { "<name>": { ... } }
|
|
5
|
+
* Uses JSONC format with command/args/environment/tools fields.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const OPENCODE_MCP_PACKS = [
|
|
9
|
+
{
|
|
10
|
+
key: 'context7-docs',
|
|
11
|
+
label: 'Context7 Docs',
|
|
12
|
+
description: 'Live, current framework and library documentation during OpenCode sessions.',
|
|
13
|
+
useWhen: 'Repos that use any framework, library, or SDK and benefit from up-to-date docs.',
|
|
14
|
+
adoption: 'Safe default docs pack for most application repos. No auth required.',
|
|
15
|
+
trustLevel: 'high',
|
|
16
|
+
transport: 'stdio',
|
|
17
|
+
requiredAuth: [],
|
|
18
|
+
serverName: 'context7',
|
|
19
|
+
jsoncProjection: { command: ['npx', '-y', '@upstash/context7-mcp@latest'] },
|
|
20
|
+
enabledTools: ['resolve-library-id', 'get-library-docs'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: 'github-mcp',
|
|
24
|
+
label: 'GitHub',
|
|
25
|
+
description: 'Issue, PR, and repository context during OpenCode sessions.',
|
|
26
|
+
useWhen: 'Repos hosted on GitHub that benefit from issue, PR, and repo context.',
|
|
27
|
+
adoption: 'Recommended for any GitHub-hosted project. Requires GITHUB_PERSONAL_ACCESS_TOKEN.',
|
|
28
|
+
trustLevel: 'medium',
|
|
29
|
+
transport: 'stdio',
|
|
30
|
+
requiredAuth: ['GITHUB_PERSONAL_ACCESS_TOKEN'],
|
|
31
|
+
serverName: 'github',
|
|
32
|
+
jsoncProjection: {
|
|
33
|
+
command: ['npx', '-y', '@modelcontextprotocol/server-github'],
|
|
34
|
+
environment: { GITHUB_PERSONAL_ACCESS_TOKEN: '${GITHUB_PERSONAL_ACCESS_TOKEN}' },
|
|
35
|
+
},
|
|
36
|
+
enabledTools: ['list_issues', 'get_issue', 'search_issues', 'list_pull_requests', 'get_pull_request', 'get_file_contents', 'search_code'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'playwright-mcp',
|
|
40
|
+
label: 'Playwright Browser',
|
|
41
|
+
description: 'Browser automation, E2E testing, and visual QA.',
|
|
42
|
+
useWhen: 'Frontend repos with E2E tests or browser-based workflows.',
|
|
43
|
+
adoption: 'Recommended for frontend-ui repos with E2E tests. No auth required.',
|
|
44
|
+
trustLevel: 'medium',
|
|
45
|
+
transport: 'stdio',
|
|
46
|
+
requiredAuth: [],
|
|
47
|
+
serverName: 'playwright',
|
|
48
|
+
jsoncProjection: { command: ['npx', '-y', '@playwright/mcp@latest'] },
|
|
49
|
+
enabledTools: ['browser_navigate', 'browser_screenshot', 'browser_click', 'browser_type', 'browser_wait_for_selector'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'postgres-mcp',
|
|
53
|
+
label: 'PostgreSQL',
|
|
54
|
+
description: 'Schema inspection and query assistance for PostgreSQL databases.',
|
|
55
|
+
useWhen: 'Repos with PostgreSQL databases that benefit from schema and query context.',
|
|
56
|
+
adoption: 'Useful for backend-api and data-pipeline repos. Requires DATABASE_URL.',
|
|
57
|
+
trustLevel: 'low',
|
|
58
|
+
transport: 'stdio',
|
|
59
|
+
requiredAuth: ['DATABASE_URL'],
|
|
60
|
+
serverName: 'postgres',
|
|
61
|
+
jsoncProjection: {
|
|
62
|
+
command: ['npx', '-y', '@modelcontextprotocol/server-postgres', '${DATABASE_URL}'],
|
|
63
|
+
},
|
|
64
|
+
enabledTools: ['query', 'list_tables', 'describe_table'],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: 'memory-mcp',
|
|
68
|
+
label: 'Memory / Knowledge Graph',
|
|
69
|
+
description: 'Persistent entity and relationship tracking across OpenCode sessions.',
|
|
70
|
+
useWhen: 'Long-running or complex projects with many interconnected concepts.',
|
|
71
|
+
adoption: 'Safe for any repo. Stores data locally. No auth required.',
|
|
72
|
+
trustLevel: 'high',
|
|
73
|
+
transport: 'stdio',
|
|
74
|
+
requiredAuth: [],
|
|
75
|
+
serverName: 'memory',
|
|
76
|
+
jsoncProjection: { command: ['npx', '-y', '@modelcontextprotocol/server-memory'] },
|
|
77
|
+
enabledTools: ['create_entities', 'create_relations', 'search_nodes', 'open_nodes', 'read_graph'],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'sequential-thinking',
|
|
81
|
+
label: 'Sequential Thinking',
|
|
82
|
+
description: 'Structured step-by-step reasoning for complex problem-solving.',
|
|
83
|
+
useWhen: 'Complex problem-solving sessions that benefit from structured reasoning.',
|
|
84
|
+
adoption: 'Safe default for any repo. No auth required.',
|
|
85
|
+
trustLevel: 'high',
|
|
86
|
+
transport: 'stdio',
|
|
87
|
+
requiredAuth: [],
|
|
88
|
+
serverName: 'sequential-thinking',
|
|
89
|
+
jsoncProjection: { command: ['npx', '-y', '@modelcontextprotocol/server-sequential-thinking'] },
|
|
90
|
+
enabledTools: ['sequentialthinking'],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: 'filesystem-mcp',
|
|
94
|
+
label: 'Filesystem',
|
|
95
|
+
description: 'Read-only filesystem access for documentation and reference files.',
|
|
96
|
+
useWhen: 'Repos with reference files, docs, or config that OpenCode needs to read.',
|
|
97
|
+
adoption: 'Read-only default. Pass allowed directories as args.',
|
|
98
|
+
trustLevel: 'medium',
|
|
99
|
+
transport: 'stdio',
|
|
100
|
+
requiredAuth: [],
|
|
101
|
+
serverName: 'filesystem',
|
|
102
|
+
jsoncProjection: { command: ['npx', '-y', '@modelcontextprotocol/server-filesystem', '.'] },
|
|
103
|
+
enabledTools: ['read_file', 'list_directory', 'search_files', 'get_file_info'],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: 'fetch-mcp',
|
|
107
|
+
label: 'Fetch / HTTP',
|
|
108
|
+
description: 'HTTP access for fetching web pages, APIs, and documentation.',
|
|
109
|
+
useWhen: 'Repos that need HTTP access to external APIs or documentation sources.',
|
|
110
|
+
adoption: 'Useful for repos integrating external services. No auth required.',
|
|
111
|
+
trustLevel: 'medium',
|
|
112
|
+
transport: 'stdio',
|
|
113
|
+
requiredAuth: [],
|
|
114
|
+
serverName: 'fetch',
|
|
115
|
+
jsoncProjection: { command: ['npx', '-y', '@modelcontextprotocol/server-fetch'] },
|
|
116
|
+
enabledTools: ['fetch'],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'next-devtools',
|
|
120
|
+
label: 'Next.js Devtools',
|
|
121
|
+
description: 'Runtime-aware debugging and framework-specific tooling for Next.js.',
|
|
122
|
+
useWhen: 'Next.js repos that need runtime-aware debugging.',
|
|
123
|
+
adoption: 'Useful companion for frontend-ui repos running Next.js.',
|
|
124
|
+
trustLevel: 'medium',
|
|
125
|
+
transport: 'stdio',
|
|
126
|
+
requiredAuth: [],
|
|
127
|
+
serverName: 'next-devtools',
|
|
128
|
+
jsoncProjection: { command: ['npx', '-y', 'next-devtools-mcp@latest'] },
|
|
129
|
+
enabledTools: ['get_page_info', 'get_routes', 'get_components'],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: 'docker-mcp',
|
|
133
|
+
label: 'Docker',
|
|
134
|
+
description: 'Container management during OpenCode sessions.',
|
|
135
|
+
useWhen: 'Repos with containerized workflows.',
|
|
136
|
+
adoption: 'Requires Docker running locally.',
|
|
137
|
+
trustLevel: 'medium',
|
|
138
|
+
transport: 'stdio',
|
|
139
|
+
requiredAuth: [],
|
|
140
|
+
serverName: 'docker',
|
|
141
|
+
jsoncProjection: { command: ['npx', '-y', '@hypnosis/docker-mcp-server'] },
|
|
142
|
+
enabledTools: ['list_containers', 'container_logs', 'container_inspect'],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
key: 'notion-mcp',
|
|
146
|
+
label: 'Notion',
|
|
147
|
+
description: 'Access Notion documentation and wikis.',
|
|
148
|
+
useWhen: 'Teams using Notion for docs or knowledge bases.',
|
|
149
|
+
adoption: 'Requires NOTION_API_KEY.',
|
|
150
|
+
trustLevel: 'medium',
|
|
151
|
+
transport: 'stdio',
|
|
152
|
+
requiredAuth: ['NOTION_API_KEY'],
|
|
153
|
+
serverName: 'notion',
|
|
154
|
+
jsoncProjection: { command: ['npx', '-y', '@notionhq/notion-mcp-server'], environment: { NOTION_API_KEY: '${NOTION_API_KEY}' } },
|
|
155
|
+
enabledTools: ['search', 'get_page', 'get_database'],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
key: 'linear-mcp',
|
|
159
|
+
label: 'Linear',
|
|
160
|
+
description: 'Issue tracking and sprint context.',
|
|
161
|
+
useWhen: 'Teams using Linear for issue tracking.',
|
|
162
|
+
adoption: 'Requires LINEAR_API_KEY.',
|
|
163
|
+
trustLevel: 'medium',
|
|
164
|
+
transport: 'stdio',
|
|
165
|
+
requiredAuth: ['LINEAR_API_KEY'],
|
|
166
|
+
serverName: 'linear',
|
|
167
|
+
jsoncProjection: { command: ['npx', '-y', '@mseep/linear-mcp'], environment: { LINEAR_API_KEY: '${LINEAR_API_KEY}' } },
|
|
168
|
+
enabledTools: ['list_issues', 'get_issue', 'search_issues'],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: 'sentry-mcp',
|
|
172
|
+
label: 'Sentry',
|
|
173
|
+
description: 'Error tracking and debugging context.',
|
|
174
|
+
useWhen: 'Repos with Sentry error tracking.',
|
|
175
|
+
adoption: 'Requires SENTRY_AUTH_TOKEN.',
|
|
176
|
+
trustLevel: 'medium',
|
|
177
|
+
transport: 'stdio',
|
|
178
|
+
requiredAuth: ['SENTRY_AUTH_TOKEN'],
|
|
179
|
+
serverName: 'sentry',
|
|
180
|
+
jsoncProjection: { command: ['npx', '-y', '@sentry/mcp-server'], environment: { SENTRY_AUTH_TOKEN: '${SENTRY_AUTH_TOKEN}' } },
|
|
181
|
+
enabledTools: ['get_issues', 'get_issue_details', 'search_errors'],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: 'slack-mcp',
|
|
185
|
+
label: 'Slack',
|
|
186
|
+
description: 'Draft and preview Slack messages.',
|
|
187
|
+
useWhen: 'Teams using Slack for communication.',
|
|
188
|
+
adoption: 'Requires SLACK_BOT_TOKEN.',
|
|
189
|
+
trustLevel: 'low',
|
|
190
|
+
transport: 'stdio',
|
|
191
|
+
requiredAuth: ['SLACK_BOT_TOKEN'],
|
|
192
|
+
serverName: 'slack',
|
|
193
|
+
jsoncProjection: { command: ['npx', '-y', 'slack-mcp-server'], environment: { SLACK_BOT_TOKEN: '${SLACK_BOT_TOKEN}' } },
|
|
194
|
+
enabledTools: ['list_channels', 'post_message', 'search_messages'],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: 'stripe-mcp',
|
|
198
|
+
label: 'Stripe',
|
|
199
|
+
description: 'Payment and billing workflow context.',
|
|
200
|
+
useWhen: 'Repos with Stripe integration.',
|
|
201
|
+
adoption: 'Requires STRIPE_API_KEY.',
|
|
202
|
+
trustLevel: 'low',
|
|
203
|
+
transport: 'stdio',
|
|
204
|
+
requiredAuth: ['STRIPE_API_KEY'],
|
|
205
|
+
serverName: 'stripe',
|
|
206
|
+
jsoncProjection: { command: ['npx', '-y', '@stripe/mcp'], environment: { STRIPE_API_KEY: '${STRIPE_API_KEY}' } },
|
|
207
|
+
enabledTools: ['list_products', 'get_subscription', 'search_customers'],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: 'figma-mcp',
|
|
211
|
+
label: 'Figma',
|
|
212
|
+
description: 'Design file access and component inspection.',
|
|
213
|
+
useWhen: 'Design-heavy repos needing Figma access.',
|
|
214
|
+
adoption: 'Requires FIGMA_ACCESS_TOKEN.',
|
|
215
|
+
trustLevel: 'medium',
|
|
216
|
+
transport: 'stdio',
|
|
217
|
+
requiredAuth: ['FIGMA_ACCESS_TOKEN'],
|
|
218
|
+
serverName: 'figma',
|
|
219
|
+
jsoncProjection: { command: ['npx', '-y', 'claude-talk-to-figma-mcp'], environment: { FIGMA_ACCESS_TOKEN: '${FIGMA_ACCESS_TOKEN}' } },
|
|
220
|
+
enabledTools: ['get_file', 'get_components', 'get_styles'],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
key: 'mcp-security',
|
|
224
|
+
label: 'MCP Security Scanner',
|
|
225
|
+
description: 'Scan MCP servers for tool poisoning and prompt injection.',
|
|
226
|
+
useWhen: 'Any repo with 2+ MCP servers.',
|
|
227
|
+
adoption: 'Safety companion for multi-MCP setups.',
|
|
228
|
+
trustLevel: 'high',
|
|
229
|
+
transport: 'stdio',
|
|
230
|
+
requiredAuth: [],
|
|
231
|
+
serverName: 'mcp-scan',
|
|
232
|
+
jsoncProjection: { command: ['npx', '-y', 'mcp-scan@latest'] },
|
|
233
|
+
enabledTools: ['scan_servers', 'check_tools'],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
key: 'composio-mcp',
|
|
237
|
+
label: 'Composio Universal',
|
|
238
|
+
description: '500+ integrations through a single MCP gateway.',
|
|
239
|
+
useWhen: 'Enterprise or integration-heavy repos.',
|
|
240
|
+
adoption: 'Requires COMPOSIO_API_KEY.',
|
|
241
|
+
trustLevel: 'medium',
|
|
242
|
+
transport: 'stdio',
|
|
243
|
+
requiredAuth: ['COMPOSIO_API_KEY'],
|
|
244
|
+
serverName: 'composio',
|
|
245
|
+
jsoncProjection: { command: ['npx', '-y', '@composio/mcp'], environment: { COMPOSIO_API_KEY: '${COMPOSIO_API_KEY}' } },
|
|
246
|
+
enabledTools: [],
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
key: 'jira-confluence',
|
|
250
|
+
label: 'Jira',
|
|
251
|
+
description: 'Issue tracking and project management.',
|
|
252
|
+
useWhen: 'Teams using Atlassian Jira.',
|
|
253
|
+
adoption: 'Requires ATLASSIAN_API_TOKEN and ATLASSIAN_EMAIL.',
|
|
254
|
+
trustLevel: 'medium',
|
|
255
|
+
transport: 'stdio',
|
|
256
|
+
requiredAuth: ['ATLASSIAN_API_TOKEN', 'ATLASSIAN_EMAIL'],
|
|
257
|
+
serverName: 'jira',
|
|
258
|
+
jsoncProjection: { command: ['npx', '-y', 'jira-mcp'], environment: { ATLASSIAN_API_TOKEN: '${ATLASSIAN_API_TOKEN}', ATLASSIAN_EMAIL: '${ATLASSIAN_EMAIL}' } },
|
|
259
|
+
enabledTools: ['list_issues', 'get_issue', 'search_issues'],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
key: 'ga4-analytics',
|
|
263
|
+
label: 'Google Analytics 4',
|
|
264
|
+
description: 'Live GA4 data, attribution, and audience insights.',
|
|
265
|
+
useWhen: 'Repos with web analytics needs.',
|
|
266
|
+
adoption: 'Requires GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS.',
|
|
267
|
+
trustLevel: 'medium',
|
|
268
|
+
transport: 'stdio',
|
|
269
|
+
requiredAuth: ['GA4_PROPERTY_ID', 'GOOGLE_APPLICATION_CREDENTIALS'],
|
|
270
|
+
serverName: 'ga4',
|
|
271
|
+
jsoncProjection: { command: ['npx', '-y', 'mcp-server-ga4'], environment: { GA4_PROPERTY_ID: '${GA4_PROPERTY_ID}', GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}' } },
|
|
272
|
+
enabledTools: ['run_report', 'get_metadata'],
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
key: 'search-console',
|
|
276
|
+
label: 'Google Search Console',
|
|
277
|
+
description: 'Search performance and indexing data.',
|
|
278
|
+
useWhen: 'SEO-focused repos.',
|
|
279
|
+
adoption: 'Requires Google OAuth credentials.',
|
|
280
|
+
trustLevel: 'medium',
|
|
281
|
+
transport: 'stdio',
|
|
282
|
+
requiredAuth: ['GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET'],
|
|
283
|
+
serverName: 'gsc',
|
|
284
|
+
jsoncProjection: { command: ['npx', '-y', 'mcp-gsc@latest'], environment: { GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}', GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}' } },
|
|
285
|
+
enabledTools: ['search_analytics', 'get_sitemaps'],
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
key: 'n8n-workflows',
|
|
289
|
+
label: 'n8n Workflow Automation',
|
|
290
|
+
description: 'Workflow automation with 1,396 integration nodes.',
|
|
291
|
+
useWhen: 'Teams using n8n for workflow automation.',
|
|
292
|
+
adoption: 'Requires N8N_URL and N8N_API_KEY.',
|
|
293
|
+
trustLevel: 'medium',
|
|
294
|
+
transport: 'stdio',
|
|
295
|
+
requiredAuth: ['N8N_URL', 'N8N_API_KEY'],
|
|
296
|
+
serverName: 'n8n',
|
|
297
|
+
jsoncProjection: { command: ['npx', '-y', 'n8n-mcp-server@latest'], environment: { N8N_URL: '${N8N_URL}', N8N_API_KEY: '${N8N_API_KEY}' } },
|
|
298
|
+
enabledTools: ['list_workflows', 'execute_workflow'],
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: 'zendesk-mcp',
|
|
302
|
+
label: 'Zendesk',
|
|
303
|
+
description: 'Ticket management and help center content.',
|
|
304
|
+
useWhen: 'Support teams using Zendesk.',
|
|
305
|
+
adoption: 'Requires ZENDESK_API_TOKEN and ZENDESK_SUBDOMAIN.',
|
|
306
|
+
trustLevel: 'medium',
|
|
307
|
+
transport: 'stdio',
|
|
308
|
+
requiredAuth: ['ZENDESK_API_TOKEN', 'ZENDESK_SUBDOMAIN'],
|
|
309
|
+
serverName: 'zendesk',
|
|
310
|
+
jsoncProjection: { command: ['npx', '-y', 'zendesk-mcp'], environment: { ZENDESK_API_TOKEN: '${ZENDESK_API_TOKEN}', ZENDESK_SUBDOMAIN: '${ZENDESK_SUBDOMAIN}' } },
|
|
311
|
+
enabledTools: ['list_tickets', 'get_ticket', 'search_tickets'],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
key: 'infisical-secrets',
|
|
315
|
+
label: 'Infisical Secrets',
|
|
316
|
+
description: 'Secrets management with auto-rotation.',
|
|
317
|
+
useWhen: 'Repos using Infisical for secrets.',
|
|
318
|
+
adoption: 'Requires INFISICAL_TOKEN.',
|
|
319
|
+
trustLevel: 'low',
|
|
320
|
+
transport: 'stdio',
|
|
321
|
+
requiredAuth: ['INFISICAL_TOKEN'],
|
|
322
|
+
serverName: 'infisical',
|
|
323
|
+
jsoncProjection: { command: ['npx', '-y', '@infisical/mcp'], environment: { INFISICAL_TOKEN: '${INFISICAL_TOKEN}' } },
|
|
324
|
+
enabledTools: ['get_secret', 'list_secrets'],
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
key: 'shopify-mcp',
|
|
328
|
+
label: 'Shopify',
|
|
329
|
+
description: 'Shopify API and deployment tooling.',
|
|
330
|
+
useWhen: 'Shopify stores and apps.',
|
|
331
|
+
adoption: 'Requires SHOPIFY_ACCESS_TOKEN.',
|
|
332
|
+
trustLevel: 'medium',
|
|
333
|
+
transport: 'stdio',
|
|
334
|
+
requiredAuth: ['SHOPIFY_ACCESS_TOKEN'],
|
|
335
|
+
serverName: 'shopify',
|
|
336
|
+
jsoncProjection: { command: ['npx', '-y', 'shopify-mcp'], environment: { SHOPIFY_ACCESS_TOKEN: '${SHOPIFY_ACCESS_TOKEN}' } },
|
|
337
|
+
enabledTools: ['get_products', 'get_orders'],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
key: 'huggingface-mcp',
|
|
341
|
+
label: 'Hugging Face',
|
|
342
|
+
description: 'Model search, dataset discovery, and Spaces.',
|
|
343
|
+
useWhen: 'AI/ML repos needing model registry access.',
|
|
344
|
+
adoption: 'Requires HF_TOKEN.',
|
|
345
|
+
trustLevel: 'medium',
|
|
346
|
+
transport: 'stdio',
|
|
347
|
+
requiredAuth: ['HF_TOKEN'],
|
|
348
|
+
serverName: 'huggingface',
|
|
349
|
+
jsoncProjection: { command: ['npx', '-y', 'huggingface-mcp-server'], environment: { HF_TOKEN: '${HF_TOKEN}' } },
|
|
350
|
+
enabledTools: ['search_models', 'get_model_info', 'search_datasets'],
|
|
351
|
+
},
|
|
352
|
+
];
|
|
353
|
+
|
|
354
|
+
// --- Helpers ---
|
|
355
|
+
|
|
356
|
+
function getOpenCodeMcpPack(key) {
|
|
357
|
+
return OPENCODE_MCP_PACKS.find(pack => pack.key === key) || null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function normalizeOpenCodeMcpPackKeys(keys = []) {
|
|
361
|
+
return [...new Set((Array.isArray(keys) ? keys : [])
|
|
362
|
+
.map(key => `${key}`.trim())
|
|
363
|
+
.filter(Boolean))]
|
|
364
|
+
.filter(key => !!getOpenCodeMcpPack(key));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function packToJsonc(pack) {
|
|
368
|
+
const proj = pack.jsoncProjection;
|
|
369
|
+
const entry = {};
|
|
370
|
+
if (proj.command) entry.command = proj.command;
|
|
371
|
+
if (proj.environment) entry.environment = proj.environment;
|
|
372
|
+
if (pack.enabledTools && pack.enabledTools.length > 0) {
|
|
373
|
+
entry.tools = {};
|
|
374
|
+
for (const tool of pack.enabledTools) {
|
|
375
|
+
entry.tools[tool] = true;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return { [pack.serverName]: entry };
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function packsToJsonc(packKeys = []) {
|
|
382
|
+
const mcp = {};
|
|
383
|
+
for (const key of normalizeOpenCodeMcpPackKeys(packKeys)) {
|
|
384
|
+
const pack = getOpenCodeMcpPack(key);
|
|
385
|
+
if (!pack) continue;
|
|
386
|
+
Object.assign(mcp, packToJsonc(pack));
|
|
387
|
+
}
|
|
388
|
+
return JSON.stringify({ mcp }, null, 2);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function hasPostgresSignals(ctx, deps) {
|
|
392
|
+
const hasDep = (name) => Object.prototype.hasOwnProperty.call(deps || {}, name);
|
|
393
|
+
return hasDep('pg') || hasDep('postgres') || hasDep('prisma') || hasDep('@prisma/client');
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function getProjectDependencies(ctx) {
|
|
397
|
+
if (typeof ctx.projectDependencies === 'function') return ctx.projectDependencies();
|
|
398
|
+
const pkg = ctx.jsonFile('package.json') || {};
|
|
399
|
+
return { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function recommendOpenCodeMcpPacks(stacks = [], domainPacks = [], options = {}) {
|
|
403
|
+
const ctx = options.ctx || null;
|
|
404
|
+
const stackKeys = new Set(stacks.map(s => s.key));
|
|
405
|
+
const domainKeys = new Set(domainPacks.map(p => p.key));
|
|
406
|
+
const deps = ctx ? getProjectDependencies(ctx) : {};
|
|
407
|
+
const recommended = [];
|
|
408
|
+
|
|
409
|
+
function add(key, reason) {
|
|
410
|
+
if (recommended.some(r => r.key === key)) return;
|
|
411
|
+
const pack = getOpenCodeMcpPack(key);
|
|
412
|
+
if (!pack) return;
|
|
413
|
+
recommended.push({ ...pack, matchReason: reason });
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Always recommend docs
|
|
417
|
+
add('context7-docs', 'Safe default for up-to-date docs.');
|
|
418
|
+
|
|
419
|
+
// GitHub for GitHub repos
|
|
420
|
+
if (ctx && (ctx.hasDir('.github') || ctx.fileContent('.git/config'))) {
|
|
421
|
+
add('github-mcp', 'GitHub-hosted repo detected.');
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Frontend packs
|
|
425
|
+
if (stackKeys.has('react') || stackKeys.has('nextjs') || stackKeys.has('vue') || domainKeys.has('frontend-ui')) {
|
|
426
|
+
add('playwright-mcp', 'Frontend stack detected.');
|
|
427
|
+
}
|
|
428
|
+
if (stackKeys.has('nextjs')) {
|
|
429
|
+
add('next-devtools', 'Next.js detected.');
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// Backend / data packs
|
|
433
|
+
if (ctx && hasPostgresSignals(ctx, deps)) {
|
|
434
|
+
add('postgres-mcp', 'PostgreSQL signals detected.');
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Docker
|
|
438
|
+
if (stackKeys.has('docker') || (ctx && (ctx.fileContent('Dockerfile') || ctx.fileContent('docker-compose.yml')))) {
|
|
439
|
+
add('docker-mcp', 'Docker usage detected.');
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Security scanner for multi-MCP
|
|
443
|
+
if (recommended.length >= 2) {
|
|
444
|
+
add('mcp-security', 'Multiple MCP servers — security scanner recommended.');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return recommended;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function getOpenCodeMcpPreflight(packKeys = []) {
|
|
451
|
+
return normalizeOpenCodeMcpPackKeys(packKeys).map(key => {
|
|
452
|
+
const pack = getOpenCodeMcpPack(key);
|
|
453
|
+
if (!pack) return { key, safe: false, warning: `Unknown pack "${key}".` };
|
|
454
|
+
if (pack.requiredAuth.length === 0) {
|
|
455
|
+
return { key, label: pack.label, safe: true, warning: null };
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
key,
|
|
459
|
+
label: pack.label,
|
|
460
|
+
safe: false,
|
|
461
|
+
warning: `Requires: ${pack.requiredAuth.join(', ')}. Set these as environment variables before enabling.`,
|
|
462
|
+
};
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
module.exports = {
|
|
467
|
+
OPENCODE_MCP_PACKS,
|
|
468
|
+
getOpenCodeMcpPack,
|
|
469
|
+
normalizeOpenCodeMcpPackKeys,
|
|
470
|
+
packToJsonc,
|
|
471
|
+
packsToJsonc,
|
|
472
|
+
recommendOpenCodeMcpPacks,
|
|
473
|
+
getOpenCodeMcpPreflight,
|
|
474
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Patch Intelligence
|
|
3
|
+
*
|
|
4
|
+
* Safe patching of existing OpenCode files using managed blocks.
|
|
5
|
+
* Supports AGENTS.md (HTML comment blocks) and opencode.json (JSONC managed sections).
|
|
6
|
+
*
|
|
7
|
+
* Managed blocks are sections that nerviq controls.
|
|
8
|
+
* Hand-authored content outside managed blocks is preserved.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { writeRollbackArtifact, writeActivityArtifact } = require('../activity');
|
|
14
|
+
const { tryParseJsonc } = require('./config-parser');
|
|
15
|
+
|
|
16
|
+
// Managed block markers
|
|
17
|
+
const MANAGED_START_MD = '<!-- nerviq:managed:start -->';
|
|
18
|
+
const MANAGED_END_MD = '<!-- nerviq:managed:end -->';
|
|
19
|
+
const MANAGED_START_JSONC = '// nerviq:managed:start';
|
|
20
|
+
const MANAGED_END_JSONC = '// nerviq:managed:end';
|
|
21
|
+
|
|
22
|
+
function extractManagedBlock(content, startMarker, endMarker) {
|
|
23
|
+
const startIdx = content.indexOf(startMarker);
|
|
24
|
+
const endIdx = content.indexOf(endMarker);
|
|
25
|
+
|
|
26
|
+
if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx) {
|
|
27
|
+
return { before: content, managed: null, after: '' };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
before: content.substring(0, startIdx),
|
|
32
|
+
managed: content.substring(startIdx + startMarker.length, endIdx).trim(),
|
|
33
|
+
after: content.substring(endIdx + endMarker.length),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function upsertManagedBlock(content, newManaged, startMarker, endMarker) {
|
|
38
|
+
const { before, managed, after } = extractManagedBlock(content, startMarker, endMarker);
|
|
39
|
+
|
|
40
|
+
if (managed !== null) {
|
|
41
|
+
return `${before}${startMarker}\n${newManaged}\n${endMarker}${after}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const separator = content.endsWith('\n') ? '\n' : '\n\n';
|
|
45
|
+
return `${content}${separator}${startMarker}\n${newManaged}\n${endMarker}\n`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function patchAgentsMd(existingContent, managedSections) {
|
|
49
|
+
const newManaged = Object.entries(managedSections)
|
|
50
|
+
.map(([section, content]) => `## ${section}\n${content}`)
|
|
51
|
+
.join('\n\n');
|
|
52
|
+
|
|
53
|
+
return upsertManagedBlock(existingContent, newManaged, MANAGED_START_MD, MANAGED_END_MD);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Patch opencode.json by safely merging new keys.
|
|
58
|
+
* Never weakens existing permission posture.
|
|
59
|
+
* Only adds new keys that don't already exist.
|
|
60
|
+
*/
|
|
61
|
+
function patchConfigJsonc(existingContent, newKeys) {
|
|
62
|
+
const parsed = tryParseJsonc(existingContent);
|
|
63
|
+
if (!parsed.ok) return existingContent;
|
|
64
|
+
|
|
65
|
+
const existing = parsed.data;
|
|
66
|
+
let changed = false;
|
|
67
|
+
|
|
68
|
+
for (const [key, value] of Object.entries(newKeys)) {
|
|
69
|
+
if (existing[key] === undefined) {
|
|
70
|
+
existing[key] = value;
|
|
71
|
+
changed = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!changed) return existingContent;
|
|
76
|
+
|
|
77
|
+
return JSON.stringify(existing, null, 2) + '\n';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function detectMixedAgentRepo(dir) {
|
|
81
|
+
const hasClaude = fs.existsSync(path.join(dir, 'CLAUDE.md')) ||
|
|
82
|
+
fs.existsSync(path.join(dir, '.claude'));
|
|
83
|
+
const hasOpenCode = fs.existsSync(path.join(dir, 'opencode.json')) ||
|
|
84
|
+
fs.existsSync(path.join(dir, 'opencode.jsonc')) ||
|
|
85
|
+
fs.existsSync(path.join(dir, '.opencode'));
|
|
86
|
+
const hasAgentsMd = fs.existsSync(path.join(dir, 'AGENTS.md'));
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
isMixed: hasClaude && (hasOpenCode || hasAgentsMd),
|
|
90
|
+
hasClaude,
|
|
91
|
+
hasOpenCode,
|
|
92
|
+
hasAgentsMd,
|
|
93
|
+
guidance: hasClaude && hasOpenCode
|
|
94
|
+
? 'This is a mixed-agent repo. Keep Claude instructions in CLAUDE.md and OpenCode instructions in AGENTS.md. AGENTS.md takes precedence in OpenCode.'
|
|
95
|
+
: null,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function generatePatchPreview(originalContent, patchedContent, filePath) {
|
|
100
|
+
const origLines = originalContent.split('\n');
|
|
101
|
+
const patchLines = patchedContent.split('\n');
|
|
102
|
+
|
|
103
|
+
const lines = [`--- ${filePath} (original)`, `+++ ${filePath} (patched)`];
|
|
104
|
+
|
|
105
|
+
let inChange = false;
|
|
106
|
+
for (let i = 0; i < Math.max(origLines.length, patchLines.length); i++) {
|
|
107
|
+
const orig = origLines[i] || '';
|
|
108
|
+
const patched = patchLines[i] || '';
|
|
109
|
+
if (orig !== patched) {
|
|
110
|
+
if (!inChange) {
|
|
111
|
+
lines.push(`@@ line ${i + 1} @@`);
|
|
112
|
+
inChange = true;
|
|
113
|
+
}
|
|
114
|
+
if (i < origLines.length) lines.push(`-${orig}`);
|
|
115
|
+
if (i < patchLines.length) lines.push(`+${patched}`);
|
|
116
|
+
} else {
|
|
117
|
+
inChange = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return lines.join('\n');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function applyPatch(dir, filePath, patchFn, options = {}) {
|
|
125
|
+
const fullPath = path.join(dir, filePath);
|
|
126
|
+
const dryRun = options.dryRun === true;
|
|
127
|
+
|
|
128
|
+
if (!fs.existsSync(fullPath)) {
|
|
129
|
+
return { success: false, reason: `${filePath} does not exist`, preview: null };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const original = fs.readFileSync(fullPath, 'utf8');
|
|
133
|
+
const patched = patchFn(original);
|
|
134
|
+
|
|
135
|
+
if (patched === original) {
|
|
136
|
+
return { success: true, reason: 'no changes needed', preview: null, unchanged: true };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const preview = generatePatchPreview(original, patched, filePath);
|
|
140
|
+
|
|
141
|
+
if (dryRun) {
|
|
142
|
+
return { success: true, reason: 'dry run', preview, unchanged: false };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const backupPath = fullPath + '.claudex-backup';
|
|
146
|
+
fs.writeFileSync(backupPath, original, 'utf8');
|
|
147
|
+
fs.writeFileSync(fullPath, patched, 'utf8');
|
|
148
|
+
|
|
149
|
+
const rollback = writeRollbackArtifact(dir, {
|
|
150
|
+
sourcePlan: 'opencode-patch',
|
|
151
|
+
patchedFiles: [filePath],
|
|
152
|
+
backupFiles: [{ original: filePath, backup: path.relative(dir, backupPath) }],
|
|
153
|
+
rollbackInstructions: [`Restore ${filePath} from ${path.relative(dir, backupPath)}`],
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const activity = writeActivityArtifact(dir, 'opencode-patch', {
|
|
157
|
+
platform: 'opencode',
|
|
158
|
+
patchedFiles: [filePath],
|
|
159
|
+
rollbackArtifact: rollback.relativePath,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
success: true,
|
|
164
|
+
reason: 'patched',
|
|
165
|
+
preview,
|
|
166
|
+
unchanged: false,
|
|
167
|
+
rollbackArtifact: rollback.relativePath,
|
|
168
|
+
activityArtifact: activity.relativePath,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = {
|
|
173
|
+
MANAGED_START_MD,
|
|
174
|
+
MANAGED_END_MD,
|
|
175
|
+
MANAGED_START_JSONC,
|
|
176
|
+
MANAGED_END_JSONC,
|
|
177
|
+
extractManagedBlock,
|
|
178
|
+
upsertManagedBlock,
|
|
179
|
+
patchAgentsMd,
|
|
180
|
+
patchConfigJsonc,
|
|
181
|
+
detectMixedAgentRepo,
|
|
182
|
+
generatePatchPreview,
|
|
183
|
+
applyPatch,
|
|
184
|
+
};
|