tng 0.4.7 โ†’ 0.4.9

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.
data/README.md CHANGED
@@ -1,12 +1,19 @@
1
- # TNG - AI-Powered Test Generation for Rails
1
+ # TNG - AI-Powered Test Generation & Code Analysis for Rails
2
2
 
3
- TNG is an AI-powered test generation tool that automatically creates comprehensive tests for your Rails applications. It analyzes your code structure, authentication patterns, and configuration to generate high-quality, contextual tests that follow your project's conventions.
3
+ TNG is a comprehensive AI-powered tool for Rails applications that combines intelligent test generation with advanced static analysis. Analyze your code structure, detect issues, find duplicates, and generate high-quality tests that follow your project's conventions.
4
4
 
5
5
  **Owner:** Binary Dreams LLC
6
6
 
7
- ## Installation
7
+ ## Features
8
+
9
+ - **๐Ÿงช AI Test Generation** - Generate comprehensive tests for controllers, models, services, and 20+ file types
10
+ - **๐Ÿ” Code Audit** - Deep security, performance, and best-practice analysis
11
+ - **๐Ÿ”ฌ Symbolic Trace** - Visualize execution paths and logic flow with Mermaid diagrams
12
+ - **๐Ÿ“Š Clone Detection** - Find duplicate code with 3 detection levels (Token, Structural, Fuzzy)
13
+ - **๐Ÿ’€ Dead Code Detection** - Identify unreachable code, unused variables, and unused private methods
14
+ - **โšก Blazing Fast** - Powered by Rust for near-instant analysis
8
15
 
9
- ### Standard Installation
16
+ ## Installation
10
17
 
11
18
  Add this line to your application's Gemfile:
12
19
 
@@ -20,415 +27,378 @@ And then execute:
20
27
  bundle install
21
28
  ```
22
29
 
23
- ## Configuration
30
+ ## Quick Start
31
+
32
+ ### 1. Initialize Configuration
24
33
 
25
- TNG requires proper configuration to generate high-quality tests. Generate the configuration file by running:
34
+ Generate the configuration file:
26
35
 
27
36
  ```bash
28
37
  rails generate tng:install
29
38
  ```
30
39
 
31
- This creates `config/initializers/tng.rb` with a configuration template that you'll need to customize for your application. The generator will attempt to detect your existing setup and pre-configure common settings.
32
-
33
- ### Configuration Options Explained
34
-
35
- #### API Configuration
36
- - **`api_key`**: Your TNG API key from https://app.tng.sh/
37
- - **`base_url`**: TNG service endpoint (automatically configured, do not modify)
38
-
39
- #### Code Reading
40
- - **`read_source_code`**: Analyzes the specific code file for which tests are being generated
41
- - **`read_test_code`**: Reads existing tests for the specific file to match your testing patterns
42
-
43
- #### Testing Framework Settings
44
- - **`testing_framework`**: Automatically detected. Possible values: `minitest` or `rspec`
45
-
46
- *Note: The following settings depend on your testing framework.*
47
-
48
- **For Minitest:**
49
- - **`test_style`**: Test organization style. Possible options:
50
- - `test_block` - `test "does something" do ... end`
51
- - `spec` - `it "does something" do ... end`
52
- - `unit` - `def test_does_something ... end`
53
- - **`assertion_style`**: Assertion syntax preference. Possible values:
54
- - `assert/refute` - Uses syntax like `assert`, `assert_equal`, `assert_nil`, `refute`, `refute_nil`
55
- - `assert/assert_not` - Uses syntax like `assert`, `assert_equal`, `assert_nil`, `assert_not`, `assert_not_equl`, `assert_not_nil`
56
- - `must/wont` - `value.must_equal`, `value.must_be_instance_of`, `value.must_raise`, `value.wont_equal`, `value.wont_be_instance_of`, `value.wont_raise`
57
-
58
- **For RSpec:**
59
- - **`describe_style`**: Include describe blocks. Possible values: `true`, `false`
60
- - **`context_style`**: Context block style. Possible values: `context`, `describe`
61
- - **`it_style`**: Example block style. Possible values: `it`, `specify`
62
- - **`before_style`**: Setup block style. Possible values: `before`, `setup`
63
- - **`after_style`**: Teardown block style. Possible values: `after`, `teardown`
64
- - **`let_style`**: Use let helpers. Possible values: `true`, `false`
65
- - **`subject_style`**: Use subject helpers. Possible values: `true`, `false`
66
-
67
- #### Authentication Methods
68
- Supported authentication types:
69
- - **`session`**: Session-based authentication
70
- - **`devise`**: Devise gem integration
71
- - **`jwt`**: JSON Web Token authentication
72
- - **`token_auth`**: Token-based authentication
73
- - **`basic_auth`**: HTTP Basic Authentication
74
- - **`oauth`**: OAuth authentication
75
- - **`headers`**: Custom header authentication
76
- - **`custom`**: Custom authentication logic
77
-
78
- #### Mock and Factory Libraries
79
- - **`mock_library`**: Mock library preference
80
- - **For Minitest**: `minitest/mock`, `mocha`, `nil`
81
- - **For RSpec**: `rspec-mocks`, `mocha`, `flexmock`, `nil`
82
- - **`http_mock_library`**: HTTP mocking library. Possible values: `webmock`, `vcr`, `httparty`, `nil`
83
- - **`factory_library`**: Factory library preference. Possible values: `factory_bot`, `factory_girl`, `fabrication`, `fabricator`, `fixtures`, `active_record`
84
-
85
- ## Configuration Examples
86
-
87
- ### Minitest with FactoryBot Setup
40
+ This creates `config/initializers/tng.rb`:
88
41
 
89
42
  ```ruby
