@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
@@ -0,0 +1,109 @@
1
+ # Audit Autofix with `nerviq audit --fix`
2
+
3
+ `nerviq audit --fix` is the safe autofix lane for deterministic governance and hygiene issues.
4
+
5
+ It is intentionally conservative:
6
+
7
+ - Dry-run is the default.
8
+ - Nerviq writes a unified diff patch to `audit-fix.patch` unless you redirect it with `--out`.
9
+ - Only deterministic, file-level fixes are planned.
10
+ - Anything that still needs repo judgment is listed as advisory-only and left untouched.
11
+
12
+ ## Command surface
13
+
14
+ ```bash
15
+ nerviq audit --fix
16
+ nerviq audit --fix --out custom-audit-fix.patch
17
+ nerviq audit --fix --out -
18
+ nerviq audit --fix --apply --auto
19
+ nerviq audit --fix --pr
20
+ ```
21
+
22
+ - `nerviq audit --fix`
23
+ Runs the audit, builds a deterministic autofix plan, prints a `git status --short` style summary, and writes `audit-fix.patch`.
24
+
25
+ - `nerviq audit --fix --out custom-audit-fix.patch`
26
+ Writes the patch to a custom file path relative to the audited repo.
27
+
28
+ - `nerviq audit --fix --out -`
29
+ Prints the unified diff to stdout instead of creating a patch file.
30
+
31
+ - `nerviq audit --fix --apply --auto`
32
+ Applies the deterministic fixes, writes a rollback manifest under `.nerviq/rollbacks/`, and re-runs the audit.
33
+
34
+ - `nerviq audit --fix --pr`
35
+ Applies the same deterministic fixes, creates a local branch named `nerviq/autofix-<timestamp>`, stages the changed files plus the patch, and leaves the review to the user.
36
+
37
+ ## Hard safety boundaries
38
+
39
+ Audit autofix never modifies source code.
40
+
41
+ The path allowlist is intentionally narrow:
42
+
43
+ - `CLAUDE.md`
44
+ - `.claude/CLAUDE.md`
45
+ - `AGENTS.md`
46
+ - `.codex/AGENTS.md`
47
+ - `.claude/settings.json`
48
+ - `.gitignore`
49
+ - `.editorconfig`
50
+ - `CHANGELOG.md`
51
+ - `CONTRIBUTING.md`
52
+ - `LICENSE`
53
+
54
+ If a planned change falls outside that list, Nerviq skips it.
55
+
56
+ Files that contain the literal `DO NOT AUTOEDIT` marker are also skipped.
57
+
58
+ ## What is considered deterministic
59
+
60
+ Examples of safe, deterministic fixes in this lane:
61
+
62
+ - create `CLAUDE.md` or `AGENTS.md` boilerplate when the instruction file is missing
63
+ - add canonical verification commands to an existing instruction file
64
+ - create `.claude/settings.json` with deny rules that protect `.env` and secret-like paths
65
+ - add `.env`, `.env.*`, and local override files to `.gitignore`
66
+ - create `.editorconfig`, `CHANGELOG.md`, `CONTRIBUTING.md`, or `LICENSE` placeholders
67
+
68
+ Examples that stay advisory-only:
69
+
70
+ - anything that changes product code
71
+ - fixes that need a repo-specific architecture decision
72
+ - hooks, commands, or permission policies that require team judgment
73
+ - content changes where Nerviq cannot prove a safe template
74
+
75
+ ## Evidence model
76
+
77
+ Every proposed change is linked to file-level evidence:
78
+
79
+ - existing findings use the audit result's `file:line` evidence when available
80
+ - missing-file fixes fall back to the target file at line `1`
81
+
82
+ This keeps the autofix plan aligned with the CTO-04 file-evidence contract.
83
+
84
+ ## Output contract
85
+
86
+ The dry-run summary shows one line per planned file operation:
87
+
88
+ ```text
89
+ A CLAUDE.md (CLAUDE.md:1) [claudeMd, verificationLoop]
90
+ M .gitignore (.gitignore:1) [gitIgnoreEnv]
91
+ A .claude/settings.json (.claude/settings.json:1) [secretsProtection]
92
+ ```
93
+
94
+ - `A` means a new file will be created.
95
+ - `M` means an existing file will be patched.
96
+ - The `(file:line)` segment shows the evidence or insertion anchor.
97
+ - The bracketed list shows which failed checks the operation addresses.
98
+
99
+ ## Exit codes
100
+
101
+ - `0` plan generated successfully, or apply completed and the targeted deterministic checks now pass
102
+ - `1` apply attempted but at least one targeted deterministic check still failed after re-audit
103
+ - `2` no deterministic audit autofixes are available, or the flag combination is invalid
104
+
105
+ ## Notes
106
+
107
+ - `--apply` requires `--auto`. The dry-run path is the safe default.
108
+ - `--pr` implies the apply path and requires a git repository.
109
+ - Audit autofix is not a substitute for a full review. It handles the obvious, localized file work and leaves judgment-heavy items as advisories.
package/docs/autofix.md CHANGED
@@ -1,64 +1,5 @@
1
- # Autofix with `nerviq audit --fix`
1
+ # Autofix docs moved
2
2
 
