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.
- package/CHANGELOG.md +116 -5
- package/LICENSE +20 -20
- package/bin/claude-hooks +84 -84
- package/lib/commands/analyze-diff.js +0 -1
- package/lib/commands/bump-version.js +346 -114
- package/lib/commands/create-pr.js +1 -1
- package/lib/commands/debug.js +1 -1
- package/lib/commands/generate-changelog.js +5 -6
- package/lib/commands/helpers.js +11 -6
- package/lib/commands/install.js +7 -8
- package/lib/commands/migrate-config.js +24 -2
- package/lib/commands/setup-github.js +1 -1
- package/lib/commands/update.js +1 -1
- package/lib/config.js +0 -4
- package/lib/hooks/prepare-commit-msg.js +2 -2
- package/lib/utils/changelog-generator.js +6 -8
- package/lib/utils/claude-client.js +7 -6
- package/lib/utils/claude-diagnostics.js +14 -21
- package/lib/utils/file-operations.js +1 -1
- package/lib/utils/file-utils.js +0 -1
- package/lib/utils/git-operations.js +0 -1
- package/lib/utils/github-api.js +3 -3
- package/lib/utils/github-client.js +2 -2
- package/lib/utils/installation-diagnostics.js +1 -1
- package/lib/utils/interactive-ui.js +93 -0
- package/lib/utils/prompt-builder.js +4 -6
- package/lib/utils/sanitize.js +13 -14
- package/lib/utils/task-id.js +18 -20
- package/lib/utils/telemetry.js +5 -7
- package/lib/utils/version-manager.js +676 -296
- package/package.json +68 -60
- package/templates/config.advanced.example.json +113 -113
- package/templates/pre-commit +7 -0
- package/templates/presets/ai/config.json +5 -5
- package/templates/presets/backend/config.json +5 -5
- package/templates/presets/backend/preset.json +49 -49
- package/templates/presets/database/config.json +5 -5
- package/templates/presets/database/preset.json +38 -38
- package/templates/presets/default/config.json +5 -5
- package/templates/presets/default/preset.json +53 -53
- package/templates/presets/frontend/config.json +5 -5
- package/templates/presets/frontend/preset.json +50 -50
- package/templates/presets/fullstack/config.json +5 -5
- package/templates/presets/fullstack/preset.json +55 -55
package/lib/utils/sanitize.js
CHANGED
|
@@ -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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
package/lib/utils/task-id.js
CHANGED
|
@@ -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
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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
|
package/lib/utils/telemetry.js
CHANGED
|
@@ -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
|
-
|
|
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)
|
|
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');
|