@nerviq/cli 0.0.1 → 0.9.0-beta.1

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 (148) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/LICENSE +21 -0
  3. package/README.md +447 -0
  4. package/bin/cli.js +749 -0
  5. package/content/case-study-template.md +91 -0
  6. package/content/claims-governance.md +37 -0
  7. package/content/claude-code/audit-repo/SKILL.md +20 -0
  8. package/content/claude-native-integration.md +60 -0
  9. package/content/devto-article.json +9 -0
  10. package/content/launch-posts.md +226 -0
  11. package/content/pilot-rollout-kit.md +30 -0
  12. package/content/release-checklist.md +31 -0
  13. package/package.json +53 -4
  14. package/src/activity.js +529 -0
  15. package/src/aider/activity.js +226 -0
  16. package/src/aider/config-parser.js +166 -0
  17. package/src/aider/context.js +158 -0
  18. package/src/aider/deep-review.js +316 -0
  19. package/src/aider/domain-packs.js +278 -0
  20. package/src/aider/freshness.js +168 -0
  21. package/src/aider/governance.js +253 -0
  22. package/src/aider/interactive.js +334 -0
  23. package/src/aider/mcp-packs.js +98 -0
  24. package/src/aider/patch.js +214 -0
  25. package/src/aider/plans.js +186 -0
  26. package/src/aider/premium.js +360 -0
  27. package/src/aider/setup.js +404 -0
  28. package/src/aider/techniques.js +1323 -0
  29. package/src/analyze.js +821 -0
  30. package/src/audit.js +1003 -0
  31. package/src/badge.js +13 -0
  32. package/src/benchmark.js +339 -0
  33. package/src/claudex-sync.json +7 -0
  34. package/src/codex/activity.js +324 -0
  35. package/src/codex/config-parser.js +183 -0
  36. package/src/codex/context.js +221 -0
  37. package/src/codex/deep-review.js +493 -0
  38. package/src/codex/domain-packs.js +372 -0
  39. package/src/codex/freshness.js +167 -0
  40. package/src/codex/governance.js +192 -0
  41. package/src/codex/interactive.js +618 -0
  42. package/src/codex/mcp-packs.js +660 -0
  43. package/src/codex/patch.js +209 -0
  44. package/src/codex/plans.js +251 -0
  45. package/src/codex/premium.js +614 -0
  46. package/src/codex/setup.js +603 -0
  47. package/src/codex/techniques.js +2649 -0
  48. package/src/context.js +272 -0
  49. package/src/copilot/activity.js +309 -0
  50. package/src/copilot/config-parser.js +226 -0
  51. package/src/copilot/context.js +197 -0
  52. package/src/copilot/deep-review.js +346 -0
  53. package/src/copilot/domain-packs.js +350 -0
  54. package/src/copilot/freshness.js +197 -0
  55. package/src/copilot/governance.js +222 -0
  56. package/src/copilot/interactive.js +406 -0
  57. package/src/copilot/mcp-packs.js +572 -0
  58. package/src/copilot/patch.js +238 -0
  59. package/src/copilot/plans.js +253 -0
  60. package/src/copilot/premium.js +450 -0
  61. package/src/copilot/setup.js +488 -0
  62. package/src/copilot/techniques.js +1822 -0
  63. package/src/cursor/activity.js +301 -0
  64. package/src/cursor/config-parser.js +265 -0
  65. package/src/cursor/context.js +236 -0
  66. package/src/cursor/deep-review.js +334 -0
  67. package/src/cursor/domain-packs.js +346 -0
  68. package/src/cursor/freshness.js +214 -0
  69. package/src/cursor/governance.js +229 -0
  70. package/src/cursor/interactive.js +391 -0
  71. package/src/cursor/mcp-packs.js +571 -0
  72. package/src/cursor/patch.js +243 -0
  73. package/src/cursor/plans.js +254 -0
  74. package/src/cursor/premium.js +468 -0
  75. package/src/cursor/setup.js +488 -0
  76. package/src/cursor/techniques.js +1786 -0
  77. package/src/deep-review.js +345 -0
  78. package/src/domain-packs.js +364 -0
  79. package/src/formatters/sarif.js +115 -0
  80. package/src/gemini/activity.js +402 -0
  81. package/src/gemini/config-parser.js +275 -0
  82. package/src/gemini/context.js +221 -0
  83. package/src/gemini/deep-review.js +559 -0
  84. package/src/gemini/domain-packs.js +371 -0
  85. package/src/gemini/freshness.js +204 -0
  86. package/src/gemini/governance.js +201 -0
  87. package/src/gemini/interactive.js +860 -0
  88. package/src/gemini/mcp-packs.js +658 -0
  89. package/src/gemini/patch.js +229 -0
  90. package/src/gemini/plans.js +269 -0
  91. package/src/gemini/premium.js +759 -0
  92. package/src/gemini/setup.js +692 -0
  93. package/src/gemini/techniques.js +2084 -0
  94. package/src/governance.js +523 -0
  95. package/src/harmony/advisor.js +383 -0
  96. package/src/harmony/audit.js +303 -0
  97. package/src/harmony/canon.js +444 -0
  98. package/src/harmony/cli.js +331 -0
  99. package/src/harmony/drift.js +401 -0
  100. package/src/harmony/governance.js +313 -0
  101. package/src/harmony/memory.js +238 -0
  102. package/src/harmony/sync.js +458 -0
  103. package/src/harmony/watch.js +336 -0
  104. package/src/index.js +256 -0
  105. package/src/insights.js +119 -0
  106. package/src/interactive.js +118 -0
  107. package/src/mcp-packs.js +597 -0
  108. package/src/opencode/activity.js +286 -0
  109. package/src/opencode/config-parser.js +109 -0
  110. package/src/opencode/context.js +247 -0
  111. package/src/opencode/deep-review.js +313 -0
  112. package/src/opencode/domain-packs.js +240 -0
  113. package/src/opencode/freshness.js +158 -0
  114. package/src/opencode/governance.js +159 -0
  115. package/src/opencode/interactive.js +392 -0
  116. package/src/opencode/mcp-packs.js +474 -0
  117. package/src/opencode/patch.js +184 -0
  118. package/src/opencode/plans.js +231 -0
  119. package/src/opencode/premium.js +413 -0
  120. package/src/opencode/setup.js +449 -0
  121. package/src/opencode/techniques.js +1713 -0
  122. package/src/plans.js +655 -0
  123. package/src/secret-patterns.js +30 -0
  124. package/src/setup.js +1274 -0
  125. package/src/synergy/adaptive.js +261 -0
  126. package/src/synergy/compensation.js +156 -0
  127. package/src/synergy/evidence.js +193 -0
  128. package/src/synergy/learning.js +184 -0
  129. package/src/synergy/patterns.js +227 -0
  130. package/src/synergy/ranking.js +83 -0
  131. package/src/synergy/report.js +163 -0
  132. package/src/synergy/routing.js +152 -0
  133. package/src/techniques.js +1354 -0
  134. package/src/watch.js +229 -0
  135. package/src/windsurf/activity.js +302 -0
  136. package/src/windsurf/config-parser.js +267 -0
  137. package/src/windsurf/context.js +249 -0
  138. package/src/windsurf/deep-review.js +337 -0
  139. package/src/windsurf/domain-packs.js +348 -0
  140. package/src/windsurf/freshness.js +215 -0
  141. package/src/windsurf/governance.js +231 -0
  142. package/src/windsurf/interactive.js +388 -0
  143. package/src/windsurf/mcp-packs.js +535 -0
  144. package/src/windsurf/patch.js +231 -0
  145. package/src/windsurf/plans.js +247 -0
  146. package/src/windsurf/premium.js +467 -0
  147. package/src/windsurf/setup.js +471 -0
  148. package/src/windsurf/techniques.js +1758 -0
