heraspec 0.1.2 → 0.1.4

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.
Files changed (20) hide show
  1. package/bin/heraspec.js +24 -1
  2. package/bin/heraspec.js.map +2 -2
  3. package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +57 -0
  4. package/dist/core/templates/skills/documents/templates/documentation.html +41 -0
  5. package/dist/core/templates/skills/documents/templates/landing-script.js +38 -0
  6. package/dist/core/templates/skills/documents/templates/landing-style.css +158 -0
  7. package/dist/core/templates/skills/documents/templates/script.js +56 -0
  8. package/dist/core/templates/skills/documents/templates/style.css +155 -0
  9. package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -0
  10. package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -0
  11. package/dist/core/templates/skills/documents-skill.md +52 -90
  12. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -0
  13. package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -0
  14. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -0
  15. package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -0
  16. package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -0
  17. package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -0
  18. package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -0
  19. package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +80 -0
  20. package/package.json +1 -1
@@ -1,114 +1,76 @@
1
- # Skill: Documents (Cross-Cutting)
1
+ # Skill: Documents (Cross-Cutting & Multi-Format)
2
2
 
3
3
  ## Purpose
4
4
 
5
- This skill is used to create documentation for both technical and end-user audiences. Ensures documentation is complete, clear, and easy to understand.
6
-
7
- ## When to Use
8
-
9
- - When creating technical documentation
10
- - When writing user guides
11
- - When documenting APIs
12
- - When creating changelogs
13
- - When writing installation/setup guides
14
-
15
- ## Step-by-Step Process
16
-
17
- ### Step 1: Identify Document Type
18
- - Technical docs: For developers
19
- - User guide: For end-users
20
- - API docs: For API consumers
21
- - Changelog: For version releases
22
-
23
- ### Step 2: Choose Appropriate Template
24
- - Technical: `templates/technical-doc-template.md`
25
- - User guide: `templates/user-guide-template.md`
26
- - API: `templates/api-doc-template.md`
27
- - Changelog: `templates/changelog-template.md`
28
-
29
- ### Step 3: Gather Information
30
- - Features and functionality
31
- - Installation steps
32
- - Configuration options
33
- - Usage examples
34
- - Troubleshooting tips
35
-
36
- ### Step 4: Write Documentation
37
- - Follow template structure
38
- - Use good examples as reference
39
- - Ensure code examples work
40
- - Include screenshots if needed
41
-
42
- ### Step 5: Validate & Generate
43
- - Run script: `scripts/validate-docs.py`
44
- - Run script: `scripts/generate-docs.sh` (if available)
45
- - Review with good examples
46
- - Test with target audience
5
+ This skill is used to create comprehensive documentation for both technical and end-user audiences. It supports parallel generation of Markdown files (for repository/GitHub) and interactive HTML files (for browser-based manuals).
6
+
7
+ ## Core Requirements
8
+
9
+ ### 1. Multi-Format Output
10
+ Every documentation task should ideally generate three versions:
11
+ - `doc-name.md`: Clean Markdown for version control.
12
+ - `doc-name.html`: Interactive HTML with a modern split-panel layout for deep reading.
13
+ - `documentation-landing-page.html`: A high-end, visual landing page to showcase features and provide entry points.
14
+
15
+ ### 2. HTML Layout (Premium Standard)
16
+ - **Documentation Page**: Split-panel (Sidebar for Nav, Content for reading). Smooth scroll-spy included.
17
+ - **Landing Page**: Full-screen Hero section, feature grids with hover effects, and clear Calls to Action (CTA).
18
+
19
+ ### 3. Visual Excellence
20
+ - Use the `ui-ux` skill to determine the theme colors, typography gradients, and spacing.
21
+ - The Landing Page must include scroll animations (fade-in, transform) to feel premium and alive.
22
+
23
+ ## Implementation Steps
24
+
25
+ ### Step 1: Define Content and Flow
26
+ 1. Outline the main technical content for the `.md` and `.html` docs.
27
+ 2. Identify the "Key Features" and "USP" (Unique Selling Points) for the Landing Page feature grid.
28
+
29
+ ### Step 2: Generate Markdown & Documentation HTML
30
+ 1. Populate `technical-doc-template.md` (or user guide).
31
+ 2. Populate `documentation.html` with navigation and sections.
32
+
33
+ ### Step 3: Integrate Landing Page
34
+ 1. Use `templates/documentation-landing-page.html`.
35
+ 2. **Hero Section**: Write a compelling headline and description.
36
+ 3. **Feature Grid**: Create cards for each major feature using `<div class="feature-card">`.
37
+ 4. **Integration**: Link the CTA buttons to `documentation.html`.
38
+ 5. Apply `landing-style.css` and `landing-script.js`.
47
39
 
