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
ref_agents/constants.py
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
"""Status emoji constants for REF Agents output formatting.
|
|
2
|
+
|
|
3
|
+
These emojis provide visual clarity for agent outputs across all MCP clients.
|
|
4
|
+
REF Agents is built on Anthropic's Model Context Protocol (MCP).
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
from ref_agents.constants import Status, Severity, Icons
|
|
8
|
+
|
|
9
|
+
# Status indicators
|
|
10
|
+
f"{Status.SUCCESS} Tests passed" # ✅ Tests passed
|
|
11
|
+
f"{Status.ERROR} Build failed" # ❌ Build failed
|
|
12
|
+
|
|
13
|
+
# Severity levels (for debt, issues, etc.)
|
|
14
|
+
f"{Severity.CRITICAL} Security vulnerability" # 🔴 Critical
|
|
15
|
+
f"{Severity.HIGH} Type hints missing" # 🟠 High
|
|
16
|
+
|
|
17
|
+
# Formatting helpers
|
|
18
|
+
Icons.banner("SECURITY AUDIT") # ═══ SECURITY AUDIT ═══
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from enum import Enum
|
|
22
|
+
from typing import Final
|
|
23
|
+
|
|
24
|
+
# Agents blocked from activating without an active story.
|
|
25
|
+
# These agents produce deliverables that must be traceable to a story.
|
|
26
|
+
STORY_REQUIRED_AGENTS: frozenset[str] = frozenset(
|
|
27
|
+
{
|
|
28
|
+
"developer",
|
|
29
|
+
"architect",
|
|
30
|
+
"pr_reviewer",
|
|
31
|
+
"tester",
|
|
32
|
+
"security_owner",
|
|
33
|
+
"forensic_engineer",
|
|
34
|
+
"specifier",
|
|
35
|
+
"qa_lead",
|
|
36
|
+
"test_designer",
|
|
37
|
+
"scrum_master",
|
|
38
|
+
"impact_architect",
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# Agents exempt from the story gate — they create stories or scan freely.
|
|
43
|
+
STORY_EXEMPT_AGENTS: frozenset[str] = frozenset(
|
|
44
|
+
{
|
|
45
|
+
"discovery",
|
|
46
|
+
"product_manager",
|
|
47
|
+
"strategist",
|
|
48
|
+
"platform_engineer",
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
AVAILABLE_AGENTS: dict[str, str] = {
|
|
53
|
+
"discovery": "Discovery (Phase 0) - Codebase Archaeology",
|
|
54
|
+
"product_manager": "Product Manager (Phase 1) - Requirements & AC",
|
|
55
|
+
"qa_lead": "QA Lead (Phase 2) - AC Validation",
|
|
56
|
+
"specifier": "Specifier (Phase 2.5 / On-Demand) - Technical Specification Authoring",
|
|
57
|
+
"architect": "Architect (Phase 3) - System Design",
|
|
58
|
+
"developer": "Developer (Phase 4) - Implementation",
|
|
59
|
+
"pr_reviewer": "PR Reviewer (Phase 5) - Compliance Check",
|
|
60
|
+
"tester": "Tester (Phase 6) - Verification & E2E",
|
|
61
|
+
"security_owner": "Security Owner (Phase 6) - Vulnerability Audit",
|
|
62
|
+
"scrum_master": "Scrum Master (Phase 7) - Workflow Completion",
|
|
63
|
+
"test_designer": "Test Designer (Parallel) - Conceptual Test Design",
|
|
64
|
+
"impact_architect": "Impact Architect (Phase 3.5) - Pre-Implementation Change Gate",
|
|
65
|
+
"forensic_engineer": "Forensic Engineer (On-Demand) - Incident Investigation",
|
|
66
|
+
"strategist": "Strategist (On-Demand) - Solution Brainstorming",
|
|
67
|
+
"platform_engineer": "Platform Engineer (On-Demand) - DevEx & Health Scanning",
|
|
68
|
+
"migration_planner": "Migration Planner (Phase M1) - Strategy & Roadmap",
|
|
69
|
+
"parity_tester": "Parity Tester (Phase M3) - Behavioral Equivalence Gate",
|
|
70
|
+
"cutover_engineer": "Cutover Engineer (Phase M4) - Feature Flag + Traffic Switch + Rollback",
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class Status:
|
|
75
|
+
"""Status indicator emojis for consistent output formatting."""
|
|
76
|
+
|
|
77
|
+
SUCCESS: Final[str] = "✅"
|
|
78
|
+
WARNING: Final[str] = "⚠️"
|
|
79
|
+
ERROR: Final[str] = "❌"
|
|
80
|
+
HALT: Final[str] = "🛑"
|
|
81
|
+
ESCALATE: Final[str] = "↗️"
|
|
82
|
+
PARALLEL: Final[str] = "⚡"
|
|
83
|
+
INFO: Final[str] = "ℹ️"
|
|
84
|
+
BLOCKED: Final[str] = "🚫"
|
|
85
|
+
DELEGATING: Final[str] = "🔄"
|
|
86
|
+
PASS: Final[str] = "✅ PASS"
|
|
87
|
+
FAIL: Final[str] = "❌ FAIL"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class Severity:
|
|
91
|
+
"""Severity level indicators for issues, debt, and scan results."""
|
|
92
|
+
|
|
93
|
+
CRITICAL: Final[str] = "🔴 Critical"
|
|
94
|
+
HIGH: Final[str] = "🟠 High"
|
|
95
|
+
MEDIUM: Final[str] = "🟡 Medium"
|
|
96
|
+
LOW: Final[str] = "🟢 Low"
|
|
97
|
+
|
|
98
|
+
# Short versions (emoji only)
|
|
99
|
+
CRITICAL_ICON: Final[str] = "🔴"
|
|
100
|
+
HIGH_ICON: Final[str] = "🟠"
|
|
101
|
+
MEDIUM_ICON: Final[str] = "🟡"
|
|
102
|
+
LOW_ICON: Final[str] = "🟢"
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_string(cls, severity: str) -> str:
|
|
106
|
+
"""Convert severity string to formatted constant.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
severity: One of 'critical', 'high', 'medium', 'low'
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Formatted severity string with emoji.
|
|
113
|
+
"""
|
|
114
|
+
mapping = {
|
|
115
|
+
"critical": cls.CRITICAL,
|
|
116
|
+
"high": cls.HIGH,
|
|
117
|
+
"medium": cls.MEDIUM,
|
|
118
|
+
"low": cls.LOW,
|
|
119
|
+
}
|
|
120
|
+
return mapping.get(severity.lower(), cls.MEDIUM)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class Icons:
|
|
124
|
+
"""Box drawing and formatting characters for terminal output."""
|
|
125
|
+
|
|
126
|
+
# Box drawing
|
|
127
|
+
HEAVY_LINE: Final[str] = "═"
|
|
128
|
+
LIGHT_LINE: Final[str] = "─"
|
|
129
|
+
VERTICAL: Final[str] = "│"
|
|
130
|
+
|
|
131
|
+
# Bullet points
|
|
132
|
+
BULLET: Final[str] = "•"
|
|
133
|
+
ARROW: Final[str] = "→"
|
|
134
|
+
CHECK: Final[str] = "✓"
|
|
135
|
+
CROSS: Final[str] = "✗"
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def banner(cls, text: str, width: int = 60) -> str:
|
|
139
|
+
"""Create a centered banner with heavy lines.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
text: Banner text
|
|
143
|
+
width: Total width (default 60)
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Formatted banner string.
|
|
147
|
+
"""
|
|
148
|
+
padding = (width - len(text) - 2) // 2
|
|
149
|
+
return (
|
|
150
|
+
f"{cls.HEAVY_LINE * width}\n{' ' * padding}{text}\n{cls.HEAVY_LINE * width}"
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def header(cls, text: str, width: int = 60) -> str:
|
|
155
|
+
"""Create a section header with light underline.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
text: Header text
|
|
159
|
+
width: Underline width
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Formatted header string.
|
|
163
|
+
"""
|
|
164
|
+
return f"{text}\n{cls.LIGHT_LINE * min(len(text), width)}"
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class EscalationLevel:
|
|
168
|
+
"""Escalation ladder levels."""
|
|
169
|
+
|
|
170
|
+
L1_AUTO: Final[str] = "L1"
|
|
171
|
+
L2_COLLAB: Final[str] = "L2"
|
|
172
|
+
L3_USER: Final[str] = "L3"
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class LogEvent(str, Enum):
|
|
176
|
+
"""Dispatch keys for the log() tool router."""
|
|
177
|
+
|
|
178
|
+
ESCALATION = "escalation"
|
|
179
|
+
OWNERSHIP = "ownership"
|
|
180
|
+
REPLAN = "replan"
|
|
181
|
+
DEBT = "debt"
|
|
182
|
+
PHASE = "phase"
|
|
183
|
+
ARTIFACT = "artifact"
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class ScanTarget(str, Enum):
|
|
187
|
+
"""Dispatch keys for the scan() tool router."""
|
|
188
|
+
|
|
189
|
+
HEALTH = "health"
|
|
190
|
+
DEBT = "debt"
|
|
191
|
+
DEAD_CODE = "dead_code"
|
|
192
|
+
COMPLEXITY = "complexity"
|
|
193
|
+
EXTERNAL = "external"
|
|
194
|
+
REGRESSION = "regression"
|
|
195
|
+
DOCS = "docs"
|
|
196
|
+
AI_PATTERNS = "ai_patterns"
|
|
197
|
+
SECURITY = "security"
|
|
198
|
+
CODEMAP_FRESHNESS = "codemap_freshness"
|
|
199
|
+
MIGRATION_READINESS = "migration_readiness"
|
|
200
|
+
FULL_SUITE = "full_suite"
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class WorkflowDispatchAction(str, Enum):
|
|
204
|
+
"""Dispatch keys for the workflow() tool router.
|
|
205
|
+
|
|
206
|
+
Named WorkflowDispatchAction to avoid collision with server.py WorkflowAction Literal.
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
INIT = "init"
|
|
210
|
+
LIST = "list"
|
|
211
|
+
STATE = "state"
|
|
212
|
+
NEXT = "next"
|
|
213
|
+
PARALLEL_START = "parallel_start"
|
|
214
|
+
PARALLEL_COMPLETE = "parallel_complete"
|
|
215
|
+
FIX_FLOW = "fix_flow"
|
|
216
|
+
COMPLETE_FIX_FLOW = "complete_fix_flow"
|
|
217
|
+
COMPLETE = "complete"
|
|
218
|
+
VALIDATE_STORY_FILE = "validate_story_file"
|
|
219
|
+
VALIDATE_AND_ADVANCE = "validate_and_advance"
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class ContextDispatchAction(str, Enum):
|
|
223
|
+
"""Dispatch keys for the context() tool router.
|
|
224
|
+
|
|
225
|
+
Named ContextDispatchAction to avoid collision with server.py ContextAction Literal.
|
|
226
|
+
"""
|
|
227
|
+
|
|
228
|
+
ADD = "add"
|
|
229
|
+
GET = "get"
|
|
230
|
+
CLEAR = "clear"
|
|
231
|
+
GRAPH_ADD = "graph_add"
|
|
232
|
+
GRAPH_RELATED = "graph_related"
|
|
233
|
+
GRAPH_CHAIN = "graph_chain"
|
|
234
|
+
GRAPH_DATA = "graph_data"
|
|
235
|
+
GRAPH_POPULATE = "graph_populate"
|
|
236
|
+
GRAPH_QUERY = "graph_query"
|
|
237
|
+
GRAPH_SUBGRAPH = "graph_subgraph"
|
|
238
|
+
GRAPH_HTML = "graph_html"
|
|
239
|
+
GRAPH_WATCH = "graph_watch"
|
|
240
|
+
GRAPH_WATCH_STOP = "graph_watch_stop"
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# Convenience constant: max chars for context snippets displayed in reports.
|
|
244
|
+
CONTEXT_SNIPPET_MAX_LEN: int = 100
|
|
245
|
+
|
|
246
|
+
# File extensions scanned by the C5 comment-smell scanner.
|
|
247
|
+
# NOTE: Limited to languages with well-understood comment syntax to avoid
|
|
248
|
+
# false-positive explosions on config/markdown/data files.
|
|
249
|
+
COMMENT_SMELL_EXTENSIONS: frozenset[str] = frozenset(
|
|
250
|
+
{".py", ".js", ".ts", ".jsx", ".tsx"}
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class Phase(str, Enum):
|
|
255
|
+
"""SDLC workflow phases."""
|
|
256
|
+
|
|
257
|
+
DISCOVERY = "PHASE_0"
|
|
258
|
+
REQUIREMENTS = "PHASE_1"
|
|
259
|
+
QA_GATE = "PHASE_2"
|
|
260
|
+
SPECIFICATION = "PHASE_2_5" # NOTE: Inserted between REQUIREMENTS and DESIGN; string avoids renumbering downstream phases.
|
|
261
|
+
DESIGN = "PHASE_3"
|
|
262
|
+
IMPLEMENTATION = "PHASE_4"
|
|
263
|
+
REVIEW = "PHASE_5"
|
|
264
|
+
VERIFICATION = "PHASE_6"
|
|
265
|
+
COMPLETION = "PHASE_7"
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class TaskStatus(str, Enum):
|
|
269
|
+
"""Status for parallel tasks."""
|
|
270
|
+
|
|
271
|
+
PENDING = "pending"
|
|
272
|
+
IN_PROGRESS = "in_progress"
|
|
273
|
+
PASSED = "passed"
|
|
274
|
+
FAILED = "failed"
|
|
275
|
+
SKIPPED = "skipped"
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class StoryType(str, Enum):
|
|
279
|
+
"""Story type classification for capability detection."""
|
|
280
|
+
|
|
281
|
+
BACKEND = "backend"
|
|
282
|
+
FRONTEND = "frontend"
|
|
283
|
+
FULLSTACK = "fullstack"
|
|
284
|
+
UNKNOWN = "unknown"
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
# Phase configuration with agents and artifacts
|
|
288
|
+
PHASE_CONFIG: dict[str, dict] = {
|
|
289
|
+
Phase.DISCOVERY.value: {
|
|
290
|
+
"name": "Discovery",
|
|
291
|
+
"primary_agent": "discovery",
|
|
292
|
+
"required_artifacts": [],
|
|
293
|
+
"produces": [
|
|
294
|
+
"CODE_MAP.md",
|
|
295
|
+
"docs/ARCHITECTURE.md",
|
|
296
|
+
"docs/EXTERNAL_DEPS.md",
|
|
297
|
+
"docs/TECH_DEBT.md",
|
|
298
|
+
],
|
|
299
|
+
"next_phase": Phase.REQUIREMENTS.value,
|
|
300
|
+
},
|
|
301
|
+
Phase.REQUIREMENTS.value: {
|
|
302
|
+
"name": "Requirements",
|
|
303
|
+
"primary_agent": "product_manager",
|
|
304
|
+
"required_artifacts": ["CODE_MAP.md", "docs/ARCHITECTURE.md"],
|
|
305
|
+
"produces": [
|
|
306
|
+
"requirements/*.md",
|
|
307
|
+
"requirements/DEPENDENCY_GRAPH.md",
|
|
308
|
+
"requirements/FLOW_DIAGRAM.md",
|
|
309
|
+
],
|
|
310
|
+
"next_phase": Phase.SPECIFICATION.value,
|
|
311
|
+
},
|
|
312
|
+
Phase.SPECIFICATION.value: {
|
|
313
|
+
"name": "Specification",
|
|
314
|
+
"primary_agent": "specifier",
|
|
315
|
+
# Spec-driven: specifier runs on story alone — no ac_validated gate.
|
|
316
|
+
# Embedded mode triggered by STORY-XXX.md presence.
|
|
317
|
+
"required_artifacts": ["requirements/*.md"],
|
|
318
|
+
"produces": ["docs/specs/SPEC-{story_id}.md"],
|
|
319
|
+
"next_phase": Phase.DESIGN.value,
|
|
320
|
+
},
|
|
321
|
+
Phase.DESIGN.value: {
|
|
322
|
+
"name": "Design",
|
|
323
|
+
"primary_agent": "architect",
|
|
324
|
+
"required_artifacts": ["docs/specs/SPEC-{story_id}.md"],
|
|
325
|
+
# "design" = state token consumed by QA_GATE + IMPLEMENTATION required_artifacts.
|
|
326
|
+
# "docs/design/..." = file gate enforced on disk by _check_produces_artifacts().
|
|
327
|
+
"produces": ["design", "docs/design/DESIGN-{story_id}.md"],
|
|
328
|
+
"next_phase": Phase.QA_GATE.value,
|
|
329
|
+
},
|
|
330
|
+
Phase.QA_GATE.value: {
|
|
331
|
+
"name": "QA Gate",
|
|
332
|
+
"primary_agent": "qa_lead",
|
|
333
|
+
"parallel_agent": "test_designer", # Parallel: conceptual test cases
|
|
334
|
+
# Spec-driven: QA validates SPEC FRs against architecture design.
|
|
335
|
+
"required_artifacts": ["docs/specs/SPEC-{story_id}.md", "design"],
|
|
336
|
+
"produces": ["ac_validated", "conceptual_tests"],
|
|
337
|
+
"next_phase": Phase.IMPLEMENTATION.value,
|
|
338
|
+
},
|
|
339
|
+
Phase.IMPLEMENTATION.value: {
|
|
340
|
+
"name": "Implementation",
|
|
341
|
+
"primary_agent": "developer",
|
|
342
|
+
"required_artifacts": ["design", "conceptual_tests"],
|
|
343
|
+
"produces": ["implementation", "codemap_updated"],
|
|
344
|
+
"next_phase": Phase.REVIEW.value,
|
|
345
|
+
},
|
|
346
|
+
Phase.REVIEW.value: {
|
|
347
|
+
"name": "Review",
|
|
348
|
+
"primary_agent": "pr_reviewer",
|
|
349
|
+
"background_agent": "security_owner", # Parallel: security scan
|
|
350
|
+
"required_artifacts": [
|
|
351
|
+
"implementation",
|
|
352
|
+
"codemap_updated",
|
|
353
|
+
"health_scan_passed",
|
|
354
|
+
# STORY-TQ-001 M1b ship-2: block PHASE_4 → PHASE_5 when HIGH
|
|
355
|
+
# test_smell.* findings exist on changed test files. Bypass via
|
|
356
|
+
# `tests_smell_deferred` artifact (audited; logs to TECH_DEBT.md).
|
|
357
|
+
"tests_smell_passed",
|
|
358
|
+
# STORY-TQ-002 M2b ship-2: full project test suite must exit 0
|
|
359
|
+
# against a fresh server-signed report. Bypass via
|
|
360
|
+
# `full_suite_deferred` or `greenfield_no_tests` artifacts.
|
|
361
|
+
"full_suite_passed",
|
|
362
|
+
],
|
|
363
|
+
"produces": ["review_passed"],
|
|
364
|
+
"next_phase": Phase.VERIFICATION.value,
|
|
365
|
+
},
|
|
366
|
+
Phase.VERIFICATION.value: {
|
|
367
|
+
"name": "Verification",
|
|
368
|
+
"primary_agent": "tester",
|
|
369
|
+
"parallel_agent": "security_owner", # Full parallel
|
|
370
|
+
"required_artifacts": ["review_passed"],
|
|
371
|
+
"produces": ["tests_passed", "security_passed"],
|
|
372
|
+
"next_phase": Phase.COMPLETION.value,
|
|
373
|
+
},
|
|
374
|
+
Phase.COMPLETION.value: {
|
|
375
|
+
"name": "Completion",
|
|
376
|
+
"primary_agent": "scrum_master",
|
|
377
|
+
"required_artifacts": ["tests_passed", "security_passed"],
|
|
378
|
+
"produces": ["project_status.md"],
|
|
379
|
+
"next_phase": None,
|
|
380
|
+
},
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
# Agent to suggested next agent mapping
|
|
384
|
+
AGENT_NEXT_SUGGESTION: dict[str, str | list[str] | None] = {
|
|
385
|
+
"discovery": "product_manager",
|
|
386
|
+
"product_manager": "specifier", # Spec-driven: PM → Specifier → Architect → QA
|
|
387
|
+
"specifier": "architect",
|
|
388
|
+
"architect": ["qa_lead", "test_designer"], # Parallel: QA validates spec+design
|
|
389
|
+
"qa_lead": "developer",
|
|
390
|
+
"test_designer": "developer",
|
|
391
|
+
"impact_architect": None, # On-demand gate — no fixed next agent
|
|
392
|
+
"developer": "pr_reviewer",
|
|
393
|
+
"pr_reviewer": ["tester", "security_owner"], # Parallel
|
|
394
|
+
"tester": "scrum_master",
|
|
395
|
+
"security_owner": "scrum_master",
|
|
396
|
+
"scrum_master": None,
|
|
397
|
+
"forensic_engineer": None, # On-demand, no fixed next agent
|
|
398
|
+
"strategist": None, # On-demand, no fixed next agent
|
|
399
|
+
"platform_engineer": None, # On-demand, no fixed next agent
|
|
400
|
+
"migration_planner": "architect",
|
|
401
|
+
"parity_tester": "cutover_engineer",
|
|
402
|
+
"cutover_engineer": "scrum_master",
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
# Frontend detection keywords
|
|
406
|
+
FRONTEND_KEYWORDS: list[str] = [
|
|
407
|
+
"ui",
|
|
408
|
+
"component",
|
|
409
|
+
"page",
|
|
410
|
+
"button",
|
|
411
|
+
"form",
|
|
412
|
+
"modal",
|
|
413
|
+
"dialog",
|
|
414
|
+
"react",
|
|
415
|
+
"vue",
|
|
416
|
+
"angular",
|
|
417
|
+
"frontend",
|
|
418
|
+
"client-side",
|
|
419
|
+
"browser",
|
|
420
|
+
"css",
|
|
421
|
+
"styling",
|
|
422
|
+
"layout",
|
|
423
|
+
"responsive",
|
|
424
|
+
"animation",
|
|
425
|
+
]
|
|
426
|
+
|
|
427
|
+
# Backend detection keywords
|
|
428
|
+
BACKEND_KEYWORDS: list[str] = [
|
|
429
|
+
"api",
|
|
430
|
+
"endpoint",
|
|
431
|
+
"service",
|
|
432
|
+
"database",
|
|
433
|
+
"server",
|
|
434
|
+
"backend",
|
|
435
|
+
"rest",
|
|
436
|
+
"graphql",
|
|
437
|
+
"authentication",
|
|
438
|
+
"authorization",
|
|
439
|
+
"migration",
|
|
440
|
+
]
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
# Agent capabilities for delegation routing
|
|
444
|
+
AGENT_CAPABILITIES: dict[str, dict[str, list[str] | str]] = {
|
|
445
|
+
"discovery": {
|
|
446
|
+
"duty": "Scan codebase, generate CODE_MAP.md",
|
|
447
|
+
"requires": [],
|
|
448
|
+
"provides": ["CODE_MAP.md"],
|
|
449
|
+
"delegates_to": [],
|
|
450
|
+
},
|
|
451
|
+
"product_manager": {
|
|
452
|
+
"duty": "Define requirements with testable AC",
|
|
453
|
+
"requires": ["CODE_MAP.md"],
|
|
454
|
+
"provides": ["requirements/*.md"],
|
|
455
|
+
"delegates_to": ["discovery"],
|
|
456
|
+
},
|
|
457
|
+
"qa_lead": {
|
|
458
|
+
"duty": "Validate AC testability and edge cases",
|
|
459
|
+
"requires": ["requirements/*.md"],
|
|
460
|
+
"provides": ["AC validation"],
|
|
461
|
+
"delegates_to": ["product_manager"],
|
|
462
|
+
},
|
|
463
|
+
"test_designer": {
|
|
464
|
+
"duty": "Design conceptual test cases from AC (BDD Architect)",
|
|
465
|
+
"requires": ["requirements/*.md"],
|
|
466
|
+
"provides": ["conceptual_tests"],
|
|
467
|
+
"delegates_to": ["product_manager", "qa_lead"],
|
|
468
|
+
},
|
|
469
|
+
"architect": {
|
|
470
|
+
"duty": "Design system structure, update CODE_MAP",
|
|
471
|
+
"requires": ["requirements/*.md"],
|
|
472
|
+
"provides": ["CODE_MAP.md", "design"],
|
|
473
|
+
"delegates_to": ["product_manager", "discovery"],
|
|
474
|
+
},
|
|
475
|
+
"developer": {
|
|
476
|
+
"duty": "Implement per Elite Quality Protocol",
|
|
477
|
+
"requires": ["CODE_MAP.md", "design", "conceptual_tests"],
|
|
478
|
+
"provides": ["implementation"],
|
|
479
|
+
"delegates_to": ["architect", "test_designer"],
|
|
480
|
+
},
|
|
481
|
+
"pr_reviewer": {
|
|
482
|
+
"duty": "Review code against compliance",
|
|
483
|
+
"requires": ["implementation"],
|
|
484
|
+
"provides": ["review report"],
|
|
485
|
+
"delegates_to": ["developer"],
|
|
486
|
+
},
|
|
487
|
+
"tester": {
|
|
488
|
+
"duty": "Convert conceptual tests to executable tests",
|
|
489
|
+
"requires": ["requirements/*.md", "implementation", "conceptual_tests"],
|
|
490
|
+
"provides": ["tests"],
|
|
491
|
+
"delegates_to": ["product_manager", "developer", "test_designer"],
|
|
492
|
+
},
|
|
493
|
+
"security_owner": {
|
|
494
|
+
"duty": "Audit vulnerabilities",
|
|
495
|
+
"requires": ["implementation"],
|
|
496
|
+
"provides": ["security audit"],
|
|
497
|
+
"delegates_to": ["developer"],
|
|
498
|
+
},
|
|
499
|
+
"scrum_master": {
|
|
500
|
+
"duty": "Track status, close loop",
|
|
501
|
+
"requires": ["all artifacts"],
|
|
502
|
+
"provides": ["project_status.md"],
|
|
503
|
+
"delegates_to": ["any"],
|
|
504
|
+
},
|
|
505
|
+
"forensic_engineer": {
|
|
506
|
+
"duty": "Investigate incidents, produce post-mortems with root cause analysis",
|
|
507
|
+
"requires": [], # Independent - self-assesses context needs
|
|
508
|
+
"provides": ["incident_postmortem.md"],
|
|
509
|
+
"delegates_to": ["discovery", "developer"],
|
|
510
|
+
},
|
|
511
|
+
"impact_architect": {
|
|
512
|
+
"duty": "Calculate blast radius, score regression risk, gate developer activation",
|
|
513
|
+
"requires": ["ac_validated", "conceptual_tests", "CODE_MAP.md"],
|
|
514
|
+
"provides": ["change_analysis"],
|
|
515
|
+
"delegates_to": ["architect", "discovery"],
|
|
516
|
+
},
|
|
517
|
+
"strategist": {
|
|
518
|
+
"duty": "Brainstorm solutions, produce trade-off analysis matrices",
|
|
519
|
+
"requires": [], # Independent - self-assesses context needs
|
|
520
|
+
"provides": ["strategy_decision_matrix.md"],
|
|
521
|
+
"delegates_to": ["discovery", "architect"],
|
|
522
|
+
},
|
|
523
|
+
"platform_engineer": {
|
|
524
|
+
"duty": "Scan codebase health, run quality checks, route findings to agents",
|
|
525
|
+
"requires": [], # Independent - scans any codebase
|
|
526
|
+
"provides": ["health_report.md", "code_quality_report.md"],
|
|
527
|
+
"delegates_to": ["developer", "architect", "pr_reviewer"],
|
|
528
|
+
},
|
|
529
|
+
"migration_planner": {
|
|
530
|
+
"duty": "Select migration strategy, produce batch roadmap and feature flag plan",
|
|
531
|
+
"requires": ["docs/MIGRATION_MAP.md"],
|
|
532
|
+
"provides": ["docs/MIGRATION_PLAN.md"],
|
|
533
|
+
"delegates_to": ["discovery"],
|
|
534
|
+
},
|
|
535
|
+
"parity_tester": {
|
|
536
|
+
"duty": "Validate behavioral parity between legacy and migrated modules",
|
|
537
|
+
"requires": ["docs/MIGRATION_PLAN.md"],
|
|
538
|
+
"provides": [
|
|
539
|
+
"docs/parity/PARITY-{batch_id}-golden.md",
|
|
540
|
+
"docs/parity/PARITY-{batch_id}-gate.md",
|
|
541
|
+
],
|
|
542
|
+
"delegates_to": ["developer"],
|
|
543
|
+
},
|
|
544
|
+
"cutover_engineer": {
|
|
545
|
+
"duty": "Produce cutover runbook, govern feature flag ramp, define rollback triggers",
|
|
546
|
+
"requires": ["docs/MIGRATION_PLAN.md", "docs/parity/PARITY-{batch_id}-gate.md"],
|
|
547
|
+
"provides": [
|
|
548
|
+
"docs/cutover/CUTOVER-{batch_id}.md",
|
|
549
|
+
"docs/cutover/DECOMMISSION-{batch_id}.md",
|
|
550
|
+
],
|
|
551
|
+
"delegates_to": ["parity_tester"],
|
|
552
|
+
},
|
|
553
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""REF Agents Core Module.
|
|
2
|
+
|
|
3
|
+
Provides language detection, configuration loading, and pattern matching
|
|
4
|
+
infrastructure for multi-language support.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from ref_agents.core.config_loader import ConfigLoader, LanguageConfig
|
|
8
|
+
from ref_agents.core.language_detector import LanguageDetector, LanguageInfo
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"ConfigLoader",
|
|
12
|
+
"LanguageConfig",
|
|
13
|
+
"LanguageDetector",
|
|
14
|
+
"LanguageInfo",
|
|
15
|
+
]
|