@nerviq/cli 0.0.1 → 0.9.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/LICENSE +21 -0
  3. package/README.md +447 -0
  4. package/bin/cli.js +749 -0
  5. package/content/case-study-template.md +91 -0
  6. package/content/claims-governance.md +37 -0
  7. package/content/claude-code/audit-repo/SKILL.md +20 -0
  8. package/content/claude-native-integration.md +60 -0
  9. package/content/devto-article.json +9 -0
  10. package/content/launch-posts.md +226 -0
  11. package/content/pilot-rollout-kit.md +30 -0
  12. package/content/release-checklist.md +31 -0
  13. package/package.json +53 -4
  14. package/src/activity.js +529 -0
  15. package/src/aider/activity.js +226 -0
  16. package/src/aider/config-parser.js +166 -0
  17. package/src/aider/context.js +158 -0
  18. package/src/aider/deep-review.js +316 -0
  19. package/src/aider/domain-packs.js +278 -0
  20. package/src/aider/freshness.js +168 -0
  21. package/src/aider/governance.js +253 -0
  22. package/src/aider/interactive.js +334 -0
  23. package/src/aider/mcp-packs.js +98 -0
  24. package/src/aider/patch.js +214 -0
  25. package/src/aider/plans.js +186 -0
  26. package/src/aider/premium.js +360 -0
  27. package/src/aider/setup.js +404 -0
  28. package/src/aider/techniques.js +1323 -0
  29. package/src/analyze.js +821 -0
  30. package/src/audit.js +1003 -0
  31. package/src/badge.js +13 -0
  32. package/src/benchmark.js +339 -0
  33. package/src/claudex-sync.json +7 -0
  34. package/src/codex/activity.js +324 -0
  35. package/src/codex/config-parser.js +183 -0
  36. package/src/codex/context.js +221 -0
  37. package/src/codex/deep-review.js +493 -0
  38. package/src/codex/domain-packs.js +372 -0
  39. package/src/codex/freshness.js +167 -0
  40. package/src/codex/governance.js +192 -0
  41. package/src/codex/interactive.js +618 -0
  42. package/src/codex/mcp-packs.js +660 -0
  43. package/src/codex/patch.js +209 -0
  44. package/src/codex/plans.js +251 -0
  45. package/src/codex/premium.js +614 -0
  46. package/src/codex/setup.js +603 -0
  47. package/src/codex/techniques.js +2649 -0
  48. package/src/context.js +272 -0
  49. package/src/copilot/activity.js +309 -0
  50. package/src/copilot/config-parser.js +226 -0
  51. package/src/copilot/context.js +197 -0
  52. package/src/copilot/deep-review.js +346 -0
  53. package/src/copilot/domain-packs.js +350 -0
  54. package/src/copilot/freshness.js +197 -0
  55. package/src/copilot/governance.js +222 -0
  56. package/src/copilot/interactive.js +406 -0
  57. package/src/copilot/mcp-packs.js +572 -0
  58. package/src/copilot/patch.js +238 -0
  59. package/src/copilot/plans.js +253 -0
  60. package/src/copilot/premium.js +450 -0
  61. package/src/copilot/setup.js +488 -0
  62. package/src/copilot/techniques.js +1822 -0
  63. package/src/cursor/activity.js +301 -0
  64. package/src/cursor/config-parser.js +265 -0
  65. package/src/cursor/context.js +236 -0
  66. package/src/cursor/deep-review.js +334 -0
  67. package/src/cursor/domain-packs.js +346 -0
  68. package/src/cursor/freshness.js +214 -0
  69. package/src/cursor/governance.js +229 -0
  70. package/src/cursor/interactive.js +391 -0
  71. package/src/cursor/mcp-packs.js +571 -0
  72. package/src/cursor/patch.js +243 -0
  73. package/src/cursor/plans.js +254 -0
  74. package/src/cursor/premium.js +468 -0
  75. package/src/cursor/setup.js +488 -0
  76. package/src/cursor/techniques.js +1786 -0
  77. package/src/deep-review.js +345 -0
  78. package/src/domain-packs.js +364 -0
  79. package/src/formatters/sarif.js +115 -0
  80. package/src/gemini/activity.js +402 -0
  81. package/src/gemini/config-parser.js +275 -0
  82. package/src/gemini/context.js +221 -0
  83. package/src/gemini/deep-review.js +559 -0
  84. package/src/gemini/domain-packs.js +371 -0
  85. package/src/gemini/freshness.js +204 -0
  86. package/src/gemini/governance.js +201 -0
  87. package/src/gemini/interactive.js +860 -0
  88. package/src/gemini/mcp-packs.js +658 -0
  89. package/src/gemini/patch.js +229 -0
  90. package/src/gemini/plans.js +269 -0
  91. package/src/gemini/premium.js +759 -0
  92. package/src/gemini/setup.js +692 -0
  93. package/src/gemini/techniques.js +2084 -0
  94. package/src/governance.js +523 -0
  95. package/src/harmony/advisor.js +383 -0
  96. package/src/harmony/audit.js +303 -0
  97. package/src/harmony/canon.js +444 -0
  98. package/src/harmony/cli.js +331 -0
  99. package/src/harmony/drift.js +401 -0
  100. package/src/harmony/governance.js +313 -0
  101. package/src/harmony/memory.js +238 -0
  102. package/src/harmony/sync.js +458 -0
  103. package/src/harmony/watch.js +336 -0
  104. package/src/index.js +256 -0
  105. package/src/insights.js +119 -0
  106. package/src/interactive.js +118 -0
  107. package/src/mcp-packs.js +597 -0
  108. package/src/opencode/activity.js +286 -0
  109. package/src/opencode/config-parser.js +109 -0
  110. package/src/opencode/context.js +247 -0
  111. package/src/opencode/deep-review.js +313 -0
  112. package/src/opencode/domain-packs.js +240 -0
  113. package/src/opencode/freshness.js +158 -0
  114. package/src/opencode/governance.js +159 -0
  115. package/src/opencode/interactive.js +392 -0
  116. package/src/opencode/mcp-packs.js +474 -0
  117. package/src/opencode/patch.js +184 -0
  118. package/src/opencode/plans.js +231 -0
  119. package/src/opencode/premium.js +413 -0
  120. package/src/opencode/setup.js +449 -0
  121. package/src/opencode/techniques.js +1713 -0
  122. package/src/plans.js +655 -0
  123. package/src/secret-patterns.js +30 -0
  124. package/src/setup.js +1274 -0
  125. package/src/synergy/adaptive.js +261 -0
  126. package/src/synergy/compensation.js +156 -0
  127. package/src/synergy/evidence.js +193 -0
  128. package/src/synergy/learning.js +184 -0
  129. package/src/synergy/patterns.js +227 -0
  130. package/src/synergy/ranking.js +83 -0
  131. package/src/synergy/report.js +163 -0
  132. package/src/synergy/routing.js +152 -0
  133. package/src/techniques.js +1354 -0
  134. package/src/watch.js +229 -0
  135. package/src/windsurf/activity.js +302 -0
  136. package/src/windsurf/config-parser.js +267 -0
  137. package/src/windsurf/context.js +249 -0
  138. package/src/windsurf/deep-review.js +337 -0
  139. package/src/windsurf/domain-packs.js +348 -0
  140. package/src/windsurf/freshness.js +215 -0
  141. package/src/windsurf/governance.js +231 -0
  142. package/src/windsurf/interactive.js +388 -0
  143. package/src/windsurf/mcp-packs.js +535 -0
  144. package/src/windsurf/patch.js +231 -0
  145. package/src/windsurf/plans.js +247 -0
  146. package/src/windsurf/premium.js +467 -0
  147. package/src/windsurf/setup.js +471 -0
  148. package/src/windsurf/techniques.js +1758 -0
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Cursor Domain Packs — 16 domain packs with Cursor detection.
3
+ *
4
+ * Adapted from Copilot pattern with Cursor-specific surfaces:
5
+ * - .cursor/rules/*.mdc (not copilot-instructions.md)
6
+ * - .cursor/mcp.json (not .vscode/mcp.json)
7
+ * - .cursor/environment.json (background agent)
8
+ * - .cursor/automations/ (event-driven triggers)
9
+ */
10
+
11
+ const CURSOR_DOMAIN_PACKS = [
12
+ {
13
+ key: 'baseline-general',
14
+ label: 'Baseline General',
15
+ useWhen: 'General repos that need a safe, reviewable baseline before deeper specialization.',
16
+ adoption: 'Safe default when no stronger domain signal dominates the repo.',
17
+ recommendedModules: ['.cursor/rules/ baseline', '.cursor/mcp.json baseline', 'Custom commands starter'],
18
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
19
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
20
+ benchmarkFocus: ['starter-safe improvement', 'reviewable trust posture'],
21
+ },
22
+ {
23
+ key: 'backend-api',
24
+ label: 'Backend API',
25
+ useWhen: 'Service, API, or backend-heavy repos with routes, services, jobs, schemas, or data access.',
26
+ adoption: 'Recommended when Cursor agents need stronger verification and review structure.',
27
+ recommendedModules: ['.cursor/rules/ baseline', 'Backend verification rules', 'CI / review workflow starter'],
28
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
29
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
30
+ benchmarkFocus: ['test + build verification', 'reviewable API changes', 'safe rollout posture'],
31
+ },
32
+ {
33
+ key: 'frontend-ui',
34
+ label: 'Frontend UI',
35
+ useWhen: 'React, Next.js, Vue, Angular, or Svelte repos with UI-heavy workflows.',
36
+ adoption: 'Recommended when Cursor agents need better component and build guidance.',
37
+ recommendedModules: ['.cursor/rules/ baseline', 'Frontend review rules', 'Design Mode guide'],
38
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
39
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
40
+ benchmarkFocus: ['build verification', 'component-safe edits', 'Design Mode awareness'],
41
+ },
42
+ {
43
+ key: 'data-pipeline',
44
+ label: 'Data Pipeline',
45
+ useWhen: 'Repos with workers, DAGs, ETL jobs, migrations, or analytics-heavy workflows.',
46
+ adoption: 'Recommended when Cursor agents need pipeline-safe verification.',
47
+ recommendedModules: ['.cursor/rules/ baseline', 'Pipeline verification rules'],
48
+ recommendedProposalFamilies: ['cursor-rules'],
49
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
50
+ benchmarkFocus: ['pipeline safety', 'repeatable task flows', 'state-aware review'],
51
+ },
52
+ {
53
+ key: 'infra-platform',
54
+ label: 'Infra Platform',
55
+ useWhen: 'Terraform, Docker, Kubernetes, serverless, or deployment-oriented repos.',
56
+ adoption: 'Recommended when Cursor changes need stronger guardrails and infra-aware verification.',
57
+ recommendedModules: ['.cursor/rules/ baseline', 'Infra review rules', 'Background agent env config'],
58
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-environment', 'cursor-ci-review'],
59
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
60
+ benchmarkFocus: ['release safety', 'infra verification', 'reviewable operational changes'],
61
+ },
62
+ {
63
+ key: 'oss-library',
64
+ label: 'OSS Library',
65
+ useWhen: 'Public packages or contributor-heavy repos that need lighter governance.',
66
+ adoption: 'Recommended for open-source repos where Cursor should suggest, not auto-apply.',
67
+ recommendedModules: ['.cursor/rules/ baseline'],
68
+ recommendedProposalFamilies: ['cursor-rules'],
69
+ recommendedSurfaces: ['.cursor/rules/'],
70
+ benchmarkFocus: ['low-footprint adoption', 'contributor-safe defaults', 'manual review friendliness'],
71
+ },
72
+ {
73
+ key: 'enterprise-governed',
74
+ label: 'Enterprise Governed',
75
+ useWhen: 'Repos with CI, policy files, security posture, or auditable team workflows.',
76
+ adoption: 'Recommended for teams that need explicit approvals, review expectations, and governance.',
77
+ recommendedModules: ['.cursor/rules/ baseline', 'Governance rollout kit', 'Enterprise policy rules'],
78
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise', 'cursor-ci-review'],
79
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/environment.json', '.github/workflows/'],
80
+ benchmarkFocus: ['policy-aware rollout', 'approval posture', 'repeatable governance evidence'],
81
+ },
82
+ {
83
+ key: 'monorepo',
84
+ label: 'Monorepo',
85
+ useWhen: 'Workspace-based repos with multiple packages sharing a root.',
86
+ adoption: 'Recommended when glob-scoped Auto Attached rules and workspace boundaries matter.',
87
+ recommendedModules: ['.cursor/rules/ baseline', 'Auto Attached rules per package', 'Custom commands'],
88
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-mcp'],
89
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.cursor/commands/'],
90
+ benchmarkFocus: ['workspace-safe edits', 'package-scoped rules', 'cross-package drift control'],
91
+ },
92
+ {
93
+ key: 'mobile',
94
+ label: 'Mobile',
95
+ useWhen: 'React Native, Flutter, Swift, or Kotlin repos with mobile-specific workflows.',
96
+ adoption: 'Recommended when Cursor needs mobile build awareness and platform-specific verification.',
97
+ recommendedModules: ['.cursor/rules/ baseline', 'Mobile verification rules'],
98
+ recommendedProposalFamilies: ['cursor-rules'],
99
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
100
+ benchmarkFocus: ['mobile build safety', 'platform-specific verification', 'reviewable native changes'],
101
+ },
102
+ {
103
+ key: 'regulated-lite',
104
+ label: 'Regulated Lite',
105
+ useWhen: 'Repos with basic compliance needs — activity artifacts, rollback manifests, and audit trail.',
106
+ adoption: 'Recommended for regulated-adjacent repos that need governance without full enterprise overhead.',
107
+ recommendedModules: ['.cursor/rules/ baseline', 'Privacy Mode guide'],
108
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
109
+ recommendedSurfaces: ['.cursor/rules/'],
110
+ benchmarkFocus: ['compliance posture', 'privacy mode coverage', 'rollback readiness'],
111
+ },
112
+ {
113
+ key: 'ecommerce',
114
+ label: 'E-commerce',
115
+ useWhen: 'Shopify, Stripe, or payment-heavy repos with transaction safety needs.',
116
+ adoption: 'Recommended when Cursor changes touch payment flows, cart logic, or sensitive data.',
117
+ recommendedModules: ['.cursor/rules/ baseline', 'Security review rules'],
118
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-ci-review'],
119
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json', '.github/workflows/'],
120
+ benchmarkFocus: ['transaction safety', 'payment flow review', 'PII-safe changes'],
121
+ },
122
+ {
123
+ key: 'ai-ml',
124
+ label: 'AI / ML',
125
+ useWhen: 'Repos with ML pipelines, model training, RAG, or LLM integration workflows.',
126
+ adoption: 'Recommended when Cursor needs model-aware verification and experiment tracking.',
127
+ recommendedModules: ['.cursor/rules/ baseline', 'ML verification rules'],
128
+ recommendedProposalFamilies: ['cursor-rules'],
129
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
130
+ benchmarkFocus: ['model safety', 'experiment reproducibility', 'data pipeline review'],
131
+ },
132
+ {
133
+ key: 'devops-cicd',
134
+ label: 'DevOps / CI-CD',
135
+ useWhen: 'Repos focused on CI/CD pipelines, deployment automation, and infrastructure-as-code.',
136
+ adoption: 'Recommended when Cursor manages CI workflows, deployment scripts, or release processes.',
137
+ recommendedModules: ['.cursor/rules/ baseline', 'Automation rules'],
138
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-automations', 'cursor-ci-review'],
139
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/automations/', '.github/workflows/'],
140
+ benchmarkFocus: ['deployment safety', 'CI pipeline review', 'automation trigger safety'],
141
+ },
142
+ {
143
+ key: 'design-system',
144
+ label: 'Design System',
145
+ useWhen: 'Component libraries, Storybook repos, or design token systems.',
146
+ adoption: 'Recommended when Cursor edits shared UI components with downstream consumers.',
147
+ recommendedModules: ['.cursor/rules/ baseline', 'Component review rules', 'Design Mode guide'],
148
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-design-mode'],
149
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
150
+ benchmarkFocus: ['component safety', 'visual regression awareness', 'Design Mode usage'],
151
+ },
152
+ {
153
+ key: 'docs-content',
154
+ label: 'Docs / Content',
155
+ useWhen: 'Documentation repos, blogs, or content-heavy sites with editorial workflows.',
156
+ adoption: 'Recommended when Cursor edits prose, docs, or content with editorial review needs.',
157
+ recommendedModules: ['.cursor/rules/ baseline'],
158
+ recommendedProposalFamilies: ['cursor-rules'],
159
+ recommendedSurfaces: ['.cursor/rules/'],
160
+ benchmarkFocus: ['content quality', 'editorial review', 'link and reference integrity'],
161
+ },
162
+ {
163
+ key: 'security-focused',
164
+ label: 'Security Focused',
165
+ useWhen: 'Repos with strong security posture needs — secret management, auth, encryption.',
166
+ adoption: 'Recommended for security-critical repos where every Cursor change needs security review.',
167
+ recommendedModules: ['.cursor/rules/ baseline', 'Security review rules', 'Privacy Mode enforcement'],
168
+ recommendedProposalFamilies: ['cursor-rules', 'cursor-enterprise'],
169
+ recommendedSurfaces: ['.cursor/rules/', '.cursor/mcp.json'],
170
+ benchmarkFocus: ['secret protection', 'privacy mode enforcement', 'security review coverage'],
171
+ },
172
+ ];
173
+
174
+ function uniqueByKey(items) {
175
+ const seen = new Set();
176
+ const result = [];
177
+ for (const item of items) {
178
+ if (seen.has(item.key)) continue;
179
+ seen.add(item.key);
180
+ result.push(item);
181
+ }
182
+ return result;
183
+ }
184
+
185
+ function detectCursorDomainPacks(ctx, stacks = [], assets = {}) {
186
+ const stackKeys = new Set((stacks || []).map((stack) => stack.key));
187
+ const pkg = ctx.jsonFile ? (ctx.jsonFile('package.json') || {}) : {};
188
+ const deps = ctx.projectDependencies ? ctx.projectDependencies() : {
189
+ ...(pkg.dependencies || {}),
190
+ ...(pkg.devDependencies || {}),
191
+ };
192
+ const matches = [];
193
+
194
+ function addMatch(key, reasons) {
195
+ const pack = CURSOR_DOMAIN_PACKS.find((item) => item.key === key);
196
+ if (!pack) return;
197
+ matches.push({ ...pack, matchReasons: reasons.filter(Boolean).slice(0, 3) });
198
+ }
199
+
200
+ const hasFrontend = stackKeys.has('react') || stackKeys.has('nextjs') || stackKeys.has('vue') ||
201
+ stackKeys.has('angular') || stackKeys.has('svelte') ||
202
+ ctx.hasDir('components') || ctx.hasDir('pages') ||
203
+ (ctx.hasDir('app') && (deps.next || deps.react || deps.vue || deps['@angular/core'] || deps.svelte));
204
+
205
+ const hasBackend = stackKeys.has('python') || stackKeys.has('django') || stackKeys.has('fastapi') ||
206
+ stackKeys.has('go') || stackKeys.has('rust') || stackKeys.has('java') ||
207
+ ctx.hasDir('api') || ctx.hasDir('routes') || ctx.hasDir('services') || ctx.hasDir('controllers') ||
208
+ ctx.hasDir('workers') || ctx.hasDir('jobs');
209
+
210
+ const hasInfra = stackKeys.has('docker') || stackKeys.has('terraform') || stackKeys.has('kubernetes') ||
211
+ ctx.files.includes('wrangler.toml') || ctx.files.includes('serverless.yml') || ctx.files.includes('serverless.yaml') ||
212
+ ctx.files.includes('cdk.json') || ctx.hasDir('infra') || ctx.hasDir('deploy') || ctx.hasDir('helm');
213
+
214
+ const isMonorepo = ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
215
+ ctx.files.includes('lerna.json') || ctx.files.includes('pnpm-workspace.yaml') ||
216
+ ctx.hasDir('packages') ||
217
+ (pkg.workspaces && (Array.isArray(pkg.workspaces) ? pkg.workspaces.length > 0 : true));
218
+
219
+ const hasCi = ctx.hasDir('.github/workflows');
220
+ const hasPolicyFiles = Boolean(ctx.fileContent('SECURITY.md') || ctx.fileContent('CODEOWNERS')) ||
221
+ ctx.hasDir('compliance') || ctx.hasDir('policies') || ctx.hasDir('audit');
222
+ const hasCursorRules = ctx.cursorRules ? ctx.cursorRules().length > 0 : ctx.hasDir('.cursor/rules');
223
+ const isEnterpriseGoverned = (hasCi && hasPolicyFiles) || (hasCursorRules && hasPolicyFiles);
224
+
225
+ if (hasBackend) {
226
+ addMatch('backend-api', [
227
+ 'Detected backend stack or service-oriented directories for Cursor agents.',
228
+ ctx.hasDir('api') ? 'API-facing structure detected.' : null,
229
+ ctx.hasDir('services') ? 'Service-layer directories detected.' : null,
230
+ ]);
231
+ }
232
+
233
+ if (hasFrontend) {
234
+ addMatch('frontend-ui', [
235
+ 'Detected UI-heavy frontend stack or component directories.',
236
+ stackKeys.has('nextjs') ? 'Next.js stack detected.' : null,
237
+ ctx.hasDir('components') ? 'Component directories detected.' : null,
238
+ ]);
239
+ }
240
+
241
+ if (isEnterpriseGoverned) {
242
+ addMatch('enterprise-governed', [
243
+ 'Detected team-governed rollout signals such as CI, policies, or explicit trust posture.',
244
+ hasCi ? 'GitHub workflow automation detected.' : null,
245
+ hasPolicyFiles ? 'Security/compliance policy files detected.' : null,
246
+ ]);
247
+ }
248
+
249
+ if (isMonorepo) {
250
+ addMatch('monorepo', [
251
+ 'Detected workspace or multi-package repository structure.',
252
+ ctx.files.includes('pnpm-workspace.yaml') ? 'pnpm workspace detected.' : null,
253
+ ctx.hasDir('packages') ? 'Packages directory detected.' : null,
254
+ ]);
255
+ }
256
+
257
+ if (hasInfra) {
258
+ addMatch('infra-platform', [
259
+ 'Detected infrastructure or deployment-oriented repo signals.',
260
+ ctx.files.includes('wrangler.toml') ? 'Wrangler config detected.' : null,
261
+ ctx.hasDir('infra') ? 'Infrastructure directory detected.' : null,
262
+ ]);
263
+ }
264
+
265
+ const hasDataPipeline = ctx.hasDir('dags') || ctx.hasDir('etl') || ctx.hasDir('pipelines') ||
266
+ ctx.hasDir('marts') || ctx.hasDir('migrations') ||
267
+ deps.airflow || deps.prefect || deps.dagster || deps.dbt;
268
+ if (hasDataPipeline) {
269
+ addMatch('data-pipeline', ['Detected data pipeline or ETL-oriented repo signals.', ctx.hasDir('dags') ? 'DAG directory detected.' : null]);
270
+ }
271
+
272
+ const isOss = ctx.files.includes('LICENSE') && ctx.files.includes('CONTRIBUTING.md');
273
+ if (isOss && !isEnterpriseGoverned) {
274
+ addMatch('oss-library', ['Detected open-source library signals (LICENSE + CONTRIBUTING.md).']);
275
+ }
276
+
277
+ const isMobile = stackKeys.has('react-native') || stackKeys.has('flutter') ||
278
+ stackKeys.has('swift') || stackKeys.has('kotlin') ||
279
+ deps['react-native'] || deps.flutter || ctx.files.includes('Podfile') ||
280
+ ctx.files.includes('build.gradle') || ctx.hasDir('ios') || ctx.hasDir('android');
281
+ if (isMobile) {
282
+ addMatch('mobile', ['Detected mobile development signals.', ctx.hasDir('ios') ? 'iOS directory detected.' : null, ctx.hasDir('android') ? 'Android directory detected.' : null]);
283
+ }
284
+
285
+ const isRegulated = hasPolicyFiles && !isEnterpriseGoverned;
286
+ if (isRegulated) {
287
+ addMatch('regulated-lite', ['Detected compliance-adjacent signals without full enterprise governance.']);
288
+ }
289
+
290
+ const isEcommerce = deps.stripe || deps['@stripe/stripe-js'] ||
291
+ deps.shopify || deps['@shopify/shopify-api'] ||
292
+ ctx.hasDir('checkout') || ctx.hasDir('cart') || ctx.hasDir('payments');
293
+ if (isEcommerce) {
294
+ addMatch('ecommerce', ['Detected e-commerce or payment-related signals.', deps.stripe ? 'Stripe dependency detected.' : null]);
295
+ }
296
+
297
+ const isAiMl = deps.tensorflow || deps.torch || deps.pytorch || deps.transformers ||
298
+ deps.langchain || deps['@langchain/core'] || deps.openai || deps.anthropic ||
299
+ ctx.hasDir('models') || ctx.hasDir('training') || ctx.hasDir('rag') ||
300
+ ctx.files.includes('model.py') || ctx.files.includes('train.py');
301
+ if (isAiMl) {
302
+ addMatch('ai-ml', ['Detected AI/ML or model training signals.', ctx.hasDir('models') ? 'Models directory detected.' : null]);
303
+ }
304
+
305
+ const isDevops = hasCi && hasInfra && !isEnterpriseGoverned;
306
+ if (isDevops) {
307
+ addMatch('devops-cicd', ['Detected DevOps/CI-CD focus with both CI workflows and infrastructure.']);
308
+ }
309
+
310
+ const isDesignSystem = ctx.hasDir('stories') || ctx.hasDir('storybook') ||
311
+ deps['@storybook/react'] || deps['@storybook/vue3'] ||
312
+ ctx.files.includes('.storybook');
313
+ if (isDesignSystem) {
314
+ addMatch('design-system', ['Detected design system or component library signals.', ctx.hasDir('stories') ? 'Storybook stories detected.' : null]);
315
+ }
316
+
317
+ const isDocsContent = ctx.hasDir('docs') && !hasBackend && !hasFrontend &&
318
+ (ctx.files.includes('mkdocs.yml') || ctx.files.includes('docusaurus.config.js') ||
319
+ ctx.files.includes('_config.yml') || ctx.files.includes('hugo.toml'));
320
+ if (isDocsContent) {
321
+ addMatch('docs-content', ['Detected documentation or content-focused repo.']);
322
+ }
323
+
324
+ const isSecurityFocused = ctx.hasDir('security') ||
325
+ deps['helmet'] || deps['csurf'] || deps['bcrypt'] ||
326
+ (hasPolicyFiles && ctx.fileContent('SECURITY.md'));
327
+ if (isSecurityFocused) {
328
+ addMatch('security-focused', ['Detected security-focused repo signals.', ctx.fileContent('SECURITY.md') ? 'SECURITY.md present.' : null]);
329
+ }
330
+
331
+ if (matches.length === 0) {
332
+ addMatch('baseline-general', [
333
+ 'No stronger platform-specific domain dominated, so a safe general Cursor baseline is the best starting point.',
334
+ hasCursorRules
335
+ ? 'The repo already has Cursor surfaces, but they are not yet specialized by domain.'
336
+ : 'The repo needs a first Cursor baseline before specialization.',
337
+ ]);
338
+ }
339
+
340
+ return uniqueByKey(matches);
341
+ }
342
+
343
+ module.exports = {
344
+ CURSOR_DOMAIN_PACKS,
345
+ detectCursorDomainPacks,
346
+ };
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Cursor Freshness Operationalization
3
+ *
4
+ * Release gates, recurring probes, propagation checklists,
5
+ * and staleness blocking for Cursor surfaces.
6
+ *
7
+ * P0 sources from docs.cursor.com, propagation for rule format changes.
8
+ */
9
+
10
+ const { version } = require('../../package.json');
11
+
12
+ /**
13
+ * P0 sources that must be fresh before any Cursor release claim.
14
+ */
15
+ const P0_SOURCES = [
16
+ {
17
+ key: 'cursor-rules-docs',
18
+ label: 'Cursor Rules Documentation',
19
+ url: 'https://docs.cursor.com/context/rules-for-ai',
20
+ stalenessThresholdDays: 30,
21
+ verifiedAt: null,
22
+ },
23
+ {
24
+ key: 'cursor-mdc-format',
25
+ label: 'MDC Format Documentation',
26
+ url: 'https://docs.cursor.com/context/rules-for-ai#rule-types',
27
+ stalenessThresholdDays: 30,
28
+ verifiedAt: null,
29
+ },
30
+ {
31
+ key: 'cursor-mcp-docs',
32
+ label: 'Cursor MCP Documentation',
33
+ url: 'https://docs.cursor.com/context/model-context-protocol',
34
+ stalenessThresholdDays: 30,
35
+ verifiedAt: null,
36
+ },
37
+ {
38
+ key: 'cursor-background-agents',
39
+ label: 'Background Agents Documentation',
40
+ url: 'https://docs.cursor.com/background-agent',
41
+ stalenessThresholdDays: 14,
42
+ verifiedAt: null,
43
+ },
44
+ {
45
+ key: 'cursor-automations',
46
+ label: 'Automations Documentation',
47
+ url: 'https://docs.cursor.com/automations',
48
+ stalenessThresholdDays: 14,
49
+ verifiedAt: null,
50
+ },
51
+ {
52
+ key: 'cursor-bugbot',
53
+ label: 'BugBot Documentation',
54
+ url: 'https://docs.cursor.com/bugbot',
55
+ stalenessThresholdDays: 30,
56
+ verifiedAt: null,
57
+ },
58
+ {
59
+ key: 'cursor-privacy-mode',
60
+ label: 'Cursor Privacy Mode Documentation',
61
+ url: 'https://docs.cursor.com/account/privacy',
62
+ stalenessThresholdDays: 30,
63
+ verifiedAt: null,
64
+ },
65
+ {
66
+ key: 'cursor-changelog',
67
+ label: 'Cursor Changelog',
68
+ url: 'https://changelog.cursor.com',
69
+ stalenessThresholdDays: 14,
70
+ verifiedAt: null,
71
+ },
72
+ {
73
+ key: 'cursor-security',
74
+ label: 'Cursor Security Documentation',
75
+ url: 'https://docs.cursor.com/account/security',
76
+ stalenessThresholdDays: 30,
77
+ verifiedAt: null,
78
+ },
79
+ ];
80
+
81
+ /**
82
+ * Propagation checklist: when a Cursor source changes, these must update.
83
+ */
84
+ const PROPAGATION_CHECKLIST = [
85
+ {
86
+ trigger: 'MDC rule format change (new frontmatter fields, type behavior change)',
87
+ targets: [
88
+ 'src/cursor/config-parser.js — update VALID_MDC_FIELDS, detectRuleType, parseSimpleYaml',
89
+ 'src/cursor/techniques.js — update rule validation checks (CU-A01..CU-A09)',
90
+ 'src/cursor/context.js — update cursorRules() parsing and type detection',
91
+ 'src/cursor/setup.js — update rule template generation',
92
+ ],
93
+ },
94
+ {
95
+ trigger: 'Background agent behavior change (environment.json format, VM config)',
96
+ targets: [
97
+ 'src/cursor/techniques.js — update background agent checks (CU-G01..CU-G05)',
98
+ 'src/cursor/setup.js — update environment.json template',
99
+ 'src/cursor/governance.js — update background-agent permission profile',
100
+ ],
101
+ },
102
+ {
103
+ trigger: 'Automation trigger format or behavior change',
104
+ targets: [
105
+ 'src/cursor/techniques.js — update automation checks (CU-H01..CU-H05)',
106
+ 'src/cursor/context.js — update automationsConfig() parsing',
107
+ 'src/cursor/governance.js — update automation permission profile and caveats',
108
+ ],
109
+ },
110
+ {
111
+ trigger: 'MCP configuration format change in .cursor/mcp.json',
112
+ targets: [
113
+ 'src/cursor/mcp-packs.js — update pack JSON projections and merge logic',
114
+ 'src/cursor/techniques.js — update MCP checks (CU-E01..CU-E05)',
115
+ 'src/cursor/context.js — update mcpConfig() parsing',
116
+ 'src/cursor/config-parser.js — update validateMcpEnvVars',
117
+ ],
118
+ },
119
+ {
120
+ trigger: 'MCP tool limit change (currently ~40)',
121
+ targets: [
122
+ 'src/cursor/techniques.js — update CU-B02 threshold',
123
+ 'src/cursor/governance.js — update mcp-tool-limit caveat',
124
+ 'src/cursor/mcp-packs.js — update recommendation logic',
125
+ ],
126
+ },
127
+ {
128
+ trigger: 'BugBot feature update or autofix behavior change',
129
+ targets: [
130
+ 'src/cursor/techniques.js — update BugBot checks (CU-J01..CU-J04)',
131
+ 'src/cursor/setup.js — update BugBot guide template',
132
+ 'src/cursor/governance.js — update bugbot-review hook',
133
+ ],
134
+ },
135
+ {
136
+ trigger: 'Privacy Mode or security model change',
137
+ targets: [
138
+ 'src/cursor/techniques.js — update trust checks (CU-C01..CU-C09)',
139
+ 'src/cursor/governance.js — update caveats and permission profiles',
140
+ 'src/cursor/deep-review.js — update trust class detection',
141
+ ],
142
+ },
143
+ {
144
+ trigger: 'Design Mode feature update',
145
+ targets: [
146
+ 'src/cursor/setup.js — update Design Mode guide template',
147
+ 'src/cursor/techniques.js — update CU-L01 modern features check',
148
+ ],
149
+ },
150
+ ];
151
+
152
+ /**
153
+ * Release gate: check if all P0 sources are within staleness threshold.
154
+ */
155
+ function checkReleaseGate(sourceVerifications = {}) {
156
+ const now = new Date();
157
+ const results = P0_SOURCES.map(source => {
158
+ const verifiedAt = sourceVerifications[source.key]
159
+ ? new Date(sourceVerifications[source.key])
160
+ : source.verifiedAt ? new Date(source.verifiedAt) : null;
161
+
162
+ if (!verifiedAt) {
163
+ return { ...source, status: 'unverified', daysStale: null };
164
+ }
165
+
166
+ const daysSince = Math.floor((now - verifiedAt) / (1000 * 60 * 60 * 24));
167
+ const isStale = daysSince > source.stalenessThresholdDays;
168
+
169
+ return { ...source, verifiedAt: verifiedAt.toISOString(), daysStale: daysSince, status: isStale ? 'stale' : 'fresh' };
170
+ });
171
+
172
+ return {
173
+ ready: results.every(r => r.status === 'fresh'),
174
+ stale: results.filter(r => r.status === 'stale' || r.status === 'unverified'),
175
+ fresh: results.filter(r => r.status === 'fresh'),
176
+ results,
177
+ };
178
+ }
179
+
180
+ function formatReleaseGate(gateResult) {
181
+ const lines = [
182
+ `Cursor Freshness Gate (nerviq v${version})`,
183
+ '═══════════════════════════════════════',
184
+ '',
185
+ `Status: ${gateResult.ready ? 'READY' : 'BLOCKED'}`,
186
+ `Fresh: ${gateResult.fresh.length}/${gateResult.results.length}`,
187
+ '',
188
+ ];
189
+
190
+ for (const result of gateResult.results) {
191
+ const icon = result.status === 'fresh' ? '✓' : result.status === 'stale' ? '✗' : '?';
192
+ const age = result.daysStale !== null ? ` (${result.daysStale}d ago)` : ' (unverified)';
193
+ lines.push(` ${icon} ${result.label}${age} — threshold: ${result.stalenessThresholdDays}d`);
194
+ }
195
+
196
+ if (!gateResult.ready) {
197
+ lines.push('', 'Action required: verify stale/unverified sources before claiming release freshness.');
198
+ }
199
+
200
+ return lines.join('\n');
201
+ }
202
+
203
+ function getPropagationTargets(triggerKeyword) {
204
+ const keyword = triggerKeyword.toLowerCase();
205
+ return PROPAGATION_CHECKLIST.filter(item => item.trigger.toLowerCase().includes(keyword));
206
+ }
207
+
208
+ module.exports = {
209
+ P0_SOURCES,
210
+ PROPAGATION_CHECKLIST,
211
+ checkReleaseGate,
212
+ formatReleaseGate,
213
+ getPropagationTargets,
214
+ };