3
- `nerviq audit --fix` runs the normal audit, applies the fixable critical recommendations that are in scope for autofix, and then re-audits the repo.
3
+ The current `audit --fix` contract lives in [`docs/audit-fix.md`](audit-fix.md).
4
4
 
5
- ## Command surface
6
-
7
- ```bash
8
- nerviq audit --fix
9
- nerviq audit --fix --auto
10
- nerviq audit --fix --dry-run
11
- ```
12
-
13
- - `nerviq audit --fix`
14
- Uses the conservative default flow. Nerviq plans the critical fixes, shows the file diff, and asks for confirmation per file before writing.
15
-
16
- - `nerviq audit --fix --auto`
17
- Applies the same critical fixes without prompts. This is the intended mode for CI or scripted remediation.
18
-
19
- - `nerviq audit --fix --dry-run`
20
- Shows the proposed diff and exits without writing files.
21
-
22
- ## What v1 fixes
23
-
24
- This first pass focuses on instruction-surface remediation:
25
-
26
- - Missing `CLAUDE.md` baseline instructions.
27
- - Missing verification guidance for critical audit checks.
28
- - Hygiene templates that can be created safely (`LICENSE`, `CHANGELOG.md`, `CONTRIBUTING.md`) through the shared fix engine.
29
-
30
- Autofix deliberately does **not** rewrite security, hooks, or permission-sensitive findings in this release.
31
-
32
- ## Safety model
33
-
34
- - Dry-run stays dry: no file writes and no rollback artifacts.
35
- - Files that contain the literal `DO NOT AUTOEDIT` marker are skipped.
36
- - `audit --fix` only targets fixable **critical** findings in this release.
37
- - A rollback manifest is written to `.nerviq/rollbacks/` after successful writes.
38
- - Nerviq re-audits after applying fixes and exits with a non-zero status if the targeted checks still fail.
39
-
40
- ## Exit codes
41
-
42
- - `0`: all targeted fixes applied and the targeted checks pass after re-audit
43
- - `1`: a targeted fix failed, was skipped for safety, or still fails after re-audit
44
- - `2`: bad flag combination or no fixable critical findings are available
45
-
46
- ## Examples
47
-
48
- Preview the exact patch without touching the working tree:
49
-
50
- ```bash
51
- nerviq audit --fix --dry-run
52
- ```
53
-
54
- Apply fixable critical items in CI:
55
-
56
- ```bash
57
- nerviq audit --fix --auto
58
- ```
59
-
60
- Apply with per-file confirmation in an interactive terminal:
61
-
62
- ```bash
63
- nerviq audit --fix
64
- ```
5
+ This legacy path stays here so older links do not break.
@@ -110,7 +110,7 @@ Once the six-step path makes sense, then go deeper:
110
110
 
111
111
  If you want a public inspectable example, see:
112
112
 
113
- - [DnaFin/nerviq-multi-agent-before-after](https://github.com/DnaFin/nerviq-multi-agent-before-after)
113
+ - [nerviq/nerviq-multi-agent-before-after](https://github.com/nerviq/nerviq-multi-agent-before-after)
114
114
 
115
115
  ## Need help?
116
116