90
- # config/initializers/tng.rb
91
43
  Tng.configure do |config|
44
+ # Get your API key from https://app.tng.sh/
92
45
  config.api_key = ENV["TNG_API_KEY"]
93
- config.base_url = "https://app.tng.sh/"
94
-
95
- config.read_source_code = true
96
- config.read_test_code = true
97
-
98
- config.testing_framework = "minitest"
99
- config.test_style = "test_block"
100
- config.assertion_style = "assert/refute"
101
- config.setup_style = true
102
- config.teardown_style = false
103
-
104
- config.mock_library = "minitest/mock"
105
- config.http_mock_library = "webmock"
106
- config.factory_library = "factory_bot"
107
-
108
- config.authentication_enabled = true
109
- config.authentication_methods = [
110
- {
111
- method: "authenticate_user!",
112
- file_location: "app/controllers/application_controller.rb",
113
- auth_type: "session"
114
- }
115
- ]
46
+
47
+ # API endpoint (do not modify unless instructed)
48
+ config.base_url = ENV["API_BASE_URI"] || "https://app.tng.sh/"
116
49
  end
117
50
  ```
118
51
 
119
- ### RSpec with FactoryBot Setup
52
+ ### 2. Set Your API Key
120
53
 
121
- ```ruby
122
- # config/initializers/tng.rb
123
- Tng.configure do |config|
124
- config.api_key = ENV["TNG_API_KEY"]
125
- config.base_url = "https://app.tng.sh/"
126
-
127
- config.testing_framework = "rspec"
128
- config.assertion_style = "expect"
129
- config.describe_style = true
130
- config.context_style = "context"
131
- config.it_style = "it"
132
- config.before_style = "before"
133
- config.after_style = "after"
134
- config.let_style = true
135
- config.subject_style = true
136
-
137
- config.mock_library = "rspec-mocks"
138
- config.http_mock_library = "webmock"
139
- config.factory_library = "factory_bot"
140
-
141
- config.authentication_enabled = true
142
- config.authentication_methods = [
143
- {
144
- method: "authenticate_user!",
145
- file_location: "app/controllers/application_controller.rb",
146
- auth_type: "devise"
147
- }
148
- ]
149
- end
54
+ Add to your `.env` file or export:
55
+
56
+ ```bash
57
+ export TNG_API_KEY=your_api_key_here
150
58
  ```
151
59
 
