claude-git-hooks 2.14.4 → 2.16.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 (44) hide show
  1. package/CHANGELOG.md +116 -5
  2. package/LICENSE +20 -20
  3. package/bin/claude-hooks +84 -84
  4. package/lib/commands/analyze-diff.js +0 -1
  5. package/lib/commands/bump-version.js +346 -114
  6. package/lib/commands/create-pr.js +1 -1
  7. package/lib/commands/debug.js +1 -1
  8. package/lib/commands/generate-changelog.js +5 -6
  9. package/lib/commands/helpers.js +11 -6
  10. package/lib/commands/install.js +7 -8
  11. package/lib/commands/migrate-config.js +24 -2
  12. package/lib/commands/setup-github.js +1 -1
  13. package/lib/commands/update.js +1 -1
  14. package/lib/config.js +0 -4
  15. package/lib/hooks/prepare-commit-msg.js +2 -2
  16. package/lib/utils/changelog-generator.js +6 -8
  17. package/lib/utils/claude-client.js +7 -6
  18. package/lib/utils/claude-diagnostics.js +14 -21
  19. package/lib/utils/file-operations.js +1 -1
  20. package/lib/utils/file-utils.js +0 -1
  21. package/lib/utils/git-operations.js +0 -1
  22. package/lib/utils/github-api.js +3 -3
  23. package/lib/utils/github-client.js +2 -2
  24. package/lib/utils/installation-diagnostics.js +1 -1
  25. package/lib/utils/interactive-ui.js +93 -0
  26. package/lib/utils/prompt-builder.js +4 -6
  27. package/lib/utils/sanitize.js +13 -14
  28. package/lib/utils/task-id.js +18 -20
  29. package/lib/utils/telemetry.js +5 -7
  30. package/lib/utils/version-manager.js +676 -296
  31. package/package.json +68 -60
  32. package/templates/config.advanced.example.json +113 -113
  33. package/templates/pre-commit +7 -0
  34. package/templates/presets/ai/config.json +5 -5
  35. package/templates/presets/backend/config.json +5 -5
  36. package/templates/presets/backend/preset.json +49 -49
  37. package/templates/presets/database/config.json +5 -5
  38. package/templates/presets/database/preset.json +38 -38
  39. package/templates/presets/default/config.json +5 -5
  40. package/templates/presets/default/preset.json +53 -53
  41. package/templates/presets/frontend/config.json +5 -5
  42. package/templates/presets/frontend/preset.json +50 -50
  43. package/templates/presets/fullstack/config.json +5 -5
  44. package/templates/presets/fullstack/preset.json +55 -55
