heraspec 0.1.12 → 0.1.14
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/LICENSE +22 -22
- package/README.md +188 -103
- package/bin/heraspec.js +4805 -1122
- package/bin/heraspec.js.map +4 -4
- package/dist/core/templates/skills/CHANGELOG.md +117 -117
- package/dist/core/templates/skills/README-template.md +58 -58
- package/dist/core/templates/skills/README.md +38 -38
- package/dist/core/templates/skills/content-optimization-skill.md +104 -104
- package/dist/core/templates/skills/data/design-systems.csv +54 -0
- package/dist/core/templates/skills/data/pages-proposed.csv +21 -21
- package/dist/core/templates/skills/data/pages.csv +9 -9
- package/dist/core/templates/skills/data/typography.csv +57 -57
- package/dist/core/templates/skills/deploy-documentation-skill.md +408 -0
- package/dist/core/templates/skills/design-system-skill.md +176 -0
- package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +63 -63
- package/dist/core/templates/skills/documents/templates/documentation.html +49 -49
- package/dist/core/templates/skills/documents/templates/landing-script.js +38 -38
- package/dist/core/templates/skills/documents/templates/landing-style.css +158 -158
- package/dist/core/templates/skills/documents/templates/script.js +56 -56
- package/dist/core/templates/skills/documents/templates/style.css +155 -155
- package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -16
- package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -16
- package/dist/core/templates/skills/documents-skill.md +104 -104
- package/dist/core/templates/skills/e2e-test-skill.md +119 -119
- package/dist/core/templates/skills/git-embed-skill.md +57 -0
- package/dist/core/templates/skills/integration-test-skill.md +118 -118
- package/dist/core/templates/skills/knowledge/README.md +63 -0
- package/dist/core/templates/skills/knowledge/design-systems/airbnb/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/airtable/DESIGN.md +89 -0
- package/dist/core/templates/skills/knowledge/design-systems/apple/DESIGN.md +313 -0
- package/dist/core/templates/skills/knowledge/design-systems/bmw/DESIGN.md +180 -0
- package/dist/core/templates/skills/knowledge/design-systems/cal/DESIGN.md +259 -0
- package/dist/core/templates/skills/knowledge/design-systems/claude/DESIGN.md +312 -0
- package/dist/core/templates/skills/knowledge/design-systems/clay/DESIGN.md +304 -0
- package/dist/core/templates/skills/knowledge/design-systems/clickhouse/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/cohere/DESIGN.md +266 -0
- package/dist/core/templates/skills/knowledge/design-systems/coinbase/DESIGN.md +129 -0
- package/dist/core/templates/skills/knowledge/design-systems/composio/DESIGN.md +307 -0
- package/dist/core/templates/skills/knowledge/design-systems/cursor/DESIGN.md +309 -0
- package/dist/core/templates/skills/knowledge/design-systems/elevenlabs/DESIGN.md +265 -0
- package/dist/core/templates/skills/knowledge/design-systems/expo/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/figma/DESIGN.md +220 -0
- package/dist/core/templates/skills/knowledge/design-systems/framer/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/hashicorp/DESIGN.md +278 -0
- package/dist/core/templates/skills/knowledge/design-systems/ibm/DESIGN.md +332 -0
- package/dist/core/templates/skills/knowledge/design-systems/index.json +72 -0
- package/dist/core/templates/skills/knowledge/design-systems/intercom/DESIGN.md +146 -0
- package/dist/core/templates/skills/knowledge/design-systems/kraken/DESIGN.md +125 -0
- package/dist/core/templates/skills/knowledge/design-systems/linear.app/DESIGN.md +367 -0
- package/dist/core/templates/skills/knowledge/design-systems/lovable/DESIGN.md +298 -0
- package/dist/core/templates/skills/knowledge/design-systems/minimax/DESIGN.md +257 -0
- package/dist/core/templates/skills/knowledge/design-systems/mintlify/DESIGN.md +326 -0
- package/dist/core/templates/skills/knowledge/design-systems/miro/DESIGN.md +108 -0
- package/dist/core/templates/skills/knowledge/design-systems/mistral.ai/DESIGN.md +261 -0
- package/dist/core/templates/skills/knowledge/design-systems/mongodb/DESIGN.md +266 -0
- package/dist/core/templates/skills/knowledge/design-systems/notion/DESIGN.md +309 -0
- package/dist/core/templates/skills/knowledge/design-systems/nvidia/DESIGN.md +293 -0
- package/dist/core/templates/skills/knowledge/design-systems/ollama/DESIGN.md +267 -0
- package/dist/core/templates/skills/knowledge/design-systems/opencode.ai/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/pinterest/DESIGN.md +230 -0
- package/dist/core/templates/skills/knowledge/design-systems/posthog/DESIGN.md +256 -0
- package/dist/core/templates/skills/knowledge/design-systems/raycast/DESIGN.md +268 -0
- package/dist/core/templates/skills/knowledge/design-systems/replicate/DESIGN.md +261 -0
- package/dist/core/templates/skills/knowledge/design-systems/resend/DESIGN.md +303 -0
- package/dist/core/templates/skills/knowledge/design-systems/revolut/DESIGN.md +185 -0
- package/dist/core/templates/skills/knowledge/design-systems/runwayml/DESIGN.md +244 -0
- package/dist/core/templates/skills/knowledge/design-systems/sanity/DESIGN.md +357 -0
- package/dist/core/templates/skills/knowledge/design-systems/sentry/DESIGN.md +262 -0
- package/dist/core/templates/skills/knowledge/design-systems/spacex/DESIGN.md +194 -0
- package/dist/core/templates/skills/knowledge/design-systems/spotify/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/stripe/DESIGN.md +322 -0
- package/dist/core/templates/skills/knowledge/design-systems/supabase/DESIGN.md +255 -0
- package/dist/core/templates/skills/knowledge/design-systems/superhuman/DESIGN.md +252 -0
- package/dist/core/templates/skills/knowledge/design-systems/together.ai/DESIGN.md +263 -0
- package/dist/core/templates/skills/knowledge/design-systems/uber/DESIGN.md +295 -0
- package/dist/core/templates/skills/knowledge/design-systems/vercel/DESIGN.md +310 -0
- package/dist/core/templates/skills/knowledge/design-systems/voltagent/DESIGN.md +323 -0
- package/dist/core/templates/skills/knowledge/design-systems/warp/DESIGN.md +253 -0
- package/dist/core/templates/skills/knowledge/design-systems/webflow/DESIGN.md +92 -0
- package/dist/core/templates/skills/knowledge/design-systems/wise/DESIGN.md +173 -0
- package/dist/core/templates/skills/knowledge/design-systems/x.ai/DESIGN.md +257 -0
- package/dist/core/templates/skills/knowledge/design-systems/zapier/DESIGN.md +328 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/profile.json +27 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/structure.md +137 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/profile.json +39 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/structure.md +208 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/profile.json +51 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/structure.md +369 -0
- package/dist/core/templates/skills/knowledge/index.json +65 -0
- package/dist/core/templates/skills/module-codebase-skill.md +110 -110
- package/dist/core/templates/skills/plugin-directory-skill.md +396 -396
- package/dist/core/templates/skills/project-memory-skill.md +222 -0
- package/dist/core/templates/skills/project-memory-skill.vi.md +223 -0
- package/dist/core/templates/skills/scripts/CODE_EXPLANATION.md +394 -394
- package/dist/core/templates/skills/scripts/SEARCH_ALGORITHMS_COMPARISON.md +421 -421
- package/dist/core/templates/skills/scripts/SEARCH_MODES_GUIDE.md +238 -238
- package/dist/core/templates/skills/scripts/__pycache__/core.cpython-311.pyc +0 -0
- package/dist/core/templates/skills/scripts/core.py +391 -385
- package/dist/core/templates/skills/scripts/search.py +1 -1
- package/dist/core/templates/skills/smart-explore-skill.md +141 -0
- package/dist/core/templates/skills/sourcecode-analyzer-skill.md +210 -0
- package/dist/core/templates/skills/sourcecode-analyzer-skill.vi.md +210 -0
- package/dist/core/templates/skills/suggestion-skill.md +118 -118
- package/dist/core/templates/skills/templates/accessibility-checklist.md +40 -40
- package/dist/core/templates/skills/templates/example-prompt-full-theme.md +333 -333
- package/dist/core/templates/skills/templates/page-types-guide.md +338 -338
- package/dist/core/templates/skills/templates/pages-proposed-summary.md +273 -273
- package/dist/core/templates/skills/templates/pre-delivery-checklist.md +42 -42
- package/dist/core/templates/skills/templates/prompt-template-full-theme.md +313 -313
- package/dist/core/templates/skills/templates/responsive-design.md +40 -40
- package/dist/core/templates/skills/ui-ux-skill.md +595 -584
- package/dist/core/templates/skills/unit-test-skill.md +111 -111
- package/dist/core/templates/skills/ux-element/templates/Controller.php +50 -50
- package/dist/core/templates/skills/ux-element/templates/Shortcode.php +23 -23
- package/dist/core/templates/skills/ux-element/templates/Template.html +20 -20
- package/dist/core/templates/skills/ux-element/templates/Thumbnail.svg +8 -8
- package/dist/core/templates/skills/ux-element/templates/View.php +21 -21
- package/dist/core/templates/skills/ux-element-skill.md +83 -83
- package/dist/core/templates/skills/wordpress-plugin-check-skill.md +151 -76
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -47
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -60
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -22
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -15
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -169
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -41
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -21
- package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +100 -100
- package/dist/index.js +4068 -278
- package/package.json +75 -72
|
@@ -1,76 +1,151 @@
|
|
|
1
|
-
# Skill: WordPress Plugin Check (PCP)
|
|
2
|
-
|
|
3
|
-
This skill automates the process of running the WordPress Plugin Check tool and fixing the reported issues.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
To identify and resolve issues flagged by the WordPress Plugin Check (PCP) tool to ensure the plugin meets WordPress.org standards.
|
|
8
|
-
|
|
9
|
-
## Prerequisites
|
|
10
|
-
|
|
11
|
-
1. **Install Plugin Check (PCP)**:
|
|
12
|
-
- You MUST have the [Plugin Check (PCP)](https://wordpress.org/plugins/plugin-check/) plugin installed and active on your WordPress site.
|
|
13
|
-
- CLI command relies on this plugin to generate reports.
|
|
14
|
-
|
|
15
|
-
2. **Configure wp-config.php**:
|
|
16
|
-
- Ensure your `wp-config.php` uses `127.0.0.1` instead of `localhost` for database host if you encounter connection issues with CLI.
|
|
17
|
-
- Example: `define( 'DB_HOST', '127.0.0.1' );`
|
|
18
|
-
|
|
19
|
-
## Required Variables
|
|
20
|
-
|
|
21
|
-
- `{{plugin_folder_name}}`: The actual folder name of the target plugin (e.g., `poly-locations-manager` or `my-awesome-plugin`).
|
|
22
|
-
> **Note**: `polyutilities` in examples is just a placeholder. ALWAYS replace it with the actual plugin slug you are working on.
|
|
23
|
-
|
|
24
|
-
## Agent Usage & Examples
|
|
25
|
-
|
|
26
|
-
### Triggering the Skill
|
|
27
|
-
|
|
28
|
-
Users may ask to "check plugin [name]" or "run plugin check".
|
|
29
|
-
|
|
30
|
-
**Example Prompt (Reference Only):**
|
|
31
|
-
> "Use skill plugin-check to check, then resolve *all* issues mentioned for plugin `[TARGET_PLUGIN_NAME]`. Ensure careful handling and verify that related features still function correctly. If uncertain about any fix, add a TODO note in the code instead of applying a risky change."
|
|
32
|
-
|
|
33
|
-
**CRITICAL INSTRUCTION**:
|
|
34
|
-
- Replace `[TARGET_PLUGIN_NAME]` with the actual plugin folder name provided by the user.
|
|
35
|
-
- IF the user does not specify a name, infer it from the current working directory or the `wp-content/plugins/` structure.
|
|
36
|
-
- **DO NOT** default to `polyutilities` unless the user specifically asked for it.
|
|
37
|
-
|
|
38
|
-
### Process Flow
|
|
39
|
-
|
|
40
|
-
#### Step 1: Run Plugin Check
|
|
41
|
-
|
|
42
|
-
1. **Identify Plugin Folder**: Ensure you are in the root workspace of the project. The plugin folder is usually the one you are currently working on.
|
|
43
|
-
2. **Execute Command**: Run the following command to generate the report. Replace `{{plugin_folder_name}}` with the actual directory name of the plugin.
|
|
44
|
-
```bash
|
|
45
|
-
mkdir -p wp-content/plugins/{{plugin_folder_name}}/_pcp && wp plugin check {{plugin_folder_name}} --exclude-files=.DS_Store,.sh,.md --exclude-directories=documentations,heraspec,node_modules,tests,dist,_pcp --format=table > wp-content/plugins/{{plugin_folder_name}}/_pcp/pcp.txt
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
#### Step 2: Review and Confirm
|
|
49
|
-
|
|
50
|
-
1. **Read Report**: Read the content of `wp-content/plugins/{{plugin_folder_name}}/_pcp/pcp.txt`.
|
|
51
|
-
2. **Notify User**: Inform the user about the number or types of issues found.
|
|
52
|
-
3. **Wait for Confirmation**: Do NOT proceed to fix issues automatically without user confirmation unless explicitly authorized to "fix all".
|
|
53
|
-
|
|
54
|
-
#### Step 3: Fix Issues (Iterative)
|
|
55
|
-
|
|
56
|
-
1. **Target**: Aim to resolve **all** reported errors and warnings, ensuring no new issues are introduced.
|
|
57
|
-
2. **Safety First**: Ensure code changes do not break existing functionality.
|
|
58
|
-
* **Uncertainty**: If a fix is risky or unclear, DO NOT apply it blindly. Instead, add a comment `// TODO: [PCP] Fix this issue manually - [Reason]` and move to the next item.
|
|
59
|
-
3. **Iterate**:
|
|
60
|
-
* Apply fixes for a batch of issues.
|
|
61
|
-
* **Re-run Check**: Run the command from Step 1 again to verify fixes.
|
|
62
|
-
* Repeat until the report is clean or only contains intentional TODOs.
|
|
63
|
-
|
|
64
|
-
##
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
# Skill: WordPress Plugin Check (PCP)
|
|
2
|
+
|
|
3
|
+
This skill automates the process of running the WordPress Plugin Check tool and fixing the reported issues.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
To identify and resolve issues flagged by the WordPress Plugin Check (PCP) tool to ensure the plugin meets WordPress.org standards.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
1. **Install Plugin Check (PCP)**:
|
|
12
|
+
- You MUST have the [Plugin Check (PCP)](https://wordpress.org/plugins/plugin-check/) plugin installed and active on your WordPress site.
|
|
13
|
+
- CLI command relies on this plugin to generate reports.
|
|
14
|
+
|
|
15
|
+
2. **Configure wp-config.php**:
|
|
16
|
+
- Ensure your `wp-config.php` uses `127.0.0.1` instead of `localhost` for database host if you encounter connection issues with CLI.
|
|
17
|
+
- Example: `define( 'DB_HOST', '127.0.0.1' );`
|
|
18
|
+
|
|
19
|
+
## Required Variables
|
|
20
|
+
|
|
21
|
+
- `{{plugin_folder_name}}`: The actual folder name of the target plugin (e.g., `poly-locations-manager` or `my-awesome-plugin`).
|
|
22
|
+
> **Note**: `polyutilities` in examples is just a placeholder. ALWAYS replace it with the actual plugin slug you are working on.
|
|
23
|
+
|
|
24
|
+
## Agent Usage & Examples
|
|
25
|
+
|
|
26
|
+
### Triggering the Skill
|
|
27
|
+
|
|
28
|
+
Users may ask to "check plugin [name]" or "run plugin check".
|
|
29
|
+
|
|
30
|
+
**Example Prompt (Reference Only):**
|
|
31
|
+
> "Use skill plugin-check to check, then resolve *all* issues mentioned for plugin `[TARGET_PLUGIN_NAME]`. Ensure careful handling and verify that related features still function correctly. If uncertain about any fix, add a TODO note in the code instead of applying a risky change."
|
|
32
|
+
|
|
33
|
+
**CRITICAL INSTRUCTION**:
|
|
34
|
+
- Replace `[TARGET_PLUGIN_NAME]` with the actual plugin folder name provided by the user.
|
|
35
|
+
- IF the user does not specify a name, infer it from the current working directory or the `wp-content/plugins/` structure.
|
|
36
|
+
- **DO NOT** default to `polyutilities` unless the user specifically asked for it.
|
|
37
|
+
|
|
38
|
+
### Process Flow
|
|
39
|
+
|
|
40
|
+
#### Step 1: Run Plugin Check
|
|
41
|
+
|
|
42
|
+
1. **Identify Plugin Folder**: Ensure you are in the root workspace of the project. The plugin folder is usually the one you are currently working on.
|
|
43
|
+
2. **Execute Command**: Run the following command to generate the report. Replace `{{plugin_folder_name}}` with the actual directory name of the plugin.
|
|
44
|
+
```bash
|
|
45
|
+
mkdir -p wp-content/plugins/{{plugin_folder_name}}/_pcp && wp plugin check {{plugin_folder_name}} --exclude-files=.DS_Store,.sh,.md --exclude-directories=documentations,heraspec,node_modules,tests,dist,_pcp --format=table > wp-content/plugins/{{plugin_folder_name}}/_pcp/pcp.txt
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Step 2: Review and Confirm
|
|
49
|
+
|
|
50
|
+
1. **Read Report**: Read the content of `wp-content/plugins/{{plugin_folder_name}}/_pcp/pcp.txt`.
|
|
51
|
+
2. **Notify User**: Inform the user about the number or types of issues found.
|
|
52
|
+
3. **Wait for Confirmation**: Do NOT proceed to fix issues automatically without user confirmation unless explicitly authorized to "fix all".
|
|
53
|
+
|
|
54
|
+
#### Step 3: Fix Issues (Iterative)
|
|
55
|
+
|
|
56
|
+
1. **Target**: Aim to resolve **all** reported errors and warnings, ensuring no new issues are introduced.
|
|
57
|
+
2. **Safety First**: Ensure code changes do not break existing functionality.
|
|
58
|
+
* **Uncertainty**: If a fix is risky or unclear, DO NOT apply it blindly. Instead, add a comment `// TODO: [PCP] Fix this issue manually - [Reason]` and move to the next item.
|
|
59
|
+
3. **Iterate**:
|
|
60
|
+
* Apply fixes for a batch of issues.
|
|
61
|
+
* **Re-run Check**: Run the command from Step 1 again to verify fixes.
|
|
62
|
+
* Repeat until the report is clean or only contains intentional TODOs.
|
|
63
|
+
|
|
64
|
+
## Custom Fix Patterns
|
|
65
|
+
|
|
66
|
+
Use these patterns to address issues that the local PCP tool might miss or flag incorrectly.
|
|
67
|
+
|
|
68
|
+
### MissingVersion Fix
|
|
69
|
+
|
|
70
|
+
**Description**: This skill documents how to address the `WordPress.WP.EnqueuedResourceParameters.MissingVersion` warning. This occurs when `wp_register_style()`, `wp_enqueue_style()`, `wp_register_script()`, or `wp_enqueue_script()` are called without a version number.
|
|
71
|
+
|
|
72
|
+
**Pattern to Identify**: Look for calls where the version argument (the 4th argument) is missing or set to `false`/`null` for local/plugin resources.
|
|
73
|
+
|
|
74
|
+
**Example Warning**:
|
|
75
|
+
> Resource version not set in call to `wp_register_style()`. This means new versions of the style may not always be loaded due to browser caching.
|
|
76
|
+
|
|
77
|
+
**Recommended Fix**: Always provide a version number. Use a global plugin/theme version constant if available, falling back to a default or `filemtime` for local assets.
|
|
78
|
+
|
|
79
|
+
**Implementation Pattern**:
|
|
80
|
+
```php
|
|
81
|
+
// 1. Define the version (Replace <PLUGIN_PREFIX> with your actual plugin/theme prefix)
|
|
82
|
+
$version = defined( '<PLUGIN_PREFIX>_VERSION' ) ? <PLUGIN_PREFIX>_VERSION : '1.0.0';
|
|
83
|
+
|
|
84
|
+
// 2. Pass it to the function
|
|
85
|
+
wp_register_style(
|
|
86
|
+
'my-handle',
|
|
87
|
+
false, // Source (false for inline-only handles)
|
|
88
|
+
array(), // Dependencies
|
|
89
|
+
$version // Version (CRITICAL)
|
|
90
|
+
);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Why this is important**: WordPress uses the version number to generate a query string (e.g., `?ver=1.0.0`) attached to the asset URL. When you update your product, changing the version number forces browsers to download the new files instead of using stale cached versions.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### NonPrefixedHooknameFound Fix
|
|
98
|
+
|
|
99
|
+
**Description**: WordPress Coding Standards require plugin/theme hooks (actions/filters) to be prefixed. However, when using core WP hooks or known third-party hooks, this warning triggers correctly.
|
|
100
|
+
|
|
101
|
+
**Pattern to Identify**:
|
|
102
|
+
> WARNING: Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "the_content".
|
|
103
|
+
|
|
104
|
+
**Recommended Fix**: If using a standard WordPress hook or a known third-party hook, use the `phpcs:disable` / `phpcs:enable` toggle to suppress the warning for that specific instance.
|
|
105
|
+
|
|
106
|
+
```php
|
|
107
|
+
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
|
|
108
|
+
$description = apply_filters( 'the_content', $post_content );
|
|
109
|
+
// phpcs:enable
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### NonPrefixedVariableFound Fix
|
|
115
|
+
|
|
116
|
+
**Description**: Global variables or variables defined in the global scope (like in template files or shared configuration) must be prefixed with a unique slug to prevent collisions.
|
|
117
|
+
|
|
118
|
+
**Pattern to Identify**:
|
|
119
|
+
> WARNING: Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$options".
|
|
120
|
+
|
|
121
|
+
**Recommended Fix**: Rename the variable to include your unique product prefix (e.g., `<plugin_prefix>_`).
|
|
122
|
+
|
|
123
|
+
#### Before
|
|
124
|
+
```php
|
|
125
|
+
$options = array( 'key' => 'value' );
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### After
|
|
129
|
+
```php
|
|
130
|
+
$<plugin_prefix>_options = array( 'key' => 'value' );
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Best Practices
|
|
134
|
+
|
|
135
|
+
- **Placeholders**: Replace `<PLUGIN_PREFIX>` (uppercase) and `<plugin_prefix>` (lowercase) with your actual project prefix throughout the implementation.
|
|
136
|
+
- **Global Scope**: Be especially careful with short variable names in common files like `functions.php` or template parts.
|
|
137
|
+
- **Hook Names**: Always prefix custom hooks. Only disable the check for established external hooks.
|
|
138
|
+
|
|
139
|
+
## Strict Prohibitions
|
|
140
|
+
|
|
141
|
+
1. **DO NOT DELETE Excluded Files**:
|
|
142
|
+
- The command excludes `.sh`, `.md`, `.DS_Store` and directories `heraspec`, `tests`, `docs`.
|
|
143
|
+
- **NEVER** delete or modify these files/directories as part of the fix. They are intentionally excluded because they are development assets, not production garbage.
|
|
144
|
+
- If `wp plugin check` complains about them (it shouldn't if excluded), **IGNORE** those specific errors.
|
|
145
|
+
|
|
146
|
+
2. **Scope**: Only modify files within the plugin directory that are relevant to the actual PHP/JS/CSS code being checked.
|
|
147
|
+
|
|
148
|
+
## Tips
|
|
149
|
+
|
|
150
|
+
- Common issues include missing escaping (`esc_html`, `esc_attr`), missing nonces, or direct DB access without preparation.
|
|
151
|
+
- Always verify that fixes do not break existing functionality.
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Admin Dashboard Template
|
|
4
|
-
*
|
|
5
|
-
* @package {{namespace}}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
9
|
-
exit;
|
|
10
|
-
}
|
|
11
|
-
?>
|
|
12
|
-
|
|
13
|
-
<div class="wrap {{plugin_slug}}-dashboard">
|
|
14
|
-
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
|
15
|
-
|
|
16
|
-
<div class="welcome-panel">
|
|
17
|
-
<div class="welcome-panel-content">
|
|
18
|
-
<h2><?php esc_html_e( 'Welcome to {{plugin_name}}', '{{text_domain}}' ); ?></h2>
|
|
19
|
-
<p class="about-description"><?php esc_html_e( 'Thank you for using our plugin. This dashboard provides an overview of your activity.', '{{text_domain}}' ); ?></p>
|
|
20
|
-
|
|
21
|
-
<div class="welcome-panel-column-container">
|
|
22
|
-
<div class="welcome-panel-column">
|
|
23
|
-
<h3><?php esc_html_e( 'Get Started', '{{text_domain}}' ); ?></h3>
|
|
24
|
-
<a class="button button-primary button-hero" href="<?php echo esc_url( admin_url( 'admin.php?page={{plugin_slug}}-settings' ) ); ?>"><?php esc_html_e( 'Configure Settings', '{{text_domain}}' ); ?></a>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="welcome-panel-column">
|
|
27
|
-
<h3><?php esc_html_e( 'Next Steps', '{{text_domain}}' ); ?></h3>
|
|
28
|
-
<ul>
|
|
29
|
-
<li><a href="#" class="welcome-icon welcome-view-site"><?php esc_html_e( 'Check Features', '{{text_domain}}' ); ?></a></li>
|
|
30
|
-
<li><a href="#" class="welcome-icon welcome-edit-page"><?php esc_html_e( 'Documentation', '{{text_domain}}' ); ?></a></li>
|
|
31
|
-
</ul>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div class="postbox-container">
|
|
38
|
-
<div class="postbox">
|
|
39
|
-
<div class="postbox-header">
|
|
40
|
-
<h2 class="hndle"><?php esc_html_e( 'Overview Stats', '{{text_domain}}' ); ?></h2>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="inside">
|
|
43
|
-
<p><?php esc_html_e( 'Summary of your plugin usage will appear here.', '{{text_domain}}' ); ?></p>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Admin Dashboard Template
|
|
4
|
+
*
|
|
5
|
+
* @package {{namespace}}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
|
9
|
+
exit;
|
|
10
|
+
}
|
|
11
|
+
?>
|
|
12
|
+
|
|
13
|
+
<div class="wrap {{plugin_slug}}-dashboard">
|
|
14
|
+
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
|
15
|
+
|
|
16
|
+
<div class="welcome-panel">
|
|
17
|
+
<div class="welcome-panel-content">
|
|
18
|
+
<h2><?php esc_html_e( 'Welcome to {{plugin_name}}', '{{text_domain}}' ); ?></h2>
|
|
19
|
+
<p class="about-description"><?php esc_html_e( 'Thank you for using our plugin. This dashboard provides an overview of your activity.', '{{text_domain}}' ); ?></p>
|
|
20
|
+
|
|
21
|
+
<div class="welcome-panel-column-container">
|
|
22
|
+
<div class="welcome-panel-column">
|
|
23
|
+
<h3><?php esc_html_e( 'Get Started', '{{text_domain}}' ); ?></h3>
|
|
24
|
+
<a class="button button-primary button-hero" href="<?php echo esc_url( admin_url( 'admin.php?page={{plugin_slug}}-settings' ) ); ?>"><?php esc_html_e( 'Configure Settings', '{{text_domain}}' ); ?></a>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="welcome-panel-column">
|
|
27
|
+
<h3><?php esc_html_e( 'Next Steps', '{{text_domain}}' ); ?></h3>
|
|
28
|
+
<ul>
|
|
29
|
+
<li><a href="#" class="welcome-icon welcome-view-site"><?php esc_html_e( 'Check Features', '{{text_domain}}' ); ?></a></li>
|
|
30
|
+
<li><a href="#" class="welcome-icon welcome-edit-page"><?php esc_html_e( 'Documentation', '{{text_domain}}' ); ?></a></li>
|
|
31
|
+
</ul>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="postbox-container">
|
|
38
|
+
<div class="postbox">
|
|
39
|
+
<div class="postbox-header">
|
|
40
|
+
<h2 class="hndle"><?php esc_html_e( 'Overview Stats', '{{text_domain}}' ); ?></h2>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="inside">
|
|
43
|
+
<p><?php esc_html_e( 'Summary of your plugin usage will appear here.', '{{text_domain}}' ); ?></p>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Admin Settings Template
|
|
4
|
-
*
|
|
5
|
-
* @package {{namespace}}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
9
|
-
exit;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Handle form submission
|
|
13
|
-
if ( isset( $_POST['{{prefix}}save_settings'] ) ) {
|
|
14
|
-
|
|
15
|
-
// Check nonce
|
|
16
|
-
if ( ! isset( $_POST['{{prefix}}settings_nonce'] ) || ! wp_verify_nonce( $_POST['{{prefix}}settings_nonce'], '{{prefix}}settings_action' ) ) {
|
|
17
|
-
wp_die( esc_html__( 'Security check failed.', '{{text_domain}}' ) );
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Check capabilities
|
|
21
|
-
if ( ! current_user_can( 'manage_options' ) ) {
|
|
22
|
-
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', '{{text_domain}}' ) );
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Save settings (example)
|
|
26
|
-
if ( isset( $_POST['{{prefix}}api_key'] ) ) {
|
|
27
|
-
update_option( '{{prefix}}api_key', sanitize_text_field( wp_unslash( $_POST['{{prefix}}api_key'] ) ) );
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
echo '<div class="updated"><p>' . esc_html__( 'Settings saved.', '{{text_domain}}' ) . '</p></div>';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
$api_key = get_option( '{{prefix}}api_key', '' );
|
|
34
|
-
?>
|
|
35
|
-
|
|
36
|
-
<div class="wrap {{plugin_slug}}-settings">
|
|
37
|
-
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
|
38
|
-
|
|
39
|
-
<form method="post" action="">
|
|
40
|
-
<?php wp_nonce_field( '{{prefix}}settings_action', '{{prefix}}settings_nonce' ); ?>
|
|
41
|
-
|
|
42
|
-
<table class="form-table" role="presentation">
|
|
43
|
-
<tbody>
|
|
44
|
-
<tr>
|
|
45
|
-
<th scope="row">
|
|
46
|
-
<label for="{{prefix}}api_key"><?php esc_html_e( 'API Key', '{{text_domain}}' ); ?></label>
|
|
47
|
-
</th>
|
|
48
|
-
<td>
|
|
49
|
-
<input name="{{prefix}}api_key" type="text" id="{{prefix}}api_key" value="<?php echo esc_attr( $api_key ); ?>" class="regular-text">
|
|
50
|
-
<p class="description"><?php esc_html_e( 'Enter your API key here.', '{{text_domain}}' ); ?></p>
|
|
51
|
-
</td>
|
|
52
|
-
</tr>
|
|
53
|
-
</tbody>
|
|
54
|
-
</table>
|
|
55
|
-
|
|
56
|
-
<p class="submit">
|
|
57
|
-
<input type="submit" name="{{prefix}}save_settings" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Save Changes', '{{text_domain}}' ); ?>">
|
|
58
|
-
</p>
|
|
59
|
-
</form>
|
|
60
|
-
</div>
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Admin Settings Template
|
|
4
|
+
*
|
|
5
|
+
* @package {{namespace}}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
|
9
|
+
exit;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Handle form submission
|
|
13
|
+
if ( isset( $_POST['{{prefix}}save_settings'] ) ) {
|
|
14
|
+
|
|
15
|
+
// Check nonce
|
|
16
|
+
if ( ! isset( $_POST['{{prefix}}settings_nonce'] ) || ! wp_verify_nonce( $_POST['{{prefix}}settings_nonce'], '{{prefix}}settings_action' ) ) {
|
|
17
|
+
wp_die( esc_html__( 'Security check failed.', '{{text_domain}}' ) );
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Check capabilities
|
|
21
|
+
if ( ! current_user_can( 'manage_options' ) ) {
|
|
22
|
+
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', '{{text_domain}}' ) );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Save settings (example)
|
|
26
|
+
if ( isset( $_POST['{{prefix}}api_key'] ) ) {
|
|
27
|
+
update_option( '{{prefix}}api_key', sanitize_text_field( wp_unslash( $_POST['{{prefix}}api_key'] ) ) );
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
echo '<div class="updated"><p>' . esc_html__( 'Settings saved.', '{{text_domain}}' ) . '</p></div>';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$api_key = get_option( '{{prefix}}api_key', '' );
|
|
34
|
+
?>
|
|
35
|
+
|
|
36
|
+
<div class="wrap {{plugin_slug}}-settings">
|
|
37
|
+
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
|
38
|
+
|
|
39
|
+
<form method="post" action="">
|
|
40
|
+
<?php wp_nonce_field( '{{prefix}}settings_action', '{{prefix}}settings_nonce' ); ?>
|
|
41
|
+
|
|
42
|
+
<table class="form-table" role="presentation">
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr>
|
|
45
|
+
<th scope="row">
|
|
46
|
+
<label for="{{prefix}}api_key"><?php esc_html_e( 'API Key', '{{text_domain}}' ); ?></label>
|
|
47
|
+
</th>
|
|
48
|
+
<td>
|
|
49
|
+
<input name="{{prefix}}api_key" type="text" id="{{prefix}}api_key" value="<?php echo esc_attr( $api_key ); ?>" class="regular-text">
|
|
50
|
+
<p class="description"><?php esc_html_e( 'Enter your API key here.', '{{text_domain}}' ); ?></p>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
|
|
56
|
+
<p class="submit">
|
|
57
|
+
<input type="submit" name="{{prefix}}save_settings" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Save Changes', '{{text_domain}}' ); ?>">
|
|
58
|
+
</p>
|
|
59
|
+
</form>
|
|
60
|
+
</div>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admin Styles for {{plugin_name}}
|
|
3
|
-
*
|
|
4
|
-
* DESIGN SYSTEM:
|
|
5
|
-
* Use the ui-ux skill to define colors, fonts, and spacing.
|
|
6
|
-
* This file should contain layout and component-specific styles.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
.{{plugin_slug}}-dashboard .welcome-panel {
|
|
10
|
-
margin-top: 20px;
|
|
11
|
-
border: 1px solid #ccd0d4;
|
|
12
|
-
background: #fff;
|
|
13
|
-
padding: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.{{plugin_slug}}-dashboard .welcome-panel h2 {
|
|
17
|
-
margin-top: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.{{plugin_slug}}-settings .form-table {
|
|
21
|
-
margin-top: 20px;
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Admin Styles for {{plugin_name}}
|
|
3
|
+
*
|
|
4
|
+
* DESIGN SYSTEM:
|
|
5
|
+
* Use the ui-ux skill to define colors, fonts, and spacing.
|
|
6
|
+
* This file should contain layout and component-specific styles.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.{{plugin_slug}}-dashboard .welcome-panel {
|
|
10
|
+
margin-top: 20px;
|
|
11
|
+
border: 1px solid #ccd0d4;
|
|
12
|
+
background: #fff;
|
|
13
|
+
padding: 20px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.{{plugin_slug}}-dashboard .welcome-panel h2 {
|
|
17
|
+
margin-top: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.{{plugin_slug}}-settings .form-table {
|
|
21
|
+
margin-top: 20px;
|
|
22
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admin JavaScript for {{plugin_name}}
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
(function($) {
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
$(document).ready(function() {
|
|
9
|
-
console.log('{{plugin_name}} Admin Loaded');
|
|
10
|
-
|
|
11
|
-
// Example: Handle AJAX or UI interactions
|
|
12
|
-
// Use {{prefix}}params.ajax_url and {{prefix}}params.nonce
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
})(jQuery);
|
|
1
|
+
/**
|
|
2
|
+
* Admin JavaScript for {{plugin_name}}
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
(function($) {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
$(document).ready(function() {
|
|
9
|
+
console.log('{{plugin_name}} Admin Loaded');
|
|
10
|
+
|
|
11
|
+
// Example: Handle AJAX or UI interactions
|
|
12
|
+
// Use {{prefix}}params.ajax_url and {{prefix}}params.nonce
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
})(jQuery);
|