@nerviq/cli 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +97 -19
  2. package/bin/cli.js +618 -182
  3. package/package.json +2 -2
  4. package/src/activity.js +49 -9
  5. package/src/adoption-advisor.js +299 -0
  6. package/src/aider/techniques.js +16 -11
  7. package/src/analyze.js +128 -0
  8. package/src/anti-patterns.js +13 -0
  9. package/src/audit.js +97 -22
  10. package/src/behavioral-drift.js +801 -0
  11. package/src/continuous-ops.js +681 -0
  12. package/src/cost-tracking.js +61 -0
  13. package/src/cursor/techniques.js +17 -12
  14. package/src/deep-review.js +83 -0
  15. package/src/diff-only.js +280 -0
  16. package/src/doctor.js +118 -55
  17. package/src/governance.js +59 -43
  18. package/src/hook-validation.js +342 -0
  19. package/src/index.js +5 -0
  20. package/src/integrations.js +42 -5
  21. package/src/mcp-validation.js +337 -0
  22. package/src/opencode/techniques.js +12 -7
  23. package/src/operating-profile.js +574 -0
  24. package/src/org.js +97 -13
  25. package/src/plans.js +192 -8
  26. package/src/platform-change-manifest.js +86 -0
  27. package/src/policy-layers.js +210 -0
  28. package/src/profiles.js +4 -1
  29. package/src/prompt-injection.js +74 -0
  30. package/src/repo-archetype.js +386 -0
  31. package/src/setup.js +34 -0
  32. package/src/source-urls.js +132 -132
  33. package/src/supplemental-checks.js +13 -12
  34. package/src/techniques/api.js +407 -0
  35. package/src/techniques/automation.js +316 -0
  36. package/src/techniques/compliance.js +257 -0
  37. package/src/techniques/hygiene.js +294 -0
  38. package/src/techniques/instructions.js +243 -0
  39. package/src/techniques/observability.js +226 -0
  40. package/src/techniques/optimization.js +142 -0
  41. package/src/techniques/quality.js +317 -0
  42. package/src/techniques/security.js +237 -0
  43. package/src/techniques/shared.js +443 -0
  44. package/src/techniques/stacks.js +2294 -0
  45. package/src/techniques/tools.js +106 -0
  46. package/src/techniques/workflow.js +413 -0
  47. package/src/techniques.js +78 -5607
  48. package/src/watch.js +18 -0
  49. package/src/windsurf/techniques.js +17 -12
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@nerviq/cli)](https://www.npmjs.com/package/@nerviq/cli)
6
6
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](LICENSE)
7
- [![Checks: 2438](https://img.shields.io/badge/checks-2438-brightgreen)](https://github.com/nerviq/nerviq)
7
+ [![Checks: 2441](https://img.shields.io/badge/checks-2441-brightgreen)](https://github.com/nerviq/nerviq)
8
8
 
9
9
  ---
10
10
 
@@ -71,6 +71,7 @@ npx @nerviq/cli --beginner # Show only the 5 starter commands
71
71
  npx @nerviq/cli audit # Quick scan: score + top 3 actions
72
72
  npx @nerviq/cli audit --full # Full audit with all checks + badge
73
73
  npx @nerviq/cli audit --snapshot --tag "pre-refactor" # Save a named snapshot for history/compare/trend
74
+ npx @nerviq/cli audit --diff-only # PR/working-tree audit: changed files + linked governance/config surfaces only
74
75
  npx @nerviq/cli compare # Detailed per-check diff between latest 2 audit snapshots
75
76
  npx @nerviq/cli audit --webhook https://hooks.slack.com/services/... # Push audit results to Slack/Discord/generic HTTP
76
77
  npx @nerviq/cli audit --workspace packages/* # Monorepo: root governance + stack-specific workspace profiles
@@ -98,7 +99,7 @@ npx @nerviq/cli --beginner
98
99
  | **Team lead / DevEx** | `nerviq governance` → `nerviq audit --json` | CI threshold + `nerviq watch` |
99
100
  | **Enterprise / Platform** | `nerviq harmony-audit` → `nerviq harmony-drift` | Policy packs + `nerviq certify` |
100
101
 
101
- ## 2,438 Checks Across 96 Categories (8 Platforms × ~300 Governance Rules)
102
+ ## 2,441 Checks Across 96 Categories (8 Platforms × ~300 Governance Rules)
102
103
 
103
104
  | Category Group | Checks | Examples |
104
105
  |----------------|--------|---------|
@@ -171,6 +172,28 @@ Stable SDK surfaces: `audit`, `harmonyAudit`, `detectPlatforms`, `getCatalog`
171
172
  Experimental SDK surfaces: `synergyReport`, `routeTask`
172
173
 
173
174
  See [sdk/README.md](sdk/README.md) for full JavaScript examples, error handling guidance, and TypeScript usage.
175
+
176
+ ## Integration Contract Pack
177
+
178
+ Nerviq publishes a compact integration pack so external systems do not need to scrape CLI text:
179
+
180
+ - OpenAPI 3.1 contract from `nerviq serve` via `GET /api/openapi.json`
181
+ - Generic audit webhook schema at [`contracts/audit-webhook-event.schema.json`](contracts/audit-webhook-event.schema.json)
182
+ - CI reference patterns in [`docs/ci-integration.md`](docs/ci-integration.md)
183
+ - SDK usage guide in [`sdk/README.md`](sdk/README.md)
184
+ - First-tier release gate in [`docs/first-tier-integration-gate.md`](docs/first-tier-integration-gate.md)
185
+
186
+ See [`docs/integration-contracts.md`](docs/integration-contracts.md) for the full pack.
187
+
188
+ ## Category Definition Kit
189
+
190
+ Nerviq is positioned as the control plane for AI-enabled development:
191
+
192
+ - a repo-native governance layer for AI coding agents
193
+ - a cross-platform drift detector and operating model
194
+ - not a full SAST scanner, prompt library, or single-vendor IDE plugin
195
+
196
+ See [`docs/category-definition-kit.md`](docs/category-definition-kit.md) for the category language, comparison matrix, operating model, and adoption playbook.
174
197
 
175
198
  ## MCP Server — `nerviq serve`
176
199
 
@@ -193,7 +216,7 @@ All successful operational responses are wrapped in a JSON envelope:
193
216
  {
194
217
  "data": {},
195
218
  "meta": {
196
- "version": "1.11.0",
219
+ "version": "1.12.0",
197
220
  "timestamp": "2026-04-09T12:00:00.000Z"
198
221
  }
199
222
  }
@@ -270,21 +293,23 @@ Levels:
270
293
 
271
294
  | Command | What it does |
272
295
  |---------|-------------|
273
- | `nerviq audit` | Score 0-100 — quick scan with top 3 actions (default) |
274
- | `nerviq audit --full` | Full audit with all checks, weakest areas, confidence labels |
275
- | `nerviq fix <key>` | Auto-fix a specific check (shows score impact) |
276
- | `nerviq fix --all-critical` | Fix all critical issues at once |
296
+ | `nerviq audit` | Score 0-100 — quick scan with top 3 actions and milestone coaching (default) |
297
+ | `nerviq audit --full` | Full audit with all checks, weakest areas, confidence labels, and milestone coaching |
298
+ | `nerviq audit --diff-only` | Analyze only changed files plus linked governance/config surfaces from git diff / working tree |
299
+ | `nerviq fix <key>` | Auto-fix a specific check (shows score impact) |
300
+ | `nerviq fix --all-critical` | Fix all critical issues at once |
277
301
  | `nerviq rollback` | Undo the most recent apply (delete created files) |
278
302
  | `nerviq rollback --list` | Show available rollback points |
279
- | `nerviq setup` | Generate starter-safe CLAUDE.md + hooks + commands |
280
- | `nerviq augment` | Repo-aware improvement plan (no writes) |
281
- | `nerviq suggest-only` | Structured report for sharing |
303
+ | `nerviq setup` | Generate starter-safe CLAUDE.md + hooks + commands |
304
+ | `nerviq augment` | Repo-aware improvement plan with archetype profiling, operating profile, and adopt/defer/ignore guidance (no writes) |
305
+ | `nerviq suggest-only` | Structured report for sharing, including repo archetype, operating profile, and adopt/defer/ignore guidance |
282
306
  | `nerviq plan` | Export proposal bundles with previews |
283
307
  | `nerviq apply` | Apply proposals with rollback |
284
308
  | `nerviq governance` | Permission profiles, hooks, policy packs |
285
309
  | `nerviq benchmark` | Baseline vs projected score in isolated temp copy |
286
310
  | `nerviq check-health` | Detect regressions between audit snapshots |
287
- | `nerviq deep-review` | AI-powered config review (opt-in) |
311
+ | `nerviq deep-review` | AI-powered config review (opt-in) |
312
+ | `nerviq deep-review --behavioral` | Local behavioral drift review with outcome-layer heuristics |
288
313
  | `nerviq interactive` | Step-by-step guided wizard |
289
314
  | `nerviq watch` | Live monitoring with score delta |
290
315
  | `nerviq history` | Audit snapshot history from saved snapshots |
@@ -294,10 +319,11 @@ Levels:
294
319
  | `nerviq anti-patterns` | Detect anti-patterns in current project |
295
320
  | `nerviq freshness` | Show verification freshness for all checks |
296
321
  | `nerviq rules-export` | Export recommendation rules (human summary or --json) |
297
- | `nerviq badge` | shields.io badge for README |
298
- | `nerviq certify` | Certification level + badge |
299
- | `nerviq scan dir1 dir2` | Compare multiple repos |
300
- | `nerviq org scan dir1 dir2` | Aggregate multiple repos into one score table |
322
+ | `nerviq badge` | shields.io badge for README |
323
+ | `nerviq certify` | Certification level + badge |
324
+ | `nerviq scan dir1 dir2` | Compare multiple repos |
325
+ | `nerviq org scan dir1 dir2` | Aggregate multiple repos into one score table |
326
+ | `nerviq org policy` | Inspect resolved org/team/repo policy layers |
301
327
  | `nerviq harmony-audit` | Cross-platform DX audit |
302
328
  | `nerviq harmony-sync` | Sync config across platforms |
303
329
  | `nerviq harmony-drift` | Detect platform drift |
@@ -306,7 +332,7 @@ Levels:
306
332
  | `nerviq harmony-governance` | Unified platform governance |
307
333
  | `nerviq synergy-report` | Multi-agent synergy analysis |
308
334
  | `nerviq catalog` | Show check catalog for all 8 platforms |
309
- | `nerviq doctor` | Self-diagnostics |
335
+ | `nerviq doctor` | Self-diagnostics for install health, freshness, platform detection, declared MCP servers, and hook runtime |
310
336
  | `nerviq convert` | Convert config between platforms |
311
337
  | `nerviq migrate` | Migrate platform config versions |
312
338
  | `nerviq serve` | Start local MCP-compatible HTTP API |
@@ -315,7 +341,7 @@ Levels:
315
341
 
316
342
  | Flag | Effect |
317
343
  |------|--------|
318
- | `--full` | Full audit output (all checks, weakest areas, confidence labels) |
344
+ | `--full` | Full audit output (all checks, weakest areas, confidence labels, milestone coaching) |
319
345
  | `--verbose` | Full audit + medium-priority recommendations |
320
346
  | `--threshold N` | Exit 1 if score < N (for CI) |
321
347
  | `--json` | Machine-readable JSON output |
@@ -324,6 +350,13 @@ Levels:
324
350
  | `--webhook-header NAME:VALUE` | Add a custom webhook header; repeat the flag for multiple headers |
325
351
  | `--webhook-retries N` | Retry transient webhook failures (`429`, `5xx`, timeouts) up to `N` extra times |
326
352
  | `--snapshot` | Save audit snapshot for trending |
353
+ | `--tag LABEL` | Label a saved snapshot (repeat the flag for multiple tags) |
354
+ | `--behavioral` | Run the opt-in local behavioral drift review via `deep-review` |
355
+ | `--history` | With `deep-review --behavioral`, show behavioral snapshot history |
356
+ | `--compare` | With `deep-review --behavioral`, compare the latest two behavioral snapshots |
357
+ | `--diff-only` | Run a changed-file audit instead of a full repo audit |
358
+ | `--diff-base SHA` | Base SHA for `--diff-only` PR comparisons (defaults to CI env vars when present) |
359
+ | `--diff-head SHA` | Head SHA for `--diff-only` PR comparisons (defaults to `GITHUB_SHA` or `HEAD`) |
327
360
  | `--dry-run` | Preview changes without writing files |
328
361
  | `--config-only` | Only write config files, never source code |
329
362
  | `--auto` | Apply without prompts |
@@ -342,6 +375,51 @@ npx @nerviq/cli audit \
342
375
  --webhook-header "X-Nerviq-Environment: production" \
343
376
  --webhook-retries 4
344
377
  ```
378
+
379
+ Generic webhook endpoints now receive a stable `nerviq.audit.completed` event envelope with:
380
+
381
+ - backward-compatible top-level `platform`, `score`, `passed`, `failed`, and `results`
382
+ - nested `data` and `meta` blocks for new consumers
383
+ - schema versioning through `schemaVersion`
384
+
385
+ For PR-focused audits, you can scope Nerviq to the working tree or an explicit base/head range:
386
+
387
+ ```bash
388
+ npx @nerviq/cli audit --diff-only
389
+ npx @nerviq/cli audit --diff-only --diff-base origin/main --diff-head HEAD
390
+ ```
391
+
392
+ `--diff-only` is intentionally a scoped review surface. It reports a `diff-only changed-file audit` score, lists the changed files it considered, and reminds you to run a full `nerviq audit` for the complete repo posture. Because diff-only scores are not directly comparable to full audit history, Nerviq blocks `--diff-only --snapshot`.
393
+
394
+ For multi-repo governance, Nerviq also supports inherited policy layers:
395
+
396
+ - `.nerviq/org-policy.json` in an ancestor directory for org defaults
397
+ - `.nerviq/team-policy.json` in the repo for team overrides
398
+ - `.nerviq/repo-policy.json` in the repo for repo-specific overrides
399
+
400
+ Inspect the resolved contract with:
401
+
402
+ ```bash
403
+ npx @nerviq/cli org policy
404
+ npx @nerviq/cli org scan ./app ./api ./infra --json
405
+ ```
406
+
407
+ For opt-in outcome-layer inspection, Nerviq can also run a local behavioral drift review:
408
+
409
+ ```bash
410
+ npx @nerviq/cli deep-review --behavioral
411
+ npx @nerviq/cli deep-review --behavioral --snapshot --milestone baseline --tag "behavioral-baseline"
412
+ npx @nerviq/cli deep-review --behavioral --history
413
+ npx @nerviq/cli deep-review --behavioral --compare
414
+ ```
415
+
416
+ Behavioral drift mode is intentionally guarded:
417
+
418
+ - It analyzes repository structure and instruction-vs-outcome mismatch heuristics
419
+ - It does not claim agent attribution without explicit evidence
420
+ - It is not marketed as SAST, semantic code review, or runtime analysis
421
+
422
+ `nerviq setup` now seeds a trust-boundary section in `CLAUDE.md` and an `injection-defense` starter hook for `WebFetch`, `WebSearch`, `Read`, `Grep`, `Glob`, and MCP-backed external-content flows. `nerviq doctor` validates that the declared starter hook still runs and logs suspicious prompt-injection patterns correctly.
345
423
 
346
424
  ## Backed by Research
347
425
 
@@ -349,7 +427,7 @@ Nerviq is built on the NERVIQ knowledge engine — the largest verified catalog
349
427
 
350
428
  - **448+ research documents** covering all 8 platforms
351
429
  - **332+ experiments** with tested, rated results
352
- - **2,438 checks** across 8 platforms (~300 unique governance rules × 8 platform adaptations), each with `sourceUrl` and `confidence` level (0.0-1.0)
430
+ - **2,441 checks** across 8 platforms (~300 unique governance rules × 8 platform adaptations), each with `sourceUrl` and `confidence` level (0.0-1.0)
353
431
  - Every check is traceable to primary documentation or verified experiment
354
432
  - 90-day freshness cycle: stale findings are re-verified or pruned
355
433
 
@@ -372,7 +450,7 @@ Every write command supports `--snapshot` for automatic backup before changes.
372
450
 
373
451
  - **Zero dependencies** — nothing to audit
374
452
  - **Runs locally** — audit, setup, plan, apply, governance, benchmark all run on your machine
375
- - **Deep review is opt-in** — only `deep-review` sends selected config for AI analysis
453
+ - **Deep review is opt-in** — `deep-review` sends selected config for AI analysis, while `deep-review --behavioral` stays local and uses heuristic outcome-layer analysis only
376
454
  - **AGPL-3.0 Licensed** — open source
377
455
 
378
456
  ## Links