@nerviq/cli 1.29.0 → 1.30.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 (93) hide show
  1. package/CHANGELOG.md +1764 -1493
  2. package/README.md +568 -538
  3. package/SECURITY.md +78 -82
  4. package/bin/cli.js +2838 -2558
  5. package/docs/api-reference.md +356 -356
  6. package/docs/audit-fix.md +109 -0
  7. package/docs/autofix.md +3 -62
  8. package/docs/getting-started.md +1 -1
  9. package/docs/index.html +592 -592
  10. package/docs/integration-contracts.md +287 -287
  11. package/docs/maintenance.md +128 -128
  12. package/docs/new-platform-guide.md +202 -202
  13. package/docs/release-process.md +63 -0
  14. package/docs/shallow-risk.md +244 -244
  15. package/docs/why-nerviq.md +82 -82
  16. package/package.json +75 -67
  17. package/sdk/README.md +12 -3
  18. package/sdk/examples/langchain-integration.md +128 -0
  19. package/sdk/examples/self-governing-agent.js +135 -0
  20. package/sdk/index.d.ts +115 -0
  21. package/sdk/index.js +94 -0
  22. package/sdk/package.json +11 -0
  23. package/src/activity.js +13 -0
  24. package/src/aider/activity.js +226 -226
  25. package/src/aider/context.js +162 -162
  26. package/src/aider/freshness.js +123 -123
  27. package/src/aider/techniques.js +3465 -3465
  28. package/src/audit/layers.js +180 -180
  29. package/src/audit.js +1133 -1032
  30. package/src/auto-suggest.js +9 -2
  31. package/src/behavioral-drift.js +37 -2
  32. package/src/benchmark.js +299 -299
  33. package/src/codex/activity.js +324 -324
  34. package/src/codex/freshness.js +149 -142
  35. package/src/codex/techniques.js +4895 -4895
  36. package/src/context.js +326 -326
  37. package/src/continuous-ops.js +11 -1
  38. package/src/convert.js +340 -340
  39. package/src/copilot/config-parser.js +280 -280
  40. package/src/copilot/context.js +218 -218
  41. package/src/copilot/freshness.js +184 -177
  42. package/src/copilot/patch.js +238 -238
  43. package/src/copilot/techniques.js +3578 -3578
  44. package/src/cursor/freshness.js +194 -194
  45. package/src/cursor/patch.js +243 -243
  46. package/src/cursor/techniques.js +3735 -3735
  47. package/src/doctor.js +201 -201
  48. package/src/fix-engine.js +511 -8
  49. package/src/formatters/csv.js +86 -86
  50. package/src/formatters/junit.js +123 -123
  51. package/src/formatters/markdown.js +164 -164
  52. package/src/formatters/otel.js +151 -151
  53. package/src/freshness.js +163 -156
  54. package/src/gemini/activity.js +402 -402
  55. package/src/gemini/context.js +290 -290
  56. package/src/gemini/freshness.js +188 -188
  57. package/src/gemini/patch.js +229 -229
  58. package/src/gemini/techniques.js +3811 -3811
  59. package/src/governance.js +533 -533
  60. package/src/harmony/audit.js +306 -306
  61. package/src/i18n.js +63 -63
  62. package/src/insights.js +119 -119
  63. package/src/integrations.js +134 -134
  64. package/src/locales/en.json +33 -33
  65. package/src/locales/es.json +33 -33
  66. package/src/migrate.js +354 -354
  67. package/src/opencode/activity.js +286 -286
  68. package/src/opencode/freshness.js +137 -137
  69. package/src/opencode/techniques.js +3450 -3450
  70. package/src/safe-glyph.js +97 -0
  71. package/src/setup/analysis.js +12 -12
  72. package/src/setup.js +13 -6
  73. package/src/shallow-risk/index.js +113 -56
  74. package/src/shallow-risk/patterns/agent-config-cross-platform-drift.js +51 -50
  75. package/src/shallow-risk/patterns/agent-config-dangerous-autoapprove.js +47 -46
  76. package/src/shallow-risk/patterns/agent-config-deprecated-keys.js +47 -46
  77. package/src/shallow-risk/patterns/agent-config-framework-version-mismatch.js +138 -0
  78. package/src/shallow-risk/patterns/agent-config-missing-file.js +318 -317
  79. package/src/shallow-risk/patterns/agent-config-script-not-in-package-json.js +108 -0
  80. package/src/shallow-risk/patterns/agent-config-secret-literal.js +52 -49
  81. package/src/shallow-risk/patterns/agent-config-stack-contradiction.js +35 -34
  82. package/src/shallow-risk/patterns/hook-script-missing.js +71 -70
  83. package/src/shallow-risk/patterns/mcp-server-no-allowlist.js +53 -52
  84. package/src/shallow-risk/shared.js +653 -648
  85. package/src/source-urls.js +295 -295
  86. package/src/state-paths.js +85 -85
  87. package/src/supplemental-checks.js +805 -805
  88. package/src/telemetry.js +160 -160
  89. package/src/watch.js +46 -0
  90. package/src/windsurf/context.js +359 -359
  91. package/src/windsurf/freshness.js +194 -194
  92. package/src/windsurf/patch.js +231 -231
  93. package/src/windsurf/techniques.js +3779 -3779
