@nerviq/cli 1.17.3 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -23
- package/README.md +4 -4
- package/bin/cli.js +61 -274
- package/package.json +60 -60
- 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 +158 -158
- 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 +16 -16
- 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/context.js +320 -320
- package/src/continuous-ops.js +681 -681
- package/src/copilot/activity.js +309 -309
- package/src/copilot/config-parser.js +280 -226
- package/src/copilot/context.js +218 -197
- 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/copilot/techniques.js +219 -78
- 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 -0
- 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/context.js +221 -221
- 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/gemini/techniques.js +14 -14
- 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/context.js +249 -249
- 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/windsurf/techniques.js +17 -17
- package/src/workspace.js +375 -375
package/LICENSE
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 3, 19 November 2007
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2026 Nerviq (nerviq.net)
|
|
5
|
-
|
|
6
|
-
Everyone is permitted to copy and distribute verbatim copies of this
|
|
7
|
-
license document, but changing it is not allowed.
|
|
8
|
-
|
|
9
|
-
This program is free software: you can redistribute it and/or modify
|
|
10
|
-
it under the terms of the GNU Affero General Public License as
|
|
11
|
-
published by the Free Software Foundation, either version 3 of the
|
|
12
|
-
License, or (at your option) any later version.
|
|
13
|
-
|
|
14
|
-
This program is distributed in the hope that it will be useful,
|
|
15
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
GNU Affero General Public License for more details.
|
|
18
|
-
|
|
19
|
-
You should have received a copy of the GNU Affero General Public License
|
|
20
|
-
along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
|
|
21
|
-
|
|
22
|
-
For the full AGPL-3.0 license text, see:
|
|
23
|
-
https://www.gnu.org/licenses/agpl-3.0.html
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Nerviq (nerviq.net)
|
|
5
|
+
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
|
7
|
+
license document, but changing it is not allowed.
|
|
8
|
+
|
|
9
|
+
This program is free software: you can redistribute it and/or modify
|
|
10
|
+
it under the terms of the GNU Affero General Public License as
|
|
11
|
+
published by the Free Software Foundation, either version 3 of the
|
|
12
|
+
License, or (at your option) any later version.
|
|
13
|
+
|
|
14
|
+
This program is distributed in the hope that it will be useful,
|
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
GNU Affero General Public License for more details.
|
|
18
|
+
|
|
19
|
+
You should have received a copy of the GNU Affero General Public License
|
|
20
|
+
along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
|
|
21
|
+
|
|
22
|
+
For the full AGPL-3.0 license text, see:
|
|
23
|
+
https://www.gnu.org/licenses/agpl-3.0.html
|
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ npx @nerviq/cli --beginner
|
|
|
119
119
|
| Tools & MCP | ~40 | .mcp.json, multi-server, Context7 |
|
|
120
120
|
| Governance & Compliance | ~30 | permission profiles, audit trails |
|
|
121
121
|
| DevOps & Infrastructure | ~30 | Docker, CI, Terraform, monitoring |
|
|
122
|
-
| Cross-Platform Intelligence | ~25 | harmony, synergy, drift detection |
|
|
122
|
+
| Cross-Platform Intelligence | ~25 | harmony (GA), synergy (Experimental), drift detection |
|
|
123
123
|
| Enterprise & Freshness | ~20 | freshness tracking, deprecation, SBOM |
|
|
124
124
|
| Memory & Context | ~15 | context management, compaction, @path |
|
|
125
125
|
| Prompting & Design | ~10 | XML tags, constraints, frontend patterns |
|
|
@@ -223,8 +223,8 @@ All successful operational responses are wrapped in a JSON envelope:
|
|
|
223
223
|
{
|
|
224
224
|
"data": {},
|
|
225
225
|
"meta": {
|
|
226
|
-
"version": "1.
|
|
227
|
-
"timestamp": "2026-04-
|
|
226
|
+
"version": "1.19.0",
|
|
227
|
+
"timestamp": "2026-04-13T12:00:00.000Z"
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
```
|
|
@@ -353,7 +353,7 @@ Levels:
|
|
|
353
353
|
| `nerviq harmony-watch` | Live drift monitoring |
|
|
354
354
|
| `nerviq harmony-governance` | Unified platform governance |
|
|
355
355
|
| `nerviq harmony-add <platform>` | Add a new platform to your project |
|
|
356
|
-
| `nerviq synergy-report` | Multi-agent synergy analysis |
|
|
356
|
+
| `nerviq synergy-report` | Multi-agent synergy analysis (Experimental) |
|
|
357
357
|
| `nerviq catalog` | Show check catalog for all 8 platforms |
|
|
358
358
|
| `nerviq doctor` | Self-diagnostics for install health, freshness, platform detection, declared MCP servers, and hook runtime |
|
|
359
359
|
| `nerviq convert` | Convert config between platforms |
|
package/bin/cli.js
CHANGED
|
@@ -578,6 +578,8 @@ const HELP = `
|
|
|
578
578
|
|
|
579
579
|
DISCOVER
|
|
580
580
|
nerviq audit Quick scan: score + top 3 gaps (Harmony-first when 2+ platforms detected)
|
|
581
|
+
nerviq audit --fix Audit, apply fixable critical fixes, then re-audit
|
|
582
|
+
nerviq audit --fix --dry-run Show proposed autofix diff without writing
|
|
581
583
|
nerviq audit --no-harmony-first Skip the cross-platform Harmony header
|
|
582
584
|
nerviq audit --full Full audit with all checks, weakest areas, badge
|
|
583
585
|
nerviq audit --platform X Audit specific platform (claude|codex|cursor|copilot|gemini|windsurf|aider|opencode)
|
|
@@ -776,7 +778,7 @@ const BEGINNER_HELP = `
|
|
|
776
778
|
SIMPLE PATH
|
|
777
779
|
1. nerviq audit
|
|
778
780
|
2. nerviq setup --auto
|
|
779
|
-
3. nerviq
|
|
781
|
+
3. nerviq audit --fix --auto
|
|
780
782
|
4. nerviq augment
|
|
781
783
|
5. nerviq doctor
|
|
782
784
|
|
|
@@ -2100,6 +2102,7 @@ async function main() {
|
|
|
2100
2102
|
const promptOnly = flags.includes('--prompt');
|
|
2101
2103
|
const autoApply = options.auto;
|
|
2102
2104
|
const isDryRun = options.dryRun;
|
|
2105
|
+
const { getFixableFailedResults, isFixableKey, applyFixes } = require('../src/fix-engine');
|
|
2103
2106
|
|
|
2104
2107
|
// Step 1: Run silent audit to find failed checks (only actual failures, not skipped/null)
|
|
2105
2108
|
const auditResult = await audit({ dir: options.dir, silent: true, platform: options.platform });
|
|
@@ -2111,50 +2114,10 @@ async function main() {
|
|
|
2111
2114
|
}
|
|
2112
2115
|
|
|
2113
2116
|
// Step 2: Determine which checks to fix
|
|
2114
|
-
const { TECHNIQUES } = require('../src/techniques');
|
|
2115
2117
|
const { FIX_PROMPTS, formatFixPrompt } = require('../src/fix-prompts');
|
|
2116
|
-
const fs = require('fs');
|
|
2117
|
-
const pathMod = require('path');
|
|
2118
|
-
|
|
2119
|
-
// Inline fixers for checks without templates but with trivial auto-fixes
|
|
2120
|
-
const INLINE_FIXERS = {
|
|
2121
|
-
gitIgnoreEnv: (dir) => {
|
|
2122
|
-
const gitignorePath = pathMod.join(dir, '.gitignore');
|
|
2123
|
-
const existing = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf8') : '';
|
|
2124
|
-
if (!existing.includes('.env')) {
|
|
2125
|
-
const lines = existing.endsWith('\n') || existing === '' ? '' : '\n';
|
|
2126
|
-
fs.appendFileSync(gitignorePath, `${lines}.env\n.env.*\n`, 'utf8');
|
|
2127
|
-
return true;
|
|
2128
|
-
}
|
|
2129
|
-
return false;
|
|
2130
|
-
},
|
|
2131
|
-
secretsProtection: (dir) => {
|
|
2132
|
-
const settingsPath = pathMod.join(dir, '.claude', 'settings.json');
|
|
2133
|
-
const settingsDir = pathMod.join(dir, '.claude');
|
|
2134
|
-
if (!fs.existsSync(settingsDir)) fs.mkdirSync(settingsDir, { recursive: true });
|
|
2135
|
-
let settings = {};
|
|
2136
|
-
if (fs.existsSync(settingsPath)) {
|
|
2137
|
-
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch { settings = {}; }
|
|
2138
|
-
}
|
|
2139
|
-
if (!settings.permissions) settings.permissions = {};
|
|
2140
|
-
if (!settings.permissions.deny) settings.permissions.deny = [];
|
|
2141
|
-
const denyEntries = ['.env', '.env.*', '**/.env', '**/*.pem', '**/secrets/**'];
|
|
2142
|
-
for (const entry of denyEntries) {
|
|
2143
|
-
if (!settings.permissions.deny.includes(entry)) settings.permissions.deny.push(entry);
|
|
2144
|
-
}
|
|
2145
|
-
// Remove overly broad allow:["*"] if present
|
|
2146
|
-
if (Array.isArray(settings.permissions.allow) && settings.permissions.allow.includes('*')) {
|
|
2147
|
-
settings.permissions.allow = settings.permissions.allow.filter(a => a !== '*');
|
|
2148
|
-
if (settings.permissions.allow.length === 0) {
|
|
2149
|
-
delete settings.permissions.allow;
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
2153
|
-
return true;
|
|
2154
|
-
},
|
|
2155
|
-
};
|
|
2156
2118
|
|
|
2157
2119
|
let targetKeys = [];
|
|
2120
|
+
const fixableFailedResults = getFixableFailedResults(failedResults, { mode: 'fix' });
|
|
2158
2121
|
|
|
2159
2122
|
if (fixKey) {
|
|
2160
2123
|
// Fix a specific check
|
|
@@ -2180,18 +2143,29 @@ async function main() {
|
|
|
2180
2143
|
}
|
|
2181
2144
|
process.exit(0);
|
|
2182
2145
|
}
|
|
2146
|
+
if (!isFixableKey(fixKey, { mode: 'fix' })) {
|
|
2147
|
+
const aiPrompt = FIX_PROMPTS[fixKey];
|
|
2148
|
+
const failedCheck = failedResults.find(r => r.key === fixKey);
|
|
2149
|
+
if (aiPrompt) {
|
|
2150
|
+
console.log(formatFixPrompt(fixKey, aiPrompt));
|
|
2151
|
+
} else {
|
|
2152
|
+
console.log(`\n 📋 ${failedCheck.name} (manual fix needed)`);
|
|
2153
|
+
console.log(` ${failedCheck.fix}\n`);
|
|
2154
|
+
}
|
|
2155
|
+
process.exit(0);
|
|
2156
|
+
}
|
|
2183
2157
|
targetKeys = [fixKey];
|
|
2184
2158
|
} else if (allCritical) {
|
|
2185
|
-
targetKeys = failedResults
|
|
2159
|
+
targetKeys = getFixableFailedResults(failedResults, { mode: 'fix', criticalOnly: true }).map(r => r.key);
|
|
2186
2160
|
if (targetKeys.length === 0) {
|
|
2187
2161
|
console.log('\n ✅ No critical issues found.\n');
|
|
2188
2162
|
process.exit(0);
|
|
2189
2163
|
}
|
|
2190
2164
|
} else {
|
|
2191
2165
|
// No key specified — show fixable checks and exit
|
|
2192
|
-
const
|
|
2193
|
-
const
|
|
2194
|
-
const nonFixable = failedResults.filter(r => !
|
|
2166
|
+
const fixable = fixableFailedResults;
|
|
2167
|
+
const fixableKeySet = new Set(fixable.map(r => r.key));
|
|
2168
|
+
const nonFixable = failedResults.filter(r => !fixableKeySet.has(r.key));
|
|
2195
2169
|
console.log('');
|
|
2196
2170
|
console.log(` nerviq fix — ${failedResults.length} failed checks\n`);
|
|
2197
2171
|
if (fixable.length > 0) {
|
|
@@ -2237,235 +2211,17 @@ async function main() {
|
|
|
2237
2211
|
process.exit(0);
|
|
2238
2212
|
}
|
|
2239
2213
|
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
const fixableTargets = targetKeys.filter(k => {
|
|
2250
|
-
const tech = TECHNIQUES[k];
|
|
2251
|
-
return (tech && tech.template) || INLINE_FIX_KEYS.has(k);
|
|
2214
|
+
const outcome = await applyFixes({
|
|
2215
|
+
dir: options.dir,
|
|
2216
|
+
platform: options.platform,
|
|
2217
|
+
auditResult,
|
|
2218
|
+
targetKeys,
|
|
2219
|
+
auto: autoApply,
|
|
2220
|
+
dryRun: isDryRun,
|
|
2221
|
+
mode: 'fix',
|
|
2222
|
+
recordOutcomes: true,
|
|
2252
2223
|
});
|
|
2253
|
-
|
|
2254
|
-
const simulatedEarned = applicableResults.reduce((sum, r) => {
|
|
2255
|
-
const w = IMPACT_WEIGHTS[r.impact] || 5;
|
|
2256
|
-
if (r.passed) return sum + w;
|
|
2257
|
-
if (fixableTargetSet.has(r.key)) return sum + w;
|
|
2258
|
-
return sum;
|
|
2259
|
-
}, 0);
|
|
2260
|
-
const predictedScore = maxScore > 0 ? Math.round((simulatedEarned / maxScore) * 100) : 0;
|
|
2261
|
-
const predictedDelta = predictedScore - preScore;
|
|
2262
|
-
|
|
2263
|
-
if (!autoApply && !isDryRun) {
|
|
2264
|
-
console.log('');
|
|
2265
|
-
if (allCritical && fixableTargets.length > 1) {
|
|
2266
|
-
// Multi-fix summary
|
|
2267
|
-
console.log(` ${fixableTargets.length} critical fixes available:`);
|
|
2268
|
-
let runningEarned = applicableResults.reduce((s, r) => s + (r.passed ? (IMPACT_WEIGHTS[r.impact] || 5) : 0), 0);
|
|
2269
|
-
let runningScore = maxScore > 0 ? Math.round((runningEarned / maxScore) * 100) : 0;
|
|
2270
|
-
fixableTargets.forEach((k, idx) => {
|
|
2271
|
-
const r = failedResults.find(fr => fr.key === k);
|
|
2272
|
-
const w = IMPACT_WEIGHTS[r.impact] || 5;
|
|
2273
|
-
const nextEarned = runningEarned + w;
|
|
2274
|
-
const nextScore = maxScore > 0 ? Math.round((nextEarned / maxScore) * 100) : 0;
|
|
2275
|
-
const d = nextScore - runningScore;
|
|
2276
|
-
console.log(` ${idx + 1}. ${(r.key).padEnd(18)} ${runningScore} → ${nextScore} (+${d})`);
|
|
2277
|
-
runningEarned = nextEarned;
|
|
2278
|
-
runningScore = nextScore;
|
|
2279
|
-
});
|
|
2280
|
-
console.log('');
|
|
2281
|
-
console.log(` Total: ${preScore} → ${predictedScore} (+${predictedDelta})`);
|
|
2282
|
-
} else {
|
|
2283
|
-
// Single fix preview
|
|
2284
|
-
const targetCheck = failedResults.find(r => r.key === fixableTargets[0]) || failedResults.find(r => r.key === targetKeys[0]);
|
|
2285
|
-
if (targetCheck) {
|
|
2286
|
-
console.log(` Predicted impact: ${preScore} → ${predictedScore} (+${predictedDelta})`);
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
// Prompt for confirmation
|
|
2291
|
-
const readline = require('readline');
|
|
2292
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
2293
|
-
const answer = await new Promise(resolve => {
|
|
2294
|
-
rl.question(' Apply? (Y/n) ', resolve);
|
|
2295
|
-
});
|
|
2296
|
-
rl.close();
|
|
2297
|
-
if (answer && answer.trim().toLowerCase() === 'n') {
|
|
2298
|
-
for (const key of targetKeys) {
|
|
2299
|
-
recordPattern(options.dir, key, 'rejected');
|
|
2300
|
-
}
|
|
2301
|
-
console.log('\n Aborted.\n');
|
|
2302
|
-
process.exit(0);
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
// Step 3: Create rollback snapshot before applying fixes
|
|
2307
|
-
const isBatch = allCritical && targetKeys.length > 1;
|
|
2308
|
-
let rollbackId = null;
|
|
2309
|
-
const allCreatedFiles = [];
|
|
2310
|
-
const fixResults = []; // { key, name, status, delta }
|
|
2311
|
-
|
|
2312
|
-
const snapshotFiles = {};
|
|
2313
|
-
if (!isDryRun && targetKeys.length > 0) {
|
|
2314
|
-
// Snapshot existing files for rollback (before applying fixes)
|
|
2315
|
-
for (const key of targetKeys) {
|
|
2316
|
-
const technique = TECHNIQUES[key];
|
|
2317
|
-
if (technique && technique.template && technique.template.path) {
|
|
2318
|
-
const tplPath = pathMod.join(options.dir, technique.template.path);
|
|
2319
|
-
if (fs.existsSync(tplPath)) {
|
|
2320
|
-
snapshotFiles[technique.template.path] = fs.readFileSync(tplPath, 'utf8');
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
// Step 3b: Apply fixes sequentially with progress
|
|
2327
|
-
let fixed = 0;
|
|
2328
|
-
let manual = 0;
|
|
2329
|
-
let runningScore = preScore;
|
|
2330
|
-
|
|
2331
|
-
for (let i = 0; i < targetKeys.length; i++) {
|
|
2332
|
-
const key = targetKeys[i];
|
|
2333
|
-
const technique = TECHNIQUES[key];
|
|
2334
|
-
const failedCheck = failedResults.find(r => r.key === key);
|
|
2335
|
-
const progress = isBatch ? `${i + 1}/${targetKeys.length}: ` : '';
|
|
2336
|
-
|
|
2337
|
-
if (technique && technique.template) {
|
|
2338
|
-
if (isDryRun) {
|
|
2339
|
-
console.log(` [dry-run] Would fix: ${progress}${failedCheck.name} (${key})`);
|
|
2340
|
-
fixResults.push({ key, name: failedCheck.name, status: 'dry-run', delta: 0 });
|
|
2341
|
-
fixed++;
|
|
2342
|
-
} else {
|
|
2343
|
-
try {
|
|
2344
|
-
if (isBatch) console.log(` Fixing ${progress}${key}...`);
|
|
2345
|
-
const setupResult = await setup({ ...options, only: [key], silent: true });
|
|
2346
|
-
if (setupResult && setupResult.writtenFiles) {
|
|
2347
|
-
allCreatedFiles.push(...setupResult.writtenFiles);
|
|
2348
|
-
}
|
|
2349
|
-
const midResult = await audit({ dir: options.dir, silent: true, platform: options.platform });
|
|
2350
|
-
const delta = midResult.score - runningScore;
|
|
2351
|
-
fixResults.push({ key, name: failedCheck.name, status: 'fixed', delta });
|
|
2352
|
-
runningScore = midResult.score;
|
|
2353
|
-
if (!isBatch) console.log(` ✅ Fixed: ${failedCheck.name}`);
|
|
2354
|
-
fixed++;
|
|
2355
|
-
} catch (err) {
|
|
2356
|
-
fixResults.push({ key, name: failedCheck.name, status: 'failed', delta: 0 });
|
|
2357
|
-
if (isBatch) {
|
|
2358
|
-
console.log(` ❌ Failed: ${key} — ${err.message}`);
|
|
2359
|
-
console.log(` Stopping batch. ${fixed} fixes applied so far.`);
|
|
2360
|
-
console.log(` Rollback: nerviq rollback --id ${rollbackId}`);
|
|
2361
|
-
break;
|
|
2362
|
-
} else {
|
|
2363
|
-
console.log(` ❌ Failed: ${failedCheck.name} — ${err.message}`);
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
} else if (INLINE_FIXERS[key]) {
|
|
2368
|
-
if (isDryRun) {
|
|
2369
|
-
console.log(` [dry-run] Would fix: ${progress}${failedCheck.name} (${key})`);
|
|
2370
|
-
fixResults.push({ key, name: failedCheck.name, status: 'dry-run', delta: 0 });
|
|
2371
|
-
fixed++;
|
|
2372
|
-
} else {
|
|
2373
|
-
try {
|
|
2374
|
-
if (isBatch) console.log(` Fixing ${progress}${key}...`);
|
|
2375
|
-
const didFix = INLINE_FIXERS[key](options.dir);
|
|
2376
|
-
if (didFix) {
|
|
2377
|
-
const midResult = await audit({ dir: options.dir, silent: true, platform: options.platform });
|
|
2378
|
-
const delta = midResult.score - runningScore;
|
|
2379
|
-
fixResults.push({ key, name: failedCheck.name, status: 'fixed', delta });
|
|
2380
|
-
runningScore = midResult.score;
|
|
2381
|
-
if (!isBatch) console.log(` ✅ Fixed: ${failedCheck.name}`);
|
|
2382
|
-
fixed++;
|
|
2383
|
-
} else {
|
|
2384
|
-
fixResults.push({ key, name: failedCheck.name, status: 'skipped', delta: 0 });
|
|
2385
|
-
if (!isBatch) console.log(` ⏭️ Already fixed: ${failedCheck.name}`);
|
|
2386
|
-
}
|
|
2387
|
-
} catch (err) {
|
|
2388
|
-
fixResults.push({ key, name: failedCheck.name, status: 'failed', delta: 0 });
|
|
2389
|
-
if (isBatch) {
|
|
2390
|
-
console.log(` ❌ Failed: ${key} — ${err.message}`);
|
|
2391
|
-
console.log(` Stopping batch. ${fixed} fixes applied so far.`);
|
|
2392
|
-
console.log(` Rollback: nerviq rollback --id ${rollbackId}`);
|
|
2393
|
-
break;
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
} else {
|
|
2398
|
-
if (!isBatch) {
|
|
2399
|
-
const aiPrompt = FIX_PROMPTS[key];
|
|
2400
|
-
if (aiPrompt) {
|
|
2401
|
-
console.log(formatFixPrompt(key, aiPrompt));
|
|
2402
|
-
} else {
|
|
2403
|
-
console.log(` 📋 ${failedCheck.name} (manual fix needed)`);
|
|
2404
|
-
console.log(` ${failedCheck.fix}`);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
fixResults.push({ key, name: failedCheck.name, status: 'skipped', delta: 0 });
|
|
2408
|
-
manual++;
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
// Record accepted patterns for successfully fixed checks
|
|
2413
|
-
if (!isDryRun) {
|
|
2414
|
-
for (const key of targetKeys) {
|
|
2415
|
-
const fr = fixResults.find(r => r.key === key);
|
|
2416
|
-
recordPattern(options.dir, key, fr && fr.status === 'fixed' ? 'accepted' : 'rejected');
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
// Write rollback artifact AFTER fixes are applied (with actual file lists)
|
|
2421
|
-
if (!isDryRun && targetKeys.length > 0 && fixed > 0) {
|
|
2422
|
-
const allPatchedFiles = Object.keys(snapshotFiles);
|
|
2423
|
-
// Also track inline-fixer patched files
|
|
2424
|
-
for (const fr of fixResults) {
|
|
2425
|
-
if (fr.status === 'fixed' && INLINE_FIXERS[fr.key]) {
|
|
2426
|
-
const inlinePath = fr.key === 'gitIgnoreEnv' ? '.gitignore' : fr.key === 'secretsProtection' ? '.claude/settings.json' : null;
|
|
2427
|
-
if (inlinePath && !allPatchedFiles.includes(inlinePath)) {
|
|
2428
|
-
allPatchedFiles.push(inlinePath);
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
const rollbackArtifact = writeRollbackArtifact(options.dir, {
|
|
2433
|
-
sourcePlan: 'fix-batch',
|
|
2434
|
-
preSnapshot: snapshotFiles,
|
|
2435
|
-
createdFiles: allCreatedFiles,
|
|
2436
|
-
patchedFiles: allPatchedFiles,
|
|
2437
|
-
rollbackInstructions: ['Use nerviq rollback to undo these fixes'],
|
|
2438
|
-
});
|
|
2439
|
-
rollbackId = rollbackArtifact.id;
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
// Step 4: Show batch summary or simple score impact
|
|
2443
|
-
if (isBatch && fixResults.length > 0) {
|
|
2444
|
-
console.log('');
|
|
2445
|
-
console.log(' Batch fix complete:');
|
|
2446
|
-
for (let i = 0; i < fixResults.length; i++) {
|
|
2447
|
-
const r = fixResults[i];
|
|
2448
|
-
const icon = r.status === 'fixed' ? '✅' : r.status === 'failed' ? '❌' : '⚠ ';
|
|
2449
|
-
const deltaStr = r.status === 'fixed' ? ` (+${r.delta})` : r.status === 'skipped' ? ' (skipped — no auto-fix)' : r.status === 'failed' ? ' (failed)' : ' (dry-run)';
|
|
2450
|
-
console.log(` ${icon} ${i + 1}. ${r.key.padEnd(20)}${deltaStr}`);
|
|
2451
|
-
}
|
|
2452
|
-
const totalDelta = runningScore - preScore;
|
|
2453
|
-
console.log('');
|
|
2454
|
-
console.log(` Score: ${preScore} → ${runningScore} (${totalDelta >= 0 ? '+' : ''}${totalDelta})`);
|
|
2455
|
-
if (rollbackId && !isDryRun) {
|
|
2456
|
-
console.log(` Rollback available: nerviq rollback --id ${rollbackId}`);
|
|
2457
|
-
}
|
|
2458
|
-
} else if (fixed > 0 && !isDryRun) {
|
|
2459
|
-
const postResult = await audit({ dir: options.dir, silent: true, platform: options.platform });
|
|
2460
|
-
const delta = postResult.score - preScore;
|
|
2461
|
-
console.log('');
|
|
2462
|
-
console.log(` Score: ${preScore} → ${postResult.score} (${delta >= 0 ? '+' : ''}${delta})`);
|
|
2463
|
-
if (rollbackId) {
|
|
2464
|
-
console.log(` Rollback available: nerviq rollback --id ${rollbackId}`);
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
console.log(`\n ${fixed} fixed, ${manual} need manual action.\n`);
|
|
2224
|
+
process.exit(outcome.exitCode);
|
|
2469
2225
|
|
|
2470
2226
|
} else if (normalizedCommand === 'init') {
|
|
2471
2227
|
const { runInit } = require('../src/init');
|
|
@@ -2539,6 +2295,37 @@ async function main() {
|
|
|
2539
2295
|
}
|
|
2540
2296
|
}
|
|
2541
2297
|
|
|
2298
|
+
if (options.fix) {
|
|
2299
|
+
if (options.diffOnly) {
|
|
2300
|
+
console.error('\n Error: --diff-only cannot be combined with --fix.\n');
|
|
2301
|
+
process.exit(2);
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
const { getFixableFailedResults, applyFixes } = require('../src/fix-engine');
|
|
2305
|
+
const auditResult = await audit({ ...options, silent: true });
|
|
2306
|
+
const failedResults = (auditResult.results || []).filter((item) => item.passed === false);
|
|
2307
|
+
const targetKeys = getFixableFailedResults(failedResults, { mode: 'audit', criticalOnly: true }).map((item) => item.key);
|
|
2308
|
+
|
|
2309
|
+
if (targetKeys.length === 0) {
|
|
2310
|
+
console.log('');
|
|
2311
|
+
console.log(' אין תיקוני critical אוטומטיים זמינים למסלול audit --fix.');
|
|
2312
|
+
console.log(' נסו `nerviq fix <key> --prompt` עבור תיקון ידני, או הריצו audit מלא כדי לראות את כל הפערים.');
|
|
2313
|
+
console.log('');
|
|
2314
|
+
process.exit(2);
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
const outcome = await applyFixes({
|
|
2318
|
+
dir: options.dir,
|
|
2319
|
+
platform: options.platform,
|
|
2320
|
+
auditResult,
|
|
2321
|
+
targetKeys,
|
|
2322
|
+
auto: options.auto,
|
|
2323
|
+
dryRun: options.dryRun,
|
|
2324
|
+
mode: 'audit',
|
|
2325
|
+
});
|
|
2326
|
+
process.exit(outcome.exitCode);
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2542
2329
|
let result;
|
|
2543
2330
|
const renderAuditJsonLocally = options.json && (Boolean(options.driftMode) || Boolean(harmonyFirstResult));
|
|
2544
2331
|
if (options.diffOnly) {
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nerviq/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "The intelligent nervous system for AI coding agents — 2,441 checks (8 platforms × ~300 governance rules), 10 languages, 62 domain packs. Audit, align, and amplify.",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"nerviq": "bin/cli.js",
|
|
8
|
-
"@nerviq/cli": "bin/cli.js",
|
|
9
|
-
"nerviq-mcp": "src/mcp-server.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"bin",
|
|
13
|
-
"src",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"start": "node bin/cli.js",
|
|
18
|
-
"build": "npm pack --dry-run",
|
|
19
|
-
"test": "node test/run.js",
|
|
20
|
-
"verify:release-metadata": "node tools/validate-release-metadata.js",
|
|
21
|
-
"test:jest": "jest",
|
|
22
|
-
"test:coverage": "jest --coverage",
|
|
23
|
-
"test:all": "npm test && npx jest && node test/check-matrix.js && node test/codex-check-matrix.js && node test/gemini-check-matrix.js && node test/copilot-check-matrix.js && node test/cursor-check-matrix.js && node test/windsurf-check-matrix.js && node test/aider-check-matrix.js && node test/opencode-check-matrix.js && node test/golden-matrix.js && node test/codex-golden-matrix.js && node test/gemini-golden-matrix.js && node test/copilot-golden-matrix.js && node test/cursor-golden-matrix.js && node test/windsurf-golden-matrix.js && node test/aider-golden-matrix.js && node test/opencode-golden-matrix.js",
|
|
24
|
-
"benchmark:perf": "node tools/benchmark.js",
|
|
25
|
-
"catalog": "node -e \"const {generateCatalog}=require('./src/catalog');console.log(JSON.stringify(generateCatalog(),null,2))\""
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"nerviq",
|
|
29
|
-
"ai-agents",
|
|
30
|
-
"agent-governance",
|
|
31
|
-
"agent-config",
|
|
32
|
-
"harmony",
|
|
33
|
-
"synergy",
|
|
34
|
-
"audit",
|
|
35
|
-
"claude",
|
|
36
|
-
"codex",
|
|
37
|
-
"gemini",
|
|
38
|
-
"copilot",
|
|
39
|
-
"cursor",
|
|
40
|
-
"windsurf",
|
|
41
|
-
"aider",
|
|
42
|
-
"developer-tools",
|
|
43
|
-
"cli",
|
|
44
|
-
"mcp",
|
|
45
|
-
"multi-agent"
|
|
46
|
-
],
|
|
47
|
-
"author": "Nerviq <hello@nerviq.net>",
|
|
48
|
-
"license": "AGPL-3.0",
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/nerviq/nerviq.git"
|
|
52
|
-
},
|
|
53
|
-
"homepage": "https://nerviq.net",
|
|
54
|
-
"engines": {
|
|
55
|
-
"node": ">=18.0.0"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"jest": "^30.3.0"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nerviq/cli",
|
|
3
|
+
"version": "1.19.0",
|
|
4
|
+
"description": "The intelligent nervous system for AI coding agents — 2,441 checks (8 platforms × ~300 governance rules), 10 languages, 62 domain packs. Audit, align, and amplify.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nerviq": "bin/cli.js",
|
|
8
|
+
"@nerviq/cli": "bin/cli.js",
|
|
9
|
+
"nerviq-mcp": "src/mcp-server.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"src",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "node bin/cli.js",
|
|
18
|
+
"build": "npm pack --dry-run",
|
|
19
|
+
"test": "node test/run.js",
|
|
20
|
+
"verify:release-metadata": "node tools/validate-release-metadata.js",
|
|
21
|
+
"test:jest": "jest",
|
|
22
|
+
"test:coverage": "jest --coverage",
|
|
23
|
+
"test:all": "npm test && npx jest && node test/check-matrix.js && node test/codex-check-matrix.js && node test/gemini-check-matrix.js && node test/copilot-check-matrix.js && node test/cursor-check-matrix.js && node test/windsurf-check-matrix.js && node test/aider-check-matrix.js && node test/opencode-check-matrix.js && node test/golden-matrix.js && node test/codex-golden-matrix.js && node test/gemini-golden-matrix.js && node test/copilot-golden-matrix.js && node test/cursor-golden-matrix.js && node test/windsurf-golden-matrix.js && node test/aider-golden-matrix.js && node test/opencode-golden-matrix.js",
|
|
24
|
+
"benchmark:perf": "node tools/benchmark.js",
|
|
25
|
+
"catalog": "node -e \"const {generateCatalog}=require('./src/catalog');console.log(JSON.stringify(generateCatalog(),null,2))\""
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"nerviq",
|
|
29
|
+
"ai-agents",
|
|
30
|
+
"agent-governance",
|
|
31
|
+
"agent-config",
|
|
32
|
+
"harmony",
|
|
33
|
+
"synergy",
|
|
34
|
+
"audit",
|
|
35
|
+
"claude",
|
|
36
|
+
"codex",
|
|
37
|
+
"gemini",
|
|
38
|
+
"copilot",
|
|
39
|
+
"cursor",
|
|
40
|
+
"windsurf",
|
|
41
|
+
"aider",
|
|
42
|
+
"developer-tools",
|
|
43
|
+
"cli",
|
|
44
|
+
"mcp",
|
|
45
|
+
"multi-agent"
|
|
46
|
+
],
|
|
47
|
+
"author": "Nerviq <hello@nerviq.net>",
|
|
48
|
+
"license": "AGPL-3.0",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/nerviq/nerviq.git"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://nerviq.net",
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"jest": "^30.3.0"
|
|
59
|
+
}
|
|
60
|
+
}
|