Coverage for lintro / ai / prompts / summary.py: 100%
3 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Prompt templates for AI summary generation."""
3from __future__ import annotations
5SUMMARY_SYSTEM = (
6 "You are a senior software engineer reviewing a codebase's quality report. "
7 "Provide concise, actionable insights — not just restated counts. "
8 "Focus on patterns, root causes, and prioritized recommendations. "
9 "Respond ONLY with the requested JSON format, no markdown fences."
10)
12SUMMARY_PROMPT_TEMPLATE = """\
13A linting analysis found {total_issues} issues across {tool_count} tool(s).
15Here is a digest of all issues grouped by tool and error code:
16<issues_digest>
17{issues_digest}
18</issues_digest>
20Analyze these results and provide a structured summary.
22Respond in this exact JSON format:
23{{
24 "overview": "2-3 sentence assessment of code quality. \
25Be specific about what needs attention.",
26 "key_patterns": [
27 "Pattern description with scope \
28(e.g., 'Missing type annotations in src/utils/')"
29 ],
30 "priority_actions": [
31 "Most impactful action to take first (explain why)"
32 ],
33 "triage_suggestions": [
34 "Code + context where suppression is appropriate \
35(e.g., 'B101 in tests — add # noqa: B101')"
36 ],
37 "estimated_effort": "Rough time estimate \
38(e.g., '20-30 minutes of focused cleanup')"
39}}
41Guidelines:
42- Identify systemic patterns, not individual issues
43- Priority actions should be ordered by impact (fixes that resolve the
44 most issues first)
45- Be specific about file areas or patterns, not generic advice
46- If issues are mostly cosmetic/style, say so
47- Limit to 3-5 key patterns and 3-5 priority actions
48- When recommending actions, use `lintro chk` for checking and \
49`lintro fmt` for formatting — never suggest running linting tools \
50directly (e.g., don't say 'run black' or 'run ruff --fix')
51- For triage_suggestions, identify issues that are likely \
52intentional or idiomatic in their context (e.g., asserts in \
53test files, long lines in generated code, unused imports in \
54__init__.py). Suggest the appropriate suppression mechanism \
55for the tool (# noqa, // eslint-disable, #[allow(...)], etc.). \
56Use an empty array if all issues genuinely need fixing
57"""