@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.
- package/LICENSE +23 -23
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/activity.js +1039 -1039
- package/src/adoption-advisor.js +299 -299
- package/src/aider/config-parser.js +166 -166
- package/src/aider/context.js +4 -1
- package/src/aider/deep-review.js +316 -316
- package/src/aider/domain-packs.js +303 -303
- package/src/aider/freshness.js +93 -93
- package/src/aider/governance.js +253 -253
- package/src/aider/interactive.js +334 -334
- package/src/aider/mcp-packs.js +329 -329
- package/src/aider/patch.js +214 -214
- package/src/aider/plans.js +186 -186
- package/src/aider/premium.js +360 -360
- package/src/aider/setup.js +404 -404
- package/src/aider/techniques.js +312 -67
- package/src/analyze.js +951 -951
- package/src/anti-patterns.js +485 -485
- package/src/audit/instruction-files.js +180 -180
- package/src/audit/recommendations.js +577 -577
- package/src/auto-suggest.js +154 -154
- package/src/badge.js +13 -13
- package/src/behavioral-drift.js +801 -801
- package/src/benchmark.js +67 -67
- package/src/catalog.js +103 -103
- package/src/certification.js +128 -128
- package/src/codex/config-parser.js +183 -183
- package/src/codex/context.js +223 -223
- package/src/codex/deep-review.js +493 -493
- package/src/codex/domain-packs.js +394 -394
- package/src/codex/freshness.js +84 -84
- package/src/codex/governance.js +192 -192
- package/src/codex/interactive.js +618 -618
- package/src/codex/mcp-packs.js +914 -914
- package/src/codex/patch.js +209 -209
- package/src/codex/plans.js +251 -251
- package/src/codex/premium.js +614 -614
- package/src/codex/setup.js +591 -591
- package/src/continuous-ops.js +681 -681
- package/src/copilot/activity.js +309 -309
- package/src/copilot/deep-review.js +346 -346
- package/src/copilot/domain-packs.js +372 -372
- package/src/copilot/freshness.js +57 -57
- package/src/copilot/governance.js +222 -222
- package/src/copilot/interactive.js +406 -406
- package/src/copilot/mcp-packs.js +826 -826
- package/src/copilot/plans.js +253 -253
- package/src/copilot/premium.js +451 -451
- package/src/copilot/setup.js +488 -488
- package/src/cost-tracking.js +61 -61
- package/src/cursor/activity.js +301 -301
- package/src/cursor/config-parser.js +265 -265
- package/src/cursor/context.js +256 -256
- package/src/cursor/deep-review.js +334 -334
- package/src/cursor/domain-packs.js +368 -368
- package/src/cursor/freshness.js +65 -65
- package/src/cursor/governance.js +229 -229
- package/src/cursor/interactive.js +391 -391
- package/src/cursor/mcp-packs.js +828 -828
- package/src/cursor/plans.js +254 -254
- package/src/cursor/premium.js +469 -469
- package/src/cursor/setup.js +488 -488
- package/src/dashboard.js +493 -493
- package/src/deep-review.js +428 -428
- package/src/deprecation.js +98 -98
- package/src/diff-only.js +280 -280
- package/src/doctor.js +119 -119
- package/src/domain-pack-expansion.js +1033 -1033
- package/src/domain-packs.js +387 -387
- package/src/feedback.js +178 -178
- package/src/fix-engine.js +783 -783
- package/src/fix-prompts.js +122 -122
- package/src/formatters/sarif.js +115 -115
- package/src/freshness.js +74 -74
- package/src/gemini/config-parser.js +275 -275
- package/src/gemini/deep-review.js +559 -559
- package/src/gemini/domain-packs.js +393 -393
- package/src/gemini/freshness.js +66 -66
- package/src/gemini/governance.js +201 -201
- package/src/gemini/interactive.js +860 -860
- package/src/gemini/mcp-packs.js +915 -915
- package/src/gemini/plans.js +269 -269
- package/src/gemini/premium.js +760 -760
- package/src/gemini/setup.js +692 -692
- package/src/governance.js +72 -72
- package/src/harmony/add.js +68 -68
- package/src/harmony/advisor.js +333 -333
- package/src/harmony/canon.js +565 -565
- package/src/harmony/cli.js +591 -591
- package/src/harmony/drift.js +401 -401
- package/src/harmony/governance.js +313 -313
- package/src/harmony/memory.js +239 -239
- package/src/harmony/sync.js +475 -475
- package/src/harmony/watch.js +370 -370
- package/src/hook-validation.js +342 -342
- package/src/index.js +271 -271
- package/src/init.js +184 -184
- package/src/instruction-surfaces.js +185 -185
- package/src/integrations.js +144 -144
- package/src/interactive.js +118 -118
- package/src/locales/en.json +1 -1
- package/src/locales/es.json +1 -1
- package/src/mcp-packs.js +830 -830
- package/src/mcp-server.js +726 -726
- package/src/mcp-validation.js +337 -337
- package/src/nerviq-sync.json +7 -7
- package/src/opencode/config-parser.js +109 -109
- package/src/opencode/context.js +247 -247
- package/src/opencode/deep-review.js +313 -313
- package/src/opencode/domain-packs.js +262 -262
- package/src/opencode/freshness.js +66 -66
- package/src/opencode/governance.js +159 -159
- package/src/opencode/interactive.js +392 -392
- package/src/opencode/mcp-packs.js +705 -705
- package/src/opencode/patch.js +184 -184
- package/src/opencode/plans.js +231 -231
- package/src/opencode/premium.js +413 -413
- package/src/opencode/setup.js +449 -449
- package/src/opencode/techniques.js +27 -27
- package/src/operating-profile.js +574 -574
- package/src/org.js +152 -152
- package/src/permission-rules.js +218 -218
- package/src/plans.js +839 -839
- package/src/platform-change-manifest.js +86 -86
- package/src/plugins.js +110 -110
- package/src/policy-layers.js +210 -210
- package/src/profiles.js +124 -124
- package/src/prompt-injection.js +74 -74
- package/src/public-api.js +173 -173
- package/src/recommendation-rules.js +84 -84
- package/src/repo-archetype.js +386 -386
- package/src/secret-patterns.js +39 -39
- package/src/server.js +527 -527
- package/src/setup/analysis.js +607 -607
- package/src/setup/runtime.js +172 -172
- package/src/setup.js +677 -677
- package/src/shared/capabilities.js +194 -194
- package/src/source-urls.js +132 -132
- package/src/stack-checks.js +565 -565
- package/src/supplemental-checks.js +13 -13
- package/src/synergy/adaptive.js +261 -261
- package/src/synergy/compensation.js +137 -137
- package/src/synergy/evidence.js +193 -193
- package/src/synergy/learning.js +199 -199
- package/src/synergy/patterns.js +227 -227
- package/src/synergy/ranking.js +83 -83
- package/src/synergy/report.js +165 -165
- package/src/synergy/routing.js +146 -146
- package/src/techniques/api.js +407 -407
- package/src/techniques/automation.js +316 -316
- package/src/techniques/compliance.js +257 -257
- package/src/techniques/hygiene.js +294 -294
- package/src/techniques/instructions.js +243 -243
- package/src/techniques/observability.js +226 -226
- package/src/techniques/optimization.js +142 -142
- package/src/techniques/quality.js +318 -318
- package/src/techniques/security.js +237 -237
- package/src/techniques/shared.js +443 -443
- package/src/techniques/stacks.js +2294 -2294
- package/src/techniques/tools.js +106 -106
- package/src/techniques/workflow.js +413 -413
- package/src/techniques.js +81 -81
- package/src/terminology.js +73 -73
- package/src/token-estimate.js +35 -35
- package/src/usage-patterns.js +99 -99
- package/src/verification-metadata.js +145 -145
- package/src/watch.js +247 -247
- package/src/windsurf/activity.js +302 -302
- package/src/windsurf/config-parser.js +267 -267
- package/src/windsurf/deep-review.js +337 -337
- package/src/windsurf/domain-packs.js +370 -370
- package/src/windsurf/freshness.js +36 -36
- package/src/windsurf/governance.js +231 -231
- package/src/windsurf/interactive.js +388 -388
- package/src/windsurf/mcp-packs.js +792 -792
- package/src/windsurf/plans.js +247 -247
- package/src/windsurf/premium.js +468 -468
- package/src/windsurf/setup.js +471 -471
- package/src/workspace.js +375 -375
package/src/adoption-advisor.js
CHANGED
|
@@ -1,299 +1,299 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { getMcpPackPreflight } = require('./mcp-packs');
|
|
4
|
-
|
|
5
|
-
const DECISION_ORDER = { adopt: 0, defer: 1, ignore: 2 };
|
|
6
|
-
|
|
7
|
-
function unique(values) {
|
|
8
|
-
return [...new Set((values || []).filter(Boolean))];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function makeItem(item) {
|
|
12
|
-
return {
|
|
13
|
-
decision: item.decision,
|
|
14
|
-
kind: item.kind,
|
|
15
|
-
key: item.key,
|
|
16
|
-
label: item.label,
|
|
17
|
-
why: item.why,
|
|
18
|
-
evidence: unique(item.evidence),
|
|
19
|
-
prerequisites: unique(item.prerequisites),
|
|
20
|
-
expectedBenefit: item.expectedBenefit,
|
|
21
|
-
rollbackSafety: item.rollbackSafety,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function summarize(items = []) {
|
|
26
|
-
const counts = items.reduce((acc, item) => {
|
|
27
|
-
acc[item.decision] = (acc[item.decision] || 0) + 1;
|
|
28
|
-
return acc;
|
|
29
|
-
}, { adopt: 0, defer: 0, ignore: 0 });
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
adopt: counts.adopt || 0,
|
|
33
|
-
defer: counts.defer || 0,
|
|
34
|
-
ignore: counts.ignore || 0,
|
|
35
|
-
label: `${counts.adopt || 0} adopt now / ${counts.defer || 0} defer / ${counts.ignore || 0} ignore`,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function inferMcpPackPrerequisites(pack, preflightEntry) {
|
|
40
|
-
const prerequisites = [];
|
|
41
|
-
if (preflightEntry && Array.isArray(preflightEntry.missingEnvVars) && preflightEntry.missingEnvVars.length > 0) {
|
|
42
|
-
prerequisites.push(`Provide required env vars: ${preflightEntry.missingEnvVars.join(', ')}`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (/Pass connection string as CLI argument/i.test(pack.adoption || '')) {
|
|
46
|
-
prerequisites.push('Provide a live connection string or DATABASE_URL before enabling this MCP pack.');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (/Docker running locally/i.test(pack.adoption || '')) {
|
|
50
|
-
prerequisites.push('Docker must be running locally before this MCP pack is useful.');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (/OAuth/i.test(pack.adoption || '')) {
|
|
54
|
-
prerequisites.push('Complete the OAuth or external auth setup before enabling this MCP pack in shared flows.');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (/community-maintained/i.test(pack.adoption || '')) {
|
|
58
|
-
prerequisites.push('Review the package trust/update posture before enabling it in a wider team baseline.');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return unique(prerequisites);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function buildIgnoreItems(repoArchetype, operatingProfile, recommendedDomainPacks = []) {
|
|
65
|
-
const items = [];
|
|
66
|
-
const domainKeys = new Set((recommendedDomainPacks || []).map((pack) => pack.key));
|
|
67
|
-
|
|
68
|
-
if (operatingProfile.platformSupport.strategy === 'single-platform-baseline') {
|
|
69
|
-
items.push(makeItem({
|
|
70
|
-
decision: 'ignore',
|
|
71
|
-
kind: 'platform-expansion',
|
|
72
|
-
key: 'broad-platform-expansion',
|
|
73
|
-
label: 'Broad multi-platform expansion',
|
|
74
|
-
why: 'This repo should stabilize one governed primary platform before adding more AI surfaces.',
|
|
75
|
-
evidence: [
|
|
76
|
-
`Platform strategy: ${operatingProfile.platformSupport.strategy}`,
|
|
77
|
-
`Archetype: ${repoArchetype.label}`,
|
|
78
|
-
],
|
|
79
|
-
prerequisites: [],
|
|
80
|
-
expectedBenefit: 'Prevents governance drift caused by widening the tool surface too early.',
|
|
81
|
-
rollbackSafety: 'Nothing is applied here; this is an intentional skip until the baseline matures.',
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (repoArchetype.topology.key !== 'monorepo') {
|
|
86
|
-
items.push(makeItem({
|
|
87
|
-
decision: 'ignore',
|
|
88
|
-
kind: 'ci-shape',
|
|
89
|
-
key: 'workspace-pr-gate',
|
|
90
|
-
label: 'Workspace-aware PR gate',
|
|
91
|
-
why: 'Workspace-specific CI complexity does not match a non-monorepo repo shape.',
|
|
92
|
-
evidence: [
|
|
93
|
-
`Topology: ${repoArchetype.topology.label}`,
|
|
94
|
-
'No monorepo-specific governance surface is required.',
|
|
95
|
-
],
|
|
96
|
-
prerequisites: [],
|
|
97
|
-
expectedBenefit: 'Keeps the operating model lean and aligned to the real repo topology.',
|
|
98
|
-
rollbackSafety: 'This is a deliberate skip; no cleanup is required.',
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (repoArchetype.riskProfile.key !== 'regulated' && !domainKeys.has('regulated-lite') && !domainKeys.has('security-focused')) {
|
|
103
|
-
items.push(makeItem({
|
|
104
|
-
decision: 'ignore',
|
|
105
|
-
kind: 'governance-pack',
|
|
106
|
-
key: 'regulated-lite',
|
|
107
|
-
label: 'Regulated-lite governance overhead',
|
|
108
|
-
why: 'The repo does not show regulated or security-heavy signals strong enough to justify this heavier rollout pack.',
|
|
109
|
-
evidence: [
|
|
110
|
-
`Risk posture: ${repoArchetype.riskProfile.label}`,
|
|
111
|
-
],
|
|
112
|
-
prerequisites: [],
|
|
113
|
-
expectedBenefit: 'Preserves a lighter rollout model and avoids over-governing normal product repos.',
|
|
114
|
-
rollbackSafety: 'This is a no-op skip; the repo can adopt a heavier pack later if evidence changes.',
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (repoArchetype.stackFamily.key !== 'mobile' && !domainKeys.has('mobile')) {
|
|
119
|
-
items.push(makeItem({
|
|
120
|
-
decision: 'ignore',
|
|
121
|
-
kind: 'verification',
|
|
122
|
-
key: 'mobile-release-loop',
|
|
123
|
-
label: 'Mobile release workflow extras',
|
|
124
|
-
why: 'Mobile-only analyze/build workflow overhead should not be forced onto a non-mobile repo.',
|
|
125
|
-
evidence: [
|
|
126
|
-
`Stack family: ${repoArchetype.stackFamily.label}`,
|
|
127
|
-
],
|
|
128
|
-
prerequisites: [],
|
|
129
|
-
expectedBenefit: 'Avoids irrelevant workflow ceremony and keeps verification recommendations credible.',
|
|
130
|
-
rollbackSafety: 'No rollback is needed because the capability is being intentionally skipped.',
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return items.slice(0, 3);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function buildAdoptionAdvisor(options) {
|
|
138
|
-
const {
|
|
139
|
-
platform,
|
|
140
|
-
repoArchetype,
|
|
141
|
-
recommendedOperatingProfile,
|
|
142
|
-
recommendedDomainPacks = [],
|
|
143
|
-
recommendedMcpPacks = [],
|
|
144
|
-
env = {},
|
|
145
|
-
} = options || {};
|
|
146
|
-
|
|
147
|
-
const items = [];
|
|
148
|
-
const mcpPreflightByKey = new Map(
|
|
149
|
-
getMcpPackPreflight((recommendedMcpPacks || []).map((pack) => pack.key), env).map((entry) => [entry.key, entry])
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
items.push(makeItem({
|
|
153
|
-
decision: 'adopt',
|
|
154
|
-
kind: 'platform-strategy',
|
|
155
|
-
key: recommendedOperatingProfile.platformSupport.strategy,
|
|
156
|
-
label: `Platform strategy: ${recommendedOperatingProfile.platformSupport.strategy}`,
|
|
157
|
-
why: recommendedOperatingProfile.platformSupport.why,
|
|
158
|
-
evidence: recommendedOperatingProfile.platformSupport.evidence,
|
|
159
|
-
prerequisites: recommendedOperatingProfile.platformSupport.prerequisites,
|
|
160
|
-
expectedBenefit: recommendedOperatingProfile.platformSupport.expectedBenefit,
|
|
161
|
-
rollbackSafety: recommendedOperatingProfile.platformSupport.rollbackSafety,
|
|
162
|
-
}));
|
|
163
|
-
|
|
164
|
-
if (recommendedOperatingProfile.platformSupport.optionalExpansion) {
|
|
165
|
-
items.push(makeItem({
|
|
166
|
-
decision: 'defer',
|
|
167
|
-
kind: 'platform-expansion',
|
|
168
|
-
key: `secondary-${recommendedOperatingProfile.platformSupport.optionalExpansion}`,
|
|
169
|
-
label: `Add ${recommendedOperatingProfile.platformSupport.optionalExpansion} as a secondary review surface`,
|
|
170
|
-
why: 'A secondary platform could help later, but the repo should stabilize its primary governed posture first.',
|
|
171
|
-
evidence: recommendedOperatingProfile.platformSupport.evidence,
|
|
172
|
-
prerequisites: [
|
|
173
|
-
'Capture tagged baseline and post-fix snapshots first.',
|
|
174
|
-
'Keep Harmony stable across the currently active platform surface.',
|
|
175
|
-
],
|
|
176
|
-
expectedBenefit: 'Adds a complementary advisory surface only after the core posture is already reliable.',
|
|
177
|
-
rollbackSafety: 'Secondary platform expansion is optional and can be removed without changing the app codebase.',
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
items.push(makeItem({
|
|
182
|
-
decision: 'adopt',
|
|
183
|
-
kind: 'permission-profile',
|
|
184
|
-
key: recommendedOperatingProfile.permissionProfile.key,
|
|
185
|
-
label: `Permission profile: ${recommendedOperatingProfile.permissionProfile.label}`,
|
|
186
|
-
why: recommendedOperatingProfile.permissionProfile.why,
|
|
187
|
-
evidence: recommendedOperatingProfile.permissionProfile.evidence,
|
|
188
|
-
prerequisites: recommendedOperatingProfile.permissionProfile.prerequisites,
|
|
189
|
-
expectedBenefit: recommendedOperatingProfile.permissionProfile.expectedBenefit,
|
|
190
|
-
rollbackSafety: recommendedOperatingProfile.permissionProfile.rollbackSafety,
|
|
191
|
-
}));
|
|
192
|
-
|
|
193
|
-
items.push(makeItem({
|
|
194
|
-
decision: 'adopt',
|
|
195
|
-
kind: 'governance-pack',
|
|
196
|
-
key: recommendedOperatingProfile.governancePack.key,
|
|
197
|
-
label: `Governance pack: ${recommendedOperatingProfile.governancePack.label}`,
|
|
198
|
-
why: recommendedOperatingProfile.governancePack.why,
|
|
199
|
-
evidence: recommendedOperatingProfile.governancePack.evidence,
|
|
200
|
-
prerequisites: recommendedOperatingProfile.governancePack.prerequisites,
|
|
201
|
-
expectedBenefit: recommendedOperatingProfile.governancePack.expectedBenefit,
|
|
202
|
-
rollbackSafety: recommendedOperatingProfile.governancePack.rollbackSafety,
|
|
203
|
-
}));
|
|
204
|
-
|
|
205
|
-
items.push(makeItem({
|
|
206
|
-
decision: 'adopt',
|
|
207
|
-
kind: 'hook-set',
|
|
208
|
-
key: 'starter-hooks',
|
|
209
|
-
label: `Starter hook set: ${recommendedOperatingProfile.hooks.map((hook) => hook.key).join(', ')}`,
|
|
210
|
-
why: 'These hooks are the lowest-friction set that matches the repo trust boundary, logging needs, and review posture.',
|
|
211
|
-
evidence: unique(recommendedOperatingProfile.hooks.flatMap((hook) => hook.evidence || []).slice(0, 5)),
|
|
212
|
-
prerequisites: unique(recommendedOperatingProfile.hooks.flatMap((hook) => hook.prerequisites || [])),
|
|
213
|
-
expectedBenefit: 'Adds secret protection, trust-boundary checks, and durable change evidence without widening the product surface.',
|
|
214
|
-
rollbackSafety: 'Each hook can be removed independently from repo settings if it proves noisy.',
|
|
215
|
-
}));
|
|
216
|
-
|
|
217
|
-
items.push(makeItem({
|
|
218
|
-
decision: 'adopt',
|
|
219
|
-
kind: 'verification-loop',
|
|
220
|
-
key: recommendedOperatingProfile.verification.key,
|
|
221
|
-
label: `Verification loop: ${recommendedOperatingProfile.verification.label}`,
|
|
222
|
-
why: recommendedOperatingProfile.verification.why,
|
|
223
|
-
evidence: recommendedOperatingProfile.verification.evidence,
|
|
224
|
-
prerequisites: recommendedOperatingProfile.verification.prerequisites,
|
|
225
|
-
expectedBenefit: recommendedOperatingProfile.verification.expectedBenefit,
|
|
226
|
-
rollbackSafety: recommendedOperatingProfile.verification.rollbackSafety,
|
|
227
|
-
}));
|
|
228
|
-
|
|
229
|
-
items.push(makeItem({
|
|
230
|
-
decision: 'adopt',
|
|
231
|
-
kind: 'ci-shape',
|
|
232
|
-
key: recommendedOperatingProfile.ciShape.key,
|
|
233
|
-
label: `CI shape: ${recommendedOperatingProfile.ciShape.label}`,
|
|
234
|
-
why: recommendedOperatingProfile.ciShape.why,
|
|
235
|
-
evidence: recommendedOperatingProfile.ciShape.evidence,
|
|
236
|
-
prerequisites: recommendedOperatingProfile.ciShape.prerequisites,
|
|
237
|
-
expectedBenefit: recommendedOperatingProfile.ciShape.expectedBenefit,
|
|
238
|
-
rollbackSafety: recommendedOperatingProfile.ciShape.rollbackSafety,
|
|
239
|
-
}));
|
|
240
|
-
|
|
241
|
-
for (const pack of recommendedDomainPacks) {
|
|
242
|
-
items.push(makeItem({
|
|
243
|
-
decision: 'adopt',
|
|
244
|
-
kind: 'domain-pack',
|
|
245
|
-
key: pack.key,
|
|
246
|
-
label: `Domain pack: ${pack.label}`,
|
|
247
|
-
why: pack.useWhen,
|
|
248
|
-
evidence: unique([...(pack.matchReasons || []), `Archetype: ${repoArchetype.label}`]).slice(0, 5),
|
|
249
|
-
prerequisites: [
|
|
250
|
-
`Review the pack modules before applying them: ${(pack.recommendedModules || []).slice(0, 4).join(', ') || 'no starter modules listed'}`,
|
|
251
|
-
],
|
|
252
|
-
expectedBenefit: (pack.benchmarkFocus || []).length > 0
|
|
253
|
-
? `Improves Nerviq's relevance around ${pack.benchmarkFocus.slice(0, 3).join(', ')}.`
|
|
254
|
-
: 'Makes Nerviq recommendations more domain-aware for this repo.',
|
|
255
|
-
rollbackSafety: 'Domain packs are additive guidance. You can remove a pack from the recommended stack without rewriting the repo.',
|
|
256
|
-
}));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (platform === 'claude') {
|
|
260
|
-
for (const pack of recommendedMcpPacks) {
|
|
261
|
-
const preflight = mcpPreflightByKey.get(pack.key);
|
|
262
|
-
const prerequisites = inferMcpPackPrerequisites(pack, preflight);
|
|
263
|
-
const decision = prerequisites.length > 0 ? 'defer' : 'adopt';
|
|
264
|
-
items.push(makeItem({
|
|
265
|
-
decision,
|
|
266
|
-
kind: 'mcp-pack',
|
|
267
|
-
key: pack.key,
|
|
268
|
-
label: `MCP pack: ${pack.label}`,
|
|
269
|
-
why: pack.useWhen,
|
|
270
|
-
evidence: unique([pack.adoption, `Repo archetype: ${repoArchetype.label}`]).slice(0, 4),
|
|
271
|
-
prerequisites,
|
|
272
|
-
expectedBenefit: pack.adoption,
|
|
273
|
-
rollbackSafety: 'MCP packs are optional integrations; they can be added or removed from settings without changing application source code.',
|
|
274
|
-
}));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
items.push(...buildIgnoreItems(repoArchetype, recommendedOperatingProfile, recommendedDomainPacks));
|
|
279
|
-
|
|
280
|
-
const sorted = items
|
|
281
|
-
.sort((a, b) => {
|
|
282
|
-
const decisionDiff = (DECISION_ORDER[a.decision] || 99) - (DECISION_ORDER[b.decision] || 99);
|
|
283
|
-
if (decisionDiff !== 0) return decisionDiff;
|
|
284
|
-
return a.label.localeCompare(b.label);
|
|
285
|
-
})
|
|
286
|
-
.map((item, index) => ({
|
|
287
|
-
priority: index + 1,
|
|
288
|
-
...item,
|
|
289
|
-
}));
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
summary: summarize(sorted),
|
|
293
|
-
items: sorted,
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
module.exports = {
|
|
298
|
-
buildAdoptionAdvisor,
|
|
299
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getMcpPackPreflight } = require('./mcp-packs');
|
|
4
|
+
|
|
5
|
+
const DECISION_ORDER = { adopt: 0, defer: 1, ignore: 2 };
|
|
6
|
+
|
|
7
|
+
function unique(values) {
|
|
8
|
+
return [...new Set((values || []).filter(Boolean))];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function makeItem(item) {
|
|
12
|
+
return {
|
|
13
|
+
decision: item.decision,
|
|
14
|
+
kind: item.kind,
|
|
15
|
+
key: item.key,
|
|
16
|
+
label: item.label,
|
|
17
|
+
why: item.why,
|
|
18
|
+
evidence: unique(item.evidence),
|
|
19
|
+
prerequisites: unique(item.prerequisites),
|
|
20
|
+
expectedBenefit: item.expectedBenefit,
|
|
21
|
+
rollbackSafety: item.rollbackSafety,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function summarize(items = []) {
|
|
26
|
+
const counts = items.reduce((acc, item) => {
|
|
27
|
+
acc[item.decision] = (acc[item.decision] || 0) + 1;
|
|
28
|
+
return acc;
|
|
29
|
+
}, { adopt: 0, defer: 0, ignore: 0 });
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
adopt: counts.adopt || 0,
|
|
33
|
+
defer: counts.defer || 0,
|
|
34
|
+
ignore: counts.ignore || 0,
|
|
35
|
+
label: `${counts.adopt || 0} adopt now / ${counts.defer || 0} defer / ${counts.ignore || 0} ignore`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function inferMcpPackPrerequisites(pack, preflightEntry) {
|
|
40
|
+
const prerequisites = [];
|
|
41
|
+
if (preflightEntry && Array.isArray(preflightEntry.missingEnvVars) && preflightEntry.missingEnvVars.length > 0) {
|
|
42
|
+
prerequisites.push(`Provide required env vars: ${preflightEntry.missingEnvVars.join(', ')}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (/Pass connection string as CLI argument/i.test(pack.adoption || '')) {
|
|
46
|
+
prerequisites.push('Provide a live connection string or DATABASE_URL before enabling this MCP pack.');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (/Docker running locally/i.test(pack.adoption || '')) {
|
|
50
|
+
prerequisites.push('Docker must be running locally before this MCP pack is useful.');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (/OAuth/i.test(pack.adoption || '')) {
|
|
54
|
+
prerequisites.push('Complete the OAuth or external auth setup before enabling this MCP pack in shared flows.');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (/community-maintained/i.test(pack.adoption || '')) {
|
|
58
|
+
prerequisites.push('Review the package trust/update posture before enabling it in a wider team baseline.');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return unique(prerequisites);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function buildIgnoreItems(repoArchetype, operatingProfile, recommendedDomainPacks = []) {
|
|
65
|
+
const items = [];
|
|
66
|
+
const domainKeys = new Set((recommendedDomainPacks || []).map((pack) => pack.key));
|
|
67
|
+
|
|
68
|
+
if (operatingProfile.platformSupport.strategy === 'single-platform-baseline') {
|
|
69
|
+
items.push(makeItem({
|
|
70
|
+
decision: 'ignore',
|
|
71
|
+
kind: 'platform-expansion',
|
|
72
|
+
key: 'broad-platform-expansion',
|
|
73
|
+
label: 'Broad multi-platform expansion',
|
|
74
|
+
why: 'This repo should stabilize one governed primary platform before adding more AI surfaces.',
|
|
75
|
+
evidence: [
|
|
76
|
+
`Platform strategy: ${operatingProfile.platformSupport.strategy}`,
|
|
77
|
+
`Archetype: ${repoArchetype.label}`,
|
|
78
|
+
],
|
|
79
|
+
prerequisites: [],
|
|
80
|
+
expectedBenefit: 'Prevents governance drift caused by widening the tool surface too early.',
|
|
81
|
+
rollbackSafety: 'Nothing is applied here; this is an intentional skip until the baseline matures.',
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (repoArchetype.topology.key !== 'monorepo') {
|
|
86
|
+
items.push(makeItem({
|
|
87
|
+
decision: 'ignore',
|
|
88
|
+
kind: 'ci-shape',
|
|
89
|
+
key: 'workspace-pr-gate',
|
|
90
|
+
label: 'Workspace-aware PR gate',
|
|
91
|
+
why: 'Workspace-specific CI complexity does not match a non-monorepo repo shape.',
|
|
92
|
+
evidence: [
|
|
93
|
+
`Topology: ${repoArchetype.topology.label}`,
|
|
94
|
+
'No monorepo-specific governance surface is required.',
|
|
95
|
+
],
|
|
96
|
+
prerequisites: [],
|
|
97
|
+
expectedBenefit: 'Keeps the operating model lean and aligned to the real repo topology.',
|
|
98
|
+
rollbackSafety: 'This is a deliberate skip; no cleanup is required.',
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (repoArchetype.riskProfile.key !== 'regulated' && !domainKeys.has('regulated-lite') && !domainKeys.has('security-focused')) {
|
|
103
|
+
items.push(makeItem({
|
|
104
|
+
decision: 'ignore',
|
|
105
|
+
kind: 'governance-pack',
|
|
106
|
+
key: 'regulated-lite',
|
|
107
|
+
label: 'Regulated-lite governance overhead',
|
|
108
|
+
why: 'The repo does not show regulated or security-heavy signals strong enough to justify this heavier rollout pack.',
|
|
109
|
+
evidence: [
|
|
110
|
+
`Risk posture: ${repoArchetype.riskProfile.label}`,
|
|
111
|
+
],
|
|
112
|
+
prerequisites: [],
|
|
113
|
+
expectedBenefit: 'Preserves a lighter rollout model and avoids over-governing normal product repos.',
|
|
114
|
+
rollbackSafety: 'This is a no-op skip; the repo can adopt a heavier pack later if evidence changes.',
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (repoArchetype.stackFamily.key !== 'mobile' && !domainKeys.has('mobile')) {
|
|
119
|
+
items.push(makeItem({
|
|
120
|
+
decision: 'ignore',
|
|
121
|
+
kind: 'verification',
|
|
122
|
+
key: 'mobile-release-loop',
|
|
123
|
+
label: 'Mobile release workflow extras',
|
|
124
|
+
why: 'Mobile-only analyze/build workflow overhead should not be forced onto a non-mobile repo.',
|
|
125
|
+
evidence: [
|
|
126
|
+
`Stack family: ${repoArchetype.stackFamily.label}`,
|
|
127
|
+
],
|
|
128
|
+
prerequisites: [],
|
|
129
|
+
expectedBenefit: 'Avoids irrelevant workflow ceremony and keeps verification recommendations credible.',
|
|
130
|
+
rollbackSafety: 'No rollback is needed because the capability is being intentionally skipped.',
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return items.slice(0, 3);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function buildAdoptionAdvisor(options) {
|
|
138
|
+
const {
|
|
139
|
+
platform,
|
|
140
|
+
repoArchetype,
|
|
141
|
+
recommendedOperatingProfile,
|
|
142
|
+
recommendedDomainPacks = [],
|
|
143
|
+
recommendedMcpPacks = [],
|
|
144
|
+
env = {},
|
|
145
|
+
} = options || {};
|
|
146
|
+
|
|
147
|
+
const items = [];
|
|
148
|
+
const mcpPreflightByKey = new Map(
|
|
149
|
+
getMcpPackPreflight((recommendedMcpPacks || []).map((pack) => pack.key), env).map((entry) => [entry.key, entry])
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
items.push(makeItem({
|
|
153
|
+
decision: 'adopt',
|
|
154
|
+
kind: 'platform-strategy',
|
|
155
|
+
key: recommendedOperatingProfile.platformSupport.strategy,
|
|
156
|
+
label: `Platform strategy: ${recommendedOperatingProfile.platformSupport.strategy}`,
|
|
157
|
+
why: recommendedOperatingProfile.platformSupport.why,
|
|
158
|
+
evidence: recommendedOperatingProfile.platformSupport.evidence,
|
|
159
|
+
prerequisites: recommendedOperatingProfile.platformSupport.prerequisites,
|
|
160
|
+
expectedBenefit: recommendedOperatingProfile.platformSupport.expectedBenefit,
|
|
161
|
+
rollbackSafety: recommendedOperatingProfile.platformSupport.rollbackSafety,
|
|
162
|
+
}));
|
|
163
|
+
|
|
164
|
+
if (recommendedOperatingProfile.platformSupport.optionalExpansion) {
|
|
165
|
+
items.push(makeItem({
|
|
166
|
+
decision: 'defer',
|
|
167
|
+
kind: 'platform-expansion',
|
|
168
|
+
key: `secondary-${recommendedOperatingProfile.platformSupport.optionalExpansion}`,
|
|
169
|
+
label: `Add ${recommendedOperatingProfile.platformSupport.optionalExpansion} as a secondary review surface`,
|
|
170
|
+
why: 'A secondary platform could help later, but the repo should stabilize its primary governed posture first.',
|
|
171
|
+
evidence: recommendedOperatingProfile.platformSupport.evidence,
|
|
172
|
+
prerequisites: [
|
|
173
|
+
'Capture tagged baseline and post-fix snapshots first.',
|
|
174
|
+
'Keep Harmony stable across the currently active platform surface.',
|
|
175
|
+
],
|
|
176
|
+
expectedBenefit: 'Adds a complementary advisory surface only after the core posture is already reliable.',
|
|
177
|
+
rollbackSafety: 'Secondary platform expansion is optional and can be removed without changing the app codebase.',
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
items.push(makeItem({
|
|
182
|
+
decision: 'adopt',
|
|
183
|
+
kind: 'permission-profile',
|
|
184
|
+
key: recommendedOperatingProfile.permissionProfile.key,
|
|
185
|
+
label: `Permission profile: ${recommendedOperatingProfile.permissionProfile.label}`,
|
|
186
|
+
why: recommendedOperatingProfile.permissionProfile.why,
|
|
187
|
+
evidence: recommendedOperatingProfile.permissionProfile.evidence,
|
|
188
|
+
prerequisites: recommendedOperatingProfile.permissionProfile.prerequisites,
|
|
189
|
+
expectedBenefit: recommendedOperatingProfile.permissionProfile.expectedBenefit,
|
|
190
|
+
rollbackSafety: recommendedOperatingProfile.permissionProfile.rollbackSafety,
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
items.push(makeItem({
|
|
194
|
+
decision: 'adopt',
|
|
195
|
+
kind: 'governance-pack',
|
|
196
|
+
key: recommendedOperatingProfile.governancePack.key,
|
|
197
|
+
label: `Governance pack: ${recommendedOperatingProfile.governancePack.label}`,
|
|
198
|
+
why: recommendedOperatingProfile.governancePack.why,
|
|
199
|
+
evidence: recommendedOperatingProfile.governancePack.evidence,
|
|
200
|
+
prerequisites: recommendedOperatingProfile.governancePack.prerequisites,
|
|
201
|
+
expectedBenefit: recommendedOperatingProfile.governancePack.expectedBenefit,
|
|
202
|
+
rollbackSafety: recommendedOperatingProfile.governancePack.rollbackSafety,
|
|
203
|
+
}));
|
|
204
|
+
|
|
205
|
+
items.push(makeItem({
|
|
206
|
+
decision: 'adopt',
|
|
207
|
+
kind: 'hook-set',
|
|
208
|
+
key: 'starter-hooks',
|
|
209
|
+
label: `Starter hook set: ${recommendedOperatingProfile.hooks.map((hook) => hook.key).join(', ')}`,
|
|
210
|
+
why: 'These hooks are the lowest-friction set that matches the repo trust boundary, logging needs, and review posture.',
|
|
211
|
+
evidence: unique(recommendedOperatingProfile.hooks.flatMap((hook) => hook.evidence || []).slice(0, 5)),
|
|
212
|
+
prerequisites: unique(recommendedOperatingProfile.hooks.flatMap((hook) => hook.prerequisites || [])),
|
|
213
|
+
expectedBenefit: 'Adds secret protection, trust-boundary checks, and durable change evidence without widening the product surface.',
|
|
214
|
+
rollbackSafety: 'Each hook can be removed independently from repo settings if it proves noisy.',
|
|
215
|
+
}));
|
|
216
|
+
|
|
217
|
+
items.push(makeItem({
|
|
218
|
+
decision: 'adopt',
|
|
219
|
+
kind: 'verification-loop',
|
|
220
|
+
key: recommendedOperatingProfile.verification.key,
|
|
221
|
+
label: `Verification loop: ${recommendedOperatingProfile.verification.label}`,
|
|
222
|
+
why: recommendedOperatingProfile.verification.why,
|
|
223
|
+
evidence: recommendedOperatingProfile.verification.evidence,
|
|
224
|
+
prerequisites: recommendedOperatingProfile.verification.prerequisites,
|
|
225
|
+
expectedBenefit: recommendedOperatingProfile.verification.expectedBenefit,
|
|
226
|
+
rollbackSafety: recommendedOperatingProfile.verification.rollbackSafety,
|
|
227
|
+
}));
|
|
228
|
+
|
|
229
|
+
items.push(makeItem({
|
|
230
|
+
decision: 'adopt',
|
|
231
|
+
kind: 'ci-shape',
|
|
232
|
+
key: recommendedOperatingProfile.ciShape.key,
|
|
233
|
+
label: `CI shape: ${recommendedOperatingProfile.ciShape.label}`,
|
|
234
|
+
why: recommendedOperatingProfile.ciShape.why,
|
|
235
|
+
evidence: recommendedOperatingProfile.ciShape.evidence,
|
|
236
|
+
prerequisites: recommendedOperatingProfile.ciShape.prerequisites,
|
|
237
|
+
expectedBenefit: recommendedOperatingProfile.ciShape.expectedBenefit,
|
|
238
|
+
rollbackSafety: recommendedOperatingProfile.ciShape.rollbackSafety,
|
|
239
|
+
}));
|
|
240
|
+
|
|
241
|
+
for (const pack of recommendedDomainPacks) {
|
|
242
|
+
items.push(makeItem({
|
|
243
|
+
decision: 'adopt',
|
|
244
|
+
kind: 'domain-pack',
|
|
245
|
+
key: pack.key,
|
|
246
|
+
label: `Domain pack: ${pack.label}`,
|
|
247
|
+
why: pack.useWhen,
|
|
248
|
+
evidence: unique([...(pack.matchReasons || []), `Archetype: ${repoArchetype.label}`]).slice(0, 5),
|
|
249
|
+
prerequisites: [
|
|
250
|
+
`Review the pack modules before applying them: ${(pack.recommendedModules || []).slice(0, 4).join(', ') || 'no starter modules listed'}`,
|
|
251
|
+
],
|
|
252
|
+
expectedBenefit: (pack.benchmarkFocus || []).length > 0
|
|
253
|
+
? `Improves Nerviq's relevance around ${pack.benchmarkFocus.slice(0, 3).join(', ')}.`
|
|
254
|
+
: 'Makes Nerviq recommendations more domain-aware for this repo.',
|
|
255
|
+
rollbackSafety: 'Domain packs are additive guidance. You can remove a pack from the recommended stack without rewriting the repo.',
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (platform === 'claude') {
|
|
260
|
+
for (const pack of recommendedMcpPacks) {
|
|
261
|
+
const preflight = mcpPreflightByKey.get(pack.key);
|
|
262
|
+
const prerequisites = inferMcpPackPrerequisites(pack, preflight);
|
|
263
|
+
const decision = prerequisites.length > 0 ? 'defer' : 'adopt';
|
|
264
|
+
items.push(makeItem({
|
|
265
|
+
decision,
|
|
266
|
+
kind: 'mcp-pack',
|
|
267
|
+
key: pack.key,
|
|
268
|
+
label: `MCP pack: ${pack.label}`,
|
|
269
|
+
why: pack.useWhen,
|
|
270
|
+
evidence: unique([pack.adoption, `Repo archetype: ${repoArchetype.label}`]).slice(0, 4),
|
|
271
|
+
prerequisites,
|
|
272
|
+
expectedBenefit: pack.adoption,
|
|
273
|
+
rollbackSafety: 'MCP packs are optional integrations; they can be added or removed from settings without changing application source code.',
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
items.push(...buildIgnoreItems(repoArchetype, recommendedOperatingProfile, recommendedDomainPacks));
|
|
279
|
+
|
|
280
|
+
const sorted = items
|
|
281
|
+
.sort((a, b) => {
|
|
282
|
+
const decisionDiff = (DECISION_ORDER[a.decision] || 99) - (DECISION_ORDER[b.decision] || 99);
|
|
283
|
+
if (decisionDiff !== 0) return decisionDiff;
|
|
284
|
+
return a.label.localeCompare(b.label);
|
|
285
|
+
})
|
|
286
|
+
.map((item, index) => ({
|
|
287
|
+
priority: index + 1,
|
|
288
|
+
...item,
|
|
289
|
+
}));
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
summary: summarize(sorted),
|
|
293
|
+
items: sorted,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
module.exports = {
|
|
298
|
+
buildAdoptionAdvisor,
|
|
299
|
+
};
|