@exaudeus/workrail 3.12.0 → 3.14.0
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.
- package/dist/console/assets/{index-CRgjJiMS.js → index-EsSXrC_a.js} +11 -11
- package/dist/console/index.html +1 -1
- package/dist/di/container.js +8 -0
- package/dist/di/tokens.d.ts +1 -0
- package/dist/di/tokens.js +1 -0
- package/dist/infrastructure/session/HttpServer.js +2 -14
- package/dist/manifest.json +93 -53
- package/dist/mcp/boundary-coercion.d.ts +2 -0
- package/dist/mcp/boundary-coercion.js +73 -0
- package/dist/mcp/handler-factory.d.ts +1 -1
- package/dist/mcp/handler-factory.js +13 -6
- package/dist/mcp/handlers/v2-manage-workflow-source.d.ts +7 -0
- package/dist/mcp/handlers/v2-manage-workflow-source.js +50 -0
- package/dist/mcp/handlers/v2-workflow.d.ts +3 -0
- package/dist/mcp/handlers/v2-workflow.js +58 -0
- package/dist/mcp/output-schemas.d.ts +93 -0
- package/dist/mcp/output-schemas.js +8 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tool-descriptions.js +20 -0
- package/dist/mcp/tools.js +6 -0
- package/dist/mcp/types/tool-description-types.d.ts +1 -1
- package/dist/mcp/types/tool-description-types.js +1 -0
- package/dist/mcp/types/workflow-tool-edition.d.ts +1 -1
- package/dist/mcp/types.d.ts +2 -0
- package/dist/mcp/v2/tool-registry.js +8 -0
- package/dist/mcp/v2/tools.d.ts +12 -0
- package/dist/mcp/v2/tools.js +7 -1
- package/dist/types/workflow-definition.d.ts +1 -0
- package/dist/v2/infra/in-memory/managed-source-store/index.d.ts +8 -0
- package/dist/v2/infra/in-memory/managed-source-store/index.js +33 -0
- package/dist/v2/infra/local/data-dir/index.d.ts +2 -0
- package/dist/v2/infra/local/data-dir/index.js +6 -0
- package/dist/v2/infra/local/managed-source-store/index.d.ts +15 -0
- package/dist/v2/infra/local/managed-source-store/index.js +164 -0
- package/dist/v2/ports/data-dir.port.d.ts +2 -0
- package/dist/v2/ports/managed-source-store.port.d.ts +25 -0
- package/dist/v2/ports/managed-source-store.port.js +2 -0
- package/package.json +2 -1
- package/spec/authoring-spec.json +9 -2
- package/spec/workflow.schema.json +418 -96
- package/workflows/adaptive-ticket-creation.json +276 -282
- package/workflows/document-creation-workflow.json +70 -191
- package/workflows/documentation-update-workflow.json +59 -309
- package/workflows/intelligent-test-case-generation.json +37 -212
- package/workflows/personal-learning-materials-creation-branched.json +1 -21
- package/workflows/presentation-creation.json +143 -308
- package/workflows/relocation-workflow-us.json +161 -535
- package/workflows/scoped-documentation-workflow.json +110 -181
- package/workflows/workflow-for-workflows.v2.json +72 -16
- package/workflows/CHANGELOG-bug-investigation.md +0 -298
- package/workflows/bug-investigation.agentic.json +0 -212
- package/workflows/bug-investigation.json +0 -112
- package/workflows/mr-review-workflow.agentic.json +0 -538
- package/workflows/mr-review-workflow.json +0 -277
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "mr-review-workflow",
|
|
3
|
-
"name": "Adaptive MR Review Workflow",
|
|
4
|
-
"version": "0.2.0",
|
|
5
|
-
"description": "An adaptive workflow to guide an AI agent in performing a comprehensive code review. It adjusts its rigor based on MR complexity and includes checkpoints for architectural and self-critique to provide deep, actionable feedback.",
|
|
6
|
-
"preconditions": [
|
|
7
|
-
"User has the full code diff accessible (e.g., as text in a file).",
|
|
8
|
-
"User has the MR title, purpose, and any relevant ticket numbers.",
|
|
9
|
-
"The agent has access to file-reading tools."
|
|
10
|
-
],
|
|
11
|
-
"clarificationPrompts": [
|
|
12
|
-
"Provide the associated ticket ID(s)/link(s) and paste full text if possible.",
|
|
13
|
-
"Provide links (or attach) any dev plan, design/architecture doc, or BRD relevant to this MR.",
|
|
14
|
-
"Provide the code diff (paste content or give a file path)."
|
|
15
|
-
],
|
|
16
|
-
"metaGuidance": [
|
|
17
|
-
"The ultimate goal is to assist, not replace, a human reviewer. The human owns the final merge decision.",
|
|
18
|
-
"All feedback should be constructive and actionable. Explain the 'why' behind suggestions.",
|
|
19
|
-
"The goal is continuous improvement, not perfection. Approve changes that are 'better' to maintain velocity.",
|
|
20
|
-
"Foster a blameless culture of collective ownership. The code is a shared asset.",
|
|
21
|
-
"Use prefixes like 'Nit:' for non-blocking, minor suggestions to keep focus on important issues.",
|
|
22
|
-
"Embrace small, single-purpose pull requests for faster, more thorough reviews.",
|
|
23
|
-
"When citing issues, always try to provide specific file paths and line numbers from the diff.",
|
|
24
|
-
"Maintain the persona of a helpful, collaborative senior engineer.",
|
|
25
|
-
"If at any point you determine that a crucial piece of information is missing, you must pause and ask the user to provide it.",
|
|
26
|
-
"Auto-advance: after completing each step, immediately get the next step; only pause for explicit requireConfirmation or missing critical inputs.",
|
|
27
|
-
"FunctionReferences are mandatory. When a step lists functionReferences, execute each in the listed order before producing chat output.",
|
|
28
|
-
"FunctionReferences are conceptual (not MCP tools). ‘Execute’ means: read the function’s definition and perform those actions using your available tools; do not look for tools with the same names.",
|
|
29
|
-
"Use each function's definition as the authoritative checklist for how to perform the step and what to produce (doc updates, context vars).",
|
|
30
|
-
"Document I/O: create/update the file at reviewDocPath using file-writing tools. If the agent cannot write files, output the exact doc content with the intended path so the user can save it.",
|
|
31
|
-
"If a function requires inputs that are missing, state exactly what is missing and pause. Otherwise, do not ask for confirmation.",
|
|
32
|
-
"If prompt text and a function definition conflict, prefer the function definition for the how, and the step prompt for the what.",
|
|
33
|
-
"Phase 1a is user-driven: request ticket/dev/design/BRD; wait for user reply; do not search or analyze code in this step.",
|
|
34
|
-
"Do not self-confirm. Only proceed after explicit user confirmation or 'skip'; then set contextGatheringComplete=true or skipContextGathering=true.",
|
|
35
|
-
"discoverModulePatterns(): Compute moduleRoot; scan only moduleRoot to build patternCatalog.",
|
|
36
|
-
"discoverModulePatterns() details: moduleRoot = nearest common ancestor, clamped to package/src; catalog = naming, DI, errors, logging, tests, layout.",
|
|
37
|
-
"consolidatePatternFindings(): Compare changes to patternCatalog (scoped to moduleRoot).",
|
|
38
|
-
"consolidatePatternFindings() details: produce patternFindings + grouped patternAppendix; set patternAppendixReady=true.",
|
|
39
|
-
"initReviewDoc(): Create live Markdown at project root; set reviewDocPath.",
|
|
40
|
-
"initReviewDoc() details: filename '<YYYY-MM-DD>--<ticket-or-branch>--mr-review.md'; insert section markers; if no file I/O, output full doc and path.",
|
|
41
|
-
"upsertSection(): Upsert under a known section marker; never duplicate sections; keep formatting concise.",
|
|
42
|
-
"appendChangedFileRow(): Append/update Changed Files table row: File | +/- | Summary | Risk.",
|
|
43
|
-
"appendFinding(): Append finding under severity (Critical/Major/Minor) with path:line, 1–2-line rationale, optional tiny diff.",
|
|
44
|
-
"appendPatternResult(): Append Pattern Adherence row (Check | Result | Note); add brief per-file deviations.",
|
|
45
|
-
"appendMRComment(): Append copy-ready MR comment: file:line, short title, rationale, optional tiny diff.",
|
|
46
|
-
"logRevision(): Append timestamped message to the Revision Log describing the update.",
|
|
47
|
-
"discoverHygieneSignals(): Scan moduleRoot changed files + neighbors for hygiene issues.",
|
|
48
|
-
"discoverHygieneSignals() details: focused/disabled/skipped tests; no‑assert tests; commented‑out code; stale/misleading comments; TODO/FIXME/HACK/BUG w/o tickets; pattern inconsistencies; debug prints; unused code.",
|
|
49
|
-
"consolidateHygieneFindings(): Cap total ≤10 and ≤3 per category; dedupe; group by file.",
|
|
50
|
-
"consolidateHygieneFindings() details: elevate Major only for clearly risky cases; produce category counts and capped items.",
|
|
51
|
-
"appendHygieneFinding(): Append hygiene bullet grouped by file: 'path:line — short note (≤2 lines)'.",
|
|
52
|
-
"appendHygieneFinding() details: if duplicated in Nits, reference '(linked in Nits)'.",
|
|
53
|
-
"finalizeReviewDocument(): Branch on complexity for different finalization logic.",
|
|
54
|
-
"finalizeReviewDocument() Trivial: brief approve summary; ≤2 hygiene; quick nits; set status=Final; log.",
|
|
55
|
-
"finalizeReviewDocument() Non‑trivial: exec summary (3 positives, 3 risks, recommendation); dedupe/sort findings; ensure sections + curated comments; set status=Final; log."
|
|
56
|
-
],
|
|
57
|
-
"steps": [
|
|
58
|
-
{
|
|
59
|
-
"id": "phase-0-triage",
|
|
60
|
-
"title": "Phase 0: Triage & Review Focus",
|
|
61
|
-
"prompt": "To begin the Merge Request review, please provide the full context below and classify the MR's complexity. This will tailor the depth of the review.\n\n**1. MR Context:**\n* **MR Title/Purpose:** [User provides the title and a brief description of its purpose.]\n* **Related Ticket(s):** [User provides ticket numbers or links.]\n* **Key Requirements/Acceptance Criteria:** [User lists key requirements from the ticket(s).]\n\n**2. Code Diff:**\n[User pastes the full `git diff` output or provides a path to a file containing the diff.]\n\n**3. Complexity Classification & Focus:**\n* **Classification:** Please choose one: **[Trivial]**, **[Standard]**, or **[High-Risk]**.\n* **PR Size:** Is this a small, focused change (<400 lines)? If not, does it have a single, clear purpose?\n* **Areas of Focus (Optional):** Are there specific areas you want me to pay close attention to? (e.g., 'performance implications', 'API design', 'data integrity').",
|
|
62
|
-
"agentRole": "You are a code review coordinator and triage specialist with expertise in assessing merge request complexity and risk. Your role is to efficiently classify reviews and establish appropriate focus areas to ensure the right level of scrutiny for each change.",
|
|
63
|
-
"guidance": [
|
|
64
|
-
"**[Trivial]:** For minor fixes (typos, docs). This will run a condensed, single-phase review.",
|
|
65
|
-
"**[Standard]:** For typical features or bug fixes. This uses the full, multi-phase review process.",
|
|
66
|
-
"**[High-Risk]:** For major architectural changes or features touching sensitive code. This follows the full process with maximum diligence."
|
|
67
|
-
],
|
|
68
|
-
"functionReferences": ["initReviewDoc()", "logRevision()"],
|
|
69
|
-
"requireConfirmation": true
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"id": "phase-1-context",
|
|
73
|
-
"title": "Phase 1: Contextual Understanding & Confirmation",
|
|
74
|
-
"prompt": "My goal is to ensure I fully understand the MR before the deep analysis. Based on the context you provided, I will perform the following tasks:\n\n1. **Summarize Goal:** Briefly summarize what I understand to be the primary goal and scope of this MR.\n2. **File Overview:** List all changed files (added, modified, deleted) and provide a one-sentence summary of the changes for each.\n3. **Initial Questions:** Formulate any immediate questions I have about the MR's purpose or requirements.\n4. **Confirmation Gate:** Does my summary accurately reflect the MR's goal? Please confirm before I proceed.\n\nI will also update the live review document with the Changed Files table and the Context summary.",
|
|
75
|
-
"agentRole": "You are a thorough code review analyst specializing in requirement comprehension and change impact assessment. Your strength is quickly understanding the intent and scope of code changes while identifying potential gaps in understanding early in the review process.",
|
|
76
|
-
"guidance": [
|
|
77
|
-
"This is a critical sanity check. If the agent's summary is incorrect, correct it now to prevent a flawed review. This step is skipped for 'Trivial' reviews.",
|
|
78
|
-
"Doc writes: update only 'Context Summary' and 'Changed Files' sections; do not add 'Questions' or extra headings.",
|
|
79
|
-
"Ask any clarifying questions in chat only; do not write them into the doc.",
|
|
80
|
-
"Do not create placeholders for issues (Critical/Major/Minor) in this step."
|
|
81
|
-
],
|
|
82
|
-
"runCondition": { "var": "complexity", "not_equals": "Trivial" },
|
|
83
|
-
"requireConfirmation": true,
|
|
84
|
-
"functionReferences": ["upsertSection()", "appendChangedFileRow()", "logRevision()"]
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
"id": "phase-1a-llm-context-gathering",
|
|
89
|
-
"title": "Phase 1a: Comprehensive Context Gathering",
|
|
90
|
-
"prompt": "To perform a thorough review, I need you to provide source documents. In this step I will not search or analyze code—I'm waiting for your inputs. Please provide:\n\n1. **Ticket(s):** Link(s) and, if possible, paste the full text (requirements, acceptance criteria).\n2. **Dev/Design Docs:** Dev plan; design/architecture docs; any BRD/ADR/decision records relevant to this MR.\n3. **Technical Context:** If this change relies on other parts of the codebase, paste relevant code snippets or file contents; include coding standards or module conventions if available.\n\nI will synthesize this information once received.\n\n**Confirmation & Gating:**\n- After you confirm that I have the right context (or explicitly instruct me to skip), I will set `contextGatheringComplete = true` or `skipContextGathering = true` accordingly.\n- I will not proceed to deeper analysis until one of these is set.",
|
|
91
|
-
"agentRole": "You are a context-aware analyst ensuring you have all necessary information before starting a deep review.",
|
|
92
|
-
"guidance": [
|
|
93
|
-
"User-driven step: ask for ticket, dev plan, design/architecture docs, BRD/ADR, and any coding standards.",
|
|
94
|
-
"Do not search or analyze code in this step; wait for user inputs.",
|
|
95
|
-
"Only after explicit confirmation or 'skip' set contextGatheringComplete=true or skipContextGathering=true."
|
|
96
|
-
],
|
|
97
|
-
"runCondition": { "var": "complexity", "not_equals": "Trivial" },
|
|
98
|
-
"requireConfirmation": true
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"id": "phase-1b-familiarization",
|
|
102
|
-
"title": "Phase 1b: Neighborhood, Call Graph, and Contracts Familiarization",
|
|
103
|
-
"prompt": "Build a lightweight understanding of surrounding code to increase review accuracy.\n\nTasks:\n1) Neighborhood Map: For each changed file, list immediate neighbors in moduleRoot (imports/exports/same-folder), co-located tests, and closest entry points (routes/endpoints/commands). Cap neighbors per file.\n2) Bounded Call Graph: For changed functions/classes, gather callers and callees up to 2 hops within moduleRoot; cap nodes/edges; prioritize edges touching changed code.\n3) Contracts & Invariants: List public symbols, API endpoints, DB/tables/messages touched nearby. Capture any stated invariants or assumptions from comments.\n\nDoc-first: Upsert sections 'Neighborhood Map', 'Bounded Call Graph', and 'Contracts & Invariants' with concise tables/bullets. Include only the highest-signal items (apply caps).",
|
|
104
|
-
"agentRole": "You are a codebase navigator building context around the change to improve downstream analysis.",
|
|
105
|
-
"guidance": [
|
|
106
|
-
"Initialize majorIssuesFound = false.",
|
|
107
|
-
"Scope strictly to moduleRoot and changed files plus immediate neighbors.",
|
|
108
|
-
"Cap per-file neighbors and graph size to avoid noise; prefer edges directly related to the diff.",
|
|
109
|
-
"Write full details to the live doc; in chat, keep output minimal.",
|
|
110
|
-
"Small Multiples: for each changed symbol, render mini path lines (≤6 nodes) for top 1–2 inbound and 1–2 outbound paths; width ≤100; highlight changed as [*name*]; tag HOT where applicable.",
|
|
111
|
-
"Path Lists with Aliasing: collapse repeated subpaths using deterministic aliases (A1, A2, ...); reuse aliases across paths; append an 'Alias Legend' listing alias → full subpath.",
|
|
112
|
-
"Ordering: HOT-first, then shortest path, then alphabetical; depth ≤2; dedupe identical paths.",
|
|
113
|
-
"Caps: ≤5 anchors; ≤8 total paths; ≤12 nodes across all small multiples; if exceeded, render 'Adjacency Summary' with per-edge counts instead.",
|
|
114
|
-
"Flow Anchors: map entrypoints to changed symbols; table 'Anchor | Type | Target Symbol | Notes'; cap ≤5 anchors.",
|
|
115
|
-
"Hot-Path ranking: score edges (diff touch, anchor, ticket keyword, test ref); tag HOT if score ≥ threshold; prefer HOT paths in ASCII output.",
|
|
116
|
-
"Legend in doc: [*name*]=changed; HOT=high-impact; 'A -> B'=calls; 'Route -> Handler'; 'Job -> Worker'.",
|
|
117
|
-
"If caps exceeded, write 'Adjacency Summary': 'Node | In | Out | Notes' (top-K by degree/frequency) and add 1–2 uncertainty questions."
|
|
118
|
-
],
|
|
119
|
-
"runCondition": { "and": [ { "var": "complexity", "not_equals": "Trivial" }, { "or": [ { "var": "contextGatheringComplete", "equals": true }, { "var": "skipContextGathering", "equals": true } ] } ] },
|
|
120
|
-
"functionReferences": ["upsertSection()", "logRevision()"],
|
|
121
|
-
"requireConfirmation": false
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"id": "phase-2-depth-analysis-loop",
|
|
125
|
-
"type": "loop",
|
|
126
|
-
"title": "Phase 2: Progressive Depth Analysis",
|
|
127
|
-
"runCondition": { "and": [ { "var": "complexity", "not_equals": "Trivial" }, { "or": [ { "var": "contextGatheringComplete", "equals": true }, { "var": "skipContextGathering", "equals": true } ] } ] },
|
|
128
|
-
"loop": {
|
|
129
|
-
"type": "for",
|
|
130
|
-
"count": 4,
|
|
131
|
-
"maxIterations": 4,
|
|
132
|
-
"iterationVar": "analysisDepth"
|
|
133
|
-
},
|
|
134
|
-
"body": [
|
|
135
|
-
{
|
|
136
|
-
"id": "discover-module-patterns",
|
|
137
|
-
"title": "Discover Module Patterns (Depth 1)",
|
|
138
|
-
"prompt": "Compute `moduleRoot` as the nearest common ancestor of changed files, clamped to the package or `src/` subtree. Scan only within `moduleRoot` to gather exemplars (naming, DI, error handling, logging, test style, file layout). Exclude changed files from discovery so they cannot define patterns. Only elevate a rule to a 'pattern' when observed ≥2 times across distinct files; record singletons as 'candidate conventions'. Produce `patternCatalog` (validated patterns) and `patternExamples` (1–3 exemplars per pattern) in context. Do not block or require confirmation.",
|
|
139
|
-
"agentRole": "You are a codebase pattern scout building a concise pattern catalog for the current module.",
|
|
140
|
-
"guidance": [
|
|
141
|
-
"Scope strictly to `moduleRoot` discovered from changed files.",
|
|
142
|
-
"Exclude changed files from discovery; use them only later for comparison.",
|
|
143
|
-
"Require ≥2 occurrences across distinct files to qualify as a pattern; otherwise mark as 'candidate convention'.",
|
|
144
|
-
"Capture 1–3 exemplars per validated pattern with file:line for the doc.",
|
|
145
|
-
"Cap exemplars (e.g., 3–5 per concern) for speed."
|
|
146
|
-
],
|
|
147
|
-
"runCondition": { "var": "analysisDepth", "equals": 1 },
|
|
148
|
-
"functionReferences": ["discoverModulePatterns()"],
|
|
149
|
-
"requireConfirmation": false
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"id": "perform-analysis-pass",
|
|
153
|
-
"title": "Analysis Pass {{analysisDepth}} of 4",
|
|
154
|
-
"prompt": "Act as a Senior Staff Engineer. Your task is to review the code based on the checklist for the current analysis depth. Think step-by-step.\n\n**Current Depth: {{analysisDepth}}**\n\n**Checklist:**\n* **Depth 1 (Basic Scan):** Check for style guide violations, simple bugs (e.g., typos, unused variables), and common security vulnerabilities (OWASP Top 10).\n* **Depth 2 (Standard Review):** Check for logical errors, edge cases, adherence to SOLID principles, and maintainability issues.\n* **Depth 3 (Deep Architectural Review):** Check for alignment with system architecture, long-term impact, performance bottlenecks, and dependency risks.\n\n**Instructions:**\n1. **Summarize Focus:** State which depth level you are on and what you will focus on.\n2. **Analyze:** Perform the review based on the checklist for depth {{analysisDepth}}.\n3. **List Findings:** Document your findings, categorizing them as 'Critical', 'Major', or 'Minor'.\n4. **Set Flag:** If you find any 'Critical' or 'Major' issues, set the context variable `majorIssuesFound = true`.",
|
|
155
|
-
"agentRole": "You are a Senior Staff Engineer performing a structured, multi-pass code review with increasing levels of scrutiny.",
|
|
156
|
-
"guidance": [
|
|
157
|
-
"At each depth, focus only on the items in that checklist.",
|
|
158
|
-
"Use Chain-of-Thought reasoning to explain your findings (keep chat concise; write full details to the doc).",
|
|
159
|
-
"Retrieval bias: Prefer reading files/functions from 'Neighborhood Map' and HOT paths before broader scans.",
|
|
160
|
-
"Depth 2: Prefer Flow Anchors and HOT paths; walk 2–3 inbound/outbound traces; verify control/data flow vs invariants; record surprises.",
|
|
161
|
-
"Depth 3: On HOT paths, check module boundaries, DI patterns, performance, and consumer contracts; note potential breakages.",
|
|
162
|
-
"Propose tiny diffs (non-blocking) for the top 1–2 Major findings: fenced unified diff with file paths; ≤8 changed lines total and ≤2 hunks per patch; add one-line rationale; scope narrow; skip if ambiguous and state why.",
|
|
163
|
-
"For each proposed patch, add a matching ready-to-copy MR comment (file:line + rationale).",
|
|
164
|
-
"Append patches to the 'Proposed Patches' section; append MR comments and log the revision.",
|
|
165
|
-
"Caps per pass: ≤2 patches; ≤3 MR comments; ≤1200 chars of total patch text.",
|
|
166
|
-
"Self-critique: list 1–2 least-confident areas and what would increase confidence under 'Confidence & Follow-ups'."
|
|
167
|
-
],
|
|
168
|
-
"runCondition": { "or": [ { "var": "analysisDepth", "equals": 1 }, { "var": "analysisDepth", "equals": 2 }, { "var": "analysisDepth", "equals": 3 } ] },
|
|
169
|
-
"functionReferences": ["upsertSection()", "appendFinding()", "appendMRComment()", "logRevision()"],
|
|
170
|
-
"requireConfirmation": false
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"id": "perform-nit-hunt",
|
|
174
|
-
"title": "Nit Hunt (Depth 4)",
|
|
175
|
-
"prompt": "Perform a focused nit hunt in `moduleRoot` on changed files and immediate neighbors. Be picky but objective. Provide concise, actionable nits with one-line rationale and suggested fix.",
|
|
176
|
-
"agentRole": "You are a meticulous reviewer surfacing small, high-signal improvements.",
|
|
177
|
-
"guidance": [
|
|
178
|
-
"Targets: naming clarity; small readability/style inconsistencies; redundant comments; commented/dead code; import/order polish; safe micro-perf; test naming/structure.",
|
|
179
|
-
"Quotas: if majorIssuesFound==true aim 5–8 (cap 12); else aim 8–12 (cap 15); ≤3 per category; 1–2 lines each; dedupe; group by file; prefix 'Nit:'.",
|
|
180
|
-
"MUST add ready-to-copy MR comments for the top 3 nits (file:line, short title, 1–2 line rationale, optional tiny diff); log the revision.",
|
|
181
|
-
"Append Nit grouped by file: 'path:line — nit text'."
|
|
182
|
-
],
|
|
183
|
-
"runCondition": { "var": "analysisDepth", "equals": 4 },
|
|
184
|
-
"functionReferences": ["appendMRComment()", "upsertSection()", "logRevision()"],
|
|
185
|
-
"requireConfirmation": false
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"id": "consolidate-patterns",
|
|
191
|
-
"title": "Consolidate Pattern Findings",
|
|
192
|
-
"prompt": "Using `moduleRoot` and `patternCatalog`, compare the MR changes to validated patterns (patterns observed ≥2 times across distinct files). Do not use changed code to define patterns. Summarize adherence and deviations, and generate a grouped `patternAppendix` (by directory/file). If no patterns meet the threshold, state this and list 'candidate conventions' separately as informative only. Set `patternAppendixReady = true`.",
|
|
193
|
-
"agentRole": "You are a senior engineer consolidating pattern adherence findings for clear reporting.",
|
|
194
|
-
"guidance": [
|
|
195
|
-
"Restrict to the module of the MR (`moduleRoot`).",
|
|
196
|
-
"Avoid re-scanning if `patternCatalog` already exists; reuse it.",
|
|
197
|
-
"Do not treat changed code as patterns; match only against validated patterns from `patternCatalog` (≥2 distinct occurrences).",
|
|
198
|
-
"Produce 'Patterns' and 'Pattern Deviations' sections: adherence table with confidence + counts; deviation ledger with file:line, rationale, and suggested alignment.",
|
|
199
|
-
"Include per-pattern occurrence counts in the module (excluding changed files)."
|
|
200
|
-
],
|
|
201
|
-
"runCondition": { "var": "complexity", "not_equals": "Trivial" },
|
|
202
|
-
"functionReferences": ["consolidatePatternFindings()", "appendPatternResult()", "upsertSection()", "logRevision()"],
|
|
203
|
-
"requireConfirmation": false
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"id": "phase-3-impact-analysis",
|
|
207
|
-
"title": "Phase 3: Testing, Documentation & Impact Analysis",
|
|
208
|
-
"prompt": "My goal is to assess the secondary impacts of this change.\n\n1. **Testing:** Based on the code changes, what tests would be expected (unit, integration, etc.)? Are new tests included? Are existing tests updated? Are there obvious gaps in test coverage for the new logic?\n2. **Documentation:** Is new or complex logic adequately commented? Could any external documentation (e.g., READMEs) be affected by this change?\n3. **Breaking Changes:** Are there any changes that could break backward compatibility for APIs or other parts of the codebase?\n\nDoc-first subsections to add/update:\n- Impacted User Flows: table 'Flow/Anchor | Type | Path/ID | Handler Chain (short) | Impact | Risk(L/M/H)'.\n- Affected Consumers: table 'Consumer | Type | Breakage Risk | Migration Note'.\n- Test Gaps & Proposals: table 'Scope | Target | Purpose | Sketch'.",
|
|
209
|
-
"agentRole": "You are a software quality engineer specializing in testing strategy and impact analysis. Your expertise includes identifying testing gaps, documentation requirements, and potential breaking changes that could affect system stability or user experience.",
|
|
210
|
-
"guidance": [
|
|
211
|
-
"Assessing test coverage is critical. A lack of tests for new logic is often a 'Major' or 'Critical' concern.",
|
|
212
|
-
"Derive Impacted User Flows from Flow Anchors and HOT paths (depth ≤2); cap ≤5 flows; prefer acceptance-criteria keywords.",
|
|
213
|
-
"List Affected Consumers (importers/API clients/message consumers); cap ≤8; rank by usage frequency and proximity to changed code.",
|
|
214
|
-
"Test skeletons: for top-risk flows/consumers, add concise code fences (project test style if clear) with a suggested file path comment at top; ≤25 lines per sketch; ≤6 total sketches (≤2 per top risk).",
|
|
215
|
-
"For data/schema/API changes, add at least one Contract test proposal; total test proposals cap ≤10.",
|
|
216
|
-
"Add 2 ready-to-copy MR comments for the highest-risk gaps; log the revision."
|
|
217
|
-
],
|
|
218
|
-
"runCondition": { "and": [ { "var": "complexity", "not_equals": "Trivial" }, { "or": [ { "var": "contextGatheringComplete", "equals": true }, { "var": "skipContextGathering", "equals": true } ] } ] },
|
|
219
|
-
"functionReferences": ["upsertSection()", "appendMRComment()", "logRevision()"],
|
|
220
|
-
"requireConfirmation": false
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"id": "hygiene-and-inconsistencies",
|
|
224
|
-
"title": "Hygiene & Inconsistencies Sweep",
|
|
225
|
-
"prompt": "Perform a platform-agnostic hygiene sweep scoped to the current module and changed files. Surface concise, actionable findings across categories:\n\n- Tests: disabled/skipped/focused tests; tests with no assertions; mismatched or overly generic names\n- Comments: commented-out code blocks; stale/misleading comments; suppression directives without justification\n- TODO/FIXME/HACK/BUG: missing ticket/reference or clearly stale; high density in an area\n- Inconsistencies: naming/DI/logging/error handling divergences from local patterns; ad-hoc debug prints; obvious unused identifiers/unreachable code\n\nConstraints:\n- Total ≤10 items; ≤3 per category; dedupe similar items; group by file; keep each note ≤2 lines\n- Elevate to Major only when clearly risky (e.g., focused tests, tests with no assertions)\n\nWrite results to the live doc under 'Hygiene & Inconsistencies' with category counts and bullets grouped by file. For the top 2–3 actionable items, add Ready-to-Copy MR comments. Log the revision.",
|
|
226
|
-
"agentRole": "You are a pragmatic reviewer catching small but valuable quality issues without adding noise.",
|
|
227
|
-
"guidance": [
|
|
228
|
-
"Scope strictly to moduleRoot and changed files plus immediate neighbors.",
|
|
229
|
-
"Write full details to the live doc; in chat, report counts and the doc path."
|
|
230
|
-
],
|
|
231
|
-
"runCondition": { "var": "complexity", "not_equals": "Trivial" },
|
|
232
|
-
"functionReferences": ["discoverHygieneSignals()", "consolidateHygieneFindings()", "appendHygieneFinding()", "appendMRComment()", "upsertSection()", "logRevision()"],
|
|
233
|
-
"requireConfirmation": false
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"id": "prepare-nit-appendix",
|
|
237
|
-
"title": "Prepare Nit Appendix",
|
|
238
|
-
"prompt": "Consolidate all non-blocking 'Nit:' items found so far into a clean appendix.\n\nTasks:\n1. Aggregate `nitFindings` by file.\n2. Format each entry as: `filePath:line - short description` with one-line context if helpful.\n3. Produce markdown in `nitAppendix`.\n4. Set `nitAppendixReady = true` and `nitsCount` accordingly.",
|
|
239
|
-
"agentRole": "You are a meticulous note-taker consolidating non-blocking suggestions for clarity and follow-through.",
|
|
240
|
-
"guidance": [
|
|
241
|
-
"This step is non-blocking and purely for documentation quality.",
|
|
242
|
-
"Deterministic ordering: sort by file path ASC → line ASC → category ASC; group by file.",
|
|
243
|
-
"Categories: Naming; Readability; Style; Comments; Imports/Order; Tests (naming/structure); Minor Perf.",
|
|
244
|
-
"Row format: 'path:line — Nit: short text (≤2 lines); suggested fix: <one-liner> [category]'; optional tiny diff snippet ≤6 lines only if helpful.",
|
|
245
|
-
"Dedupe: identical path:line + similar text → keep one; if overlap with Hygiene/Patterns, keep in the most specific section and cross-reference in the other.",
|
|
246
|
-
"Caps: ≤15 total; ≤3 per category; if exceeded, append a single 'More items omitted due to caps.' line.",
|
|
247
|
-
"Cross-link any existing MR comments to their nit rows (e.g., 'MR: MR-##').",
|
|
248
|
-
"If fewer than 3 Nit MR comments exist overall, create minimal ready-to-copy MR comments for the highest-signal remaining nits to reach 3 (file:line, short title, 1–2 line rationale, optional tiny diff).",
|
|
249
|
-
"Recap (output.notesMarkdown): Summarize what you reviewed, key findings (counts by severity), decisions made, and the doc path. Be specific about what you found."
|
|
250
|
-
],
|
|
251
|
-
"runCondition": { "and": [ { "var": "complexity", "not_equals": "Trivial" }, { "or": [ { "var": "contextGatheringComplete", "equals": true }, { "var": "skipContextGathering", "equals": true } ] } ] },
|
|
252
|
-
"functionReferences": ["appendMRComment()", "upsertSection()", "logRevision()"],
|
|
253
|
-
"requireConfirmation": false
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"id": "finalize-review-document",
|
|
257
|
-
"title": "Finalize Review Document",
|
|
258
|
-
"prompt": "Finalize the live review document (no new analysis).\n\nBranching:\n- If `complexity == 'Trivial'`:\n 1) Upsert a brief Executive Summary (1–2 lines) with 'Recommendation: Approve'.\n 2) Perform light hygiene (≤2 items) on changed files; write concise bullets under 'Hygiene & Inconsistencies'.\n 3) Quick Nit sweep; write bullets under 'Nit Appendix'.\n 4) Update Header: set status=Final; include final counts.\n 5) Append 'Finalized trivial review' to the Revision Log.\n\n- Otherwise (non-trivial):\n 1) Upsert Executive Summary (3 positives, 3 risks, final recommendation).\n 2) Dedupe and sort Findings (Severity → File → Line).\n 3) Ensure sections exist: Patterns, Pattern Deviations, Tests & Docs, Ideas & Alternatives, Nits, MR Comments.\n 4) Ensure every Critical/Major finding has a curated MR comment; add minimal ones if missing.\n 5) Update Header: set status=Final; include final counts and decision.\n 6) Append 'Finalized document' to the Revision Log.\n\nRecap (output.notesMarkdown): Summarize what you finalized — decision, key finding counts by severity, and the doc path. For non-trivial reviews, include top risks and the recommendation rationale.",
|
|
259
|
-
"agentRole": "You are a facilitator ensuring the final document is complete, accurate, and consumable.",
|
|
260
|
-
"guidance": [
|
|
261
|
-
"Write full details to the live doc. Recap (output.notesMarkdown): Summarize what you finalized, key findings, recommendation, and the doc path.",
|
|
262
|
-
"Ensure sections exist: 'Executive Summary', 'Decision Criteria', 'Risk Heatmap', 'Proposed Patches', 'Test Gaps & Proposals', 'Confidence & Follow-ups'; create missing sections with stable anchors.",
|
|
263
|
-
"Executive Summary template: 3 positives (≤120 chars each); 3 risks (≤120 chars each); decision & rationale (≤2 lines); add links to Patterns, Deviations, Tests, Hygiene; total ≤12 lines.",
|
|
264
|
-
"Decision Criteria checklist: Scope fit; Tests adequate; Pattern adherence; Performance risk; Backwards compatibility; Security basics. Render as 'Criteria: [✓/✗] label — 1 phrase note' in fixed order.",
|
|
265
|
-
"Risk Heatmap table: rows 'Risk | Area | Likelihood(L/M/H) | Impact(L/M/H) | Mitigation(≤1 line)'; sort by Impact desc then Likelihood desc; cap ≤6 rows; add 'omitted due to caps' line if needed.",
|
|
266
|
-
"Dedupe patches and MR comments; ensure every Critical/Major has either a patch or a copy-ready MR comment.",
|
|
267
|
-
"If any Critical/Major lacks an MR comment, generate a minimal ready-to-copy comment (file:line, short title, 1–2 line rationale, optional tiny diff snippet).",
|
|
268
|
-
"Ensure at least 3 Nit MR comments exist overall; if fewer, create minimal Nit MR comments for the top remaining nits to reach 3.",
|
|
269
|
-
"Group MR comments by file and dedupe similar entries; add a 'Missing Comments Summary' note if any comments were auto-added.",
|
|
270
|
-
"Cross-link each MR comment to its related Proposed Patch when applicable ('See Proposed Patch: <title>').",
|
|
271
|
-
"Keep all caps deterministic; if any list exceeds its cap, add a single trailing 'More items omitted due to caps.' line."
|
|
272
|
-
],
|
|
273
|
-
"functionReferences": ["finalizeReviewDocument()", "upsertSection()", "discoverHygieneSignals()", "consolidateHygieneFindings()", "appendHygieneFinding()", "logRevision()"],
|
|
274
|
-
"requireConfirmation": false
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
}
|