Skip to content

Commit 4217822

Browse files
authored
Merge pull request #2849 from Strategy11/feature/windsurf-configuration-formidable
Add comprehensive Windsurf configuration for Formidable Forms development
2 parents 3c4c38a + d92ecf7 commit 4217822

55 files changed

Lines changed: 7799 additions & 118 deletions

Some content is hidden

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

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.php-cs-fixer.cache export-ignore
1818
.wp-env.json export-ignore
1919
.coderabbit.yaml export-ignore
20+
.windsurf export-ignore
2021
cypress.config.js export-ignore
2122
/bin/ export-ignore
2223
changelog.txt export-ignore
@@ -45,6 +46,7 @@ mago.toml export-ignore
4546
/resources/ export-ignore
4647
webpack.dev.js export-ignore
4748
.browserslistrc export-ignore
49+
/eslint-rules/ export-ignore
4850
/phpcs-sniffs/ export-ignore
4951
.deepsource.toml export-ignore
5052
.semgrepignore export-ignore

.windsurf/.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Override parent EditorConfig for .windsurf/ markdown files
2+
# Code blocks in these rule files must use WP coding standards (tabs, indent_size 4)
3+
# while all other .md files in the project keep space/2 from the root config.
4+
5+
[*.md]
6+
indent_style = tab
7+
indent_size = 4