@@ -34,9 +34,11 @@ export const sanitizeInput = (input, {
34
34
  if (stripControlChars) {
35
35
  if (allowNewlines) {
36
36
  // Keep \n, \r, \t but remove other control chars
37
+ // eslint-disable-next-line no-control-regex
37
38
  sanitized = sanitized.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '');
38
39
  } else {
39
40
  // Remove all control characters including newlines
41
+ // eslint-disable-next-line no-control-regex
40
42
  sanitized = sanitized.replace(/[\x00-\x1F\x7F]/g, ' ');
41
43
  }
42
44
  }
@@ -60,13 +62,11 @@ export const sanitizeInput = (input, {
60
62
  * @param {string} title - Raw title
61
63
  * @returns {string} - Sanitized title
62
64
  */
63
- export const sanitizePRTitle = (title) => {
64
- return sanitizeInput(title, {
65
- maxLength: 256,
66
- allowNewlines: false,
67
- stripControlChars: true
68
- });
69
- };
65
+ export const sanitizePRTitle = (title) => sanitizeInput(title, {
66
+ maxLength: 256,
67
+ allowNewlines: false,
68
+ stripControlChars: true
69
+ });
70
70
 
71
71
  /**
72
72
  * Sanitize PR body/description for GitHub API
@@ -75,13 +75,11 @@ export const sanitizePRTitle = (title) => {
75
75
  * @param {string} body - Raw body text
76
76
  * @returns {string} - Sanitized body
77
77
  */
78
- export const sanitizePRBody = (body) => {
79
- return sanitizeInput(body, {
80
- maxLength: 65536, // GitHub's limit is 65536 chars
81
- allowNewlines: true,
82
- stripControlChars: true
83
- });
84
- };
78
+ export const sanitizePRBody = (body) => sanitizeInput(body, {
79
+ maxLength: 65536, // GitHub's limit is 65536 chars
80
+ allowNewlines: true,
81
+ stripControlChars: true
82
+ });
85
83
 
86
84
  /**
87
85
  * Sanitize array of strings (labels, reviewers)
@@ -149,6 +147,7 @@ export const sanitizeLabel = (label) => {
149
147
  }
150
148
 
151
149
  // Remove problematic characters
150
+ // eslint-disable-next-line no-control-regex
152
151
  return trimmed.replace(/[,\x00-\x1F\x7F]/g, '');
153
152
  };
154
153
 
@@ -405,26 +405,24 @@ export const parseTaskIdArg = async (argTaskId, { prompt = true, required = fals
405
405
  *
406
406
  * @returns {Array<Object>} - Array of pattern info
407
407
  */
408
- export const getSupportedPatterns = () => {
409
- return [
410
- {
411
- name: 'Jira-style',
412
- examples: getExamplesForPattern('Jira-style')
413
- },
414
- {
415
- name: 'GitHub issue',
416
- examples: getExamplesForPattern('GitHub issue')
417
- },
418
- {
419
- name: 'Linear',
420
- examples: getExamplesForPattern('Linear')
421
- },
422
- {
423
- name: 'Generic',
424
- examples: getExamplesForPattern('Generic')
425
- }
426
- ];
427
- };
408
+ export const getSupportedPatterns = () => [
409
+ {
410
+ name: 'Jira-style',
411
+ examples: getExamplesForPattern('Jira-style')
412
+ },
413
+ {
414
+ name: 'GitHub issue',
415
+ examples: getExamplesForPattern('GitHub issue')
416
+ },
417
+ {
418
+ name: 'Linear',
419
+ examples: getExamplesForPattern('Linear')
420
+ },
421
+ {
422
+ name: 'Generic',
423
+ examples: getExamplesForPattern('Generic')
424
+ }
425
+ ];
428
426
 
429
427
  /**
430
428
  * Get example task IDs for a pattern
@@ -69,9 +69,7 @@ const generateEventId = () => {
69
69
  *
70
70
  * @returns {string} Telemetry directory path
71
71
  */
72
- const getTelemetryDir = () => {
73
- return path.join(process.cwd(), '.claude', 'telemetry');
74
- };
72
+ const getTelemetryDir = () => path.join(process.cwd(), '.claude', 'telemetry');
75
73
 
76
74
  /**
77
75
  * Get current telemetry log file path
@@ -90,10 +88,10 @@ const getCurrentLogFile = () => {
90
88
  *
91
89
  * @returns {boolean} True if telemetry is enabled (default: true)
92
90
  */
93
- const isTelemetryEnabled = () => {
91
+ const isTelemetryEnabled = () =>
94
92
  // Enabled by default - only disabled if explicitly set to false
95
- return config.system?.telemetry !== false;
96
- };
93
+ config.system?.telemetry !== false
94
+ ;
97
95
 
98
96
  /**
99
97
  * Ensure telemetry directory exists
@@ -117,7 +115,7 @@ const ensureTelemetryDir = async () => {
117
115
  const appendEvent = async (event) => {
118
116
  try {
119
117
  const logFile = getCurrentLogFile();
120
- const line = JSON.stringify(event) + '\n';
118
+ const line = `${JSON.stringify(event) }\n`;
121
119
 
122
120
  // Append to file (create if doesn't exist)
123
121
  await fs.appendFile(logFile, line, 'utf8');