mosaic-headless 1.29.2 → 1.30.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.
package/README.md CHANGED
@@ -67,17 +67,29 @@ below runs only when Claude follows `SKILL.md` and you approve the command:
67
67
  - **`tools/*.php`** run inside your own WordPress through `wp eval-file`. They read
68
68
  and write Mosaic's own tables and theme data on that site.
69
69
  - **`tools/mint_session.php`** creates a logged-in WordPress session and a matching
70
- REST nonce for an account on *your* site. You put them in a local config file
71
- (`--config sweep.json`); they are printed to your terminal and sent nowhere else.
70
+ REST nonce for an account on *your* site. They are printed to your terminal and
71
+ sent nowhere else. **Nothing here goes looking for a credential on your machine** -
72
+ you supply the session, one of two ways:
73
+ - installed as a plugin, Claude Code prompts for `Mosaic site URL`,
74
+ `WordPress logged-in cookie` and `wp_rest nonce`. The two credentials are
75
+ declared `sensitive`, so they are masked on entry and kept in your platform's
76
+ credential store, not in `settings.json`. Export them for a tool run as
77
+ `MOSAIC_SITE_URL`, `MOSAIC_REST_COOKIE` and `MOSAIC_REST_NONCE`
78
+ - or put them in a JSON file of your own and pass `--config <file>`, which is what
79
+ the examples in the skill show
80
+ The environment wins over the file, and with the environment set no credential
81
+ needs to be written to disk at all.
72
82
  - **`tools/build_site.py`, `data_upgrade.py`, `theme_zip.py`, `probe_accordion.py` and the `sweep_*.py`
73
83
  tools** call Mosaic's REST routes on the site in that config file, with that
74
84
  session, to read and write pages, components and themes. They contact only that
75
85
  site.
76
86
  - **`tools/verify_*.py`** open pages of that same site with Playwright (Chromium) or
77
87
  `urllib` and compare what was delivered with what was written.