.windsurf/.markdownlint.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"default": true,
3+
"MD003": { "style": "atx" },
4+
"MD007": { "indent": 4 },
5+
"MD013": { "line_length": 9999 },
6+
"no-hard-tabs": false,
7+
"whitespace": false
8+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
trigger: always_on
3+
description: Enterprise code change principles for safe, minimal-scope modifications.
4+
---
5+
6+
# Enterprise Code Change Principles
7+
8+
Critical principles for enterprise-level plugin development.
9+
10+
---
11+
12+
## Core Principles
13+
14+
1. **NEVER guess**: Always search and verify before making changes
15+
2. **Minimal scope**: Fix at the most specific location, closest to the problem
16+
3. **Backward compatibility**: Maintain 100% compatibility with existing callers
17+
4. **No custom solutions**: Never invent new patterns. Use existing ones or search the web to review best practices, then follow the official WordPress standards or VIP guidelines.
18+
5. **User changes are final**: If user makes manual changes, treat as authoritative
19+
6. **Multi-issue fixes**: When fixing multiple issues in one request, run all 6 phases independently for each issue. Findings from one issue's phases may inform the next, but every phase is mandatory for every issue, even when issues share a root cause.
20+
21+
---
22+
23+
## Analysis Phase
24+
25+
Before proposing solutions:
26+
27+
### Phase 1: Understand
28+
29+
- Read and understand the complete issue
30+
- Clarify expected vs actual behavior
31+
- Identify reproduction steps
32+
- Determine scope: which plugin(s), which feature(s)
33+
- **Cross-plugin**: Identify if the feature or setting exists in Lite, Pro, or both. Understand the full feature context across all relevant plugins
34+
- Working on an addon: research must include Lite AND Pro
35+
- Working on Pro: research must include Lite
36+
- Working on Lite: check if the change affects Pro or any active addon
37+
38+
### Phase 2: Locate
39+
40+
- Use code_search to find the root cause (not just symptoms)
41+
- Trace execution flow from entry point to failure
42+
- **Analyze complete context** of the class or file being changed — all features, logic, and flows
43+
- **Trace parent hierarchy**: search parent classes and files up to plugin root
44+
- **CSS-Specific Rules - Trace complete style cascade**: When debugging CSS on an element, identify ALL classes on the element and its ancestors, then search for ALL CSS rules affecting it (not just the obvious class). Understand the complete cascade before proposing changes
45+
- Identify ALL affected locations in the codebase
46+
- Map dependencies: what calls this code, what does this code call
47+
- Check plugin requirements: must code work standalone or require Pro/addons
48+
- **Cross-plugin**: Search for the same feature, helper, or code path in Lite and Pro (and addons if relevant). Understand how data flows between plugins
49+
50+
### Phase 3: Research
51+
52+
- **Never invent custom solutions if existing patterns exist**
53+
- Find existing patterns: search models, controllers, helpers, views for similar functionality
54+
- Study pattern usage: search ALL places using the pattern
55+
- Search official WordPress/VIP docs: function parameters, return types, deprecated alternatives
56+
- Search platform-specific docs: performance and security best practices
57+
- Verify alignment: ensure approach matches existing codebase patterns
58+
- **Cross-plugin**: Search for existing patterns and helpers in Lite and Pro that already solve the problem. Reuse them instead of inventing new solutions
59+
- **Iterate**: if a better pattern is found, repeat from Phase 2
60+
61+
---
62+
63+
## Solution Phase
64+
65+
### Phase 4: Select Solution
66+
67+
- Propose 2-3 solutions with trade-offs clearly stated
68+
- Select the solution with minimal scope and lowest risk
69+
- Fix at the most specific location, closest to root cause
70+
- Prefer adding safety checks over refactoring
71+
- Fix must be testable without touching other code
72+
- **Verify changes are not overkill**: If affecting several areas, review everything carefully to make sure the fix is not excessive. If it is, go back to Phase 2
73+
74+
---
75+
76+
## Change Phase
77+
78+
### Phase 5: Implement
79+
80+
- Never refactor unrelated code in the same commit
81+
- If a rule conflicts with existing code in the file being modified, follow the rule for new code but do not refactor unrelated existing code
82+
- Make the smallest change that completely solves the problem
83+
- **CSS-Specific Rules - Never modify shared CSS classes**: If a CSS class is already used elsewhere in the plugin, do not change its behavior. Instead, add a new specific class for the feature and define new styles for it
84+
- Use Big-O to compare algorithms and choose the most efficient one for large inputs and iterations
85+
- Never change method signatures, return types, or data structures
86+
- Add defensive checks where data comes in, not where used everywhere
87+
- Add PHPDoc/JSDoc for new methods/properties/functions and comments for complex logic
88+
- Never guess the version number and use `@since x.x` as the version placeholder in docblocks
89+
90+
---
91+
92+
## Change Verification Phase
93+
94+
### Phase 6: Verify
95+
96+
- Confirm fix resolves the reported issue
97+
- Confirm backward compatibility with existing callers
98+
- Confirm this change does not break any existing functionality
99+
- Test with Pro plugin active AND inactive
100+
- Test with empty data and missing keys
101+
- Confirm no PHP warnings, notices, or errors in any scenario
102+
- Test edge cases
103+
- Remove all debug code (error_log statements, debug comments, debug files)
104+
- Verify code passes phpcs/linting checks
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
trigger: always_on
3+
description: Enforces conventional commit message format for all git commits in the project.
4+
---
5+
6+
# Conventional Commit Messages
7+
8+
All commit messages MUST follow the Conventional Commits 1.0.0 specification.
9+
10+
## Format
11+
12+
```text
13+
<type>(<scope>): <description>
14+
15+
[optional body]
16+
17+
[optional footer(s)]
18+
```
19+
20+
## Types
21+
22+
| Type | Description | SemVer |
23+
| ---------- | ----------------------------------------------------- | ------ |
24+
| `fix` | Bug fix (patches a bug in the codebase) | PATCH |
25+
| `feat` | New feature (adds functionality to the codebase) | MINOR |
26+
| `docs` | Documentation only changes | - |
27+
| `style` | Code style changes (formatting, whitespace, etc.) | - |
28+
| `refactor` | Code change that neither fixes a bug nor adds feature | - |
29+
| `perf` | Performance improvement | - |
30+
| `test` | Adding or correcting tests | - |
31+
| `build` | Changes to build system or external dependencies | - |
32+
| `ci` | CI configuration changes | - |
33+
| `chore` | Other changes that don't modify src or test files | - |
34+
35+
## Scope (Optional)
36+
37+
The scope provides additional context about what part of the codebase the commit affects:
38+
39+
- `builder`: Form builder related changes
40+
- `entries`: Entry management changes
41+
- `fields`: Field types or field handling
42+
- `api`: API endpoints or integrations
43+
- `admin`: Admin UI changes
44+
- `frontend`: Front-end form display
45+
- `db`: Database operations
46+
- `i18n`: Internationalization
47+
- `security`: Security fixes or improvements
48+
- `deps`: Dependencies
49+
50+
## Breaking Changes
51+
52+
Indicate breaking changes with:
53+
54+
1. `!` after type/scope: `feat(api)!: change response format`
55+
2. `BREAKING CHANGE:` footer in the commit body
56+
57+
## Examples
58+
59+
```text
60+
fix(fields): resolve date field validation error
61+
62+
The date field was incorrectly validating dates in non-US formats.
63+
Added locale-aware date parsing.
64+
```
65+
66+
```text
67+
feat(builder): add drag-and-drop field reordering
68+
69+
Implements smooth drag-and-drop functionality for reordering fields
70+
in the form builder interface.
71+
```
72+
73+
```text
74+
fix: prevent XSS in field labels
75+
76+
Escape HTML entities in field labels before output.
77+
```
78+
79+
```text
80+
refactor(entries)!: change entry meta storage
81+
82+
BREAKING CHANGE: Entry meta now uses JSON encoding instead of
83+
serialized PHP arrays. Run migration script before updating.
84+
```
85+
86+
## Character Limits (50/72 Rule)
87+
88+
The 50/72 rule is a Git convention for readable commit messages:
89+
90+
| Element | Limit | Reason |
91+
| ------------ | ------------- | ------------------------------------------------------- |
92+
| Subject line | 50 characters | GitHub truncates at 72, but 50 is ideal for readability |
93+
| Body lines | 72 characters | Matches terminal width and Git log formatting |
94+
95+
**Subject Line (50 chars):**
96+
97+
- Forces concise, scannable summaries
98+
- Displays fully in `git log --oneline`
99+
- GitHub shows full title without truncation
100+
101+
**Body Lines (72 chars):**
102+
103+
- Readable in terminals and Git interfaces
104+
- Prevents awkward line breaks
105+
- Matches email format conventions
106+
107+
---
108+
109+
## Rules
110+
111+
1. Type MUST be lowercase.
112+
2. Description MUST start with lowercase letter.
113+
3. Description MUST NOT end with a period.
114+
4. Description MUST be imperative mood ("add" not "added" or "adds").
115+
5. Body MUST be separated from description by a blank line.
116+
6. Breaking changes MUST be indicated with `!` or `BREAKING CHANGE:` footer.
117+
7. Subject line MUST be 50 characters or fewer.
118+
8. Body lines MUST wrap at 72 characters.
119+
120+
## AI Commit Message Generation
121+
122+
When generating commit messages:
123+
124+
1. Analyze the staged changes to determine the appropriate type.
125+
2. Identify the scope from the files/directories changed.
126+
3. Write a concise description in imperative mood.
127+
4. Add body with details if the change is complex.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
trigger: always_on
3+
description: Baseline rules that apply across the entire Formidable Forms plugin ecosystem.
4+
---
5+
6+
# General Principles
7+
8+
Baseline rules that apply across the Formidable Forms plugin ecosystem.
9+
10+
## Writing Style for Generated Text
11+
12+
Applies to all generated text: PR titles, PR body, commit messages, comments, and etc.
13+
14+
- **No em dashes** (`` or ``): use commas, periods, or rewrite the sentence
15+
- **No semicolons** (`;`): split into separate sentences instead
16+
- **Full GitHub URL** for issue references (e.g., `https://github.com/Strategy11/formidable-pro/issues/3030`), never shorthand `#number` (PRs may target a different repo than the issue)
17+
- **No hard-wrapping** in PR body text: let GitHub handle line wrapping. The 72-char wrap rule applies only to **commit message bodies**
18+
19+
---
20+
21+
## PHPDoc/JSdoc Parameter Descriptions
22+
23+
PHPDoc/JSdoc `@param` descriptions must be concise and describe what the parameter contains. Never document a parameter as "Unused", always describe its content, even when it is present only for hook/filter signature compatibility.

0 commit comments

Comments
 (0)