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