48
40
  ## Required Input
49
41
 
50
42
  - **Document type**: Technical, user guide, API, changelog
51
43
  - **Target audience**: Developers, end-users, admins
52
- - **Features to document**: List of features to document
53
- - **Code examples**: Code samples to include
54
- - **Screenshots**: Images if needed
44
+ - **Structural Outline**: List of headings and sub-headings
45
+ - **Design Cues**: Colors and icons from `ui-ux` skill
55
46
 
56
47
  ## Expected Output
57
48
 
58
- - Complete documentation file
59
- - Proper formatting and structure
60
- - Working code examples
61
- - Clear instructions
62
- - Troubleshooting section
49
+ - `file.md`: Complete documentation in Markdown.
50
+ - `file.html`: Interactive split-panel HTML documentation.
51
+ - `style.css`: Documentation styles.
52
+ - `script.js`: Documentation interactivity.
63
53
 
64
54
  ## Tone & Rules
65
55
 
66
- ### Writing Style
67
- - **Clear**: Write clearly, easy to understand
68
- - **Concise**: Brief, not verbose
69
- - **Actionable**: Can be followed
70
- - **Complete**: Complete necessary information
71
-
72
- ### Technical Docs
73
- - Code examples must work
74
- - Include prerequisites
75
- - Explain "why" not just "what"
76
- - Link to related docs
77
-
78
- ### User Guides
79
- - Step-by-step instructions
80
- - Screenshots for complex steps
81
- - Common issues and solutions
82
- - Plain language (avoid jargon)
83
-
84
- ### Limitations
85
- - ❌ DO NOT skip prerequisites
86
- - ❌ DO NOT assume prior knowledge
87
- - ❌ DO NOT use untested code examples
88
- - ❌ DO NOT write too technical for user guides
89
- - ❌ DO NOT skip troubleshooting
56
+ - **Consistent Content**: The content in MD and HTML MUST be identical in substance.
57
+ - **No Inline Bloat**: Keep CSS and JS in separate files as provided in the templates.
58
+ - **Interactive T.O.C**: Sidebar links MUST use smooth-scroll IDs.
90
59
 
91
60
  ## Available Templates
92
61
 
62
+ - `templates/documentation.html` - Base HTML documentation layout
63
+ - `templates/documentation-landing-page.html` - Premium Landing Page layout
64
+ - `templates/style.css` - Premium styles for HTML documentation
65
+ - `templates/landing-style.css` - Premium styles for Landing Page
66
+ - `templates/script.js` - Interactive logic for HTML documentation
67
+ - `templates/landing-script.js` - Interactive logic for Landing Page
93
68
  - `templates/technical-doc-template.md` - Technical documentation
94
69
  - `templates/user-guide-template.md` - User guide
95
70
  - `templates/api-doc-template.md` - API documentation
96
71
  - `templates/changelog-template.md` - Changelog template
97
72
 
98
- ## Available Scripts
99
-
100
- - `scripts/generate-docs.sh` - Automatically generate docs from code
101
- - `scripts/validate-docs.py` - Validate format and completeness
102
-
103
- ## Examples
104
-
105
- See `examples/` directory for reference:
106
- - `good-technical-doc.md` - Good technical doc example
107
- - `good-user-guide.md` - Good user guide example
108
- - `good-api-doc.md` - Good API doc example
109
-
110
73
  ## Links to Other Skills
111
74
 
