@boshu2/vibe-check 1.1.0 → 1.2.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 CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.0] - 2025-11-29
9
+
10
+ ### Added
11
+ - **Git Hook** - `vibe-check init-hook` command to install pre-push hook
12
+ - Runs vibe-check automatically before every git push
13
+ - `--block-low` option to reject pushes with LOW rating
14
+ - Configurable via environment variables
15
+ - Pre-push hook script in `hooks/pre-push` for manual installation
16
+
8
17
  ## [1.1.0] - 2025-11-29
9
18
 
10
19
  ### Added
package/README.md CHANGED
@@ -195,6 +195,43 @@ vibe-check --since "1 week ago" --score -o results.json
195
195
  vibe-check --format markdown -o results.json # Terminal gets markdown, file gets JSON
196
196
  ```
197
197
 
198
+ ## Git Hook
199
+
200
+ Run vibe-check automatically before every push:
201
+
202
+ ```bash
203
+ # Install the pre-push hook
204
+ vibe-check init-hook
205
+
206
+ # Or with blocking enabled (rejects push on LOW rating)
207
+ vibe-check init-hook --block-low
208
+ ```
209
+
210
+ ### Hook Configuration
211
+
212
+ Control behavior with environment variables:
213
+
214
+ ```bash
215
+ # Block push on LOW rating (default: false)
216
+ VIBE_CHECK_BLOCK_LOW=true git push
217
+
218
+ # Show full output instead of simple (default: true)
219
+ VIBE_CHECK_SIMPLE=false git push
220
+
221
+ # Hide vibe score (default: true)
222
+ VIBE_CHECK_SCORE=false git push
223
+ ```
224
+
225
+ ### Manual Installation
226
+
227
+ If you prefer to install manually:
228
+
229
+ ```bash
230
+ # Copy the hook to your repo
231
+ curl -o .git/hooks/pre-push https://raw.githubusercontent.com/boshu2/vibe-check/main/hooks/pre-push
232
+ chmod +x .git/hooks/pre-push
233
+ ```
234
+
198
235
  ## GitHub Action
199
236
 
200
237
  Add automated vibe-check to your PRs:
package/dist/cli.js CHANGED
@@ -14,6 +14,7 @@ program
14
14
  program.addCommand((0, commands_1.createAnalyzeCommand)());
15
15
  program.addCommand((0, commands_1.createLevelCommand)());
16
16
  program.addCommand((0, commands_1.createProfileCommand)());
17
+ program.addCommand((0, commands_1.createInitHookCommand)());
17
18
  // Default behavior: if no subcommand, run analyze with passed options
18
19
  // This maintains backwards compatibility with v1.x usage
19
20
  program
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,yCAAwG;AAExG,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,gDAAgD,CAAC;KAC7D,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,kBAAkB;AAClB,OAAO,CAAC,UAAU,CAAC,IAAA,+BAAoB,GAAE,CAAC,CAAC;AAC3C,OAAO,CAAC,UAAU,CAAC,IAAA,6BAAkB,GAAE,CAAC,CAAC;AACzC,OAAO,CAAC,UAAU,CAAC,IAAA,+BAAoB,GAAE,CAAC,CAAC;AAE3C,sEAAsE;AACtE,yDAAyD;AACzD,OAAO;KACJ,MAAM,CAAC,gBAAgB,EAAE,8CAA8C,CAAC;KACxE,MAAM,CAAC,gBAAgB,EAAE,sCAAsC,CAAC;KAChE,MAAM,CAAC,qBAAqB,EAAE,yCAAyC,EAAE,UAAU,CAAC;KACpF,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KAC7D,MAAM,CAAC,eAAe,EAAE,qBAAqB,EAAE,KAAK,CAAC;KACrD,MAAM,CAAC,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;AACL,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { createAnalyzeCommand, runAnalyze, AnalyzeOptions } from './analyze';
2
2
  export { createLevelCommand } from './level';
3
3
  export { createProfileCommand } from './profile';
4
+ export { createInitHookCommand } from './init-hook';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createProfileCommand = exports.createLevelCommand = exports.runAnalyze = exports.createAnalyzeCommand = void 0;
3
+ exports.createInitHookCommand = exports.createProfileCommand = exports.createLevelCommand = exports.runAnalyze = exports.createAnalyzeCommand = void 0;
4
4
  var analyze_1 = require("./analyze");
5
5
  Object.defineProperty(exports, "createAnalyzeCommand", { enumerable: true, get: function () { return analyze_1.createAnalyzeCommand; } });
6
6
  Object.defineProperty(exports, "runAnalyze", { enumerable: true, get: function () { return analyze_1.runAnalyze; } });
@@ -8,4 +8,6 @@ var level_1 = require("./level");
8
8
  Object.defineProperty(exports, "createLevelCommand", { enumerable: true, get: function () { return level_1.createLevelCommand; } });
9
9
  var profile_1 = require("./profile");
10
10
  Object.defineProperty(exports, "createProfileCommand", { enumerable: true, get: function () { return profile_1.createProfileCommand; } });
11
+ var init_hook_1 = require("./init-hook");
12
+ Object.defineProperty(exports, "createInitHookCommand", { enumerable: true, get: function () { return init_hook_1.createInitHookCommand; } });
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;AAAA,qCAA6E;AAApE,+GAAA,oBAAoB,OAAA;AAAE,qGAAA,UAAU,OAAA;AACzC,iCAA6C;AAApC,2GAAA,kBAAkB,OAAA;AAC3B,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;AAAA,qCAA6E;AAApE,+GAAA,oBAAoB,OAAA;AAAE,qGAAA,UAAU,OAAA;AACzC,iCAA6C;AAApC,2GAAA,kBAAkB,OAAA;AAC3B,qCAAiD;AAAxC,+GAAA,oBAAoB,OAAA;AAC7B,yCAAoD;AAA3C,kHAAA,qBAAqB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createInitHookCommand(): Command;
3
+ //# sourceMappingURL=init-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-hook.d.ts","sourceRoot":"","sources":["../../src/commands/init-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwGpC,wBAAgB,qBAAqB,IAAI,OAAO,CAU/C"}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createInitHookCommand = createInitHookCommand;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const fs_1 = require("fs");
10
+ const path_1 = require("path");
11
+ const PRE_PUSH_HOOK = `#!/bin/bash
12
+ # vibe-check pre-push hook
13
+ # Runs vibe-check on commits being pushed and displays metrics
14
+
15
+ # Colors
16
+ RED='\\033[0;31m'
17
+ YELLOW='\\033[1;33m'
18
+ GREEN='\\033[0;32m'
19
+ CYAN='\\033[0;36m'
20
+ NC='\\033[0m' # No Color
21
+
22
+ # Configuration (set these env vars to customize)
23
+ VIBE_CHECK_BLOCK_LOW=\${VIBE_CHECK_BLOCK_LOW:-false} # Set to "true" to block push on LOW rating
24
+ VIBE_CHECK_SIMPLE=\${VIBE_CHECK_SIMPLE:-true} # Use simple output by default
25
+ VIBE_CHECK_SCORE=\${VIBE_CHECK_SCORE:-true} # Include vibe score
26
+
27
+ echo -e "\${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
28
+ echo -e "\${CYAN} 🎯 Running vibe-check before push...\${NC}"
29
+ echo -e "\${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
30
+ echo
31
+
32
+ # Read stdin for push info
33
+ while read local_ref local_sha remote_ref remote_sha; do
34
+ # Skip if deleting branch
35
+ if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
36
+ continue
37
+ fi
38
+
39
+ # Determine the range of commits
40
+ if [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
41
+ # New branch - check all commits
42
+ RANGE="$local_sha"
43
+ SINCE_FLAG=""
44
+ else
45
+ # Existing branch - check commits since last push
46
+ RANGE="$remote_sha..$local_sha"
47
+ # Get the date of the remote SHA
48
+ SINCE_DATE=$(git log -1 --format=%ci "$remote_sha" 2>/dev/null)
49
+ if [ -n "$SINCE_DATE" ]; then
50
+ SINCE_FLAG="--since \\"$SINCE_DATE\\""
51
+ else
52
+ SINCE_FLAG=""
53
+ fi
54
+ fi
55
+
56
+ # Count commits being pushed
57
+ COMMIT_COUNT=$(git rev-list --count "$RANGE" 2>/dev/null || echo "0")
58
+
59
+ if [ "$COMMIT_COUNT" = "0" ]; then
60
+ echo -e "\${YELLOW}No new commits to analyze\${NC}"
61
+ continue
62
+ fi
63
+
64
+ echo -e "Analyzing \${GREEN}$COMMIT_COUNT\${NC} commit(s) on \${CYAN}$local_ref\${NC}"
65
+ echo
66
+
67
+ # Build vibe-check command
68
+ VIBE_CMD="npx @boshu2/vibe-check"
69
+
70
+ if [ "$VIBE_CHECK_SIMPLE" = "true" ]; then
71
+ VIBE_CMD="$VIBE_CMD --simple"
72
+ fi
73
+
74
+ if [ "$VIBE_CHECK_SCORE" = "true" ]; then
75
+ VIBE_CMD="$VIBE_CMD --score"
76
+ fi
77
+
78
+ # Run vibe-check and capture output
79
+ if [ -n "$SINCE_FLAG" ]; then
80
+ OUTPUT=$(eval "$VIBE_CMD $SINCE_FLAG" 2>&1)
81
+ else
82
+ OUTPUT=$(eval "$VIBE_CMD --since '1 week ago'" 2>&1)
83
+ fi
84
+
85
+ EXIT_CODE=$?
86
+
87
+ # Display output
88
+ echo "$OUTPUT"
89
+ echo
90
+
91
+ # Check if we should block on LOW rating
92
+ if [ "$VIBE_CHECK_BLOCK_LOW" = "true" ] && [ $EXIT_CODE -eq 1 ]; then
93
+ echo -e "\${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
94
+ echo -e "\${RED} ⛔ Push blocked: LOW vibe rating\${NC}"
95
+ echo -e "\${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
96
+ echo
97
+ echo -e "To push anyway, set: \${YELLOW}VIBE_CHECK_BLOCK_LOW=false git push\${NC}"
98
+ exit 1
99
+ fi
100
+ done
101
+
102
+ echo -e "\${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
103
+ echo -e "\${GREEN} ✓ Vibe check complete, proceeding with push\${NC}"
104
+ echo -e "\${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\${NC}"
105
+ echo
106
+
107
+ exit 0
108
+ `;
109
+ function createInitHookCommand() {
110
+ const cmd = new commander_1.Command('init-hook')
111
+ .description('Install vibe-check git hook in current repository')
112
+ .option('-f, --force', 'Overwrite existing hook', false)
113
+ .option('--block-low', 'Configure hook to block pushes on LOW rating', false)
114
+ .action(async (options) => {
115
+ await runInitHook(options);
116
+ });
117
+ return cmd;
118
+ }
119
+ async function runInitHook(options) {
120
+ const cwd = process.cwd();
121
+ const gitDir = (0, path_1.join)(cwd, '.git');
122
+ const hooksDir = (0, path_1.join)(gitDir, 'hooks');
123
+ const hookPath = (0, path_1.join)(hooksDir, 'pre-push');
124
+ // Check if we're in a git repo
125
+ if (!(0, fs_1.existsSync)(gitDir)) {
126
+ console.error(chalk_1.default.red('Error: Not a git repository'));
127
+ console.error(chalk_1.default.gray('Run this command from the root of a git repository'));
128
+ process.exit(1);
129
+ }
130
+ // Check if hook already exists
131
+ if ((0, fs_1.existsSync)(hookPath) && !options.force) {
132
+ console.error(chalk_1.default.yellow('pre-push hook already exists'));
133
+ console.error(chalk_1.default.gray('Use --force to overwrite'));
134
+ process.exit(1);
135
+ }
136
+ // Create hooks directory if needed
137
+ if (!(0, fs_1.existsSync)(hooksDir)) {
138
+ (0, fs_1.mkdirSync)(hooksDir, { recursive: true });
139
+ }
140
+ // Modify hook content if blocking is enabled
141
+ let hookContent = PRE_PUSH_HOOK;
142
+ if (options.blockLow) {
143
+ hookContent = hookContent.replace('VIBE_CHECK_BLOCK_LOW=${VIBE_CHECK_BLOCK_LOW:-false}', 'VIBE_CHECK_BLOCK_LOW=${VIBE_CHECK_BLOCK_LOW:-true}');
144
+ }
145
+ // Write the hook
146
+ (0, fs_1.writeFileSync)(hookPath, hookContent);
147
+ (0, fs_1.chmodSync)(hookPath, 0o755);
148
+ console.log();
149
+ console.log(chalk_1.default.green('✓ vibe-check pre-push hook installed'));
150
+ console.log();
151
+ console.log(chalk_1.default.gray('Location:'), hookPath);
152
+ console.log();
153
+ console.log(chalk_1.default.bold('Configuration:'));
154
+ console.log(chalk_1.default.gray(' VIBE_CHECK_BLOCK_LOW=true Block push on LOW rating'));
155
+ console.log(chalk_1.default.gray(' VIBE_CHECK_SIMPLE=false Show full output'));
156
+ console.log(chalk_1.default.gray(' VIBE_CHECK_SCORE=false Hide vibe score'));
157
+ console.log();
158
+ console.log(chalk_1.default.cyan('The hook will run automatically on every git push'));
159
+ console.log();
160
+ }
161
+ //# sourceMappingURL=init-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-hook.js","sourceRoot":"","sources":["../../src/commands/init-hook.ts"],"names":[],"mappings":";;;;;AAwGA,sDAUC;AAlHD,yCAAoC;AACpC,kDAA0B;AAC1B,2BAAqE;AACrE,+BAA4B;AAE5B,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGrB,CAAC;AAEF,SAAgB,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,WAAW,CAAC;SACjC,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,aAAa,EAAE,yBAAyB,EAAE,KAAK,CAAC;SACvD,MAAM,CAAC,aAAa,EAAE,8CAA8C,EAAE,KAAK,CAAC;SAC5E,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,OAA8C;IACvE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE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Aa,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACrC,IAAA,cAAS,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE3B,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
package/hooks/pre-push ADDED
@@ -0,0 +1,103 @@
1
+ #!/bin/bash
2
+ # vibe-check pre-push hook
3
+ # Runs vibe-check on commits being pushed and displays metrics
4
+ #
5
+ # Installation:
6
+ # cp hooks/pre-push .git/hooks/pre-push
7
+ # chmod +x .git/hooks/pre-push
8
+ #
9
+ # Or run: npx @boshu2/vibe-check init-hook
10
+
11
+ # Colors
12
+ RED='\033[0;31m'
13
+ YELLOW='\033[1;33m'
14
+ GREEN='\033[0;32m'
15
+ CYAN='\033[0;36m'
16
+ NC='\033[0m' # No Color
17
+
18
+ # Configuration (set these env vars to customize)
19
+ VIBE_CHECK_BLOCK_LOW=${VIBE_CHECK_BLOCK_LOW:-false} # Set to "true" to block push on LOW rating
20
+ VIBE_CHECK_SIMPLE=${VIBE_CHECK_SIMPLE:-true} # Use simple output by default
21
+ VIBE_CHECK_SCORE=${VIBE_CHECK_SCORE:-true} # Include vibe score
22
+
23
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
24
+ echo -e "${CYAN} 🎯 Running vibe-check before push...${NC}"
25
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
26
+ echo
27
+
28
+ # Read stdin for push info
29
+ while read local_ref local_sha remote_ref remote_sha; do
30
+ # Skip if deleting branch
31
+ if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
32
+ continue
33
+ fi
34
+
35
+ # Determine the range of commits
36
+ if [ "$remote_sha" = "0000000000000000000000000000000000000000" ]; then
37
+ # New branch - check all commits
38
+ RANGE="$local_sha"
39
+ SINCE_FLAG=""
40
+ else
41
+ # Existing branch - check commits since last push
42
+ RANGE="$remote_sha..$local_sha"
43
+ # Get the date of the remote SHA
44
+ SINCE_DATE=$(git log -1 --format=%ci "$remote_sha" 2>/dev/null)
45
+ if [ -n "$SINCE_DATE" ]; then
46
+ SINCE_FLAG="--since \"$SINCE_DATE\""
47
+ else
48
+ SINCE_FLAG=""
49
+ fi
50
+ fi
51
+
52
+ # Count commits being pushed
53
+ COMMIT_COUNT=$(git rev-list --count "$RANGE" 2>/dev/null || echo "0")
54
+
55
+ if [ "$COMMIT_COUNT" = "0" ]; then
56
+ echo -e "${YELLOW}No new commits to analyze${NC}"
57
+ continue
58
+ fi
59
+
60
+ echo -e "Analyzing ${GREEN}$COMMIT_COUNT${NC} commit(s) on ${CYAN}$local_ref${NC}"
61
+ echo
62
+
63
+ # Build vibe-check command
64
+ VIBE_CMD="npx @boshu2/vibe-check"
65
+
66
+ if [ "$VIBE_CHECK_SIMPLE" = "true" ]; then
67
+ VIBE_CMD="$VIBE_CMD --simple"
68
+ fi
69
+
70
+ if [ "$VIBE_CHECK_SCORE" = "true" ]; then
71
+ VIBE_CMD="$VIBE_CMD --score"
72
+ fi
73
+
74
+ # Run vibe-check and capture output
75
+ if [ -n "$SINCE_FLAG" ]; then
76
+ OUTPUT=$(eval "$VIBE_CMD $SINCE_FLAG" 2>&1)
77
+ else
78
+ OUTPUT=$(eval "$VIBE_CMD --since '1 week ago'" 2>&1)
79
+ fi
80
+
81
+ EXIT_CODE=$?
82
+
83
+ # Display output
84
+ echo "$OUTPUT"
85
+ echo
86
+
87
+ # Check if we should block on LOW rating
88
+ if [ "$VIBE_CHECK_BLOCK_LOW" = "true" ] && [ $EXIT_CODE -eq 1 ]; then
89
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
90
+ echo -e "${RED} ⛔ Push blocked: LOW vibe rating${NC}"
91
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
92
+ echo
93
+ echo -e "To push anyway, set: ${YELLOW}VIBE_CHECK_BLOCK_LOW=false git push${NC}"
94
+ exit 1
95
+ fi
96
+ done
97
+
98
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
99
+ echo -e "${GREEN} ✓ Vibe check complete, proceeding with push${NC}"
100
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
101
+ echo
102
+
103
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boshu2/vibe-check",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Track git commit patterns during AI-assisted coding (experimental)",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {