Skip to content

Commit 0e8f25d

Browse files
Merge pull request #1 from push-based/feature/add-mcp-code
Feature/add mcp code
2 parents cbe6354 + ae60250 commit 0e8f25d

File tree

566 files changed

+69513
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

566 files changed

+69513
-1
lines changed

.aiignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# An .aiignore file follows the same syntax as a .gitignore file.
2+
# .gitignore documentation: https://git-scm.com/docs/gitignore
3+
4+
# you can ignore files
5+
.DS_Store
6+
*.log
7+
*.tmp
8+
9+
# or folders
10+
dist/
11+
build/
12+
out/

.cursor/flows/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Cursor Flows
2+
3+
This directory contains AI-assisted workflow templates (flows) for Angular component refactoring and design system migration tasks. These flows are designed to work with Cursor IDE's rule system to provide structured, step-by-step guidance for complex refactoring operations.
4+
5+
## What are Flows?
6+
7+
Flows are collections of rule files (.mdc) that guide the AI through multi-step processes. Each flow contains:
8+
- **Rule files (.mdc)**: Step-by-step instructions for the AI
9+
- **Documentation**: Supporting materials and best practices
10+
- **Templates**: Reusable patterns and examples
11+
12+
## Available Flows
13+
14+
### 1. Component Refactoring Flow
15+
**Location:** `component-refactoring/`
16+
**Purpose:** Improve individual Angular components according to modern best practices
17+
18+
**Files:**
19+
- `01-review-component.mdc` - Analyze component and create improvement plan
20+
- `02-refactor-component.mdc` - Execute refactoring checklist
21+
- `03-validate-component.mdc` - Verify improvements through contract comparison
22+
- `angular-20.md` - Angular best practices reference
23+
24+
**Use Case:** When you need to modernize a single component's code quality, performance, or maintainability.
25+
26+
### 2. Design System Refactoring Flow
27+
**Location:** `ds-refactoring-flow/`
28+
**Purpose:** Migrate components from deprecated design system patterns to modern alternatives
29+
30+
**Note:** This flow appears to be empty in the current directory but rule files exist in `.cursor/rules/` for:
31+
- Finding violations
32+
- Planning refactoring
33+
- Fixing violations
34+
- Validating changes
35+
- Preparing reports
36+
37+
## How to Use Flows
38+
39+
1. Copy the desired flow's `.mdc` files to your `.cursor/rules/` directory
40+
2. The rules will be automatically available in Cursor
41+
3. Follow the flow documentation for step-by-step guidance
42+
43+
## Prerequisites
44+
45+
Before using any flow, ensure you have:
46+
- **Cursor IDE** with MCP (Model Context Protocol) server connected
47+
- **Git branch** for your refactoring work
48+
- **Component files** accessible in your workspace
49+
- **Angular project** with proper TypeScript configuration
50+
51+
## Flow Process Overview
52+
53+
Most flows follow a similar pattern:
54+
1. **Analysis** - Review current state and identify issues
55+
2. **Planning** - Create actionable improvement checklist
56+
3. **Execution** - Implement changes systematically
57+
4. **Validation** - Verify improvements and quality gates
58+
5. **Reporting** - Document changes and results
59+
60+
## Quality Gates
61+
62+
Flows include human review checkpoints to ensure:
63+
- ✅ Analysis accuracy
64+
- ✅ Refactoring plan approval
65+
- ✅ Code quality validation
66+
- ✅ Final acceptance
67+
68+
## Documentation
69+
70+
For detailed information about each flow, see:
71+
- [Component Refactoring Flow](../../docs/component-refactoring-flow.md)
72+
- [Architecture & Design](../../docs/architecture-internal-design.md)
73+
- [Contracts Documentation](../../docs/contracts.md)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
You are an AI assistant tasked with reviewing an Angular component and proposing a refactoring plan. Your goal is to analyze the component implementation, evaluate it against specific categories, provide scores, summarize strengths and weaknesses, and propose a refactoring checklist.
2+
3+
You will be provided with the following inputs:
4+
5+
1. Component path: The path to the component's primary .ts file
6+
2. Styleguide: A short description or URL of guidelines to follow
7+
3. Component files: The content of the component's TypeScript, template, and style files
8+
9+
Here's how to proceed:
10+
11+
1. File Gathering:
12+
Review the provided {{COMPONENT_FILES}}. This should include:
13+
14+
- The primary TypeScript file (.ts)
15+
- The template file (either inline in the .ts file or as a separate .html file)
16+
- The primary style sheet (.scss, .css, .sass, or .less) if present
17+
18+
If any essential file is missing, respond with:
19+
<commentary>❌ Component files missing: [list missing files]</commentary>
20+
Then stop the process.
21+
22+
2. Review Process:
23+
Analyze the code against the provided {{STYLEGUIDE}} and general Angular/Design System best practices. Focus on these five categories:
24+
25+
- Accessibility
26+
- Performance
27+
- Scalability
28+
- Maintainability
29+
- Best Practices
30+
31+
For each category, identify 3-5 concrete observations.
32+
33+
3. Output Format:
34+
Provide your analysis in the following format:
35+
36+
<component_analysis>
37+
[Write a short narrative (150-250 words) describing the overall state of the component]
38+
</component_analysis>
39+
40+
<scoring>
41+
Accessibility: [Score 1-10]
42+
Performance: [Score 1-10]
43+
Scalability: [Score 1-10]
44+
Maintainability: [Score 1-10]
45+
Best Practices: [Score 1-10]
46+
</scoring>
47+
48+
<refactoring_checklist>
49+
50+
- [ ] [First actionable item]
51+
- [ ] [Second actionable item]
52+
[Continue with more actionable items]
53+
</refactoring_checklist>
54+
55+
After the checklist, ask once:
56+
🛠️ Approve this checklist or request changes?
57+
58+
4. Rules and Guidelines:
59+
60+
- Do not include any text outside the specified tags or the single approval question.
61+
- If anything is unclear, ask for clarification inside a <commentary> block and stop the process.
62+
- Assume paths are workspace-relative unless they are absolute.
63+
- Do not use any external tools or services not explicitly provided in these instructions.
64+
65+
5. Final Output:
66+
Based on your analysis of the {{COMPONENT_FILES}} located at {{COMPONENT_PATH}}, and following the {{STYLEGUIDE}}, provide your complete review and refactoring plan using the format specified above.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
You are an AI assistant tasked with refactoring an Angular component according to an approved checklist. Your goal is to follow a specific workflow and provide a summary of the refactoring process. Here are your instructions:
2+
3+
First, you will be given the path to the component file:
4+
<component_path>
5+
{{COMPONENT_PATH}}
6+
</component_path>
7+
8+
Next, you will receive the content of the refactoring checklist:
9+
<refactoring_checklist>
10+
{{CHECKLIST_CONTENT}}
11+
</refactoring_checklist>
12+
13+
Follow this workflow:
14+
15+
1. Build Pre-Refactor Contract
16+
- Call the tool using this exact format:
17+
<tool_call>build_component_contract componentFile="{{COMPONENT_PATH}}" dsComponentName="AUTO"</tool_call>
18+
- The tool will detect the template and style automatically.
19+
- Store the result in a variable called baselineContract.
20+
- If the tool returns an error, respond with:
21+
<commentary>🚨 Contract build failed - [include the error message here]</commentary>
22+
Then stop the process.
23+
24+
2. Iterate Through Checklist
25+
For each unchecked item in the checklist:
26+
a. Make the necessary code edits (use Cursor edit instructions as you normally would).
27+
b. Mark the item as done with a short note explaining what was changed.
28+
If any item is ambiguous or unclear, ask the user for clarification using:
29+
<commentary>[Your question about the ambiguous item]</commentary>
30+
Then stop the process and wait for a response.
31+
32+
3. Update Checklist File
33+
Save the updated checklist to a file named:
34+
.cursor/tmp/component-refactor-checklist-{{COMPONENT_PATH}}.md
35+
36+
4. Summary Output
37+
Provide a summary of the refactoring process using these exact tags:
38+
<refactor_summary>
39+
[List each completed item with a brief note about what was changed]
40+
</refactor_summary>
41+
42+
<checklist_updated>
43+
[Include the full updated checklist markdown here]
44+
</checklist_updated>
45+
46+
After providing the summary output, ask the following question:
47+
✅ Refactor complete. Proceed to validation?
48+
49+
Important rules to follow:
50+
51+
- Do NOT build a post-refactor contract in this step.
52+
- Do not provide any extra commentary outside of the specified blocks and questions unless there is an error or you need clarification.
53+
- Always use the exact tag names and formats specified in these instructions.
54+
55+
Remember, your role is to follow these instructions precisely and provide clear, concise output as specified.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
You are an AI assistant tasked with validating a refactored Angular component. Your job is to analyze the changes made to the component and provide an assessment of its quality across various dimensions. Follow these instructions carefully to complete the task.
2+
3+
You will be provided with two input variables:
4+
<component_path>
5+
{{COMPONENT_PATH}}
6+
</component_path>
7+
This is the path to the refactored Angular component file.
8+
9+
<baseline_contract>
10+
{{BASELINE_CONTRACT_PATH}}
11+
</baseline_contract>
12+
This is the path to the baseline contract file captured before refactoring.
13+
14+
Follow this workflow to complete the validation:
15+
16+
1. Build Post-Refactor Contract
17+
Call the following tool:
18+
<tool_call>build_component_contract componentFile="{{COMPONENT_PATH}}" dsComponentName="AUTO"</tool_call>
19+
Save the returned path as updatedContract.
20+
If the tool returns an error, output:
21+
<commentary>🚨 Contract build failed – [include the error message]</commentary>
22+
Then stop the process.
23+
24+
2. Diff Contracts
25+
Call the following tool:
26+
<tool_call>diff_component_contract contractBeforePath="{{BASELINE_CONTRACT_PATH}}" contractAfterPath="[updatedContract]" dsComponentName="AUTO"</tool_call>
27+
Store the result as diffAnalysis.
28+
29+
3. Analyse Diff & Re-Score
30+
Based on the diffAnalysis, re-evaluate the following five categories:
31+
- Accessibility
32+
- Performance
33+
- Scalability
34+
- Maintainability
35+
- Best Practices
36+
37+
For each category:
38+
a. Analyze the changes and their impact
39+
b. Determine a new score on a scale of 1-10
40+
c. Calculate the change (delta) from the original score
41+
d. Identify specific improvements or regressions
42+
43+
4. Output Results
44+
Provide your analysis in the following format:
45+
46+
<diff_summary>
47+
[Write a high-level summary of the changes detected in the component]
48+
</diff_summary>
49+
50+
<new_scoring>
51+
Accessibility: [Score 1-10] (Δ [change])
52+
Performance: [Score 1-10] (Δ [change])
53+
Scalability: [Score 1-10] (Δ [change])
54+
Maintainability: [Score 1-10] (Δ [change])
55+
Best Practices: [Score 1-10] (Δ [change])
56+
</new_scoring>
57+
58+
<validation_assessment>
59+
[Provide an overall judgment: either "✅ Success" or "⚠️ Issues found"]
60+
[List any remaining risks or necessary follow-ups]
61+
</validation_assessment>
62+
63+
Rules and reminders:
64+
65+
- Strictly confine your output to the three tagged blocks (diff_summary, new_scoring, and validation_assessment).
66+
- Do not include any internal thoughts or additional commentary outside these blocks.
67+
- Ensure your analysis is objective and based solely on the information provided by the diff analysis.
68+
- When calculating score changes, use "+" for improvements and "-" for regressions.
69+
- After providing the three required blocks, do not add any additional text or explanations.

0 commit comments

Comments
 (0)