crackerjack 0.27.8__tar.gz → 0.28.0__tar.gz
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-0.27.8 → crackerjack-0.28.0}/.pre-commit-config-ai.yaml +1 -5
- {crackerjack-0.27.8 → crackerjack-0.28.0}/CLAUDE.md +460 -1
- {crackerjack-0.27.8 → crackerjack-0.28.0}/PKG-INFO +1 -1
- {crackerjack-0.27.8 → crackerjack-0.28.0}/RULES.md +54 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.pre-commit-config-ai.yaml +1 -5
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/__main__.py +40 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/crackerjack.py +705 -23
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/pyproject.toml +1 -1
- {crackerjack-0.27.8 → crackerjack-0.28.0}/pyproject.toml +1 -1
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_crackerjack.py +225 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_crackerjack_runner.py +5 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_structured_errors.py +7 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/uv.lock +1 -1
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.envrc +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.github/FUNDING.yml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.gitignore +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.libcst.codemod.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.pre-commit-config-fast.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/.pre-commit-config.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/LICENSE +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/README-AI-AGENT.md +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/README.md +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.gitignore +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.pdm.toml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.pre-commit-config-fast.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/.pre-commit-config.yaml +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/__init__.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/errors.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/interactive.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/crackerjack/py313.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/TESTING.md +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/__init__.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/conftest.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/data/comments_sample.txt +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/data/docstrings_sample.txt +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/data/expected_comments_sample.txt +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/data/init.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_errors.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_interactive.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_interactive_run.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_main.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_multiline_functions.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_py313_advanced.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_py313_features.py +0 -0
- {crackerjack-0.27.8 → crackerjack-0.28.0}/tests/test_pytest_features.py +0 -0
|
@@ -96,7 +96,7 @@ repos:
|
|
|
96
96
|
rev: v3.0.0
|
|
97
97
|
hooks:
|
|
98
98
|
- id: complexipy
|
|
99
|
-
args: ["-d", "low", "--output", "complexipy.json"]
|
|
99
|
+
args: ["-d", "low", "--output-json", "complexipy.json"]
|
|
100
100
|
stages: [pre-commit]
|
|
101
101
|
|
|
102
102
|
- repo: https://github.com/dosisod/refurb
|
|
@@ -116,10 +116,6 @@ repos:
|
|
|
116
116
|
- --aggressive
|
|
117
117
|
- --only-without-imports
|
|
118
118
|
- --guess-common-names
|
|
119
|
-
- --cache-dir=.autotyping-cache
|
|
120
|
-
- --workers=4
|
|
121
|
-
- --max-line-length=88
|
|
122
|
-
- --exclude-name=test_*,conftest
|
|
123
119
|
- crackerjack
|
|
124
120
|
types_or: [ python, pyi ]
|
|
125
121
|
language: python
|
|
@@ -162,6 +162,32 @@ python -m crackerjack -u
|
|
|
162
162
|
python -m crackerjack -x
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
### Documentation Template Management
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Update CLAUDE.md and RULES.md with latest quality standards (only if they don't exist)
|
|
171
|
+
python -m crackerjack --update-docs
|
|
172
|
+
|
|
173
|
+
# Force update CLAUDE.md and RULES.md even if they already exist
|
|
174
|
+
python -m crackerjack --force-update-docs
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**When to Use:**
|
|
178
|
+
|
|
179
|
+
- **New Projects**: Use `--update-docs` to create initial documentation templates
|
|
180
|
+
- **Quality Standard Updates**: Use `--force-update-docs` weekly to keep standards current
|
|
181
|
+
- **AI Integration**: Ensures Claude Code generates compliant code on first pass across all projects
|
|
182
|
+
- **Team Synchronization**: Keeps all team projects using the same quality standards
|
|
183
|
+
|
|
184
|
+
**How It Works:**
|
|
185
|
+
|
|
186
|
+
- Copies the latest Refurb, Pyright, Complexipy, and Bandit standards from Crackerjack
|
|
187
|
+
- Customizes project-specific sections (project name, overview)
|
|
188
|
+
- Preserves the core quality standards and AI generation guidelines
|
|
189
|
+
- Automatically adds files to git for easy committing
|
|
190
|
+
|
|
165
191
|
### Publishing
|
|
166
192
|
|
|
167
193
|
```bash
|
|
@@ -303,6 +329,8 @@ Crackerjack follows a single-file architecture for simplicity and maintainabilit
|
|
|
303
329
|
| `-t` | `--test` | Run tests |
|
|
304
330
|
| `-x` | `--clean` | Remove docstrings, comments, and whitespace |
|
|
305
331
|
| `-u` | `--update-precommit` | Update pre-commit hooks |
|
|
332
|
+
| | `--update-docs` | Update CLAUDE.md and RULES.md with latest quality standards |
|
|
333
|
+
| | `--force-update-docs` | Force update CLAUDE.md and RULES.md even if they exist |
|
|
306
334
|
| `-r` | `--pr` | Create pull request |
|
|
307
335
|
| `-v` | `--verbose` | Enable verbose output |
|
|
308
336
|
| `-s` | `--skip-hooks` | Skip pre-commit hooks |
|
|
@@ -328,6 +356,14 @@ Crackerjack follows a single-file architecture for simplicity and maintainabilit
|
|
|
328
356
|
| `--test-timeout` | Test timeout in seconds (0=auto) |
|
|
329
357
|
| `--ai-agent` | Generate structured output files (hidden flag) |
|
|
330
358
|
|
|
359
|
+
### Session Progress Tracking
|
|
360
|
+
|
|
361
|
+
| Flag | Description |
|
|
362
|
+
|------|-------------|
|
|
363
|
+
| `--track-progress` | Enable session progress tracking with detailed markdown output |
|
|
364
|
+
| `--resume-from <file>` | Resume session from existing progress file |
|
|
365
|
+
| `--progress-file <path>` | Custom path for progress file (default: SESSION-PROGRESS-{timestamp}.md) |
|
|
366
|
+
|
|
331
367
|
## Development Guidelines
|
|
332
368
|
|
|
333
369
|
1. **Code Style**: Follow the Crackerjack style guide (see RULES.md):
|
|
@@ -380,7 +416,29 @@ When generating code, AI assistants MUST follow these standards to ensure compli
|
|
|
380
416
|
- Use inline comments sparingly only when absolutely necessary for complex logic
|
|
381
417
|
- The codebase prioritizes clean, self-documenting code over documentation strings
|
|
382
418
|
|
|
383
|
-
### Refurb Standards (Modern Python Patterns up to 3.
|
|
419
|
+
### Refurb Standards (Modern Python Patterns up to 3.13+)
|
|
420
|
+
|
|
421
|
+
**CRITICAL: Collection and Membership Testing:**
|
|
422
|
+
|
|
423
|
+
- **FURB109**: Use tuples instead of lists for `in` membership testing
|
|
424
|
+
|
|
425
|
+
```python
|
|
426
|
+
# Bad
|
|
427
|
+
if response in ["y", "yes", "ok"]:
|
|
428
|
+
|
|
429
|
+
# Good
|
|
430
|
+
if response in ("y", "yes", "ok"):
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
- **FURB120**: Don't pass arguments that are the same as the default value
|
|
434
|
+
|
|
435
|
+
```python
|
|
436
|
+
# Bad
|
|
437
|
+
kwargs.get("resume_from", None)
|
|
438
|
+
|
|
439
|
+
# Good
|
|
440
|
+
kwargs.get("resume_from")
|
|
441
|
+
```
|
|
384
442
|
|
|
385
443
|
**Use modern syntax and built-ins:**
|
|
386
444
|
|
|
@@ -404,6 +462,34 @@ When generating code, AI assistants MUST follow these standards to ensure compli
|
|
|
404
462
|
- Use `tempfile` module for temporary files instead of manual paths
|
|
405
463
|
- Prefer `subprocess.run()` over `subprocess.Popen()` when possible
|
|
406
464
|
|
|
465
|
+
**Code Complexity Management (Complexipy):**
|
|
466
|
+
|
|
467
|
+
- **CRITICAL**: Keep cognitive complexity under 20 per function/method
|
|
468
|
+
- Break complex methods into smaller helper functions (3-5 helper functions are better than 1 complex function)
|
|
469
|
+
- Use descriptive function names that explain their purpose
|
|
470
|
+
- Prefer multiple small functions over one large function
|
|
471
|
+
- **Pattern for refactoring complex methods:**
|
|
472
|
+
```python
|
|
473
|
+
# Bad - High complexity (>20)
|
|
474
|
+
def complex_method(self, data):
|
|
475
|
+
# 50+ lines with multiple nested if/else, loops, etc.
|
|
476
|
+
|
|
477
|
+
# Good - Broken into helpers
|
|
478
|
+
def main_method(self, data):
|
|
479
|
+
processed = self._preprocess_data(data)
|
|
480
|
+
result = self._apply_transformations(processed)
|
|
481
|
+
return self._finalize_result(result)
|
|
482
|
+
|
|
483
|
+
def _preprocess_data(self, data):
|
|
484
|
+
# Single responsibility
|
|
485
|
+
|
|
486
|
+
def _apply_transformations(self, data):
|
|
487
|
+
# Single responsibility
|
|
488
|
+
|
|
489
|
+
def _finalize_result(self, data):
|
|
490
|
+
# Single responsibility
|
|
491
|
+
```
|
|
492
|
+
|
|
407
493
|
**Example of good patterns:**
|
|
408
494
|
|
|
409
495
|
```python
|
|
@@ -491,6 +577,34 @@ cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
|
|
|
491
577
|
|
|
492
578
|
### Pyright Type Safety Standards
|
|
493
579
|
|
|
580
|
+
**CRITICAL: Complete Type Annotations:**
|
|
581
|
+
|
|
582
|
+
- **reportMissingParameterType**: ALL function parameters MUST have type hints
|
|
583
|
+
|
|
584
|
+
```python
|
|
585
|
+
# Bad
|
|
586
|
+
def _format_task_detail(self, task) -> str:
|
|
587
|
+
|
|
588
|
+
# Good
|
|
589
|
+
def _format_task_detail(self, task: TaskStatus) -> str:
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
- **reportArgumentType**: Protocol implementations must match exactly
|
|
593
|
+
|
|
594
|
+
```python
|
|
595
|
+
# Bad - Missing properties in protocol implementation
|
|
596
|
+
class Options(OptionsProtocol):
|
|
597
|
+
verbose = True
|
|
598
|
+
# Missing: resume_from, progress_file
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
# Good - Complete protocol implementation
|
|
602
|
+
class Options(OptionsProtocol):
|
|
603
|
+
verbose = True
|
|
604
|
+
resume_from: str | None = None
|
|
605
|
+
progress_file: str | None = None
|
|
606
|
+
```
|
|
607
|
+
|
|
494
608
|
**Always use explicit type annotations:**
|
|
495
609
|
|
|
496
610
|
- Function parameters must have type hints
|
|
@@ -516,6 +630,7 @@ cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
|
|
|
516
630
|
- Prefer `typing.Protocol` over abstract base classes for duck typing
|
|
517
631
|
- Use `@runtime_checkable` when protocols need runtime checks
|
|
518
632
|
- Define clear interfaces with protocols
|
|
633
|
+
- **CRITICAL**: When implementing protocols, ensure ALL properties are included with correct types
|
|
519
634
|
|
|
520
635
|
**Python 3.13+ specific features:**
|
|
521
636
|
|
|
@@ -593,6 +708,164 @@ These standards align with the project's pre-commit hooks:
|
|
|
593
708
|
|
|
594
709
|
By following these guidelines during code generation, AI assistants will produce code that passes all quality checks without requiring manual fixes.
|
|
595
710
|
|
|
711
|
+
### AI Code Generation Best Practices
|
|
712
|
+
|
|
713
|
+
**MANDATORY: Always Apply These Standards When Generating Code**
|
|
714
|
+
|
|
715
|
+
1. **Pre-Generation Checklist:**
|
|
716
|
+
|
|
717
|
+
- Use tuples `()` for `in` membership testing, never lists `[]`
|
|
718
|
+
- Don't pass default values that match the function's default (e.g., `None` for optional parameters)
|
|
719
|
+
- Add complete type annotations to ALL function parameters
|
|
720
|
+
- Keep cognitive complexity under 20 per function
|
|
721
|
+
- Implement ALL protocol properties when creating test classes
|
|
722
|
+
|
|
723
|
+
1. **Common Patterns to Always Follow:**
|
|
724
|
+
|
|
725
|
+
```python
|
|
726
|
+
# Membership testing - ALWAYS use tuples
|
|
727
|
+
if status in ("pending", "completed", "failed"):
|
|
728
|
+
|
|
729
|
+
# Optional parameters - Don't pass None when it's the default
|
|
730
|
+
value = kwargs.get("optional_param") # Good
|
|
731
|
+
value = kwargs.get("optional_param", None) # Bad
|
|
732
|
+
|
|
733
|
+
# Type annotations - ALWAYS complete
|
|
734
|
+
def helper_method(self, task: TaskStatus, datetime_module) -> str: # Good
|
|
735
|
+
def helper_method(self, task) -> str: # Bad - missing type
|
|
736
|
+
|
|
737
|
+
# Protocol implementation - ALL properties required
|
|
738
|
+
class TestOptions(OptionsProtocol):
|
|
739
|
+
verbose = True
|
|
740
|
+
resume_from: str | None = None # Required
|
|
741
|
+
progress_file: str | None = None # Required
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
1. **Quality Gate Strategy:**
|
|
745
|
+
|
|
746
|
+
- Write code that would pass `python -m crackerjack --comprehensive` on first try
|
|
747
|
+
- Prioritize these checks: Refurb FURB109, FURB120, Pyright reportMissingParameterType, Complexipy \<20
|
|
748
|
+
- When refactoring complex code, break into 3-5 helper methods with single responsibilities
|
|
749
|
+
|
|
750
|
+
1. **Testing Integration:**
|
|
751
|
+
|
|
752
|
+
- All generated test classes MUST implement complete protocols
|
|
753
|
+
- Use proper type annotations in test helper classes
|
|
754
|
+
- Follow the same standards in test code as production code
|
|
755
|
+
|
|
756
|
+
By following these AI-specific guidelines, code generation will consistently pass all pre-commit hooks without manual intervention.
|
|
757
|
+
|
|
758
|
+
## Self-Maintenance Protocol for AI Assistants
|
|
759
|
+
|
|
760
|
+
**IMPORTANT: AI assistants should proactively maintain and update these quality standards to stay current with evolving tools.**
|
|
761
|
+
|
|
762
|
+
### Weekly Standards Update Process
|
|
763
|
+
|
|
764
|
+
**When to Update (any of these triggers):**
|
|
765
|
+
|
|
766
|
+
- Weekly basis (if working on the project regularly)
|
|
767
|
+
- After pre-commit hook failures reveal new rule violations
|
|
768
|
+
- When tools are updated (`pre-commit autoupdate` runs)
|
|
769
|
+
- When new error patterns emerge from quality checks
|
|
770
|
+
|
|
771
|
+
**Update Process:**
|
|
772
|
+
|
|
773
|
+
1. **Analyze Recent Quality Failures:**
|
|
774
|
+
|
|
775
|
+
```bash
|
|
776
|
+
# Run comprehensive analysis to identify current issues
|
|
777
|
+
python -m crackerjack --comprehensive --ai-agent
|
|
778
|
+
|
|
779
|
+
# Check for new Refurb rules
|
|
780
|
+
uv run python -c "import refurb; print('Refurb available')" 2>/dev/null || echo "Check refurb rules manually"
|
|
781
|
+
|
|
782
|
+
# Review recent pre-commit failures
|
|
783
|
+
git log --oneline -20 | grep -i "fix.*refurb\|fix.*pyright\|fix.*complex"
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
1. **Update CLAUDE.md Standards:**
|
|
787
|
+
|
|
788
|
+
- Add any new FURB rules discovered (e.g., FURB150, FURB200, etc.)
|
|
789
|
+
- Include new Pyright error codes (reportXxxType patterns)
|
|
790
|
+
- Update complexity thresholds if Complexipy settings change
|
|
791
|
+
- Add new Bandit security patterns as they emerge
|
|
792
|
+
|
|
793
|
+
1. **Update RULES.md:**
|
|
794
|
+
|
|
795
|
+
- Sync any contradictory patterns between CLAUDE.md and RULES.md
|
|
796
|
+
- Ensure RULES.md reflects the same quality standards
|
|
797
|
+
- Add project-specific patterns that emerge from development
|
|
798
|
+
|
|
799
|
+
1. **Test Updated Standards:**
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
# Verify updates don't conflict with existing code
|
|
803
|
+
python -m crackerjack --comprehensive
|
|
804
|
+
|
|
805
|
+
# Ensure documentation examples still work
|
|
806
|
+
python -m crackerjack -t
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### Self-Learning Pattern Recognition
|
|
810
|
+
|
|
811
|
+
**When encountering pre-commit failures, AI assistants should:**
|
|
812
|
+
|
|
813
|
+
1. **Pattern Analysis:**
|
|
814
|
+
|
|
815
|
+
- Identify the specific tool (Refurb, Pyright, Complexipy, etc.)
|
|
816
|
+
- Extract the error code (FURB109, reportMissingParameterType, etc.)
|
|
817
|
+
- Note the violation pattern and correct pattern
|
|
818
|
+
|
|
819
|
+
1. **Documentation Update:**
|
|
820
|
+
|
|
821
|
+
- Add the new pattern to the appropriate section in CLAUDE.md
|
|
822
|
+
- Include both "bad" and "good" code examples
|
|
823
|
+
- Mark as **CRITICAL** if it's a frequent failure pattern
|
|
824
|
+
|
|
825
|
+
1. **Validation:**
|
|
826
|
+
|
|
827
|
+
- Test the fix resolves the issue
|
|
828
|
+
- Ensure it doesn't conflict with existing standards
|
|
829
|
+
- Update the "AI Code Generation Best Practices" checklist
|
|
830
|
+
|
|
831
|
+
### Example Update Entry Format
|
|
832
|
+
|
|
833
|
+
When adding new patterns, use this format:
|
|
834
|
+
|
|
835
|
+
````markdown
|
|
836
|
+
**Tool Update (Date): New Pattern Discovered**
|
|
837
|
+
|
|
838
|
+
- **ERROR_CODE**: Brief description
|
|
839
|
+
```python
|
|
840
|
+
# Bad
|
|
841
|
+
problematic_pattern()
|
|
842
|
+
|
|
843
|
+
# Good
|
|
844
|
+
correct_pattern()
|
|
845
|
+
````
|
|
846
|
+
|
|
847
|
+
- **Context**: When this typically occurs
|
|
848
|
+
- **Priority**: CRITICAL/HIGH/MEDIUM based on frequency
|
|
849
|
+
|
|
850
|
+
````
|
|
851
|
+
|
|
852
|
+
### Hook Version Monitoring
|
|
853
|
+
|
|
854
|
+
**AI assistants should track when these tools are updated:**
|
|
855
|
+
- Refurb: New FURB rules often added
|
|
856
|
+
- Pyright: New reportXxx error types
|
|
857
|
+
- Complexipy: Threshold or analysis changes
|
|
858
|
+
- Bandit: New security patterns
|
|
859
|
+
|
|
860
|
+
**Update Check Command:**
|
|
861
|
+
```bash
|
|
862
|
+
# Check current versions and available updates
|
|
863
|
+
pre-commit autoupdate --config .pre-commit-config.yaml
|
|
864
|
+
git diff .pre-commit-config.yaml # Review what changed
|
|
865
|
+
````
|
|
866
|
+
|
|
867
|
+
By maintaining these standards proactively, AI assistants will stay ahead of quality issues and generate compliant code consistently.
|
|
868
|
+
|
|
596
869
|
## Recent Bug Fixes and Improvements
|
|
597
870
|
|
|
598
871
|
### CodeCleaner Docstring Removal Fix (December 2024)
|
|
@@ -914,6 +1187,191 @@ python -m crackerjack --ai-agent -t --benchmark
|
|
|
914
1187
|
|
|
915
1188
|
See README-AI-AGENT.md for detailed information about AI agent integration.
|
|
916
1189
|
|
|
1190
|
+
## Session Progress Tracking
|
|
1191
|
+
|
|
1192
|
+
Crackerjack includes robust session progress tracking that helps maintain continuity during long-running development sessions, especially when working with AI assistants that may experience interruptions.
|
|
1193
|
+
|
|
1194
|
+
### Key Features
|
|
1195
|
+
|
|
1196
|
+
- **Automatic Progress Logging**: Tracks each step of the crackerjack workflow with timestamps
|
|
1197
|
+
- **Markdown Output**: Generates human-readable progress files with detailed status information
|
|
1198
|
+
- **Session Recovery**: Resume interrupted sessions from where they left off
|
|
1199
|
+
- **Task Status Tracking**: Monitors pending, in-progress, completed, failed, and skipped tasks
|
|
1200
|
+
- **File Change Tracking**: Records which files were modified during each task
|
|
1201
|
+
- **Error Recovery**: Provides detailed error information and recovery suggestions
|
|
1202
|
+
|
|
1203
|
+
### Usage Examples
|
|
1204
|
+
|
|
1205
|
+
```bash
|
|
1206
|
+
# Enable session tracking with automatic detection and recovery
|
|
1207
|
+
python -m crackerjack --track-progress -x -t -c
|
|
1208
|
+
|
|
1209
|
+
# Use custom progress file location
|
|
1210
|
+
python -m crackerjack --track-progress --progress-file my-session.md -t
|
|
1211
|
+
|
|
1212
|
+
# Resume from a specific session file
|
|
1213
|
+
python -m crackerjack --resume-from SESSION-PROGRESS-20240716-143052.md
|
|
1214
|
+
|
|
1215
|
+
# Combine with AI agent mode for structured output
|
|
1216
|
+
python -m crackerjack --track-progress --ai-agent -a patch
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
### Automatic Session Detection
|
|
1220
|
+
|
|
1221
|
+
**🚀 New Feature**: Crackerjack now automatically detects interrupted sessions and offers to resume them!
|
|
1222
|
+
|
|
1223
|
+
When you use `--track-progress`, crackerjack will:
|
|
1224
|
+
|
|
1225
|
+
1. **Scan for incomplete sessions** in the current directory
|
|
1226
|
+
1. **Analyze session status** to determine if resumption is possible
|
|
1227
|
+
1. **Prompt for user confirmation** with session details
|
|
1228
|
+
1. **Automatically resume** from the most recent incomplete session
|
|
1229
|
+
|
|
1230
|
+
Example workflow:
|
|
1231
|
+
|
|
1232
|
+
```bash
|
|
1233
|
+
# First run - session gets interrupted
|
|
1234
|
+
python -m crackerjack --track-progress -a patch
|
|
1235
|
+
# ... session interrupted during testing phase ...
|
|
1236
|
+
|
|
1237
|
+
# Second run - automatic detection
|
|
1238
|
+
python -m crackerjack --track-progress -a patch
|
|
1239
|
+
# 📋 Found incomplete session: SESSION-PROGRESS-20240716-143052.md
|
|
1240
|
+
# Session ID: abc123def
|
|
1241
|
+
# Progress: 3/8 tasks completed
|
|
1242
|
+
# Failed tasks: Run tests
|
|
1243
|
+
# ❓ Resume this session? [y/N]: y
|
|
1244
|
+
# 🔄 Resumed session from: SESSION-PROGRESS-20240716-143052.md
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
### Progress File Structure
|
|
1248
|
+
|
|
1249
|
+
Progress files are generated in markdown format with the following structure:
|
|
1250
|
+
|
|
1251
|
+
````markdown
|
|
1252
|
+
# Crackerjack Session Progress: {session_id}
|
|
1253
|
+
|
|
1254
|
+
**Session ID**: abc123def
|
|
1255
|
+
**Started**: 2024-07-16 14:30:52
|
|
1256
|
+
**Status**: In Progress
|
|
1257
|
+
**Progress**: 3/8 tasks completed
|
|
1258
|
+
|
|
1259
|
+
## Session Metadata
|
|
1260
|
+
- **Working Directory**: /Users/dev/my-project
|
|
1261
|
+
- **Python Version**: 3.13
|
|
1262
|
+
- **Crackerjack Version**: 0.19.8
|
|
1263
|
+
- **CLI Options**: Options(clean=True, test=True, commit=True, ...)
|
|
1264
|
+
|
|
1265
|
+
## Task Progress Overview
|
|
1266
|
+
| Task | Status | Duration | Details |
|
|
1267
|
+
|------|--------|----------|---------|
|
|
1268
|
+
| Setup | ✅ completed | 0.15s | Project structure initialized |
|
|
1269
|
+
| Clean | ⏳ in_progress | - | Removing docstrings and comments |
|
|
1270
|
+
| Tests | ⏸️ pending | - | - |
|
|
1271
|
+
|
|
1272
|
+
## Detailed Task Log
|
|
1273
|
+
### ✅ Setup - COMPLETED
|
|
1274
|
+
- **Started**: 2024-07-16 14:30:52
|
|
1275
|
+
- **Completed**: 2024-07-16 14:30:52
|
|
1276
|
+
- **Duration**: 0.15s
|
|
1277
|
+
- **Files Changed**: None
|
|
1278
|
+
- **Details**: Project structure initialized
|
|
1279
|
+
|
|
1280
|
+
### ⏳ Clean - IN PROGRESS
|
|
1281
|
+
- **Started**: 2024-07-16 14:30:53
|
|
1282
|
+
- **Current Status**: Removing docstrings and comments
|
|
1283
|
+
|
|
1284
|
+
## Session Recovery Information
|
|
1285
|
+
If this session was interrupted, you can resume from where you left off:
|
|
1286
|
+
|
|
1287
|
+
```bash
|
|
1288
|
+
python -m crackerjack --resume-from SESSION-PROGRESS-20240716-143052.md
|
|
1289
|
+
````
|
|
1290
|
+
|
|
1291
|
+
## Files Modified This Session
|
|
1292
|
+
|
|
1293
|
+
- src/main.py
|
|
1294
|
+
- tests/test_main.py
|
|
1295
|
+
|
|
1296
|
+
## Next Steps
|
|
1297
|
+
|
|
1298
|
+
🔄 Currently working on:
|
|
1299
|
+
|
|
1300
|
+
- Clean project code
|
|
1301
|
+
|
|
1302
|
+
````
|
|
1303
|
+
|
|
1304
|
+
### Integration with AI Assistants
|
|
1305
|
+
|
|
1306
|
+
Session progress tracking is particularly valuable when working with AI assistants:
|
|
1307
|
+
|
|
1308
|
+
1. **Continuity**: If an AI session is interrupted, the assistant can read the progress file to understand what was completed
|
|
1309
|
+
2. **Context**: Progress files provide detailed context about the current state of the project
|
|
1310
|
+
3. **Recovery**: Clear instructions for resuming work from the exact point of interruption
|
|
1311
|
+
4. **Transparency**: Detailed logs help both users and AI assistants understand what happened
|
|
1312
|
+
|
|
1313
|
+
### Best Practices
|
|
1314
|
+
|
|
1315
|
+
1. **Always use progress tracking for complex workflows**:
|
|
1316
|
+
```bash
|
|
1317
|
+
python -m crackerjack --track-progress -a patch
|
|
1318
|
+
```
|
|
1319
|
+
|
|
1320
|
+
2. **Let automatic detection handle resumption**:
|
|
1321
|
+
- Simply use `--track-progress` again after interruption
|
|
1322
|
+
- Crackerjack will automatically detect and offer to resume incomplete sessions
|
|
1323
|
+
- No need to manually specify `--resume-from` in most cases
|
|
1324
|
+
|
|
1325
|
+
3. **Combine with AI agent mode for maximum visibility**:
|
|
1326
|
+
```bash
|
|
1327
|
+
python -m crackerjack --track-progress --ai-agent -x -t -c
|
|
1328
|
+
```
|
|
1329
|
+
|
|
1330
|
+
4. **Keep progress files for debugging**:
|
|
1331
|
+
- Progress files help diagnose issues that occur during workflow execution
|
|
1332
|
+
- They provide valuable debugging information for support requests
|
|
1333
|
+
- Automatic detection only considers sessions from the last 24 hours
|
|
1334
|
+
|
|
1335
|
+
5. **Use custom progress file names for important sessions**:
|
|
1336
|
+
```bash
|
|
1337
|
+
python -m crackerjack --track-progress --progress-file release-v1.0.md -p major
|
|
1338
|
+
```
|
|
1339
|
+
|
|
1340
|
+
### Error Handling and Recovery
|
|
1341
|
+
|
|
1342
|
+
When tasks fail, progress files include:
|
|
1343
|
+
|
|
1344
|
+
- Detailed error messages
|
|
1345
|
+
- Recovery suggestions
|
|
1346
|
+
- Context about what was being attempted
|
|
1347
|
+
- Information about which files were being modified
|
|
1348
|
+
|
|
1349
|
+
Example failed task entry:
|
|
1350
|
+
|
|
1351
|
+
```markdown
|
|
1352
|
+
### ❌ Pre-commit Hooks - FAILED
|
|
1353
|
+
- **Started**: 2024-07-16 14:35:22
|
|
1354
|
+
- **Failed**: 2024-07-16 14:35:45
|
|
1355
|
+
- **Error**: ruff check failed with exit code 1
|
|
1356
|
+
- **Recovery Suggestions**: Check error details and retry the failed operation
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
### File Management
|
|
1360
|
+
|
|
1361
|
+
- Progress files are automatically named with timestamps: `SESSION-PROGRESS-YYYYMMDD-HHMMSS.md`
|
|
1362
|
+
- Files are created in the current working directory by default
|
|
1363
|
+
- Use `--progress-file` to specify custom locations or names
|
|
1364
|
+
- Progress files are updated in real-time as tasks complete
|
|
1365
|
+
|
|
1366
|
+
### Integration with Other Features
|
|
1367
|
+
|
|
1368
|
+
Session progress tracking works seamlessly with:
|
|
1369
|
+
|
|
1370
|
+
- **AI Agent Mode**: Structured output files reference progress tracking
|
|
1371
|
+
- **Interactive Mode**: Progress is displayed in the Rich UI
|
|
1372
|
+
- **Benchmark Mode**: Performance metrics are included in progress files
|
|
1373
|
+
- **Version Bumping**: Version changes are tracked in session history
|
|
1374
|
+
|
|
917
1375
|
## Test Execution Details
|
|
918
1376
|
|
|
919
1377
|
### Test Configuration (pytest.ini_options)
|
|
@@ -981,3 +1439,4 @@ For expensive operations that should run before pushing:
|
|
|
981
1439
|
- Install with: `pre-commit install --hook-type pre-push`
|
|
982
1440
|
- Runs comprehensive analysis automatically
|
|
983
1441
|
- Prevents pushing code that doesn't meet quality standards
|
|
1442
|
+
````
|
|
@@ -73,6 +73,32 @@
|
|
|
73
73
|
- Configure hooks in `.pre-commit-config.yaml` with exact versions
|
|
74
74
|
- Ensure all code passes pre-commit checks before submitting
|
|
75
75
|
|
|
76
|
+
- **Specific Tool Compliance Standards**
|
|
77
|
+
|
|
78
|
+
- **Refurb (FURB Rules):**
|
|
79
|
+
|
|
80
|
+
- **FURB109**: ALWAYS use tuples `()` instead of lists `[]` for `in` membership testing
|
|
81
|
+
- **FURB120**: Never pass default values that match the function's default (e.g., `None` for optional parameters)
|
|
82
|
+
- Use modern Python patterns and built-ins consistently
|
|
83
|
+
|
|
84
|
+
- **Pyright Type Checking:**
|
|
85
|
+
|
|
86
|
+
- **reportMissingParameterType**: ALL function parameters MUST have complete type annotations
|
|
87
|
+
- **reportArgumentType**: Protocol implementations must include ALL required properties with correct types
|
|
88
|
+
- Use explicit type annotations for all function parameters and return types
|
|
89
|
+
|
|
90
|
+
- **Complexipy Code Complexity:**
|
|
91
|
+
|
|
92
|
+
- Keep cognitive complexity under 20 per function/method
|
|
93
|
+
- Break complex methods into 3-5 smaller helper functions with single responsibilities
|
|
94
|
+
- Use descriptive function names that explain their purpose
|
|
95
|
+
|
|
96
|
+
- **Bandit Security:**
|
|
97
|
+
|
|
98
|
+
- Never use dangerous functions like `eval()`, `exec()`, or `subprocess.shell=True`
|
|
99
|
+
- Use `secrets` module for cryptographic operations, never `random`
|
|
100
|
+
- Always specify encoding when opening files
|
|
101
|
+
|
|
76
102
|
- **Automation Focus**
|
|
77
103
|
|
|
78
104
|
- Automate repetitive tasks whenever possible
|
|
@@ -172,3 +198,31 @@
|
|
|
172
198
|
- Automate style and formatting checks to focus reviews on substance
|
|
173
199
|
- Look for edge cases and error handling in reviews
|
|
174
200
|
- Ensure tests adequately cover the changes
|
|
201
|
+
|
|
202
|
+
- **Session Progress Tracking**
|
|
203
|
+
|
|
204
|
+
- Use `--track-progress` flag for complex development workflows
|
|
205
|
+
- Always enable progress tracking when working with AI assistants
|
|
206
|
+
- Keep progress files for debugging and session recovery
|
|
207
|
+
- Use descriptive progress file names for important sessions: `--progress-file release-v1.0.md`
|
|
208
|
+
- Combine with AI agent mode for maximum visibility: `--track-progress --ai-agent`
|
|
209
|
+
- Progress files should be included in .gitignore to avoid committing session state
|
|
210
|
+
- Use `--resume-from` to continue interrupted sessions rather than starting over
|
|
211
|
+
|
|
212
|
+
## AI Assistant Self-Maintenance
|
|
213
|
+
|
|
214
|
+
- **Quality Standards Maintenance**
|
|
215
|
+
|
|
216
|
+
- AI assistants should update CLAUDE.md and RULES.md weekly or after pre-commit failures
|
|
217
|
+
- Learn from new Refurb rules (FURB codes), Pyright errors (reportXxx), and Complexipy thresholds
|
|
218
|
+
- Add newly discovered error patterns to documentation with code examples
|
|
219
|
+
- Test all documentation updates by running `python -m crackerjack --comprehensive`
|
|
220
|
+
- Prioritize frequently occurring error patterns as **CRITICAL** standards
|
|
221
|
+
|
|
222
|
+
- **Self-Learning Protocol**
|
|
223
|
+
|
|
224
|
+
- When encountering new pre-commit failures, extract the error pattern and add to standards
|
|
225
|
+
- Format new patterns with "Bad" and "Good" code examples
|
|
226
|
+
- Update the "AI Code Generation Best Practices" checklist in CLAUDE.md
|
|
227
|
+
- Ensure RULES.md stays synchronized with CLAUDE.md standards
|
|
228
|
+
- Monitor tool version updates and incorporate new rules as they emerge
|
|
@@ -96,7 +96,7 @@ repos:
|
|
|
96
96
|
rev: v3.0.0
|
|
97
97
|
hooks:
|
|
98
98
|
- id: complexipy
|
|
99
|
-
args: ["-d", "low", "--output", "complexipy.json"]
|
|
99
|
+
args: ["-d", "low", "--output-json", "complexipy.json"]
|
|
100
100
|
stages: [pre-commit]
|
|
101
101
|
|
|
102
102
|
- repo: https://github.com/dosisod/refurb
|
|
@@ -116,10 +116,6 @@ repos:
|
|
|
116
116
|
- --aggressive
|
|
117
117
|
- --only-without-imports
|
|
118
118
|
- --guess-common-names
|
|
119
|
-
- --cache-dir=.autotyping-cache
|
|
120
|
-
- --workers=4
|
|
121
|
-
- --max-line-length=88
|
|
122
|
-
- --exclude-name=test_*,conftest
|
|
123
119
|
- crackerjack
|
|
124
120
|
types_or: [ python, pyi ]
|
|
125
121
|
language: python
|