git-coco 0.22.11 → 0.23.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/README.md CHANGED
@@ -10,361 +10,112 @@
10
10
  [![Last Commit](https://img.shields.io/github/last-commit/gfargo/coco)](https://github.com/gfargo/coco/tree/main)
11
11
  [![Discord](https://img.shields.io/discord/1176716060825767948)](https://discord.gg/KGu9nE9Ejx)
12
12
 
13
- Spawned by the dream to automate away the tedium of writing commit messages, `coco` has grown into a multi-facetted git assistant to expedite any developer git workflow.
14
-
15
- Currently `coco` generates commit messages with **first-class Conventional Commits support**, creates changelogs, summarizes code changes, performs code reviews, and more - with new features being added regularly!
13
+ An AI-powered git assistant that generates meaningful commit messages, creates changelogs, and streamlines your development workflow.
16
14
 
17
15
  **✨ Key Features:**
18
16
 
19
17
  - 🤖 **AI-Powered Commit Messages** - Generate contextual commits from your staged changes
20
- - 📋 **Conventional Commits** - Full support with automatic validation and formatting
18
+ - 📋 **Conventional Commits** - Full support with automatic validation and formatting
21
19
  - 🔧 **Commitlint Integration** - Seamless integration with your existing commitlint configuration
22
- - 📦 **Package Manager Friendly** - Works with npm, yarn, and pnpm (with automatic compatibility handling)
23
- - 🛠️ **Robust Error Recovery** - Advanced JSON parsing with automatic repair capabilities
24
20
  - 🏠 **Local AI Support** - Run completely offline with Ollama (no API costs, full privacy)
21
+ - 📦 **Package Manager Friendly** - Works with npm, yarn, and pnpm
22
+ - 👥 **Team Ready** - Shared configurations and enterprise deployment
25
23
 
26
- ## Commands
27
-
28
- - **`commit`**: generates commit messages based on staged changes with intelligent conventional commits support and robust error handling.
29
-
30
- - **`changelog`**: create changelogs for the current branch or a range of commits.
31
-
32
- - **`recap`**: summarize changes from working-tree, or yesterday, or in the last month, or since the last tag.
33
-
34
- - **`review`**: perform a code review on the changes in the working directory.
35
-
36
- - **`init`**: step by step wizard to set up `coco` globally or for a project.
37
-
38
- - **`help`**: display help for `coco` commands.
39
-
40
- ## Getting Started
41
-
42
- **`coco init`** is the first step to getting started with `coco`. It will guide you through the installation process, including setting up your OpenAI API key and configuring `coco` to your preferences.
43
-
44
- ```bash
45
- # For local project use
46
- npx git-coco@latest init -l project
47
-
48
- # For global use
49
- npx git-coco@latest init -l global
50
- ```
51
-
52
- ## Usage
53
-
54
- ### **`coco commit`**
55
-
56
- Generates commit messages based on staged changes with intelligent commitlint integration.
57
-
58
- ```bash
59
- coco
60
-
61
- # or
62
-
63
- coco commit
64
- ```
65
-
66
- #### Conventional Commits & Commitlint Integration
67
-
68
- `coco` provides first-class support for Conventional Commits with intelligent commitlint integration:
69
-
70
- **Conventional Commits Support:**
71
-
72
- - **Automatic Detection**: Enables conventional commits mode when commitlint config is detected
73
- - **Smart Formatting**: Generates properly formatted conventional commits (feat, fix, docs, etc.)
74
- - **Breaking Changes**: Supports breaking change syntax (`feat!:` and `feat(scope)!:`)
75
- - **Scoped Commits**: Intelligent scope detection and formatting
76
- - **Robust Parsing**: Advanced JSON parsing with automatic error recovery
77
-
78
- **Commitlint Integration:**
79
-
80
- - **Smart Detection**: Automatically finds commitlint config files (`.commitlintrc.*`, `commitlint.config.*`, or `package.json` with commitlint field)
81
- - **AI-Aware Rules**: Passes your commitlint rules to the AI for better compliance from the start
82
- - **Automatic Retry**: When validation fails, `coco` automatically retries generation with error feedback (up to 2 attempts)
83
- - **Package Manager Compatibility**: Works seamlessly with npm, yarn, and pnpm (with automatic fallback for ES module issues)
84
- - **User-Friendly Flow**: After auto-retries, offers options to try 2 more times or edit manually
85
- - **Full Validation**: Both AI-generated and manually edited commit messages are validated against your rules
86
-
87
- #### Command Options
88
-
89
- **Basic Options:**
24
+ ## Quick Start
90
25
 
91
26
  ```bash
92
- # Interactive mode - opens editor for review and editing
93
- coco -i, --interactive
27
+ # Try without installing
28
+ npx git-coco@latest init
94
29
 
95
- # Verbose output - shows detailed processing information
96
- coco --verbose
97
-
98
- # Help - display command help
99
- coco --help
100
- ```
30
+ # Install globally
31
+ npm install -g git-coco
101
32
 
102
- **Commit Enhancement Options:**
103
-
104
- ```bash
105
- # Add content to the end of the generated commit message
106
- coco --append "Resolves #128"
107
-
108
- # Automatically append Jira/Linear ticket ID from branch name
109
- coco -t, --append-ticket
110
-
111
- # Add extra context to guide commit generation
112
- coco -a, --additional "Resolves UX bug with sign up button"
113
-
114
- # Include previous commits for context (specify number)
115
- coco -p, --with-previous-commits 3
116
- ```
117
-
118
- **Conventional Commits Options:**
119
-
120
- ```bash
121
- # Force conventional commits mode
122
- coco -c, --conventional
123
-
124
- # Include/exclude branch name in context (default: true)
125
- coco --include-branch-name
126
- coco --no-include-branch-name
127
- ```
128
-
129
- **Processing Options:**
130
-
131
- ```bash
132
- # Ignore specific files (can be used multiple times)
133
- coco --ignored-files "*.lock" --ignored-files "dist/*"
134
-
135
- # Ignore file extensions (can be used multiple times)
136
- coco --ignored-extensions ".map" --ignored-extensions ".min.js"
137
-
138
- # Use basic git status instead of full diff (faster for large changes)
139
- coco --no-diff
33
+ # Setup and configure
34
+ coco init
140
35
 
141
- # Open commit message in editor before proceeding
142
- coco --open-in-editor
36
+ # Generate your first commit
37
+ git add .
38
+ coco -i
143
39
  ```
144
40
 
145
- ### **`coco changelog`**
146
-
147
- Creates changelogs from commit history.
148
-
149
- ```bash
150
- # Basic changelog for current branch
151
- coco changelog
41
+ ## Commands
152
42
 
153
- # Interactive mode
154
- coco changelog -i, --interactive
155
- ```
43
+ - **`coco commit`** - Generate commit messages from staged changes
44
+ - **`coco changelog`** - Create changelogs from commit history
45
+ - **`coco recap`** - Summarize recent changes and activity
46
+ - **`coco review`** - AI-powered code review of your changes
47
+ - **`coco init`** - Interactive setup wizard
156
48
 
157
- #### Changelog Options
49
+ ## Usage Examples
158
50
 
159
- **Range Selection:**
51
+ ### Basic Workflow
160
52
 
161
53
  ```bash
162
- # Specific commit range (HEAD references)
163
- coco changelog -r HEAD~5:HEAD
164
-
165
- # Specific commit range (commit hashes)
166
- coco changelog -r abc1234:def5678
54
+ # Make your changes
55
+ git add .
167
56
 
168
- # Compare against target branch
169
- coco changelog -b main, --branch main
57
+ # Generate commit message (interactive mode recommended)
58
+ coco -i
170
59
 
171
- # All commits since last tag
172
- coco changelog -t, --since-last-tag
60
+ # Or use stdout mode
61
+ git commit -m "$(coco)"
173
62
  ```
174
63
 
175
- **Content Options:**
64
+ ### Conventional Commits
176
65
 
177
66
  ```bash
178
- # Include diff for each commit in analysis
179
- coco changelog --with-diff
180
-
181
- # Generate changelog based only on branch diff
182
- coco changelog --only-diff
67
+ # Enable conventional commits format
68
+ coco --conventional
183
69
 
184
- # Include author attribution
185
- coco changelog --author
70
+ # With additional context
71
+ coco -a "Fixes login timeout" --conventional
186
72
 
187
- # Add extra context to guide generation
188
- coco changelog -a "Focus on user-facing changes" --additional "Focus on user-facing changes"
73
+ # Include ticket from branch name
74
+ coco --append-ticket --conventional
189
75
  ```
190
76
 
191
- ### **`coco recap`**
192
-
193
- Summarize changes across different time periods.
77
+ ### Team Workflows
194
78
 
195
79
  ```bash
196
- # Summarize current working directory changes
197
- coco recap
198
-
199
- # Interactive mode
200
- coco recap -i, --interactive
201
- ```
202
-
203
- #### Recap Time Periods
80
+ # Generate changelog for releases
81
+ coco changelog --since-last-tag
204
82
 
205
- ```bash
206
- # Yesterday's changes
83
+ # Summarize recent work
207
84
  coco recap --yesterday
208
85
 
209
- # Last week's changes
210
- coco recap --last-week, --week
211
-
212
- # Last month's changes
213
- coco recap --last-month, --month
214
-
215
- # Changes since last git tag
216
- coco recap --last-tag, --tag
217
-
218
- # Current branch changes
219
- coco recap --current-branch
220
- ```
221
-
222
- ### **`coco review`**
223
-
224
- Perform AI-powered code review on your changes.
225
-
226
- ```bash
227
- # Review current working directory changes
86
+ # Code review before committing
228
87
  coco review
229
-
230
- # Interactive mode
231
- coco review -i, --interactive
232
-
233
- # Review specific branch
234
- coco review -b feature-branch, --branch feature-branch
235
- ```
236
-
237
- ### **`coco init`**
238
-
239
- Interactive setup wizard for configuring coco.
240
-
241
- ```bash
242
- # Setup wizard (will prompt for scope)
243
- coco init
244
-
245
- # Configure for current project only
246
- coco init --scope project
247
-
248
- # Configure globally for current user
249
- coco init --scope global
250
- ```
251
-
252
- ### Stdout vs. Interactive Mode
253
-
254
- `coco` offers two modes of operation: **stdout** and **interactive**, defaulting to **stdout**. You can specify your preferred mode in your config file or via command line flags.
255
-
256
- ```bash
257
- # Stdout mode
258
- git commit -m $(coco)
259
-
260
- # Interactive mode
261
- coco -i
262
- ```
263
-
264
- ### Generate and commit all in one
265
-
266
- `coco` can generate and commit your changes in one command.
267
-
268
- ```bash
269
- coco -s
270
- ```
271
-
272
- ### **Conventional Commits Examples**
273
-
274
- `coco` excels at generating properly formatted conventional commits:
275
-
276
- ```bash
277
- # Basic conventional commit
278
- coco --conventional
279
- # Output: feat: add user authentication system
280
-
281
- # With scope
282
- coco --conventional -a 'fixes login timeout'
283
- # Output: fix(auth): resolve login timeout issue
284
-
285
- # With additional context and ticket
286
- coco --conventional --additional "Resolves login issues" --append-ticket
287
- # Output: feat(auth): add OAuth2 integration
288
- #
289
- # Implement OAuth2 flow with Google and GitHub providers.
290
- # Resolves login issues
291
- #
292
- # Part of **PROJ-123**
293
88
  ```
294
89
 
295
90
  ## Configuration
296
91
 
297
- `coco` offers flexible configuration through multiple methods with a clear priority system. See the complete [Configuration Overview](CONFIG_OVERVIEW.md) for detailed setup instructions, all available options, and examples.
298
-
299
- **Quick Start:**
92
+ Configure `coco` for your workflow with the interactive setup wizard:
300
93
 
301
94
  ```bash
302
- # Interactive setup wizard
95
+ # Setup wizard
303
96
  coco init
304
97
 
305
- # Project-specific configuration
98
+ # Project-specific setup
306
99
  coco init --scope project
307
-
308
- # Global user configuration
309
- coco init --scope global
310
100
  ```
311
101
 
312
- **Configuration Methods (in priority order):**
313
-
314
- 1. Command line flags (highest priority)
315
- 2. Environment variables
316
- 3. Project config (`.coco.config.json`)
317
- 4. Git config (`.gitconfig`)
318
- 5. XDG config directory (lowest priority)
319
-
320
102
  **AI Providers:**
103
+ - **OpenAI** - GPT-4o, GPT-4o-mini (API key required)
104
+ - **Anthropic** - Claude 3.5 Sonnet (API key required)
105
+ - **Ollama** - Local models, no API costs, full privacy
321
106
 
322
- - **OpenAI**: GPT-4o, GPT-4o-mini, GPT-4 Turbo (API key required)
323
- - **Anthropic**: Claude 3.5 Sonnet, Claude 3 Haiku (API key required)
324
- - **Ollama**: Local models, no API costs, full privacy - [Setup Guide](USING_OLLAMA.md)
325
-
326
- ### **Ignoring Files & Extensions**
327
-
328
- `coco` can ignore specific files and extensions to focus on meaningful changes. See the complete [Ignoring Files & Extensions Guide](IGNORING_FILES_EXTENSIONS.md) for detailed configuration options and examples.
329
-
330
- **Quick Examples:**
331
-
332
- ```bash
333
- # Command line flags
334
- coco --ignored-files "*.lock" --ignored-extensions ".map"
335
-
336
- # Config file
107
+ **Example Configuration:**
108
+ ```json
337
109
  {
338
- "ignoredFiles": ["package-lock.json", "dist/*"],
339
- "ignoredExtensions": [".map", ".min.js"]
110
+ "mode": "interactive",
111
+ "conventionalCommits": true,
112
+ "service": {
113
+ "provider": "openai",
114
+ "model": "gpt-4o"
115
+ }
340
116
  }
341
117
  ```
342
118
 
343
- **Default Ignores:**
344
-
345
- - Files: `package-lock.json` + contents of `.gitignore`
346
- - Extensions: `.map`, `.lock`
347
-
348
- ## Troubleshooting
349
-
350
- ### **pnpm Compatibility**
351
-
352
- If you encounter ES module errors with pnpm and commitlint:
353
-
354
- ```bash
355
- # Update commitlint packages to latest versions
356
- pnpm add -D @commitlint/config-conventional@latest @commitlint/cli@latest
357
-
358
- # Or continue without commitlint validation
359
- # coco will automatically fall back to built-in conventional commit rules
360
- ```
361
-
362
- ### **Conventional Commits Issues**
363
-
364
- - **JSON Parsing Errors**: `coco` automatically repairs common JSON formatting issues from AI responses
365
- - **Commitlint Validation**: If validation fails, `coco` provides clear error messages and retry options
366
- - **Missing Dependencies**: `coco` gracefully handles missing commitlint packages with helpful installation guidance
367
-
368
119
  ## Documentation
369
120
 
370
121
  For comprehensive guides, advanced usage, and detailed configuration options, visit our complete documentation:
@@ -372,17 +123,15 @@ For comprehensive guides, advanced usage, and detailed configuration options, vi
372
123
  ### 📚 **[Coco Wiki](https://github.com/gfargo/coco/wiki)**
373
124
 
374
125
  **Essential Guides:**
375
-
376
126
  - **[Getting Started](https://github.com/gfargo/coco/wiki/Getting-Started)** - Complete beginner's guide from installation to first commit
127
+ - **[Command Reference](https://github.com/gfargo/coco/wiki/Command-Reference)** - Detailed command options and examples
377
128
  - **[Configuration Overview](https://github.com/gfargo/coco/wiki/Config-Overview)** - All configuration options and setup methods
378
129
  - **[Team Collaboration](https://github.com/gfargo/coco/wiki/Team-Collaboration)** - Enterprise deployment and team adoption strategies
379
- - **[Using Ollama](https://github.com/gfargo/coco/wiki/Using-Ollama)** - Local AI setup for privacy and cost control
380
130
 
381
131
  **Advanced Resources:**
382
-
132
+ - **[Using Ollama](https://github.com/gfargo/coco/wiki/Using-Ollama)** - Local AI setup for privacy and cost control
383
133
  - **[Advanced Usage](https://github.com/gfargo/coco/wiki/Advanced-Usage)** - Custom prompts, automation, and power-user features
384
134
  - **[Troubleshooting](https://github.com/gfargo/coco/wiki/Troubleshooting)** - Solutions for common issues and debugging
385
- - **[Ignoring Files & Extensions](https://github.com/gfargo/coco/wiki/Ignoring-Files-&-Extensions)** - Advanced file filtering and pattern matching
386
135
 
387
136
  ### 🆘 **Need Help?**
388
137
 
@@ -47,7 +47,7 @@ import { pathToFileURL } from 'url';
47
47
  /**
48
48
  * Current build version from package.json
49
49
  */
50
- const BUILD_VERSION = "0.22.11";
50
+ const BUILD_VERSION = "0.23.0";
51
51
 
52
52
  const isInteractive = (config) => {
53
53
  return config?.mode === 'interactive' || !!config?.interactive;
@@ -11557,6 +11557,10 @@ const handler$3 = async (argv, logger) => {
11557
11557
  },
11558
11558
  factory,
11559
11559
  parser,
11560
+ reviewParser: (result) => {
11561
+ // Ensure the result is properly formatted as a string for display
11562
+ return typeof result === 'string' ? result : String(result);
11563
+ },
11560
11564
  agent: async (context, options) => {
11561
11565
  // Select the appropriate schema based on whether conventional commits are enabled
11562
11566
  const schema = USE_CONVENTIONAL_COMMITS
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
69
69
  /**
70
70
  * Current build version from package.json
71
71
  */
72
- const BUILD_VERSION = "0.22.11";
72
+ const BUILD_VERSION = "0.23.0";
73
73
 
74
74
  const isInteractive = (config) => {
75
75
  return config?.mode === 'interactive' || !!config?.interactive;
@@ -11579,6 +11579,10 @@ const handler$3 = async (argv, logger) => {
11579
11579
  },
11580
11580
  factory,
11581
11581
  parser,
11582
+ reviewParser: (result) => {
11583
+ // Ensure the result is properly formatted as a string for display
11584
+ return typeof result === 'string' ? result : String(result);
11585
+ },
11582
11586
  agent: async (context, options) => {
11583
11587
  // Select the appropriate schema based on whether conventional commits are enabled
11584
11588
  const schema = USE_CONVENTIONAL_COMMITS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-coco",
3
- "version": "0.22.11",
3
+ "version": "0.23.0",
4
4
  "description": "zero-effort git commits with coco.",
5
5
  "author": "gfargo <ghfargo@gmail.com>",
6
6
  "license": "MIT",