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