152
- ### API-Only Application with Token Authentication
60
+ Get your API key from [https://app.tng.sh/](https://app.tng.sh/)
153
61
 
154
- ```ruby
155
- # config/initializers/tng.rb
156
- Tng.configure do |config|
157
- config.api_key = ENV["TNG_API_KEY"]
158
- config.base_url = "https://app.tng.sh/"
159
-
160
- config.read_source_code = true
161
- config.read_test_code = true
162
-
163
- config.testing_framework = "minitest"
164
- config.test_style = "test_block"
165
- config.assertion_style = "assert/refute"
166
-
167
- config.mock_library = "minitest/mock"
168
- config.http_mock_library = "webmock"
169
- config.factory_library = "fixtures"
170
-
171
- config.authentication_enabled = true
172
- config.authentication_methods = [
173
- {
174
- method: "authenticate_via_token!",
175
- file_location: "app/controllers/application_controller.rb",
176
- auth_type: "headers"
177
- }
178
- ]
179
- end
180
- ```
62
+ ### 3. Start Using TNG
181
63
 
182
- ### Multiple Authentication Methods
64
+ ```bash
65
+ # Interactive mode (recommended)
66
+ bundle exec tng
183
67
 
184
- ```ruby
185
- # config/initializers/tng.rb
186
- Tng.configure do |config|
187
- config.api_key = ENV["TNG_API_KEY"]
188
- config.base_url = "https://app.tng.sh/"
189
- config.testing_framework = "rspec"
190
- config.assertion_style = "expect"
191
- config.let_style = true
192
-
193
- config.mock_library = "rspec-mocks"
194
- config.http_mock_library = "webmock"
195
- config.factory_library = "factory_bot"
196
-
197
- config.authentication_enabled = true
198
- config.authentication_methods = [
199
- {
200
- method: "authenticate_user!",
201
- file_location: "app/controllers/application_controller.rb",
202
- auth_type: "session"
203
- },
204
- {
205
- method: "authenticate_api_user!",
206
- file_location: "app/controllers/api/base_controller.rb",
207
- auth_type: "token_auth"
208
- }
209
- ]
210
-
211
- config.authorization_library = "pundit"
212
- end
68
+ # Or use direct commands
69
+ bundle exec tng --file app/models/user.rb --clones
213
70
  ```
214
71
 
215
- ## Advanced Configuration
72
+ ## Usage
216
73
 
217
- ### Custom Authentication Setup
74
+ ### Interactive Mode (TUI)
218
75
 
219
- For applications with custom authentication logic that doesn't fit standard patterns:
76
+ The most powerful way to use TNG:
220
77
 
221
- ```ruby
222
- config.authentication_methods = [
223
- {
224
- method: "verify_custom_auth!",
225
- file_location: "app/controllers/concerns/custom_auth.rb",
226
- auth_type: "custom"
227
- }
228
- ]
78
+ ```bash
79
+ bundle exec tng
229
80
  ```
230
81
 
231
- #### Rails API Application
82
+ **Interactive Features:**
83
+ - ๐Ÿ“ **Browse** your application structure
84
+ - ๐Ÿงช **Generate Tests** for specific methods
85
+ - ๐Ÿ” **Audit** methods for issues and improvements
86
+ - ๐Ÿ”ฌ **Trace** symbolic execution paths
87
+ - ๐Ÿ“Š **Check Duplicates** across your codebase
88
+ - ๐Ÿ’€ **Find Dead Code** in files
89
+ - ๐Ÿ“ˆ **View Stats** and usage metrics
232
90
 
233
- ```ruby
234
- config.authentication_enabled = true
235
- config.authentication_methods = [
236
- {
237
- method: "authenticate_with_token",
238
- file_location: "app/controllers/application_controller.rb",
239
- auth_type: "jwt"
240
- }
241
- ]
242
- config.factory_library = "fixtures" # Often simpler for API apps
243
- ```
91
+ ### Command Line Interface
244
92
 
245
- #### Multi-Tenant Application
93
+ #### Test Generation
246
94
 
247
- ```ruby
248
- config.authentication_methods = [
249
- {
250
- method: "authenticate_tenant!",
251
- file_location: "app/controllers/application_controller.rb",
252
- auth_type: "custom"
253
- },
254
- {
255
- method: "authenticate_user!",
256
- file_location: "app/controllers/application_controller.rb",
257
- auth_type: "devise"
258
- }
259
- ]
95
+ ```bash
96
+ # Generate test for a specific method
97
+ bundle exec tng --file app/controllers/users_controller.rb --method index
98
+
99
+ # Short form
100
+ bundle exec tng -f users_controller.rb -m show
101
+
102
+ # Works from subdirectories (auto-detection)
103
+ bundle exec tng users_controller.rb index
260
104
  ```
261
105
 
262
- #### Legacy Application with Mixed Authentication
106
+ **Supported File Types:**
107
+ Controllers, Models, Services, Jobs, Helpers, Lib, Policies, Presenters, Mailers, Serializers, Decorators, Forms, Queries, Channels, GraphQL (Resolvers, Types, Mutations, Loaders, Schemas), and more.
263
108
 
264
- ```ruby
265
- config.authentication_methods = [
266
- {
267
- method: "authenticate_admin!",
268
- file_location: "app/controllers/admin/base_controller.rb",
269
- auth_type: "basic_auth"
270
- },
271
- {
272
- method: "authenticate_user!",
273
- file_location: "app/controllers/application_controller.rb",
274
- auth_type: "session"
275
- },
276
- {
277
- method: "authenticate_api_key!",
278
- file_location: "app/controllers/api/v1/base_controller.rb",
279
- auth_type: "headers"
280
- }
281
- ]
109
+ #### Code Audit
110
+
111
+ Analyze code for security, performance, and best practices:
112
+
113
+ ```bash
114
+ # Audit a specific method
115
+ bundle exec tng --file app/services/payment_service.rb --method process_payment --audit
116
+
117
+ # Interactive audit mode
118
+ bundle exec tng -f payment_service.rb -m process_payment -a
282
119
  ```
283
120
 
284
- ## Usage Patterns
121
+ **Audit Checks:**
122
+ - Security vulnerabilities
123
+ - Performance bottlenecks
124
+ - Code smells
125
+ - Best practice violations
126
+ - Rails-specific patterns
285
127
 
286
- ### Interactive Mode
128
+ #### Symbolic Trace
287
129
 
288
- The recommended way to use TNG for beginners and exploratory testing:
130
+ Visualize execution paths and generate Mermaid diagrams:
289
131
 
290
132
  ```bash
291
- bundle exec tng
133
+ # Trace a method's execution flow
134
+ bundle exec tng --file app/models/order.rb --method calculate_total --trace
135
+
136
+ # Short form
137
+ bundle exec tng -f order.rb -m calculate_total -t
292
138
  ```
293
139
 
294
- This launches an interactive session where you can:
295
- - Browse your application structure
296
- - Select files to generate tests for
297
- - Preview generated tests before saving
298
- - Adjust configuration on the fly
140
+ **Trace Features:**
141
+ - Control flow visualization
142
+ - Conditional path analysis
143
+ - Loop detection
144
+ - Method call chains
145
+ - Mermaid diagram generation
146
+
147
+ #### Clone Detection
299
148
 
300
- ### Method-Specific Testing
149
+ Find duplicate code with 3 levels of detection:
301
150
 
302
- TNG focuses on precise, method-level test generation:
151
+ ```bash
152
+ # Check for all types of clones
153
+ bundle exec tng --file app/services/pricing_service.rb --clones
303
154
 
304
- - **Select specific methods** from 20+ file types including controllers, models, services, jobs, helpers, lib, policies, presenters, mailers, GraphQL components, and more
305
- - **Interactive browsing** with search and filter capabilities
306
- - **Focused test generation** for individual methods only
307
- - **No bulk generation** - intentionally designed for precision
155
+ # Specific detection level
156
+ bundle exec tng --file app/services/pricing_service.rb --clones --level=1
157
+ bundle exec tng --file app/services/pricing_service.rb --clones --level=2
158
+ bundle exec tng --file app/services/pricing_service.rb --clones --level=3
308
159
 
309
- Use `bundle exec tng --help` for more options.
160
+ # Short form
161
+ bundle exec tng -f pricing_service.rb -c
162
+ ```
310
163
 
311
- ### Direct Mode (for Developers)
164
+ **Detection Levels:**
165
+ - **Level 1 (Token)** - Exact or near-exact duplicates (copy-paste detection)
166
+ - **Level 2 (Structural)** - Same AST structure with different names
167
+ - **Level 3 (Fuzzy)** - Similar logic with variations (up to 20% difference)
312
168
 
313
- For experienced developers who want quick, command-line test generation:
169
+ #### Dead Code Detection
170
+
171
+ Identify unreachable code and unused elements:
314
172
 
315
173
  ```bash
316
- # Generate test for specific method using file path
317
- bundle exec tng app/controllers/users_controller.rb index
174
+ # Detect dead code in a file
175
+ bundle exec tng --file app/models/user.rb --deadcode
318
176
 
319
- # Short form using shortcuts
320
- bundle exec tng f=users_controller.rb m=show
177
+ # Short form
178
+ bundle exec tng -f user.rb -d
321
179
 
322
- # Full parameter names
323
- bundle exec tng --file=app/models/user.rb --method=validate
180
+ # JSON output for CI/CD
181
+ bundle exec tng -f user.rb --deadcode --json
182
+ ```
324
183
 
325
- # Works from subdirectories (auto-detection)
326
- bundle exec tng users_controller.rb index
184
+ **Dead Code Types:**
185
+ - **Unreachable Code** - Code after `return`, `raise`, `exit`, etc.
186
+ - **Unused Variables** - Local variables assigned but never used
187
+ - **Unused Private Methods** - Private methods never called
188
+ - **Unused Parameters** - Method parameters never referenced
189
+
190
+ ### JSON Output Mode
191
+
192
+ Get machine-readable output for CI/CD integration:
327
193
 
328
- # Mixed parameter order
329
- bundle exec tng m=index f=app/controllers/users_controller.rb
194
+ ```bash
195
+ # Any command with --json flag
196
+ bundle exec tng --file app/models/user.rb --clones --json
197
+ bundle exec tng --file app/services/payment.rb --deadcode --json
198
+ bundle exec tng --file app/controllers/api_controller.rb --trace --json
330
199
  ```
331
200
 
332
- **Direct Mode Features:**
333
- - **Automatic file type detection** - No need to specify `-t controller/model/service`
334
- - **Flexible file path resolution** - Works with full paths or just filenames
335
- - **Multiple syntax formats** - Use `f=` shortcuts or `--file=` full parameters
336
- - **Smart path finding** - Automatically searches Rails directories
201
+ ## Advanced Features
202
+
203
+ ### Method-Specific Analysis
204
+
205
+ TNG focuses on precise, method-level analysis:
206
+
207
+ - **Select specific methods** from any file type
208
+ - **Interactive browsing** with search and filter
209
+ - **Focused generation** for individual methods
210
+ - **No bulk generation** - designed for precision
211
+
212
+ ### File Type Auto-Detection
213
+
214
+ No need to specify file types - TNG automatically detects:
215
+
216
+ ```bash
217
+ # All of these work automatically
218
+ bundle exec tng users_controller.rb index
219
+ bundle exec tng user.rb validate_email
220
+ bundle exec tng payment_service.rb process
221
+ bundle exec tng user_mailer.rb welcome_email
222
+ bundle exec tng user_resolver.rb find_user
223
+ ```
337
224
 
338
225
  ### Debug Mode
339
226
 
340
- For troubleshooting configuration or generation issues:
227
+ Enable detailed logging for troubleshooting:
341
228
 
342
229
  ```bash
343
- # Interactive mode with debug on
344
230
  DEBUG=1 bundle exec tng
231
+ DEBUG=1 bundle exec tng -f users_controller.rb -m index
232
+ ```
233
+
234
+ ## Examples
235
+
236
+ ### Example 1: Find Duplicate Code
237
+
238
+ ```bash
239
+ $ bundle exec tng --file app/services/pricing_service.rb --clones
240
+
241
+ ๐Ÿ” Clone Detection Results
345
242
 
346
- # Direct mode with debug
347
- DEBUG=1 bundle exec tng app/controllers/users_controller.rb index
243
+ Level 1 (Token): 2 matches found
244
+ โ”œโ”€ Lines 45-52 โ†” Lines 78-85 (8 lines, exact match)
245
+ โ””โ”€ Lines 120-127 โ†” Lines 156-163 (8 lines, exact match)
246
+
247
+ Level 2 (Structural): 1 match found
248
+ โ””โ”€ Lines 200-215 โ†” Lines 240-255 (16 nodes, complexity: 85)
249
+
250
+ Level 3 (Fuzzy): 1 match found
251
+ โ””โ”€ Lines 300-320 โ†” Lines 350-370 (similar logic, 15% variation)
348
252
  ```
349
253
 
350
- ### Help and Options
254
+ ### Example 2: Detect Dead Code
351
255
 
352
256
  ```bash
353
- bundle exec tng --help # Show help message
354
- bundle exec tng -h # Short help
257
+ $ bundle exec tng --file app/models/user.rb --deadcode
258
+
259
+ ๐Ÿ’€ Dead Code Detection Results
260
+
261
+ [Unreachable Code] Line 42: Code follows terminal statement
262
+ 42: puts "This will never execute"
263
+
264
+ [Unused Variable] Line 67: Variable 'temp' is assigned but never used
265
+ 67: temp = calculate_something
266
+
267
+ [Unused Method] Line 120: Private method 'unused_helper' is never used
268
+ 120: def unused_helper
269
+
270
+ [Unused Parameter] Line 85: Parameter 'options' is never used
271
+ 85: def process(data, options)
355
272
  ```
356
273
 
357
- ## Troubleshooting
274
+ ### Example 3: Trace Execution Flow
358
275
 
359
- ### Configuration Issues
276
+ ```bash
277
+ $ bundle exec tng --file app/models/order.rb --method calculate_total --trace
278
+
279
+ ๐Ÿ”ฌ Symbolic Trace Results
280
+
281
+ Execution Paths: 3
282
+ Complexity Score: 12
283
+
284
+ Path 1: items.empty? โ†’ return 0
285
+ Path 2: discount_code.present? โ†’ apply_discount โ†’ calculate_tax โ†’ total
286
+ Path 3: !discount_code.present? โ†’ calculate_tax โ†’ total
360
287
 
361
- #### API Key Problems
288
+ [Mermaid diagram saved to: trace_order_calculate_total.md]
289
+ ```
290
+
291
+ ## CLI Reference
292
+
293
+ ### Flags
294
+
295
+ | Flag | Short | Description |
296
+ |------|-------|-------------|
297
+ | `--file` | `-f` | Target file path |
298
+ | `--method` | `-m` | Method name to analyze |
299
+ | `--audit` | `-a` | Run audit mode |
300
+ | `--trace` | `-t` | Run symbolic trace mode |
301
+ | `--clones` | `-c` | Run clone detection |
302
+ | `--deadcode` | `-d` | Run dead code detection |
303
+ | `--level` | `-l` | Clone detection level (1, 2, 3, or all) |
304
+ | `--json` | | Output as JSON |
305
+ | `--help` | `-h` | Show help message |
306
+
307
+ ### Examples
308
+
309
+ ```bash
310
+ # Test generation
311
+ bundle exec tng -f users_controller.rb -m index
312
+
313
+ # Code audit
314
+ bundle exec tng -f payment_service.rb -m process -a
315
+
316
+ # Symbolic trace
317
+ bundle exec tng -f order.rb -m calculate_total -t
318
+
319
+ # Clone detection (all levels)
320
+ bundle exec tng -f pricing_service.rb -c
321
+
322
+ # Clone detection (specific level)
323
+ bundle exec tng -f pricing_service.rb -c -l 2
324
+
325
+ # Dead code detection
326
+ bundle exec tng -f user.rb -d
327
+
328
+ # JSON output
329
+ bundle exec tng -f user.rb -c --json
330
+ ```
331
+
332
+ ## Troubleshooting
333
+
334
+ ### API Key Issues
362
335
 
363
336
  **Error: "Invalid API key"**
364
337
  - Verify your API key from https://app.tng.sh/
365
- - Check environment variable: `echo $TNG_API_KEY`
366
- - Ensure no extra spaces in `.env` file: `TNG_API_KEY=your_key_here`
338
+ - Check: `echo $TNG_API_KEY`
339
+ - Ensure no extra spaces in `.env`: `TNG_API_KEY=your_key_here`
367
340
 
368
341
  **Error: "API key not found"**
369
342
  - Set environment variable: `export TNG_API_KEY=your_key`
370
343
  - Or add to `.env` file: `TNG_API_KEY=your_key`
371
- - Restart Rails server after changing environment variables
344
+ - Restart Rails server after changes
372
345
 
373
- #### Configuration Validation
346
+ ### Configuration Issues
374
347
 
375
348
  **Error: "Invalid configuration"**
376
- - Run configuration check: `rails console` then `Tng.configuration`
377
- - Verify all required settings are present
349
+ - Run: `rails console` then `Tng.configuration`
350
+ - Verify `config/initializers/tng.rb` exists
378
351
  - Check for typos in configuration file
379
352
 
380
- **Poor Test Quality**
381
- - Verify authentication methods are correctly configured
382
- - Check factory library setting matches your setup
383
- - Ensure `read_source_code` and `read_test_code` are enabled
384
- - Review testing framework settings match your project
385
-
386
- #### Authentication Configuration Issues
387
-
388
- **Tests don't include authentication**
389
- - Verify `authentication_enabled = true`
390
- - Check authentication methods are correctly specified
391
- - Ensure file paths exist: `ls app/controllers/application_controller.rb`
392
- - Verify method names exist in specified files
393
-
394
- **Authentication tests fail**
395
- - Check auth method names match your application
396
- - Verify file locations are correct
397
- - Ensure auth_type matches your authentication pattern
398
-
399
353
  ### Generation Issues
400
354
 
401
- #### No Tests Generated
402
-
403
- **Check these common issues:**
404
- 1. File path is correct: `ls app/controllers/users_controller.rb`
405
- 2. File contains valid Ruby code
406
- 3. Configuration is valid
407
- 4. API key is working
408
- 5. Internet connection is available
355
+ **No tests generated:**
356
+ 1. Verify file path: `ls app/controllers/users_controller.rb`
357
+ 2. Check file contains valid Ruby code
358
+ 3. Verify API key is working
359
+ 4. Check internet connection
409
360
 
410
- #### Generated Tests Are Generic
411
-
412
- **Common causes:**
413
- - Authentication not properly configured
414
- - Factory library setting doesn't match your setup
415
- - `read_source_code` or `read_test_code` disabled
416
- - File analysis failed (check DEBUG mode)
361
+ **Poor test quality:**
362
+ - Ensure you're using the latest version
363
+ - Try audit mode for better insights
364
+ - Check file is properly formatted
417
365
 
418
366
  ### Debug Mode
419
367
 
420
- Enable debug mode to get detailed information:
368
+ Enable debug output for detailed information:
421
369
 
422
370
  ```bash
423
- DEBUG=1 bundle exec tng app/controllers/your_controller.rb method_name
371
+ DEBUG=1 bundle exec tng -f users_controller.rb -m index
424
372
  ```
425
373
 
426
374
  Debug output includes:
427
- - API request/response information
428
-
429
- ### Getting Help
430
-
431
- If you're still experiencing issues: Contact the gem maintainers or open a GitHub issue for support
375
+ - API request/response details
376
+ - File analysis results
377
+ - Configuration validation
378
+ - Error stack traces
379
+
380
+ ## What's New in v0.4.8
381
+
382
+ ### New Features
383
+ - โœจ **Level 3 Fuzzy Clone Detection** - Find similar code with variations
384
+ - โœจ **Dead Code Detection** - Identify unreachable code and unused elements
385
+ - โœจ **Simplified Configuration** - Only API key required to get started
386
+ - โœจ **Enhanced Clone Detection** - 3 levels of duplicate detection
387
+ - โœจ **Improved UI** - Better visualization of results
388
+
389
+ ### Improvements
390
+ - โšก Faster file analysis with optimized Rust parsers
391
+ - ๐ŸŽจ Better error messages and user feedback
392
+ - ๐Ÿ“Š Enhanced reporting for all analysis modes
393
+ - ๐Ÿ”ง Auto-detection of file types and test frameworks
394
+
395
+ ## Getting Help
396
+
397
+ If you're experiencing issues:
398
+ - Check the troubleshooting section above
399
+ - Enable debug mode: `DEBUG=1 bundle exec tng`
400
+ - Contact support at https://app.tng.sh/
401
+ - Open a GitHub issue for bug reports
432
402
 
433
403
  ## License
434
404