@nerviq/cli 1.20.1 → 1.21.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 (181) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +2 -2
  3. package/package.json +1 -1
  4. package/src/activity.js +1039 -1039
  5. package/src/adoption-advisor.js +299 -299
  6. package/src/aider/config-parser.js +166 -166
  7. package/src/aider/context.js +4 -1
  8. package/src/aider/deep-review.js +316 -316
  9. package/src/aider/domain-packs.js +303 -303
  10. package/src/aider/freshness.js +93 -93
  11. package/src/aider/governance.js +253 -253
  12. package/src/aider/interactive.js +334 -334
  13. package/src/aider/mcp-packs.js +329 -329
  14. package/src/aider/patch.js +214 -214
  15. package/src/aider/plans.js +186 -186
  16. package/src/aider/premium.js +360 -360
  17. package/src/aider/setup.js +404 -404
  18. package/src/aider/techniques.js +312 -67
  19. package/src/analyze.js +951 -951
  20. package/src/anti-patterns.js +485 -485
  21. package/src/audit/instruction-files.js +180 -180
  22. package/src/audit/recommendations.js +577 -577
  23. package/src/auto-suggest.js +154 -154
  24. package/src/badge.js +13 -13
  25. package/src/behavioral-drift.js +801 -801
  26. package/src/benchmark.js +67 -67
  27. package/src/catalog.js +103 -103
  28. package/src/certification.js +128 -128
  29. package/src/codex/config-parser.js +183 -183
  30. package/src/codex/context.js +223 -223
  31. package/src/codex/deep-review.js +493 -493
  32. package/src/codex/domain-packs.js +394 -394
  33. package/src/codex/freshness.js +84 -84
  34. package/src/codex/governance.js +192 -192
  35. package/src/codex/interactive.js +618 -618
  36. package/src/codex/mcp-packs.js +914 -914
  37. package/src/codex/patch.js +209 -209
  38. package/src/codex/plans.js +251 -251
  39. package/src/codex/premium.js +614 -614
  40. package/src/codex/setup.js +591 -591
  41. package/src/continuous-ops.js +681 -681
  42. package/src/copilot/activity.js +309 -309
  43. package/src/copilot/deep-review.js +346 -346
  44. package/src/copilot/domain-packs.js +372 -372
  45. package/src/copilot/freshness.js +57 -57
  46. package/src/copilot/governance.js +222 -222
  47. package/src/copilot/interactive.js +406 -406
  48. package/src/copilot/mcp-packs.js +826 -826
  49. package/src/copilot/plans.js +253 -253
  50. package/src/copilot/premium.js +451 -451
  51. package/src/copilot/setup.js +488 -488
  52. package/src/cost-tracking.js +61 -61
  53. package/src/cursor/activity.js +301 -301
  54. package/src/cursor/config-parser.js +265 -265
  55. package/src/cursor/context.js +256 -256
  56. package/src/cursor/deep-review.js +334 -334
  57. package/src/cursor/domain-packs.js +368 -368
  58. package/src/cursor/freshness.js +65 -65
  59. package/src/cursor/governance.js +229 -229
  60. package/src/cursor/interactive.js +391 -391
  61. package/src/cursor/mcp-packs.js +828 -828
  62. package/src/cursor/plans.js +254 -254
  63. package/src/cursor/premium.js +469 -469
  64. package/src/cursor/setup.js +488 -488
  65. package/src/dashboard.js +493 -493
  66. package/src/deep-review.js +428 -428
  67. package/src/deprecation.js +98 -98
  68. package/src/diff-only.js +280 -280
  69. package/src/doctor.js +119 -119
  70. package/src/domain-pack-expansion.js +1033 -1033
  71. package/src/domain-packs.js +387 -387
  72. package/src/feedback.js +178 -178
  73. package/src/fix-engine.js +783 -783
  74. package/src/fix-prompts.js +122 -122
  75. package/src/formatters/sarif.js +115 -115
  76. package/src/freshness.js +74 -74
  77. package/src/gemini/config-parser.js +275 -275
  78. package/src/gemini/deep-review.js +559 -559
  79. package/src/gemini/domain-packs.js +393 -393
  80. package/src/gemini/freshness.js +66 -66
  81. package/src/gemini/governance.js +201 -201
  82. package/src/gemini/interactive.js +860 -860
  83. package/src/gemini/mcp-packs.js +915 -915
  84. package/src/gemini/plans.js +269 -269
  85. package/src/gemini/premium.js +760 -760
  86. package/src/gemini/setup.js +692 -692
  87. package/src/governance.js +72 -72
  88. package/src/harmony/add.js +68 -68
  89. package/src/harmony/advisor.js +333 -333
  90. package/src/harmony/canon.js +565 -565
  91. package/src/harmony/cli.js +591 -591
  92. package/src/harmony/drift.js +401 -401
  93. package/src/harmony/governance.js +313 -313
  94. package/src/harmony/memory.js +239 -239
  95. package/src/harmony/sync.js +475 -475
  96. package/src/harmony/watch.js +370 -370
  97. package/src/hook-validation.js +342 -342
  98. package/src/index.js +271 -271
  99. package/src/init.js +184 -184
  100. package/src/instruction-surfaces.js +185 -185
  101. package/src/integrations.js +144 -144
  102. package/src/interactive.js +118 -118
  103. package/src/locales/en.json +1 -1
  104. package/src/locales/es.json +1 -1
  105. package/src/mcp-packs.js +830 -830
  106. package/src/mcp-server.js +726 -726
  107. package/src/mcp-validation.js +337 -337
  108. package/src/nerviq-sync.json +7 -7
  109. package/src/opencode/config-parser.js +109 -109
  110. package/src/opencode/context.js +247 -247
  111. package/src/opencode/deep-review.js +313 -313
  112. package/src/opencode/domain-packs.js +262 -262
  113. package/src/opencode/freshness.js +66 -66
  114. package/src/opencode/governance.js +159 -159
  115. package/src/opencode/interactive.js +392 -392
  116. package/src/opencode/mcp-packs.js +705 -705
  117. package/src/opencode/patch.js +184 -184
  118. package/src/opencode/plans.js +231 -231
  119. package/src/opencode/premium.js +413 -413
  120. package/src/opencode/setup.js +449 -449
  121. package/src/opencode/techniques.js +27 -27
  122. package/src/operating-profile.js +574 -574
  123. package/src/org.js +152 -152
  124. package/src/permission-rules.js +218 -218
  125. package/src/plans.js +839 -839
  126. package/src/platform-change-manifest.js +86 -86
  127. package/src/plugins.js +110 -110
  128. package/src/policy-layers.js +210 -210
  129. package/src/profiles.js +124 -124
  130. package/src/prompt-injection.js +74 -74
  131. package/src/public-api.js +173 -173
  132. package/src/recommendation-rules.js +84 -84
  133. package/src/repo-archetype.js +386 -386
  134. package/src/secret-patterns.js +39 -39
  135. package/src/server.js +527 -527
  136. package/src/setup/analysis.js +607 -607
  137. package/src/setup/runtime.js +172 -172
  138. package/src/setup.js +677 -677
  139. package/src/shared/capabilities.js +194 -194
  140. package/src/source-urls.js +132 -132
  141. package/src/stack-checks.js +565 -565
  142. package/src/supplemental-checks.js +13 -13
  143. package/src/synergy/adaptive.js +261 -261
  144. package/src/synergy/compensation.js +137 -137
  145. package/src/synergy/evidence.js +193 -193
  146. package/src/synergy/learning.js +199 -199
  147. package/src/synergy/patterns.js +227 -227
  148. package/src/synergy/ranking.js +83 -83
  149. package/src/synergy/report.js +165 -165
  150. package/src/synergy/routing.js +146 -146
  151. package/src/techniques/api.js +407 -407
  152. package/src/techniques/automation.js +316 -316
  153. package/src/techniques/compliance.js +257 -257
  154. package/src/techniques/hygiene.js +294 -294
  155. package/src/techniques/instructions.js +243 -243
  156. package/src/techniques/observability.js +226 -226
  157. package/src/techniques/optimization.js +142 -142
  158. package/src/techniques/quality.js +318 -318
  159. package/src/techniques/security.js +237 -237
  160. package/src/techniques/shared.js +443 -443
  161. package/src/techniques/stacks.js +2294 -2294
  162. package/src/techniques/tools.js +106 -106
  163. package/src/techniques/workflow.js +413 -413
  164. package/src/techniques.js +81 -81
  165. package/src/terminology.js +73 -73
  166. package/src/token-estimate.js +35 -35
  167. package/src/usage-patterns.js +99 -99
  168. package/src/verification-metadata.js +145 -145
  169. package/src/watch.js +247 -247
  170. package/src/windsurf/activity.js +302 -302
  171. package/src/windsurf/config-parser.js +267 -267
  172. package/src/windsurf/deep-review.js +337 -337
  173. package/src/windsurf/domain-packs.js +370 -370
  174. package/src/windsurf/freshness.js +36 -36
  175. package/src/windsurf/governance.js +231 -231
  176. package/src/windsurf/interactive.js +388 -388
  177. package/src/windsurf/mcp-packs.js +792 -792
  178. package/src/windsurf/plans.js +247 -247
  179. package/src/windsurf/premium.js +468 -468
  180. package/src/windsurf/setup.js +471 -471
  181. package/src/workspace.js +375 -375