@@ -1,9 +1,9 @@
1
- # Knowledge Maintenance Process
2
-
3
- How to keep Nerviq's knowledge base accurate, current, and trustworthy.
4
-
5
- ## Maintenance Cadences
6
-
1
+ # Knowledge Maintenance Process
2
+
3
+ How to keep Nerviq's knowledge base accurate, current, and trustworthy.
4
+
5
+ ## Maintenance Cadences
6
+
7
7
  ### Daily: Freshness Daemon
8
8
 
9
9
  The freshness system runs automatically and flags checks whose source documentation may have changed.
@@ -17,9 +17,9 @@ The freshness system runs automatically and flags checks whose source documentat
17
17
  - Review `nerviq doctor` output for broken MCP declarations (missing commands, unreachable URLs, missing env vars)
18
18
  - Review `nerviq doctor` output for broken hook runtime health (missing scripts, missing runtimes, or starter hook regressions)
19
19
  - Review `.claude/logs/prompt-injection-alerts.log` if the starter `injection-defense` hook reports suspicious external-content patterns during normal development
20
- - If a check's `sourceUrl` returns 404 or has changed significantly, mark for review
21
- - Update `confidence` values for any checks with degraded sources
22
-
20
+ - If a check's `sourceUrl` returns 404 or has changed significantly, mark for review
21
+ - Update `confidence` values for any checks with degraded sources
22
+
23
23
  **Automation:**
24
24
  ```bash
25
25
  npx @nerviq/cli doctor --verbose # Shows freshness gates + MCP + hook runtime validation
@@ -32,124 +32,124 @@ const { getPlatformChangeManifest, summarizePlatformChangeManifest } = require('
32
32
  console.log(summarizePlatformChangeManifest());
33
33
  console.log(getPlatformChangeManifest()[0].trackedSources);
34
34
  ```
35
-
36
- ### Weekly: Platform Changelog Review
37
-
38
- Each supported platform publishes updates that may affect Nerviq's checks.
39
-
40
- **Process:**
41
- 1. Check official changelogs/release notes for all 8 platforms:
42
- - Claude Code: Anthropic changelog
43
- - Codex: OpenAI platform updates
44
- - Gemini CLI: Google AI Studio releases
45
- - GitHub Copilot: GitHub blog/changelog
46
- - Cursor: Cursor changelog
47
- - Windsurf: Codeium/Windsurf releases
48
- - Aider: GitHub releases
49
- - OpenCode: GitHub releases
50
-
51
- 2. For each relevant change:
52
- - Does it add a new config option? → Candidate for new check
53
- - Does it deprecate a feature? → Update or retire affected checks
54
- - Does it change file formats? → Update config-parser.js
55
-
35
+
36
+ ### Weekly: Platform Changelog Review
37
+
38
+ Each supported platform publishes updates that may affect Nerviq's checks.
39
+
40
+ **Process:**
41
+ 1. Check official changelogs/release notes for all 8 platforms:
42
+ - Claude Code: Anthropic changelog
43
+ - Codex: OpenAI platform updates
44
+ - Gemini CLI: Google AI Studio releases
45
+ - GitHub Copilot: GitHub blog/changelog
46
+ - Cursor: Cursor changelog
47
+ - Windsurf: Codeium/Windsurf releases
48
+ - Aider: GitHub releases
49
+ - OpenCode: GitHub releases
50
+
51
+ 2. For each relevant change:
52
+ - Does it add a new config option? → Candidate for new check
53
+ - Does it deprecate a feature? → Update or retire affected checks
54
+ - Does it change file formats? → Update config-parser.js
55
+
56
56
  3. Log findings in `research/` with date stamp