@@ -0,0 +1,660 @@
1
+ /**
2
+ * Codex MCP Pack System — CP-03
3
+ *
4
+ * 8 priority MCP packs with TOML-aware projection, detection,
5
+ * recommendation, merge logic, and trust preflight.
6
+ *
7
+ * Codex MCP config lives in .codex/config.toml under [mcp_servers.<name>].
8
+ * Each server uses TOML format with command/args/env/enabled_tools fields.
9
+ */
10
+
11
+ const CODEX_MCP_PACKS = [
12
+ {
13
+ key: 'context7-docs',
14
+ label: 'Context7 Docs',
15
+ description: 'Live, current framework and library documentation during Codex sessions.',
16
+ useWhen: 'Repos that use any framework, library, or SDK and benefit from up-to-date docs.',
17
+ adoption: 'Safe default docs pack for most application repos. No auth required.',
18
+ trustLevel: 'high',
19
+ transport: 'stdio',
20
+ requiredAuth: [],
21
+ serverName: 'context7',
22
+ tomlProjection: {
23
+ command: 'npx',
24
+ args: ['-y', '@upstash/context7-mcp@latest'],
25
+ },
26
+ enabledTools: ['resolve-library-id', 'get-library-docs'],
27
+ },
28
+ {
29
+ key: 'github-mcp',
30
+ label: 'GitHub',
31
+ description: 'Issue, PR, and repository context during Codex sessions.',
32
+ useWhen: 'Repos hosted on GitHub that benefit from issue, PR, and repo context.',
33
+ adoption: 'Recommended for any GitHub-hosted project. Requires GITHUB_PERSONAL_ACCESS_TOKEN.',
34
+ trustLevel: 'medium',
35
+ transport: 'stdio',
36
+ requiredAuth: ['GITHUB_PERSONAL_ACCESS_TOKEN'],
37
+ serverName: 'github',
38
+ tomlProjection: {
39
+ command: 'npx',
40
+ args: ['-y', '@modelcontextprotocol/server-github'],
41
+ env: { GITHUB_PERSONAL_ACCESS_TOKEN: '${GITHUB_PERSONAL_ACCESS_TOKEN}' },
42
+ },
43
+ enabledTools: [
44
+ 'list_issues', 'get_issue', 'search_issues',
45
+ 'list_pull_requests', 'get_pull_request',
46
+ 'get_file_contents', 'search_code',
47
+ ],
48
+ },
49
+ {
50
+ key: 'playwright-mcp',
51
+ label: 'Playwright Browser',
52
+ description: 'Browser automation, E2E testing, and visual QA.',
53
+ useWhen: 'Frontend repos with E2E tests or browser-based workflows.',
54
+ adoption: 'Recommended for frontend-ui repos with E2E tests. No auth required.',
55
+ trustLevel: 'medium',
56
+ transport: 'stdio',
57
+ requiredAuth: [],
58
+ serverName: 'playwright',
59
+ tomlProjection: {
60
+ command: 'npx',
61
+ args: ['-y', '@playwright/mcp@latest'],
62
+ },
63
+ enabledTools: [
64
+ 'browser_navigate', 'browser_screenshot', 'browser_click',
65
+ 'browser_type', 'browser_wait_for_selector',
66
+ ],
67
+ },
68
+ {
69
+ key: 'postgres-mcp',
70
+ label: 'PostgreSQL',
71
+ description: 'Schema inspection and query assistance for PostgreSQL databases.',
72
+ useWhen: 'Repos with PostgreSQL databases that benefit from schema and query context.',
73
+ adoption: 'Useful for backend-api and data-pipeline repos. Requires DATABASE_URL.',
74
+ trustLevel: 'low',
75
+ transport: 'stdio',
76
+ requiredAuth: ['DATABASE_URL'],
77
+ serverName: 'postgres',
78
+ tomlProjection: {
79
+ command: 'npx',
80
+ args: ['-y', '@modelcontextprotocol/server-postgres', '${DATABASE_URL}'],
81
+ },
82
+ enabledTools: ['query', 'list_tables', 'describe_table'],
83
+ },
84
+ {
85
+ key: 'memory-mcp',
86
+ label: 'Memory / Knowledge Graph',
87
+ description: 'Persistent entity and relationship tracking across Codex sessions.',
88
+ useWhen: 'Long-running or complex projects with many interconnected concepts.',
89
+ adoption: 'Safe for any repo. Stores data locally. No auth required.',
90
+ trustLevel: 'high',
91
+ transport: 'stdio',
92
+ requiredAuth: [],
93
+ serverName: 'memory',
94
+ tomlProjection: {
95
+ command: 'npx',
96
+ args: ['-y', '@modelcontextprotocol/server-memory'],
97
+ },
98
+ enabledTools: [
99
+ 'create_entities', 'create_relations', 'search_nodes',
100
+ 'open_nodes', 'read_graph',
101
+ ],
102
+ },
103
+ {
104
+ key: 'sequential-thinking',
105
+ label: 'Sequential Thinking',
106
+ description: 'Structured step-by-step reasoning for complex problem-solving.',
107
+ useWhen: 'Complex problem-solving sessions that benefit from structured reasoning.',
108
+ adoption: 'Safe default for any repo. No auth required.',
109
+ trustLevel: 'high',
110
+ transport: 'stdio',
111
+ requiredAuth: [],
112
+ serverName: 'sequential-thinking',
113
+ tomlProjection: {
114
+ command: 'npx',
115
+ args: ['-y', '@modelcontextprotocol/server-sequential-thinking'],
116
+ },
117
+ enabledTools: ['sequentialthinking'],
118
+ },
119
+ {
120
+ key: 'filesystem-mcp',
121
+ label: 'Filesystem',
122
+ description: 'Read-only filesystem access for documentation and reference files.',
123
+ useWhen: 'Repos with reference files, docs, or config that Codex needs to read outside sandbox.',
124
+ adoption: 'Read-only default. Pass allowed directories as args.',
125
+ trustLevel: 'medium',
126
+ transport: 'stdio',
127
+ requiredAuth: [],
128
+ serverName: 'filesystem',
129
+ tomlProjection: {
130
+ command: 'npx',
131
+ args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],
132
+ },
133
+ enabledTools: [
134
+ 'read_file', 'list_directory', 'search_files', 'get_file_info',
135
+ ],
136
+ },
137
+ {
138
+ key: 'fetch-mcp',
139
+ label: 'Fetch / HTTP',
140
+ description: 'HTTP access for fetching web pages, APIs, and documentation.',
141
+ useWhen: 'Repos that need HTTP access to external APIs or documentation sources.',
142
+ adoption: 'Useful for repos integrating external services. No auth required.',
143
+ trustLevel: 'medium',
144
+ transport: 'stdio',
145
+ requiredAuth: [],
146
+ serverName: 'fetch',
147
+ tomlProjection: {
148
+ command: 'npx',
149
+ args: ['-y', '@modelcontextprotocol/server-fetch'],
150
+ },
151
+ enabledTools: ['fetch'],
152
+ },
153
+ // --- Parity expansion: 18 new packs to match Claude's 26 ---
154
+ {
155
+ key: 'next-devtools',
156
+ label: 'Next.js Devtools',
157
+ description: 'Runtime-aware debugging and framework-specific tooling for Next.js.',
158
+ useWhen: 'Next.js repos that need runtime-aware debugging.',
159
+ adoption: 'Useful companion for frontend-ui repos running Next.js.',
160
+ trustLevel: 'medium',
161
+ transport: 'stdio',
162
+ requiredAuth: [],
163
+ serverName: 'next-devtools',
164
+ tomlProjection: { command: 'npx', args: ['-y', 'next-devtools-mcp@latest'] },
165
+ enabledTools: ['get_page_info', 'get_routes', 'get_components'],
166
+ },
167
+ {
168
+ key: 'docker-mcp',
169
+ label: 'Docker',
170
+ description: 'Container management during Codex sessions.',
171
+ useWhen: 'Repos with containerized workflows.',
172
+ adoption: 'Requires Docker running locally.',
173
+ trustLevel: 'medium',
174
+ transport: 'stdio',
175
+ requiredAuth: [],
176
+ serverName: 'docker',
177
+ tomlProjection: { command: 'npx', args: ['-y', '@hypnosis/docker-mcp-server'] },
178
+ enabledTools: ['list_containers', 'container_logs', 'container_inspect'],
179
+ },
180
+ {
181
+ key: 'notion-mcp',
182
+ label: 'Notion',
183
+ description: 'Access Notion documentation and wikis.',
184
+ useWhen: 'Teams using Notion for docs or knowledge bases.',
185
+ adoption: 'Requires NOTION_API_KEY.',
186
+ trustLevel: 'medium',
187
+ transport: 'stdio',
188
+ requiredAuth: ['NOTION_API_KEY'],
189
+ serverName: 'notion',
190
+ tomlProjection: { command: 'npx', args: ['-y', '@notionhq/notion-mcp-server'], env: { NOTION_API_KEY: '${NOTION_API_KEY}' } },
191
+ enabledTools: ['search', 'get_page', 'get_database'],
192
+ },
193
+ {
194
+ key: 'linear-mcp',
195
+ label: 'Linear',
196
+ description: 'Issue tracking and sprint context.',
197
+ useWhen: 'Teams using Linear for issue tracking.',
198
+ adoption: 'Requires LINEAR_API_KEY.',
199
+ trustLevel: 'medium',
200
+ transport: 'stdio',
201
+ requiredAuth: ['LINEAR_API_KEY'],
202
+ serverName: 'linear',
203
+ tomlProjection: { command: 'npx', args: ['-y', '@mseep/linear-mcp'], env: { LINEAR_API_KEY: '${LINEAR_API_KEY}' } },
204
+ enabledTools: ['list_issues', 'get_issue', 'search_issues'],
205
+ },
206
+ {
207
+ key: 'sentry-mcp',
208
+ label: 'Sentry',
209
+ description: 'Error tracking and debugging context.',
210
+ useWhen: 'Repos with Sentry error tracking.',
211
+ adoption: 'Requires SENTRY_AUTH_TOKEN.',
212
+ trustLevel: 'medium',
213
+ transport: 'stdio',
214
+ requiredAuth: ['SENTRY_AUTH_TOKEN'],
215
+ serverName: 'sentry',
216
+ tomlProjection: { command: 'npx', args: ['-y', '@sentry/mcp-server'], env: { SENTRY_AUTH_TOKEN: '${SENTRY_AUTH_TOKEN}' } },
217
+ enabledTools: ['get_issues', 'get_issue_details', 'search_errors'],
218
+ },
219
+ {
220
+ key: 'slack-mcp',
221
+ label: 'Slack',
222
+ description: 'Draft and preview Slack messages.',
223
+ useWhen: 'Teams using Slack for communication.',
224
+ adoption: 'Requires SLACK_BOT_TOKEN.',
225
+ trustLevel: 'low',
226
+ transport: 'stdio',
227
+ requiredAuth: ['SLACK_BOT_TOKEN'],
228
+ serverName: 'slack',
229
+ tomlProjection: { command: 'npx', args: ['-y', 'slack-mcp-server'], env: { SLACK_BOT_TOKEN: '${SLACK_BOT_TOKEN}' } },
230
+ enabledTools: ['list_channels', 'post_message', 'search_messages'],
231
+ },
232
+ {
233
+ key: 'stripe-mcp',
234
+ label: 'Stripe',
235
+ description: 'Payment and billing workflow context.',
236
+ useWhen: 'Repos with Stripe integration.',
237
+ adoption: 'Requires STRIPE_API_KEY.',
238
+ trustLevel: 'low',
239
+ transport: 'stdio',
240
+ requiredAuth: ['STRIPE_API_KEY'],
241
+ serverName: 'stripe',
242
+ tomlProjection: { command: 'npx', args: ['-y', '@stripe/mcp'], env: { STRIPE_API_KEY: '${STRIPE_API_KEY}' } },
243
+ enabledTools: ['list_products', 'get_subscription', 'search_customers'],
244
+ },
245
+ {
246
+ key: 'figma-mcp',
247
+ label: 'Figma',
248
+ description: 'Design file access and component inspection.',
249
+ useWhen: 'Design-heavy repos needing Figma access.',
250
+ adoption: 'Requires FIGMA_ACCESS_TOKEN.',
251
+ trustLevel: 'medium',
252
+ transport: 'stdio',
253
+ requiredAuth: ['FIGMA_ACCESS_TOKEN'],
254
+ serverName: 'figma',
255
+ tomlProjection: { command: 'npx', args: ['-y', 'claude-talk-to-figma-mcp'], env: { FIGMA_ACCESS_TOKEN: '${FIGMA_ACCESS_TOKEN}' } },
256
+ enabledTools: ['get_file', 'get_components', 'get_styles'],
257
+ },
258
+ {
259
+ key: 'mcp-security',
260
+ label: 'MCP Security Scanner',
261
+ description: 'Scan MCP servers for tool poisoning and prompt injection.',
262
+ useWhen: 'Any repo with 2+ MCP servers.',
263
+ adoption: 'Safety companion for multi-MCP setups.',
264
+ trustLevel: 'high',
265
+ transport: 'stdio',
266
+ requiredAuth: [],
267
+ serverName: 'mcp-scan',
268
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-scan@latest'] },
269
+ enabledTools: ['scan_servers', 'check_tools'],
270
+ },
271
+ {
272
+ key: 'composio-mcp',
273
+ label: 'Composio Universal',
274
+ description: '500+ integrations through a single MCP gateway.',
275
+ useWhen: 'Enterprise or integration-heavy repos.',
276
+ adoption: 'Requires COMPOSIO_API_KEY.',
277
+ trustLevel: 'medium',
278
+ transport: 'stdio',
279
+ requiredAuth: ['COMPOSIO_API_KEY'],
280
+ serverName: 'composio',
281
+ tomlProjection: { command: 'npx', args: ['-y', '@composio/mcp'], env: { COMPOSIO_API_KEY: '${COMPOSIO_API_KEY}' } },
282
+ enabledTools: [],
283
+ },
284
+ {
285
+ key: 'jira-confluence',
286
+ label: 'Jira',
287
+ description: 'Issue tracking and project management.',
288
+ useWhen: 'Teams using Atlassian Jira.',
289
+ adoption: 'Requires ATLASSIAN_API_TOKEN and ATLASSIAN_EMAIL.',
290
+ trustLevel: 'medium',
291
+ transport: 'stdio',
292
+ requiredAuth: ['ATLASSIAN_API_TOKEN', 'ATLASSIAN_EMAIL'],
293
+ serverName: 'jira',
294
+ tomlProjection: { command: 'npx', args: ['-y', 'jira-mcp'], env: { ATLASSIAN_API_TOKEN: '${ATLASSIAN_API_TOKEN}', ATLASSIAN_EMAIL: '${ATLASSIAN_EMAIL}' } },
295
+ enabledTools: ['list_issues', 'get_issue', 'search_issues'],
296
+ },
297
+ {
298
+ key: 'ga4-analytics',
299
+ label: 'Google Analytics 4',
300
+ description: 'Live GA4 data, attribution, and audience insights.',
301
+ useWhen: 'Repos with web analytics needs.',
302
+ adoption: 'Requires GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS.',
303
+ trustLevel: 'medium',
304
+ transport: 'stdio',
305
+ requiredAuth: ['GA4_PROPERTY_ID', 'GOOGLE_APPLICATION_CREDENTIALS'],
306
+ serverName: 'ga4',
307
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-server-ga4'], env: { GA4_PROPERTY_ID: '${GA4_PROPERTY_ID}', GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}' } },
308
+ enabledTools: ['run_report', 'get_metadata'],
309
+ },
310
+ {
311
+ key: 'search-console',
312
+ label: 'Google Search Console',
313
+ description: 'Search performance and indexing data.',
314
+ useWhen: 'SEO-focused repos.',
315
+ adoption: 'Requires Google OAuth credentials.',
316
+ trustLevel: 'medium',
317
+ transport: 'stdio',
318
+ requiredAuth: ['GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET'],
319
+ serverName: 'gsc',
320
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-gsc@latest'], env: { GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}', GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}' } },
321
+ enabledTools: ['search_analytics', 'get_sitemaps'],
322
+ },
323
+ {
324
+ key: 'n8n-workflows',
325
+ label: 'n8n Workflow Automation',
326
+ description: 'Workflow automation with 1,396 integration nodes.',
327
+ useWhen: 'Teams using n8n for workflow automation.',
328
+ adoption: 'Requires N8N_URL and N8N_API_KEY.',
329
+ trustLevel: 'medium',
330
+ transport: 'stdio',
331
+ requiredAuth: ['N8N_URL', 'N8N_API_KEY'],
332
+ serverName: 'n8n',
333
+ tomlProjection: { command: 'npx', args: ['-y', 'n8n-mcp-server@latest'], env: { N8N_URL: '${N8N_URL}', N8N_API_KEY: '${N8N_API_KEY}' } },
334
+ enabledTools: ['list_workflows', 'execute_workflow'],
335
+ },
336
+ {
337
+ key: 'zendesk-mcp',
338
+ label: 'Zendesk',
339
+ description: 'Ticket management and help center content.',
340
+ useWhen: 'Support teams using Zendesk.',
341
+ adoption: 'Requires ZENDESK_API_TOKEN and ZENDESK_SUBDOMAIN.',
342
+ trustLevel: 'medium',
343
+ transport: 'stdio',
344
+ requiredAuth: ['ZENDESK_API_TOKEN', 'ZENDESK_SUBDOMAIN'],
345
+ serverName: 'zendesk',
346
+ tomlProjection: { command: 'npx', args: ['-y', 'zendesk-mcp'], env: { ZENDESK_API_TOKEN: '${ZENDESK_API_TOKEN}', ZENDESK_SUBDOMAIN: '${ZENDESK_SUBDOMAIN}' } },
347
+ enabledTools: ['list_tickets', 'get_ticket', 'search_tickets'],
348
+ },
349
+ {
350
+ key: 'infisical-secrets',
351
+ label: 'Infisical Secrets',
352
+ description: 'Secrets management with auto-rotation.',
353
+ useWhen: 'Repos using Infisical for secrets.',
354
+ adoption: 'Requires INFISICAL_TOKEN.',
355
+ trustLevel: 'low',
356
+ transport: 'stdio',
357
+ requiredAuth: ['INFISICAL_TOKEN'],
358
+ serverName: 'infisical',
359
+ tomlProjection: { command: 'npx', args: ['-y', '@infisical/mcp'], env: { INFISICAL_TOKEN: '${INFISICAL_TOKEN}' } },
360
+ enabledTools: ['get_secret', 'list_secrets'],
361
+ },
362
+ {
363
+ key: 'shopify-mcp',
364
+ label: 'Shopify',
365
+ description: 'Shopify API and deployment tooling.',
366
+ useWhen: 'Shopify stores and apps.',
367
+ adoption: 'Requires SHOPIFY_ACCESS_TOKEN.',
368
+ trustLevel: 'medium',
369
+ transport: 'stdio',
370
+ requiredAuth: ['SHOPIFY_ACCESS_TOKEN'],
371
+ serverName: 'shopify',
372
+ tomlProjection: { command: 'npx', args: ['-y', 'shopify-mcp'], env: { SHOPIFY_ACCESS_TOKEN: '${SHOPIFY_ACCESS_TOKEN}' } },
373
+ enabledTools: ['get_products', 'get_orders'],
374
+ },
375
+ {
376
+ key: 'huggingface-mcp',
377
+ label: 'Hugging Face',
378
+ description: 'Model search, dataset discovery, and Spaces.',
379
+ useWhen: 'AI/ML repos needing model registry access.',
380
+ adoption: 'Requires HF_TOKEN.',
381
+ trustLevel: 'medium',
382
+ transport: 'stdio',
383
+ requiredAuth: ['HF_TOKEN'],
384
+ serverName: 'huggingface',
385
+ tomlProjection: { command: 'npx', args: ['-y', 'huggingface-mcp-server'], env: { HF_TOKEN: '${HF_TOKEN}' } },
386
+ enabledTools: ['search_models', 'get_model_info', 'search_datasets'],
387
+ },
388
+ ];
389
+
390
+ // --- Helpers ---
391
+
392
+ function clone(value) {
393
+ return JSON.parse(JSON.stringify(value));
394
+ }
395
+
396
+ function hasDependency(deps, name) {
397
+ return Object.prototype.hasOwnProperty.call(deps || {}, name);
398
+ }
399
+
400
+ function hasFileContentMatch(ctx, filePath, pattern) {
401
+ if (!ctx) return false;
402
+ const content = ctx.fileContent(filePath);
403
+ return !!(content && pattern.test(content));
404
+ }
405
+
406
+ function getProjectDependencies(ctx) {
407
+ if (!ctx) return {};
408
+ if (typeof ctx.projectDependencies === 'function') {
409
+ return ctx.projectDependencies();
410
+ }
411
+ const pkg = ctx.jsonFile('package.json') || {};
412
+ return {
413
+ ...(pkg.dependencies || {}),
414
+ ...(pkg.devDependencies || {}),
415
+ };
416
+ }
417
+
418
+ function hasPostgresSignals(ctx, deps) {
419
+ if (
420
+ hasDependency(deps, 'pg') ||
421
+ hasDependency(deps, 'postgres') ||
422
+ hasDependency(deps, 'pg-promise') ||
423
+ hasDependency(deps, 'slonik') ||
424
+ hasDependency(deps, '@neondatabase/serverless') ||
425
+ hasDependency(deps, '@vercel/postgres')
426
+ ) {
427
+ return true;
428
+ }
429
+ return (
430
+ hasFileContentMatch(ctx, 'prisma/schema.prisma', /provider\s*=\s*["']postgresql["']/i) ||
431
+ hasFileContentMatch(ctx, 'docker-compose.yml', /\bpostgres\b/i) ||
432
+ hasFileContentMatch(ctx, 'docker-compose.yaml', /\bpostgres\b/i) ||
433
+ hasFileContentMatch(ctx, '.env', /postgres(?:ql)?:\/\//i) ||
434
+ hasFileContentMatch(ctx, '.env.example', /postgres(?:ql)?:\/\//i)
435
+ );
436
+ }
437
+
438
+ // --- Core Functions ---
439
+
440
+ function getCodexMcpPack(key) {
441
+ return CODEX_MCP_PACKS.find(pack => pack.key === key) || null;
442
+ }
443
+
444
+ function normalizeCodexMcpPackKeys(keys = []) {
445
+ return [...new Set((Array.isArray(keys) ? keys : [])
446
+ .map(key => `${key}`.trim())
447
+ .filter(Boolean))]
448
+ .filter(key => !!getCodexMcpPack(key));
449
+ }
450
+
451
+ /**
452
+ * Generate TOML string for a single MCP pack.
453
+ */
454
+ function packToToml(pack) {
455
+ const lines = [];
456
+ lines.push(`[mcp_servers.${pack.serverName}]`);
457
+ const proj = pack.tomlProjection;
458
+
459
+ if (proj.command) {
460
+ lines.push(`command = "${proj.command}"`);
461
+ }
462
+ if (proj.url) {
463
+ lines.push(`url = "${proj.url}"`);
464
+ }
465
+ if (proj.args && proj.args.length > 0) {
466
+ const argsStr = proj.args.map(a => `"${a}"`).join(', ');
467
+ lines.push(`args = [${argsStr}]`);
468
+ }
469
+ if (proj.env) {
470
+ const envPairs = Object.entries(proj.env)
471
+ .map(([k, v]) => `${k} = "${v}"`)
472
+ .join(', ');
473
+ lines.push(`env = { ${envPairs} }`);
474
+ }
475
+ if (pack.enabledTools && pack.enabledTools.length > 0) {
476
+ const toolsStr = pack.enabledTools.map(t => `"${t}"`).join(', ');
477
+ lines.push(`enabled_tools = [${toolsStr}]`);
478
+ }
479
+ lines.push('enabled = true');
480
+ lines.push('required = false');
481
+
482
+ return lines.join('\n');
483
+ }
484
+
485
+ /**
486
+ * Generate TOML for multiple packs.
487
+ */
488
+ function packsToToml(packKeys = []) {
489
+ return normalizeCodexMcpPackKeys(packKeys)
490
+ .map(key => {
491
+ const pack = getCodexMcpPack(key);
492
+ return pack ? packToToml(pack) : null;
493
+ })
494
+ .filter(Boolean)
495
+ .join('\n\n');
496
+ }
497
+
498
+ /**
499
+ * Detect which MCP packs to recommend for a Codex project.
500
+ */
501
+ function recommendCodexMcpPacks(stacks = [], domainPacks = [], options = {}) {
502
+ const recommended = new Set();
503
+ const stackKeys = new Set(stacks.map(s => s.key));
504
+ const ctx = options.ctx || null;
505
+ const deps = getProjectDependencies(ctx);
506
+ const domainKeys = new Set(domainPacks.map(p => p.key));
507
+
508
+ // Context7 docs for any project with detected stacks
509
+ if (stackKeys.size > 0) {
510
+ recommended.add('context7-docs');
511
+ }
512
+
513
+ // GitHub for collaborative / governed repos
514
+ if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo')) {
515
+ recommended.add('github-mcp');
516
+ }
517
+
518
+ // Playwright for frontend repos
519
+ if (
520
+ domainKeys.has('frontend-ui') ||
521
+ stackKeys.has('react') || stackKeys.has('nextjs') ||
522
+ stackKeys.has('vue') || stackKeys.has('angular') || stackKeys.has('svelte')
523
+ ) {
524
+ recommended.add('playwright-mcp');
525
+ }
526
+
527
+ // Postgres when explicit signals exist
528
+ if (
529
+ (domainKeys.has('backend-api') || domainKeys.has('infra-platform')) &&
530
+ hasPostgresSignals(ctx, deps)
531
+ ) {
532
+ recommended.add('postgres-mcp');
533
+ }
534
+
535
+ // Memory for complex / monorepo / long-lived projects
536
+ if (domainKeys.has('monorepo') || domainKeys.has('enterprise-governed')) {
537
+ recommended.add('memory-mcp');
538
+ }
539
+
540
+ // Sequential thinking for complex problem-solving
541
+ if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo') || domainKeys.has('infra-platform')) {
542
+ recommended.add('sequential-thinking');
543
+ }
544
+
545
+ // Filesystem for infra repos with reference docs
546
+ if (domainKeys.has('infra-platform')) {
547
+ recommended.add('filesystem-mcp');
548
+ }
549
+
550
+ // Fetch for repos with external API integrations
551
+ if (domainKeys.has('backend-api') && ctx && (
552
+ hasDependency(deps, 'axios') ||
553
+ hasDependency(deps, 'node-fetch') ||
554
+ hasDependency(deps, 'got') ||
555
+ hasDependency(deps, 'ky') ||
556
+ hasDependency(deps, 'undici')
557
+ )) {
558
+ recommended.add('fetch-mcp');
559
+ }
560
+
561
+ // Fallback: always recommend context7 if nothing else matched
562
+ if (recommended.size === 0) {
563
+ recommended.add('context7-docs');
564
+ }
565
+
566
+ return CODEX_MCP_PACKS
567
+ .filter(pack => recommended.has(pack.key))
568
+ .map(pack => clone(pack));
569
+ }
570
+
571
+ /**
572
+ * Get required env vars for a set of pack keys.
573
+ */
574
+ function getCodexMcpRequiredEnvVars(packKeys = []) {
575
+ const required = new Set();
576
+ for (const key of normalizeCodexMcpPackKeys(packKeys)) {
577
+ const pack = getCodexMcpPack(key);
578
+ if (!pack) continue;
579
+ for (const envVar of pack.requiredAuth) {
580
+ required.add(envVar);
581
+ }
582
+ }
583
+ return [...required].sort();
584
+ }
585
+
586
+ /**
587
+ * Trust preflight: check if packs are safe to install.
588
+ */
589
+ function getCodexMcpPreflight(packKeys = [], env = process.env) {
590
+ return normalizeCodexMcpPackKeys(packKeys)
591
+ .map(key => {
592
+ const pack = getCodexMcpPack(key);
593
+ if (!pack) return null;
594
+ const missingEnvVars = pack.requiredAuth.filter(envKey => {
595
+ const value = env && Object.prototype.hasOwnProperty.call(env, envKey) ? env[envKey] : '';
596
+ return !`${value || ''}`.trim();
597
+ });
598
+ return {
599
+ key,
600
+ label: pack.label,
601
+ trustLevel: pack.trustLevel,
602
+ requiredAuth: pack.requiredAuth,
603
+ missingEnvVars,
604
+ safe: missingEnvVars.length === 0,
605
+ warning: missingEnvVars.length > 0
606
+ ? `Missing env vars: ${missingEnvVars.join(', ')}. Pack will be included but may fail at runtime.`
607
+ : null,
608
+ };
609
+ })
610
+ .filter(Boolean);
611
+ }
612
+
613
+ /**
614
+ * Merge TOML: generate safe TOML additions for new MCP packs.
615
+ * Returns the TOML string to append (does not modify existing config).
616
+ */
617
+ function mergeCodexMcpToml(existingConfigContent = '', packKeys = []) {
618
+ const existingServers = new Set();
619
+
620
+ // Parse existing [mcp_servers.*] sections to avoid duplicates
621
+ const serverPattern = /\[mcp_servers\.([^\]]+)\]/g;
622
+ let match;
623
+ while ((match = serverPattern.exec(existingConfigContent)) !== null) {
624
+ existingServers.add(match[1]);
625
+ }
626
+
627
+ const newPacks = normalizeCodexMcpPackKeys(packKeys)
628
+ .map(key => getCodexMcpPack(key))
629
+ .filter(pack => pack && !existingServers.has(pack.serverName));
630
+
631
+ if (newPacks.length === 0) return '';
632
+
633
+ const lines = [
634
+ '',
635
+ '# <!-- nerviq:mcp-packs:start -->',
636
+ '# MCP packs added by nerviq',
637
+ ];
638
+
639
+ for (const pack of newPacks) {
640
+ lines.push('');
641
+ lines.push(packToToml(pack));
642
+ }
643
+
644
+ lines.push('');
645
+ lines.push('# <!-- nerviq:mcp-packs:end -->');
646
+
647
+ return lines.join('\n');
648
+ }
649
+
650
+ module.exports = {
651
+ CODEX_MCP_PACKS,
652
+ getCodexMcpPack,
653
+ normalizeCodexMcpPackKeys,
654
+ packToToml,
655
+ packsToToml,
656
+ recommendCodexMcpPacks,
657
+ getCodexMcpRequiredEnvVars,
658
+ getCodexMcpPreflight,
659
+ mergeCodexMcpToml,
660
+ };