empathy-framework 4.6.6__py3-none-any.whl → 4.7.1__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.
- empathy_framework-4.7.1.dist-info/METADATA +690 -0
- empathy_framework-4.7.1.dist-info/RECORD +379 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/top_level.txt +1 -2
- empathy_healthcare_plugin/monitors/monitoring/__init__.py +9 -9
- empathy_llm_toolkit/agent_factory/__init__.py +6 -6
- empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +7 -10
- empathy_llm_toolkit/agents_md/__init__.py +22 -0
- empathy_llm_toolkit/agents_md/loader.py +218 -0
- empathy_llm_toolkit/agents_md/parser.py +271 -0
- empathy_llm_toolkit/agents_md/registry.py +307 -0
- empathy_llm_toolkit/commands/__init__.py +51 -0
- empathy_llm_toolkit/commands/context.py +375 -0
- empathy_llm_toolkit/commands/loader.py +301 -0
- empathy_llm_toolkit/commands/models.py +231 -0
- empathy_llm_toolkit/commands/parser.py +371 -0
- empathy_llm_toolkit/commands/registry.py +429 -0
- empathy_llm_toolkit/config/__init__.py +8 -8
- empathy_llm_toolkit/config/unified.py +3 -7
- empathy_llm_toolkit/context/__init__.py +22 -0
- empathy_llm_toolkit/context/compaction.py +455 -0
- empathy_llm_toolkit/context/manager.py +434 -0
- empathy_llm_toolkit/hooks/__init__.py +24 -0
- empathy_llm_toolkit/hooks/config.py +306 -0
- empathy_llm_toolkit/hooks/executor.py +289 -0
- empathy_llm_toolkit/hooks/registry.py +302 -0
- empathy_llm_toolkit/hooks/scripts/__init__.py +39 -0
- empathy_llm_toolkit/hooks/scripts/evaluate_session.py +201 -0
- empathy_llm_toolkit/hooks/scripts/first_time_init.py +285 -0
- empathy_llm_toolkit/hooks/scripts/pre_compact.py +207 -0
- empathy_llm_toolkit/hooks/scripts/session_end.py +183 -0
- empathy_llm_toolkit/hooks/scripts/session_start.py +163 -0
- empathy_llm_toolkit/hooks/scripts/suggest_compact.py +225 -0
- empathy_llm_toolkit/learning/__init__.py +30 -0
- empathy_llm_toolkit/learning/evaluator.py +438 -0
- empathy_llm_toolkit/learning/extractor.py +514 -0
- empathy_llm_toolkit/learning/storage.py +560 -0
- empathy_llm_toolkit/providers.py +4 -11
- empathy_llm_toolkit/security/__init__.py +17 -17
- empathy_llm_toolkit/utils/tokens.py +2 -5
- empathy_os/__init__.py +202 -70
- empathy_os/cache_monitor.py +5 -3
- empathy_os/cli/__init__.py +11 -55
- empathy_os/cli/__main__.py +29 -15
- empathy_os/cli/commands/inspection.py +21 -12
- empathy_os/cli/commands/memory.py +4 -12
- empathy_os/cli/commands/profiling.py +198 -0
- empathy_os/cli/commands/utilities.py +27 -7
- empathy_os/cli.py +28 -57
- empathy_os/cli_unified.py +525 -1164
- empathy_os/cost_tracker.py +9 -3
- empathy_os/dashboard/server.py +200 -2
- empathy_os/hot_reload/__init__.py +7 -7
- empathy_os/hot_reload/config.py +6 -7
- empathy_os/hot_reload/integration.py +35 -35
- empathy_os/hot_reload/reloader.py +57 -57
- empathy_os/hot_reload/watcher.py +28 -28
- empathy_os/hot_reload/websocket.py +2 -2
- empathy_os/memory/__init__.py +11 -4
- empathy_os/memory/claude_memory.py +1 -1
- empathy_os/memory/cross_session.py +8 -12
- empathy_os/memory/edges.py +6 -6
- empathy_os/memory/file_session.py +770 -0
- empathy_os/memory/graph.py +30 -30
- empathy_os/memory/nodes.py +6 -6
- empathy_os/memory/short_term.py +15 -9
- empathy_os/memory/unified.py +606 -140
- empathy_os/meta_workflows/agent_creator.py +3 -9
- empathy_os/meta_workflows/cli_meta_workflows.py +113 -53
- empathy_os/meta_workflows/form_engine.py +6 -18
- empathy_os/meta_workflows/intent_detector.py +64 -24
- empathy_os/meta_workflows/models.py +3 -1
- empathy_os/meta_workflows/pattern_learner.py +13 -31
- empathy_os/meta_workflows/plan_generator.py +55 -47
- empathy_os/meta_workflows/session_context.py +2 -3
- empathy_os/meta_workflows/workflow.py +20 -51
- empathy_os/models/cli.py +2 -2
- empathy_os/models/tasks.py +1 -2
- empathy_os/models/telemetry.py +4 -1
- empathy_os/models/token_estimator.py +3 -1
- empathy_os/monitoring/alerts.py +938 -9
- empathy_os/monitoring/alerts_cli.py +346 -183
- empathy_os/orchestration/execution_strategies.py +12 -29
- empathy_os/orchestration/pattern_learner.py +20 -26
- empathy_os/orchestration/real_tools.py +6 -15
- empathy_os/platform_utils.py +2 -1
- empathy_os/plugins/__init__.py +2 -2
- empathy_os/plugins/base.py +64 -64
- empathy_os/plugins/registry.py +32 -32
- empathy_os/project_index/index.py +49 -15
- empathy_os/project_index/models.py +1 -2
- empathy_os/project_index/reports.py +1 -1
- empathy_os/project_index/scanner.py +1 -0
- empathy_os/redis_memory.py +10 -7
- empathy_os/resilience/__init__.py +1 -1
- empathy_os/resilience/health.py +10 -10
- empathy_os/routing/__init__.py +7 -7
- empathy_os/routing/chain_executor.py +37 -37
- empathy_os/routing/classifier.py +36 -36
- empathy_os/routing/smart_router.py +40 -40
- empathy_os/routing/{wizard_registry.py → workflow_registry.py} +47 -47
- empathy_os/scaffolding/__init__.py +8 -8
- empathy_os/scaffolding/__main__.py +1 -1
- empathy_os/scaffolding/cli.py +28 -28
- empathy_os/socratic/__init__.py +3 -19
- empathy_os/socratic/ab_testing.py +25 -36
- empathy_os/socratic/blueprint.py +38 -38
- empathy_os/socratic/cli.py +34 -20
- empathy_os/socratic/collaboration.py +30 -28
- empathy_os/socratic/domain_templates.py +9 -1
- empathy_os/socratic/embeddings.py +17 -13
- empathy_os/socratic/engine.py +135 -70
- empathy_os/socratic/explainer.py +70 -60
- empathy_os/socratic/feedback.py +24 -19
- empathy_os/socratic/forms.py +15 -10
- empathy_os/socratic/generator.py +51 -35
- empathy_os/socratic/llm_analyzer.py +25 -23
- empathy_os/socratic/mcp_server.py +99 -159
- empathy_os/socratic/session.py +19 -13
- empathy_os/socratic/storage.py +98 -67
- empathy_os/socratic/success.py +38 -27
- empathy_os/socratic/visual_editor.py +51 -39
- empathy_os/socratic/web_ui.py +99 -66
- empathy_os/telemetry/cli.py +3 -1
- empathy_os/telemetry/usage_tracker.py +1 -3
- empathy_os/test_generator/__init__.py +3 -3
- empathy_os/test_generator/cli.py +28 -28
- empathy_os/test_generator/generator.py +64 -66
- empathy_os/test_generator/risk_analyzer.py +11 -11
- empathy_os/vscode_bridge 2.py +173 -0
- empathy_os/vscode_bridge.py +173 -0
- empathy_os/workflows/__init__.py +212 -120
- empathy_os/workflows/batch_processing.py +8 -24
- empathy_os/workflows/bug_predict.py +1 -1
- empathy_os/workflows/code_review.py +20 -5
- empathy_os/workflows/code_review_pipeline.py +13 -8
- empathy_os/workflows/keyboard_shortcuts/workflow.py +6 -2
- empathy_os/workflows/manage_documentation.py +1 -0
- empathy_os/workflows/orchestrated_health_check.py +6 -11
- empathy_os/workflows/orchestrated_release_prep.py +3 -3
- empathy_os/workflows/pr_review.py +18 -10
- empathy_os/workflows/progressive/README 2.md +454 -0
- empathy_os/workflows/progressive/__init__ 2.py +92 -0
- empathy_os/workflows/progressive/__init__.py +2 -12
- empathy_os/workflows/progressive/cli 2.py +242 -0
- empathy_os/workflows/progressive/cli.py +14 -37
- empathy_os/workflows/progressive/core 2.py +488 -0
- empathy_os/workflows/progressive/core.py +12 -12
- empathy_os/workflows/progressive/orchestrator 2.py +701 -0
- empathy_os/workflows/progressive/orchestrator.py +166 -144
- empathy_os/workflows/progressive/reports 2.py +528 -0
- empathy_os/workflows/progressive/reports.py +22 -31
- empathy_os/workflows/progressive/telemetry 2.py +280 -0
- empathy_os/workflows/progressive/telemetry.py +8 -14
- empathy_os/workflows/progressive/test_gen 2.py +514 -0
- empathy_os/workflows/progressive/test_gen.py +29 -48
- empathy_os/workflows/progressive/workflow 2.py +628 -0
- empathy_os/workflows/progressive/workflow.py +31 -70
- empathy_os/workflows/release_prep.py +21 -6
- empathy_os/workflows/release_prep_crew.py +1 -0
- empathy_os/workflows/secure_release.py +13 -6
- empathy_os/workflows/security_audit.py +8 -3
- empathy_os/workflows/test_coverage_boost_crew.py +3 -2
- empathy_os/workflows/test_maintenance_crew.py +1 -0
- empathy_os/workflows/test_runner.py +16 -12
- empathy_software_plugin/SOFTWARE_PLUGIN_README.md +25 -703
- empathy_software_plugin/cli.py +0 -122
- patterns/README.md +119 -0
- patterns/__init__.py +95 -0
- patterns/behavior.py +298 -0
- patterns/code_review_memory.json +441 -0
- patterns/core.py +97 -0
- patterns/debugging.json +3763 -0
- patterns/empathy.py +268 -0
- patterns/health_check_memory.json +505 -0
- patterns/input.py +161 -0
- patterns/memory_graph.json +8 -0
- patterns/refactoring_memory.json +1113 -0
- patterns/registry.py +663 -0
- patterns/security_memory.json +8 -0
- patterns/structural.py +415 -0
- patterns/validation.py +194 -0
- coach_wizards/__init__.py +0 -45
- coach_wizards/accessibility_wizard.py +0 -91
- coach_wizards/api_wizard.py +0 -91
- coach_wizards/base_wizard.py +0 -209
- coach_wizards/cicd_wizard.py +0 -91
- coach_wizards/code_reviewer_README.md +0 -60
- coach_wizards/code_reviewer_wizard.py +0 -180
- coach_wizards/compliance_wizard.py +0 -91
- coach_wizards/database_wizard.py +0 -91
- coach_wizards/debugging_wizard.py +0 -91
- coach_wizards/documentation_wizard.py +0 -91
- coach_wizards/generate_wizards.py +0 -347
- coach_wizards/localization_wizard.py +0 -173
- coach_wizards/migration_wizard.py +0 -91
- coach_wizards/monitoring_wizard.py +0 -91
- coach_wizards/observability_wizard.py +0 -91
- coach_wizards/performance_wizard.py +0 -91
- coach_wizards/prompt_engineering_wizard.py +0 -661
- coach_wizards/refactoring_wizard.py +0 -91
- coach_wizards/scaling_wizard.py +0 -90
- coach_wizards/security_wizard.py +0 -92
- coach_wizards/testing_wizard.py +0 -91
- empathy_framework-4.6.6.dist-info/METADATA +0 -1597
- empathy_framework-4.6.6.dist-info/RECORD +0 -410
- empathy_llm_toolkit/wizards/__init__.py +0 -43
- empathy_llm_toolkit/wizards/base_wizard.py +0 -364
- empathy_llm_toolkit/wizards/customer_support_wizard.py +0 -190
- empathy_llm_toolkit/wizards/healthcare_wizard.py +0 -378
- empathy_llm_toolkit/wizards/patient_assessment_README.md +0 -64
- empathy_llm_toolkit/wizards/patient_assessment_wizard.py +0 -193
- empathy_llm_toolkit/wizards/technology_wizard.py +0 -209
- empathy_os/wizard_factory_cli.py +0 -170
- empathy_software_plugin/wizards/__init__.py +0 -42
- empathy_software_plugin/wizards/advanced_debugging_wizard.py +0 -395
- empathy_software_plugin/wizards/agent_orchestration_wizard.py +0 -511
- empathy_software_plugin/wizards/ai_collaboration_wizard.py +0 -503
- empathy_software_plugin/wizards/ai_context_wizard.py +0 -441
- empathy_software_plugin/wizards/ai_documentation_wizard.py +0 -503
- empathy_software_plugin/wizards/base_wizard.py +0 -288
- empathy_software_plugin/wizards/book_chapter_wizard.py +0 -519
- empathy_software_plugin/wizards/code_review_wizard.py +0 -604
- empathy_software_plugin/wizards/debugging/__init__.py +0 -50
- empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +0 -414
- empathy_software_plugin/wizards/debugging/config_loaders.py +0 -446
- empathy_software_plugin/wizards/debugging/fix_applier.py +0 -469
- empathy_software_plugin/wizards/debugging/language_patterns.py +0 -385
- empathy_software_plugin/wizards/debugging/linter_parsers.py +0 -470
- empathy_software_plugin/wizards/debugging/verification.py +0 -369
- empathy_software_plugin/wizards/enhanced_testing_wizard.py +0 -537
- empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +0 -816
- empathy_software_plugin/wizards/multi_model_wizard.py +0 -501
- empathy_software_plugin/wizards/pattern_extraction_wizard.py +0 -422
- empathy_software_plugin/wizards/pattern_retriever_wizard.py +0 -400
- empathy_software_plugin/wizards/performance/__init__.py +0 -9
- empathy_software_plugin/wizards/performance/bottleneck_detector.py +0 -221
- empathy_software_plugin/wizards/performance/profiler_parsers.py +0 -278
- empathy_software_plugin/wizards/performance/trajectory_analyzer.py +0 -429
- empathy_software_plugin/wizards/performance_profiling_wizard.py +0 -305
- empathy_software_plugin/wizards/prompt_engineering_wizard.py +0 -425
- empathy_software_plugin/wizards/rag_pattern_wizard.py +0 -461
- empathy_software_plugin/wizards/security/__init__.py +0 -32
- empathy_software_plugin/wizards/security/exploit_analyzer.py +0 -290
- empathy_software_plugin/wizards/security/owasp_patterns.py +0 -241
- empathy_software_plugin/wizards/security/vulnerability_scanner.py +0 -604
- empathy_software_plugin/wizards/security_analysis_wizard.py +0 -322
- empathy_software_plugin/wizards/security_learning_wizard.py +0 -740
- empathy_software_plugin/wizards/tech_debt_wizard.py +0 -726
- empathy_software_plugin/wizards/testing/__init__.py +0 -27
- empathy_software_plugin/wizards/testing/coverage_analyzer.py +0 -459
- empathy_software_plugin/wizards/testing/quality_analyzer.py +0 -525
- empathy_software_plugin/wizards/testing/test_suggester.py +0 -533
- empathy_software_plugin/wizards/testing_wizard.py +0 -274
- wizards/__init__.py +0 -82
- wizards/admission_assessment_wizard.py +0 -644
- wizards/care_plan.py +0 -321
- wizards/clinical_assessment.py +0 -769
- wizards/discharge_planning.py +0 -77
- wizards/discharge_summary_wizard.py +0 -468
- wizards/dosage_calculation.py +0 -497
- wizards/incident_report_wizard.py +0 -454
- wizards/medication_reconciliation.py +0 -85
- wizards/nursing_assessment.py +0 -171
- wizards/patient_education.py +0 -654
- wizards/quality_improvement.py +0 -705
- wizards/sbar_report.py +0 -324
- wizards/sbar_wizard.py +0 -608
- wizards/shift_handoff_wizard.py +0 -535
- wizards/soap_note_wizard.py +0 -679
- wizards/treatment_plan.py +0 -15
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/WHEEL +0 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/entry_points.txt +0 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,735 +1,57 @@
|
|
|
1
1
|
# Software Development Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **DEPRECATION NOTICE (January 2026):** The `empathy_software_plugin.wizards` module has been removed. Please use CLI workflows instead.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Production-ready analysis tools for software development.
|
|
6
|
+
|
|
7
|
+
**Copyright 2025-2026 Smart AI Memory, LLC**
|
|
6
8
|
**Licensed under Fair Source 0.9**
|
|
7
9
|
|
|
8
10
|
## Overview
|
|
9
11
|
|
|
10
|
-
The Software Development Plugin provides
|
|
11
|
-
|
|
12
|
-
1. **Enhanced Testing Wizard** - Predicts where bugs will occur based on test coverage gaps
|
|
13
|
-
2. **Performance Profiling Wizard** - Predicts performance degradation before it impacts users
|
|
14
|
-
3. **Security Analysis Wizard** - Predicts which vulnerabilities will actually be exploited
|
|
15
|
-
|
|
16
|
-
All three wizards operate at **Level 4: Anticipatory Empathy**, meaning they don't just identify current issues—they predict future problems and alert you before they become critical.
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
```python
|
|
21
|
-
from empathy_software_plugin.wizards.enhanced_testing_wizard import EnhancedTestingWizard
|
|
22
|
-
from empathy_software_plugin.wizards.performance_profiling_wizard import PerformanceProfilingWizard
|
|
23
|
-
from empathy_software_plugin.wizards.security_analysis_wizard import SecurityAnalysisWizard
|
|
24
|
-
|
|
25
|
-
# Enhanced Testing Wizard
|
|
26
|
-
testing_wizard = EnhancedTestingWizard()
|
|
27
|
-
result = await testing_wizard.analyze({
|
|
28
|
-
'source_files': ['src/'],
|
|
29
|
-
'test_files': ['tests/'],
|
|
30
|
-
'project_path': '/path/to/project'
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
print(f"High-risk gaps: {result['high_risk_gaps']}")
|
|
34
|
-
print(f"Predictions: {result['predictions']}")
|
|
35
|
-
|
|
36
|
-
# Performance Profiling Wizard
|
|
37
|
-
performance_wizard = PerformanceProfilingWizard()
|
|
38
|
-
result = await performance_wizard.analyze({
|
|
39
|
-
'profiler_data': profiler_output,
|
|
40
|
-
'profiler_type': 'cprofile' # or 'chrome_devtools', 'simple_json'
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
print(f"Bottlenecks: {result['bottlenecks']}")
|
|
44
|
-
print(f"Trajectory: {result['trajectory_analysis']}")
|
|
45
|
-
|
|
46
|
-
# Security Analysis Wizard
|
|
47
|
-
security_wizard = SecurityAnalysisWizard()
|
|
48
|
-
result = await security_wizard.analyze({
|
|
49
|
-
'source_files': ['src/'],
|
|
50
|
-
'project_path': '/path/to/project',
|
|
51
|
-
'endpoint_config': {
|
|
52
|
-
'src/api.py': {'endpoint_public': True}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
print(f"Vulnerabilities: {result['vulnerabilities_found']}")
|
|
57
|
-
print(f"Exploitability: {result['exploitability_assessments']}")
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Wizards
|
|
61
|
-
|
|
62
|
-
### 1. Enhanced Testing Wizard
|
|
63
|
-
|
|
64
|
-
**Level 4 Capability:** Predicts where bugs will occur based on test coverage gaps and code patterns.
|
|
65
|
-
|
|
66
|
-
#### What It Does
|
|
67
|
-
|
|
68
|
-
- Analyzes test coverage beyond simple percentages
|
|
69
|
-
- Identifies high-risk code patterns (authentication, payments, error handling, user input, financial calculations)
|
|
70
|
-
- Detects brittle tests that will break with minor code changes
|
|
71
|
-
- Predicts bug likelihood in untested code
|
|
72
|
-
- Generates smart test suggestions
|
|
73
|
-
|
|
74
|
-
#### High-Risk Patterns
|
|
75
|
-
|
|
76
|
-
The wizard identifies untested code in these categories:
|
|
77
|
-
|
|
78
|
-
- **Authentication/Authorization** - Login, permissions, access control
|
|
79
|
-
- **Payment Processing** - Financial transactions, billing
|
|
80
|
-
- **Error Handling** - Exception handling, recovery logic
|
|
81
|
-
- **User Input Validation** - Form processing, API parameters
|
|
82
|
-
- **Financial Calculations** - Money, pricing, tax calculations
|
|
83
|
-
|
|
84
|
-
#### Example Output
|
|
85
|
-
|
|
86
|
-
```python
|
|
87
|
-
{
|
|
88
|
-
"coverage_summary": {
|
|
89
|
-
"overall_coverage": 0.75,
|
|
90
|
-
"covered_lines": 300,
|
|
91
|
-
"total_lines": 400,
|
|
92
|
-
"uncovered_files": 5
|
|
93
|
-
},
|
|
94
|
-
"high_risk_gaps": [
|
|
95
|
-
{
|
|
96
|
-
"file_path": "src/auth.py",
|
|
97
|
-
"function_name": "verify_permissions",
|
|
98
|
-
"risk_category": "authentication",
|
|
99
|
-
"risk_level": "CRITICAL",
|
|
100
|
-
"uncovered_lines": [42, 43, 44],
|
|
101
|
-
"reasoning": "Authorization logic with no test coverage"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"predictions": [
|
|
105
|
-
{
|
|
106
|
-
"type": "bug_risk_in_untested_auth",
|
|
107
|
-
"severity": "HIGH",
|
|
108
|
-
"description": "In our experience, untested authentication code leads to security vulnerabilities",
|
|
109
|
-
"affected_functions": ["verify_permissions"],
|
|
110
|
-
"prevention_steps": [
|
|
111
|
-
"Add unit tests for all authorization paths",
|
|
112
|
-
"Test both allowed and denied access scenarios",
|
|
113
|
-
"Include tests for edge cases (null user, expired tokens)"
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### When to Use
|
|
121
|
-
|
|
122
|
-
- Before deployment (ensure critical code is tested)
|
|
123
|
-
- During code review (identify testing gaps)
|
|
124
|
-
- Sprint planning (prioritize test writing)
|
|
125
|
-
- After adding new features (verify test coverage)
|
|
126
|
-
|
|
127
|
-
### 2. Performance Profiling Wizard
|
|
128
|
-
|
|
129
|
-
**Level 4 Capability:** Predicts performance degradation before it becomes critical by analyzing historical trends.
|
|
130
|
-
|
|
131
|
-
#### What It Does
|
|
132
|
-
|
|
133
|
-
- Parses profiling data from multiple tools (cProfile, Chrome DevTools, custom JSON)
|
|
134
|
-
- Detects bottlenecks: hot paths, N+1 queries, I/O bound operations
|
|
135
|
-
- Analyzes performance trajectory (degrading, stable, optimal)
|
|
136
|
-
- Predicts time to critical thresholds
|
|
137
|
-
- Provides fix suggestions based on real-world experience
|
|
138
|
-
|
|
139
|
-
#### Supported Profilers
|
|
140
|
-
|
|
141
|
-
1. **cProfile** (Python standard library)
|
|
142
|
-
```python
|
|
143
|
-
import cProfile
|
|
144
|
-
profiler = cProfile.Profile()
|
|
145
|
-
profiler.enable()
|
|
146
|
-
# ... your code ...
|
|
147
|
-
profiler.disable()
|
|
148
|
-
stats = profiler.get_stats()
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
2. **Chrome DevTools** (browser performance)
|
|
152
|
-
- Record performance profile in Chrome
|
|
153
|
-
- Export as JSON
|
|
154
|
-
- Pass to wizard
|
|
155
|
-
|
|
156
|
-
3. **Simple JSON** (custom profilers)
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"functions": [
|
|
160
|
-
{
|
|
161
|
-
"name": "function_name",
|
|
162
|
-
"file": "path/to/file.py",
|
|
163
|
-
"line": 42,
|
|
164
|
-
"total_time": 1.5,
|
|
165
|
-
"self_time": 1.0,
|
|
166
|
-
"calls": 100,
|
|
167
|
-
"cumulative_time": 1.5,
|
|
168
|
-
"percent": 15.0
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
#### Bottleneck Types
|
|
12
|
+
The Software Development Plugin provides analysis capabilities through CLI workflows.
|
|
175
13
|
|
|
176
|
-
|
|
177
|
-
- **N+1 Query** - Database query called repeatedly (>50 times)
|
|
178
|
-
- **I/O Bound** - File or network operations blocking execution
|
|
179
|
-
- **CPU Bound** - Computationally expensive operations
|
|
180
|
-
- **Memory Leak** - Growing memory usage over time
|
|
181
|
-
- **Synchronous I/O** - Blocking I/O in async context
|
|
14
|
+
## Recommended Approach
|
|
182
15
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```python
|
|
188
|
-
# Provide historical metrics
|
|
189
|
-
historical_metrics = [
|
|
190
|
-
{"timestamp": "2024-01-01T10:00:00", "response_time": 0.2},
|
|
191
|
-
{"timestamp": "2024-01-02T10:00:00", "response_time": 0.45},
|
|
192
|
-
{"timestamp": "2024-01-03T10:00:00", "response_time": 0.8}
|
|
193
|
-
]
|
|
194
|
-
|
|
195
|
-
result = await wizard.analyze({
|
|
196
|
-
'profiler_data': current_profile,
|
|
197
|
-
'profiler_type': 'cprofile',
|
|
198
|
-
'historical_metrics': historical_metrics
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
# Output includes prediction
|
|
202
|
-
{
|
|
203
|
-
"trajectory_analysis": {
|
|
204
|
-
"state": "degrading",
|
|
205
|
-
"trends": [
|
|
206
|
-
{
|
|
207
|
-
"metric_name": "response_time",
|
|
208
|
-
"direction": "degrading",
|
|
209
|
-
"current_value": 0.8,
|
|
210
|
-
"rate_of_change": 0.3,
|
|
211
|
-
"severity": "HIGH"
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
"time_to_critical": "~1.3 days"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
#### Example Output
|
|
220
|
-
|
|
221
|
-
```python
|
|
222
|
-
{
|
|
223
|
-
"profiling_summary": {
|
|
224
|
-
"total_functions": 50,
|
|
225
|
-
"total_time": 10.0,
|
|
226
|
-
"top_function": "process_request (45% of time)"
|
|
227
|
-
},
|
|
228
|
-
"bottlenecks": [
|
|
229
|
-
{
|
|
230
|
-
"type": "hot_path",
|
|
231
|
-
"function_name": "process_request",
|
|
232
|
-
"file_path": "api.py",
|
|
233
|
-
"line_number": 42,
|
|
234
|
-
"severity": "CRITICAL",
|
|
235
|
-
"time_consumed": 4.5,
|
|
236
|
-
"percent_of_total": 45.0,
|
|
237
|
-
"reasoning": "Single function consuming nearly half of execution time",
|
|
238
|
-
"fix_suggestion": "Profile this function further to identify optimization opportunities. Consider caching, algorithmic improvements, or async processing."
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"type": "n_plus_one",
|
|
242
|
-
"function_name": "fetch_user",
|
|
243
|
-
"file_path": "database.py",
|
|
244
|
-
"line_number": 100,
|
|
245
|
-
"severity": "HIGH",
|
|
246
|
-
"call_count": 1000,
|
|
247
|
-
"reasoning": "Database query called 1000 times - classic N+1 pattern",
|
|
248
|
-
"fix_suggestion": "Use eager loading or batch queries. Replace loop with single query using IN clause or JOIN."
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
"predictions": [
|
|
252
|
-
{
|
|
253
|
-
"type": "performance_degradation",
|
|
254
|
-
"severity": "HIGH",
|
|
255
|
-
"description": "In our experience, response times trending upward lead to timeout errors under load",
|
|
256
|
-
"affected_code": ["process_request"],
|
|
257
|
-
"prevention_steps": [
|
|
258
|
-
"Optimize hot path in process_request",
|
|
259
|
-
"Add caching layer",
|
|
260
|
-
"Monitor response time trends"
|
|
261
|
-
]
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
#### When to Use
|
|
268
|
-
|
|
269
|
-
- After profiling production traffic (identify real bottlenecks)
|
|
270
|
-
- During load testing (understand performance characteristics)
|
|
271
|
-
- Investigating slow endpoints (find root cause)
|
|
272
|
-
- Monitoring performance trends (predict degradation)
|
|
273
|
-
|
|
274
|
-
### 3. Security Analysis Wizard
|
|
275
|
-
|
|
276
|
-
**Level 4 Capability:** Predicts which vulnerabilities will actually be exploited based on accessibility and attack patterns.
|
|
277
|
-
|
|
278
|
-
#### What It Does
|
|
279
|
-
|
|
280
|
-
- Detects OWASP Top 10 vulnerabilities
|
|
281
|
-
- Assesses exploitability (not just theoretical severity)
|
|
282
|
-
- Considers endpoint accessibility (public/authenticated/internal)
|
|
283
|
-
- Calculates exploit likelihood based on real-world attack patterns
|
|
284
|
-
- Prioritizes by actual risk, not just CVSS scores
|
|
285
|
-
|
|
286
|
-
#### Detected Vulnerabilities
|
|
287
|
-
|
|
288
|
-
Based on **OWASP Top 10**:
|
|
289
|
-
|
|
290
|
-
1. **Injection** - SQL, Command, LDAP injection
|
|
291
|
-
2. **Cryptographic Failures** - Weak algorithms (MD5, SHA1), hardcoded secrets
|
|
292
|
-
3. **Cross-Site Scripting (XSS)** - innerHTML, document.write with user input
|
|
293
|
-
4. **Insecure Deserialization** - Pickle, eval() with untrusted data
|
|
294
|
-
5. **Security Misconfiguration** - Missing authentication, debug mode
|
|
295
|
-
6. **Path Traversal** - File access with user-controlled paths
|
|
296
|
-
7. **CSRF** - Missing CSRF tokens on state-changing endpoints
|
|
297
|
-
|
|
298
|
-
#### Exploitability Assessment
|
|
16
|
+
```bash
|
|
17
|
+
# Security analysis
|
|
18
|
+
empathy workflow run security-audit --path ./src
|
|
299
19
|
|
|
300
|
-
|
|
20
|
+
# Bug prediction
|
|
21
|
+
empathy workflow run bug-predict --path ./src
|
|
301
22
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
"exploitability_assessments": [
|
|
305
|
-
{
|
|
306
|
-
"vulnerability": {
|
|
307
|
-
"category": "injection",
|
|
308
|
-
"name": "SQL Injection",
|
|
309
|
-
"severity": "CRITICAL",
|
|
310
|
-
"file_path": "api.py",
|
|
311
|
-
"line_number": 42
|
|
312
|
-
},
|
|
313
|
-
"accessibility": "public", # Publicly accessible endpoint
|
|
314
|
-
"attack_complexity": "low", # Easy to exploit
|
|
315
|
-
"exploit_likelihood": 0.9, # 90% chance of being exploited
|
|
316
|
-
"exploitability": "CRITICAL",
|
|
317
|
-
"reasoning": "Publicly accessible SQL injection with low attack complexity. In our experience, actively scanned by automated tools (SQLMap, Havij).",
|
|
318
|
-
"mitigation_urgency": "IMMEDIATE", # Fix before deploying
|
|
319
|
-
"real_world_examples": [
|
|
320
|
-
"SQLMap automated scanner",
|
|
321
|
-
"Havij SQL injection tool",
|
|
322
|
-
"Automated bot scans"
|
|
323
|
-
]
|
|
324
|
-
}
|
|
325
|
-
]
|
|
326
|
-
}
|
|
23
|
+
# Test coverage analysis
|
|
24
|
+
empathy workflow run test-coverage --path ./src
|
|
327
25
|
```
|
|
328
26
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
- **IMMEDIATE** - Fix before next deployment (hours)
|
|
332
|
-
- **URGENT** - Fix within 24 hours
|
|
333
|
-
- **HIGH** - Fix within 1 week
|
|
334
|
-
- **MEDIUM** - Fix within sprint (2 weeks)
|
|
335
|
-
- **LOW** - Address in future release
|
|
336
|
-
|
|
337
|
-
#### Example Output
|
|
27
|
+
Or use the Python workflow API:
|
|
338
28
|
|
|
339
29
|
```python
|
|
340
|
-
|
|
341
|
-
"vulnerabilities_found": 5,
|
|
342
|
-
"by_severity": {
|
|
343
|
-
"CRITICAL": 2,
|
|
344
|
-
"HIGH": 2,
|
|
345
|
-
"MEDIUM": 1
|
|
346
|
-
},
|
|
347
|
-
"by_category": {
|
|
348
|
-
"injection": 2,
|
|
349
|
-
"cryptographic_failures": 2,
|
|
350
|
-
"cross_site_scripting": 1
|
|
351
|
-
},
|
|
352
|
-
"exploitability_assessments": [
|
|
353
|
-
{
|
|
354
|
-
"vulnerability": {
|
|
355
|
-
"category": "injection",
|
|
356
|
-
"name": "SQL Injection",
|
|
357
|
-
"severity": "CRITICAL",
|
|
358
|
-
"file_path": "api.py",
|
|
359
|
-
"line_number": 42,
|
|
360
|
-
"code_snippet": "query = f\"SELECT * FROM users WHERE id={user_id}\"",
|
|
361
|
-
"description": "SQL query built with f-string interpolation",
|
|
362
|
-
"example_fix": "cursor.execute('SELECT * FROM users WHERE id = ?', (user_id,))"
|
|
363
|
-
},
|
|
364
|
-
"accessibility": "public",
|
|
365
|
-
"attack_complexity": "low",
|
|
366
|
-
"exploit_likelihood": 0.9,
|
|
367
|
-
"exploitability": "CRITICAL",
|
|
368
|
-
"reasoning": "Publicly accessible SQL injection with low attack complexity. In our experience, actively scanned by automated tools.",
|
|
369
|
-
"mitigation_urgency": "IMMEDIATE"
|
|
370
|
-
}
|
|
371
|
-
],
|
|
372
|
-
"insights": {
|
|
373
|
-
"most_common_category": "injection",
|
|
374
|
-
"critical_exploitable": 2,
|
|
375
|
-
"exploitable_percent": 0.4,
|
|
376
|
-
"public_exposure": 3,
|
|
377
|
-
"immediate_action_required": true
|
|
378
|
-
},
|
|
379
|
-
"predictions": [
|
|
380
|
-
{
|
|
381
|
-
"type": "imminent_exploitation_risk",
|
|
382
|
-
"severity": "CRITICAL",
|
|
383
|
-
"description": "In our experience, public SQL injection vulnerabilities are exploited within hours of discovery",
|
|
384
|
-
"affected_endpoints": ["api.py:42"],
|
|
385
|
-
"prevention_steps": [
|
|
386
|
-
"Use parameterized queries immediately",
|
|
387
|
-
"Review all database queries for injection",
|
|
388
|
-
"Add input validation",
|
|
389
|
-
"Enable SQL query logging for detection"
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
]
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
#### Endpoint Configuration
|
|
397
|
-
|
|
398
|
-
Help the wizard assess exploitability by providing endpoint context:
|
|
30
|
+
from empathy_os.workflows import BugPredictWorkflow
|
|
399
31
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
'src/api.py': {
|
|
403
|
-
'endpoint_public': True # Publicly accessible
|
|
404
|
-
},
|
|
405
|
-
'src/admin.py': {
|
|
406
|
-
'endpoint_public': False, # Requires authentication
|
|
407
|
-
'requires_auth': True
|
|
408
|
-
},
|
|
409
|
-
'src/internal.py': {
|
|
410
|
-
'endpoint_public': False, # Internal only
|
|
411
|
-
'internal_only': True
|
|
412
|
-
}
|
|
413
|
-
}
|
|
32
|
+
workflow = BugPredictWorkflow()
|
|
33
|
+
result = await workflow.execute(target_path="./src")
|
|
414
34
|
```
|
|
415
35
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
- Before deployment (security gate)
|
|
419
|
-
- After adding new endpoints (vulnerability scan)
|
|
420
|
-
- Code review (identify security issues)
|
|
421
|
-
- Compliance audits (demonstrate security practices)
|
|
422
|
-
- Penetration testing preparation (find issues first)
|
|
423
|
-
|
|
424
|
-
## Integration: Using All Three Wizards
|
|
425
|
-
|
|
426
|
-
The wizards are designed to work together. Here's a complete pre-deployment workflow:
|
|
427
|
-
|
|
428
|
-
```python
|
|
429
|
-
from empathy_software_plugin.wizards.enhanced_testing_wizard import EnhancedTestingWizard
|
|
430
|
-
from empathy_software_plugin.wizards.performance_profiling_wizard import PerformanceProfilingWizard
|
|
431
|
-
from empathy_software_plugin.wizards.security_analysis_wizard import SecurityAnalysisWizard
|
|
432
|
-
|
|
433
|
-
async def pre_deployment_check(project_path, source_files, test_files, profile_data, endpoint_config):
|
|
434
|
-
"""
|
|
435
|
-
Run all three wizards before deployment.
|
|
436
|
-
Returns True if deployment is safe, False if blockers found.
|
|
437
|
-
"""
|
|
438
|
-
|
|
439
|
-
# Initialize wizards
|
|
440
|
-
testing_wizard = EnhancedTestingWizard()
|
|
441
|
-
performance_wizard = PerformanceProfilingWizard()
|
|
442
|
-
security_wizard = SecurityAnalysisWizard()
|
|
36
|
+
## Migration Guide
|
|
443
37
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
'endpoint_config': endpoint_config
|
|
450
|
-
})
|
|
451
|
-
|
|
452
|
-
# Run test coverage analysis
|
|
453
|
-
print("Step 2/3: Test coverage analysis...")
|
|
454
|
-
testing_result = await testing_wizard.analyze({
|
|
455
|
-
'source_files': source_files,
|
|
456
|
-
'test_files': test_files,
|
|
457
|
-
'project_path': project_path
|
|
458
|
-
})
|
|
459
|
-
|
|
460
|
-
# Run performance analysis
|
|
461
|
-
print("Step 3/3: Performance analysis...")
|
|
462
|
-
performance_result = await performance_wizard.analyze({
|
|
463
|
-
'profiler_data': profile_data,
|
|
464
|
-
'profiler_type': 'simple_json'
|
|
465
|
-
})
|
|
466
|
-
|
|
467
|
-
# Collect deployment blockers
|
|
468
|
-
blockers = []
|
|
469
|
-
|
|
470
|
-
# Check for IMMEDIATE security issues
|
|
471
|
-
for assessment in security_result['exploitability_assessments']:
|
|
472
|
-
if 'IMMEDIATE' in assessment['mitigation_urgency']:
|
|
473
|
-
blockers.append({
|
|
474
|
-
'type': 'security',
|
|
475
|
-
'severity': 'CRITICAL',
|
|
476
|
-
'description': f"{assessment['vulnerability']['name']} in {assessment['vulnerability']['file_path']}",
|
|
477
|
-
'action': assessment['vulnerability']['example_fix']
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
# Check for critical untested code
|
|
481
|
-
for gap in testing_result['high_risk_gaps']:
|
|
482
|
-
if gap['risk_level'] == 'CRITICAL':
|
|
483
|
-
blockers.append({
|
|
484
|
-
'type': 'testing',
|
|
485
|
-
'severity': 'HIGH',
|
|
486
|
-
'description': f"Untested {gap['risk_category']} code: {gap['function_name']}",
|
|
487
|
-
'action': f"Add tests covering {gap['function_name']}"
|
|
488
|
-
})
|
|
489
|
-
|
|
490
|
-
# Check for critical performance issues
|
|
491
|
-
for bottleneck in performance_result['bottlenecks']:
|
|
492
|
-
if bottleneck['severity'] == 'CRITICAL':
|
|
493
|
-
blockers.append({
|
|
494
|
-
'type': 'performance',
|
|
495
|
-
'severity': 'HIGH',
|
|
496
|
-
'description': f"{bottleneck['type']} in {bottleneck['function_name']}",
|
|
497
|
-
'action': bottleneck['fix_suggestion']
|
|
498
|
-
})
|
|
499
|
-
|
|
500
|
-
# Print results
|
|
501
|
-
if blockers:
|
|
502
|
-
print(f"\n❌ DEPLOYMENT BLOCKED - {len(blockers)} critical issues found:\n")
|
|
503
|
-
for i, blocker in enumerate(blockers, 1):
|
|
504
|
-
print(f"{i}. [{blocker['type'].upper()}] {blocker['description']}")
|
|
505
|
-
print(f" Action: {blocker['action']}\n")
|
|
506
|
-
return False
|
|
507
|
-
else:
|
|
508
|
-
print("\n✅ DEPLOYMENT APPROVED - No blocking issues found")
|
|
509
|
-
print("\nRecommendations for future sprints:")
|
|
510
|
-
for rec in testing_result['recommendations'][:3]:
|
|
511
|
-
print(f" - {rec}")
|
|
512
|
-
return True
|
|
513
|
-
|
|
514
|
-
# Usage
|
|
515
|
-
deployment_safe = await pre_deployment_check(
|
|
516
|
-
project_path='/path/to/project',
|
|
517
|
-
source_files=['src/api.py', 'src/auth.py'],
|
|
518
|
-
test_files=['tests/test_api.py'],
|
|
519
|
-
profile_data=profiler_output,
|
|
520
|
-
endpoint_config={
|
|
521
|
-
'src/api.py': {'endpoint_public': True},
|
|
522
|
-
'src/auth.py': {'endpoint_public': False}
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
|
|
526
|
-
if not deployment_safe:
|
|
527
|
-
exit(1) # Block CI/CD pipeline
|
|
528
|
-
```
|
|
38
|
+
| Old Wizard | New Approach |
|
|
39
|
+
|------------|--------------|
|
|
40
|
+
| `EnhancedTestingWizard` | `empathy workflow run test-coverage` |
|
|
41
|
+
| `PerformanceProfilingWizard` | `empathy workflow run profile` |
|
|
42
|
+
| `SecurityAnalysisWizard` | `empathy workflow run security-audit` |
|
|
529
43
|
|
|
530
44
|
## Installation
|
|
531
45
|
|
|
532
|
-
The Software Development Plugin is part of the Empathy Framework:
|
|
533
|
-
|
|
534
46
|
```bash
|
|
535
47
|
pip install empathy-framework
|
|
536
|
-
|
|
537
|
-
# Or install from source
|
|
538
|
-
git clone https://github.com/deepstudyai/empathy
|
|
539
|
-
cd empathy
|
|
540
|
-
pip install -e .
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
## Examples
|
|
544
|
-
|
|
545
|
-
Complete examples are in [`examples/`](../examples/):
|
|
546
|
-
|
|
547
|
-
- [`testing_demo.py`](../examples/testing_demo.py) - Enhanced Testing Wizard demo
|
|
548
|
-
- [`performance_demo.py`](../examples/performance_demo.py) - Performance Profiling Wizard demo
|
|
549
|
-
- [`security_demo.py`](../examples/security_demo.py) - Security Analysis Wizard demo
|
|
550
|
-
- [`software_plugin_complete_demo.py`](../examples/software_plugin_complete_demo.py) - All wizards working together
|
|
551
|
-
|
|
552
|
-
Run any demo:
|
|
553
|
-
|
|
554
|
-
```bash
|
|
555
|
-
python examples/testing_demo.py
|
|
556
|
-
python examples/performance_demo.py
|
|
557
|
-
python examples/security_demo.py
|
|
558
|
-
python examples/software_plugin_complete_demo.py
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
## Testing
|
|
562
|
-
|
|
563
|
-
Comprehensive test suite in [`tests/`](../tests/):
|
|
564
|
-
|
|
565
|
-
```bash
|
|
566
|
-
# Run all Software Plugin tests
|
|
567
|
-
pytest tests/test_enhanced_testing.py -v
|
|
568
|
-
pytest tests/test_performance_wizard.py -v
|
|
569
|
-
pytest tests/test_security_wizard.py -v
|
|
570
|
-
pytest tests/test_software_integration.py -v
|
|
571
|
-
|
|
572
|
-
# Run all tests
|
|
573
|
-
pytest tests/ -v
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
## Architecture
|
|
577
|
-
|
|
578
|
-
Each wizard follows the same Level 4 Anticipatory pattern:
|
|
579
|
-
|
|
580
|
-
```
|
|
581
|
-
1. Current State Analysis
|
|
582
|
-
↓
|
|
583
|
-
2. Historical Trend Analysis
|
|
584
|
-
↓
|
|
585
|
-
3. Rate of Change Calculation
|
|
586
|
-
↓
|
|
587
|
-
4. Future State Prediction
|
|
588
|
-
↓
|
|
589
|
-
5. Time to Critical Threshold
|
|
590
|
-
↓
|
|
591
|
-
6. Preventive Recommendations
|
|
592
48
|
```
|
|
593
49
|
|
|
594
|
-
### Standardized Data Formats
|
|
595
|
-
|
|
596
|
-
All wizards use standardized dataclasses for consistency:
|
|
597
|
-
|
|
598
|
-
```python
|
|
599
|
-
# Performance
|
|
600
|
-
@dataclass
|
|
601
|
-
class FunctionProfile:
|
|
602
|
-
function_name: str
|
|
603
|
-
file_path: str
|
|
604
|
-
line_number: int
|
|
605
|
-
total_time: float
|
|
606
|
-
call_count: int
|
|
607
|
-
percent_total: float
|
|
608
|
-
|
|
609
|
-
# Security
|
|
610
|
-
@dataclass
|
|
611
|
-
class Vulnerability:
|
|
612
|
-
category: str # OWASP category
|
|
613
|
-
name: str
|
|
614
|
-
severity: str
|
|
615
|
-
file_path: str
|
|
616
|
-
line_number: int
|
|
617
|
-
|
|
618
|
-
# Testing
|
|
619
|
-
@dataclass
|
|
620
|
-
class TestGap:
|
|
621
|
-
file_path: str
|
|
622
|
-
function_name: str
|
|
623
|
-
risk_category: str
|
|
624
|
-
risk_level: str
|
|
625
|
-
uncovered_lines: List[int]
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
## Best Practices
|
|
629
|
-
|
|
630
|
-
### 1. Run Security Wizard First
|
|
631
|
-
|
|
632
|
-
Always run security scans before other checks:
|
|
633
|
-
|
|
634
|
-
```python
|
|
635
|
-
# ✅ Good
|
|
636
|
-
security_result = await security_wizard.analyze(...)
|
|
637
|
-
if security_result['vulnerabilities_found'] > 0:
|
|
638
|
-
# Fix security issues first
|
|
639
|
-
...
|
|
640
|
-
|
|
641
|
-
# ❌ Bad
|
|
642
|
-
# Optimizing performance before fixing security issues
|
|
643
|
-
```
|
|
644
|
-
|
|
645
|
-
### 2. Provide Historical Metrics
|
|
646
|
-
|
|
647
|
-
For best predictions, provide historical data:
|
|
648
|
-
|
|
649
|
-
```python
|
|
650
|
-
# ✅ Good
|
|
651
|
-
historical_metrics = load_metrics_from_monitoring()
|
|
652
|
-
result = await performance_wizard.analyze({
|
|
653
|
-
'profiler_data': current_profile,
|
|
654
|
-
'historical_metrics': historical_metrics # Enables trajectory analysis
|
|
655
|
-
})
|
|
656
|
-
|
|
657
|
-
# ❌ Bad
|
|
658
|
-
result = await performance_wizard.analyze({
|
|
659
|
-
'profiler_data': current_profile
|
|
660
|
-
# No historical data = no trajectory prediction
|
|
661
|
-
})
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
### 3. Configure Endpoint Accessibility
|
|
665
|
-
|
|
666
|
-
Help the security wizard prioritize:
|
|
667
|
-
|
|
668
|
-
```python
|
|
669
|
-
# ✅ Good
|
|
670
|
-
endpoint_config = {
|
|
671
|
-
'api.py': {'endpoint_public': True}, # Public = high priority
|
|
672
|
-
'admin.py': {'endpoint_public': False} # Internal = lower priority
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
# ❌ Bad
|
|
676
|
-
endpoint_config = {} # Wizard can't assess exploitability
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
### 4. Test High-Risk Code First
|
|
680
|
-
|
|
681
|
-
Focus testing efforts based on wizard recommendations:
|
|
682
|
-
|
|
683
|
-
```python
|
|
684
|
-
testing_result = await testing_wizard.analyze(...)
|
|
685
|
-
|
|
686
|
-
# Prioritize by risk level
|
|
687
|
-
critical_gaps = [gap for gap in testing_result['high_risk_gaps']
|
|
688
|
-
if gap['risk_level'] == 'CRITICAL']
|
|
689
|
-
|
|
690
|
-
for gap in critical_gaps:
|
|
691
|
-
# Write tests for critical gaps first
|
|
692
|
-
write_tests_for(gap['function_name'])
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
## Experience-Based Messaging
|
|
696
|
-
|
|
697
|
-
All wizards use "in our experience" framing rather than specific predictions:
|
|
698
|
-
|
|
699
|
-
✅ **Good:**
|
|
700
|
-
- "In our experience, untested authentication code leads to security vulnerabilities"
|
|
701
|
-
- "In our experience, this pattern leads to timeout errors under load"
|
|
702
|
-
- "In our experience, publicly accessible SQL injection is exploited within hours"
|
|
703
|
-
|
|
704
|
-
❌ **Bad:**
|
|
705
|
-
- "This will cause a bug"
|
|
706
|
-
- "Performance will degrade by 50%"
|
|
707
|
-
- "You will be hacked"
|
|
708
|
-
|
|
709
|
-
This approach:
|
|
710
|
-
- Sets appropriate expectations
|
|
711
|
-
- Acknowledges uncertainty
|
|
712
|
-
- Shares genuine insight from experience
|
|
713
|
-
- Avoids over-promising
|
|
714
|
-
|
|
715
50
|
## Support
|
|
716
51
|
|
|
717
|
-
- **Documentation:** [
|
|
52
|
+
- **Documentation:** [docs/](../docs/)
|
|
718
53
|
- **Issues:** [GitHub Issues](https://github.com/deepstudyai/empathy/issues)
|
|
719
|
-
- **Examples:** [examples/](../examples/)
|
|
720
54
|
|
|
721
55
|
## License
|
|
722
56
|
|
|
723
|
-
Copyright 2025 Smart AI Memory, LLC
|
|
724
|
-
|
|
725
|
-
Licensed under Fair Source 0.9 (the "License");
|
|
726
|
-
you may not use this file except in compliance with the License.
|
|
727
|
-
You may obtain a copy of the License at
|
|
728
|
-
|
|
729
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
730
|
-
|
|
731
|
-
Unless required by applicable law or agreed to in writing, software
|
|
732
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
733
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
734
|
-
See the License for the specific language governing permissions and
|
|
735
|
-
limitations under the License.
|
|
57
|
+
Copyright 2025-2026 Smart AI Memory, LLC - Licensed under Fair Source 0.9
|