@nerviq/cli 1.27.0 → 1.29.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 (45) hide show
  1. package/CHANGELOG.md +1493 -0
  2. package/README.md +2 -2
  3. package/SECURITY.md +82 -0
  4. package/contracts/audit-webhook-event.schema.json +138 -0
  5. package/contracts/pack-contract.schema.json +15 -0
  6. package/contracts/technique-contract.schema.json +18 -0
  7. package/docs/ARCHITECTURE.md +74 -0
  8. package/docs/api-reference.md +356 -0
  9. package/docs/autofix.md +64 -0
  10. package/docs/bitbucket-pipe.yml +57 -0
  11. package/docs/case-studies.md +149 -0
  12. package/docs/category-definition-kit.md +56 -0
  13. package/docs/ci-integration.md +127 -0
  14. package/docs/claude-code-style.md +24 -0
  15. package/docs/claude-maintainer-ops.md +19 -0
  16. package/docs/external-validation.md +78 -0
  17. package/docs/first-tier-integration-gate.md +59 -0
  18. package/docs/getting-started.md +119 -0
  19. package/docs/gitlab-ci-template.yml +54 -0
  20. package/docs/index.html +597 -0
  21. package/docs/integration-contracts.md +287 -0
  22. package/docs/license-faq.md +53 -0
  23. package/docs/maintenance.md +155 -0
  24. package/docs/methodology.md +236 -0
  25. package/docs/new-platform-guide.md +202 -0
  26. package/docs/open-vsx-publishing.md +46 -0
  27. package/docs/platform-change-ingestion.md +46 -0
  28. package/docs/plugins.md +101 -0
  29. package/docs/pre-commit.md +58 -0
  30. package/docs/security-model.md +63 -0
  31. package/docs/shallow-risk.md +246 -0
  32. package/docs/versioning-policy.md +63 -0
  33. package/docs/why-nerviq.md +82 -0
  34. package/package.json +7 -2
  35. package/sdk/README.md +190 -0
  36. package/src/codex/setup.js +3 -2
  37. package/src/gemini/setup.js +3 -2
  38. package/src/init.js +4 -3
  39. package/src/opencode/context.js +42 -3
  40. package/src/opencode/techniques.js +198 -142
  41. package/src/output-icons.js +44 -0
  42. package/src/setup/runtime.js +6 -5
  43. package/src/setup.js +4 -3
  44. package/src/shallow-risk/patterns/agent-config-missing-file.js +254 -9
  45. package/src/shallow-risk/shared.js +135 -7
package/README.md CHANGED
@@ -234,8 +234,8 @@ All successful operational responses are wrapped in a JSON envelope:
234
234
  {
235
235
  "data": {},
236
236
  "meta": {
237
- "version": "1.27.0",
238
- "timestamp": "2026-04-15T18:00:00.000Z"
237
+ "version": "1.29.0",
238
+ "timestamp": "2026-04-16T08:00:00.000Z"
239
239
  }
240
240
  }
