@dharminnagar/bruh 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HeyG contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # bruh - Git Commit Summarizer
2
+
3
+ A Bun CLI that explains what changed in git history after a base commit by combining:
4
+
5
+ - Commit messages
6
+ - Full commit diffs (with safe truncation for large patches)
7
+ - AI-generated analysis (OpenAI, Claude, or Cloudflare Workers AI)
8
+
9
+ ## Install
10
+
11
+ Prerequisite: Bun must be installed on the machine where `bruh` runs.
12
+
13
+ Global install from npm:
14
+
15
+ ```bash
16
+ npm install -g bruh
17
+ ```
18
+
19
+ Or run without installing globally:
20
+
21
+ ```bash
22
+ npx bruh --help
23
+ ```
24
+
25
+ For local development in this repo:
26
+
27
+ ```bash
28
+ bun install
29
+ ```
30
+
31
+ ## First-run setup
32
+
33
+ Run interactive setup once:
34
+
35
+ ```bash
36
+ bruh --init
37
+ ```
38
+
39
+ Interactive prompts use `@clack/prompts` and setup now provides provider-specific model choices from a list (with a custom model option). For Cloudflare, model choices are fetched dynamically from your account when available, with built-in fallback options.
40
+
41
+ This stores provider and API key in a local config file:
42
+
43
+ - macOS: `~/Library/Application Support/bruh/config.json`
44
+ - Linux: `$XDG_CONFIG_HOME/bruh/config.json` or `~/.config/bruh/config.json`
45
+
46
+ If config is deleted or key is missing, setup is prompted again automatically.
47
+
48
+ ## Usage
49
+
50
+ Analyze commits after a base commit hash:
51
+
52
+ ```bash
53
+ bruh --commit <commit-hash>
54
+ ```
55
+
56
+ or positional style:
57
+
58
+ ```bash
59
+ bruh <commit-hash>
60
+ ```
61
+
62
+ ### Options
63
+
64
+ - `-c, --commit <hash>`: base commit hash
65
+ - `-p, --provider <name>`: `openai | claude | cloudflare`
66
+ - `-k, --api-key <key>`: override API key for current run
67
+ - `-m, --model <model>`: override model for current run
68
+ - `--config <path>`: custom config path
69
+ - `-f, --format <format>`: `text | json | markdown` (default: `text`)
70
+ - `-o, --output <path>`: write report to a file
71
+ - `--init`: run interactive setup
72
+ - `-h, --help`: help text
73
+
74
+ ## Output formats
75
+
76
+ - `text`: human-readable terminal report
77
+ - `json`: machine-readable report for automation
78
+ - `markdown`: markdown report for docs/changelogs
79
+
80
+ In interactive terminals, the CLI now includes progress indicators for key analysis stages and a visually clearer text report hierarchy for faster scanning.
81
+ When output is non-interactive (for example piped in CI), it falls back to plain deterministic logs.
82
+
83
+ Example markdown export:
84
+
85
+ ```bash
86
+ bruh <commit-hash> --format markdown --output commit-report.md
87
+ ```
88
+
89
+ ## Provider notes
90
+
91
+ - OpenAI uses `https://api.openai.com/v1/chat/completions`
92
+ - Claude uses `https://api.anthropic.com/v1/messages`
93
+ - Cloudflare Workers AI requires both API token and account ID
94
+
95
+ For Cloudflare, setup prompts for account ID and stores it in config.
96
+
97
+ ## Development
98
+
99
+ ```bash
100
+ bun run check
101
+ bun run lint
102
+ bun run start -- --help
103
+ ```
104
+
105
+ ### Help and recipes
106
+
107
+ ```bash
108
+ bun run src/index.ts --help
109
+ ```
110
+
111
+ The help output includes a quick-start path and common recipes for setup, analysis, and exports.
package/dist/args.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { CliArgs } from './types';
2
+ export declare function parseArgs(argv: string[]): CliArgs;
3
+ export declare function usageText(): string;
4
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,SAAS,CAAC;AAqB/D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CA6FjD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAiClC"}
package/dist/args.js ADDED
@@ -0,0 +1,136 @@
1
+ const SUPPORTED_PROVIDERS = ['openai', 'claude', 'cloudflare'];
2
+ const SUPPORTED_FORMATS = ['text', 'json', 'markdown'];
3
+ function isProvider(value) {
4
+ return SUPPORTED_PROVIDERS.includes(value);
5
+ }
6
+ function isFormat(value) {
7
+ return SUPPORTED_FORMATS.includes(value);
8
+ }
9
+ function readValue(argv, index, flag) {
10
+ const nextValue = argv[index + 1];
11
+ if (!nextValue || nextValue.startsWith('-')) {
12
+ throw new Error(`Missing value for ${flag}`);
13
+ }
14
+ return nextValue;
15
+ }
16
+ export function parseArgs(argv) {
17
+ let commit;
18
+ let provider;
19
+ let apiKey;
20
+ let model;
21
+ let configPath;
22
+ let format = 'text';
23
+ let outputPath;
24
+ let init = false;
25
+ let help = false;
26
+ for (let i = 0; i < argv.length; i += 1) {
27
+ const token = argv[i];
28
+ if (!token.startsWith('-')) {
29
+ if (!commit) {
30
+ commit = token;
31
+ }
32
+ continue;
33
+ }
34
+ switch (token) {
35
+ case '-h':
36
+ case '--help':
37
+ help = true;
38
+ break;
39
+ case '--init':
40
+ init = true;
41
+ break;
42
+ case '-c':
43
+ case '--commit':
44
+ commit = readValue(argv, i, token);
45
+ i += 1;
46
+ break;
47
+ case '-p':
48
+ case '--provider': {
49
+ const value = readValue(argv, i, token).toLowerCase();
50
+ if (!isProvider(value)) {
51
+ throw new Error(`Unsupported provider "${value}". Use one of: ${SUPPORTED_PROVIDERS.join(', ')}`);
52
+ }
53
+ provider = value;
54
+ i += 1;
55
+ break;
56
+ }
57
+ case '-k':
58
+ case '--api-key':
59
+ apiKey = readValue(argv, i, token);
60
+ i += 1;
61
+ break;
62
+ case '-m':
63
+ case '--model':
64
+ model = readValue(argv, i, token);
65
+ i += 1;
66
+ break;
67
+ case '--config':
68
+ configPath = readValue(argv, i, token);
69
+ i += 1;
70
+ break;
71
+ case '-f':
72
+ case '--format': {
73
+ const value = readValue(argv, i, token).toLowerCase();
74
+ if (!isFormat(value)) {
75
+ throw new Error(`Unsupported format "${value}". Use one of: ${SUPPORTED_FORMATS.join(', ')}`);
76
+ }
77
+ format = value;
78
+ i += 1;
79
+ break;
80
+ }
81
+ case '-o':
82
+ case '--output':
83
+ outputPath = readValue(argv, i, token);
84
+ i += 1;
85
+ break;
86
+ default:
87
+ throw new Error(`Unknown flag: ${token}`);
88
+ }
89
+ }
90
+ return {
91
+ commit,
92
+ provider,
93
+ apiKey,
94
+ model,
95
+ configPath,
96
+ format,
97
+ outputPath,
98
+ init,
99
+ help,
100
+ };
101
+ }
102
+ export function usageText() {
103
+ return [
104
+ 'bruh - Git Commit Summarizer',
105
+ '',
106
+ 'Understand what changed after a base commit using AI-powered release analysis.',
107
+ '',
108
+ 'Usage:',
109
+ ' bun run src/index.ts --commit <commit-hash> [options]',
110
+ ' bun run src/index.ts <commit-hash> [options]',
111
+ '',
112
+ 'Quick Start:',
113
+ ' 1) Configure provider credentials once:',
114
+ ' bun run src/index.ts --init',
115
+ ' 2) Analyze commits after a base commit:',
116
+ ' bun run src/index.ts --commit <commit-hash>',
117
+ '',
118
+ 'Examples:',
119
+ ' bun run src/index.ts 9f13c4a',
120
+ ' bun run src/index.ts --commit 9f13c4a --provider claude',
121
+ ' bun run src/index.ts 9f13c4a --format markdown --output report.md',
122
+ ' bun run src/index.ts 9f13c4a --format json',
123
+ '',
124
+ 'Options:',
125
+ ' -c, --commit <hash> Base commit hash (analyze commits after this)',
126
+ ' -p, --provider <name> openai | claude | cloudflare',
127
+ ' -k, --api-key <key> Override API key for this run',
128
+ ' -m, --model <model> Override model for this run',
129
+ ' --config <path> Custom config file path',
130
+ ' -f, --format <format> text | json | markdown (default: text)',
131
+ ' -o, --output <path> Write report to file',
132
+ ' --init Run interactive setup and save config',
133
+ ' -h, --help Show help',
134
+ ].join('\n');
135
+ }
136
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAEA,MAAM,mBAAmB,GAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC3E,MAAM,iBAAiB,GAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAEvE,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAiB,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,iBAAiB,CAAC,QAAQ,CAAC,KAAqB,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,SAAS,CAAC,IAAc,EAAE,KAAa,EAAE,IAAY;IAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;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,IAAI,KAAK,CAAC,iBAAiB,KAAK,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,MAAM;QACN,KAAK;QACL,UAAU;QACV,MAAM;QACN,UAAU;QACV,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,8BAA8B;QAC9B,EAAE;QACF,gFAAgF;QAChF,EAAE;QACF,QAAQ;QACR,yDAAyD;QACzD,gDAAgD;QAChD,EAAE;QACF,cAAc;QACd,2CAA2C;QAC3C,kCAAkC;QAClC,2CAA2C;QAC3C,kDAAkD;QAClD,EAAE;QACF,WAAW;QACX,gCAAgC;QAChC,2DAA2D;QAC3D,qEAAqE;QACrE,8CAA8C;QAC9C,EAAE;QACF,UAAU;QACV,0EAA0E;QAC1E,yDAAyD;QACzD,0DAA0D;QAC1D,wDAAwD;QACxD,oDAAoD;QACpD,mEAAmE;QACnE,iDAAiD;QACjD,kEAAkE;QAClE,sCAAsC;KACvC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ import './index';
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,SAAS,CAAC"}
package/dist/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ import './index';
3
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Provider, ProviderContext, StoredConfig } from './types';
2
+ export declare function resolveConfigPath(customPath?: string): string;
3
+ export declare function loadConfig(configPath: string): Promise<StoredConfig | null>;
4
+ export declare function saveConfig(configPath: string, config: StoredConfig): Promise<void>;
5
+ export declare function mergeProviderContext(provider: Provider, storedConfig: StoredConfig, overrides: {
6
+ apiKey?: string;
7
+ model?: string;
8
+ }): ProviderContext;
9
+ export declare function runInteractiveSetup(current?: Partial<StoredConfig>): Promise<StoredConfig>;
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA8dvE,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAyB9B;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAeD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,eAAe,CAejB;AAED,wBAAsB,mBAAmB,CACvC,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,YAAY,CAAC,CAuEvB"}