57
57
  4. If the change affects rollout posture or config semantics, update `src/platform-change-manifest.js` so cadence + triggers stay aligned with reality
58
-
59
- ### Monthly: Cross-Reference Audit
60
-
61
- Verify internal consistency across the knowledge base.
62
-
63
- **Process:**
64
- 1. Run the cross-reference audit:
65
- ```bash
66
- # From the NERVIQ research repo
67
- python tools/check-trust-drift.py
68
- ```
69
-
70
- 2. Check for:
71
- - Duplicate check IDs across platforms
72
- - Checks with confidence below 0.7 (candidates for re-verification)
73
- - Techniques referenced in research but missing from code
74
- - Techniques in code with no corresponding research doc
75
-
76
- 3. Reconcile any mismatches:
77
- - Update source URLs that have moved
78
- - Re-verify claims that have contradicting evidence
79
- - Remove techniques that are no longer applicable
80
-
81
- ### Quarterly: Pruning
82
-
83
- Remove or archive knowledge that is no longer relevant.
84
-
85
- **Process:**
86
- 1. Query all checks by `lastVerified` date
87
- 2. Identify checks not verified in 90+ days
88
- 3. For each stale check:
89
- - **Re-verify**: Visit sourceUrl, test the check, update confidence
90
- - **Archive**: If the feature no longer exists, move to `_archived/`
91
- - **Retire**: If the platform deprecated the feature, remove the check and note in CHANGELOG
92
-
93
- 4. Review research documents older than 90 days:
94
- - Still accurate? → Update `lastVerified` date
95
- - Outdated? → Mark as `status: archived` in frontmatter
96
- - Contradicted by newer findings? → Create superseding document
97
-
98
- 5. Audit experiment results:
99
- - Re-run 5 random experiments to confirm results still hold
100
- - Update ratings if behavior has changed
101
-
102
- ## The 90-Day Rule
103
-
104
- Every piece of knowledge in Nerviq has a maximum freshness window of 90 days.
105
-
106
- **What this means:**
107
- - After 90 days without re-verification, a check's confidence is automatically degraded
108
- - Research documents older than 90 days without updates are flagged in `nerviq doctor`
109
- - Stale checks are not removed automatically but are surfaced in audit output with warnings
110
-
111
- **How to handle stale checks:**
112
-
113
- 1. **Check still valid, source unchanged:**
114
- Update `lastVerified` timestamp. No code change needed.
115
-
116
- 2. **Check valid but source URL changed:**
117
- Update `sourceUrl` in the technique definition. Update `lastVerified`.
118
-
119
- 3. **Check partially valid — behavior changed:**
120
- Update the check function, fix text, confidence level. Create a research note documenting the change.
121
-
122
- 4. **Check no longer valid — feature removed:**
123
- Remove from `techniques.js`. Add entry to CHANGELOG. If other checks depend on it, update those too.
124
-
125
- 5. **Check cannot be verified — source unavailable:**
126
- Lower confidence to 0.5. Add a `TODO` comment. Flag for next weekly review.
127
-
128
- ## Freshness Tracking Fields
129
-
130
- Each technique in Nerviq supports these freshness-related fields:
131
-
132
- | Field | Type | Purpose |
133
- |-------|------|---------|
134
- | `sourceUrl` | string | Primary documentation URL |
135
- | `confidence` | number (0.0-1.0) | How confident we are the check is correct |
136
- | `lastVerified` | ISO date string | When the check was last manually verified |
137
- | `addedVersion` | string | Nerviq version when the check was added |
138
-
139
- ## Emergency Updates
140
-
141
- When a platform ships a breaking change:
142
-
143
- 1. Create a research doc immediately: `research/{platform}-breaking-change-YYYY-MM-DD.md`
144
- 2. Update affected techniques in the same session
145
- 3. Run full check matrix: `node test/{platform}-check-matrix.js`
146
- 4. Run golden matrix to detect output changes: `node test/{platform}-golden-matrix.js`
147
- 5. Publish patch release if checks produce incorrect results
148
-
149
- ## Metrics to Track
150
-
151
- - **Freshness coverage**: % of checks verified within 90 days
152
- - **Confidence distribution**: histogram of confidence values across all checks
153
- - **Stale check count**: number of checks past 90-day window
154
- - **Source availability**: % of sourceUrls returning 200
155
- - **Platform coverage**: checks per platform (target: balanced distribution)
58
+
59
+ ### Monthly: Cross-Reference Audit
60
+
61
+ Verify internal consistency across the knowledge base.
62
+
63
+ **Process:**
64
+ 1. Run the cross-reference audit:
65
+ ```bash
66
+ # From the NERVIQ research repo
67
+ python tools/check-trust-drift.py
68
+ ```
69
+
70
+ 2. Check for:
71
+ - Duplicate check IDs across platforms
72
+ - Checks with confidence below 0.7 (candidates for re-verification)
73
+ - Techniques referenced in research but missing from code
74
+ - Techniques in code with no corresponding research doc
75
+
76
+ 3. Reconcile any mismatches:
77
+ - Update source URLs that have moved
78
+ - Re-verify claims that have contradicting evidence
79
+ - Remove techniques that are no longer applicable
80
+
81
+ ### Quarterly: Pruning
82
+
83
+ Remove or archive knowledge that is no longer relevant.
84
+
85
+ **Process:**
86
+ 1. Query all checks by `lastVerified` date
87
+ 2. Identify checks not verified in 90+ days
88
+ 3. For each stale check:
89
+ - **Re-verify**: Visit sourceUrl, test the check, update confidence
90
+ - **Archive**: If the feature no longer exists, move to `_archived/`
91
+ - **Retire**: If the platform deprecated the feature, remove the check and note in CHANGELOG
92
+
93
+ 4. Review research documents older than 90 days:
94
+ - Still accurate? → Update `lastVerified` date
95
+ - Outdated? → Mark as `status: archived` in frontmatter
96
+ - Contradicted by newer findings? → Create superseding document
97
+
98
+ 5. Audit experiment results:
99
+ - Re-run 5 random experiments to confirm results still hold
100
+ - Update ratings if behavior has changed
101
+
102
+ ## The 90-Day Rule
103
+
104
+ Every piece of knowledge in Nerviq has a maximum freshness window of 90 days.
105
+
106
+ **What this means:**
107
+ - After 90 days without re-verification, a check's confidence is automatically degraded
108
+ - Research documents older than 90 days without updates are flagged in `nerviq doctor`
109
+ - Stale checks are not removed automatically but are surfaced in audit output with warnings
110
+
111
+ **How to handle stale checks:**
112
+
113
+ 1. **Check still valid, source unchanged:**
114
+ Update `lastVerified` timestamp. No code change needed.
115
+
116
+ 2. **Check valid but source URL changed:**
117
+ Update `sourceUrl` in the technique definition. Update `lastVerified`.
118
+
119
+ 3. **Check partially valid — behavior changed:**
120
+ Update the check function, fix text, confidence level. Create a research note documenting the change.
121
+
122
+ 4. **Check no longer valid — feature removed:**
123
+ Remove from `techniques.js`. Add entry to CHANGELOG. If other checks depend on it, update those too.
124
+
125
+ 5. **Check cannot be verified — source unavailable:**
126
+ Lower confidence to 0.5. Add a `TODO` comment. Flag for next weekly review.
127
+
128
+ ## Freshness Tracking Fields
129
+
130
+ Each technique in Nerviq supports these freshness-related fields:
131
+
132
+ | Field | Type | Purpose |
133
+ |-------|------|---------|
134
+ | `sourceUrl` | string | Primary documentation URL |
135
+ | `confidence` | number (0.0-1.0) | How confident we are the check is correct |
136
+ | `lastVerified` | ISO date string | When the check was last manually verified |
137
+ | `addedVersion` | string | Nerviq version when the check was added |
138
+
139
+ ## Emergency Updates
140
+
141
+ When a platform ships a breaking change:
142
+
143
+ 1. Create a research doc immediately: `research/{platform}-breaking-change-YYYY-MM-DD.md`
144
+ 2. Update affected techniques in the same session
145
+ 3. Run full check matrix: `node test/{platform}-check-matrix.js`
146
+ 4. Run golden matrix to detect output changes: `node test/{platform}-golden-matrix.js`
147
+ 5. Publish patch release if checks produce incorrect results
148
+
149
+ ## Metrics to Track
150
+
151
+ - **Freshness coverage**: % of checks verified within 90 days
152
+ - **Confidence distribution**: histogram of confidence values across all checks
153
+ - **Stale check count**: number of checks past 90-day window
154
+ - **Source availability**: % of sourceUrls returning 200
155
+ - **Platform coverage**: checks per platform (target: balanced distribution)