@@ -6,7 +6,7 @@ const HOOK_MARKER = '# codeant-push-protection';
66const HOOK_MARKER_END = '# end-codeant-push-protection' ;
77
88/**
9- * Build the full pre-push hook script (with shebang).
9+ * Build the full pre-commit hook script (with shebang).
1010 */
1111function buildHookScript ( cliPath ) {
1212 return `#!/bin/sh
@@ -22,26 +22,26 @@ ${buildHookBlock(cliPath)}
2222function buildHookBlock ( cliPath ) {
2323 if ( cliPath ) {
2424 return `${ HOOK_MARKER }
25- # Auto-installed by CodeAnt AI — blocks pushes containing secrets.
25+ # Auto-installed by CodeAnt AI — blocks commits containing secrets.
2626# To disable: delete this hook or run "codeant push-protection disable"
2727# Uses the CLI bundled with the VS Code extension.
2828# Reopen stdin from terminal so the CLI can show an interactive bypass prompt.
29- # In non-interactive environments (CI), this silently fails and the push is blocked.
29+ # In non-interactive environments (CI), this silently fails and the commit is blocked.
3030exec < /dev/tty 2>/dev/null || true
3131if [ -f "${ cliPath } " ] && command -v node >/dev/null 2>&1; then
32- node "${ cliPath } " secrets --committed --hook
32+ node "${ cliPath } " secrets --staged --hook
3333else
3434 command -v codeant >/dev/null 2>&1 || exit 0
35- codeant secrets --committed --hook
35+ codeant secrets --staged --hook
3636fi
3737${ HOOK_MARKER_END } `;
3838 }
3939 return `${ HOOK_MARKER }
40- # Auto-installed by CodeAnt AI — blocks pushes containing secrets.
40+ # Auto-installed by CodeAnt AI — blocks commits containing secrets.
4141# To disable: delete this hook or run "codeant push-protection disable"
4242exec < /dev/tty 2>/dev/null || true
4343command -v codeant >/dev/null 2>&1 || exit 0
44- codeant secrets --committed --hook
44+ codeant secrets --staged --hook
4545${ HOOK_MARKER_END } `;
4646}
4747
@@ -97,7 +97,7 @@ function getHooksDir(gitRoot) {
9797}
9898
9999/**
100- * Install a pre-push hook that runs secret scanning before push .
100+ * Install a pre-commit hook that runs secret scanning before commit .
101101 *
102102 * @param {string } workspacePath - Path to the git repository
103103 * @param {string } [cliPath] - Absolute path to the codeant CLI entry point (from extension node_modules)
@@ -113,7 +113,7 @@ export function installPushProtectionHook(workspacePath, cliPath) {
113113 if ( ! existsSync ( hooksDir ) ) {
114114 mkdirSync ( hooksDir , { recursive : true } ) ;
115115 }
116- const hookPath = path . join ( hooksDir , 'pre-push ' ) ;
116+ const hookPath = path . join ( hooksDir , 'pre-commit ' ) ;
117117
118118 // If hook already exists, check if it's ours
119119 if ( existsSync ( hookPath ) ) {
@@ -129,12 +129,12 @@ export function installPushProtectionHook(workspacePath, cliPath) {
129129 const firstLine = existing . split ( '\n' , 1 ) [ 0 ] || '' ;
130130 const isShellHook = firstLine . startsWith ( '#!' ) ? / \/ ( b a | z | k ) ? s h ( \s | $ ) / . test ( firstLine ) : true ;
131131 if ( ! isShellHook ) {
132- return { installed : false , hookPath, message : 'Existing pre-push hook is non-shell; cannot append CodeAnt block safely' } ;
132+ return { installed : false , hookPath, message : 'Existing pre-commit hook is non-shell; cannot append CodeAnt block safely' } ;
133133 }
134134 const appended = existing . trimEnd ( ) + '\n\n' + buildHookBlock ( cliPath ) + '\n' ;
135135 writeFileSync ( hookPath , appended , 'utf-8' ) ;
136136 chmodSync ( hookPath , 0o755 ) ;
137- return { installed : true , hookPath, message : 'Hook appended to existing pre-push ' } ;
137+ return { installed : true , hookPath, message : 'Hook appended to existing pre-commit ' } ;
138138 }
139139
140140 writeFileSync ( hookPath , buildHookScript ( cliPath ) , 'utf-8' ) ;
@@ -143,7 +143,7 @@ export function installPushProtectionHook(workspacePath, cliPath) {
143143}
144144
145145/**
146- * Remove the CodeAnt pre-push hook (or just our section if appended).
146+ * Remove the CodeAnt pre-commit hook (or just our section if appended).
147147 *
148148 * @param {string } workspacePath
149149 * @returns {{ removed: boolean, message: string } }
@@ -155,10 +155,10 @@ export function removePushProtectionHook(workspacePath) {
155155 }
156156
157157 const hooksDir = getHooksDir ( gitRoot ) ;
158- const hookPath = path . join ( hooksDir , 'pre-push ' ) ;
158+ const hookPath = path . join ( hooksDir , 'pre-commit ' ) ;
159159
160160 if ( ! existsSync ( hookPath ) ) {
161- return { removed : false , message : 'No pre-push hook found' } ;
161+ return { removed : false , message : 'No pre-commit hook found' } ;
162162 }
163163
164164 const content = readFileSync ( hookPath , 'utf-8' ) ;
0 commit comments