241
241
  ```
package/SECURITY.md ADDED
@@ -0,0 +1,82 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ If you discover a security vulnerability in Nerviq, please report it responsibly.
6
+
7
+ **Email:** [business@nerviq.net](mailto:business@nerviq.net) (subject: SECURITY)
8
+
9
+ Please include:
10
+
11
+ - Description of the vulnerability
12
+ - Steps to reproduce
13
+ - Affected version(s)
14
+ - Impact assessment (if known)
15
+
16
+ **Do not** open a public GitHub issue for security vulnerabilities.
17
+
18
+ ## Response SLA
19
+
20
+ | Severity | Response Time | Fix Timeline |
21
+ |----------|--------------|--------------|
22
+ | **Critical** (RCE, data exfiltration) | < 24 hours | < 48 hours |
23
+ | **High** (privilege escalation, auth bypass) | < 48 hours | < 7 days |
24
+ | **Medium** (information disclosure, DoS) | < 7 days | < 30 days |
25
+ | **Low** (minor issues, hardening) | < 14 days | Next release |
26
+
27
+ ## Supported Versions
28
+
29
+ | Version | Supported |
30
+ |---------|-----------|
31
+ | 1.29.x | Yes |
32
+ | 1.28.x | Yes |
33
+ | 1.27.x | Yes |
34
+ | 1.26.x | Yes |
35
+ | < 1.26 | No |
36
+ | < 1.29 | No |
37
+
38
+ Only the latest patch release of each supported major.minor line receives security updates.
39
+
40
+ ## Dependency Policy
41
+
42
+ - **Zero runtime dependencies.** Nerviq ships with no production `node_modules` — only Node.js (>=18) is required.
43
+ - **devDependencies audited monthly** using `npm audit` and reviewed for known CVEs.
44
+ - **SBOM published** with every release (`sbom.cdx.json`) in CycloneDX format for full dependency transparency.
45
+ - **Lockfile integrity** checked in CI to prevent supply-chain tampering.
46
+ - **npm provenance attestation** — every release published via the GitHub Actions release workflow is signed with an npm provenance attestation (`npm publish --provenance`). This cryptographically links the published package to a specific GitHub Actions run, repository, and commit. Consumers can verify the attestation with `npm audit signatures @nerviq/cli`.
47
+
48
+ ## Security Architecture
49
+
50
+ - All operations run **locally** — no data is sent to external servers by default.
51
+ - The `nerviq serve` command binds to **localhost only** (127.0.0.1), never to 0.0.0.0.
52
+ - `deep-review` (opt-in) redacts secrets and credentials before sending config snippets to any AI provider.
53
+ - No secrets, tokens, or API keys are stored by Nerviq.
54
+
55
+ ## Reporting False Positives in Checks
56
+
57
+ If a Nerviq audit check produces a false positive (flags something that is not actually a problem):
58
+
59
+ 1. Run `nerviq audit --verbose` to identify the exact check key (e.g., `permissionDeny`).
60
+ 2. Open a GitHub issue with:
61
+ - The check key
62
+ - Your project structure (relevant files only)
63
+ - Why you believe it is a false positive
64
+ 3. Alternatively, use `nerviq feedback --key <checkKey> --status rejected --effect neutral --notes "false positive: <reason>"` to record it locally.
65
+
66
+ False positive reports help us improve check accuracy for all users.
67
+
68
+ ## Acknowledgments
69
+
70
+ We gratefully acknowledge security researchers who responsibly disclose vulnerabilities. With your permission, we will list you in our security acknowledgments.
71
+
72
+ ## Internal Response Process
73
+
74
+ When a vulnerability report arrives:
75
+
76
+ 1. **Acknowledge** — Reply within the SLA above confirming receipt
77
+ 2. **Triage** — Classify severity (Critical/High/Medium/Low), assign to founder
78
+ 3. **Reproduce** — Verify the vulnerability exists in the latest supported version
79
+ 4. **Fix** — Develop fix on a private branch, add regression test
80
+ 5. **Release** — Publish patched version to npm, tag in GitHub
81
+ 6. **Disclose** — Notify reporter, update CHANGELOG.md with security tag, credit reporter if permitted
82
+ 7. **Post-mortem** — For Critical/High: document root cause and prevention measures in `research/`
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://nerviq.net/contracts/audit-webhook-event.schema.json",
4
+ "title": "Nerviq Audit Webhook Event",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "event",
9
+ "schemaVersion",
10
+ "generatedAt",
11
+ "platform",
12
+ "score",
13
+ "passed",
14
+ "failed",
15
+ "results",
16
+ "data",
17
+ "meta"
18
+ ],
19
+ "properties": {
20
+ "event": {
21
+ "const": "nerviq.audit.completed"
22
+ },
23
+ "schemaVersion": {
24
+ "type": "string",
25
+ "const": "1.0"
26
+ },
27
+ "generatedAt": {
28
+ "type": "string",
29
+ "format": "date-time"
30
+ },
31
+ "platform": {
32
+ "type": "string"
33
+ },
34
+ "score": {
35
+ "type": "number"
36
+ },
37
+ "passed": {
38
+ "type": "integer"
39
+ },
40
+ "failed": {
41
+ "type": "integer"
42
+ },
43
+ "results": {
44
+ "type": "array"
45
+ },
46
+ "data": {
47
+ "type": "object",
48
+ "additionalProperties": true,
49
+ "required": [
50
+ "platform",
51
+ "score",
52
+ "scoreType",
53
+ "passed",
54
+ "failed",
55
+ "checkCount",
56
+ "topNextActions",
57
+ "quickWins",
58
+ "scoreCoaching"
59
+ ],
60
+ "properties": {
61
+ "platform": {
62
+ "type": "string"
63
+ },
64
+ "platformLabel": {
65
+ "type": [
66
+ "string",
67
+ "null"
68
+ ]
69
+ },
70
+ "score": {
71
+ "type": "number"
72
+ },
73
+ "scoreType": {
74
+ "type": "string"
75
+ },
76
+ "organicScore": {
77
+ "type": [
78
+ "number",
79
+ "null"
80
+ ]
81
+ },
82
+ "passed": {
83
+ "type": "integer"
84
+ },
85
+ "failed": {
86
+ "type": "integer"
87
+ },
88
+ "skipped": {
89
+ "type": [
90
+ "integer",
91
+ "null"
92
+ ]
93
+ },
94
+ "checkCount": {
95
+ "type": "integer"
96
+ },
97
+ "topNextActions": {
98
+ "type": "array"
99
+ },
100
+ "quickWins": {
101
+ "type": "array"
102
+ },
103
+ "scoreCoaching": {
104
+ "type": [
105
+ "object",
106
+ "null"
107
+ ]
108
+ },
109
+ "suggestedNextCommand": {
110
+ "type": [
111
+ "string",
112
+ "null"
113
+ ]
114
+ }
115
+ }
116
+ },
117
+ "meta": {
118
+ "type": "object",
119
+ "additionalProperties": true,
120
+ "required": [
121
+ "cliVersion",
122
+ "source",
123
+ "webhookFormat"
124
+ ],
125
+ "properties": {
126
+ "cliVersion": {
127
+ "type": "string"
128
+ },
129
+ "source": {
130
+ "const": "nerviq-cli"
131
+ },
132
+ "webhookFormat": {
133
+ "const": "generic-audit-event"
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Nerviq Domain/MCP Pack",
4
+ "type": "object",
5
+ "required": ["key", "label"],
6
+ "properties": {
7
+ "key": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
8
+ "label": { "type": "string" },
9
+ "description": { "type": "string" },
10
+ "useWhen": { "type": "string" },
11
+ "adoption": { "type": "string" },
12
+ "recommendedModules": { "type": "array", "items": { "type": "string" } },
13
+ "benchmarkFocus": { "type": "array", "items": { "type": "string" } }
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Nerviq Technique",
4
+ "type": "object",
5
+ "required": ["id", "name", "check", "impact", "category", "fix"],
6
+ "properties": {
7
+ "id": { "type": ["string", "integer"] },
8
+ "name": { "type": "string", "minLength": 3 },
9
+ "check": { "description": "Function (ctx) => boolean|null" },
10
+ "impact": { "type": "string", "enum": ["critical", "high", "medium", "low"] },
11
+ "category": { "type": "string", "minLength": 2 },
12
+ "fix": { "type": "string", "minLength": 5 },
13
+ "rating": { "type": "integer", "minimum": 1, "maximum": 5 },
14
+ "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
15
+ "sourceUrl": { "type": "string", "format": "uri" },
16
+ "template": {}
17
+ }
18
+ }
@@ -0,0 +1,74 @@
1
+ # Architecture
2
+
3
+ ## Data Flow
4
+
5
+ ```mermaid
6
+ graph LR
7
+ CLI[bin/cli.js] --> Audit[audit.js]
8
+ CLI --> Setup[setup.js]
9
+ CLI --> Analyze[analyze.js]
10
+ CLI --> Plans[plans.js]
11
+ CLI --> Gov[governance.js]
12
+ CLI --> Bench[benchmark.js]
13
+
14
+ Context[context.js] --> Audit
15
+ Context --> Setup
16
+ Context --> Analyze
17
+
18
+ Techniques[techniques.js<br/>84 checks + 30 stacks] --> Audit
19
+ Techniques --> Setup
20
+
21
+ DomainPacks[domain-packs.js<br/>16 domains] --> Analyze
22
+ DomainPacks --> Gov
23
+
24
+ McpPacks[mcp-packs.js<br/>26 MCP packs] --> Analyze
25
+ McpPacks --> Gov
26
+ McpPacks --> Plans
27
+
28
+ Audit --> Activity[activity.js<br/>snapshots + history]
29
+ Bench --> Activity
30
+ Analyze --> Activity
31
+ ```
32
+
33
+ ## Module Responsibilities
34
+
35
+ | Module | Role | I/O |
36
+ |--------|------|-----|
37
+ | **context.js** | Scans project directory, caches file reads | Dir path → ProjectContext |
38
+ | **techniques.js** | Defines 84 checks + 30 stacks. The knowledge base | ProjectContext → check results |
39
+ | **audit.js** | Runs checks, calculates score, builds topNextActions | Options → scored result |
40
+ | **analyze.js** | Augment/suggest-only analysis with strengths, gaps, domains | Options → analysis report |
41
+ | **plans.js** | Generates proposal bundles, applies with rollback | Audit result → proposals |
42
+ | **setup.js** | Generates CLAUDE.md, hooks, commands, agents, skills, rules | Stacks + context → files |
43
+ | **governance.js** | Permission profiles, hook registry, policy packs | Config → governance summary |
44
+ | **benchmark.js** | Isolated before/after in temp copy | Options → benchmark report |
45
+ | **domain-packs.js** | Detects repo type from signals | Context + stacks → domain matches |
46
+ | **mcp-packs.js** | Recommends MCP servers per domain | Domains + signals → MCP packs |
47
+ | **activity.js** | Snapshots, history, compare, trend export | Payloads → artifact files |
48
+
49
+ ## Scoring
50
+
51
+ ```
52
+ Score = (earned / max) * 100
53
+
54
+ Weights: critical=15, high=10, medium=5, low=2
55
+ Organic score: excludes checks that nerviq itself generated
56
+ ```
57
+
58
+ Checks return `true` (pass), `false` (fail), or `null` (not applicable / skip).
59
+
60
+ ## Trust-First Flow
61
+
62
+ ```
63
+ User runs audit → sees score + gaps
64
+
65
+ User runs plan → sees file previews + rationale
66
+
67
+ User reviews → approves specific bundles
68
+
69
+ apply writes files → rollback manifest created
70
+
71
+ User runs audit again → sees improvement
72
+ ```
73
+
74
+ No step writes without the previous step's output being reviewed.