mosaic-headless 1.34.4 → 1.34.6

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/README.md CHANGED
@@ -303,7 +303,7 @@ and heading level — and it earned its place at once: it caught the converter l
303
303
  | `theme_export.php` / `theme_import.php` | a whole theme as JSON rows over WP-CLI, ids intact |
304
304
  | `prune_unbound.php` | clears the templates and masters that page rebuilds leave bound to nothing, with their nodes; dry run unless `--apply` |
305
305
  | `fix_text_runs.py` | makes buttons built before v1.34.1 editable in the Mosaic editor by wrapping their text the way the editor does; dry run unless `--apply` |
306
- | `scan_inline_tags.py` | read only: finds text that holds HTML tags, which Mosaic 1.0.11+ prints as visible `<p>` / `<br>` on the page |
306
+ | `scan_inline_tags.py` | read only: finds text that holds HTML tags, which Mosaic 1.0.11+ prints as visible `<p>` / `<br>` on the page, and warns on a document with a duplicate root |
307
307
  | `fix_inline_tags.py` | fixes what `scan_inline_tags.py` finds, turning the tags into real inline nodes; dry run unless `--apply` |
308
308
  | `theme_zip.py` / `theme_zip_compare.php` / `theme_delete.php` | Mosaic's own ZIP export/import from outside the editor, the copy held against the source, and a clean delete that refuses the live theme |
309
309
  | `list_fields.php` | every `@VAR` / `@LOOP` name a post's custom fields register, with values |
package/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: |
5
5
  license: "MIT"
6
6
  metadata:
7
7
  author: "moksa (https://moksaweb.com)"
8
- version: "1.34.4"
8
+ version: "1.34.6"
9
9
  homepage: "https://github.com/Moksa1123/mosaic-headless"
10
10
  ---
11
11
 
@@ -714,6 +714,20 @@ with `tools/prune_unbound.php` (dry run by default) after a batch of rebuilds.
714
714
  tables appear when an admin loads `/wp-admin/admin.php?page=mosaic`.
715
715
  - **Commit has side effects.** `heal()` runs inside it and creates breakpoints,
716
716
  collections and child nodes you never sent. Take every revision in the response.
717
+ - **One root per document, or the document renders empty.** A second, empty
718
+ `component-internal` (or master/template root) ordered first makes Mosaic render
719
+ from it: every instance of that component prints nothing, and the next master
720
+ commit drops the overrides that point into the real tree (90 lost on a live
721
+ 1.0.11 site; restoring them alone changed nothing until the empty roots were
722
+ deleted). Health check, which must return no rows (group by `themeID` too: the
723
+ same component ID in two themes is not a duplicate):
724
+ `SELECT themeID, documentType, documentID, parentType, COUNT(*) n FROM wp_mosaic_nodes WHERE parentType IN ('master','template','component','componentDocument') GROUP BY themeID, documentType, documentID, parentType HAVING n > 1`.
725
+ A node's `revision` is a time-based UUID (v1), so it dates when that root was
726
+ written. Match that time against the access log. `build_site.py` stops and the
727
+ fix tools skip a document with more than one root; `scan_inline_tags.py` warns.
728
+ Reading every document over REST does not create roots (135 before and after a
729
+ full scan on the demo site). The one creation traced to a cause so far was a
730
+ MySQL restart mid-render: heal read the failed SELECT as "no root".
717
731
  - **`modified_gmt` is server-assigned.**
718
732
  - **Styling hangs on the generated `._<token>` class, not your `attrID`**, and the
719
733
  token (`_a`, `_b`, ... `_ba`: a base-38 per-document counter) is not stable. The
@@ -965,7 +979,7 @@ with `tools/prune_unbound.php` (dry run by default) after a batch of rebuilds.
965
979
  | `prune_unbound.php` | delete the templates no post is bound to, the masters no kept template uses, their nodes, then orphan nodes pass after pass - one theme, dry run unless `--apply`, `assign="auto"` templates kept |
966
980
  | `theme_delete.php` | remove a theme completely through the plugin's own routine; refuses the live one |
967
981
  | `fix_text_runs.py` | wrap text runs that sit directly under a button, menu-link or other non-text element (built before v1.34.1) in an Inherited text `text` node, so the editor can edit them - every master, template and component, through each document's own commit; dry run unless `--apply`, idempotent, component overrides kept |
