foundry-mcp 0.3.3__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.
Files changed (135) hide show
  1. foundry_mcp/__init__.py +7 -0
  2. foundry_mcp/cli/__init__.py +80 -0
  3. foundry_mcp/cli/__main__.py +9 -0
  4. foundry_mcp/cli/agent.py +96 -0
  5. foundry_mcp/cli/commands/__init__.py +37 -0
  6. foundry_mcp/cli/commands/cache.py +137 -0
  7. foundry_mcp/cli/commands/dashboard.py +148 -0
  8. foundry_mcp/cli/commands/dev.py +446 -0
  9. foundry_mcp/cli/commands/journal.py +377 -0
  10. foundry_mcp/cli/commands/lifecycle.py +274 -0
  11. foundry_mcp/cli/commands/modify.py +824 -0
  12. foundry_mcp/cli/commands/plan.py +633 -0
  13. foundry_mcp/cli/commands/pr.py +393 -0
  14. foundry_mcp/cli/commands/review.py +652 -0
  15. foundry_mcp/cli/commands/session.py +479 -0
  16. foundry_mcp/cli/commands/specs.py +856 -0
  17. foundry_mcp/cli/commands/tasks.py +807 -0
  18. foundry_mcp/cli/commands/testing.py +676 -0
  19. foundry_mcp/cli/commands/validate.py +982 -0
  20. foundry_mcp/cli/config.py +98 -0
  21. foundry_mcp/cli/context.py +259 -0
  22. foundry_mcp/cli/flags.py +266 -0
  23. foundry_mcp/cli/logging.py +212 -0
  24. foundry_mcp/cli/main.py +44 -0
  25. foundry_mcp/cli/output.py +122 -0
  26. foundry_mcp/cli/registry.py +110 -0
  27. foundry_mcp/cli/resilience.py +178 -0
  28. foundry_mcp/cli/transcript.py +217 -0
  29. foundry_mcp/config.py +850 -0
  30. foundry_mcp/core/__init__.py +144 -0
  31. foundry_mcp/core/ai_consultation.py +1636 -0
  32. foundry_mcp/core/cache.py +195 -0
  33. foundry_mcp/core/capabilities.py +446 -0
  34. foundry_mcp/core/concurrency.py +898 -0
  35. foundry_mcp/core/context.py +540 -0
  36. foundry_mcp/core/discovery.py +1603 -0
  37. foundry_mcp/core/error_collection.py +728 -0
  38. foundry_mcp/core/error_store.py +592 -0
  39. foundry_mcp/core/feature_flags.py +592 -0
  40. foundry_mcp/core/health.py +749 -0
  41. foundry_mcp/core/journal.py +694 -0
  42. foundry_mcp/core/lifecycle.py +412 -0
  43. foundry_mcp/core/llm_config.py +1350 -0
  44. foundry_mcp/core/llm_patterns.py +510 -0
  45. foundry_mcp/core/llm_provider.py +1569 -0
  46. foundry_mcp/core/logging_config.py +374 -0
  47. foundry_mcp/core/metrics_persistence.py +584 -0
  48. foundry_mcp/core/metrics_registry.py +327 -0
  49. foundry_mcp/core/metrics_store.py +641 -0
  50. foundry_mcp/core/modifications.py +224 -0
  51. foundry_mcp/core/naming.py +123 -0
  52. foundry_mcp/core/observability.py +1216 -0
  53. foundry_mcp/core/otel.py +452 -0
  54. foundry_mcp/core/otel_stubs.py +264 -0
  55. foundry_mcp/core/pagination.py +255 -0
  56. foundry_mcp/core/progress.py +317 -0
  57. foundry_mcp/core/prometheus.py +577 -0
  58. foundry_mcp/core/prompts/__init__.py +464 -0
  59. foundry_mcp/core/prompts/fidelity_review.py +546 -0
  60. foundry_mcp/core/prompts/markdown_plan_review.py +511 -0
  61. foundry_mcp/core/prompts/plan_review.py +623 -0
  62. foundry_mcp/core/providers/__init__.py +225 -0
  63. foundry_mcp/core/providers/base.py +476 -0
  64. foundry_mcp/core/providers/claude.py +460 -0
  65. foundry_mcp/core/providers/codex.py +619 -0
  66. foundry_mcp/core/providers/cursor_agent.py +642 -0
  67. foundry_mcp/core/providers/detectors.py +488 -0
  68. foundry_mcp/core/providers/gemini.py +405 -0
  69. foundry_mcp/core/providers/opencode.py +616 -0
  70. foundry_mcp/core/providers/opencode_wrapper.js +302 -0
  71. foundry_mcp/core/providers/package-lock.json +24 -0
  72. foundry_mcp/core/providers/package.json +25 -0
  73. foundry_mcp/core/providers/registry.py +607 -0
  74. foundry_mcp/core/providers/test_provider.py +171 -0
  75. foundry_mcp/core/providers/validation.py +729 -0
  76. foundry_mcp/core/rate_limit.py +427 -0
  77. foundry_mcp/core/resilience.py +600 -0
  78. foundry_mcp/core/responses.py +934 -0
  79. foundry_mcp/core/review.py +366 -0
  80. foundry_mcp/core/security.py +438 -0
  81. foundry_mcp/core/spec.py +1650 -0
  82. foundry_mcp/core/task.py +1289 -0
  83. foundry_mcp/core/testing.py +450 -0
  84. foundry_mcp/core/validation.py +2081 -0
  85. foundry_mcp/dashboard/__init__.py +32 -0
  86. foundry_mcp/dashboard/app.py +119 -0
  87. foundry_mcp/dashboard/components/__init__.py +17 -0
  88. foundry_mcp/dashboard/components/cards.py +88 -0
  89. foundry_mcp/dashboard/components/charts.py +234 -0
  90. foundry_mcp/dashboard/components/filters.py +136 -0
  91. foundry_mcp/dashboard/components/tables.py +195 -0
  92. foundry_mcp/dashboard/data/__init__.py +11 -0
  93. foundry_mcp/dashboard/data/stores.py +433 -0
  94. foundry_mcp/dashboard/launcher.py +289 -0
  95. foundry_mcp/dashboard/views/__init__.py +12 -0
  96. foundry_mcp/dashboard/views/errors.py +217 -0
  97. foundry_mcp/dashboard/views/metrics.py +174 -0
  98. foundry_mcp/dashboard/views/overview.py +160 -0
  99. foundry_mcp/dashboard/views/providers.py +83 -0
  100. foundry_mcp/dashboard/views/sdd_workflow.py +255 -0
  101. foundry_mcp/dashboard/views/tool_usage.py +139 -0
  102. foundry_mcp/prompts/__init__.py +9 -0
  103. foundry_mcp/prompts/workflows.py +525 -0
  104. foundry_mcp/resources/__init__.py +9 -0
  105. foundry_mcp/resources/specs.py +591 -0
  106. foundry_mcp/schemas/__init__.py +38 -0
  107. foundry_mcp/schemas/sdd-spec-schema.json +386 -0
  108. foundry_mcp/server.py +164 -0
  109. foundry_mcp/tools/__init__.py +10 -0
  110. foundry_mcp/tools/unified/__init__.py +71 -0
  111. foundry_mcp/tools/unified/authoring.py +1487 -0
  112. foundry_mcp/tools/unified/context_helpers.py +98 -0
  113. foundry_mcp/tools/unified/documentation_helpers.py +198 -0
  114. foundry_mcp/tools/unified/environment.py +939 -0
  115. foundry_mcp/tools/unified/error.py +462 -0
  116. foundry_mcp/tools/unified/health.py +225 -0
  117. foundry_mcp/tools/unified/journal.py +841 -0
  118. foundry_mcp/tools/unified/lifecycle.py +632 -0
  119. foundry_mcp/tools/unified/metrics.py +777 -0
  120. foundry_mcp/tools/unified/plan.py +745 -0
  121. foundry_mcp/tools/unified/pr.py +294 -0
  122. foundry_mcp/tools/unified/provider.py +629 -0
  123. foundry_mcp/tools/unified/review.py +685 -0
  124. foundry_mcp/tools/unified/review_helpers.py +299 -0
  125. foundry_mcp/tools/unified/router.py +102 -0
  126. foundry_mcp/tools/unified/server.py +580 -0
  127. foundry_mcp/tools/unified/spec.py +808 -0
  128. foundry_mcp/tools/unified/task.py +2202 -0
  129. foundry_mcp/tools/unified/test.py +370 -0
  130. foundry_mcp/tools/unified/verification.py +520 -0
  131. foundry_mcp-0.3.3.dist-info/METADATA +337 -0
  132. foundry_mcp-0.3.3.dist-info/RECORD +135 -0
  133. foundry_mcp-0.3.3.dist-info/WHEEL +4 -0
  134. foundry_mcp-0.3.3.dist-info/entry_points.txt +3 -0
  135. foundry_mcp-0.3.3.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,511 @@
