@wp-operations/wp-ops 0.3.0 → 0.4.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.
Files changed (119) hide show
  1. package/README.md +6 -3
  2. package/package.json +6 -2
  3. package/src/commands/platform.js +58 -2
  4. package/src/commands/start.js +2 -2
  5. package/src/main.js +19 -8
  6. package/wp-operations/CHANGELOG.md +14 -0
  7. package/wp-operations/README.md +39 -0
  8. package/wp-operations/agents/builder/AGENT.md +15 -0
  9. package/wp-operations/assets/admin.css +631 -0
  10. package/wp-operations/assets/admin.js +614 -0
  11. package/wp-operations/assets/app/app.css +1 -0
  12. package/wp-operations/assets/app/app.js +70 -0
  13. package/wp-operations/assets/app/fonts/inter-medium.woff +0 -0
  14. package/wp-operations/assets/app/fonts/inter-regular.woff +0 -0
  15. package/wp-operations/assets/app/fonts/inter-semibold.woff +0 -0
  16. package/wp-operations/assets/app/login.css +42 -0
  17. package/wp-operations/assets/brand/icon.svg +20 -0
  18. package/wp-operations/assets/brand/mark.svg +19 -0
  19. package/wp-operations/assets/editors/audiobook.css +311 -0
  20. package/wp-operations/assets/editors/audiofile.css +286 -0
  21. package/wp-operations/assets/editors/course.css +701 -0
  22. package/wp-operations/assets/editors/course.js +698 -0
  23. package/wp-operations/assets/editors/faq.css +258 -0
  24. package/wp-operations/assets/editors/faq.js +196 -0
  25. package/wp-operations/assets/editors/interactive.css +220 -0
  26. package/wp-operations/assets/editors/interactive.js +378 -0
  27. package/wp-operations/assets/editors/media-sources.css +3 -0
  28. package/wp-operations/assets/editors/media-sources.js +40 -0
  29. package/wp-operations/assets/editors/open-media.css +114 -0
  30. package/wp-operations/assets/editors/open-media.js +182 -0
  31. package/wp-operations/assets/editors/thumbnails.css +335 -0
  32. package/wp-operations/assets/editors/thumbnails.js +447 -0
  33. package/wp-operations/assets/editors/translator.css +818 -0
  34. package/wp-operations/functions.php +24 -0
  35. package/wp-operations/index.php +14 -0
  36. package/wp-operations/platform.json +1836 -0
  37. package/wp-operations/skills/ai-development-guardrails/SKILL.md +49 -0
  38. package/wp-operations/skills/gutenberg-reference/SKILL.md +45 -0
  39. package/wp-operations/skills/js-tooling-for-themes/SKILL.md +51 -0
  40. package/wp-operations/skills/tailwind-for-wp/SKILL.md +62 -0
  41. package/wp-operations/skills/wp-clean-classic-themes/SKILL.md +112 -0
  42. package/wp-operations/skills/wp-psr4-plugins/SKILL.md +2043 -0
  43. package/wp-operations/skills/wp-security/SKILL.md +90 -0
  44. package/wp-operations/src/Admin.php +78 -0
  45. package/wp-operations/src/App/Access.php +57 -0
  46. package/wp-operations/src/App/Admin.php +442 -0
  47. package/wp-operations/src/App/App.php +157 -0
  48. package/wp-operations/src/App/Apps.php +379 -0
  49. package/wp-operations/src/App/Bundle.php +111 -0
  50. package/wp-operations/src/App/Contents.php +676 -0
  51. package/wp-operations/src/App/Engine.php +554 -0
  52. package/wp-operations/src/App/Github.php +308 -0
  53. package/wp-operations/src/App/Module.php +23 -0
  54. package/wp-operations/src/App/Ops.php +470 -0
  55. package/wp-operations/src/App/Packages.php +289 -0
  56. package/wp-operations/src/App/Rest.php +539 -0
  57. package/wp-operations/src/App/Sandboxes.php +206 -0
  58. package/wp-operations/src/App/Store.php +104 -0
  59. package/wp-operations/src/App/Usage.php +268 -0
  60. package/wp-operations/src/Config.php +249 -0
  61. package/wp-operations/src/Content/Editor.php +223 -0
  62. package/wp-operations/src/Content/Fields.php +681 -0
  63. package/wp-operations/src/Content/Scoring.php +253 -0
  64. package/wp-operations/src/Content/Structure.php +293 -0
  65. package/wp-operations/src/Content/Types.php +150 -0
  66. package/wp-operations/src/Content/Uploads.php +50 -0
  67. package/wp-operations/src/Editors/AudiobookAuthor.php +61 -0
  68. package/wp-operations/src/Editors/AudiobookChapters.php +632 -0
  69. package/wp-operations/src/Editors/AudiobookCover.php +235 -0
  70. package/wp-operations/src/Editors/Audiofile.php +462 -0
  71. package/wp-operations/src/Editors/Course.php +784 -0
  72. package/wp-operations/src/Editors/Ebook.php +242 -0
  73. package/wp-operations/src/Editors/Editors.php +44 -0
  74. package/wp-operations/src/Editors/Faq.php +237 -0
  75. package/wp-operations/src/Editors/Files.php +139 -0
  76. package/wp-operations/src/Editors/Interactive/Builder.php +103 -0
  77. package/wp-operations/src/Editors/Interactive/Card.php +76 -0
  78. package/wp-operations/src/Editors/Interactive/Editor.php +42 -0
  79. package/wp-operations/src/Editors/Interactive/Field.php +272 -0
  80. package/wp-operations/src/Editors/Interactive/Map.php +84 -0
  81. package/wp-operations/src/Editors/Interactive/Models.php +227 -0
  82. package/wp-operations/src/Editors/Interactive/Report.php +59 -0
  83. package/wp-operations/src/Editors/Interactive/Save.php +323 -0
  84. package/wp-operations/src/Editors/Interactive/Scoring.php +244 -0
  85. package/wp-operations/src/Editors/Interactive/Structure.php +195 -0
  86. package/wp-operations/src/Editors/Legal.php +235 -0
  87. package/wp-operations/src/Editors/OpenMedia.php +140 -0
  88. package/wp-operations/src/Editors/OriginalTitle.php +112 -0
  89. package/wp-operations/src/Editors/Sources.php +28 -0
  90. package/wp-operations/src/Editors/Thumbnails/Admin.php +306 -0
  91. package/wp-operations/src/Editors/Thumbnails/Ajax.php +163 -0
  92. package/wp-operations/src/Editors/Thumbnails/Box.php +188 -0
  93. package/wp-operations/src/Editors/Thumbnails/Storage.php +228 -0
  94. package/wp-operations/src/Editors/Translator/Admin.php +913 -0
  95. package/wp-operations/src/Editors/Translator/Api.php +63 -0
  96. package/wp-operations/src/Editors/Translator/Bar.php +83 -0
  97. package/wp-operations/src/Editors/Translator/Fields.php +273 -0
  98. package/wp-operations/src/Editors/Translator/Storage.php +131 -0
  99. package/wp-operations/src/Editors/Translator/Thumbnail.php +215 -0
  100. package/wp-operations/src/Identity.php +104 -0
  101. package/wp-operations/src/Languages.php +45 -0
  102. package/wp-operations/src/Lockdown.php +85 -0
  103. package/wp-operations/src/Modules/Apps/Admin.php +472 -0
  104. package/wp-operations/src/Modules/Apps/Api.php +193 -0
  105. package/wp-operations/src/Modules/Apps/Apps.php +279 -0
  106. package/wp-operations/src/Modules/Apps/Formatters.php +478 -0
  107. package/wp-operations/src/Modules/Apps/Schemes.php +248 -0
  108. package/wp-operations/src/Modules/Apps/Table.php +101 -0
  109. package/wp-operations/src/Modules/Thumbnails.php +68 -0
  110. package/wp-operations/src/Modules/Translations.php +133 -0
  111. package/wp-operations/src/Platform.php +59 -0
  112. package/wp-operations/src/Setup.php +273 -0
  113. package/wp-operations/src/Status.php +99 -0
  114. package/wp-operations/src/Storage/Client.php +168 -0
  115. package/wp-operations/src/Storage/Offload.php +120 -0
  116. package/wp-operations/src/Storage/Settings.php +166 -0
  117. package/wp-operations/src/Storage/Storage.php +35 -0
  118. package/wp-operations/src/Updates.php +151 -0
  119. package/wp-operations/style.css +11 -0
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: ai-development-guardrails
3
+ description: >
4
+ Rules for AI agents writing code in wp-operations projects: which skills
5
+ bind, what is forbidden, how to verify work, and how to write output that
6
+ survives review. Load this first; it routes to the rest.
7
+ ---
8
+
9
+ ## Binding order
10
+
11
+ 1. `wp-psr4-plugins` — all backend PHP package code. Non-negotiable.
12
+ 2. `wp-security` — every request handler. Non-negotiable.
13
+ 3. `wp-clean-classic-themes` — theme/template work.
14
+ 4. `gutenberg-reference` — only when explicitly asked about block tooling.
15
+
16
+ ## Hard rules
17
+
18
+ - **No Gutenberg/FSE output** unless explicitly requested: no block.json, no
19
+ theme.json styling, no `@wordpress/*` npm packages, no block templates.
20
+ Target runs on ClassicPress too.
21
+ - **No new dependencies without stating why.** Composer or npm. Every added
22
+ package is attack surface and maintenance; justify or leave it out.
23
+ - **Never weaken the four-point pattern** to make code shorter. Capability,
24
+ nonce, sanitize, escape — even in examples.
25
+ - **No decorative comments**: no ASCII dividers, no dashed banners, no
26
+ "section" headers in code, no `// end if`. Comments state constraints the
27
+ code cannot, or nothing.
28
+ - **No placeholder code** (`// implement later`, `TODO: security`) in anything
29
+ presented as done. Say what is unfinished in prose instead.
30
+ - Strict types, final classes, typed signatures — the handbook checklist is
31
+ the definition of done for PHP.
32
+
33
+ ## Verification
34
+
35
+ Work is done when it demonstrably runs:
36
+
37
+ - Packages: `composer dump-autoload` resolves all classes; a smoke script or
38
+ `wp-app php` execution exercises the entry path.
39
+ - Themes/plugins: boot with `wp-app start` (and `--wp=classicpress` when the
40
+ change could differ) — HTTP 200 and the feature visibly present.
41
+ - State the check performed and its literal result. Failed checks are reported
42
+ as failures, never rounded up to success.
43
+
44
+ ## Output discipline
45
+
46
+ - Prefer editing existing files over spawning new ones; match surrounding style.
47
+ - One concern per commit; imperative subject lines; body explains why.
48
+ - When a rule here conflicts with something the user explicitly asked for,
49
+ say so once, then follow the user.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: gutenberg-reference
3
+ description: >
4
+ Reference-only skill: what Gutenberg/block tech is and how to interoperate
5
+ with content produced by it. wp-operations projects do not build with it —
6
+ this exists for reading foreign codebases and migrations.
7
+ references:
8
+ - https://developer.wordpress.org/block-editor/
9
+ ---
10
+
11
+ ## Position
12
+
13
+ wp-operations targets classic themes + PSR-4 packages on WordPress and
14
+ ClassicPress. ClassicPress has no block editor at all. This skill is for
15
+ **recognizing and interoperating** with block-era artifacts, not producing them.
16
+
17
+ ## Recognizing the stack
18
+
19
+ | Artifact | What it is |
20
+ |---|---|
21
+ | `block.json` | Block registration metadata (name, attributes, assets) |
22
+ | `theme.json` | Global styles/settings engine for block themes |
23
+ | `templates/*.html`, `parts/*.html` | FSE block templates (HTML + block comments) |
24
+ | `<!-- wp:paragraph -->` comments | Block delimiters stored inside post_content |
25
+ | `@wordpress/scripts` | Their webpack build wrapper |
26
+ | `render_block`, `parse_blocks()` | Server-side block APIs |
27
+
28
+ ## Interop you may actually need
29
+
30
+ - **Content migration to classic:** block markup in `post_content` renders fine
31
+ on classic themes — the block comments are HTML comments; `the_content`
32
+ output is valid HTML. Strip/transform only if markup cleanliness matters:
33
+ `parse_blocks()` + serialize the inner HTML.
34
+ - **Moving a site to ClassicPress:** audit for block-only plugins; content
35
+ survives, editors change (classic editor is built in).
36
+ - **Reading a block theme codebase:** start at theme.json (design tokens) and
37
+ templates/ (structure); PHP is mostly thin.
38
+ - **Shortcodes vs blocks:** classic interactive regions here are shortcodes or
39
+ template parts fed by package managers (see wp-psr4-plugins §19).
40
+
41
+ ## If explicitly asked to build blocks
42
+
43
+ Do it in a separate plugin package, never in the theme; static blocks
44
+ (save.js output) over dynamic where possible; and note the ClassicPress
45
+ incompatibility in the deliverable.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: js-tooling-for-themes
3
+ description: >
4
+ Frontend JS in classic themes: esbuild-first pipeline, when Vite earns its
5
+ place, progressive enhancement over SPA thinking, and how React fits when a
6
+ screen genuinely needs it.
7
+ ---
8
+
9
+ ## Default: esbuild, one entry, IIFE/ESM out
10
+
11
+ ```json
12
+ "scripts": {
13
+ "build:js": "esbuild src/js/theme.js --bundle --minify --outfile=assets/js/main.js",
14
+ "watch:js": "esbuild src/js/theme.js --bundle --outfile=assets/js/main.js --watch"
15
+ }
16
+ ```
17
+
18
+ - Enqueue with `wp_enqueue_script(..., true)` (footer) and pass server data via
19
+ `wp_localize_script` / `wp_add_inline_script` — never inline PHP echoes in JS.
20
+ - Progressive enhancement: templates render complete HTML; JS upgrades
21
+ (menus, lightboxes, filters). The site works with JS disabled.
22
+ - Vanilla + small libraries beat frameworks for theme interactivity. Every
23
+ dependency is weight and audit surface.
24
+
25
+ ## When Vite
26
+
27
+ Vite earns its config when you need: HMR on a component-heavy screen, many
28
+ entries with code splitting, or a real app embedded in a page. Use it as a
29
+ theme-local tool (`vite build` outputting to `assets/`), keep WordPress
30
+ unaware of dev-server URLs in production builds. Otherwise esbuild.
31
+
32
+ ## React (or Preact) inside a classic theme
33
+
34
+ For a genuinely app-like screen (dashboard, configurator):
35
+
36
+ - Mount into one container div rendered by the template; everything else
37
+ stays server-rendered.
38
+ - Data via REST endpoints from your PSR-4 packages (wp-psr4-plugins §14),
39
+ authenticated with a localized nonce (`X-WP-Nonce` header).
40
+ - Prefer Preact via esbuild alias when bundle size matters.
41
+ - The app owns its island only — routing, title, and the rest of the page
42
+ belong to WordPress.
43
+
44
+ ## Rules
45
+
46
+ - No jQuery for new code (WP still ships it; you don't have to use it).
47
+ - No global namespace pollution: one IIFE/module per bundle.
48
+ - `defer`-safe: code runs off `DOMContentLoaded`, not top-level DOM access.
49
+ - Fetch wrappers handle non-200 and JSON parse failure explicitly — REST
50
+ errors are part of the contract (four-point pattern's server side).
51
+ - Works on ClassicPress identically (no `@wordpress/*` runtime imports).
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: tailwind-for-wp
3
+ description: >
4
+ Tailwind CSS in classic WordPress/ClassicPress themes: setup without a
5
+ bundler framework, content scanning for PHP templates, admin-safe usage,
6
+ and design-token discipline.
7
+ references:
8
+ - https://tailwindcss.com/docs
9
+ ---
10
+
11
+ ## Setup (theme-local, CLI only)
12
+
13
+ ```
14
+ src/input.css @tailwind base; @tailwind components; @tailwind utilities;
15
+ tailwind.config.js content: ['./**/*.php', './src/js/**/*.js']
16
+ assets/css/style.css build output, enqueued by functions.php
17
+ ```
18
+
19
+ ```json
20
+ "scripts": {
21
+ "build:css": "tailwindcss -i src/input.css -o assets/css/style.css --minify",
22
+ "watch:css": "tailwindcss -i src/input.css -o assets/css/style.css --watch"
23
+ }
24
+ ```
25
+
26
+ No PostCSS config needed for plain usage; add `@tailwindcss/typography` for
27
+ post content (`prose` classes on `the_content()` wrappers).
28
+
29
+ ## Content scanning gotchas in PHP
30
+
31
+ - The scanner reads class names literally — **never build class strings
32
+ dynamically** (`'text-' . $color` is invisible to the scanner). Use full
33
+ literal alternatives and pick between them in PHP.
34
+ - Include every template location in `content`: `parts/**/*.php`, package view
35
+ files if packages emit admin HTML (`vendor/` is usually excluded — if a
36
+ package renders markup with Tailwind classes, safelist or add its path).
37
+ - Classes echoed from the database (editor content) are not scanned — style
38
+ editor content with `prose`/semantic CSS, not per-element utilities.
39
+
40
+ ## WordPress-specific discipline
41
+
42
+ - **Preflight vs admin bar / editor styles:** Tailwind's reset can fight WP
43
+ defaults. Scope trouble away rather than disabling preflight; keep the theme
44
+ frontend-only (don't enqueue the Tailwind build in wp-admin).
45
+ - Body classes from `body_class()` + Tailwind utilities coexist fine; use WP's
46
+ contextual classes (`single`, `archive`) for template-level variants.
47
+ - Menus/widgets emit fixed markup — style via component classes in
48
+ `@layer components` instead of chasing generated HTML with utilities.
49
+
50
+ ## Design tokens
51
+
52
+ Define the palette/spacing/typography once in `tailwind.config.js` `theme.extend`
53
+ and treat it as the design contract. No arbitrary values (`w-[437px]`) in
54
+ committed templates — if a value recurs, it becomes a token.
55
+
56
+ ## Checklist
57
+
58
+ - [ ] Build output committed or built in CI — never edited by hand
59
+ - [ ] No dynamic class-name construction
60
+ - [ ] `prose` (typography plugin) wraps `the_content()`
61
+ - [ ] Tokens in config, not arbitrary values in markup
62
+ - [ ] `wp-app dev` + `watch:css` documented as the dev loop
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: wp-clean-classic-themes
3
+ description: >
4
+ Clean classic (non-block) theme development for WordPress & ClassicPress:
5
+ structure, template hierarchy, vendor-package loading, asset pipeline
6
+ (Tailwind/esbuild), escaping in templates. No Gutenberg, no FSE, no
7
+ theme.json-driven styling.
8
+ references:
9
+ - https://developer.wordpress.org/themes/basics/template-hierarchy/
10
+ - https://developer.wordpress.org/themes/basics/theme-functions/
11
+ ---
12
+
13
+ ## Structure
14
+
15
+ ```
16
+ my-theme/
17
+ ├── style.css theme header (identity only, not the stylesheet)
18
+ ├── functions.php thin: autoload vendor, wire supports, enqueue
19
+ ├── index.php required fallback template
20
+ ├── front-page.php homepage
21
+ ├── single.php single post
22
+ ├── page.php single page
23
+ ├── archive.php archives (or archive-{post_type}.php)
24
+ ├── search.php, 404.php
25
+ ├── parts/ get_template_part() partials
26
+ │ ├── header-nav.php
27
+ │ └── card-content.php
28
+ ├── src/ build inputs (input.css, js/theme.js)
29
+ ├── assets/ build outputs (gitignored or committed, pick one)
30
+ │ ├── css/style.css
31
+ │ └── js/main.js
32
+ ├── composer.json vendor packages = the plugins
33
+ └── vendor/ composer output (gitignored)
34
+ ```
35
+
36
+ ## functions.php stays thin
37
+
38
+ Three jobs only: load composer autoload, register theme supports, enqueue assets.
39
+ All real logic lives in PSR-4 vendor packages (see wp-psr4-plugins).
40
+
41
+ ```php
42
+ declare(strict_types=1);
43
+
44
+ $autoload = __DIR__ . '/vendor/autoload.php';
45
+ if (file_exists($autoload)) {
46
+ require_once $autoload;
47
+ }
48
+
49
+ if (class_exists(Vendor\App\Plugin::class)) {
50
+ Vendor\App\Plugin::init();
51
+ }
52
+
53
+ add_action('after_setup_theme', static function (): void {
54
+ add_theme_support('title-tag');
55
+ add_theme_support('post-thumbnails');
56
+ add_theme_support('html5', ['search-form', 'gallery', 'caption', 'style', 'script']);
57
+ register_nav_menus(['primary' => __('Primary', 'my-theme')]);
58
+ });
59
+
60
+ add_action('wp_enqueue_scripts', static function (): void {
61
+ $version = wp_get_theme()->get('Version');
62
+ wp_enqueue_style('my-theme', get_theme_file_uri('assets/css/style.css'), [], $version);
63
+ wp_enqueue_script('my-theme', get_theme_file_uri('assets/js/main.js'), [], $version, true);
64
+ });
65
+ ```
66
+
67
+ Never: business logic in functions.php, `require` trees of includes/, CPT
68
+ registration in the theme (content types survive theme switches — they belong
69
+ in packages).
70
+
71
+ ## Templates
72
+
73
+ - Loop with `have_posts()` / `the_post()`; modify queries with `pre_get_posts`,
74
+ never `query_posts()`.
75
+ - Partials via `get_template_part('parts/card', 'content', ['post' => $post])` —
76
+ the third arg becomes `$args` inside the partial.
77
+ - Escape everything at echo: `esc_html`, `esc_attr`, `esc_url`. Template files
78
+ are output context — the four-point pattern's point 4 lives here.
79
+ - Data comes from package manager classes (`ContentManager::getMeta()`), not
80
+ from raw `get_post_meta` calls scattered through templates.
81
+
82
+ ## Asset pipeline
83
+
84
+ Tailwind + esbuild, no bundler framework:
85
+
86
+ ```json
87
+ "scripts": {
88
+ "build:css": "tailwindcss -i src/input.css -o assets/css/style.css --minify",
89
+ "watch:css": "tailwindcss -i src/input.css -o assets/css/style.css --watch",
90
+ "build:js": "esbuild src/js/theme.js --bundle --minify --outfile=assets/js/main.js",
91
+ "build": "npm run build:css && npm run build:js"
92
+ }
93
+ ```
94
+
95
+ `wp-app build` runs composer install + this build script. `wp-app dev` (or
96
+ `wp-ops dev`) serves with restart-on-change; Tailwind watch runs alongside.
97
+
98
+ ## ClassicPress notes
99
+
100
+ Classic themes run unchanged on ClassicPress 2.x. Do not use:
101
+ `theme.json` styling engine, block templates (`templates/*.html`),
102
+ `add_theme_support('block-templates')`, block patterns. Widgets/customizer
103
+ work on both if needed — prefer menus + options pages from packages.
104
+
105
+ ## Checklist
106
+
107
+ - [ ] style.css header complete (Text Domain, Requires PHP, License)
108
+ - [ ] Every template escapes at output
109
+ - [ ] No CPT/taxonomy registration in the theme
110
+ - [ ] functions.php under ~60 lines
111
+ - [ ] Boots on `wp-app start` and `wp-app start --wp=classicpress`
112
+ - [ ] Text domain consistent, all strings through `__()/esc_html__()`