@nerviq/cli 1.11.0 → 1.13.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 (62) hide show
  1. package/README.md +216 -124
  2. package/bin/cli.js +620 -183
  3. package/package.json +3 -2
  4. package/src/activity.js +49 -9
  5. package/src/adoption-advisor.js +299 -0
  6. package/src/aider/freshness.js +65 -20
  7. package/src/aider/techniques.js +16 -11
  8. package/src/analyze.js +128 -0
  9. package/src/anti-patterns.js +13 -0
  10. package/src/audit/instruction-files.js +180 -0
  11. package/src/audit/recommendations.js +531 -0
  12. package/src/audit.js +53 -681
  13. package/src/behavioral-drift.js +801 -0
  14. package/src/codex/freshness.js +84 -25
  15. package/src/continuous-ops.js +681 -0
  16. package/src/copilot/freshness.js +57 -20
  17. package/src/cost-tracking.js +61 -0
  18. package/src/cursor/freshness.js +65 -20
  19. package/src/cursor/techniques.js +17 -12
  20. package/src/deep-review.js +83 -0
  21. package/src/diff-only.js +280 -0
  22. package/src/doctor.js +118 -55
  23. package/src/freshness.js +74 -21
  24. package/src/gemini/freshness.js +66 -21
  25. package/src/governance.js +59 -43
  26. package/src/hook-validation.js +342 -0
  27. package/src/index.js +5 -0
  28. package/src/integrations.js +42 -5
  29. package/src/mcp-server.js +95 -59
  30. package/src/mcp-validation.js +337 -0
  31. package/src/opencode/freshness.js +66 -21
  32. package/src/opencode/techniques.js +12 -7
  33. package/src/operating-profile.js +574 -0
  34. package/src/org.js +97 -13
  35. package/src/plans.js +192 -8
  36. package/src/platform-change-manifest.js +86 -0
  37. package/src/policy-layers.js +210 -0
  38. package/src/profiles.js +4 -1
  39. package/src/prompt-injection.js +74 -0
  40. package/src/repo-archetype.js +386 -0
  41. package/src/setup/analysis.js +619 -0
  42. package/src/setup/runtime.js +172 -0
  43. package/src/setup.js +62 -748
  44. package/src/source-urls.js +132 -132
  45. package/src/supplemental-checks.js +13 -12
  46. package/src/techniques/api.js +407 -0
  47. package/src/techniques/automation.js +316 -0
  48. package/src/techniques/compliance.js +257 -0
  49. package/src/techniques/hygiene.js +294 -0
  50. package/src/techniques/instructions.js +243 -0
  51. package/src/techniques/observability.js +226 -0
  52. package/src/techniques/optimization.js +142 -0
  53. package/src/techniques/quality.js +317 -0
  54. package/src/techniques/security.js +237 -0
  55. package/src/techniques/shared.js +443 -0
  56. package/src/techniques/stacks.js +2294 -0
  57. package/src/techniques/tools.js +106 -0
  58. package/src/techniques/workflow.js +413 -0
  59. package/src/techniques.js +78 -5607
  60. package/src/watch.js +18 -0
  61. package/src/windsurf/freshness.js +36 -21
  62. package/src/windsurf/techniques.js +17 -12
