@nerviq/cli 1.29.0 → 1.29.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.
- package/CHANGELOG.md +1527 -1493
- package/README.md +550 -538
- package/SECURITY.md +82 -82
- package/bin/cli.js +2562 -2558
- package/docs/api-reference.md +356 -356
- package/docs/audit-fix.md +109 -0
- package/docs/autofix.md +3 -62
- package/docs/getting-started.md +1 -1
- package/docs/index.html +592 -592
- package/docs/integration-contracts.md +287 -287
- package/docs/maintenance.md +128 -128
- package/docs/new-platform-guide.md +202 -202
- package/docs/release-process.md +63 -0
- package/docs/shallow-risk.md +244 -244
- package/docs/why-nerviq.md +82 -82
- package/package.json +67 -67
- package/src/aider/activity.js +226 -226
- package/src/aider/context.js +162 -162
- package/src/aider/freshness.js +123 -123
- package/src/aider/techniques.js +3465 -3465
- package/src/audit/layers.js +180 -180
- package/src/audit.js +1032 -1032
- package/src/benchmark.js +299 -299
- package/src/codex/activity.js +324 -324
- package/src/codex/freshness.js +142 -142
- package/src/codex/techniques.js +4895 -4895
- package/src/context.js +326 -326
- package/src/continuous-ops.js +11 -1
- package/src/convert.js +340 -340
- package/src/copilot/config-parser.js +280 -280
- package/src/copilot/context.js +218 -218
- package/src/copilot/freshness.js +177 -177
- package/src/copilot/patch.js +238 -238
- package/src/copilot/techniques.js +3578 -3578
- package/src/cursor/freshness.js +194 -194
- package/src/cursor/patch.js +243 -243
- package/src/cursor/techniques.js +3735 -3735
- package/src/doctor.js +201 -201
- package/src/fix-engine.js +511 -8
- package/src/formatters/csv.js +86 -86
- package/src/formatters/junit.js +123 -123
- package/src/formatters/markdown.js +164 -164
- package/src/formatters/otel.js +151 -151
- package/src/freshness.js +156 -156
- package/src/gemini/activity.js +402 -402
- package/src/gemini/context.js +290 -290
- package/src/gemini/freshness.js +183 -183
- package/src/gemini/patch.js +229 -229
- package/src/gemini/techniques.js +3811 -3811
- package/src/governance.js +533 -533
- package/src/harmony/audit.js +306 -306
- package/src/i18n.js +63 -63
- package/src/insights.js +119 -119
- package/src/integrations.js +134 -134
- package/src/locales/en.json +33 -33
- package/src/locales/es.json +33 -33
- package/src/migrate.js +354 -354
- package/src/opencode/activity.js +286 -286
- package/src/opencode/freshness.js +137 -137
- package/src/opencode/techniques.js +3450 -3450
- package/src/setup/analysis.js +12 -12
- package/src/setup.js +7 -6
- package/src/shallow-risk/index.js +56 -56
- package/src/shallow-risk/patterns/agent-config-cross-platform-drift.js +50 -50
- package/src/shallow-risk/patterns/agent-config-dangerous-autoapprove.js +46 -46
- package/src/shallow-risk/patterns/agent-config-deprecated-keys.js +46 -46
- package/src/shallow-risk/patterns/agent-config-missing-file.js +317 -317
- package/src/shallow-risk/patterns/agent-config-secret-literal.js +49 -49
- package/src/shallow-risk/patterns/agent-config-stack-contradiction.js +34 -34
- package/src/shallow-risk/patterns/hook-script-missing.js +70 -70
- package/src/shallow-risk/patterns/mcp-server-no-allowlist.js +52 -52
- package/src/shallow-risk/shared.js +648 -648
- package/src/source-urls.js +295 -295
- package/src/state-paths.js +85 -85
- package/src/supplemental-checks.js +805 -805
- package/src/telemetry.js +160 -160
- package/src/windsurf/context.js +359 -359
- package/src/windsurf/freshness.js +194 -194
- package/src/windsurf/patch.js +231 -231
- package/src/windsurf/techniques.js +3779 -3779
|
@@ -1,287 +1,287 @@
|
|
|
1
|
-
# Integration Contract Pack
|
|
2
|
-
|
|
3
|
-
This document centralizes Nerviq's integration surfaces so external systems can adopt one stable package instead of scraping CLI text output.
|
|
4
|
-
|
|
5
|
-
## Included contract surfaces
|
|
6
|
-
|
|
7
|
-
- `nerviq serve` live OpenAPI contract via `GET /api/openapi.json`
|
|
8
|
-
- `nerviq-mcp` stdio JSON-RPC 2.0 transport for MCP hosts
|
|
9
|
-
- Generic audit webhook event contract via `contracts/audit-webhook-event.schema.json`
|
|
10
|
-
- CI reference patterns for GitHub Actions, GitLab, Bitbucket, and generic shell runners
|
|
11
|
-
- SDK usage examples through `sdk/README.md`
|
|
12
|
-
|
|
13
|
-
## 1. Local REST contract
|
|
14
|
-
|
|
15
|
-
Start the local API server:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx @nerviq/cli serve --port 3000
|
|
19
|
-
curl http://127.0.0.1:3000/api/openapi.json > nerviq-openapi.json
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Current GET endpoints:
|
|
23
|
-
|
|
24
|
-
- `/api/openapi.json`
|
|
25
|
-
- `/api/health`
|
|
26
|
-
- `/api/audit`
|
|
27
|
-
- `/api/harmony`
|
|
28
|
-
- `/api/catalog`
|
|
29
|
-
|
|
30
|
-
The live OpenAPI document is the canonical machine-readable contract for local HTTP consumers.
|
|
31
|
-
|
|
32
|
-
## 2. MCP transport (stdio JSON-RPC 2.0)
|
|
33
|
-
|
|
34
|
-
Nerviq also ships a separate MCP server binary for hosts that speak Model Context Protocol over stdio.
|
|
35
|
-
|
|
36
|
-
Use `nerviq serve` for local HTTP/OpenAPI consumers.
|
|
37
|
-
Use `nerviq-mcp` when the host expects MCP over stdio.
|
|
38
|
-
|
|
39
|
-
Example host registration:
|
|
40
|
-
|
|
41
|
-
```json
|
|
42
|
-
{
|
|
43
|
-
"mcpServers": {
|
|
44
|
-
"nerviq": {
|
|
45
|
-
"command": "npx",
|
|
46
|
-
"args": ["-y", "-p", "@nerviq/cli", "nerviq-mcp"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The runtime implementation lives in `src/mcp-server.js` and speaks JSON-RPC 2.0 over stdin/stdout.
|
|
53
|
-
|
|
54
|
-
## 3. Generic webhook event contract
|
|
55
|
-
|
|
56
|
-
When `audit` is called with `--webhook` and the URL is not a Slack or Discord webhook, Nerviq now emits a stable generic JSON event contract.
|
|
57
|
-
|
|
58
|
-
Schema:
|
|
59
|
-
|
|
60
|
-
- `contracts/audit-webhook-event.schema.json`
|
|
61
|
-
|
|
62
|
-
Example:
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"event": "nerviq.audit.completed",
|
|
67
|
-
"schemaVersion": "1.0",
|
|
68
|
-
"generatedAt": "2026-04-09T12:00:00.000Z",
|
|
69
|
-
"platform": "claude",
|
|
70
|
-
"score": 84,
|
|
71
|
-
"passed": 196,
|
|
72
|
-
"failed": 34,
|
|
73
|
-
"results": [],
|
|
74
|
-
"data": {
|
|
75
|
-
"platform": "claude",
|
|
76
|
-
"platformLabel": "Claude",
|
|
77
|
-
"score": 84,
|
|
78
|
-
"scoreType": "live-audit-score",
|
|
79
|
-
"organicScore": 68,
|
|
80
|
-
"passed": 196,
|
|
81
|
-
"failed": 34,
|
|
82
|
-
"skipped": 28,
|
|
83
|
-
"checkCount": 258,
|
|
84
|
-
"topNextActions": [],
|
|
85
|
-
"quickWins": [],
|
|
86
|
-
"scoreCoaching": {
|
|
87
|
-
"currentScore": 84,
|
|
88
|
-
"nextMilestone": 90,
|
|
89
|
-
"pointsNeeded": 6,
|
|
90
|
-
"fixesNeeded": 2
|
|
91
|
-
},
|
|
92
|
-
"suggestedNextCommand": "npx nerviq fix verificationLoop"
|
|
93
|
-
},
|
|
94
|
-
"meta": {
|
|
95
|
-
"cliVersion": "1.29.
|
|
96
|
-
"source": "nerviq-cli",
|
|
97
|
-
"webhookFormat": "generic-audit-event"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Compatibility note:
|
|
103
|
-
|
|
104
|
-
- Top-level `platform`, `score`, `passed`, `failed`, and `results` remain present for older consumers
|
|
105
|
-
- New consumers should prefer the nested `data` + `meta` contract
|
|
106
|
-
|
|
107
|
-
## 4. CI reference patterns
|
|
108
|
-
|
|
109
|
-
See:
|
|
110
|
-
|
|
111
|
-
- `docs/ci-integration.md`
|
|
112
|
-
- `action/README.md`
|
|
113
|
-
- `docs/gitlab-ci-template.yml`
|
|
114
|
-
- `docs/bitbucket-pipe.yml`
|
|
115
|
-
|
|
116
|
-
Recommended patterns:
|
|
117
|
-
|
|
118
|
-
### Score gate
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
npx @nerviq/cli audit --threshold 60
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### PR drift gate
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
npx @nerviq/cli audit --diff-only --drift-mode ci --threshold 60
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Fleet rollup artifact
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
npx @nerviq/cli org scan ./app ./api ./infra --json --out nerviq-fleet.json
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## 5. SDK reference
|
|
137
|
-
|
|
138
|
-
See:
|
|
139
|
-
|
|
140
|
-
- `sdk/README.md`
|
|
141
|
-
- `docs/api-reference.md`
|
|
142
|
-
|
|
143
|
-
Recommended SDK surfaces:
|
|
144
|
-
|
|
145
|
-
- Stable: `audit`, `harmonyAudit`, `detectPlatforms`, `getCatalog`
|
|
146
|
-
- Experimental: `synergyReport`, `routeTask`
|
|
147
|
-
|
|
148
|
-
## Why this pack exists
|
|
149
|
-
|
|
150
|
-
- External dashboards can bind to explicit contracts instead of scraping CLI text
|
|
151
|
-
- CI systems can use repeatable patterns for threshold gates, drift gates, and fleet rollups
|
|
152
|
-
- SDK users and HTTP users now share one public integration story instead of separate ad-hoc examples
|
|
153
|
-
|
|
154
|
-
## 6. First-tier integration gate
|
|
155
|
-
|
|
156
|
-
Nerviq does not treat every external surface as equally ready on day one.
|
|
157
|
-
|
|
158
|
-
Before broader distribution surfaces such as GitHub Marketplace listings, JetBrains plugins, or similar first-tier integrations are unblocked, the release bar must be green across:
|
|
159
|
-
|
|
160
|
-
- contract stability
|
|
161
|
-
- public proof density
|
|
162
|
-
- operational reliability
|
|
163
|
-
- clear ownership and support posture
|
|
164
|
-
- category fit
|
|
165
|
-
|
|
166
|
-
See `docs/first-tier-integration-gate.md` for the explicit gate and current posture.
|
|
167
|
-
|
|
168
|
-
## 7. CI output format contracts
|
|
169
|
-
|
|
170
|
-
`nerviq audit --format=<name>` emits machine-readable output shapes for standard
|
|
171
|
-
CI surfaces. All six formats share the same underlying audit result object; they
|
|
172
|
-
differ only in rendering.
|
|
173
|
-
|
|
174
|
-
### markdown (`--format=markdown`)
|
|
175
|
-
|
|
176
|
-
GitHub-flavoured markdown suitable for a PR comment. Contract:
|
|
177
|
-
|
|
178
|
-
- first line is an `## Score: N/100` heading followed by a shields.io badge
|
|
179
|
-
- second block lists `**Platform:**` and `**Checks:**` summary
|
|
180
|
-
- `### Top next actions` section with up to 5 items rendered as a GitHub
|
|
181
|
-
task-list checklist: `- [ ] **[SEVERITY] Title** (` + backtick key + `)`
|
|
182
|
-
optionally suffixed with ` — ` + backtick file:line
|
|
183
|
-
- when `auditResult.shallowRiskHints` is present, a `### Shallow Risk (experimental, opt-in)`
|
|
184
|
-
section appears immediately after `### Top next actions`, with the
|
|
185
|
-
shallow-risk banner rendered as a blockquote and each hint listed with
|
|
186
|
-
severity, key, and file:line
|
|
187
|
-
- `<details><summary>All failed checks (N)</summary>` collapsible block
|
|
188
|
-
containing a GitHub pipe-table with columns
|
|
189
|
-
`key | name | category | rating | file | line`. Pipe characters inside cells
|
|
190
|
-
are backslash-escaped.
|
|
191
|
-
- footer line `Generated by [Nerviq](https://nerviq.net) vX.Y.Z · TIMESTAMP`
|
|
192
|
-
- no raw HTML other than `<details>` / `<summary>`
|
|
193
|
-
|
|
194
|
-
### junit (`--format=junit`)
|
|
195
|
-
|
|
196
|
-
JUnit XML, Jenkins-compatible. Contract:
|
|
197
|
-
|
|
198
|
-
- first line is `<?xml version="1.0" encoding="UTF-8"?>`
|
|
199
|
-
- root element `<testsuites name="nerviq" tests="N" failures="F" skipped="S" time="0">`
|
|
200
|
-
- one `<testsuite>` per check category, with attributes
|
|
201
|
-
`name=category`, `tests`, `failures`, `skipped`, `time`, `timestamp`,
|
|
202
|
-
`package="nerviq.PLATFORM"`
|
|
203
|
-
- when `auditResult.shallowRiskHints` is present, a separate
|
|
204
|
-
`<testsuite name="shallow-risk">` is emitted so CI consumers can
|
|
205
|
-
filter it independently from governance scoring suites
|
|
206
|
-
- one `<testcase>` per check, with `classname=category` and `name=key`
|
|
207
|
-
- failed checks emit `<failure message="..." type="SEVERITY">BODY</failure>`
|
|
208
|
-
where message = `fix || name`, type = severity/impact, body contains
|
|
209
|
-
`name [at file:line] [(sourceUrl)]`
|
|
210
|
-
- skipped checks emit `<skipped/>`
|
|
211
|
-
- all attribute values and text nodes XML-escape `& < > " '`
|
|
212
|
-
|
|
213
|
-
### csv (`--format=csv`)
|
|
214
|
-
|
|
215
|
-
RFC 4180 CSV. Contract:
|
|
216
|
-
|
|
217
|
-
- first row = header `key,id,name,category,layer,rating,severity,passed,file,line,sourceUrl,fix,projectedScoreDelta,projectedScoreAfter`
|
|
218
|
-
- `layer` is one of `governance`, `drift`, `hygiene`, or `shallow-risk` (see §8)
|
|
219
|
-
- one row per check result in `auditResult.results`
|
|
220
|
-
- when `auditResult.shallowRiskHints` is present, those hints are
|
|
221
|
-
appended as additional rows tagged with `layer=shallow-risk`
|
|
222
|
-
- `projectedScoreDelta` / `projectedScoreAfter` are populated only for rows whose
|
|
223
|
-
`key` appears in `auditResult.topNextActions` (the projection is computed per
|
|
224
|
-
top action, not per every check). Other rows leave both columns empty.
|
|
225
|
-
- fields containing comma, double-quote, CR, or LF are wrapped in double-quotes
|
|
226
|
-
- internal double-quotes are escaped by doubling (`""`)
|
|
227
|
-
- no UTF-8 BOM
|
|
228
|
-
- line separator = LF
|
|
229
|
-
|
|
230
|
-
These contracts are the stable consumer API for `--format=markdown|junit|csv`.
|
|
231
|
-
Downstream wrappers (GitHub Actions, Jenkins plugins, GitLab reporters,
|
|
232
|
-
dashboards) should bind to these shapes rather than scraping the text output.
|
|
233
|
-
|
|
234
|
-
## 8. Audit layers (scope taxonomy)
|
|
235
|
-
|
|
236
|
-
Every check in the NERVIQ audit is tagged with exactly one `layer`. The
|
|
237
|
-
layer answers the question "what kind of problem does this check look
|
|
238
|
-
for?" and gives evaluators an explicit, stable map of what NERVIQ covers
|
|
239
|
-
and what it deliberately does not.
|
|
240
|
-
|
|
241
|
-
| Layer | Short definition | Example checks |
|
|
242
|
-
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
243
|
-
| `governance` | Agent configuration posture: presence, content, and quality of agent-instruction files and platform settings. "Does my agent know X?" | `claudeMdExists`, `codexAgentsMdSubstantive`, `geminiSettingsExists`, MCP servers, hook presence |
|
|
244
|
-
| `drift` | Cross-platform consistency and declared-vs-actual alignment. "Do two places agree on X?" | Harmony drift, Gemini propagation completeness, "rules consistent across surfaces", pack agreement |
|
|
245
|
-
| `hygiene` | Repo-level cleanliness adjacent to agents — the engineering baseline that makes an agent's job easier. | `.gitignore`, `CHANGELOG`, `SECURITY.md`, `LICENSE`, `.editorconfig`, Node version pinning |
|
|
246
|
-
| `shallow-risk` | Opt-in boundary checks that sit at the agent-config <-> codebase edge and are emitted in parallel to the governance audit. | `agent-config-missing-file`, `mcp-server-no-allowlist`, `agent-config-dangerous-autoapprove` |
|
|
247
|
-
|
|
248
|
-
**Disambiguation rules** (apply when a check could plausibly fit more than one layer):
|
|
249
|
-
|
|
250
|
-
- If the check asks "does my agent know X?" → `governance`.
|
|
251
|
-
- If the check asks "do two places agree on X?" → `drift`.
|
|
252
|
-
- If the check asks "does the repo have standard engineering hygiene that makes the agent's job easier?" → `hygiene`.
|
|
253
|
-
- When in doubt, default to `hygiene`. A mild misclassification is recoverable; a missing tag breaks the coverage contract.
|
|
254
|
-
|
|
255
|
-
**No deep-review lane.** There is intentionally no `deep-review`,
|
|
256
|
-
`security`, or `code-review` layer. NERVIQ audits agent configuration and
|
|
257
|
-
the cleanliness of the repo boundary an agent operates inside. It does
|
|
258
|
-
not perform dataflow analysis, SAST, or general code review — those are
|
|
259
|
-
out of scope and left to dedicated tools. This is the contract that
|
|
260
|
-
lets evaluators know where our claim to ground-truth starts and stops.
|
|
261
|
-
|
|
262
|
-
### 8.1 Shallow-risk as a parallel lane
|
|
263
|
-
|
|
264
|
-
`shallow-risk` is the one layer that does **not** roll into the governance
|
|
265
|
-
score. When enabled via `nerviq audit --shallow-risk`, findings are emitted
|
|
266
|
-
through `auditResult.shallowRiskHints[]` and rendered separately in text,
|
|
267
|
-
Markdown, JUnit, and CSV. They are intentionally excluded from:
|
|
268
|
-
|
|
269
|
-
- `auditResult.score`
|
|
270
|
-
- `auditResult.organicScore`
|
|
271
|
-
- `auditResult.passed` / `failed` / `skipped`
|
|
272
|
-
- `auditResult.topNextActions`
|
|
273
|
-
- `auditResult.layerSummary.*.failed`
|
|
274
|
-
|
|
275
|
-
This keeps the governance pipeline stable while still surfacing the
|
|
276
|
-
agent-config <-> codebase red flags documented in [docs/shallow-risk.md](shallow-risk.md).
|
|
277
|
-
|
|
278
|
-
**Surfaces.** The `layer` field appears in:
|
|
279
|
-
|
|
280
|
-
- `auditResult.results[].layer` (JSON)
|
|
281
|
-
- `auditResult.topNextActions[].layer` (JSON)
|
|
282
|
-
- `auditResult.layerSummary` (JSON) — per-layer `{ total, passed, failed, skipped }`
|
|
283
|
-
- CSV output — column between `category` and `rating`
|
|
284
|
-
- JUnit output — attribute on each `<testcase layer="…">`
|
|
285
|
-
- Markdown output — column in the failed-checks table plus a `_layer: X_` suffix on each top-action checklist item
|
|
286
|
-
- Text output — "Coverage by layer:" summary block and a small `[layer]` prefix on failed-check names
|
|
287
|
-
|
|
1
|
+
# Integration Contract Pack
|
|
2
|
+
|
|
3
|
+
This document centralizes Nerviq's integration surfaces so external systems can adopt one stable package instead of scraping CLI text output.
|
|
4
|
+
|
|
5
|
+
## Included contract surfaces
|
|
6
|
+
|
|
7
|
+
- `nerviq serve` live OpenAPI contract via `GET /api/openapi.json`
|
|
8
|
+
- `nerviq-mcp` stdio JSON-RPC 2.0 transport for MCP hosts
|
|
9
|
+
- Generic audit webhook event contract via `contracts/audit-webhook-event.schema.json`
|
|
10
|
+
- CI reference patterns for GitHub Actions, GitLab, Bitbucket, and generic shell runners
|
|
11
|
+
- SDK usage examples through `sdk/README.md`
|
|
12
|
+
|
|
13
|
+
## 1. Local REST contract
|
|
14
|
+
|
|
15
|
+
Start the local API server:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @nerviq/cli serve --port 3000
|
|
19
|
+
curl http://127.0.0.1:3000/api/openapi.json > nerviq-openapi.json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Current GET endpoints:
|
|
23
|
+
|
|
24
|
+
- `/api/openapi.json`
|
|
25
|
+
- `/api/health`
|
|
26
|
+
- `/api/audit`
|
|
27
|
+
- `/api/harmony`
|
|
28
|
+
- `/api/catalog`
|
|
29
|
+
|
|
30
|
+
The live OpenAPI document is the canonical machine-readable contract for local HTTP consumers.
|
|
31
|
+
|
|
32
|
+
## 2. MCP transport (stdio JSON-RPC 2.0)
|
|
33
|
+
|
|
34
|
+
Nerviq also ships a separate MCP server binary for hosts that speak Model Context Protocol over stdio.
|
|
35
|
+
|
|
36
|
+
Use `nerviq serve` for local HTTP/OpenAPI consumers.
|
|
37
|
+
Use `nerviq-mcp` when the host expects MCP over stdio.
|
|
38
|
+
|
|
39
|
+
Example host registration:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"nerviq": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["-y", "-p", "@nerviq/cli", "nerviq-mcp"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The runtime implementation lives in `src/mcp-server.js` and speaks JSON-RPC 2.0 over stdin/stdout.
|
|
53
|
+
|
|
54
|
+
## 3. Generic webhook event contract
|
|
55
|
+
|
|
56
|
+
When `audit` is called with `--webhook` and the URL is not a Slack or Discord webhook, Nerviq now emits a stable generic JSON event contract.
|
|
57
|
+
|
|
58
|
+
Schema:
|
|
59
|
+
|
|
60
|
+
- `contracts/audit-webhook-event.schema.json`
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"event": "nerviq.audit.completed",
|
|
67
|
+
"schemaVersion": "1.0",
|
|
68
|
+
"generatedAt": "2026-04-09T12:00:00.000Z",
|
|
69
|
+
"platform": "claude",
|
|
70
|
+
"score": 84,
|
|
71
|
+
"passed": 196,
|
|
72
|
+
"failed": 34,
|
|
73
|
+
"results": [],
|
|
74
|
+
"data": {
|
|
75
|
+
"platform": "claude",
|
|
76
|
+
"platformLabel": "Claude",
|
|
77
|
+
"score": 84,
|
|
78
|
+
"scoreType": "live-audit-score",
|
|
79
|
+
"organicScore": 68,
|
|
80
|
+
"passed": 196,
|
|
81
|
+
"failed": 34,
|
|
82
|
+
"skipped": 28,
|
|
83
|
+
"checkCount": 258,
|
|
84
|
+
"topNextActions": [],
|
|
85
|
+
"quickWins": [],
|
|
86
|
+
"scoreCoaching": {
|
|
87
|
+
"currentScore": 84,
|
|
88
|
+
"nextMilestone": 90,
|
|
89
|
+
"pointsNeeded": 6,
|
|
90
|
+
"fixesNeeded": 2
|
|
91
|
+
},
|
|
92
|
+
"suggestedNextCommand": "npx nerviq fix verificationLoop"
|
|
93
|
+
},
|
|
94
|
+
"meta": {
|
|
95
|
+
"cliVersion": "1.29.1",
|
|
96
|
+
"source": "nerviq-cli",
|
|
97
|
+
"webhookFormat": "generic-audit-event"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Compatibility note:
|
|
103
|
+
|
|
104
|
+
- Top-level `platform`, `score`, `passed`, `failed`, and `results` remain present for older consumers
|
|
105
|
+
- New consumers should prefer the nested `data` + `meta` contract
|
|
106
|
+
|
|
107
|
+
## 4. CI reference patterns
|
|
108
|
+
|
|
109
|
+
See:
|
|
110
|
+
|
|
111
|
+
- `docs/ci-integration.md`
|
|
112
|
+
- `action/README.md`
|
|
113
|
+
- `docs/gitlab-ci-template.yml`
|
|
114
|
+
- `docs/bitbucket-pipe.yml`
|
|
115
|
+
|
|
116
|
+
Recommended patterns:
|
|
117
|
+
|
|
118
|
+
### Score gate
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx @nerviq/cli audit --threshold 60
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### PR drift gate
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx @nerviq/cli audit --diff-only --drift-mode ci --threshold 60
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Fleet rollup artifact
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npx @nerviq/cli org scan ./app ./api ./infra --json --out nerviq-fleet.json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## 5. SDK reference
|
|
137
|
+
|
|
138
|
+
See:
|
|
139
|
+
|
|
140
|
+
- `sdk/README.md`
|
|
141
|
+
- `docs/api-reference.md`
|
|
142
|
+
|
|
143
|
+
Recommended SDK surfaces:
|
|
144
|
+
|
|
145
|
+
- Stable: `audit`, `harmonyAudit`, `detectPlatforms`, `getCatalog`
|
|
146
|
+
- Experimental: `synergyReport`, `routeTask`
|
|
147
|
+
|
|
148
|
+
## Why this pack exists
|
|
149
|
+
|
|
150
|
+
- External dashboards can bind to explicit contracts instead of scraping CLI text
|
|
151
|
+
- CI systems can use repeatable patterns for threshold gates, drift gates, and fleet rollups
|
|
152
|
+
- SDK users and HTTP users now share one public integration story instead of separate ad-hoc examples
|
|
153
|
+
|
|
154
|
+
## 6. First-tier integration gate
|
|
155
|
+
|
|
156
|
+
Nerviq does not treat every external surface as equally ready on day one.
|
|
157
|
+
|
|
158
|
+
Before broader distribution surfaces such as GitHub Marketplace listings, JetBrains plugins, or similar first-tier integrations are unblocked, the release bar must be green across:
|
|
159
|
+
|
|
160
|
+
- contract stability
|
|
161
|
+
- public proof density
|
|
162
|
+
- operational reliability
|
|
163
|
+
- clear ownership and support posture
|
|
164
|
+
- category fit
|
|
165
|
+
|
|
166
|
+
See `docs/first-tier-integration-gate.md` for the explicit gate and current posture.
|
|
167
|
+
|
|
168
|
+
## 7. CI output format contracts
|
|
169
|
+
|
|
170
|
+
`nerviq audit --format=<name>` emits machine-readable output shapes for standard
|
|
171
|
+
CI surfaces. All six formats share the same underlying audit result object; they
|
|
172
|
+
differ only in rendering.
|
|
173
|
+
|
|
174
|
+
### markdown (`--format=markdown`)
|
|
175
|
+
|
|
176
|
+
GitHub-flavoured markdown suitable for a PR comment. Contract:
|
|
177
|
+
|
|
178
|
+
- first line is an `## Score: N/100` heading followed by a shields.io badge
|
|
179
|
+
- second block lists `**Platform:**` and `**Checks:**` summary
|
|
180
|
+
- `### Top next actions` section with up to 5 items rendered as a GitHub
|
|
181
|
+
task-list checklist: `- [ ] **[SEVERITY] Title** (` + backtick key + `)`
|
|
182
|
+
optionally suffixed with ` — ` + backtick file:line
|
|
183
|
+
- when `auditResult.shallowRiskHints` is present, a `### Shallow Risk (experimental, opt-in)`
|
|
184
|
+
section appears immediately after `### Top next actions`, with the
|
|
185
|
+
shallow-risk banner rendered as a blockquote and each hint listed with
|
|
186
|
+
severity, key, and file:line
|
|
187
|
+
- `<details><summary>All failed checks (N)</summary>` collapsible block
|
|
188
|
+
containing a GitHub pipe-table with columns
|
|
189
|
+
`key | name | category | rating | file | line`. Pipe characters inside cells
|
|
190
|
+
are backslash-escaped.
|
|
191
|
+
- footer line `Generated by [Nerviq](https://nerviq.net) vX.Y.Z · TIMESTAMP`
|
|
192
|
+
- no raw HTML other than `<details>` / `<summary>`
|
|
193
|
+
|
|
194
|
+
### junit (`--format=junit`)
|
|
195
|
+
|
|
196
|
+
JUnit XML, Jenkins-compatible. Contract:
|
|
197
|
+
|
|
198
|
+
- first line is `<?xml version="1.0" encoding="UTF-8"?>`
|
|
199
|
+
- root element `<testsuites name="nerviq" tests="N" failures="F" skipped="S" time="0">`
|
|
200
|
+
- one `<testsuite>` per check category, with attributes
|
|
201
|
+
`name=category`, `tests`, `failures`, `skipped`, `time`, `timestamp`,
|
|
202
|
+
`package="nerviq.PLATFORM"`
|
|
203
|
+
- when `auditResult.shallowRiskHints` is present, a separate
|
|
204
|
+
`<testsuite name="shallow-risk">` is emitted so CI consumers can
|
|
205
|
+
filter it independently from governance scoring suites
|
|
206
|
+
- one `<testcase>` per check, with `classname=category` and `name=key`
|
|
207
|
+
- failed checks emit `<failure message="..." type="SEVERITY">BODY</failure>`
|
|
208
|
+
where message = `fix || name`, type = severity/impact, body contains
|
|
209
|
+
`name [at file:line] [(sourceUrl)]`
|
|
210
|
+
- skipped checks emit `<skipped/>`
|
|
211
|
+
- all attribute values and text nodes XML-escape `& < > " '`
|
|
212
|
+
|
|
213
|
+
### csv (`--format=csv`)
|
|
214
|
+
|
|
215
|
+
RFC 4180 CSV. Contract:
|
|
216
|
+
|
|
217
|
+
- first row = header `key,id,name,category,layer,rating,severity,passed,file,line,sourceUrl,fix,projectedScoreDelta,projectedScoreAfter`
|
|
218
|
+
- `layer` is one of `governance`, `drift`, `hygiene`, or `shallow-risk` (see §8)
|
|
219
|
+
- one row per check result in `auditResult.results`
|
|
220
|
+
- when `auditResult.shallowRiskHints` is present, those hints are
|
|
221
|
+
appended as additional rows tagged with `layer=shallow-risk`
|
|
222
|
+
- `projectedScoreDelta` / `projectedScoreAfter` are populated only for rows whose
|
|
223
|
+
`key` appears in `auditResult.topNextActions` (the projection is computed per
|
|
224
|
+
top action, not per every check). Other rows leave both columns empty.
|
|
225
|
+
- fields containing comma, double-quote, CR, or LF are wrapped in double-quotes
|
|
226
|
+
- internal double-quotes are escaped by doubling (`""`)
|
|
227
|
+
- no UTF-8 BOM
|
|
228
|
+
- line separator = LF
|
|
229
|
+
|
|
230
|
+
These contracts are the stable consumer API for `--format=markdown|junit|csv`.
|
|
231
|
+
Downstream wrappers (GitHub Actions, Jenkins plugins, GitLab reporters,
|
|
232
|
+
dashboards) should bind to these shapes rather than scraping the text output.
|
|
233
|
+
|
|
234
|
+
## 8. Audit layers (scope taxonomy)
|
|
235
|
+
|
|
236
|
+
Every check in the NERVIQ audit is tagged with exactly one `layer`. The
|
|
237
|
+
layer answers the question "what kind of problem does this check look
|
|
238
|
+
for?" and gives evaluators an explicit, stable map of what NERVIQ covers
|
|
239
|
+
and what it deliberately does not.
|
|
240
|
+
|
|
241
|
+
| Layer | Short definition | Example checks |
|
|
242
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
243
|
+
| `governance` | Agent configuration posture: presence, content, and quality of agent-instruction files and platform settings. "Does my agent know X?" | `claudeMdExists`, `codexAgentsMdSubstantive`, `geminiSettingsExists`, MCP servers, hook presence |
|
|
244
|
+
| `drift` | Cross-platform consistency and declared-vs-actual alignment. "Do two places agree on X?" | Harmony drift, Gemini propagation completeness, "rules consistent across surfaces", pack agreement |
|
|
245
|
+
| `hygiene` | Repo-level cleanliness adjacent to agents — the engineering baseline that makes an agent's job easier. | `.gitignore`, `CHANGELOG`, `SECURITY.md`, `LICENSE`, `.editorconfig`, Node version pinning |
|
|
246
|
+
| `shallow-risk` | Opt-in boundary checks that sit at the agent-config <-> codebase edge and are emitted in parallel to the governance audit. | `agent-config-missing-file`, `mcp-server-no-allowlist`, `agent-config-dangerous-autoapprove` |
|
|
247
|
+
|
|
248
|
+
**Disambiguation rules** (apply when a check could plausibly fit more than one layer):
|
|
249
|
+
|
|
250
|
+
- If the check asks "does my agent know X?" → `governance`.
|
|
251
|
+
- If the check asks "do two places agree on X?" → `drift`.
|
|
252
|
+
- If the check asks "does the repo have standard engineering hygiene that makes the agent's job easier?" → `hygiene`.
|
|
253
|
+
- When in doubt, default to `hygiene`. A mild misclassification is recoverable; a missing tag breaks the coverage contract.
|
|
254
|
+
|
|
255
|
+
**No deep-review lane.** There is intentionally no `deep-review`,
|
|
256
|
+
`security`, or `code-review` layer. NERVIQ audits agent configuration and
|
|
257
|
+
the cleanliness of the repo boundary an agent operates inside. It does
|
|
258
|
+
not perform dataflow analysis, SAST, or general code review — those are
|
|
259
|
+
out of scope and left to dedicated tools. This is the contract that
|
|
260
|
+
lets evaluators know where our claim to ground-truth starts and stops.
|
|
261
|
+
|
|
262
|
+
### 8.1 Shallow-risk as a parallel lane
|
|
263
|
+
|
|
264
|
+
`shallow-risk` is the one layer that does **not** roll into the governance
|
|
265
|
+
score. When enabled via `nerviq audit --shallow-risk`, findings are emitted
|
|
266
|
+
through `auditResult.shallowRiskHints[]` and rendered separately in text,
|
|
267
|
+
Markdown, JUnit, and CSV. They are intentionally excluded from:
|
|
268
|
+
|
|
269
|
+
- `auditResult.score`
|
|
270
|
+
- `auditResult.organicScore`
|
|
271
|
+
- `auditResult.passed` / `failed` / `skipped`
|
|
272
|
+
- `auditResult.topNextActions`
|
|
273
|
+
- `auditResult.layerSummary.*.failed`
|
|
274
|
+
|
|
275
|
+
This keeps the governance pipeline stable while still surfacing the
|
|
276
|
+
agent-config <-> codebase red flags documented in [docs/shallow-risk.md](shallow-risk.md).
|
|
277
|
+
|
|
278
|
+
**Surfaces.** The `layer` field appears in:
|
|
279
|
+
|
|
280
|
+
- `auditResult.results[].layer` (JSON)
|
|
281
|
+
- `auditResult.topNextActions[].layer` (JSON)
|
|
282
|
+
- `auditResult.layerSummary` (JSON) — per-layer `{ total, passed, failed, skipped }`
|
|
283
|
+
- CSV output — column between `category` and `rating`
|
|
284
|
+
- JUnit output — attribute on each `<testcase layer="…">`
|
|
285
|
+
- Markdown output — column in the failed-checks table plus a `_layer: X_` suffix on each top-action checklist item
|
|
286
|
+
- Text output — "Coverage by layer:" summary block and a small `[layer]` prefix on failed-check names
|
|
287
|
+
|