@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.
Files changed (80) hide show
  1. package/CHANGELOG.md +1527 -1493
  2. package/README.md +550 -538
  3. package/SECURITY.md +82 -82
  4. package/bin/cli.js +2562 -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 +67 -67
  17. package/src/aider/activity.js +226 -226
  18. package/src/aider/context.js +162 -162
  19. package/src/aider/freshness.js +123 -123
  20. package/src/aider/techniques.js +3465 -3465
  21. package/src/audit/layers.js +180 -180
  22. package/src/audit.js +1032 -1032
  23. package/src/benchmark.js +299 -299
  24. package/src/codex/activity.js +324 -324
  25. package/src/codex/freshness.js +142 -142
  26. package/src/codex/techniques.js +4895 -4895
  27. package/src/context.js +326 -326
  28. package/src/continuous-ops.js +11 -1
  29. package/src/convert.js +340 -340
  30. package/src/copilot/config-parser.js +280 -280
  31. package/src/copilot/context.js +218 -218
  32. package/src/copilot/freshness.js +177 -177
  33. package/src/copilot/patch.js +238 -238
  34. package/src/copilot/techniques.js +3578 -3578
  35. package/src/cursor/freshness.js +194 -194
  36. package/src/cursor/patch.js +243 -243
  37. package/src/cursor/techniques.js +3735 -3735
  38. package/src/doctor.js +201 -201
  39. package/src/fix-engine.js +511 -8
  40. package/src/formatters/csv.js +86 -86
  41. package/src/formatters/junit.js +123 -123
  42. package/src/formatters/markdown.js +164 -164
  43. package/src/formatters/otel.js +151 -151
  44. package/src/freshness.js +156 -156
  45. package/src/gemini/activity.js +402 -402
  46. package/src/gemini/context.js +290 -290
  47. package/src/gemini/freshness.js +183 -183
  48. package/src/gemini/patch.js +229 -229
  49. package/src/gemini/techniques.js +3811 -3811
  50. package/src/governance.js +533 -533
  51. package/src/harmony/audit.js +306 -306
  52. package/src/i18n.js +63 -63
  53. package/src/insights.js +119 -119
  54. package/src/integrations.js +134 -134
  55. package/src/locales/en.json +33 -33
  56. package/src/locales/es.json +33 -33
  57. package/src/migrate.js +354 -354
  58. package/src/opencode/activity.js +286 -286
  59. package/src/opencode/freshness.js +137 -137
  60. package/src/opencode/techniques.js +3450 -3450
  61. package/src/setup/analysis.js +12 -12
  62. package/src/setup.js +7 -6
  63. package/src/shallow-risk/index.js +56 -56
  64. package/src/shallow-risk/patterns/agent-config-cross-platform-drift.js +50 -50
  65. package/src/shallow-risk/patterns/agent-config-dangerous-autoapprove.js +46 -46
  66. package/src/shallow-risk/patterns/agent-config-deprecated-keys.js +46 -46
  67. package/src/shallow-risk/patterns/agent-config-missing-file.js +317 -317
  68. package/src/shallow-risk/patterns/agent-config-secret-literal.js +49 -49
  69. package/src/shallow-risk/patterns/agent-config-stack-contradiction.js +34 -34
  70. package/src/shallow-risk/patterns/hook-script-missing.js +70 -70
  71. package/src/shallow-risk/patterns/mcp-server-no-allowlist.js +52 -52
  72. package/src/shallow-risk/shared.js +648 -648
  73. package/src/source-urls.js +295 -295
  74. package/src/state-paths.js +85 -85
  75. package/src/supplemental-checks.js +805 -805
  76. package/src/telemetry.js +160 -160
  77. package/src/windsurf/context.js +359 -359
  78. package/src/windsurf/freshness.js +194 -194
  79. package/src/windsurf/patch.js +231 -231
  80. 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