968
- | `scan_inline_tags.py` | read only: list every `wysiwyg-text` run whose text holds HTML tags (printed literally on 1.0.11+), with the nearest attrID above it, across every master, template and component - run it before or after a site updates from 1.0.10 |
982
+ | `scan_inline_tags.py` | read only: list every `wysiwyg-text` run whose text holds HTML tags (printed literally on 1.0.11+), with the nearest attrID above it, across every master, template and component - run it before or after a site updates from 1.0.10; also warns on a document with more than one root |
969
983
  | `fix_inline_tags.py` | rewrite those runs in place as `wysiwyg-span` / `-link` / `-linebreak` nodes (inline_html.py's mapping); a run that is one `<p>`/`<hN>` gives its tag to a text node that has none; lists, tables, images and mixed block/inline runs are skipped and listed; dry run unless `--apply`, idempotent |
970
984
  | `verify_slider.py` | the slider in a real browser: does it advance, do the arrows and bullets drive it, does the keyboard, does it stop when motion is not wanted - `--label`/`--append` put several sliders in one table, which is where a carousel and a plain slider can be held against each other |
971
985
  | `verify_navigation.py` | a multi-page site: is every menu item a real `<a href>`, does every page answer 200 (a template that was never bound answers 406 with an empty body, which only a logged-out visitor sees), and with `--viewports` does any page scroll SIDEWAYS - the one question no per-page checker asks - and whether every in-page `#fragment` resolves ON THE PAGE THAT CARRIES IT, which an HTTP check cannot see: a bare `#services` in a SHARED header fetches the current page, answers 200 everywhere, and does nothing on every page but the one that has that section |
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.34.4"
23
+ "version": "1.34.6"
24
24
  },
25
25
  "loaderBehaviour": "Upload via Settings -> Skills -> Upload. Claude.ai parses SKILL.md frontmatter and surfaces the skill in your library. The extraction tool (extract-block-schema.php) needs a live WP-CLI connection and won't run in the sandbox; use it from a local terminal against your own site instead.",
26
26
  "uploadSteps": [
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.34.4"
23
+ "version": "1.34.6"
24
24
  },
25
25
  "loaderBehaviour": "Auto-loads on session start when SKILL.md frontmatter parses successfully.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.34.4"
23
+ "version": "1.34.6"
24
24
  },
25
25
  "loaderBehaviour": "Confirmed (2026-07-11): Codex CLI natively supports the SKILL.md spec. Place SKILL.md under .codex/skills/<name>/ (project) or ~/.codex/skills/<name>/ (personal) and Codex loads the name+description at session start, then the full body on demand. A parallel, broader convention .agents/skills/ (searched from cwd up to repo root, then ~/.agents/skills/) also exists across multiple tools - if your Codex CLI version prioritizes that path instead, mirror the same SKILL.md there.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.34.4"
