@nerviq/cli 1.17.3 → 1.19.0

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 (190) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +4 -4
  3. package/bin/cli.js +61 -274
  4. package/package.json +60 -60
  5. package/src/activity.js +1039 -1039
  6. package/src/adoption-advisor.js +299 -299
  7. package/src/aider/config-parser.js +166 -166
  8. package/src/aider/context.js +158 -158
  9. package/src/aider/deep-review.js +316 -316
  10. package/src/aider/domain-packs.js +303 -303
  11. package/src/aider/freshness.js +93 -93
  12. package/src/aider/governance.js +253 -253
  13. package/src/aider/interactive.js +334 -334
  14. package/src/aider/mcp-packs.js +329 -329
  15. package/src/aider/patch.js +214 -214
  16. package/src/aider/plans.js +186 -186
  17. package/src/aider/premium.js +360 -360
  18. package/src/aider/setup.js +404 -404
  19. package/src/aider/techniques.js +16 -16
  20. package/src/analyze.js +951 -951
  21. package/src/anti-patterns.js +485 -485
  22. package/src/audit/instruction-files.js +180 -180
  23. package/src/audit/recommendations.js +577 -577
  24. package/src/auto-suggest.js +154 -154
  25. package/src/badge.js +13 -13
  26. package/src/behavioral-drift.js +801 -801
  27. package/src/benchmark.js +67 -67
  28. package/src/catalog.js +103 -103
  29. package/src/certification.js +128 -128
  30. package/src/codex/config-parser.js +183 -183
  31. package/src/codex/context.js +223 -223
  32. package/src/codex/deep-review.js +493 -493
  33. package/src/codex/domain-packs.js +394 -394
  34. package/src/codex/freshness.js +84 -84
  35. package/src/codex/governance.js +192 -192
  36. package/src/codex/interactive.js +618 -618
  37. package/src/codex/mcp-packs.js +914 -914
  38. package/src/codex/patch.js +209 -209
  39. package/src/codex/plans.js +251 -251
  40. package/src/codex/premium.js +614 -614
  41. package/src/codex/setup.js +591 -591
  42. package/src/context.js +320 -320
  43. package/src/continuous-ops.js +681 -681
  44. package/src/copilot/activity.js +309 -309
  45. package/src/copilot/config-parser.js +280 -226
  46. package/src/copilot/context.js +218 -197
  47. package/src/copilot/deep-review.js +346 -346
  48. package/src/copilot/domain-packs.js +372 -372
  49. package/src/copilot/freshness.js +57 -57
  50. package/src/copilot/governance.js +222 -222
  51. package/src/copilot/interactive.js +406 -406
  52. package/src/copilot/mcp-packs.js +826 -826
  53. package/src/copilot/plans.js +253 -253
  54. package/src/copilot/premium.js +451 -451
  55. package/src/copilot/setup.js +488 -488
  56. package/src/copilot/techniques.js +219 -78
  57. package/src/cost-tracking.js +61 -61
  58. package/src/cursor/activity.js +301 -301
  59. package/src/cursor/config-parser.js +265 -265
  60. package/src/cursor/context.js +256 -256
  61. package/src/cursor/deep-review.js +334 -334
  62. package/src/cursor/domain-packs.js +368 -368
  63. package/src/cursor/freshness.js +65 -65
  64. package/src/cursor/governance.js +229 -229
  65. package/src/cursor/interactive.js +391 -391
  66. package/src/cursor/mcp-packs.js +828 -828
  67. package/src/cursor/plans.js +254 -254
  68. package/src/cursor/premium.js +469 -469
  69. package/src/cursor/setup.js +488 -488
  70. package/src/dashboard.js +493 -493
  71. package/src/deep-review.js +428 -428
  72. package/src/deprecation.js +98 -98
  73. package/src/diff-only.js +280 -280
  74. package/src/doctor.js +119 -119
  75. package/src/domain-pack-expansion.js +1033 -1033
  76. package/src/domain-packs.js +387 -387
  77. package/src/feedback.js +178 -178
  78. package/src/fix-engine.js +783 -0
  79. package/src/fix-prompts.js +122 -122
  80. package/src/formatters/sarif.js +115 -115
  81. package/src/freshness.js +74 -74
  82. package/src/gemini/config-parser.js +275 -275
  83. package/src/gemini/context.js +221 -221
  84. package/src/gemini/deep-review.js +559 -559
  85. package/src/gemini/domain-packs.js +393 -393
  86. package/src/gemini/freshness.js +66 -66
  87. package/src/gemini/governance.js +201 -201
  88. package/src/gemini/interactive.js +860 -860
  89. package/src/gemini/mcp-packs.js +915 -915
  90. package/src/gemini/plans.js +269 -269
  91. package/src/gemini/premium.js +760 -760
  92. package/src/gemini/setup.js +692 -692
  93. package/src/gemini/techniques.js +14 -14
  94. package/src/governance.js +72 -72
  95. package/src/harmony/add.js +68 -68
  96. package/src/harmony/advisor.js +333 -333
  97. package/src/harmony/canon.js +565 -565
  98. package/src/harmony/cli.js +591 -591
  99. package/src/harmony/drift.js +401 -401
  100. package/src/harmony/governance.js +313 -313
  101. package/src/harmony/memory.js +239 -239
  102. package/src/harmony/sync.js +475 -475
  103. package/src/harmony/watch.js +370 -370
  104. package/src/hook-validation.js +342 -342
  105. package/src/index.js +271 -271
  106. package/src/init.js +184 -184
  107. package/src/instruction-surfaces.js +185 -185
  108. package/src/integrations.js +144 -144
  109. package/src/interactive.js +118 -118
  110. package/src/locales/en.json +1 -1
  111. package/src/locales/es.json +1 -1
  112. package/src/mcp-packs.js +830 -830
  113. package/src/mcp-server.js +726 -726
  114. package/src/mcp-validation.js +337 -337
  115. package/src/nerviq-sync.json +7 -7
  116. package/src/opencode/config-parser.js +109 -109
  117. package/src/opencode/context.js +247 -247
  118. package/src/opencode/deep-review.js +313 -313
  119. package/src/opencode/domain-packs.js +262 -262
  120. package/src/opencode/freshness.js +66 -66
  121. package/src/opencode/governance.js +159 -159
  122. package/src/opencode/interactive.js +392 -392
  123. package/src/opencode/mcp-packs.js +705 -705
  124. package/src/opencode/patch.js +184 -184
  125. package/src/opencode/plans.js +231 -231
  126. package/src/opencode/premium.js +413 -413
  127. package/src/opencode/setup.js +449 -449
  128. package/src/opencode/techniques.js +27 -27
  129. package/src/operating-profile.js +574 -574
  130. package/src/org.js +152 -152
  131. package/src/permission-rules.js +218 -218
  132. package/src/plans.js +839 -839
  133. package/src/platform-change-manifest.js +86 -86
  134. package/src/plugins.js +110 -110
  135. package/src/policy-layers.js +210 -210
  136. package/src/profiles.js +124 -124
  137. package/src/prompt-injection.js +74 -74
  138. package/src/public-api.js +173 -173
  139. package/src/recommendation-rules.js +84 -84
  140. package/src/repo-archetype.js +386 -386
  141. package/src/secret-patterns.js +39 -39
  142. package/src/server.js +527 -527
  143. package/src/setup/analysis.js +607 -607
  144. package/src/setup/runtime.js +172 -172
  145. package/src/setup.js +677 -677
  146. package/src/shared/capabilities.js +194 -194
  147. package/src/source-urls.js +132 -132
  148. package/src/stack-checks.js +565 -565
  149. package/src/supplemental-checks.js +13 -13
  150. package/src/synergy/adaptive.js +261 -261
  151. package/src/synergy/compensation.js +137 -137
  152. package/src/synergy/evidence.js +193 -193
  153. package/src/synergy/learning.js +199 -199
  154. package/src/synergy/patterns.js +227 -227
  155. package/src/synergy/ranking.js +83 -83
  156. package/src/synergy/report.js +165 -165
  157. package/src/synergy/routing.js +146 -146
  158. package/src/techniques/api.js +407 -407
  159. package/src/techniques/automation.js +316 -316
  160. package/src/techniques/compliance.js +257 -257
  161. package/src/techniques/hygiene.js +294 -294
  162. package/src/techniques/instructions.js +243 -243
  163. package/src/techniques/observability.js +226 -226
  164. package/src/techniques/optimization.js +142 -142
  165. package/src/techniques/quality.js +318 -318
  166. package/src/techniques/security.js +237 -237
  167. package/src/techniques/shared.js +443 -443
  168. package/src/techniques/stacks.js +2294 -2294
  169. package/src/techniques/tools.js +106 -106
  170. package/src/techniques/workflow.js +413 -413
  171. package/src/techniques.js +81 -81
  172. package/src/terminology.js +73 -73
  173. package/src/token-estimate.js +35 -35
  174. package/src/usage-patterns.js +99 -99
  175. package/src/verification-metadata.js +145 -145
  176. package/src/watch.js +247 -247
  177. package/src/windsurf/activity.js +302 -302
  178. package/src/windsurf/config-parser.js +267 -267
  179. package/src/windsurf/context.js +249 -249
  180. package/src/windsurf/deep-review.js +337 -337
  181. package/src/windsurf/domain-packs.js +370 -370
  182. package/src/windsurf/freshness.js +36 -36
  183. package/src/windsurf/governance.js +231 -231
  184. package/src/windsurf/interactive.js +388 -388
  185. package/src/windsurf/mcp-packs.js +792 -792
  186. package/src/windsurf/plans.js +247 -247
  187. package/src/windsurf/premium.js +468 -468
  188. package/src/windsurf/setup.js +471 -471
  189. package/src/windsurf/techniques.js +17 -17
  190. package/src/workspace.js +375 -375