78
- - **`sites/`** holds the worked example (the author's own site) as data. Its design
79
- loads Google Fonts, so pages built from it make visitors' browsers fetch fonts from
80
- Google, as any page using Google Fonts does.
88
+ - **`sites/`** holds the worked example (the author's own site) as readable Python
89
+ modules. `python sites/_moksa.py` generates `sites/moksa.json` from them; the
90
+ generated file is not shipped. The design loads Google Fonts, so pages built from
91
+ it make visitors' browsers fetch fonts from Google, as any page using Google Fonts
92
+ does.
81
93
 
82
94
  The tools need Python 3 and Playwright. Nothing is downloaded at install time, and no
83
95
  data is sent to the author or any third party.
package/SKILL.md CHANGED
@@ -3,8 +3,10 @@ name: "mosaic-headless"
3
3
  description: |
4
4
  Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface with `mo.py`, which joins every source table to the live sweeps so a lookup leads with the measured verdict rather than the declaration (128 node types, 191 properties, 98 style properties with 20 structured value shapes pinned down, 53 style states, 156 variants, 74 dynamic variables, 15 interaction triggers, 115 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, the design-token and element-class layers verified against compiled CSS, the @VAR() dynamic language verified against rendered output, nine designed pages built through the tables themselves, and the delivered pages re-read in Chromium at three viewports so a rule that is present, correct and still wrong cannot pass. Drives Mosaic's own theme export/import and its plugin data upgrade from outside the editor and holds the copy against the source tree for tree. Measured on Mosaic Pro 1.0.9: the modal (`<dialog>`), OpenStreetMap, the exit-intent and scroll-depth triggers, run rules and the memory actions all built on a live page and read back, and the 1.0.7 -> 1.0.8 -> 1.0.9 migrations driven from outside wp-admin.
5
5
  license: "MIT"
6
- author: "moksa (https://moksaweb.com)"
7
- version: "1.29.2"
6
+ metadata:
7
+ author: "moksa (https://moksaweb.com)"
8
+ version: "1.30.0"
9
+ homepage: "https://github.com/Moksa1123/mosaic-headless"
8
10
  ---
9
11
 
10
12
  # Headless Mosaic
@@ -822,8 +824,41 @@ post — `build_all.py` resets first for that reason.
822
824
  | `copy_styles.py` | push one node's style onto others, by attrID or prefix |
823
825
  | `bootstrap_probe_theme.php` | a licence-free scratch theme |
824
826
  | `mint_session.php` | a matching cookie + `wp_rest` nonce from WP-CLI |
827
+ | `mosaic_config.py` | the one place a tool resolves the site URL and session - environment (`MOSAIC_SITE_URL` / `MOSAIC_REST_COOKIE` / `MOSAIC_REST_NONCE`) over `--config` file, so a credential never has to be written to disk |
825
828
  | `check_tables.py` | re-extract all eleven source-derived tables and diff them against the shipped ones - the check for a table that is not wrong but STALE, which nothing else can see |
826
829
 
830
+ ## The session, and where it comes from
831
+
832
+ Every tool that writes needs a site URL, a logged-in cookie and a matching
833
+ `wp_rest` nonce. **Never go looking for them on the user's machine** - not in a
834
+ browser profile, not in `wp-config.php`, not in a dotfile. Ask, or have the user
835
+ mint them:
836
+
837
+ ```bash
838
+ wp eval-file tools/mint_session.php # on the server, prints COOKIE= and NONCE=
839
+ ```
840
+
841
+ Then either export them, which keeps the credential off disk entirely:
842
+
843
+ ```bash
844
+ export MOSAIC_SITE_URL=https://example.com
845
+ export MOSAIC_REST_COOKIE='wordpress_logged_in_…=…'
846
+ export MOSAIC_REST_NONCE=0a0326da96
847
+ python tools/build_site.py --site sites/moksa.json
848
+ ```
849
+
850
+ or pass a JSON file the user wrote:
851
+
852
+ ```bash
853
+ python tools/build_site.py --config sweep.json --site sites/moksa.json
854
+ ```
855
+
856
+ `tools/mosaic_config.py` is the single place that resolves this, and the
857
+ environment wins over the file. Installed as a plugin, the three values are
858
+ `userConfig` options - the cookie and the nonce `sensitive: true`, so Claude Code
859
+ masks them and stores them in the platform credential store rather than in
860
+ `settings.json`.
861
+
827
862
  ## Regenerating everything
828
863
 
829
864
  ```bash
@@ -848,6 +883,10 @@ python tools/capture_live.py data/ # from data/raw/*.json +
848
883
  python tools/sweep_node_types.py --config sweep.json --setup
849
884
  python tools/sweep_node_types.py --config sweep.json --sweep --edition all
850
885
  python tools/sweep_properties.py --config sweep.json
886
+ # `sites/moksa.json` is GENERATED - the package ships the readable modules it
887
+ # comes from, not 2MB of built output. Regenerate it before anything reads it:
888
+ python sites/_moksa.py
889
+
851
890
  python tools/verify_rwd.py --config sweep.json --site sites/moksa.json --csv data/rwd-verification.csv
852
891
  python tools/verify_browser.py --config sweep.json --site sites/moksa.json \
853
892
  --csv data/browser-verification.csv --audit data/design-audit.csv
@@ -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, 98 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.29.2"
23
+ "version": "1.30.0"
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, 98 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.29.2"
23
+ "version": "1.30.0"
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, 98 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.29.2"
23
+ "version": "1.30.0"
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, 98 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.29.2"
23
+ "version": "1.30.0"
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, 98 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.29.2"
23
+ "version": "1.30.0"
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.29.2",
3
+ "version": "1.30.0",
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",
@@ -35,7 +35,14 @@
35
35
  "data/*.csv",
36
36
  "references/",
37
37
  "sites/_moksa.py",
38
- "sites/moksa.json",
38
+ "sites/_components.py",
39
+ "sites/_content.py",
40
+ "sites/_conversion.py",
41
+ "sites/_dialogs.py",
42
+ "sites/_dynamic.py",
43
+ "sites/_forms.py",
44
+ "sites/_sliders.py",
45
+ "sites/_tokens.py",
39
46
  "tools/*.py",
40
47
  "tools/*.php",
41
48
  "SKILL.md",
@@ -136,6 +136,7 @@ mechanical check reads what the spec declared and what the site actually served,
136
136
  compares them key by key:
137
137
 
138
138
  ```bash
139
+ python sites/_moksa.py # moksa.json is generated, not shipped
139
140
  python tools/verify_rwd.py --config sweep.json --site sites/moksa.json --csv rwd.csv
140
141
  ```
141
142
 
@@ -35,7 +35,11 @@ const pkg = JSON.parse(read("package.json"));
35
35
  const want = pkg.version;
36
36
 
37
37
  const skill = read("SKILL.md");
38
- const fmVersion = /^version:\s*"?([^"\n]+)"?\s*$/m.exec(skill.split("---")[1] || "");
38
+ // `version` sits under `metadata:`, hence the leading indent. The Agent Skills
39
+ // spec allows only allowed-tools / compatibility / description / license /
40
+ // metadata / name at the top level, and a stray `version` there does not get
41
+ // ignored - it fails the upload.
42
+ const fmVersion = /^\s+version:\s*"?([^"\n]+)"?\s*$/m.exec(skill.split("---")[1] || "");
39
43
  if (!fmVersion) fail("SKILL.md frontmatter has no version:");
40
44
  else if (fmVersion[1].trim() !== want)
41
45
  fail(`SKILL.md version ${fmVersion[1].trim()} != package.json ${want}`);
@@ -38,12 +38,13 @@ const head = skill.slice(0, end);
38
38
  const rest = skill.slice(end);
39
39
  // "already correct" and "line missing" are different answers, and conflating them
40
40
  // made this exit 1 on a release where the version happened to match already.
41
- const VERSION_LINE = /^version:\s*"?[^"\n]*"?\s*$/m;
41
+ // indented: it lives under `metadata:` (see check-release.mjs for why)
42
+ const VERSION_LINE = /^(\s+)version:\s*"?[^"\n]*"?\s*$/m;
42
43
  if (!VERSION_LINE.test(head)) {
43
44
  console.error("SKILL.md frontmatter has no version: line to update");
44
45
  process.exit(1);
45
46
  }
46
- const next = head.replace(VERSION_LINE, `version: "${v}"`);
47
+ const next = head.replace(VERSION_LINE, (_m, indent) => `${indent}version: "${v}"`);
47
48
  if (next !== head) {
48
49
  fs.writeFileSync(skillPath, next + rest);
49
50
  touched.push("SKILL.md");