ref-agents 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ref_agents/__init__.py +9 -0
- ref_agents/api_keys.json.example +8 -0
- ref_agents/auth.py +129 -0
- ref_agents/codemap/..md +62 -0
- ref_agents/codemap/CODE_MAP.md +37 -0
- ref_agents/codemap/core.md +43 -0
- ref_agents/codemap/models.md +43 -0
- ref_agents/codemap/prompts.md +40 -0
- ref_agents/codemap/security.md +45 -0
- ref_agents/codemap/tools.md +94 -0
- ref_agents/codemap/tools_browser.md +44 -0
- ref_agents/codemap/utils.md +42 -0
- ref_agents/codemap/workflow.md +42 -0
- ref_agents/config/ai_patterns.yaml +101 -0
- ref_agents/config/frameworks/angular.yaml +104 -0
- ref_agents/config/frameworks/aspnet.yaml +84 -0
- ref_agents/config/frameworks/ef_core.yaml +81 -0
- ref_agents/config/frameworks/react.yaml +111 -0
- ref_agents/config/frameworks/spring_boot.yaml +117 -0
- ref_agents/config/languages/csharp.yaml +153 -0
- ref_agents/config/languages/java.yaml +188 -0
- ref_agents/config/languages/javascript.yaml +172 -0
- ref_agents/config/languages/python.yaml +153 -0
- ref_agents/config/languages/typescript.yaml +193 -0
- ref_agents/constants.py +553 -0
- ref_agents/core/__init__.py +15 -0
- ref_agents/core/config_loader.py +160 -0
- ref_agents/core/config_models.py +167 -0
- ref_agents/core/config_parsing.py +84 -0
- ref_agents/core/language_detector.py +388 -0
- ref_agents/core/validation_models.py +66 -0
- ref_agents/core/validation_primitives.py +176 -0
- ref_agents/errors.py +34 -0
- ref_agents/license_client.py +247 -0
- ref_agents/models/__init__.py +22 -0
- ref_agents/models/gherkin.py +45 -0
- ref_agents/models/hierarchy.py +80 -0
- ref_agents/models/invest.py +59 -0
- ref_agents/models/version.py +49 -0
- ref_agents/prompts/__init__.py +9 -0
- ref_agents/prompts/start_agent.py +772 -0
- ref_agents/rules/architecture/backend_patterns.md +43 -0
- ref_agents/rules/architecture/diagramming.md +100 -0
- ref_agents/rules/architecture/frontend_patterns.md +40 -0
- ref_agents/rules/architecture/impact_analysis.md +129 -0
- ref_agents/rules/architecture/migration_strategy.md +208 -0
- ref_agents/rules/architecture/regression_protocol.md +77 -0
- ref_agents/rules/architecture/system_design.md +97 -0
- ref_agents/rules/common/codemap_standard.md +97 -0
- ref_agents/rules/common/core_protocol.md +59 -0
- ref_agents/rules/common/prompt_engineering.md +294 -0
- ref_agents/rules/development/debugging.md +32 -0
- ref_agents/rules/development/implementation.md +205 -0
- ref_agents/rules/operations/completion.md +119 -0
- ref_agents/rules/operations/cutover_protocol.md +218 -0
- ref_agents/rules/operations/discovery.md +179 -0
- ref_agents/rules/operations/fix_workflow.md +87 -0
- ref_agents/rules/operations/forensics.md +278 -0
- ref_agents/rules/operations/platform.md +263 -0
- ref_agents/rules/operations/synchronous_flow.md +25 -0
- ref_agents/rules/product/ac_validation.md +25 -0
- ref_agents/rules/product/brainstorming.md +27 -0
- ref_agents/rules/product/ref_flow.md +101 -0
- ref_agents/rules/product/requirements_std.md +114 -0
- ref_agents/rules/product/spec_writing.md +235 -0
- ref_agents/rules/product/strategy.md +96 -0
- ref_agents/rules/quality/documentation_standards.md +46 -0
- ref_agents/rules/quality/parity_testing.md +234 -0
- ref_agents/rules/quality/project_documentation.md +56 -0
- ref_agents/rules/quality/qa_lead.md +111 -0
- ref_agents/rules/quality/test_design.md +146 -0
- ref_agents/rules/quality/testing_standards.md +293 -0
- ref_agents/rules/review/pr_review.md +116 -0
- ref_agents/rules/security/security_audit.md +83 -0
- ref_agents/security/__init__.py +22 -0
- ref_agents/security/dependency_audit.py +188 -0
- ref_agents/security/file_audit.py +208 -0
- ref_agents/security/network_scan.py +179 -0
- ref_agents/security/report_generator.py +313 -0
- ref_agents/security/secret_scan.py +252 -0
- ref_agents/security/url_scan.py +240 -0
- ref_agents/security_scan.py +236 -0
- ref_agents/server.py +1586 -0
- ref_agents/session.py +100 -0
- ref_agents/tool_names.py +55 -0
- ref_agents/tools/__init__.py +8 -0
- ref_agents/tools/agents_generator.py +315 -0
- ref_agents/tools/ai_pattern_detector.py +815 -0
- ref_agents/tools/brownfield_populator.py +529 -0
- ref_agents/tools/browser/__init__.py +50 -0
- ref_agents/tools/browser/evidence_verifier.py +302 -0
- ref_agents/tools/browser/execution_logger.py +249 -0
- ref_agents/tools/browser/playwright_mcp_client.py +259 -0
- ref_agents/tools/browser/screenshot_utils.py +184 -0
- ref_agents/tools/browser/test_executor.py +537 -0
- ref_agents/tools/code_quality_scanner.py +629 -0
- ref_agents/tools/codemap/..md +93 -0
- ref_agents/tools/codemap/CODE_MAP.md +30 -0
- ref_agents/tools/codemap/browser.md +44 -0
- ref_agents/tools/codemap.py +403 -0
- ref_agents/tools/codemap_freshness.py +234 -0
- ref_agents/tools/comment_smell_scanner.py +346 -0
- ref_agents/tools/complexity.py +436 -0
- ref_agents/tools/complexity_ast.py +333 -0
- ref_agents/tools/compliance.py +246 -0
- ref_agents/tools/compliance_remediation.py +846 -0
- ref_agents/tools/context_graph.py +839 -0
- ref_agents/tools/context_manager.py +550 -0
- ref_agents/tools/context_tools.py +121 -0
- ref_agents/tools/cross_repo_linker.py +393 -0
- ref_agents/tools/dead_code_scanner.py +637 -0
- ref_agents/tools/debt_scanner.py +1092 -0
- ref_agents/tools/dependency_graph.py +272 -0
- ref_agents/tools/discovery_audit.py +372 -0
- ref_agents/tools/docs_scanner.py +600 -0
- ref_agents/tools/evaluate_gate.py +119 -0
- ref_agents/tools/external_detector.py +524 -0
- ref_agents/tools/features_generator.py +282 -0
- ref_agents/tools/flow_gap_detector.py +373 -0
- ref_agents/tools/flow_mapper.py +327 -0
- ref_agents/tools/full_suite_runner.py +740 -0
- ref_agents/tools/gherkin_parser.py +227 -0
- ref_agents/tools/guard_tools.py +139 -0
- ref_agents/tools/handoff_tools.py +282 -0
- ref_agents/tools/health_scanner.py +1211 -0
- ref_agents/tools/hierarchy_manager.py +289 -0
- ref_agents/tools/invest_scorer.py +249 -0
- ref_agents/tools/jira_confluence_export.py +306 -0
- ref_agents/tools/json_output.py +76 -0
- ref_agents/tools/migration_mapper.py +946 -0
- ref_agents/tools/migration_readiness_scanner.py +209 -0
- ref_agents/tools/pattern_learner.py +522 -0
- ref_agents/tools/report_utils.py +155 -0
- ref_agents/tools/requirements_serializer.py +225 -0
- ref_agents/tools/security_audit_tool.py +106 -0
- ref_agents/tools/sequencing_engine.py +288 -0
- ref_agents/tools/summary_generator.py +275 -0
- ref_agents/tools/symbol_resolver.py +306 -0
- ref_agents/tools/symbol_smoke_runner.py +336 -0
- ref_agents/tools/test_plan_validator.py +189 -0
- ref_agents/tools/test_smell_walker.py +902 -0
- ref_agents/tools/tier1_fixer.py +502 -0
- ref_agents/tools/validators/__init__.py +419 -0
- ref_agents/tools/validators/architect.py +268 -0
- ref_agents/tools/validators/cutover_engineer.py +167 -0
- ref_agents/tools/validators/developer.py +180 -0
- ref_agents/tools/validators/discovery.py +150 -0
- ref_agents/tools/validators/forensic_engineer.py +191 -0
- ref_agents/tools/validators/impact_architect.py +181 -0
- ref_agents/tools/validators/migration_planner.py +166 -0
- ref_agents/tools/validators/parity_tester.py +155 -0
- ref_agents/tools/validators/platform_engineer.py +134 -0
- ref_agents/tools/validators/pr_reviewer.py +129 -0
- ref_agents/tools/validators/product_manager.py +291 -0
- ref_agents/tools/validators/qa_lead.py +172 -0
- ref_agents/tools/validators/scrum_master.py +212 -0
- ref_agents/tools/validators/security_owner.py +162 -0
- ref_agents/tools/validators/specifier.py +134 -0
- ref_agents/tools/validators/strategist.py +149 -0
- ref_agents/tools/validators/tester.py +121 -0
- ref_agents/tools/version_manager.py +202 -0
- ref_agents/tools/workflow_tools.py +1549 -0
- ref_agents/utils/__init__.py +21 -0
- ref_agents/utils/git_utils.py +351 -0
- ref_agents/utils/handoff_logger.py +368 -0
- ref_agents/utils/ignore_matcher.py +270 -0
- ref_agents/workflow/__init__.py +19 -0
- ref_agents/workflow/capabilities.py +328 -0
- ref_agents/workflow/state_machine.py +708 -0
- ref_agents/workflow/transitions.py +658 -0
- ref_agents-1.0.0.dist-info/METADATA +365 -0
- ref_agents-1.0.0.dist-info/RECORD +175 -0
- ref_agents-1.0.0.dist-info/WHEEL +4 -0
- ref_agents-1.0.0.dist-info/entry_points.txt +2 -0
- ref_agents-1.0.0.dist-info/licenses/LICENSE +115 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""Migration readiness assessment scanner.
|
|
2
|
+
|
|
3
|
+
Aggregates per-module composite scores from health_report.json without
|
|
4
|
+
re-running full discovery or activating migration mode.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
from ref_agents.tools.migration_readiness_scanner import scan_migration_readiness
|
|
8
|
+
report = scan_migration_readiness("/path/to/project")
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
from datetime import datetime, timezone
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
import structlog
|
|
18
|
+
|
|
19
|
+
from ref_agents.tools.migration_mapper import MigrationMapper, ModuleAssessment
|
|
20
|
+
|
|
21
|
+
logger = structlog.get_logger(__name__)
|
|
22
|
+
|
|
23
|
+
_HEALTH_REPORT_PATH = Path("ref-reports") / "platform_engineer" / "health_report.json"
|
|
24
|
+
|
|
25
|
+
_RISK_ORDER: dict[str, int] = {"CRITICAL": 4, "HIGH": 3, "MEDIUM": 2, "LOW": 1}
|
|
26
|
+
|
|
27
|
+
_WARNING_NO_REPORT = (
|
|
28
|
+
"⚠️ Warning: health_report.json not found.\n"
|
|
29
|
+
'Run scan(target="health", directory=".") first to generate scanner data.\n'
|
|
30
|
+
"Returning empty assessment."
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _load_health_report(directory: Path) -> dict | None:
|
|
35
|
+
"""Load health_report.json from ref-reports/platform_engineer/.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
directory: Project root directory.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Parsed JSON dict or None if not found or invalid.
|
|
42
|
+
"""
|
|
43
|
+
report_path = directory / _HEALTH_REPORT_PATH
|
|
44
|
+
if not report_path.exists():
|
|
45
|
+
logger.debug("health_report_not_found", path=str(report_path))
|
|
46
|
+
return None
|
|
47
|
+
try:
|
|
48
|
+
return json.loads(report_path.read_text(encoding="utf-8"))
|
|
49
|
+
except (json.JSONDecodeError, OSError) as exc:
|
|
50
|
+
logger.warning(
|
|
51
|
+
"health_report_load_failed", path=str(report_path), error=str(exc)
|
|
52
|
+
)
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _compute_overall_risk(assessments: list[ModuleAssessment]) -> str:
|
|
57
|
+
"""Return worst risk level across all assessed modules.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
assessments: Module assessments from MigrationMapper.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
"CRITICAL" | "HIGH" | "MEDIUM" | "LOW" — worst risk found, or "LOW" if empty.
|
|
64
|
+
"""
|
|
65
|
+
if not assessments:
|
|
66
|
+
return "LOW"
|
|
67
|
+
return max(
|
|
68
|
+
(a.risk for a in assessments if not a.unknown),
|
|
69
|
+
key=lambda r: _RISK_ORDER.get(r, 0),
|
|
70
|
+
default="LOW",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _write_outputs(
|
|
75
|
+
directory: Path,
|
|
76
|
+
assessments: list[ModuleAssessment],
|
|
77
|
+
overall_risk: str,
|
|
78
|
+
) -> tuple[Path, Path]:
|
|
79
|
+
"""Write migration_readiness.md and migration_readiness.json to ref-reports/.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
directory: Project root directory.
|
|
83
|
+
assessments: Module assessments from MigrationMapper.
|
|
84
|
+
overall_risk: Overall project risk level string.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Tuple of (md_path, json_path).
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
OSError: If file write fails.
|
|
91
|
+
"""
|
|
92
|
+
reports_dir = directory / "ref-reports"
|
|
93
|
+
reports_dir.mkdir(exist_ok=True)
|
|
94
|
+
|
|
95
|
+
md_path = reports_dir / "migration_readiness.md"
|
|
96
|
+
json_path = reports_dir / "migration_readiness.json"
|
|
97
|
+
|
|
98
|
+
timestamp = datetime.now(timezone.utc).isoformat()
|
|
99
|
+
|
|
100
|
+
# --- Markdown ---
|
|
101
|
+
action_counts: dict[str, int] = {}
|
|
102
|
+
for a in assessments:
|
|
103
|
+
action_counts[a.recommended_action] = (
|
|
104
|
+
action_counts.get(a.recommended_action, 0) + 1
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
lines = [
|
|
108
|
+
"# Migration Readiness Report",
|
|
109
|
+
"",
|
|
110
|
+
f"**Generated:** {timestamp}",
|
|
111
|
+
f"**Directory:** {directory}",
|
|
112
|
+
f"**Modules assessed:** {len(assessments)}",
|
|
113
|
+
"",
|
|
114
|
+
"## Module Scores",
|
|
115
|
+
"",
|
|
116
|
+
"| Module | Debt | Dead Code | Complexity | Composite | Action | Risk |",
|
|
117
|
+
"|--------|------|-----------|------------|-----------|--------|------|",
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
for a in assessments:
|
|
121
|
+
if a.unknown:
|
|
122
|
+
lines.append(f"| `{a.path}` | — | — | — | — | Unknown | — |")
|
|
123
|
+
else:
|
|
124
|
+
lines.append(
|
|
125
|
+
f"| `{a.path}` | {a.debt_score:.1f} | {a.dead_code_score:.1f} | "
|
|
126
|
+
f"{a.complexity_score:.1f} | **{a.composite_score:.1f}** | "
|
|
127
|
+
f"**{a.recommended_action}** | {a.risk} |"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
lines += [
|
|
131
|
+
"",
|
|
132
|
+
"## Summary",
|
|
133
|
+
"",
|
|
134
|
+
f"- **Migrate:** {action_counts.get('Migrate', 0)} | "
|
|
135
|
+
f"**Rewrite:** {action_counts.get('Rewrite', 0)} | "
|
|
136
|
+
f"**Delete:** {action_counts.get('Delete', 0)} | "
|
|
137
|
+
f"**Keep:** {action_counts.get('Keep', 0)} | "
|
|
138
|
+
f"**Refactor:** {action_counts.get('Refactor', 0)}",
|
|
139
|
+
f"- **Overall risk:** {overall_risk}",
|
|
140
|
+
"",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
md_path.write_text("\n".join(lines), encoding="utf-8")
|
|
144
|
+
|
|
145
|
+
# --- JSON ---
|
|
146
|
+
payload = {
|
|
147
|
+
"schema_version": "1.0",
|
|
148
|
+
"generated_at": timestamp,
|
|
149
|
+
"directory": str(directory),
|
|
150
|
+
"overall_risk": overall_risk,
|
|
151
|
+
"modules": [
|
|
152
|
+
{
|
|
153
|
+
"path": a.path,
|
|
154
|
+
"debt_score": a.debt_score,
|
|
155
|
+
"dead_code_score": a.dead_code_score,
|
|
156
|
+
"complexity_score": a.complexity_score,
|
|
157
|
+
"composite_score": a.composite_score,
|
|
158
|
+
"recommended_action": a.recommended_action,
|
|
159
|
+
"batch": a.batch,
|
|
160
|
+
"risk": a.risk,
|
|
161
|
+
"unknown": a.unknown,
|
|
162
|
+
}
|
|
163
|
+
for a in assessments
|
|
164
|
+
],
|
|
165
|
+
}
|
|
166
|
+
json_path.write_text(json.dumps(payload, indent=2), encoding="utf-8")
|
|
167
|
+
|
|
168
|
+
logger.info(
|
|
169
|
+
"migration_readiness_written",
|
|
170
|
+
md_path=str(md_path),
|
|
171
|
+
json_path=str(json_path),
|
|
172
|
+
modules=len(assessments),
|
|
173
|
+
overall_risk=overall_risk,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
return md_path, json_path
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def scan_migration_readiness(directory: str) -> str:
|
|
180
|
+
"""Run migration readiness assessment for all modules in directory.
|
|
181
|
+
|
|
182
|
+
Reads ref-reports/platform_engineer/health_report.json and produces
|
|
183
|
+
per-module composite scores. Does not run scanners or set session state.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
directory: Project root directory path.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
Markdown-formatted readiness report string, or warning if no health data.
|
|
190
|
+
"""
|
|
191
|
+
root = Path(directory)
|
|
192
|
+
|
|
193
|
+
report = _load_health_report(root)
|
|
194
|
+
if report is None:
|
|
195
|
+
return _WARNING_NO_REPORT
|
|
196
|
+
|
|
197
|
+
mapper = MigrationMapper(directory=root, report=report)
|
|
198
|
+
assessments = mapper.assess_modules()
|
|
199
|
+
overall_risk = _compute_overall_risk(assessments)
|
|
200
|
+
md_path, _ = _write_outputs(root, assessments, overall_risk)
|
|
201
|
+
|
|
202
|
+
logger.info(
|
|
203
|
+
"scan_migration_readiness_complete",
|
|
204
|
+
directory=directory,
|
|
205
|
+
modules=len(assessments),
|
|
206
|
+
overall_risk=overall_risk,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
return md_path.read_text(encoding="utf-8")
|