1
+ """
2
+ Markdown plan review prompts for AI consultation workflows.
3
+
4
+ This module provides prompt templates for reviewing markdown plans
5
+ before converting them to formal JSON specifications. Supports iterative
6
+ review cycles to refine plans with AI feedback.
7
+
8
+ Templates:
9
+ - MARKDOWN_PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
10
+ - MARKDOWN_PLAN_REVIEW_QUICK_V1: Critical blockers only
11
+ - MARKDOWN_PLAN_REVIEW_SECURITY_V1: Security-focused review
12
+ - MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1: Complexity and risk assessment
13
+
14
+ Each template expects plan_content, plan_name, and optionally plan_path context.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from typing import Any, Dict, List
20
+
21
+ from foundry_mcp.core.prompts import PromptBuilder, PromptRegistry, PromptTemplate
22
+
23
+
24
+ # =============================================================================
25
+ # Response Schema for MARKDOWN_PLAN_REVIEW Templates
26
+ # =============================================================================
27
+
28
+ _RESPONSE_SCHEMA = """
29
+ # Review Summary
30
+
31
+ ## Critical Blockers
32
+ Issues that MUST be fixed before this becomes a spec.
33
+
34
+ - **[Category]** <Issue title>
35
+ - **Description:** <What's wrong>
36
+ - **Impact:** <Consequences if not fixed>
37
+ - **Fix:** <Specific actionable recommendation>
38
+
39
+ ## Major Suggestions
40
+ Significant improvements to strengthen the plan.
41
+
42
+ - **[Category]** <Issue title>
43
+ - **Description:** <What's wrong>
44
+ - **Impact:** <Consequences if not addressed>
45
+ - **Fix:** <Specific actionable recommendation>
46
+
47
+ ## Minor Suggestions
48
+ Smaller refinements.
49
+
50
+ - **[Category]** <Issue title>
51
+ - **Description:** <What could be better>
52
+ - **Fix:** <Specific actionable recommendation>
53
+
54
+ ## Questions
55
+ Clarifications needed before proceeding.
56
+
57
+ - **[Category]** <Question>
58
+ - **Context:** <Why this matters>
59
+ - **Needed:** <What information would help>
60
+
61
+ ## Praise
62
+ What the plan does well.
63
+
64
+ - **[Category]** <What works well>
65
+ - **Why:** <What makes this effective>
66
+
67
+ ---
68
+
69
+ **Important**:
70
+ - Use category tags: [Completeness], [Architecture], [Sequencing], [Feasibility], [Risk], [Clarity]
71
+ - Include all sections even if empty (write "None identified" for empty sections)
72
+ - Be specific and actionable in all feedback
73
+ - For clarity issues, use Questions section rather than creating a separate category
74
+ """
75
+
76
+
77
+ # =============================================================================
78
+ # System Prompts
79
+ # =============================================================================
80
+
81
+ _MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT = """You are an expert software architect conducting a technical review.
82
+ Your task is to provide constructive, actionable feedback on implementation plans
83
+ written in markdown format, BEFORE they become formal specifications.
84
+
85
+ Guidelines:
86
+ - Be thorough and specific - examine all aspects of the proposed approach
87
+ - Identify both strengths and opportunities for improvement
88
+ - Ask clarifying questions for ambiguities
89
+ - Propose alternatives when better approaches exist
90
+ - Focus on impact and prioritize feedback by potential consequences
91
+ - Be collaborative, not adversarial
92
+ - Remember: this is an early-stage plan, not a final spec"""
93
+
94
+
95
+ # =============================================================================
96
+ # MARKDOWN_PLAN_REVIEW_FULL_V1
97
+ # =============================================================================
98
+
99
+ MARKDOWN_PLAN_REVIEW_FULL_V1 = PromptTemplate(
100
+ id="MARKDOWN_PLAN_REVIEW_FULL_V1",
101
+ version="1.0",
102
+ system_prompt=_MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT,
103
+ user_template="""You are conducting a comprehensive review of a markdown implementation plan.
104
+
105
+ **Plan Name**: {plan_name}
106
+ **Review Type**: Full (comprehensive analysis)
107
+
108
+ **Your role**: You are a collaborative senior peer helping refine the plan before it becomes a formal specification.
109
+
110
+ **Critical: Provide Constructive Feedback**
111
+
112
+ Effective reviews combine critical analysis with actionable guidance.
113
+
114
+ **Your evaluation guidelines**:
115
+ 1. **Be thorough and specific** - Examine all aspects of the proposed approach
116
+ 2. **Identify both strengths and opportunities** - Note what works well and what could improve
117
+ 3. **Ask clarifying questions** - Highlight ambiguities that need resolution
118
+ 4. **Propose alternatives** - Show better approaches when they exist
119
+ 5. **Be actionable** - Provide specific, implementable recommendations
120
+ 6. **Focus on impact** - Prioritize feedback by potential consequences
121
+
122
+ **Effective feedback patterns**:
123
+ - "Consider whether this approach handles X, Y, Z edge cases"
124
+ - "These estimates may be optimistic because..."
125
+ - "Strong design choice here because..."
126
+ - "Clarification needed: how does this handle scenario X?"
127
+
128
+ **Evaluate across 6 dimensions:**
129
+
130
+ 1. **Completeness** - Are all phases/deliverables identified? Missing sections?
131
+ 2. **Architecture** - Sound approach? Coupling concerns? Missing abstractions?
132
+ 3. **Sequencing** - Phases ordered correctly? Dependencies identified?
133
+ 4. **Feasibility** - Realistic estimates? Hidden complexity?
134
+ 5. **Risk** - What could go wrong? Mitigation strategies?
135
+ 6. **Clarity** - Unambiguous? Would another developer understand?
136
+
137
+ **MARKDOWN PLAN TO REVIEW:**
138
+
139
+ {plan_content}
140
+
141
+ ---
142
+
143
+ **Required Output Format** (Markdown):
144
+ {response_schema}
145
+
146
+ **Remember**: Your goal is to **help create a robust implementation plan**. Be specific, actionable, and balanced in your feedback. Identify both critical blockers and positive aspects of the plan.""",
147
+ required_context=["plan_content", "plan_name"],
148
+ optional_context=["response_schema", "plan_path"],
149
+ metadata={
150
+ "author": "foundry-mcp",
151
+ "category": "markdown_plan_review",
152
+ "workflow": "MARKDOWN_PLAN_REVIEW",
153
+ "review_type": "full",
154
+ "dimensions": [
155
+ "Completeness",
156
+ "Architecture",
157
+ "Sequencing",
158
+ "Feasibility",
159
+ "Risk",
160
+ "Clarity",
161
+ ],
162
+ "description": "Comprehensive 6-dimension markdown plan review",
163
+ },
164
+ )
165
+
166
+
167
+ # =============================================================================
168
+ # MARKDOWN_PLAN_REVIEW_QUICK_V1
169
+ # =============================================================================
170
+
171
+ MARKDOWN_PLAN_REVIEW_QUICK_V1 = PromptTemplate(
172
+ id="MARKDOWN_PLAN_REVIEW_QUICK_V1",
173
+ version="1.0",
174
+ system_prompt=_MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT,
175
+ user_template="""You are conducting a quick review of a markdown implementation plan.
176
+
177
+ **Plan Name**: {plan_name}
178
+ **Review Type**: Quick (focus on blockers and questions)
179
+
180
+ **Your role**: Identify critical blockers and key questions that need resolution before this becomes a spec.
181
+
182
+ **Focus on finding:**
183
+
184
+ 1. **Critical Blockers**: What would prevent this plan from becoming a valid spec?
185
+ - Missing phases or deliverables
186
+ - Undefined dependencies
187
+ - Unresolved technical decisions
188
+ - Incomplete objectives
189
+
190
+ 2. **Key Questions**: What needs clarification?
191
+ - Ambiguous requirements
192
+ - Unclear technical approaches
193
+ - Missing context or rationale
194
+ - Edge cases not addressed
195
+
196
+ **Evaluation areas**:
197
+ - **Completeness**: Are all necessary sections present?
198
+ - **Questions**: What clarifications are needed?
199
+
200
+ **MARKDOWN PLAN TO REVIEW:**
201
+
202
+ {plan_content}
203
+
204
+ ---
205
+
206
+ **Required Output Format** (Markdown):
207
+ {response_schema}
208
+
209
+ **Note**: Focus primarily on Critical Blockers and Questions sections. Brief notes for other sections are sufficient.""",
210
+ required_context=["plan_content", "plan_name"],
211
+ optional_context=["response_schema", "plan_path"],
212
+ metadata={
213
+ "author": "foundry-mcp",
214
+ "category": "markdown_plan_review",
215
+ "workflow": "MARKDOWN_PLAN_REVIEW",
216
+ "review_type": "quick",
217
+ "focus": ["Critical Blockers", "Questions"],
218
+ "description": "Quick review focusing on blockers and clarifications",
219
+ },
220
+ )
221
+
222
+
223
+ # =============================================================================
224
+ # MARKDOWN_PLAN_REVIEW_SECURITY_V1
225
+ # =============================================================================
226
+
227
+ MARKDOWN_PLAN_REVIEW_SECURITY_V1 = PromptTemplate(
228
+ id="MARKDOWN_PLAN_REVIEW_SECURITY_V1",
229
+ version="1.0",
230
+ system_prompt="""You are a security specialist reviewing implementation plans.
231
+ Your task is to identify security vulnerabilities, risks, and recommend mitigations
232
+ in the proposed implementation approach.
233
+
234
+ Guidelines:
235
+ - Focus on authentication, authorization, and data protection
236
+ - Identify injection risks and common vulnerabilities
237
+ - Consider OWASP Top 10 and industry security standards
238
+ - Provide specific, actionable remediation recommendations
239
+ - Prioritize findings by risk severity""",
240
+ user_template="""You are conducting a security review of a markdown implementation plan.
241
+
242
+ **Plan Name**: {plan_name}
243
+ **Review Type**: Security (focus on vulnerabilities and risks)
244
+
245
+ **Your role**: Security specialist helping identify and mitigate potential vulnerabilities in the proposed approach.
246
+
247
+ **Focus on security considerations:**
248
+
249
+ 1. **Authentication & Authorization**:
250
+ - Are authentication mechanisms properly planned?
251
+ - Is authorization enforced at appropriate boundaries?
252
+ - Does the plan follow principle of least privilege?
253
+
254
+ 2. **Data Protection**:
255
+ - Is input validation planned?
256
+ - Are secrets managed securely?
257
+ - Is encryption considered for data at rest and in transit?
258
+ - Do error handling plans avoid leaking sensitive information?
259
+
260
+ 3. **Common Vulnerabilities**:
261
+ - Are injection attacks (SQL, command, XSS, CSRF) considered?
262
+ - Are security headers and protections planned?
263
+ - Is rate limiting and DoS protection addressed?
264
+ - Are insecure defaults avoided?
265
+
266
+ 4. **Audit & Compliance**:
267
+ - Is audit logging planned for security events?
268
+ - Are privacy concerns addressed?
269
+ - Are relevant compliance requirements considered?
270
+
271
+ **Evaluation areas**:
272
+ - **Security**: Authentication, authorization, data protection, vulnerability prevention
273
+ - **Architecture**: Security-relevant design decisions
274
+ - **Risk**: Security risks and mitigations
275
+
276
+ **MARKDOWN PLAN TO REVIEW:**
277
+
278
+ {plan_content}
279
+
280
+ ---
281
+
282
+ **Required Output Format** (Markdown):
283
+ {response_schema}
284
+
285
+ **Note**: Focus primarily on Security category feedback. Include Critical Blockers for any security issues that must be addressed before this becomes a spec.""",
286
+ required_context=["plan_content", "plan_name"],
287
+ optional_context=["response_schema", "plan_path"],
288
+ metadata={
289
+ "author": "foundry-mcp",
290
+ "category": "markdown_plan_review",
291
+ "workflow": "MARKDOWN_PLAN_REVIEW",
292
+ "review_type": "security",
293
+ "focus": [
294
+ "Authentication",
295
+ "Authorization",
296
+ "Data Protection",
297
+ "Vulnerabilities",
298
+ ],
299
+ "description": "Security-focused review for vulnerabilities and risks",
300
+ },
301
+ )
302
+
303
+
304
+ # =============================================================================
305
+ # MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1
306
+ # =============================================================================
307
+
308
+ MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1 = PromptTemplate(
309
+ id="MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1",
310
+ version="1.0",
311
+ system_prompt="""You are a pragmatic senior engineer assessing technical feasibility.
312
+ Your task is to identify implementation challenges, risks, and hidden complexity
313
+ in the proposed approach.
314
+
315
+ Guidelines:
316
+ - Identify non-obvious technical challenges
317
+ - Evaluate dependency availability and stability
318
+ - Assess resource and timeline realism
319
+ - Highlight areas of concentrated complexity
320
+ - Suggest risk mitigations and alternatives""",
321
+ user_template="""You are conducting a technical feasibility review of a markdown implementation plan.
322
+
323
+ **Plan Name**: {plan_name}
324
+ **Review Type**: Feasibility (focus on implementation challenges)
325
+
326
+ **Your role**: Pragmatic engineer helping identify technical challenges and implementation risks.
327
+
328
+ **Focus on technical considerations:**
329
+
330
+ 1. **Hidden Complexity**:
331
+ - What technical challenges might not be obvious?
332
+ - Where does complexity concentrate?
333
+ - What edge cases increase difficulty?
334
+
335
+ 2. **Dependencies & Integration**:
336
+ - Are all required dependencies identified?
337
+ - Are external services/APIs available and documented?
338
+ - Are integration points well-defined?
339
+ - What dependency risks exist?
340
+
341
+ 3. **Technical Constraints**:
342
+ - What technical limitations could impact the approach?
343
+ - Are performance requirements achievable?
344
+ - Are there scalability considerations?
345
+ - What infrastructure requirements exist?
346
+
347
+ 4. **Implementation Risks**:
348
+ - What could go wrong during implementation?
349
+ - Where are the highest-risk technical areas?
350
+ - What mitigation strategies are needed?
351
+
352
+ **Evaluation areas**:
353
+ - **Completeness**: Are technical requirements fully specified?
354
+ - **Feasibility**: Is the technical approach sound?
355
+ - **Risk**: What are the technical risks?
356
+
357
+ **MARKDOWN PLAN TO REVIEW:**
358
+
359
+ {plan_content}
360
+
361
+ ---
362
+
363
+ **Required Output Format** (Markdown):
364
+ {response_schema}
365
+
366
+ **Note**: Focus on technical challenges and risks. Identify Major Suggestions for areas of hidden complexity and Critical Blockers for missing technical requirements.""",
367
+ required_context=["plan_content", "plan_name"],
368
+ optional_context=["response_schema", "plan_path"],
369
+ metadata={
370
+ "author": "foundry-mcp",
371
+ "category": "markdown_plan_review",
372
+ "workflow": "MARKDOWN_PLAN_REVIEW",
373
+ "review_type": "feasibility",
374
+ "focus": ["Complexity", "Dependencies", "Risks"],
375
+ "description": "Technical feasibility and risk assessment",
376
+ },
377
+ )
378
+
379
+
380
+ # =============================================================================
381
+ # Template Registry
382
+ # =============================================================================
383
+
384
+
385
+ MARKDOWN_PLAN_REVIEW_TEMPLATES: Dict[str, PromptTemplate] = {
386
+ "MARKDOWN_PLAN_REVIEW_FULL_V1": MARKDOWN_PLAN_REVIEW_FULL_V1,
387
+ "MARKDOWN_PLAN_REVIEW_QUICK_V1": MARKDOWN_PLAN_REVIEW_QUICK_V1,
388
+ "MARKDOWN_PLAN_REVIEW_SECURITY_V1": MARKDOWN_PLAN_REVIEW_SECURITY_V1,
389
+ "MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1": MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1,
390
+ }
391
+
392
+
393
+ # =============================================================================
394
+ # Prompt Builder Implementation
395
+ # =============================================================================
396
+
397
+
398
+ class MarkdownPlanReviewPromptBuilder(PromptBuilder):
399
+ """
400
+ Prompt builder for markdown plan review workflows.
401
+
402
+ Provides access to MARKDOWN_PLAN_REVIEW_* templates for reviewing
403
+ markdown plans before they become formal JSON specifications.
404
+
405
+ Templates:
406
+ - MARKDOWN_PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
407
+ - MARKDOWN_PLAN_REVIEW_QUICK_V1: Critical blockers and questions focus
408
+ - MARKDOWN_PLAN_REVIEW_SECURITY_V1: Security-focused review
409
+ - MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1: Technical complexity assessment
410
+
411
+ Example:
412
+ builder = MarkdownPlanReviewPromptBuilder()
413
+
414
+ prompt = builder.build("MARKDOWN_PLAN_REVIEW_FULL_V1", {
415
+ "plan_content": "...",
416
+ "plan_name": "my-feature",
417
+ })
418
+ """
419
+
420
+ def __init__(self) -> None:
421
+ """Initialize the builder with all templates."""
422
+ self._registry = PromptRegistry()
423
+ for template in MARKDOWN_PLAN_REVIEW_TEMPLATES.values():
424
+ self._registry.register(template)
425
+
426
+ def build(self, prompt_id: str, context: Dict[str, Any]) -> str:
427
+ """
428
+ Build a markdown plan review prompt.
429
+
430
+ Args:
431
+ prompt_id: Template ID (MARKDOWN_PLAN_REVIEW_*)
432
+ context: Context dict with required variables
433
+
434
+ Returns:
435
+ Rendered prompt string
436
+
437
+ Raises:
438
+ ValueError: If prompt_id not found or required context missing
439
+ """
440
+ if prompt_id not in MARKDOWN_PLAN_REVIEW_TEMPLATES:
441
+ available = sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
442
+ raise ValueError(f"Unknown prompt_id '{prompt_id}'. Available: {available}")
443
+
444
+ render_context = dict(context)
445
+ # Add default response schema if not provided
446
+ if "response_schema" not in render_context:
447
+ render_context["response_schema"] = _RESPONSE_SCHEMA
448
+
449
+ return self._registry.render(prompt_id, render_context)
450
+
451
+ def list_prompts(self) -> List[str]:
452
+ """
453
+ Return all available prompt IDs.
454
+
455
+ Returns:
456
+ Sorted list of all prompt IDs
457
+ """
458
+ return sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
459
+
460
+ def get_template(self, prompt_id: str) -> PromptTemplate:
461
+ """
462
+ Get a template by ID for inspection.
463
+
464
+ Args:
465
+ prompt_id: Template identifier
466
+
467
+ Returns:
468
+ The PromptTemplate
469
+
470
+ Raises:
471
+ KeyError: If not found
472
+ """
473
+ if prompt_id not in MARKDOWN_PLAN_REVIEW_TEMPLATES:
474
+ available = sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
475
+ raise KeyError(
476
+ f"Template '{prompt_id}' not found. Available: {available}"
477
+ )
478
+ return self._registry.get_required(prompt_id)
479
+
480
+
481
+ # =============================================================================
482
+ # Helper Functions
483
+ # =============================================================================
484
+
485
+
486
+ def get_response_schema() -> str:
487
+ """
488
+ Get the standard response schema for markdown plan reviews.
489
+
490
+ Returns:
491
+ Response schema markdown string
492
+ """
493
+ return _RESPONSE_SCHEMA
494
+
495
+
496
+ # =============================================================================
497
+ # Module Exports
498
+ # =============================================================================
499
+
500
+ __all__ = [
501
+ # Templates
502
+ "MARKDOWN_PLAN_REVIEW_FULL_V1",
503
+ "MARKDOWN_PLAN_REVIEW_QUICK_V1",
504
+ "MARKDOWN_PLAN_REVIEW_SECURITY_V1",
505
+ "MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1",
506
+ "MARKDOWN_PLAN_REVIEW_TEMPLATES",
507
+ # Builder
508
+ "MarkdownPlanReviewPromptBuilder",
509
+ # Helpers
510
+ "get_response_schema",
511
+ ]