empathy-framework 3.7.0__py3-none-any.whl → 3.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.
- coach_wizards/code_reviewer_README.md +60 -0
- coach_wizards/code_reviewer_wizard.py +180 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/METADATA +20 -2
- empathy_framework-3.7.1.dist-info/RECORD +327 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/top_level.txt +5 -1
- empathy_healthcare_plugin/monitors/__init__.py +9 -0
- empathy_healthcare_plugin/monitors/clinical_protocol_monitor.py +315 -0
- empathy_healthcare_plugin/monitors/monitoring/__init__.py +44 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_checker.py +300 -0
- empathy_healthcare_plugin/monitors/monitoring/protocol_loader.py +214 -0
- empathy_healthcare_plugin/monitors/monitoring/sensor_parsers.py +306 -0
- empathy_healthcare_plugin/monitors/monitoring/trajectory_analyzer.py +389 -0
- empathy_llm_toolkit/agent_factory/__init__.py +53 -0
- empathy_llm_toolkit/agent_factory/adapters/__init__.py +85 -0
- empathy_llm_toolkit/agent_factory/adapters/autogen_adapter.py +312 -0
- empathy_llm_toolkit/agent_factory/adapters/crewai_adapter.py +454 -0
- empathy_llm_toolkit/agent_factory/adapters/haystack_adapter.py +298 -0
- empathy_llm_toolkit/agent_factory/adapters/langchain_adapter.py +362 -0
- empathy_llm_toolkit/agent_factory/adapters/langgraph_adapter.py +333 -0
- empathy_llm_toolkit/agent_factory/adapters/native.py +228 -0
- empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +426 -0
- empathy_llm_toolkit/agent_factory/base.py +305 -0
- empathy_llm_toolkit/agent_factory/crews/__init__.py +67 -0
- empathy_llm_toolkit/agent_factory/crews/code_review.py +1113 -0
- empathy_llm_toolkit/agent_factory/crews/health_check.py +1246 -0
- empathy_llm_toolkit/agent_factory/crews/refactoring.py +1128 -0
- empathy_llm_toolkit/agent_factory/crews/security_audit.py +1018 -0
- empathy_llm_toolkit/agent_factory/decorators.py +286 -0
- empathy_llm_toolkit/agent_factory/factory.py +558 -0
- empathy_llm_toolkit/agent_factory/framework.py +192 -0
- empathy_llm_toolkit/agent_factory/memory_integration.py +324 -0
- empathy_llm_toolkit/agent_factory/resilient.py +320 -0
- empathy_llm_toolkit/cli/__init__.py +8 -0
- empathy_llm_toolkit/cli/sync_claude.py +487 -0
- empathy_llm_toolkit/code_health.py +150 -3
- empathy_llm_toolkit/config/__init__.py +29 -0
- empathy_llm_toolkit/config/unified.py +295 -0
- empathy_llm_toolkit/routing/__init__.py +32 -0
- empathy_llm_toolkit/routing/model_router.py +362 -0
- empathy_llm_toolkit/security/IMPLEMENTATION_SUMMARY.md +413 -0
- empathy_llm_toolkit/security/PHASE2_COMPLETE.md +384 -0
- empathy_llm_toolkit/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +271 -0
- empathy_llm_toolkit/security/QUICK_REFERENCE.md +316 -0
- empathy_llm_toolkit/security/README.md +262 -0
- empathy_llm_toolkit/security/__init__.py +62 -0
- empathy_llm_toolkit/security/audit_logger.py +929 -0
- empathy_llm_toolkit/security/audit_logger_example.py +152 -0
- empathy_llm_toolkit/security/pii_scrubber.py +640 -0
- empathy_llm_toolkit/security/secrets_detector.py +678 -0
- empathy_llm_toolkit/security/secrets_detector_example.py +304 -0
- empathy_llm_toolkit/security/secure_memdocs.py +1192 -0
- empathy_llm_toolkit/security/secure_memdocs_example.py +278 -0
- empathy_llm_toolkit/wizards/__init__.py +38 -0
- empathy_llm_toolkit/wizards/base_wizard.py +364 -0
- empathy_llm_toolkit/wizards/customer_support_wizard.py +190 -0
- empathy_llm_toolkit/wizards/healthcare_wizard.py +362 -0
- empathy_llm_toolkit/wizards/patient_assessment_README.md +64 -0
- empathy_llm_toolkit/wizards/patient_assessment_wizard.py +193 -0
- empathy_llm_toolkit/wizards/technology_wizard.py +194 -0
- empathy_os/__init__.py +52 -52
- empathy_os/adaptive/__init__.py +13 -0
- empathy_os/adaptive/task_complexity.py +127 -0
- empathy_os/cli.py +118 -8
- empathy_os/cli_unified.py +121 -1
- empathy_os/config/__init__.py +63 -0
- empathy_os/config/xml_config.py +239 -0
- empathy_os/dashboard/__init__.py +15 -0
- empathy_os/dashboard/server.py +743 -0
- empathy_os/memory/__init__.py +195 -0
- empathy_os/memory/claude_memory.py +466 -0
- empathy_os/memory/config.py +224 -0
- empathy_os/memory/control_panel.py +1298 -0
- empathy_os/memory/edges.py +179 -0
- empathy_os/memory/graph.py +567 -0
- empathy_os/memory/long_term.py +1193 -0
- empathy_os/memory/nodes.py +179 -0
- empathy_os/memory/redis_bootstrap.py +540 -0
- empathy_os/memory/security/__init__.py +31 -0
- empathy_os/memory/security/audit_logger.py +930 -0
- empathy_os/memory/security/pii_scrubber.py +640 -0
- empathy_os/memory/security/secrets_detector.py +678 -0
- empathy_os/memory/short_term.py +2119 -0
- empathy_os/memory/storage/__init__.py +15 -0
- empathy_os/memory/summary_index.py +583 -0
- empathy_os/memory/unified.py +619 -0
- empathy_os/metrics/__init__.py +12 -0
- empathy_os/metrics/prompt_metrics.py +190 -0
- empathy_os/models/__init__.py +136 -0
- empathy_os/models/__main__.py +13 -0
- empathy_os/models/cli.py +655 -0
- empathy_os/models/empathy_executor.py +354 -0
- empathy_os/models/executor.py +252 -0
- empathy_os/models/fallback.py +671 -0
- empathy_os/models/provider_config.py +563 -0
- empathy_os/models/registry.py +382 -0
- empathy_os/models/tasks.py +302 -0
- empathy_os/models/telemetry.py +548 -0
- empathy_os/models/token_estimator.py +378 -0
- empathy_os/models/validation.py +274 -0
- empathy_os/monitoring/__init__.py +52 -0
- empathy_os/monitoring/alerts.py +23 -0
- empathy_os/monitoring/alerts_cli.py +268 -0
- empathy_os/monitoring/multi_backend.py +271 -0
- empathy_os/monitoring/otel_backend.py +363 -0
- empathy_os/optimization/__init__.py +19 -0
- empathy_os/optimization/context_optimizer.py +272 -0
- empathy_os/plugins/__init__.py +28 -0
- empathy_os/plugins/base.py +361 -0
- empathy_os/plugins/registry.py +268 -0
- empathy_os/project_index/__init__.py +30 -0
- empathy_os/project_index/cli.py +335 -0
- empathy_os/project_index/crew_integration.py +430 -0
- empathy_os/project_index/index.py +425 -0
- empathy_os/project_index/models.py +501 -0
- empathy_os/project_index/reports.py +473 -0
- empathy_os/project_index/scanner.py +538 -0
- empathy_os/prompts/__init__.py +61 -0
- empathy_os/prompts/config.py +77 -0
- empathy_os/prompts/context.py +177 -0
- empathy_os/prompts/parser.py +285 -0
- empathy_os/prompts/registry.py +313 -0
- empathy_os/prompts/templates.py +208 -0
- empathy_os/resilience/__init__.py +56 -0
- empathy_os/resilience/circuit_breaker.py +256 -0
- empathy_os/resilience/fallback.py +179 -0
- empathy_os/resilience/health.py +300 -0
- empathy_os/resilience/retry.py +209 -0
- empathy_os/resilience/timeout.py +135 -0
- empathy_os/routing/__init__.py +43 -0
- empathy_os/routing/chain_executor.py +433 -0
- empathy_os/routing/classifier.py +217 -0
- empathy_os/routing/smart_router.py +234 -0
- empathy_os/routing/wizard_registry.py +307 -0
- empathy_os/trust/__init__.py +28 -0
- empathy_os/trust/circuit_breaker.py +579 -0
- empathy_os/validation/__init__.py +19 -0
- empathy_os/validation/xml_validator.py +281 -0
- empathy_os/wizard_factory_cli.py +170 -0
- empathy_os/workflows/__init__.py +360 -0
- empathy_os/workflows/base.py +1530 -0
- empathy_os/workflows/bug_predict.py +962 -0
- empathy_os/workflows/code_review.py +960 -0
- empathy_os/workflows/code_review_adapters.py +310 -0
- empathy_os/workflows/code_review_pipeline.py +720 -0
- empathy_os/workflows/config.py +600 -0
- empathy_os/workflows/dependency_check.py +648 -0
- empathy_os/workflows/document_gen.py +1069 -0
- empathy_os/workflows/documentation_orchestrator.py +1205 -0
- empathy_os/workflows/health_check.py +679 -0
- empathy_os/workflows/keyboard_shortcuts/__init__.py +39 -0
- empathy_os/workflows/keyboard_shortcuts/generators.py +386 -0
- empathy_os/workflows/keyboard_shortcuts/parsers.py +414 -0
- empathy_os/workflows/keyboard_shortcuts/prompts.py +295 -0
- empathy_os/workflows/keyboard_shortcuts/schema.py +193 -0
- empathy_os/workflows/keyboard_shortcuts/workflow.py +505 -0
- empathy_os/workflows/manage_documentation.py +804 -0
- empathy_os/workflows/new_sample_workflow1.py +146 -0
- empathy_os/workflows/new_sample_workflow1_README.md +150 -0
- empathy_os/workflows/perf_audit.py +687 -0
- empathy_os/workflows/pr_review.py +748 -0
- empathy_os/workflows/progress.py +445 -0
- empathy_os/workflows/progress_server.py +322 -0
- empathy_os/workflows/refactor_plan.py +691 -0
- empathy_os/workflows/release_prep.py +808 -0
- empathy_os/workflows/research_synthesis.py +404 -0
- empathy_os/workflows/secure_release.py +585 -0
- empathy_os/workflows/security_adapters.py +297 -0
- empathy_os/workflows/security_audit.py +1050 -0
- empathy_os/workflows/step_config.py +234 -0
- empathy_os/workflows/test5.py +125 -0
- empathy_os/workflows/test5_README.md +158 -0
- empathy_os/workflows/test_gen.py +1855 -0
- empathy_os/workflows/test_lifecycle.py +526 -0
- empathy_os/workflows/test_maintenance.py +626 -0
- empathy_os/workflows/test_maintenance_cli.py +590 -0
- empathy_os/workflows/test_maintenance_crew.py +821 -0
- empathy_os/workflows/xml_enhanced_crew.py +285 -0
- empathy_software_plugin/cli/__init__.py +120 -0
- empathy_software_plugin/cli/inspect.py +362 -0
- empathy_software_plugin/cli.py +3 -1
- empathy_software_plugin/wizards/__init__.py +42 -0
- empathy_software_plugin/wizards/advanced_debugging_wizard.py +392 -0
- empathy_software_plugin/wizards/agent_orchestration_wizard.py +511 -0
- empathy_software_plugin/wizards/ai_collaboration_wizard.py +503 -0
- empathy_software_plugin/wizards/ai_context_wizard.py +441 -0
- empathy_software_plugin/wizards/ai_documentation_wizard.py +503 -0
- empathy_software_plugin/wizards/base_wizard.py +288 -0
- empathy_software_plugin/wizards/book_chapter_wizard.py +519 -0
- empathy_software_plugin/wizards/code_review_wizard.py +606 -0
- empathy_software_plugin/wizards/debugging/__init__.py +50 -0
- empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +414 -0
- empathy_software_plugin/wizards/debugging/config_loaders.py +442 -0
- empathy_software_plugin/wizards/debugging/fix_applier.py +469 -0
- empathy_software_plugin/wizards/debugging/language_patterns.py +383 -0
- empathy_software_plugin/wizards/debugging/linter_parsers.py +470 -0
- empathy_software_plugin/wizards/debugging/verification.py +369 -0
- empathy_software_plugin/wizards/enhanced_testing_wizard.py +537 -0
- empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +816 -0
- empathy_software_plugin/wizards/multi_model_wizard.py +501 -0
- empathy_software_plugin/wizards/pattern_extraction_wizard.py +422 -0
- empathy_software_plugin/wizards/pattern_retriever_wizard.py +400 -0
- empathy_software_plugin/wizards/performance/__init__.py +9 -0
- empathy_software_plugin/wizards/performance/bottleneck_detector.py +221 -0
- empathy_software_plugin/wizards/performance/profiler_parsers.py +278 -0
- empathy_software_plugin/wizards/performance/trajectory_analyzer.py +429 -0
- empathy_software_plugin/wizards/performance_profiling_wizard.py +305 -0
- empathy_software_plugin/wizards/prompt_engineering_wizard.py +425 -0
- empathy_software_plugin/wizards/rag_pattern_wizard.py +461 -0
- empathy_software_plugin/wizards/security/__init__.py +32 -0
- empathy_software_plugin/wizards/security/exploit_analyzer.py +290 -0
- empathy_software_plugin/wizards/security/owasp_patterns.py +241 -0
- empathy_software_plugin/wizards/security/vulnerability_scanner.py +604 -0
- empathy_software_plugin/wizards/security_analysis_wizard.py +322 -0
- empathy_software_plugin/wizards/security_learning_wizard.py +740 -0
- empathy_software_plugin/wizards/tech_debt_wizard.py +726 -0
- empathy_software_plugin/wizards/testing/__init__.py +27 -0
- empathy_software_plugin/wizards/testing/coverage_analyzer.py +459 -0
- empathy_software_plugin/wizards/testing/quality_analyzer.py +531 -0
- empathy_software_plugin/wizards/testing/test_suggester.py +533 -0
- empathy_software_plugin/wizards/testing_wizard.py +274 -0
- hot_reload/README.md +473 -0
- hot_reload/__init__.py +62 -0
- hot_reload/config.py +84 -0
- hot_reload/integration.py +228 -0
- hot_reload/reloader.py +298 -0
- hot_reload/watcher.py +179 -0
- hot_reload/websocket.py +176 -0
- scaffolding/README.md +589 -0
- scaffolding/__init__.py +35 -0
- scaffolding/__main__.py +14 -0
- scaffolding/cli.py +240 -0
- test_generator/__init__.py +38 -0
- test_generator/__main__.py +14 -0
- test_generator/cli.py +226 -0
- test_generator/generator.py +325 -0
- test_generator/risk_analyzer.py +216 -0
- workflow_patterns/__init__.py +33 -0
- workflow_patterns/behavior.py +249 -0
- workflow_patterns/core.py +76 -0
- workflow_patterns/output.py +99 -0
- workflow_patterns/registry.py +255 -0
- workflow_patterns/structural.py +288 -0
- workflow_scaffolding/__init__.py +11 -0
- workflow_scaffolding/__main__.py +12 -0
- workflow_scaffolding/cli.py +206 -0
- workflow_scaffolding/generator.py +265 -0
- agents/code_inspection/patterns/inspection/recurring_B112.json +0 -18
- agents/code_inspection/patterns/inspection/recurring_F541.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_FORMAT.json +0 -25
- agents/code_inspection/patterns/inspection/recurring_bug_20250822_def456.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20250915_abc123.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_3c5b9951.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_97c0f72f.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a0871d53.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_20251212_a9b6ec41.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_bug_null_001.json +0 -16
- agents/code_inspection/patterns/inspection/recurring_builtin.json +0 -16
- agents/compliance_anticipation_agent.py +0 -1422
- agents/compliance_db.py +0 -339
- agents/epic_integration_wizard.py +0 -530
- agents/notifications.py +0 -291
- agents/trust_building_behaviors.py +0 -872
- empathy_framework-3.7.0.dist-info/RECORD +0 -105
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/WHEEL +0 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/entry_points.txt +0 -0
- {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/licenses/LICENSE +0 -0
- /empathy_os/{monitoring.py → agent_monitoring.py} +0 -0
scaffolding/cli.py
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"""CLI for wizard scaffolding.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
python -m scaffolding create my_wizard --domain healthcare
|
|
5
|
+
python -m scaffolding create my_wizard --methodology tdd --domain finance
|
|
6
|
+
python -m scaffolding create my_wizard --interactive
|
|
7
|
+
|
|
8
|
+
Copyright 2025 Smart AI Memory, LLC
|
|
9
|
+
Licensed under Fair Source 0.9
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import logging
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
from patterns import get_pattern_registry
|
|
17
|
+
|
|
18
|
+
from .methodologies.pattern_compose import PatternCompose
|
|
19
|
+
from .methodologies.tdd_first import TDDFirst
|
|
20
|
+
|
|
21
|
+
logging.basicConfig(
|
|
22
|
+
level=logging.INFO,
|
|
23
|
+
format="%(levelname)s: %(message)s",
|
|
24
|
+
)
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def cmd_create(args):
|
|
29
|
+
"""Create a new wizard using specified methodology.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
args: Command line arguments
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
wizard_name = args.name
|
|
36
|
+
domain = args.domain or "general"
|
|
37
|
+
wizard_type = args.type or "domain"
|
|
38
|
+
methodology = args.methodology or "pattern"
|
|
39
|
+
|
|
40
|
+
print(f"\n{'=' * 60}")
|
|
41
|
+
print(f"Creating Wizard: {wizard_name}")
|
|
42
|
+
print(f"{'=' * 60}\n")
|
|
43
|
+
print(f"Domain: {domain}")
|
|
44
|
+
print(f"Type: {wizard_type}")
|
|
45
|
+
print(f"Methodology: {methodology}")
|
|
46
|
+
print()
|
|
47
|
+
|
|
48
|
+
# Get pattern recommendations
|
|
49
|
+
registry = get_pattern_registry()
|
|
50
|
+
recommended = registry.recommend_for_wizard(
|
|
51
|
+
wizard_type=wizard_type,
|
|
52
|
+
domain=domain,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
print(f"Recommended Patterns ({len(recommended)}):")
|
|
56
|
+
for i, pattern in enumerate(recommended, 1):
|
|
57
|
+
print(f" {i}. {pattern.name} - {pattern.description[:60]}...")
|
|
58
|
+
|
|
59
|
+
# Pattern selection
|
|
60
|
+
if args.patterns:
|
|
61
|
+
# User provided patterns
|
|
62
|
+
selected_patterns = args.patterns.split(",")
|
|
63
|
+
elif args.interactive:
|
|
64
|
+
# Interactive selection
|
|
65
|
+
print("\nSelect patterns (comma-separated numbers, or 'all' for all):")
|
|
66
|
+
selection = input("> ").strip()
|
|
67
|
+
|
|
68
|
+
if selection.lower() == "all":
|
|
69
|
+
selected_patterns = [p.id for p in recommended]
|
|
70
|
+
else:
|
|
71
|
+
try:
|
|
72
|
+
indices = [int(i.strip()) - 1 for i in selection.split(",")]
|
|
73
|
+
selected_patterns = [recommended[i].id for i in indices]
|
|
74
|
+
except (ValueError, IndexError):
|
|
75
|
+
print("Invalid selection. Using all patterns.")
|
|
76
|
+
selected_patterns = [p.id for p in recommended]
|
|
77
|
+
else:
|
|
78
|
+
# Use all recommended
|
|
79
|
+
selected_patterns = [p.id for p in recommended]
|
|
80
|
+
|
|
81
|
+
print(f"\nUsing {len(selected_patterns)} patterns:")
|
|
82
|
+
for pid in selected_patterns:
|
|
83
|
+
print(f" - {pid}")
|
|
84
|
+
|
|
85
|
+
# Create wizard using selected methodology
|
|
86
|
+
print(f"\nCreating wizard with {methodology} methodology...")
|
|
87
|
+
|
|
88
|
+
if methodology == "pattern":
|
|
89
|
+
method = PatternCompose()
|
|
90
|
+
result = method.create_wizard(
|
|
91
|
+
name=wizard_name,
|
|
92
|
+
domain=domain,
|
|
93
|
+
wizard_type=wizard_type,
|
|
94
|
+
selected_patterns=selected_patterns,
|
|
95
|
+
)
|
|
96
|
+
elif methodology == "tdd":
|
|
97
|
+
method = TDDFirst()
|
|
98
|
+
result = method.create_wizard(
|
|
99
|
+
name=wizard_name,
|
|
100
|
+
domain=domain,
|
|
101
|
+
wizard_type=wizard_type,
|
|
102
|
+
pattern_ids=selected_patterns,
|
|
103
|
+
)
|
|
104
|
+
else:
|
|
105
|
+
print(f"Unknown methodology: {methodology}")
|
|
106
|
+
sys.exit(1)
|
|
107
|
+
|
|
108
|
+
# Display results
|
|
109
|
+
print(f"\n{'=' * 60}")
|
|
110
|
+
print("✅ Wizard Created Successfully!")
|
|
111
|
+
print(f"{'=' * 60}\n")
|
|
112
|
+
|
|
113
|
+
print("Generated Files:")
|
|
114
|
+
for file_path in result["files"]:
|
|
115
|
+
print(f" - {file_path}")
|
|
116
|
+
|
|
117
|
+
print("\nPatterns Used:")
|
|
118
|
+
for pattern_name in result.get("patterns", selected_patterns):
|
|
119
|
+
print(f" - {pattern_name}")
|
|
120
|
+
|
|
121
|
+
print("\nNext Steps:")
|
|
122
|
+
for step in result["next_steps"]:
|
|
123
|
+
print(f" {step}")
|
|
124
|
+
|
|
125
|
+
print()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def cmd_list_patterns(args):
|
|
129
|
+
"""List available patterns.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
args: Command line arguments
|
|
133
|
+
|
|
134
|
+
"""
|
|
135
|
+
registry = get_pattern_registry()
|
|
136
|
+
|
|
137
|
+
print(f"\n{'=' * 60}")
|
|
138
|
+
print("Available Patterns")
|
|
139
|
+
print(f"{'=' * 60}\n")
|
|
140
|
+
|
|
141
|
+
# Group by category
|
|
142
|
+
from patterns.core import PatternCategory
|
|
143
|
+
|
|
144
|
+
for category in PatternCategory:
|
|
145
|
+
patterns = registry.list_by_category(category)
|
|
146
|
+
if not patterns:
|
|
147
|
+
continue
|
|
148
|
+
|
|
149
|
+
print(f"{category.value.upper()} ({len(patterns)} patterns):")
|
|
150
|
+
for pattern in patterns:
|
|
151
|
+
print(
|
|
152
|
+
f" - {pattern.id:25} | {pattern.name:20} | Reusability: {pattern.reusability_score:.2f}"
|
|
153
|
+
)
|
|
154
|
+
print()
|
|
155
|
+
|
|
156
|
+
stats = registry.get_statistics()
|
|
157
|
+
print(f"Total: {stats['total_patterns']} patterns")
|
|
158
|
+
print(f"Average Reusability: {stats['average_reusability']:.2f}")
|
|
159
|
+
print()
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def main():
|
|
163
|
+
"""Main CLI entry point."""
|
|
164
|
+
parser = argparse.ArgumentParser(
|
|
165
|
+
description="Wizard Scaffolding for Empathy Framework",
|
|
166
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
167
|
+
epilog="""
|
|
168
|
+
Examples:
|
|
169
|
+
# Create healthcare wizard (recommended approach)
|
|
170
|
+
%(prog)s create patient_intake --domain healthcare
|
|
171
|
+
|
|
172
|
+
# Create with TDD methodology
|
|
173
|
+
%(prog)s create my_wizard --methodology tdd --domain finance
|
|
174
|
+
|
|
175
|
+
# Interactive pattern selection
|
|
176
|
+
%(prog)s create my_wizard --interactive --domain legal
|
|
177
|
+
|
|
178
|
+
# Specify patterns manually
|
|
179
|
+
%(prog)s create my_wizard --patterns linear_flow,approval,structured_fields
|
|
180
|
+
|
|
181
|
+
# List available patterns
|
|
182
|
+
%(prog)s list-patterns
|
|
183
|
+
""",
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
subparsers = parser.add_subparsers(dest="command", help="Command to run")
|
|
187
|
+
|
|
188
|
+
# Create command
|
|
189
|
+
create_parser = subparsers.add_parser("create", help="Create a new wizard")
|
|
190
|
+
create_parser.add_argument("name", help="Wizard name (e.g., patient_intake)")
|
|
191
|
+
create_parser.add_argument(
|
|
192
|
+
"--domain",
|
|
193
|
+
"-d",
|
|
194
|
+
help="Domain (e.g., healthcare, finance, legal)",
|
|
195
|
+
)
|
|
196
|
+
create_parser.add_argument(
|
|
197
|
+
"--type",
|
|
198
|
+
"-t",
|
|
199
|
+
choices=["domain", "coach", "ai"],
|
|
200
|
+
help="Wizard type (default: domain)",
|
|
201
|
+
)
|
|
202
|
+
create_parser.add_argument(
|
|
203
|
+
"--methodology",
|
|
204
|
+
"-m",
|
|
205
|
+
choices=["pattern", "tdd"],
|
|
206
|
+
help="Methodology (default: pattern)",
|
|
207
|
+
)
|
|
208
|
+
create_parser.add_argument(
|
|
209
|
+
"--patterns",
|
|
210
|
+
"-p",
|
|
211
|
+
help="Comma-separated pattern IDs",
|
|
212
|
+
)
|
|
213
|
+
create_parser.add_argument(
|
|
214
|
+
"--interactive",
|
|
215
|
+
"-i",
|
|
216
|
+
action="store_true",
|
|
217
|
+
help="Interactive pattern selection",
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
# List patterns command
|
|
221
|
+
list_parser = subparsers.add_parser("list-patterns", help="List available patterns")
|
|
222
|
+
|
|
223
|
+
args = parser.parse_args()
|
|
224
|
+
|
|
225
|
+
if not args.command:
|
|
226
|
+
parser.print_help()
|
|
227
|
+
sys.exit(1)
|
|
228
|
+
|
|
229
|
+
# Execute command
|
|
230
|
+
if args.command == "create":
|
|
231
|
+
cmd_create(args)
|
|
232
|
+
elif args.command == "list-patterns":
|
|
233
|
+
cmd_list_patterns(args)
|
|
234
|
+
else:
|
|
235
|
+
parser.print_help()
|
|
236
|
+
sys.exit(1)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
if __name__ == "__main__":
|
|
240
|
+
main()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Risk-Driven Test Generator for Wizard Factory.
|
|
2
|
+
|
|
3
|
+
Generates comprehensive tests for wizards based on risk analysis and patterns.
|
|
4
|
+
|
|
5
|
+
Features:
|
|
6
|
+
- Risk-based test prioritization
|
|
7
|
+
- Pattern-driven test generation
|
|
8
|
+
- Jinja2 templates for unit/integration/E2E tests
|
|
9
|
+
- Fixture generation for common patterns
|
|
10
|
+
- CLI integration
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
from test_generator import TestGenerator
|
|
14
|
+
|
|
15
|
+
generator = TestGenerator()
|
|
16
|
+
tests = generator.generate_tests(
|
|
17
|
+
wizard_id="soap_note",
|
|
18
|
+
pattern_ids=["linear_flow", "approval", "structured_fields"]
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Write tests to file
|
|
22
|
+
with open("test_soap_note.py", "w") as f:
|
|
23
|
+
f.write(tests["unit"])
|
|
24
|
+
|
|
25
|
+
Copyright 2025 Smart AI Memory, LLC
|
|
26
|
+
Licensed under Fair Source 0.9
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from .generator import TestGenerator
|
|
30
|
+
from .risk_analyzer import RiskAnalysis, RiskAnalyzer
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"TestGenerator",
|
|
34
|
+
"RiskAnalyzer",
|
|
35
|
+
"RiskAnalysis",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Make test_generator runnable as a module.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
python -m test_generator generate soap_note --patterns linear_flow,approval
|
|
5
|
+
python -m test_generator analyze debugging --patterns code_analysis_input
|
|
6
|
+
|
|
7
|
+
Copyright 2025 Smart AI Memory, LLC
|
|
8
|
+
Licensed under Fair Source 0.9
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .cli import main
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
main()
|
test_generator/cli.py
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"""CLI for test generator.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
python -m test_generator.cli generate soap_note --patterns linear_flow,approval,structured_fields
|
|
5
|
+
python -m test_generator.cli analyze soap_note --patterns linear_flow,approval
|
|
6
|
+
|
|
7
|
+
Copyright 2025 Smart AI Memory, LLC
|
|
8
|
+
Licensed under Fair Source 0.9
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import logging
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
from .generator import TestGenerator
|
|
18
|
+
from .risk_analyzer import RiskAnalyzer
|
|
19
|
+
|
|
20
|
+
logging.basicConfig(
|
|
21
|
+
level=logging.INFO,
|
|
22
|
+
format="%(levelname)s: %(message)s",
|
|
23
|
+
)
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def cmd_generate(args):
|
|
28
|
+
"""Generate tests for a wizard.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
args: Command line arguments
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
wizard_id = args.wizard_id
|
|
35
|
+
pattern_ids = args.patterns.split(",") if args.patterns else []
|
|
36
|
+
|
|
37
|
+
logger.info(f"Generating tests for wizard: {wizard_id}")
|
|
38
|
+
logger.info(f"Patterns: {', '.join(pattern_ids)}")
|
|
39
|
+
|
|
40
|
+
# Generate tests
|
|
41
|
+
generator = TestGenerator()
|
|
42
|
+
tests = generator.generate_tests(
|
|
43
|
+
wizard_id=wizard_id,
|
|
44
|
+
pattern_ids=pattern_ids,
|
|
45
|
+
wizard_module=args.module,
|
|
46
|
+
wizard_class=args.wizard_class,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Determine output directory
|
|
50
|
+
output_dir = Path(args.output) if args.output else Path("tests/unit/wizards")
|
|
51
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
|
|
53
|
+
# Write unit tests
|
|
54
|
+
unit_test_file = output_dir / f"test_{wizard_id}_wizard.py"
|
|
55
|
+
with open(unit_test_file, "w") as f:
|
|
56
|
+
f.write(tests["unit"])
|
|
57
|
+
logger.info(f"✓ Unit tests written to: {unit_test_file}")
|
|
58
|
+
|
|
59
|
+
# Write integration tests (if generated)
|
|
60
|
+
if tests["integration"]:
|
|
61
|
+
integration_test_file = (
|
|
62
|
+
output_dir.parent.parent / "integration" / f"test_{wizard_id}_integration.py"
|
|
63
|
+
)
|
|
64
|
+
integration_test_file.parent.mkdir(parents=True, exist_ok=True)
|
|
65
|
+
with open(integration_test_file, "w") as f:
|
|
66
|
+
f.write(tests["integration"])
|
|
67
|
+
logger.info(f"✓ Integration tests written to: {integration_test_file}")
|
|
68
|
+
|
|
69
|
+
# Write fixtures
|
|
70
|
+
fixtures_file = output_dir / f"fixtures_{wizard_id}.py"
|
|
71
|
+
with open(fixtures_file, "w") as f:
|
|
72
|
+
f.write(tests["fixtures"])
|
|
73
|
+
logger.info(f"✓ Fixtures written to: {fixtures_file}")
|
|
74
|
+
|
|
75
|
+
print("\n🎉 Test generation complete!")
|
|
76
|
+
print("\nGenerated files:")
|
|
77
|
+
print(f" - {unit_test_file}")
|
|
78
|
+
if tests["integration"]:
|
|
79
|
+
print(f" - {integration_test_file}")
|
|
80
|
+
print(f" - {fixtures_file}")
|
|
81
|
+
|
|
82
|
+
print("\nNext steps:")
|
|
83
|
+
print(" 1. Review generated tests")
|
|
84
|
+
print(f" 2. Run tests: pytest {unit_test_file}")
|
|
85
|
+
print(" 3. Add custom test cases as needed")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def cmd_analyze(args):
|
|
89
|
+
"""Analyze wizard risk and show recommendations.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
args: Command line arguments
|
|
93
|
+
|
|
94
|
+
"""
|
|
95
|
+
wizard_id = args.wizard_id
|
|
96
|
+
pattern_ids = args.patterns.split(",") if args.patterns else []
|
|
97
|
+
|
|
98
|
+
logger.info(f"Analyzing wizard: {wizard_id}")
|
|
99
|
+
|
|
100
|
+
# Perform risk analysis
|
|
101
|
+
analyzer = RiskAnalyzer()
|
|
102
|
+
analysis = analyzer.analyze(wizard_id, pattern_ids)
|
|
103
|
+
|
|
104
|
+
# Display results
|
|
105
|
+
print(f"\n{'=' * 60}")
|
|
106
|
+
print(f"Risk Analysis: {wizard_id}")
|
|
107
|
+
print(f"{'=' * 60}\n")
|
|
108
|
+
|
|
109
|
+
print(f"Patterns Used: {len(analysis.pattern_ids)}")
|
|
110
|
+
for pid in analysis.pattern_ids:
|
|
111
|
+
print(f" - {pid}")
|
|
112
|
+
|
|
113
|
+
print(f"\nCritical Paths: {len(analysis.critical_paths)}")
|
|
114
|
+
for path in analysis.critical_paths:
|
|
115
|
+
print(f" - {path}")
|
|
116
|
+
|
|
117
|
+
print(f"\nHigh-Risk Inputs: {len(analysis.high_risk_inputs)}")
|
|
118
|
+
for input_risk in analysis.high_risk_inputs[:5]: # Top 5
|
|
119
|
+
print(f" - {input_risk}")
|
|
120
|
+
|
|
121
|
+
print(f"\nValidation Points: {len(analysis.validation_points)}")
|
|
122
|
+
for validation in analysis.validation_points[:5]: # Top 5
|
|
123
|
+
print(f" - {validation}")
|
|
124
|
+
|
|
125
|
+
print(f"\n{'=' * 60}")
|
|
126
|
+
print(f"Recommended Test Coverage: {analysis.recommended_coverage}%")
|
|
127
|
+
print(f"{'=' * 60}\n")
|
|
128
|
+
|
|
129
|
+
print("Test Priorities:")
|
|
130
|
+
for test_name, priority in sorted(analysis.test_priorities.items(), key=lambda x: x[1])[:10]:
|
|
131
|
+
priority_label = {
|
|
132
|
+
1: "CRITICAL",
|
|
133
|
+
2: "HIGH",
|
|
134
|
+
3: "MEDIUM",
|
|
135
|
+
4: "LOW",
|
|
136
|
+
5: "OPTIONAL",
|
|
137
|
+
}.get(priority, "UNKNOWN")
|
|
138
|
+
print(f" [{priority_label:8}] {test_name}")
|
|
139
|
+
|
|
140
|
+
# JSON output if requested
|
|
141
|
+
if args.json:
|
|
142
|
+
json_output = analysis.to_dict()
|
|
143
|
+
json_file = Path(f"{wizard_id}_risk_analysis.json")
|
|
144
|
+
with open(json_file, "w") as f:
|
|
145
|
+
json.dump(json_output, f, indent=2)
|
|
146
|
+
print(f"\n✓ JSON output written to: {json_file}")
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def main():
|
|
150
|
+
"""Main CLI entry point."""
|
|
151
|
+
parser = argparse.ArgumentParser(
|
|
152
|
+
description="Test Generator for Empathy Wizard Factory",
|
|
153
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
154
|
+
epilog="""
|
|
155
|
+
Examples:
|
|
156
|
+
# Generate tests for SOAP Note wizard
|
|
157
|
+
%(prog)s generate soap_note --patterns linear_flow,approval,structured_fields
|
|
158
|
+
|
|
159
|
+
# Analyze risk for debugging wizard
|
|
160
|
+
%(prog)s analyze debugging --patterns code_analysis_input,risk_assessment
|
|
161
|
+
|
|
162
|
+
# Generate with custom module/class
|
|
163
|
+
%(prog)s generate my_wizard --patterns linear_flow --module wizards.my_wizard --class MyWizard
|
|
164
|
+
|
|
165
|
+
# Output to custom directory
|
|
166
|
+
%(prog)s generate soap_note --patterns linear_flow --output tests/custom/
|
|
167
|
+
""",
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
subparsers = parser.add_subparsers(dest="command", help="Command to run")
|
|
171
|
+
|
|
172
|
+
# Generate command
|
|
173
|
+
gen_parser = subparsers.add_parser("generate", help="Generate tests for a wizard")
|
|
174
|
+
gen_parser.add_argument("wizard_id", help="Wizard identifier (e.g., soap_note)")
|
|
175
|
+
gen_parser.add_argument(
|
|
176
|
+
"--patterns",
|
|
177
|
+
required=True,
|
|
178
|
+
help="Comma-separated pattern IDs (e.g., linear_flow,approval)",
|
|
179
|
+
)
|
|
180
|
+
gen_parser.add_argument(
|
|
181
|
+
"--module",
|
|
182
|
+
help="Python module path (e.g., wizards.soap_note)",
|
|
183
|
+
)
|
|
184
|
+
gen_parser.add_argument(
|
|
185
|
+
"--class",
|
|
186
|
+
dest="wizard_class",
|
|
187
|
+
help="Wizard class name (e.g., SOAPNoteWizard)",
|
|
188
|
+
)
|
|
189
|
+
gen_parser.add_argument(
|
|
190
|
+
"--output",
|
|
191
|
+
"-o",
|
|
192
|
+
help="Output directory (default: tests/unit/wizards/)",
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
# Analyze command
|
|
196
|
+
analyze_parser = subparsers.add_parser("analyze", help="Analyze wizard risk")
|
|
197
|
+
analyze_parser.add_argument("wizard_id", help="Wizard identifier")
|
|
198
|
+
analyze_parser.add_argument(
|
|
199
|
+
"--patterns",
|
|
200
|
+
required=True,
|
|
201
|
+
help="Comma-separated pattern IDs",
|
|
202
|
+
)
|
|
203
|
+
analyze_parser.add_argument(
|
|
204
|
+
"--json",
|
|
205
|
+
action="store_true",
|
|
206
|
+
help="Output JSON file with analysis results",
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
args = parser.parse_args()
|
|
210
|
+
|
|
211
|
+
if not args.command:
|
|
212
|
+
parser.print_help()
|
|
213
|
+
sys.exit(1)
|
|
214
|
+
|
|
215
|
+
# Execute command
|
|
216
|
+
if args.command == "generate":
|
|
217
|
+
cmd_generate(args)
|
|
218
|
+
elif args.command == "analyze":
|
|
219
|
+
cmd_analyze(args)
|
|
220
|
+
else:
|
|
221
|
+
parser.print_help()
|
|
222
|
+
sys.exit(1)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
if __name__ == "__main__":
|
|
226
|
+
main()
|