@@ -0,0 +1,316 @@
1
+ /**
2
+ * Automation technique fragments.
3
+ * Generated mechanically from the legacy techniques.js monolith during HR-09.
4
+ */
5
+
6
+ const {
7
+ findProjectFiles,
8
+ readProjectFiles,
9
+ } = require('./shared');
10
+
11
+ module.exports = {
12
+ hooks: {
13
+ id: 19,
14
+ name: 'Hooks for automation',
15
+ check: (ctx) => {
16
+ // Hooks are configured in settings.json (not .claude/hooks/ directory)
17
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
18
+ const local = ctx.jsonFile('.claude/settings.local.json') || {};
19
+ return !!(shared.hooks && Object.keys(shared.hooks).length > 0) || !!(local.hooks && Object.keys(local.hooks).length > 0);
20
+ },
21
+ impact: 'high',
22
+ rating: 4,
23
+ category: 'automation',
24
+ fix: 'Add hooks in .claude/settings.json under the "hooks" key. Supported events: PreToolUse, PostToolUse, Notification, Stop, StopFailure, SubagentStop, and more.',
25
+ template: 'hooks'
26
+ },
27
+
28
+ hooksInSettings: {
29
+ id: 8801,
30
+ name: 'Hooks configured in settings',
31
+ check: (ctx) => {
32
+ const shared = ctx.jsonFile('.claude/settings.json');
33
+ const local = ctx.jsonFile('.claude/settings.local.json');
34
+ const hasSharedHooks = shared && shared.hooks && Object.keys(shared.hooks).length > 0;
35
+ const hasLocalHooks = local && local.hooks && Object.keys(local.hooks).length > 0;
36
+ return hasSharedHooks || hasLocalHooks;
37
+ },
38
+ impact: 'high',
39
+ rating: 4,
40
+ category: 'automation',
41
+ fix: 'Add hooks in .claude/settings.json for automated enforcement (lint-on-save, test-on-commit).',
42
+ template: 'hooks'
43
+ },
44
+
45
+ preToolUseHook: {
46
+ id: 8802,
47
+ name: 'PreToolUse hook configured',
48
+ check: (ctx) => {
49
+ const shared = ctx.jsonFile('.claude/settings.json');
50
+ const local = ctx.jsonFile('.claude/settings.local.json');
51
+ return !!(shared?.hooks?.PreToolUse || local?.hooks?.PreToolUse);
52
+ },
53
+ impact: 'high',
54
+ rating: 4,
55
+ category: 'automation',
56
+ fix: 'Add PreToolUse hooks for validation before tool calls (e.g. block writes to protected files).',
57
+ template: null
58
+ },
59
+
60
+ postToolUseHook: {
61
+ id: 8803,
62
+ name: 'PostToolUse hook configured',
63
+ check: (ctx) => {
64
+ const shared = ctx.jsonFile('.claude/settings.json');
65
+ const local = ctx.jsonFile('.claude/settings.local.json');
66
+ return !!(shared?.hooks?.PostToolUse || local?.hooks?.PostToolUse);
67
+ },
68
+ impact: 'high',
69
+ rating: 4,
70
+ category: 'automation',
71
+ fix: 'Add PostToolUse hooks for auto-lint or auto-format after file writes.',
72
+ template: null
73
+ },
74
+
75
+ sessionStartHook: {
76
+ id: 8804,
77
+ name: 'SessionStart hook configured',
78
+ check: (ctx) => {
79
+ const shared = ctx.jsonFile('.claude/settings.json');
80
+ const local = ctx.jsonFile('.claude/settings.local.json');
81
+ if (!(shared?.hooks || local?.hooks)) return false;
82
+ return !!(shared?.hooks?.SessionStart || local?.hooks?.SessionStart);
83
+ },
84
+ impact: 'medium',
85
+ rating: 4,
86
+ category: 'automation',
87
+ fix: 'Add a SessionStart hook for initialization tasks (log rotation, state loading, etc.).',
88
+ template: null
89
+ },
90
+
91
+ dockerfile: {
92
+ id: 399,
93
+ name: 'Has Dockerfile',
94
+ check: (ctx) => ctx.files.some(f => /^Dockerfile/i.test(f)),
95
+ impact: 'medium',
96
+ rating: 3,
97
+ category: 'devops',
98
+ fix: 'Add a Dockerfile for containerized builds and deployments.',
99
+ template: null
100
+ },
101
+
102
+ dockerCompose: {
103
+ id: 39901,
104
+ name: 'Has docker-compose.yml',
105
+ check: (ctx) => ctx.files.some(f => /^docker-compose\.(yml|yaml)$/i.test(f)),
106
+ impact: 'medium',
107
+ rating: 3,
108
+ category: 'devops',
109
+ fix: 'Add docker-compose.yml for multi-service local development.',
110
+ template: null
111
+ },
112
+
113
+ ciPipeline: {
114
+ id: 260,
115
+ name: 'CI pipeline configured',
116
+ check: (ctx) => ctx.hasDir('.github/workflows') || ctx.hasDir('.circleci') ||
117
+ ctx.files.includes('.gitlab-ci.yml') || ctx.files.includes('Jenkinsfile') ||
118
+ ctx.files.includes('.travis.yml') || ctx.files.includes('bitbucket-pipelines.yml'),
119
+ impact: 'high',
120
+ rating: 4,
121
+ category: 'devops',
122
+ fix: 'Add a CI pipeline (GitHub Actions, GitLab CI, CircleCI, etc.) for automated testing and deployment.',
123
+ template: null
124
+ },
125
+
126
+ terraformFiles: {
127
+ id: 397,
128
+ name: 'Infrastructure as Code (Terraform)',
129
+ check: (ctx) => ctx.files.some(f => /\.tf$/.test(f)) || ctx.files.includes('main.tf'),
130
+ impact: 'medium',
131
+ rating: 3,
132
+ category: 'devops',
133
+ fix: 'Add Terraform files for infrastructure-as-code management.',
134
+ template: null
135
+ },
136
+
137
+ dockerMultiStage: {
138
+ id: 39902,
139
+ name: 'Dockerfile uses multi-stage build',
140
+ check: (ctx) => {
141
+ const df = findProjectFiles(ctx, /^Dockerfile$/i);
142
+ if (df.length === 0) return null;
143
+ const content = ctx.fileContent(df[0]) || '';
144
+ return (content.match(/^FROM\s/gim) || []).length >= 2;
145
+ },
146
+ impact: 'medium',
147
+ rating: 3,
148
+ category: 'devops',
149
+ fix: 'Use multi-stage builds in Dockerfile to reduce image size and avoid leaking build tools into production.',
150
+ template: null
151
+ },
152
+
153
+ dockerignoreExists: {
154
+ id: 39903,
155
+ name: '.dockerignore includes node_modules and .env',
156
+ check: (ctx) => {
157
+ if (!ctx.files.some(f => /^Dockerfile/i.test(f))) return null;
158
+ const di = ctx.fileContent('.dockerignore') || '';
159
+ return di.includes('node_modules') && /\.env/i.test(di);
160
+ },
161
+ impact: 'high',
162
+ rating: 4,
163
+ category: 'devops',
164
+ fix: 'Add .dockerignore with node_modules, .env, and other sensitive/large files to keep images small and secure.',
165
+ template: null
166
+ },
167
+
168
+ dockerNoSecrets: {
169
+ id: 39904,
170
+ name: 'Dockerfile has no secrets in build args',
171
+ check: (ctx) => {
172
+ const df = findProjectFiles(ctx, /^Dockerfile$/i);
173
+ if (df.length === 0) return null;
174
+ const content = ctx.fileContent(df[0]) || '';
175
+ return !/ARG\s+(PASSWORD|SECRET|TOKEN|API_KEY|PRIVATE_KEY)/i.test(content);
176
+ },
177
+ impact: 'critical',
178
+ rating: 5,
179
+ category: 'devops',
180
+ fix: 'Never pass secrets via ARG in Dockerfile — use runtime environment variables or secret mounts instead.',
181
+ template: null
182
+ },
183
+
184
+ terraformFmt: {
185
+ id: 39705,
186
+ name: 'Terraform formatting configured',
187
+ check: (ctx) => {
188
+ if (!ctx.files.some(f => /\.tf$/.test(f))) return null;
189
+ const ci = readProjectFiles(ctx, /\.(yml|yaml)$/i, 10);
190
+ const makefileContent = ctx.fileContent('Makefile') || '';
191
+ const preCommit = ctx.fileContent('.pre-commit-config.yaml') || '';
192
+ return /terraform\s+fmt/i.test(ci) || /terraform\s+fmt/i.test(makefileContent) || /terraform_fmt/i.test(preCommit);
193
+ },
194
+ impact: 'medium',
195
+ rating: 3,
196
+ category: 'devops',
197
+ fix: 'Add `terraform fmt` to CI or pre-commit hooks to enforce consistent formatting.',
198
+ template: null
199
+ },
200
+
201
+ terraformDirIgnored: {
202
+ id: 39706,
203
+ name: '.terraform directory in .gitignore',
204
+ check: (ctx) => {
205
+ if (!ctx.files.some(f => /\.tf$/.test(f))) return null;
206
+ const gi = ctx.fileContent('.gitignore') || '';
207
+ return /\.terraform/i.test(gi);
208
+ },
209
+ impact: 'high',
210
+ rating: 4,
211
+ category: 'devops',
212
+ fix: 'Add .terraform/ to .gitignore — it contains provider binaries and should not be committed.',
213
+ template: null
214
+ },
215
+
216
+ terraformStateNotCommitted: {
217
+ id: 39707,
218
+ name: 'Terraform state file not committed',
219
+ check: (ctx) => {
220
+ if (!ctx.files.some(f => /\.tf$/.test(f))) return null;
221
+ return !ctx.files.some(f => /terraform\.tfstate$/i.test(f));
222
+ },
223
+ impact: 'critical',
224
+ rating: 5,
225
+ category: 'devops',
226
+ fix: 'Never commit terraform.tfstate — it may contain secrets. Use a remote backend (S3, GCS, Terraform Cloud).',
227
+ template: null
228
+ },
229
+
230
+ terraformBackendConfigured: {
231
+ id: 39708,
232
+ name: 'Terraform remote backend configured',
233
+ check: (ctx) => {
234
+ const tfFiles = findProjectFiles(ctx, /\.tf$/);
235
+ if (tfFiles.length === 0) return null;
236
+ const allTf = tfFiles.slice(0, 10).map(f => ctx.fileContent(f) || '').join('\n');
237
+ return /backend\s+"(s3|gcs|azurerm|remote|cloud|consul|http)"/i.test(allTf);
238
+ },
239
+ impact: 'high',
240
+ rating: 4,
241
+ category: 'devops',
242
+ fix: 'Configure a remote backend in Terraform (S3, GCS, Terraform Cloud) for team collaboration and state locking.',
243
+ template: null
244
+ },
245
+
246
+ githubActionsOrCI: {
247
+ id: 2021,
248
+ name: 'GitHub Actions or CI configured',
249
+ check: (ctx) => {
250
+ return ctx.hasDir('.github/workflows') || !!ctx.fileContent('.circleci/config.yml') ||
251
+ !!ctx.fileContent('.gitlab-ci.yml') || !!ctx.fileContent('Jenkinsfile') ||
252
+ !!ctx.fileContent('.travis.yml') || !!ctx.fileContent('bitbucket-pipelines.yml');
253
+ },
254
+ impact: 'medium', rating: 3, category: 'devops',
255
+ fix: 'Add CI pipeline for automated testing. Claude Code has a GitHub Action for audit gates.',
256
+ template: null
257
+ },
258
+
259
+ multipleHookTypes: {
260
+ id: 2024,
261
+ name: '2+ hook event types configured',
262
+ check: (ctx) => {
263
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
264
+ const local = ctx.jsonFile('.claude/settings.local.json') || {};
265
+ const hooks = { ...(shared.hooks || {}), ...(local.hooks || {}) };
266
+ return Object.keys(hooks).length >= 2;
267
+ },
268
+ impact: 'medium', rating: 3, category: 'automation',
269
+ fix: 'Add at least 2 hook types (e.g. PostToolUse for linting + SessionStart for initialization).',
270
+ template: null
271
+ },
272
+
273
+ stopFailureHook: {
274
+ id: 2025,
275
+ name: 'StopFailure hook for error tracking',
276
+ check: (ctx) => {
277
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
278
+ const local = ctx.jsonFile('.claude/settings.local.json') || {};
279
+ // StopFailure = error stop (API errors), Stop = normal completion — both useful but different
280
+ return !!(shared.hooks?.StopFailure || local.hooks?.StopFailure);
281
+ },
282
+ impact: 'low', rating: 3, category: 'automation',
283
+ fix: 'Add a StopFailure hook to log API errors and unexpected stops. Note: StopFailure (errors) is different from Stop (normal completion).',
284
+ template: null
285
+ },
286
+
287
+ hooksNotificationEvent: {
288
+ id: 2033,
289
+ name: 'Notification hook for alerts',
290
+ check: (ctx) => {
291
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
292
+ const local = ctx.jsonFile('.claude/settings.local.json') || {};
293
+ return !!(shared.hooks?.Notification || local.hooks?.Notification);
294
+ },
295
+ impact: 'low',
296
+ rating: 2,
297
+ category: 'automation',
298
+ fix: 'Add a Notification hook to capture alerts and status updates from Claude during long tasks.',
299
+ template: null
300
+ },
301
+
302
+ subagentStopHook: {
303
+ id: 2034,
304
+ name: 'SubagentStop hook for delegation tracking',
305
+ check: (ctx) => {
306
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
307
+ const local = ctx.jsonFile('.claude/settings.local.json') || {};
308
+ return !!(shared.hooks?.SubagentStop || local.hooks?.SubagentStop);
309
+ },
310
+ impact: 'low',
311
+ rating: 2,
312
+ category: 'automation',
313
+ fix: 'Add a SubagentStop hook to track when delegated subagent tasks complete.',
314
+ template: null
315
+ },
316
+ };
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Compliance technique fragments.
3
+ * Generated mechanically from the legacy techniques.js monolith during HR-09.
4
+ */
5
+
6
+ const {
7
+ hasFrontendSignals,
8
+ hasProjectFile,
9
+ readProjectFiles,
10
+ } = require('./shared');
11
+
12
+ module.exports = {
13
+ a11yTestingTool: {
14
+ id: 130011,
15
+ name: 'Accessibility testing tool',
16
+ check: (ctx) => {
17
+ if (!hasFrontendSignals(ctx)) return null;
18
+ const pkg = ctx.fileContent('package.json') || '';
19
+ return /axe-core|pa11y|@testing-library\/jest-dom|jest-axe|cypress-axe|@axe-core/i.test(pkg);
20
+ },
21
+ impact: 'high',
22
+ category: 'accessibility',
23
+ fix: 'Add an accessibility testing tool (axe-core, pa11y, jest-axe) to catch a11y regressions.',
24
+ },
25
+
26
+ ariaLabels: {
27
+ id: 130012,
28
+ name: 'ARIA labels in components',
29
+ check: (ctx) => {
30
+ if (!hasFrontendSignals(ctx)) return null;
31
+ const components = readProjectFiles(ctx, /\.(jsx|tsx|vue|svelte|html)$/i);
32
+ if (!components) return null;
33
+ return /aria-label|aria-labelledby|aria-describedby/i.test(components);
34
+ },
35
+ impact: 'high',
36
+ category: 'accessibility',
37
+ fix: 'Add aria-label or aria-labelledby attributes to interactive components for screen readers.',
38
+ },
39
+
40
+ wcagMentioned: {
41
+ id: 130013,
42
+ name: 'WCAG or accessibility in docs',
43
+ check: (ctx) => {
44
+ if (!hasFrontendSignals(ctx)) return null;
45
+ const docs = readProjectFiles(ctx, /\.(md|txt|rst)$/i);
46
+ const configs = readProjectFiles(ctx, /\.(ya?ml|json|toml)$/i);
47
+ return /wcag|accessibility|a11y/i.test(docs + configs);
48
+ },
49
+ impact: 'medium',
50
+ category: 'accessibility',
51
+ fix: 'Document WCAG compliance level and accessibility standards in your project docs.',
52
+ },
53
+
54
+ semanticHtml: {
55
+ id: 130014,
56
+ name: 'Semantic HTML elements used',
57
+ check: (ctx) => {
58
+ if (!hasFrontendSignals(ctx)) return null;
59
+ const templates = readProjectFiles(ctx, /\.(jsx|tsx|vue|svelte|html)$/i);
60
+ if (!templates) return null;
61
+ return /<(nav|main|article|section|aside|header|footer)\b/i.test(templates);
62
+ },
63
+ impact: 'medium',
64
+ category: 'accessibility',
65
+ fix: 'Use semantic HTML elements (nav, main, article, section, aside) instead of generic div elements.',
66
+ },
67
+
68
+ colorContrastTool: {
69
+ id: 130015,
70
+ name: 'Color contrast checking configured',
71
+ check: (ctx) => {
72
+ if (!hasFrontendSignals(ctx)) return null;
73
+ const pkg = ctx.fileContent('package.json') || '';
74
+ const configs = readProjectFiles(ctx, /\.(ya?ml|json|toml|js|ts)$/i);
75
+ return /axe-core|lighthouse|contrast-checker|color-contrast|a11y.*color/i.test(pkg + configs);
76
+ },
77
+ impact: 'medium',
78
+ category: 'accessibility',
79
+ fix: 'Configure a color contrast checking tool (axe, Lighthouse CI, contrast-checker) for WCAG AA compliance.',
80
+ },
81
+
82
+ keyboardNavigation: {
83
+ id: 130016,
84
+ name: 'Keyboard navigation patterns',
85
+ check: (ctx) => {
86
+ if (!hasFrontendSignals(ctx)) return null;
87
+ const components = readProjectFiles(ctx, /\.(jsx|tsx|vue|svelte|html)$/i);
88
+ if (!components) return null;
89
+ return /tabindex|onKeyDown|onKeyUp|onKeyPress|@keydown|@keyup|v-on:keydown|focus-trap|useFocusTrap|FocusTrap/i.test(components);
90
+ },
91
+ impact: 'medium',
92
+ category: 'accessibility',
93
+ fix: 'Implement keyboard navigation with tabindex, key handlers, and focus management for accessible UIs.',
94
+ },
95
+
96
+ privacyPolicy: {
97
+ id: 130021,
98
+ name: 'Privacy policy document exists',
99
+ check: (ctx) => {
100
+ return ctx.files.some(f => /privacy/i.test(f) && /\.(md|txt|html|rst)$/i.test(f)) ||
101
+ hasProjectFile(ctx, /privacy[_-]?policy/i);
102
+ },
103
+ impact: 'high',
104
+ category: 'privacy',
105
+ fix: 'Create a PRIVACY.md or privacy-policy document describing data handling practices.',
106
+ },
107
+
108
+ consentManagement: {
109
+ id: 130022,
110
+ name: 'Consent management configured',
111
+ check: (ctx) => {
112
+ const pkg = ctx.fileContent('package.json') || '';
113
+ const code = readProjectFiles(ctx, /\.(js|ts|jsx|tsx|html)$/i);
114
+ return /cookie-consent|cookieconsent|onetrust|cookiebot|consent-manager|cookie.*banner/i.test(pkg + code);
115
+ },
116
+ impact: 'high',
117
+ category: 'privacy',
118
+ fix: 'Add a consent management solution (CookieConsent, OneTrust, Cookiebot) for GDPR cookie compliance.',
119
+ },
120
+
121
+ dataRetentionPolicy: {
122
+ id: 130023,
123
+ name: 'Data retention policy documented',
124
+ check: (ctx) => {
125
+ const docs = readProjectFiles(ctx, /\.(md|txt|rst|ya?ml|json)$/i);
126
+ return /data.retention|retention.polic|ttl.*expir|expir.*polic/i.test(docs);
127
+ },
128
+ impact: 'medium',
129
+ category: 'privacy',
130
+ fix: 'Document your data retention policy specifying how long user data is stored and when it is deleted.',
131
+ },
132
+
133
+ piiHandling: {
134
+ id: 130024,
135
+ name: 'PII handling patterns in code',
136
+ check: (ctx) => {
137
+ const code = readProjectFiles(ctx, /\.(js|ts|py|go|rs|java|rb)$/i);
138
+ return /\bredact|anonymize|pseudonymize|mask.*(email|phone|ssn|pii)|pii.*mask|sanitize.*(user|personal)/i.test(code);
139
+ },
140
+ impact: 'high',
141
+ category: 'privacy',
142
+ fix: 'Implement PII handling patterns (redact, anonymize, mask) to protect personal data in logs and storage.',
143
+ },
144
+
145
+ gdprCompliance: {
146
+ id: 130025,
147
+ name: 'GDPR/CCPA compliance mentioned',
148
+ check: (ctx) => {
149
+ const docs = readProjectFiles(ctx, /\.(md|txt|rst)$/i);
150
+ const configs = readProjectFiles(ctx, /\.(ya?ml|json|toml)$/i);
151
+ return /\bgdpr\b|\bccpa\b|data.protection|right.to.erasure|data.subject|dpa\b/i.test(docs + configs);
152
+ },
153
+ impact: 'high',
154
+ category: 'privacy',
155
+ fix: 'Document GDPR/CCPA compliance measures and data protection practices in your project.',
156
+ },
157
+
158
+ dataEncryption: {
159
+ id: 130026,
160
+ name: 'Data encryption in deps or config',
161
+ check: (ctx) => {
162
+ const pkg = ctx.fileContent('package.json') || '';
163
+ const req = readProjectFiles(ctx, /(^|\/)requirements[^/]*\.txt$/i);
164
+ const goMod = ctx.fileContent('go.mod') || '';
165
+ const cargo = ctx.fileContent('Cargo.toml') || '';
166
+ const deps = [pkg, req, goMod, cargo].join('\n');
167
+ return /bcrypt|argon2|scrypt|crypto|node:crypto|cryptography|ring\b|rustls|tls.*config|ssl.*config|encryption.at.rest/i.test(deps) ||
168
+ /encrypt|bcrypt|argon2/i.test(readProjectFiles(ctx, /\.(js|ts|py|go|rs|java)$/i));
169
+ },
170
+ impact: 'high',
171
+ category: 'privacy',
172
+ fix: 'Use encryption libraries (bcrypt, argon2, crypto) for data at rest and configure TLS for data in transit.',
173
+ },
174
+
175
+ i18nLibrary: {
176
+ id: 130101,
177
+ name: 'i18n library in dependencies',
178
+ check: (ctx) => {
179
+ const pkg = ctx.fileContent('package.json') || '';
180
+ if (/i18next|react-intl|vue-i18n|@angular\/localize/i.test(pkg)) return true;
181
+ const py = readProjectFiles(ctx, /(^|\/)pyproject\.toml$/i) + readProjectFiles(ctx, /(^|\/)requirements[^/]*\.txt$/i);
182
+ if (/gettext|babel|fluent/i.test(py)) return true;
183
+ return false;
184
+ },
185
+ impact: 'medium',
186
+ category: 'i18n',
187
+ fix: 'Add an i18n library (i18next, react-intl, vue-i18n, gettext, fluent) for internationalization support.',
188
+ confidence: 0.7,
189
+ },
190
+
191
+ localeFiles: {
192
+ id: 130102,
193
+ name: 'Locale files exist',
194
+ check: (ctx) => {
195
+ return hasProjectFile(ctx, /(^|\/)locales\//i) ||
196
+ hasProjectFile(ctx, /(^|\/)messages\//i) ||
197
+ hasProjectFile(ctx, /(^|\/)translations\//i) ||
198
+ hasProjectFile(ctx, /\.(po|xlf)$/i);
199
+ },
200
+ impact: 'medium',
201
+ category: 'i18n',
202
+ fix: 'Add locale files in a locales/, messages/, or translations/ directory for multi-language support.',
203
+ confidence: 0.7,
204
+ },
205
+
206
+ rtlSupport: {
207
+ id: 130103,
208
+ name: 'RTL support configured',
209
+ check: (ctx) => {
210
+ const src = readProjectFiles(ctx, /\.(jsx?|tsx?|vue|html|css|scss)$/i, 30);
211
+ return /dir=["']rtl["']|\brtl\b|\bbidi\b/i.test(src);
212
+ },
213
+ impact: 'low',
214
+ category: 'i18n',
215
+ fix: 'Add RTL (right-to-left) support with dir="rtl" or bidi utilities for languages like Arabic and Hebrew.',
216
+ confidence: 0.7,
217
+ },
218
+
219
+ pluralizationRules: {
220
+ id: 130104,
221
+ name: 'ICU message format or pluralization',
222
+ check: (ctx) => {
223
+ const src = readProjectFiles(ctx, /\.(jsx?|tsx?|json|properties)$/i, 30);
224
+ return /\{[^}]*,\s*plural\s*,/i.test(src) || /\bplural\b.*\bone\b|\bICU\b/i.test(src);
225
+ },
226
+ impact: 'low',
227
+ category: 'i18n',
228
+ fix: 'Use ICU message format or pluralization rules for correct multi-language number/gender handling.',
229
+ confidence: 0.7,
230
+ },
231
+
232
+ i18nExtraction: {
233
+ id: 130105,
234
+ name: 'i18n extraction tool configured',
235
+ check: (ctx) => {
236
+ const pkg = ctx.fileContent('package.json') || '';
237
+ return /babel-plugin-react-intl|i18next-parser|@formatjs\/cli|react-intl-translations-manager/i.test(pkg);
238
+ },
239
+ impact: 'low',
240
+ category: 'i18n',
241
+ fix: 'Add an i18n extraction tool (i18next-parser, @formatjs/cli) to auto-extract translatable strings.',
242
+ confidence: 0.7,
243
+ },
244
+
245
+ dateTimeFormatting: {
246
+ id: 130106,
247
+ name: 'Locale-aware date/time formatting',
248
+ check: (ctx) => {
249
+ const src = readProjectFiles(ctx, /\.(jsx?|tsx?|vue)$/i, 30);
250
+ return /Intl\.DateTimeFormat|date-fns\/locale|dayjs\/locale|moment\/locale/i.test(src);
251
+ },
252
+ impact: 'low',
253
+ category: 'i18n',
254
+ fix: 'Use locale-aware date/time formatting (Intl.DateTimeFormat, date-fns/locale, dayjs/locale) instead of hardcoded formats.',
255
+ confidence: 0.7,
256
+ },
257
+ };