23
+ "version": "1.34.6"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: GitHub Copilot added a proper '.github/skills/' Agent Skills directory (December 2025), alongside the older single-file .github/copilot-instructions.md convention. This config targets the new skills-directory form. If your Copilot version predates this (pre Dec 2025), use the instructions-append fallback instead (see fallback below).",
26
26
  "fallback": {
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.34.4"
23
+ "version": "1.34.6"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: Gemini CLI now natively supports the same SKILL.md standard as Claude Code and Codex CLI - the same directory-based skill works unmodified. Gemini CLI discovers skills in this precedence order: built-in, extension skills, ~/.gemini/skills/ (personal), .gemini/skills/ (project, shared via version control). At session start Gemini injects each discovered skill's name+description into the system prompt and calls activate_skill when a task matches.",
26
26
  "verified": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mosaic-headless",
3
- "version": "1.34.4",
3
+ "version": "1.34.6",
4
4
  "description": "AI-agent skill: build Mosaic Pro (Nextend) WordPress sites by writing the underlying data model directly - 23 custom tables, no visual editor, no DOM. Every node type, style property and node property swept against a live install and asserted on the delivered HTML and compiled CSS. Installs into Claude Code, Cursor, Codex CLI, Gemini CLI, Copilot, Continue, Windsurf and Claude.ai.",
5
5
  "keywords": [
6
6
  "wordpress",
@@ -73,6 +73,19 @@ it commits without complaint and delivers
73
73
  `href="http://concat('/contact/?ref=%27…"` - the leading `@` dropped and the rest taken
74
74
  as a URL (measured on a client build on 1.0.10). As `{"v": "@concat(…)"}` it delivers the evaluated link.
75
75
 
76
+ The same holds for a field that is not in the sweep tables. A form's
77
+ `actionOptions.entryName` and `formName` go through `LocalContext::evaluateText`,
78
+ which computes only `{"v": …}` and returns a plain string as it is. A plain
79
+ `"entryName": "@VAR('form/field_name')"` stores that text as every submission's
80
+ `entryLabel`, so the admin's Form Submissions list shows the raw code (measured on a
81
+ live form on 1.0.11). The label is stored per submission, so fixing the setting
82
+ does not change submissions already saved. The action settings inside
83
+ `actionOptions.actions[]` (email subject, replyTo, webhook body) accept either form.
84
+ `build_page.py` refuses `@fn(` code in a plain data string, except where a plain
85
+ string is evaluated: `code` content, `wpShortcode`, `wysiwyg-variable`'s
86
+ `dynamicCode` (and a condition's variable subject), a loop source, and form
87
+ action settings.
88
+
76
89
 
77
90
  ## The variable namespace
78
91
 
@@ -220,7 +220,10 @@ the sweep tables.
220
220
  keeps one open.
221
221
  - **form**: `submitType` is `action` (default) or `native`; the options sit in
222
222
  `actionOptions {actions[], formName, entryName}` or `nativeOptions {url, target,
223
- method get|post, encoding}`, and switching type deletes the other group. A native
223
+ method get|post, encoding}`, and switching type deletes the other group.
224
+ `formName` and `entryName` take dynamic code only as `{"v": "@VAR('form/…')"}`;
225
+ a plain string is not computed, and a plain `entryName` is what the submissions
226
+ list shows. A native
224
227
  submit skips server validation, the honeypot and CAPTCHA. The success screen
225
228
  shows only for `action` with no redirect. With no error-message element, errors
226
229
  appear in the browser's own bubble. Every label and legend is required; hide one
@@ -73,6 +73,26 @@ def load_csv(name):
73
73
  # `<br>` prints as those characters on the page. Inline formatting is written as
74
74
  # nodes instead: wysiwyg-span, wysiwyg-linebreak, wysiwyg-link.
75
75
  PROSE_TAG = re.compile(r"</?[a-zA-Z][a-zA-Z0-9-]*\s*[^>]*>")
76
+ DYNAMIC_CALL = re.compile(r"@[A-Za-z_][A-Za-z0-9_]*\s*\(")
77
+ # types whose own content is parsed as code from a plain string
78
+ RAW_CODE_TYPES = {"code", "wpShortcode", "wysiwyg-variable", "wysiwyg-text"}
79
+ # data keys whose plain string is evaluated (loop source; form action settings;
80
+ # a condition's variable subject)
81
+ RAW_CODE_KEYS = {"localContextOptions", "actions", "dynamicCode"}
82
+
83
+
84
+ def plain_code_paths(value, path="data"):
85
+ """Paths of plain strings holding @fn( code where only {"v": ...} is computed."""
86
+ if isinstance(value, str):
87
+ return [path] if DYNAMIC_CALL.search(value) else []
88
+ if isinstance(value, dict):
89
+ if isinstance(value.get("v"), str):
90
+ return []
91
+ return [p for k, v in value.items() if k not in RAW_CODE_KEYS
92
+ for p in plain_code_paths(v, "%s.%s" % (path, k))]
93
+ if isinstance(value, list):
94
+ return [p for i, v in enumerate(value) for p in plain_code_paths(v, "%s[%d]" % (path, i))]
95
+ return []
76
96
  AT_RULE_GLUED = re.compile(
77
97
  r"@(media|supports|container|layer|scope|import|page|starting-style|"
78
98
  r"font-feature-values|counter-style|property|document)\(")
@@ -134,6 +154,16 @@ class Surface:
134
154
  problems.append("code content contains `%s` - Mosaic's template parser reads "
135
155
  "it as a function call and the page renders as HTTP 500; "
136
156
  "write `%s (`" % (hit.group(0), hit.group(0)[:-1]))
157
+ # Node data is computed only in the {"v": "..."} object form
158
+ # (DynamicCodeHelper::isDynamicCode); evaluateText hands a plain string back
159
+ # verbatim. So `"entryName": "@VAR('form/field_name')"` stores and shows the
160
+ # code itself - measured on a live form's submission list. Raw strings that ARE
161
+ # evaluated: code content, wpShortcode, wysiwyg-variable dynamicCode, a loop
162
+ # source, and form action settings (getSetting takes either form).
163
+ if not force and t not in RAW_CODE_TYPES:
164
+ for path in plain_code_paths(node.get("data") or {}):
165
+ problems.append("%s holds dynamic code as a plain string - it is stored "
166
+ "and shown literally; write it as {\"v\": \"...\"}" % path)
137
167
  # A local-context loop's source written as `@LOOP('post/x')` renders on the
138
168
  # front end - LoopEvaluator.php reads the loop name out of any function call -
139
169
  # and throws in the editor, whose evaluateLoop only resolves `@VAR`
@@ -46,6 +46,7 @@ from build_page import (refresh_node_ids, # noqa: E402
46
46
  flatten,
47
47
  theme_records,
48
48
  )
49
+ from fix_text_runs import extra_roots # noqa: E402
49
50
  from sweep_node_types import ( # noqa: E402
50
51
  MIN_HEALTHY_BYTES,
51
52
  Client,
@@ -198,6 +199,12 @@ def ensure_components(client, cfg, site, surface):
198
199
  client.get(instance) # the first GET heals the document
199
200
  doc = unwrap(client.get(instance), "componentDocumentInstance")
200
201
  key = "node/component/%s" % cid
202
+ dup = extra_roots(doc[key])
203
+ if dup:
204
+ sys.exit("component %s has %d component-internal roots (%s); Mosaic renders "
205
+ "the first one, so writing under any of them is a guess. Remove the "
206
+ "empty extra root first." % (name, len(dup), ", ".join(
207
+ "%s ordering %s" % (n["ID"][:8], n.get("ordering")) for n in dup)))
201
208
  internal = next(n for n in doc[key] if n["type"] == "component-internal")
202
209
 
203
210
  # refill: drop whatever the last build put there, deepest first
@@ -35,7 +35,7 @@ import sys
35
35
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
36
36
  import inline_html # noqa: E402
37
37
  from build_page import Surface, flatten # noqa: E402
38
- from fix_text_runs import documents # noqa: E402
38
+ from fix_text_runs import documents, extra_roots # noqa: E402
39
39
  from scan_inline_tags import scan # noqa: E402
40
40
  from sweep_node_types import Client, envelopes, exceptions_of # noqa: E402
41
41
 
@@ -133,6 +133,10 @@ def main():
133
133
  print(" skip %-40s (could not read)" % label)
134
134
  continue
135
135
  doc = resp["response"]
136
+ dup = extra_roots(doc.get(key) or [])
137
+ if dup:
138
+ print(" SKIP %-40s %d roots - fix the duplicate root first" % (label, len(dup)))
139
+ continue
136
140
  records, fixed, skipped = plan(doc.get(key) or [], surface)
137
141
  if not fixed and not skipped:
138
142
  continue
@@ -57,6 +57,24 @@ def documents(client):
57
57
  return out
58
58
 
59
59
 
60
+ ROOT_PARENTS = ("master", "template", "component", "componentDocument")
61
+
62
+
63
+ def extra_roots(nodes):
64
+ """Root nodes beyond the first in one document; empty when the document is sound.
65
+
66
+ A document has one root (`parentType` master / template / component). A second,
67
+ empty one makes Mosaic render from it, so every instance of a component prints
68
+ nothing, and the next master commit drops the overrides pointing at the real
69
+ tree. Measured on a live site on 1.0.11. Never write to such a document.
70
+ """
71
+ by = {}
72
+ for n in nodes:
73
+ if n.get("status") != "delete" and n.get("parentType") in ROOT_PARENTS:
74
+ by.setdefault(n["parentType"], []).append(n)
75
+ return [n for roots in by.values() if len(roots) > 1 for n in roots]
76
+
77
+
60
78
  def plan(nodes):
61
79
  """Revision records that wrap every misplaced run, and a count per parent type."""
62
80
  live = [n for n in nodes if n.get("status") != "delete"]
@@ -114,6 +132,10 @@ def main():
114
132
  print(" skip %-40s (could not read)" % label)
115
133
  continue
116
134
  doc = resp["response"]
135
+ dup = extra_roots(doc.get(key) or [])
136
+ if dup:
137
+ print(" SKIP %-40s %d roots - fix the duplicate root first" % (label, len(dup)))
138
+ continue
117
139
  records, counts = plan(doc.get(key) or [])
118
140
  if not counts:
119
141
  continue
@@ -25,7 +25,7 @@ import sys
25
25
 
26
26
  sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
27
27
  from build_page import PROSE_TAG # noqa: E402
28
- from fix_text_runs import documents # noqa: E402
28
+ from fix_text_runs import documents, extra_roots # noqa: E402
29
29
  from sweep_node_types import Client # noqa: E402
30
30
 
31
31
 
@@ -66,6 +66,10 @@ def main():
66
66
  if "_httperror" in resp or "response" not in resp:
67
67
  print(" skip %-40s (could not read)" % label)
68
68
  continue
69
+ dup = extra_roots(resp["response"].get(key) or [])
70
+ if dup:
71
+ print("WARNING %s has %d roots: %s" % (label, len(dup), ", ".join(
72
+ "%s(%s)" % (n["ID"][:8], n.get("ordering")) for n in dup)))
69
73
  hits = scan(resp["response"].get(key) or [])
70
74
  if not hits:
71
75
  continue