n2b 0.3.1 โ†’ 0.5.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: 644455363c88bf95c4ab4f21121ed6b8f56a591fb32bd1a8fa9f8f36d981e515
4
- data.tar.gz: f899199e26524f38f88e4416217616c048e588c1f54becb228261b07ffcda3d1
3
+ metadata.gz: d512a4b43acc8a3adac6fe3fd60d05605abef697b36e0beb2e896371c6ae94c0
4
+ data.tar.gz: 140274359582046b03b89521d143e7efc498c07ee85c6cd200de821191b0b0db
5
5
  SHA512:
6
- metadata.gz: 2b3cfcba02a3c41017737317df2d932e1ff053c2d470c529a3158ccba11696ccf09367369f4530de78fc7669cc26795a3dad8abe49a26da0f5a8f836758baf4d
7
- data.tar.gz: f664e6b0e9099aecc969e7d46a71b7cf7da0bf1238e9fbf203f445bed9d7073c2a643cce09a3a50fc1ce666805505c7e8d6222817a207fd3b4ec9491c8fcd4e4
6
+ metadata.gz: '0184eb2ae93e21a1a389f7445c5e1d3532f645f5164df29ba7acc77ce67e163b8a273767aadc7a3b1ccab8483ae62d7e75b691331cb9145f4075a5a3aa3777ae'
7
+ data.tar.gz: d12e12c75dc2e6b161fb9f169de0a2dd7a8760bdcdf49b915c217407937516cffca31fb5649c5b65e33b81f7c02d688c7695c9c7cf4f5c638d837756c3ce97e5
data/README.md CHANGED
@@ -1,20 +1,92 @@
1
- # N2B - Natural Language to Bash & Ruby
1
+ # N2B - AI-Powered Code Analysis & Jira Integration
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/n2b.svg)](https://badge.fury.io/rb/n2b)
4
4
 
5
- N2B (Natural Language to Bash & Ruby) is a Ruby gem that leverages AI to convert natural language instructions into bash commands and Ruby code.
5
+ **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 analysis and smart ticket integration.
6
6
 
7
- ## Features
7
+ ## ๐Ÿš€ **Key Features**
8
8
 
9
- - **๐Ÿค– Natural Language to Commands**: Convert natural language to bash commands
10
- - **๐Ÿ’Ž Ruby Code Generation**: Generate Ruby code from natural language instructions
11
- - **๐Ÿ” AI-Powered Diff Analysis**: Analyze git/hg diffs with comprehensive code review
12
- - **๐Ÿ“‹ Requirements Compliance**: Check if code changes meet specified requirements
13
- - **๐Ÿงช Test Coverage Assessment**: Evaluate test coverage for code changes
14
- - **๐ŸŒฟ Branch Comparison**: Compare changes against any branch (main/master/default)
15
- - **๐Ÿ› ๏ธ VCS Support**: Full support for both Git and Mercurial repositories
16
- - **๐Ÿ“Š Errbit Integration**: Analyze Errbit errors and generate detailed reports
17
- - **๐ŸŽซ Scrum Tickets**: Create formatted Scrum tickets from errors
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
14
+
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
20
+
21
+ ### ๐Ÿค– **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
25
+
26
+ ### ๐Ÿ’ป **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
+ - **Errbit Integration**: Analyze errors and generate actionable reports
31
+
32
+ ## ๐ŸŽฏ **Jira Integration - Get Started in 2 Minutes**
33
+
34
+ Transform your development workflow with intelligent Jira integration:
35
+
36
+ ### Quick Setup
37
+
38
+ ```bash
39
+ # Install and configure
40
+ gem install n2b
41
+ n2b --advanced-config # Set up Jira credentials
42
+
43
+ # Test your connection
44
+ n2b-test-jira
45
+
46
+ # Analyze code against ticket requirements
47
+ n2b --diff --jira PROJ-123 --jira-update
48
+ ```
49
+
50
+ ### What You Get
51
+
52
+ 1. **๐Ÿ“ฅ Smart Ticket Analysis**: Automatically fetches requirements, acceptance criteria, and comments from Jira
53
+ 2. **๐Ÿ” Intelligent Code Review**: AI analyzes your changes against ticket requirements
54
+ 3. **๐Ÿ“ค Structured Updates**: Posts beautifully formatted analysis back to Jira with collapsible sections
55
+ 4. **โœ… Requirements Compliance**: Clear status on what's implemented, partially done, or missing
56
+
57
+ ### Example Workflow
58
+
59
+ ```bash
60
+ # Working on ticket PROJ-123
61
+ git add .
62
+ n2b --diff --jira PROJ-123 --jira-update
63
+ ```
64
+
65
+ **Result**: Your Jira ticket gets updated with a professional analysis comment showing implementation progress, technical insights, and compliance status.
66
+
67
+ ## ๐Ÿ” **AI-Powered Code Analysis**
68
+
69
+ Get comprehensive code review and insights:
70
+
71
+ ```bash
72
+ # Analyze uncommitted changes
73
+ n2b --diff
74
+
75
+ # Compare against specific branch with requirements
76
+ n2b --diff --branch main --requirements requirements.md
77
+
78
+ # Full workflow with Jira integration
79
+ n2b --diff --jira PROJ-123 --requirements specs.md
80
+ ```
81
+
82
+ ## ๐Ÿ†• **What's New in v0.5.0**
83
+
84
+ - **๐ŸŽฏ Full Jira Integration**: Real API integration with ticket fetching and automated updates
85
+ - **๐Ÿ“ Structured Comments**: Beautifully formatted Jira comments with collapsible sections
86
+ - **๐Ÿ” Smart Requirements Extraction**: AI identifies requirements from tickets and comments
87
+ - **๐Ÿงช Connection Testing**: Built-in `n2b-test-jira` utility for troubleshooting
88
+ - **๐Ÿ“‹ Permission Validation**: Verifies all required Jira API permissions
89
+ - **โšก Enhanced Analysis**: Improved code review with better context and insights
18
90
 
19
91
  ## Installation
20
92
 
@@ -22,7 +94,39 @@ N2B (Natural Language to Bash & Ruby) is a Ruby gem that leverages AI to convert
22
94
  gem install n2b
23
95
  ```
24
96
 
25
- ## Usage
97
+ ## Quick Start
98
+
99
+ ### ๐ŸŽฏ **For Jira Users** (Most Popular)
100
+
101
+ ```bash
102
+ # Set up Jira integration
103
+ n2b --advanced-config
104
+
105
+ # Analyze code changes against ticket
106
+ n2b --diff --jira PROJ-123 --jira-update
107
+ ```
108
+
109
+ ### ๐Ÿ” **For Code Review**
110
+
111
+ ```bash
112
+ # AI-powered diff analysis
113
+ n2b --diff
114
+
115
+ # Compare against main branch with requirements
116
+ n2b --diff --branch main --requirements specs.md
117
+ ```
118
+
119
+ ### ๐Ÿ’ป **For Command Generation**
120
+
121
+ ```bash
122
+ # Generate bash commands
123
+ n2b "create a new git repo and push to github"
124
+
125
+ # Execute commands directly
126
+ n2b -x "backup all .rb files to backup folder"
127
+ ```
128
+
129
+ ## Detailed Usage
26
130
 
27
131
  ### In IRB/Rails Console
28
132
 
@@ -61,16 +165,74 @@ n2rscrum "Create a user authentication system"
61
165
 
62
166
  ## Configuration
63
167
 
64
- Create a config file at `~/.n2b/config.yml` with your API keys:
168
+ N2B now features a **flexible model configuration system** that supports both suggested models and custom model names across all providers.
169
+
170
+ ### Quick Setup
171
+
172
+ Run the configuration command to get started:
173
+
174
+ ```bash
175
+ n2b -c
176
+ ```
177
+
178
+ This will guide you through:
179
+ - Selecting your preferred LLM provider (Claude, OpenAI, Gemini, OpenRouter, Ollama)
180
+ - Choosing from suggested models or entering custom model names
181
+ - Setting up API keys
182
+ - Configuring privacy settings
183
+
184
+ ### Supported Models
185
+
186
+ #### ๐Ÿค– **Claude** (Default: sonnet)
187
+ - `haiku` โ†’ claude-3-haiku-20240307
188
+ - `sonnet` โ†’ claude-3-sonnet-20240229
189
+ - `sonnet35` โ†’ claude-3-5-sonnet-20240620
190
+ - `sonnet37` โ†’ claude-3-7-sonnet-20250219
191
+ - `sonnet40` โ†’ claude-sonnet-4-20250514
192
+ - **Custom models**: Any Claude model name
193
+
194
+ #### ๐Ÿง  **OpenAI** (Default: gpt-4o-mini)
195
+ - `gpt-4o` โ†’ gpt-4o
196
+ - `gpt-4o-mini` โ†’ gpt-4o-mini
197
+ - `o3` โ†’ o3 (Latest reasoning model)
198
+ - `o3-mini` โ†’ o3-mini
199
+ - `o3-mini-high` โ†’ o3-mini-high
200
+ - `o4` โ†’ o4
201
+ - `o4-mini` โ†’ o4-mini
202
+ - `o4-mini-high` โ†’ o4-mini-high
203
+ - **Custom models**: Any OpenAI model name
204
+
205
+ #### ๐Ÿ”ฎ **Gemini** (Default: gemini-2.5-flash)
206
+ - `gemini-2.5-flash` โ†’ gemini-2.5-flash-preview-05-20
207
+ - `gemini-2.5-pro` โ†’ gemini-2.5-pro-preview-05-06
208
+ - **Custom models**: Any Gemini model name
209
+
210
+ #### ๐ŸŒ **OpenRouter** (Default: deepseek-v3)
211
+ - `deepseek-v3` โ†’ deepseek-v3-0324
212
+ - `deepseek-r1-llama-8b` โ†’ deepseek-r1-distill-llama-8b
213
+ - `llama-3.3-70b` โ†’ llama-3.3-70b-instruct
214
+ - `llama-3.3-8b` โ†’ llama-3.3-8b-instruct
215
+ - `wayfinder-large` โ†’ wayfinder-large-70b-llama-3.3
216
+ - **Custom models**: Any OpenRouter model name
217
+
218
+ #### ๐Ÿฆ™ **Ollama** (Default: llama3)
219
+ - `llama3` โ†’ llama3
220
+ - `mistral` โ†’ mistral
221
+ - `codellama` โ†’ codellama
222
+ - `qwen` โ†’ qwen2.5
223
+ - **Custom models**: Any locally available Ollama model
224
+
225
+ ### Custom Configuration File
226
+
227
+ You can use a custom config file by setting the `N2B_CONFIG_FILE` environment variable:
65
228
 
66
- ```yaml
67
- llm: claude # or openai
68
- claude:
69
- key: your-anthropic-api-key
70
- model: claude-3-opus-20240229 # or opus, haiku, sonnet
71
- openai:
72
- key: your-openai-api-key
73
- model: gpt-4 # or gpt-3.5-turbo
229
+ ```bash
230
+ export N2B_CONFIG_FILE=/path/to/your/config.yml
231
+ ```
232
+
233
+ You can also set the history file location using the `N2B_HISTORY_FILE` environment variable:
234
+ ```bash
235
+ export N2B_HISTORY_FILE=/path/to/your/history
74
236
  ```
75
237
 
76
238
  ## Quick Example N2B
@@ -119,16 +281,38 @@ input_string.to_s.scan(/[\/\w.-]+\.rb(?=\s|:|$)/)
119
281
  Install the gem by running:
120
282
  gem install n2b
121
283
 
122
- ## Configuration
284
+ ## Enhanced Model Selection
123
285
 
124
- Before using n2b, you need to configure it with your Claude API key and preferences. Run:
125
- n2b -c
286
+ N2B v0.4.0 introduces a **flexible model configuration system**:
287
+
288
+ ### Interactive Model Selection
289
+
290
+ When you run `n2b -c`, you'll see an enhanced interface:
291
+
292
+ ```
293
+ Choose a model for openai:
294
+ 1. gpt-4o (gpt-4o)
295
+ 2. gpt-4o-mini (gpt-4o-mini) [default]
296
+ 3. o3 (o3)
297
+ 4. o3-mini (o3-mini)
298
+ 5. o3-mini-high (o3-mini-high)
299
+ 6. o4 (o4)
300
+ 7. o4-mini (o4-mini)
301
+ 8. o4-mini-high (o4-mini-high)
302
+ 9. custom (enter your own model name)
303
+
304
+ Enter choice (1-9) or model name [gpt-4o-mini]: 9
305
+ Enter custom model name: gpt-5-preview
306
+ โœ“ Using custom model: gpt-5-preview
307
+ ```
308
+
309
+ ### Key Features
126
310
 
127
- This will prompt you to enter:
128
- - Your Claude API or OpenAI key
129
- - Preferred model (e.g. haiku, sonnet, or sonnet35)
130
- - Privacy settings (whether to send shell history, past requests, current directory)
131
- - Whether to append generated commands to your shell history
311
+ - **๐ŸŽฏ Suggested Models**: Curated list of latest models for each provider
312
+ - **๐Ÿ”ง Custom Models**: Enter any model name for fine-tunes, beta models, etc.
313
+ - **๐Ÿ”„ Backward Compatible**: Existing configurations continue working
314
+ - **๐Ÿš€ Latest Models**: Access to newest OpenAI O-series, Gemini 2.5, etc.
315
+ - **โšก No Validation**: Direct API model names accepted - let the API handle errors
132
316
 
133
317
  Configuration is stored in `~/.n2b/config.yml`.
134
318
 
@@ -143,7 +327,11 @@ Options:
143
327
  - `-d` or `--diff`: Analyze git/hg diff with AI-powered code review
144
328
  - `-b` or `--branch [BRANCH]`: Compare against specific branch (auto-detects main/master/default)
145
329
  - `-r` or `--requirements FILE`: Requirements file for compliance checking
330
+ - `-j` or `--jira TICKET`: Jira ticket ID or URL for context and updates
331
+ - `--jira-update`: Automatically update Jira ticket with analysis (no prompt)
332
+ - `--jira-no-update`: Skip Jira ticket update (analyze only)
146
333
  - `-c` or `--config`: Reconfigure the tool
334
+ - `--advanced-config`: Advanced configuration including Jira setup
147
335
  - `-h` or `--help`: Display help information
148
336
 
149
337
  Examples:
@@ -237,6 +425,115 @@ Requirements Evaluation:
237
425
  - **Git**: Full support with auto-detection of main/master branches
238
426
  - **Mercurial (hg)**: Full support with auto-detection of default branch
239
427
 
428
+ ## ๐ŸŽฏ Jira Integration
429
+
430
+ N2B provides seamless integration with Jira for automated ticket analysis and updates.
431
+
432
+ ### Setup
433
+
434
+ Configure Jira integration using the advanced configuration:
435
+
436
+ ```bash
437
+ n2b --advanced-config
438
+ ```
439
+
440
+ You'll need:
441
+ - **Jira Domain**: Your Atlassian domain (e.g., `company.atlassian.net`)
442
+ - **Email**: Your Jira account email
443
+ - **API Token**: Generate from [Atlassian Account Settings](https://id.atlassian.com/manage-profile/security/api-tokens)
444
+
445
+ ### Required Jira Permissions
446
+
447
+ Your API token needs these permissions:
448
+ - **Browse Projects** - Access project list
449
+ - **Browse Issues** - Read ticket details
450
+ - **View Comments** - Read ticket comments
451
+ - **Add Comments** - Post analysis results
452
+
453
+ ### Usage
454
+
455
+ ```bash
456
+ # Analyze code changes against Jira ticket requirements
457
+ n2b --diff --jira PROJ-123
458
+
459
+ # Use full Jira URL
460
+ n2b --diff --jira https://company.atlassian.net/browse/PROJ-123
461
+
462
+ # Auto-update ticket without prompt
463
+ n2b --diff --jira PROJ-123 --jira-update
464
+
465
+ # Analyze only (no ticket update)
466
+ n2b --diff --jira PROJ-123 --jira-no-update
467
+ ```
468
+
469
+ ### What It Does
470
+
471
+ 1. **Fetches Ticket Details**: Downloads ticket description and comments
472
+ 2. **Extracts Requirements**: Automatically identifies requirements, acceptance criteria, and tasks
473
+ 3. **Analyzes Code Changes**: Compares your diff against ticket requirements
474
+ 4. **Updates Ticket**: Posts structured analysis comment with:
475
+ - Implementation summary (what you accomplished)
476
+ - Technical analysis findings
477
+ - Potential issues and suggestions
478
+ - Test coverage assessment
479
+ - Requirements compliance check
480
+
481
+ ### Example Jira Comment
482
+
483
+ ```
484
+ *N2B Code Analysis Report*
485
+ =========================
486
+
487
+ *Implementation Summary:*
488
+ Implemented user authentication with JWT tokens, password validation,
489
+ and session management as specified in the ticket requirements.
490
+
491
+ ---
492
+
493
+ *Automated Analysis Findings:*
494
+
495
+ *Technical Changes:*
496
+ Added authentication middleware, JWT token generation, and password
497
+ hashing with bcrypt. Updated user model with authentication methods.
498
+
499
+ *Potential Issues/Risks:*
500
+ โ€ข No rate limiting on login attempts
501
+ โ€ข Password validation could be stronger
502
+
503
+ *Suggested Improvements:*
504
+ โ€ข Add rate limiting middleware
505
+ โ€ข Implement password strength requirements
506
+ โ€ข Add two-factor authentication support
507
+
508
+ *Test Coverage Assessment:*
509
+ Good: Basic authentication flow tested. Missing: Edge cases, security
510
+ scenarios, and JWT expiration handling tests.
511
+
512
+ *Requirements Evaluation:*
513
+ โœ… IMPLEMENTED: User login/logout functionality
514
+ โœ… IMPLEMENTED: Password hashing and validation
515
+ โš ๏ธ PARTIALLY IMPLEMENTED: Session management (basic implementation)
516
+ โŒ NOT IMPLEMENTED: Two-factor authentication
517
+ ```
518
+
519
+ ### Testing Jira Connection
520
+
521
+ Test your Jira API connection and permissions:
522
+
523
+ ```bash
524
+ # Test basic connection
525
+ n2b-test-jira
526
+
527
+ # Test specific ticket access
528
+ n2b-test-jira PROJ-123
529
+ ```
530
+
531
+ This will verify:
532
+ - Network connectivity to Jira
533
+ - Authentication with your API token
534
+ - Required permissions
535
+ - Specific ticket access (if provided)
536
+
240
537
  n2r in ruby or rails console
241
538
  n2r "your question", files:['file1.rb', 'file2.rb'], exception: AnError
242
539
  only question is mandatory
@@ -296,6 +593,27 @@ Contributions are welcome! Please feel free to submit a Pull Request.
296
593
 
297
594
  This project is licensed under the MIT License.
298
595
 
596
+ ## Version History
597
+
598
+ ### ๐Ÿš€ **v0.5.0 - Jira Integration & Enhanced Analysis**
599
+ - Full Jira API integration with real ticket fetching and comment posting
600
+ - Structured Jira comments using ADF with collapsible sections
601
+ - Smart requirements extraction from ticket descriptions and comments
602
+ - Built-in connection testing with `n2b-test-jira` utility
603
+ - Enhanced configuration validation and error handling
604
+
605
+ ### ๐Ÿ”ง **v0.4.0 - Flexible Model Configuration**
606
+ - Multiple LLM providers: Claude, OpenAI, Gemini, OpenRouter, Ollama
607
+ - Custom model support for fine-tunes and beta releases
608
+ - Latest models: OpenAI O3/O4 series, Gemini 2.5, Claude Sonnet 4.0
609
+ - Backward compatible configuration system
610
+
611
+ ### ๐Ÿ” **v0.3.0 - AI-Powered Diff Analysis**
612
+ - Git/Mercurial diff analysis with context extraction
613
+ - Requirements compliance checking
614
+ - Test coverage assessment
615
+ - Branch comparison with auto-detection
616
+
299
617
  ## Support
300
618
 
301
619
  If you encounter any issues or have questions, please file an issue on the GitHub repository.
@@ -324,4 +642,4 @@ The generated tickets include:
324
642
  - Acceptance criteria
325
643
  - Story point estimate
326
644
  - Priority level
327
- - Reference to the original Errbit URL# Test change
645
+ - Reference to the original Errbit URL