n2b 0.7.1 โ†’ 2.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cad0de8d212180547279e2d92365d37ec44abeb716d6984a6770edc3067f963
4
- data.tar.gz: 0d23a5f0841c06357175234129814ec2bb36b87d3106fd0e845a3d76fc37e559
3
+ metadata.gz: 904b66daf8fd1cdb0a4fba961fc0431dbf5bf841c022d3b31b52daa7c549f02d
4
+ data.tar.gz: e89ae0125af9f1c2c40ac2ad14f0a5ced1dc6bd882e88aa81ccf34b2d958528f
5
5
  SHA512:
6
- metadata.gz: e348c724af4d838d64e86fbd78fa291a6bf10e585d501df061c5c88dae2e20bf7180bef645011057e458bd0226725ba51de230e7bb21b21927726b85f42453c3
7
- data.tar.gz: 005d855b32744aa5b74694c4d2978c4bf2b21478d4a502e627b7cb0edb4abcb474bb18a50ab791c5b7155d040c59196f01fdb0ad1a7e3cabff5d7c88158bc168
6
+ metadata.gz: 528eefd2847a246bcc5282b1ea360477737c9c85e8643fadce3be1eaaa6c7b64464e9cdba1d1a59d8bcad4eec25fd912dd5e9d04e1abbd5f31ab39c646b9b363
7
+ data.tar.gz: abcee779b759722282f5b48046c97418d215e0ff528b9c6ea76be4cca09335256606150eb7c18c3a2bff978559f5560768b0fdf02c35bbcd05a65023de3ff4b0
data/README.md CHANGED
@@ -2,37 +2,51 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/n2b.svg)](https://badge.fury.io/rb/n2b)
4
4
 
5
+ **Transform your development workflow with intelligent command translation, code analysis, and seamless Jira/GitHub integration.** N2B provides a suite of tools to enhance productivity.
6
+
7
+ > **IMPORTANT: Command Restructuring in v2.0**
8
+ >
9
+ > The `n2b` and `n2b-diff` commands have been restructured in version 2.0.
10
+ > * `n2b` is now solely for natural language to shell command translation.
11
+ > * `n2b-diff` handles both AI-powered merge conflict resolution AND AI-powered code diff analysis (previously `n2b --diff`).
12
+ >
13
+ > Please see our [MIGRATION.md](MIGRATION.md) for details on adapting your commands and workflows.
14
+
5
15
  **Transform your development workflow with intelligent code analysis and seamless Jira integration.** N2B is an AI-powered development tool that revolutionizes code review, requirements compliance, and project management through automated diff analysis, smart merge conflict resolution, and intelligent ticket integration.
6
16
 
7
17
  ## ๐Ÿš€ **Key Features**
8
18
 
9
- ### ๐ŸŽฏ **Smart Jira Integration**
10
- - **Automated Ticket Analysis**: Fetch requirements from Jira tickets and analyze code changes against them
11
- - **Intelligent Updates**: Post beautifully formatted analysis results directly to Jira with collapsible sections
12
- - **Requirements Extraction**: Automatically identify acceptance criteria, tasks, and requirements from tickets and comments
13
- - **Real-time Feedback**: Get instant compliance checking and implementation guidance
19
+ ### ๐ŸŽฏ **Smart Jira & GitHub Integration (via `n2b-diff --analyze`)**
20
+ - **Automated Ticket/Issue Analysis**: Fetch requirements from Jira tickets or GitHub issues and analyze code changes against them using `n2b-diff --analyze`.
21
+ - **Intelligent Updates**: Post beautifully formatted analysis results directly to Jira or GitHub.
22
+ - **Requirements Extraction**: Automatically identify acceptance criteria and tasks.
23
+ - **Real-time Feedback**: Get instant compliance checking.
14
24
 
15
- ### ๐Ÿ” **AI-Powered Code Analysis**
16
- - **Context-Aware Diff Review**: Intelligent analysis of git/hg changes with comprehensive insights
17
- - **Requirements Compliance**: Automated verification against project requirements and acceptance criteria
18
- - **Test Coverage Assessment**: Evaluate test completeness and suggest improvements
19
- - **Security & Quality Insights**: Identify potential issues, risks, and improvement opportunities
25
+ ### ๐Ÿ” **AI-Powered Code Diff Analysis (via `n2b-diff --analyze`)**
26
+ - **Context-Aware Diff Review**: Intelligent analysis of `git`/`hg` changes.
27
+ - **Requirements Compliance**: Automated verification against project requirements.
28
+ - **Test Coverage Assessment**: Evaluate test completeness.
29
+ - **Security & Quality Insights**: Identify potential issues and improvements.
30
+ - **Custom Instructions**: Guide the AI analysis with the `-m/--message` option.
31
+
32
+ ### ใ‚ณใƒžใƒณใƒ‰ๅค‰ๆ› (via `n2b`)
33
+ - **Natural Language to Shell**: Convert descriptions to executable shell commands.
20
34
 
21
35
  ### ๐Ÿค– **Flexible AI Support**
22
- - **Multiple LLM Providers**: Claude, OpenAI, Gemini, OpenRouter, Ollama
23
- - **Latest Models**: OpenAI O3/O4 series, Gemini 2.5, Claude Sonnet 4.0
24
- - **Custom Models**: Support for fine-tuned models, beta releases, and custom deployments
36
+ - **Multiple LLM Providers**: Claude, OpenAI, Gemini, OpenRouter, Ollama.
37
+ - **Latest Models**: Support for cutting-edge models from various providers.
38
+ - **Custom Models**: Use fine-tuned models and custom deployments.
25
39
 
26
40
  ### ๐Ÿ’ป **Development Workflow**
27
- - **Natural Language Commands**: Convert descriptions to executable bash commands
28
- - **Ruby Code Generation**: Generate Ruby code from natural language instructions
29
- - **VCS Integration**: Full Git and Mercurial support with branch comparison
30
- - **AI Merge Conflict Resolution**: Interactive merge conflict resolver with intelligent suggestions
31
- - **Errbit Integration**: Analyze errors and generate actionable reports
41
+ - **AI Merge Conflict Resolution (via `n2b-diff`)**: Interactive merge conflict resolver with HTML audit logs.
42
+ - **HTML Merge Logs**: Beautiful 4-column audit trails with base/incoming/resolution/reasoning.
43
+ - **Ruby Code Generation (IRB/Console)**: Generate Ruby code from natural language.
44
+ - **VCS Integration**: Git and Mercurial support in `n2b-diff`.
45
+ - **Errbit Integration (IRB/Console)**: Analyze errors and generate reports.
32
46
 
33
- ## ๐Ÿ” **AI-Powered Diff Analysis** โšก *Beta Feature*
47
+ ## ๐Ÿ” **AI-Powered Diff Analysis with `n2b-diff --analyze`** โšก *Beta Feature*
34
48
 
35
- **Get instant, intelligent code review for every change you make.** Our AI-powered diff analysis provides comprehensive insights into your code changes, helping you catch issues early and maintain high code quality.
49
+ **Get instant, intelligent code review for every change you make.** The `n2b-diff --analyze` command provides comprehensive insights into your code changes, helping you catch issues early and maintain high code quality.
36
50
 
37
51
  ### โœจ **What Makes It Special**
38
52
 
@@ -47,13 +61,13 @@
47
61
 
48
62
  ```bash
49
63
  # Analyze your current changes
50
- n2b --diff
64
+ n2b-diff --analyze
51
65
 
52
- # Compare against main branch with requirements checking
53
- n2b --diff --branch main --requirements requirements.md
66
+ # Compare against main branch with requirements checking and a custom message
67
+ n2b-diff --analyze --branch main --requirements requirements.md -m "Focus on security aspects"
54
68
 
55
69
  # Full workflow with Jira integration
56
- n2b --diff --jira PROJ-123 --jira-update
70
+ n2b-diff --analyze --jira PROJ-123 --update
57
71
  ```
58
72
 
59
73
  ### ๐Ÿ’ฌ **We Want Your Feedback!**
@@ -66,9 +80,9 @@ This is a **beta feature** and we're actively improving it based on real-world u
66
80
 
67
81
  ---
68
82
 
69
- ## ๐ŸŽฏ **Jira Integration - Get Started in 2 Minutes**
83
+ ## ๐ŸŽฏ **Jira & GitHub Integration with `n2b-diff --analyze`**
70
84
 
71
- Transform your development workflow with intelligent Jira integration:
85
+ Transform your development workflow with intelligent Jira and GitHub issue integration:
72
86
 
73
87
  ### Quick Setup
74
88
 
@@ -78,10 +92,13 @@ gem install n2b
78
92
  n2b --advanced-config # Set up Jira credentials
79
93
 
80
94
  # Test your connection
81
- n2b-test-jira
95
+ n2b-test-jira # (This command might need review if its scope changes)
82
96
 
83
97
  # Analyze code against ticket requirements
84
- n2b --diff --jira PROJ-123 --jira-update
98
+ n2b-diff --analyze --jira PROJ-123 --update
99
+
100
+ # Analyze code against GitHub issue requirements
101
+ n2b-diff --analyze --github your-org/your-repo/issues/42 --update
85
102
  ```
86
103
 
87
104
  ### What You Get
@@ -96,28 +113,85 @@ n2b --diff --jira PROJ-123 --jira-update
96
113
  ```bash
97
114
  # Working on ticket PROJ-123
98
115
  git add .
99
- n2b --diff --jira PROJ-123 --jira-update
116
+ n2b-diff --analyze --jira PROJ-123 --update
100
117
  ```
101
118
 
102
- **Result**: Your Jira ticket gets updated with a professional analysis comment showing implementation progress, technical insights, and compliance status.
119
+ **Result**: Your Jira ticket (or GitHub issue) gets updated with a professional analysis comment showing implementation progress, technical insights, and compliance status.
120
+
121
+ ## ๐Ÿ“Š **HTML Merge Logs - Professional Audit Trails**
122
+
123
+ N2B now generates beautiful HTML merge logs that provide complete audit trails of your merge conflict resolutions:
103
124
 
104
- ## ๐Ÿ” **AI-Powered Code Analysis**
125
+ ### โœจ **4-Column Layout**
126
+ - **Base Branch Code**: The code from your target branch
127
+ - **Incoming Branch Code**: The code from the branch being merged
128
+ - **Final Resolution**: The actual resolved code that was chosen
129
+ - **Resolution Details**: Method used, timestamps, and LLM reasoning
105
130
 
106
- Get comprehensive code review and insights:
131
+ ### ๐ŸŽจ **Professional Features**
132
+ - **Color-Coded Sections**: Red for base, blue for incoming, green for resolution
133
+ - **Method Badges**: Visual indicators for LLM vs Manual vs Skip vs Abort
134
+ - **Statistics Dashboard**: Total conflicts, resolved count, success rates
135
+ - **Responsive Design**: Works perfectly on desktop and mobile
136
+ - **Browser-Ready**: Open directly in any web browser
107
137
 
138
+ ### ๐Ÿ“‹ **Perfect for Teams**
139
+ - **Code Reviews**: Share merge decisions with your team
140
+ - **Compliance**: Complete audit trail for regulated environments
141
+ - **Learning**: See how AI suggestions compare to manual choices
142
+ - **Debugging**: Understand why conflicts were resolved specific ways
143
+
144
+ ### ๐Ÿš€ **Usage**
108
145
  ```bash
109
- # Analyze uncommitted changes
110
- n2b --diff
146
+ # Enable merge logging in config (if not already enabled)
147
+ n2b -c
111
148
 
112
- # Compare against specific branch with requirements
113
- n2b --diff --branch main --requirements requirements.md
149
+ # Resolve conflicts - HTML log automatically generated
150
+ n2b-diff conflicted_file.rb
114
151
 
115
- # Full workflow with Jira integration
116
- n2b --diff --jira PROJ-123 --requirements specs.md
152
+ # Find your logs
153
+ open .n2b_merge_log/2025-01-08-143022.html
117
154
  ```
118
155
 
119
- ## ๐Ÿ†• **What's New in v0.7.1**
156
+ ## ๐Ÿ” **AI-Powered Code Analysis & Command Translation**
157
+
158
+ N2B offers two primary commands for different aspects of your workflow:
159
+
160
+ **1. `n2b` (Natural Language to Shell Commands)**
161
+ Use `n2b` for translating your plain English (or other language) descriptions into shell commands.
162
+ ```bash
163
+ n2b "list all ruby files modified in the last 2 days"
164
+ n2b -x "create a backup of my_app.log"
165
+ ```
166
+
167
+ **2. `n2b-diff` (Merge Conflict Resolution & Diff Analysis)**
168
+ Use `n2b-diff` for AI-assisted merge conflict resolution and for detailed AI-powered analysis of your code changes (diffs).
120
169
 
170
+ **Diff Analysis Examples:**
171
+ ```bash
172
+ # Analyze uncommitted changes
173
+ n2b-diff --analyze
174
+
175
+ # Compare against specific branch with requirements and custom message
176
+ n2b-diff --analyze --branch main --requirements requirements.md -m "Ensure all new functions are documented."
177
+
178
+ # Full workflow with Jira integration
179
+ n2b-diff --analyze --jira PROJ-123 --requirements specs.md --update
180
+ ```
181
+
182
+ ## ๐Ÿ†• **What's New in v2.0.1 (Latest)**
183
+ * **๐Ÿ“Š HTML Merge Logs**: Beautiful 4-column audit trails with professional styling and team collaboration features
184
+ * **๐ŸŽฏ Enhanced Jira Integration**: Template-based formatting, collapsible sections, and clean professional comments
185
+ * **๐Ÿ”ง Debug Environment**: `N2B_DEBUG=true` for detailed troubleshooting when needed
186
+ * **โšก Better Context Display**: Shows surrounding code context for better conflict understanding
187
+ * **๐Ÿงช Robust Testing**: All core functionality thoroughly tested and passing
188
+
189
+ ## ๐Ÿ†• **What's New in v2.0 (Major Release)**
190
+ * **Command Restructuring**: `n2b` for command translation, `n2b-diff` for merge conflicts and all-new AI diff analysis. See [MIGRATION.md](MIGRATION.md).
191
+ * **Custom Messages for Analysis**: Guide the AI's focus during diff analysis using the `-m/--message` option with `n2b-diff --analyze`.
192
+ * **Enhanced `n2b-diff`**: Now the central hub for code analysis, supporting branches, requirements files, Jira/GitHub integration, and custom analysis instructions.
193
+
194
+ - **๐Ÿ”— GitHub Integration**: Full GitHub issue support with fetch and comment functionality
121
195
  - **๐Ÿ” Enhanced AI Diff Analysis**: Comprehensive code review with context-aware insights (Beta)
122
196
  - **โ˜ Interactive Jira Checklists**: Native checkboxes for team collaboration and progress tracking
123
197
  - **๐ŸŽฏ Full Template Engine**: Variables, loops, conditionals for maximum customization
@@ -221,30 +295,33 @@ hg merge
221
295
 
222
296
  ## Quick Start
223
297
 
224
- ### ๐Ÿ” **AI-Powered Code Review** (โšก Beta - Try It Now!)
298
+ ### ๐Ÿ” **AI-Powered Code Review (using `n2b-diff --analyze`)** (โšก Beta - Try It Now!)
225
299
 
226
300
  ```bash
227
301
  # Get instant AI analysis of your changes
228
- n2b --diff
302
+ n2b-diff --analyze
229
303
 
230
- # Compare against main branch with requirements checking
231
- n2b --diff --branch main --requirements specs.md
304
+ # Compare against main branch with requirements checking and custom message
305
+ n2b-diff --analyze --branch main --requirements specs.md -m "Check for API compatibility."
232
306
 
233
307
  # Full workflow with Jira integration
234
- n2b --diff --jira PROJ-123 --jira-update
308
+ n2b-diff --analyze --jira PROJ-123 --update
235
309
  ```
236
310
 
237
- ### ๐ŸŽฏ **For Jira Users** (Most Popular)
311
+ ### ๐ŸŽฏ **For Jira & GitHub Users (Code Analysis)**
238
312
 
239
313
  ```bash
240
- # Set up Jira integration
314
+ # Set up Jira/GitHub integration (done once via n2b's config)
241
315
  n2b --advanced-config
242
316
 
243
- # Analyze code changes against ticket
244
- n2b --diff --jira PROJ-123 --jira-update
317
+ # Analyze code changes against a Jira ticket
318
+ n2b-diff --analyze --jira PROJ-123 --update
319
+
320
+ # Analyze code changes against a GitHub issue
321
+ n2b-diff --analyze --github your-org/your-repo/issues/42 --update
245
322
  ```
246
323
 
247
- ### ๐Ÿ’ป **For Command Generation**
324
+ ### ๐Ÿ’ป **For Command Generation (using `n2b`)**
248
325
 
249
326
  ```bash
250
327
  # Generate bash commands
@@ -363,6 +440,20 @@ You can also set the history file location using the `N2B_HISTORY_FILE` environm
363
440
  export N2B_HISTORY_FILE=/path/to/your/history
364
441
  ```
365
442
 
443
+ ### Debug Mode
444
+
445
+ For troubleshooting Jira integration or other issues, enable debug mode:
446
+ ```bash
447
+ export N2B_DEBUG=true
448
+ n2b-diff --analyze --jira PROJ-123 --update
449
+ ```
450
+
451
+ This will show detailed information about:
452
+ - Template content generation
453
+ - API request/response details
454
+ - ADF structure for Jira comments
455
+ - Error diagnostics
456
+
366
457
  ### Custom Prompt Templates
367
458
 
368
459
  N2B uses text templates for AI prompts. To override them, specify paths in your configuration:
@@ -381,6 +472,24 @@ When these paths are not provided, the built-in templates located in `lib/n2b/te
381
472
  - `diff_json_instruction.txt` - JSON formatting instructions for diff analysis
382
473
  - `merge_conflict_prompt.txt` - Merge conflict resolution prompt
383
474
 
475
+ ### Editor Configuration
476
+
477
+ N2B allows you to configure your preferred text editor or visual diff tool for use with the `[e]` (Edit) option during merge conflict resolution. This can be set up during the advanced configuration flow (run `n2b --advanced-config` or `n2b -c` and choose to configure advanced settings).
478
+
479
+ You will be prompted to choose from a list of auto-detected editors (like `nano`, `vim`, `code` - VS Code) and diff tools (like `meld`, `kdiff3`, `vimdiff`). You can also provide a custom command.
480
+
481
+ The chosen editor is stored in your `~/.n2b/config.yml` file under the `editor` key:
482
+
483
+ ```yaml
484
+ editor:
485
+ command: "meld"
486
+ type: "diff_tool" # Can be "text_editor" or "diff_tool"
487
+ configured: true
488
+ ```
489
+
490
+ * If a **text editor** is configured, the `[e]` option will open the conflicted file directly for manual editing using the specified editor command.
491
+ * If a **diff tool** is configured, N2B will prepare temporary files for the base, incoming, and current (LLM suggested) versions of the conflict and open them in your chosen 3-way merge tool. After you've used the tool, N2B will use the content from your successfully merged file.
492
+
384
493
  ## Quick Example N2B
385
494
 
386
495
  ```
@@ -466,24 +575,39 @@ Configuration is stored in `~/.n2b/config.yml`.
466
575
 
467
576
  Basic usage:
468
577
 
469
- n2b [options] your natural language instruction
470
-
471
- Options:
472
- - `-x` or `--execute`: Execute the generated commands after confirmation
473
- - `-d` or `--diff`: Analyze git/hg diff with AI-powered code review
474
- - `-b` or `--branch [BRANCH]`: Compare against specific branch (auto-detects main/master/default)
475
- - `-r` or `--requirements FILE`: Requirements file for compliance checking
476
- - `-j` or `--jira TICKET`: Jira ticket ID or URL for context and updates
477
- - `--jira-update`: Automatically update Jira ticket with analysis (no prompt)
478
- - `--jira-no-update`: Skip Jira ticket update (analyze only)
479
- - `-c` or `--config`: Reconfigure the tool
480
- - `--advanced-config`: Advanced configuration including Jira setup
481
- - `-v` or `--version`: Show version information
482
- - `-h` or `--help`: Display help information
483
-
484
- **Additional Commands:**
485
- - `n2b-diff FILE`: AI-powered merge conflict resolution
486
- - `n2b-test-jira`: Test Jira API connection and permissions
578
+ n2b [options] "your natural language instruction"
579
+
580
+ **`n2b` Options:**
581
+ - `-x`, `--execute`: Execute the translated commands after confirmation.
582
+ - `-c`, `--config`: Configure N2B (API key, model, privacy settings, etc.).
583
+ - `--advanced-config`: Access advanced configuration options.
584
+ - `-v`, `--version`: Show version information.
585
+ - `-h`, `--help`: Display help information for `n2b`.
586
+
587
+ **`n2b-diff` Command Usage:**
588
+
589
+ `n2b-diff [FILE] [options]` (for merge conflicts)
590
+ `n2b-diff --analyze [options]` (for code diff analysis)
591
+
592
+ **`n2b-diff` Options:**
593
+ *Merge Conflict Mode (when FILE is provided and not --analyze):*
594
+ - `--context N`: Number of context lines to display around a merge conflict.
595
+ *Diff Analysis Mode (`--analyze`):*
596
+ - `-a`, `--analyze`: Activate AI-powered diff analysis.
597
+ - `--branch [BRANCH_NAME]`: Specify branch to compare against (e.g., 'main', 'develop'). Defaults to auto-detected primary branch.
598
+ - `-j`, `--jira JIRA_ID_OR_URL`: Link a Jira ticket for context or updates.
599
+ - `--github GITHUB_ISSUE_URL`: Link a GitHub issue for context or updates (e.g., 'owner/repo/issues/123').
600
+ - `-r`, `--requirements FILE_PATH`: Provide a requirements file for the AI.
601
+ - `-m`, `--message "TEXT"`: Add custom instructions for the AI analysis.
602
+ - `--update`: If -j or --github is used, attempt to update the ticket/issue with the analysis (prompts for confirmation by default unless this flag is used for auto-yes).
603
+ - `--no-update`: Prevent updating the ticket/issue.
604
+ *Common for `n2b-diff`:*
605
+ - `-h`, `--help`: Display help information for `n2b-diff`.
606
+ - `-v`, `--version`: Show version information.
607
+
608
+
609
+ **Other Commands:**
610
+ - `n2b-test-jira`: Test Jira API connection and permissions (functionality might be reviewed/updated).
487
611
 
488
612
  Examples:
489
613
 
@@ -499,36 +623,32 @@ Examples:
499
623
 
500
624
  ```n2b -c ```
501
625
 
502
- ## ๐Ÿ” AI-Powered Diff Analysis
626
+ ## ๐Ÿ” AI-Powered Diff Analysis (using `n2b-diff --analyze`)
503
627
 
504
- N2B provides comprehensive AI-powered code review for your git and mercurial repositories.
628
+ `n2b-diff --analyze` provides comprehensive AI-powered code review for your Git and Mercurial repositories.
505
629
 
506
630
  ### Basic Diff Analysis
507
631
 
508
632
  ```bash
509
- # Analyze uncommitted changes
510
- n2b --diff
633
+ # Analyze uncommitted changes (against HEAD or default compare target)
634
+ n2b-diff --analyze
511
635
 
512
- # Analyze changes against specific branch
513
- n2b --diff --branch main
514
- n2b --diff --branch feature/auth
636
+ # Analyze changes against a specific branch
637
+ n2b-diff --analyze --branch main
638
+ n2b-diff --analyze --branch feature/auth
515
639
 
516
- # Auto-detect default branch (main/master/default)
517
- n2b --diff --branch
518
-
519
- # Short form
520
- n2b -d -b main
640
+ # Auto-detect default branch (main/master/default) if --branch is provided without a value
641
+ n2b-diff --analyze --branch
521
642
  ```
522
643
 
523
- ### Requirements Compliance Checking
644
+ ### Requirements Compliance Checking & Custom Instructions
524
645
 
525
646
  ```bash
526
- # Check if changes meet requirements
527
- n2b --diff --requirements requirements.md
528
- n2b -d -r req.md
647
+ # Check if changes meet requirements from a file
648
+ n2b-diff --analyze --requirements requirements.md
529
649
 
530
- # Combine with branch comparison
531
- n2b --diff --branch main --requirements requirements.md
650
+ # Combine with branch comparison and add a custom message for the AI
651
+ n2b-diff --analyze --branch main --requirements requirements.md -m "Pay special attention to the new UserProfile class."
532
652
  ```
533
653
 
534
654
  ### What You Get
@@ -576,9 +696,9 @@ Requirements Evaluation:
576
696
  - **Git**: Full support with auto-detection of main/master branches
577
697
  - **Mercurial (hg)**: Full support with auto-detection of default branch
578
698
 
579
- ## ๐ŸŽฏ Jira Integration
699
+ ## ๐ŸŽฏ Jira & GitHub Integration (with `n2b-diff --analyze`)
580
700
 
581
- N2B provides seamless integration with Jira for automated ticket analysis and updates.
701
+ `n2b-diff --analyze` provides seamless integration with Jira and GitHub for automated ticket/issue analysis and updates.
582
702
 
583
703
  ### Setup
584
704
 
@@ -614,16 +734,19 @@ Your API token needs these specific scopes:
614
734
 
615
735
  ```bash
616
736
  # Analyze code changes against Jira ticket requirements
617
- n2b --diff --jira PROJ-123
737
+ n2b-diff --analyze --jira PROJ-123
618
738
 
619
739
  # Use full Jira URL
620
- n2b --diff --jira https://company.atlassian.net/browse/PROJ-123
740
+ n2b-diff --analyze --jira https://company.atlassian.net/browse/PROJ-123
741
+
742
+ # Auto-update Jira ticket without prompt (if configured and supported by client)
743
+ n2b-diff --analyze --jira PROJ-123 --update
621
744
 
622
- # Auto-update ticket without prompt
623
- n2b --diff --jira PROJ-123 --jira-update
745
+ # Analyze only, do not offer to update Jira ticket
746
+ n2b-diff --analyze --jira PROJ-123 --no-update
624
747
 
625
- # Analyze only (no ticket update)
626
- n2b --diff --jira PROJ-123 --jira-no-update
748
+ # Analyze code changes against GitHub issue, with custom message and update
749
+ n2b-diff --analyze --github your-org/your-repo/issues/42 -m "Focus on UI changes" --update
627
750
  ```
628
751
 
629
752
  ### What It Does
@@ -725,10 +848,34 @@ For each conflict, you can:
725
848
  - **[y] Accept** - Apply the AI suggestion
726
849
  - **[n] Skip** - Keep the conflict as-is
727
850
  - **[c] Comment** - Add context to improve AI suggestions
851
+ - **[s] Refresh Preview** - Regenerate the HTML preview with the latest suggestion
728
852
  - **[a] Abort** - Stop processing and keep file unchanged
729
853
 
730
854
  ### Features
731
855
 
856
+ #### **๐ŸŒ 3-Way HTML Conflict Preview**
857
+
858
+ When resolving merge conflicts with `n2b-diff`, N2B now automatically generates a 3-way HTML preview of the conflict.
859
+
860
+ * **Automatic Opening**: The preview is automatically opened in your default web browser.
861
+ * **Terminal Link**: A clickable `file:///` link to the preview is also displayed in your terminal.
862
+ ```
863
+ ๐ŸŒ Opening conflict preview in browser...
864
+ ๐Ÿ“ Preview: file:///Users/user/.n2b_merge_log/conflict_preview_your_file.rb_20231027_103045.html
865
+
866
+ Actions: [y] Accept, [n] Skip, [c] Comment, [e] Edit, [s] Refresh Preview, [a] Abort
867
+ (Preview link above can be cmd/ctrl+clicked if your terminal supports it)
868
+ Your choice:
869
+ ```
870
+ * **Layout**: The preview features a three-column layout:
871
+ * **Base Branch**: Content from the base branch (e.g., HEAD).
872
+ * **Incoming Branch**: Content from the incoming branch (e.g., your feature branch).
873
+ * **Current Resolution**: The current LLM suggestion or your edited version, showing how the conflict would be resolved.
874
+ * **Full File View**: Each column displays the *entire* file content, with the specific conflicting lines highlighted within their context. This allows for a comprehensive understanding of the changes.
875
+ * **Syntax Highlighting**: Code is professionally syntax-highlighted using Highlight.js for improved readability across various programming languages.
876
+ * **Dynamic Updates**: The preview is regenerated and reopened if the LLM suggestion changes (e.g., after you add a comment or use the `[e]` edit option and a new suggestion is fetched) or if you use the `[s]` (Refresh Preview) option.
877
+ * **Temporary Files**: Preview files are stored temporarily in the `.n2b_merge_log/` directory and are automatically cleaned up after the conflict is resolved or skipped for that particular block.
878
+
732
879
  #### **๐ŸŽจ Colorized Display**
733
880
  - ๐Ÿ”ด **Red**: Base/HEAD content (`<<<<<<< HEAD`)
734
881
  - ๐ŸŸข **Green**: Incoming content (`>>>>>>> feature`)
@@ -865,9 +1012,9 @@ done
865
1012
  Add to your `.zshrc` or `.bashrc`:
866
1013
  ```bash
867
1014
  # Quick aliases for n2b tools
868
- alias resolve-conflicts='n2b-diff'
869
- alias test-jira='n2b-test-jira'
870
- alias ai-diff='n2b --diff'
1015
+ alias resolve-conflicts='n2b-diff' # For merge conflicts
1016
+ alias test-jira='n2b-test-jira' # For testing Jira connection
1017
+ alias ai-diff='n2b-diff --analyze' # For AI diff analysis
871
1018
 
872
1019
  # Function to resolve all conflict files
873
1020
  resolve-all-conflicts() {
@@ -939,31 +1086,57 @@ This project is licensed under the MIT License.
939
1086
 
940
1087
  ## Version History
941
1088
 
942
- ### ๐Ÿ”ง **v0.5.4 - AI-Powered Merge Conflict Resolver**
943
- - **NEW: n2b-diff command** - Interactive AI-powered merge conflict resolution
944
- - Colorized conflict display with Accept/Skip/Comment/Abort workflow
945
- - Smart AI suggestions with detailed reasoning and user feedback integration
946
- - Custom templates for merge prompts and configurable context lines
947
- - Merge logging and Git/Mercurial support
1089
+ ### โœจ **v2.0.0 (Planned) - Command Restructure & Enhanced Diff Analysis**
1090
+ - **Command Restructuring**: `n2b` is now for natural language to shell command translation only. `n2b-diff` handles merge conflicts and all AI-powered diff/code analysis. See [MIGRATION.md](MIGRATION.md).
1091
+ - **Enhanced `n2b-diff --analyze`**:
1092
+ - Added `--github` option for GitHub Issue integration (fetching details, updating issues).
1093
+ - Added `-m, --message, --msg` option for providing custom instructions to the AI during diff analysis.
1094
+ - Streamlined Jira integration options (`--jira`, `--update`, `--no-update`).
1095
+ - Diff analysis features (branch comparison, requirements files) now exclusively under `n2b-diff --analyze`.
1096
+ - **Documentation Overhaul**: Updated README, help texts, and added `MIGRATION.md`.
1097
+ - **Test Suite Updates**: Refactored tests for `n2b` and significantly enhanced tests for `n2b-diff`.
1098
+ - **Internal Refinements**: Created `N2B::MessageUtils` for message handling.
1099
+
1100
+ ### ๐Ÿ”ง **v0.7.2 - GitHub Integration & Enhanced AI Diff Analysis (as `n2b --diff`)** (Pre-Restructure)
1101
+ - **๐Ÿ”— GitHub Integration**: Full GitHub issue support with fetch and comment functionality
1102
+ - **๐Ÿ” Enhanced AI Diff Analysis**: Comprehensive code review with context-aware insights (Beta)
1103
+ - **โ˜ Interactive Jira Checklists**: Native checkboxes for team collaboration and progress tracking
1104
+ - **๐ŸŽฏ Full Template Engine**: Variables, loops, conditionals for maximum customization
1105
+ - **๐Ÿšจ Smart Error Classification**: Automatic severity detection (Critical/Important/Low)
1106
+ - **๐Ÿ“ Editor Integration**: Open conflicted files in your preferred editor with change detection
1107
+ - **๐Ÿ›ก๏ธ JSON Auto-Repair**: Automatically fixes malformed LLM responses
1108
+ - **โœ… VCS Auto-Resolution**: Automatically marks resolved conflicts in Git/Mercurial
1109
+ - **๐ŸŽจ Collapsible Sections**: Organized Jira comments with expand/collapse functionality
1110
+ - **๐Ÿงช Comprehensive Tests**: 103+ tests ensuring bulletproof reliability
1111
+ - **โšก Enhanced Context**: Full file content sent to AI for better merge decisions
1112
+ - **๐Ÿ”„ Robust Error Handling**: Multiple recovery options when AI responses fail
1113
+
1114
+
1115
+ ### ๐Ÿ”ง **v0.5.4 - AI-Powered Merge Conflict Resolver (Introducing `n2b-diff`)**
1116
+ - **NEW: n2b-diff command** - Interactive AI-powered merge conflict resolution.
1117
+ - Colorized conflict display with Accept/Skip/Comment/Abort workflow.
1118
+ - Smart AI suggestions with detailed reasoning and user feedback integration.
1119
+ - Custom templates for merge prompts and configurable context lines.
1120
+ - Merge logging and Git/Mercurial support.
948
1121
 
949
- ### ๐Ÿš€ **v0.5.0 - Jira Integration & Enhanced Analysis**
950
- - Full Jira API integration with real ticket fetching and comment posting
951
- - Structured Jira comments using ADF with collapsible sections
952
- - Smart requirements extraction from ticket descriptions and comments
953
- - Built-in connection testing with `n2b-test-jira` utility
954
- - Enhanced configuration validation and error handling
1122
+ ### ๐Ÿš€ **v0.5.0 - Jira Integration & Enhanced Analysis (as `n2b --diff`)**
1123
+ - Full Jira API integration with real ticket fetching and comment posting.
1124
+ - Structured Jira comments using ADF with collapsible sections.
1125
+ - Smart requirements extraction from ticket descriptions and comments.
1126
+ - Built-in connection testing with `n2b-test-jira` utility.
1127
+ - Enhanced configuration validation and error handling.
955
1128
 
956
1129
  ### ๐Ÿ”ง **v0.4.0 - Flexible Model Configuration**
957
- - Multiple LLM providers: Claude, OpenAI, Gemini, OpenRouter, Ollama
958
- - Custom model support for fine-tunes and beta releases
959
- - Latest models: OpenAI O3/O4 series, Gemini 2.5, Claude Sonnet 4.0
960
- - Backward compatible configuration system
961
-
962
- ### ๐Ÿ” **v0.3.0 - AI-Powered Diff Analysis**
963
- - Git/Mercurial diff analysis with context extraction
964
- - Requirements compliance checking
965
- - Test coverage assessment
966
- - Branch comparison with auto-detection
1130
+ - Multiple LLM providers: Claude, OpenAI, Gemini, OpenRouter, Ollama.
1131
+ - Custom model support for fine-tunes and beta releases.
1132
+ - Latest models: OpenAI O3/O4 series, Gemini 2.5, Claude Sonnet 4.0.
1133
+ - Backward compatible configuration system.
1134
+
1135
+ ### ๐Ÿ” **v0.3.0 - AI-Powered Diff Analysis (as `n2b --diff`)**
1136
+ - Git/Mercurial diff analysis with context extraction.
1137
+ - Requirements compliance checking.
1138
+ - Test coverage assessment.
1139
+ - Branch comparison with auto-detection.
967
1140
 
968
1141
  ## Support
969
1142
 
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yaml'
4
+ require_relative '../lib/n2b/github_client'
5
+
6
+ config_file = File.expand_path('~/.n2b/config.yml')
7
+ unless File.exist?(config_file)
8
+ puts "โŒ Config file not found: #{config_file}"
9
+ puts "Please run 'n2b --advanced-config' to set up GitHub integration first."
10
+ exit 1
11
+ end
12
+
13
+ config = YAML.load_file(config_file)
14
+
15
+ begin
16
+ client = N2B::GitHubClient.new(config)
17
+ rescue => e
18
+ puts "โŒ #{e.message}"
19
+ exit 1
20
+ end
21
+
22
+ client.test_connection