@@ -1,368 +1,368 @@
1
- /**
2
- * Cursor Domain Packs — 16 domain packs with Cursor detection.
3
- *
4
- * Adapted from Copilot pattern with Cursor-specific surfaces:
5
- * - .cursor/rules/*.mdc (not copilot-instructions.md)
6
- * - .cursor/mcp.json (not .vscode/mcp.json)
7
- * - .cursor/environment.json (background agent)
8
- * - .cursor/automations/ (event-driven triggers)
9
- */
10
-
11
- const { buildAdditionalDomainPacks, detectAdditionalDomainPacks } = require('../domain-pack-expansion');
12
-
13
- const BASE_CURSOR_DOMAIN_PACKS = [
14
- {
15
- key: 'baseline-general',
16
- label: 'Baseline General',
17
- useWhen: 'General repos that need a safe, reviewable baseline before deeper specialization.',
18
- adoption: 'Safe default when no stronger domain signal dominates the repo.',
19
- recommendedModules: ['.cursor/rules/ baseline', '.cursor/mcp.json baseline', 'Custom commands starter'],
20
- recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
21
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
22
- benchmarkFocus: ['starter-safe improvement', 'reviewable trust posture'],
23
- },
24
- {
25
- key: 'backend-api',
26
- label: 'Backend API',
27
- useWhen: 'Service, API, or backend-heavy repos with routes, services, jobs, schemas, or data access.',
28
- adoption: 'Recommended when Cursor agents need stronger verification and review structure.',
29
- recommendedModules: ['.cursor/rules/ baseline', 'Backend verification rules', 'CI / review workflow starter'],
30
- recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
31
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
32
- benchmarkFocus: ['test + build verification', 'reviewable API changes', 'safe rollout posture'],
33
- },
34
- {
35
- key: 'frontend-ui',
36
- label: 'Frontend UI',
37
- useWhen: 'React, Next.js, Vue, Angular, or Svelte repos with UI-heavy workflows.',
38
- adoption: 'Recommended when Cursor agents need better component and build guidance.',
39
- recommendedModules: ['.cursor/rules/ baseline', 'Frontend review rules', 'Design Mode guide'],
40
- recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
41
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
42
- benchmarkFocus: ['build verification', 'component-safe edits', 'Design Mode awareness'],
43
- },
44
- {
45
- key: 'data-pipeline',
46
- label: 'Data Pipeline',
47
- useWhen: 'Repos with workers, DAGs, ETL jobs, migrations, or analytics-heavy workflows.',
48
- adoption: 'Recommended when Cursor agents need pipeline-safe verification.',
49
- recommendedModules: ['.cursor/rules/ baseline', 'Pipeline verification rules'],
50
- recommendedProposalFamilies: ['cursor-rules'],
51
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
52
- benchmarkFocus: ['pipeline safety', 'repeatable task flows', 'state-aware review'],
53
- },
54
- {
55
- key: 'infra-platform',
56
- label: 'Infra Platform',
57
- useWhen: 'Terraform, Docker, Kubernetes, serverless, or deployment-oriented repos.',
58
- adoption: 'Recommended when Cursor changes need stronger guardrails and infra-aware verification.',
59
- recommendedModules: ['.cursor/rules/ baseline', 'Infra review rules', 'Background agent env config'],
60
- recommendedProposalFamilies: ['cursor-rules', 'cursor-environment', 'cursor-ci-review'],
61
- recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
62
- benchmarkFocus: ['release safety', 'infra verification', 'reviewable operational changes'],
63
- },
64
- {
65
- key: 'oss-library',
66
- label: 'OSS Library',
67
- useWhen: 'Public packages or contributor-heavy repos that need lighter governance.',
68
- adoption: 'Recommended for open-source repos where Cursor should suggest, not auto-apply.',
69
- recommendedModules: ['.cursor/rules/ baseline'],
70
- recommendedProposalFamilies: ['cursor-rules'],
71
- recommendedSurfaces: ['.cursor/rules/'],
72
- benchmarkFocus: ['low-footprint adoption', 'contributor-safe defaults', 'manual review friendliness'],
73
- },
74
- {
75
- key: 'enterprise-governed',
76
- label: 'Enterprise Governed',
77
- useWhen: 'Repos with CI, policy files, security posture, or auditable team workflows.',
78
- adoption: 'Recommended for teams that need explicit approvals, review expectations, and governance.',
79
- recommendedModules: ['.cursor/rules/ baseline', 'Governance rollout kit', 'Enterprise policy rules'],
80
- recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise', 'cursor-ci-review'],
81
- recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
82
- benchmarkFocus: ['policy-aware rollout', 'approval posture', 'repeatable governance evidence'],
83
- },
84
- {
85
- key: 'monorepo',
86
- label: 'Monorepo',
87
- useWhen: 'Workspace-based repos with multiple packages sharing a root.',
88
- adoption: 'Recommended when glob-scoped Auto Attached rules and workspace boundaries matter.',
89
- recommendedModules: ['.cursor/rules/ baseline', 'Auto Attached rules per package', 'Custom commands'],
90
- recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
91
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.cursor/commands/'],
92
- benchmarkFocus: ['workspace-safe edits', 'package-scoped rules', 'cross-package drift control'],
93
- },
94
- {
95
- key: 'mobile',
96
- label: 'Mobile',
97
- useWhen: 'React Native, Flutter, Swift, or Kotlin repos with mobile-specific workflows.',
98
- adoption: 'Recommended when Cursor needs mobile build awareness and platform-specific verification.',
99
- recommendedModules: ['.cursor/rules/ baseline', 'Mobile verification rules'],
100
- recommendedProposalFamilies: ['cursor-rules'],
101
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
102
- benchmarkFocus: ['mobile build safety', 'platform-specific verification', 'reviewable native changes'],
103
- },
104
- {
105
- key: 'regulated-lite',
106
- label: 'Regulated Lite',
107
- useWhen: 'Repos with basic compliance needs — activity artifacts, rollback manifests, and audit trail.',
108
- adoption: 'Recommended for regulated-adjacent repos that need governance without full enterprise overhead.',
109
- recommendedModules: ['.cursor/rules/ baseline', 'Privacy Mode guide'],
110
- recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
111
- recommendedSurfaces: ['.cursor/rules/'],
112
- benchmarkFocus: ['compliance posture', 'privacy mode coverage', 'rollback readiness'],
113
- },
114
- {
115
- key: 'ecommerce',
116
- label: 'E-commerce',
117
- useWhen: 'Shopify, Stripe, or payment-heavy repos with transaction safety needs.',
118
- adoption: 'Recommended when Cursor changes touch payment flows, cart logic, or sensitive data.',
119
- recommendedModules: ['.cursor/rules/ baseline', 'Security review rules'],
120
- recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
121
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
122
- benchmarkFocus: ['transaction safety', 'payment flow review', 'PII-safe changes'],
123
- },
124
- {
125
- key: 'ai-ml',
126
- label: 'AI / ML',
127
- useWhen: 'Repos with ML pipelines, model training, RAG, or LLM integration workflows.',
128
- adoption: 'Recommended when Cursor needs model-aware verification and experiment tracking.',
129
- recommendedModules: ['.cursor/rules/ baseline', 'ML verification rules'],
130
- recommendedProposalFamilies: ['cursor-rules'],
131
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
132
- benchmarkFocus: ['model safety', 'experiment reproducibility', 'data pipeline review'],
133
- },
134
- {
135
- key: 'devops-cicd',
136
- label: 'DevOps / CI-CD',
137
- useWhen: 'Repos focused on CI/CD pipelines, deployment automation, and infrastructure-as-code.',
138
- adoption: 'Recommended when Cursor manages CI workflows, deployment scripts, or release processes.',
139
- recommendedModules: ['.cursor/rules/ baseline', 'Automation rules'],
140
- recommendedProposalFamilies: ['cursor-rules', 'cursor-automations', 'cursor-ci-review'],
141
- recommendedSurfaces: ['.cursor/rules/', '.cursor/automations/', '.github/workflows/'],
142
- benchmarkFocus: ['deployment safety', 'CI pipeline review', 'automation trigger safety'],
143
- },
144
- {
145
- key: 'design-system',
146
- label: 'Design System',
147
- useWhen: 'Component libraries, Storybook repos, or design token systems.',
148
- adoption: 'Recommended when Cursor edits shared UI components with downstream consumers.',
149
- recommendedModules: ['.cursor/rules/ baseline', 'Component review rules', 'Design Mode guide'],
150
- recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
151
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
152
- benchmarkFocus: ['component safety', 'visual regression awareness', 'Design Mode usage'],
153
- },
154
- {
155
- key: 'docs-content',
156
- label: 'Docs / Content',
157
- useWhen: 'Documentation repos, blogs, or content-heavy sites with editorial workflows.',
158
- adoption: 'Recommended when Cursor edits prose, docs, or content with editorial review needs.',
159
- recommendedModules: ['.cursor/rules/ baseline'],
160
- recommendedProposalFamilies: ['cursor-rules'],
161
- recommendedSurfaces: ['.cursor/rules/'],
162
- benchmarkFocus: ['content quality', 'editorial review', 'link and reference integrity'],
163
- },
164
- {
165
- key: 'security-focused',
166
- label: 'Security Focused',
167
- useWhen: 'Repos with strong security posture needs — secret management, auth, encryption.',
168
- adoption: 'Recommended for security-critical repos where every Cursor change needs security review.',
169
- recommendedModules: ['.cursor/rules/ baseline', 'Security review rules', 'Privacy Mode enforcement'],
170
- recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
171
- recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
172
- benchmarkFocus: ['secret protection', 'privacy mode enforcement', 'security review coverage'],
173
- },
174
- ];
175
-
176
- const CURSOR_DOMAIN_PACKS = [
177
- ...BASE_CURSOR_DOMAIN_PACKS,
178
- ...buildAdditionalDomainPacks('cursor', {
179
- existingKeys: new Set(BASE_CURSOR_DOMAIN_PACKS.map((pack) => pack.key)),
180
- }),
181
- ];
182
-
183
- function uniqueByKey(items) {
184
- const seen = new Set();
185
- const result = [];
186
- for (const item of items) {
187
- if (seen.has(item.key)) continue;
188
- seen.add(item.key);
189
- result.push(item);
190
- }
191
- return result;
192
- }
193
-
194
- function detectCursorDomainPacks(ctx, stacks = [], assets = {}) {
195
- const stackKeys = new Set((stacks || []).map((stack) => stack.key));
196
- const pkg = ctx.jsonFile ? (ctx.jsonFile('package.json') || {}) : {};
197
- const deps = ctx.projectDependencies ? ctx.projectDependencies() : {
198
- ...(pkg.dependencies || {}),
199
- ...(pkg.devDependencies || {}),
200
- };
201
- const matches = [];
202
-
203
- function addMatch(key, reasons) {
204
- const pack = CURSOR_DOMAIN_PACKS.find((item) => item.key === key);
205
- if (!pack) return;
206
- matches.push({ ...pack, matchReasons: reasons.filter(Boolean).slice(0, 3) });
207
- }
208
-
209
- const hasFrontend = stackKeys.has('react') || stackKeys.has('nextjs') || stackKeys.has('vue') ||
210
- stackKeys.has('angular') || stackKeys.has('svelte') ||
211
- ctx.hasDir('components') || ctx.hasDir('pages') ||
212
- (ctx.hasDir('app') && (deps.next || deps.react || deps.vue || deps['@angular/core'] || deps.svelte));
213
-
214
- const hasBackend = stackKeys.has('python') || stackKeys.has('django') || stackKeys.has('fastapi') ||
215
- stackKeys.has('go') || stackKeys.has('rust') || stackKeys.has('java') ||
216
- ctx.hasDir('api') || ctx.hasDir('routes') || ctx.hasDir('services') || ctx.hasDir('controllers') ||
217
- ctx.hasDir('workers') || ctx.hasDir('jobs');
218
-
219
- const hasInfra = stackKeys.has('docker') || stackKeys.has('terraform') || stackKeys.has('kubernetes') ||
220
- ctx.files.includes('wrangler.toml') || ctx.files.includes('serverless.yml') || ctx.files.includes('serverless.yaml') ||
221
- ctx.files.includes('cdk.json') || ctx.hasDir('infra') || ctx.hasDir('deploy') || ctx.hasDir('helm');
222
-
223
- const isMonorepo = ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
224
- ctx.files.includes('lerna.json') || ctx.files.includes('pnpm-workspace.yaml') ||
225
- ctx.hasDir('packages') ||
226
- (pkg.workspaces && (Array.isArray(pkg.workspaces) ? pkg.workspaces.length > 0 : true));
227
-
228
- const hasCi = ctx.hasDir('.github/workflows');
229
- const hasPolicyFiles = Boolean(ctx.fileContent('SECURITY.md') || ctx.fileContent('CODEOWNERS')) ||
230
- ctx.hasDir('compliance') || ctx.hasDir('policies') || ctx.hasDir('audit');
231
- const hasCursorRules = ctx.cursorRules ? ctx.cursorRules().length > 0 : ctx.hasDir('.cursor/rules');
232
- const isEnterpriseGoverned = (hasCi && hasPolicyFiles) || (hasCursorRules && hasPolicyFiles);
233
-
234
- if (hasBackend) {
235
- addMatch('backend-api', [
236
- 'Detected backend stack or service-oriented directories for Cursor agents.',
237
- ctx.hasDir('api') ? 'API-facing structure detected.' : null,
238
- ctx.hasDir('services') ? 'Service-layer directories detected.' : null,
239
- ]);
240
- }
241
-
242
- if (hasFrontend) {
243
- addMatch('frontend-ui', [
244
- 'Detected UI-heavy frontend stack or component directories.',
245
- stackKeys.has('nextjs') ? 'Next.js stack detected.' : null,
246
- ctx.hasDir('components') ? 'Component directories detected.' : null,
247
- ]);
248
- }
249
-
250
- if (isEnterpriseGoverned) {
251
- addMatch('enterprise-governed', [
252
- 'Detected team-governed rollout signals such as CI, policies, or explicit trust posture.',
253
- hasCi ? 'GitHub workflow automation detected.' : null,
254
- hasPolicyFiles ? 'Security/compliance policy files detected.' : null,
255
- ]);
256
- }
257
-
258
- if (isMonorepo) {
259
- addMatch('monorepo', [
260
- 'Detected workspace or multi-package repository structure.',
261
- ctx.files.includes('pnpm-workspace.yaml') ? 'pnpm workspace detected.' : null,
262
- ctx.hasDir('packages') ? 'Packages directory detected.' : null,
263
- ]);
264
- }
265
-
266
- if (hasInfra) {
267
- addMatch('infra-platform', [
268
- 'Detected infrastructure or deployment-oriented repo signals.',
269
- ctx.files.includes('wrangler.toml') ? 'Wrangler config detected.' : null,
270
- ctx.hasDir('infra') ? 'Infrastructure directory detected.' : null,
271
- ]);
272
- }
273
-
274
- const hasDataPipeline = ctx.hasDir('dags') || ctx.hasDir('etl') || ctx.hasDir('pipelines') ||
275
- ctx.hasDir('marts') || ctx.hasDir('migrations') ||
276
- deps.airflow || deps.prefect || deps.dagster || deps.dbt;
277
- if (hasDataPipeline) {
278
- addMatch('data-pipeline', ['Detected data pipeline or ETL-oriented repo signals.', ctx.hasDir('dags') ? 'DAG directory detected.' : null]);
279
- }
280
-
281
- const isOss = ctx.files.includes('LICENSE') && ctx.files.includes('CONTRIBUTING.md');
282
- if (isOss && !isEnterpriseGoverned) {
283
- addMatch('oss-library', ['Detected open-source library signals (LICENSE + CONTRIBUTING.md).']);
284
- }
285
-
286
- const isMobile = stackKeys.has('react-native') || stackKeys.has('flutter') ||
287
- stackKeys.has('swift') || stackKeys.has('kotlin') ||
288
- deps['react-native'] || deps.flutter || ctx.files.includes('Podfile') ||
289
- ctx.files.includes('build.gradle') || ctx.hasDir('ios') || ctx.hasDir('android');
290
- if (isMobile) {
291
- addMatch('mobile', ['Detected mobile development signals.', ctx.hasDir('ios') ? 'iOS directory detected.' : null, ctx.hasDir('android') ? 'Android directory detected.' : null]);
292
- }
293
-
294
- const isRegulated = hasPolicyFiles && !isEnterpriseGoverned;
295
- if (isRegulated) {
296
- addMatch('regulated-lite', ['Detected compliance-adjacent signals without full enterprise governance.']);
297
- }
298
-
299
- const isEcommerce = deps.stripe || deps['@stripe/stripe-js'] ||
300
- deps.shopify || deps['@shopify/shopify-api'] ||
301
- ctx.hasDir('checkout') || ctx.hasDir('cart') || ctx.hasDir('payments');
302
- if (isEcommerce) {
303
- addMatch('ecommerce', ['Detected e-commerce or payment-related signals.', deps.stripe ? 'Stripe dependency detected.' : null]);
304
- }
305
-
306
- const isAiMl = deps.tensorflow || deps.torch || deps.pytorch || deps.transformers ||
307
- deps.langchain || deps['@langchain/core'] || deps.openai || deps.anthropic ||
308
- ctx.hasDir('models') || ctx.hasDir('training') || ctx.hasDir('rag') ||
309
- ctx.files.includes('model.py') || ctx.files.includes('train.py');
310
- if (isAiMl) {
311
- addMatch('ai-ml', ['Detected AI/ML or model training signals.', ctx.hasDir('models') ? 'Models directory detected.' : null]);
312
- }
313
-
314
- const isDevops = hasCi && hasInfra && !isEnterpriseGoverned;
315
- if (isDevops) {
316
- addMatch('devops-cicd', ['Detected DevOps/CI-CD focus with both CI workflows and infrastructure.']);
317
- }
318
-
319
- const isDesignSystem = ctx.hasDir('stories') || ctx.hasDir('storybook') ||
320
- deps['@storybook/react'] || deps['@storybook/vue3'] ||
321
- ctx.files.includes('.storybook');
322
- if (isDesignSystem) {
323
- addMatch('design-system', ['Detected design system or component library signals.', ctx.hasDir('stories') ? 'Storybook stories detected.' : null]);
324
- }
325
-
326
- const isDocsContent = ctx.hasDir('docs') && !hasBackend && !hasFrontend &&
327
- (ctx.files.includes('mkdocs.yml') || ctx.files.includes('docusaurus.config.js') ||
328
- ctx.files.includes('_config.yml') || ctx.files.includes('hugo.toml'));
329
- if (isDocsContent) {
330
- addMatch('docs-content', ['Detected documentation or content-focused repo.']);
331
- }
332
-
333
- const isSecurityFocused = ctx.hasDir('security') ||
334
- deps['helmet'] || deps['csurf'] || deps['bcrypt'] ||
335
- (hasPolicyFiles && ctx.fileContent('SECURITY.md'));
336
- if (isSecurityFocused) {
337
- addMatch('security-focused', ['Detected security-focused repo signals.', ctx.fileContent('SECURITY.md') ? 'SECURITY.md present.' : null]);
338
- }
339
-
340
- detectAdditionalDomainPacks({
341
- ctx,
342
- pkg,
343
- deps,
344
- stackKeys,
345
- addMatch,
346
- hasBackend,
347
- hasFrontend,
348
- hasInfra,
349
- hasCi,
350
- isEnterpriseGoverned,
351
- });
352
-
353
- if (matches.length === 0) {
354
- addMatch('baseline-general', [
355
- 'No stronger platform-specific domain dominated, so a safe general Cursor baseline is the best starting point.',
356
- hasCursorRules
357
- ? 'The repo already has Cursor surfaces, but they are not yet specialized by domain.'
358
- : 'The repo needs a first Cursor baseline before specialization.',
359
- ]);
360
- }
361
-
362
- return uniqueByKey(matches);
363
- }
364
-
365
- module.exports = {
366
- CURSOR_DOMAIN_PACKS,
367
- detectCursorDomainPacks,
368
- };
1
+ /**
2
+ * Cursor Domain Packs — 16 domain packs with Cursor detection.
3
+ *
4
+ * Adapted from Copilot pattern with Cursor-specific surfaces:
5
+ * - .cursor/rules/*.mdc (not copilot-instructions.md)
6
+ * - .cursor/mcp.json (not .vscode/mcp.json)
7
+ * - .cursor/environment.json (background agent)
8
+ * - .cursor/automations/ (event-driven triggers)
9
+ */
10
+
11
+ const { buildAdditionalDomainPacks, detectAdditionalDomainPacks } = require('../domain-pack-expansion');
12
+
13
+ const BASE_CURSOR_DOMAIN_PACKS = [
14
+ {
15
+ key: 'baseline-general',
16
+ label: 'Baseline General',
17
+ useWhen: 'General repos that need a safe, reviewable baseline before deeper specialization.',
18
+ adoption: 'Safe default when no stronger domain signal dominates the repo.',
19
+ recommendedModules: ['.cursor/rules/ baseline', '.cursor/mcp.json baseline', 'Custom commands starter'],
20
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
21
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
22
+ benchmarkFocus: ['starter-safe improvement', 'reviewable trust posture'],
23
+ },
24
+ {
25
+ key: 'backend-api',
26
+ label: 'Backend API',
27
+ useWhen: 'Service, API, or backend-heavy repos with routes, services, jobs, schemas, or data access.',
28
+ adoption: 'Recommended when Cursor agents need stronger verification and review structure.',
29
+ recommendedModules: ['.cursor/rules/ baseline', 'Backend verification rules', 'CI / review workflow starter'],
30
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
31
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
32
+ benchmarkFocus: ['test + build verification', 'reviewable API changes', 'safe rollout posture'],
33
+ },
34
+ {
35
+ key: 'frontend-ui',
36
+ label: 'Frontend UI',
37
+ useWhen: 'React, Next.js, Vue, Angular, or Svelte repos with UI-heavy workflows.',
38
+ adoption: 'Recommended when Cursor agents need better component and build guidance.',
39
+ recommendedModules: ['.cursor/rules/ baseline', 'Frontend review rules', 'Design Mode guide'],
40
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
41
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
42
+ benchmarkFocus: ['build verification', 'component-safe edits', 'Design Mode awareness'],
43
+ },
44
+ {
45
+ key: 'data-pipeline',
46
+ label: 'Data Pipeline',
47
+ useWhen: 'Repos with workers, DAGs, ETL jobs, migrations, or analytics-heavy workflows.',
48
+ adoption: 'Recommended when Cursor agents need pipeline-safe verification.',
49
+ recommendedModules: ['.cursor/rules/ baseline', 'Pipeline verification rules'],
50
+ recommendedProposalFamilies: ['cursor-rules'],
51
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
52
+ benchmarkFocus: ['pipeline safety', 'repeatable task flows', 'state-aware review'],
53
+ },
54
+ {
55
+ key: 'infra-platform',
56
+ label: 'Infra Platform',
57
+ useWhen: 'Terraform, Docker, Kubernetes, serverless, or deployment-oriented repos.',
58
+ adoption: 'Recommended when Cursor changes need stronger guardrails and infra-aware verification.',
59
+ recommendedModules: ['.cursor/rules/ baseline', 'Infra review rules', 'Background agent env config'],
60
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-environment', 'cursor-ci-review'],
61
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
62
+ benchmarkFocus: ['release safety', 'infra verification', 'reviewable operational changes'],
63
+ },
64
+ {
65
+ key: 'oss-library',
66
+ label: 'OSS Library',
67
+ useWhen: 'Public packages or contributor-heavy repos that need lighter governance.',
68
+ adoption: 'Recommended for open-source repos where Cursor should suggest, not auto-apply.',
69
+ recommendedModules: ['.cursor/rules/ baseline'],
70
+ recommendedProposalFamilies: ['cursor-rules'],
71
+ recommendedSurfaces: ['.cursor/rules/'],
72
+ benchmarkFocus: ['low-footprint adoption', 'contributor-safe defaults', 'manual review friendliness'],
73
+ },
74
+ {
75
+ key: 'enterprise-governed',
76
+ label: 'Enterprise Governed',
77
+ useWhen: 'Repos with CI, policy files, security posture, or auditable team workflows.',
78
+ adoption: 'Recommended for teams that need explicit approvals, review expectations, and governance.',
79
+ recommendedModules: ['.cursor/rules/ baseline', 'Governance rollout kit', 'Enterprise policy rules'],
80
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise', 'cursor-ci-review'],
81
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
82
+ benchmarkFocus: ['policy-aware rollout', 'approval posture', 'repeatable governance evidence'],
83
+ },
84
+ {
85
+ key: 'monorepo',
86
+ label: 'Monorepo',
87
+ useWhen: 'Workspace-based repos with multiple packages sharing a root.',
88
+ adoption: 'Recommended when glob-scoped Auto Attached rules and workspace boundaries matter.',
89
+ recommendedModules: ['.cursor/rules/ baseline', 'Auto Attached rules per package', 'Custom commands'],
90
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
91
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.cursor/commands/'],
92
+ benchmarkFocus: ['workspace-safe edits', 'package-scoped rules', 'cross-package drift control'],
93
+ },
94
+ {
95
+ key: 'mobile',
96
+ label: 'Mobile',
97
+ useWhen: 'React Native, Flutter, Swift, or Kotlin repos with mobile-specific workflows.',
98
+ adoption: 'Recommended when Cursor needs mobile build awareness and platform-specific verification.',
99
+ recommendedModules: ['.cursor/rules/ baseline', 'Mobile verification rules'],
100
+ recommendedProposalFamilies: ['cursor-rules'],
101
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
102
+ benchmarkFocus: ['mobile build safety', 'platform-specific verification', 'reviewable native changes'],
103
+ },
104
+ {
105
+ key: 'regulated-lite',
106
+ label: 'Regulated Lite',
107
+ useWhen: 'Repos with basic compliance needs — activity artifacts, rollback manifests, and audit trail.',
108
+ adoption: 'Recommended for regulated-adjacent repos that need governance without full enterprise overhead.',
109
+ recommendedModules: ['.cursor/rules/ baseline', 'Privacy Mode guide'],
110
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
111
+ recommendedSurfaces: ['.cursor/rules/'],
112
+ benchmarkFocus: ['compliance posture', 'privacy mode coverage', 'rollback readiness'],
113
+ },
114
+ {
115
+ key: 'ecommerce',
116
+ label: 'E-commerce',
117
+ useWhen: 'Shopify, Stripe, or payment-heavy repos with transaction safety needs.',
118
+ adoption: 'Recommended when Cursor changes touch payment flows, cart logic, or sensitive data.',
119
+ recommendedModules: ['.cursor/rules/ baseline', 'Security review rules'],
120
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
121
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
122
+ benchmarkFocus: ['transaction safety', 'payment flow review', 'PII-safe changes'],
123
+ },
124
+ {
125
+ key: 'ai-ml',
126
+ label: 'AI / ML',
127
+ useWhen: 'Repos with ML pipelines, model training, RAG, or LLM integration workflows.',
128
+ adoption: 'Recommended when Cursor needs model-aware verification and experiment tracking.',
129
+ recommendedModules: ['.cursor/rules/ baseline', 'ML verification rules'],
130
+ recommendedProposalFamilies: ['cursor-rules'],
131
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
132
+ benchmarkFocus: ['model safety', 'experiment reproducibility', 'data pipeline review'],
133
+ },
134
+ {
135
+ key: 'devops-cicd',
136
+ label: 'DevOps / CI-CD',
137
+ useWhen: 'Repos focused on CI/CD pipelines, deployment automation, and infrastructure-as-code.',
138
+ adoption: 'Recommended when Cursor manages CI workflows, deployment scripts, or release processes.',
139
+ recommendedModules: ['.cursor/rules/ baseline', 'Automation rules'],
140
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-automations', 'cursor-ci-review'],
141
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/automations/', '.github/workflows/'],
142
+ benchmarkFocus: ['deployment safety', 'CI pipeline review', 'automation trigger safety'],
143
+ },
144
+ {
145
+ key: 'design-system',
146
+ label: 'Design System',
147
+ useWhen: 'Component libraries, Storybook repos, or design token systems.',
148
+ adoption: 'Recommended when Cursor edits shared UI components with downstream consumers.',
149
+ recommendedModules: ['.cursor/rules/ baseline', 'Component review rules', 'Design Mode guide'],
150
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
151
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
152
+ benchmarkFocus: ['component safety', 'visual regression awareness', 'Design Mode usage'],
153
+ },
154
+ {
155
+ key: 'docs-content',
156
+ label: 'Docs / Content',
157
+ useWhen: 'Documentation repos, blogs, or content-heavy sites with editorial workflows.',
158
+ adoption: 'Recommended when Cursor edits prose, docs, or content with editorial review needs.',
159
+ recommendedModules: ['.cursor/rules/ baseline'],
160
+ recommendedProposalFamilies: ['cursor-rules'],
161
+ recommendedSurfaces: ['.cursor/rules/'],
162
+ benchmarkFocus: ['content quality', 'editorial review', 'link and reference integrity'],
163
+ },
164
+ {
165
+ key: 'security-focused',
166
+ label: 'Security Focused',
167
+ useWhen: 'Repos with strong security posture needs — secret management, auth, encryption.',
168
+ adoption: 'Recommended for security-critical repos where every Cursor change needs security review.',
169
+ recommendedModules: ['.cursor/rules/ baseline', 'Security review rules', 'Privacy Mode enforcement'],
170
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
171
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
172
+ benchmarkFocus: ['secret protection', 'privacy mode enforcement', 'security review coverage'],
173
+ },
174
+ ];
175
+
176
+ const CURSOR_DOMAIN_PACKS = [
177
+ ...BASE_CURSOR_DOMAIN_PACKS,
178
+ ...buildAdditionalDomainPacks('cursor', {
179
+ existingKeys: new Set(BASE_CURSOR_DOMAIN_PACKS.map((pack) => pack.key)),
180
+ }),
181
+ ];
182
+
183
+ function uniqueByKey(items) {
184
+ const seen = new Set();
185
+ const result = [];
186
+ for (const item of items) {
187
+ if (seen.has(item.key)) continue;
188
+ seen.add(item.key);
189
+ result.push(item);
190
+ }
191
+ return result;
192
+ }
193
+
194
+ function detectCursorDomainPacks(ctx, stacks = [], assets = {}) {
195
+ const stackKeys = new Set((stacks || []).map((stack) => stack.key));
196
+ const pkg = ctx.jsonFile ? (ctx.jsonFile('package.json') || {}) : {};
197
+ const deps = ctx.projectDependencies ? ctx.projectDependencies() : {
198
+ ...(pkg.dependencies || {}),
199
+ ...(pkg.devDependencies || {}),
200
+ };
201
+ const matches = [];
202
+
203
+ function addMatch(key, reasons) {
204
+ const pack = CURSOR_DOMAIN_PACKS.find((item) => item.key === key);
205
+ if (!pack) return;
206
+ matches.push({ ...pack, matchReasons: reasons.filter(Boolean).slice(0, 3) });
207
+ }
208
+
209
+ const hasFrontend = stackKeys.has('react') || stackKeys.has('nextjs') || stackKeys.has('vue') ||
210
+ stackKeys.has('angular') || stackKeys.has('svelte') ||
211
+ ctx.hasDir('components') || ctx.hasDir('pages') ||
212
+ (ctx.hasDir('app') && (deps.next || deps.react || deps.vue || deps['@angular/core'] || deps.svelte));
213
+
214
+ const hasBackend = stackKeys.has('python') || stackKeys.has('django') || stackKeys.has('fastapi') ||
215
+ stackKeys.has('go') || stackKeys.has('rust') || stackKeys.has('java') ||
216
+ ctx.hasDir('api') || ctx.hasDir('routes') || ctx.hasDir('services') || ctx.hasDir('controllers') ||
217
+ ctx.hasDir('workers') || ctx.hasDir('jobs');
218
+
219
+ const hasInfra = stackKeys.has('docker') || stackKeys.has('terraform') || stackKeys.has('kubernetes') ||
220
+ ctx.files.includes('wrangler.toml') || ctx.files.includes('serverless.yml') || ctx.files.includes('serverless.yaml') ||
221
+ ctx.files.includes('cdk.json') || ctx.hasDir('infra') || ctx.hasDir('deploy') || ctx.hasDir('helm');
222
+
223
+ const isMonorepo = ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
224
+ ctx.files.includes('lerna.json') || ctx.files.includes('pnpm-workspace.yaml') ||
225
+ ctx.hasDir('packages') ||
226
+ (pkg.workspaces && (Array.isArray(pkg.workspaces) ? pkg.workspaces.length > 0 : true));
227
+
228
+ const hasCi = ctx.hasDir('.github/workflows');
229
+ const hasPolicyFiles = Boolean(ctx.fileContent('SECURITY.md') || ctx.fileContent('CODEOWNERS')) ||
230
+ ctx.hasDir('compliance') || ctx.hasDir('policies') || ctx.hasDir('audit');
231
+ const hasCursorRules = ctx.cursorRules ? ctx.cursorRules().length > 0 : ctx.hasDir('.cursor/rules');
232
+ const isEnterpriseGoverned = (hasCi && hasPolicyFiles) || (hasCursorRules && hasPolicyFiles);
233
+
234
+ if (hasBackend) {
235
+ addMatch('backend-api', [
236
+ 'Detected backend stack or service-oriented directories for Cursor agents.',
237
+ ctx.hasDir('api') ? 'API-facing structure detected.' : null,
238
+ ctx.hasDir('services') ? 'Service-layer directories detected.' : null,
239
+ ]);
240
+ }
241
+
242
+ if (hasFrontend) {
243
+ addMatch('frontend-ui', [
244
+ 'Detected UI-heavy frontend stack or component directories.',
245
+ stackKeys.has('nextjs') ? 'Next.js stack detected.' : null,
246
+ ctx.hasDir('components') ? 'Component directories detected.' : null,
247
+ ]);
248
+ }
249
+
250
+ if (isEnterpriseGoverned) {
251
+ addMatch('enterprise-governed', [
252
+ 'Detected team-governed rollout signals such as CI, policies, or explicit trust posture.',
253
+ hasCi ? 'GitHub workflow automation detected.' : null,
254
+ hasPolicyFiles ? 'Security/compliance policy files detected.' : null,
255
+ ]);
256
+ }
257
+
258
+ if (isMonorepo) {
259
+ addMatch('monorepo', [
260
+ 'Detected workspace or multi-package repository structure.',
261
+ ctx.files.includes('pnpm-workspace.yaml') ? 'pnpm workspace detected.' : null,
262
+ ctx.hasDir('packages') ? 'Packages directory detected.' : null,
263
+ ]);
264
+ }
265
+
266
+ if (hasInfra) {
267
+ addMatch('infra-platform', [
268
+ 'Detected infrastructure or deployment-oriented repo signals.',
269
+ ctx.files.includes('wrangler.toml') ? 'Wrangler config detected.' : null,
270
+ ctx.hasDir('infra') ? 'Infrastructure directory detected.' : null,
271
+ ]);
272
+ }
273
+
274
+ const hasDataPipeline = ctx.hasDir('dags') || ctx.hasDir('etl') || ctx.hasDir('pipelines') ||
275
+ ctx.hasDir('marts') || ctx.hasDir('migrations') ||
276
+ deps.airflow || deps.prefect || deps.dagster || deps.dbt;
277
+ if (hasDataPipeline) {
278
+ addMatch('data-pipeline', ['Detected data pipeline or ETL-oriented repo signals.', ctx.hasDir('dags') ? 'DAG directory detected.' : null]);
279
+ }
280
+
281
+ const isOss = ctx.files.includes('LICENSE') && ctx.files.includes('CONTRIBUTING.md');
282
+ if (isOss && !isEnterpriseGoverned) {
283
+ addMatch('oss-library', ['Detected open-source library signals (LICENSE + CONTRIBUTING.md).']);
284
+ }
285
+
286
+ const isMobile = stackKeys.has('react-native') || stackKeys.has('flutter') ||
287
+ stackKeys.has('swift') || stackKeys.has('kotlin') ||
288
+ deps['react-native'] || deps.flutter || ctx.files.includes('Podfile') ||
289
+ ctx.files.includes('build.gradle') || ctx.hasDir('ios') || ctx.hasDir('android');
290
+ if (isMobile) {
291
+ addMatch('mobile', ['Detected mobile development signals.', ctx.hasDir('ios') ? 'iOS directory detected.' : null, ctx.hasDir('android') ? 'Android directory detected.' : null]);
292
+ }
293
+
294
+ const isRegulated = hasPolicyFiles && !isEnterpriseGoverned;
295
+ if (isRegulated) {
296
+ addMatch('regulated-lite', ['Detected compliance-adjacent signals without full enterprise governance.']);
297
+ }
298
+
299
+ const isEcommerce = deps.stripe || deps['@stripe/stripe-js'] ||
300
+ deps.shopify || deps['@shopify/shopify-api'] ||
301
+ ctx.hasDir('checkout') || ctx.hasDir('cart') || ctx.hasDir('payments');
302
+ if (isEcommerce) {
303
+ addMatch('ecommerce', ['Detected e-commerce or payment-related signals.', deps.stripe ? 'Stripe dependency detected.' : null]);
304
+ }
305
+
306
+ const isAiMl = deps.tensorflow || deps.torch || deps.pytorch || deps.transformers ||
307
+ deps.langchain || deps['@langchain/core'] || deps.openai || deps.anthropic ||
308
+ ctx.hasDir('models') || ctx.hasDir('training') || ctx.hasDir('rag') ||
309
+ ctx.files.includes('model.py') || ctx.files.includes('train.py');
310
+ if (isAiMl) {
311
+ addMatch('ai-ml', ['Detected AI/ML or model training signals.', ctx.hasDir('models') ? 'Models directory detected.' : null]);
312
+ }
313
+
314
+ const isDevops = hasCi && hasInfra && !isEnterpriseGoverned;
315
+ if (isDevops) {
316
+ addMatch('devops-cicd', ['Detected DevOps/CI-CD focus with both CI workflows and infrastructure.']);
317
+ }
318
+
319
+ const isDesignSystem = ctx.hasDir('stories') || ctx.hasDir('storybook') ||
320
+ deps['@storybook/react'] || deps['@storybook/vue3'] ||
321
+ ctx.files.includes('.storybook');
322
+ if (isDesignSystem) {
323
+ addMatch('design-system', ['Detected design system or component library signals.', ctx.hasDir('stories') ? 'Storybook stories detected.' : null]);
324
+ }
325
+
326
+ const isDocsContent = ctx.hasDir('docs') && !hasBackend && !hasFrontend &&
327
+ (ctx.files.includes('mkdocs.yml') || ctx.files.includes('docusaurus.config.js') ||
328
+ ctx.files.includes('_config.yml') || ctx.files.includes('hugo.toml'));
329
+ if (isDocsContent) {
330
+ addMatch('docs-content', ['Detected documentation or content-focused repo.']);
331
+ }
332
+
333
+ const isSecurityFocused = ctx.hasDir('security') ||
334
+ deps['helmet'] || deps['csurf'] || deps['bcrypt'] ||
335
+ (hasPolicyFiles && ctx.fileContent('SECURITY.md'));
336
+ if (isSecurityFocused) {
337
+ addMatch('security-focused', ['Detected security-focused repo signals.', ctx.fileContent('SECURITY.md') ? 'SECURITY.md present.' : null]);
338
+ }
339
+
340
+ detectAdditionalDomainPacks({
341
+ ctx,
342
+ pkg,
343
+ deps,
344
+ stackKeys,
345
+ addMatch,
346
+ hasBackend,
347
+ hasFrontend,
348
+ hasInfra,
349
+ hasCi,
350
+ isEnterpriseGoverned,
351
+ });
352
+
353
+ if (matches.length === 0) {
354
+ addMatch('baseline-general', [
355
+ 'No stronger platform-specific domain dominated, so a safe general Cursor baseline is the best starting point.',
356
+ hasCursorRules
357
+ ? 'The repo already has Cursor surfaces, but they are not yet specialized by domain.'
358
+ : 'The repo needs a first Cursor baseline before specialization.',
359
+ ]);
360
+ }
361
+
362
+ return uniqueByKey(matches);
363
+ }
364
+
365
+ module.exports = {
366
+ CURSOR_DOMAIN_PACKS,
367
+ detectCursorDomainPacks,
368
+ };