@rachel_rotenberg/ai-contribution-tracker 1.0.24 → 1.0.25
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/cli.js +25 -0
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -89,6 +89,29 @@ function appendOrCreateHook(hooksDir) {
|
|
|
89
89
|
try { fs.chmodSync(hookPath, "755"); } catch { /* Windows */ }
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
const PASSTHROUGH_HOOKS = [
|
|
93
|
+
"pre-commit", "pre-push", "prepare-commit-msg",
|
|
94
|
+
"post-commit", "post-merge", "pre-rebase",
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
function ensurePassthroughHooks(hooksDir) {
|
|
98
|
+
for (const hookName of PASSTHROUGH_HOOKS) {
|
|
99
|
+
const hookPath = path.join(hooksDir, hookName);
|
|
100
|
+
if (fs.existsSync(hookPath)) continue;
|
|
101
|
+
const content = [
|
|
102
|
+
"#!/bin/sh",
|
|
103
|
+
`LOCAL_HOOK="$(git rev-parse --git-dir)/hooks/${hookName}"`,
|
|
104
|
+
'if [ -f "$LOCAL_HOOK" ] && [ -x "$LOCAL_HOOK" ]; then',
|
|
105
|
+
' "$LOCAL_HOOK" "$@" || exit $?',
|
|
106
|
+
'fi',
|
|
107
|
+
"",
|
|
108
|
+
].join("\n");
|
|
109
|
+
fs.writeFileSync(hookPath, content);
|
|
110
|
+
try { fs.chmodSync(hookPath, "755"); } catch { }
|
|
111
|
+
ok(`Created passthrough hook: ${hookName}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
92
115
|
/** Install the global git commit-msg hook. */
|
|
93
116
|
function installGitHook() {
|
|
94
117
|
console.log("\nGit commit-msg hook:");
|
|
@@ -108,10 +131,12 @@ function installGitHook() {
|
|
|
108
131
|
// Use existing hooksPath directory
|
|
109
132
|
fs.mkdirSync(existingPath, { recursive: true });
|
|
110
133
|
appendOrCreateHook(existingPath);
|
|
134
|
+
ensurePassthroughHooks(existingPath);
|
|
111
135
|
} else {
|
|
112
136
|
const hooksDir = path.join(os.homedir(), ".config", "ai-contribution-tracker", "git-hooks");
|
|
113
137
|
fs.mkdirSync(hooksDir, { recursive: true });
|
|
114
138
|
appendOrCreateHook(hooksDir);
|
|
139
|
+
ensurePassthroughHooks(hooksDir);
|
|
115
140
|
|
|
116
141
|
try {
|
|
117
142
|
const gitPath = hooksDir.replace(/\\/g, "/");
|
package/package.json
CHANGED