@nerviq/cli 1.20.1 → 1.22.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.
- package/LICENSE +23 -23
- package/README.md +20 -2
- package/bin/cli.js +3 -3
- package/package.json +1 -1
- package/src/activity.js +1039 -1039
- package/src/adoption-advisor.js +299 -299
- package/src/aider/config-parser.js +166 -166
- package/src/aider/context.js +4 -1
- package/src/aider/deep-review.js +316 -316
- package/src/aider/domain-packs.js +303 -303
- package/src/aider/freshness.js +93 -93
- package/src/aider/governance.js +253 -253
- package/src/aider/interactive.js +334 -334
- package/src/aider/mcp-packs.js +329 -329
- package/src/aider/patch.js +214 -214
- package/src/aider/plans.js +186 -186
- package/src/aider/premium.js +360 -360
- package/src/aider/setup.js +404 -404
- package/src/aider/techniques.js +312 -67
- package/src/analyze.js +951 -951
- package/src/anti-patterns.js +485 -485
- package/src/audit/instruction-files.js +180 -180
- package/src/audit/recommendations.js +577 -577
- package/src/audit.js +20 -0
- package/src/auto-suggest.js +154 -154
- package/src/badge.js +13 -13
- package/src/behavioral-drift.js +801 -801
- package/src/benchmark.js +67 -67
- package/src/catalog.js +103 -103
- package/src/certification.js +128 -128
- package/src/codex/config-parser.js +183 -183
- package/src/codex/context.js +223 -223
- package/src/codex/deep-review.js +493 -493
- package/src/codex/domain-packs.js +394 -394
- package/src/codex/freshness.js +84 -84
- package/src/codex/governance.js +192 -192
- package/src/codex/interactive.js +618 -618
- package/src/codex/mcp-packs.js +914 -914
- package/src/codex/patch.js +209 -209
- package/src/codex/plans.js +251 -251
- package/src/codex/premium.js +614 -614
- package/src/codex/setup.js +591 -591
- package/src/continuous-ops.js +681 -681
- package/src/copilot/activity.js +309 -309
- package/src/copilot/deep-review.js +346 -346
- package/src/copilot/domain-packs.js +372 -372
- package/src/copilot/freshness.js +57 -57
- package/src/copilot/governance.js +222 -222
- package/src/copilot/interactive.js +406 -406
- package/src/copilot/mcp-packs.js +826 -826
- package/src/copilot/plans.js +253 -253
- package/src/copilot/premium.js +451 -451
- package/src/copilot/setup.js +488 -488
- package/src/cost-tracking.js +61 -61
- package/src/cursor/activity.js +301 -301
- package/src/cursor/config-parser.js +265 -265
- package/src/cursor/context.js +256 -256
- package/src/cursor/deep-review.js +334 -334
- package/src/cursor/domain-packs.js +368 -368
- package/src/cursor/freshness.js +65 -65
- package/src/cursor/governance.js +229 -229
- package/src/cursor/interactive.js +391 -391
- package/src/cursor/mcp-packs.js +828 -828
- package/src/cursor/plans.js +254 -254
- package/src/cursor/premium.js +469 -469
- package/src/cursor/setup.js +488 -488
- package/src/dashboard.js +493 -493
- package/src/deep-review.js +428 -428
- package/src/deprecation.js +98 -98
- package/src/diff-only.js +280 -280
- package/src/doctor.js +119 -119
- package/src/domain-pack-expansion.js +1033 -1033
- package/src/domain-packs.js +387 -387
- package/src/feedback.js +178 -178
- package/src/fix-engine.js +783 -783
- package/src/fix-prompts.js +122 -122
- package/src/formatters/csv.js +69 -0
- package/src/formatters/junit.js +99 -0
- package/src/formatters/markdown.js +118 -0
- package/src/formatters/sarif.js +115 -115
- package/src/freshness.js +74 -74
- package/src/gemini/config-parser.js +275 -275
- package/src/gemini/deep-review.js +559 -559
- package/src/gemini/domain-packs.js +393 -393
- package/src/gemini/freshness.js +66 -66
- package/src/gemini/governance.js +201 -201
- package/src/gemini/interactive.js +860 -860
- package/src/gemini/mcp-packs.js +915 -915
- package/src/gemini/plans.js +269 -269
- package/src/gemini/premium.js +760 -760
- package/src/gemini/setup.js +692 -692
- package/src/governance.js +72 -72
- package/src/harmony/add.js +68 -68
- package/src/harmony/advisor.js +333 -333
- package/src/harmony/canon.js +565 -565
- package/src/harmony/cli.js +591 -591
- package/src/harmony/drift.js +401 -401
- package/src/harmony/governance.js +313 -313
- package/src/harmony/memory.js +239 -239
- package/src/harmony/sync.js +475 -475
- package/src/harmony/watch.js +370 -370
- package/src/hook-validation.js +342 -342
- package/src/index.js +271 -271
- package/src/init.js +184 -184
- package/src/instruction-surfaces.js +185 -185
- package/src/integrations.js +144 -144
- package/src/interactive.js +118 -118
- package/src/locales/en.json +1 -1
- package/src/locales/es.json +1 -1
- package/src/mcp-packs.js +830 -830
- package/src/mcp-server.js +726 -726
- package/src/mcp-validation.js +337 -337
- package/src/nerviq-sync.json +7 -7
- package/src/opencode/config-parser.js +109 -109
- package/src/opencode/context.js +247 -247
- package/src/opencode/deep-review.js +313 -313
- package/src/opencode/domain-packs.js +262 -262
- package/src/opencode/freshness.js +66 -66
- package/src/opencode/governance.js +159 -159
- package/src/opencode/interactive.js +392 -392
- package/src/opencode/mcp-packs.js +705 -705
- package/src/opencode/patch.js +184 -184
- package/src/opencode/plans.js +231 -231
- package/src/opencode/premium.js +413 -413
- package/src/opencode/setup.js +449 -449
- package/src/opencode/techniques.js +27 -27
- package/src/operating-profile.js +574 -574
- package/src/org.js +152 -152
- package/src/permission-rules.js +218 -218
- package/src/plans.js +839 -839
- package/src/platform-change-manifest.js +86 -86
- package/src/plugins.js +110 -110
- package/src/policy-layers.js +210 -210
- package/src/profiles.js +124 -124
- package/src/prompt-injection.js +74 -74
- package/src/public-api.js +173 -173
- package/src/recommendation-rules.js +84 -84
- package/src/repo-archetype.js +386 -386
- package/src/secret-patterns.js +39 -39
- package/src/server.js +527 -527
- package/src/setup/analysis.js +607 -607
- package/src/setup/runtime.js +172 -172
- package/src/setup.js +677 -677
- package/src/shared/capabilities.js +194 -194
- package/src/source-urls.js +132 -132
- package/src/stack-checks.js +565 -565
- package/src/supplemental-checks.js +13 -13
- package/src/synergy/adaptive.js +261 -261
- package/src/synergy/compensation.js +137 -137
- package/src/synergy/evidence.js +193 -193
- package/src/synergy/learning.js +199 -199
- package/src/synergy/patterns.js +227 -227
- package/src/synergy/ranking.js +83 -83
- package/src/synergy/report.js +165 -165
- package/src/synergy/routing.js +146 -146
- package/src/techniques/api.js +407 -407
- package/src/techniques/automation.js +316 -316
- package/src/techniques/compliance.js +257 -257
- package/src/techniques/hygiene.js +294 -294
- package/src/techniques/instructions.js +243 -243
- package/src/techniques/observability.js +226 -226
- package/src/techniques/optimization.js +142 -142
- package/src/techniques/quality.js +318 -318
- package/src/techniques/security.js +237 -237
- package/src/techniques/shared.js +443 -443
- package/src/techniques/stacks.js +2294 -2294
- package/src/techniques/tools.js +106 -106
- package/src/techniques/workflow.js +413 -413
- package/src/techniques.js +81 -81
- package/src/terminology.js +73 -73
- package/src/token-estimate.js +35 -35
- package/src/usage-patterns.js +99 -99
- package/src/verification-metadata.js +145 -145
- package/src/watch.js +247 -247
- package/src/windsurf/activity.js +302 -302
- package/src/windsurf/config-parser.js +267 -267
- package/src/windsurf/deep-review.js +337 -337
- package/src/windsurf/domain-packs.js +370 -370
- package/src/windsurf/freshness.js +36 -36
- package/src/windsurf/governance.js +231 -231
- package/src/windsurf/interactive.js +388 -388
- package/src/windsurf/mcp-packs.js +792 -792
- package/src/windsurf/plans.js +247 -247
- package/src/windsurf/premium.js +468 -468
- package/src/windsurf/setup.js +471 -471
- package/src/workspace.js +375 -375
package/src/fix-prompts.js
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI-generated fix prompts for checks without template auto-fixes.
|
|
3
|
-
* Each key maps to a check key from techniques.js.
|
|
4
|
-
* These prompts are designed to be copy-pasted into an AI coding agent.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const FIX_PROMPTS = {
|
|
8
|
-
importSyntax:
|
|
9
|
-
'Refactor CLAUDE.md to use @path imports for modularity. Split large sections into separate files (e.g. @docs/coding-style.md, @docs/architecture.md) and reference them with @path syntax. Also consider using .claude/rules/ for path-specific rules.',
|
|
10
|
-
|
|
11
|
-
underlines200:
|
|
12
|
-
'Refactor CLAUDE.md to be under 200 lines. Move detailed sections into separate files using @import or .claude/rules/ for path-specific rules. Keep only essential project overview, build commands, and key conventions in the main file.',
|
|
13
|
-
|
|
14
|
-
verificationLoop:
|
|
15
|
-
'Add a verification section to CLAUDE.md with commands Claude should run after making changes. Include test, lint, and build commands. Example:\n\n## Verification\nAfter every change, run:\n- `npm test` to verify tests pass\n- `npm run lint` to check code style\n- `npm run build` to verify compilation',
|
|
16
|
-
|
|
17
|
-
testCommand:
|
|
18
|
-
'Add an explicit test command to CLAUDE.md. Example: "Run `npm test` before committing." or "Run `pytest` to verify changes." Place it in a ## Commands or ## Verification section.',
|
|
19
|
-
|
|
20
|
-
lintCommand:
|
|
21
|
-
'Add a lint command to CLAUDE.md so the AI agent auto-checks code style. Example: "Run `npm run lint` or `eslint .` before committing." Place it in a ## Commands section.',
|
|
22
|
-
|
|
23
|
-
buildCommand:
|
|
24
|
-
'Add a build command to CLAUDE.md so the AI agent can verify compilation. Example: "Run `npm run build` or `tsc` to verify the project compiles." Place it in a ## Commands section.',
|
|
25
|
-
|
|
26
|
-
settingsPermissions:
|
|
27
|
-
'Create or update .claude/settings.json with permission configuration. Add "permissions": { "allow": ["Read", "Write src/**"], "deny": ["Write .env", "Write **/secrets/**"] } to control which tools and paths the AI agent can access.',
|
|
28
|
-
|
|
29
|
-
permissionDeny:
|
|
30
|
-
'Add deny rules to .claude/settings.json under permissions.deny to block dangerous operations. Example entries: "rm -rf /", "DROP TABLE", "Write .env", "Write **/*.pem", "Write **/secrets/**".',
|
|
31
|
-
|
|
32
|
-
noBypassPermissions:
|
|
33
|
-
'Remove bypassPermissions from your .claude/settings.json defaultMode. Instead, use explicit allow rules in permissions.allow to grant only the access needed.',
|
|
34
|
-
|
|
35
|
-
secretsProtection:
|
|
36
|
-
'Add permissions.deny rules in .claude/settings.json to block reading sensitive files. Add entries like: ".env", ".env.*", "**/.env", "**/*.pem", "**/secrets/**" to the deny array.',
|
|
37
|
-
|
|
38
|
-
securityReview:
|
|
39
|
-
'Add a /security-review command or mention security review in CLAUDE.md. Create .claude/commands/security-review.md with: "Review the codebase for OWASP Top 10 vulnerabilities. Check for: SQL injection, XSS, CSRF, insecure dependencies, hardcoded secrets, and misconfigured permissions."',
|
|
40
|
-
|
|
41
|
-
preToolUseHook:
|
|
42
|
-
'Add a PreToolUse hook in .claude/settings.json to validate tool calls before execution. Example: add a hook that blocks writes to protected files or validates file paths. See hooks documentation for the event schema.',
|
|
43
|
-
|
|
44
|
-
postToolUseHook:
|
|
45
|
-
'Add a PostToolUse hook in .claude/settings.json for automated actions after tool calls. Example: auto-run linting after file writes, or validate output format after code generation.',
|
|
46
|
-
|
|
47
|
-
sessionStartHook:
|
|
48
|
-
'Add a SessionStart hook in .claude/settings.json for initialization tasks. Example: load project state, rotate logs, or display a welcome message with project status at the start of each session.',
|
|
49
|
-
|
|
50
|
-
deployCommand:
|
|
51
|
-
'Create .claude/commands/deploy.md with deployment instructions. Include: pre-deploy checks (tests, lint, build), deployment steps for your platform (Vercel, AWS, etc.), and post-deploy verification.',
|
|
52
|
-
|
|
53
|
-
reviewCommand:
|
|
54
|
-
'Create .claude/commands/review.md with code review instructions. Include: check for security issues, verify test coverage, review naming conventions, check for code duplication, and validate error handling.',
|
|
55
|
-
|
|
56
|
-
compactionAwareness:
|
|
57
|
-
'Add compaction guidance to CLAUDE.md. Add a line like: "Run /compact when context gets heavy or before large operations." This helps the AI agent manage its context window effectively.',
|
|
58
|
-
|
|
59
|
-
contextManagement:
|
|
60
|
-
'Add context management tips to CLAUDE.md. Include: "Use /compact proactively at 70% capacity. Prefer targeted file reads over broad searches. Keep conversation focused on one task at a time."',
|
|
61
|
-
|
|
62
|
-
mcpServers:
|
|
63
|
-
'Create .mcp.json at the project root to configure MCP servers. Example:\n{\n "mcpServers": {\n "memory": { "command": "npx", "args": ["-y", "@anthropic/mcp-memory"] }\n }\n}\nUse `claude mcp add <name>` to add servers interactively.',
|
|
64
|
-
|
|
65
|
-
context7Mcp:
|
|
66
|
-
'Add the Context7 MCP server for real-time documentation lookup. Add to .mcp.json:\n"context7": { "command": "npx", "args": ["-y", "@anthropic/context7-mcp"] }\nThis provides always-up-to-date library documentation.',
|
|
67
|
-
|
|
68
|
-
xmlTags:
|
|
69
|
-
'Add XML-tagged sections to CLAUDE.md for structured rules. Wrap critical rules in tags like <constraints>, <validation>, or <rules>. Example:\n<constraints>\n- Never modify package-lock.json manually\n- Always run tests before committing\n</constraints>',
|
|
70
|
-
|
|
71
|
-
fewShotExamples:
|
|
72
|
-
'Add code examples to CLAUDE.md showing preferred patterns. Include 2-3 examples of your coding style: naming conventions, error handling patterns, file structure. Use fenced code blocks with the appropriate language tag.',
|
|
73
|
-
|
|
74
|
-
roleDefinition:
|
|
75
|
-
'Add a role definition to the top of CLAUDE.md. Example: "You are a senior backend engineer working on a Node.js microservices platform. Prioritize type safety, comprehensive error handling, and test coverage."',
|
|
76
|
-
|
|
77
|
-
constraintBlocks:
|
|
78
|
-
'Add XML constraint blocks to CLAUDE.md for critical rules. Wrap must-follow rules in <constraints> tags for ~40% better adherence. Example:\n<constraints>\n- Never delete database migrations\n- Always use parameterized queries\n- Run the full test suite before committing\n</constraints>',
|
|
79
|
-
|
|
80
|
-
readme:
|
|
81
|
-
'Create a README.md with: project name and description, installation/setup instructions, usage examples, configuration options, and contribution guidelines.',
|
|
82
|
-
|
|
83
|
-
changelog:
|
|
84
|
-
'Create a CHANGELOG.md following Keep a Changelog format. Include sections: Added, Changed, Deprecated, Removed, Fixed, Security. Start with your current version.',
|
|
85
|
-
|
|
86
|
-
contributing:
|
|
87
|
-
'Create a CONTRIBUTING.md with: how to set up the dev environment, coding standards and style guide, pull request process, issue reporting guidelines, and code of conduct reference.',
|
|
88
|
-
|
|
89
|
-
editorconfig:
|
|
90
|
-
'Create a .editorconfig file at the project root with consistent formatting rules:\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true',
|
|
91
|
-
|
|
92
|
-
ciPipeline:
|
|
93
|
-
'Add a CI pipeline for automated testing. For GitHub Actions, create .github/workflows/ci.yml with steps: checkout, setup Node/Python, install dependencies, run lint, run tests, run build.',
|
|
94
|
-
|
|
95
|
-
dockerfile:
|
|
96
|
-
'Create a Dockerfile for the project. Use a multi-stage build: stage 1 installs dependencies and builds, stage 2 copies only production artifacts. Use a slim base image and set a non-root user.',
|
|
97
|
-
|
|
98
|
-
noSecretsInClaude:
|
|
99
|
-
'Remove any API keys, tokens, or secrets from CLAUDE.md. Replace them with environment variable references (e.g. $API_KEY or process.env.API_KEY). Store actual values in .env files that are gitignored.',
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Format a fix prompt for display in the terminal.
|
|
104
|
-
*/
|
|
105
|
-
function formatFixPrompt(key, prompt) {
|
|
106
|
-
const divider = '\u2500'.repeat(38);
|
|
107
|
-
const lines = [
|
|
108
|
-
'',
|
|
109
|
-
` No auto-fix for '${key}'. Here's a prompt for your AI agent:`,
|
|
110
|
-
'',
|
|
111
|
-
` ${divider}`,
|
|
112
|
-
];
|
|
113
|
-
for (const line of prompt.split('\n')) {
|
|
114
|
-
lines.push(` ${line}`);
|
|
115
|
-
}
|
|
116
|
-
lines.push(` ${divider}`);
|
|
117
|
-
lines.push('');
|
|
118
|
-
lines.push(' Copy and paste this into Claude Code, Cursor, or your preferred AI agent.');
|
|
119
|
-
return lines.join('\n');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
module.exports = { FIX_PROMPTS, formatFixPrompt };
|
|
1
|
+
/**
|
|
2
|
+
* AI-generated fix prompts for checks without template auto-fixes.
|
|
3
|
+
* Each key maps to a check key from techniques.js.
|
|
4
|
+
* These prompts are designed to be copy-pasted into an AI coding agent.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const FIX_PROMPTS = {
|
|
8
|
+
importSyntax:
|
|
9
|
+
'Refactor CLAUDE.md to use @path imports for modularity. Split large sections into separate files (e.g. @docs/coding-style.md, @docs/architecture.md) and reference them with @path syntax. Also consider using .claude/rules/ for path-specific rules.',
|
|
10
|
+
|
|
11
|
+
underlines200:
|
|
12
|
+
'Refactor CLAUDE.md to be under 200 lines. Move detailed sections into separate files using @import or .claude/rules/ for path-specific rules. Keep only essential project overview, build commands, and key conventions in the main file.',
|
|
13
|
+
|
|
14
|
+
verificationLoop:
|
|
15
|
+
'Add a verification section to CLAUDE.md with commands Claude should run after making changes. Include test, lint, and build commands. Example:\n\n## Verification\nAfter every change, run:\n- `npm test` to verify tests pass\n- `npm run lint` to check code style\n- `npm run build` to verify compilation',
|
|
16
|
+
|
|
17
|
+
testCommand:
|
|
18
|
+
'Add an explicit test command to CLAUDE.md. Example: "Run `npm test` before committing." or "Run `pytest` to verify changes." Place it in a ## Commands or ## Verification section.',
|
|
19
|
+
|
|
20
|
+
lintCommand:
|
|
21
|
+
'Add a lint command to CLAUDE.md so the AI agent auto-checks code style. Example: "Run `npm run lint` or `eslint .` before committing." Place it in a ## Commands section.',
|
|
22
|
+
|
|
23
|
+
buildCommand:
|
|
24
|
+
'Add a build command to CLAUDE.md so the AI agent can verify compilation. Example: "Run `npm run build` or `tsc` to verify the project compiles." Place it in a ## Commands section.',
|
|
25
|
+
|
|
26
|
+
settingsPermissions:
|
|
27
|
+
'Create or update .claude/settings.json with permission configuration. Add "permissions": { "allow": ["Read", "Write src/**"], "deny": ["Write .env", "Write **/secrets/**"] } to control which tools and paths the AI agent can access.',
|
|
28
|
+
|
|
29
|
+
permissionDeny:
|
|
30
|
+
'Add deny rules to .claude/settings.json under permissions.deny to block dangerous operations. Example entries: "rm -rf /", "DROP TABLE", "Write .env", "Write **/*.pem", "Write **/secrets/**".',
|
|
31
|
+
|
|
32
|
+
noBypassPermissions:
|
|
33
|
+
'Remove bypassPermissions from your .claude/settings.json defaultMode. Instead, use explicit allow rules in permissions.allow to grant only the access needed.',
|
|
34
|
+
|
|
35
|
+
secretsProtection:
|
|
36
|
+
'Add permissions.deny rules in .claude/settings.json to block reading sensitive files. Add entries like: ".env", ".env.*", "**/.env", "**/*.pem", "**/secrets/**" to the deny array.',
|
|
37
|
+
|
|
38
|
+
securityReview:
|
|
39
|
+
'Add a /security-review command or mention security review in CLAUDE.md. Create .claude/commands/security-review.md with: "Review the codebase for OWASP Top 10 vulnerabilities. Check for: SQL injection, XSS, CSRF, insecure dependencies, hardcoded secrets, and misconfigured permissions."',
|
|
40
|
+
|
|
41
|
+
preToolUseHook:
|
|
42
|
+
'Add a PreToolUse hook in .claude/settings.json to validate tool calls before execution. Example: add a hook that blocks writes to protected files or validates file paths. See hooks documentation for the event schema.',
|
|
43
|
+
|
|
44
|
+
postToolUseHook:
|
|
45
|
+
'Add a PostToolUse hook in .claude/settings.json for automated actions after tool calls. Example: auto-run linting after file writes, or validate output format after code generation.',
|
|
46
|
+
|
|
47
|
+
sessionStartHook:
|
|
48
|
+
'Add a SessionStart hook in .claude/settings.json for initialization tasks. Example: load project state, rotate logs, or display a welcome message with project status at the start of each session.',
|
|
49
|
+
|
|
50
|
+
deployCommand:
|
|
51
|
+
'Create .claude/commands/deploy.md with deployment instructions. Include: pre-deploy checks (tests, lint, build), deployment steps for your platform (Vercel, AWS, etc.), and post-deploy verification.',
|
|
52
|
+
|
|
53
|
+
reviewCommand:
|
|
54
|
+
'Create .claude/commands/review.md with code review instructions. Include: check for security issues, verify test coverage, review naming conventions, check for code duplication, and validate error handling.',
|
|
55
|
+
|
|
56
|
+
compactionAwareness:
|
|
57
|
+
'Add compaction guidance to CLAUDE.md. Add a line like: "Run /compact when context gets heavy or before large operations." This helps the AI agent manage its context window effectively.',
|
|
58
|
+
|
|
59
|
+
contextManagement:
|
|
60
|
+
'Add context management tips to CLAUDE.md. Include: "Use /compact proactively at 70% capacity. Prefer targeted file reads over broad searches. Keep conversation focused on one task at a time."',
|
|
61
|
+
|
|
62
|
+
mcpServers:
|
|
63
|
+
'Create .mcp.json at the project root to configure MCP servers. Example:\n{\n "mcpServers": {\n "memory": { "command": "npx", "args": ["-y", "@anthropic/mcp-memory"] }\n }\n}\nUse `claude mcp add <name>` to add servers interactively.',
|
|
64
|
+
|
|
65
|
+
context7Mcp:
|
|
66
|
+
'Add the Context7 MCP server for real-time documentation lookup. Add to .mcp.json:\n"context7": { "command": "npx", "args": ["-y", "@anthropic/context7-mcp"] }\nThis provides always-up-to-date library documentation.',
|
|
67
|
+
|
|
68
|
+
xmlTags:
|
|
69
|
+
'Add XML-tagged sections to CLAUDE.md for structured rules. Wrap critical rules in tags like <constraints>, <validation>, or <rules>. Example:\n<constraints>\n- Never modify package-lock.json manually\n- Always run tests before committing\n</constraints>',
|
|
70
|
+
|
|
71
|
+
fewShotExamples:
|
|
72
|
+
'Add code examples to CLAUDE.md showing preferred patterns. Include 2-3 examples of your coding style: naming conventions, error handling patterns, file structure. Use fenced code blocks with the appropriate language tag.',
|
|
73
|
+
|
|
74
|
+
roleDefinition:
|
|
75
|
+
'Add a role definition to the top of CLAUDE.md. Example: "You are a senior backend engineer working on a Node.js microservices platform. Prioritize type safety, comprehensive error handling, and test coverage."',
|
|
76
|
+
|
|
77
|
+
constraintBlocks:
|
|
78
|
+
'Add XML constraint blocks to CLAUDE.md for critical rules. Wrap must-follow rules in <constraints> tags for ~40% better adherence. Example:\n<constraints>\n- Never delete database migrations\n- Always use parameterized queries\n- Run the full test suite before committing\n</constraints>',
|
|
79
|
+
|
|
80
|
+
readme:
|
|
81
|
+
'Create a README.md with: project name and description, installation/setup instructions, usage examples, configuration options, and contribution guidelines.',
|
|
82
|
+
|
|
83
|
+
changelog:
|
|
84
|
+
'Create a CHANGELOG.md following Keep a Changelog format. Include sections: Added, Changed, Deprecated, Removed, Fixed, Security. Start with your current version.',
|
|
85
|
+
|
|
86
|
+
contributing:
|
|
87
|
+
'Create a CONTRIBUTING.md with: how to set up the dev environment, coding standards and style guide, pull request process, issue reporting guidelines, and code of conduct reference.',
|
|
88
|
+
|
|
89
|
+
editorconfig:
|
|
90
|
+
'Create a .editorconfig file at the project root with consistent formatting rules:\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true',
|
|
91
|
+
|
|
92
|
+
ciPipeline:
|
|
93
|
+
'Add a CI pipeline for automated testing. For GitHub Actions, create .github/workflows/ci.yml with steps: checkout, setup Node/Python, install dependencies, run lint, run tests, run build.',
|
|
94
|
+
|
|
95
|
+
dockerfile:
|
|
96
|
+
'Create a Dockerfile for the project. Use a multi-stage build: stage 1 installs dependencies and builds, stage 2 copies only production artifacts. Use a slim base image and set a non-root user.',
|
|
97
|
+
|
|
98
|
+
noSecretsInClaude:
|
|
99
|
+
'Remove any API keys, tokens, or secrets from CLAUDE.md. Replace them with environment variable references (e.g. $API_KEY or process.env.API_KEY). Store actual values in .env files that are gitignored.',
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Format a fix prompt for display in the terminal.
|
|
104
|
+
*/
|
|
105
|
+
function formatFixPrompt(key, prompt) {
|
|
106
|
+
const divider = '\u2500'.repeat(38);
|
|
107
|
+
const lines = [
|
|
108
|
+
'',
|
|
109
|
+
` No auto-fix for '${key}'. Here's a prompt for your AI agent:`,
|
|
110
|
+
'',
|
|
111
|
+
` ${divider}`,
|
|
112
|
+
];
|
|
113
|
+
for (const line of prompt.split('\n')) {
|
|
114
|
+
lines.push(` ${line}`);
|
|
115
|
+
}
|
|
116
|
+
lines.push(` ${divider}`);
|
|
117
|
+
lines.push('');
|
|
118
|
+
lines.push(' Copy and paste this into Claude Code, Cursor, or your preferred AI agent.');
|
|
119
|
+
return lines.join('\n');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = { FIX_PROMPTS, formatFixPrompt };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSV Formatter (RFC 4180)
|
|
3
|
+
*
|
|
4
|
+
* One row per check in a nerviq audit result.
|
|
5
|
+
* Columns: key,id,name,category,rating,severity,passed,file,line,sourceUrl,fix
|
|
6
|
+
*
|
|
7
|
+
* Quoting rules (RFC 4180):
|
|
8
|
+
* - Fields containing comma, double-quote, CR, or LF are wrapped in
|
|
9
|
+
* double-quotes.
|
|
10
|
+
* - Internal double-quotes are escaped by doubling them.
|
|
11
|
+
* - Header row is emitted first.
|
|
12
|
+
* - No UTF-8 BOM (some consumers mishandle it).
|
|
13
|
+
* - Line separator: LF (consumers accept LF; JUnit/XLSX/csv parsers
|
|
14
|
+
* normalize both).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
const COLUMNS = [
|
|
20
|
+
'key',
|
|
21
|
+
'id',
|
|
22
|
+
'name',
|
|
23
|
+
'category',
|
|
24
|
+
'rating',
|
|
25
|
+
'severity',
|
|
26
|
+
'passed',
|
|
27
|
+
'file',
|
|
28
|
+
'line',
|
|
29
|
+
'sourceUrl',
|
|
30
|
+
'fix',
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
function csvEscape(value) {
|
|
34
|
+
if (value === null || value === undefined) return '';
|
|
35
|
+
const s = String(value);
|
|
36
|
+
if (/[",\r\n]/.test(s)) {
|
|
37
|
+
return `"${s.replace(/"/g, '""')}"`;
|
|
38
|
+
}
|
|
39
|
+
return s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function rowFor(r) {
|
|
43
|
+
const severity = r.severity || r.impact || '';
|
|
44
|
+
const cells = [
|
|
45
|
+
r.key ?? '',
|
|
46
|
+
r.id ?? '',
|
|
47
|
+
r.name ?? '',
|
|
48
|
+
r.category ?? '',
|
|
49
|
+
r.rating ?? '',
|
|
50
|
+
severity,
|
|
51
|
+
r.passed === null || r.passed === undefined ? '' : String(r.passed),
|
|
52
|
+
r.file ?? '',
|
|
53
|
+
r.line ?? '',
|
|
54
|
+
r.sourceUrl ?? '',
|
|
55
|
+
r.fix ?? '',
|
|
56
|
+
];
|
|
57
|
+
return cells.map(csvEscape).join(',');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatCsv(auditResult) {
|
|
61
|
+
const results = Array.isArray(auditResult.results) ? auditResult.results : [];
|
|
62
|
+
const lines = [COLUMNS.join(',')];
|
|
63
|
+
for (const r of results) {
|
|
64
|
+
lines.push(rowFor(r));
|
|
65
|
+
}
|
|
66
|
+
return lines.join('\n');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = { formatCsv, CSV_COLUMNS: COLUMNS };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JUnit XML Formatter
|
|
3
|
+
*
|
|
4
|
+
* Converts a nerviq audit result into Jenkins-compatible JUnit XML.
|
|
5
|
+
* Schema: <testsuites><testsuite><testcase><failure/></testcase></testsuite></testsuites>
|
|
6
|
+
*
|
|
7
|
+
* - One <testsuite> per check category.
|
|
8
|
+
* - Each check becomes a <testcase> (classname = category, name = key).
|
|
9
|
+
* - Failed checks emit a <failure message="..." type="..."/> where:
|
|
10
|
+
* - message = check.fix || check.name
|
|
11
|
+
* - type = severity (check.severity || check.impact)
|
|
12
|
+
* - Skipped checks emit <skipped/>.
|
|
13
|
+
*
|
|
14
|
+
* Parses with any standard JUnit XML consumer (GitHub Actions test
|
|
15
|
+
* reporter, Jenkins, GitLab CI, CircleCI).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const { version: nerviqVersion } = require('../../package.json');
|
|
21
|
+
|
|
22
|
+
function escapeXml(value) {
|
|
23
|
+
if (value === null || value === undefined) return '';
|
|
24
|
+
return String(value)
|
|
25
|
+
.replace(/&/g, '&')
|
|
26
|
+
.replace(/</g, '<')
|
|
27
|
+
.replace(/>/g, '>')
|
|
28
|
+
.replace(/"/g, '"')
|
|
29
|
+
.replace(/'/g, ''');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function severityFor(r) {
|
|
33
|
+
return r.severity || r.impact || 'medium';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function groupByCategory(results) {
|
|
37
|
+
const map = new Map();
|
|
38
|
+
for (const r of results) {
|
|
39
|
+
const cat = r.category || 'uncategorized';
|
|
40
|
+
if (!map.has(cat)) map.set(cat, []);
|
|
41
|
+
map.get(cat).push(r);
|
|
42
|
+
}
|
|
43
|
+
return map;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function formatJUnit(auditResult) {
|
|
47
|
+
const allResults = Array.isArray(auditResult.results) ? auditResult.results : [];
|
|
48
|
+
const timestamp = auditResult.timestamp || new Date().toISOString();
|
|
49
|
+
const platform = auditResult.platform || 'claude';
|
|
50
|
+
|
|
51
|
+
const totalTests = allResults.length;
|
|
52
|
+
const totalFailures = allResults.filter((r) => r.passed === false).length;
|
|
53
|
+
const totalSkipped = allResults.filter((r) => r.passed === null || r.skipped === true).length;
|
|
54
|
+
|
|
55
|
+
const byCategory = groupByCategory(allResults);
|
|
56
|
+
|
|
57
|
+
const lines = [];
|
|
58
|
+
lines.push('<?xml version="1.0" encoding="UTF-8"?>');
|
|
59
|
+
lines.push(
|
|
60
|
+
`<testsuites name="nerviq" tests="${totalTests}" failures="${totalFailures}" skipped="${totalSkipped}" time="0">`,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
for (const [category, checks] of byCategory) {
|
|
64
|
+
const suiteFailures = checks.filter((r) => r.passed === false).length;
|
|
65
|
+
const suiteSkipped = checks.filter((r) => r.passed === null || r.skipped === true).length;
|
|
66
|
+
lines.push(
|
|
67
|
+
` <testsuite name="${escapeXml(category)}" tests="${checks.length}" failures="${suiteFailures}" skipped="${suiteSkipped}" time="0" timestamp="${escapeXml(timestamp)}" package="nerviq.${escapeXml(platform)}">`,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
for (const r of checks) {
|
|
71
|
+
const classname = escapeXml(r.category || 'uncategorized');
|
|
72
|
+
const name = escapeXml(r.key || r.id || r.name || 'unknown');
|
|
73
|
+
if (r.passed === false) {
|
|
74
|
+
const msg = escapeXml(r.fix || r.name || r.key || 'check failed');
|
|
75
|
+
const type = escapeXml(severityFor(r));
|
|
76
|
+
let body = `${r.name || ''}`;
|
|
77
|
+
if (r.file) body += ` at ${r.file}${r.line ? ':' + r.line : ''}`;
|
|
78
|
+
if (r.sourceUrl) body += ` (${r.sourceUrl})`;
|
|
79
|
+
lines.push(` <testcase classname="${classname}" name="${name}" time="0">`);
|
|
80
|
+
lines.push(` <failure message="${msg}" type="${type}">${escapeXml(body)}</failure>`);
|
|
81
|
+
lines.push(` </testcase>`);
|
|
82
|
+
} else if (r.passed === null || r.skipped === true) {
|
|
83
|
+
lines.push(` <testcase classname="${classname}" name="${name}" time="0">`);
|
|
84
|
+
lines.push(` <skipped/>`);
|
|
85
|
+
lines.push(` </testcase>`);
|
|
86
|
+
} else {
|
|
87
|
+
lines.push(` <testcase classname="${classname}" name="${name}" time="0"/>`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
lines.push(' </testsuite>');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
lines.push('</testsuites>');
|
|
95
|
+
lines.push(`<!-- nerviq v${escapeXml(auditResult.version || nerviqVersion)} -->`);
|
|
96
|
+
return lines.join('\n');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = { formatJUnit };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Formatter
|
|
3
|
+
*
|
|
4
|
+
* Converts a nerviq audit result into GitHub-flavoured markdown suitable
|
|
5
|
+
* for posting as a PR comment. Structure:
|
|
6
|
+
*
|
|
7
|
+
* - Header with score badge and pass/fail/skip counts
|
|
8
|
+
* - Top 5 topNextActions as a GitHub task-list checklist
|
|
9
|
+
* - Collapsible <details> block with the full failed-checks table
|
|
10
|
+
* - Footer with Nerviq link, version, timestamp
|
|
11
|
+
*
|
|
12
|
+
* Output is plain GitHub-flavoured markdown. The only HTML used is
|
|
13
|
+
* <details>/<summary>, which GitHub renders natively.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { version: nerviqVersion } = require('../../package.json');
|
|
19
|
+
|
|
20
|
+
function escapeCell(value) {
|
|
21
|
+
if (value === null || value === undefined) return '';
|
|
22
|
+
return String(value)
|
|
23
|
+
.replace(/\r?\n/g, ' ')
|
|
24
|
+
.replace(/\|/g, '\\|');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function escapeInline(value) {
|
|
28
|
+
if (value === null || value === undefined) return '';
|
|
29
|
+
return String(value).replace(/\r?\n/g, ' ');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function scoreBadge(score) {
|
|
33
|
+
const s = Number.isFinite(score) ? Math.round(score) : 0;
|
|
34
|
+
let color;
|
|
35
|
+
if (s >= 80) color = 'brightgreen';
|
|
36
|
+
else if (s >= 60) color = 'yellow';
|
|
37
|
+
else color = 'red';
|
|
38
|
+
return ``;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function severityFor(item) {
|
|
42
|
+
return item.severity || item.impact || 'medium';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function formatMarkdown(auditResult, options = {}) {
|
|
46
|
+
const platformLabel = auditResult.platformLabel || auditResult.platform || 'claude';
|
|
47
|
+
const score = auditResult.score ?? 0;
|
|
48
|
+
const passed = auditResult.passed ?? 0;
|
|
49
|
+
const failed = auditResult.failed ?? 0;
|
|
50
|
+
const skipped = auditResult.skipped ?? 0;
|
|
51
|
+
const version = auditResult.version || nerviqVersion;
|
|
52
|
+
const timestamp = auditResult.timestamp || new Date().toISOString();
|
|
53
|
+
|
|
54
|
+
const lines = [];
|
|
55
|
+
|
|
56
|
+
lines.push(`## Score: ${score}/100 ${scoreBadge(score)}`);
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push(`**Platform:** ${platformLabel} `);
|
|
59
|
+
lines.push(`**Checks:** ${passed} passed, ${failed} failed, ${skipped} skipped`);
|
|
60
|
+
lines.push('');
|
|
61
|
+
|
|
62
|
+
const top = Array.isArray(auditResult.topNextActions)
|
|
63
|
+
? auditResult.topNextActions.slice(0, 5)
|
|
64
|
+
: [];
|
|
65
|
+
|
|
66
|
+
if (top.length > 0) {
|
|
67
|
+
lines.push('### Top next actions');
|
|
68
|
+
lines.push('');
|
|
69
|
+
for (const item of top) {
|
|
70
|
+
const sev = severityFor(item).toString().toUpperCase();
|
|
71
|
+
const title = escapeInline(item.name || item.title || item.key);
|
|
72
|
+
const key = escapeInline(item.key || item.id || '');
|
|
73
|
+
let loc = '';
|
|
74
|
+
if (item.file) {
|
|
75
|
+
loc = ` — \`${escapeInline(item.file)}${item.line ? ':' + item.line : ''}\``;
|
|
76
|
+
}
|
|
77
|
+
lines.push(`- [ ] **[${sev}] ${title}** (\`${key}\`)${loc}`);
|
|
78
|
+
const hint = item.fix || item.hint || '';
|
|
79
|
+
if (hint) {
|
|
80
|
+
lines.push(` - ${escapeInline(hint)}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
lines.push('');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const failedResults = Array.isArray(auditResult.results)
|
|
87
|
+
? auditResult.results.filter((r) => r.passed === false)
|
|
88
|
+
: [];
|
|
89
|
+
|
|
90
|
+
if (failedResults.length > 0) {
|
|
91
|
+
lines.push('<details>');
|
|
92
|
+
lines.push(`<summary>All failed checks (${failedResults.length})</summary>`);
|
|
93
|
+
lines.push('');
|
|
94
|
+
lines.push('| key | name | category | rating | file | line |');
|
|
95
|
+
lines.push('| --- | --- | --- | --- | --- | --- |');
|
|
96
|
+
for (const r of failedResults) {
|
|
97
|
+
const row = [
|
|
98
|
+
escapeCell(r.key),
|
|
99
|
+
escapeCell(r.name),
|
|
100
|
+
escapeCell(r.category),
|
|
101
|
+
escapeCell(r.rating ?? ''),
|
|
102
|
+
escapeCell(r.file || ''),
|
|
103
|
+
escapeCell(r.line || ''),
|
|
104
|
+
];
|
|
105
|
+
lines.push(`| ${row.join(' | ')} |`);
|
|
106
|
+
}
|
|
107
|
+
lines.push('');
|
|
108
|
+
lines.push('</details>');
|
|
109
|
+
lines.push('');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
lines.push(`---`);
|
|
113
|
+
lines.push(`Generated by [Nerviq](https://nerviq.net) v${version} · ${timestamp}`);
|
|
114
|
+
|
|
115
|
+
return lines.join('\n');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = { formatMarkdown };
|