112
- - **module-codebase**: Document module structure
113
- - **ui-ux**: Document UI components and design system
114
- - **content-optimization**: Optimize documentation for clarity
75
+ - **ui-ux**: ESSENTIAL. Use this to determine the look and feel of the HTML documentation.
76
+ - **content-optimization**: Use to ensure the text is clear and professional.
@@ -0,0 +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>
@@ -0,0 +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>
@@ -0,0 +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
+ }
@@ -0,0 +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);
@@ -0,0 +1,169 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: {{plugin_name}}
4
+ * Description: A high-quality WordPress plugin following WP.org standards.
5
+ * Version: 1.0.0
6
+ * Author: Your Name
7
+ * Author URI: https://example.com
8
+ * License: GPL-2.0-or-later
9
+ * License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
+ * Text Domain: {{text_domain}}
11
+ * Domain Path: /languages
12
+ *
13
+ * @package {{namespace}}
14
+ */
15
+
16
+ // If this file is called directly, abort.
17
+ if ( ! defined( 'ABSPATH' ) ) {
18
+ exit;
19
+ }
20
+
21
+ /**
22
+ * The core plugin class.
23
+ */
24
+ class {{namespace}}\Main {
25
+
26
+ /**
27
+ * Instance of this class.
28
+ *
29
+ * @var object
30
+ */
31
+ protected static $instance = null;
32
+
33
+ /**
34
+ * Initialize the plugin.
35
+ */
36
+ public function __construct() {
37
+ $this->define_constants();
38
+ $this->includes();
39
+ $this->init_hooks();
40
+ }
41
+
42
+ /**
43
+ * Return an instance of this class.
44
+ */
45
+ public static function get_instance() {
46
+ if ( null === self::$instance ) {
47
+ self::$instance = new self();
48
+ }
49
+ return self::$instance;
50
+ }
51
+
52
+ /**
53
+ * Define constants.
54
+ */
55
+ private function define_constants() {
56
+ define( '{{prefix|upper}}VERSION', '1.0.0' );
57
+ define( '{{prefix|upper}}PATH', plugin_dir_path( __FILE__ ) );
58
+ define( '{{prefix|upper}}URL', plugin_dir_url( __FILE__ ) );
59
+ }
60
+
61
+ /**
62
+ * Include required files.
63
+ */
64
+ private function includes() {
65
+ // Include admin classes, helpers, etc.
66
+ }
67
+
68
+ /**
69
+ * Initialize hooks.
70
+ */
71
+ private function init_hooks() {
72
+ add_action( 'admin_menu', [ $this, 'add_menu_pages' ] );
73
+ add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
74
+
75
+ // Activation / Deactivation hooks
76
+ register_activation_hook( __FILE__, [ $this, 'activate' ] );
77
+ register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
78
+ }
79
+
80
+ /**
81
+ * Add Admin Menu Pages.
82
+ */
83
+ public function add_menu_pages() {
84
+ add_menu_page(
85
+ __( '{{plugin_name}}', '{{text_domain}}' ),
86
+ __( '{{plugin_name}}', '{{text_domain}}' ),
87
+ 'manage_options',
88
+ '{{plugin_slug}}',
89
+ [ $this, 'render_dashboard_page' ],
90
+ 'dashicons-admin-generic',
91
+ 100
92
+ );
93
+
94
+ add_submenu_page(
95
+ '{{plugin_slug}}',
96
+ __( 'Dashboard', '{{text_domain}}' ),
97
+ __( 'Dashboard', '{{text_domain}}' ),
98
+ 'manage_options',
99
+ '{{plugin_slug}}',
100
+ [ $this, 'render_dashboard_page' ]
101
+ );
102
+
103
+ add_submenu_page(
104
+ '{{plugin_slug}}',
105
+ __( 'Settings', '{{text_domain}}' ),
106
+ __( 'Settings', '{{text_domain}}' ),
107
+ 'manage_options',
108
+ '{{plugin_slug}}-settings',
109
+ [ $this, 'render_settings_page' ]
110
+ );
111
+ }
112
+
113
+ /**
114
+ * Enqueue Admin Assets.
115
+ */
116
+ public function enqueue_admin_assets( $hook ) {
117
+ // Only load on our plugin pages
118
+ if ( strpos( $hook, '{{plugin_slug}}' ) === false ) {
119
+ return;
120
+ }
121
+
122
+ wp_enqueue_style( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/css/admin.css', [], {{prefix|upper}}VERSION );
123
+ wp_enqueue_script( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/js/admin.js', [ 'jquery' ], {{prefix|upper}}VERSION, true );
124
+
125
+ wp_localize_script( '{{plugin_slug}}-admin', '{{prefix}}params', [
126
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
127
+ 'nonce' => wp_create_nonce( '{{prefix}}nonce' ),
128
+ ]);
129
+ }
130
+
131
+ /**
132
+ * Render Dashboard Page.
133
+ */
134
+ public function render_dashboard_page() {
135
+ // Include template file
136
+ include {{prefix|upper}}PATH . 'templates/admin-dashboard.php';
137
+ }
138
+
139
+ /**
140
+ * Render Settings Page.
141
+ */
142
+ public function render_settings_page() {
143
+ // Include template file
144
+ include {{prefix|upper}}PATH . 'templates/admin-settings.php';
145
+ }
146
+
147
+ /**
148
+ * Activation logic.
149
+ */
150
+ public function activate() {
151
+ // Setup database tables, default options, etc.
152
+ }
153
+
154
+ /**
155
+ * Deactivation logic.
156
+ */
157
+ public function deactivate() {
158
+ // Clear scheduled tasks, etc.
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Initialize the plugin.
164
+ */
165
+ function {{prefix}}init() {
166
+ return {{namespace}}\Main::get_instance();
167
+ }
168
+
169
+ add_action( 'plugins_loaded', '{{prefix}}init' );
@@ -0,0 +1,41 @@
1
+ === {{plugin_name}} ===
2
+ Contributors: yourname
3
+ Tags: wordpress, plugin, standard
4
+ Requires at least: 6.0
5
+ Tested up to: 6.4
6
+ Requires PHP: 7.4
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ {{plugin_name}} is a high-quality WordPress plugin built with HeraSpec.
12
+
13
+ == Description ==
14
+
15
+ Describe your plugin features here.
16
+
17
+ == Installation ==
18
+
19
+ 1. Upload the plugin files to the `/wp-content/plugins/{{plugin_slug}}` directory.
20
+ 2. Activate the plugin through the 'Plugins' screen in WordPress.
21
+ 3. Go to {{plugin_name}} -> Settings to configure.
22
+
23
+ == Frequently Asked Questions ==
24
+
25
+ = Is this plugin free? =
26
+
27
+ Yes!
28
+
29
+ == Screenshots ==
30
+
31
+ 1. Dashboard view.
32
+
33
+ == Changelog ==
34
+
35
+ = 1.0.0 =
36
+ * Initial release.
37
+
38
+ == Upgrade Notice ==
39
+
40
+ = 1.0.0 =
41
+ * First version.
@@ -0,0 +1,21 @@
1
+ <?php
2
+ /**
3
+ * Fired when the plugin is uninstalled.
4
+ *
5
+ * @package {{namespace}}
6
+ */
7
+
8
+ // If uninstall not called from WordPress, then exit.
9
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Clean up plugin data.
15
+ */
16
+ delete_option( '{{prefix}}version' );
17
+ delete_option( '{{prefix}}api_key' );
18
+
19
+ // Delete custom tables if any...
20
+ // global $wpdb;
21
+ // $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}your_table_name" );
@@ -0,0 +1,80 @@
1
+ # Skill: WordPress Plugin Standard (WP.org Compliant)
2
+
3
+ This skill guides the creation of a high-quality, secure, and WordPress.org compliant plugin. It focuses on adherence to the Plugin Check (PCP) requirements and provides a robust structure including admin interfaces.
4
+
5
+ ## Purpose
6
+ Standardize WordPress plugin development to ensure acceptance into the official repository, maximize security, and promote maintainability through strict separation of concerns.
7
+
8
+ ## Required Variables
9
+ - `{{plugin_name}}`: Human-readable name (e.g., My Awesome Plugin).
10
+ - `{{plugin_slug}}`: Unique slug (e.g., my-awesome-plugin).
11
+ - `{{namespace}}`: PHP Namespace (e.g., PolyXGO\MyPlugin).
12
+ - `{{prefix}}`: Unique prefix for functions/variables (e.g., pxmp_).
13
+ - `{{text_domain}}`: I18n text domain (usually same as plugin slug).
14
+
15
+ ## Core Requirements (WordPress.org & PCP)
16
+
17
+ ### 1. Security & Protection
18
+ - **Direct Access**: Use `if ( ! defined( 'ABSPATH' ) ) exit;` at the top of every PHP file.
19
+ - **Nonces**: Verify nonces for all form submissions and AJAX requests.
20
+ - **Validation & Sanitization**: Sanitize all inputs (`sanitize_text_field`, `absint`, etc.) and validate data before processing.
21
+ - **Escaping**: Escape all outputs strictly based on context (`esc_html`, `esc_attr`, `wp_kses`, etc.).
22
+ - **Capabilities**: Explicitly check user capabilities (`current_user_can`) for all admin actions.
23
+
24
+ ### 2. Code Organization & Standards
25
+ - **Naming**: Use the `{{prefix}}` for all global functions, variables, and constants.
26
+ - **Namespace**: Use PSR-4 namespacing (`{{namespace}}`) to avoid class collisions.
27
+ - **Separation of Concerns**: Keep CSS and JS in separate files. AVOID inline styles or scripts unless dynamically generated values are required (use `wp_localize_script` or `wp_add_inline_style` only when necessary).
28
+ - **No Prohibited Constructs**: Never use `eval()`, `base64_decode()` for obfuscation, or short tags (`<?`).
29
+
30
+ ### 3. Required Components
31
+ - **Main Plugin File**: Must contain the required header comment.
32
+ - **`readme.txt`**: Standard WordPress.org format.
33
+ - **Admin Interface**:
34
+ - A top-level or sub-menu item for the **Dashboard**.
35
+ - A dedicated **Settings** page for configuration.
36
+ - **Uninstallation**: Provide an `uninstall.php` file to clean up data (options, tables) when the plugin is deleted.
37
+
38
+ ## Implementation Steps
39
+
40
+ ### Step 1: Initialize Main Structure
41
+ 1. Create the main plugin file `{{plugin_slug}}.php` with the correct header.
42
+ 2. Initialize the main class with a singleton or static instance.
43
+ 3. Hook into `plugins_loaded` to start the plugin logic.
44
+
45
+ ### Step 2: Register Admin Menu
46
+ 1. Hook into `admin_menu`.
47
+ 2. Add a menu page and a sub-page for Settings.
48
+ 3. Enqueue admin-specific assets (CSS/JS) only on plugin pages.
49
+
50
+ ### Step 3: Integrate UI/UX Skill
51
+ When designing the Dashboard or Settings page:
52
+ 1. **Call Skill**: Use `(skill: ui-ux)` to define the design language.
53
+ 2. **Apply Styles**: Use the colors, typography, and spacing defined by the `ui-ux` skill result.
54
+ 3. Write styles in `assets/admin.css`.
55
+
56
+ ### Step 4: Handle Data Persistence
57
+ 1. Use the Options API (`get_option`, `update_option`) for settings.
58
+ 2. Ensure all data saved to the database is sanitized.
59
+ 3. Ensure all data retrieved from the database is escaped on output.
60
+
61
+ ## Standards and Rules
62
+
63
+ ### The Prefixing Rule
64
+ Every global identifier MUST start with `{{prefix}}`.
65
+ - ✅ `{{prefix}}get_settings()`
66
+ - ❌ `get_settings()`
67
+
68
+ ### The "No Inline" Rule
69
+ - CSS must be in `assets/css/admin.css`.
70
+ - JS must be in `assets/js/admin.js`.
71
+ - Use `wp_enqueue_style` and `wp_enqueue_script` correctly.
72
+
73
+ ## Templates
74
+ - [plugin-main.php](templates/plugin-main.php)
75
+ - [admin-dashboard.php](templates/admin-dashboard.php)
76
+ - [admin-settings.php](templates/admin-settings.php)
77
+ - [readme.txt](templates/readme.txt)
78
+ - [uninstall.php](templates/uninstall.php)
79
+ - [assets/admin-css.css](templates/assets/admin-css.css)
80
+ - [assets/admin-js.js](templates/assets/admin-js.js)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heraspec",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Universal spec-first development framework + CLI for all project types and AI tools",
5
5
  "keywords": [
6
6
  "heraspec",