crackerjack 0.27.9__py3-none-any.whl → 0.29.0__py3-none-any.whl
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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- crackerjack/.pre-commit-config-ai.yaml +1 -5
- crackerjack/__main__.py +48 -0
- crackerjack/crackerjack.py +1326 -45
- crackerjack/interactive.py +7 -16
- crackerjack/pyproject.toml +3 -1
- {crackerjack-0.27.9.dist-info → crackerjack-0.29.0.dist-info}/METADATA +636 -52
- {crackerjack-0.27.9.dist-info → crackerjack-0.29.0.dist-info}/RECORD +9 -9
- {crackerjack-0.27.9.dist-info → crackerjack-0.29.0.dist-info}/WHEEL +0 -0
- {crackerjack-0.27.9.dist-info → crackerjack-0.29.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crackerjack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.29.0
|
|
4
4
|
Summary: Crackerjack: code quality toolkit
|
|
5
5
|
Project-URL: documentation, https://github.com/lesleslie/crackerjack
|
|
6
6
|
Project-URL: homepage, https://github.com/lesleslie/crackerjack
|
|
@@ -153,6 +153,7 @@ Crackerjack is built on the following core principles:
|
|
|
153
153
|
|
|
154
154
|
### Git Integration
|
|
155
155
|
|
|
156
|
+
- **Intelligent Commit Messages:** Analyzes git changes and suggests descriptive commit messages based on file types and modifications
|
|
156
157
|
- **Commit and Push:** Commits and pushes your changes with standardized commit messages
|
|
157
158
|
- **Pull Request Creation:** Creates pull requests to upstream repositories on GitHub or GitLab
|
|
158
159
|
- **Pre-commit Integration:** Ensures code quality before commits
|
|
@@ -164,25 +165,106 @@ Crackerjack is built on the following core principles:
|
|
|
164
165
|
- **Structured Error Handling:** Clear error messages with error codes, detailed explanations, and recovery suggestions
|
|
165
166
|
- **Programmatic API:** Can be integrated into your own Python scripts and workflows
|
|
166
167
|
- **AI Agent Integration:** Structured output format for integration with AI assistants, with complete style rules available in [RULES.md](RULES.md) for AI tool customization
|
|
168
|
+
- **Celebratory Success Messages:** Trophy emoji (🏆) celebrates achieving crackerjack quality when all checks pass
|
|
167
169
|
- **Verbose Mode:** Detailed output for debugging and understanding what's happening
|
|
168
170
|
- **Python 3.13+ Features:** Leverages the latest Python language features including PEP 695 type parameter syntax, Self type annotations, and structural pattern matching
|
|
169
171
|
|
|
170
|
-
## Pre-commit Hooks
|
|
172
|
+
## Pre-commit Hooks & Performance Optimization
|
|
171
173
|
|
|
172
|
-
Crackerjack
|
|
174
|
+
Crackerjack provides dual-mode pre-commit hook configuration optimized for different development scenarios:
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
### ⚡ Fast Development Mode (Default)
|
|
177
|
+
|
|
178
|
+
**Target Execution Time: \<5 seconds**
|
|
179
|
+
|
|
180
|
+
Uses `.pre-commit-config-fast.yaml` for regular development work:
|
|
181
|
+
|
|
182
|
+
- **Structure Validation**: Basic file structure checks
|
|
183
|
+
- **UV Lock Updates**: Keeps dependency lock files current
|
|
184
|
+
- **Security Checks**: Essential security scanning with detect-secrets
|
|
185
|
+
- **Quick Formatting**: Fast formatting with codespell and ruff
|
|
186
|
+
- **Markdown Formatting**: mdformat with ruff integration
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Default fast mode (automatically selected)
|
|
190
|
+
python -m crackerjack
|
|
191
|
+
|
|
192
|
+
# Explicitly use fast mode
|
|
193
|
+
python -m crackerjack --fast # Uses fast pre-commit configuration
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 🔍 Comprehensive Analysis Mode
|
|
197
|
+
|
|
198
|
+
**Target Execution Time: \<30 seconds**
|
|
199
|
+
|
|
200
|
+
Uses `.pre-commit-config.yaml` for thorough analysis before releases or important commits:
|
|
201
|
+
|
|
202
|
+
- **All Fast Mode Checks**: Includes everything from fast mode
|
|
203
|
+
- **Type Checking**: Complete static analysis with Pyright
|
|
204
|
+
- **Code Modernization**: Advanced suggestions with Refurb
|
|
205
|
+
- **Security Scanning**: Comprehensive vulnerability detection with Bandit
|
|
206
|
+
- **Dead Code Detection**: Unused code identification with Vulture
|
|
207
|
+
- **Dependency Analysis**: Unused dependency detection with Creosote
|
|
208
|
+
- **Complexity Analysis**: Code complexity checking with Complexipy
|
|
209
|
+
- **Auto Type Hints**: Automatic type annotation with Autotyping
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Run comprehensive analysis
|
|
213
|
+
python -m crackerjack --comprehensive
|
|
214
|
+
|
|
215
|
+
# Use comprehensive mode for releases
|
|
216
|
+
python -m crackerjack --comprehensive -a patch
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 📦 Pre-push Hooks (CI/CD Integration)
|
|
220
|
+
|
|
221
|
+
For expensive operations that should run before pushing to remote repositories:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Install pre-push hooks for comprehensive checks
|
|
225
|
+
pre-commit install --hook-type pre-push
|
|
226
|
+
|
|
227
|
+
# Manual pre-push validation
|
|
228
|
+
python -m crackerjack --comprehensive --test
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Performance Comparison
|
|
232
|
+
|
|
233
|
+
| Mode | Execution Time | Use Case | Hooks Count |
|
|
234
|
+
|------|---------------|----------|-------------|
|
|
235
|
+
| **Fast** | \<5s | Regular development | 8 essential hooks |
|
|
236
|
+
| **Comprehensive** | \<30s | Pre-release, important commits | 15+ thorough hooks |
|
|
237
|
+
| **Pre-push** | Variable | CI/CD, remote push | All hooks + extended analysis |
|
|
238
|
+
|
|
239
|
+
### Hook Categories
|
|
240
|
+
|
|
241
|
+
**Fast Mode Hooks:**
|
|
242
|
+
|
|
243
|
+
1. **uv-lock:** Ensures the `uv.lock` file is up to date
|
|
244
|
+
1. **Core pre-commit-hooks:** Essential hooks (trailing-whitespace, end-of-file-fixer)
|
|
245
|
+
1. **Ruff:** Fast linting and formatting
|
|
246
|
+
1. **Detect-secrets:** Security credential detection
|
|
247
|
+
1. **Codespell:** Spelling mistake correction
|
|
248
|
+
1. **mdformat:** Markdown formatting
|
|
249
|
+
|
|
250
|
+
**Additional Comprehensive Mode Hooks:**
|
|
251
|
+
7\. **Vulture:** Dead code detection
|
|
252
|
+
8\. **Creosote:** Unused dependency detection
|
|
253
|
+
9\. **Complexipy:** Code complexity analysis
|
|
254
|
+
10\. **Autotyping:** Automatic type hint generation
|
|
255
|
+
11\. **Refurb:** Code modernization suggestions
|
|
256
|
+
12\. **Bandit:** Security vulnerability scanning
|
|
257
|
+
13\. **Pyright:** Static type checking
|
|
258
|
+
14\. **Extended Ruff:** Additional formatting passes
|
|
259
|
+
|
|
260
|
+
### Smart Hook Selection
|
|
261
|
+
|
|
262
|
+
Crackerjack automatically selects the appropriate hook configuration based on:
|
|
263
|
+
|
|
264
|
+
- **Operation Type**: Fast for regular development, comprehensive for releases
|
|
265
|
+
- **User Preference**: Explicit `--fast` or `--comprehensive` flags
|
|
266
|
+
- **CI/CD Context**: Pre-push hooks for remote operations
|
|
267
|
+
- **Project Size**: Larger projects may benefit from fast mode during development
|
|
186
268
|
|
|
187
269
|
## The Crackerjack Style Guide
|
|
188
270
|
|
|
@@ -240,36 +322,105 @@ python -m crackerjack -t --test-timeout=300
|
|
|
240
322
|
python -m crackerjack -t --test-workers=2 --test-timeout=600
|
|
241
323
|
```
|
|
242
324
|
|
|
243
|
-
### Benchmark Testing
|
|
325
|
+
### Benchmark Testing & Performance Monitoring
|
|
244
326
|
|
|
245
|
-
Crackerjack includes benchmark testing capabilities:
|
|
327
|
+
Crackerjack includes comprehensive benchmark testing capabilities designed for continuous performance monitoring and regression detection:
|
|
246
328
|
|
|
247
|
-
|
|
248
|
-
- **Regression Testing:** Use `--benchmark-regression` to detect performance regressions
|
|
249
|
-
- **Configurable Thresholds:** Set custom regression thresholds with `--benchmark-regression-threshold`
|
|
250
|
-
- **Compatibility Management:** Automatically disables parallel execution when running benchmarks
|
|
251
|
-
- **CI Integration:** Track performance across commits with benchmark history
|
|
329
|
+
#### 📊 Core Benchmark Features
|
|
252
330
|
|
|
253
|
-
|
|
331
|
+
- **Performance Measurement:** Accurately measure execution time, memory usage, and function calls
|
|
332
|
+
- **Regression Detection:** Automatic detection of performance degradation between code changes
|
|
333
|
+
- **Statistical Analysis:** Statistical validation of performance differences with confidence intervals
|
|
334
|
+
- **Historical Tracking:** Track performance trends across commits and releases
|
|
335
|
+
- **CI/CD Integration:** Seamless integration with continuous integration pipelines
|
|
336
|
+
- **AI Agent Output:** JSON format benchmark results for automated analysis
|
|
254
337
|
|
|
255
|
-
|
|
256
|
-
1. Configures the pytest-benchmark plugin with optimized settings
|
|
257
|
-
1. Compares benchmark results against previous runs when regression testing is enabled
|
|
258
|
-
1. Fails tests if performance decreases beyond the specified threshold
|
|
338
|
+
#### 🚀 Benchmark Execution Modes
|
|
259
339
|
|
|
260
|
-
|
|
340
|
+
**Basic Benchmarking:**
|
|
261
341
|
|
|
262
342
|
```bash
|
|
263
|
-
# Run
|
|
343
|
+
# Run tests with performance measurement
|
|
264
344
|
python -m crackerjack -t --benchmark
|
|
265
345
|
|
|
266
|
-
#
|
|
346
|
+
# Combine with AI agent mode for structured output
|
|
347
|
+
python -m crackerjack -t --benchmark --ai-agent
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Regression Testing:**
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Run benchmarks with regression detection (5% threshold)
|
|
267
354
|
python -m crackerjack -t --benchmark-regression
|
|
268
355
|
|
|
269
|
-
#
|
|
356
|
+
# Custom regression threshold (fail if >10% slower)
|
|
270
357
|
python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=10.0
|
|
358
|
+
|
|
359
|
+
# Strict regression testing for critical performance paths (2% threshold)
|
|
360
|
+
python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=2.0
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
#### 📈 Strategic Benchmark Scheduling
|
|
364
|
+
|
|
365
|
+
**🚀 Critical Scenarios (Always Run Benchmarks):**
|
|
366
|
+
|
|
367
|
+
- Before major releases
|
|
368
|
+
- After significant algorithmic changes
|
|
369
|
+
- When performance-critical code is modified
|
|
370
|
+
|
|
371
|
+
**📊 Regular Monitoring (Weekly):**
|
|
372
|
+
|
|
373
|
+
- Automated CI/CD pipeline execution
|
|
374
|
+
- Performance drift detection
|
|
375
|
+
- Long-term trend analysis
|
|
376
|
+
|
|
377
|
+
**🎲 Random Sampling (10% of commits):**
|
|
378
|
+
|
|
379
|
+
- Stochastic performance monitoring
|
|
380
|
+
- Gradual performance regression detection
|
|
381
|
+
- Statistical baseline maintenance
|
|
382
|
+
|
|
383
|
+
#### ⚙️ Technical Implementation
|
|
384
|
+
|
|
385
|
+
When benchmarks are executed, Crackerjack:
|
|
386
|
+
|
|
387
|
+
1. **Disables Parallel Execution**: Ensures accurate timing measurements (pytest-benchmark incompatible with pytest-xdist)
|
|
388
|
+
1. **Optimizes Configuration**: Configures pytest-benchmark with performance-optimized settings
|
|
389
|
+
1. **Baseline Comparison**: Compares results against previous runs for regression detection
|
|
390
|
+
1. **Statistical Validation**: Uses statistical methods to determine significant performance changes
|
|
391
|
+
1. **JSON Export**: Generates machine-readable results for automated analysis (with `--ai-agent`)
|
|
392
|
+
|
|
393
|
+
#### 🎯 Benchmark Best Practices
|
|
394
|
+
|
|
395
|
+
**Threshold Guidelines:**
|
|
396
|
+
|
|
397
|
+
- **2-5% threshold**: For release candidates and critical performance paths
|
|
398
|
+
- **5-10% threshold**: For regular development and monitoring
|
|
399
|
+
- **10%+ threshold**: For experimental features and early development
|
|
400
|
+
|
|
401
|
+
**Execution Strategy:**
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
# Development workflow with benchmarks
|
|
405
|
+
python -m crackerjack -t --benchmark --test-workers=1
|
|
406
|
+
|
|
407
|
+
# Release validation with strict thresholds
|
|
408
|
+
python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=2.0
|
|
409
|
+
|
|
410
|
+
# CI/CD integration with structured output
|
|
411
|
+
python -m crackerjack --ai-agent -t --benchmark-regression --benchmark-regression-threshold=5.0
|
|
271
412
|
```
|
|
272
413
|
|
|
414
|
+
#### 📁 Benchmark Output Files
|
|
415
|
+
|
|
416
|
+
When using `--ai-agent` mode, benchmark results are exported to:
|
|
417
|
+
|
|
418
|
+
- **`benchmark.json`**: Detailed performance metrics and statistical analysis
|
|
419
|
+
- **`test-results.xml`**: JUnit XML format with benchmark integration
|
|
420
|
+
- **`ai-agent-summary.json`**: Summary including benchmark status and regression analysis
|
|
421
|
+
|
|
422
|
+
This comprehensive approach ensures that performance regressions are caught early while maintaining development velocity.
|
|
423
|
+
|
|
273
424
|
## Installation
|
|
274
425
|
|
|
275
426
|
1. **Python:** Ensure you have Python 3.13 or higher installed.
|
|
@@ -369,28 +520,183 @@ runner = create_crackerjack_runner(
|
|
|
369
520
|
runner.process(MyOptions())
|
|
370
521
|
```
|
|
371
522
|
|
|
523
|
+
## Intelligent Commit Messages
|
|
524
|
+
|
|
525
|
+
Crackerjack includes a smart commit message generation system that analyzes your git changes and suggests descriptive commit messages based on the files modified and the type of changes made.
|
|
526
|
+
|
|
527
|
+
### How It Works
|
|
528
|
+
|
|
529
|
+
When you use the `-c` (commit) flag, Crackerjack automatically:
|
|
530
|
+
|
|
531
|
+
1. **Analyzes Changes**: Scans `git diff` to understand what files were added, modified, deleted, or renamed
|
|
532
|
+
1. **Categorizes Files**: Groups changes by type (documentation, tests, core functionality, configuration, dependencies)
|
|
533
|
+
1. **Suggests Message**: Generates a descriptive commit message with appropriate action verbs and categorization
|
|
534
|
+
1. **Interactive Choice**: Offers options to use the suggestion, edit it, or write a custom message
|
|
535
|
+
|
|
536
|
+
### Message Format
|
|
537
|
+
|
|
538
|
+
Generated commit messages follow this structure:
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
[Action] [primary changes] and [secondary changes]
|
|
542
|
+
|
|
543
|
+
- Added N file(s)
|
|
544
|
+
* path/to/new/file.py
|
|
545
|
+
* path/to/another/file.py
|
|
546
|
+
- Modified N file(s)
|
|
547
|
+
* path/to/changed/file.py
|
|
548
|
+
- Deleted N file(s)
|
|
549
|
+
- Renamed N file(s)
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Examples
|
|
553
|
+
|
|
554
|
+
**Documentation Updates:**
|
|
555
|
+
|
|
556
|
+
```
|
|
557
|
+
Update documentation
|
|
558
|
+
|
|
559
|
+
- Modified 3 file(s)
|
|
560
|
+
* README.md
|
|
561
|
+
* CLAUDE.md
|
|
562
|
+
* docs/guide.md
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**New Feature Addition:**
|
|
566
|
+
|
|
567
|
+
```
|
|
568
|
+
Add core functionality and tests
|
|
569
|
+
|
|
570
|
+
- Added 2 file(s)
|
|
571
|
+
* src/new_feature.py
|
|
572
|
+
* tests/test_feature.py
|
|
573
|
+
- Modified 1 file(s)
|
|
574
|
+
* README.md
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
**Configuration Changes:**
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
Update configuration
|
|
581
|
+
|
|
582
|
+
- Modified 2 file(s)
|
|
583
|
+
* pyproject.toml
|
|
584
|
+
* .pre-commit-config.yaml
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Usage Options
|
|
588
|
+
|
|
589
|
+
When committing, you'll see:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
🔍 Analyzing changes...
|
|
593
|
+
|
|
594
|
+
README.md | 10 ++++
|
|
595
|
+
tests/test_new.py | 50 ++++
|
|
596
|
+
2 files changed, 60 insertions(+)
|
|
597
|
+
|
|
598
|
+
📋 Suggested commit message:
|
|
599
|
+
Update documentation and tests
|
|
600
|
+
|
|
601
|
+
- Modified 1 file(s)
|
|
602
|
+
* README.md
|
|
603
|
+
- Added 1 file(s)
|
|
604
|
+
* tests/test_new.py
|
|
605
|
+
|
|
606
|
+
Use suggested message? [Y/n/e to edit]:
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**Options:**
|
|
610
|
+
|
|
611
|
+
- **Y** or **Enter**: Use the suggested message as-is
|
|
612
|
+
- **n**: Enter a completely custom commit message
|
|
613
|
+
- **e**: Edit the suggested message in your default editor (`$EDITOR`)
|
|
614
|
+
|
|
615
|
+
### Smart Categorization
|
|
616
|
+
|
|
617
|
+
The system intelligently categorizes files:
|
|
618
|
+
|
|
619
|
+
- **Documentation**: `README.md`, `CLAUDE.md`, `docs/`, `.md` files
|
|
620
|
+
- **Tests**: `test_`, `tests/`, `conftest.py`
|
|
621
|
+
- **Configuration**: `pyproject.toml`, `.yaml`, `.yml`, `.json`, `.gitignore`
|
|
622
|
+
- **CI/CD**: `.github/`, `ci/`, `.pre-commit`
|
|
623
|
+
- **Dependencies**: `requirements`, `pyproject.toml`, `uv.lock`
|
|
624
|
+
- **Core**: All other Python files and application code
|
|
625
|
+
|
|
626
|
+
This intelligent commit message system helps maintain consistent, descriptive commit history while saving time during development workflows.
|
|
627
|
+
|
|
372
628
|
### Command-Line Options
|
|
373
629
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
- `-
|
|
377
|
-
- `-
|
|
378
|
-
- `-v`, `--verbose`: Enable verbose output
|
|
379
|
-
- `-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
- `-
|
|
384
|
-
- `-
|
|
385
|
-
- `--
|
|
386
|
-
- `--
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
- `-
|
|
391
|
-
- `-
|
|
392
|
-
- `--
|
|
393
|
-
- `--
|
|
630
|
+
#### Core Workflow Options
|
|
631
|
+
|
|
632
|
+
- `-c`, `--commit`: Commit changes to Git
|
|
633
|
+
- `-i`, `--interactive`: Launch the interactive Rich UI with visual progress tracking
|
|
634
|
+
- `-v`, `--verbose`: Enable detailed verbose output for debugging
|
|
635
|
+
- `-a`, `--all <patch|minor|major>`: Run complete workflow: clean, test, publish, commit
|
|
636
|
+
|
|
637
|
+
#### Configuration & Setup
|
|
638
|
+
|
|
639
|
+
- `-n`, `--no-config-updates`: Skip updating configuration files (e.g., `pyproject.toml`)
|
|
640
|
+
- `-u`, `--update-precommit`: Update pre-commit hooks to the latest versions
|
|
641
|
+
- `--update-docs`: Create CLAUDE.md and RULES.md templates (only if they don't exist)
|
|
642
|
+
- `--force-update-docs`: Force update CLAUDE.md and RULES.md even if they exist
|
|
643
|
+
|
|
644
|
+
#### Code Quality & Testing
|
|
645
|
+
|
|
646
|
+
- `-x`, `--clean`: Clean code by removing docstrings, line comments, and extra whitespace
|
|
647
|
+
- `-t`, `--test`: Run tests using pytest with intelligent parallelization
|
|
648
|
+
- `-s`, `--skip-hooks`: Skip running pre-commit hooks (useful with `-t`)
|
|
649
|
+
- `--comprehensive`: Use comprehensive pre-commit analysis mode (\<30s, thorough)
|
|
650
|
+
|
|
651
|
+
#### Test Execution Control
|
|
652
|
+
|
|
653
|
+
- `--test-workers <N>`: Set parallel workers (0=auto-detect, 1=disable, N=specific count)
|
|
654
|
+
- `--test-timeout <seconds>`: Set timeout per test (0=auto-detect based on project size)
|
|
655
|
+
|
|
656
|
+
#### Performance & Benchmarking
|
|
657
|
+
|
|
658
|
+
- `--benchmark`: Run tests in benchmark mode (disables parallel execution)
|
|
659
|
+
- `--benchmark-regression`: Fail tests if benchmarks regress beyond threshold
|
|
660
|
+
- `--benchmark-regression-threshold <percentage>`: Set regression threshold (default: 5.0%)
|
|
661
|
+
|
|
662
|
+
#### Version Management & Publishing
|
|
663
|
+
|
|
664
|
+
- `-p`, `--publish <patch|minor|major>`: Bump version and publish to PyPI with enhanced authentication
|
|
665
|
+
- `-b`, `--bump <patch|minor|major>`: Bump version without publishing
|
|
666
|
+
|
|
667
|
+
#### Git Integration
|
|
668
|
+
|
|
669
|
+
- `-r`, `--pr`: Create a pull request to the upstream repository
|
|
670
|
+
|
|
671
|
+
#### Session Management
|
|
672
|
+
|
|
673
|
+
- `--track-progress`: Enable session progress tracking with automatic recovery
|
|
674
|
+
- `--progress-file <path>`: Custom path for progress file (default: SESSION-PROGRESS-{timestamp}.md)
|
|
675
|
+
- `--resume-from <file>`: Resume session from existing progress file
|
|
676
|
+
|
|
677
|
+
#### AI & Integration
|
|
678
|
+
|
|
679
|
+
- `--ai-agent`: Enable AI agent mode with structured JSON output
|
|
680
|
+
- `--help`: Display comprehensive help information
|
|
681
|
+
|
|
682
|
+
#### Example Flag Combinations
|
|
683
|
+
|
|
684
|
+
```bash
|
|
685
|
+
# Complete development workflow with session tracking
|
|
686
|
+
python -m crackerjack --track-progress -a patch
|
|
687
|
+
|
|
688
|
+
# Fast development cycle
|
|
689
|
+
python -m crackerjack -x -t -c
|
|
690
|
+
|
|
691
|
+
# Comprehensive pre-release validation
|
|
692
|
+
python -m crackerjack --comprehensive --benchmark-regression -p minor
|
|
693
|
+
|
|
694
|
+
# AI-optimized workflow with progress tracking
|
|
695
|
+
python -m crackerjack --ai-agent --track-progress -t --benchmark
|
|
696
|
+
|
|
697
|
+
# Interactive mode with comprehensive analysis
|
|
698
|
+
python -m crackerjack -i --comprehensive
|
|
699
|
+
```
|
|
394
700
|
|
|
395
701
|
### Example Workflows
|
|
396
702
|
|
|
@@ -449,7 +755,79 @@ runner.process(MyOptions())
|
|
|
449
755
|
python -m crackerjack -t --test-workers=2 --test-timeout=300
|
|
450
756
|
```
|
|
451
757
|
|
|
452
|
-
#### Version Management
|
|
758
|
+
#### Version Management & PyPI Publishing
|
|
759
|
+
|
|
760
|
+
Crackerjack provides comprehensive PyPI publishing with enhanced authentication and validation.
|
|
761
|
+
|
|
762
|
+
**🔐 PyPI Authentication Setup**
|
|
763
|
+
|
|
764
|
+
Crackerjack automatically validates your authentication setup before publishing and provides helpful error messages. Choose one of these authentication methods:
|
|
765
|
+
|
|
766
|
+
**Method 1: Environment Variable (Recommended)**
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
# Set PyPI token as environment variable
|
|
770
|
+
export UV_PUBLISH_TOKEN=pypi-your-token-here
|
|
771
|
+
|
|
772
|
+
# Publish with automatic token authentication
|
|
773
|
+
python -m crackerjack -p patch
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
**Method 2: Keyring Integration**
|
|
777
|
+
|
|
778
|
+
```bash
|
|
779
|
+
# Install keyring globally or in current environment
|
|
780
|
+
uv tool install keyring
|
|
781
|
+
|
|
782
|
+
# Store PyPI token in keyring (you'll be prompted for the token)
|
|
783
|
+
keyring set https://upload.pypi.org/legacy/ __token__
|
|
784
|
+
|
|
785
|
+
# Ensure keyring provider is configured in pyproject.toml
|
|
786
|
+
[tool.uv]
|
|
787
|
+
keyring-provider = "subprocess"
|
|
788
|
+
|
|
789
|
+
# Publish with keyring authentication
|
|
790
|
+
python -m crackerjack -p patch
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
**Method 3: Environment Variable for Keyring Provider**
|
|
794
|
+
|
|
795
|
+
```bash
|
|
796
|
+
# Set keyring provider via environment
|
|
797
|
+
export UV_KEYRING_PROVIDER=subprocess
|
|
798
|
+
|
|
799
|
+
# Publish (will use keyring for authentication)
|
|
800
|
+
python -m crackerjack -p patch
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
**Authentication Validation**
|
|
804
|
+
|
|
805
|
+
Crackerjack automatically validates your authentication setup before publishing:
|
|
806
|
+
|
|
807
|
+
- ✅ **Token Found**: When `UV_PUBLISH_TOKEN` is set
|
|
808
|
+
- ✅ **Keyring Ready**: When keyring is configured and token is stored
|
|
809
|
+
- ⚠️ **Setup Needed**: When authentication needs configuration
|
|
810
|
+
|
|
811
|
+
If publishing fails due to authentication issues, crackerjack displays helpful setup instructions.
|
|
812
|
+
|
|
813
|
+
**PyPI Token Best Practices**
|
|
814
|
+
|
|
815
|
+
1. **Generate Project-Specific Tokens**: Create separate PyPI tokens for each project
|
|
816
|
+
1. **Use Scoped Tokens**: Limit token scope to the specific package you're publishing
|
|
817
|
+
1. **Secure Storage**: Use environment variables or keyring - never hardcode tokens
|
|
818
|
+
1. **Token Format**: PyPI tokens start with `pypi-` (e.g., `pypi-AgEIcHlwaS5vcmcCJGZm...`)
|
|
819
|
+
|
|
820
|
+
**Troubleshooting Authentication**
|
|
821
|
+
|
|
822
|
+
If you encounter authentication issues:
|
|
823
|
+
|
|
824
|
+
1. **Check Token Format**: Ensure your token starts with `pypi-`
|
|
825
|
+
1. **Verify Environment Variable**: `echo $UV_PUBLISH_TOKEN` should show your token
|
|
826
|
+
1. **Test Keyring**: `keyring get https://upload.pypi.org/legacy/ __token__` should return your token
|
|
827
|
+
1. **Check Configuration**: Ensure `keyring-provider = "subprocess"` in pyproject.toml
|
|
828
|
+
1. **Install Keyring**: `uv tool install keyring` if using keyring authentication
|
|
829
|
+
|
|
830
|
+
**Version Management Commands**
|
|
453
831
|
|
|
454
832
|
- **Bump and Publish** - Bump version and publish to PyPI:
|
|
455
833
|
|
|
@@ -465,6 +843,36 @@ runner.process(MyOptions())
|
|
|
465
843
|
python -m crackerjack -b major
|
|
466
844
|
```
|
|
467
845
|
|
|
846
|
+
#### Documentation Template Management
|
|
847
|
+
|
|
848
|
+
Crackerjack can automatically propagate its quality standards to other Python projects by creating or updating their CLAUDE.md and RULES.md files. This ensures consistent AI code generation across all projects.
|
|
849
|
+
|
|
850
|
+
**📄 Template Propagation Commands**
|
|
851
|
+
|
|
852
|
+
```bash
|
|
853
|
+
# Update CLAUDE.md and RULES.md with latest quality standards (only if they don't exist)
|
|
854
|
+
python -m crackerjack --update-docs
|
|
855
|
+
|
|
856
|
+
# Force update CLAUDE.md and RULES.md even if they already exist
|
|
857
|
+
python -m crackerjack --force-update-docs
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
**When to Use Documentation Templates**
|
|
861
|
+
|
|
862
|
+
- **New Projects**: Use `--update-docs` to create initial documentation templates
|
|
863
|
+
- **Quality Standard Updates**: Use `--force-update-docs` weekly to keep standards current
|
|
864
|
+
- **AI Integration**: Ensures Claude Code generates compliant code on first pass across all projects
|
|
865
|
+
- **Team Synchronization**: Keeps all team projects using the same quality standards
|
|
866
|
+
|
|
867
|
+
**How Template Management Works**
|
|
868
|
+
|
|
869
|
+
- **Quality Standards**: Copies the latest Refurb, Pyright, Complexipy, and Bandit standards from Crackerjack
|
|
870
|
+
- **Project Customization**: Customizes project-specific sections (project name, overview)
|
|
871
|
+
- **Standard Preservation**: Preserves the core quality standards and AI generation guidelines
|
|
872
|
+
- **Git Integration**: Automatically adds files to git for easy committing
|
|
873
|
+
|
|
874
|
+
This feature is particularly valuable for teams maintaining multiple Python projects, ensuring that AI assistants generate consistent, high-quality code across all repositories.
|
|
875
|
+
|
|
468
876
|
#### Configuration Management
|
|
469
877
|
|
|
470
878
|
- **Skip Config Updates** - Run checks without updating configuration files:
|
|
@@ -535,6 +943,106 @@ python -m crackerjack --ai-agent --test
|
|
|
535
943
|
|
|
536
944
|
For detailed information about using Crackerjack with AI agents, including the structured output format and programmatic usage, see [README-AI-AGENT.md](README-AI-AGENT.md).
|
|
537
945
|
|
|
946
|
+
## Session Progress Tracking
|
|
947
|
+
|
|
948
|
+
Crackerjack includes robust session progress tracking to maintain continuity during long-running development sessions and enable seamless collaboration with AI assistants.
|
|
949
|
+
|
|
950
|
+
### Key Features
|
|
951
|
+
|
|
952
|
+
- **Automatic Progress Logging:** Tracks each step of the crackerjack workflow with detailed timestamps and status information
|
|
953
|
+
- **Markdown Output:** Generates human-readable progress files with comprehensive task status and file change tracking
|
|
954
|
+
- **Session Recovery:** Automatically detects and resumes interrupted sessions from where they left off
|
|
955
|
+
- **Task Status Tracking:** Monitors pending, in-progress, completed, failed, and skipped tasks with detailed context
|
|
956
|
+
- **File Change Tracking:** Records which files were modified during each task for easy debugging and rollback
|
|
957
|
+
- **Error Recovery:** Provides detailed error information with recovery suggestions and continuation instructions
|
|
958
|
+
- **AI Assistant Integration:** Optimized for AI workflows with structured progress information and session continuity
|
|
959
|
+
|
|
960
|
+
### Usage Examples
|
|
961
|
+
|
|
962
|
+
**Enable automatic session tracking:**
|
|
963
|
+
|
|
964
|
+
```bash
|
|
965
|
+
# Basic session tracking with automatic detection
|
|
966
|
+
python -m crackerjack --track-progress -x -t -c
|
|
967
|
+
|
|
968
|
+
# Session tracking with custom progress file
|
|
969
|
+
python -m crackerjack --track-progress --progress-file my-session.md -a patch
|
|
970
|
+
|
|
971
|
+
# Resume from interrupted session (automatic detection)
|
|
972
|
+
python -m crackerjack --track-progress -a patch
|
|
973
|
+
# 📋 Found incomplete session: SESSION-PROGRESS-20240716-143052.md
|
|
974
|
+
# ❓ Resume this session? [y/N]: y
|
|
975
|
+
|
|
976
|
+
# Manual session resumption
|
|
977
|
+
python -m crackerjack --resume-from SESSION-PROGRESS-20240716-143052.md
|
|
978
|
+
|
|
979
|
+
# Combine with AI agent mode for maximum visibility
|
|
980
|
+
python -m crackerjack --track-progress --ai-agent -x -t -c
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
### Automatic Session Detection
|
|
984
|
+
|
|
985
|
+
**🚀 Smart Recovery:** Crackerjack automatically detects interrupted sessions and offers to resume them! When you use `--track-progress`, crackerjack will:
|
|
986
|
+
|
|
987
|
+
1. **Scan for incomplete sessions** in the current directory (last 24 hours)
|
|
988
|
+
1. **Analyze session status** to determine if resumption is possible
|
|
989
|
+
1. **Prompt for user confirmation** with detailed session information
|
|
990
|
+
1. **Automatically resume** from the most recent incomplete task
|
|
991
|
+
|
|
992
|
+
### Progress File Structure
|
|
993
|
+
|
|
994
|
+
Progress files are generated in markdown format with comprehensive information:
|
|
995
|
+
|
|
996
|
+
````markdown
|
|
997
|
+
# Crackerjack Session Progress: abc123def
|
|
998
|
+
|
|
999
|
+
**Session ID**: abc123def
|
|
1000
|
+
**Started**: 2024-07-16 14:30:52
|
|
1001
|
+
**Status**: In Progress
|
|
1002
|
+
**Progress**: 3/8 tasks completed
|
|
1003
|
+
|
|
1004
|
+
## Task Progress Overview
|
|
1005
|
+
| Task | Status | Duration | Details |
|
|
1006
|
+
|------|--------|----------|---------|
|
|
1007
|
+
| Setup | ✅ completed | 0.15s | Project structure initialized |
|
|
1008
|
+
| Clean | ⏳ in_progress | - | Removing docstrings and comments |
|
|
1009
|
+
| Tests | ⏸️ pending | - | - |
|
|
1010
|
+
|
|
1011
|
+
## Detailed Task Log
|
|
1012
|
+
### ✅ Setup - COMPLETED
|
|
1013
|
+
- **Started**: 2024-07-16 14:30:52
|
|
1014
|
+
- **Completed**: 2024-07-16 14:30:52
|
|
1015
|
+
- **Duration**: 0.15s
|
|
1016
|
+
- **Files Changed**: None
|
|
1017
|
+
- **Details**: Project structure initialized
|
|
1018
|
+
|
|
1019
|
+
## Files Modified This Session
|
|
1020
|
+
- src/main.py
|
|
1021
|
+
- tests/test_main.py
|
|
1022
|
+
|
|
1023
|
+
## Session Recovery Information
|
|
1024
|
+
If this session was interrupted, you can resume from where you left off:
|
|
1025
|
+
```bash
|
|
1026
|
+
python -m crackerjack --resume-from SESSION-PROGRESS-20240716-143052.md
|
|
1027
|
+
````
|
|
1028
|
+
|
|
1029
|
+
### Benefits for Development Workflows
|
|
1030
|
+
|
|
1031
|
+
- **Long-running Sessions:** Perfect for complex development workflows that may be interrupted
|
|
1032
|
+
- **Team Collaboration:** Share session files with team members to show exactly what was done
|
|
1033
|
+
- **Debugging Support:** Detailed logs help diagnose issues and understand workflow execution
|
|
1034
|
+
- **AI Assistant Continuity:** AI assistants can read progress files to understand current project state
|
|
1035
|
+
- **Audit Trail:** Complete record of all changes and operations performed during development
|
|
1036
|
+
|
|
1037
|
+
### Integration with Other Features
|
|
1038
|
+
|
|
1039
|
+
Session progress tracking works seamlessly with:
|
|
1040
|
+
|
|
1041
|
+
- **AI Agent Mode:** Structured output files reference progress tracking for enhanced AI workflows
|
|
1042
|
+
- **Interactive Mode:** Progress is displayed in the Rich UI with real-time updates
|
|
1043
|
+
- **Benchmark Mode:** Performance metrics are included in progress files for analysis
|
|
1044
|
+
- **Version Bumping:** Version changes are tracked in session history for rollback support
|
|
1045
|
+
|
|
538
1046
|
## Interactive Rich UI
|
|
539
1047
|
|
|
540
1048
|
Crackerjack now offers an enhanced interactive experience through its Rich UI:
|
|
@@ -592,6 +1100,82 @@ For the most comprehensive error details with visual formatting, combine verbose
|
|
|
592
1100
|
python -m crackerjack -i -v
|
|
593
1101
|
```
|
|
594
1102
|
|
|
1103
|
+
## Performance Optimization
|
|
1104
|
+
|
|
1105
|
+
Crackerjack is optimized for performance across different project sizes and development scenarios:
|
|
1106
|
+
|
|
1107
|
+
### ⚡ Development Speed Optimization
|
|
1108
|
+
|
|
1109
|
+
**Fast Mode Execution:**
|
|
1110
|
+
|
|
1111
|
+
- **Target Time**: \<5 seconds for most operations
|
|
1112
|
+
- **Smart Hook Selection**: Essential hooks only during development
|
|
1113
|
+
- **Parallel Processing**: Intelligent worker allocation based on system resources
|
|
1114
|
+
- **Incremental Updates**: Only processes changed files when possible
|
|
1115
|
+
|
|
1116
|
+
**Adaptive Configuration:**
|
|
1117
|
+
|
|
1118
|
+
```bash
|
|
1119
|
+
# Automatic optimization based on project size
|
|
1120
|
+
python -m crackerjack # Auto-detects and optimizes
|
|
1121
|
+
|
|
1122
|
+
# Force fast mode for development
|
|
1123
|
+
python -m crackerjack --fast
|
|
1124
|
+
|
|
1125
|
+
# Override for large projects
|
|
1126
|
+
python -m crackerjack --test-workers=2 --test-timeout=300
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
### 🔍 Quality vs Speed Balance
|
|
1130
|
+
|
|
1131
|
+
| Operation | Fast Mode (\<5s) | Comprehensive Mode (\<30s) | Use Case |
|
|
1132
|
+
|-----------|----------------|---------------------------|----------|
|
|
1133
|
+
| **Pre-commit** | Essential hooks | All hooks + analysis | Development vs Release |
|
|
1134
|
+
| **Testing** | Parallel execution | Full suite + benchmarks | Quick check vs Validation |
|
|
1135
|
+
| **Code Cleaning** | Basic formatting | Deep analysis + refactoring | Daily work vs Refactoring |
|
|
1136
|
+
|
|
1137
|
+
### 📊 Project Size Adaptation
|
|
1138
|
+
|
|
1139
|
+
**Small Projects (\<1000 lines):**
|
|
1140
|
+
|
|
1141
|
+
- Default: Maximum parallelization
|
|
1142
|
+
- Fast hooks with minimal overhead
|
|
1143
|
+
- Quick test execution
|
|
1144
|
+
|
|
1145
|
+
**Medium Projects (1000-10000 lines):**
|
|
1146
|
+
|
|
1147
|
+
- Balanced worker allocation
|
|
1148
|
+
- Selective comprehensive checks
|
|
1149
|
+
- Optimized timeout settings
|
|
1150
|
+
|
|
1151
|
+
**Large Projects (>10000 lines):**
|
|
1152
|
+
|
|
1153
|
+
- Conservative parallelization
|
|
1154
|
+
- Extended timeouts
|
|
1155
|
+
- Strategic hook selection
|
|
1156
|
+
- Session progress tracking recommended
|
|
1157
|
+
|
|
1158
|
+
### 🚀 CI/CD Optimization
|
|
1159
|
+
|
|
1160
|
+
**Pre-push Hooks:**
|
|
1161
|
+
|
|
1162
|
+
```bash
|
|
1163
|
+
# Install optimized pre-push hooks
|
|
1164
|
+
pre-commit install --hook-type pre-push
|
|
1165
|
+
|
|
1166
|
+
# Comprehensive validation before push
|
|
1167
|
+
python -m crackerjack --comprehensive --ai-agent -t
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
**Performance Monitoring:**
|
|
1171
|
+
|
|
1172
|
+
- Benchmark regression detection
|
|
1173
|
+
- Statistical performance analysis
|
|
1174
|
+
- Automated performance alerts
|
|
1175
|
+
- Long-term trend tracking
|
|
1176
|
+
|
|
1177
|
+
This multi-layered optimization approach ensures that Crackerjack remains fast during development while providing thorough analysis when needed.
|
|
1178
|
+
|
|
595
1179
|
## Python 3.13+ Features
|
|
596
1180
|
|
|
597
1181
|
Crackerjack is designed to leverage the latest Python 3.13+ language features:
|