@@ -1,413 +1,413 @@
1
- /**
2
- * Workflow technique fragments.
3
- * Generated mechanically from the legacy techniques.js monolith during HR-09.
4
- */
5
-
6
- const {
7
- fs,
8
- path,
9
- hasProjectFile,
10
- readProjectFiles,
11
- getWorkflowContent,
12
- resolveProjectStateReadPath,
13
- } = require('./shared');
14
-
15
- module.exports = {
16
- customCommands: {
17
- id: 20,
18
- name: 'Custom slash commands',
19
- check: (ctx) => ctx.hasDir('.claude/commands') && ctx.dirFiles('.claude/commands').length > 0,
20
- impact: 'high',
21
- rating: 4,
22
- category: 'workflow',
23
- fix: 'Create custom commands for repeated workflows (/test, /deploy, /review).',
24
- template: 'commands'
25
- },
26
-
27
- multipleCommands: {
28
- id: 20001,
29
- name: '3+ slash commands for rich workflow',
30
- check: (ctx) => ctx.hasDir('.claude/commands') && ctx.dirFiles('.claude/commands').length >= 3,
31
- impact: 'medium',
32
- rating: 4,
33
- category: 'workflow',
34
- fix: 'Add at least 3 slash commands to cover your main workflows (test, deploy, review, etc.).',
35
- template: 'commands'
36
- },
37
-
38
- deployCommand: {
39
- id: 20002,
40
- name: 'Has /deploy or /release command',
41
- check: (ctx) => {
42
- if (!ctx.hasDir('.claude/commands')) return false;
43
- const files = ctx.dirFiles('.claude/commands');
44
- return files.some(f => /deploy|release/i.test(f));
45
- },
46
- impact: 'medium',
47
- rating: 4,
48
- category: 'workflow',
49
- fix: 'Create a /deploy or /release command for one-click deployments.',
50
- template: null
51
- },
52
-
53
- reviewCommand: {
54
- id: 20003,
55
- name: 'Has /review command',
56
- check: (ctx) => {
57
- if (!ctx.hasDir('.claude/commands')) return false;
58
- const files = ctx.dirFiles('.claude/commands');
59
- return files.some(f => /review/i.test(f));
60
- },
61
- impact: 'medium',
62
- rating: 4,
63
- category: 'workflow',
64
- fix: 'Create a /review command for code review workflows.',
65
- template: null
66
- },
67
-
68
- skills: {
69
- id: 21,
70
- name: 'Custom skills',
71
- check: (ctx) => {
72
- // Skills use directory-per-skill structure: .claude/skills/<name>/SKILL.md
73
- if (!ctx.hasDir('.claude/skills')) return false;
74
- const dirs = ctx.dirFiles('.claude/skills');
75
- // Check for SKILL.md inside skill directories
76
- for (const d of dirs) {
77
- if (ctx.fileContent(`.claude/skills/${d}/SKILL.md`)) return true;
78
- }
79
- // Fallback: any files in skills dir (legacy .claude/commands/ also works)
80
- return dirs.length > 0;
81
- },
82
- impact: 'medium',
83
- rating: 4,
84
- category: 'workflow',
85
- fix: 'Create skills at .claude/skills/<name>/SKILL.md with YAML frontmatter (name, description). Each skill is a directory with a SKILL.md file.',
86
- template: 'skills'
87
- },
88
-
89
- multipleSkills: {
90
- id: 2101,
91
- name: '2+ skills for specialization',
92
- check: (ctx) => {
93
- if (!ctx.hasDir('.claude/skills')) return false;
94
- return ctx.dirFiles('.claude/skills').length >= 2;
95
- },
96
- impact: 'medium',
97
- rating: 4,
98
- category: 'workflow',
99
- fix: 'Add at least 2 skills covering different workflows (e.g. code-review, test-writer).',
100
- template: 'skills'
101
- },
102
-
103
- agents: {
104
- id: 22,
105
- name: 'Custom agents',
106
- check: (ctx) => ctx.hasDir('.claude/agents') && ctx.dirFiles('.claude/agents').length > 0,
107
- impact: 'medium',
108
- rating: 4,
109
- category: 'workflow',
110
- fix: 'Create specialized agents (security-reviewer, test-writer) in .claude/agents/.',
111
- template: 'agents'
112
- },
113
-
114
- multipleAgents: {
115
- id: 2201,
116
- name: '2+ agents for delegation',
117
- check: (ctx) => ctx.hasDir('.claude/agents') && ctx.dirFiles('.claude/agents').length >= 2,
118
- impact: 'medium',
119
- rating: 4,
120
- category: 'workflow',
121
- fix: 'Add at least 2 agents for specialized tasks (e.g. security-reviewer, test-writer).',
122
- template: 'agents'
123
- },
124
-
125
- multipleRules: {
126
- id: 301,
127
- name: '2+ rules files for granular control',
128
- check: (ctx) => ctx.hasDir('.claude/rules') && ctx.dirFiles('.claude/rules').length >= 2,
129
- impact: 'medium',
130
- rating: 4,
131
- category: 'workflow',
132
- fix: 'Add path-specific rules for different parts of the codebase (frontend, backend, tests).',
133
- template: 'rules'
134
- },
135
-
136
- channelsAwareness: {
137
- id: 1102,
138
- name: 'Claude Code Channels awareness',
139
- check: (ctx) => {
140
- const md = ctx.claudeMdContent() || '';
141
- const settings = ctx.jsonFile('.claude/settings.local.json') || ctx.jsonFile('.claude/settings.json');
142
- const settingsStr = JSON.stringify(settings || {});
143
- return /\bchannels?\b.*\b(telegram|discord|imessage|slack|bridge)\b|\b(telegram|discord|imessage|slack|bridge)\b.*\bchannels?\b/i.test(md) || settingsStr.includes('channels');
144
- },
145
- impact: 'low',
146
- rating: 3,
147
- category: 'features',
148
- fix: 'Claude Code Channels (v2.1.80+) bridges Telegram/Discord/iMessage to your session.',
149
- template: null
150
- },
151
-
152
- agentHasAllowedTools: {
153
- id: 2011,
154
- name: 'At least one subagent restricts tools',
155
- check: (ctx) => {
156
- if (!ctx.hasDir('.claude/agents')) return null;
157
- const files = ctx.dirFiles('.claude/agents');
158
- if (files.length === 0) return null;
159
- for (const f of files) {
160
- const content = ctx.fileContent(`.claude/agents/${f}`) || '';
161
- // Current frontmatter uses allowed-tools (also accept legacy tools:)
162
- if (/allowed-tools:/i.test(content) || /tools:\s*\[/.test(content)) return true;
163
- }
164
- return false;
165
- },
166
- impact: 'medium', rating: 3, category: 'workflow',
167
- fix: 'Add allowed-tools to subagent frontmatter (e.g. allowed-tools: Read Grep Bash) for safer delegation.',
168
- template: null
169
- },
170
-
171
- hasSnapshotHistory: {
172
- id: 2017,
173
- name: 'Audit snapshot history exists',
174
- check: (ctx) => {
175
- const fs = require('fs');
176
- return fs.existsSync(resolveProjectStateReadPath(ctx.dir, 'snapshots', 'index.json'));
177
- },
178
- impact: 'low', rating: 3, category: 'workflow',
179
- fix: 'Run `npx nerviq --snapshot` to start tracking your setup score over time.',
180
- template: null
181
- },
182
-
183
- worktreeAwareness: {
184
- id: 2018,
185
- name: 'Worktree or parallel sessions mentioned',
186
- check: (ctx) => {
187
- const md = ctx.claudeMdContent() || '';
188
- const shared = ctx.jsonFile('.claude/settings.json') || {};
189
- return /worktree|parallel.*session/i.test(md) || !!shared.worktree;
190
- },
191
- impact: 'low', rating: 3, category: 'features',
192
- fix: 'Claude Code supports git worktrees for parallel isolated sessions. Mention if relevant.',
193
- template: null
194
- },
195
-
196
- skillUsesPaths: {
197
- id: 2026,
198
- name: 'At least one skill uses paths for scoping',
199
- check: (ctx) => {
200
- if (!ctx.hasDir('.claude/skills')) return null;
201
- const entries = ctx.dirFiles('.claude/skills');
202
- if (entries.length === 0) return null;
203
- for (const entry of entries) {
204
- // Skills can be files or dirs with SKILL.md inside
205
- const direct = ctx.fileContent(`.claude/skills/${entry}`) || '';
206
- if (/paths:/i.test(direct)) return true;
207
- const nested = ctx.fileContent(`.claude/skills/${entry}/SKILL.md`) || '';
208
- if (/paths:/i.test(nested)) return true;
209
- }
210
- return false;
211
- },
212
- impact: 'low', rating: 3, category: 'workflow',
213
- fix: 'Add paths to skill frontmatter to scope when skills activate (e.g. paths: ["src/**/*.ts"]).',
214
- template: null
215
- },
216
-
217
- rulesDirectory: {
218
- id: 2035,
219
- name: 'Path-specific rules in .claude/rules/',
220
- check: (ctx) => ctx.hasDir('.claude/rules') && ctx.dirFiles('.claude/rules').length > 0,
221
- impact: 'medium',
222
- rating: 3,
223
- category: 'workflow',
224
- fix: 'Create .claude/rules/ with path-specific rules for different parts of your codebase (e.g. frontend.md, backend.md).',
225
- template: null
226
- },
227
-
228
- hasLlmsTxt: {
229
- id: 110001,
230
- name: 'Has /llms.txt or llms.txt for LLM context',
231
- check: (ctx) => {
232
- return ctx.files.some(f => /^(public\/)?llms\.txt$/i.test(f) || /^llms-full\.txt$/i.test(f));
233
- },
234
- impact: 'low', rating: 3, category: 'features',
235
- fix: 'Add llms.txt to provide LLM-friendly project context. See llmstxt.org for the standard.',
236
- template: null,
237
- confidence: 0.8,
238
- },
239
-
240
- instinctToSkillProgression: {
241
- id: 110006,
242
- name: 'Instinct-to-skill progression documented',
243
- check: (ctx) => {
244
- const md = ctx.claudeMdContent() || '';
245
- return /progressive learning|instinct[- ]to[- ]skill|instinct.{0,40}skill|skill.{0,40}instinct|graduated|phased approach/i.test(md);
246
- },
247
- impact: 'low', rating: 3, category: 'features',
248
- fix: 'Document a progressive learning path that turns repeated instincts into reusable skills or phased practices.',
249
- template: null,
250
- confidence: 0.7,
251
- },
252
-
253
- featureFlagService: {
254
- id: 130141,
255
- name: 'Feature flag service in dependencies',
256
- check: (ctx) => {
257
- const pkg = ctx.fileContent('package.json') || '';
258
- if (/launchdarkly|unleash|flagsmith|growthbook|@split/i.test(pkg)) return true;
259
- const py = readProjectFiles(ctx, /(^|\/)pyproject\.toml$/i) + readProjectFiles(ctx, /(^|\/)requirements[^/]*\.txt$/i);
260
- if (/launchdarkly|unleash|flagsmith|growthbook/i.test(py)) return true;
261
- return false;
262
- },
263
- impact: 'medium',
264
- category: 'feature-flags',
265
- fix: 'Add a feature flag service (LaunchDarkly, Unleash, Flagsmith, GrowthBook) for safe feature rollouts.',
266
- confidence: 0.7,
267
- },
268
-
269
- featureFlagConfig: {
270
- id: 130142,
271
- name: 'Feature flag config files exist',
272
- check: (ctx) => {
273
- return hasProjectFile(ctx, /(^|\/)flags\.json$/i) ||
274
- hasProjectFile(ctx, /(^|\/)features\.json$/i) ||
275
- hasProjectFile(ctx, /(^|\/)feature-flags\//i);
276
- },
277
- impact: 'low',
278
- category: 'feature-flags',
279
- fix: 'Add feature flag configuration files (flags.json, features.json, or feature-flags/ directory).',
280
- confidence: 0.7,
281
- },
282
-
283
- featureFlagTests: {
284
- id: 130143,
285
- name: 'Feature flag testing present',
286
- check: (ctx) => {
287
- const testFiles = readProjectFiles(ctx, /(test|spec)\.(jsx?|tsx?|py|go|java|rb)$/i, 30);
288
- return /flag|feature.*toggle|variation/i.test(testFiles);
289
- },
290
- impact: 'low',
291
- category: 'feature-flags',
292
- fix: 'Add tests for feature flag variations to verify behavior under different flag states.',
293
- confidence: 0.7,
294
- },
295
-
296
- flagLifecycle: {
297
- id: 130144,
298
- name: 'Flag lifecycle management',
299
- check: (ctx) => {
300
- return hasProjectFile(ctx, /flag-audit|remove-flag|flag.*cleanup/i) ||
301
- /flag.*lifecycle|flag.*cleanup|stale.*flag/i.test(readProjectFiles(ctx, /\.(md|txt|json)$/i, 10));
302
- },
303
- impact: 'low',
304
- category: 'feature-flags',
305
- fix: 'Add flag lifecycle scripts or docs (flag-audit, remove-flag) to prevent stale flag accumulation.',
306
- confidence: 0.7,
307
- },
308
-
309
- envBasedFlags: {
310
- id: 130145,
311
- name: 'Environment-based feature toggles',
312
- check: (ctx) => {
313
- const envFiles = readProjectFiles(ctx, /(^|\/)(\.env|\.env\.\w+)$/i);
314
- const config = readProjectFiles(ctx, /\.(json|ya?ml|toml)$/i, 15);
315
- return /FEATURE_|ENABLE_|FF_/i.test(envFiles + config);
316
- },
317
- impact: 'low',
318
- category: 'feature-flags',
319
- fix: 'Use environment-based feature toggles (FEATURE_, ENABLE_, FF_ prefixes) for deployment-time configuration.',
320
- confidence: 0.7,
321
- },
322
-
323
- monorepoTool: {
324
- id: 130161,
325
- name: 'Monorepo tool configured',
326
- check: (ctx) => {
327
- const pkg = ctx.fileContent('package.json') || '';
328
- const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
329
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
330
- hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
331
- if (!hasMonorepo) return null;
332
- return /turborepo|turbo|"nx"|lerna|rush|bazel/i.test(pkg) ||
333
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
334
- ctx.files.includes('lerna.json') || ctx.files.includes('rush.json');
335
- },
336
- impact: 'medium',
337
- category: 'monorepo',
338
- fix: 'Configure a monorepo orchestration tool (Turborepo, Nx, Lerna, Rush) for efficient multi-package builds.',
339
- confidence: 0.7,
340
- },
341
-
342
- workspaceDeps: {
343
- id: 130162,
344
- name: 'Workspace dependency management configured',
345
- check: (ctx) => {
346
- const pkg = ctx.fileContent('package.json') || '';
347
- const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
348
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
349
- hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
350
- if (!hasMonorepo) return null;
351
- return hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i) || /workspaces/i.test(pkg);
352
- },
353
- impact: 'medium',
354
- category: 'monorepo',
355
- fix: 'Configure workspace dependencies (pnpm-workspace.yaml or workspaces in package.json) for cross-package linking.',
356
- confidence: 0.7,
357
- },
358
-
359
- changesetsConfigured: {
360
- id: 130163,
361
- name: 'Changesets or conventional commits for versioning',
362
- check: (ctx) => {
363
- const pkg = ctx.fileContent('package.json') || '';
364
- const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
365
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
366
- hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
367
- if (!hasMonorepo) return null;
368
- return /@changesets\/cli|changeset/i.test(pkg) || ctx.hasDir('.changeset') ||
369
- hasProjectFile(ctx, /(^|\/)\.changeset\//i);
370
- },
371
- impact: 'low',
372
- category: 'monorepo',
373
- fix: 'Add @changesets/cli or conventional commits for coordinated versioning across packages.',
374
- confidence: 0.7,
375
- },
376
-
377
- monorepoCI: {
378
- id: 130164,
379
- name: 'CI uses affected/changed detection',
380
- check: (ctx) => {
381
- const pkg = ctx.fileContent('package.json') || '';
382
- const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
383
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
384
- hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
385
- if (!hasMonorepo) return null;
386
- const ci = getWorkflowContent(ctx);
387
- return /nx affected|turbo.*--filter|lerna changed|lerna run.*--since/i.test(ci);
388
- },
389
- impact: 'medium',
390
- category: 'monorepo',
391
- fix: 'Use affected/changed detection in CI (nx affected, turbo --filter) to only build what changed.',
392
- confidence: 0.7,
393
- },
394
-
395
- sharedConfigs: {
396
- id: 130165,
397
- name: 'Shared configs across packages',
398
- check: (ctx) => {
399
- const pkg = ctx.fileContent('package.json') || '';
400
- const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
401
- ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
402
- hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
403
- if (!hasMonorepo) return null;
404
- return hasProjectFile(ctx, /(^|\/)packages\/.*eslint/i) ||
405
- hasProjectFile(ctx, /(^|\/)packages\/.*tsconfig/i) ||
406
- hasProjectFile(ctx, /shared.*config/i);
407
- },
408
- impact: 'low',
409
- category: 'monorepo',
410
- fix: 'Create shared config packages (eslint, tsconfig) referenced across monorepo packages for consistency.',
411
- confidence: 0.7,
412
- },
413
- };
1
+ /**
2
+ * Workflow technique fragments.
3
+ * Generated mechanically from the legacy techniques.js monolith during HR-09.
4
+ */
5
+
6
+ const {
7
+ fs,
8
+ path,
9
+ hasProjectFile,
10
+ readProjectFiles,
11
+ getWorkflowContent,
12
+ resolveProjectStateReadPath,
13
+ } = require('./shared');
14
+
15
+ module.exports = {
16
+ customCommands: {
17
+ id: 20,
18
+ name: 'Custom slash commands',
19
+ check: (ctx) => ctx.hasDir('.claude/commands') && ctx.dirFiles('.claude/commands').length > 0,
20
+ impact: 'high',
21
+ rating: 4,
22
+ category: 'workflow',
23
+ fix: 'Create custom commands for repeated workflows (/test, /deploy, /review).',
24
+ template: 'commands'
25
+ },
26
+
27
+ multipleCommands: {
28
+ id: 20001,
29
+ name: '3+ slash commands for rich workflow',
30
+ check: (ctx) => ctx.hasDir('.claude/commands') && ctx.dirFiles('.claude/commands').length >= 3,
31
+ impact: 'medium',
32
+ rating: 4,
33
+ category: 'workflow',
34
+ fix: 'Add at least 3 slash commands to cover your main workflows (test, deploy, review, etc.).',
35
+ template: 'commands'
36
+ },
37
+
38
+ deployCommand: {
39
+ id: 20002,
40
+ name: 'Has /deploy or /release command',
41
+ check: (ctx) => {
42
+ if (!ctx.hasDir('.claude/commands')) return false;
43
+ const files = ctx.dirFiles('.claude/commands');
44
+ return files.some(f => /deploy|release/i.test(f));
45
+ },
46
+ impact: 'medium',
47
+ rating: 4,
48
+ category: 'workflow',
49
+ fix: 'Create a /deploy or /release command for one-click deployments.',
50
+ template: null
51
+ },
52
+
53
+ reviewCommand: {
54
+ id: 20003,
55
+ name: 'Has /review command',
56
+ check: (ctx) => {
57
+ if (!ctx.hasDir('.claude/commands')) return false;
58
+ const files = ctx.dirFiles('.claude/commands');
59
+ return files.some(f => /review/i.test(f));
60
+ },
61
+ impact: 'medium',
62
+ rating: 4,
63
+ category: 'workflow',
64
+ fix: 'Create a /review command for code review workflows.',
65
+ template: null
66
+ },
67
+
68
+ skills: {
69
+ id: 21,
70
+ name: 'Custom skills',
71
+ check: (ctx) => {
72
+ // Skills use directory-per-skill structure: .claude/skills/<name>/SKILL.md
73
+ if (!ctx.hasDir('.claude/skills')) return false;
74
+ const dirs = ctx.dirFiles('.claude/skills');
75
+ // Check for SKILL.md inside skill directories
76
+ for (const d of dirs) {
77
+ if (ctx.fileContent(`.claude/skills/${d}/SKILL.md`)) return true;
78
+ }
79
+ // Fallback: any files in skills dir (legacy .claude/commands/ also works)
80
+ return dirs.length > 0;
81
+ },
82
+ impact: 'medium',
83
+ rating: 4,
84
+ category: 'workflow',
85
+ fix: 'Create skills at .claude/skills/<name>/SKILL.md with YAML frontmatter (name, description). Each skill is a directory with a SKILL.md file.',
86
+ template: 'skills'
87
+ },
88
+
89
+ multipleSkills: {
90
+ id: 2101,
91
+ name: '2+ skills for specialization',
92
+ check: (ctx) => {
93
+ if (!ctx.hasDir('.claude/skills')) return false;
94
+ return ctx.dirFiles('.claude/skills').length >= 2;
95
+ },
96
+ impact: 'medium',
97
+ rating: 4,
98
+ category: 'workflow',
99
+ fix: 'Add at least 2 skills covering different workflows (e.g. code-review, test-writer).',
100
+ template: 'skills'
101
+ },
102
+
103
+ agents: {
104
+ id: 22,
105
+ name: 'Custom agents',
106
+ check: (ctx) => ctx.hasDir('.claude/agents') && ctx.dirFiles('.claude/agents').length > 0,
107
+ impact: 'medium',
108
+ rating: 4,
109
+ category: 'workflow',
110
+ fix: 'Create specialized agents (security-reviewer, test-writer) in .claude/agents/.',
111
+ template: 'agents'
112
+ },
113
+
114
+ multipleAgents: {
115
+ id: 2201,
116
+ name: '2+ agents for delegation',
117
+ check: (ctx) => ctx.hasDir('.claude/agents') && ctx.dirFiles('.claude/agents').length >= 2,
118
+ impact: 'medium',
119
+ rating: 4,
120
+ category: 'workflow',
121
+ fix: 'Add at least 2 agents for specialized tasks (e.g. security-reviewer, test-writer).',
122
+ template: 'agents'
123
+ },
124
+
125
+ multipleRules: {
126
+ id: 301,
127
+ name: '2+ rules files for granular control',
128
+ check: (ctx) => ctx.hasDir('.claude/rules') && ctx.dirFiles('.claude/rules').length >= 2,
129
+ impact: 'medium',
130
+ rating: 4,
131
+ category: 'workflow',
132
+ fix: 'Add path-specific rules for different parts of the codebase (frontend, backend, tests).',
133
+ template: 'rules'
134
+ },
135
+
136
+ channelsAwareness: {
137
+ id: 1102,
138
+ name: 'Claude Code Channels awareness',
139
+ check: (ctx) => {
140
+ const md = ctx.claudeMdContent() || '';
141
+ const settings = ctx.jsonFile('.claude/settings.local.json') || ctx.jsonFile('.claude/settings.json');
142
+ const settingsStr = JSON.stringify(settings || {});
143
+ return /\bchannels?\b.*\b(telegram|discord|imessage|slack|bridge)\b|\b(telegram|discord|imessage|slack|bridge)\b.*\bchannels?\b/i.test(md) || settingsStr.includes('channels');
144
+ },
145
+ impact: 'low',
146
+ rating: 3,
147
+ category: 'features',
148
+ fix: 'Claude Code Channels (v2.1.80+) bridges Telegram/Discord/iMessage to your session.',
149
+ template: null
150
+ },
151
+
152
+ agentHasAllowedTools: {
153
+ id: 2011,
154
+ name: 'At least one subagent restricts tools',
155
+ check: (ctx) => {
156
+ if (!ctx.hasDir('.claude/agents')) return null;
157
+ const files = ctx.dirFiles('.claude/agents');
158
+ if (files.length === 0) return null;
159
+ for (const f of files) {
160
+ const content = ctx.fileContent(`.claude/agents/${f}`) || '';
161
+ // Current frontmatter uses allowed-tools (also accept legacy tools:)
162
+ if (/allowed-tools:/i.test(content) || /tools:\s*\[/.test(content)) return true;
163
+ }
164
+ return false;
165
+ },
166
+ impact: 'medium', rating: 3, category: 'workflow',
167
+ fix: 'Add allowed-tools to subagent frontmatter (e.g. allowed-tools: Read Grep Bash) for safer delegation.',
168
+ template: null
169
+ },
170
+
171
+ hasSnapshotHistory: {
172
+ id: 2017,
173
+ name: 'Audit snapshot history exists',
174
+ check: (ctx) => {
175
+ const fs = require('fs');
176
+ return fs.existsSync(resolveProjectStateReadPath(ctx.dir, 'snapshots', 'index.json'));
177
+ },
178
+ impact: 'low', rating: 3, category: 'workflow',
179
+ fix: 'Run `npx nerviq --snapshot` to start tracking your setup score over time.',
180
+ template: null
181
+ },
182
+
183
+ worktreeAwareness: {
184
+ id: 2018,
185
+ name: 'Worktree or parallel sessions mentioned',
186
+ check: (ctx) => {
187
+ const md = ctx.claudeMdContent() || '';
188
+ const shared = ctx.jsonFile('.claude/settings.json') || {};
189
+ return /worktree|parallel.*session/i.test(md) || !!shared.worktree;
190
+ },
191
+ impact: 'low', rating: 3, category: 'features',
192
+ fix: 'Claude Code supports git worktrees for parallel isolated sessions. Mention if relevant.',
193
+ template: null
194
+ },
195
+
196
+ skillUsesPaths: {
197
+ id: 2026,
198
+ name: 'At least one skill uses paths for scoping',
199
+ check: (ctx) => {
200
+ if (!ctx.hasDir('.claude/skills')) return null;
201
+ const entries = ctx.dirFiles('.claude/skills');
202
+ if (entries.length === 0) return null;
203
+ for (const entry of entries) {
204
+ // Skills can be files or dirs with SKILL.md inside
205
+ const direct = ctx.fileContent(`.claude/skills/${entry}`) || '';
206
+ if (/paths:/i.test(direct)) return true;
207
+ const nested = ctx.fileContent(`.claude/skills/${entry}/SKILL.md`) || '';
208
+ if (/paths:/i.test(nested)) return true;
209
+ }
210
+ return false;
211
+ },
212
+ impact: 'low', rating: 3, category: 'workflow',
213
+ fix: 'Add paths to skill frontmatter to scope when skills activate (e.g. paths: ["src/**/*.ts"]).',
214
+ template: null
215
+ },
216
+
217
+ rulesDirectory: {
218
+ id: 2035,
219
+ name: 'Path-specific rules in .claude/rules/',
220
+ check: (ctx) => ctx.hasDir('.claude/rules') && ctx.dirFiles('.claude/rules').length > 0,
221
+ impact: 'medium',
222
+ rating: 3,
223
+ category: 'workflow',
224
+ fix: 'Create .claude/rules/ with path-specific rules for different parts of your codebase (e.g. frontend.md, backend.md).',
225
+ template: null
226
+ },
227
+
228
+ hasLlmsTxt: {
229
+ id: 110001,
230
+ name: 'Has /llms.txt or llms.txt for LLM context',
231
+ check: (ctx) => {
232
+ return ctx.files.some(f => /^(public\/)?llms\.txt$/i.test(f) || /^llms-full\.txt$/i.test(f));
233
+ },
234
+ impact: 'low', rating: 3, category: 'features',
235
+ fix: 'Add llms.txt to provide LLM-friendly project context. See llmstxt.org for the standard.',
236
+ template: null,
237
+ confidence: 0.8,
238
+ },
239
+
240
+ instinctToSkillProgression: {
241
+ id: 110006,
242
+ name: 'Instinct-to-skill progression documented',
243
+ check: (ctx) => {
244
+ const md = ctx.claudeMdContent() || '';
245
+ return /progressive learning|instinct[- ]to[- ]skill|instinct.{0,40}skill|skill.{0,40}instinct|graduated|phased approach/i.test(md);
246
+ },
247
+ impact: 'low', rating: 3, category: 'features',
248
+ fix: 'Document a progressive learning path that turns repeated instincts into reusable skills or phased practices.',
249
+ template: null,
250
+ confidence: 0.7,
251
+ },
252
+
253
+ featureFlagService: {
254
+ id: 130141,
255
+ name: 'Feature flag service in dependencies',
256
+ check: (ctx) => {
257
+ const pkg = ctx.fileContent('package.json') || '';
258
+ if (/launchdarkly|unleash|flagsmith|growthbook|@split/i.test(pkg)) return true;
259
+ const py = readProjectFiles(ctx, /(^|\/)pyproject\.toml$/i) + readProjectFiles(ctx, /(^|\/)requirements[^/]*\.txt$/i);
260
+ if (/launchdarkly|unleash|flagsmith|growthbook/i.test(py)) return true;
261
+ return false;
262
+ },
263
+ impact: 'medium',
264
+ category: 'feature-flags',
265
+ fix: 'Add a feature flag service (LaunchDarkly, Unleash, Flagsmith, GrowthBook) for safe feature rollouts.',
266
+ confidence: 0.7,
267
+ },
268
+
269
+ featureFlagConfig: {
270
+ id: 130142,
271
+ name: 'Feature flag config files exist',
272
+ check: (ctx) => {
273
+ return hasProjectFile(ctx, /(^|\/)flags\.json$/i) ||
274
+ hasProjectFile(ctx, /(^|\/)features\.json$/i) ||
275
+ hasProjectFile(ctx, /(^|\/)feature-flags\//i);
276
+ },
277
+ impact: 'low',
278
+ category: 'feature-flags',
279
+ fix: 'Add feature flag configuration files (flags.json, features.json, or feature-flags/ directory).',
280
+ confidence: 0.7,
281
+ },
282
+
283
+ featureFlagTests: {
284
+ id: 130143,
285
+ name: 'Feature flag testing present',
286
+ check: (ctx) => {
287
+ const testFiles = readProjectFiles(ctx, /(test|spec)\.(jsx?|tsx?|py|go|java|rb)$/i, 30);
288
+ return /flag|feature.*toggle|variation/i.test(testFiles);
289
+ },
290
+ impact: 'low',
291
+ category: 'feature-flags',
292
+ fix: 'Add tests for feature flag variations to verify behavior under different flag states.',
293
+ confidence: 0.7,
294
+ },
295
+
296
+ flagLifecycle: {
297
+ id: 130144,
298
+ name: 'Flag lifecycle management',
299
+ check: (ctx) => {
300
+ return hasProjectFile(ctx, /flag-audit|remove-flag|flag.*cleanup/i) ||
301
+ /flag.*lifecycle|flag.*cleanup|stale.*flag/i.test(readProjectFiles(ctx, /\.(md|txt|json)$/i, 10));
302
+ },
303
+ impact: 'low',
304
+ category: 'feature-flags',
305
+ fix: 'Add flag lifecycle scripts or docs (flag-audit, remove-flag) to prevent stale flag accumulation.',
306
+ confidence: 0.7,
307
+ },
308
+
309
+ envBasedFlags: {
310
+ id: 130145,
311
+ name: 'Environment-based feature toggles',
312
+ check: (ctx) => {
313
+ const envFiles = readProjectFiles(ctx, /(^|\/)(\.env|\.env\.\w+)$/i);
314
+ const config = readProjectFiles(ctx, /\.(json|ya?ml|toml)$/i, 15);
315
+ return /FEATURE_|ENABLE_|FF_/i.test(envFiles + config);
316
+ },
317
+ impact: 'low',
318
+ category: 'feature-flags',
319
+ fix: 'Use environment-based feature toggles (FEATURE_, ENABLE_, FF_ prefixes) for deployment-time configuration.',
320
+ confidence: 0.7,
321
+ },
322
+
323
+ monorepoTool: {
324
+ id: 130161,
325
+ name: 'Monorepo tool configured',
326
+ check: (ctx) => {
327
+ const pkg = ctx.fileContent('package.json') || '';
328
+ const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
329
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
330
+ hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
331
+ if (!hasMonorepo) return null;
332
+ return /turborepo|turbo|"nx"|lerna|rush|bazel/i.test(pkg) ||
333
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
334
+ ctx.files.includes('lerna.json') || ctx.files.includes('rush.json');
335
+ },
336
+ impact: 'medium',
337
+ category: 'monorepo',
338
+ fix: 'Configure a monorepo orchestration tool (Turborepo, Nx, Lerna, Rush) for efficient multi-package builds.',
339
+ confidence: 0.7,
340
+ },
341
+
342
+ workspaceDeps: {
343
+ id: 130162,
344
+ name: 'Workspace dependency management configured',
345
+ check: (ctx) => {
346
+ const pkg = ctx.fileContent('package.json') || '';
347
+ const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
348
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
349
+ hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
350
+ if (!hasMonorepo) return null;
351
+ return hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i) || /workspaces/i.test(pkg);
352
+ },
353
+ impact: 'medium',
354
+ category: 'monorepo',
355
+ fix: 'Configure workspace dependencies (pnpm-workspace.yaml or workspaces in package.json) for cross-package linking.',
356
+ confidence: 0.7,
357
+ },
358
+
359
+ changesetsConfigured: {
360
+ id: 130163,
361
+ name: 'Changesets or conventional commits for versioning',
362
+ check: (ctx) => {
363
+ const pkg = ctx.fileContent('package.json') || '';
364
+ const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
365
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
366
+ hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
367
+ if (!hasMonorepo) return null;
368
+ return /@changesets\/cli|changeset/i.test(pkg) || ctx.hasDir('.changeset') ||
369
+ hasProjectFile(ctx, /(^|\/)\.changeset\//i);
370
+ },
371
+ impact: 'low',
372
+ category: 'monorepo',
373
+ fix: 'Add @changesets/cli or conventional commits for coordinated versioning across packages.',
374
+ confidence: 0.7,
375
+ },
376
+
377
+ monorepoCI: {
378
+ id: 130164,
379
+ name: 'CI uses affected/changed detection',
380
+ check: (ctx) => {
381
+ const pkg = ctx.fileContent('package.json') || '';
382
+ const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
383
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
384
+ hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
385
+ if (!hasMonorepo) return null;
386
+ const ci = getWorkflowContent(ctx);
387
+ return /nx affected|turbo.*--filter|lerna changed|lerna run.*--since/i.test(ci);
388
+ },
389
+ impact: 'medium',
390
+ category: 'monorepo',
391
+ fix: 'Use affected/changed detection in CI (nx affected, turbo --filter) to only build what changed.',
392
+ confidence: 0.7,
393
+ },
394
+
395
+ sharedConfigs: {
396
+ id: 130165,
397
+ name: 'Shared configs across packages',
398
+ check: (ctx) => {
399
+ const pkg = ctx.fileContent('package.json') || '';
400
+ const hasMonorepo = /workspaces/i.test(pkg) || ctx.files.includes('lerna.json') ||
401
+ ctx.files.includes('nx.json') || ctx.files.includes('turbo.json') ||
402
+ hasProjectFile(ctx, /(^|\/)pnpm-workspace\.yaml$/i);
403
+ if (!hasMonorepo) return null;
404
+ return hasProjectFile(ctx, /(^|\/)packages\/.*eslint/i) ||
405
+ hasProjectFile(ctx, /(^|\/)packages\/.*tsconfig/i) ||
406
+ hasProjectFile(ctx, /shared.*config/i);
407
+ },
408
+ impact: 'low',
409
+ category: 'monorepo',
410
+ fix: 'Create shared config packages (eslint, tsconfig) referenced across monorepo packages for consistency.',
411
+ confidence: 0.7,
412
+ },
413
+ };